From meh9 at cornell.edu Tue Apr 11 15:25:50 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Tue, 11 Apr 2000 15:25:50 -0400 Subject: Functions and objects Message-ID: Hi All, I'm confused. Take a look at the following: >>> def f(x): ... return [x] ... >>> a=f(5) >>> a [5] >>> for x in range(5): # Case A ... temp=a ... print a ... temp.append(1) ... [5] [5, 1] [5, 1, 1] [5, 1, 1, 1] [5, 1, 1, 1, 1] >>> a=f(5) >>> for x in range(5): # Case B ... temp=a[:] ... print a ... temp.append(1) ... [5] [5] [5] [5] [5] >>> In case A, why doesn't temp reset itself to the value of a, [5], that was predetermined before it entered the loop? Why do you need to copy the list to get the behavior I'm looking for in Case B? Doesn't a always equal [5]? Thanks for your help, Matt From rcunning at acm.org Mon Apr 10 08:16:08 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Mon, 10 Apr 2000 12:16:08 GMT Subject: Python paradigms References: <8cs70f$ojf$1@pegasus.csx.cam.ac.uk> Message-ID: <38F1C600.3FD9878B@acm.org> Nick Maclaren wrote: > In article , Oleg Broytmann writes: > |> On Mon, 10 Apr 2000, Robert W. Cunningham wrote: > |> > |> > Oleg Broytmann wrote: > |> > > > python's "and" and "or" operators doesn't evaluate the > |> > > > second argument unless they really have to... > |> > > > |> > > Yes, I missed that, sorry. > |> > > |> > So, it works just fine, right? > |> > |> No. Code is intended not only to beeing run on processor, but also (and > |> often more important) to beeing read by human. Code is speech, it is the > |> way to interchange ideas. > |> In that sense ugly code is not working even if you add three books of > |> comments. Code should be readable. Period. > > Yes, precisely. In the real world, programs often have long lifetimes, > are worked on by many programmers (in parallel and sequentially), are > sometimes transliterated between languages, and it is common to need > to modify code which was written 20 years ago by some long-retired > programmer. > > At best, confusing code wastes effort. At worst, it causes mistakes > to be introduced. I have seen the latter effect many times. > > That is why I was talking about the benefits of those paradigms for > code clarification, and neither efficiency nor compactness. Python > has some very useful facilities, but is a bit tedious for some kinds > of scripting. Again, comments in the code can cover all these bases. A good "paradigm" is a good thing to have, but it is no Holy Grail. It is but one step in the creation of a good program. If a sound and reliable implementation is possible, then the paradigm is probably a good fit. Paradigms that encourage "slow" or "fat" code merely to improve the self-expressiveness of the code is a dubious goal in practical terms, but certainly has value in abstract terms (i.e., to extract reusable patterns - patterns are *very* expressive). Have any of you ever had to port a product written in a "dead" computer language? I have, more than once. The comments were the ONLY thing to make the task possible, since even texts adequately documenting the old languages (especially the libraries) were extremely difficult to find. Many such languages seemed to have come into existence with the PDP-11 and the Intel 8080, and never migrated far from those platforms. At times, I was reduced to staring at assembler dumps to figure out what a line of supposedly "high-level code" was actually trying to do. And the code, I was told, had an excellent reputation for being "well written". It had merely gotten old, and the original authors had literally died. Human language, written well, is far more expressive than computer languages. That's why computer hardware and software is documented with books, and not in their "own" languages. Remember, code maintainers are also "users" of a product, and deserve to have the support of equal documentation. If the code could do it alone, I'd say go for it. But it cannot, and never will. To believe otherwise is sheer foolishness that displays a blatant ignorance of how the "real world" works. The greatest programmers of our age manage to include the equivalent of a "Rosetta Stone" in their work. It could be the Weave and Tangle of Knuth's "Literate Programming", or merely inline comments and a good set of design documents. But never bare code, all alone. Never. A single representation, no matter how elegant, cannot be sufficient. Unless, of course, you write code that will never need maintenance: never have a bug, never need a new feature, never have any other developer than yourself, and your code is used by nobody. In that case, sure, leave out the comments! Computer programming is far more than a form of communication between a programmer and a computer. It implicitly involves a virtual army of other people, users and maintainers chief among them. Remember, the goal of good communication is NOT "making it possible for another party to understand you". No, good communication is "making it DIFFICULT for another party to MISUNDERSTAND you". Which means, to be understood, you usually need to say a given thing more than once, in more than one way. Code is one way. Comments is another. They both (and more) are needed if the source code is to communicate effectively throughout time. At best, sound paradigms can simplify code and reduce the level of commenting needed, but can in no way eliminate the need for thorough commenting and other documentation. And the occasional efficient and effective (but(t) ugly) one-liner that saves significant processor time or lots of code deserves to be commented to death. And if you can't write good comments, how can you POSSIBLY believe you can write good code? -BobC From gmcm at hypernet.com Fri Apr 21 17:05:38 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 21 Apr 2000 17:05:38 -0400 Subject: The Simple Economics of Open Source In-Reply-To: Message-ID: <1255771356-36910442@hypernet.com> Robin Becker wrote: > In article <1255786824-35980039 at hypernet.com>, Gordon McMillan > writes > >Why does everyone miss the main point? > > > >I (and you) are literally 100s of times more productive because > >of open source. Imagine having to either invent it all yourself, > >or duct tape together expensive half-assed closed "solutions". > >Shudder. > > Developers who share code may actually do so for other than friendly > reasons. If M$ released win2000 source into the world it might actually > slow down Linux development. Doubt it. It would probably yield an emulation layer (c runtime lib) that worked. > I prefer not to worry about the exact electronics/chemistry behind my > computer. So in that sense my 'open sourceness' has limits. I guess this > argument has to do with the relative value 'developers' put on the > tools. On win32 VC++ is valuable; while gcc/egcs is really useful on > unices. What problems would you be solving without Python (TCL ...)? Remember the late 80s / early 90s when big companies were pushing 7 figure middleware that is now obsolete (thanks to internet technologies)? Remember when IBM truly believed the world would communicate through SNA? Remember when damn near any real app cost at least $10K? > > > >Developers who share code are *enormously* more productive > >than those who don't. So the range of problems that can be > >attacked increases geometrically, so computers penetrate > >new areas, so geeks stand a better chance of making a living. > > This is a competitive position to take. Geeks presumably compete with > non-geeks for resources. So? The article was about why developers like open source. Those wierd people with real lives didn't enter into it. > In addition the inter geek co-operation may actually be a form of > competition for other things like 'mindset' 'noosphere' etc. Painters > exchange ideas, concepts and criticism freely, but compete for > customers. Sure. And my competitive position is greatly enhanced vs those developers who rely on commercial products. I never used the word "altruism". I was just pointing out that the article and the initial responses there to completely missed what I see as the main benefit. In most cases, cooperation remains a good thing, whatever the motivation. > > > >Win-win situations are rarely profitably analyzed by > >competitive models. > Wrong! Non-zero sum games are widely studied in many areas of > mathematics, economics and control theory. Did you see any in that article? > Just because we can both win > doesn't mean we're not in competition. And just because we're in competition doesn't mean we should shoot each other . > Win-Win games tend not to be so > stable as minimal-loss minimal-loss (Nash) games and for that reason are > of less interest. It requires a constant flow of information (co- > operation) to achieve best-best so that is rarely achieved or sustained. > > Win-Win for the group of geeks is a sub-game in the wider community. As > a group the geeks strive to turn their knowledge into something useful > to get income. It may be that inter geek co-operation aids the group as > a whole; certainly that cannot be simply asserted as there exists a > large number of geeks who work only for $/? and who co-operate with the > prince of darkness in Seattle. I don't believe any comparative study of > commercial vs opensourcerer geeks has yet been carried out to see which > group does better. It doesn't take a comparative study for me to know that, despite having an NT box and MSVC etc., I do 90% of what I do with open source stuff. Whether mankind is inherently selfish and evil is another question. i-think-they're-just-sleeping-ly y'rs - Gordon From artswan at ktc.com Wed Apr 5 12:33:03 2000 From: artswan at ktc.com (Art Swan) Date: Wed, 5 Apr 2000 11:33:03 -0500 Subject: Clear screen? Message-ID: <38eb6a36@207.71.36.3> In Perl I can clear the screen using system("cls"). What is the equivalent in Python? From aahz at netcom.com Sun Apr 2 12:53:19 2000 From: aahz at netcom.com (Aahz Maruch) Date: 2 Apr 2000 16:53:19 GMT Subject: Paid to work in Python? (was: Re: Choice Of Language) References: <8ajmib$elo$1@nnrp1.deja.com> <8c3ats$b5f$1@nntp.Stanford.EDU> Message-ID: <8c7ttv$ge7$1@slb2.atl.mindspring.net> In article , Grant Edwards wrote: > >Pointless tanget: Is it just me, or is Google really the last usable search >engine? I still use Yahoo! as a backup for Google, but yeah. I never did think AltaVista was usable, nor NorthernLight, Lycos, or Hotbot. Infoseek was pretty good for a long time, but it's gone downhill and I'm not sure why; I suspect it simply isn't scaling. -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of cigarettes, it's dark, and we're wearing sunglasses." "Hit it." From milesthompson at sprint.ca Thu Apr 20 16:51:46 2000 From: milesthompson at sprint.ca (Miles Thompson) Date: Thu, 20 Apr 2000 17:51:46 -0300 Subject: How2 use curses for data input Message-ID: <38FF6DE2.5751423A@sprint.ca> I 've read the curses part of the manual, and the HOWTO, but I'm not much wiser. I need to capture some user input (name of a new directory for archiving some web files), and I understand how to define a window, etc. What I don't know to do is how to edit the lines, and loop from last to first. In FoxPro/dBase one could issue @ 5,10 say "Source file:" @ 5, 23 get csource @ 6,10 say "Destination:" @ 6,23 get cDestination READ CYCLE and the user could loop around the fields until a (not displayed here) OK button was clicked on. Can the same thing be done with curses and Python, or do all the movement keys, etc. have to be trapped and the correct movement of the cursor applied? I know this seems a bit antedeluvian in an age of GUI's, but the box is a web server, I don't want to run X, and it's a very simple task. I would like the user to be able to look at what's been typed in before commiting to doing it. Regards - Miles Thompson milesthompson at sprint.ca From gmcm at hypernet.com Fri Apr 7 14:05:44 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 7 Apr 2000 14:05:44 -0400 Subject: Compile Gadfly? In-Reply-To: Message-ID: <1256991746-21080406@hypernet.com> Warren Postma wrote: > Has anyone tried compiling Gadfly and 'embedding' it into an executable, for > easier distribution? Does it work!? Yup. The only trick is putting the marshalled grammar file where the app will find it. - Gordon From aa8vb at yahoo.com Wed Apr 12 11:29:35 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 12 Apr 2000 11:29:35 -0400 Subject: comparing strings and ints In-Reply-To: References: <2YmI4.366$rc9.188014080@newsb.telia.net> <20000411134358.A2352304@vislab.epa.gov> <1256641282-42160637@hypernet.com> <20000412075812.A2449004@vislab.epa.gov> Message-ID: <20000412112935.A2446939@vislab.epa.gov> Fredrik Lundh: |Randall Hopper: |>Gordon McMillan: |> |Randall Hopper wrote: |> |> Fredrik Lundh: |> |> | |> |> | Objects of different types always compare unequal, and are |> |> | ordered consistently but arbitrarily. |> |> |> |> Is there a case where this could be useful (with its undefined |> |> behavior)? I believe that is the root of the question. |> | |> |I'd happily bet your wife and firstborn child that there's code that |> |relies on it , if only because after sorting a list, all the ints |> |will end up in a clump, and all the strings in another, etc. |> |>Oh, I also have __no doubt__ that someone is using this unofficial, |>undocumented behavior. But they don't have a leg to stand on if the |>ordering breaks in a future Python version ;-) | |interestingly enough, you included my documentation quote in |a post claiming that this is an undocumented feature... I was of course referring to the behavior Gordon McMillan mentioned in the message I replied to. Namely, that sorting a list of objects of hetrogenous primitive types "groups" the instances of a particular type together (ints together, strings together, etc.). I'm taking Gordon's word that that's what it does. The documentation you cited simply said "arbitrary" ordering. Unless it's documented as official behavior, I would think that expecting it is probably not a safe bet. -- Randall Hopper aa8vb at yahoo.com From P.J.W.S.VRIJLANDT at INT.azg.nl Wed Apr 19 04:39:35 2000 From: P.J.W.S.VRIJLANDT at INT.azg.nl (P.J.W.S. Vrijlandt) Date: Wed, 19 Apr 2000 09:39:35 +0100 Subject: Telnet client using curses In-Reply-To: <8dj02n$61k$1@kryogenix.yi.org> Message-ID: <1E0DE27726A@nds-3.azg.nl> On 19 Apr 00 at 1:53, Aquarius wrote: > Having used Python for a few brief scripts (the sort of thing I used > to use Perl for :), I thought I'd try something a bit more > ambitious, to teach myself the language. What I decided on, because > I need one, is a telnet client. The key thing is that I'd like to > use curses to give me one input line into which text it typed, while > data returned from the connection goes into the window above. > Something like TinyFugue. > > Looking at telnetlib, it uses select to poll stdin. However, I'll be > getting user input using curses input functions, not input() or > raw_input(), so the user input doesn't go into stdin. Is the best > way to handle this: 1. get user input with the curses function and > then somehow slip this input into stdin, so it looks like it came > from raw_input() or whatever? Obviously, raw_input() gets its data > into stdin, but it's a built-in function, so I don't know how it > does it :-) 2. write a file object which I feed data *into* from the > curses input function, and which then feeds that data back out when > requested to do so, and poll *that* instead of stdin? 3. A better > solution? > > If your answer is "3", some kind of suggestion as to the Right Way > to do it would be appreciated :-) > > Aquarius > > -- > Well *done*, Aquarius -- a phrase we love typing because it makes us > feel like the boss-character from a 1980s Glen A Larson action > series... > NTK, > http://www.ntk.net/index.cgi?back=archive99/now0618.txt&line=292#l > > -- > http://www.python.org/mailman/listinfo/python-list I would opt for "3". The Right Thing (tm) requires rewriting/modifying of telnetlib in order to seperate the terminal functions from the protocol handling, like it was intended in de rfc. I have done such a thing and I will mail it to you privately when I'm home (it's not ready for publication). You then get a TTY object with read and write methods and you can use it as you like. On windows, you can't use select with stdin and you have to use seperate threads for input and output to get an elegant solution. The elegance of this solution is that you don't have to modify telnetlib again if you want to write logfiles or implement a terminal that uses another gui instead of curses. Patrick Vrijlandt From rhicks at nospam.rma.edu Sat Apr 1 14:28:16 2000 From: rhicks at nospam.rma.edu (Robert Hicks) Date: Sat, 01 Apr 2000 19:28:16 GMT Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com> <38E58D2D.384F1546@Lugoj.Com> <38E646B6.12011A4E@Lugoj.Com> Message-ID: > James Logajan wrote: > The benefit/pain ratio for by this change is close to zero. I am sure that this will be thorougly thought out before the official release of v1.6. > Well then I hope it gets changed due to those polite requests. Hopefully > that old extra code can be patched back in. same answer as previous > now how come I find your "guido the god" argument to be > directly offensive? > > Because it was meant to be. Glad to see it worked! The motivation for it was > because even though Bjorn directed his post to Guido, you and one or two > others responded. Almost like high priests guarding the temple. Any reason > Guido doesn't post to this newsgroup like he used to? Why would you possibly want to offend someone, whoever they are, with a blatantly attacking statement? Why does it matter WHO gives the answers as long as the answer is well thought out and correct? I for one am hoping that Guido is working hard on the 1.6 release. Mr. Lundh has always actively participated in this newsgroup and I appreciate his time for doing so. I wonder if someone in the perl group ever said "Larry Wall the god" to make anyone upset? If so, then Guido stands in good company. Bob From hamish_lawson at yahoo.co.uk Mon Apr 10 17:08:14 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Mon, 10 Apr 2000 14:08:14 -0700 Subject: indexed dictionaries? References: <8cta0u$2bg$2@eeyore.INS.CWRU.Edu> Message-ID: <0062c1d4.5891a1da@usw-ex0104-033.remarq.com> Opening up the Vaults of Parnassus we find the seqdict package: http://www.vex.net/parnassus/apyllo.py/514463245.769244789.833538 28 Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From mjhand at concentric.net Fri Apr 14 16:55:30 2000 From: mjhand at concentric.net (Manus Hand) Date: Fri, 14 Apr 2000 14:55:30 -0600 Subject: Questions on 1.6a2's string methods References: <38F6C904.76B538E5@concentric.net> <38F7598E.97A07412@aw.sgi.com> Message-ID: <38F785C2.7087957C@concentric.net> Thanks, Gary! "".title() was exactly what I was hoping for! Manus From johngrayson at home.com Sun Apr 23 16:07:18 2000 From: johngrayson at home.com (johngrayson at home.com) Date: Sun, 23 Apr 2000 20:07:18 GMT Subject: Radio-button in Tkinter References: <39028096.24B972B4@swt.edu> Message-ID: <8dvl5e$ff7$1@nnrp1.deja.com> In article <39028096.24B972B4 at swt.edu>, ns56645 wrote: > > --------------834CABF3AAE289AC3BC56CC4 > Content-Type: text/plain; charset=us-ascii > Content-Transfer-Encoding: 7bit > > In the following code the radiobuttons that have been set are not seen > as default selected in the output. > For e.g v1.set(3) # initialize should set the radiobutton with > text 'BOTH' as default. > > What could be the wrong with the code? > Please help? > > Shah > Nothing is wrong. I tried your code in a little harness and it worked correctly. 'BOTH' was selected for each radiobutton group. Changing the variable to 1 or 2 for v1 and 11 or 12 for v2 selected the corresponding button. What is it that you're expecting the widgets to do? John Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Sat Apr 15 07:27:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 15 Apr 2000 11:27:39 GMT Subject: General question of "SystemError:NULL result..." References: <8d9645$fsa$1@nnrp1.deja.com> Message-ID: gmol at my-deja.com wrote: > Hi all, disclaimer, I am new to python so I may be doing something > severly stupid. unless you've written the extension module, it's not really your fault... read on. > I have installed VTK and python on my sys,and some of the python > examples work, and some don't...the ones that don't say always say > something like: > > File "KSpline.py", line 106, in ? > profileTubes.SetInput(profileData) > SystemError: NULL result without error in call_object > > Now, no one has been able to figure this out on the VTK list...but I do > know that people can run the same examples on the same python under the > same platform (linux) and the same Mesa... technically, this means that an extension library returns NULL to Python, without setting the exception status. it's a bug in the extension library. (it's probably caused by a configuration problem of some kind, but the library should tell you so, rather than returning bogus values to the python interpreter...) From dln at jump.net Wed Apr 19 13:39:46 2000 From: dln at jump.net (Dick Norton) Date: Wed, 19 Apr 2000 12:39:46 -0500 Subject: need non-blocking keyboard read on dos - like kbhit? Message-ID: <38FDEF62.92171124@jump.net> Hello, I've gotten pydos.zip from http://www.python.org/ftp/python/wpy/dos.html and it runs but I need either threads (these seem absent) or a non-blocking keyboard char in routine to return an otherwise unsed thinkpad back to some level of dignity as a shop timer. Is there a routine like kbhit without msvcrt (dos, not windows)? Thanks, Dick Norton From bozon at natur.cuni.cz Tue Apr 11 11:40:59 2000 From: bozon at natur.cuni.cz (Michal Bozon) Date: Tue, 11 Apr 2000 17:40:59 +0200 Subject: starship.python.net In-Reply-To: References: Message-ID: > What the hell is with the starship.python.net server? Today and yesterday > I cannont connect (from Czech Republic). > Someone knows? > > Michal Bozon > Just after I posted this message I tried connection again, and it is OK. MB From somaking at yoyo.cc.monash.edu.au Sun Apr 23 23:28:45 2000 From: somaking at yoyo.cc.monash.edu.au (Linus Chang) Date: Mon, 24 Apr 2000 13:28:45 +1000 (EST) Subject: dbm string lengths Message-ID: Hi all, I'm trying to use anydbm to store potentially long strings, and am running into problems which seem to be caused by the length of the strings. (The Python Ref Manual sec 3.11 on Shelve mentions that the length of pickled objects should be small - how small?) eg. the following code fragment: import anydbm import cPickle db = anydbm.open("testingdb", "c") print "Keys in db are: ", for k in db.keys(): print k, list = [] for x in range(10000): list.append("Item number " + `x`) db["item"] = cPickle.dumps(list) db.sync() db["item"] = "Small string" db.sync() -- Run the first time (no testingdb file exists), output as expected: D:\Program Files\Python>python dbtest.py Keys in db are: -- Run a second time, the name of the key gets confused: D:\Program Files\Python>python dbtest.py Keys in db are: itemm (Changing the list to say a length of 10 yields results as expected.) Alternatively, removing the line db["item"] = "Small string" causes the following output on the second run: D:\Program Files\Python>python dbtest.py Keys in db are: Traceback (innermost last): File "dbtest.py", line 8, in ? for k in db.keys(): bsddb.error: (22, 'Invalid argument') -- Can anyone please help? I'm trying to store potentially long strings in a dictionary, and need to store them to disk. I expect that entries will be updated at up to 20 per second, so it's not really feasible to pickle the whole dictionary to disk every time an individual entry is updated. In addition, saving to disk asynchronously (eg. every X seconds) really isn't my preference... Thanks in advance, Linus Chang From exarkun at flashmail.com Thu Apr 27 12:41:37 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Thu, 27 Apr 2000 16:41:37 +0000 Subject: Converting = to == References: Message-ID: <39086DC1.E2699CDE@flashmail.com> Warren Postma wrote: > > I have an "end user query tool" that uses Python expressions, but I want > comparisons to be able to be written either as A=B or A==B then I want to > compare them using Python's Eval function. > > Problem is if you search and replace all = with == then users have to use > the single-equals convention, and some of them will be python programmers, > and will want to use the "non idiot mode" of the query tool. > > So i did this, but is there a better way? > > >>> string.replace( string.replace("a=b a==b", "=", "=="), "====","==") > a==b a==b > > Warren You can use regular expressions. I'm not going to try to give you the exact one off hand, because I'll get it wrong, but basically replace "[anything-but-equals]=[anything-but-equals]" with "[first part]==[second part]" -- -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS dpu>-- s+: a--- 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------ -- 4:40pm up 29 days, 21:47, 0 users, load average: 0.11, 0.07, 0.01 From bawolk at pacbell.net Thu Apr 6 01:43:02 2000 From: bawolk at pacbell.net (Bruce Wolk) Date: Wed, 05 Apr 2000 22:43:02 -0700 Subject: Widget for plotting graphs? Message-ID: <38EC23E6.9975FD7D@pacbell.net> I am exploring Tkinter and Pmw and wondering whether anyone has created a widget for graphing points and functions. Also, is there a way to place one pixel (i.e., a point) on a Canvas widget? Thanks. Bruce From rgb122 at my-deja.com Thu Apr 6 15:07:14 2000 From: rgb122 at my-deja.com (rgb122 at my-deja.com) Date: Thu, 06 Apr 2000 19:07:14 GMT Subject: Problem calling COM Object written in Python Message-ID: <8cin8n$dhk$1@nnrp1.deja.com> I have a COM object I wrote in Python that needs to be called from an ASP script (VBScript). I can create the object just fine, but then when I try to call a method on it: Python COM Server Internal Error error '80004005' Unexpected Python Error: exceptions.TypeError: Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object. The COM object is a pretty simple wrapper for a Python class. It's got one factory method that takes a string as a parameter import Publisher class PublisherCOM: _public_methods_ = ['loadSite'] _reg_progid_ = "ECS.Publisher" _reg_clsid_ = "{5E633A5D-D0BA-40A4-B30D-54F7B29CCD23}" def loadSite (self, filename): print "I'm here\n" print str(filename) site = Publisher.loadSite(str(filename)) return site The PythonWin Trace Collector gives this friendly output: Object with win32trace dispatcher created (object=None) in _GetDispID_ with LoadSite 8 in _InvokeEx_ with 1000 1033L 3 (L'D:\\rbender\\Desktop\\pyTemplate\\brands.xml',) None Is there some sort of problem passing the string as a parameter? I'm running this under Win2000, so perhaps there's a lovely new "feature" that's cropped up. Any and all help is much appreciated. Thanks! -Rob Bender Sent via Deja.com http://www.deja.com/ Before you buy. From hamish_lawson at yahoo.co.uk Sat Apr 1 16:41:49 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Sat, 01 Apr 2000 13:41:49 -0800 Subject: Why should I switch to Python? References: <00033120055300.03687@quadra.teleo.net> Message-ID: <170a3a86.966ca715@usw-ex0102-014.remarq.com> Hi Aaron Here are the reasons I switched to Python. I had used Perl for several years and I think I had gotten to quite an advanced stage with it. However what convinced me to switch to Python was the recurring difficulties I saw my less- experienced colleagues having with things like references and other dark corners of Perl. Sure, it would have been much harder to use C or C++ for the kinds of things we were using Perl for, but I felt that the continual taking of references and dereferencing was still too much like C's pointer hassle. In Python, since all variables hold references, references can be transparently handled. Compare this in Perl: @people = ('Joe', 'Pat', 'Sue'); @stuff = (5, \@people, 7); dosomething(\@stuff); print $people[2] with this in Python (square brackets are used to make lists): people = ['Joe', 'Pat', 'Sue'] stuff = [5, people, 7] dosomething(stuff) print people[2] The first line of the Perl version causes @people to contain a list, but in the Python version it causes the people variable to hold a *reference* to the list. A great deal of simplification follows on from that. Or take another example, adapted from 'Programming Perl' (I know my use of printf here isn't entirely idiomatic in Perl, but I'm trying to make that aspect look as much like Python in order to highlight the actual comparison I'm making): foreach $family (keys %TV) { printf "Family: %s", $family; foreach $who (@{$TV{$family}{'members'}}) { printf "%s (%s)\n", $who->{'name'}, $who->{'role'}; } } I found it much easier to explain to my less-experienced colleagues the Python version below: for family in TV.keys(): print "Family: %s" % family for who in TV[family]['members']: print "%s (%s)" % (who['name'], who['role']) Neither "who" or "TV[family]['members']" needed to be explicitly dereferenced. I also found Python's handling of OO more elegant and explicable: class MyClass(AnotherClass): def __init__(self, name): self.name = name def greet(self): print "Hi, I'm", self.name m = MyClass('Bob') m.greet() compared to this: package MyClass; @ISA = ('AnotherClass'); sub new { ($class, $name) = @_; $self = {}; bless $self, $class; $self->{'name'} = $name; return $self; } sub greet { ($self) = @_; print "Hi, I'm ", $self->{'name'}, "\n"; } $a = MyClass->new('Bob'); $a->greet(); Once I switched to Python I found other gems in the everything- is-an-object philosophy: even modules (packages in Perl) and classes are objects, so you can do things like this: try: import optional_fast_native_stuffmodule stuffmodule = optional_fast_native_stuffmodule except ImportError: import standard_slow_portable_stuffmodule stuffmodule = standard_slow_portable_stuffmodule stuffmodule.dostuff() So while there may not be many things that you can do in Python can't in Perl (but treating classes and modules as objects and reflection would be among them), I found that the real advantage of Python is that most things will be simpler and more understandable. This makes it so much easier when working with others or when revisiting my code months later. Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From effbot at telia.com Wed Apr 26 16:42:11 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 26 Apr 2000 20:42:11 GMT Subject: newbie regexp question References: <39075648.CA622A7D@imeme.net> Message-ID: mindlace wrote: > I've got a re.compile('\W') that I can use to search for non-alphanumeric > characters in a variable. However, if the variable has ( in it, for example, > the search breaks. breaks? > is there a quoted_var = string.quote(somevar) or similar? Do I want to > use string.maketrans(somevar, quoted_var) ? have no idea what you're talking about here, but maybe re.escape does what you wants? >>> import re >>> print re.escape.__doc__ Escape all non-alphanumeric characters in pattern. >>> print re.escape("(") \( From m.faassen at vet.uu.nl Fri Apr 21 15:15:59 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 21 Apr 2000 19:15:59 GMT Subject: Using python on the web References: <8di2bk$l1s$1@newshost.accu.uu.nl> <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> <9N4L4.499$wYl.191816704@newsb.telia.net> <8do2te$kpr$1@nnrp1.deja.com> Message-ID: <8dq9df$pjg$1@newshost.accu.uu.nl> spenrose at my-deja.com wrote: > We build medium-busy, CGI-intensive sites in Python. We were briefly > quite excited about Zope, but once we realized it locked us into Yet > Another Programming Language, we lost interest. DHTML is particularly > problematic, AFAI can tell, because it doesn't appear to allow the > segregation of HTML development from coding the way Python string > substitution does. We hire very skilled HTML people to do HTML and tell > them to leave our sustitution tags alone, rather than taking the time > and money to create novice DHTML people to do the same work. If I understand you right, you seem to be incorrect about Zope. I've worked together with a HTML designer and he had no trouble with DTML tags. You can also tell the designer to leave the DTML tags alone, though usually you just factor out pieces of HTML into fragments, so your designer isn't even going to see much of DTML beyond the occasional tag. > If we were > going to learn another language for production purposes, Perl, Java, and > C++ all have vastly larger infrastructures (code bases, labor pools, > documentation, etc.) than DHTML ever will. Note: DTML is named confusingly, and has nothing to do with DHTML. And I'd just like to see a comparable infrastructure to Zope in Perl or C++. *Maybe* Java. DTML should be used as a glue language. Real code should be moved to Python products. Currently in Zope this is more of a hassle than it needs to be, but there are already PythonMethods which you can edit through the web (which you can install seperately). Use minor amounts of DTML only! (or do away with DTML completely and just use ZPublisher to publish Python objects) > There are enough hassles in > using Python, which I love, because of its relatively small installed > base. No way am I going to something which is an order of magnitude less > supported. That's your choice, of course. I don't think Zope is badly supported, myself. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From anders.eriksson at morateknikutveckling.se Mon Apr 3 04:23:46 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 03 Apr 2000 10:23:46 +0200 Subject: examples for HTMLgen References: <14564.28003.931035.44380@gargle.gargle.HOWL> Message-ID: <60kgesct0e4arv70qgbch9telqpc3tu3qc@4ax.com> On Fri, 31 Mar 2000 18:18:27 +0900 (JST), Christian Stolte wrote: > >I'd like to web-present a file structure (=pseudo database) in different sort >orders with info and pics, nice and webby. > >a. project view - split frame left: all projs to select from > right: detailed info with short descr, > pics etc >b. data view - split frame left: grouped data to select from > right: detailed info with project information > >I know there is Zope, but that's too much. So what about picking the files >into a directory like list, then sort that list in different ways and >display it with HTMLGen??? > I would use os.listdir() to create a list of files and then sort it the way I want it. If you have several 'levels' of subdirectories you want to look up os.path.walk() Using the Table class in HTMLgen you just use the list of files and create a table which you then can insert into your HTML page using TemplateDocument The only example that I have found (.although I haven't look very hard.) is the HTMLtest.py. Here you will find alot of things! // Anders From tim_one at email.msn.com Sat Apr 1 00:29:02 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 1 Apr 2000 00:29:02 -0500 Subject: Function override? In-Reply-To: <38E4D7A4.4C83CFF7@math.okstate.edu> Message-ID: <000101bf9b9b$312f8fe0$2f2d153f@tim> [David C. Ullrich] > ... > This is certainly one of the things that _I_ find keen, > amyway - I hope the people who are talking about adding > stricter typing to Python make it optional somehow. Yup, not to worry. All proposals to date make static typing declarations optional, and by default not needed. It may be that the choice will apply to entire modules, though (that is, that if you want to use static declarations in one part of a module, you'll need to use it everywhere in that module; other modules make their own choices). > There are obvious advantages to stricter typing but you lose > something as well. (For example, I get a big kick out of > the fact that exactly the same euclidean-algorithm code > works to find the GCD of two integers or the GCD of > two polynomials. Etc.) This isn't a problem with static typing per se, provided the system is rich enough to let you define a suitable EuclideanDomain type. The system is not rich enough today, but people throughout this industry hold a charming faith that tomorrow's solutions won't suffer today's problems . just-a-fan-of-the-illusion-of-progress-ly y'rs - tim From lewst at yahoo.com Wed Apr 5 00:58:55 2000 From: lewst at yahoo.com (lewst) Date: Tue, 4 Apr 2000 21:58:55 -0700 (PDT) Subject: Starving for an Advanced Python Book Message-ID: <20000405045855.26682.qmail@web2101.mail.yahoo.com> Jeff Bauer wrote: > I would second Bjorn's recommendation. It's a useful > book for anyone who writes Python code and wants quick > access to library examples. Thanks Jeff and Bjorn, now I want the book even more. > That said, the electronic distribution mechanism > will try your patience. When you get it to work, > the first thing you'll want to do is follow Bjorn's > advice and print it. Yes, even though I won't get to install it on the workstation of my choice (Grr..), I think I'll try to find some way to get the book printed. > purchasing-the-book-is-like-taking-a-test-but-it's- > all-downhill-from-there-ly y'rs, This is off-topic, but what is with this funky way of signing articles? I've now seen many people do this on the Python list but am not quite getting it. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From jcmllc at earthlink.net Sat Apr 15 12:35:41 2000 From: jcmllc at earthlink.net (Pepper-Emporium) Date: Sat, 15 Apr 2000 09:35:41 -0700 Subject: (no subject) Message-ID: <001f01bfa6f8$b05dc9e0$69ee85ce@default> PLEASE HELP: I'm getting irate e-mails from people on my list indicating that when ever they send a message is bounces back to them instead of me. My list is called "hotlist" and I have about 27,000 members. I want to REMOVE ALL the members and start with a clean slate. Whenever I try to login to MAILMAN I get the following error message: Bug in Mailman version 2.0beta2 We're sorry, we hit a bug! If you would like to help us identify the problem, please email a copy of this page to the webmaster for this site with a description of what happened. Thanks! Traceback: Traceback (innermost last): File "/usr/local/mailman/scripts/driver", line 89, in run_main main() File "/usr/local/mailman/Mailman/Cgi/admin.py", line 68, in main mlist = MailList.MailList(listname) File "/usr/local/mailman/Mailman/MailList.py", line 69, in __init__ self.Load() File "/usr/local/mailman/Mailman/MailList.py", line 858, in Load self.Lock() File "/usr/local/mailman/Mailman/MailList.py", line 1300, in Lock self.__lock.lock() File "/usr/local/mailman/Mailman/LockFile.py", line 209, in lock os.link(self.__lockfile, self.__tmpfname) OSError: [Errno 28] No space left on device -------------------------------------------------------------------------------- Python information: Variable Value sys.version 1.5.2 (#1, Jan 20 2000, 22:40:08) [GCC 2.8.1] sys.executable /usr/local/bin/python sys.prefix /usr/local sys.exec_prefix /usr/local sys.path /usr/local sys.platform sunos5 -------------------------------------------------------------------------------- Environment variables: Variable Value DOCUMENT_ROOT /home3/awdesigns/public_html SERVER_ADDR 209.40.121.211 HTTP_ACCEPT_ENCODING gzip, deflate SERVER_PORT 80 PATH_TRANSLATED /home3/awdesigns/public_html/hotlist REMOTE_ADDR 206.133.238.105 HTTP_ACCEPT_LANGUAGE en-us GATEWAY_INTERFACE CGI/1.1 SERVER_NAME awdesigns.com TZ US/Eastern HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 4.01; Windows 95) HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, */* REQUEST_URI /mailman/admin/hotlist PATH /usr/sbin:/usr/bin QUERY_STRING SCRIPT_FILENAME /usr/local/mailman/cgi-bin/admin PATH_INFO /hotlist HTTP_HOST www.a-webdesigns.com REQUEST_METHOD GET SERVER_SIGNATURE Apache/1.3.12 Server at awdesigns.com Port 80 SCRIPT_NAME /mailman/admin SERVER_ADMIN webmaster at awdesigns.com SERVER_SOFTWARE Apache/1.3.12 (Unix) ApacheJServ/1.1.1b1 PHP/3.0.14 FrontPage/4.0.4.3 mod_ssl/2.6.2 OpenSSL/0.9.5 PYTHONPATH /usr/local/mailman REMOTE_PORT 1390 SERVER_PROTOCOL HTTP/1.1 HTTP_CONNECTION Keep-Alive -------------- next part -------------- An HTML attachment was scrubbed... URL: From fig at oreilly.com Wed Apr 19 11:15:00 2000 From: fig at oreilly.com (Stephen R. Figgins) Date: Wed, 19 Apr 2000 15:15:00 GMT Subject: Writing for the python devcenter References: <38FCF25E.4D945D81@oreilly.com> Message-ID: <38FDCD2B.3CCB4A84@oreilly.com> Robert Hicks wrote: > > Do I write an article and then just email it to you? > > Bob It would be best if you checked in with me first. I would hate to have you spend all that effort for something I might reject. Send me an outline of what you want to do. If I like it, we will talk about when you can deliver it and I will get you contract. I haven't got author's guidelines for the network up yet (for some reason it keeps slipping down my to do list) but you should take a look at the author's guidelines at WebReview: http://www.webreview.com/pub/universal/authorguide.html The audience isn't exactly the same but the information on writing for the web is dead on. Stephen Figgins fig at oreilly.com From dgreen at kryten.kitenet.net Wed Apr 5 00:07:13 2000 From: dgreen at kryten.kitenet.net (Dan Green) Date: Wed, 05 Apr 2000 04:07:13 GMT Subject: ASP web-type stuff Message-ID: Ahoy, folks. I was looking over things like Embperl and Apache::ASP and liked the idea. I would like the idea more if I could do with python. So I had a couple of questions: Is there such a thing? Is there interest in such a thing? Does anbody want to hear about my 75 lines of code hack that basically does the trick, but needs a lot of work? If nobody cares at all, I'll just shut up and go home. :) For those of you who have no idea what I'm talking about, it's basically an alternative to CGI that allows you to embed the code right into the HTML. something like this: <% for i in range(5): %> Loop item <%= i %>
would look like this when called from a browser: Loop item 1
Loop item 2
Loop item 3
Loop item 4
Loop item 5
Let me know. If you're interested, please e-mail me. -- Dan Green | "So What? It's your problem to learn to live with, Developer | destroy us, or make us saints." Rewind Technologies | -- Ministry, "So What?" From mal at lemburg.com Wed Apr 26 14:01:48 2000 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed, 26 Apr 2000 20:01:48 +0200 Subject: [Python-Dev] Re: Python 1.6a2 Unicode bug (was Re: comparing strings and ints) References: Message-ID: <39072F0C.5214E339@lemburg.com> Just van Rossum wrote: > > I wrote: > >A utf-8-encoded 8-bit string in Python is *not* a string, but a "ByteArray". > > Another way of putting this is: > - utf-8 in an 8-bit string is to a unicode string what a pickle is to an > object. > - defaulting to utf-8 upon coercing is like implicitly trying to unpickle > an 8-bit string when comparing it to an instance. Bad idea. > > Defaulting to Latin-1 is the only logical choice, no matter how > western-culture-centric this may seem. Please note that the support for mixing strings and Unicode objects is really only there to aid porting applications to Unicode. New code should use Unicode directly and apply all needed conversions explicitly using one of the many ways to encode or decode Unicode data. The auto-conversions are only there to help out and provide some convenience. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From nascheme at enme.ucalgary.ca Mon Apr 3 21:38:41 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: 4 Apr 2000 01:38:41 -0000 Subject: [Python-Dev] New Features in Python 1.6 In-Reply-To: <20000403165621.A9955@cnri.reston.va.us> References: <200004011740.MAA04675@eric.cnri.reston.va.us> <200004031604.MAA05283@eric.cnri.reston.va.us> <20000403165621.A9955@cnri.reston.va.us> Message-ID: <20000404013841.15629.qmail@cranky.arctrix.com> In comp.lang.python, you wrote: >You people are *so* gullible! ;-) Well done. You had me going for a while. You had just enough truth in there. Guido releasing the alpha at that time helped your cause as well. Neil -- Tact is the ability to tell a man he has an open mind when he has a hole in his head. From alwagner at tcac.net Thu Apr 13 13:03:48 2000 From: alwagner at tcac.net (Albert Wagner) Date: Thu, 13 Apr 2000 12:03:48 -0500 Subject: Doesn't anybody write to paper anymore? Message-ID: <38F5FDF3.EE2FBA01@tcac.net> I've searched the docs and my "Learning Python" book and I can't find anything on printing to a real printer. Through trial and error I finally made the following work: printer = open('/dev/lp0', 'w') printer.write("page 1\n\r\f") printer.write("page 2\n\r\f") printer.close But it writes directly to the printer port. I would like to pass it into the queue. IO redirection in the shell is ugly and awkward. Also, assigning "printer" to "os.stdout" does not work. Someone please help a newbie. -- Small is Beautiful From warlock at eskimo.com Tue Apr 4 01:14:07 2000 From: warlock at eskimo.com (Jim Richardson) Date: Tue, 04 Apr 2000 05:14:07 GMT Subject: Advice requested: GUI project beginning References: Message-ID: On Fri, 31 Mar 2000 09:23:47 +0200, Christian Tanzer, in the persona of , brought forth the following words...: > >"Russell E. Owen" wrote: > >> I am starting work on a telescope remote control user interface. It's a >> big program with lots of windows and controls and display graphics >> supporting the telescope and numerous instruments. > >Nice project. > >> Python is a leading contender because I'd like a system that offers: >> - rapid development/change/test >> - robust >> - safe (automatic garbage collection and bounds checking) >> - runs under both unix and MacOS, if possible (windows wouldn't hurt, >> either) >> - will probably be around in 10 years > >IMHO, Python is a very good bet on all counts. > >> Any comments? If I do switch, is Python development or support notably >> superior under unix or windows -- aside from OS preferences? (Please no >> OS flame wars.) > >I'm developing on Linux while most of the production code runs on >Win32. > >If you have free choice, Linux would be the better platform for >controlling a telescope than either Mac or Win32. The observers >wouldn't like to have to reboot in the middle of the night on a >regular basis. Not discourage you from writing the app yourself, but there is a linux Telescope control app at http://206.169.225.102/eots.html certainly worth a look at least. I know nothing of the app itself, don't know if it would fit the bill for you. -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From tismer at tismer.com Sun Apr 16 12:53:47 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 16 Apr 2000 18:53:47 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> Message-ID: <38F9F01B.57273052@tismer.com> Just van Rossum wrote: > > Michael Hudson wrote: > > To someone who might know: what hope is there for this to go > > into 1.6? > [ ... ] > > It would be, in my opinion, be a really really really good thing; for > > one thing it would help in language wars... > > Fredrik Lundh wrote: > > sorry, but stackless python is the only really really really good > > thing that hasn't yet been added to the core. this is just really > > really good. Hey! If Stackless goes with GC, can we get 5 times "really"? :-)) > Oh how I agree... (Now lets hope the new Python GC isn't > incompatible with Stackless... Project anyone? ;-) I'm currently looking into that. Seems to be *very* possible and *very* worthy to be done. Many cyclic issues with continuations are much easier and probably more efficient to solve with *the* GC at hand, similar to Mikecode Hackson's observation. > While were at it, here's a little Stackless news: > - Christian is redesigning the continuation module, it already has > improved quite a bit over the last two weeks. It will become simpler, simpler and simpler. > - Even so, Chris and I agree that continuations should eventually > be completely hidden from the user, since it's so incredibly > obscure, hardly anyone will understand it. Not good for CP4E ;-) Today I'm saying so. But I think there will come a time where people are told "look, a continuation is as simple as 1+1", and they'll say "sure? I thought a co is simpler." ... > - Dunno about coroutines: it appears they are much harder to get > right, and the people on the python-coro at egroups.com list only > seem to make slow progress. (But then again, I've only been > there for a week or so, so who am I to say that...) That's not a continuation matter. The problem is to get a really really really (really? :) good coroutine design together that fits everybody's expectations. Expressing them with continuation is just a homework. Doing the right design is very hard. until-Tim-Peters-tells-us-the-way-hopefully-<0.90000000000000002 wink> -- Christian Tismer :^) Applied Biometrics GmbH : 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 glyph at twistedmatrix.com Fri Apr 21 15:06:28 2000 From: glyph at twistedmatrix.com (Glyph Lefkowitz) Date: 21 Apr 2000 14:06:28 -0500 Subject: Pickling Robustly In-Reply-To: m.faassen@vet.uu.nl's message of "21 Apr 2000 13:11:14 GMT" References: <8dpk1i$7de$1@newshost.accu.uu.nl> Message-ID: m.faassen at vet.uu.nl (Martijn Faassen) writes: > Glyph Lefkowitz wrote: > > The Digicool people must've run into similar problems with their > Zope Object Database, which is based on Pickle. Perhaps looking at > the ZODB wouldn't be a bad idea, if you haven't already, therefore: > > http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html > http://www.zope.org/Members/michel/HowTos/ZODB-How-To > http://www.zope.org/Documentation/Developer/Models/ZODB > > Though I'm not sure if they indeed have solved your problem, as far > as I understand it. Thanks for the link! This is some great reading, and gives me a number of things to think about. However, one of the first things I noticed was: The ZODB stores objects in Python pickle format [van Rossum99]. All of the rules for pickling objects apply. See the documentation for the Python pickle module for more details. ... so I don't think it *quite* solves my problems :) (It also imposes some other inconvenient restrictions, such as the necessity of subclassing from Persistent and allowing it to override __setattr__ and __getattr__, which I need to have overridden for various other reasons). Perhaps I should ask this question in a different way. How does Pickle tell if an object is pickleable or not? Is there some pickle.ispicklable method I could refer to? -- __________________________________________ | ______ __ __ _____ _ _ | | | ____ | \_/ |_____] |_____| | | |_____| |_____ | | | | | | @ t w i s t e d m a t r i x . c o m | | http://www.twistedmatrix.com/~glyph/ | `__________________________________________' From pinard at iro.umontreal.ca Wed Apr 26 11:17:40 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Apr 2000 11:17:40 -0400 Subject: The Simple Economics of Open Source In-Reply-To: Albert Wagner's message of "Fri, 21 Apr 2000 11:56:03 -0500" References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <39008823.A3B67E8@tcac.net> Message-ID: Albert Wagner writes: > An elegant algorithm can be as beautiful as a painting or a song. > The truely creative desperately need to share their creations. This is a bit like I feel :-). Just introspecting myself a little, I would say that my real initial motivation for sharing software was my mere way to thank the community who gave so much good software to me. It spared me a lot of time, and I felt I should return part of this spared time to the community. It then became sort of an habit in the long run. About why I feel like thanking people? It's just that I've been educated that way. It's builtin, kind of hardware. A factory defect! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From gregm at iname.com Thu Apr 27 08:38:47 2000 From: gregm at iname.com (Greg McFarlane) Date: Thu, 27 Apr 2000 22:38:47 +1000 Subject: Scrollbar needed to get attached to Canvas In-Reply-To: <3903BA47.A7CABC48@swt.edu>; from Shah, Navneet on 23 Apr 2000 at 10:06:47PM References: <3903BA47.A7CABC48@swt.edu> Message-ID: <20000427223847.59255@nms.otc.telstra.com.au> You should not pack widgets into a canvas, you should use create_window, like this: self.sc.create_window(200, 200, anchor='nw', window = button) But maybe you should be using a Pmw.ScrolledFrame instead of a Pmw.ScrolledCanvas if all you want to do scroll around a bunch of widgets. On 23 Apr, Shah, Navneet wrote: > I am using Pmw Mega widget. I already have canvas with buttons in it. > How can I attached scrollbar to the canvas. Any help will be > appreciated. > > Shah > > My code goes as follows: > > class Demo: > def __int__(self,parent) > #Create the canvas > self.sc=Pmw.ScrolledCanvas(parent, > borderframe=1, > labelpos ='n', > usehullsize = 1, > hull_width = 400, > hull_height = 300, > ) > > self.sc.pack() > button=Tkinter.Button(self.sc.interior(), text='Hello') > button.pack(side='left') > > > > > -- > http://www.python.org/mailman/listinfo/python-list > -- Greg McFarlane INMS Telstra Australia gregm at iname.com From jae at ilk.de Fri Apr 21 23:43:13 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Sat, 22 Apr 2000 05:43:13 +0200 Subject: The Simple Economics of Open Source In-Reply-To: References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> Message-ID: <22042000.2@sanctum.jae.ddns.org> ----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Neel" == Neel Krishnaswami writes: Neel> Will Ware wrote: >> Ed (elb at cfdrc.com) wrote: >> > ... I didn't think much of the article... >> > ...they gave the impression that programmers behave >> > somewhat like monkeys, motivated primarily by concerns >> > about group status and dominance... >> >> They also mentioned, but immediately belittled, the possibility >> that altruism might be a real motivation. They may have been >> projecting their own thinking upon programmers in doing so. Neel> One of the interesting things about this thread is that it has given Neel> me a bit of insight into what economics looks like to people who Neel> haven't internalized its assumptions. I'm afraid that I'm tainted Neel> enough that it no longer looks like the dismal science to me. :) "Internalized its assumptions". Well put... now hold that thought... Neel> Seriously, the rejection of altruism as a possible motive strikes me Neel> as a very reasonable decision. Altruism is generally not sufficient Neel> motive in other aspects of life -- [...] Same goes for egoism... see below. Neel> Second, economists assume that everyone is basically self interested, Neel> including themselves -- it's a standard analytic assumption, not Neel> snobbery. But it is not just a `basic analytic assumption' in most cases... most people in the field, as you yourself have stated above, have `internalized its assumptions'. Now, you could argue that you didn't mean it like *that*... but my impression of people in that field of science[1] is that the *did* indeed internalize this... which means that *everything*, ever single point of data that goes into an analysis, into a study, is colored and filtered by this worldview. Now, I think the fundamental flaw here is that people only see this in black and white: it's either altruistic or egoistic. "Okay, so it might be some shade in between." Which still is basically black and white... just a mix of the two. No, I think (and this thought just occurred to me, so it's pretty fresh) that there's a third thing... it's the answer to the old question asked of a mountaineers: "Why did you climb that mountain?". "Well... because it was there." Or, in other words, "because I had to".[4] Egoism is often equated with the profit motive these days (little wonder in our money-based society...[2]) Now this is a nice explanation for many things... but not for all. I'm certain that the greatest thinkers, the greatest musicians, artists... the greatest innovators were *not* motivated by that... For example, when Einstein wrote his famouse relativity theories... did he do it for the money? Well, certainly not (he was a teacher at the time, I think, and did it in his spare time). Did he do for fame? Hmmm... I don't do something for fame that comes years later... if I want fame, I want it *now*! So... why did he do it? Well, I think because he *had* *to*. Some writer once said that there are books that one writes... and then there are books that *demand* to be written. It's something you because you want to... but because you have to. I think this can be compared to egoism and altruism like this: Egoism is "I get something". Altruism is "`They' get something". Xyzzy (for lack of a name[3]) is "I get *rid* of something". Or "I get something of my chest". Ranting-is-my-middle-name-(Chorus:-"Obviously!")-ly y'rs, J [1] If it can be called a science... in the end, you have to deal with people (because even big corporations are evantually directed by people), and then you get into the uncertainty areas of psychology and sociology (which are sciences, IMHO... they're just not as hard as things like physics or chemistry (though some areas of physics are even softer than psychology ;-) [2] I can rant at length about that, too... ;-) [3] Actually, I guess the old greeks probably had a word for *that*, too... I'm just not that well-read in (greek) philosophy... I just dabble in it (because I must ;-) [4] I'm sure someone has found some weird explanation that makes this something egoistical... - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html "Ever wonder why the SAME PEOPLE make up ALL the conspiracy theories?" -- Michael K. Johnson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkBH84ACgkQN0B+CS56qs256ACeKvBlNlglVqK2jsWsMCjUV/IH Hm4An2VP08D5RFccgGmGw4FohYwvPHHg =SV1u -----END PGP SIGNATURE----- From ajung at sz-sb.de Tue Apr 4 16:58:10 2000 From: ajung at sz-sb.de (Andreas Jung) Date: Tue, 4 Apr 2000 22:58:10 +0200 Subject: Getting the argument names passed to a function ? Message-ID: <20000404225810.A12156@sz-sb.de> def myfunc(arg1,arg2): ... a=1;b=2 myfunc(a,b) Is it possible to get the name of variables that were used as arguments to call myfunc(). myfunc() should be able to determine the names 'a' and 'b'. Don't ask me why I need this - it's for a worse Python hack :-) Cheers, Andreas From greg at cosc.canterbury.ac.nz Wed Apr 12 22:56:48 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 13 Apr 2000 14:56:48 +1200 Subject: Musing - Algebraic types? (was Tuples...) Message-ID: <38F53770.230E6DA@cosc.canterbury.ac.nz> The recent discussion about lists vs. tuples got me thinking about algebraic types. It was mentioned that an alternative to tuples was to define a class with an appropriate __init__ method. This is true, but it can get tedious writing __init__ methods that do nothing but stuff their arguments into instance variable. So I was thinking about a shorthand syntax for defining such classes, based on the way that algebraic types are defined in Haskell-like languages. Maybe something like class Statement(ParseNode) = ( IfStatement(expr, then_stmts, else_stmts), WhileStatement(expr, body), ForStatement(var, expr, body) ) which would be equivalent to writing class Statement(ParseNode): pass class IfStatement(Statement): def __init__(self, expr, then_stmts, else_stmts): self.expr = expr self.then_stmts = then_stmts self.else_stmts = else_stmts etc. etc. Then, of course, we're going to want to be able to unpack these: IfStatement(b, t, e) = my_if_statement would be equivalent to b = my_if_statement.expr t = my_if_statement.then_stmts e = my_if_statement.else_stmts and to be really useful we want some sort of case-statement with unpacking: switch my_statement: case IfStatement(b, t, e): ... case WhileStatement(b, s): ... case ForStatement(v, e, s): ... (expansion left as an exercise for the reader - this post is long enough already!) What think ye all? -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From gklix at hassler.de Thu Apr 13 05:39:43 2000 From: gklix at hassler.de (Gerald Klix) Date: Thu, 13 Apr 2000 11:39:43 +0200 Subject: No method overloadin I suppose ? References: <38F4938E.8F245B68@altern.org> Message-ID: <38F595DE.B413D191@hassler.de> Thomas SMETS wrote: > ## Beginning of Python program ... > class Lister: > def __init__(self): > print 'In constructor ...' > __init__(1) > > def __init__(self, lValue): > print 'In constructor with parameter' > self.l = lValue > > def __repr__(self): > print '\n******\n\tValue is : ', l, '\n********' > > if __name__ == "__main__": > x = Lister() > y = Lister (2) > ## End of python program > > Trace of execution is : > Traceback (innermost last): > File "Minheritence.py", line 14, in ? > x = Lister() > TypeError: not enough arguments; expected 2, got 1 > End of trace ... > > I guess I can't do methods overloadin', as shown... WHY is that ? I'm > wrong ? > > Thomas, > > -- Yes Thomas, you can't do overloading. The second __init__ method overides the first one. But you can do: def __init__( self, lValue = 1 ): self.l = lValue Gerald From dworkin at ccs.neu.edu Thu Apr 6 12:47:23 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 06 Apr 2000 12:47:23 -0400 Subject: More about variables In-Reply-To: Michael Scharf's message of "Thu, 06 Apr 2000 18:22:38 +0200" References: <38ECB9CE.44A73C13@gmx.de> Message-ID: Michael Scharf writes: > Just do: > > for i in range(number_of_variables): > vars()["variable%s" %(i+1)]=[] Don't do that unless you don't mind the strong possibility that a future version of Python will cause your code to break. The above relies on an implementation detail that is subject to change. >From the standard reference: vars ([object]) Without arguments, return a dictionary corresponding to the current local symbol table. With a module, class or class instance object as argument (or anything else that has a __dict__ attribute), returns a dictionary corresponding to the object's symbol table. The returned dictionary should not be modified: the effects on the corresponding symbol table are undefined. -Justin From rcunning at acm.org Thu Apr 13 06:17:47 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Thu, 13 Apr 2000 10:17:47 GMT Subject: 1st non-trivial program - gentle criticism requested References: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> Message-ID: <38F59E2E.308BD8C4@acm.org> I couldn't get it to run under Linux until I trivially initialized the following variables: gTarget = "" gNumGenerations = gMutationRate = gStepSize = None -BobC From effbot at telia.com Thu Apr 13 16:30:51 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 13 Apr 2000 20:30:51 GMT Subject: Simple formatting string question References: <8d57gp$1om@gap.cco.caltech.edu> Message-ID: <%7qJ4.929$rc9.193537024@newsb.telia.net> Robert Kern wrote: > GuruQuestion: > Should implicit string concatenation have a different precedence than > explicit string concatenation? Perhaps only a mention in > http://www.python.org/doc/current/ref/string-catenation.html ? what do you mean? that page describes "string literal concatenation", and clearly says that multiple adjacent string literals are concatenated at *compile* time. operator precedence has nothing to do with it -- it's not an operator, and it's not documented as being one. From tismer at tismer.com Wed Apr 19 06:51:45 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 19 Apr 2000 12:51:45 +0200 Subject: BAD starship.python.net news! References: <38FC852A.9B11F458@concentric.net> <38FCBD77.A5925D65@darwin.in-berlin.de> Message-ID: <38FD8FC1.EC5DDCD7@tismer.com> "Dinu C. Gherman" wrote: > > Manus Hand wrote: > > > > This from Mike McLay. Everyone, let's pony up what it takes to recover > > our starship! > > > > Manus (who will backup more and more often than he has until now) > > Not a bad idea! Sigh... > > I think Christian Tismer used to make regular copies of > large parts of the Starship, at least in former times... > > Thinking of the not so long ago shut-down of Starship Py- > thon I (starship.skyport.net)... couldn't that be a source > to recover substantial parts of the previous data?? Ironically, yes it could have been used. My last copy wasn't older than a month. But I forgot about that when I gave up starship.skyport, and I asked my ISP about it: They wiped the machine last Friday. cheerio, Starship "Titanic" Python - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 ljz at asfast.com Sat Apr 1 23:10:47 2000 From: ljz at asfast.com (Lloyd Zusman) Date: 01 Apr 2000 23:10:47 -0500 Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <_pyF4.25562$E85.640966@news1.rdc1.md.home.com> Message-ID: wtanksle at dolphin.openprojects.net (William Tanksley) writes: > On Sun, 02 Apr 2000 02:39:54 GMT, Eric Hagemann wrote: > >What are the options for users wanting 1.6 that may not have access to > >modules.python.org > >on a regular basis or at all. I'd hate to be disconnected from the net and > >find I need that > >'one' function that used to be in the standard library ......... e.g. can I > >down load the > >entire library and forgo the net check ? What happens if there is no net -- > >will the import function > >get unhappy ? > > It's actually not a problem -- all modern OSes support TCP/IP even when > you're disconnected from the net, and one particular address, 127.0.0.1, > is always live. This happens to be the site from which Python loads its > modules (we have an agreement with the owner of that site, which also > hosts many other products of the same nature, including some marketing > apps). Hey! Wait a minute ... that's *my* site! I never agreed to this! Oh ... now I get it ... my cat went and signed another contract behind my back. You guys outbid me on catnip, didn't you?! I've been having enough bandwidth problems lately ... and now thousands of module downloads every day ... OK ... this is the last straw ... no more Mr. Nice Guy! Here kitty .. here kitty kitty kitty ... it's neutering time! Well, I guess this isn't all that bad, because I can cut down on the download bandwidth by compressing all those Python modules. I'll use the new compression algorithm I recently invented. It's amazing! .. it compresses *anything* down to one bit. I'm still working on the de-compression algorithm, though ... -- Lloyd Zusman ljz at asfast.com From m.faassen at vet.uu.nl Thu Apr 27 14:24:12 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 27 Apr 2000 18:24:12 GMT Subject: Newbie Question: Is there a Python equiv to Perl's "do" statement? References: <8e9rna$ajh$1@nnrp1.deja.com> <390881D9.5661AD51@tismer.com> Message-ID: <8ea0kc$kik$2@newshost.accu.uu.nl> Christian Tismer wrote: > mdefreitas at sikorsky.com wrote: >> >> I'm trying to call a python script from another python script (given >> the filename). > Yes, you can use the execfile function to do that. > execfile("otherscript.py") And please do consider breaking up your system into modules which get imported, instead of using execfile(). Generally a much cleaner way to organize your code. And more powerful, to boot. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From jmassung at magpiesystems.com Wed Apr 26 16:41:26 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Wed, 26 Apr 2000 14:41:26 -0600 Subject: global variables or inheritence References: <28p8zy0irgc.fsf@lada.kom.auc.dk> <28p4s8oipzh.fsf@lada.kom.auc.dk> <28pzoqghaoh.fsf@lada.kom.auc.dk> Message-ID: Thomas Rasmussen wrote in message <28pzoqghaoh.fsf at lada.kom.auc.dk>... > Jeff> NOTE: myvar is local to main() (not to the file) >Well I still want to be able to do this.... Well, you can't :), so you're going to have to find another way to do what you want. >Well i'm programming a small admin tool, which must use the users >$EDITOR for editing files. This works fine if the EDITOR sysenv is >set, if not, then i want to ask the user which editor he want to use, >and then pass this variable to the module that handles >filemanipulation. This modules is also in another file if it >matters... I must add that this is my first real program made in >python... Definitely no need for circular code there, just rethink it through some more - try a simple program of what you want with only 1 file for now. As for circular code, think of it like this: def CodeA(): def CodeB(): CodeA() CodeB() What happens? Ouch ;) Stay away... very bad... Jeff From JohnH at PHM.GOV.AU Sun Apr 2 21:38:07 2000 From: JohnH at PHM.GOV.AU (Hirsch, John) Date: Mon, 3 Apr 2000 11:38:07 +1000 Subject: controlling Excel2000 with COM Message-ID: Christer Fernstrom wrote: I tried the most obvious thing with COM with Excel 20000 in Windows 2000 (p. 67 in "Programming on 32") >> import win32com.client >> xl = win32com.client.Dispatch("Excel.Application") -- This launches Excel (as verified with the windows task manager) >> xl.visible =1 (I also tried to capitalise Visible) Result: Traceback (innermost last): File "", line 1, in ? xl.visible =1 File "D:\tools\Python\win32com\client\dynamic.py", line 453, in __setattr__ raise AttributeError, "Property '%s.%s' can not be set." % (self._username_, attr) AttributeError: Property 'Excel.Application.visible' can not be set. Anybody got a clue? Is this a problem related to Office2000? christer ____________________________________________________________________________ ______________ This works for me. >>> import win32com.client >>> xl = win32com.client.Dispatch("Excel.Application") >>> xl.Visible = 1 Must be capital 'V'. john From smigowsky at dspace.de Mon Apr 3 05:53:11 2000 From: smigowsky at dspace.de (Stefan Migowsky) Date: Mon, 3 Apr 2000 10:53:11 +0100 Subject: Q: List and Dicts as default args Message-ID: <326536345498D311B3BC00105A39802A074654@newsintern.dspace.de> Hi, I was just wondering how to handle lists and dictionaries in a simple way as default arguments to functions. Since following strange behaviour occured : >>> def f(Index,List = [], Dict = {}): ... List.append(1) ... List.append(2) ... print List ... Dict[Index] = Index ... print Dict >>> f(1) [1, 2] {1: 1} >>> f(2) [1, 2, 1, 2] {2: 2, 1: 1} >>> f(3) [1, 2, 1, 2, 1, 2] {3: 3, 2: 2, 1: 1} This behaviour only occurs with dictionaries and list. All other types are "well" behaved. I could try the following but that doesn't look so nice: def f(Index,List = None, Dict = None): if not List: List = [] List.append(1) List.append(2) print List if not Dict: Dict = {} Dict[Index] = Index print Dict Thanks for any advice. Stefan From mhammond at skippinet.com.au Fri Apr 28 19:26:12 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 28 Apr 2000 23:26:12 GMT Subject: win32all-131 at python.org References: <1UDL4.539$v85.2477@news-server.bigpond.net.au> <8ecf70$766$1@nnrp1.deja.com> Message-ID: "Matthias" wrote in message news:8ecf70$766$1 at nnrp1.deja.com... > Hy Mark :-) > Are the sources anywhere ?? > (You told me to include the new startup-code in my project) Only from CVS - available via the web at http://www.pythonpros.com/cgi-bin/cvsweb.cgi/PyWin32 David Ascher creates a nightly tarball: http://starship.python.net/crew/da/pywin32dists/ > BTW > I have the following problems: > (1) I want to use python-win for the interface in my programm, but it > is most important to hide the interactive windows for most of the users > (they should not know that they are powered by python), and Ultimately you will end up with your own "intpyapp.py" (hopefully named something else!) This gives you full control over the app - eg, do you want an editor, interactive, debugger, etc. > (2) I have a conflict with my main windows. In the InitInstance() from > my application the pyglue-code creates a new window and now visualc > does not know which of them is the main window. (e.g. I open > splittst.py in my window, have to choose debug (go is disabled ??) from > the python-window and the splitter - test window is a mdi-child in my > own main window again (little confuseing, isn't it ;-) - the menus are > quite the same, but in my window all python-related menus are diasbled) You _definately_ need a new intpyapp.py - either drop the creation of the main frame from your C++ code, or from the custom app.py Here is some code taken from a real project that does the exact same thing - the MFC app creates the frame, and Pythonwin attaches to it! Mark. # initapp.py # "The main startup code for my custom Pythonwin App." # import win32ui try: debugging = win32ui.GetProfileVal("Whatever", "Debugging", 0) except: debugging=1 # Keep this as short as possible, cos error output is only redirected to # the interactive window if this runs OK. # Keep as much logic in imported modules, as errors in these are much better - # the messages go somewhere! # Redirect to the debugging device! if debugging: import win32traceutil import sys print "Starting up:", sys.path import sys import win32con import pywin from pywin.framework import intpyapp, app from pywin.mfc import afxres class MyApp(intpyapp.InteractivePythonApp): def HookCommands(self): f = win32ui.GetMainFrame() # Probably dont want most of these if you are not exposing the # interactive Window, or any Python IDE features. f.HookCommand(self.OnViewBrowse,win32ui.ID_VIEW_BROWSE) f.HookCommand(self.OnFileImport,win32ui.ID_FILE_IMPORT) f.HookCommand(self.OnFileCheck,win32ui.ID_FILE_CHECK) f.HookCommandUpdate(self.OnUpdateFileCheck, win32ui.ID_FILE_CHECK) f.HookCommand(self.OnFileRun,win32ui.ID_FILE_RUN) f.HookCommand(self.OnFileLocate,win32ui.ID_FILE_LOCATE) f.HookCommand(self.OnInteractiveWindow, win32ui.ID_VIEW_INTERACTIVE) f.HookCommandUpdate(self.OnUpdateInteractiveWindow, win32ui.ID_VIEW_INTERACTIVE) f.HookCommand(self.OnViewOptions, win32ui.ID_VIEW_OPTIONS) f.HookCommand(self.OnHelpIndex, afxres.ID_HELP_INDEX) f.HookCommand(self.OnFileSaveAll, win32ui.ID_FILE_SAVE_ALL) app.CApp.HookCommands(self) def InitInstance(self): self.ddeServer = None # Create the taskbar icon if necessary. if debugging: win32ui.CreateDebuggerThread() # Attach to (NOT CREATE) the main frame. # This code assumes the MFC app has ALREADY created the main frame window, # so win32ui.GetMainFrame() will return this window. By passing this window to the # app.MainFrame() constructor, we attach to the existing window. self.frame = app.MainFrame(win32ui.GetMainFrame()) # However, in this example, our main app does not create the status bar! self.frame._CreateStatusBar() self.HookCommands() from editor import editor # Allow HTML files to be edited by Pythonwin! # ('something' is a module that exposes an MFC resource ID - there # should be a string, icon, menu etc entries in the resources for this ID) self.AddDocTemplate( editor.EditorTemplate(something.IDR_HTML_FILE) ) # Create the interactive window if we want. from pywin.framework import interact interact.CreateInteractiveWindow() # Load internal modules we need (if you want :-) self.LoadSystemModules() # Minimise the interactive window. win32ui.PumpWaitingMessages() interactiveFrame = interact.edit.currentView.GetParentFrame() if interactiveFrame != win32ui.GetMainFrame(): interactiveFrame.ShowWindow(win32con.SW_MINIMIZE) appobj = MyApp() From PClaerhout at CREO.BE Wed Apr 26 10:11:20 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 26 Apr 2000 16:11:20 +0200 Subject: Saving pieces of the registry Message-ID: <2B1262E83448D211AE4B00A0C9D61B03011152B9@MSGEURO1> Hi, does anyone know is there is a command in Python to save a part from the registry to a .reg file, like you can do with regedit.exe? I would like for example like to save all keys under HKEY_LOCAL_MACHINE\Software to a file. Anyone know if this is possible or not? Kind regards, Pieter From c.evans at clear.net.nz Thu Apr 20 03:57:15 2000 From: c.evans at clear.net.nz (Carey Evans) Date: Thu, 20 Apr 2000 07:57:15 GMT Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) References: <20000419154202.B480@owl.rhein-zeitung.de> <3d4s8yotiy.fsf@amarok.cnri.reston.va.us> Message-ID: <87zoqp8ask.fsf@psyche.evansnet> akuchlin at mems-exchange.org (Andrew M. Kuchling) writes: > First Zope.org (down because an Ethernet cable got pulled out), then > Starship (disk crash), now pythonware.com. Has someone released evil > whitespace-eating nanobots that also attack computer hardware? >From my perspective, the problem's obvious. Debian is going to release version 2.2 sometime soon. We've had most of the usual symptoms (new version of XFree86 released, new version of Apache released, even a new version of Perl); but we're still waiting for the requisite disk crash on master.debian.org. Obviously when Guido announced that 1.6's release schedule was being changed, he jinxed all the Python machines with the same problem Debian has. -- Carey Evans http://home.clear.net.nz/pages/c.evans/ "I can't believe it's not Cthulhu!" From aa8vb at yahoo.com Wed Apr 26 06:39:27 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 26 Apr 2000 06:39:27 -0400 Subject: what does XDR stand for? and what is it? In-Reply-To: <002101bfaeb5$b57f5dc0$2801000a@iel.ie> References: <002101bfaeb5$b57f5dc0$2801000a@iel.ie> Message-ID: <20000426063927.A1240847@vislab.epa.gov> Shaun: |im here looking and trying to figure out the xdrlib module, ... |my question is what is XDR? what does it stand for? Fredrik and Richard already gave you the what's-it-stand-for and Richard mentioned RPC (a Sun protocol using XDR). Here's a bit more detail on the what's-it-for. XDR is for transparently exchanging data between systems which may have different representations for basic data types. "Data types" being things like ints, floats, double-precision floats, characters, etc. "Representations" meaning things like: word sizes, byte orderings, floating-point formats, etc. You use XDR to "flatten your data structures" into stream of bytes so you can send it over the net or write it to a file (similar in concept to Python's marshal and pickle modules). On the other end, you "build them back up" from the data stream to construct the heirarchy of data structures originally sent. These two processes are called serialization and deserialization, respectively. As Richard mentioned, the main protocol Sun developed using XDR for a data representation was RPC (remote procedure call), which is used by (among other things) NFS -- Network File System. Most UNICes nowadays (and maybe MSWin too) provide XDR C APIs with the OS, since they have to have them for NFS anyways. -- Randall Hopper aa8vb at yahoo.com From jwbnews at scandaroon.com Wed Apr 19 14:45:06 2000 From: jwbnews at scandaroon.com (John W. Baxter) Date: Wed, 19 Apr 2000 11:45:06 -0700 Subject: Python in the future References: <38FDB8A7.E701F81F@sec.noaa.gov> Message-ID: In article , Michael Hudson wrote: > The point being that Python hasn't changed fast, and probably won't > change that fast in the next five years either. There's something of a bump in the road ahead..."Python3000" will break some existing scripts to change some things. Aside from that bump, I'd expect the same sort of slow, careful, don't break the old stuff progression which Guido has wisely given us. --John -- John W. Baxter Port Ludlow, WA USA jwbnews at scandaroon.com From ullrich at math.okstate.edu Tue Apr 4 14:21:19 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 04 Apr 2000 13:21:19 -0500 Subject: Learning in Stereo: Math + Python References: Message-ID: <38EA329F.4D407309@math.okstate.edu> Kirby Urner wrote: > [...] > And here's another fast converger [to pi] using every other > Fibonacci number: > > def pifib(n): > # return approximation for pi using > # arctan(1) = 4 * SIGMA [ arctan(1.0/Fib(2i+1))] > sum = 0 > for i in range(1,n+1): > sum = sum + math.atan(1.0/fibo(2*i+1)) > return 4*sum I didn't know that arctan(1) was equal to that sum, fascinating. But I don't quite see the point to using that as a way to "calculate" arctan(1) - seems like the call to math.atan is cheating, if we're gonna do that why not just call math.atan(1)? Now if we were calculating the arctangents by hand that might be different - there's an easy and fairly efficient way to find arctan(x) for |x| < 1 that doesn't work for |x| > 1 (and just barely works for |x| = 1), ie the power series; so there's a possible point to finding arctan(1) using arctan(1/fib) in that case. You might note that pi/6 = arctan(1/sqrt(3)). The power series for arctan(1/sqrt(3)) converges pretty fast, and you can make the calculations go pretty quick as well, if you note that (sqrt(3))**(2*k+1) = sqrt(3)*(3**k); you factor out one sqrt(3) and in the inner loop you have almost nothing but integer computations. (I got 7,000 digits of pi this morning in about two minutes this way. Using ordinary floats it's def floatpi(n): """Gets pi from the power series for arctan(1/sqrt(3)) - factors out some stuff and combined pairs of terms... """ eps = 10.0**(-n) pow = 1L term = 1.0 #just to make the first test succeed p=0.0 j=0 while abs(term) > eps: term=float(j+1)/((4*j+1)*(4*j+3)*pow) p=p+term pow=9*pow j=j+1 return (16/math.sqrt(3))*p The error's just a little larger than the first omitted term, so floatpi(n) should give pi to n places. And it only takes about n terms to get there. Probably worrying about the "optimizations" doesn't make much sense here - makes more sense when dealing with high-precision (slow) reals.) Or you could use someone's formula pi = 16*atan(1/5) - 4*atan(1/239) to get faster convergence (although explaining why the formula is valid might not be quite as straightforward as pi = 6*atan(1/sqrt(3)) - dunno if we mean to include explanations of that sort of thing or not). DU From gmuller at worldonline.nl Wed Apr 5 14:59:29 2000 From: gmuller at worldonline.nl (gerrit) Date: Wed, 05 Apr 2000 20:59:29 +0200 Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <3d3dp01t13.fsf@amarok.cnri.reston.va.us> Message-ID: <38EB8D10.2BA39F8D@worldonline.nl> "Andrew M. Kuchling" wrote: > rzantow at my-deja.com writes: > > the whole language, and buying more books. I'm really surprised there > > are as many as 13 Python books on the market. I'd have thought there > > was a need for maybe three, along with about two pamphlets and a poster. > > I'm not surprised, and think there's room for still more. Hopefully > the next wave of books will aim at specific topics: Python and > {Tkinter,KDE,GTk+,wxWindows}, Python for numeric work, for Web stuff, > for bioinformatics, for teaching programming, inside Zope, JPython for > Java programmers who need to embed a scripting language, etc. <...snip...> I would like to see a book "Python for children". My children (9 and 11 years old) are now learning Superlogo, with a dutch book "Programmeren voor Kinderen deel 2 met Superlogo" (Programming for children part 2 with Superlogo). It is quite detailed step by detailed step, too much detail for my taste. Python plus tkinter could be as simple and (more) educational than Superlogo. Of course the right level of interfaces should be supplied to make it succesful (turtles, which is available, but also images sound and so on) Regards Gerrit From jason-usenet at mastaler.com Mon Apr 3 03:36:12 2000 From: jason-usenet at mastaler.com (Jason R Mastaler) Date: Mon, 3 Apr 2000 01:36:12 -0600 (MDT) Subject: Integrating Pmw into Python dist Message-ID: <20000403073612.5943.qmail@ashanti.in.mastaler.com> Have the Python developers considered integrating Greg McFarlane's wonderful Python megawidgets work into the core Python distribution? I feel this would be an excellent addition. Pmw offers a nice set of extra widgets and an easy way to add functionality to Tkinter applications. The only reservation I have with using Pmw, is that it adds yet another package to the list of extras that users must download and install before they can use my software. If Pmw was integrated, obviously applications which rely on it would suddenly become much more portable. What do others think of this suggestion? ---Jason From hathawa2 at marshall.edu Tue Apr 11 21:17:10 2000 From: hathawa2 at marshall.edu (Mark Hathaway) Date: Tue, 11 Apr 2000 21:17:10 -0400 Subject: Huh? func_defaults, default values in function calls References: <8cv5qj$35p$1@zinc.intern.netconnect.no> <8cv8ra$hio$1@pegasus.csx.cam.ac.uk> >>> I don't get it. Why isn't the dictionary reset to {'x':'a'} when i call >>> the function the last time? >>> >>> >>> a.func_defaults >>> ('', '', {'x': 'a', 'y': 'c'}) >>> >>> Why is not {} the default for the z parameter? >> According to my understanding of the Python docs, defaults are only >> evaluated at function definition time, not at function invokation time. Definately goofy! >> As a result, if you set a mutable object (list, dictionary, etc) as a >> default, it'll be set when the function is defined and then if the >> function changes it, it'll stay changed for subsequent invokations. >> The function effectively has a "side-effect", of modifying it's own >> default! This way you'll never really know what the default is going to be. Ha ha ha ha. that's pathetic. > That's exactly right. The idiomatic Python way of doing what Roger wants > here is: > > def a(x='',y='',z=None): > if z is None: > z = {} > if x: > z['x'] = x > if y: > z['y'] = y > print str(z) > > I think this is the first time I've seen show up with dictionaries, usually > is shows up with lists. At least this idiom gets the job done, but it sincerely defeats the idea of having default values to have to say "z=None". Mark S. Hathaway email: hathawa2 at marshall.edu From hamish_lawson at yahoo.co.uk Wed Apr 5 08:24:23 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Wed, 05 Apr 2000 05:24:23 -0700 Subject: UserDict's has_key() and get() should use __getitem__() References: <0535db98.ec878f67@usw-ex0101-005.remarq.com> Message-ID: <29328840.06b5b87b@usw-ex0101-005.remarq.com> Michael Hudson wrote: >Hmm. These are likely to be rather less efficient than the >current implementation, so you want to penalise those who use >UserDict for the sake of those who don't subclass it >thoroughly - do you really want to do this? I grant that my proposal is a bit less efficient, but I see that as part of the cost for the proper abstraction. Given that UserDict exists primarily to be subclassed, and usually for the purpose of providing new definitions of setting and getting items, I do think that UserDict should be implemented in such a way as not to require those methods which are conceptually dependent to be redefined in the derived class. If they are conceptually dependent they should be made so in the code. >Let's face it, you're unlikely to make this mistake again. Except that I think subclassers should be able to make this 'mistake'. Hamish * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From mwh21 at cam.ac.uk Wed Apr 12 20:32:24 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 13 Apr 2000 01:32:24 +0100 Subject: comparing strings and ints References: <2YmI4.366$rc9.188014080@newsb.telia.net> <20000411134358.A2352304@vislab.epa.gov> <1256641282-42160637@hypernet.com> <20000412075812.A2449004@vislab.epa.gov> <20000412112935.A2446939@vislab.epa.gov> Message-ID: grant at nowhere. (Grant Edwards) writes: > No, it said "_consistently_ but arbitrarily" [emph added]. > That means that you don't which result you will get when a > string and an int are compared, but you know you will always > get the _same_ result. That's one reading; however I'd have thought a more likely one would be to specify that if x>y is true once for some x and y of differing types, then x>y is true each subsequent time it is evaluated. can-I-have-a-language-lawyer-brownie-point?-ly y'rs M. -- please realize that the Common Lisp community is more than 40 years old. collectively, the community has already been where every clueless newbie will be going for the next three years. so relax, please. -- Erik Naggum, comp.lang.lisp From ddt92 at home.com Tue Apr 11 18:55:35 2000 From: ddt92 at home.com (HC2k) Date: Tue, 11 Apr 2000 22:55:35 GMT Subject: I need Help Message-ID: <38F3AD34.E6C88698@home.com> Hello I am new to programming and someone said start with Python it's a great learning language and can be very useful what excactly does python program? And how long did it take anyone else to learn thanks ! From neilh at hare.net.au Sun Apr 2 21:25:14 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Mon, 3 Apr 2000 11:25:14 +1000 Subject: Unicode program representation Message-ID: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> I've been playing around with the Unicode support in Python 1.6. IDLE uses a Unicode enabled text widget so a script like the following: print "hi ?" works well. There is a good chance this didn't travel over mail well, so the string is 'h', 'i', ' '(space), '', (U+0429 cyrillic capital letter shcha). The last letter looks like an angular 'W' with a tail. This saves as UTF-8, so it looks like IDLE's text widget stores data in UTF-8 form. In my opinion, this is very much the right thing to do and I am thinking of adding Unicode support to Scintilla so Pythonwin will also be able to work like this. This means that if you want to use non-roman characters in string constants then you should use 'ASCII' strings rather than the new u" form. With: i = 0 s = "hi ?" print s for x in s: print i, x i = i + 1 i = 0 su = u"hi ?" print su for x in su: print i, x i = i + 1 Printing the 'ASCII' string did what I wanted but the Unicode form did not. This leads to the question of what the use of the u" form is. The current answer is that u" takes the ASCII string and makes a Unicode string object by extending each byte with another zero byte. Because its a Unicode string object it behaves appropriately with Unicode aware functions. I think this should be changed to interpreting the literal as a UTF-8 literal. The advantage here is that non-roman string literals become a natural part of the language. The example scripts do not work well from the command line. Thought should be given to whether on NT, the console should be reopened in wide character mode so that Unicode I/O will work well. Saving the scripts as UCS-2 shows that the interpreter is unable to deal with UCS-2 scripts, which is what I expected. I think very few people will be creating script files in UCS-2, instead preferring to keep source code in UTF-8 files. Neil From culliton at clark.net Sun Apr 9 12:55:34 2000 From: culliton at clark.net (Tom Culliton) Date: Sun, 09 Apr 2000 16:55:34 GMT Subject: awk-like usage of Python References: <8cq5os$8b9$1@nnrp1.deja.com> Message-ID: In article <8cq5os$8b9$1 at nnrp1.deja.com>, wrote: >I'm a relative newbie to Python. But, I have extensive experience with >awk (it's an old stand-by that I rely on over and over). > >Are there any library modules that make python behave more like awk? >Lacking that, what's the best way to achieve line by line parsing >and pattern matching with Python? Here's an awk like base class written when I first started using Python. It still sees heavy use today as the base class for many filters which summarize data from log files. I've seen other more elaborate ones but this has continued to be useful for me and others. --------------------------------filter.py-------------------------------- import sys import os def perror(*elist) : for e in elist : sys.stderr.write(str(e) + " ") sys.stderr.write("\n") class file_filter : def __init__(self, filenames) : self.filenames = filenames self.filename = "stdin" self.file = sys.stdin self.line = "" self.nr = 0 self.fnr = 0 def run(self) : self.nr = 0 self.fnr = 0 self.begin() if not self.filenames : self.filename = "stdin" self.file = sys.stdin self.do_file() else : for self.filename in self.filenames : self.fnr = 0 try : ext = os.path.splitext(self.filename)[1] if ext == ".Z": self.file = os.popen("zcat " + self.filename, "rb") elif ext == ".gz": self.file = os.popen("gzip -dc " + self.filename, "rb") elif ext == ".bz2": self.file = os.popen("bzip2 -dc " + self.filename, "rb") else: self.file = open(self.filename, "rb") except IOError, msg : perror("Cannot open:", self.filename, msg) continue self.do_file() self.file.close() self.end() def do_file(self) : while 1 : self.line = self.file.readline() if self.line == "" : break self.nr = self.nr + 1 self.fnr = self.fnr + 1 self.do_line() def do_line(self) : print self.line, def begin(self) : pass def end(self) : pass From soundhack at hotmail.com Thu Apr 20 11:23:52 2000 From: soundhack at hotmail.com (Robert) Date: Thu, 20 Apr 2000 11:23:52 -0400 Subject: Why MFC instead of Tkinter -- was Re: Pythonwin? References: <4QtL4.24$v85.41@news-server.bigpond.net.au> <7LDL4.534$v85.2563@news-server.bigpond.net.au> Message-ID: <38ff21b8$0$10972@senator-bedfellow.mit.edu> To each his own I guess. I work mostly on Windows platforms, and for me MFC is a lot better than Tk for a couple of reasons. 1) I can port MFC/C++ programs a lot easier 2) I may be mistaken, but MFC based guis are faster than Tk 3) I really do not like using layout managers, and using Visual C++'s dialog editor is the best thing since sliced bread IMHO. One suggestion for learning MFC fresh: don't read books that basically teach you how to use Visual C++'s AppWizard. AppWizard is really nice and easy to use but it basically automates so much of creating MFC programs that it was hard (at least for me) to make the transition to a non-wizard MFC environment in python. Robert Michael A. Crawford wrote in message ... >I'm curious. Why did you not steer him in the Tkinter direction for his GUI >needs? Is MFC better? I learned (and forgot MFC) some time ago, years in >fact. Same with X-Windows programming. Now I'm working my way throught >"Python and Tkinter Programming" by Grayson. I thought Tkinter was the >preferred method for Pythong GUI programming. Am I mistaken? > >-Michael From tjg at avalongroup.net Tue Apr 25 00:20:27 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Mon, 24 Apr 2000 21:20:27 -0700 Subject: Anyone generating SWF content with Python? References: Message-ID: <39051D0B.6FC168F2@exceptionalminds.com> Grant Munsey wrote: And here I am all excited that Python could possibly create something having to do with Single White Females... Imagine my disappointment! -- Stand Fast, tjg. Timothy Grant tjg at exceptionalminds.com Chief Technology Officer www.exceptionalminds.com Red Hat Certified Engineer (503) 246-3630 Avalon Technology Group, Inc. fax (503) 246-3124 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From btribble at blueshiftinc.com Wed Apr 5 18:19:59 2000 From: btribble at blueshiftinc.com (Brett Tribble) Date: Wed, 5 Apr 2000 15:19:59 -0700 Subject: os.utime limitation on Windows? References: Message-ID: Oh, I should mention that no error is reported by the second os.error catch... Brett "Brett Tribble" wrote in message news:senek66krfg118 at corp.supernews.com... > I have the following routine: > > def synctime(self, source, target): > try: > syncstat = os.stat(source) > except os.error: > self.statuswindow.insert('end', source + ': cannot get stats\n') > try: > os.utime(target, (syncstat[ST_ATIME], syncstat[ST_MTIME])) > except os.error: > self.statuswindow.insert('end', target + ': cannot change time\n') > return > > This works fine under NT on an NTFS drive, but doesn't seem to do anything > on a 95 box on a FAT16 partition. Is this a limitation with 95, FAT16, > Python, or a combination therein? > > > Thanks in advance, > > Brett > > > > From hoehn at cs.utk.edu Wed Apr 12 14:01:53 2000 From: hoehn at cs.utk.edu (Jacob A Hoehn) Date: Wed, 12 Apr 2000 14:01:53 -0400 (EDT) Subject: a question about flushing input buffer Message-ID: I am expanding on the rolodex example given in the learning python book, as a project for me to better learn python. I have run into a problem. I have a class named Rolodex that uses the cmd module. One of the methods for the class is to add a user to the rolodex. In the book example it just has you enter the person's name and phone number. I want to alter this so that you can also enter in additional information. So, in the add method I have the following statement: print "Enter additional information (to stop, hit ^D):" try: self.info[name] = sys.stdin.readlines() sys.stdin.flush() except EOFError: return The problem is, when I run the program I get the following: ROLODEX> add foo Enter phone number for foo: 911 Enter additional information (to stop, hit ^D): hello world ROLODEX> list ========================================= foo : 911 ========================================= ROLODEX> find foo ========================================= The number for foo is 911. Additional information: hello world ========================================= ROLODEX> add guido Enter phone number for guido: 111-1111 Enter additional information (to stop, hit ^D): ROLODEX> list ========================================= foo : 911 guido : 111-1111 ========================================= ROLODEX> find guido ========================================= The number for guido is 111-1111. Additional information: ========================================= ROLODEX> It is not letting me enter in the additional information. It skips it as if I had typed cntrl D. So, is there a buffer that I need to be flushing? I thought sys.stdin.flush() would do that. Below is all of the code. Thanks for any help you can give me and I appologize for the length of this email. Jacob Hoehn #!/usr/local/bin/python # rolodex, a simpler version of this exists in the oreilly # learning python book... i added some stuff import string, sys, pickle, cmd class Rolodex(cmd.Cmd): def __init__(self): cmd.Cmd.__init__(self) self.prompt = "ROLODEX> " self.people = {} self.info = {} def help_add(self): print "Adds an entry (specifiy a name)" def do_add(self, name): if name == "": name = raw_input("Enter name: ") name = string.lower(name) if self.people.has_key(name): option = "" while 1: if option == 'y': break if option == 'n': return option = raw_input("Name exists! " \ "Overwrite? Enter [y/n] ") phone = raw_input("Enter phone number for "+ name+": ") self.people[name] = phone print "Enter additional information (to stop, hit ^D):" try: self.info[name] = sys.stdin.readlines() sys.stdin.flush() except EOFError: return def help_delete(self): print "Delete an entry (specify a name)" def do_delete(self, name): if name == "": name = raw_input("Enter name: ") name = string.lower(name) try: del self.people[name] del self.info[name] except KeyError: print "Name not found" def help_find(self): print "Find an entry (specifiy a name)" def do_find(self, name): if name == "": name = raw_input("Enter name: ") name = string.lower(name) if self.people.has_key(name): print '='*41 print "The number for %s is %s." % \ (name, self.people[name]) print "\nAdditional information:\n" for line in self.info[name]: print line, print '='*41 else: print "We have no record for %s." % (name,) def help_list(self): print "Prints the contents of the directory" def do_list(self, line): names = self.people.keys() if names == []: return names.sort() print '='*41 for name in names: print string.rjust(name, 20), ":", \ string.ljust(self.people[name], 20) print '='*41 def help_EOF(self): print "Quits the program" def do_EOF(self, line): sys.exit() def help_save(self): print "save the current state of affairs" def do_save(self, filename): if filename == "": filename = raw_input("Enter filename: ") saveFile = open(filename, 'w') pickle.dump(self.people, saveFile) pickle.dump(self.info, saveFile) def help_load(self): print "load a directory" def do_load(self, filename): if filename == "": filename = raw_input("Enter filename: ") saveFile = open(filename, 'r') self.people = pickle.load(saveFile) self.info = pickle.load(saveFile) if __name__ == '__main__': rolo = Rolodex() rolo.cmdloop() From paul.magwene at yale.edu Sun Apr 23 16:19:04 2000 From: paul.magwene at yale.edu (Paul Magwene) Date: Sun, 23 Apr 2000 16:19:04 -0400 Subject: setting up Tkinter References: Message-ID: <39035AB8.5845D1EA@yale.edu> Andy Mullen wrote: > > As i understand from the website (www.python.com), this program doesn't run > on windows 98. Since i was already thinking of putting linux on my machine > under a partition of the HD, i was wondering if someone could point me in > the right direction as to where to get linux online, how to go about > install, and how to run the 2 separate OS's on one machine. any response > would be appreciated If I read your email correctly, you're confused. Tk (and hence Tkinter) DOES run on Windows (95/98,NT,2000, etc),various Unix and Unix-like systems, and the Mac as well (though recent posts seem to indicate some minor bugs in the current installer). You don't need to install Linux to work with Tkinter. --Paul From tuttledon at hotmail.com Thu Apr 20 08:55:15 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Thu, 20 Apr 2000 12:55:15 GMT Subject: [ANNOUNCE] Webware for Python 0.1 References: <5650A1190E4FD111BC7E0000F8034D26A0F40D@huina.oceanic.com> <38FEF62B.2A4402CD@mindspring.com> Message-ID: WinZip is having problems with your tar. It's giving me the error "Error reading header after processing 0 times." Don From robin at jessikat.demon.co.uk Sat Apr 22 14:45:30 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sat, 22 Apr 2000 19:45:30 +0100 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7@lp.airnews.net> Message-ID: In article <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7 at lp.airnew s.net>, Tres Seaver writes ... >"That dog won't hunt!" Your claim that "basically no one makes the >effort" is easily refuted: consider the League of Women Voters, >and the guides they put out before each election -- that effort is >well-organized, and involves coordinated, non-partisan effort on the >scale of tens of thousands of volunteers (much like a large Open Source >project). The League's explicit motive is to educate themselves and >the population at large on the issues and candidates; that at least >some of the effort here is altruistic is obvious to anyone who hasn't >"internalized [economics'] assumptions." > >Altruism-is-a-shibboleth'ly, > >Tres. I don't think the pessimists amongst whom I count myself reject altruism totally. A purely altruistic action has benefit for others and none for the actor. Very few of the altruistic examples in the thread come close. A lot of claims are made, but few are verifiable. I think the internalized utility assumptions are a bit spurious as there is evidence that many of the assumptions that economists make (about human behaviour) are not verifiable and in some cases have been shown to be true; a classic example is the assumption of risk averse behaviour in investment decisions. I feel that the assumption that economic agents (people) always behave as though they have a well defined utility is false. I think that what economists are really saying is that they have a model where the 'average' agent has such a utility and that the model gives good results for certain problems. In this sense the average volunteer feels they behave in a non-partisan altruistic way, but the ensemble actually behaves selfishly although this is not selfishness in the way we normally think of it. -- Robin Becker From fwang2 at yahoo.com Tue Apr 4 16:06:06 2000 From: fwang2 at yahoo.com (oliver) Date: Tue, 4 Apr 2000 16:06:06 -0400 Subject: ldap support? Message-ID: hi, I wonder is there any standard LDAP support module in python? I looked up SIGs, doesn't show anything there. I appreciate your help. oliver From sabren at manifestation.com Thu Apr 20 03:29:59 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 20 Apr 2000 03:29:59 -0400 (EDT) Subject: globals: a dirty little secret? Message-ID: Globals have come up a couple times recently.. If someone posted the following approach, I missed it... ### step 1: globals.py ####################### import __builtin__ def setGlobal(key, value): __builtin__.__dict__[key] = value __builtin__.setGlobal = setGlobal # makes the above function global ## step 2: your program ###################### import globals setGlobal("x", 5) print x ############################################## Whatcha think? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From hamish_lawson at yahoo.co.uk Wed Apr 5 06:44:01 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Wed, 05 Apr 2000 03:44:01 -0700 Subject: UserDict's has_key() and get() should use __getitem__() Message-ID: <0535db98.ec878f67@usw-ex0101-005.remarq.com> [This is a modified version of an earlier posting for which I didn't get any responses. I'm trying again with what I'm hoping might be a clearer exposition.] The UserDict class in the standard library provides a framework for defining your own dictionary-like classes. However I think their may be an anomaly in how it is currently implemented (up to 1.5.2). I think that most people would expect that if the following statement succeeded: print d['Joe'] then the following line would evaluate true: print d.has_key('Joe') However, under the current implementation of UserDict, if you redefine __getitem__() in your own UserDict-derived class, you will probably also have to redefine has_key() and get() (and maybe others) in order to have them behave as expected. This wholescale redefining is caused by the fact that UserDict's has_key() and get() methods don't make use of the class's own __getitem__() method in determining whether a key exists, as shown in the extract below: def __getitem__(self, key): return self.data[key] def has_key(self, key): return self.data.has_key(key) def get(self, key, failobj=None): return self.data.get(key, failobj) My contention is that the behaviour we expect from get() and has_key() is intimately bound up with how __getitem__() behaves, and this should be reflected in get() and has_key() making use of __getitem__(): def has_key(self, key): try: self[key] return 1 except KeyError: return 0 def get(self, key, failobj=None): try: return self[key] except KeyError: return failobj It is now possible to redefine __getitem__() in a derived class and have has_key() and get() behave as expected, without having to redefine them also. (It may be that other methods in UserDict should also be reimplemented along these lines - I've not looked yet.) Is there some reason why this isn't the right thing to do? Assuming it is, I'd like to get this change into Python 1.6. Hamish Lawson ----------------------------------------------------------- PS: Below is an example demonstrating how the semantics of has_key() and get() get broken under the current version of UserDict when you redefine only __getitem__() in a derived class. import UserDict, string class CaselessDict(UserDict): "A dictionary class with case-insensitive keys" def __setitem__(self, key, value): self.data[string.lower(key)] = value def __getitem__(self, key): return self.data[string.lower(key)] d = CaselessDict() d['Joe'] = "Sue" print d['jOE'] # prints "Sue" print d.has_key('jOE') # prints 0 but expected 1 print d.get('jOE', None) # prints None but expected "Sue" * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From joachim at medien.tecmath.de Tue Apr 4 05:28:37 2000 From: joachim at medien.tecmath.de (Joachim Koenig-Baltes) Date: Tue, 4 Apr 2000 11:28:37 +0200 (MEST) Subject: New Features in Python 1.6 In-Reply-To: <20000403131720.A10313@sz-sb.de> References: <200004011740.MAA04675@eric.cnri.reston.va.us> <20000403131720.A10313@sz-sb.de> Message-ID: <20000404092837.944E889@tmpc200.medien.tecmath.de> In comp.lang.python, you wrote: >On Sat, Apr 01, 2000 at 12:00:00PM -0500, Guido van Rossum wrote: >> >> Python strings can now be stored as Unicode strings. To make it easier >> to type Unicode strings, the single-quote character defaults to creating >> a Unicode string, while the double-quote character defaults to ASCII >> strings. If you need to create a Unicode string with double quotes, >> just preface it with the letter "u"; likewise, an ASCII string can be >> created by prefacing single quotes with the letter "a". For example: >> >> foo = 'hello' # Unicode >> foo = "hello" # ASCII > >Is single-quoting for creating unicode clever ? I think there might be a problem >with old code when the operations on unicode strings are not 100% compatible to >the standard string operations. I don't know if this is a real problem - it's >just a point for discussion. > >Cheers, >Andreas > Hallo Andreas, hast Du mal auf das Datum des Beitrages von Guido geschaut? Echt guter April- Scherz, da er die Scherze sehr gut mit der Realit?t mischt. Liebe Gr??e, auch an die anderen, Joachim From robin at alldunn.com Tue Apr 18 16:42:35 2000 From: robin at alldunn.com (Robin Dunn) Date: Tue, 18 Apr 2000 13:42:35 -0700 Subject: Starship update: April 18 References: <3du2gzmiki.fsf@amarok.cnri.reston.va.us> Message-ID: > * If you had downloadable files on Starship (such as software) > which you no longer have copies of, you might want to post to > comp.lang.python or the appropriate mailing list and ask if > anyone grabbed a copy recently. > The only thing of value that I have (potentially) lost is the archives of the wxPython-users mailman list. Did anybody happen to have downloaded them? -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From dan at cgsoftware.com Wed Apr 12 09:16:00 2000 From: dan at cgsoftware.com (Daniel Berlin+list.python) Date: 12 Apr 2000 09:16:00 -0400 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) In-Reply-To: tom__98@my-deja.com's message of "Wed, 12 Apr 2000 06:15:34 GMT" References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d149t$jo6$1@nnrp1.deja.com> Message-ID: >>>>> "tom" == tom 98 writes: tom> -- How can I browse the Python documentation without firing tom> up a web browser? >> Convert it to text format. It's latex, you can make it into >> anything you want, and do anything you want with it. tom> Well, what I'm suggesting is that it might be a good idea to tom> make a command-line accessible version of the documentation, tom> together with a command line tool, available as part of the tom> standard distribution. Sure, i'm all for it, and i'm sure it's being worked on. tom> -- Is there a Python equivalent of CPAN and the Perl CPAN tom> module? The closest I know of is Parnassus. But Parnassus tom> is merely a collection of links, not an archive, and it tom> doesn't have any facilities (AFAIK) for automatic tom> installation. >> So, who gives a crap? I try not to be that lazy. tom> So, you are saying that you basically agree: compiling and tom> installing modules is more work on Python, but that really tom> shouldn't matter because expecting to install modules quickly tom> is just laziness. Well, I admit it, I'm lazy. You'll have to excuse me, i have a problem with the CPAN module. Namely, i have yet to install a single PERL module, and it claims there are 203 installed modules with no parseable version number. So there are 203 installed modules, which i didn't install, that it can't tell me anything about. That's not very helpful. Whenever i try to upgrade any of my installed modules, they install fine, yet the CPAN module never notices. I have to manually go and do some cleanup before it notices the new versions. It's more of an annoyance to me than anything else. tom> perldoc and the Perl CPAN module are really nice and well tom> done, perldoc yes. tom> and as a user, I miss that functionality when I use tom> Python. tom> Why not learn from Perl where they did something tom> good? Because i don't feel they did it all that well. tom> This antagonism between the two camps, expressed in tom> your and other posts, just seems really silly to me as a user tom> of both languages. You'll have to pardon me. I have PERL angst from trying to write an HMM based Part of Speech tagger in PERL. tom> Tom. tom> Sent via Deja.com http://www.deja.com/ Before you buy. -- tom> http://www.python.org/mailman/listinfo/python-list From laird at tsunami.ecn.purdue.edu Sat Apr 22 09:04:47 2000 From: laird at tsunami.ecn.purdue.edu (Kyler Laird) Date: 22 Apr 2000 13:04:47 GMT Subject: Using python on the web References: <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> Message-ID: <8ds81f$qne$1@mozo.cc.purdue.edu> amphgobb at bjord.org (amphgobb) writes: >I am not aware of many sysadmins who allow universal CGI access without >mod_perl, and a cgi-wrapper. Hmmm...cgi-wrapper doesn't work with mod_perl (or mod_php, or ...), right? (This is why I built my own system to do the job.) --kyler From akira.kiyomiya at autodesk.com Wed Apr 26 14:44:45 2000 From: akira.kiyomiya at autodesk.com (Akira Kiyomiya) Date: Wed, 26 Apr 2000 11:44:45 -0700 Subject: Simple Function Question Message-ID: <8e7dh3$1gc@autodesk.autodesk.com> Hi, Could you explain this in dummy's language? This function prints out '4' and I have a feeling that x=1 and n=3, so add1(3) prints '4'. However, I have a difficlut time trying to see how these two arguments assigned to both x (especially x) and n. Thanks Akira # Return a function that returns its argument incremented by 'n' def make_incrementer(n): def increment(x, n=n): return x+n return increment add1 = make_incrementer(1) print add1(3) # This prints '4' From claird at starbase.neosoft.com Fri Apr 21 09:48:03 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 21 Apr 2000 08:48:03 -0500 Subject: Good style for multi-valued returns References: <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7@lp.airnews.net> Message-ID: <43E1059BD6C613C1.19161A8DC1C439F1.3E710DAA95C4F8D8@lp.airnews.net> In article , Michael Hudson wrote: >claird at starbase.neosoft.com (Cameron Laird) writes: > >> Let me guess: folks generally pass tuples for small and >> determinate-in-number multi-values, and dictionaries other- >> wise, 'cept some do it all with tuples. Accurate? > >I've always used tuples; I wouldn't have thought of something that >returns a dictionary as return multiple values. > >Any reason for asking? . . . "Reason"? You want a *reason*? Well, sure, there are plenty of those: it's time for me to be more of a producer than consumer (of methods); I've been thinking about decomposition; I didn't notice any- thing in Guido's style guide; I'm eager to learn more; ... Particular thanks to the three people who've already gently written to remind me that what I really want in the complex-and-big case is to return an *object* (but why do you all call it a class? To my ear, it truly sounds like a confusion to say, "class", rather than, "instance of a class"). I think I still have special cases where I want to move dictionaries around, but I'm learning that their proper domain is much smaller than I used to believe. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From chapman at bioreason.com Mon Apr 17 15:21:40 2000 From: chapman at bioreason.com (Mitch Chapman) Date: Mon, 17 Apr 2000 13:21:40 -0600 Subject: Scripting and Gnome and KDE References: <8d95m0$9j6$1@news1.xs4all.nl> <8damat$4ja$1@slb2.atl.mindspring.net> <8dbsgc$35o$1@news1.xs4all.nl> <38FB4336.2BC6C235@bioreason.com> <87bt38h8wq.fsf@parus.parus.no> Message-ID: <38FB6444.939CE6D6@bioreason.com> Jon K Hellan wrote: > You should definitely have mentioned libglade, which in most cases > makes it unnecessary to code the Gtk GUI at all. You still have to do > the callbacks, of course. Yep, for static UIs (ones in which user interface elements are not added dynamically at runtime), libglade saves all kinds of effort. We had not used it at the time the article was written (September 1999), which is one reason why it was not mentioned. -- Mitch Chapman chapman at bioreason.com Return-Path: Delivered-To: python-list at python.org Received: from mailgizmo.com (105.164.200.216.fastpoint.net [216.200.164.105]) by dinsdale.python.org (Postfix) with ESMTP id 995E51CE50 for ; Mon, 17 Apr 2000 15:03:55 -0400 (EDT) Received: (from phord at localhost) by mailgizmo.com (8.9.3/8.9.3) id PAA26768; Mon, 17 Apr 2000 15:00:59 -0400 From: nathan_christensen at peoplesoft.com X-Envelope-To: X-Server-Uuid: b85f21a3-cfd1-11d3-8401-00104bf46ab7 Cc: AMitchell at origin.ea.com, bryanandlacey at earthlink.net, carma at carmapro.com, cujorover at earthlink.net, Disalphafu at aol.com, eovelman at origin.ea.com, falconson at nettally.com, fischer at tsgc.utexas.edu, funny at phord.com, goldie.mcelroy at attws.com, joe.maloukis at mail.va.gov, jtaylor at gfbank.com, jttaylor at flash.net, karyn at nightfire.com, kevin at aestechnology.com, Kizzy_Williams at yahoo.com, kmagill at prysm.net, knaack at gwatt.com, lachtaylor at yahoo.com, lbyrne at creativelabs.com, lindt at mail.utexas.edu, lmwwelsh at yahoo.com, lrosens at home.com, mar4 at texas.net, matsaleh at texas.net, matw at player1.com, mbakonyi at pencom.com, mbutler at esginc.com, mcginnis at texas.net, melanie at vsearch.com, mhornbuc at etec.com, mikeb at pencom.com, mike.cato at amd.com, mjerman at itrsjobs.com, mjgreathouse at juno.com, mkasper at mshow.com, monty_hornbuckle at etec.com, mrcambron at earthlink.net, MThor at aol.com, pbuchorn at gator1.brazosport.cc.tx.us, postmaster at novacell.com, python-list at python.org, ra6200 at email.sps.mot.com, rayjunem at juno.com, Ray_Grosvenor at Dell.com, rbarton at bbs.wiztower.com, rds at attymail.com, rgrosvenor at austin.rr.com, rong at cmsopen.com, rstidolph at austin.rr.com, san2edb at ups.com, scotts at illuminactive.com, seans at cmsopen.com, sitnalta at cableone.net, skip at Aureal.com, Srhughes30 at aol.com, stidolph at origin.ea.com, stone at golden-gate.org, tandmel at juno.com, Tanea_Greenwood at amat.com, tech_support at Quantum3D.com, terri.calloway at stanford.edu, tgif at iconn.net, Tiggerree at aol.com, tjhuff at msn.com, tlujan1 at hotmail.com, Tonya.Ochiltree at ci.austin.tx.us, tracie at austin.rr.com, tsmith at cs.utexas.edu, tt at peakware.com, Veronicahu at aol.com, vocooper at juno.com, WanChef at aol.com, wayne.stidolph at lutris.com, y2krdi at aol.com X-Mailer: Lotus Notes Release 5.0.1 July 16, 1999 Message-ID: Date: Mon, 17 Apr 2000 11:56:55 -0700 X-MIMETrack: Serialize by Router on SMTPOUT/Server/PSExternal(Release 5.0.2b |December 16, 1999) at 04/17/2000 12:05:20 PM MIME-Version: 1.0 X-WSS-ID: 14E580871000386-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mailgizmo.com id OAA26751 X-Loop: funny at phord.com To: funny at phord.com Subject: funny: Re: May 27th PARTY! 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.0beta3 Precedence: bulk List-Id: General discussion list for the Python programming language Sounds like a blast...What should I bring? Nate "Rebecca Stidolph" To: "Wayne Stidolph" , , , "Veronica Hughes" , in.rr.com> "Val Cooper" , "Trevor Lind" , "Tracie Thor" , , 04/15/00 08:47 "Tom Taylor" , "Todd Hughes" , PM "Tim Huffman" , "Tim and Melody Martin" , "Tim and Cindy Martin" , "Tim" , , "Thad Smith" , "Terry Thompson" , "Terri Calloway" , "tech_support" , "Taylor, Jacki" , "Tanya Lujan" , , "Stone Eleazer" , "Stidolph, David" , "Steven Jumper" , "Stan Edwards" , "Skip McIlvaine" , "Sheridan Layman" , "Sean Stanley" , "Scott Schimpf" , , "Ron Gilbert" , "Roja, Elena" , "Robert Knaack" , "Richard Barton" , , "Rebecca Stidolph" , , "Ray O. Grosvenor" , "Ray and June Minyard" , "Python-List @ python. org" , "Python Mailing List" , "postmaster" , "'Peggy Buchorn'" , "Ovelman, Elizabeth" , "Nathan Christensen" , "Monty Hornbuckle" , "Monty Hornbuckle" , "Mitchell, Andy" , "Mike Jerman" , "Mike Greathouse" , "Mike Cato" , "Michael Bakonyi" , "Michael & Treasa McGinnis" , "Melinda Kasper" , "Melanie R. Cambron" , "Melanie Cambron" , "Mcelroy, Goldie" , , , "Matt Weathers" , "Matt Walker" , "Mark Thor" , "Mark Fischer" , "Mark Fischer" , "Margaret Warren" , "Maloukis, Joe" , "Leon Rosenhein" , "Lbyrne" , "Laurie Welsh" , "Lach Taylor" , "Kurt Schmidt" , "Kizzy_Williams at amat.com" , "Kevin Cooper" , "Kelsi" , "Kelley Magill" , "Karyn Christensen" , "A1C Bryan A. and Mrs. Lacey D. Buchorn" cc: Subject: May 27th PARTY! ATTENTION FRIENDS AND FAMILY AROUND THE NATION!! We (David and Rebecca Stidolph) are celebrating our 17th wedding anniversary with a big BBQ bash on Saturday, May 27th!? We want everyone to come, so we're giving plenty of notice.? Please set aside the late afternoon and evening to have lots of fun! Please reply if you would like to come, so we can include you in future e-mails for more information. Love, David and Rebecca, Kelley and Kenneth PS Sorry for any duplicate e-mails.? Let us know if you got more than two. Thanks! Return-Path: Delivered-To: python-list at python.org Received: from mail.austin.rr.com (sm1.texas.rr.com [24.93.35.54]) by dinsdale.python.org (Postfix) with ESMTP id 3E0881CDB8 for ; Sat, 15 Apr 2000 23:51:23 -0400 (EDT) Received: from play1 ([24.160.3.64]) by mail.austin.rr.com with Microsoft SMTPSVC(5.5.1877.357.35); Sat, 15 Apr 2000 22:48:00 -0500 Message-ID: <006201bfa756$896e5a80$da00a8c0 at austin.rr.com> From: "Rebecca Stidolph" To: "Wayne Stidolph" , , "Viele Humor" , "Veronica Hughes" , "Val Cooper" , "Trevor Lind" , "Tracie Thor" , , "Tom Taylor" , "Todd Hughes" , "Tim Huffman" , "Tim and Melody Martin" , "Tim and Cindy Martin" , "Tim" , , "Thad Smith" , "Terry Thompson" , "Terri Calloway" , "tech_support" , "Taylor, Jacki" , "Tanya Lujan" , , "Stone Eleazer" , "Stidolph, David" , "Steven Jumper" , "Stan Edwards" , "Skip McIlvaine" , "Sheridan Layman" , "Sean Stanley" , "Scott Schimpf" , , "Ron Gilbert" , "Roja, Elena" , "Robert Knaack" , "Richard Barton" , , "Rebecca Stidolph" , , "Ray O. Grosvenor" , "Ray and June Minyard" , "Python-List @ python. org" , "Python Mailing List" , "postmaster" , "'Peggy Buchorn'" , "Ovelman, Elizabeth" , "Nathan Christensen" , "Monty Hornbuckle" , "Monty Hornbuckle" , "Mitchell, Andy" , "Mike Jerman" , "Mike Greathouse" , "Mike Cato" , "Michael Bakonyi" , "Michael & Treasa McGinnis" , "Melinda Kasper" , "Melanie R. Cambron" , "Melanie Cambron" , "Mcelroy, Goldie" , , , "Matt Weathers" , "Matt Walker" , "Mark Thor" , "Mark Fischer" , "Mark Fischer" , "Margaret Warren" , "Maloukis, Joe" , "Leon Rosenhein" , "Lbyrne" , "Laurie Welsh" , "Lach Taylor" , "Kurt Schmidt" , "Kizzy_Williams at amat.com" , "Kevin Cooper" , "Kelsi" , "Kelley Magill" , "Karyn Christensen" , "A1C Bryan A. and Mrs. Lacey D. Buchorn" Subject: May 27th PARTY! Date: Sat, 15 Apr 2000 22:47:16 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_005C_01BFA72C.8C651E60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 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.0beta3 Precedence: bulk List-Id: General discussion list for the Python programming language This is a multi-part message in MIME format. ------=_NextPart_000_005C_01BFA72C.8C651E60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ATTENTION FRIENDS AND FAMILY AROUND THE NATION!! We (David and Rebecca Stidolph) are celebrating our 17th wedding = anniversary with a big BBQ bash on Saturday, May 27th! We want everyone = to come, so we're giving plenty of notice. Please set aside the late = afternoon and evening to have lots of fun! =20 Please reply if you would like to come, so we can include you in future = e-mails for more information. Love,=20 David and Rebecca, Kelley and Kenneth PS Sorry for any duplicate e-mails. Let us know if you got more than = two. Thanks! ------=_NextPart_000_005C_01BFA72C.8C651E60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
ATTENTION FRIENDS AND FAMILY AROUND THE = NATION!!
 
We (David and Rebecca Stidolph) are = celebrating our=20 17th wedding anniversary with a big BBQ bash on Saturday, May = 27th!  We=20 want everyone to come, so we're giving plenty of = notice. =20 Please set aside the late afternoon and evening to have lots of = fun! =20
 
Please reply if you would like to come, = so we can=20 include you in future e-mails for more information.
 
Love,
David and Rebecca, Kelley and = Kenneth
 
PS Sorry for any duplicate = e-mails.  Let us=20 know if you got more than two.  Thanks!
------=_NextPart_000_005C_01BFA72C.8C651E60-- Return-Path: Delivered-To: python-list at python.org Received: from mail.channel21.com (unknown [209.139.165.10]) by dinsdale.python.org (Postfix) with SMTP id 1FFFB1CD0E; Fri, 14 Apr 2000 17:45:58 -0400 (EDT) Received: by XENON with Internet Mail Service (5.5.2650.21) id <2PBTHPD9>; Fri, 14 Apr 2000 18:08:00 -0400 Message-ID: <81DD38F43381D111BA3E00A076A0998A45A00A at XENON> From: Channel21 Python Team Reply-To: Channel21 Python Team To: "'python-list at python.org'" , "'python-sig at python.org'" , "'thread-sig at python.org'" Subject: FW: problems w/ IIS - Microsoft says it's python... Date: Fri, 14 Apr 2000 18:07:54 -0400 Importance: high X-Priority: 1 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01BFA65D.E540DE90" 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.0beta3 Precedence: bulk List-Id: General discussion list for the Python programming language This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01BFA65D.E540DE90 Content-Type: text/plain something I sent to mark, just FYI to you guys (maybe you have some suggestions) > ---------- > From: Jason Nadler > Sent: Friday, April 14, 2000 6:02 PM > To: 'mhammond at skippinet.com.au' > Subject: problems w/ python and IIS - Microsoft says it's python... > Importance: High > My IIS has been crashing more frequently lately w/ more traffic to the machine, so I opened up a ticket w/ the IIS guys at Microsoft and they gave me some software (IIS Exception Monitor) which trapped the stuff loaded im memory and it points to the python interpreter. They say the problem is definitely w/ python and they can't (won't) fix it, or even address it, any further. The IIS services are now crashing about once an hour... I attached 2 of the log files here and an excerpt. > <> <> > You can open the attached files w/ notepad... (look for instance 39 in the > 173 file, and instance 22 in the 332 file - they are actually the same...) > > here is what instance 39 from the 173 file looks like: > > 39 id: ad.5d Suspend: 0 Teb 7ff93000 Unfrozen > Stack frame count of 0x300 is too high. Changing to 500. > ChildEBP RetAddr Args to Child > 01bafd68 1e142143 0ae13b80 00000000 0aee1f60 > python15!PyThreadState_Clear+0x6d > 01bafd78 1e14267f 0aee1f60 00000000 1e2a2401 > python15!PyInterpreterState_Clear+0x13 > 01bafd84 1e2a2401 01bafda4 1e2c4fd8 00000000 python15!Py_Finalize+0x3f > 01bafdec 680c3b32 01bafe6c 00139248 77f050f0 > pythoncom15!PyCom_DLLReleaseRef+0x71 > 01bafe34 680c2f38 000dfa58 00000000 01bafec0 asp!CAppConfig__SetValue+0xc8 > 01bafe7c 680c78c0 000dfa58 000c4698 01bafec0 asp!CPerfMainBlock__Init+0x47 > 01bafecc 680e25c6 00000000 697e1898 00313ea0 > asp!CConnectionPoint__~CConnectionPoint+0x6 > 01bafee4 697e67cc 00000000 697e1898 0aceefc0 > asp!_IASPObjectContextCustomStubVtbl+0x95 > 01baff24 697e57ce 00148598 697f21de 77f0178b > MTxEx!CActivity__CallWithNewContext+0xac > 77f67610 4affc033 89257508 fff00c42 037d044a > MTxEx!CQueuedRequest__~CQueuedRequest+0x5e > 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 > > > > PLEASE HELP!!! I am having the worst day... > ------_=_NextPart_000_01BFA65D.E540DE90 Content-Type: application/octet-stream; name="IIS_173-153131-413-2000.dbl" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="IIS_173-153131-413-2000.dbl" Auto4/13/00 3:31:31 = PM4/13/00 10:39:41 = PMManual log file opened 0:044> !emdbg.tag IIS Exception Monitor 6.1.0.0 Loaded emdbg extension DLL IIS Exception Monitor 6.1.0.0 0:044> !emdbg.tag = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 0:044> !emdbg.tag =3D=3D Your Web Server should be running now, DON'T = press Ctl-C Now. =3D=3D Your Web Server should be running now, DON'T press Ctl-C Now. 0:044> !emdbg.tag = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 0:044> !emdbg.tag =3D=3D Wait until the application stops serving pages = and then press Ctl-C in this window =3D=3D Wait until the application stops serving pages and then press = Ctl-C in this window 0:044> !emdbg.tag =3D=3D If you press Ctl-C, you can use the log to = look for 100% CPU utilization =3D=3D If you press Ctl-C, you can use the log to look for 100% CPU = utilization 0:044> !emdbg.tag =3D=3D however it may not be able to tell you which = module is causing your instability =3D=3D however it may not be able to tell you which module is causing = your instability 0:044> !emdbg.tag = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 0:044> sxd ch 0:044> g CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 0e030000 0e041000 C:\Perl\bin\perlis.dll LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll PerlCRT.dll base 78000000 relocated due to collision with = C:\WINNT\system32\MSVCRT.dll CDB ModLoad: 02140000 02188000 C:\WINNT\system32\PerlCRT.dll LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll PerlCore.dll base 10000000 relocated due to collision with = C:\Program Files\WEBTREND\Plugins\IIS4\RevDNS.dll CDB ModLoad: 025a0000 02627000 C:\Perl\bin\PerlCore.dll CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll Socket.dll base 10000000 relocated due to collision with = C:\Program Files\WEBTREND\Plugins\IIS4\RevDNS.dll CDB ModLoad: 02a70000 02a77000 C:\Perl\lib\auto\Socket\Socket.dll CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 68e50000 68e56000 C:\WINNT\system32\WAMREGPS.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll IO.dll base 10000000 relocated due to collision with = C:\Program Files\WEBTREND\Plugins\IIS4\RevDNS.dll CDB ModLoad: 07d10000 07d16000 C:\Perl\lib\auto\IO\IO.dll CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB: exception number 800706be CDB: exception number 800706ba CDB: exception number 800706ba CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 800706ba CDB: exception number 800706ba CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: access violation eax=3D00000002 ebx=3D680ec470 ecx=3Dffffffff edx=3D7803c120 = esi=3D0ae13b80 edi=3D00000000 eip=3D1e1422ed esp=3D01bafd64 ebp=3D01bafdec iopl=3D0 nv up ei = pl nz na pe nc cs=3D001b ss=3D0023 ds=3D0023 es=3D0023 fs=3D003b gs=3D0000 = efl=3D00010202 *** WARNING: Using export symbols for python15.dll python15!PyThreadState_Clear+0x6d: 1e1422ed 8b08 mov ecx,[eax] = ds:0023:00000002=3D???????? 0:039> kv *** WARNING: Using export symbols for pythoncom15.dll *** WARNING: symbols checksum and timestamp is wrong 0x0005847a = 0x000512f3 for asp.dll *** WARNING: symbols checksum and timestamp is wrong 0x000784a0 = 0x00078fb6 for mtxex.dll ChildEBP RetAddr Args to Child 01bafd68 1e142143 0ae13b80 00000000 0aee1f60 = python15!PyThreadState_Clear+0x6d (FPO: [1,0,2]) 01bafd78 1e14267f 0aee1f60 00000000 1e2a2401 = python15!PyInterpreterState_Clear+0x13 (FPO: [1,0,2]) 01bafd84 1e2a2401 01bafda4 1e2c4fd8 00000000 python15!Py_Finalize+0x3f = (FPO: [0,0,1]) 01bafdec 680c3b32 01bafe6c 00139248 77f050f0 = pythoncom15!PyCom_DLLReleaseRef+0x71(FPO: [Non-Fpo] 01bafe34 680c2f38 000dfa58 00000000 01bafec0 = asp!CAppConfig__SetValue+0xc8(FPO: [Non-Fpo] 01bafe7c 680c78c0 000dfa58 000c4698 01bafec0 = asp!CPerfMainBlock__Init+0x47(FPO: [Non-Fpo] 01bafecc 680e25c6 00000000 697e1898 00313ea0 = asp!CConnectionPoint__~CConnectionPoint+0x6 (FPO: [0,0,2]) 01bafee4 697e67cc 00000000 697e1898 0aceefc0 = asp!_IASPObjectContextCustomStubVtbl+0x95(FPO: [Non-Fpo] 01baff24 697e57ce 00148598 697f21de 77f0178b = MTxEx!CActivity__CallWithNewContext+0xac(FPO: [Non-Fpo] 77f67610 4affc033 89257508 fff00c42 037d044a = MTxEx!CQueuedRequest__~CQueuedRequest+0x5e(FPO: [Non-Fpo] 0424548b 000003e6 0006ef54 0006ee98 00000008 0x4affc033 [Stdcall: 20] 0:039> !emdbg.sysinfo OBERON C:\WINNT\System32 4.0 (Build 1381) Service Pack 6 2 x86 Pentium Pro or PII 1073135616 bytes 920686592 bytes 1304231936 bytes 1181814784 bytes A:\ Removable C:\ Fixed Drive 4194860032 bytes 1352962560 bytes 2841897472 bytes 4c8e8b33 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION D:\ Fixed Drive 36413280256 bytes 702312448 bytes 35710967808 bytes 342d9cd8 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION E:\ Fixed Drive 36413280256 bytes 9957376 bytes 36403322880 bytes 50397a26 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION F:\ Removable G:\ CDROM L:\ Fixed Drive 4902232064 bytes 1175777280 bytes 3726454784 bytes 70239c30 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION 0:039> !inetdbg.mod Loaded inetdbg extension DLL Start End Entry Path 01000000 01005000 01001d80 C:\WINNT\System32\inetsrv\inetinfo.exe 77f60000 77fbe000 00000000 C:\WINNT\System32\ntdll.dll 78000000 78045000 7800256b C:\WINNT\system32\MSVCRT.dll 77f00000 77f5e000 77f01000 C:\WINNT\system32\KERNEL32.dll 77dc0000 77dff000 77dc1000 C:\WINNT\system32\ADVAPI32.dll 77e70000 77ec5000 77e781d7 C:\WINNT\system32\USER32.dll 77ed0000 77efc000 00000000 C:\WINNT\system32\GDI32.dll 77e10000 77e67000 77e186bf C:\WINNT\system32\RPCRT4.dll 77b20000 77bd7000 77b24d6e C:\WINNT\system32\ole32.dll 68e80000 68e86000 68e810bc C:\WINNT\System32\inetsrv\rpcref.dll 77bf0000 77bf7000 00000000 C:\WINNT\system32\rpcltc1.dll 683a0000 683a7000 683a15a8 C:\WINNT\System32\inetsrv\iisadmin.dll 68220000 6822c000 682269e0 C:\WINNT\System32\inetsrv\COADMIN.dll 70980000 70b28000 709868fb C:\WINNT\system32\SHELL32.dll 710d0000 710f3000 710d14ce C:\WINNT\system32\SHLWAPI.dll 77aa0000 77b15000 77aa1b4d C:\WINNT\system32\COMCTL32.dll 68020000 6802a000 68022a91 C:\WINNT\system32\ADMWPROX.dll 74880000 74894000 74881000 C:\WINNT\system32\userenv.dll 77800000 7783a000 77801000 C:\WINNT\system32\NETAPI32.dll 77840000 77849000 00000000 C:\WINNT\system32\NETRAP.dll 777e0000 777ed000 00000000 C:\WINNT\system32\SAMLIB.dll 68900000 6890d000 68906180 C:\WINNT\System32\inetsrv\nsepm.dll 68440000 68450000 68448800 C:\WINNT\system32\IISMAP.dll 77400000 77429000 7740382b C:\WINNT\system32\schannel.dll 5e380000 5e3a5000 5e3a0920 C:\WINNT\system32\MSOSS.dll 776d0000 776d8000 00000000 C:\WINNT\system32\WSOCK32.dll 776b0000 776c4000 776b36b5 C:\WINNT\system32\WS2_32.dll 776a0000 776a7000 776a110e C:\WINNT\system32\WS2HELP.dll 5cf00000 5cf5e000 5cf06b44 C:\WINNT\system32\CRYPT32.dll 68df0000 68e03000 68df2b1f C:\WINNT\System32\inetsrv\metadata.dll 68c90000 68c9b000 68c91f80 C:\WINNT\System32\inetsrv\wamreg.dll 5f400000 5f4f2000 5f4065ff C:\WINNT\system32\MFC42.DLL 65340000 653d2000 6534ee21 C:\WINNT\system32\OLEAUT32.dll 7ca00000 7ca1b000 7ca0b2cc C:\WINNT\system32\rsabase.dll 5a800000 5a80f000 5a802004 C:\WINNT\system32\pstorec.dll 68db0000 68db7000 68db2b10 C:\WINNT\System32\inetsrv\admexs.dll 68ea0000 68ea7000 68ea2350 C:\WINNT\System32\inetsrv\svcext.dll 68330000 68345000 68336930 C:\WINNT\System32\inetsrv\ftpsvc2.dll 68590000 685bf000 68594a93 C:\WINNT\System32\inetsrv\INFOCOMM.dll 68620000 6862e000 68625f71 C:\WINNT\System32\inetsrv\ISATQ.dll 682b0000 682b6000 682b17b4 C:\WINNT\System32\inetsrv\IISFECNV.dll 678a0000 67923000 678ef3b0 C:\WINNT\System32\inetsrv\SMTPSVC.dll 77a90000 77a9b000 77a92fd0 C:\WINNT\system32\VERSION.dll 779c0000 779c8000 779c1881 C:\WINNT\system32\LZ32.dll 679a0000 679aa000 679a1230 C:\WINNT\system32\exstrace.dll 67780000 67786000 677811c0 C:\WINNT\system32\RWNH.dll 68c00000 68c39000 68c1c344 C:\WINNT\System32\inetsrv\w3svc.dll 68560000 68568000 68562f47 C:\WINNT\system32\inetsloc.dll 77670000 77685000 77672599 C:\WINNT\system32\MSWSOCK.dll 76e70000 76e82000 76e71000 C:\WINNT\system32\security.dll 68820000 68827000 6882132a C:\WINNT\System32\inetsrv\lonsint.dll 47600000 4760e000 47608a10 C:\WINNT\system32\wintrust.dll 74fa0000 74fab000 00000000 C:\WINNT\system32\RpcLtScm.Dll 77660000 7766f000 77663bc8 C:\WINNT\system32\msafd.dll 77690000 77699000 77691000 C:\WINNT\System32\wshtcpip.dll 74ff0000 74ffe000 74ff7b68 C:\WINNT\System32\rnr20.dll 60000000 60011000 60006440 C:\WINNT\system32\msapsspc.dll 779d0000 779e5000 779d1000 C:\WINNT\system32\MSVCRT40.dll 780a0000 780b2000 780a1000 C:\WINNT\system32\MSVCIRT.dll 011a0000 011bf000 011a52c0 C:\WINNT\system32\msnsspc.dll 77e00000 77e06000 00000000 C:\WINNT\system32\rpclts1.dll 74fc0000 74fcf000 00000000 C:\WINNT\system32\RpcLtCcm.Dll 68650000 68659000 686519e8 C:\WINNT\System32\inetsrv\iscomlog.dll 677b0000 67802000 677b6b30 C:\WINNT\System32\inetsrv\seo.dll 68a10000 68a19000 68a126d6 C:\WINNT\System32\inetsrv\sspifilt.dll 74480000 74488000 00000000 C:\WINNT\System32\wshisn.dll 67860000 67868000 678613e0 c:\program files\microsoft = frontpage\bin\fpexedll.dll 75830000 7585a000 7583636b C:\WINNT\System32\nwprovau.dll 77720000 77731000 777278db C:\WINNT\system32\MPR.dll 67ec0000 67ec5000 67ec1460 C:\Program Files\Microsoft = FrontPage\version3.0\bin\fpexedll.dll 74470000 74477000 74471000 C:\WINNT\system32\wshnetbs.dll 68410000 68421000 684160c8 C:\WINNT\System32\inetsrv\iislog.dll 10000000 10008000 100025f0 C:\Program = Files\WEBTREND\Plugins\IIS4\RevDNS.dll 017d0000 017d8000 017d27a0 C:\Program = Files\WEBTREND\Plugins\IIS4\wtCookie.dll 68890000 688a6000 6889244e C:\WINNT\System32\inetsrv\wam.dll 697e0000 6984c000 6981c900 C:\WINNT\System32\mtxex.dll 69d00000 69d1a000 69d10490 C:\WINNT\System32\MTSEvents.DLL 69a90000 69a9a000 69a94690 C:\WINNT\System32\MTxInfr1.dll 69ab0000 69abd000 69ab5cf0 C:\WINNT\System32\MTxInfr2.dll 69620000 69630000 696289a0 C:\WINNT\System32\MTxRn.DLL 6b550000 6b556000 6b551480 C:\WINNT\System32\MTxPerf.dll 69a70000 69a7a000 69a74220 C:\WINNT\System32\MfcSubs.dll 690b0000 690ce000 690c5a00 C:\WINNT\System32\DTCCM.dll 69000000 6900a000 69004180 C:\WINNT\System32\DTCUtil.dll 68ff0000 68ff7000 68ff1420 C:\WINNT\System32\DTCTRACE.dll 69790000 6979d000 69798460 C:\WINNT\System32\MTXCLU.DLL 699c0000 699cc000 699c4f00 C:\WINNT\System32\MTXTRK.DLL 69360000 69369000 69361d40 C:\WINNT\System32\XOLEHLP.dll 69120000 69133000 6912d300 C:\WINNT\System32\ADME.dll 69a20000 69a2b000 69a24a30 C:\WINNT\System32\MtxDm.dll 69640000 69671000 69656720 C:\WINNT\System32\MtxCat.dll 1f7d0000 1f804000 1f7d12d4 C:\WINNT\System32\ODBC32.dll 77d80000 77db2000 77d81000 C:\WINNT\system32\comdlg32.dll 7f230000 7f23d000 00000000 C:\WINNT\system32\CLUSAPI.DLL 7f250000 7f25a000 7f2516f8 C:\WINNT\system32\RESUTILS.DLL 1f8c0000 1f8d6000 00000000 C:\WINNT\System32\odbcint.dll 697c0000 697ca000 697c4d10 C:\WINNT\System32\Mts\mtxact.dll 69a40000 69a5b000 69a4f730 C:\WINNT\system32\mtxoci.dll 680b0000 680ff000 680e2c80 C:\WINNT\System32\inetsrv\asp.dll 6b600000 6b66b000 6b605359 C:\WINNT\System32\vbscript.dll 1e2a0000 1e2e2000 1e2c4d6d C:\WINNT\system32\pythoncom15.dll 1e600000 1e611000 1e606f5a C:\WINNT\system32\PyWinTypes15.dll 1e100000 1e186000 1e1583c0 C:\WINNT\system32\python15.dll 77fd0000 77ffa000 77fd5640 C:\WINNT\system32\WINMM.dll 1e200000 1e20e000 1e206fa3 C:\Program Files\Python\win32\win32api.pyd 01d30000 01d42000 01d37a18 C:\Program = Files\Python\win32comext\axscript\axscript.pyd 1e3b0000 1e3e8000 1e3d1b6f C:\Program = Files\Python\win32comext\axdebug\axdebug.pyd 1e360000 1e366000 1e361855 C:\Program Files\Python\win32\dbi.dll 1e350000 1e358000 1e3534c5 C:\Program Files\Python\win32\odbc.pyd 41230000 412ae000 41231000 C:\WINNT\System32\sqlsrv32.dll 41100000 4110c000 411061e0 C:\WINNT\System32\SQLWOA.dll 1f820000 1f83a000 1f82c63c C:\WINNT\system32\odbccp32.dll 68c80000 68c86000 68c81510 C:\WINNT\System32\inetsrv\wamps.dll 68690000 68696000 68691970 C:\WINNT\System32\inetsrv\iwrps.dll 0e030000 0e041000 0e039d30 C:\Perl\bin\perlis.dll 02140000 02188000 02149010 C:\WINNT\system32\PerlCRT.dll 025a0000 02627000 0260c040 C:\Perl\bin\PerlCore.dll 02a70000 02a77000 02a73c80 C:\Perl\lib\auto\Socket\Socket.dll 68e50000 68e56000 68e514e0 C:\WINNT\system32\WAMREGPS.DLL 07d10000 07d16000 07d12610 C:\Perl\lib\auto\IO\IO.dll 0:039> ~*kb 300 0 id: ad.ac Suspend: 0 Teb 7ffde000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for advapi32.dll *** WARNING: Using export symbols for kernel32.dll ChildEBP RetAddr Args to Child 0006fdb0 77dd8a35 00000050 00073880 0000021a ntdll!ZwReadFile+0xb 0006fde4 77dd8481 00000050 00073880 0000021a = ADVAPI32!RegisterServiceCtrlHandlerA+0x352 0006fe48 77dd829e 00000050 00073880 0000021a = ADVAPI32!StartServiceCtrlDispatcherW+0x184 0006fe6c 0100182c 00073278 68e80000 77f13fb3 = ADVAPI32!StartServiceCtrlDispatcherA+0x82 0006fea4 010015d5 00000000 00000000 7ffdf000 = inetinfo!StartDispatchTable+0x61 0006ff70 01001e7f 00000001 00240550 002401a0 inetinfo!main+0x2a5 0006ffc0 77f1b9ea 00000000 00000000 7ffdf000 = inetinfo!mainCRTStartup+0xff 0006fff0 00000000 01001d80 00000000 000000b0 = KERNEL32!GetProcessPriorityBoost+0x117 1 id: ad.ae Suspend: 0 Teb 7ffdd000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0087fe54 77f04f37 000000b4 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 00000001 000003e6 00000088 77f04f37 0000000f = KERNEL32!WaitForSingleObject+0xf 2 id: ad.34 Suspend: 0 Teb 7ffdc000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for rpcrt4.dll ChildEBP RetAddr Args to Child 0d25ff90 77e15a1d 77e160f7 0007f878 0d25ffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 3 id: ad.6a Suspend: 0 Teb 7ffdb000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for user32.dll *** WARNING: symbols checksum and timestamp is wrong 0x0003b1c7 = 0x0003704a for infocomm.dll ChildEBP RetAddr Args to Child 00e4fd80 77e79de5 00000002 00e4fda8 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00e4fddc 77e79e31 00000001 0028030c ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 00e4fdf8 68599007 00000001 0028030c 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 0028030c 00000000 00000000 00000000 68333581 = INFOCOMM!INetpCreateSecurityDescriptor+0x1cf 4 id: ad.af Suspend: 0 Teb 7ffda000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00e8fd8c 77e79de5 00000002 00e8fdb4 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00e8fde8 77e79e31 00000001 0023ed44 ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 00e8fe04 68599007 00000001 0023ed44 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 0023ed44 00000000 00000000 00000000 678ae3e0 = INFOCOMM!INetpCreateSecurityDescriptor+0x1cf 5 id: ad.b0 Suspend: 0 Teb 7ffd9000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00ecfd80 77e79de5 00000002 00ecfda8 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00ecfddc 77e79e31 00000001 0023e864 ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 00ecfdf8 68599007 00000001 0023e864 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 0023e864 00000000 00000000 00000800 68c09c95 = INFOCOMM!INetpCreateSecurityDescriptor+0x1cf 6 id: ad.b1 Suspend: 0 Teb 7ffd8000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x00013a0e = 0x00011cc1 for isatq.dll ChildEBP RetAddr Args to Child 00f0fef4 77e79de5 00000002 00f0ff1c 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00f0ff50 77e79e31 00000001 68629668 000010e9 = USER32!MsgWaitForMultipleObjectsEx+0xa8 00f0ff6c 68625cce 00000001 68629668 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 00000001 000003e6 00000088 68622913 00000000 = ISATQ!W95CPORT__PrepareDescriptorArrays+0x58 7 id: ad.b2 Suspend: 0 Teb 7ffd7000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00f4fef4 77e79de5 00000002 00f4ff1c 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00f4ff50 77e79e31 00000001 68629668 000010e9 = USER32!MsgWaitForMultipleObjectsEx+0xa8 00f4ff6c 68625cce 00000001 68629668 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 00000001 000003e6 00000088 68622913 00000000 = ISATQ!W95CPORT__PrepareDescriptorArrays+0x58 8 id: ad.b3 Suspend: 0 Teb 7ffd6000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00fcff84 686248e5 0000016c 00fcffac 00fcffb4 = ntdll!ZwRemoveIoCompletion+0xb 00fcffb8 77f04ede abcdef01 00e4fc8c 00e4fcf0 ISATQ!AtqSetInfo+0xbb 00fcffec 00000000 686248a8 abcdef01 00000000 KERNEL32!lstrcmpiW+0xbe 9 id: ad.b4 Suspend: 0 Teb 7ffd5000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0104ff84 686248e5 0000016c 0104ffac 0104ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0104ffb8 77f04ede abcdef01 00e4fc8c 00e4fcf0 ISATQ!AtqSetInfo+0xbb 0104ffec 00000000 686248a8 abcdef01 00000000 KERNEL32!lstrcmpiW+0xbe 10 id: ad.b5 Suspend: 0 Teb 7ffd4000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0108ff88 685a75d5 00000002 0108ffb4 00000000 = ntdll!NtWaitForMultipleObjects+0xb 11 id: ad.b6 Suspend: 0 Teb 7ffaf000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 010cff90 77e15a1d 77e160f7 00084d18 010cffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 12 id: ad.b7 Suspend: 0 Teb 7ffae000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for msafd.dll *** WARNING: Using export symbols for ws2_32.dll *** WARNING: Using export symbols for rpcltscm.dll ChildEBP RetAddr Args to Child 0118fd78 77664a12 000001e0 000001e8 00000001 = ntdll!NtWaitForSingleObject+0xb 0118fea0 776b9f5f 00000000 000854f0 00000000 MSAFD+0x4a12 0118fef0 74fa21e2 00000000 000854f0 00000000 WS2_32!select+0xfc 0118ff2c 77e1b0dc 00086c00 0118ff58 0118ff88 RPCLTSCM+0x21e2 0118ff60 77e1cb96 0118ff8c 0118ff88 0118ff84 = RPCRT4!I_RpcTransServerUnprotectThread+0x48f 0118ff90 77e1aa95 77e160f7 00086b20 0118ffec = RPCRT4!I_RpcTransServerProtectThread+0xcc 00003a98 000003e6 00000088 77e1aa95 000000c8 = RPCRT4!I_RpcTransServerReallocBuffer+0xc8 13 id: ad.b8 Suspend: 0 Teb 7ffad000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 011fff2c 77e1b0dc 00089280 011fff58 011fff88 = ntdll!NtWaitForMultipleObjects+0xb 011fff60 77e1cb96 011fff8c 011fff88 011fff84 = RPCRT4!I_RpcTransServerUnprotectThread+0x48f 011fff90 77e1aa95 77e160f7 000891a0 011fffec = RPCRT4!I_RpcTransServerProtectThread+0xcc 00003a98 000003e6 00000088 77e1aa95 000000c8 = RPCRT4!I_RpcTransServerReallocBuffer+0xc8 14 id: ad.ba Suspend: 0 Teb 7ffac000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0123ff64 77f1cebe 0000ea60 00000000 7583a68a ntdll!NtDelayExecution+0xb 0123ffb8 77f04ede 00000000 00000001 00000000 KERNEL32!Sleep+0xb 0123ffec 00000000 7583a65e 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 15 id: ad.bb Suspend: 0 Teb 7ffab000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x0003e35a = 0x00039d63 for w3svc.dll ChildEBP RetAddr Args to Child 0127fec8 77e79de5 00000002 0127fef0 00000000 = ntdll!NtWaitForMultipleObjects+0xb 0127ff24 77e79e31 00000001 0028186c ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 0127ff40 68c243f1 00000001 0028186c 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 16 id: ad.bc Suspend: 0 Teb 7ffaa000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 012bff00 77e79de5 00000002 012bff28 00000000 = ntdll!NtWaitForMultipleObjects+0xb 012bff5c 77e79e31 00000001 68c2c25c ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 012bff78 68c1c55e 00000001 68c2c25c 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 012bffb8 77f04ede 00000000 00000003 00230000 = W3SVC!HTTP_FILTER__ParseSendHeaders+0x46 012bffec 00000000 68c1c52a 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 17 id: ad.e1 Suspend: 0 Teb 7ffa9000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x000077d7 = 0x0000908e for inetsloc.dll ChildEBP RetAddr Args to Child 012ffcf8 77664a12 00000340 00000240 00000001 = ntdll!NtWaitForSingleObject+0xb 012ffe20 776b9f5f 00000000 012ffe98 00000000 MSAFD+0x4a12 012ffe70 68563c07 00000000 012ffe98 00000000 WS2_32!select+0xfc 012fffb8 77f04ede 00000000 00000000 00000000 = INETSLOC!SocketListenThread+0x51 012fffec 00000000 68563bb6 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 18 id: ad.c7 Suspend: 0 Teb 7ffa8000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0133ff90 77e15a1d 77e160f7 00094390 0133ffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 19 id: ad.cb Suspend: 0 Teb 7ffa7000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0147ff2c 77e1b0dc 00097d58 0147ff58 0147ff88 = ntdll!NtWaitForMultipleObjects+0xb 0147ff60 77e1cb96 0147ff8c 0147ff88 0147ff84 = RPCRT4!I_RpcTransServerUnprotectThread+0x48f 0147ff90 77e1aa95 77e160f7 00097c78 0147ffec = RPCRT4!I_RpcTransServerProtectThread+0xcc 00003a98 000003e6 00000088 77e1aa95 000000c8 = RPCRT4!I_RpcTransServerReallocBuffer+0xc8 20 id: ad.c2 Suspend: 0 Teb 7ffa6000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x00087d67 = 0x0007a2f5 for smtpsvc.dll ChildEBP RetAddr Args to Child 014cff68 77f1cd76 00000002 014cffac 00000000 = ntdll!NtWaitForMultipleObjects+0xb 014cff84 678b9333 00000002 014cffac 00000000 = KERNEL32!WaitForMultipleObjects+0x16 21 id: ad.de Suspend: 0 Teb 7ffa5000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0150ff68 77f1cd76 00000002 0150ffac 00000000 = ntdll!NtWaitForMultipleObjects+0xb 0150ff84 678b9333 00000002 0150ffac 00000000 = KERNEL32!WaitForMultipleObjects+0x16 22 id: ad.dc Suspend: 0 Teb 7ffa4000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0154ff68 77f1cd76 00000002 0154ffac 00000000 = ntdll!NtWaitForMultipleObjects+0xb 0154ff84 678b9333 00000002 0154ffac 00000000 = KERNEL32!WaitForMultipleObjects+0x16 23 id: ad.e2 Suspend: 0 Teb 7ffa3000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0158ff68 77f1cd76 00000002 0158ffac 00000000 = ntdll!NtWaitForMultipleObjects+0xb 0158ff84 678b9333 00000002 0158ffac 00000000 = KERNEL32!WaitForMultipleObjects+0x16 24 id: ad.ef Suspend: 0 Teb 7ffa2000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 015cff68 77f1cd76 00000002 015cffac 00000000 = ntdll!NtWaitForMultipleObjects+0xb 015cff84 678b9333 00000002 015cffac 00000000 = KERNEL32!WaitForMultipleObjects+0x16 25 id: ad.f0 Suspend: 0 Teb 7ffa1000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0160ff8c 77f04f37 00000484 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 77f67610 4affc033 89257508 fff00c42 037d044a = KERNEL32!WaitForSingleObject+0xf 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 26 id: ad.f1 Suspend: 0 Teb 7ffa0000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0164ff8c 77f04f37 00000490 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 77f67610 4affc033 89257508 fff00c42 037d044a = KERNEL32!WaitForSingleObject+0xf 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 27 id: ad.f2 Suspend: 0 Teb 7ff9f000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0168ff8c 77f04f37 0000049c ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 77f67610 4affc033 89257508 fff00c42 037d044a = KERNEL32!WaitForSingleObject+0xf 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 28 id: ad.f3 Suspend: 0 Teb 7ff9e000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 016cff94 77f04f37 000004a8 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 016cffec 00000000 678d5c30 002834e0 00000000 = KERNEL32!WaitForSingleObject+0xf 29 id: ad.f5 Suspend: 0 Teb 7ff9c000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0174ff8c 77f04f37 000004c8 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 77f67610 4affc033 89257508 fff00c42 037d044a = KERNEL32!WaitForSingleObject+0xf 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 30 id: ad.f7 Suspend: 0 Teb 7ff9d000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for revdns.dll ChildEBP RetAddr Args to Child 017cfba4 10001a2b 017cfd70 00000000 00000000 USER32!InvalidateRect+0x19 017cffb8 77f04ede 00000000 00070860 00070000 = REVDNS!CreateConfigTab+0x84e 017cffec 00000000 10001755 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 31 id: ad.f8 Suspend: 0 Teb 7ff9a000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0181ff84 686248e5 0000016c 0181ffac 0181ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0181ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0181ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 32 id: ad.f9 Suspend: 0 Teb 7ff99000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0185ff84 686248e5 0000016c 0185ffac 0185ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0185ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0185ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 33 id: ad.124 Suspend: 0 Teb 7ff9b000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 08c2feb4 77e79de5 00000003 08c2fedc 00000000 = ntdll!NtWaitForMultipleObjects+0xb 08c2ff10 77e79e31 00000002 08c2ff58 000003e8 = USER32!MsgWaitForMultipleObjectsEx+0xa8 08c2ff2c 697f1dbe 00000002 08c2ff58 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 69a92ea0 750169a9 24448b22 244c8b14 24548b10 = MTxEx!ContextWrapper__Recycle+0xe 60b03d83 000003e6 0006ef1c 0006ee60 00000008 0x750169a9 34 id: ad.fd Suspend: 0 Teb 7ff98000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01a1ff80 77f04f37 00000b20 00002710 00000000 = ntdll!NtWaitForSingleObject+0xb 00000000 000003e6 00000088 77f04f37 0000000f = KERNEL32!WaitForSingleObject+0xf 35 id: ad.fe Suspend: 0 Teb 7ff97000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for msvcrt.dll ChildEBP RetAddr Args to Child 01a8fec8 77e79de5 00000002 01a8fef0 00000000 = ntdll!NtWaitForMultipleObjects+0xb 01a8ff24 77e79e31 00000001 680ebddc ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 01a8ff40 680ca30c 00000001 680ebddc 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 01a8ff84 7800be50 680ebdc0 00000008 0000021c = asp!CCookieSupportErr__`vftable'+0xb 01a8ffb8 77f04ede 00293f30 00000008 0000021c MSVCRT!endthread+0x96 01a8ffec 00000000 7800bdf9 00293f30 00000000 KERNEL32!lstrcmpiW+0xbe 36 id: ad.31 Suspend: 0 Teb 7ff96000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01aefeb4 77e79de5 00000003 01aefedc 00000000 = ntdll!NtWaitForMultipleObjects+0xb 01aeff10 77e79e31 00000002 01aeff58 000003e8 = USER32!MsgWaitForMultipleObjectsEx+0xa8 01aeff2c 697f1dbe 00000002 01aeff58 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 69a92ea0 750169a9 24448b22 244c8b14 24548b10 = MTxEx!ContextWrapper__Recycle+0xe 60b03d83 000003e6 0006ef1c 0006ee60 00000008 0x750169a9 37 id: ad.c6 Suspend: 0 Teb 7ff95000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01b2feb4 77e79de5 00000003 01b2fedc 00000000 = ntdll!NtWaitForMultipleObjects+0xb 01b2ff10 77e79e31 00000002 01b2ff58 000003e8 = USER32!MsgWaitForMultipleObjectsEx+0xa8 01b2ff2c 697f1dbe 00000002 01b2ff58 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 69a92ea0 750169a9 24448b22 244c8b14 24548b10 = MTxEx!ContextWrapper__Recycle+0xe 60b03d83 000003e6 0006ef1c 0006ee60 00000008 0x750169a9 38 id: ad.bf Suspend: 0 Teb 7ff94000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01b6ff88 77f04f37 00000bc4 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 01b6ffb8 77f04ede 001522a8 ffffffff 00fcf1fc = KERNEL32!WaitForSingleObject+0xf 01b6ffec 00000000 776b1bdd 001522a8 00000000 KERNEL32!lstrcmpiW+0xbe 39 id: ad.5d Suspend: 0 Teb 7ff93000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01bafd68 1e142143 0ae13b80 00000000 0aee1f60 = python15!PyThreadState_Clear+0x6d 01bafd78 1e14267f 0aee1f60 00000000 1e2a2401 = python15!PyInterpreterState_Clear+0x13 01bafd84 1e2a2401 01bafda4 1e2c4fd8 00000000 python15!Py_Finalize+0x3f 01bafdec 680c3b32 01bafe6c 00139248 77f050f0 = pythoncom15!PyCom_DLLReleaseRef+0x71 01bafe34 680c2f38 000dfa58 00000000 01bafec0 = asp!CAppConfig__SetValue+0xc8 01bafe7c 680c78c0 000dfa58 000c4698 01bafec0 = asp!CPerfMainBlock__Init+0x47 01bafecc 680e25c6 00000000 697e1898 00313ea0 = asp!CConnectionPoint__~CConnectionPoint+0x6 01bafee4 697e67cc 00000000 697e1898 0aceefc0 = asp!_IASPObjectContextCustomStubVtbl+0x95 01baff24 697e57ce 00148598 697f21de 77f0178b = MTxEx!CActivity__CallWithNewContext+0xac 77f67610 4affc033 89257508 fff00c42 037d044a = MTxEx!CQueuedRequest__~CQueuedRequest+0x5e 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 40 id: ad.73 Suspend: 0 Teb 7ff92000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01dcff84 686248e5 0000016c 01dcffac 01dcffb4 = ntdll!ZwRemoveIoCompletion+0xb 01dcffb8 77f04ede 00000000 00000133 00000000 ISATQ!AtqSetInfo+0xbb 01dcffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 41 id: ad.4b Suspend: 0 Teb 7ff6f000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01e3ff84 686248e5 0000016c 01e3ffac 01e3ffb4 = ntdll!ZwRemoveIoCompletion+0xb 01e3ffb8 77f04ede 00000000 ffffffff 0104fe68 ISATQ!AtqSetInfo+0xbb 01e3ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 42 id: ad.8a Suspend: 0 Teb 7ff6e000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01e7ff84 686248e5 0000016c 01e7ffac 01e7ffb4 = ntdll!ZwRemoveIoCompletion+0xb 01e7ffb8 77f04ede 00000000 00000187 00001000 ISATQ!AtqSetInfo+0xbb 01e7ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 43 id: ad.144 Suspend: 0 Teb 7ff6d000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 034dff84 686248e5 0000016c 034dffac 034dffb4 = ntdll!ZwRemoveIoCompletion+0xb 034dffb8 77f04ede 00000000 ffffffff 0104fe68 ISATQ!AtqSetInfo+0xbb 034dffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 44 id: ad.147 Suspend: 0 Teb 7ff6c000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0351ff84 686248e5 0000016c 0351ffac 0351ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0351ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0351ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 45 id: ad.149 Suspend: 0 Teb 7ff6b000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0355ff84 686248e5 0000016c 0355ffac 0355ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0355ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0355ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 46 id: ad.101 Suspend: 0 Teb 7ff6a000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0359ff84 686248e5 0000016c 0359ffac 0359ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0359ffb8 77f04ede 00000000 0000003d 00001000 ISATQ!AtqSetInfo+0xbb 0359ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 47 id: ad.136 Suspend: 0 Teb 7fdaf000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0361ff84 686248e5 0000016c 0361ffac 0361ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0361ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0361ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 48 id: ad.13e Suspend: 0 Teb 7ff69000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 035dff84 686248e5 0000016c 035dffac 035dffb4 = ntdll!ZwRemoveIoCompletion+0xb 035dffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 035dffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 49 id: ad.14e Suspend: 0 Teb 7fdae000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0365ff84 686248e5 0000016c 0365ffac 0365ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0365ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0365ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 50 id: ad.16f Suspend: 0 Teb 7f81f000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0584ff84 686248e5 0000016c 0584ffac 0584ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0584ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 0584ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 51 id: ad.135 Suspend: 0 Teb 7f81e000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 048cff84 686248e5 0000016c 048cffac 048cffb4 = ntdll!ZwRemoveIoCompletion+0xb 048cffb8 77f04ede 00000000 00908e50 000003e5 ISATQ!AtqSetInfo+0xbb 048cffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 52 id: ad.e0 Suspend: 0 Teb 7f81d000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0588ff84 686248e5 0000016c 0588ffac 0588ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0588ffb8 77f04ede 00000000 ffffffff 0104fe68 ISATQ!AtqSetInfo+0xbb 0588ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 53 id: ad.ec Suspend: 0 Teb 7f81c000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 058cff84 686248e5 0000016c 058cffac 058cffb4 = ntdll!ZwRemoveIoCompletion+0xb 058cffb8 77f04ede 00000000 ffffffff 0104fe68 ISATQ!AtqSetInfo+0xbb 058cffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 54 id: ad.169 Suspend: 0 Teb 7f81b000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0590ff84 686248e5 0000016c 0590ffac 0590ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0590ffb8 77f04ede 00000000 0090af28 000003e5 ISATQ!AtqSetInfo+0xbb 0590ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 55 id: ad.158 Suspend: 0 Teb 7f81a000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0594ff84 686248e5 0000016c 0594ffac 0594ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0594ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 0594ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 56 id: ad.167 Suspend: 0 Teb 7f819000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0598ff84 686248e5 0000016c 0598ffac 0598ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0598ffb8 77f04ede 00000000 ffffffff 0590fe68 ISATQ!AtqSetInfo+0xbb 0598ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 57 id: ad.162 Suspend: 0 Teb 7f818000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 059cff84 686248e5 0000016c 059cffac 059cffb4 = ntdll!ZwRemoveIoCompletion+0xb 059cffb8 77f04ede 00000000 ffffffff 0590fe68 ISATQ!AtqSetInfo+0xbb 059cffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 58 id: ad.6d Suspend: 0 Teb 7f817000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05a0ff84 686248e5 0000016c 05a0ffac 05a0ffb4 = ntdll!ZwRemoveIoCompletion+0xb 05a0ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 05a0ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 59 id: ad.44 Suspend: 0 Teb 7f816000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05a4ff84 686248e5 0000016c 05a4ffac 05a4ffb4 = ntdll!ZwRemoveIoCompletion+0xb 05a4ffb8 77f04ede 00000000 0000000f 00001000 ISATQ!AtqSetInfo+0xbb 05a4ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 60 id: ad.178 Suspend: 0 Teb 7f815000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05a8ff84 686248e5 0000016c 05a8ffac 05a8ffb4 = ntdll!ZwRemoveIoCompletion+0xb 05a8ffb8 77f04ede 00000000 0000020c 00001000 ISATQ!AtqSetInfo+0xbb 05a8ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 61 id: ad.176 Suspend: 0 Teb 7f814000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05acff84 686248e5 0000016c 05acffac 05acffb4 = ntdll!ZwRemoveIoCompletion+0xb 05acffb8 77f04ede 00000000 00000009 00001000 ISATQ!AtqSetInfo+0xbb 05acffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 62 id: ad.d4 Suspend: 0 Teb 7f813000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05b0ff84 686248e5 0000016c 05b0ffac 05b0ffb4 = ntdll!ZwRemoveIoCompletion+0xb 05b0ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 05b0ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 63 id: ad.156 Suspend: 0 Teb 7f812000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05b4ff84 686248e5 0000016c 05b4ffac 05b4ffb4 = ntdll!ZwRemoveIoCompletion+0xb 05b4ffb8 77f04ede 00000000 00000003 00001000 ISATQ!AtqSetInfo+0xbb 05b4ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 64 id: ad.166 Suspend: 0 Teb 7f811000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05b8ff84 686248e5 0000016c 05b8ffac 05b8ffb4 = ntdll!ZwRemoveIoCompletion+0xb 05b8ffb8 77f04ede 00000000 001f0003 00000000 ISATQ!AtqSetInfo+0xbb 05b8ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 65 id: ad.68 Suspend: 0 Teb 7f810000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 05bcff84 686248e5 0000016c 05bcffac 05bcffb4 = ntdll!ZwRemoveIoCompletion+0xb 05bcffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 05bcffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 66 id: ad.13d Suspend: 0 Teb 7f80f000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0d2cff90 77e15a1d 77e160f7 0007f878 0d2cffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 0:039> !locks 0:039> !inetdbg.atq -g Atq Globals: isatq!g_cConcurrency =3D 1 (0x 1) isatq!g_cThreads =3D 2 (0x 2) isatq!g_cAvailableThreads =3D 0 (0x 0) isatq!g_cMaxThreads =3D 0 (0x 0) isatq!g_fUseAcceptEx =3D 0 (0x 0) isatq!g_cbXmitBufferSize =3D 0 (0x 0) isatq!g_cbMinKbSec =3D 0 (0x 0) isatq!g_cCPU =3D 0 (0x 0) isatq!g_fShutdown =3D 2 (0x 2) isatq!g_msThreadTimeout =3D 0 (0x 0) isatq!g_dwTimeoutCookie =3D 0 (0x 0) isatq!g_cListenBacklog =3D 0 (0x 0) isatq!AtqGlobalContextCount =3D 0 (0x 0) sizeof(ATQ_CONTEXT) =3D 212 0:039> !inetdbg.asp -g Asp Globals: asp!g_nSessions =3D 0 (0x 0) asp!g_nApplications =3D 0 (0x 0) asp!g_nApplicationsRestarting =3D 0 (0x 0) asp!g_nBrowserRequests =3D 0 (0x 0) asp!g_nSessionCleanupRequests =3D 0 (0x 0) asp!g_nApplnCleanupRequests =3D 0 (0x 0) asp!g_fShutDownInProgress =3D 1868967740 (0x6f662f3c) 0:039> !inetdbg.ds -v esp 01bafd6c : 1e142143 : python15!PyInterpreterState_Clear+0x13 01bafd7c : 1e14267f : python15!Py_Finalize+0x3f 01bafd88 : 1e2a2401 : pythoncom15!PyCom_DLLReleaseRef+0x71 01bafd90 : 1e2c4fd8 : pythoncom15!PyITypeComp__Bind+0x1c28 01bafd98 : 1e2a6795 : pythoncom15!PyGatewayBase__~PyGatewayBase+0xa5 01bafda8 : 1e2c5108 : pythoncom15!PyITypeComp__Bind+0x1d58 01bafdb0 : 1e2a6a41 : pythoncom15!PyGatewayBase__Release+0x21 *** WARNING: Using export symbols for axscript.pyd 01bafdbc : 01d3245b : axscript!PyGActiveScript__Release+0xb 01bafdc4 : 680d3924 : asp!STR__Copy+0x17 01bafdcc : 680ec330 : asp!g_szErrTemplate+0x17f 01bafdd4 : 680d50cd : asp!CCertRequest__ParseRDNS+0x43 01bafdf0 : 680c3b32 : asp!CAppConfig__SetValue+0xc8 01bafdfc : 77f050f0 : KERNEL32!InterlockedIncrement 01bafe04 : 680ebe20 : asp!g_PerfMain+0x7 01bafe08 : 680c31e0 : asp!CPerfMainBlock__AddProcess+0x49 01bafe24 : 680c3b58 : asp!CAppConfig__SetValue+0x11a 01bafe2c : 680ec6d0 : asp!g_szErrTemplate+0x51f 01bafe38 : 680c2f38 : asp!CPerfMainBlock__Init+0x47 01bafe4c : 77f050f0 : KERNEL32!InterlockedIncrement 01bafe54 : 680ebe20 : asp!g_PerfMain+0x7 01bafe80 : 680c78c0 : asp!CConnectionPoint__~CConnectionPoint+0x6 01bafed0 : 680e25c6 : asp!_IASPObjectContextCustomStubVtbl+0x95 01bafed8 : 697e1898 : MTxEx!IID_IRegNode+0x8 01bafee8 : 697e67cc : MTxEx!CActivity__CallWithNewContext+0xac 01bafef0 : 697e1898 : MTxEx!IID_IRegNode+0x8 01baff18 : 6981ca16 : MTxEx!CAspSecurity__Release+0x1d6 01baff1c : 697e18b0 : MTxEx!IID_IRegNodeDispenser 01baff24 : 77f67610 : ntdll!RtlLeaveCriticalSection 01baff28 : 697e57ce : MTxEx!CQueuedRequest__~CQueuedRequest+0x5e 01baff30 : 697f21de : MTxEx!ContextWrapper__QueryInterface+0x352 01baff34 : 77f0178b : KERNEL32!GetLastError 01baff3c : 69a92ea0 : MTxInfr1!VipThunkPeekMessageW 01baff44 : 697f1ed1 : MTxEx!ContextWrapper__QueryInterface+0x45 01baff50 : 697e21f8 : MTxEx!IID_IJavaObjectPrivate 01baff7c : 697f22d2 : MTxEx!ContextWrapper__Release+0x6e 01baff88 : 7800be50 : MSVCRT!endthread+0x96 *** WARNING: Using export symbols for ole32.dll 01baff94 : 77b2aa4d : ole32!CreateBindCtx+0x2d10 01baffac : 7800ef57 : MSVCRT!except_handler3 01baffb0 : 78033200 : MSVCRT!__non_rtti_object__`vftable'+0x33c 01baffbc : 77f04ede : KERNEL32!lstrcmpiW+0xbe 01baffc8 : 77b2aa4d : ole32!CreateBindCtx+0x2d10 01baffd0 : 77b2aa4d : ole32!CreateBindCtx+0x2d10 01baffd8 : 77bc7d60 : ole32+0xa7d60 01baffe0 : 77f3b944 : KERNEL32!GetDateFormatW+0x411f 01baffe4 : 77f3d238 : KERNEL32!GetDateFormatW+0x5a13 01bafff4 : 7800bdf9 : MSVCRT!endthread+0x3f inetdbg!ds: cannot read memory @ 1bb0000 0:039> !inetdbg.ds esp 01bafd64 : 0aee1f60 01bafd68 : 0ae13b80 01bafd6c : 1e142143 : python15!PyInterpreterState_Clear+0x13 01bafd70 : 0ae13b80 01bafd74 : 00000000 01bafd78 : 0aee1f60 01bafd7c : 1e14267f : python15!Py_Finalize+0x3f 01bafd80 : 0aee1f60 01bafd84 : 00000000 01bafd88 : 1e2a2401 : pythoncom15!PyCom_DLLReleaseRef+0x71 01bafd8c : 01bafda4 01bafd90 : 1e2c4fd8 : pythoncom15!PyITypeComp__Bind+0x1c28 01bafd94 : 00000000 01bafd98 : 1e2a6795 : pythoncom15!PyGatewayBase__~PyGatewayBase+0xa5 01bafd9c : 0ae631b0 01bafda0 : 00000001 01bafda4 : 01baff14 01bafda8 : 1e2c5108 : pythoncom15!PyITypeComp__Bind+0x1d58 01bafdac : ffffffff 01bafdb0 : 1e2a6a41 : pythoncom15!PyGatewayBase__Release+0x21 01bafdb4 : 00084fd0 01bafdb8 : 00084f50 01bafdbc : 01d3245b : axscript!PyGActiveScript__Release+0xb 01bafdc0 : 0ae631b0 01bafdc4 : 680d3924 : asp!STR__Copy+0x17 01bafdc8 : 0ae631b0 01bafdcc : 680ec330 : asp!g_szErrTemplate+0x17f 01bafdd0 : 00084f50 01bafdd4 : 680d50cd : asp!CCertRequest__ParseRDNS+0x43 01bafdd8 : 00000000 01bafddc : 01bafe58 01bafde0 : 00000000 01bafde4 : 00000000 01bafde8 : 01c3ace0 01bafdec : 01bafe34 01bafdf0 : 680c3b32 : asp!CAppConfig__SetValue+0xc8 01bafdf4 : 01bafe6c 01bafdf8 : 00139248 01bafdfc : 77f050f0 : KERNEL32!InterlockedIncrement 01bafe00 : 000c4698 01bafe04 : 680ebe20 : asp!g_PerfMain+0x7 01bafe08 : 680c31e0 : asp!CPerfMainBlock__AddProcess+0x49 01bafe0c : 01bafe58 01bafe10 : 00139248 01bafe14 : 01bafec0 01bafe18 : 000c4698 01bafe1c : 00000000 01bafe20 : 0013f741 !inetdbg.ds 1bafe24 to dump next block 0:039> u eip-50 eip+10 python15!PyThreadState_Clear+0x1d: 1e14229d 2d171e83c0 sub eax,0xc0831e17 1e1422a2 40 inc eax 1e1422a3 50 push eax 1e1422a4 ff15fce4171e call dword ptr [python15+0x7e4fc = (1e17e4fc)] 1e1422aa 83c408 add esp,0x8 1e1422ad 8b4608 mov eax,[esi+0x8] 1e1422b0 897e08 mov [esi+0x8],edi 1e1422b3 3bc7 cmp eax,edi 1e1422b5 7411 jz python15!PyThreadState_Clear+0x48 = (1e1422c8) 1e1422b7 8b08 mov ecx,[eax] 1e1422b9 49 dec ecx 1e1422ba 8908 mov [eax],ecx 1e1422bc 750a jnz python15!PyThreadState_Clear+0x48 = (1e1422c8) 1e1422be 8b4804 mov ecx,[eax+0x4] 1e1422c1 50 push eax 1e1422c2 ff5118 call dword ptr [ecx+0x18] 1e1422c5 83c404 add esp,0x4 1e1422c8 8b4638 mov eax,[esi+0x38] 1e1422cb 897e38 mov [esi+0x38],edi 1e1422ce 3bc7 cmp eax,edi 1e1422d0 7411 jz python15!PyThreadState_Clear+0x63 = (1e1422e3) 1e1422d2 8b08 mov ecx,[eax] 1e1422d4 49 dec ecx 1e1422d5 8908 mov [eax],ecx 1e1422d7 750a jnz python15!PyThreadState_Clear+0x63 = (1e1422e3) 1e1422d9 8b5004 mov edx,[eax+0x4] 1e1422dc 50 push eax 1e1422dd ff5218 call dword ptr [edx+0x18] 1e1422e0 83c404 add esp,0x4 1e1422e3 8b4620 mov eax,[esi+0x20] 1e1422e6 897e20 mov [esi+0x20],edi 1e1422e9 3bc7 cmp eax,edi 1e1422eb 7411 jz python15!PyThreadState_Clear+0x7e = (1e1422fe) 1e1422ed 8b08 mov ecx,[eax] 1e1422ef 49 dec ecx 1e1422f0 8908 mov [eax],ecx 1e1422f2 750a jnz python15!PyThreadState_Clear+0x7e = (1e1422fe) 1e1422f4 8b4804 mov ecx,[eax+0x4] 1e1422f7 50 push eax 1e1422f8 ff5118 call dword ptr [ecx+0x18] 1e1422fb 83c404 add esp,0x4 0:039> dc eax-100 eax+100 ^ Range error in 'dc eax-100 eax+100' 0:039> dc ebx-100 ebx+100 680ec370 00000000 00000000 00000000 00000000 ................ 680ec380 00000000 00000000 00000000 00000000 ................ 680ec390 00000000 00000000 00000000 00000000 ................ 680ec3a0 00000000 00000000 00000000 00000000 ................ 680ec3b0 00000000 00000000 00000000 680b1b10 ...............h 680ec3c0 00159014 00159014 00140478 ffffffff ........x....... 680ec3d0 00000000 00000000 00000000 00000000 ................ 680ec3e0 680b53d0 00000001 00000000 00000000 .S.h............ 680ec3f0 680ec400 680c57c0 00000003 00000000 ...h.W.h........ 680ec400 00000000 00000000 00000000 00000000 ................ 680ec410 00000000 00000000 00000000 00000000 ................ 680ec420 00000000 00000000 00000000 00000000 ................ 680ec430 00000000 00000000 00000000 00000000 ................ 680ec440 00000000 00000000 00000000 00000000 ................ 680ec450 00000000 00000000 00000000 00000000 ................ 680ec460 00000000 680b1b10 680ec464 680ec464 .......hd..hd..h 680ec470 00140498 ffffffff 00000000 00000000 ................ 680ec480 00000000 00000000 680b3340 00000001 ........ at 3.h.... 680ec490 0014a2a8 00146d28 680ec4a8 680c57c0 ....(m.....h.W.h 680ec4a0 0000000b 00000002 00000000 00146d28 ............(m.. 680ec4b0 00000000 0014a2a8 00000000 00000000 ................ 680ec4c0 00000000 00000000 00000000 00000000 ................ 680ec4d0 00000000 00000000 00000000 00000000 ................ 680ec4e0 00000000 00000000 00000000 00000000 ................ 680ec4f0 00000000 00000000 00000000 00000000 ................ 680ec500 00000000 00000000 00000000 00140458 ............X... 680ec510 ffffffff 00000000 00000000 00000000 ................ 680ec520 00000000 000000a2 00000002 00000008 ................ 680ec530 00000007 00293db8 00000002 00000008 .....=3D)......... 680ec540 00000007 00000000 00000002 00000000 ................ 680ec550 00000001 00140378 ffffffff 00000000 ....x........... 680ec560 00000000 00000000 00000000 3101f691 ...............1 680ec570 3101fa55 U..1 0:039> dc ecx-100 ecx+100 ^ Range error in 'dc ecx-100 ecx+100' 0:039> dc edx-100 edx+100 7803c020 00000000 00000000 00000000 00000000 ................ 7803c030 00000000 7803c0f0 00299890 00000000 .......x..)..... 7803c040 00000000 00000000 00000000 00000000 ................ 7803c050 00000000 7803c120 00000000 0029acd0 .... ..x......). 7803c060 00296a30 7803c138 00000000 00000000 0j).8..x........ 7803c070 00000000 7803c108 00299900 00240600 .......x..)...$. 7803c080 00000000 00000000 00000000 00000000 ................ 7803c090 00000000 00240180 00000000 00000000 ......$......... 7803c0a0 00000000 003cbfc0 002414b0 002998e0 ......<...$...). 7803c0b0 0029acf0 002a0b70 002b0910 002b5ad0 ..).p.*...+..Z+. 7803c0c0 002bbd30 00354970 00000000 00000000 0.+.pI5......... 7803c0d0 00000000 00000000 00000000 00000000 ................ 7803c0e0 00000000 00000000 00000000 00000000 ................ 7803c0f0 77fa7790 ffffffff 00000000 00000000 .w.w............ 7803c100 00000000 00000000 77fa7730 ffffffff ........0w.w.... 7803c110 00000000 00000000 00000000 00000000 ................ 7803c120 77fa7770 ffffffff 00000000 00000000 pw.w............ 7803c130 000003e0 00000000 77fa7750 ffffffff ........Pw.w.... 7803c140 00000000 00000000 00000000 00000000 ................ 7803c150 000001e0 04e91ff0 00000000 0000001e ................ 7803c160 00200000 00200020 00200020 00200020 .. . . . . . . . 7803c170 00200020 00280028 00280028 00200028 . .(.(.(.(.(. . 7803c180 00200020 00200020 00200020 00200020 . . . . . . . . 7803c190 00200020 00200020 00200020 00200020 . . . . . . . . 7803c1a0 00480020 00100010 00100010 00100010 .H............. 7803c1b0 00100010 00100010 00100010 00100010 ................ 7803c1c0 00840010 00840084 00840084 00840084 ................ 7803c1d0 00840084 00100084 00100010 00100010 ................ 7803c1e0 00100010 00810081 00810081 00810081 ................ 7803c1f0 00010001 00010001 00010001 00010001 ................ 7803c200 00010001 00010001 00010001 00010001 ................ 7803c210 00010001 00010001 00100010 00100010 ................ 7803c220 00100010 .... 0:039> dc esi-100 esi+100 0ae13a80 00000002 1e176bd8 0000001a e91943f6 .....k.......C.. 0ae13a90 0ae13a80 5f4e4150 49454858 5f544847 .:..PAN_XHEIGHT_ 0ae13aa0 534e4f43 544e4154 52414c5f 44004547 CONSTANT_LARGE.D 0ae13ab0 5954535f 4f00454c 00000057 2920bfe4 _STYLE.OW..... ) 0ae13ac0 00000002 1e176bd8 0000000c fb80250b .....k.......%.. 0ae13ad0 0ae13ac0 454c4150 49455454 5845444e .:..PALETTEINDEX 0ae13ae0 004e5200 72610000 00007367 0ae14460 .RN...args..`D.. 0ae13af0 00000001 1e176bd8 00000005 ffffffff .....k.......... 0ae13b00 00000000 6f727265 695f0072 00000074 ....error._it... 0ae13b10 00000002 1e176bd8 00000019 9e835d28 .....k......(].. 0ae13b20 0ae13b10 5f4e4150 49454858 5f544847 .;..PAN_XHEIGHT_ 0ae13b30 4b435544 5f474e49 4c414d53 5902004c DUCKING_SMALL..Y 0ae13b40 00000000 1e176bd8 00000011 174c09dc .....k........L. 0ae13b50 00000002 1e176bd8 00000017 7ba26528 .....k......(e.{ 0ae13b60 0ae13b50 5f4e4150 49454858 5f544847 P;..PAN_XHEIGHT_ 0ae13b70 4b435544 5f474e49 00445453 a91a4b8b DUCKING_STD..K.. 0ae13b80 00000000 1e2d9bf8 00000000 00000000 ......-......... 0ae13b90 ffffffff ffffffff 00000004 00000003 ................ 0ae13ba0 00000000 00000000 00000001 00000024 ............$... 0ae13bb0 00000004 00001100 00000000 00000000 ................ 0ae13bc0 1e170238 0ada1390 00004445 0ae13e00 8.......ED...>.. 0ae13bd0 00000001 1e176bd8 00000020 ffffffff .....k.. ....... 0ae13be0 00000000 62654449 6f446775 656d7563 ....IDebugDocume 0ae13bf0 6554746e 78457478 6e726574 75416c61 ntTextExternalAu 0ae13c00 726f6874 1e176b00 00000001 3f9b43ec thor.k.......C.? 0ae13c10 00000002 1e176bd8 00000019 52e821e0 .....k.......!.R 0ae13c20 0ae13c10 5f4e4150 49454858 5f544847 .<..PAN_XHEIGHT_ 0ae13c30 4b435544 5f474e49 4752414c 00540045 DUCKING_LARGE.T. 0ae13c40 0ae13ad0 7261776b 0a007367 0ad267f0 .:..kwargs...g.. 0ae13c50 00000001 1e176bd8 00000015 ffffffff .....k.......... 0ae13c60 00000000 62654449 6f446775 656d7563 ....IDebugDocume 0ae13c70 6f43746e 7865746e 726f0074 0ad1d200 ntContext.or.... 0ae13c80 00000002 .... 0:039> dc edi-100 edi+100 ^ Range error in 'dc edi-100 edi+100' 0:039> dc esp-100 esp+100 01bafc64 00230000 00001000 05054000 00230548 ..#...... at ..H.#. 01bafc74 01d702f0 77f6447e 04d30000 01d702f0 ....~D.w........ 01bafc84 77f6447e 04d30000 01bafcd8 05055000 ~D.w.........P.. 01bafc94 05053aa0 00230000 77f650a8 04d30000 .:....#..P.w.... 01bafca4 01bafcd4 00000000 77f8f2ad 00230000 ...........w..#. 01bafcb4 04ef5c38 00000000 01bafcb0 00000000 8\.............. 01bafcc4 01bafd34 77f92cd4 77f9d870 ffffffff 4....,.wp..w.... 01bafcd4 01bafcfc 77f64ddc 00231a90 04ef5c40 .....M.w..#.@\.. 01bafce4 0000000c 04ef5c40 06062c50 0504ab20 ....@\..P,.. ... 01bafcf4 780012a6 780012a6 7803c120 780012a6 ...x...x ..x...x 01bafd04 7803c120 01bafd4c 78001434 00000009 ..xL...4..x.... 01bafd14 780012a6 7803c120 01bafd60 78001434 ...x ..x`...4..x 01bafd24 00000009 78001405 00000020 78001385 .......x ......x 01bafd34 0aef4580 0aef4050 04e91ff0 0aef4000 .E..P at .......@.. 01bafd44 78032250 ffffffff 01bafdec 01bafd8c P".x............ 01bafd54 7800ef57 78032250 ffffffff 01bafdec W..xP".x........ 01bafd64 0aee1f60 0ae13b80 1e142143 0ae13b80 `....;..C!...;.. 01bafd74 00000000 0aee1f60 1e14267f 0aee1f60 ....`....&..`... 01bafd84 00000000 1e2a2401 01bafda4 1e2c4fd8 .....$*......O,. 01bafd94 00000000 1e2a6795 0ae631b0 00000001 .....g*..1...... 01bafda4 01baff14 1e2c5108 ffffffff 1e2a6a41 .....Q,.....Aj*. 01bafdb4 00084fd0 00084f50 01d3245b 0ae631b0 .O..PO..[$...1.. 01bafdc4 680d3924 0ae631b0 680ec330 00084f50 $9.h.1..0..hPO.. 01bafdd4 680d50cd 00000000 01bafe58 00000000 .P.h....X....... 01bafde4 00000000 01c3ace0 01bafe34 680c3b32 ........4...2;.h 01bafdf4 01bafe6c 00139248 77f050f0 000c4698 l...H....P.w.F.. 01bafe04 680ebe20 680c31e0 01bafe58 00139248 ..h.1.hX...H... 01bafe14 01bafec0 000c4698 00000000 0013f741 .....F......A... 01bafe24 680c3b58 00000000 680ec6d0 000000c0 X;.h.......h.... 01bafe34 01bafe7c 680c2f38 000dfa58 00000000 |...8/.hX....... 01bafe44 01bafec0 01bafe58 77f050f0 000c4698 ....X....P.w.F.. 01bafe54 680ebe20 00000001 00000001 01bafe64 ..h........d... 01bafe64 04198054 T... 0:039> dc ebp-100 ebp+100 01bafcec 06062c50 0504ab20 780012a6 780012a6 P,.. ......x...x 01bafcfc 7803c120 780012a6 7803c120 01bafd4c ..x...x ..xL... 01bafd0c 78001434 00000009 780012a6 7803c120 4..x.......x ..x 01bafd1c 01bafd60 78001434 00000009 78001405 `...4..x.......x 01bafd2c 00000020 78001385 0aef4580 0aef4050 ......x.E..P at .. 01bafd3c 04e91ff0 0aef4000 78032250 ffffffff ..... at ..P".x.... 01bafd4c 01bafdec 01bafd8c 7800ef57 78032250 ........W..xP".x 01bafd5c ffffffff 01bafdec 0aee1f60 0ae13b80 ........`....;.. 01bafd6c 1e142143 0ae13b80 00000000 0aee1f60 C!...;......`... 01bafd7c 1e14267f 0aee1f60 00000000 1e2a2401 .&..`........$*. 01bafd8c 01bafda4 1e2c4fd8 00000000 1e2a6795 .....O,......g*. 01bafd9c 0ae631b0 00000001 01baff14 1e2c5108 .1...........Q,. 01bafdac ffffffff 1e2a6a41 00084fd0 00084f50 ....Aj*..O..PO.. 01bafdbc 01d3245b 0ae631b0 680d3924 0ae631b0 [$...1..$9.h.1.. 01bafdcc 680ec330 00084f50 680d50cd 00000000 0..hPO...P.h.... 01bafddc 01bafe58 00000000 00000000 01c3ace0 X............... 01bafdec 01bafe34 680c3b32 01bafe6c 00139248 4...2;.hl...H... 01bafdfc 77f050f0 000c4698 680ebe20 680c31e0 .P.w.F.. ..h.1.h 01bafe0c 01bafe58 00139248 01bafec0 000c4698 X...H........F.. 01bafe1c 00000000 0013f741 680c3b58 00000000 ....A...X;.h.... 01bafe2c 680ec6d0 000000c0 01bafe7c 680c2f38 ...h....|...8/.h 01bafe3c 000dfa58 00000000 01bafec0 01bafe58 X...........X... 01bafe4c 77f050f0 000c4698 680ebe20 00000001 .P.w.F.. ..h.... 01bafe5c 00000001 01bafe64 04198054 0419805c ....d...T...\... 01bafe6c 00084f50 00000000 000dfa58 00000000 PO......X....... 01bafe7c 00000000 680c78c0 000dfa58 000c4698 .....x.hX....F.. 01bafe8c 01bafec0 00000000 00148598 01bafee4 ................ 01bafe9c 0013f6a8 00000000 00000000 00152678 ............x&.. 01bafeac 000dfa58 00000000 00000000 fffffffe X............... 01bafebc 00000001 00157258 00157280 001572a8 ....Xr...r...r.. 01bafecc 001572d0 680e25c6 00000000 697e1898 .r...%.h......~i 01bafedc 00313ea0 0031caec 01baff24 697e67cc .>1...1.$....g~i 01bafeec 00000000 .... 0:039> dc esp+0x04 01bafd68 0ae13b80 1e142143 0ae13b80 00000000 .;..C!...;...... 01bafd78 0aee1f60 1e14267f 0aee1f60 00000000 `....&..`....... 01bafd88 1e2a2401 01bafda4 1e2c4fd8 00000000 .$*......O,..... 01bafd98 1e2a6795 0ae631b0 00000001 01baff14 .g*..1.......... 01bafda8 1e2c5108 ffffffff 1e2a6a41 00084fd0 .Q,.....Aj*..O.. 01bafdb8 00084f50 01d3245b 0ae631b0 680d3924 PO..[$...1..$9.h 01bafdc8 0ae631b0 680ec330 00084f50 680d50cd .1..0..hPO...P.h 01bafdd8 00000000 01bafe58 00000000 00000000 ....X........... 0:039> dc esp+0x08 01bafd6c 1e142143 0ae13b80 00000000 0aee1f60 C!...;......`... 01bafd7c 1e14267f 0aee1f60 00000000 1e2a2401 .&..`........$*. 01bafd8c 01bafda4 1e2c4fd8 00000000 1e2a6795 .....O,......g*. 01bafd9c 0ae631b0 00000001 01baff14 1e2c5108 .1...........Q,. 01bafdac ffffffff 1e2a6a41 00084fd0 00084f50 ....Aj*..O..PO.. 01bafdbc 01d3245b 0ae631b0 680d3924 0ae631b0 [$...1..$9.h.1.. 01bafdcc 680ec330 00084f50 680d50cd 00000000 0..hPO...P.h.... 01bafddc 01bafe58 00000000 00000000 01c3ace0 X............... 0:039> dc esp+0x0c 01bafd70 0ae13b80 00000000 0aee1f60 1e14267f .;......`....&.. 01bafd80 0aee1f60 00000000 1e2a2401 01bafda4 `........$*..... 01bafd90 1e2c4fd8 00000000 1e2a6795 0ae631b0 .O,......g*..1.. 01bafda0 00000001 01baff14 1e2c5108 ffffffff .........Q,..... 01bafdb0 1e2a6a41 00084fd0 00084f50 01d3245b Aj*..O..PO..[$.. 01bafdc0 0ae631b0 680d3924 0ae631b0 680ec330 .1..$9.h.1..0..h 01bafdd0 00084f50 680d50cd 00000000 01bafe58 PO...P.h....X... 01bafde0 00000000 00000000 01c3ace0 01bafe34 ............4... 0:039> dc esp+0x10 01bafd74 00000000 0aee1f60 1e14267f 0aee1f60 ....`....&..`... 01bafd84 00000000 1e2a2401 01bafda4 1e2c4fd8 .....$*......O,. 01bafd94 00000000 1e2a6795 0ae631b0 00000001 .....g*..1...... 01bafda4 01baff14 1e2c5108 ffffffff 1e2a6a41 .....Q,.....Aj*. 01bafdb4 00084fd0 00084f50 01d3245b 0ae631b0 .O..PO..[$...1.. 01bafdc4 680d3924 0ae631b0 680ec330 00084f50 $9.h.1..0..hPO.. 01bafdd4 680d50cd 00000000 01bafe58 00000000 .P.h....X....... 01bafde4 00000000 01c3ace0 01bafe34 680c3b32 ........4...2;.h 0:039> dc ebp+0x04 01bafdf0 680c3b32 01bafe6c 00139248 77f050f0 2;.hl...H....P.w 01bafe00 000c4698 680ebe20 680c31e0 01bafe58 .F.. ..h.1.hX... 01bafe10 00139248 01bafec0 000c4698 00000000 H........F...... 01bafe20 0013f741 680c3b58 00000000 680ec6d0 A...X;.h.......h 01bafe30 000000c0 01bafe7c 680c2f38 000dfa58 ....|...8/.hX... 01bafe40 00000000 01bafec0 01bafe58 77f050f0 ........X....P.w 01bafe50 000c4698 680ebe20 00000001 00000001 .F.. ..h........ 01bafe60 01bafe64 04198054 0419805c 00084f50 d...T...\...PO.. 0:039> dc ebp+0x08 01bafdf4 01bafe6c 00139248 77f050f0 000c4698 l...H....P.w.F.. 01bafe04 680ebe20 680c31e0 01bafe58 00139248 ..h.1.hX...H... 01bafe14 01bafec0 000c4698 00000000 0013f741 .....F......A... 01bafe24 680c3b58 00000000 680ec6d0 000000c0 X;.h.......h.... 01bafe34 01bafe7c 680c2f38 000dfa58 00000000 |...8/.hX....... 01bafe44 01bafec0 01bafe58 77f050f0 000c4698 ....X....P.w.F.. 01bafe54 680ebe20 00000001 00000001 01bafe64 ..h........d... 01bafe64 04198054 0419805c 00084f50 00000000 T...\...PO...... 0:039> dc ebp+0x0c 01bafdf8 00139248 77f050f0 000c4698 680ebe20 H....P.w.F.. ..h 01bafe08 680c31e0 01bafe58 00139248 01bafec0 .1.hX...H....... 01bafe18 000c4698 00000000 0013f741 680c3b58 .F......A...X;.h 01bafe28 00000000 680ec6d0 000000c0 01bafe7c .......h....|... 01bafe38 680c2f38 000dfa58 00000000 01bafec0 8/.hX........... 01bafe48 01bafe58 77f050f0 000c4698 680ebe20 X....P.w.F.. ..h 01bafe58 00000001 00000001 01bafe64 04198054 ........d...T... 01bafe68 0419805c 00084f50 00000000 000dfa58 \...PO......X... 0:039> dc ebp+0x10 01bafdfc 77f050f0 000c4698 680ebe20 680c31e0 .P.w.F.. ..h.1.h 01bafe0c 01bafe58 00139248 01bafec0 000c4698 X...H........F.. 01bafe1c 00000000 0013f741 680c3b58 00000000 ....A...X;.h.... 01bafe2c 680ec6d0 000000c0 01bafe7c 680c2f38 ...h....|...8/.h 01bafe3c 000dfa58 00000000 01bafec0 01bafe58 X...........X... 01bafe4c 77f050f0 000c4698 680ebe20 00000001 .P.w.F.. ..h.... 01bafe5c 00000001 01bafe64 04198054 0419805c ....d...T...\... 01bafe6c 00084f50 00000000 000dfa58 00000000 PO......X....... 0:039> dc poi(esp+0x04) 0ae13b80 00000000 1e2d9bf8 00000000 00000000 ......-......... 0ae13b90 ffffffff ffffffff 00000004 00000003 ................ 0ae13ba0 00000000 00000000 00000001 00000024 ............$... 0ae13bb0 00000004 00001100 00000000 00000000 ................ 0ae13bc0 1e170238 0ada1390 00004445 0ae13e00 8.......ED...>.. 0ae13bd0 00000001 1e176bd8 00000020 ffffffff .....k.. ....... 0ae13be0 00000000 62654449 6f446775 656d7563 ....IDebugDocume 0ae13bf0 6554746e 78457478 6e726574 75416c61 ntTextExternalAu 0:039> dc poi(esp+0x08) 1e142143 c483368b 75f68504 08478bf1 000847c7 .6.....u..G..G.. 1e142153 85000000 8b1174c0 08894908 488b0a75 .....t...I..u..H 1e142163 51ff5004 04c48318 c70c478b 00000c47 .P.Q.....G..G... 1e142173 c0850000 088b1174 75088949 04508b0a ....t...I..u..P. 1e142183 1852ff50 8b04c483 47c71047 00000010 P.R.....G..G.... 1e142193 74c08500 49088b11 0a750889 5004488b ...t...I..u..H.P 1e1421a3 831851ff 5e5f04c4 909090c3 8b575690 .Q...._^.....VW. 1e1421b3 570c247c 000054e8 04c48300 17cd34be |$.W.T.......4.. 0:039> dc poi(esp+0x0c) 0ae13b80 00000000 1e2d9bf8 00000000 00000000 ......-......... 0ae13b90 ffffffff ffffffff 00000004 00000003 ................ 0ae13ba0 00000000 00000000 00000001 00000024 ............$... 0ae13bb0 00000004 00001100 00000000 00000000 ................ 0ae13bc0 1e170238 0ada1390 00004445 0ae13e00 8.......ED...>.. 0ae13bd0 00000001 1e176bd8 00000020 ffffffff .....k.. ....... 0ae13be0 00000000 62654449 6f446775 656d7563 ....IDebugDocume 0ae13bf0 6554746e 78457478 6e726574 75416c61 ntTextExternalAu 0:039> dc poi(esp+0x10) 00000000 ???????? ???????? ???????? ???????? ???????????????? 00000010 ???????? ???????? ???????? ???????? ???????????????? 00000020 ???????? ???????? ???????? ???????? ???????????????? 00000030 ???????? ???????? ???????? ???????? ???????????????? 00000040 ???????? ???????? ???????? ???????? ???????????????? 00000050 ???????? ???????? ???????? ???????? ???????????????? 00000060 ???????? ???????? ???????? ???????? ???????????????? 00000070 ???????? ???????? ???????? ???????? ???????????????? 0:039> dc poi(ebp+0x04) 680c3b32 c7b70f47 7c04463b 045e89de 7e013e83 G...;F.|..^..>.~ 680c3b42 ff53530a 15e80876 89000050 085e891e .SS.v...P.....^. 680c3b52 c25b5e5f 4c8b0008 448b0824 413b0424 _^[....L$..D$.;A 680c3b62 33047204 8b0aebc0 048d0849 81448b80 .r.3....I.....D. 680c3b72 0008c208 8bec8b55 4d8b1845 00208014 ....U...E..M.. . 680c3b82 1f74c985 08758b56 0f118b50 ff0c45bf ..t.V.u.P....E.. 680c3b92 768b1075 80048d08 088674ff 1452ff51 u..v.....t..Q.R. 680c3ba2 0f19eb5e 8b0c45bf 75ff084d 80048d10 ^....E..M..u.... 0:039> dc poi(ebp+0x08) 01bafe6c 00084f50 00000000 000dfa58 00000000 PO......X....... 01bafe7c 00000000 680c78c0 000dfa58 000c4698 .....x.hX....F.. 01bafe8c 01bafec0 00000000 00148598 01bafee4 ................ 01bafe9c 0013f6a8 00000000 00000000 00152678 ............x&.. 01bafeac 000dfa58 00000000 00000000 fffffffe X............... 01bafebc 00000001 00157258 00157280 001572a8 ....Xr...r...r.. 01bafecc 001572d0 680e25c6 00000000 697e1898 .r...%.h......~i 01bafedc 00313ea0 0031caec 01baff24 697e67cc .>1...1.$....g~i 0:039> dc poi(ebp+0x0c) 00139248 680b1aa8 680b3bc0 00000000 0014411c ...h.;.h.....A.. 00139258 680b1ae4 00146930 00000011 00156340 ...h0i...... at c.. 00139268 00000000 00000001 00000006 00000001 ................ 00139278 00000001 00146930 001441f8 00146ca8 ....0i...A...l.. 00139288 00000000 00000000 00146df0 000a2200 .........m...".. 00139298 0007a800 001434c0 00146da0 00000000 .....4...m...... 001392a8 00140578 ffffffff 00000000 00000000 x............... 001392b8 00000000 00000000 001405b8 ffffffff ................ 0:039> dc poi(ebp+0x10) 77f050f0 04244c8b 000001b8 c10ff000 04c24001 .L$.......... at .. 77f05100 c08b2e00 04244c8b ffffffb8 c10ff0ff .....L$......... 77f05110 04c24801 c08b2e00 04244c8b 0824548b .H.......L$..T$. 77f05120 0ff0018b fa7511b1 900008c2 04244c8b ......u......L$. 77f05130 0824548b 0c24448b 11b10ff0 90000cc2 .T$..D$......... 77f05140 04244c8b 0824448b 01c10ff0 900008c2 .L$..D$......... 77f05150 0424448b 3878c00b 0824548b 880fd20b .D$...x8.T$..... 77f05160 000000b2 4c8be2f7 c90b0c24 00e6880f .......L$....... 0:039> !inetdbg.ver Module @ 0x01000000 =3D inetinfo.exe dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Internet Information Services FileVersion =3D 4.02.0622 InternalName =3D INETINFO.EXE LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D INETINFO.EXE ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77f60000 =3D ntdll.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D NT Layer DLL FileVersion =3D 4.00 InternalName =3D ntdll.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D ntdll.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x78000000 =3D MSVCRT.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft (R) C Runtime Library FileVersion =3D 6.10.8528.0 InternalName =3D MSVCRT.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1998 OriginalFilename =3D MSVCRT.DLL ProductName =3D Microsoft (R) Visual C++ ProductVersion =3D 6.10.8528.0 Module @ 0x77f00000 =3D KERNEL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT BASE API Client DLL FileVersion =3D 4.00 InternalName =3D kernel32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D kernel32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77dc0000 =3D ADVAPI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Advanced Windows 32 Base API FileVersion =3D 4.00 InternalName =3D advapi32.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D advapi32.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e70000 =3D USER32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT USER API Client DLL FileVersion =3D 4.00 InternalName =3D user32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D user32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77ed0000 =3D GDI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D GDI Client DLL FileVersion =3D 4.00 InternalName =3D gdi32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D gdi32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e10000 =3D RPCRT4.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Procedure Call Runtime FileVersion =3D 4.00 InternalName =3D rpcrt4.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcrt4.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77b20000 =3D ole32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft OLE for Windows and Windows NT FileVersion =3D 4.00 InternalName =3D OLE32.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D OLE32.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x68e80000 =3D rpcref.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft Internet Information Services RPC = helper library FileVersion =3D 4.02.0622 InternalName =3D RPCREF.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D RPCREF.DLL ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77bf0000 =3D rpcltc1.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Process Control LTC1 DLL FileVersion =3D 4.00 InternalName =3D rpcltc1.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcltc1.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x683a0000 =3D iisadmin.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Metadata and Admin Service FileVersion =3D 4.02.0720 InternalName =3D mdadmin.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D mdadmin.dll ProductName =3D Internet Information Server CDB: c0000005 Exception in inetdbg.ver debugger extension. PC: 77f66ebf VA: 00078000 R/W: 1 Parameter: 1001f 0:039> !inetdbg.ver Module @ 0x01000000 =3D inetinfo.exe dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Internet Information Services FileVersion =3D 4.02.0622 InternalName =3D INETINFO.EXE LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D INETINFO.EXE ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77f60000 =3D ntdll.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D NT Layer DLL FileVersion =3D 4.00 InternalName =3D ntdll.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D ntdll.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x78000000 =3D MSVCRT.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft (R) C Runtime Library FileVersion =3D 6.10.8528.0 InternalName =3D MSVCRT.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1998 OriginalFilename =3D MSVCRT.DLL ProductName =3D Microsoft (R) Visual C++ ProductVersion =3D 6.10.8528.0 Module @ 0x77f00000 =3D KERNEL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT BASE API Client DLL FileVersion =3D 4.00 InternalName =3D kernel32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D kernel32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77dc0000 =3D ADVAPI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Advanced Windows 32 Base API FileVersion =3D 4.00 InternalName =3D advapi32.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D advapi32.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e70000 =3D USER32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT USER API Client DLL FileVersion =3D 4.00 InternalName =3D user32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D user32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77ed0000 =3D GDI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D GDI Client DLL FileVersion =3D 4.00 InternalName =3D gdi32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D gdi32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e10000 =3D RPCRT4.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Procedure Call Runtime FileVersion =3D 4.00 InternalName =3D rpcrt4.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcrt4.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77b20000 =3D ole32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft OLE for Windows and Windows NT FileVersion =3D 4.00 InternalName =3D OLE32.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D OLE32.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x68e80000 =3D rpcref.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft Internet Information Services RPC = helper library FileVersion =3D 4.02.0622 InternalName =3D RPCREF.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D RPCREF.DLL ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77bf0000 =3D rpcltc1.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Process Control LTC1 DLL FileVersion =3D 4.00 InternalName =3D rpcltc1.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcltc1.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x683a0000 =3D iisadmin.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Metadata and Admin Service FileVersion =3D 4.02.0720 InternalName =3D mdadmin.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D mdadmin.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x68220000 =3D COADMIN.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D IIS CoAdmin DLL FileVersion =3D 4.02.0720 InternalName =3D coadmin.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D coadmin.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x70980000 =3D SHELL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows Shell Common Dll FileVersion =3D 4.72.3612.1700 InternalName =3D SHELL32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D SHELL32.DLL ProductName =3D Microsoft(R) Windows NT(R) Operating System ProductVersion =3D 4.72.3612.1700 Module @ 0x710d0000 =3D SHLWAPI.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Shell Light-weight Utility Library FileVersion =3D 4.72.3110.0 InternalName =3D SHLWAPI LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D SHLWAPI.DLL ProductName =3D Microsoft(R) Windows NT(R) Operating System ProductVersion =3D 4.72.3110.0 Module @ 0x77aa0000 =3D COMCTL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Custom Controls Library FileVersion =3D 4.72.3612.1702 InternalName =3D COMMCTRL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1999 OriginalFilename =3D COMMCTRL.DLL ProductName =3D Microsoft(R) Windows NT(R) Operating System ProductVersion =3D 4.72.3612.1702 Module @ 0x68020000 =3D ADMWPROX.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D IIS Admin Com API Proxy dll FileVersion =3D 4.02.0720 InternalName =3D admwprox.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D admwprox.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x74880000 =3D userenv.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Userenv FileVersion =3D 4.00 InternalName =3D userenv LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D userenv.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77800000 =3D NETAPI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Net Win32 API DLL FileVersion =3D 4.00 InternalName =3D NetApi32.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D NetApi32.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77840000 =3D NETRAP.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Net Remote Admin Protocol DLL FileVersion =3D 4.00 InternalName =3D NetRap.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D NetRap.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x777e0000 =3D SAMLIB.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D SAM Library DLL FileVersion =3D 4.00 InternalName =3D SAMLib.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D SAMLib.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x68900000 =3D nsepm.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D IIS NSEP mapping DLL FileVersion =3D 4.02.0720 InternalName =3D nsepm.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D nsepm.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x68440000 =3D IISMAP.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft IIS mapper FileVersion =3D 4.02.0720 InternalName =3D iismap.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D iismap.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x77400000 =3D schannel.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation CDB: c0000005 Exception in inetdbg.ver debugger extension. PC: 77f66edd VA: 00079000 R/W: 1 Parameter: 1001f 0:039> q quit: ------_=_NextPart_000_01BFA65D.E540DE90 Content-Type: application/octet-stream; name="IIS_332-224129-413-2000.dbl" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="IIS_332-224129-413-2000.dbl" Auto4/13/00 10:41:29 = PM4/14/00 11:10:49 = AMManual log file opened 0:017> !emdbg.tag IIS Exception Monitor 6.1.0.0 Loaded emdbg extension DLL IIS Exception Monitor 6.1.0.0 0:017> !emdbg.tag = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 0:017> !emdbg.tag =3D=3D Your Web Server should be running now, DON'T = press Ctl-C Now. =3D=3D Your Web Server should be running now, DON'T press Ctl-C Now. 0:017> !emdbg.tag = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 0:017> !emdbg.tag =3D=3D Wait until the application stops serving pages = and then press Ctl-C in this window =3D=3D Wait until the application stops serving pages and then press = Ctl-C in this window 0:017> !emdbg.tag =3D=3D If you press Ctl-C, you can use the log to = look for 100% CPU utilization =3D=3D If you press Ctl-C, you can use the log to look for 100% CPU = utilization 0:017> !emdbg.tag =3D=3D however it may not be able to tell you which = module is causing your instability =3D=3D however it may not be able to tell you which module is causing = your instability 0:017> !emdbg.tag = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 0:017> sxd ch 0:017> g CDB ModLoad: 68890000 688a6000 C:\WINNT\System32\inetsrv\wam.dll CDB ModLoad: 697e0000 6984c000 C:\WINNT\System32\mtxex.dll CDB ModLoad: 69d00000 69d1a000 MTSEvents.DLL CDB ModLoad: 69a90000 69a9a000 C:\WINNT\System32\MTxInfr1.dll CDB ModLoad: 69ab0000 69abd000 C:\WINNT\System32\MTxInfr2.dll CDB ModLoad: 69620000 69630000 C:\WINNT\System32\MTxRn.DLL CDB ModLoad: 6b550000 6b556000 C:\WINNT\System32\MTxPerf.dll CDB ModLoad: 69a70000 69a7a000 C:\WINNT\System32\MfcSubs.dll CDB ModLoad: 690b0000 690ce000 C:\WINNT\System32\DTCCM.dll CDB ModLoad: 69000000 6900a000 C:\WINNT\System32\DTCUtil.dll CDB ModLoad: 68ff0000 68ff7000 C:\WINNT\System32\DTCTRACE.dll CDB ModLoad: 69790000 6979d000 C:\WINNT\System32\MTXCLU.DLL CDB ModLoad: 77a90000 77a9b000 C:\WINNT\system32\VERSION.dll CDB ModLoad: 779c0000 779c8000 C:\WINNT\system32\LZ32.dll CDB ModLoad: 699c0000 699cc000 C:\WINNT\System32\MTXTRK.DLL CDB ModLoad: 69360000 69369000 C:\WINNT\System32\XOLEHLP.dll CDB ModLoad: 69120000 69133000 C:\WINNT\System32\ADME.dll CDB ModLoad: 69a20000 69a2b000 C:\WINNT\System32\MtxDm.dll CDB ModLoad: 69640000 69671000 C:\WINNT\System32\MtxCat.dll CDB ModLoad: 1f7d0000 1f804000 C:\WINNT\System32\ODBC32.dll CDB ModLoad: 77d80000 77db2000 C:\WINNT\system32\comdlg32.dll CDB ModLoad: 7f230000 7f23d000 C:\WINNT\system32\CLUSAPI.DLL CDB: exception number 000006ba CDB ModLoad: 7f250000 7f25a000 C:\WINNT\system32\RESUTILS.DLL CDB ModLoad: 1f8c0000 1f8d6000 C:\WINNT\System32\odbcint.dll CDB ModLoad: 697c0000 697ca000 C:\WINNT\System32\Mts\mtxact.dll CDB ModLoad: 69a40000 69a5b000 C:\WINNT\system32\mtxoci.dll CDB ModLoad: 0e030000 0e041000 C:\Perl\bin\perlis.dll LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll PerlCRT.dll base 78000000 relocated due to collision with = C:\WINNT\system32\MSVCRT.dll CDB ModLoad: 015e0000 01628000 C:\WINNT\system32\PerlCRT.dll LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll PerlCore.dll base 10000000 relocated due to collision with = C:\Program Files\WEBTREND\Plugins\IIS4\RevDNS.dll CDB ModLoad: 01a40000 01ac7000 C:\Perl\bin\PerlCore.dll CDB ModLoad: 680b0000 680ff000 C:\WINNT\System32\inetsrv\asp.dll CDB ModLoad: 6b600000 6b66b000 C:\WINNT\System32\vbscript.dll LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll Socket.dll base 10000000 relocated due to collision with = C:\Program Files\WEBTREND\Plugins\IIS4\RevDNS.dll CDB ModLoad: 01c60000 01c67000 C:\Perl\lib\auto\Socket\Socket.dll CDB ModLoad: 1e2a0000 1e2e2000 C:\WINNT\system32\pythoncom15.dll CDB ModLoad: 1e600000 1e611000 C:\WINNT\system32\PyWinTypes15.dll CDB ModLoad: 1e100000 1e186000 python15.dll CDB ModLoad: 77fd0000 77ffa000 C:\WINNT\system32\WINMM.dll CDB ModLoad: 77fc0000 77fc8000 C:\WINNT\system32\mmdrv.dll CDB ModLoad: 1e200000 1e20e000 C:\Program = Files\Python\win32\win32api.pyd LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll axscript.pyd base 1e2b0000 relocated due to collision with = C:\WINNT\system32\pythoncom15.dll CDB ModLoad: 02080000 02092000 C:\Program = Files\Python\win32comext\axscript\axscript.pyd CDB ModLoad: 1e3b0000 1e3e8000 C:\Program = Files\Python\win32comext\axdebug\axdebug.pyd CDB ModLoad: 68c80000 68c86000 C:\WINNT\System32\inetsrv\wamps.dll CDB ModLoad: 68690000 68696000 C:\WINNT\System32\inetsrv\iwrps.dll CDB ModLoad: 1e360000 1e366000 C:\Program Files\Python\win32\dbi.dll CDB ModLoad: 1e350000 1e358000 C:\Program Files\Python\win32\odbc.pyd CDB ModLoad: 41230000 412ae000 C:\WINNT\System32\sqlsrv32.dll CDB ModLoad: 41100000 4110c000 C:\WINNT\System32\SQLWOA.dll CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 1f820000 1f83a000 C:\WINNT\system32\odbccp32.dll CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL LDR: Automatic DLL Relocation in inetinfo.exe LDR: Dll IO.dll base 10000000 relocated due to collision with = C:\Program Files\WEBTREND\Plugins\IIS4\RevDNS.dll CDB ModLoad: 02ec0000 02ec6000 C:\Perl\lib\auto\IO\IO.dll CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: exception number 8000d001 CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 689f0000 689fb000 C:\WINNT\System32\inetsrv\ssinc.dll CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB ModLoad: 75a80000 75a87000 C:\WINNT\system32\NDDEAPI.DLL CDB ModLoad: 77c00000 77c18000 C:\WINNT\system32\WINSPOOL.DRV CDB ModLoad: 73310000 73318000 C:\WINNT\system32\DBNMPNTW.DLL CDB: access violation eax=3D5c6e6f68 ebx=3D680ec470 ecx=3D020ffd8c edx=3D7803c120 = esi=3D0a5734f0 edi=3D00000000 eip=3D1e1422b7 esp=3D020ffd64 ebp=3D020ffdec iopl=3D0 nv up ei = pl nz na pe nc cs=3D001b ss=3D0023 ds=3D0023 es=3D0023 fs=3D003b gs=3D0000 = efl=3D00010202 *** WARNING: Using export symbols for python15.dll python15!PyThreadState_Clear+0x37: 1e1422b7 8b08 mov ecx,[eax] = ds:0023:5c6e6f68=3D???????? 0:022> kv *** WARNING: Using export symbols for c:\winnt\system32\pythoncom15.dll *** WARNING: symbols checksum and timestamp is wrong 0x0005847a = 0x000512f3 for c:\winnt\system32\inetsrv\asp.dll *** WARNING: symbols checksum and timestamp is wrong 0x000784a0 = 0x00078fb6 for c:\winnt\system32\mtxex.dll ChildEBP RetAddr Args to Child 020ffd68 1e142143 0a5734f0 00000000 0a6b31f0 = python15!PyThreadState_Clear+0x37 (FPO: [1,0,2]) 020ffd78 1e14267f 0a6b31f0 00000000 1e2a2401 = python15!PyInterpreterState_Clear+0x13 (FPO: [1,0,2]) 020ffd84 1e2a2401 020ffda4 1e2c4fd8 00000000 python15!Py_Finalize+0x3f = (FPO: [0,0,1]) 020ffdec 680c3b32 020ffe6c 00134748 77f050f0 = pythoncom15!PyCom_DLLReleaseRef+0x71(FPO: [Non-Fpo] 020ffe34 680c2f38 0009f0f0 00000000 020ffec0 = asp!CAppConfig__SetValue+0xc8(FPO: [Non-Fpo] 020ffe7c 680c78c0 0009f0f0 02216400 020ffec0 = asp!CPerfMainBlock__Init+0x47(FPO: [Non-Fpo] 020ffecc 680e25c6 00000000 697e1898 003ce8e0 = asp!CConnectionPoint__~CConnectionPoint+0x6 (FPO: [0,0,2]) 020ffee4 697e67cc 00000000 697e1898 0a6a5c90 = asp!_IASPObjectContextCustomStubVtbl+0x95(FPO: [Non-Fpo] 020fff24 697e57ce 02228310 697f21de 77f0178b = mtxex!CActivity__CallWithNewContext+0xac(FPO: [Non-Fpo] 77f67610 4affc033 89257508 fff00c42 037d044a = mtxex!CQueuedRequest__~CQueuedRequest+0x5e(FPO: [Non-Fpo] 0424548b 000003e6 0006ef54 0006ee98 00000008 0x4affc033 [Stdcall: 20] 0:022> !emdbg.sysinfo OBERON C:\WINNT\System32 4.0 (Build 1381) Service Pack 6 2 x86 Pentium Pro or PII 1073135616 bytes 898994176 bytes 1304231936 bytes 1161953280 bytes A:\ Removable C:\ Fixed Drive 4194860032 bytes 1353121792 bytes 2841738240 bytes 4c8e8b33 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION D:\ Fixed Drive 36413280256 bytes 702562304 bytes 35710717952 bytes 342d9cd8 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION E:\ Fixed Drive 36413280256 bytes 9957376 bytes 36403322880 bytes 50397a26 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION F:\ Removable G:\ CDROM L:\ Fixed Drive 4902232064 bytes 1180934144 bytes 3721297920 bytes 70239c30 NTFS FS_CASE_IS_PRESERVED FS_CASE_SENSITIVE FS_UNICODE_STORED_ON_DISK FS_PERSISTENT_ACLS FS_FILE_COMPRESSION 0:022> !inetdbg.mod Loaded inetdbg extension DLL Start End Entry Path 01000000 01005000 01001d80 C:\WINNT\System32\inetsrv\inetinfo.exe 77f60000 77fbe000 00000000 C:\WINNT\System32\ntdll.dll 78000000 78045000 7800256b C:\WINNT\system32\MSVCRT.dll 77f00000 77f5e000 77f01000 C:\WINNT\system32\KERNEL32.dll 77dc0000 77dff000 77dc1000 C:\WINNT\system32\ADVAPI32.dll 77e70000 77ec5000 77e781d7 C:\WINNT\system32\USER32.dll 77ed0000 77efc000 00000000 C:\WINNT\system32\GDI32.dll 77e10000 77e67000 77e186bf C:\WINNT\system32\RPCRT4.dll 77b20000 77bd7000 77b24d6e C:\WINNT\system32\ole32.dll 68e80000 68e86000 68e810bc C:\WINNT\System32\inetsrv\rpcref.dll 77bf0000 77bf7000 00000000 C:\WINNT\system32\rpcltc1.dll 683a0000 683a7000 683a15a8 C:\WINNT\System32\inetsrv\iisadmin.dll 68220000 6822c000 682269e0 C:\WINNT\System32\inetsrv\COADMIN.dll 70980000 70b28000 709868fb C:\WINNT\system32\SHELL32.dll 710d0000 710f3000 710d14ce C:\WINNT\system32\SHLWAPI.dll 77aa0000 77b15000 77aa1b4d C:\WINNT\system32\COMCTL32.dll 68020000 6802a000 68022a91 C:\WINNT\system32\ADMWPROX.dll 74880000 74894000 74881000 C:\WINNT\system32\userenv.dll 77800000 7783a000 77801000 C:\WINNT\system32\NETAPI32.dll 77840000 77849000 00000000 C:\WINNT\system32\NETRAP.dll 777e0000 777ed000 00000000 C:\WINNT\system32\SAMLIB.dll 68900000 6890d000 68906180 C:\WINNT\System32\inetsrv\nsepm.dll 68440000 68450000 68448800 C:\WINNT\system32\IISMAP.dll 77400000 77429000 7740382b C:\WINNT\system32\schannel.dll 5e380000 5e3a5000 5e3a0920 C:\WINNT\system32\MSOSS.dll 776d0000 776d8000 00000000 C:\WINNT\system32\WSOCK32.dll 776b0000 776c4000 776b36b5 C:\WINNT\system32\WS2_32.dll 776a0000 776a7000 776a110e C:\WINNT\system32\WS2HELP.dll 5cf00000 5cf5e000 5cf06b44 C:\WINNT\system32\CRYPT32.dll 68df0000 68e03000 68df2b1f C:\WINNT\System32\inetsrv\metadata.dll 68c90000 68c9b000 68c91f80 C:\WINNT\System32\inetsrv\wamreg.dll 5f400000 5f4f2000 5f4065ff C:\WINNT\system32\MFC42.DLL 65340000 653d2000 6534ee21 C:\WINNT\system32\OLEAUT32.dll 7ca00000 7ca1b000 7ca0b2cc C:\WINNT\system32\rsabase.dll 5a800000 5a80f000 5a802004 C:\WINNT\system32\pstorec.dll 68db0000 68db7000 68db2b10 C:\WINNT\System32\inetsrv\admexs.dll 68ea0000 68ea7000 68ea2350 C:\WINNT\System32\inetsrv\svcext.dll 68c00000 68c39000 68c1c344 C:\WINNT\System32\inetsrv\w3svc.dll 68590000 685bf000 68594a93 C:\WINNT\System32\inetsrv\INFOCOMM.dll 68620000 6862e000 68625f71 C:\WINNT\System32\inetsrv\ISATQ.dll 682b0000 682b6000 682b17b4 C:\WINNT\System32\inetsrv\IISFECNV.dll 68560000 68568000 68562f47 C:\WINNT\system32\inetsloc.dll 77670000 77685000 77672599 C:\WINNT\system32\MSWSOCK.dll 76e70000 76e82000 76e71000 C:\WINNT\system32\security.dll 68820000 68827000 6882132a C:\WINNT\System32\inetsrv\lonsint.dll 47600000 4760e000 47608a10 C:\WINNT\system32\wintrust.dll 74fa0000 74fab000 00000000 C:\WINNT\system32\RpcLtScm.Dll 77660000 7766f000 77663bc8 C:\WINNT\system32\msafd.dll 77690000 77699000 77691000 C:\WINNT\System32\wshtcpip.dll 74ff0000 74ffe000 74ff7b68 C:\WINNT\System32\rnr20.dll 60000000 60011000 60006440 C:\WINNT\system32\msapsspc.dll 779d0000 779e5000 779d1000 C:\WINNT\system32\MSVCRT40.dll 780a0000 780b2000 780a1000 C:\WINNT\system32\MSVCIRT.dll 01120000 0113f000 011252c0 C:\WINNT\system32\msnsspc.dll 77e00000 77e06000 00000000 C:\WINNT\system32\rpclts1.dll 74fc0000 74fcf000 00000000 C:\WINNT\system32\RpcLtCcm.Dll 68650000 68659000 686519e8 C:\WINNT\System32\inetsrv\iscomlog.dll 68a10000 68a19000 68a126d6 C:\WINNT\System32\inetsrv\sspifilt.dll 67860000 67868000 678613e0 c:\program files\microsoft = frontpage\bin\fpexedll.dll 67ec0000 67ec5000 67ec1460 C:\Program Files\Microsoft = FrontPage\version3.0\bin\fpexedll.dll 74480000 74488000 00000000 C:\WINNT\System32\wshisn.dll 75830000 7585a000 7583636b C:\WINNT\System32\nwprovau.dll 77720000 77731000 777278db C:\WINNT\system32\MPR.dll 74470000 74477000 74471000 C:\WINNT\system32\wshnetbs.dll 68410000 68421000 684160c8 C:\WINNT\System32\inetsrv\iislog.dll 10000000 10008000 100025f0 C:\Program = Files\WEBTREND\Plugins\IIS4\RevDNS.dll 013c0000 013c8000 013c27a0 C:\Program = Files\WEBTREND\Plugins\IIS4\wtCookie.dll 68890000 688a6000 6889244e C:\WINNT\System32\inetsrv\wam.dll 697e0000 6984c000 6981c900 C:\WINNT\System32\mtxex.dll 69d00000 69d1a000 69d10490 C:\WINNT\System32\MTSEvents.DLL 69a90000 69a9a000 69a94690 C:\WINNT\System32\MTxInfr1.dll 69ab0000 69abd000 69ab5cf0 C:\WINNT\System32\MTxInfr2.dll 69620000 69630000 696289a0 C:\WINNT\System32\MTxRn.DLL 6b550000 6b556000 6b551480 C:\WINNT\System32\MTxPerf.dll 69a70000 69a7a000 69a74220 C:\WINNT\System32\MfcSubs.dll 690b0000 690ce000 690c5a00 C:\WINNT\System32\DTCCM.dll 69000000 6900a000 69004180 C:\WINNT\System32\DTCUtil.dll 68ff0000 68ff7000 68ff1420 C:\WINNT\System32\DTCTRACE.dll 69790000 6979d000 69798460 C:\WINNT\System32\MTXCLU.DLL 77a90000 77a9b000 77a92fd0 C:\WINNT\system32\VERSION.dll 779c0000 779c8000 779c1881 C:\WINNT\system32\LZ32.dll 699c0000 699cc000 699c4f00 C:\WINNT\System32\MTXTRK.DLL 69360000 69369000 69361d40 C:\WINNT\System32\XOLEHLP.dll 69120000 69133000 6912d300 C:\WINNT\System32\ADME.dll 69a20000 69a2b000 69a24a30 C:\WINNT\System32\MtxDm.dll 69640000 69671000 69656720 C:\WINNT\System32\MtxCat.dll 1f7d0000 1f804000 1f7d12d4 C:\WINNT\System32\ODBC32.dll 77d80000 77db2000 77d81000 C:\WINNT\system32\comdlg32.dll 7f230000 7f23d000 00000000 C:\WINNT\system32\CLUSAPI.DLL 7f250000 7f25a000 7f2516f8 C:\WINNT\system32\RESUTILS.DLL 1f8c0000 1f8d6000 00000000 C:\WINNT\System32\odbcint.dll 697c0000 697ca000 697c4d10 C:\WINNT\System32\Mts\mtxact.dll 69a40000 69a5b000 69a4f730 C:\WINNT\system32\mtxoci.dll 0e030000 0e041000 0e039d30 C:\Perl\bin\perlis.dll 015e0000 01628000 015e9010 C:\WINNT\system32\PerlCRT.dll 01a40000 01ac7000 01aac040 C:\Perl\bin\PerlCore.dll 680b0000 680ff000 680e2c80 C:\WINNT\System32\inetsrv\asp.dll 6b600000 6b66b000 6b605359 C:\WINNT\System32\vbscript.dll 01c60000 01c67000 01c63c80 C:\Perl\lib\auto\Socket\Socket.dll 1e2a0000 1e2e2000 1e2c4d6d C:\WINNT\system32\pythoncom15.dll 1e600000 1e611000 1e606f5a C:\WINNT\system32\PyWinTypes15.dll 1e100000 1e186000 1e1583c0 C:\WINNT\system32\python15.dll 77fd0000 77ffa000 77fd5640 C:\WINNT\system32\WINMM.dll 1e200000 1e20e000 1e206fa3 C:\Program Files\Python\win32\win32api.pyd 02080000 02092000 02087a18 C:\Program = Files\Python\win32comext\axscript\axscript.pyd 1e3b0000 1e3e8000 1e3d1b6f C:\Program = Files\Python\win32comext\axdebug\axdebug.pyd 68c80000 68c86000 68c81510 C:\WINNT\System32\inetsrv\wamps.dll 68690000 68696000 68691970 C:\WINNT\System32\inetsrv\iwrps.dll 1e360000 1e366000 1e361855 C:\Program Files\Python\win32\dbi.dll 1e350000 1e358000 1e3534c5 C:\Program Files\Python\win32\odbc.pyd 41230000 412ae000 41231000 C:\WINNT\System32\sqlsrv32.dll 41100000 4110c000 411061e0 C:\WINNT\System32\SQLWOA.dll 1f820000 1f83a000 1f82c63c C:\WINNT\system32\odbccp32.dll 02ec0000 02ec6000 02ec2610 C:\Perl\lib\auto\IO\IO.dll 689f0000 689fb000 689f3b28 C:\WINNT\System32\inetsrv\ssinc.dll 0:022> ~*kb 300 0 id: 14c.128 Suspend: 0 Teb 7ffde000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for advapi32.dll *** WARNING: Using export symbols for kernel32.dll ChildEBP RetAddr Args to Child 0006fdb0 77dd8a35 00000050 00073880 0000021a ntdll!ZwReadFile+0xb 0006fde4 77dd8481 00000050 00073880 0000021a = ADVAPI32!RegisterServiceCtrlHandlerA+0x352 0006fe48 77dd829e 00000050 00073880 0000021a = ADVAPI32!StartServiceCtrlDispatcherW+0x184 0006fe6c 0100182c 00073278 68e80000 77f13fb3 = ADVAPI32!StartServiceCtrlDispatcherA+0x82 0006fea4 010015d5 00000000 00000000 7ffdf000 = inetinfo!StartDispatchTable+0x61 0006ff70 01001e7f 00000001 00240550 002401a0 inetinfo!main+0x2a5 0006ffc0 77f1b9ea 00000000 00000000 7ffdf000 = inetinfo!mainCRTStartup+0xff 0006fff0 00000000 01001d80 00000000 000000b0 = KERNEL32!GetProcessPriorityBoost+0x117 1 id: 14c.ac Suspend: 0 Teb 7ffdd000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0087fe54 77f04f37 000000b4 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 00000001 000003e6 00000088 77f04f37 0000000f = KERNEL32!WaitForSingleObject+0xf 2 id: 14c.d4 Suspend: 0 Teb 7ffdc000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for user32.dll ChildEBP RetAddr Args to Child 0252feb4 77e79de5 00000003 0252fedc 00000000 = ntdll!NtWaitForMultipleObjects+0xb 0252ff10 77e79e31 00000002 0252ff58 000003e8 = USER32!MsgWaitForMultipleObjectsEx+0xa8 0252ff2c 697f1dbe 00000002 0252ff58 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 69a92ea0 750169a9 24448b22 244c8b14 24548b10 = mtxex!ContextWrapper__Recycle+0xe 60b03d83 000003e6 0006ef1c 0006ee60 00000008 0x750169a9 3 id: 14c.102 Suspend: 0 Teb 7ffdb000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x0003b1c7 = 0x0003704a for infocomm.dll ChildEBP RetAddr Args to Child 00e4fd80 77e79de5 00000002 00e4fda8 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00e4fddc 77e79e31 00000001 0023e864 ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 00e4fdf8 68599007 00000001 0023e864 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 0023e864 00000000 00000000 00000800 68c09c95 = INFOCOMM!INetpCreateSecurityDescriptor+0x1cf 4 id: 14c.eb Suspend: 0 Teb 7ffda000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x00013a0e = 0x00011cc1 for isatq.dll ChildEBP RetAddr Args to Child 00e8fef4 77e79de5 00000002 00e8ff1c 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00e8ff50 77e79e31 00000001 68629668 00003ea0 = USER32!MsgWaitForMultipleObjectsEx+0xa8 00e8ff6c 68625cce 00000001 68629668 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 00000001 000003e6 00000088 68622913 00000000 = ISATQ!W95CPORT__PrepareDescriptorArrays+0x58 5 id: 14c.df Suspend: 0 Teb 7ffd9000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00ecfef4 77e79de5 00000002 00ecff1c 00000000 = ntdll!NtWaitForMultipleObjects+0xb 00ecff50 77e79e31 00000001 68629668 00003ea0 = USER32!MsgWaitForMultipleObjectsEx+0xa8 00ecff6c 68625cce 00000001 68629668 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 00000001 000003e6 00000088 68622913 00000000 = ISATQ!W95CPORT__PrepareDescriptorArrays+0x58 6 id: 14c.165 Suspend: 0 Teb 7ffd8000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00f4ff84 686248e5 000000d8 00f4ffac 00f4ffb4 = ntdll!ZwRemoveIoCompletion+0xb 00f4ffb8 77f04ede abcdef01 00e4fc8c 00e4fcf0 ISATQ!AtqSetInfo+0xbb 00f4ffec 00000000 686248a8 abcdef01 00000000 KERNEL32!lstrcmpiW+0xbe 7 id: 14c.108 Suspend: 0 Teb 7ffd7000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00f8ff84 686248e5 000000d8 00f8ffac 00f8ffb4 = ntdll!ZwRemoveIoCompletion+0xb 00f8ffb8 77f04ede abcdef01 00e4fc8c 00e4fcf0 ISATQ!AtqSetInfo+0xbb 00f8ffec 00000000 686248a8 abcdef01 00000000 KERNEL32!lstrcmpiW+0xbe 8 id: 14c.157 Suspend: 0 Teb 7ffd6000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 00fcff88 685a75d5 00000002 00fcffb4 00000000 = ntdll!NtWaitForMultipleObjects+0xb 9 id: 14c.177 Suspend: 0 Teb 7ffd5000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for rpcrt4.dll ChildEBP RetAddr Args to Child 0104ff90 77e15a1d 77e160f7 000afab0 0104ffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 10 id: 14c.155 Suspend: 0 Teb 7ffd4000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for msafd.dll *** WARNING: Using export symbols for ws2_32.dll *** WARNING: Using export symbols for rpcltscm.dll ChildEBP RetAddr Args to Child 0110fd78 77664a12 00000158 00000140 00000001 = ntdll!NtWaitForSingleObject+0xb 0110fea0 776b9f5f 00000000 00084050 00000000 MSAFD+0x4a12 0110fef0 74fa21e2 00000000 00084050 00000000 WS2_32!select+0xfc 0110ff2c 77e1b0dc 000b01c0 0110ff58 0110ff88 RPCLTSCM+0x21e2 0110ff60 77e1cb96 0110ff8c 0110ff88 0110ff84 = RPCRT4!I_RpcTransServerUnprotectThread+0x48f 0110ff90 77e1aa95 77e160f7 000b00e0 0110ffec = RPCRT4!I_RpcTransServerProtectThread+0xcc 00003a98 000003e6 00000088 77e1aa95 000000c8 = RPCRT4!I_RpcTransServerReallocBuffer+0xc8 11 id: 14c.172 Suspend: 0 Teb 7ffaf000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0117ff2c 77e1b0dc 00087c78 0117ff58 0117ff88 = ntdll!NtWaitForMultipleObjects+0xb 0117ff60 77e1cb96 0117ff8c 0117ff88 0117ff84 = RPCRT4!I_RpcTransServerUnprotectThread+0x48f 0117ff90 77e1aa95 77e160f7 00087b98 0117ffec = RPCRT4!I_RpcTransServerProtectThread+0xcc 00003a98 000003e6 00000088 77e1aa95 000000c8 = RPCRT4!I_RpcTransServerReallocBuffer+0xc8 12 id: 14c.111 Suspend: 0 Teb 7ffae000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x0003e35a = 0x00039d63 for w3svc.dll ChildEBP RetAddr Args to Child 011bfec8 77e79de5 00000002 011bfef0 00000000 = ntdll!NtWaitForMultipleObjects+0xb 011bff24 77e79e31 00000001 002812ac ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 011bff40 68c243f1 00000001 002812ac 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 13 id: 14c.116 Suspend: 0 Teb 7ffad000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 011fff00 77e79de5 00000002 011fff28 00000000 = ntdll!NtWaitForMultipleObjects+0xb 011fff5c 77e79e31 00000001 68c2c25c ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 011fff78 68c1c55e 00000001 68c2c25c 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 011fffb8 77f04ede 00000000 10231850 00e4fd68 = W3SVC!HTTP_FILTER__ParseSendHeaders+0x46 011fffec 00000000 68c1c52a 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 14 id: 14c.118 Suspend: 0 Teb 7ffac000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0123ff64 77f1cebe 0000ea60 00000000 7583a68a ntdll!NtDelayExecution+0xb 0123ffb8 77f04ede 00000000 00000001 00000000 KERNEL32!Sleep+0xb 0123ffec 00000000 7583a65e 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 15 id: 14c.112 Suspend: 0 Teb 7ffab000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: symbols checksum and timestamp is wrong 0x000077d7 = 0x0000908e for inetsloc.dll ChildEBP RetAddr Args to Child 0127fcf8 77664a12 00000204 000001b0 00000001 = ntdll!NtWaitForSingleObject+0xb 0127fe20 776b9f5f 00000000 0127fe98 00000000 MSAFD+0x4a12 0127fe70 68563c07 00000000 0127fe98 00000000 WS2_32!select+0xfc 0127ffb8 77f04ede 00000000 00000000 00000000 = INETSLOC!SocketListenThread+0x51 0127ffec 00000000 68563bb6 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 16 id: 14c.11e Suspend: 0 Teb 7ffaa000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for revdns.dll ChildEBP RetAddr Args to Child 013bfba4 10001a2b 013bfd70 00000000 00000000 USER32!InvalidateRect+0x19 013bffb8 77f04ede 00000000 00070860 00070000 = REVDNS!CreateConfigTab+0x84e 013bffec 00000000 10001755 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 17 id: 14c.10b Suspend: 0 Teb 7ffa9000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0275ff84 686248e5 000000d8 0275ffac 0275ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0275ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 0275ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 18 id: 14c.e2 Suspend: 0 Teb 7ffa8000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0159ff84 686248e5 000000d8 0159ffac 0159ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0159ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 0159ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 19 id: 14c.c2 Suspend: 0 Teb 7ffa7000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 015dff80 77f04f37 00000874 00002710 00000000 = ntdll!NtWaitForSingleObject+0xb 00000000 000003e6 00000088 77f04f37 0000000f = KERNEL32!WaitForSingleObject+0xf 20 id: 14c.de Suspend: 0 Teb 7ffa6000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. *** WARNING: Using export symbols for msvcrt.dll ChildEBP RetAddr Args to Child 01c5fec8 77e79de5 00000002 01c5fef0 00000000 = ntdll!NtWaitForMultipleObjects+0xb 01c5ff24 77e79e31 00000001 680ebddc ffffffff = USER32!MsgWaitForMultipleObjectsEx+0xa8 01c5ff40 680ca30c 00000001 680ebddc 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 01c5ff84 7800be50 680ebdc0 00000008 0000021c = asp!CCookieSupportErr__`vftable'+0xb 01c5ffb8 77f04ede 00292950 00000008 0000021c MSVCRT!endthread+0x96 01c5ffec 00000000 7800bdf9 00292950 00000000 KERNEL32!lstrcmpiW+0xbe 21 id: 14c.f0 Suspend: 0 Teb 7ffa5000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 01e6feb4 77e79de5 00000003 01e6fedc 00000000 = ntdll!NtWaitForMultipleObjects+0xb 01e6ff10 77e79e31 00000002 01e6ff58 000003e8 = USER32!MsgWaitForMultipleObjectsEx+0xa8 01e6ff2c 697f1dbe 00000002 01e6ff58 00000000 = USER32!MsgWaitForMultipleObjects+0x1d 69a92ea0 750169a9 24448b22 244c8b14 24548b10 = mtxex!ContextWrapper__Recycle+0xe 60b03d83 000003e6 0006ef1c 0006ee60 00000008 0x750169a9 22 id: 14c.f2 Suspend: 0 Teb 7ffa4000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 020ffd68 1e142143 0a5734f0 00000000 0a6b31f0 = python15!PyThreadState_Clear+0x37 020ffd78 1e14267f 0a6b31f0 00000000 1e2a2401 = python15!PyInterpreterState_Clear+0x13 020ffd84 1e2a2401 020ffda4 1e2c4fd8 00000000 python15!Py_Finalize+0x3f 020ffdec 680c3b32 020ffe6c 00134748 77f050f0 = pythoncom15!PyCom_DLLReleaseRef+0x71 020ffe34 680c2f38 0009f0f0 00000000 020ffec0 = asp!CAppConfig__SetValue+0xc8 020ffe7c 680c78c0 0009f0f0 02216400 020ffec0 = asp!CPerfMainBlock__Init+0x47 020ffecc 680e25c6 00000000 697e1898 003ce8e0 = asp!CConnectionPoint__~CConnectionPoint+0x6 020ffee4 697e67cc 00000000 697e1898 0a6a5c90 = asp!_IASPObjectContextCustomStubVtbl+0x95 020fff24 697e57ce 02228310 697f21de 77f0178b = mtxex!CActivity__CallWithNewContext+0xac 77f67610 4affc033 89257508 fff00c42 037d044a = mtxex!CQueuedRequest__~CQueuedRequest+0x5e 0424548b 000003e6 0006ef1c 0006ee60 00000008 0x4affc033 23 id: 14c.f4 Suspend: 0 Teb 7ffa3000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0214ff88 77f04f37 00000994 ffffffff 00000000 = ntdll!NtWaitForSingleObject+0xb 0214ffb8 77f04ede 0015d260 ffffffff 00f4f234 = KERNEL32!WaitForSingleObject+0xf 0214ffec 00000000 776b1bdd 0015d260 00000000 KERNEL32!lstrcmpiW+0xbe 25 id: 14c.dc Suspend: 0 Teb 7ffa1000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0314ff84 686248e5 000000d8 0314ffac 0314ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0314ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 0314ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 26 id: 14c.115 Suspend: 0 Teb 7ffa0000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 025aff84 686248e5 000000d8 025affac 025affb4 = ntdll!ZwRemoveIoCompletion+0xb 025affb8 77f04ede 00000000 ffffffff 00f4ff28 ISATQ!AtqSetInfo+0xbb 025affec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 27 id: 14c.113 Suspend: 0 Teb 7ff9f000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 025fff84 686248e5 000000d8 025fffac 025fffb4 = ntdll!ZwRemoveIoCompletion+0xb 025fffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 025fffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 28 id: 14c.ff Suspend: 0 Teb 7ff9e000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0263ff84 686248e5 000000d8 0263ffac 0263ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0263ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 0263ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 29 id: 14c.132 Suspend: 0 Teb 7ff9d000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0279ff84 686248e5 000000d8 0279ffac 0279ffb4 = ntdll!ZwRemoveIoCompletion+0xb 0279ffb8 77f04ede 00000000 00000000 00000000 ISATQ!AtqSetInfo+0xbb 0279ffec 00000000 686248a8 00000000 00000000 KERNEL32!lstrcmpiW+0xbe 30 id: 14c.127 Suspend: 0 Teb 7ff9c000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0b89ff90 77e15a1d 77e160f7 0007f878 0b89ffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 31 id: 14c.dd Suspend: 0 Teb 7ff9b000 Unfrozen Stack frame count of 0x300 is too high. Changing to 500. ChildEBP RetAddr Args to Child 0b92ff90 77e15a1d 77e160f7 0007f878 0b92ffec = ntdll!ZwReplyWaitReceivePort+0xb 00003a98 000003e6 00000088 77e15a1d 00000024 RPCRT4!NdrOleAllocate+0x24 0:022> !locks 0:022> !inetdbg.atq -g Atq Globals: isatq!g_cConcurrency =3D 1 (0x 1) isatq!g_cThreads =3D 2 (0x 2) isatq!g_cAvailableThreads =3D 0 (0x 0) isatq!g_cMaxThreads =3D 0 (0x 0) isatq!g_fUseAcceptEx =3D 0 (0x 0) isatq!g_cbXmitBufferSize =3D 0 (0x 0) isatq!g_cbMinKbSec =3D 0 (0x 0) isatq!g_cCPU =3D 0 (0x 0) isatq!g_fShutdown =3D 2 (0x 2) isatq!g_msThreadTimeout =3D 0 (0x 0) isatq!g_dwTimeoutCookie =3D 0 (0x 0) isatq!g_cListenBacklog =3D 0 (0x 0) isatq!AtqGlobalContextCount =3D 0 (0x 0) sizeof(ATQ_CONTEXT) =3D 212 0:022> !inetdbg.asp -g Asp Globals: asp!g_nSessions =3D 0 (0x 0) asp!g_nApplications =3D 0 (0x 0) asp!g_nApplicationsRestarting =3D 0 (0x 0) asp!g_nBrowserRequests =3D 0 (0x 0) asp!g_nSessionCleanupRequests =3D 0 (0x 0) asp!g_nApplnCleanupRequests =3D 0 (0x 0) asp!g_fShutDownInProgress =3D 1868967740 (0x6f662f3c) 0:022> !inetdbg.ds -v esp 020ffd6c : 1e142143 : python15!PyInterpreterState_Clear+0x13 020ffd7c : 1e14267f : python15!Py_Finalize+0x3f 020ffd88 : 1e2a2401 : pythoncom15!PyCom_DLLReleaseRef+0x71 020ffd90 : 1e2c4fd8 : pythoncom15!PyITypeComp__Bind+0x1c28 020ffd98 : 1e2a6795 : pythoncom15!PyGatewayBase__~PyGatewayBase+0xa5 020ffda8 : 1e2c5108 : pythoncom15!PyITypeComp__Bind+0x1d58 020ffdb0 : 1e2a6a41 : pythoncom15!PyGatewayBase__Release+0x21 *** WARNING: Using export symbols for c:\program = files\python\win32comext\axscript\axscript.pyd 020ffdbc : 0208245b : axscript!PyGActiveScript__Release+0xb 020ffdc4 : 680d3924 : asp!STR__Copy+0x17 020ffdcc : 680ec330 : asp!g_szErrTemplate+0x17f 020ffdd4 : 680d50cd : asp!CCertRequest__ParseRDNS+0x43 020ffdf0 : 680c3b32 : asp!CAppConfig__SetValue+0xc8 020ffdfc : 77f050f0 : KERNEL32!InterlockedIncrement 020ffe04 : 680ebe20 : asp!g_PerfMain+0x7 020ffe08 : 680c31e0 : asp!CPerfMainBlock__AddProcess+0x49 020ffe24 : 680c3b58 : asp!CAppConfig__SetValue+0x11a 020ffe2c : 680ec6d0 : asp!g_szErrTemplate+0x51f 020ffe38 : 680c2f38 : asp!CPerfMainBlock__Init+0x47 020ffe4c : 77f050f0 : KERNEL32!InterlockedIncrement 020ffe54 : 680ebe20 : asp!g_PerfMain+0x7 020ffe80 : 680c78c0 : asp!CConnectionPoint__~CConnectionPoint+0x6 020ffed0 : 680e25c6 : asp!_IASPObjectContextCustomStubVtbl+0x95 020ffed8 : 697e1898 : mtxex!IID_IRegNode+0x8 020ffee8 : 697e67cc : mtxex!CActivity__CallWithNewContext+0xac 020ffef0 : 697e1898 : mtxex!IID_IRegNode+0x8 020fff18 : 6981ca16 : mtxex!CAspSecurity__Release+0x1d6 020fff1c : 697e18b0 : mtxex!IID_IRegNodeDispenser 020fff24 : 77f67610 : ntdll!RtlLeaveCriticalSection 020fff28 : 697e57ce : mtxex!CQueuedRequest__~CQueuedRequest+0x5e 020fff30 : 697f21de : mtxex!ContextWrapper__QueryInterface+0x352 020fff34 : 77f0178b : KERNEL32!GetLastError 020fff3c : 69a92ea0 : MTxInfr1!VipThunkPeekMessageW 020fff44 : 697f1ed1 : mtxex!ContextWrapper__QueryInterface+0x45 020fff50 : 697e21f8 : mtxex!IID_IJavaObjectPrivate 020fff7c : 697f22d2 : mtxex!ContextWrapper__Release+0x6e 020fff88 : 7800be50 : MSVCRT!endthread+0x96 *** WARNING: Using export symbols for ole32.dll 020fff94 : 77b2aa4d : ole32!CreateBindCtx+0x2d10 020fffac : 7800ef57 : MSVCRT!except_handler3 020fffb0 : 78033200 : MSVCRT!__non_rtti_object__`vftable'+0x33c 020fffbc : 77f04ede : KERNEL32!lstrcmpiW+0xbe 020fffc8 : 77b2aa4d : ole32!CreateBindCtx+0x2d10 020fffd0 : 77b2aa4d : ole32!CreateBindCtx+0x2d10 020fffd8 : 77bc7d60 : ole32+0xa7d60 020fffe0 : 77f3b944 : KERNEL32!GetDateFormatW+0x411f 020fffe4 : 77f3d238 : KERNEL32!GetDateFormatW+0x5a13 020ffff4 : 7800bdf9 : MSVCRT!endthread+0x3f inetdbg!ds: cannot read memory @ 2101000 0:022> !inetdbg.ds esp 020ffd64 : 0a6b31f0 020ffd68 : 0a5734f0 020ffd6c : 1e142143 : python15!PyInterpreterState_Clear+0x13 020ffd70 : 0a5734f0 020ffd74 : 00000000 020ffd78 : 0a6b31f0 020ffd7c : 1e14267f : python15!Py_Finalize+0x3f 020ffd80 : 0a6b31f0 020ffd84 : 00000000 020ffd88 : 1e2a2401 : pythoncom15!PyCom_DLLReleaseRef+0x71 020ffd8c : 020ffda4 020ffd90 : 1e2c4fd8 : pythoncom15!PyITypeComp__Bind+0x1c28 020ffd94 : 00000000 020ffd98 : 1e2a6795 : pythoncom15!PyGatewayBase__~PyGatewayBase+0xa5 020ffd9c : 0a661f70 020ffda0 : 00000001 020ffda4 : 020fff14 020ffda8 : 1e2c5108 : pythoncom15!PyITypeComp__Bind+0x1d58 020ffdac : ffffffff 020ffdb0 : 1e2a6a41 : pythoncom15!PyGatewayBase__Release+0x21 020ffdb4 : 0008faf8 020ffdb8 : 0008fa78 020ffdbc : 0208245b : axscript!PyGActiveScript__Release+0xb 020ffdc0 : 0a661f70 020ffdc4 : 680d3924 : asp!STR__Copy+0x17 020ffdc8 : 0a661f70 020ffdcc : 680ec330 : asp!g_szErrTemplate+0x17f 020ffdd0 : 0008fa78 020ffdd4 : 680d50cd : asp!CCertRequest__ParseRDNS+0x43 020ffdd8 : 00000000 020ffddc : 020ffe58 020ffde0 : 00000000 020ffde4 : 00000000 020ffde8 : 0014ce18 020ffdec : 020ffe34 020ffdf0 : 680c3b32 : asp!CAppConfig__SetValue+0xc8 020ffdf4 : 020ffe6c 020ffdf8 : 00134748 020ffdfc : 77f050f0 : KERNEL32!InterlockedIncrement 020ffe00 : 02216400 020ffe04 : 680ebe20 : asp!g_PerfMain+0x7 020ffe08 : 680c31e0 : asp!CPerfMainBlock__AddProcess+0x49 020ffe0c : 020ffe58 020ffe10 : 00134748 020ffe14 : 020ffec0 020ffe18 : 02216400 020ffe1c : 00000000 020ffe20 : 0012c241 !inetdbg.ds 20ffe24 to dump next block 0:022> u eip-50 eip+10 python15!PyThreadState_New+0x37: 1e142267 48 dec eax 1e142268 3489 xor al,0x89 1e14226a 48 dec eax 1e14226b 1889481c8b4a sbb [ecx+0x4a8b1c48],cl 1e142271 0489 add al,0x89 1e142273 08894204c390 or [ecx+0x90c30442],cl 1e142279 90 nop 1e14227a 90 nop 1e14227b 90 nop 1e14227c 90 nop 1e14227d 90 nop 1e14227e 90 nop 1e14227f 90 nop python15!PyThreadState_Clear: 1e142280 a180d6171e mov eax,[python15!Py_VerboseFlag = (1e17d680)] 1e142285 56 push esi 1e142286 8b742408 mov esi,[esp+0x8] 1e14228a 57 push edi 1e14228b 33ff xor edi,edi 1e14228d 3bc7 cmp eax,edi 1e14228f 741c jz python15!PyThreadState_Clear+0x2d = (1e1422ad) 1e142291 397e08 cmp [esi+0x8],edi 1e142294 7417 jz python15!PyThreadState_Clear+0x2d = (1e1422ad) 1e142296 a100e5171e mov eax,[python15+0x7e500 (1e17e500)] 1e14229b 68ec2d171e push 0x1e172dec 1e1422a0 83c040 add eax,0x40 1e1422a3 50 push eax 1e1422a4 ff15fce4171e call dword ptr [python15+0x7e4fc = (1e17e4fc)] 1e1422aa 83c408 add esp,0x8 1e1422ad 8b4608 mov eax,[esi+0x8] 1e1422b0 897e08 mov [esi+0x8],edi 1e1422b3 3bc7 cmp eax,edi 1e1422b5 7411 jz python15!PyThreadState_Clear+0x48 = (1e1422c8) 1e1422b7 8b08 mov ecx,[eax] 1e1422b9 49 dec ecx 1e1422ba 8908 mov [eax],ecx 1e1422bc 750a jnz python15!PyThreadState_Clear+0x48 = (1e1422c8) 1e1422be 8b4804 mov ecx,[eax+0x4] 1e1422c1 50 push eax 1e1422c2 ff5118 call dword ptr [ecx+0x18] 1e1422c5 83c404 add esp,0x4 0:022> dc eax-100 eax+100 5c6e6e68 ???????? ???????? ???????? ???????? ???????????????? 5c6e6e78 ???????? ???????? ???????? ???????? ???????????????? 5c6e6e88 ???????? ???????? ???????? ???????? ???????????????? 5c6e6e98 ???????? ???????? ???????? ???????? ???????????????? 5c6e6ea8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6eb8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6ec8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6ed8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6ee8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6ef8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f08 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f18 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f28 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f38 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f48 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f58 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f68 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f78 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f88 ???????? ???????? ???????? ???????? ???????????????? 5c6e6f98 ???????? ???????? ???????? ???????? ???????????????? 5c6e6fa8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6fb8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6fc8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6fd8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6fe8 ???????? ???????? ???????? ???????? ???????????????? 5c6e6ff8 ???????? ???????? ???????? ???????? ???????????????? 5c6e7008 ???????? ???????? ???????? ???????? ???????????????? 5c6e7018 ???????? ???????? ???????? ???????? ???????????????? 5c6e7028 ???????? ???????? ???????? ???????? ???????????????? 5c6e7038 ???????? ???????? ???????? ???????? ???????????????? 5c6e7048 ???????? ???????? ???????? ???????? ???????????????? 5c6e7058 ???????? ???????? ???????? ???????? ???????????????? 5c6e7068 ???????? ???? 0:022> dc ebx-100 ebx+100 680ec370 00000000 00000000 00000000 00000000 ................ 680ec380 00000000 00000000 00000000 00000000 ................ 680ec390 00000000 00000000 00000000 00000000 ................ 680ec3a0 00000000 00000000 00000000 00000000 ................ 680ec3b0 00000000 00000000 00000000 680b1b10 ...............h 680ec3c0 680ec3bc 680ec3bc 0012d4a0 ffffffff ...h...h........ 680ec3d0 00000000 00000000 00000000 00000000 ................ 680ec3e0 680b53d0 00000001 00000000 00000000 .S.h............ 680ec3f0 680ec400 680c57c0 00000003 00000000 ...h.W.h........ 680ec400 00000000 00000000 00000000 00000000 ................ 680ec410 00000000 00000000 00000000 00000000 ................ 680ec420 00000000 00000000 00000000 00000000 ................ 680ec430 00000000 00000000 00000000 00000000 ................ 680ec440 00000000 00000000 00000000 00000000 ................ 680ec450 00000000 00000000 00000000 00000000 ................ 680ec460 00000000 680b1b10 680ec464 680ec464 .......hd..hd..h 680ec470 0012d4c0 ffffffff 00000000 00000000 ................ 680ec480 00000000 00000000 680b3340 00000001 ........ at 3.h.... 680ec490 001377c0 001348e8 680ec4a8 680c57c0 .w...H.....h.W.h 680ec4a0 0000000b 00000002 00000000 001348e8 .............H.. 680ec4b0 00000000 001377c0 00000000 00000000 .....w.......... 680ec4c0 00000000 00000000 00000000 00000000 ................ 680ec4d0 00000000 00000000 00000000 00000000 ................ 680ec4e0 00000000 00000000 00000000 00000000 ................ 680ec4f0 00000000 00000000 00000000 00000000 ................ 680ec500 00000000 00000000 00000000 0012d480 ................ 680ec510 ffffffff 00000000 00000000 00000000 ................ 680ec520 00000000 0000008a 00000002 00000008 ................ 680ec530 00000007 002927d8 00000002 00000008 .....')......... 680ec540 00000007 00000000 00000002 00000000 ................ 680ec550 00000001 0012d3a0 ffffffff 00000000 ................ 680ec560 00000000 00000000 00000000 342ad0bc ..............*4 680ec570 342ad6c0 ..*4 0:022> dc ecx-100 ecx+100 020ffc8c 020ffcd8 07879000 07877e00 00230000 .........~....#. 020ffc9c 77f650a8 072f0000 020ffcd4 00000000 .P.w../......... 020ffcac 77f8f2ad 00230000 078528a8 00000000 ...w..#..(...... 020ffcbc 020ffcb0 00000000 020ffd34 77f92cd4 ........4....,.w 020ffccc 77f9d870 ffffffff 020ffcfc 77f64ddc p..w.........M.w 020ffcdc 00231a90 078528b0 0000000c 078528b0 ..#..(.......(.. 020ffcec 08983200 078726d8 780012a6 780012a6 .2...&.....x...x 020ffcfc 7803c120 780012a6 7803c120 020ffd4c ..x...x ..xL... 020ffd0c 78001434 00000009 780012a6 7803c120 4..x.......x ..x 020ffd1c 020ffd60 78001434 00000009 78001405 `...4..x.......x 020ffd2c 00000020 78001385 0a6de250 0a6de01d ......xP.m...m. 020ffd3c 0767df18 0a6de000 78032250 ffffffff ..g...m.P".x.... 020ffd4c 020ffdec 020ffd8c 7800ef57 78032250 ........W..xP".x 020ffd5c ffffffff 020ffdec 0a6b31f0 0a5734f0 .........1k..4W. 020ffd6c 1e142143 0a5734f0 00000000 0a6b31f0 C!...4W......1k. 020ffd7c 1e14267f 0a6b31f0 00000000 1e2a2401 .&...1k......$*. 020ffd8c 020ffda4 1e2c4fd8 00000000 1e2a6795 .....O,......g*. 020ffd9c 0a661f70 00000001 020fff14 1e2c5108 p.f..........Q,. 020ffdac ffffffff 1e2a6a41 0008faf8 0008fa78 ....Aj*.....x... 020ffdbc 0208245b 0a661f70 680d3924 0a661f70 [$..p.f.$9.hp.f. 020ffdcc 680ec330 0008fa78 680d50cd 00000000 0..hx....P.h.... 020ffddc 020ffe58 00000000 00000000 0014ce18 X............... 020ffdec 020ffe34 680c3b32 020ffe6c 00134748 4...2;.hl...HG.. 020ffdfc 77f050f0 02216400 680ebe20 680c31e0 .P.w.d!. ..h.1.h 020ffe0c 020ffe58 00134748 020ffec0 02216400 X...HG.......d!. 020ffe1c 00000000 0012c241 680c3b58 00000000 ....A...X;.h.... 020ffe2c 680ec6d0 000000c0 020ffe7c 680c2f38 ...h....|...8/.h 020ffe3c 0009f0f0 00000000 020ffec0 020ffe58 ............X... 020ffe4c 77f050f0 02216400 680ebe20 00000001 .P.w.d!. ..h.... 020ffe5c 00000001 020ffe64 045dc31c 045dc324 ....d.....].$.]. 020ffe6c 0008fa78 00000000 0009f0f0 00000000 x............... 020ffe7c 00000000 680c78c0 0009f0f0 02216400 .....x.h.....d!. 020ffe8c 020ffec0 .... 0:022> dc edx-100 edx+100 7803c020 00000000 00000000 00000000 00000000 ................ 7803c030 00000000 7803c0f0 00298880 00000000 .......x..)..... 7803c040 00000000 00000000 00000000 00000000 ................ 7803c050 00000000 7803c120 00000000 002988e0 .... ..x......). 7803c060 00294aa0 7803c138 00000000 00000000 .J).8..x........ 7803c070 00000000 7803c108 002988c0 00240600 .......x..)...$. 7803c080 00000000 00000000 00000000 00000000 ................ 7803c090 00000000 00240180 00000000 00000000 ......$......... 7803c0a0 00000000 003c2ba0 0029de50 002988a0 .....+<.P.)...). 7803c0b0 00298900 0029eb70 002ae910 002b3ad0 ..).p.)...*..:+. 7803c0c0 00348f80 00350970 063274c0 00000000 ..4.p.5..t2..... 7803c0d0 00000000 00000000 00000000 00000000 ................ 7803c0e0 00000000 00000000 00000000 00000000 ................ 7803c0f0 77fa7790 ffffffff 00000000 00000000 .w.w............ 7803c100 00000000 00000000 77fa7730 ffffffff ........0w.w.... 7803c110 00000000 00000000 00000000 00000000 ................ 7803c120 77fa7770 ffffffff 00000000 00000000 pw.w............ 7803c130 00000a70 00000000 77fa7750 ffffffff p.......Pw.w.... 7803c140 00000000 00000000 00000000 00000000 ................ 7803c150 000001e0 0767df18 00000000 00000018 ......g......... 7803c160 00200000 00200020 00200020 00200020 .. . . . . . . . 7803c170 00200020 00280028 00280028 00200028 . .(.(.(.(.(. . 7803c180 00200020 00200020 00200020 00200020 . . . . . . . . 7803c190 00200020 00200020 00200020 00200020 . . . . . . . . 7803c1a0 00480020 00100010 00100010 00100010 .H............. 7803c1b0 00100010 00100010 00100010 00100010 ................ 7803c1c0 00840010 00840084 00840084 00840084 ................ 7803c1d0 00840084 00100084 00100010 00100010 ................ 7803c1e0 00100010 00810081 00810081 00810081 ................ 7803c1f0 00010001 00010001 00010001 00010001 ................ 7803c200 00010001 00010001 00010001 00010001 ................ 7803c210 00010001 00010001 00100010 00100010 ................ 7803c220 00100010 .... 0:022> dc esi-100 esi+100 0a5733f0 00000000 1e168fd0 0a54f7a0 0a5717f0 ..........T...W. 0a573400 00000000 1e170238 0a54f760 414b4341 ....8...`.T.ACKA 0a573410 00000000 1e168fd0 0a5502f0 0a5717f0 ..........U...W. 0a573420 00000000 1e170238 0a54f8d0 69725065 ....8.....T.ePri 0a573430 697e3768 697e3740 697e3728 697e3708 h7~i at 7~i(7~i.7~i 0a573440 697e36f8 00000003 00293230 00000000 .6~i....02)..... 0a573450 00000002 1e176bd8 00000008 e1d9e008 .....k.......... 0a573460 0a573450 65707954 65707954 45544f00 P4W.TypeType.OTE 0a573470 53490138 00000000 00010003 0a5735b0 8.IS.........5W. 0a573480 00000001 1e176bd8 00000014 ffffffff .....k.......... 0a573490 00000000 63614d49 656e6968 75626544 ....IMachineDebu 0a5734a0 6e614d67 72656761 51973c00 11d0cb0c gManager.<.Q.... 0a5734b0 00000002 1e176bd8 00000007 3c0dad84 .....k.........< 0a5734c0 0a5734b0 54746e49 00657079 69766900 .4W.IntType..ivi 0a5734d0 00000000 1e176bd8 00000037 ffffffff .....k..7....... 0a5734e0 00000000 505c3a43 72676f72 46206d61 ....C:\Program F 0a5734f0 73656c69 7479505c 00000000 336e6977 iles\Pyt....win3 0a573500 6d6f6332 5c747865 65647861 5c677562 2comext\axdebug\ 0a573510 65746167 73796177 0079702e 00000000 gateways.py..... 0a573520 00000000 00000000 00000000 3674e0d9 ..............t6 0a573530 00000002 1e176bd8 00000018 65c3ff27 .....k......'..e 0a573540 0a573530 336e6977 6d6f6332 7265732e 05W.win32com.ser 0a573550 2e726576 656e6977 726f7272 65534200 ver.winerror.BSe 0a573560 00000002 1e176bd8 00000008 44a2c362 .....k......b..D 0a573570 0a573560 676e6f4c 65707954 0a573600 `5W.LongType.6W. 0a573580 00000001 1e176bd8 00000011 ffffffff .....k.......... 0a573590 00000000 62654449 70416775 63696c70 ....IDebugApplic 0a5735a0 6f697461 6e69006e 78655f74 68740063 ation.int_exc.th 0a5735b0 00000000 1e176bd8 00000014 ffffffff .....k.......... 0a5735c0 00000000 43746547 65746e6f 664f7478 ....GetContextOf 0a5735d0 69736f50 6e6f6974 00010000 0a5735e0 Position.....5W. 0a5735e0 00000123 00000000 00010003 0a573610 #............6W. 0a5735f0 00000000 .... 0:022> dc edi-100 edi+100 ^ Range error in 'dc edi-100 edi+100' 0:022> dc esp-100 esp+100 020ffc64 00230000 00001000 0786b000 00230548 ..#.........H.#. 020ffc74 072f0030 77f6447e 072f0000 072f0030 0./.~D.w../.0./. 020ffc84 77f6447e 072f0000 020ffcd8 07879000 ~D.w../......... 020ffc94 07877e00 00230000 77f650a8 072f0000 .~....#..P.w../. 020ffca4 020ffcd4 00000000 77f8f2ad 00230000 ...........w..#. 020ffcb4 078528a8 00000000 020ffcb0 00000000 .(.............. 020ffcc4 020ffd34 77f92cd4 77f9d870 ffffffff 4....,.wp..w.... 020ffcd4 020ffcfc 77f64ddc 00231a90 078528b0 .....M.w..#..(.. 020ffce4 0000000c 078528b0 08983200 078726d8 .....(...2...&.. 020ffcf4 780012a6 780012a6 7803c120 780012a6 ...x...x ..x...x 020ffd04 7803c120 020ffd4c 78001434 00000009 ..xL...4..x.... 020ffd14 780012a6 7803c120 020ffd60 78001434 ...x ..x`...4..x 020ffd24 00000009 78001405 00000020 78001385 .......x ......x 020ffd34 0a6de250 0a6de01d 0767df18 0a6de000 P.m...m...g...m. 020ffd44 78032250 ffffffff 020ffdec 020ffd8c P".x............ 020ffd54 7800ef57 78032250 ffffffff 020ffdec W..xP".x........ 020ffd64 0a6b31f0 0a5734f0 1e142143 0a5734f0 .1k..4W.C!...4W. 020ffd74 00000000 0a6b31f0 1e14267f 0a6b31f0 .....1k..&...1k. 020ffd84 00000000 1e2a2401 020ffda4 1e2c4fd8 .....$*......O,. 020ffd94 00000000 1e2a6795 0a661f70 00000001 .....g*.p.f..... 020ffda4 020fff14 1e2c5108 ffffffff 1e2a6a41 .....Q,.....Aj*. 020ffdb4 0008faf8 0008fa78 0208245b 0a661f70 ....x...[$..p.f. 020ffdc4 680d3924 0a661f70 680ec330 0008fa78 $9.hp.f.0..hx... 020ffdd4 680d50cd 00000000 020ffe58 00000000 .P.h....X....... 020ffde4 00000000 0014ce18 020ffe34 680c3b32 ........4...2;.h 020ffdf4 020ffe6c 00134748 77f050f0 02216400 l...HG...P.w.d!. 020ffe04 680ebe20 680c31e0 020ffe58 00134748 ..h.1.hX...HG.. 020ffe14 020ffec0 02216400 00000000 0012c241 .....d!.....A... 020ffe24 680c3b58 00000000 680ec6d0 000000c0 X;.h.......h.... 020ffe34 020ffe7c 680c2f38 0009f0f0 00000000 |...8/.h........ 020ffe44 020ffec0 020ffe58 77f050f0 02216400 ....X....P.w.d!. 020ffe54 680ebe20 00000001 00000001 020ffe64 ..h........d... 020ffe64 045dc31c ..]. 0:022> dc ebp-100 ebp+100 020ffcec 08983200 078726d8 780012a6 780012a6 .2...&.....x...x 020ffcfc 7803c120 780012a6 7803c120 020ffd4c ..x...x ..xL... 020ffd0c 78001434 00000009 780012a6 7803c120 4..x.......x ..x 020ffd1c 020ffd60 78001434 00000009 78001405 `...4..x.......x 020ffd2c 00000020 78001385 0a6de250 0a6de01d ......xP.m...m. 020ffd3c 0767df18 0a6de000 78032250 ffffffff ..g...m.P".x.... 020ffd4c 020ffdec 020ffd8c 7800ef57 78032250 ........W..xP".x 020ffd5c ffffffff 020ffdec 0a6b31f0 0a5734f0 .........1k..4W. 020ffd6c 1e142143 0a5734f0 00000000 0a6b31f0 C!...4W......1k. 020ffd7c 1e14267f 0a6b31f0 00000000 1e2a2401 .&...1k......$*. 020ffd8c 020ffda4 1e2c4fd8 00000000 1e2a6795 .....O,......g*. 020ffd9c 0a661f70 00000001 020fff14 1e2c5108 p.f..........Q,. 020ffdac ffffffff 1e2a6a41 0008faf8 0008fa78 ....Aj*.....x... 020ffdbc 0208245b 0a661f70 680d3924 0a661f70 [$..p.f.$9.hp.f. 020ffdcc 680ec330 0008fa78 680d50cd 00000000 0..hx....P.h.... 020ffddc 020ffe58 00000000 00000000 0014ce18 X............... 020ffdec 020ffe34 680c3b32 020ffe6c 00134748 4...2;.hl...HG.. 020ffdfc 77f050f0 02216400 680ebe20 680c31e0 .P.w.d!. ..h.1.h 020ffe0c 020ffe58 00134748 020ffec0 02216400 X...HG.......d!. 020ffe1c 00000000 0012c241 680c3b58 00000000 ....A...X;.h.... 020ffe2c 680ec6d0 000000c0 020ffe7c 680c2f38 ...h....|...8/.h 020ffe3c 0009f0f0 00000000 020ffec0 020ffe58 ............X... 020ffe4c 77f050f0 02216400 680ebe20 00000001 .P.w.d!. ..h.... 020ffe5c 00000001 020ffe64 045dc31c 045dc324 ....d.....].$.]. 020ffe6c 0008fa78 00000000 0009f0f0 00000000 x............... 020ffe7c 00000000 680c78c0 0009f0f0 02216400 .....x.h.....d!. 020ffe8c 020ffec0 00000000 02228310 020ffee4 .........."..... 020ffe9c 0012c110 00000000 00000000 0013cba0 ................ 020ffeac 0009f0f0 00000000 00000000 fffffffe ................ 020ffebc 00000001 0014ba80 0014baa8 0014bad0 ................ 020ffecc 0014baf8 680e25c6 00000000 697e1898 .....%.h......~i 020ffedc 003ce8e0 003ce3ec 020fff24 697e67cc ..<...<.$....g~i 020ffeec 00000000 .... 0:022> dc esp+0x04 020ffd68 0a5734f0 1e142143 0a5734f0 00000000 .4W.C!...4W..... 020ffd78 0a6b31f0 1e14267f 0a6b31f0 00000000 .1k..&...1k..... 020ffd88 1e2a2401 020ffda4 1e2c4fd8 00000000 .$*......O,..... 020ffd98 1e2a6795 0a661f70 00000001 020fff14 .g*.p.f......... 020ffda8 1e2c5108 ffffffff 1e2a6a41 0008faf8 .Q,.....Aj*..... 020ffdb8 0008fa78 0208245b 0a661f70 680d3924 x...[$..p.f.$9.h 020ffdc8 0a661f70 680ec330 0008fa78 680d50cd p.f.0..hx....P.h 020ffdd8 00000000 020ffe58 00000000 00000000 ....X........... 0:022> dc esp+0x08 020ffd6c 1e142143 0a5734f0 00000000 0a6b31f0 C!...4W......1k. 020ffd7c 1e14267f 0a6b31f0 00000000 1e2a2401 .&...1k......$*. 020ffd8c 020ffda4 1e2c4fd8 00000000 1e2a6795 .....O,......g*. 020ffd9c 0a661f70 00000001 020fff14 1e2c5108 p.f..........Q,. 020ffdac ffffffff 1e2a6a41 0008faf8 0008fa78 ....Aj*.....x... 020ffdbc 0208245b 0a661f70 680d3924 0a661f70 [$..p.f.$9.hp.f. 020ffdcc 680ec330 0008fa78 680d50cd 00000000 0..hx....P.h.... 020ffddc 020ffe58 00000000 00000000 0014ce18 X............... 0:022> dc esp+0x0c 020ffd70 0a5734f0 00000000 0a6b31f0 1e14267f .4W......1k..&.. 020ffd80 0a6b31f0 00000000 1e2a2401 020ffda4 .1k......$*..... 020ffd90 1e2c4fd8 00000000 1e2a6795 0a661f70 .O,......g*.p.f. 020ffda0 00000001 020fff14 1e2c5108 ffffffff .........Q,..... 020ffdb0 1e2a6a41 0008faf8 0008fa78 0208245b Aj*.....x...[$.. 020ffdc0 0a661f70 680d3924 0a661f70 680ec330 p.f.$9.hp.f.0..h 020ffdd0 0008fa78 680d50cd 00000000 020ffe58 x....P.h....X... 020ffde0 00000000 00000000 0014ce18 020ffe34 ............4... 0:022> dc esp+0x10 020ffd74 00000000 0a6b31f0 1e14267f 0a6b31f0 .....1k..&...1k. 020ffd84 00000000 1e2a2401 020ffda4 1e2c4fd8 .....$*......O,. 020ffd94 00000000 1e2a6795 0a661f70 00000001 .....g*.p.f..... 020ffda4 020fff14 1e2c5108 ffffffff 1e2a6a41 .....Q,.....Aj*. 020ffdb4 0008faf8 0008fa78 0208245b 0a661f70 ....x...[$..p.f. 020ffdc4 680d3924 0a661f70 680ec330 0008fa78 $9.hp.f.0..hx... 020ffdd4 680d50cd 00000000 020ffe58 00000000 .P.h....X....... 020ffde4 00000000 0014ce18 020ffe34 680c3b32 ........4...2;.h 0:022> dc ebp+0x04 020ffdf0 680c3b32 020ffe6c 00134748 77f050f0 2;.hl...HG...P.w 020ffe00 02216400 680ebe20 680c31e0 020ffe58 .d!. ..h.1.hX... 020ffe10 00134748 020ffec0 02216400 00000000 HG.......d!..... 020ffe20 0012c241 680c3b58 00000000 680ec6d0 A...X;.h.......h 020ffe30 000000c0 020ffe7c 680c2f38 0009f0f0 ....|...8/.h.... 020ffe40 00000000 020ffec0 020ffe58 77f050f0 ........X....P.w 020ffe50 02216400 680ebe20 00000001 00000001 .d!. ..h........ 020ffe60 020ffe64 045dc31c 045dc324 0008fa78 d.....].$.].x... 0:022> dc ebp+0x08 020ffdf4 020ffe6c 00134748 77f050f0 02216400 l...HG...P.w.d!. 020ffe04 680ebe20 680c31e0 020ffe58 00134748 ..h.1.hX...HG.. 020ffe14 020ffec0 02216400 00000000 0012c241 .....d!.....A... 020ffe24 680c3b58 00000000 680ec6d0 000000c0 X;.h.......h.... 020ffe34 020ffe7c 680c2f38 0009f0f0 00000000 |...8/.h........ 020ffe44 020ffec0 020ffe58 77f050f0 02216400 ....X....P.w.d!. 020ffe54 680ebe20 00000001 00000001 020ffe64 ..h........d... 020ffe64 045dc31c 045dc324 0008fa78 00000000 ..].$.].x....... 0:022> dc ebp+0x0c 020ffdf8 00134748 77f050f0 02216400 680ebe20 HG...P.w.d!. ..h 020ffe08 680c31e0 020ffe58 00134748 020ffec0 .1.hX...HG...... 020ffe18 02216400 00000000 0012c241 680c3b58 .d!.....A...X;.h 020ffe28 00000000 680ec6d0 000000c0 020ffe7c .......h....|... 020ffe38 680c2f38 0009f0f0 00000000 020ffec0 8/.h............ 020ffe48 020ffe58 77f050f0 02216400 680ebe20 X....P.w.d!. ..h 020ffe58 00000001 00000001 020ffe64 045dc31c ........d.....]. 020ffe68 045dc324 0008fa78 00000000 0009f0f0 $.].x........... 0:022> dc ebp+0x10 020ffdfc 77f050f0 02216400 680ebe20 680c31e0 .P.w.d!. ..h.1.h 020ffe0c 020ffe58 00134748 020ffec0 02216400 X...HG.......d!. 020ffe1c 00000000 0012c241 680c3b58 00000000 ....A...X;.h.... 020ffe2c 680ec6d0 000000c0 020ffe7c 680c2f38 ...h....|...8/.h 020ffe3c 0009f0f0 00000000 020ffec0 020ffe58 ............X... 020ffe4c 77f050f0 02216400 680ebe20 00000001 .P.w.d!. ..h.... 020ffe5c 00000001 020ffe64 045dc31c 045dc324 ....d.....].$.]. 020ffe6c 0008fa78 00000000 0009f0f0 00000000 x............... 0:022> dc poi(esp+0x04) 0a5734f0 73656c69 7479505c 00000000 336e6977 iles\Pyt....win3 0a573500 6d6f6332 5c747865 65647861 5c677562 2comext\axdebug\ 0a573510 65746167 73796177 0079702e 00000000 gateways.py..... 0a573520 00000000 00000000 00000000 3674e0d9 ..............t6 0a573530 00000002 1e176bd8 00000018 65c3ff27 .....k......'..e 0a573540 0a573530 336e6977 6d6f6332 7265732e 05W.win32com.ser 0a573550 2e726576 656e6977 726f7272 65534200 ver.winerror.BSe 0a573560 00000002 1e176bd8 00000008 44a2c362 .....k......b..D 0:022> dc poi(esp+0x08) 1e142143 c483368b 75f68504 08478bf1 000847c7 .6.....u..G..G.. 1e142153 85000000 8b1174c0 08894908 488b0a75 .....t...I..u..H 1e142163 51ff5004 04c48318 c70c478b 00000c47 .P.Q.....G..G... 1e142173 c0850000 088b1174 75088949 04508b0a ....t...I..u..P. 1e142183 1852ff50 8b04c483 47c71047 00000010 P.R.....G..G.... 1e142193 74c08500 49088b11 0a750889 5004488b ...t...I..u..H.P 1e1421a3 831851ff 5e5f04c4 909090c3 8b575690 .Q...._^.....VW. 1e1421b3 570c247c 000054e8 04c48300 17cd34be |$.W.T.......4.. 0:022> dc poi(esp+0x0c) 0a5734f0 73656c69 7479505c 00000000 336e6977 iles\Pyt....win3 0a573500 6d6f6332 5c747865 65647861 5c677562 2comext\axdebug\ 0a573510 65746167 73796177 0079702e 00000000 gateways.py..... 0a573520 00000000 00000000 00000000 3674e0d9 ..............t6 0a573530 00000002 1e176bd8 00000018 65c3ff27 .....k......'..e 0a573540 0a573530 336e6977 6d6f6332 7265732e 05W.win32com.ser 0a573550 2e726576 656e6977 726f7272 65534200 ver.winerror.BSe 0a573560 00000002 1e176bd8 00000008 44a2c362 .....k......b..D 0:022> dc poi(esp+0x10) 00000000 ???????? ???????? ???????? ???????? ???????????????? 00000010 ???????? ???????? ???????? ???????? ???????????????? 00000020 ???????? ???????? ???????? ???????? ???????????????? 00000030 ???????? ???????? ???????? ???????? ???????????????? 00000040 ???????? ???????? ???????? ???????? ???????????????? 00000050 ???????? ???????? ???????? ???????? ???????????????? 00000060 ???????? ???????? ???????? ???????? ???????????????? 00000070 ???????? ???????? ???????? ???????? ???????????????? 0:022> dc poi(ebp+0x04) 680c3b32 c7b70f47 7c04463b 045e89de 7e013e83 G...;F.|..^..>.~ 680c3b42 ff53530a 15e80876 89000050 085e891e .SS.v...P.....^. 680c3b52 c25b5e5f 4c8b0008 448b0824 413b0424 _^[....L$..D$.;A 680c3b62 33047204 8b0aebc0 048d0849 81448b80 .r.3....I.....D. 680c3b72 0008c208 8bec8b55 4d8b1845 00208014 ....U...E..M.. . 680c3b82 1f74c985 08758b56 0f118b50 ff0c45bf ..t.V.u.P....E.. 680c3b92 768b1075 80048d08 088674ff 1452ff51 u..v.....t..Q.R. 680c3ba2 0f19eb5e 8b0c45bf 75ff084d 80048d10 ^....E..M..u.... 0:022> dc poi(ebp+0x08) 020ffe6c 0008fa78 00000000 0009f0f0 00000000 x............... 020ffe7c 00000000 680c78c0 0009f0f0 02216400 .....x.h.....d!. 020ffe8c 020ffec0 00000000 02228310 020ffee4 .........."..... 020ffe9c 0012c110 00000000 00000000 0013cba0 ................ 020ffeac 0009f0f0 00000000 00000000 fffffffe ................ 020ffebc 00000001 0014ba80 0014baa8 0014bad0 ................ 020ffecc 0014baf8 680e25c6 00000000 697e1898 .....%.h......~i 020ffedc 003ce8e0 003ce3ec 020fff24 697e67cc ..<...<.$....g~i 0:022> dc poi(ebp+0x0c) 00134748 680b1aa8 680b3bc0 00000000 0013143c ...h.;.h....<... 00134758 680b1ae4 00134398 00000011 00134160 ...h.C......`A.. 00134768 00000000 00000001 00000006 00000001 ................ 00134778 00000001 00134398 00134840 00134358 .....C.. at H..XC.. 00134788 00000000 00000000 001349b0 000826b8 .........I...&.. 00134798 000bb0c0 00134088 00134960 00000000 ..... at ..`I...... 001347a8 0012d660 ffffffff 00000000 00000000 `............... 001347b8 00000000 00000000 0012d680 ffffffff ................ 0:022> dc poi(ebp+0x10) 77f050f0 04244c8b 000001b8 c10ff000 04c24001 .L$.......... at .. 77f05100 c08b2e00 04244c8b ffffffb8 c10ff0ff .....L$......... 77f05110 04c24801 c08b2e00 04244c8b 0824548b .H.......L$..T$. 77f05120 0ff0018b fa7511b1 900008c2 04244c8b ......u......L$. 77f05130 0824548b 0c24448b 11b10ff0 90000cc2 .T$..D$......... 77f05140 04244c8b 0824448b 01c10ff0 900008c2 .L$..D$......... 77f05150 0424448b 3878c00b 0824548b 880fd20b .D$...x8.T$..... 77f05160 000000b2 4c8be2f7 c90b0c24 00e6880f .......L$....... 0:022> !inetdbg.ver Module @ 0x01000000 =3D inetinfo.exe dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Internet Information Services FileVersion =3D 4.02.0622 InternalName =3D INETINFO.EXE LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D INETINFO.EXE ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77f60000 =3D ntdll.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D NT Layer DLL FileVersion =3D 4.00 InternalName =3D ntdll.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D ntdll.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x78000000 =3D MSVCRT.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft (R) C Runtime Library FileVersion =3D 6.10.8528.0 InternalName =3D MSVCRT.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1998 OriginalFilename =3D MSVCRT.DLL ProductName =3D Microsoft (R) Visual C++ ProductVersion =3D 6.10.8528.0 Module @ 0x77f00000 =3D KERNEL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT BASE API Client DLL FileVersion =3D 4.00 InternalName =3D kernel32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D kernel32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77dc0000 =3D ADVAPI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Advanced Windows 32 Base API FileVersion =3D 4.00 InternalName =3D advapi32.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D advapi32.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e70000 =3D USER32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT USER API Client DLL FileVersion =3D 4.00 InternalName =3D user32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D user32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77ed0000 =3D GDI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D GDI Client DLL FileVersion =3D 4.00 InternalName =3D gdi32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D gdi32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e10000 =3D RPCRT4.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Procedure Call Runtime FileVersion =3D 4.00 InternalName =3D rpcrt4.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcrt4.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77b20000 =3D ole32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft OLE for Windows and Windows NT FileVersion =3D 4.00 InternalName =3D OLE32.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D OLE32.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x68e80000 =3D rpcref.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft Internet Information Services RPC = helper library FileVersion =3D 4.02.0622 InternalName =3D RPCREF.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D RPCREF.DLL ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77bf0000 =3D rpcltc1.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Process Control LTC1 DLL FileVersion =3D 4.00 InternalName =3D rpcltc1.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcltc1.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x683a0000 =3D iisadmin.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Metadata and Admin Service FileVersion =3D 4.02.0720 InternalName =3D mdadmin.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D mdadmin.dll ProductName =3D Internet Information Server CDB: c0000005 Exception in inetdbg.ver debugger extension. PC: 77f66ebf VA: 00078000 R/W: 1 Parameter: 1001f 0:022> !inetdbg.ver Module @ 0x01000000 =3D inetinfo.exe dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Internet Information Services FileVersion =3D 4.02.0622 InternalName =3D INETINFO.EXE LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D INETINFO.EXE ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77f60000 =3D ntdll.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D NT Layer DLL FileVersion =3D 4.00 InternalName =3D ntdll.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D ntdll.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x78000000 =3D MSVCRT.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft (R) C Runtime Library FileVersion =3D 6.10.8528.0 InternalName =3D MSVCRT.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1998 OriginalFilename =3D MSVCRT.DLL ProductName =3D Microsoft (R) Visual C++ ProductVersion =3D 6.10.8528.0 Module @ 0x77f00000 =3D KERNEL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT BASE API Client DLL FileVersion =3D 4.00 InternalName =3D kernel32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D kernel32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77dc0000 =3D ADVAPI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Advanced Windows 32 Base API FileVersion =3D 4.00 InternalName =3D advapi32.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D advapi32.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e70000 =3D USER32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows NT USER API Client DLL FileVersion =3D 4.00 InternalName =3D user32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D user32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77ed0000 =3D GDI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D GDI Client DLL FileVersion =3D 4.00 InternalName =3D gdi32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D gdi32 ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77e10000 =3D RPCRT4.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Procedure Call Runtime FileVersion =3D 4.00 InternalName =3D rpcrt4.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcrt4.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77b20000 =3D ole32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft OLE for Windows and Windows NT FileVersion =3D 4.00 InternalName =3D OLE32.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D OLE32.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x68e80000 =3D rpcref.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft Internet Information Services RPC = helper library FileVersion =3D 4.02.0622 InternalName =3D RPCREF.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D RPCREF.DLL ProductName =3D Internet Information Server ProductVersion =3D 4.02.0622 Module @ 0x77bf0000 =3D rpcltc1.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Remote Process Control LTC1 DLL FileVersion =3D 4.00 InternalName =3D rpcltc1.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D rpcltc1.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x683a0000 =3D iisadmin.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Metadata and Admin Service FileVersion =3D 4.02.0720 InternalName =3D mdadmin.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D mdadmin.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x68220000 =3D COADMIN.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D IIS CoAdmin DLL FileVersion =3D 4.02.0720 InternalName =3D coadmin.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D coadmin.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x70980000 =3D SHELL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Windows Shell Common Dll FileVersion =3D 4.72.3612.1700 InternalName =3D SHELL32 LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D SHELL32.DLL ProductName =3D Microsoft(R) Windows NT(R) Operating System ProductVersion =3D 4.72.3612.1700 Module @ 0x710d0000 =3D SHLWAPI.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Shell Light-weight Utility Library FileVersion =3D 4.72.3110.0 InternalName =3D SHLWAPI LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D SHLWAPI.DLL ProductName =3D Microsoft(R) Windows NT(R) Operating System ProductVersion =3D 4.72.3110.0 Module @ 0x77aa0000 =3D COMCTL32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Custom Controls Library FileVersion =3D 4.72.3612.1702 InternalName =3D COMMCTRL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1999 OriginalFilename =3D COMMCTRL.DLL ProductName =3D Microsoft(R) Windows NT(R) Operating System ProductVersion =3D 4.72.3612.1702 Module @ 0x68020000 =3D ADMWPROX.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D IIS Admin Com API Proxy dll FileVersion =3D 4.02.0720 InternalName =3D admwprox.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D admwprox.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x74880000 =3D userenv.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Userenv FileVersion =3D 4.00 InternalName =3D userenv LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D userenv.dll ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77800000 =3D NETAPI32.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Net Win32 API DLL FileVersion =3D 4.00 InternalName =3D NetApi32.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D NetApi32.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x77840000 =3D NETRAP.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Net Remote Admin Protocol DLL FileVersion =3D 4.00 InternalName =3D NetRap.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D NetRap.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x777e0000 =3D SAMLIB.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D SAM Library DLL FileVersion =3D 4.00 InternalName =3D SAMLib.DLL LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1996 OriginalFilename =3D SAMLib.DLL ProductName =3D Microsoft(R) Windows NT(TM) Operating System ProductVersion =3D 4.00 Module @ 0x68900000 =3D nsepm.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D IIS NSEP mapping DLL FileVersion =3D 4.02.0720 InternalName =3D nsepm.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D nsepm.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x68440000 =3D IISMAP.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation FileDescription =3D Microsoft IIS mapper FileVersion =3D 4.02.0720 InternalName =3D iismap.dll LegalCopyright =3D Copyright (C) Microsoft Corp. 1981-1997 OriginalFilename =3D iismap.dll ProductName =3D Internet Information Server ProductVersion =3D 4.02.0720 Module @ 0x77400000 =3D schannel.dll dwFileFlags =3D 0x00000000 (FREE) CompanyName =3D Microsoft Corporation CDB: c0000005 Exception in inetdbg.ver debugger extension. PC: 77f66edd VA: 00079000 R/W: 1 Parameter: 1001f 0:022> q quit: ------_=_NextPart_000_01BFA65D.E540DE90-- Return-Path: Delivered-To: python-list at python.org Received: from mail03-oak.pilot.net (mail-oak-3.pilot.net [198.232.147.18]) by dinsdale.python.org (Postfix) with ESMTP id 84E6F1CE4E for ; Mon, 17 Apr 2000 14:56:58 -0400 (EDT) Received: from psh-wss-01.peoplesoft.com (unk-131-192-163.peoplesoft.com [216.131.192.163] (may be forged)) by mail03-oak.pilot.net with SMTP id LAA11818 for ; Mon, 17 Apr 2000 11:59:35 -0700 (PDT) From: nathan_christensen at peoplesoft.com Received: from 216.131.192.133 by psh-wss-01.peoplesoft.com with ESMTP ( WorldSecure Server SMTP Relay(WSS) v4.3); Mon, 17 Apr 00 11:59:25 -0700 X-Server-Uuid: b85f21a3-cfd1-11d3-8401-00104bf46ab7 Subject: Re: May 27th PARTY! To: rstidolph at austin.rr.com Cc: AMitchell at origin.ea.com, bryanandlacey at earthlink.net, carma at carmapro.com, cujorover at earthlink.net, Disalphafu at aol.com, eovelman at origin.ea.com, falconson at nettally.com, fischer at tsgc.utexas.edu, funny at phord.com, goldie.mcelroy at attws.com, joe.maloukis at mail.va.gov, jtaylor at gfbank.com, jttaylor at flash.net, karyn at nightfire.com, kevin at aestechnology.com, Kizzy_Williams at yahoo.com, kmagill at prysm.net, knaack at gwatt.com, lachtaylor at yahoo.com, lbyrne at creativelabs.com, lindt at mail.utexas.edu, lmwwelsh at yahoo.com, lrosens at home.com, mar4 at texas.net, matsaleh at texas.net, matw at player1.com, mbakonyi at pencom.com, mbutler at esginc.com, mcginnis at texas.net, melanie at vsearch.com, mhornbuc at etec.com, mikeb at pencom.com, mike.cato at amd.com, mjerman at itrsjobs.com, mjgreathouse at juno.com, mkasper at mshow.com, monty_hornbuckle at etec.com, mrcambron at earthlink.net, MThor at aol.com, pbuchorn at gator1.brazosport.cc.tx.us, postmaster at novacell.com, python-list at python.org, ra6200 at email.sps.mot.com, rayjunem at juno.com, Ray_Grosvenor at Dell.com, rbarton at bbs.wiztower.com, rds at attymail.com, rgrosvenor at austin.rr.com, rong at cmsopen.com, rstidolph at austin.rr.com, san2edb at ups.com, scotts at illuminactive.com, seans at cmsopen.com, sitnalta at cableone.net, skip at Aureal.com, Srhughes30 at aol.com, stidolph at origin.ea.com, stone at golden-gate.org, tandmel at juno.com, Tanea_Greenwood at amat.com, tech_support at Quantum3D.com, terri.calloway at stanford.edu, tgif at iconn.net, Tiggerree at aol.com, tjhuff at msn.com, tlujan1 at hotmail.com, Tonya.Ochiltree at ci.austin.tx.us, tracie at austin.rr.com, tsmith at cs.utexas.edu, tt at peakware.com, Veronicahu at aol.com, vocooper at juno.com, WanChef at aol.com, wayne.stidolph at lutris.com, y2krdi at aol.com X-Mailer: Lotus Notes Release 5.0.1 July 16, 1999 Message-ID: Date: Mon, 17 Apr 2000 11:56:55 -0700 X-MIMETrack: Serialize by Router on SMTPOUT/Server/PSExternal(Release 5.0.2b |December 16, 1999) at 04/17/2000 12:05:20 PM MIME-Version: 1.0 X-WSS-ID: 14E580871000386-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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.0beta3 Precedence: bulk List-Id: General discussion list for the Python programming language Sounds like a blast...What should I bring? Nate = =20 "Rebecca = =20 Stidolph" To: "Wayne Stidolph" , , =20 , "Veronica Hughes" , =20 in.rr.com> "Val Cooper" , "Trevor Lind" , =20 "Tracie Thor" , , =20 04/15/00 08:47 "Tom Taylor" , "Todd Hughes" , =20 PM "Tim Huffman" , "Tim and Melody Martin" =20 , "Tim and= Cindy Martin" , "Tim" =20 , , "Thad Smith" =20 , "Ter= ry Thompson" , "Terri =20 Calloway" , "tech_support" =20 = , "Taylor, Jacki" , =20 "Tanya Lujan" , , "Stone =20 Eleazer" , "Stidolph, David" =20 , "S= teven Jumper" , "Stan =20 Edwards" , "Skip McIlvaine" , =20 "Sheridan Layman" , "Sean Stanley" =20 , "Scott = Schimpf" , =20 , "Ron Gilb= ert" , "Roja, Elena" =20 , = "Robert Knaack" , "Richard =20 Barton" , , "Rebecca =20 Stidolph" , , "Ray O. =20 Grosvenor" , "Ray and June Minyard" =20 , "Python= -List @ python. org" =20 , "P= ython Mailing List" , =20 "postmaster" , "'Peggy Buchorn'" =20 , "Ovelman, Elizabeth" =20 , "N= athan Christensen" =20 , "Monty Hornbuckle" =20 ,= "Monty Hornbuckle" , =20 "Mitchell, Andy" , "Mike Jerman" =20 , "Mik= e Greathouse" , "Mike =20 Cato" , "= Michael Bakonyi" , "Michael=20 & Treasa McGinnis" , "Melinda Kasper" =20 , "Melani= e R. Cambron" , "Melanie=20 Cambron" , "Mcelroy, Goldie" =20 , = , , =20 "Matt Weathers" , "Matt Walker" , =20 "Mark Thor" ,= "Mark Fischer" , =20 "Mark Fischer" , "Margaret Warren" =20 , "Malou= kis, Joe" , "Leon =20 Rosenhein" , "Lbyrne" , =20 "Laurie Welsh" , "Lach Taylor" =20 , "Kur= t Schmidt" , =20 "Kizzy_Williams at amat.com" , "Kevin Cooper" =20 , "= Kelsi" , "Kelley Magill" =20 , "Karyn = Christensen" , "A1C =20 Bryan A. and Mrs. Lacey D. B= uchorn" =20 cc: = =20 Subject: May 27th PARTY!= =20 = =20 ATTENTION FRIENDS AND FAMILY AROUND THE NATION!! We (David and Rebecca Stidolph) are celebrating our 17th wedding anniversary with a big BBQ bash on Saturday, May 27th!=A0 We want ever= yone to come, so we're giving plenty of notice.=A0 Please set aside the lat= e afternoon and evening to have lots of fun! Please reply if you would like to come, so we can include you in futur= e e-mails for more information. Love, David and Rebecca, Kelley and Kenneth PS Sorry for any duplicate e-mails.=A0 Let us know if you got more tha= n two. Thanks! = Return-Path: Delivered-To: python-list at python.org Received: from hera.cwi.nl (hera.cwi.nl [192.16.191.1]) by dinsdale.python.org (Postfix) with ESMTP id 6BEBB1CDBA for ; Sat, 15 Apr 2000 23:45:05 -0400 (EDT) Received: from mail.austin.rr.com (sm1.texas.rr.com [24.93.35.54]) by hera.cwi.nl with ESMTP id FAA22703 for ; Sun, 16 Apr 2000 05:47:35 +0200 (MET DST) Received: from play1 ([24.160.3.64]) by mail.austin.rr.com with Microsoft SMTPSVC(5.5.1877.357.35); Sat, 15 Apr 2000 22:48:00 -0500 Message-ID: <006201bfa756$896e5a80$da00a8c0 at austin.rr.com> From: "Rebecca Stidolph" To: "Wayne Stidolph" , , "Viele Humor" , "Veronica Hughes" , "Val Cooper" , "Trevor Lind" , "Tracie Thor" , , "Tom Taylor" , "Todd Hughes" , "Tim Huffman" , "Tim and Melody Martin" , "Tim and Cindy Martin" , "Tim" , , "Thad Smith" , "Terry Thompson" , "Terri Calloway" , "tech_support" , "Taylor, Jacki" , "Tanya Lujan" , , "Stone Eleazer" , "Stidolph, David" , "Steven Jumper" , "Stan Edwards" , "Skip McIlvaine" , "Sheridan Layman" , "Sean Stanley" , "Scott Schimpf" , , "Ron Gilbert" , "Roja, Elena" , "Robert Knaack" , "Richard Barton" , , "Rebecca Stidolph" , , "Ray O. Grosvenor" , "Ray and June Minyard" , "Python-List @ python. org" , "Python Mailing List" , "postmaster" , "'Peggy Buchorn'" , "Ovelman, Elizabeth" , "Nathan Christensen" , "Monty Hornbuckle" , "Monty Hornbuckle" , "Mitchell, Andy" , "Mike Jerman" , "Mike Greathouse" , "Mike Cato" , "Michael Bakonyi" , "Michael & Treasa McGinnis" , "Melinda Kasper" , "Melanie R. Cambron" , "Melanie Cambron" , "Mcelroy, Goldie" , , , "Matt Weathers" , "Matt Walker" , "Mark Thor" , "Mark Fischer" , "Mark Fischer" , "Margaret Warren" , "Maloukis, Joe" , "Leon Rosenhein" , "Lbyrne" , "Laurie Welsh" , "Lach Taylor" , "Kurt Schmidt" , "Kizzy_Williams at amat.com" , "Kevin Cooper" , "Kelsi" , "Kelley Magill" , "Karyn Christensen" , "A1C Bryan A. and Mrs. Lacey D. Buchorn" Subject: May 27th PARTY! Date: Sat, 15 Apr 2000 22:47:16 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_005C_01BFA72C.8C651E60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 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.0beta3 Precedence: bulk List-Id: General discussion list for the Python programming language This is a multi-part message in MIME format. ------=_NextPart_000_005C_01BFA72C.8C651E60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ATTENTION FRIENDS AND FAMILY AROUND THE NATION!! We (David and Rebecca Stidolph) are celebrating our 17th wedding = anniversary with a big BBQ bash on Saturday, May 27th! We want everyone = to come, so we're giving plenty of notice. Please set aside the late = afternoon and evening to have lots of fun! =20 Please reply if you would like to come, so we can include you in future = e-mails for more information. Love,=20 David and Rebecca, Kelley and Kenneth PS Sorry for any duplicate e-mails. Let us know if you got more than = two. Thanks! ------=_NextPart_000_005C_01BFA72C.8C651E60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
ATTENTION FRIENDS AND FAMILY AROUND THE = NATION!!
 
We (David and Rebecca Stidolph) are = celebrating our=20 17th wedding anniversary with a big BBQ bash on Saturday, May = 27th!  We=20 want everyone to come, so we're giving plenty of = notice. =20 Please set aside the late afternoon and evening to have lots of = fun! =20
 
Please reply if you would like to come, = so we can=20 include you in future e-mails for more information.
 
Love,
David and Rebecca, Kelley and = Kenneth
 
PS Sorry for any duplicate = e-mails.  Let us=20 know if you got more than two.  Thanks!
------=_NextPart_000_005C_01BFA72C.8C651E60-- From loredo at spacenet.tn.cornell.edu Thu Apr 13 16:22:47 2000 From: loredo at spacenet.tn.cornell.edu (Tom Loredo) Date: Thu, 13 Apr 2000 16:22:47 -0400 Subject: Need full example of C extension on Macintosh (CW) References: <120420000714412887%pecora@anvil.nrl.navy.mil> Message-ID: <38F62C97.FD5073B@spacenet.tn.cornell.edu> Lewis- I'm putting together some project stationery for CodeWarrior 5 for simple numerical extensions (i.e., just returning the value of a function; or using NumPy arrays). Are you using CW5? If so, I can send you something. To get this to work, I had to "borrow" some stuff from the source distribution; some files were missing from the binary distribution, even though it is advertised as suitable for "plugin" development. But I think what was missing only affects NumPy extensions. -Tom Loredo From alwagner at tcac.net Thu Apr 20 21:03:35 2000 From: alwagner at tcac.net (Albert Wagner) Date: Thu, 20 Apr 2000 20:03:35 -0500 Subject: os.listdir & os.stat fail on windows zipdrive References: <38FF9F53.A4698EE6@tcac.net> Message-ID: <38FFA8E7.8D926F32@tcac.net> Crap, I forgot the code: def descendTree(self, dir): ''' recursively descend the directory tree rooted at dir, save each directory and its files as an entry in a Dictionary. Each directory pathname is a key with a List for a value. Each filename is placed in the list for its directory. ''' self.tree[dir] = [] for aName in os.listdir(dir): dirName = '%s/%s' % (dir, aName) try: mode = os.stat(dirName)[ST_MODE] except: self.tree[dir].append("(%s)" % aName) continue if S_ISDIR(mode): if not self.tree.has_key(dirName): self.tree[dirName] = [] # recurse into directory self.descendTree(dirName) elif S_ISREG(mode): self.tree[dir].append(aName) else: self.tree[dir].append("(%s)" % aName) -- Small is Beautiful From smalleys at gte.net Sat Apr 15 14:20:19 2000 From: smalleys at gte.net (sue) Date: Sat, 15 Apr 2000 18:20:19 GMT Subject: Building Core Python References: <213CDEBFDDA7D3118081009027E40C56071139@SHEF-MS1> Message-ID: <38F8A4E4.582F5451@gte.net> Have you checked the "small python" from http://www.lyra.org/greg/small/ Sue. From tseaver at starbase.neosoft.com Fri Apr 21 20:21:52 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 21 Apr 2000 19:21:52 -0500 Subject: Using python on the web References: <8dq9lj$pjg$2@newshost.accu.uu.nl> Message-ID: <30317B4110C2CF2B.69B375EBD430B2E8.1EDF515EC1E9B219@lp.airnews.net> In article <8dq9lj$pjg$2 at newshost.accu.uu.nl>, Martijn Faassen wrote: >Brent Fulgham wrote: >> A couple of questions: > >>> We build medium-busy, CGI-intensive sites in Python. We were briefly >>> quite excited about Zope, but once we realized it locked us into Yet >>> Another Programming Language, we lost interest. DHTML is particularly >>> problematic, >> 1. I'm not familiar with Zope. Is DHTML specific to Zope? It seems >> to be proudly advertised on a lot of "webware" brochures I see these >> days. > >Acronym mixup. DHTML (Dynamic HTML) and DTML (Document Template Markup Language) >have little in common besides that they both are used with HTML. DHTML is >client side (in the browser), DTML server side (in Zope). DHTML is to do >fancy graphics effects, DTML is a reporting language that talks to Zope >(read Python) objects and usually generates HTML. The closest cognate I know of to DTML in the non-Zope world is "server-side includes," and their siblings. It is not a coincidence that Zope supports three distinct DTML syntaxes: * One based on Python "%"-substitution (the oldest, I think; almost nobody uses this now); * One using the same '' style of syntax as SSI: this is comfortable for developers used to SSI, but doesn't play nice with design tools; * The now-dominant "pseudo-XML" style (''), specifically designed to be teachable to DreamWeaver, et al. DTML is a "document template" language, logically equivalent to building a document via Python string substituion, but with conditional and iterative processing constructs added in. It is *not* adequate for doing "real" programming, although many early Zope apps used it so, because it was the only way to do logic "through-the-web." What's-one-more-letter-between-friends'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at digicool.com http://www.zope.org Digital Creations From Alessandro.Bottoni at think3.com Mon Apr 17 11:48:47 2000 From: Alessandro.Bottoni at think3.com (Alessandro Bottoni) Date: Mon, 17 Apr 2000 17:48:47 +0200 Subject: Any Web-Mail Gateway (written in Python)? Message-ID: <6D8A17398E28D3119F860090274DD7DB4986A3@pces.cadlab.it> I'm looking for a web-mail gateway (written in Python, if possible) for making accessible the Postfix mail boxes of my users through my PyApache web server (both running under Linux, of course). Any suggestion? TIA ---------------------------------------------------------------- Alessandro Bottoni (Alessandro.Bottoni at Think3.com) Web Programmer @ Think3 inc. (www.think3.com) I do not speak for think3 and they return the favour From andrew at andrewcooke.free-online.co.uk Sat Apr 22 04:33:42 2000 From: andrew at andrewcooke.free-online.co.uk (Andrew Cooke) Date: Sat, 22 Apr 2000 08:33:42 GMT Subject: LAmbda calculus evaluator (interactive) Message-ID: <8dro55$eq6$1@nnrp1.deja.com> Hi, Does anyone, by any chance, know of an interactive lambda fuinction evaluator/editor? Preferably in Python as that's a language I understand that's common to both platforms I'd like to run this on. I've found source to a simple evaluator on this ng, but am looking for something that lets you single step, do abstractions as well as reductions, step different evaluation strategies (lazy or by value etc). This is just for untyped calculus (at the moment - I see that in a few chapters more I might need something similar with types...). I know where I can get various (Oca)ML programs, but I'm not sure they're interactive and for various reasons I don't want to install that language at the moment. Thanks, Andrew http://www.andrewcooke.free-online.co.uk/index.html Sent via Deja.com http://www.deja.com/ Before you buy. From kilian.lorenz at dkfz-heidelberg.de Sun Apr 9 17:01:47 2000 From: kilian.lorenz at dkfz-heidelberg.de (Kilian Lorenz) Date: Sun, 09 Apr 2000 23:01:47 +0200 Subject: Tkinter: centering windows on screen References: <38F0C6A7.10878609@dkfz-heidelberg.de> <38F0C95D.1F7E853@dkfz-heidelberg.de> Message-ID: <38F0EFBB.F39F4A6F@dkfz-heidelberg.de> Fredrik Lundh wrote: > > if you browsed the source, how come you didn't find the > corresponding Tkinter methods? > Ooooops, because I'm kind of an idiot ... (and as a paltry excuse I started using Tkinter just yesterday) windows geometry: I didn't realize what "geometry = wm_geometry" means file dialogues: I only searched in Tkinter.py itself ... sorry ... you may torture me with soft cussions ... From aa8vb at yahoo.com Wed Apr 5 12:42:58 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 05 Apr 2000 12:42:58 -0400 Subject: Tkinter: "Get root for a widget" is private? In-Reply-To: References: <20000331112048.A1257432@vislab.epa.gov> <20000331112048.A1257432@vislab.epa.gov> <20000403064335.A1560771@vislab.epa.gov> <2Q_F4.1092$n68.187097600@newsb.telia.net> <20000405073526.A1760238@vislab.epa.gov> Message-ID: <20000405124258.A1747369@vislab.epa.gov> Jeff Senn: |Randall Hopper writes: |> I have a timer class built around Tk timers. I realize I could just pass |> any_old_widget into this routine, and it would store it off into state data |> and use it periodically to access the 'after' and 'after_cancel' methods. |> |> However, this timer has nothing to do with this widget in particular, so |> why should it have a reference to it (versus the button next to it, or the |> list widget below it)? It makes more sense for the timer class to accept |> and bookmark the root object. This root is associated with the global Tk |> state, and it makes sense for a timer to bookmark this to use global Tk |> state commands. | |Unless you're doing something wacky (creating multiple roots??), you |could just do what Tkinter itself (generally) does and use |Tkinter._default_root to get the instance of the root object.... Right. I'm using _root() now which works. My original point wasn't that I couldn't get root from a widget, but that to do it I violate the declared public/private/protected policy for Tkinter. Since Python has no enforced access control, I can poke at object internals anytime, but I really want to avoid this. My understanding is that . is public, ._ is protected, and .__ is private. If _root() was ripped out in the next version of Python, I wouldn't have a leg to stand on. And by all rights it's protected so removing it should not affect me (or any other external code), unless I (or it) was deriving off this class. As Fredrik mentioned I could just snitch global Tk commands off any_old_widget, but an event loop timer object that has nothing to do with "any" widget shouldn't be keeping a handle to any_old_widget. That's not clean code. An alternative is just to pass root around everywhere, but that seems silly if every widget already knows its root. So my request was for _root() to be declared public (e.g. as .root()) -- Randall Hopper aa8vb at yahoo.com From mwh21 at cam.ac.uk Sat Apr 1 09:33:27 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 01 Apr 2000 15:33:27 +0100 Subject: bytecodehacks-April2000 Message-ID: Well, it's April the first, so what better time than this to announce the release of a new version of bytecodehacks? Not all that much has changed in the code; a bug fix here and there. * The mechanism for calculating the co_stacklevel attribute of code objects actually gets it right (at least in cases I have tested). * xapply.xapply has gotten *much* cleverer, and much hairier. It now supports such delights as keyword arguments, trimming the default argument list correctly, assignments to arguments and handling **-style arguments (but not *-style, yet). It's approaching the point of being actually useful (scary!). * there's the beginnings of a test suite. Administrivia-wise, there's much more shaking up. * bytecodehacks now live on sourceforge; start here to find the tarballs and updated docs. http://bytecodehacks.sourceforge.net There's a mailing list, which I don't envision being very high volume: http://lists.sourceforge.net/mailman/listinfo/bytecodehacks-discuss but I invite anyone who's interested to join for banter about the internal structures of Python and how to (ab)use them. * bytecodehacks now has a license, based on the deliberately liberal Python license; please read the file LICENSE for details. * Documentation is now being distributed separately; a tarball of the HTML can be found on the project homepage. As ever, all comments are welcome! Cheers, Michael PS: I haven't sent this to python-announce, as that list appears to be entirely dead. News to the contrary will be gratefully accepted. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From ulf.engstrom at b2b-link.com Wed Apr 12 07:26:12 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F8m?=) Date: Wed, 12 Apr 2000 13:26:12 +0200 Subject: Getting an overview if all available driveletters on NT References: <2B1262E83448D211AE4B00A0C9D61B03BA7294@MSGEURO1> <_FGI4.1194$Za1.20497@newsc.telia.net> <00ed01bfa442$53c66150$858647c1@DEVELOPMENT> <8d1hak$25p$1@nnrp1.deja.com> Message-ID: <007501bfa471$e89bfd60$858647c1@DEVELOPMENT> Well, Yes, the original question was that, but there's no such thing as a GetDriveType in my win32api at least. As I said, that's all I find in the win32api that has to do with the drives, but someone else might now better :) Some digging around and I found the right module, the GetDriveType is in the win32file package :) And there we go :) Regards Ulf ----- Original Message ----- From: Newsgroups: comp.lang.python To: Sent: Wednesday, April 12, 2000 11:57 AM Subject: Re: Getting an overview if all available driveletters on NT > Ulf Engstrom wrote: > > As the effbot told you the win32api is probably the one you wanna > use, but > > the function is GetLogicalDriveStrings() This won't gives you all the > the > > driveletters, but not their labels, there might be something like that > > there, just never have had to use it. Someone else might now that > part? > > >>> win32api.GetLogicalDriveStrings() > > 'A:\\\000C:\\\000D:\\\000E:\\\000' > > umm. didn't the original poster ask for a way to > tell ordinary drives from network drives? that's > exactly what GetDriveType does... > > > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list From darrell at dorb.com Fri Apr 28 20:22:43 2000 From: darrell at dorb.com (Darrell) Date: Sat, 29 Apr 2000 00:22:43 GMT Subject: command pattern/framework in python? References: <8ebpl4$eq9$1@nnrp1.deja.com> Message-ID: wrote in message > Anyone got an example of a Command pattern/framework that they have > used in python? > This pattern wraps an action or command in an instance with an execute method. The instance can be passed around like a function pointer. def demo(a,b,c): print 'a:',a print 'b:',b print 'c:',c class Command: def __init__(self, cmd, *args): self._cmd=cmd self._args=args def __call__(self, *args): return apply(self._cmd, self._args+args) cmd=Command(dir,__builtins__) print cmd() cmd=Command(demo,1,2) cmd(3) --Darrell Gallion From order at ownbox.com Mon Apr 10 02:19:38 2000 From: order at ownbox.com (order at ownbox.com) Date: Mon, 10 Apr 2000 06:19:38 GMT Subject: Free Money Making Reports Message-ID: <_neI4.24192$d5.66171@typhoon1.san.rr.com> Check it out for yourself http://www.geocities.com/freemoneymakingsystem/index.html From garry at sage.att.com Fri Apr 28 09:44:41 2000 From: garry at sage.att.com (Garry Hodgson) Date: Fri, 28 Apr 2000 13:44:41 GMT Subject: Running shell programs from Python References: <38FC64DA.7D297563@ffi.no> <8di47s$mkg$1@nntp6.u.washington.edu> <390485A8.B5ADAAE9@sage.att.com> Message-ID: <390995C9.F49AF78A@sage.att.com> Grant Edwards wrote: > > In article <390485A8.B5ADAAE9 at sage.att.com>, Garry Hodgson wrote: > >Donn Cave wrote: > > > >> The references are mainly UNIX man pages pipe(2), fork(2), fcntl(2) > >> (look for dup2), exec(2) and wait(2). > >> > >> Basically, the sequence is repeat ( open pipes, fork, close pipes ) > >> After a fork, the parent and child both have both ends of each pipe > >> open, and it's important to close the unused "write" ends so the > >> pipe will generate an EOF when its real writer exits. > > > >i've always been curious why this wasn't encapsulated as a single > >command in the os module. i use it infrequently enough that i always > >need to go look the idiom, or skip it for simpler things. seems like > >a single command that returned a process id, and a pair of file > >descriptors would have lots of uses. > > You mean like popen2? well...yeah, kinda like that, except... uhhhh...one that i'd know about. thanks for the clue. i needed one. -- Garry Hodgson Every night garry at sage.att.com a child is born Software Innovation Services is a Holy Night. AT&T Labs - Sophia Lyon Fahs From tjg at avalongroup.net Tue Apr 4 17:52:34 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Tue, 04 Apr 2000 14:52:34 -0700 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> Message-ID: <38EA6422.61054B11@exceptionalminds.com> Ivan Van Laningham wrote: > Well, that's two recommendations. And judging from previous Marc-Andre > packages I've used, it'll be a snap. > > Steve Holden, in another post, said that Tkinter should work fine along > with mxODBC. That's a relief, but does anyone have direct personal > experience with doing so? Ivan, mxODBC works beautifully, but I've never used it to access and access database, only SQL database. Perchance do you know how Windows advertises an Access database to an ODBC driver? It's amazing how often I come here with a question only to find someone else asking the same question I came with! -- Stand Fast, tjg. Timothy Grant tjg at exceptionalminds.com Chief Technology Officer www.exceptionalminds.com Red Hat Certified Engineer (503) 246-3630 Avalon Technology Group, Inc. fax (503) 246-3124 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From jon at dgs.monash.edu.au Wed Apr 12 02:50:52 2000 From: jon at dgs.monash.edu.au (Jonathan Giddy) Date: Wed, 12 Apr 2000 16:50:52 +1000 (EST) Subject: Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20? In-Reply-To: <38f363e5.2931715373@news> from "Randy Wiser" at Apr 11, 2000 05:48:11 PM Message-ID: <200004120650.QAA22353@nexus.csse.monash.edu.au> Randy Wiser declared: > >I've written a small python program that spawns one child process from >its main thread, and then creates a second thread. The sole purpose >of the second thread (at this point) is to call os.waitpid(processID, >0) to wait for the child that the main thread created. This works >fine under Solaris when I call os.waitpid() from the second thread. > >But, under Linux 2.2.12-20 I get the following OSError exception: > >[Errno 10] No child processes I recently had this reported as a problem in code I developed on a Sun, which was then run on Linux. I believe it is due to Linux threads being separate processes, hence the second thread is not the spawned process's parent and cannot wait for it. (Presumably, if pthread_join() works, then waitpid() should be able to work too, since they must be the same function on Linux). Anyway, my (non-)solution was to redesign my code to wait from the same thread as the fork(). If you can't move the waitpid() into the main thread, maybe you can move the fork() into the second thread. Jon. From c.hintze at gmx.net Sat Apr 22 10:36:55 2000 From: c.hintze at gmx.net (Clemens Hintze) Date: Sat, 22 Apr 2000 14:36:55 GMT Subject: Distribution References: <39013f48@flexnet239.uunt.net> Message-ID: >>>>> "Hdman" == Highdesertman writes: ... Hdman> Now to my question: Hdman> If I use python to develop an application for the windows Hdman> 9x environment, I have already downloaded the appropriate Hdman> libraries and version) what form does the finished program Hdman> take? How does it get distributed? I remember in the early Hdman> days of BASIC programming, (before compiled basic) your Hdman> program was just raw code that could be (often Hdman> accidentally) altered or otherwise corrupted. In order for Hdman> your basic program to be used, the user had to have a basic Hdman> compiler on board and they loaded your raw source from a Hdman> text file and executed it. Is this how Python is used? I feel that this is similar to how Python is used. The Python interpreter accepts to sources of input (actually three, to speak the truth), 1st is plain Python source, 2nd is a bytecode file created by the interpreter. In detail: If you execute a Python source with the interpreter, it will be compiled to bytecode (machine code of a virtual CPU); this machine code will be executed by the interpreter simulating that virtual CPU here. You could also store that machine code into another file and hand this to the interpreter. The compilation process is not necessary then. Heared about Java? Python is similar here. Only compiler and virtual machine (you may call it 'interpreter') are not separated. But that also mean, that your client must have Python installed normally. But IIRC somebody (Chris Tismer?) has shown a way how to compile the whole program into an standalone executable with linked-in interpreter. Here you would not have to pass the whole Python together with your proggy. Perhaps others could clarify this? ... Hdman> Cheers, Hdman> Mathew HTH, Clemens. From jae at ilk.de Sat Apr 15 11:51:44 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Sat, 15 Apr 2000 17:51:44 +0200 Subject: A Mountain of Perl Books + Python Advocacy In-Reply-To: <8cr4an$j40$2@newshost.accu.uu.nl> (m.faassen@vet.uu.nl) References: <000f01bf9eca$2eec8c60$3e2d153f@tim> <38ECF4E6.B85C62D5@sightreader.com> <8cr4an$j40$2@newshost.accu.uu.nl> Message-ID: <15042000.2@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Martijn" == Martijn Faassen writes: Martijn> [...] Well, but Perl isn't based on a wild, revolutionary Martijn> idea either. [...] Well, maybe not revolutionary, but certainly wild: "Everybody should program as they speak". If that ain't wild (and the results even more so), I don't know what is. ";-) " * 1000. Bye, J PS: ";-) " x 999 so the perlers out there get it too ;-). - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://members.tripod.com/Juergen_Erhard Internet Movie Database (http://www.imdb.com) "Windows NT" is an acronym for "Windows? No thanks." -- Russ McManus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjj4kA0ACgkQN0B+CS56qs3YhgCcDsNMqbKFIBZQXtPzoZobe/SJ WMsAnR7z6o72b0sOO1hIlc6245Dpzv7n =0bQH -----END PGP SIGNATURE----- From gmcm at hypernet.com Thu Apr 6 09:32:10 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 6 Apr 2000 09:32:10 -0400 Subject: Installer / mxDateTime problem In-Reply-To: <8chm9o$qbv$1@gxsn.com> Message-ID: <1257094563-14896354@hypernet.com> Richard Chamberlain wrote: > I've got a simple script that uses mxDateTime that I want to run as an exe. > I run it through simple.py and I get the following error: > > NameError: Case mismatch for module name feasts > (filename C:\Program Files\Python\DateTime\Feasts.py) If I attempt to import DateTime.feasts interactively, I get the same error. Do you have PYTHONCASEOK set? The exe isn't going to do that for you. - Gordon From ngps at madcap.dyndns.org Tue Apr 18 11:57:40 2000 From: ngps at madcap.dyndns.org (Ng Pheng Siong) Date: 18 Apr 2000 15:57:40 GMT Subject: Pliant? Message-ID: <8di0lk$4h0$1@coco.singnet.com.sg> Hello, Saw a reference to the language Pliant on Freshmeat today. Looks pretty interesting. What are your views on Pliant, as a Python programmer? Pliant is here: http://pliant.cams.ehess.fr TIA. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps From emile at fenx.com Wed Apr 5 12:03:03 2000 From: emile at fenx.com (Emile van Sebille) Date: Wed, 5 Apr 2000 09:03:03 -0700 Subject: reload imported module Message-ID: <05fd01bf9f18$6e5a33e0$01ffffc0@worldnet.att.net> I'm testing a new class in its own module from within idle. Is there a way to reload y after having done: from x import y or is it easiest to just import x and reload it? Emile van Sebille emile at fenx.com ------------------- From m.faassen at vet.uu.nl Tue Apr 25 08:35:09 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 25 Apr 2000 12:35:09 GMT Subject: plugins for browsers? References: <3904ccb0.32134281@news.demon.co.uk> Message-ID: <8e43dt$ods$1@newshost.accu.uu.nl> greg at quokka.demon.co.uk wrote: > Are there any plugins or other means of running Python in Web > browsers? I seem to recall that there were a while ago ... JPython: http://www.jpython.org Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From ulf.engstrom at b2b-link.com Wed Apr 12 01:45:36 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F8m?=) Date: Wed, 12 Apr 2000 07:45:36 +0200 Subject: Getting an overview if all available driveletters on NT References: <2B1262E83448D211AE4B00A0C9D61B03BA7294@MSGEURO1> <_FGI4.1194$Za1.20497@newsc.telia.net> Message-ID: <00ed01bfa442$53c66150$858647c1@DEVELOPMENT> As the effbot told you the win32api is probably the one you wanna use, but the function is GetLogicalDriveStrings() This won't gives you all the the driveletters, but not their labels, there might be something like that there, just never have had to use it. Someone else might now that part? >>> win32api.GetLogicalDriveStrings() 'A:\\\000C:\\\000D:\\\000E:\\\000' Regards Ulf > Pieter Claerhout wrote: > > is there a module in Python, which can list all available driveletters, > together with > > their label. I'm using Windows NT? I already thought of iterating over all > possible > > driveletters, and see if the path exists or not, but I also want to > separate the > > network volumes from the other volumes. Any ideas? > > just guessing here (don't have win32api on this box), > but this might do the trick: > > type = win32api.GetDriveType("%s:\\" % drive) > > where drive is 'A' through 'Z'. > > > > > -- > http://www.python.org/mailman/listinfo/python-list From cer at tutopia.com Thu Apr 13 11:55:15 2000 From: cer at tutopia.com (cer at tutopia.com) Date: Thu, 13 Apr 2000 15:55:15 GMT Subject: ANN: Tkinter Look Message-ID: <8d4qkq$l7s$1@nnrp1.deja.com> I want to share this work related with a Look&Feel package for Tkinter. For info and download see : http://www.geocities.com/cristian_echeverria/Chevegui.html This has been very usefull to my and maybe somebody can do a better job with it. Bye.......Cristian Echeverria Sent via Deja.com http://www.deja.com/ Before you buy. From PClaerhout at CREO.BE Mon Apr 17 22:08:18 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Tue, 18 Apr 2000 04:08:18 +0200 Subject: Upgrading IIS to 1.6 problem.... Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA72C9@MSGEURO1> If you go to the Internet Services Manager, and you select a web application, you can edit the application options (in IIS 4 or higher, a webapp is a folder with the blue icon). If you go to the home directory tab, you can click on the configure button to change the settings for your application. If you go there to the App Mapping tabs, to what points the extension .cgi? My guess it that it's pointing to the python 1.5 executable and not to the 1.6 executable. Kind regards, Pieter -----Original Message----- From: Manus Hand To: python-list at python.org Sent: 4/17/00 7:58 PM Subject: Upgrading IIS to 1.6 problem.... I run CGI scripts on a real machine, but I also run some on IIS on an NT machine. To configure IIS to know that .cgi files should run Python, I (long ago) followed Aaron Watters' instructions, and added a "ScriptMap" parameter in the Windows registry: HKEY_LOCAL_MACHINE System CurrentControlSet W3SVC Parameters ScriptMap .cgi -> C:\Program Files\Python\Python.exe %s %s Worked just fine for a good long time. The other day, I downloaded 1.6a2 and installed it on the PC. BUT...not at the same location -- I installed it in the directory D:\Python16 I figured that changing the above registry entry to "D:\Python16\\python.exe %s %s" would be all I needed to do and my Python .cgi code would run using 1.6. Long story short(er), it didn't work. My .cgi code still runs using the 1.5.2 version that is in C:\Program Files\Python. Honest. I made the registry change (I promise) and even rebooted. Twice to be sure. Anyone know why my registry change hasn't affected IIS yet? (Oh, I also -- though this shouldn't matter -- made sure to update my %PATH% in my autoexec.bat -- now when I type Python at an MS-DOS prompt, I get 1.6a2.) Let me know. Thanks, Manus -- http://www.python.org/mailman/listinfo/python-list From bill at libc.org Tue Apr 25 01:18:01 2000 From: bill at libc.org (Bill Anderson) Date: Mon, 24 Apr 2000 23:18:01 -0600 Subject: Using python on the web References: <8dq6k3$qmb$1@nnrp1.deja.com> Message-ID: <39052A89.19DC9417@libc.org> spenrose at my-deja.com wrote: > > In article , > Brent Fulgham wrote: > > A couple of questions: > > > > > We build medium-busy, CGI-intensive sites in Python. We were briefly > > > quite excited about Zope, but once we realized it locked us into Yet > > > Another Programming Language, we lost interest. DHTML is > > > particularly > > > problematic, > > 1. I'm not familiar with Zope. Is DHTML specific to Zope? It seems > > to be proudly advertised on a lot of "webware" brochures I see these > > days. > > My limited understanding of Zope is that to run Zope is to use DHTML and > vice-versa. I welcome corrections on this point. Nope. DHTML: Dynamic HTML Translation: Usually Javascript and/or javascript with css You may be thinking of DTML: Document Template Markup language -- In flying I have learned that carelessness and overconfidence are usually far more dangerous than deliberately accepted risks. -- Wilbur Wright in a letter to his father, September 1900 From effbot at telia.com Mon Apr 24 03:51:38 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 24 Apr 2000 07:51:38 GMT Subject: Tkinter.Button error References: <3903E8C1.39B3E3D7@swt.edu> Message-ID: ABC wrote: > button=Tkinter.Button(group1.interior(), text='8.00') > button.pack() > > The above program gives an error in TKinter in the second last line. > I have no clue of what the error is? how about posting the error message? From embed at geocities.com Wed Apr 26 09:05:32 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 26 Apr 2000 09:05:32 -0400 Subject: Why doesn't O'Reilly use parrots on its python books? References: Message-ID: > >If they ever run out of fauna and need to go flora, the only choice would > >be: the larch. > > > > Pruned into shrubbery. Let us not forget the Lofty Scotts Pine. Warren From m.faassen at vet.uu.nl Thu Apr 6 06:24:38 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 6 Apr 2000 10:24:38 GMT Subject: Tuples -- who needs 'em References: Message-ID: <8chol6$6em$1@newshost.accu.uu.nl> Alexander, Bob wrote: > m.faassen at vet.uu.nl [mailto:m.faassen at vet.uu.nl] wrote: >> But tuples are nice in particular for their *syntax*. With tuples, you >> can do: >> >> def foo(): >> return 1, 2, 3, 4 >> >> first, second, third, fourth = foo() >> >> I think this is nice syntax. Without tuples it'd not be as >> nice. It's not so much about efficiency. This pattern occurs all >> over Python. > I like that syntax too. If tuples and lists were unified, that bracket-free > syntax could also be used for the list/tuple datatype, and nice syntax you > mention would not change. Except that you can suddenly do this: results = foo() ... results.append(5) ... first, second, third, fourth = results # error That's could be a bad thing, though of course Python isn't typesafe in any case. The usage of tuples is however different, supported by syntactic difference. A tuple tends to contain a few heterogenous things, while a list tends to contain a larger number of homogenous things. [snip] >> But this is less symmetrical, and since lists are mutable, >> this may go wrong far more easily. > I am wondering where the serious concern about mutable lists comes from, as > it is a pattern in the responses I've gotten on this topic. For me, the > immutable list is a relatively new concept, since I can't think of many > other languages that have it. Functional programming languages have the concept. At least the *spirit* that you shouldn't be changing a list. This is different from Python, as we do change (homogenous) lists. The pattern in functional programming, which *does* occur often in Python code as well, is some operation over all elements of a list creating a new list (map(), though this is often expressed in Python as a 'for' loop, partially due to the nastiness of 'lambda'). The old list isn't changed. > I'm a programming-language-design kind of > person, and I never really saw mutable lists as a problem that needed > solving. I've used many Python-type languages that have mutable lists but > not immutable ones, and if I don't want the elements to change they don't > change -- I simply avoid the x[i] = y construct :-) And I still haven't > heard from anyone about why there isn't similar concern about immutable > dictionaries. People tend to use classes for this purpose. You can give a class a public interface (enforced or not) with only get_() methods, for instance. That gets you just about the same thing as an immutable dictionary would give you. Again, a dictionary tends to contain a larger number of homogenous objects, while an object tends to contain a smaller number of heterogenous objects. > Anyway, it seems to me that most of the tuple advantages we enjoy could and > should still exist with a merged tuple-list type, and the only possible > drawback is the loss of an immutable sequence type. The gain, though, is one > less decision that we must frequently make (between tuple and list) while > programming. Do you really feel that pain, then? Why don't you always use lists in your Python code, if you want to avoid the decision? That'd be effectively the same as what you're proposing? If you don't do this, is this because you're afraid other programmers will complain about your code, or because you do believe there's something to decide about? If-everything-were-blocks-of-bytes-we-would-never-need-to-decide-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From rkhale at earthlink.net Sat Apr 29 11:04:35 2000 From: rkhale at earthlink.net (Richard Hale) Date: Sat, 29 Apr 2000 15:04:35 GMT Subject: The Simple Economics of Open Source References: <1255228265-1994958@hypernet.com> <1255108931-9171946@hypernet.com> Message-ID: In article <1255108931-9171946 at hypernet.com>, gmcm at hypernet.com says... > If that were the model, we'd all be using Apples. MS got where > they are by outmanuvering IBM and DR. If Gary Kildall had > been willing to play hardball with a bunch of IBM suits, the > world would be quite different. > > > You must mean "play ball". Kildall "played hardball" much to his (past) regret. He missed the appointment with IBM suits and left his wife to greet them. He wanted lawyers and contracts and a too favorable deal. Gates on the other hand took risks and "played ball" on IBM's terms. No lawyers, no complicated contracts or deals. He offered a system he didn't have (bought it afterward for $50,000 from ? Mountain View ? software). Then, he out-maneuvered the IBM suits and ended up with all the marbles. CP/M was the OS "monopoly" of its day. A perfect illustration of how success breeds failure and how every trend has within it the seeds of its own destruction. It must be Microsoft's turn now!? Richard From m.faassen at vet.uu.nl Sun Apr 2 14:49:13 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 2 Apr 2000 18:49:13 GMT Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> Message-ID: <8c84n9$pf0$3@newshost.accu.uu.nl> Guido van Rossum wrote: > New Features in Python 1.6 > ========================== > With the recent release of Python 1.6 alpha 1, a lot of people have > been wondering what's new. This short note aims to explain the major > changes in Python 1.6. You almost got me! I didn't read the rest of the thread, and I was already thinking about why all these would be bad ideas, and then I realized it was posted on April 1. Good one! Think-up-the-bad-stuff-so-as-to-avoid-it-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From mhammond at skippinet.com.au Mon Apr 17 20:20:19 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 18 Apr 2000 00:20:19 GMT Subject: Microsoft ActiveX Scripting References: <8dg0rg$afj$1@cubacola.tninet.se> Message-ID: <7TNK4.3520$1D.25703@news-server.bigpond.net.au> "Erik Englund" wrote in message news:8dg0rg$afj$1 at cubacola.tninet.se... > "You create script components using any scripting language that supports the > Microsoft? ActiveX? Scripting interfaces. Script languages that support > these interfaces include JScript, Microsoft? Visual Basic? Scripting Edition > (VBScript), PERLScript, PScript, and Python." > > If I want to use vbscript with the activeX control I just set the property > 'Languange' to 'vbscript', and it works. Does anyone know what I need to do > wo use it with Python? I have downloaded and installed python for windows. All you need to do then is say 'LANGUAGE="Python"' :-) Check out the win32com reademe from the Python for Windows extensions. This has a link to the Active Scripting pages - some basic demos and info about using Active Scripting... [Actually, Ive never personally used the scripting control, but I believe it works!] Mark. From cut_me_out at hotmail.com Thu Apr 13 10:30:10 2000 From: cut_me_out at hotmail.com (Alex) Date: 13 Apr 2000 10:30:10 -0400 Subject: 1st non-trivial program - gentle criticism requested References: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> Message-ID: > With some trepidation, I post it here in the hopes that experts will > be able to coach me in "The Python Way". I'm by no means an expert. Python is the first language I've used extensively since I was a kid. But I've been using it for close to a year, and have acquired a couple of prejudices. If I was going to write a program like this, practically everything would have been inside a class. This would have avoided the need for global variables (looking at this script, I realized that I have never, ever used a global variable in a python script. I've never written a really complex application, though.) Also, for extended calculations like yours, having everything in a class makes it possible to stop the calculation, tinker with the innards of the class, and restart it. E.g. class Weasle: '''etc. etc.''' pass if ('weasle' not in dir ()): weasle = Weasle () else: weasle.__class__ = Weasle weasle.run () ...then you pump this into an interactive interpreter (I use emacs python-mode for this), stop it whenever it seems to be going awry, edit the script, and pump it back into the interpreter. The weasle instance gets all the new methods from your editing but keeps its old data, so you don't have to start it up over and over and wait till it reaches the point you want to study. If you want to speed up MutateIndividual, you might try something like this untested code: import random def MutateIndividual (theTargetIndiv): """Iterates over symbols of individual changing their 'genes'""" # Must be a faster way of doing this theNewIndiv = [] for theSymbol in theTargetIndiv: if (gRng.random() < gMutationRate): theNewIndiv.append (random.choice (gAlphabet)) else: theNewIndiv.append (theSymbol) return string.join (theNewIndiv) also, your findMax method seems redundant. I think you could do something like: best_score = max (theFitness) # Index of first element == best_score: best_index = theFitness.index (best_score) theWinner = gPopulation[best_index] Alex. From effbot at telia.com Tue Apr 25 03:56:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 25 Apr 2000 07:56:01 GMT Subject: Simple list.append() question References: <0CF260C495FED111A6610000F866308D0D893596@mail3.ntu.edu.sg> Message-ID: #VEDALA NARASIMHA KUMAR# wrote: > l=[] > i=0 > while 1: > if i <3: > l.append([]) > else: > break > i=i+1 > > crude..but works tip: using for-in and range is faster, easier to read, and definitely more "pythonish": l = [] for i in range(3): l.append([]) From noreply at antispam.com Mon Apr 3 02:16:21 2000 From: noreply at antispam.com (Brian Schmidt) Date: Mon, 03 Apr 2000 06:16:21 GMT Subject: embeddable Python web server Message-ID: Does anyone know of a webserver written in Python that is embeddable into a Python application, something similar to tclhttpd available for Tcl? Thanks! From pinard at iro.umontreal.ca Sun Apr 2 08:15:08 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 02 Apr 2000 08:15:08 -0400 Subject: Why should I switch to Python? In-Reply-To: "Tim Peters"'s message of "Sat, 1 Apr 2000 14:54:07 -0500" References: <000201bf9c14$0a79d9e0$182d153f@tim> Message-ID: "Tim Peters" writes: > Python's [...] philosophy of raising exceptions is "gripe whenever there's > a reasonable doubt" rather than "assume the programmer meant whatever > they wrote". That one is particularly valuable to me. When I write C, it is very tedious having to check all return codes and take a diagnostic action for most cases. Of course, I could do like many and just check here and there, but then, error handling has no spinal chord. This aspect of C programming has been bothering me for the last twelve years :-). In Python, I only have to handle errors for which I want something else than a diagnostic action, which is much less burden while programming. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tismer at tismer.com Thu Apr 20 11:34:06 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 20 Apr 2000 17:34:06 +0200 Subject: __del__ problem - would adopting Garbage Collection fix this? References: <000801bfaa9c$c9957aa0$d62d153f@tim> Message-ID: <38FF236E.E34E64AB@tismer.com> Warren Postma wrote: > > > BTW, this was all discussed at extreme length on Python-Dev -- check it > out! > > I doubt anyone wants to repeat all of that whlie struggling to pretend > it's > > new & interesting . > > Is there an archive on the web somewhere of Python-Dev discussions?! Sorry > if that's a FAQ. Not a FAQ, andthe archives are not advertized, but they're public and here: http://www.python.org/pipermail/python-dev/ ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 tim_one at email.msn.com Thu Apr 6 22:18:49 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 6 Apr 2000 22:18:49 -0400 Subject: Some suggestion for a GUI kit evolved on Perl In-Reply-To: <8cijoc$gfs$1@newsg3.svr.pol.co.uk> Message-ID: <000101bfa037$9c1c2980$6c2d153f@tim> [Makhno] >> label = OrcLabel >> NewOrcWindow( >> title = "Test" >> ).Add( >> OrcVGroup( >> OrcButton, >> label >> ) >> ).Show() > Yes, this appears to be the best way. I thought that Python > statements could only be continued onto a new line if a '\' was > supplied, but perhaps I was wrong. An unclosed bracketing structure (left paren, square or curly bracket) suffices. > I don't like the way the Label has to be pre-made (not created in the > constructor) in order to keep a reference. It's thoroughly idiomatic Python, though, so even if you could dream up a way around that it wouldn't be accepted -- Python programmers aren't accustomed to staring at the insides of expressions for side-effects. This is considered to be a feature . clash-of-philosophies-ly y'rs - tim From dbeagle at my-deja.com Tue Apr 18 09:27:19 2000 From: dbeagle at my-deja.com (dbeagle at my-deja.com) Date: Tue, 18 Apr 2000 13:27:19 GMT Subject: telnetlib and NT vs. AIX Message-ID: <8dhnr5$glm$1@nnrp1.deja.com> I am trying to figure out what the difference is between telnet to Windows NT and AIX. As you can see below the calls made to each telnet server are the same but for some reason (unknown to me) after I enter username in the NT telnet session it never returns asking for the password. Testing on the AIX system worked as expected. The printout from both sessions is shown below. Thank you for your help db ************************************************** ************ This is the attempt to log into NT. ************************************************** ************ C:\_work\logparse\telnet>c:\_langs\python\python Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import telnetlib >>> tn = telnetlib.Telnet("WinNT4SVR_1") >>> tn.set_debuglevel(10) >>> tn.interact() Telnet(WinNT4SVR_1,23): recv '\377\375\030\377 \375 \377\375#\377\375$' Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): recv '\377\373\003\377\375 \001\377\375\037\377\373\005\377\375!' Telnet(WinNT4SVR_1,23): IAC WILL 251 Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): IAC WILL 251 Telnet(WinNT4SVR_1,23): IAC DO 253 Telnet(WinNT4SVR_1,23): recv '\377\373\001' Telnet(WinNT4SVR_1,23): IAC WILL 251 Telnet(WinNT4SVR_1,23): recv '\033[?7h\015 \012Welcome to WinNT4SVR_1\015\012(C) Copyright 1994-1' ?[?7h Welcome to WinNT4SVR_1 (C) Copyright 1994-1Telnet(WinNT4SVR_1,23): recv '998 Pragma Systems, Inc.\015\012\015\012login name: ' 998 Pragma Systems, Inc. login name: username Telnet(WinNT4SVR_1,23): send 'username\012' Telnet(WinNT4SVR_1,23): recv 'u' cTelnet(WinNT4SVR_1,23): recv 'sername' ondtt Telnet(WinNT4SVR_1,23): send '\012' ************************************************** ************ This is a far as I get on NT. I can never get to the password. Below is the attempt to log into an AIX Sever. ************************************************** ************ >>> tn = telnetlib.Telnet("AIXSvr_2") >>> tn.set_debuglevel(10) >>> tn.interact() Telnet(AIXSvr_2,23): recv '\377\376%\377\375\030' Telnet(AIXSvr_2,23): IAC DONT 254 Telnet(AIXSvr_2,23): IAC DO 253 Telnet(AIXSvr_2,23): recv '\377\376\030\377\375 \030\377\373\001\377\373\003\377\375\037\377\374 \310\37 7\375\001\015\012\015\012telnet (AIXSvr_2)\015\012 \015\000\015\012\015\000' Telnet(AIXSvr_2,23): IAC DONT 254 Telnet(AIXSvr_2,23): IAC DO 253 Telnet(AIXSvr_2,23): IAC WILL 251 Telnet(AIXSvr_2,23): IAC WILL 251 Telnet(AIXSvr_2,23): IAC DO 253 Telnet(AIXSvr_2,23): IAC WONT 252 Telnet(AIXSvr_2,23): IAC DO 253 telnet (AIXSvr_2) Telnet(AIXSvr_2,23): recv '\015\012\015\012\015 \012\015\012\015\012\015\012\015\012\015\012\015 \012\01 5\012\015\012\015\012\015\012\015\012\015\012\015 \012\015\012\015\012\015\012\015\012\015\012\015 \01 2\015\012\015\012\015\012' Telnet(AIXSvr_2,23): recv '\015\000AIX Version 4 \015\012\015\000(C) Copyrights by IBM and by ot' AIX Version 4 (C) Copyrights by IBM and by otTelnet (AIXSvr_2,23): recv 'hers 1982, 1996.\015\012\015 \000login: \377\ 376\037\377\376\001' Telnet(AIXSvr_2,23): IAC DONT 254 Telnet(AIXSvr_2,23): IAC DONT 254 hers 1982, 1996. login: username Telnet(AIXSvr_2,23): send 'username\012' Telnet(AIXSvr_2,23): recv 'username\015\012' username Telnet(AIXSvr_2,23): recv "username's Password: " username's Password: myPassword Telnet(AIXSvr_2,23): send 'myPassword\012' Telnet(AIXSvr_2,23): recv '\015\012' Telnet(AIXSvr_2,23): recv '************************************************* *' ************************************************** Telnet(AIXSvr_2,23): recv '************************* ****\015\012* ' ***************************** * Telnet(AIXSvr_2,23): recv ' ' Telnet(AIXSvr_2,23): recv ' *\015\012* // Lots of garbage but the connection is made!! Telnet(AIXSvr_2,23): recv 'AIXSvr_2:/u001/username>' AIXSvr_2:/u001/username>exit Sent via Deja.com http://www.deja.com/ Before you buy. From c.evans at clear.net.nz Thu Apr 13 06:13:23 2000 From: c.evans at clear.net.nz (Carey Evans) Date: Thu, 13 Apr 2000 10:13:23 GMT Subject: Why should I switch to Python? References: Message-ID: <87u2h6nwak.fsf@psyche.evansnet> Alex writes: > Catchy title. Good sigfodder too, if you don't mind. > Mail-copies-to: [nobody|poster] Uh, I think that's supposed to be _one_ of: Mail-copies-to: nobody Mail-copies-to: poster -- Carey Evans http://home.clear.net.nz/pages/c.evans/ "Perl Programmers are from Mars, Python Programmers are from Yorkshire?" Catchy title. - Alex in c.l.py From gresham at mediavisual.com Sat Apr 8 08:36:37 2000 From: gresham at mediavisual.com (Paul Gresham) Date: Sat, 8 Apr 2000 20:36:37 +0800 Subject: Socket Programming Question References: Message-ID: <8cn94p$je01@imsp212.netvigator.com> Have a look at www.freshmeat.net search for ACHAT. Someone has written it already ... I believe this is using sockets. "Ray Van Dolson" wrote in message news:aZdH4.95109$AT6.106753 at dfw-read.news.verio.net... > I'm trying to write a simple chat server w/ Python sockets that supports > multiple connections and am having a little trouble... here's my server code so > far: > > #!/usr/bin/python > > from socket import * > from threading import * > > serversocket = socket(AF_INET,SOCK_STREAM) > serversocket.setsockopt(SOL_SOCKET,SO_REUSEADDR,1) > serversocket.bind((gethostname(), 9001)) > serversocket.listen(5) > > def client_thread(clientsocket): > clientsocket.send("Welcome to the chat server...\r\n") > while 1: > data = clientsocket.recv(1024) > if data: > clientsocket.send(data) > else: > pass > > def main_server_thread(): > while 1: > (clientsocket, address) = serversocket.accept() > ct = Thread(target=client_thread,args=((clientsocket),)) > ct.run() > > mainThread = Thread(target=main_server_thread,args=()) > mainThread.start() > while 1: > pass > > However, this code only allows one connection at a time... the other can connect > to the socket but is simply queued. I would think the main_server_thread() > therad would create a new thread for each connection? > > What do I need to do to support multiple, simultaneous connections with this > code? > > Thanks, > Ray Van Dolson From garry at sage.att.com Fri Apr 14 12:11:13 2000 From: garry at sage.att.com (Garry Hodgson) Date: Fri, 14 Apr 2000 16:11:13 GMT Subject: Java References: <8d56qk$qdn1@imsp212.netvigator.com> Message-ID: <38F74321.465CCA09@sage.att.com> Gresh wrote: > but there are few experiences in life; > where you realize what you are missing; > i.e { > programming in python, then { > returning to a language with curly braces && semicolons; > } last year i wrote a testing framework for a client-server TTS engine in python. i later decided to rewrite it in c++ for some stupid reason or another. drove me nuts. i gave it a day or so, then gave up. i've done a *lot* of c++ in the past, but python really spoiled me, and i couldn't (or wouldn't) deal with all of the low level minutia. -- Garry Hodgson Every night garry at sage.att.com a child is born Software Innovation Services is a Holy Night. AT&T Labs - Sophia Lyon Fahs From nmm1 at cus.cam.ac.uk Sun Apr 9 15:04:30 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 9 Apr 2000 19:04:30 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> <8covpn$4jq$1@slb6.atl.mindspring.net> Message-ID: <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk> In article <8covpn$4jq$1 at slb6.atl.mindspring.net>, Andrew Dalke wrote: > >I wrote: >>Nick Maclaren wrote >>> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0) > >>How about >> x = getattr(a, "weeble", 0) + getattr(b, "wombat", 0) > >My code, BTW, is wrong. I didn't see the "[i]" part of the original >expression. To my view of things, this means the expression is >too complex. Yes. That is the point. The pity is that the expression that I am trying to evaluate is EXACTLY what the logic of the program requires, but it cannot be written in Python (or Fortran) without artificial variables. >You asked about other idioms. You could have a class wrapper >for accessing elements, like: Again, that works only in a few cases. When the code is such that there is not a common pattern to the test condition and evaluated expression, you have to create a class for every instance. That doesn't exactly clarify your code .... To the several people who suggested: (a() and [b()] or [c()])[0] Thank you for the suggestion. I have occasionally used perversities like that (such as '*(x ? &a : &b) = y;' in C to mimic the Algol 68 facility), but I don't regard them as clarifying the code, either! Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From jeremy at cnri.reston.va.us Sun Apr 2 17:32:10 2000 From: jeremy at cnri.reston.va.us (jeremy at cnri.reston.va.us) Date: Sun, 02 Apr 2000 21:32:10 GMT Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com> Message-ID: <8c8e8q$27v$1@nnrp1.deja.com> > Just read the announcement page, and found that socket.connect() no > longer takes two arguments as was previously documented. If this > change is staying I'm assuming the examples in the manual that uses > a two argument socket.connect() will be changed? Yes. The source and documentation releases are decoupled. The doc release will take a bit longer, because Fred just finished a big revision of the 1.5.2 docs. > A quick look shows that this breaks all the network scripts I have > installed (at least the ones that I found, undoubtedly there are many > more). Because of this I will put any upgrade plans on hold. I'm surprised at all the vituperative responses you got on this one. I like the change, but agree that in some environments it makes a lot of sense to delay upgrades. If you're project is mission critical and its not broken, why upgrade? In the long run, you'll probably benefit from all the little changes in 1.6 even if Unicode isn't important, but do it on your own schedule. Jeremy Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Fri Apr 28 19:17:53 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 29 Apr 2000 00:17:53 +0100 Subject: Linux Processes from Python HOW-TO? References: <8ecpch$j73$1@nnrp1.deja.com> <20000428234608.L11481@xs4all.nl> Message-ID: Thomas Wouters writes: > > I'm really hoping someopne has written this up! > > Well, I just did, didn't I ? ;) While I think this was a great write-up, I'll just add that Python has fairly recently gained, in os.py, a bunch of functions that act a bit like a cross between the os.exec* functions and os.system; the spawn* functions. They take a file and a list of arguments (like the exec* functions) but the subprocess des not replace the calling process. It can either be run as a subprocess (a bit like popen, but you do not control it's stdin or stdout) or you can ask the spawn* function to wait for the process to return (a bit like system, but there is no chance of the shell doing strange things to the arguments). On unices, these functions will most likely be implemented using fork&execv, but they save some tedious boilerplate. Cheers, M. -- 6. Symmetry is a complexity-reducing concept (co-routines include subroutines); seek it everywhere. -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From frohne at gci.net Tue Apr 18 17:40:05 2000 From: frohne at gci.net (Ivan Frohne) Date: Tue, 18 Apr 2000 13:40:05 -0800 Subject: o'reilly python devcenter References: <38FC984D.59407BCB@callware.com> Message-ID: "Ivan Van Laningham" wrote in message news:38FC984D.59407BCB at callware.com... > > http://www.oreillynet.com/python/ > Hmmm. I looked it over, admittedly not in great depth, but: > > 1) There seems to be no mention of www.python.org > 2) There seems to be no mention of the python mailing lists > 3) The only books mentioned are O'Reilly books > 4) There seem to be no links to other websites http://www.oreillynet.com/python/ is an outstanding web site. The design is professional, the home page loads quickly, and the material is well-organized. Almost every click either either leads to http://www.Python.org or displays the "Python-powered" ikon, which also clicks to Mecca. Gee, I wonder if it's even legal for O'Reilly to flog other publishers' books? And even if it is, ...? So cut O'Reilly some slack. Python can use the web presence. --Ivan Frohne From fw at deneb.cygnus.argh.org Mon Apr 10 17:10:59 2000 From: fw at deneb.cygnus.argh.org (Florian Weimer) Date: 10 Apr 2000 23:10:59 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com> Message-ID: <87r9cdhdb0.fsf@deneb.cygnus.argh.org> nascheme at enme.ucalgary.ca (Neil Schemenauer) writes: > I would rather get the bugs stomped out of my patch and get it > included in 1.6 or 1.7. We can then remove the FAQ entry. :) Is it possible to extend your GC in a way which would permit the execution of several bytecode interpreters in multiple threads? From Wolfgang.Strobl at gmd.de Wed Apr 5 06:45:32 2000 From: Wolfgang.Strobl at gmd.de (Wolfgang Strobl) Date: Wed, 05 Apr 2000 12:45:32 +0200 Subject: win32all-130 for Python 1.6 available References: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au> Message-ID: "Mark Hammond" wrote: >Delete _all_ "Toolbar*" subkeys - probably 20 or so in total! Worked, Thanks. The editors new "folding" feature is great, btw. Im currently using it for browsing the Zope sources, and especially like the "Toggle top-level" key. Its a great tool for viewing a programs overall structure. May I take the opportunity to suggest another feature? The Zope sources, like many others packages, have each and every file starting with a lengthy, boring copyright message, license, or something similar, which doesn't aid in understanding a programs structure in any way. Wouldn't it be nice if "Toggle top-level" and "Collapse all" would collapse comment blocks, too? -- o ( Wolfgang.Strobl at gmd.de (+49 2241) 14-2394 /\ * GMD Forschungszentrum Informationstechnik GmbH _`\ `_<=== Schloss Birlinghoven, | #include __(_)/_(_)___.-._ D-53754 Sankt Augustin, Germany | From matheusrodrigues at hotmail.com Wed Apr 19 16:36:24 2000 From: matheusrodrigues at hotmail.com (Matheus Rodrigues) Date: Wed, 19 Apr 2000 20:36:24 GMT Subject: ADO Question Message-ID: <20000419203624.53393.qmail@hotmail.com> Hi all, I have a piece of code that runs fine in my machine (windows 98). I am trying to create a package to install this application in other machines just by unziping a directory structure. But I am getting the following traceback message. I know it has something to do with the ADO configuration. Btw, the other machine has the same DNS entry that mine has. Any suggestions ?? Cheers, Matheus Traceback (innermost last): File "c:\python\win32com\client\dynamic.py", line 242, in _make_method_ codeObject = compile(methodCode, "" % self._username_,"exec") File "", line 1 def Open(self, ConnectionString=L'', UserID=L'', Password=L'', Options=-1): ^ SyntaxError: invalid syntax Traceback (innermost last): File "App/launch.py", line 18, in ? main.main() File "c:\python\App\main.py", line 33, in main adoConn.Open("data source=dns_sql_server;") TypeError: call of non-function (type None) ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From bingdo19 at earthlink.net Thu Apr 20 11:52:20 2000 From: bingdo19 at earthlink.net (Bob Langdon) Date: Thu, 20 Apr 2000 15:52:20 GMT Subject: Test_time Fails? / Installing on Virtual DOmain References: Message-ID: In article , Bob Langdon wrote: Anyone know why "altzone" won't work on Linux2? > In article , > Bob Langdon wrote: > > > Hi, > > > > Upon installing Python in the home directory of a virtual domain (after > > making the necessary configure file changes; i.e.: replacing all > > instances of "/usr/" with: "/home/username/python/usr/") > > > > "make test" results in 1 error: > > > > >>1 test failed: test_time > > 19 tests skipped: test_al test_audioop test_bsddb test_cd test_cl > > test_crypt test_dbm test_dl test_gdbm test_gl test_gzip test_imageop > > test_imgfile test_nis test_rgbimg test_sunaudiodev test_thread > > test_timing test_zlib<< > > > > Running Lib/test/test_time.py results in: > > >>Lib/test/test_time.py: import: command not found > > Lib/test/test_time.py: time.altzone: command not found > > Lib/test/test_time.py: line 5: syntax error near unexpected token `t' > > Lib/test/test_time.py: line 5: `t = time.time()'<< > > > > Is this something I've failed to install, or something missing from the > > system? > > > > Of course if I add the correct path test_time.pl > > then I get the following error: > > > >>Traceback (innermost last): > File "Lib/test/test_time.py", line 5, in ? > time.altzone > AttributeError: altzone<< From cdh at mail.ala.net Wed Apr 5 22:53:03 2000 From: cdh at mail.ala.net (cdh) Date: Wed, 5 Apr 2000 21:53:03 -0500 Subject: special attributes (and greetings from a new list user) (repost, hopefully in plain text) Message-ID: <002301bf9f73$3cff8f60$4f186bce@ala.net> -- sorry for the repost, but outlook rendered my last one nearly unreadable:( Hi, My name is Chris Hickman and though I've been using python for a while now, I'm new to the list. I've been a member on another prog-lang list before and found it very fun and interesting. Below is a module I'd like to submit for comments. It make's attribute handling a bit easier as it takes care of __getattr__ and __setattr__ for you. The document string should explain it fairly well. Happy python programming, Christoper D. Hickman ############################################################################### # Author: Christopher D. Hickman # Date: 4/3/2000 """ Module: spec_attr.py Simplifies adding special get and set handlers for attributes. Exports: class spec_attr: Defines the methods __getattr__ and __setattr__ implement magic handlers for special attributes. The special attribute must be defined with an _ (underscore) prepended. The methods are defined as getattr and setattr. The special attributes will then automatically call their handlers whenever accessed without the leading underscore. You may also implement "virtual attributes" which are handlers only with no special attribute supporting them. See example below for usage. class spec_attr_declarative: Same as the spec_attr class except it disallows implicit attribute creation. class SpecialAttributeError(AttributeError): Error class raised by spec_attr_declarative.__setattr__() when attempting to implicitly create a new attribute by assigning a value to a non-existant attribute. Example: >>> from spec_attr import spec_attr >>> class foo(spec_attr): ... _x = 0 # special attribute x ... _y = 0 ... _z = 0 ... count = 5 ... def getattr_x(self): # special get method for x ... print "x attribute of %s was read" % repr(self) # verbalize all accesses to x ... return self._x # caveat: you must use the underscore prepended form for all "gets" ... # of a special attribute when defining it's get method. ... # otherwise, infinite recursion will ensue. ... def setattr_x(self, value): ... print "x attribute of %s was changed from %s to %s" % (self, self._x, value) ... self._x = value # same caveat applies for sets in set methods as for gets in get methods. ... def setattr_y(self, value): ... if value % 2: ... raise "y must be even!" ... self._y = value ... def getattr_xyz(self): # a virtual get method (there's no xyz attribute) ... return self.x, self.y, self.z ... def setattr_xyz(self, value): # a virtual set method ... self.x, self.y, self.z = value ... def getattr_decr_count(self): ... val = self.count ... self.count = self.count - 1 ... return val ... >>> a = foo() >>> a.x x attribute of <__main__.foo instance at 10e2bf0> was read 0 >>> a.x = 12 x attribute of <__main__.foo instance at 10e2bf0> was changed from 0 to 12 >>> a.xyz = (1,2,3) x attribute of <__main__.foo instance at 10e2bf0> was changed from 12 to 1 >>> a.xyz x attribute of <__main__.foo instance at 10e2bf0> was read (1, 2, 3) >>> while a.decr_count: ... print a.count ... 4 3 2 1 0 >>> a.xyz = (6, 7, 8) x attribute of <__main__.foo instance at 10e2bf0> was changed from 1 to 6 Traceback (innermost last): File "", line 1, in ? . . . File "", line 16, in setattr_y y must be even! >>> """ class SpecialAttributeError(AttributeError): pass class spec_attr_declarative: # important things to remember about __getattr__: # 1. __getattr__ is *only* called when a "real" attr is not present # 2. hasattr() can cause recursion to __getattr__, and traps any exceptions generated def __getattr__(self, attr): # see if there is a method defined to handle gets for attr if attr[:8] == 'getattr_': # we've either recursed because getattr_ doesn't exist, (in which case the exception # generated here is trapped by the hasattr() call from the caller), or we tried to call # the non-existant getattr_ directly. raise AttributeError, attr if hasattr(self, 'getattr_' + attr): return eval ('self.getattr_' + attr + '()') # if no method is present, try to return the value of the special attribute behind the one # we're trying to access if attr[:2] == '__': # we're probably checking for ('_' + _) due to recursive calls, a private attribute, # or an undefined instance of one of python's "magic" attributes (like __repr__), # so give up. raise AttributeError, attr if hasattr(self, '_' + attr): return eval ('self._' + attr) # otherwise, it simply doesn't exist raise AttributeError, attr # unlike __getattr__, __setattr__ is always called def __setattr__(self, attr, value): # if it's in the __dict__ it's not special, so process it quickly if self.__dict__.has_key(attr): self.__dict__[attr] = value return # see if there is a method defined to handle sets for attr if hasattr(self, 'setattr_' + attr): exec ('self.setattr_' + attr + '(value)') return # if no method is present, try to set the value of the special attribute behind the one # we're trying to set if hasattr(self, '_' + attr): exec ('self._' + attr + ' = value') return # otherwise attr could be present in the .__class__.__dict__ (or somewhere), in which # case hasattr() will return true even though the above tests failed. Create a real attribute # in the instance's __dict__. (this mirrors the default behavior in this case when no __setattr__ # method is defined) if hasattr(self, attr): self.__dict__[attr] = value return # for the declarative version, don't allow de-facto creation of a new attribute. (explicitly use # __dict__ to circumvent this) raise SpecialAttributeError, "Attempted to create a new attribute %s for the declarative class instance %s" % (attr, repr(self)) class spec_attr(spec_attr_declarative): def __setattr__(self, attr, value): try: spec_attr_declarative.__setattr__(self, attr, value) except SpecialAttributeError: # allow creation of new normal attributes (without explicitly using __dict__) in the # non-declaritive version. self.__dict__[attr] = value From dalke at acm.org Sat Apr 1 01:48:15 2000 From: dalke at acm.org (Andrew Dalke) Date: Fri, 31 Mar 2000 23:48:15 -0700 Subject: "tostring" as a string method? Message-ID: <8c45ue$b7u$1@slb1.atl.mindspring.net> Hello, Strings in Python 1.6 will have methods. I would like them to also have a "tostring()" method, which returns itself. I've been working on classes for storing and analyzing protein and dna sequences. There are four ways I can think of to store the data: a string, array.array, Numeric.array, and a [] of single character strings. Because of space requirements, [] is out, and Numeric.array isn't available on all machines (and its length can't be changed in-place). Strings are more natural, because of the large number of string operations, including regular expressions. An array.array of characters is nice since it's mutable. I would like to write functions which work on both strings and array.arrays. Here's an example, which is used to translate DNA to protein: def translate(dna, table = Translation.standard_table): s = dna # or "dna.tostring()" for array.array x = [] for i in range(0, len(s), 3): x.append(table[s[i:i+3]]) return string.join(x, "") This would work with both strings and arrays, if strings supported a "tostring()" method. (I could give an example with needing strings for regular expressions, but it would be more complicated.) Would there be any reason not to have tostring() as a method? If not, I can supply a patch off the CVS version for it. Andrew dalke at acm.org From tim.hochberg at ieee.org Thu Apr 6 11:08:10 2000 From: tim.hochberg at ieee.org (Tim Hochberg) Date: Thu, 06 Apr 2000 15:08:10 GMT Subject: More about variables References: Message-ID: > Hi All, > > Let's say I had something like: > > number_of_variables=int(raw_input('Enter number of variables: ')) > > if number_of_variables==1: > variable1=[] > elif number_of_variables==2: > variable1=[] > variable2=[] [snip....] you could do: for i in range(number_of_variables): exec "variable%s = []" % i Or, if you wanted to about exec, and you didn't mind your variables being stored in a dictionary or class, you could do: varDict = {} for i in range(number_of_variables): varDict["variable%s" % i] = [] varDict["variable0"].append(something) #... or, class VariableHolder: pass varClass = VariableHolder() for i in range(number_of_variables): setattr(varClass, "variable%s" % i, []) varClass.variable0.append(something) #... -tim From c.hintze at gmx.net Thu Apr 27 01:30:15 2000 From: c.hintze at gmx.net (Clemens Hintze) Date: Thu, 27 Apr 2000 05:30:15 GMT Subject: defining __getitem__ References: Message-ID: "Gang" Gang Seong has written: Gang> I'd like to have a method __getitem__ in a class which acts Gang> like other sequence type. For example, Gang> ------------------------ Gang> class data: Gang> def __init__(self, n): Gang> self.maxsize = n Gang> Gang> def __getitem__(self, k): Gang> if k >= self.maxsize: raise IndexError # !!! The 'for' loop works that way! It calls __getitem__ until it catched an IndexError, then it stops. Gang> # I want to stop here Gang> # ???? Gang> return get_data_from_some_where_else(k) Gang> Gang> d = data(10) Gang> for el in d: Gang> print el Gang> ------------------------ Gang> I want to make it stop at some point automatically, like Gang> range() does. I don't want to use try: exception clause for Gang> this. Is there any way for this? No try ... except clause necessary, but a 'raise' is! ;-) Gang> Gang> Thanks Gang> Gang Seong You're welcome, Clemens. From jwbnews at scandaroon.com Sat Apr 22 16:38:35 2000 From: jwbnews at scandaroon.com (John W. Baxter) Date: Sat, 22 Apr 2000 13:38:35 -0700 Subject: code not true? References: Message-ID: In article , Moshe Zadka wrote: > On Sat, 22 Apr 2000 jeff_islay at my-deja.com wrote: > > > Why does the second example return false? > > > > >>> print 7.0 == 7 > > 1 > > >>> print (.07 * 100) == 7 > > 0 > > Because computers represent floats with too little bits. > Never ever compare two floats for equality! > Not quite. No number of bits is sufficient to represent .07 exactly in the typical (and IEEE standard) representation. Various alternate representations are possible which are exact (such as BCD floating point of sufficient precision, rational numbers with (potentially) Python longs as numerator and/or denominator, some interesting recent work I haven't followed, etc etc etc). --John -- John W. Baxter Port Ludlow, WA USA jwbnews at scandaroon.com From scherbi at bam.com Mon Apr 24 13:17:19 2000 From: scherbi at bam.com (Bill Scherer) Date: Mon, 24 Apr 2000 13:17:19 -0400 Subject: ftplib sendcmd References: <1255528387-51524611@hypernet.com> Message-ID: <3904819F.E7FEEFE0@bam.com> Thanks Gordon! This is the answer I needed. It all works great now. Thanks again, Bill Gordon McMillan wrote: > Bill Scherer wrote > > > I'm having trouble with ftplib's sendcmd method (Python 1.5.2 on > > RH linux 6.1): > > > > >>> ftp = ftplib.FTP(host, user, password) > > >>> ftp.sendcmd('umask 002') > > Traceback (innermost last): > > File "", line 1, in ? > > File "/usr/local/lib/python1.5/ftplib.py", line 228, in sendcmd > > return self.getresp() > > File "/usr/local/lib/python1.5/ftplib.py", line 201, in getresp > > raise error_perm, resp > > ftplib.error_perm: 500 'UMASK 002': command not understood. > > >>> > > > > The umask command does, of course, work using a standard ftp > > client to the same host. > > > > Other commands, chmod, etc, suffer equal fate. > > > > Is this not what sendcmd is for? What am I doing wrong? Thanks! > > These are not rcf 959 commands. GNU ftpd will support them > as SITE UMASK x and SITE CHMOD mod file. > > - Gordon From chris_barker at my-deja.com Fri Apr 28 15:39:00 2000 From: chris_barker at my-deja.com (chris_barker at my-deja.com) Date: Fri, 28 Apr 2000 19:39:00 GMT Subject: Linux Processes from Python HOW-TO? Message-ID: <8ecpch$j73$1@nnrp1.deja.com> Hi all, Has anyone written a HOW-TO or tutorial that explains how to start and manipulate other processes with Python. I imagine it's trivial if you are familiar with the Linux/Unix process model, but I get very confused about when to use: system popen and it's variants exec and it's variants fork etc. I'm really hoping someopne has written this up! If you just have a subset of the info, send it to me, and maybe I'll write it up! -Chris Barker cbarker at jps.net Sent via Deja.com http://www.deja.com/ Before you buy. From wfouche45 at hotmail.com Thu Apr 20 13:49:56 2000 From: wfouche45 at hotmail.com (Werner Fouche) Date: Thu, 20 Apr 2000 13:49:56 -0400 Subject: XML 1.0 DTD parser for SPARK. Message-ID: <8e0c1u$hqc$1@slb1.atl.mindspring.net> If anybody has a XML 1.0 DTD parser for SPARK (http://csr.uvic.ca/~aycock/python) please drop me an e-mail. Thanks, Werner From embed at geocities.com Fri Apr 7 09:02:21 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 7 Apr 2000 09:02:21 -0400 Subject: Compile Gadfly? Message-ID: Has anyone tried compiling Gadfly and 'embedding' it into an executable, for easier distribution? Does it work!? Warren From effbot at telia.com Sun Apr 2 15:19:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 02 Apr 2000 19:19:32 GMT Subject: Python 1.6 alpha 1 released References: <00033115131700.03666@quadra.teleo.net> <38E7922D.52166F1D@bellatlantic.net> Message-ID: <83NF4.1011$n68.190636032@newsb.telia.net> Steve Holden wrote: > Maybe someone could borrw the time machine and visit the future to let us > know how this one is going to come out? :-) guido didn't mention this in yesterday's 1.6 final release note, so it's probably gone. note, though, that socket.connect doesn't support unicode in 1.6 final, so you may be SOL anyway. From DOUGS at oceanic.com Thu Apr 20 00:17:24 2000 From: DOUGS at oceanic.com (Doug Stanfield) Date: Wed, 19 Apr 2000 18:17:24 -1000 Subject: [ANNOUNCE] Webware for Python 0.1 Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F40D@huina.oceanic.com> The following intrigues me but its not probably the best endorsement. When I hit your published link I get: ERROR Traceback (innermost last): File "MainPage.py", line 55, in main _main() File "MainPage.py", line 49, in _main inc_counter() File "MainPage.py", line 23, in inc_counter f.write(repr(counter+1)) NameError: counter But I guess you're at V0.1 so proving the error reporting works is a good thing. :-) This was from a redirect to http://writewithme.com/Webware/ by the way, so maybe therin lies the problem. I am still interested in looking at the package. -Doug- > -----Original Message----- > From: Chuck Esterbrook [mailto:echuck at mindspring.com] > Sent: Wednesday, April 19, 2000 5:52 PM > To: python-list at python.org > Subject: [ANNOUNCE] Webware for Python 0.1 > > > > Webware for Python is a definitive suite of Python software > components for use in web development. Each component has a > focused purpose and can often be used on it's own. At the > same time, the components are designed to work together where > appropriate. As a user of Webware, you can bite off as much > or as little as you want to chew. > > You can find more and download at: > > http://www.writers-webshop.com/Webware > > > -Chuck > -- > http://www.python.org/mailman/listinfo/python-list > From Jonathan_Epstein at nih.gov Mon Apr 10 10:25:17 2000 From: Jonathan_Epstein at nih.gov (Jonathan Epstein) Date: Mon, 10 Apr 2000 10:25:17 -0400 Subject: Visual Studio add-ins in Python Message-ID: <38F1E44D.13BE21D0@nih.gov> Some colleagues and I are interested in writing some fairly complex Visual Studio add-ins in Python. Before digging into writing a complex add-in, we will probably try a simple one, analogous to what appears at: http://msdn.microsoft.com/library/devprods/vs6/visualc/vcsample/vcsmpdeveloperstudioaddinsamples.htm Has somebody already written an add-in using Python? I have the _Programming Python_ book, but gather that it would be worthwhile to also purchase _Python Programming on Win32_ for this project. Correct? http://www.amazon.com/exec/obidos/ASIN/1565926218/104-2140334-1904426 Thanks for any advice, - Jonathan From genius at idirect.com Fri Apr 28 13:38:58 2000 From: genius at idirect.com (Snoopy :-))) Date: Fri, 28 Apr 2000 17:38:58 GMT Subject: Help Needed-IDLE (Linux)Upgrading Message-ID: <3909CC26.D684AD92@idirect.com> No Flames Please. I am a NEWBIE :-)) Using Linux (RH-6.1) I have downloaded the Idle-0.5 Upgrade "tgz". package.But I don't know where and how to install the package. After unzipping the package I've read the README file which doesn't seem togive clear instructions regarding installation of the upgrade. On my system Idle is in /usr/bin but this is only the executable file without subdirectories where I would be able to put the untared and uzippedfiles. I would appreciate a helping hand Best regards Charles Takacs From aahz at netcom.com Thu Apr 20 16:25:42 2000 From: aahz at netcom.com (Aahz Maruch) Date: 20 Apr 2000 20:25:42 GMT Subject: Good style for multi-valued returns References: <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7@lp.airnews.net> Message-ID: <8dnp46$23t$1@slb0.atl.mindspring.net> In article <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7 at lp.airnews.net>, Cameron Laird wrote: > >Examples of multi-valued returns: (head, tail); (quotient, remainder); >(left, right); (prologue, body, epilogue); (data, code); (CAR, CDR); >(count, size); (handle, status); (decomposition; remainder); ... > >Let me guess: folks generally pass tuples for small and >determinate-in-number multi-values, and dictionaries otherwise, 'cept >some do it all with tuples. Accurate? Somewhat. There's also the option of returning a class (though that usually ends up being a class instantiation followed by a method call). -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Why is this newsgroup different from all other newsgroups? --Aahz From mdefreitas at sikorsky.com Sun Apr 30 19:15:31 2000 From: mdefreitas at sikorsky.com (mdefreitas at sikorsky.com) Date: Sun, 30 Apr 2000 23:15:31 GMT Subject: MORE INFO References: <8ea0ao$fro$1@nnrp1.deja.com> <8ea9uu$rh0$1@nnrp1.deja.com> <8ecad6$bun$1@ites.inria.fr> <8ecref$lck$1@nnrp1.deja.com> <8ehnvs$m0h$1@ites.inria.fr> Message-ID: <8eieq8$ees$1@nnrp1.deja.com> In article <8ehnvs$m0h$1 at ites.inria.fr>, Cedric Adjih wrote: > mdefreitas at sikorsky.com wrote: > > >> Do you want to run several python scripts (and several ui.commands > >> C code) concurently (how would you synchronize?) ? > > > I do not want to run concurrently, I just want to run in one thread of > > execution, but recursively. > > Ok. > > >> Note that if all you want is to have C code that calls Python > >> code that calls C code (through a module) that calls Python code > >> without threads, PyRun_XXX functions are re-entrant. > > > Thanks! That's what I needed to know. I now modified (and simplified) > > my code as follows: > > > void interp(char *script) { > > static int nest_level = 0; > > FILE *fd = fopen(script, "r"); > > if (nest_level == 0) { > > Py_Initialize(); > > PyRun_SimpleString("import ui\n"); // import my ui > > } > > nest_level++; > > PyRun_SimpleFile(fd, script); > > nest_level--; > > if (nest_level == 0) Py_Finalize(); > > } > > > The only problem is that the nested script that is run "remembers" the > > variable settings from it's caller. Is there a way to give each nested > > python script a fresh, clean environment? The nested script should not > > effect the environment of it's caller either. Is that what the global > > and local dictionaries for the API function PyRun_File are for? If so, > > is there any examples on their usage. The C/API doc isn't all that > > explicit. > > Indeed. > PyRun_File is actually implementing most of the "execfile(...)" > code (see http://www.python.org/doc/current/lib/built-in-funcs.html). > Python source code for execfile is also an example of use for > PyRun_File. > Passing empty dictionaries would be a way to have a "clean" > environment except if a script imports a Python module and fiddles > with its internals. Because modules will be shared among scripts. > But fiddling with internals is very bad style. > > -- Cedric Hmmm... I looked at the source code for execfile and it looks like it either passes PyRun_File the dictionaries that were passed into execfile itself, or if none was passed in, it passed PyRun_File the current dictionaries as default. I believe that what I need to do is pass in EMPTY dictionaries for the globals and locals. I tried the following: PyRun_File(fd, script, Py_file_input, PyDict_New(), PyDict_New()); But that didn't seem to work. The top level script seemed OK, but the nested one didn't seem to execute. Is there something else that needs to be done? Is it bad to pass in an empty global dictionary? Also, I noticed that there was a PyDict_New function, but not a PyDict_Delete function... I assume memory cleanup is automatic? As always, thanks for the help... Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Tue Apr 4 11:53:50 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 4 Apr 2000 11:53:50 -0400 Subject: Python and .HTA files in IE5 In-Reply-To: <38E9EBA2.CF62323A@bellatlantic.net> Message-ID: <1257258851-5014402@hypernet.com> Richard M. Smith wrote: [snip] > I am having trouble executing the following simple Python script > to read the contents of AUTOEXEC.BAT and output it on > the .HTA page: > > readlines() returns a list of lines, which str() is not going to be happy about. Try using read(). - Gordon From nascheme at enme.ucalgary.ca Thu Apr 20 00:50:09 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Thu, 20 Apr 2000 04:50:09 GMT Subject: __del__ problem - would adopting Garbage Collection fix this? References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> <38FE7F1E.168E914A@cosc.canterbury.ac.nz> Message-ID: Greg Ewing wrote: >By the way, does anyone know what the recently >announced GC patch does about __del__ methods? Well, I guess I should. :) When garbage is found by the collector (ie. reference cycles not reachable from Python), all objects reachable from __del__ methods are moved into a separate set. This is what I call uncollectable garbage. Uncollectable instances are currently added to a global list of uncollectable objects reachable from within Python. If the programmer creates such garbage it is up to them to deal with it. The bottom line is don't add __del__ methods to objects that form cycles. It is, however, okay to reference objects with __del__ methods from objects involved in reference cycles. If that's not clear perhaps an example will help: >>> import gc >>> class A: ... pass ... >>> class B: ... def __del__(self): ... pass ... >>> a = A() >>> a.b = B() # referenced from, not involved in cycle >>> c = A() >>> a.c = c >>> c.a = a >>> del a, c # collectable garbage created >>> gc.collect() gc: collectable gc: collectable gc: collectable gc: collectable 4 >>> a = A() >>> b = B() >>> a.b = b >>> b.a = a >>> del a, b # uncollectable garbage created >>> gc.collect() gc: uncollectable gc: uncollectable gc: uncollectable gc: uncollectable 4 >>> gc.garbage [<__main__.A instance at 81abbc4>, <__main__.B instance at 81c50a4>] There was quite a bit of discussion about this issue on the python-dev list. Getting back on topic, GC does not help with this problem. In fact it is hard to make __del__ methods behave sanely with GC. Nice __del__ semantics are one of the benefits of reference counting. __del__ methods are strong medicine, use them sparingly. Neil -- "A language that doesn't affect the way you think about programming, is not worth knowing" -- Alan Perlis From ivanlan at callware.com Fri Apr 7 08:55:40 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 07 Apr 2000 06:55:40 -0600 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> <38EB73B6.6C0913A7@callware.com> <8chsij$k5r$1@newsserver.rrzn.uni-hannover.de> Message-ID: <38EDDACC.8641FF8C@callware.com> Hi All Niklas Frykholm wrote: > [snip] > > As an interesting side note, a publisher here in Sweden has > recently started a 10-minute series, with titles such as > "Teach your self Internet in 10 minutes". Seems there is > inflation (or perhaps deflation) in these things. > Probably SAMS. They have a 10-minutes series. The books are comprised of *lots* of 10-minute lessons; there's no expectation that you would learn the whole area of study in ten minutes;-) > And it _is_ a silly practice. But then again, corporate > silliness doesn't surprise me that much anymore. > -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From nascheme at enme.ucalgary.ca Sat Apr 8 00:17:50 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Fri, 7 Apr 2000 22:17:50 -0600 Subject: [ANNOUNCE] Garbage collection for Python Message-ID: <20000407221750.A29279@acs.ucalgary.ca> Garbage collection for Python: http://www.enme.ucalgary.ca/~nascheme/python/gc.html I think I have all of the wrinkles ironed out of this patch. Reference cycles involving lists, tuples, instances, classes, dictionaries, and functions are found. Instances with __del__ methods are handled in a sane way. It is easy to add GC support to new types. GC enabled Python is binary compatible with regular Python. Generational collection works (currently three generations). The overhead measured by pybench is less than 1 percent and is not measurable with pystone (on my machine). Virually all extension modules should work unchanged (I had to modify new and cPickle in the standard distribution). A new module called gc is available for tuning the collector and setting debugging options. The collector should be portable across all platforms but I have only tested on my Linux machine. The patched version of Python passes all regression tests and runs Grail, Idle and Sketch without problems. The patch is against the current CVS version of Python. If enough people ask for a patch against the stable version of Python I will make one. Please send comments and bug reports. Neil -- "Simplicity does not precede complexity, but follows it." -- Alan Perlis From ppi at searchy.net Fri Apr 7 10:34:21 2000 From: ppi at searchy.net (Penpal International) Date: Fri, 07 Apr 2000 16:34:21 +0200 Subject: PPython References: <38ede548.353776233@news.oh.verio.com> Message-ID: <38EDF1ED.D102B7C9@searchy.net> I bet also your web hoster has support for python. It comes along with almost every ditribution of Linux. (95 % of all webservers are working with linux). Why you don't try it out. Make a little script, put it in the cgi-bin directory (Don't forget to chmod it 0755). you also can login with telnet and type: python . If you get a sort of shell you know for sure you can execute python scripts. Kevin Dahlhausen wrote: > > So many web hosting sites only allow Perl scripting, I got to thinking. That's > often a dangerous thing. Would it be possible to implement the Python virtual > machine in Perl? OK, anything is possible, but I guess the real question is > does anyone have a feel for the scope of such a project? Say using a native > interpreter to pre-compile the Python code to pyc files and the perl cgi vm to > run them? Feasible, or just a silly idea? -- Penpal International http://ppi.searchy.net/ ppi at searchy.net From neilh at hare.net.au Sat Apr 1 09:07:38 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Sun, 2 Apr 2000 00:07:38 +1000 Subject: Why should I switch to Python? References: Message-ID: <011d01bf9be3$a3dca0d0$4ddd3fcb@neil> > What I'd like to hear from people is what technical > resons I should switch to Python. Are there any > features that Python has (perhaps in it's OO > offering) that Perl lacks? From what I can tell > people tend to prefer Python over Perl mostly > for its syntax, which I find very likable. If you are happy with Perl's syntax and semantics, I think you should stay with it. There are cases where particular libraries are available in one or the other language which may make it more usable on a particular project but overall the languages cover similar ground. If you are curious, it may be worthwhile trying a small task with Python. It shouldn't take very long to learn enough Python to have a go. I moved from Perl to Python about 2 years ago because of the then better Windows COM support and stayed because it suited me better. To explain why, I'd have to repeat some of the common subjective arguments that don't seem to satisfy Perlers. Neil From chris.lada at westgroup.com Tue Apr 11 11:01:57 2000 From: chris.lada at westgroup.com (Chris Lada) Date: Tue, 11 Apr 2000 11:01:57 -0400 Subject: Processing BCD and Signed Integer Fields with Python References: <38f334ea@wwwproxy3.westgroup.com> <8cvdel$lb9$1@pegasus.csx.cam.ac.uk> Message-ID: <38f33dca@wwwproxy3.westgroup.com> Nick, Being a newbie in python, I have to ask these questions: what functions can I use to process these fields ? What can I use to separate the number from the sign ? Is there a conversion for this type of data to strings ? What data types would they be ? Thanks, Chris Nick Maclaren wrote in message <8cvdel$lb9$1 at pegasus.csx.cam.ac.uk>... > >In article <38f334ea at wwwproxy3.westgroup.com>, "Chris Lada" writes: >|> We have been receiving record/field-based information from a data provider. >|> Some of the fields are BCD (Binary Coded Decimal), and some are signed >|> integer. The data originates from a mainframe/Cobol(?) system. The record >|> layouts have definitions like "PIC S99999" (signed integer), and "PIC S99999 >|> Comp-3" (BCD). Has anyone had to process this sort of data with Python ? >|> Can Python handle this sort of data type ? Anyone have suggestions on how >|> to approach this problem ? > >It's pretty easy handling anything like that, PROVIDED that you have >the data intact. Let us assume that is IBM 360/370/390 MVS or CMS, >then it originated in a record-oriented system, where ALL characters >are valid in records. 99% of people manage to mangle the data when >transferring it to Unix or Unix-like systems (including Microsoft >systems), and lose information. > >If you can avoid that, it is just like handling any field-oriented >data, except in binary rather than human-readable text. This remark >applies to any sufficiently powerful language - C, Perl, Python and >so on. > > >Regards, >Nick Maclaren, >University of Cambridge Computing Service, >New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. >Email: nmm1 at cam.ac.uk >Tel.: +44 1223 334761 Fax: +44 1223 334679 From dalke at acm.org Mon Apr 24 04:33:38 2000 From: dalke at acm.org (Andrew Dalke) Date: Mon, 24 Apr 2000 02:33:38 -0600 Subject: partial parsing? References: <8dvilp$88s$1@slb6.atl.mindspring.net> Message-ID: <8e10n7$rkl$1@slb3.atl.mindspring.net> It looks like I wasn't clear in my post, so let me start over. This time I'll explain the problem domain first, and end up with the question part. I need to parse data files of two broad clases, data files and output files. The first contains many sets of data records, which were designed to be parsed by hand-coded parsers written by non-CS people (no CF grammers here). These files range from 10K up to several hundred MB. The second class, output from executables, weren't really designed to be machine parsable, but since they are machine generated, they can be parsed. In both cases, the formats contain more information than is usually needed. I often just want the record identifier and one or two other fields, and not the author's name, the publication data, the date of submission, the ... I think you get it. And in some cases, I just want the start/end position of the record to make an index. Additionally, all of the formats are line oriented. Nearly all are machine generated, so there's a good likelyhood that the data is in the right format. The lexical elements are quite stateful; the word 'sequence' may mean three or more things in the same record, depending on the line and position. On the simplification side, I believe I can get away with parsing regular grammers only. Some of the formats, about 25%, are non-regular. Indded, expect three lines in a row to have the same length, which is a context sensitive grammer, but the assertion that they are in the right format means a regular grammer will work. (Eg, a[n]b[n]c[n] can be parsed with a*b*c* if it is guaranteed that the input grammer is correct.) Examples of the database files I need to parse are: 220MB at ftp://ftp.expasy.ch/databases/swiss-prot/release/sprot38.dat 21MB (compressed) at ftp://ncbi.nlm.nih.gov/genbank/gbmam.seq.Z 55K at http://www.expasy.ch/cgi-bin/get-pdb-entry.pl?9pti HTML marked-up records from the first two formats are at: http://www.expasy.ch/cgi-bin/get-sprot-entry?P80222 http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=Nucleotide&lis t_uids=3822546&dopt=GenBank Links from the "DR" lines of the SwissProt record (the first one) gives pointers to another dozen database formats. Examples of executable output I need to parse are at: 490K at ftp://bio.perl.org/pub/katel/Blast/Nucleic/wisteria.txt 3K (a small one!) at ftp://bio.perl.org/pub/katel/Blast/Nucleic/lupine.txt I usually write event driven parsers, in the style of SAX for XML parsing. This works well if I want to parse everything, but there's a lot of overhead if I only need the couple of fields - I end up ignoring most of them. Indeed, most people usually write specialized parsers to extract just the needed data. Since the formats are line oriented, that means something like: find the line starting with 'ID'; read the first word, find the lines starting with 'SQ'; get rest of the data in the line, record ends at the line equal to '//'. In perl, this is ridiculously easy; $id = ''; $sq = ''; while (<>) { if (/^ID (\w+)/) { $id = $1; next; } if (/^SQ (.*)/) { $sq .= $1; next; } if ($_ eq '//\n') { #&do_something($id, $sq) $id = ''; $sq = ''; } } That's one reason why perl is popular in this field. So I want some way to start with the full grammer for the format, then generate a parser which sends events for only those terms I'm interested in, and allows optimizations which assume the format is correct, so it can do thing like skip some bytes, or read a few lines without checking what's on them. Say, perhaps, like: import sys, ParserGen from Formats import GivenFormat parser = ParserGen.LenientParser(GivenFormat, tags = ("identifier", "sq_data", "end") ) class SQHandler: def __init__(self, func): self.reset() self.func = func def reset(self): self.id = self.sq = '' def parse(self, tag, text): if tag == "identifier": self.id = text elif tag == "sq_data": self.sq = self.sq + text elif tag == "end": self.func(self.id, self.sq) self.reset() def do_something(id, seq): pass parser.set_handler(SQHandler(do_something)) parser.parse(sys.stdin) I know, it looks more complicated than the perl version, but it allows reads from any file-like object, and once created, the SQHandler object can be reused, so the amortized cost is quite small. Plus, the same handler can work with related formats, perhaps with the right adapter. I've been looking at existing parser generation systems, such as lex/yacc, SPARK and Plex. They all seem to be designed to verify every character in the file, so I lose some of the performance given the guarantee of having a valid format. They also prefer having a good context free grammer, as compared to the stateful one I have. While they do allow the lexer to have different states, the specification for doing so isn't very natural (IMHO). Or to put it another way, the author of the lex/yacc O'Rielly book says he did a FORTRAN parser purely in lex because yacc didn't work very well. I think that's relevant, since the formats I deal with have the same sort of feel as I expect a FORTRAN parser to work. Indeed, what I'm envisioning is more like a super-scanner than a parser, since the formats I need this system for are almost all regular in nature, rather than context free. So! Since what I think I'm looking for doesn't seems to exist in the toolsets I'm used to using, I'm going to have to write something (most likely writing to mxTextTools or Plex for the back end). Since I doubt I'm working on a unique situation, I figure there must be existing code that does this which I haven't heard about, or at least papers describing it. I don't know exactly what I'm looking for, so any pointer would be nice. BTW, the implementation for what I'm thinking about feels pretty straight-forward, but I think it's best to compare what others have done. "It", to reiterate, is a generator for event-based parsers which are optimized to create events only for selected subsets of a given (regular?) grammer and which can make the assumption that the input file is in the correct format. Andrew Dalke dalke at acm.org From robin at jessikat.demon.co.uk Fri Apr 21 05:55:26 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 21 Apr 2000 10:55:26 +0100 Subject: finding real $0 Message-ID: Is there any pythonic way to locate the original argument zero of the process? I mean the location of python itself not the script. This would allow me to launch subscripts without having to rely on the path being set up correctly. -- Robin Becker From scarblac-spamtrap at pino.selwerd.nl Sun Apr 30 18:39:20 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 30 Apr 2000 22:39:20 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8ecsgj$6lp$1@slb0.atl.mindspring.net> <300420001008012011%pecora@anvil.nrl.navy.mil> Message-ID: Ben Wolfson wrote in comp.lang.python: > On Sun, 30 Apr 2000 21:27:35 GMT, ben at co.and.co wrote: > > >Samuel A. Falvo II wrote: > >> I would write something like this: > >> > >> uint32 WriteData( void *buffer, char *pString, uint32 cbString ) > >> > >> This tells me that WriteData() takes as parameters a buffer, a pointer to a > >> string, and the number of bytes in the said string. I fail to see how this > >> is somehow hard to read. :) > > > >OK, let's bite :-) > > > > int WriteData(void *buffer, char *str, int len) > > > >I fail to see how this is somehow hard to read :-) > > For me, actually, it's easier to read, since I don't have to wonder > why the int parameter is "cbString". That "cb" means "count of bytes" > is not intuitively obvious. "len" or "length" is much easier. For me too. "cbString" sounds like some sort of string. Why is it pString, but not pBuffer, btw? -- Remco Gerlich, scarblac at pino.selwerd.nl 12:38am up 55 days, 12:54, 7 users, load average: 0.08, 0.02, 0.01 From python at rose164.wuh.wustl.edu Sat Apr 1 13:40:16 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Sat, 1 Apr 2000 12:40:16 -0600 Subject: Python Threading and sys.exit() codes References: <0532446FBA0ED31193BD00A0C92C53AB0134460A@billtcat.serviceware.com> Message-ID: <004701bf9c0c$f84b7aa0$0201a8c0@spkydomain> ----- Original Message ----- From: "Bob Dickenson" To: "'David Fisher'" ; "Bob Dickenson" Cc: Sent: Saturday, April 01, 2000 9:56 AM Subject: RE: Python Threading and sys.exit() codes > These are good suggestions. A couple of questions/comments. You got lucky, normally my suggestions are pretty lame. :) > > I thought about using the Queue model, but I was experimenting with MxStack > at the time. It seemed to work fine, so... > > I think I need the global lock to get proper thread sync because I have to > pop values off two stacks for each "job" - the file to be ftp'd and it's > time stamp on the source machine (for resetting it locally after the > ftp.retrbinary so that the next time the job runs it does valid date > compares.) If I'm missing something with this logic, I'd appreciate a > clarification. (I suppose I could compose a tuple and push/pop that, but > otherwise....) > Yes, that was exactly what I was thinking of, pushing a tuple or list. Hey, if you've already done the work and it's doing the job, don't mess with it. I just think Queues are cool. I'll attach a program that was inspired by your first post. > I have read the thread doc and know that the sys.exit() in the FTPthread > class def is bogus on my part--part of the "prettifying" the code needs (mea > culpa). > > It's the sys.exit() (explicit or implied) from the __main__ thread after the > iterative thread.join of the ftp worker threads finishes that seems to be > causing me problems. The process isn't "finishing" from the perspective of > the job scheduler. The single-threaded version surfaces both an implied or > explicit exit code to the OS, the multi-threaded version does not surface > anything. The SMTP message gets sent (last item before the sys.exit() in > __main__) AND the command shell window closes, but something seems to be at > loose ends on the process termination cleanup side. Well one thing you might try it to call setDaemon(1) for the worker threads before start(). In threading.py sys.exitfunc() is overriden for the main thread. Sys.exitfunc() is called by the interpreter for cleanup after a sys.exit(). It sounds like your program is hanging inside there. Setting all the threads to daemonic should bypass the logic in the new sys.exitfunc(). I'm still a little confused though. The only thing sys.exitfunc() seems to do it join() to all the non-daemon threads, and you've already done that, so it shouldn't hang. But it's worth a try. If it were me, I would hack threading.py to not override sys.exitfunc() to see if that fixed the problem. > > (BTW - the single threaded version of this program had about 60 files per > minute throughput on the ftp; with 12 worker threads I'm getting between > 800-1000 files per minute. The flux rate on the target site is several > thousand files per day, so it's really worth it to use the multi-threaded > version) Yeah, threads kick butt. After your first post, I got to thinkin' about Queue and threads and wrote this program to scan the internet randomly for NNTP servers that allow public access. So thanks, I got some inspiration from you. Good luck, David from nntplib import NNTP from Queue import Queue import thread import whrandom ##import daemonize def checkserv(servq,repq): while 1: serv = servq.get() try: nn = NNTP(serv) except: repq.put((serv,'')) else: repq.put((serv,'connect')) def randurl(servq): rip = str(whrandom.randint(0,255)) for i in range(3): rip = rip + '.' + str(whrandom.randint(0,255)) try: rurl = socket.gethostbyaddr(rip)[0] except: servq.put(rip) else: servq.put(rurl) def main(): N_THREADS = 100 ## daemonize.become_daemon() f = open('openserv.txt','w') servq = Queue(0) repq = Queue(0) for i in range(N_THREADS * 2): thread.start_new_thread(randurl,(servq,)) for i in range(N_THREADS): thread.start_new_thread(checkserv,(servq,repq)) while 1: resp = repq.get() if resp[1]: f.write(`resp[0]`) f.flush() thread.start_new_thread(randurl,(servq,)) From karl at ulbrich.org Wed Apr 26 13:57:24 2000 From: karl at ulbrich.org (Karl G. Ulbrich) Date: Wed, 26 Apr 2000 13:57:24 -0400 Subject: PIL compile/make bombs out at step #7 -- help? Message-ID: <20000426135724.A26663@exeter.exeter.org> I'm stuck trying to compile PIL. My environment is a standard Slackware 7.0 Linux instalation (Python 1.5.2, but the distribution version, not custom). The install bombs out in step #7 of the readme, which is mentioned as a problem spot... however, I modifed Setup.in to point to /usr/include, and checked to see that yes, there's a python1.5 directory in there and yes, it has lots of .h files. make -f Makefile.pre.in boot blows up as shown below (sorry for the lengthy garbage, but I'm -very- new th this whole "compile" world and figured the extra debug info couldn't hurt much). Thanks for any suggestions, Karl Ulbrich karl at ulbrich.org ...................................... rm -f *.o *~ rm -f *.a tags TAGS config.c Makefile.pre python sedscript rm -f *.so *.sl so_locations VERSION=`python -c "import sys; print sys.version[:3]"`; \ installdir=`python -c "import sys; print sys.prefix"`; \ exec_installdir=`python -c "import sys; print sys.exec_prefix"`; \ make -f ./Makefile.pre.in VPATH=. srcdir=. \ VERSION=$VERSION \ installdir=$installdir \ exec_installdir=$exec_installdir \ Makefile make[1]: Entering directory `/home/caribou/proj/pil/Imaging-1.0' sed -n \ -e '1s/.*/1i\\/p' \ -e '2s%.*%# Generated automatically from Makefile.pre.in by sedscript.%p' \ -e '/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p' \ -e '/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p' \ -e '/^CCC=/s/^CCC=[ ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \ -e '/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p' \ -e '/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p' \ -e '/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \ -e '/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p' \ -e '/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p' \ -e '/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p' \ -e '/^LIBC=/s/^LIBC=[ ]*\(.*\)/s%@LIBC[@]%\1%/p' \ -e '/^RANLIB=/s/^RANLIB=[ ]*\(.*\)/s%@RANLIB[@]%\1%/p' \ -e '/^MACHDEP=/s/^MACHDEP=[ ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \ -e '/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p' \ -e '/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \ -e '/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \ -e '/^LINKFORSHARED=/s/^LINKFORSHARED=[ ]*\(.*\)/s%@LINKFORSHARED[@]%\1%/p' \ -e '/^prefix=/s/^prefix=\(.*\)/s%^prefix=.*%prefix=\1%/p' \ -e '/^exec_prefix=/s/^exec_prefix=\(.*\)/s%^exec_prefix=.*%exec_prefix=\1%/p' \ /usr/lib/python1.5/config/Makefile >sedscript echo "/^#@SET_CCC@/d" >>sedscript echo "/^installdir=/s%=.*%= /usr%" >>sedscript echo "/^exec_installdir=/s%=.*%=/usr%" >>sedscript echo "/^srcdir=/s%=.*%= .%" >>sedscript echo "/^VPATH=/s%=.*%= .%" >>sedscript echo "/^LINKPATH=/s%=.*%= %" >>sedscript echo "/^BASELIB=/s%=.*%= %" >>sedscript echo "/^BASESETUP=/s%=.*%= %" >>sedscript sed -f sedscript ./Makefile.pre.in >Makefile.pre /usr/lib/python1.5/config/makesetup \ -m Makefile.pre -c /usr/lib/python1.5/config/config.c.in Setup -n /usr/lib/python1.5/config/Setup bad word *noobjects* in _imaging _imaging.c decode.c encode.c map.c display.c outline.c path.c -IlibImaging libImaging/libImaging.a -I/usr/include -L/usr/lib -ljpeg -I/usr/include -L/usr/lib -lz *noobjects* make[1]: *** [Makefile] Error 1 make[1]: Leaving directory `/home/caribou/proj/pil/Imaging-1.0' make: *** [boot] Error 2 ----- End forwarded message ----- From effbot at telia.com Tue Apr 11 12:23:38 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 16:23:38 GMT Subject: issubclass funny business References: Message-ID: Les Schaffer wrote: > but when i need to test whther an object is an instance of a subclass > of StandardArrayFileScanner: > > # make sure std is of the correct type > if not issubclass(std.__class__, StandardArrayFileScanner): how about: if not isinstance(std, StandardArrayFileScanner): > import cie > print std.__class__, cie.CIE.__bases__ > raise NotStandardArrayError > > > but it doesnt work, even though std is of type cie.CIE : > > (gustav)~/Engineering/dspring/stoplite/matlab/Jue-Data/: python FileScanner.py > > cie.CIE (,) <=== result of print stmt > > huh?????? you have two different StandardArrayFileScanner classes. when you run FileScanner as a script, it's evaluated in the __main__ namespace. when you import it, it's evaluated again, in the FileScanner namespace. solution: never import the script you use as the main program. also see the last section on this page: http://www.pythonware.com/people/fredrik/fyi/fyi06.htm From Henning.Schroeder at Informatik.Uni-Oldenburg.DE Thu Apr 6 15:53:41 2000 From: Henning.Schroeder at Informatik.Uni-Oldenburg.DE (Henning Schroeder) Date: Thu, 06 Apr 2000 21:53:41 +0200 Subject: alphanumerics in mails In-Reply-To: <029501bf9eda$0dd8e2c0$858647c1@DEVELOPMENT> References: <029501bf9eda$0dd8e2c0$858647c1@DEVELOPMENT> Message-ID: In comp.lang.python, you wrote: >I've made a small mail-client which is working very good, except for when I >get mails with alphanumerics (which happens quite often since I'm in >scandinavia;). >If I send a mail with subject: >'Ett ?' >The subject line in my mailclient will say: >'=?iso-8859-1?Q?Ett_=E5?=' >Is there some kind of parser for this, has someone made anything like this >or do I have to make one? Use mime_decode_header from the mimify module Greets from Germany Henning From moshez at math.huji.ac.il Tue Apr 25 01:13:43 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 25 Apr 2000 08:13:43 +0300 (IDT) Subject: Simple list.append() question In-Reply-To: Message-ID: On Mon, 24 Apr 2000, Bill Wilkinson wrote: > l = [[][:]] * 3 No, this won't work. From tismer at tismer.com Mon Apr 3 05:43:39 2000 From: tismer at tismer.com (Christian Tismer) Date: Mon, 03 Apr 2000 11:43:39 +0200 Subject: Q: List and Dicts as default args References: <326536345498D311B3BC00105A39802A074654@newsintern.dspace.de> Message-ID: <38E867CB.D47BD1D2@tismer.com> Stefan Migowsky wrote: > > Hi, > > I was just wondering how to handle lists and dictionaries in > a simple way as default arguments to functions. Since following > strange behaviour occured : [Stefan, exploring the side effects of mutable default parameters] > This behaviour only occurs with dictionaries and list. All other > types are "well" behaved. I could try the following but that > doesn't look so nice: > > def f(Index,List = None, Dict = None): > if not List: List = [] > List.append(1) > List.append(2) > print List > if not Dict: Dict = {} > Dict[Index] = Index > print Dict The above is correct. When supplying default args, you need to take care of possible side effects. Lists and dicts are mutable objects, and the default assignment is done at compile time. You can use "real" values as defaults if: - they are immutable, like ints, strings, tuples - they are only used for lookup (not changed) - you *want* to change state permanently In all other cases, use something like you did above. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 we're tired of banana software - shipped green, ripens at home From Peter.Desaulniers at pahv.xerox.com Mon Apr 10 14:30:23 2000 From: Peter.Desaulniers at pahv.xerox.com (Desaulniers, Peter) Date: Mon, 10 Apr 2000 11:30:23 -0700 Subject: Actually Running a function from a DLL Message-ID: <51B8ABCE456FD111899900805F6FD6EE071E9108@mercury.ADOC.xerox.com> Writing C extensions for the first time is a daunting task. The best source of information that I am aware of are: 1. The API is described, minimally, on the Python web site 2. Some of the python source header files have lengthy comments that explain some important concepts. 3. Internet Programming with Python by Watters, van Rossum and Ahlstrom has a decent chapter on C extensions. But you will still need to read the headers indicated in #2. Getting the call mechanism will be fairly straightforward with the above information. The challenge will be understanding object management. The proper use of INCREF and DECREF is a difficult concept to get right. Improper INCREF may leak (maybe you don't care) and improper DECREF may crash you due to a prematurely cleaned up reference (you will care about that one). In terms of how rapidly you can learn to do C extensions (that run correctly on all systems... beware, want may work on Windows NT, no longer works on Win2000 in some complex models), you may need to save your appetite unless you have some really savvy developers. Good luck. > -----Original Message----- > From: Peter Olsen [mailto:pcolsen at draper.com] > Sent: Friday, April 07, 2000 6:13 PM > To: python-list at cwi.nl > Subject: Actually Running a function from a DLL > > > I'm writing ask for a quick explanation of how to load and > use dll files > from Python running under MS Windows. > > I have installed PythonWin and win32all, but I seem to be completely > unable to run a function from a dll. I'm loading the dll with > win32api.LoadLibrary, but I can't figure out how to access the > functions. I've made some statements about how fast we can > learn Python > and the start development, but if I don't find an answer > quickly, I may > have to eat my words. If the best answer is "RTFM," please give me a > hint as to where in TFM I should R. > > I would greatly appreciate receiving answers by email because > my company > makes it hard to read news. > > Thanks! > > Peter > > > -- > http://www.python.org/mailman/listinfo/python-list > From jnw22 at cam.ac.uk Tue Apr 11 09:21:33 2000 From: jnw22 at cam.ac.uk (James "Wez" Weatherall) Date: Tue, 11 Apr 2000 14:21:33 +0100 Subject: Why should I switch to Python? References: Message-ID: <8cv8st$hjc$1@pegasus.csx.cam.ac.uk> > Yorkshire. Which is a great place to be from. In particular, Knaresborough. :) From arta at x-stream.nl Thu Apr 13 08:41:27 2000 From: arta at x-stream.nl (A[r]TA) Date: Thu, 13 Apr 2000 14:41:27 +0200 Subject: windows registry Message-ID: Heyz.. How do I edit the windows registry with Python? Thnx, A[r]TA -- We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time. - T. S. Eliot From Andreas.Cardeneo at mach.uni-karlsruhe.de Fri Apr 7 08:54:19 2000 From: Andreas.Cardeneo at mach.uni-karlsruhe.de (Andreas Cardeneo) Date: Fri, 07 Apr 2000 14:54:19 +0200 Subject: CGI Help Needed References: <8ck9uo$ga08@imsp212.netvigator.com> Message-ID: <38EDDA7B.47FC3FDE@mach.uni-karlsruhe.de> > > What is the normal and respected method of User authentication on a web > site, how should I present a login box when the user is not authenticated > already, and how do I maintain a session with an authenticated user, without > using cookies, allowing them to continue surfing around the web site ? Hi, well. I think you're right that this is not exactly Python specific, but you might use Python in a CGI-script to look up session-keys. If you have a look at PHP, then you will see that there is a function to generate a session key (some large number that can not be guessed easily and has some checksum in it) that you pass to your pages as a URL paramter in the form "?session=4242424242424242&nextpar=....". You then evaluate the key in your script looking it up in a database or file and checking if it is still valid. I would certainly not use JavaScipt to authenticate the user because the implementations have some security problems. If I remember correctly Microsoft had problems on their Hotmail-system with Javascript. One possibility would be to use the .htaccess file of a directory and let the browser/server check authorization. But that's probably a bad idea for larger sites. You could better use a form within a frame on your page so the URL is not being displayed in the browser location line (but in the HTML code it is). Hope this helps, Andreas From snoopyy at ms11.hinet.net Tue Apr 25 11:10:25 2000 From: snoopyy at ms11.hinet.net (¤ý©y»Ê) Date: Tue, 25 Apr 2000 23:10:25 +0800 Subject: ·Q·Q ·í¦ÑÁó ¥s§A±N ¸ê®Æ®wªº¸ê®Æ ¿é¤J¨ì ¬Y­Óºô­¶¥h ¡A¤Ñ¨º ?? À°À°§Ú§a!! Message-ID: <8e4cc2$d5t@netnews.hinet.net> ?Q?Q ?????? ?s?A?N ?????w?????? ???J?? ?Y???????h ?A???? ?? ???????a!! -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ?? ?] ?? ?^ ?]???^ ???^ ?? ?]?? ?????? ?]?? ???? ???U?? ???U?? ?]?_?_ ?]?U ?]?U?^ ?U?^ ?U ?]?? ?? ???@ ?? ?? ?] ?? ?^ ?] ?^ ?] ?@ ?? ?? ???`?` ???? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ?{?????n?g???h..???????n?????[..?_???????a!! ?i?????j ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From phd at phd.russ.ru Thu Apr 27 06:03:54 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 27 Apr 2000 10:03:54 +0000 (GMT) Subject: How can I get the name of an object??? In-Reply-To: <8e9090$c4d$1@nnrp1.deja.com> Message-ID: On Thu, 27 Apr 2000 spex66 at my-deja.com wrote: > > An object could be referred to by any number of names: > > > > dd = zz () > > ee = dd > > > > Which name for the object do you wish to know? ee or dd? > dd or in other words, the name of the FIRST made instance... I tried to dd = zz () ee = dd del dd What is the name now? (ee still holds the reference to the object) Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From m.faassen at vet.uu.nl Wed Apr 26 10:16:09 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 26 Apr 2000 14:16:09 GMT Subject: how would i make a HTML type UI? References: <000f01bfaf6b$0c9c6200$2801000a@iel.ie> Message-ID: <8e6tn9$gvq$1@newshost.accu.uu.nl> Shaun wrote: > how would i create a HTML type user interface using python which would take > in say, -name-address-date of birth- and record it with the intention > of struct.pack-ing the values entered, I'm not quite sure what you mean by struct.pack-ing the values entered, but for information on web programming with Python look here: http://www.python.org/topics/web/ For a very powerful system based on Python for building web applications, look at Zope: http://www.zope.org Good luck! Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From embed at geocities.com Fri Apr 7 09:07:16 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 7 Apr 2000 09:07:16 -0400 Subject: "tostring" as a string method? References: <8c45ue$b7u$1@slb1.atl.mindspring.net> <8ck7kq$1cu$1@slb3.atl.mindspring.net> Message-ID: > > Meanwhile, on the biopthon.org list, Jeff Chang pointed out that > __str__ is in general an ill-defined quantity. The usual > interpretation is that __str__ returns a human-representation while > __repr__ returns a computer representation. So using __str__ > to return the character stream is not the right interface. We're > now using "tostring()", which is more obvious. > Hmm. Have you considered marshalling everything instead? Warren From kragen at dnaco.net Sat Apr 22 19:49:03 2000 From: kragen at dnaco.net (Kragen Sitaker) Date: Sat, 22 Apr 2000 23:49:03 GMT Subject: code not true? References: Message-ID: In article , John W. Baxter wrote: >Various alternate representations are possible which are exact (such as >BCD floating point of sufficient precision, rational numbers with >(potentially) Python longs as numerator and/or denominator, some >interesting recent work I haven't followed, etc etc etc). Well, back in the 1970s, Gosper proposed to represent all computable numbers exactly as continued fractions --- see HAKMEM for the details. I haven't implemented it, but it looks like it should only be one or two orders of magnitude slower than using standard integers or floating-point (for normal uses, of course --- printing out pi to the thousandth place will be slower in the continued-fraction form than in the floating-point form, but that's because the continued-fraction output is correct.) There has been other, more recent work I haven't followed either. -- Kragen Sitaker The Internet stock bubble didn't burst on 1999-11-08. Hurrah! The power didn't go out on 2000-01-01 either. :) From kajiyama at grad.sccs.chukyo-u.ac.jp Thu Apr 6 10:44:22 2000 From: kajiyama at grad.sccs.chukyo-u.ac.jp (Tamito Kajiyama) Date: 06 Apr 2000 14:44:22 GMT Subject: Codecs for Japanese character encodings Message-ID: Based on the Python Unicode support proposal, I wrote codecs for two Japanese character encodings EUC-JP and Shift_JIS. The codecs are available at the following location: http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/tmp/japanese-codecs.tar.gz Comments and suggestions are very appreciated. Enjoy, -- KAJIYAMA, Tamito -- KAJIYAMA, Tamito From nmm1 at cus.cam.ac.uk Sat Apr 15 05:19:02 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 15 Apr 2000 09:19:02 GMT Subject: else clauses in while and for loops References: <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> Message-ID: <8d9c66$el7$1@pegasus.csx.cam.ac.uk> In article <38F79B93.B03F0A6B at mindspring.com>, Chuck Esterbrook wrote: >So did anyone present, in this thread, an example that shows a real need? Whether or not they have one, there is a fairly common case: Perform an action XXX provided that no member of sequence YYY fulfils a particular criterion. Yes, you can also use exceptions for this, but the 'else' construct is clearer and probably more efficient. Actually, I would prefer a different way of doing this, but that is another matter. Python is Python and not some other language. Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From Michael.Scharf at gmx.de Wed Apr 19 16:40:45 2000 From: Michael.Scharf at gmx.de (Michael Scharf) Date: Wed, 19 Apr 2000 22:40:45 +0200 Subject: SNiFF+ for Linux References: Message-ID: <38FE19CD.385CCD64@gmx.de> Robert Hicks wrote: > > There was a "how-to" to integrate Python into SNiFF+. I have 2 questions > regarding this: > 1. Does anyone have this info? The how-to is at http://starship.python.net/crew/scharf/sn4py Unfortunately, starship is down at the moment. I did the integration for an older version of SNiFF and Python. I don't think that the debugger integration runs out of the box. > 2. Does it work with the free Linux version that only supports C/C++? I simply don't know what is in the free linux version. But I think it is the full distribution with a restricted license. Fortunately, the pythonparser has no license (since it is not officially supported). So, add the Python file-type to new projects and it should work fine. I think the restriction is a few hundred files. That will hit you, if you want to browse the entire python-lib. But yes, it works fine for browsing and editing. Cross-ref doesn't work, but that is hard (probably impossible) for a dynamically typed language. If you start sniff as % sniff --GUI.Tools.ED.SmartComments even "comment region" will work for python. (It's enough to call sniff once with this option, open the preferences and hit OK: sniff will then remember the option in the user preferences.) Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software GmbH, a Wind River Company ` > http://www.WindRiver.com \_ V mailto:Michael.Scharf at gmx.de From mwh21 at cam.ac.uk Sat Apr 1 07:43:42 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 01 Apr 2000 13:43:42 +0100 Subject: Paid to work in Python? (was: Re: Choice Of Language) References: <8ajmib$elo$1@nnrp1.deja.com> <8c3ats$b5f$1@nntp.Stanford.EDU> Message-ID: nobody at nowhere.nohow (Grant Edwards) writes: > In article <8c3ats$b5f$1 at nntp.Stanford.EDU>, Amit Patel wrote: > > >I do 100% of my professional development in Python, too. Google's > >using a lot of Python and C++, and fortunately I get to do my work in > >Python. :-) > > > >I should post Google's Python-related job openings to > > http://www.python.org/Jobs.html > > Pointless tanget: Is it just me, or is Google really the last usable search > engine? > I'd have said that it was the first, last and only really usable search engine. I used to be amazed at its accuracy, but now I just get narked by the inaccuracy of every other engine I use (not very many...). Not affiliated with google, just a very satisfied user (though if they *want* to give me a job...). Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From aa8vb at yahoo.com Tue Apr 18 08:25:04 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Tue, 18 Apr 2000 08:25:04 -0400 Subject: IDLE 0.5: Odd NumTut import results Message-ID: <20000418082504.A417909@vislab.epa.gov> >From the command-line: > python Python 1.6a2 (#2, Apr 17 2000, 12:17:27) [C] on irix646-n32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> from Numeric import * >>> from NumTut import * >>> No problem. >From within IDLE (started from the same shell): Python 1.6a2 (#2, Apr 17 2000, 12:17:27) [C] on irix646-n32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam IDLE 0.5 -- press F1 for help >>> from Numeric import * >>> from NumTut import * Traceback (innermost last): File "", line 1, in ? from NumTut import * File "NumTut/__init__.py", line 11, in ? from view import * File "/home/rhh/software/pythonutil/NumTut/view.py", line 146, in ? class ThreadedTk(Thread): NameError: Thread >>> -- Randall Hopper aa8vb at yahoo.com From smalleys at gte.net Thu Apr 20 00:35:29 2000 From: smalleys at gte.net (sue) Date: Thu, 20 Apr 2000 04:35:29 GMT Subject: Very Horrible Question About Goto's References: <6325E90C8B6ED21189080001FA7E2ADA0D4051@IBA1><2hkL4.8514$5D.18609@ozemail.com.au> Message-ID: <38FE8924.F2F9FFF0@gte.net> Simple blocks can be translated, which is probably the infamous 80% of your code. The remaining 10-20% probably isn't worth the effort; rewrite it. We did have a bit more luck when we added "hints", based on data, context, and so on, but 5-10% needed a redesign. Good luck. Sue. From lexberezhny at email.msn.com Sat Apr 1 16:53:56 2000 From: lexberezhny at email.msn.com (lexberezhny) Date: Sat, 1 Apr 2000 16:53:56 -0500 Subject: Python/GTK on Windows? References: <#XSVXB5m$GA.240@cpmsnbbsa03> <8c5m42$1dv@gap.cco.caltech.edu> Message-ID: Thanks you very much. - Lex Robert Kern wrote in message news:8c5m42$1dv at gap.cco.caltech.edu... > In article <#XSVXB5m$GA.240 at cpmsnbbsa03>, > "lexberezhny" writes: > > Hi, > > I was wondering if anyone was able to get PyGTK to work on windows, and if > > its possible at all. I am trying to port a Linux app to windows that uses > > PyGTK. If you know anything about this or can point me in the right > > direction, I would really appreciate it. Thanks. > > http://theopenlab.uml.edu/pygtkwin/ > > > - Lex Berezhny > > -- > Robert Kern > kern at caltech.edu > > "In the fields of hell where the grass grows high > Are the graves of dreams allowed to die." > -- Richard Harter From Lisowski.Tomasz at sssa.nospam.pl Fri Apr 7 00:23:52 2000 From: Lisowski.Tomasz at sssa.nospam.pl (Tomek Lisowski) Date: Fri, 07 Apr 2000 04:23:52 GMT Subject: Odp: Creating variables on the fly... References: <38E8EFF0.D71D0415@gmd.de> Message-ID: U?ytkownik Joachim Kaeber w wiadomooci do grup dyskusyjnych napisa?:38E8EFF0.D71D0415 at gmd.de... > Hi, > > what about this: > > def add(*args): > sum=0 > for arg in args: > sum=sum+arg > return sum > > add(1,2,3,4) > => 10 > > add (1,2,3,4,5,6,7) > => 28 Why not: def add(*args): return reduce(lambda x, y: x+y, args) I am not completely sure, but it may be faster, than a Python for loop Tomasz Lisowski > > > Matthew Hirsch wrote: > > > > Hi All, > > > > Let's say I have four variables: > > > > a=1 > > b=2 > > c=3 > > d=4 > > > > And I have a function that adds these variables together: > > > > def add(a,b,c,d): > > return a+b+c+d > > > > But now let's say I have twenty variables that I want to add together. > > This function will no longer work. I would have to rewrite it as > > a+b+c+d+e+f+g+...+(20th letter). Is there a way to dynamically create a > > variable name? So that my add function can automatically determine how > > many variable names to create and then add the values together. In > > other words, I'd ideally like something like: > > > > def add(number_of_variables): > > return a+b+c+...+(letter corresponding to number_of_variables) > > > > Thanks for your help, > > > > Matt > > -- > Joachim Kaeber (kaeber at gmd.de) (http://imk.gmd.de/~kaeber) > GMD - Forschungszentrum Informationstechnik GmbH > - German National Research Center for Information Technology > Schloss Birlinghoven email: kaeber at gmd.de > D-53757 Sankt Augustin 1, Germany phone: (+49 2241) 14-2546 From bwilk_97 at yahoo.com Sat Apr 8 18:11:58 2000 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Sat, 08 Apr 2000 22:11:58 GMT Subject: tabular data References: <8co4l2$5r2$1@nnrp1.deja.com> Message-ID: << <8c794n$mjq$1@zingo.tninet.se> Message-ID: In article <8c794n$mjq$1 at zingo.tninet.se>, Andr? Dahlqvist wrote: > > all in all, *emacs* has lots of shortcuts for handy things. I wish I > > knew more about it.. :) > > While we're on the subject of Emacs Python mode, why is it that I can't > indent a line under a line which has been commanted out? Emacs > refuses to let me tab in there, but if I remove the comment it will > happily > let me do it. Experiment with whether or not there is a space following the # --John (who didn't fully understand that part of the fine manual and hasn't experimented much) -- John W. Baxter Port Ludlow, WA USA jwbnews at scandaroon.com From donn at u.washington.edu Mon Apr 17 17:53:34 2000 From: donn at u.washington.edu (Donn Cave) Date: 17 Apr 2000 21:53:34 GMT Subject: else clauses in while and for loops References: <2JKK4.325$vr2.19414@news.uswest.net> <38DD2EE3.C7F3CB54@webamused.com> <8boe2k$gmh$1@inputplus.demon.co.uk> <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> Message-ID: <8dg14u$f08$1@nntp6.u.washington.edu> Quoth "Jeff Massung" : | I'm new to Python, so perhaps I'm miss reading something in these posts, but | it appears as though the "else" statement (especially in while loops - | unless infinite) always get executed regardless. | | i = 0 | while i<=5: | i = i + 1 | print i | else: | print 10 | | should spit out "1 2 3 4 5 10" right? Yes, but if you look at the examples, they also use "break". After a loop, "else" basically means "if no iteration of the loop met the conditions to break out." It's a common usage, where in C we'd compare the final loop index with the maximum (or whatever) loop index to see if the loop ran all the way through. | Now a use that I could definitely see for the "else" would be if the loop | were never entered at all! Example: | | i = 6 | while i<=5: | i = i+1 | print i | else: | print 10 | | would print "10", and if 'i' started at 0, would print "1 2 3 4 5". | | That could definitely be useful, because it would eliminate an "if" | statement right before the "while" statement. Extremely useful for debugging | purposes. I think I would go along with that if you took out "Extremely" - and then your paragraph would justify better on the right margin, too! Seriously, "else" does invariably execute if the loop was never run once, but as mentioned above it also executes in other circumstances. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From gmcm at hypernet.com Tue Apr 11 10:29:11 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 11 Apr 2000 10:29:11 -0400 Subject: Thread-safe atomic operation In-Reply-To: <8cuf0o$p9a$1@news1.kornet.net> Message-ID: <1256659126-41087547@hypernet.com> Dong-gweon Oh writes: > Are these statements thread-safe? > 1. import xxx > 2. xxx = __import__('xxx') > 3. reload(xxx) > 4. dict['xxx'] = sys.modules['xxx'] > 5. dict.has_key('xxx') Numbers 2 and 4 could be interrupted between evaluation of the RHS and assigment to LHS. For #2 that would be of concern only if xxx was a global. - Gordon From hdiwan at rpi.edu Wed Apr 5 10:31:38 2000 From: hdiwan at rpi.edu (Hasan Diwan) Date: 5 Apr 2000 14:31:38 GMT Subject: Why should I switch to Python? - Infinity of Primes References: <8ccoug$f4o$1@pegasus.csx.cam.ac.uk> <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> <38EA369C.26A1C25@math.okstate.edu> <38EAC8C4.ADC25640@cosc.canterbury.ac.nz> Message-ID: <8cfioa$qvc$1@newsfeeds.rpi.edu> Proof of infinity of primes by contradiction:= Suppose there is a finite number of primes p, where p is the set of all primes up to p[k]. Now multiply all the elements of p together. You now have a number that is a product of primes, add 1 to this number, and you have a new prime, so my assumption is bogus and there are an infinite number of primes. -- Hasan Diwan [hdiwan at pobox.com] :) Rensselaer Polytechnic Institute Computer Science Department http://forsythe.dhs.org/~hdiwan From mhammond at skippinet.com.au Thu Apr 13 23:09:49 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 14 Apr 2000 03:09:49 GMT Subject: windows registry References: <8d5h78$fpq$1@nnrp1.deja.com> Message-ID: <1_vJ4.809$1D.5094@news-server.bigpond.net.au> Note that in Python 1.6, there is a "winreg" standard module - ie, no need for the win32 extensions. This is taken from the win32api sources. The relevant differences are: * The module name has obviously changed! The winreg module will raise winreg.error (which happens to be thenew standard WindowsError exception object, derived from OSError, derived from EnvironmentError, derived from StandardError - so any of these error objects will catch the exceptions!) * The function names have changed (eg, win32api.RegCreateKey -> winreg.CreateKey) * Security information is not supported - none must be passed to all winreg functions that accept security information. * winreg has docstrings, win32api has help files :-) Apart from that, all args and usage are identical to the win32api functions. Thus, in the general case, code can be changed to use winreg from win32api with a couple of search-and-replaces! Mark. From cut_me_out at hotmail.com Wed Apr 26 09:52:43 2000 From: cut_me_out at hotmail.com (Alex) Date: 26 Apr 2000 09:52:43 -0400 Subject: Metaclasses? References: <3905F4A0.2B39C705@darmstadt.gmd.de> <200004261201.IAA05678@zippy.init.com> Message-ID: Such a fine comrade you are Michael! Raising (meta)class consciousness and speeding the arrival of universal selflessness in one fell swoop! Alex. From bawolk at pacbell.net Thu Apr 20 00:19:39 2000 From: bawolk at pacbell.net (Bruce Wolk) Date: Wed, 19 Apr 2000 21:19:39 -0700 Subject: Tkinter aspect question Message-ID: <38FE855B.79F7881A@pacbell.net> I am trying to create a square window that will remain square when its size is adjusted. I found the aspect method, which looked promising, and tried the following: from Tkinter import * master=Tk() win = Toplevel(master) win.geometry('400x400+100+100') win.aspect(1.0,1.0,1.0,1.0) This does not work, i.e., the window does not maintain its aspect. Can anyone help me out? Thanks. Bruce From jmassung at magpiesystems.com Wed Apr 19 11:12:55 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Wed, 19 Apr 2000 09:12:55 -0600 Subject: Python in the future References: <38FDB8A7.E701F81F@sec.noaa.gov> Message-ID: <8ZjL4.273$CP3.3311@news.uswest.net> IMHO, C++ will DEFINITELY be here 10 years from now, as will assembler - they are just inherent in computers - the core languages (used to make Python, Java, Basic, etc). But I personally think that as computers grow in speed exponentially, and the internet becomes much faster (10 years, maybe everyone will have T1 access?) interpreted languages will be increasingly more important and used widespread - not for sale (because the code is needed), but rather for distribution within a business, or with other programs, the web, etc. Of course I'm refering to interpreted languages as a whole. Now to just Python. I am new to Python, but being an accomplished C/C++ programmer, I have already begun seeing the power and use of Python. And like Java (and I believe unlike Perl) has a great following and good programmers commited to its success (Perl I feel is more of a "hack"ing language that people that don't code in other languages use). So to conclude - I feel Python and Java will have a strong presence in the near and far futures. Of course they will be different from how they are today - and possibly in how they are used, but they will be there. Jeff j vickroy wrote in message <38FDB8A7.E701F81F at sec.noaa.gov>... >Hello all, > >I'm relatively new to Python and am trying to gain support for it at my >work place. To that end, I'm giving a brief (overview) presentation. >One of the items I have been asked to consider is where will Python be >5-10 years from now. I certainly don't know where C++ or Java will be >in that time frame! Any ideas on where to research the future plans for >Python would be appreciated. > >Thanks for your time, > >- jv > From bjorn at roguewave.com Tue Apr 4 14:27:19 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Tue, 04 Apr 2000 12:27:19 -0600 Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> Message-ID: <38EA3407.534827DF@roguewave.com> Bob Alexander wrote: [...] > However, too bad about that nasty syntax irregularity that using parens for > tuples presents (1,) (Couldn't resist ;-) [...] Contrary to popular belief, it's actually the comma that creates the tuple, not the parens... As an example, I recently copied code from a dictionary to an assignment a little to hasty: foo = { 'a' : 1, 'b' : 2, } to: a = 1, b = 2, and it took me way to long to figure out where the eventual "unpack tuple of wrong size" error was coming from... *sigh* Serves me righ, I suppose --bjorn From spex66 at my-deja.com Thu Apr 27 05:25:42 2000 From: spex66 at my-deja.com (spex66 at my-deja.com) Date: Thu, 27 Apr 2000 09:25:42 GMT Subject: Namespace Problem with global declaration in module References: <8e6vv9$4n8$1@nnrp1.deja.com> Message-ID: <8e912d$cpi$1@nnrp1.deja.com> hmm, deja is not so fast as my newsreader :), so here is a reply of Gordons message >spex66 at my-deja.com wrote: > >> Hi, >> it seemed very simple but don't worked like expected: >> >> #FILE: test.py >> dd = None #INIT a shadow instance for automated access >> class zz: >> #ONLY one class will be instantiated >> def __init__(self): >> self.name = 'hallo' >> global dd >> dd = self >> #END OF FILE >> >> >>> from test import * > >There's your problem. "from test import *" copies names from >test to your namespace. Now dd is another name for None. >yy() affects the dd in test's namespace, not yours. > >- Gordon I see the point, but I like the from statement :) Is it a bug? It's not the way I expected this code to work... and I cannot find a hook in the documentation that explicit explained this misbehaviour. Any idea for a workaround (I need the from-statement for further code readability)? thanks Peter (=PA=) > >> >>> yy = zz() >> >>> dd.name >> ... >> AttributeError >> ... > Sent via Deja.com http://www.deja.com/ Before you buy. From pinard at iro.umontreal.ca Tue Apr 25 19:46:59 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 25 Apr 2000 19:46:59 -0400 Subject: Sourceforge and Python Message-ID: Hi, people. Bruno Haible is convincing me to put `recode' in an open source environment, like `sourceforge', say. I have been reluctant to CVS so far (for various reasons), and if I was doing such a move, I would like to bring `recode' a bit closer to Python, in one way or another, given this is easily doable. Just to make things clear, `recode' is C code currently, this is not Python. So, merely beginning to explore the possibility, I'm asking for advice on this list, as to if there is environments offering a set of services similar to `sourceforge', but that would be especially Python-using, or Python-aware. Of course, and also given some recent saga reported on this list, stability and availability are parts of the requirements :-). It would be tempted to think such a site might be a better investment of energies in the long run, presumably. But I may also be wrong, and it might not be an important criterion, after all. Tell me if you have an opinion. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jbauer at rubic.com Wed Apr 26 23:24:17 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Wed, 26 Apr 2000 22:24:17 -0500 Subject: Python compiler ? (was Re: Python for drivers?) References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> <3906f804@nntp.server.uni-frankfurt.de> <015b01bfaf8b$9cd03930$0500a8c0@secret.pythonware.com> <39076316@nntp.server.uni-frankfurt.de> <8e7sop$5io$1@nnrp1.deja.com> Message-ID: <3907B2E1.DF6B19B4@rubic.com> [ Discussion about sending somebody $60K to build a better Python mousetrap. ] I haven't kept up with this thread, but from what I've skimmed, most of the posts appear to assume we'd have a useful technology if this project was financed. I don't think this is conclusive, however. I can think of a few ways $60K could be more effectively spent on improving Python. after-budgeting-for-Marketing-we'd-*still*-have-almost- $10,000-to-get-some-work-done-ly y'rs, Jeff Bauer Rubicon Research From mwh21 at cam.ac.uk Tue Apr 11 20:48:19 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 12 Apr 2000 01:48:19 +0100 Subject: issubclass funny business References: Message-ID: Les Schaffer writes: > said: > > > how about: > > if not isinstance(std, StandardArrayFileScanner): > > i tried that first, but same problem. > > > when you run FileScanner as a script, it's evaluated in the __main__ > > namespace. when you import it, it's evaluated again, in the > > FileScanner namespace. > > groan.... its not intuitive (to me). because i can make CIE_Standards > class inherit from FileScanner classes in the udder module no problem > at runtime, so its a surprise to see it won't trace the tree properly > at runtime for isinstance issubclass. > > > solution: never import the script you use as the main program. > > i am only at the testing stage. neither of these modules will be main > at "usage" time. This is definitely a pain. It'd be nice if when you `reload'ed modules that contain classes you could "smash" extant instances of those classes so that they were instances of the new class, but I can't for the life of me see how you might do this. wishful-ly y'rs Michael -- On the other hand, the following areas are subject to boycott in reaction to the rampant impurity of design or execution, as determined after a period of study, in no particular order: ... http://www.naggum.no/profile.html From anthony at dstc.edu.au Wed Apr 26 05:37:52 2000 From: anthony at dstc.edu.au (Anthony J Wilkinson) Date: Wed, 26 Apr 2000 19:37:52 +1000 (EST) Subject: huh? Python says that AttributeError: 'string' object has no attribute 'split' In-Reply-To: <8e62qm$511$1@nnrp1.deja.com> Message-ID: On Wed, 26 Apr 2000 schmitthead at my-deja.com wrote: [...] > Traceback (innermost last): [...] > File "C:\bin\mac2dos.py", line 9, in mac2dosfile > lines = myline.split( myline, chr(10) ) > AttributeError: 'string' object has no attribute 'split' [...] > lines = myline.split( myline, chr(10) ) The above should be: lines = string.split(myline, chr(10)) Regards, Anthony From smalleys at gte.net Thu Apr 20 00:43:13 2000 From: smalleys at gte.net (sue) Date: Thu, 20 Apr 2000 04:43:13 GMT Subject: A tkMessageBox question! References: <38FDC335.B9FDCFE4@icestormfx.com> Message-ID: <38FE8AF6.2A4CDBDA@gte.net> I don't remember the exact syntax, but try: msg = TkMessageBox("text") msg.configure( font = "something_decent" ). You might have to check that the font exists. Sue. From phd at phd.russ.ru Thu Apr 27 10:46:46 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 27 Apr 2000 14:46:46 +0000 (GMT) Subject: DCOracle In-Reply-To: Message-ID: On Thu, 27 Apr 2000, Darren Young wrote: > Any pointers on examples of working code out there? from DCOracle import Connect jwt = Connect("%s/%s@%s" % (login, password, SID)) cursor = jwt.cursor() format = "%s | "*13 + "%s\n" cursor.execute("SELECT * FROM sides_view") while 1: olist = cursor.fetchmany(10) if not olist: break for row in olist: sys.stdout.write(format % row) cursor.close() jwt.close() Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From echuck at mindspring.com Tue Apr 25 10:13:34 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Tue, 25 Apr 2000 10:13:34 -0400 Subject: sys.exit References: <3904C35C.B16BDE75@mindspring.com> <8e2hss$1250$1@nntp6.u.washington.edu> Message-ID: <3905A80E.7A8323F9@mindspring.com> Donn Cave wrote: > > Quoth Chuck Esterbrook : > | The short question: > | > | If I catch a SystemExit exception (because of an invocation of > | sys.exit(code)), how do I examine the argument to sys.exit()? > > ... > | Upon printing the "excInfo" tuple I get: > | > | (, , ) > | > | And the attributes of the SystemExit instance are: > | > | ['__doc__', '__init__', '__module__'] > | > | I don't know how to get my hands on the exit code. > > That's not the instance you're looking at there, but the class, so > that's kind of a red herring. The instance has a 'code' attribute > for you. > > So you need something like > > eclass, einstance, etrace = sys.exc_info() > if eclass == SystemExit: > if einstance.code == 0: > self._errorOccurred = 0 Silly me: I was printing [0] of the tuple rather than [1] by mistake. Don & Tim are both right. The instance has attributes "args" and "code". For my purpose, I prefer using "code". Thanks! -Chuck From danzap_python at yahoo.com.br Thu Apr 13 12:38:28 2000 From: danzap_python at yahoo.com.br (=?iso-8859-1?q?Daniel=20Zapata?=) Date: Thu, 13 Apr 2000 13:38:28 -0300 (ART) Subject: How do I execute a program ? Message-ID: <20000413163828.28296.qmail@web4303.mail.yahoo.com> How do I execute a program or a batch file (under Windows) using python and get the return information ??? Thanks, Daniel ____________________________________________________________________________ YAHOO! BATE-PAPO Conhe?a gente nova, fa?a amigos e divirta-se! - http://www.yahoo.com.br From shae at webwitches.com Tue Apr 18 18:13:03 2000 From: shae at webwitches.com (Shae Erisson) Date: Tue, 18 Apr 2000 22:13:03 GMT Subject: gaming and python References: <000c01bfa91c$f421d6a0$0f8d0b3f@oemcomputer> <8dhifa$aom$1@nnrp1.deja.com> Message-ID: <38FCDF99.352876CE@webwitches.com> sp00fD wrote: > > Well, I'd have a hard time believing that you could program something > like quake, but you could probably do a decent job with tetris or the Maybe you could write quake in python.... Crystalspace is an open source 3D engine that claims to be scriptable with Python. this ripped without permission from http://crystal.linuxgames.com : Crystal Space is a free (LGPL) and portable 3D engine written in C++. It supports: true six degree's of freedom, colored lighting, mipmapping, portals, mirrors, alpha transparency, reflective surfaces, 3D sprites, scripting (using Python or other languages), 8-bit, 16-bit, and 32-bit display support, Direct3D under Windows, Glide and OpenGL on Windows, Linux, OS/2, Macintosh, BeOS, ... See the extensive list of features for more details. Crystal Space currently runs on Linux, general Unix, Windows, Windows NT, OS/2, BeOS, NextStep, OpenStep, MacOS/X Server, DOS, and Macintosh. It can optionally use OpenGL (Windows, Linux, Mac, OS/2, BeOS), Direct3D (Windows), GGI (Linux), Allegro (DOS), X11 (Unix/Linux) and SVGALIB (Linux). It can also optionally use assembler routines (GCC/DJGPP, Visual C++ and Intel only currently) and MMX if the processor supports it. -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre bRing mE fOur sQuirrels aNd nO oNe wIll gEt hUrt 13:00pm up 1 season, 1 squirrel, load average: 1+1j 0.5+2j 0.2+0.5j From gmunsey at adobe.com Mon Apr 17 00:44:02 2000 From: gmunsey at adobe.com (Grant Munsey) Date: Sun, 16 Apr 2000 21:44:02 -0700 Subject: How to fire off a web browser process from Python in Win? Message-ID: Is there a call somewhere in the std library for staring up the default ( the one that the user has set for opening .htm and .html files) web browser on Win 95/8/NT/2K? From un4e at rzstud1.rz.uni-karlsruhe.de Thu Apr 27 09:30:53 2000 From: un4e at rzstud1.rz.uni-karlsruhe.de (Bjoern Giesler) Date: 27 Apr 2000 13:30:53 GMT Subject: PyOpenGL Message-ID: <8e9fed$lm4$1@news.rz.uni-karlsruhe.de> Hi, is there an archive that carries a newer version of PyOpenGL? The newest I have is from the contrib-09-Dec-99 directory on ftp.python.org, and that seems to require tcl7.6, which I don't want to use anymore. TIA, --Bj?rn From dwhite2 at seas.upenn.edu Tue Apr 4 21:20:36 2000 From: dwhite2 at seas.upenn.edu (dave white) Date: Tue, 04 Apr 2000 21:20:36 -0400 Subject: reading data from a file Message-ID: <38EA94E3.7B249C3@seas.upenn.edu> Hello, can anyone please help with these basic questions: 1) I'm using file.readlines() to read in some data. Is there any quick and efficient way to automatically get rid of the endofline '\012' character that gets appended to the strings at the end of every line? 2) Is there a way for python to read a line from a file in such a way that it knows its a collection data type and not just a string? i.e. read something like [[1,2][3,4][5,6]] and know its a list of lists? thanks... david From calishar at *NOSPAM*home.com Tue Apr 18 23:26:26 2000 From: calishar at *NOSPAM*home.com (Calishar) Date: Wed, 19 Apr 2000 03:26:26 GMT Subject: win32all-128.exe availability? References: <38fd01b2$0$10982@senator-bedfellow.mit.edu> Message-ID: <3k9qfs0ropdsv515f9he7lkpdrf1qfputv@4ax.com> On Tue, 18 Apr 2000 20:49:08 -0400, "Robert" wrote: >Now that starship has crashed, I was wondering if it was possible to >get the 128 build of Pythonwin extensions off the net? By an unfortunate >coincidence, my own hard drive chose to crash around the time starship >did. Don't know if any sites have a mirror of win32all-128, but I have it on my HD (love being a packrat, still have -127 too). If you want I can try e-mailing it to you. I say try because the file is 3.2M and @home gives me a 5M message size limit. Let me know if you want it via mail. Calishar calishar at home.com From sabren at manifestation.com Thu Apr 20 13:18:13 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 20 Apr 2000 13:18:13 -0400 (EDT) Subject: python templating system In-Reply-To: Message-ID: On 20 Apr 2000, Cameron Laird wrote: > In article , > Michal Wallace (sabren) wrote: > >On Wed, 19 Apr 2000 pozman at my-deja.com wrote: > > > >> Does anyone know of a templating system (other than zope) that is > >> implemented with python [ comparisons would be embperl with perl] > > > >http://zebra.sourceforge.net/ > . > . > . > According to the text currently at that page, Zebra does *not* now > interpret Python. However, I collect systems which do at starbase.neosoft.com/~claird/comp.lang.python/web_python.html>. Uh. Oops. Must be that the idiot who wrote it (me) didn't update the documentation yet. Zebra exports Python well and PHP poorly. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From bjorn at roguewave.com Wed Apr 5 13:19:12 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Wed, 05 Apr 2000 11:19:12 -0600 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <8cfqf7$4ml$4@newsserver.rrzn.uni-hannover.de> Message-ID: <38EB7590.1827F01C@roguewave.com> Bernhard Reiter wrote: > > In article , > "Warren Postma" writes: > > > The Python texts I've read are good References to Getting Stuff Done, but > > they Don't Teach the Art. Speaking of Dummies, was there/is there a LISP for > > Dummies, or Smalltalk for Dummies? Can Python for Dummies be far off? > > Yes, because people who do Python are no dummies. > At least I hope so. Reminds me of something Stroustrup wrote: "... In a small dedicated community, life is relatively easy. people do their homework, people have access to reasonable sources of information, gross errors and misconceptions are corrected before they can cause significant harm, compilers and teaching materials are up-to-date, etc. This is not and cannot be the case in a multi-hundred-thousand member community: Some will be taught out of outdated or unsuitable books, some will use antiquated compilers and tools, some will be taught by charlatans, some will be remote from current and reliable news-sources, some will have unsuitable rules and regulations imposed on their work, etc. Also, in a rapidly growing community, most users will be novices. " For the full article, check out his website -- it's in the section titled "C++ programmers are idiots" :-) (http://www.research.att.com/~bs/blast.html). --bjorn From guido at python.org Tue Apr 11 16:29:16 2000 From: guido at python.org (Guido van Rossum) Date: Tue, 11 Apr 2000 16:29:16 -0400 Subject: ANNOUNCE: Python 1.6 alpha 2 Message-ID: <200004112029.QAA09762@eric.cnri.reston.va.us> I've just released a source tarball and a Windows installer for Python 1.6 alpha 2 to the Python website: http://www.python.org/1.6/ If you missed the announcement for 1.6a1, probably the biggest news is Unicode support. More news is on the above webpage; Unicode is being discussed in the i18n-sig. Most changes since 1.6a1 affect either details of the Unicode support, or details of what the Windows installer installs where. Note: this is an alpha release. Some of the code is very rough! Please give it a try with your favorite Python application, but don't trust it for production use yet. I plan to release several more alpha and beta releases over the next two months, culminating in an 1.6 final release before June first. We need your help to make the final 1.6 release as robust as possible -- please test this alpha release!!! --Guido van Rossum (home page: http://www.python.org/~guido/) From rjroy at takingcontrol.com Wed Apr 12 22:45:58 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Thu, 13 Apr 2000 02:45:58 GMT Subject: Using xmllib References: <2B1262E83448D211AE4B00A0C9D61B03BA72A1@MSGEURO1> Message-ID: <38f533f1.513177687@news1.on.sympatico.ca> On Wed, 12 Apr 2000 13:38:41 +0200, Pieter Claerhout wrote: >Hello, > >does anyone has an example on how to use the xmllib to parse an xmlfile? >I have an xml-file, which looks a bit like this: > > > > > > Item 1 description. > Thu Dec 16 16:35:05 1999 > > > Item 2 description. > Wed Mar 15 11:54:27 2000 > > > >I want to convert it to something like this: > >Collection from path s:\ > >- Item 1 (Thu Dec 16 16:35:05 1999) > Item 1 description. >- Item 2 (Wed Mar 15 11:54:27 2000) > Item 2 description. > >Anyone an idea on how to do that with XMLlib? > >Kind regards, > > >Pieter >Pieter_Claerhout at creoscitex.com > This is a fairly trivial example based on what you posted. Bob ++++++++++ import xmllib, string class myparser(xmllib.XMLParser): def __init__(self): xmllib.XMLParser.__init__(self) self.currentdescrip = '' self.currentdate = '' self.currentitem = '' self.currentdata = [] def handle_data(self, data): self.currentdata.append(data) def start_COLLECTION(self, attrs): print "Collection from path", def end_COLLECTION(self): pass def start_GENERAL(self, attrs): print attrs['PATH'] def end_GENERAL(self): pass def start_ITEM(self, attrs): self.currentitem = attrs['NAME'] def end_ITEM(self): print '-%(currentitem)s (%(currentdate)s)\n %(currentdescrip)s' % self.__dict__ def start_DESCRIPTION(self, attrs): self.currentdata = [] def end_DESCRIPTION(self): self.currentdescrip = string.join(self.currentdata,'') def start_DATE(self, attrs): self.currentdata = [] def end_DATE(self): self.currentdate = string.join(self.currentdata,'') ### some test code data= """\ Item 1 description. Thu Dec 16 16:35:05 1999 Item 2 description. Wed Mar 15 11:54:27 2000 """ if __name__ == "__main__": p=myparser() p.feed(data) p.close() From tismer at tismer.com Sun Apr 16 14:26:17 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 16 Apr 2000 20:26:17 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F9F01B.57273052@tismer.com> Message-ID: <38FA05C9.442868E4@tismer.com> Quinn Dunkan wrote: > > >> - Even so, Chris and I agree that continuations should eventually > >> be completely hidden from the user, since it's so incredibly > >> obscure, hardly anyone will understand it. Not good for CP4E ;-) > > > >Today I'm saying so. But I think there will come a time > >where people are told "look, a continuation is as simple as 1+1", > >and they'll say "sure? I thought a co is simpler." > > I'm not sure I understand correctly, but does "completely hidden from the > user" mean "only visible (in the "raw" form) from C"? In that case, I think > it should still be visible from python. Right. One should perhaps not advertize continuations in the first place, until people know them from school. That's why we try to build really useful stuff from them, familiar and understandable for many people, like threads. This also means, after some stabilization phase and iterations, most of these applications on top of co's will get optimized back into C, dealing with the co stuff from there. This doesn't mean to remove the co's Python interface, but to improve and simplify it further. > I don't see how it's different from metaclasses or the "new" module: just > put big red stickers on it. It'd be nice to have around for people who want > to experiment, write obfuscated code, or maybe even write a useful > continuation-using extension. I don't think there's much trouble with people > abusing the Beaudry hook to explode anyone's head other than their own. Thank you for reminding me that I have to write a real C interface now. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 parker at gol.com Fri Apr 21 21:10:01 2000 From: parker at gol.com (Ian Parker) Date: Sat, 22 Apr 2000 01:10:01 GMT Subject: editor for win32 References: Message-ID: <1vhEiDAdtPA5EwJ3@gol.com> In article , Scott Hathaway writes >Thanks for all the good input! > >I am new to python and excited about giving it a whirl. > >Scott > >"Scott Hathaway" wrote in message >news:NpHL4.779$fK2.113609 at news.flash.net... >> Can anyone recommend a python editor for Windows? >> >> If there is an IDE for windows (other than IDLE), even better. >> >> Thanks, >> Scott >> >> > > I use PFE - Programmer's File Editor. It's simple, programmable and with optional line numbers. Regards -- Ian Parker From zorro at zipzap.ch Sat Apr 15 04:24:50 2000 From: zorro at zipzap.ch (Boris Borcic) Date: Sat, 15 Apr 2000 10:24:50 +0200 Subject: starship.python.net References: <38F763CA.43F8EA85@eq.uc.pt> Message-ID: <38F82752.E7FBE4E6@zipzap.ch> Pedro Vale Lima wrote: > > I still can't connect. Same here. BB From meh9 at cornell.edu Thu Apr 6 14:24:00 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Thu, 06 Apr 2000 14:24:00 -0400 Subject: More about variables References: <3X3H4.16435$0o4.108310@iad-read.news.verio.net> Message-ID: Why create named variables? I always thought that having 20 lists saved more space than having one list of 20 lists. Maybe I'm wrong. Thanks for your help, Matt In article <3X3H4.16435$0o4.108310 at iad-read.news.verio.net>, culliton at clark.net (Tom Culliton) wrote: > What (or maybe what do you think) you are trying to do? Most likely > you would be better off with just a list or tuple if you're dealing > with and unknown number of data items. Not everything needs a name, > and there isn't much difference between: > > v0, v1, v2, v3, v4, v5 > > and > > v[0], v[1], v[2], v[3], v[4], v[5] > > Why do you think this variable length collection of data needs > individual names? > > Now, if after consideration there is still some compelling reason to > generate names, you can use something like this with a dictionary > (possibly the one returned by globals()): > > v = {} > for i in range(number_of_variables): > name = "variable%d" % i > v[name] = [] > > But again, Why? > > In article , > Matthew Hirsch wrote: > >Hi All, > > > >Let's say I had something like: > > > >number_of_variables=int(raw_input('Enter number of variables: ')) > > > >if number_of_variables==1: > > variable1=[] > >elif number_of_variables==2: > > variable1=[] > > variable2=[] > >elif number_of_variables==3: > > variable1=[] > > variable2=[] > > variable3=[] > >elif number_of_variables==4: > > variable1=[] > > variable2=[] > > variable3=[] > > variable4=[] > >elif number_of_variables==5: > > variable1=[] > > variable2=[] > > variable3=[] > > variable4=[] > > variable5=[] > >else: > > print 'else' > > > >Is there a more efficient way of doing this? What if I wanted to create > >100 variables (lists). It doesn't make sense to write an if statement > >for that many conditions. > > > >Thanks for your help, > >Matt From bingdo19 at earthlink.net Sat Apr 29 11:25:03 2000 From: bingdo19 at earthlink.net (Bob Langdon) Date: Sat, 29 Apr 2000 15:25:03 GMT Subject: Need to Hire Freelance Python Expert Message-ID: Hi, I've recently installed Python 1.5.2 in the home directopry on a virtual domain name. All seems to work well, but having trouble with a series of scripts moved from another server; e.g.: name errors and key errors. Need to hire someone to trouble shoot the setup. Call Bob Langdon at 800-982-0548 as soon as possible. Will be in Sat & Sunday 10-4 eastern time. Thanks. From phd at phd.russ.ru Thu Apr 27 08:56:04 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 27 Apr 2000 12:56:04 +0000 (GMT) Subject: PyApache memory leak? In-Reply-To: Message-ID: Hello! On Thu, 27 Apr 2000, Gregory Trubetskoy wrote: > On Fri, 21 Apr 2000, Oleg Broytmann wrote: > > > This don't help saving memory. Other way round - PyApache destroys > > subinterpreter after processing a request, thus saving memory; but httpdapy > > keeps the interpreter with all (unneccessary and superfluos) imported > > modules, thus leaking memory. > > I wouldn't call this "leaking". "Leaking" means forgetting to free memory > where you should be freeing it (like overlooking a Py_DECREF), loosing a > pointer to memory, etc. To the best of my knowledge, httpdapy 1.7b does > not leak memory. I've done a lot of work to make sure of this. > > Another note to consider - I am not 100% sure that Py_EndInterpreter() > actually frees all memory. In fact I'm almost sure it doesn't, and you > still need to watch your reference counts if you create object via the > C-API. If that is the case, then PyApache has a higher likelyhood of > actually leaking memory. May be... > BTW, if I remember it correctly, the decision by Lele (the author of > PyApache) to recreate the interpreter was based not on memory usage, but > because the CGI wouldn't work as expected otherwise and for security > reasons. I am pretty satisfied with PyApache. (Note: I didn't tried httpdapy yet, so I cannot say bad words about it; I belive it's good product anyway). Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From tim_one at email.msn.com Tue Apr 11 00:09:26 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 11 Apr 2000 00:09:26 -0400 Subject: Python paradigms In-Reply-To: Message-ID: <001b01bfa36b$bafc7a80$27a2143f@tim> [Grant Edwards] > ... > In assembly comments are probably required, but in a language > like Python, if code needs comments other than the occasionaly > "doc" string, then it's written badly. Depends on how hard the algorithm is. I have, on occasion, and even in Python, written two pages of comments to explain one line of code; also one line of comment to explain two pages. Not all algorithms are trivial! Although more *should* be in most code I see <0.5 wink>. The first compiler I worked on was written entirely in Cray assembly language, for a RISC vector machine warped toward supernaturally fast 64-bit floating-point arithmetic in all possible ways. It was a nightmare in most respects for what a compiler needs to do. The original author gave all functions 4-letter names, and arranged them in strict alphabetical order. Each function used its own calling and return conventions, undocumented except by reverse-engineering the code. Over time you just *learned*, e.g., that function CPMX didn't touch register S5 and that callers relied on that, while function CX00 expected its input in S5 and put its output in S3 (names & register numbers disguised to protect the guilty). Etc. In many respects it was a magnificent house of soggy cards balanced on grains of sand . One early day I was tracking down a particularly nasty bug, scratching my head in the emulator, stepping thru page after page of this uncommented code. Then, like a long-sought lighthouse in an oceanic storm, a single comment appeared on a line of code in the middle of the page: S1 -3 ; because 15 didn't work Oh -- of course . bad-comments-are-worse-than-none-ly y'rs - tim From chambert at borel2.institut.math.jussieu.fr Sat Apr 22 03:57:22 2000 From: chambert at borel2.institut.math.jussieu.fr (Antoine Chambert-Loir) Date: 22 Apr 2000 09:57:22 +0200 Subject: Mac Python Questions References: <956247497.216189@fezzik.endicor.com> <956347062.17103@fezzik.endicor.com> Message-ID: <8drm12$v1v$1@borel2.institut.math.jussieu.fr> In article <956347062.17103 at fezzik.endicor.com>, Kent Polk wrote: >I have no idea where things are actually *supposed* to be, but the >installer placed _tkinter.CFM68k.slb in :Mac:PlugIns: and did not >install the _tkinter.ppc.slb there also. From what I saw, you can >either copy _tkinter.ppc.slb into :Mac:PlugIns: or add its location >to the Path in order to be able to import _tkinter. We are copying >to :Mac:PlugIns: as it appears that was the installer's intent. In my distribution, I got 2 copies of _tkinter.ppc.slb and 2 (or maybe even 3) of _tkinter.CFM68k.slb ! They look different. Maybe one of them is bugged ? It would be great to have a full listing of the PYTHON directory on a mac where it works well. (Plus some stats as, e.g. the memory available, the advised memory, etc.) Regards, -- Antoine Chambert-Loir o-o Institut de Math?matiques de Jussieu (Chevaleret) Tel: 01 44 27 75 20 | Universit? Pierre et Marie Curie Fax: 01 44 27 48 44 - Boite 247, 4 place Jussieu, F-75252 Paris Cedex 05 http://www.math.jussieu.fr/~chambert From emile at fenx.com Thu Apr 13 13:14:25 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 13 Apr 2000 10:14:25 -0700 Subject: List mapping? References: <38f5d68e@news.xtml.co.uk> <38f5e714@news.xtml.co.uk> Message-ID: <010a01bfa56b$b93364a0$01ffffc0@worldnet.att.net> While this does work, it is slower and harder to see what's going on. Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Nick Trout Newsgroups: comp.lang.python To: Sent: Thursday, April 13, 2000 8:20 AM Subject: Re: List mapping? > > Try this: > > mylist = ['/a','1','/b','2','/c','3'] > > map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0, > > len(mylist), 2)) > > Very good! I wasnt familiar with the reduce function. I would certainly not have > come up with something of this complexity. > > This begs the question: Is there an archive of code snippets for Python? These > could form an excellent tutorial. Quite a few messages arrive on this newsgroup > asking for good starting points for Python (and thats just the people who come > here and ask). > > N > > > -- > http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Thu Apr 13 15:04:18 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 13 Apr 2000 19:04:18 GMT Subject: Simple formatting string question References: Message-ID: Matthew Hirsch wrote: > I'm trying to print something like this: > > >>> print 6*'%2i' '%1i' % tuple([5,5,5,5,5,5,1]) > > but I'm getting an error. how about: >>> print (6*'%2i' + '%1i') % tuple([5,5,5,5,5,5,1]) From dieter at handshake.de Sat Apr 1 03:22:34 2000 From: dieter at handshake.de (Dieter Maurer) Date: 01 Apr 2000 10:22:34 +0200 Subject: pdb will not continue References: Message-ID: Tim Egbert writes on Thu, 30 Mar 2000 11:30:17 -0700: > I'm new to the pbd module, but think I've got most of it working. The > problem I'm having, however, is that even though I can set break points, I > can't get pdb to 'continue' ('cont' or 'c') to the break point. All it > will do is advance one line. What am I doing wrong? This is a bug in PDB: Pdb.runcall cannot continue in the top level function (it can inside a called function). You can use "Pdb.run" instead of "Pdb.runcall" (it takes a string with the function call rather than the function and the arguments). Dieter. From chapman at bioreason.com Wed Apr 5 11:10:52 2000 From: chapman at bioreason.com (Mitch Chapman) Date: Wed, 05 Apr 2000 09:10:52 -0600 Subject: opening a serial port at a given baudrate. How? References: <200004050319.NAA08789@piglet.dstc.edu.au> Message-ID: <38EB577C.E1EC5704@bioreason.com> David Arnold wrote: > > -->"Jim" == Jim Richardson writes: > > Jim> I have been using open('/dev/ttyS0','r+') but need to control > Jim> baud rate. fcntl.ioctl() will do this? > > as someone else pointed out (sorry, lost the mail), the termios module > is the go for setting baud rates, parity, etc. Here's an old answer, courtesy of www.deja.com: http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=309748544&fmt=text Search for "# Set the baud rate." -- Mitch Chapman chapman at bioreason.com From dalke at acm.org Fri Apr 7 09:27:26 2000 From: dalke at acm.org (Andrew Dalke) Date: Fri, 7 Apr 2000 07:27:26 -0600 Subject: "tostring" as a string method? References: <8c45ue$b7u$1@slb1.atl.mindspring.net> <8ck7kq$1cu$1@slb3.atl.mindspring.net> Message-ID: <8cknio$1v8$1@slb1.atl.mindspring.net> Warren Postma asked: >Hmm. Have you considered marshalling everything instead? I think I didn't explain the context well enough. The result of this string (either from __str__, tostring() or whichever) will be sent to one of the string.* or re.* functions. It really needs the string representation of the underlying sequence (assuming it can be encoded into a single-letter alphabet). Eg, if seq = Seq("GGATACTG", Alphabet.dna) then string.count(seq.tostring(), "G") works. As would seq = MutableSeq(array.array("c", "GGATACTG")) (or as /F pointed out, so does string.count(buffer(seq.data), "G")) Marshall would be used to get a string encoded representation of the object which isn't (easily) usable by, say, a regular expression. Andrew dalke at acm.org From lewst at yahoo.com Wed Apr 5 00:52:27 2000 From: lewst at yahoo.com (lewst) Date: Tue, 4 Apr 2000 21:52:27 -0700 (PDT) Subject: Starving for an Advanced Python Book Message-ID: <20000405045227.29911.qmail@web2105.mail.yahoo.com> Lee Joramo wrote: > 'Python Essential Reference'; David Beazley; New Riders > An excellent reworking of the online documentation. This is a > reference book with out tutorial, but I have learned much from > it. HIGHLY RECOMMENDED I also decided to buy this book tonight after having a chance to look at it. This will be much more convenient than looking up things in the online library reference manual which I have been doing thus far. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From guido at python.org Sat Apr 1 12:00:00 2000 From: guido at python.org (Guido van Rossum) Date: Sat, 1 Apr 2000 12:00:00 -0500 EST Subject: New Features in Python 1.6 Message-ID: <200004011740.MAA04675@eric.cnri.reston.va.us> New Features in Python 1.6 ========================== With the recent release of Python 1.6 alpha 1, a lot of people have been wondering what's new. This short note aims to explain the major changes in Python 1.6. Core Language ------------- 1. Unicode strings Python strings can now be stored as Unicode strings. To make it easier to type Unicode strings, the single-quote character defaults to creating a Unicode string, while the double-quote character defaults to ASCII strings. If you need to create a Unicode string with double quotes, just preface it with the letter "u"; likewise, an ASCII string can be created by prefacing single quotes with the letter "a". For example: foo = 'hello' # Unicode foo = "hello" # ASCII foo = a'hello' # ASCII foo = u"hello" # Unicode You can still use the "r" character to quote strings in a manner convenient for the regular expression engine, but with subtle changes in semantics: see "New regular expression engine" below for more information. Also, for compatibility with most editors and operating systems, Python source code is still 7-bit ASCII. Thus, for portability it's best to write Unicode strings using one of two new escapes: \u and \N. \u lets you specify a Unicode character as a 16-bit hexadecimal number, and \N lets you specify it by name: message = 'Bienvenue \N{LATIN SMALL LETTER A WITH GRAVE} ' \ + 'Python fran\N{LATIN SMALL LETTER C WITH CEDILLA}ais!' message = 'Bienvenue \u00E0 Python fran\u00E7ais!' 2. string methods Python strings have grown methods, just like lists and dictionaries. For instance, to split a string on spaces, you can now say this: tokens = "foo bar baz".split(" ") Or, equivalently, this: tokens = " ".split("foo bar baz") (Python figures out which string is the delimiter and which is the string to split by examining both strings to see which one occurs more frequently inside the other.) Be careful not to mix Unicode and ASCII strings when doing this, though. Other examples: foo = "The quick red fox jumped over the lazy brown dog." foo.find("dog") foo.strip() foo.lower() Note that use of any string method on a particular string renders it mutable. This is for consistency with lists, which are mutable and have methods like 'append()' and 'sort()' that modify the list. Thus, "foo.strip()" modifies the string 'foo' in-place. "strip(foo)" retains its old behavior of returning a modified copy of 'foo'. 3. extended call syntax The variable argument list and keyword argument syntax introduced in Python 1.3 has been extended. Previously, it only worked in function/method signatures; calling other functions with the same arguments required the use of 'apply()' def spam(arg1,arg2,*more_args,**keyword_args): # ... apply(foo,(arg1,arg2) + more_args,keyword_args) Now it works for calling functions too. For consistency with C and C++, asterisks in the function signature become ampersands in the function body: foo(arg1,arg2,&more_args,&&keyword_args) 4. assignment to None now works In previous version of Python, values assigned to None were lost. For example, this code: (username,None,None,None,realname,homedir,None) = getpwuid(uid) would only preserve the user name, real name, and home directory fields from a password file entry -- everything else of interest was lost. In Python 1.6, you can meaningfully assign to None. In the above example, None would be replaced by a tuple containing the four values of interest. You can also use the variable argument list syntax here, for example: (username,password,uid,uid,*None) = getpwuid(uid) would set None to a tuple containing the last three elements of the tuple returned by getpwuid. Library ------- 1. Distutils In the past, lots of people have complained about the lack of a standard mechanism for distributing and installing Python modules. This has been fixed by the Distutils, or Distribution Utilities. We took the approach of leveraging past efforts in this area rather than reinventing a number of perfectly good wheels. Thus, the Distutils take advantage of a number of "best-of-breed" tools for distributing, configuring, building, and installing software. The core of the system is a set of m4 macros that augment the standard macros supplied by GNU Autoconf. Where the Autoconf macros generate shell code that becomes a configure script, the Distutils macros generate Python code that creates a Makefile. (This is a similar idea to Perl's MakeMaker system, but of course this Makefile builds Python modules and extensions!) Using the Distutils is easy: you write a script called "setup.in" which contains both Autoconf and Distutils m4 macros; the Autoconf macros are used to create a "configure" script which examines the target system to find out how to build your extensions there, and the Distutils macros create a "setup.py" script, which generates a Makefile that knows how to build your particular collection of modules. You process "setup.in" before distributing your modules, and bundle the resulting "configure" and "setup.py" with your modules. Then, the user just has to run "configure", "setup.py", and "make" to build everything. For example, here's a small, simple "setup.in" for a hypothetical module distribution that uses Autoconf to check for a C library "frob" and builds a Python extension called "_frob" and a pure Python module "frob": AC_INIT(frobmodule.c) AC_CHECK_HEADER(frob.h) AC_HAVE_LIBRARY(frob) AC_OUTPUT() DU_INIT(Frob,1.0) DU_EXTENSION(_frob,frobmodule.c,-lfrob) DU_MODULE(frob,frob.py) DU_OUTPUT(setup.py) First, you run this setup.in using the "prepare_dist" script; this creates "configure" and "setup.py": % prepare_dist Next, you configure the package and create a makefile: % ./configure % ./setup.py Finally, to create a source distribution, use the "sdist" target of the generated Makefile: % make sdist This creates Frob-1.0.tar.gz, which you can then share with the world. A user who wishes to install your extension would download Frob-1.0.tar.gz and create local, custom versions of the "configure" and "setup.py" scripts: % gunzip -c Frob-1.0.tar.gz | tar xf - % cd Frob-1.0 % ./configure % ./setup.py Then, she can build and install your modules: % make % make install Hopefully this will foster even more code sharing in the Python community, and prevent unneeded duplication of effort by module developers. Note that the Python installer for Windows now installs GNU m4, the bash shell, and Autoconf, so that Windows users will be able to use the Distutils just like on Unix. 2. Imputils Complementary to the Distutils are the Imputils, or Import Utilities. Python's import mechanism has been reworked to make it easy for Python programmers to put "hooks" into the code that finds and loads modules. The default import mechanism now includes hooks, written in Python, to load modules via HTTP from a known URL. This has allowed us to drop most of the standard library from the distribution. Now, for example, when you import a less-commonly-needed module from the standard library, Python fetches the code for you. For example, if you say import tokenize then Python -- via the Imputils -- will fetch http://modules.python.org/lib/tokenize.py for you and install it on your system for future use. (This is why the Python interpreter is now installed as a setuid binary under Unix -- if you turn off this bit, you will be unable to load modules from the standard library!) If you try to import a module that's not part of the standard library, then the Imputils will find out -- again from modules.python.org -- where it can find this module. It then downloads the entire relevant module distribution, and uses the Distutils to build and install it on your system. It then loads the module you requested. Simplicity itself! 3. New regular expression engine Python 1.6 includes a new regular expression engine, accessed through the "sre" module, to support Unicode strings. Be sure to use the *old* engine for ASCII strings, though: import re, sre # ... re.match(r"(\d+)", "The number is 42.") # ASCII sre.match(r'(\d+)', 'The number is \N{SUPERSCRIPT TWO}') # Unicode If you're not sure whether a string is ASCII or Unicode, you can always determine this at runtime: from types import * # ... if type(s) is StringType: m = re.match(r"...", s) elif type(s) is UnicodeType: m = sre.match(r'...', s) From jamarijr at hotmail.com Mon Apr 17 12:22:05 2000 From: jamarijr at hotmail.com (Arinté) Date: Mon, 17 Apr 2000 16:22:05 GMT Subject: Python flak??? Message-ID: <8dfdmq$v1o$1@nnrp1.deja.com> What are the reprecussions of doing a PyErr_Clear() when there is no error? Sent via Deja.com http://www.deja.com/ Before you buy. From pony at nmt.edu Mon Apr 10 14:24:23 2000 From: pony at nmt.edu (Enrique Herrera) Date: Mon, 10 Apr 2000 12:24:23 -0600 Subject: Help on Big Python Program References: <38E8DB50.A79CB88@nmt.edu> Message-ID: <38F21C57.F6DD2CFA@nmt.edu> I am not going to relse this software to the public. Is for my department. I just need to find a way to combind all my modeles and the main program into one bin exec. Any Ideas? From darrell at dorb.com Sun Apr 2 15:48:59 2000 From: darrell at dorb.com (Darrell) Date: Sun, 2 Apr 2000 12:48:59 -0700 Subject: Debugging confusion -- too many stacks! References: <000a01bf9c6b$3f80c2a0$752d153f@tim> <38E739A1.45F4B199@tismer.com> <030301bf9cd9$eb6786d0$6401a8c0@dorb> <38E77676.4599978B@tismer.com> Message-ID: <035a01bf9cdc$7d433d40$6401a8c0@dorb> "Christian Tismer" > Oops, sorry! I confused PDB with GDB. > Probably since the issue was about stacks... > Oh... Still when it comes to walking the stack and inspecting things PDB is hard to beat. The trick being how to best use it with the likes of GDB. --Darrell From JamesL at Lugoj.Com Sat Apr 1 13:57:58 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Sat, 01 Apr 2000 10:57:58 -0800 Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com> <38E58D2D.384F1546@Lugoj.Com> Message-ID: <38E646B6.12011A4E@Lugoj.Com> Fredrik Lundh wrote: > > James Logajan wrote: > > Also, how good are you at math? You seem to feel that 5 minutes of "Guido > > the god's" time is of much more value than that of 1000 knuckle-dragging > > Neanderthal programmers like myself spending a mere 10 minutes each to > make > > sure their code doesn't break. Of course, if we happen to take more than > 10 > > minutes its our own damn fault I'm sure you'll agree. > > the strange thing here is that there are changes listed on > that page that are far more difficult to spot and fix, but for > some reason, neither you or bjorn seem to care. To be honest, I have so little time these days that I only spot-check this newsgroup and have not even checked into what is happening with Python's latest version. The only reason I even read Bjorn's post is because I saw Guido's announcement and read it and started reading some of the followups. While Bjorn came across as a bit irritating I had to reluctantly agree that he had a valid point: one should not change API signatures unless there is something concretely wrong with them. The benefit/pain ratio for by this change is close to zero. > others have politely asked for backwards compatibility on > this one (which would mean *adding* extra code to handle > multiple calling syntaxes). someone will probably come up > with a patch well before the next alpha, but probably not > because you guys are flaming away on this newsgroup. Well then I hope it gets changed due to those polite requests. Hopefully that old extra code can be patched back in. > > besides, the notion that 10 minutes spent on fixing this will > outweigh all others costs involved in upgrading to a new > release of the core interpreter strikes me as rather odd... > > (heck, both of you have probably spent far more than ten > minutes each writing your posts...) I'm not sure if you realize that the reference to ten minutes was an absurdism. If 1.6 includes a number of function signature changes or semantic changes to existing functionality and not just bug fixes and benign additions then I know of at least two firms that will be unwilling to use 1.6 or later versions. In fact I may be in the unfortunate position of getting calls on it even though I am no longer consulting to them. I had told them that as far as I knew code that worked for version 1.N should in *general* work for version 1.(N+1) but that all bets were off for N.X to (N+1).X. It was how I managed to sell Python into them. Ouch; guess I shoud have read the fine-print. > > > Now how did I get so pissed over this exchange of posts? > > now how come I find your "guido the god" argument to be > directly offensive? Because it was meant to be. Glad to see it worked! The motivation for it was because even though Bjorn directed his post to Guido, you and one or two others responded. Almost like high priests guarding the temple. Any reason Guido doesn't post to this newsgroup like he used to? P.S. I'm not pissed anymore about it. Since it is clear I can't influence things I have calmed down and will move on to things that I can influence (to stay the same) or that no one can influence. The pragmatist in me says I should look for a language that abides by a standard that can not be easily changed. From ullrich at math.okstate.edu Sun Apr 23 14:14:13 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Sun, 23 Apr 2000 18:14:13 GMT Subject: LAmbda calculus evaluator (interactive) References: <000301bfacdf$1f5c7260$212d153f@tim> Message-ID: <39033c95.437294824@news> On Sun, 23 Apr 2000 00:48:08 -0400, "Tim Peters" wrote: >[Kragen Sitaker] >> ... >> Many years ago, Colby Kraybill suggested to me that it would be nice >> to have something similar for mathematical expressions --- something >> that would do nothing on its own, but would do the grunt-work involved >> in an action like "take the reciprocal of both sides" or "divide both >> the top and bottom by (x-1)". > >Hyland Software's "Merlyn" program does that; see > > http://www.hylandsoftware.com/ > >It's based on a general term-rewriting system, and is programmable by the >end-user (indeed, almost all the builtin rules are exposed in files you can >edit too). However, it's proprietary, costs money, source for the engine >itself is not available, and it works only on Windows. I often use it >instead of, e.g., Macsyma, because the high-powered systems drive me nuts >with the pervasive & often unhelpful transformations they make in an >eyeblink; Merlyn never does anything unless it's told to. > >Similar but weaker symbolic facilities can be found, e.g., in Dave >Gillespie's Emacs calc, and high-end HP calculators. > >If the world were sane, they would have written all these things in Python >. So if they'd written them in Python what would the source code look like? >the-temptation-to-use-the-time-machine-is-often-overwhelming-ly y'rs - tim So you have a time machine - so "too busy" is no excuse... DU From ljoramo.list at nickads.com Mon Apr 3 18:19:59 2000 From: ljoramo.list at nickads.com (Lee Joramo) Date: Mon, 3 Apr 2000 16:19:59 -0600 Subject: PyGreSQL errors Message-ID: I am trying to get pygresql to work. I have a Cobalt RaQ3 server which runs a slightly modified version of RedHat. The system came with PostgreSQL pre-installed. When I import the pygresql's basics.py tutorial at pythons command line, I follow the instructions to create a connection and get an error: >>> cnx = basics.DB('mytest') Traceback (innermost last): File "", line 1, in ? File "/usr/lib/python1.5/pg.py", line 34, in __init__ self.db = apply(connect, args, kw) pg.error: FATAL 1: Database mytest does not exist in pg_database What has gone wrong? -- Lee A. Joramo ljoramo at nickads.com The Nickel Want Ads www.nickads.com Internet Manager 970-242-5555 -- Onward and Upward! Lee A. Joramo }}-----> Cowboy on the Electronic Frontier lee at joramo.com Alamar Ranch - Palisade - Colorado ThreeRivers|Eagle|UCD|D&D|TNC|DX|Mac|221B|Cannondale|Deutsch From pete at bluesq2.com Thu Apr 6 06:40:00 2000 From: pete at bluesq2.com (David Grove) Date: Thu, 06 Apr 2000 10:40:00 GMT Subject: ANNOUNCE: CodeMagicCD Version 1.0 Message-ID: <38ec6964.14922499@news.rmi.net> ANNOUNCE: CodeMagicCD Version 1.0 New York based software developer, The Blue Square Group, announces the release of CodeMagicCD Ver 1.0., a three-level toolkit for professional programmers. This software is now available at www.CodeMagicCD.com. CodeMagicCD, The Complete Programmer's Toolkit For Win32, CDRom Version 1.0 includes: ***CODEMAGIC UNIVERSAL IDE*** This high-quality, multi-language, professional programmer's editor proved itself by being used by more than 12,000 users before coming out of its beta stage. It has a thriving community of users, its own mailing lists, and the best programming user interface of any editor currently on the market. Now in version 1.0, this editor supports over 12 languages, and more are being added regularly. Among the features of this editor, you will find: * User configurable syntax highlighting for multiple languages * Extremely configurable and flexible editing environment * A pure build of core Perl 5.005_03, with more than a hundred of the most popular perl modules built in (yes, including Tk, GD, DBD/DBI, Win32::ODBC, and DB_File). Although CodeMagic can be used with other versions of Win32-based perl, this standard build is used because it's embedding and extension mechanisms are not corrupted or C++ based, and can therefore be used as a macro language and API extension language for the editor itself, or from any other language that supports DLL linkage. * Code templates for lightning fast coding * Per-user configuration, for multi-user machines * The ability to work with any text file, and these languages: Perl, Python, C, C++, Java, JavaScript, Html, Html with embedded JavaScript/VBScript/PerlScript/PML, ASP, VBScript, BASIC, Visual Basic, Pascal (Delphi), REBOL, Tcl and TclTk, SQL, Lisp, PML (PerlMagic/Lightning or the "Perl Markup Language"), and DOS/4DOS/NT Batch Files * Revision control * FTP communication, excellent for telecommuters, web program- mers, and remote projects * Project management * Online customer support (Guido, et. al.) NOTE: Python syntax highlighting is now fully supported in this version, as promised. As of the first service pack, Python will be embedded into CodeMagic as its primary API and macro facility using PyDelphi. Also please note that the CodeMagicCD Environment is _NOT_ a "professional" version of the CodeMagic editor, which remains free and fully functional. The CodeMagicCD Environment is a full working environment that contains the CodeMagic editor. ***PACKAGED SOFTWARE*** Included on this CD is the software that makes Microsoft run and hide. Free tools, freely distributed, hand picked from around the world. These tools allow for a 100% complete programming environment that VisualStudio could never beat. Any kind of programming currently in existence is included, from basic learning to web programming to advanced COM and device driver development. (Microsoft doesn't want you to know that these tools are available. They have nothing that can compete.) These tools include: * Perl 5.005_03, PerlMagic port. (Perl 5.6 is not stable at this time.) This port of perl contains only the true Win32 port of Perl. This means that embedding and extending are not corrupted, as they are in other Win32 ports of Perl. As the hands down industry standard language for web and administration programming, and as the most powerful script programming and text programming language in existence today... not to mention the fastest, Perl is a "must have" for everyone, even if it's to use it as a super-advanced command line tool. * TclTk, the original "popular" scripting language, and the first scripting language (that we know of) to put GUI programming in reach of entry-level programmers. * Python, the up-and-coming scripting language preferred by its several-hundred-thousand-member community. * A large set of GNU programming tools, such as grep, diff, patch, awk, sed, merge, and many others required for full- featured programming. * The REBOL language, an extremely high-level language that allows you to send an email in one line of code. Of course, this is just an example. If it can be done on the internet, REBOL can do it in the blink of an eye. No complicated sockets or protocol programming to get in the way. * The wxWindows GUI toolkit for C/C++ brings simple, object- oriented Windows programs within easy reach of the average Joe or Josephine. No longer do poor-quality COM and ActiveX components rule the Windows GUI world. * The industry standard GNU C++ complier for Win32 (MinGWin), with its accompanying Assembler, Fortran77 compiler, and C and Objective C Compliers and tools. (Who said programming in C took a $1000 set of do-little wizards? Oh, that's right, Microsoft does!) * The DJGPP DOC C compiler used for many years by C programmers around the world. * Cint, C Interpreter powerful enough to run itself running a program written in C. (Yes, you read that right, it is powerful enough to run its own source code, and have that running code run another program.) There are times when the code-compile- link-run steps need simplification. Just write it and run it with this tool. * YaBasic, proof that BASIC is not a Microsoft commodity. * Other tools and languages, more of which will be added until no language is unavailable to our users, and people begin to realize that they really do have better choices than the supposed de-facto standards dictated by Redmond. ***THE PACKAGE*** All of this comes in a tidy package to tie everything together. New programmers can use just one language, and not have to worry about any of the others (but can graduate to them when the need arises). Hackers (the guys who wear the propeller hats) can enjoy learning and using everything in the most complete programming package available anywhere for the Win32 platform. One of the most pervasive problems with getting these superior tools into the public workplace is the lack of wizards, gadgets, buttons, gizmos, and little spinning icons. In other words, management has always liked these languages, but couldn't find themselves accepting them, because of the lack of any congruity between them, or of any interface for them. This package provides that interface once and for all. ***SUPPORT*** CodeMagicCD includes free installation support, per-incident phone support, free email support, and mailing list support. The languages contained in the package collectively have over 100 methods of free and commercial support. Nothing at Microsoft can top that. From tom-main at REMOVEME.home.com Mon Apr 24 19:57:15 2000 From: tom-main at REMOVEME.home.com (Tom) Date: Mon, 24 Apr 2000 23:57:15 GMT Subject: OOP books that compare - what about Python? Message-ID: I've been browsing two books that compare and/or teach OO languages: An Intro to OOP by Timothy Budd, and Objects Unencapsulated by Ian Joyner. Both seem good, both cover C++ and Java, but neither consider Python. Any recommandations? Thanks, Tom From glhansen at steel.ucs.indiana.edu Wed Apr 5 13:39:08 2000 From: glhansen at steel.ucs.indiana.edu (Gregory L. Hansen) Date: 5 Apr 2000 17:39:08 GMT Subject: MacPython and Tkinter Message-ID: <8cftns$udt$1@flotsam.uits.indiana.edu> I've just installed Python 1.5.2 for Macintosh, and it seems to work well enough except that none of the Tkinter demos work. When I try to run a demo script like Guido's "brownian.py", I get "ImportError: No module named Tkinter". The ConfigurePython app throws up a dialog "Locating plugin modules..." that disappears so fast I hadto run it many times to figure out what it said. What could be the problem? Do I need to download the Tkinter module seperately from somewhere? -- "Ballpark nachos -- you don't buy them, you just rent them." -- Hank Hill From debl.nospamm at world.std.com Sun Apr 30 21:31:18 2000 From: debl.nospamm at world.std.com (David Lees) Date: Mon, 01 May 2000 01:31:18 GMT Subject: COM question Message-ID: <390CDC8B.779DB0C3@world.std.com> I am working examples in Hammond book on Python. How do I get a list of names of COM objects? I am on page 67 and and to know how to figure out what is the name for a Microsoft Word object. In the example it is referred to as: "Word.Application", but this gives a name error. I am doing the client call correctly, because when I substitute "Excel.Application" or "Access.Application" I have not problem opening and closing Excel or Access. Apparently Word must have a different name for COM stuff on my system, so I thought that if someone can tell me how to look at the list of COM objects the name will be obvious. I have Norton Utility under Win95 OSR2, so I can easily look at the Registry (though as a Win95 newbie, much of it is not intelligible) Thanks in advance. David Lees From tim_one at email.msn.com Tue Apr 18 02:43:14 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 18 Apr 2000 02:43:14 -0400 Subject: Another question In-Reply-To: Message-ID: <000201bfa901$5f32f620$642d153f@tim> [Michael Hudson] > ... > For that last dreg of performance you might try: > > import random > def do_it(randint=random.randint,xrange=xrange): > r = [0,] * 100000 > for i in xrange(100000): > r[i] = randint(1,10) > do_it() Or even make the guts: r = range(100000) for i in r: r[i] = randint(1, 10) > But really, this is getting silly; if performance is this much of an > obsession you aren't going to have that much fun with Python. To the contrary, speeding a language that fights you each step of the way is rather akin to seduction -- what could be more fun than that ? python-is-the-language-of-lovers-ly y'rs - tim From mwh21 at cam.ac.uk Fri Apr 28 09:05:57 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Apr 2000 14:05:57 +0100 Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8eacdf$nnm$1@newshost.accu.uu.nl> <280420000751353947%pecora@anvil.nrl.navy.mil> Message-ID: "Louis M. Pecora" writes: > In the above I would describe things as follows (am I right or wrong?): > > (1) data and self.data point to the same object, a list, so when a > method is called it is the method that works on that instance of a list > and either data or self.data will append 'foo' to the same list object. > > (2) when you do more=more+1 an new object (the more+1 value) is created > and more then points to it and no longer to the old value of self.more. > The latter still exists and points to the original 10 object. > > (3) Similar story here for interesting where a new object > interesting[10:] is created and interesting is "switched" to point to > it. self.interesting still points tohe "foo" object. > > I hope I got that right, because they have tripped me up a few times. Yes! That's right. Simple isn't it (once you understand, anyway)? Cheers, M. -- If i don't understand lisp, it would be wise to not bray about how lisp is stupid or otherwise criticize, because my stupidity would be archived and open for all in the know to see. -- Xah, comp.lang.lisp From a.d.stribblehill at dur.ac.uk Fri Apr 7 07:10:07 2000 From: a.d.stribblehill at dur.ac.uk (Andrew Stribblehill) Date: 07 Apr 2000 12:10:07 +0100 Subject: CGI extension problem References: Message-ID: <87ya6q5fqo.fsf@womble.dur.ac.uk> Robin Becker writes: > I don't have root privilege, my python cgi script needs access to an extension which I have > built; the extension in turn needs a shared lib which I have built. I install in a directory say > $HOME/lib. When I run the cgi script I need to set the LD_LIBRARY_PATH to at least include > $HOME/lib. I have use the following idiom > > import sys, os > HOME_LIB='/home/me/lib' > if sys.platform != 'win32' and not os.environ.has_key('LD_LIBRARY_PATH'): > os.environ['LD_LIBRARY_PATH'] = HOME_LIB > os.execve(sys.argv[0],sys.argv,os.environ) > > # rest of cgi script > ..... > > I can think of a few ways in which this might break, but is there anything obviously easier less > breakable? Wouldn't it be better to use LD_RUN_PATH when /compiling/ the extension? Then it won't need a LD_LIBRARY_PATH variable at runtime. Obviously you then have to make sure that this location stays the same else you'll need to resort to the LD_LIBRARY_PATH hack (or recompile) again! Cheerio, Andrew Stribblehill Systems Programmer, IT Service, University of Durham, England From effbot at telia.com Wed Apr 12 10:39:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 12 Apr 2000 14:39:33 GMT Subject: Compiling Python Imaging under LinuxPPC References: <20000412234630.21095@nms.otc.telstra.com.au> <20000412102120.18661.00002626@ng-cg1.aol.com> Message-ID: William F. Adams wrote: > Greg McFarlane was kind enough to clue me in to BLT being: > >A graphics extension to Tk: > > http://www.tcltk.com/blt/ > > I've got that, but still having trouble with python imaging, now because > imaging.h isn't appropriately installed---I found a message on the Sketch list > which had a patch, but that won't work on my LinuxPPC install, reports it as > being garbage.... > > Can I just d/l Imaging.h manually from somewhere or copy it in to > /usr/include/python1.5 by hand? eh? Imaging.h is part of the PIL distribution (it's in the libImaging directory) and the standard Setup file already points to it. as long as you follow the instructions in the README, you shouldn't really have to move it around... From pecora at anvil.nrl.navy.mil Fri Apr 14 07:17:19 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Fri, 14 Apr 2000 11:17:19 GMT Subject: Need full example of C extension on Macintosh (CW) References: <120420000714412887%pecora@anvil.nrl.navy.mil> <38F62C97.FD5073B@spacenet.tn.cornell.edu> Message-ID: <140420000717194110%pecora@anvil.nrl.navy.mil> In article <38F62C97.FD5073B at spacenet.tn.cornell.edu>, Tom Loredo wrote: Tom, I got a small extension to work (! succeess). I have written it up and will pass it by the Mac-Python crowd to see if there are any mistakes (I am still unsure of some rules about naming things), but I think I have the general scheme down. I am using CW3 (plan to upgrade in a few months). I will send you the text file of my write up separately. It's not ready for prime time. Let me know what you think and if there are differences for CW5. From javanet at dynacap.com Wed Apr 12 17:34:58 2000 From: javanet at dynacap.com (Arnaldo Riquelme) Date: Wed, 12 Apr 2000 13:34:58 -0800 Subject: Python 4 DOS References: <38F48C6D.FD671082@interet.com> Message-ID: > Did you try running it *with* the DOS extender? I have no experience > using Python on DOS with the extender, but I've used other prorgams which > required it (DooM, DJGPP [I think]), and they won't work without it. > GO32.exe, or something like that? > > > Aaron > ---- Thanks Aaron, I looked into DJGPP and it all makes sense now. Arnaldo Python rules!! From effbot at telia.com Thu Apr 13 15:17:45 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 13 Apr 2000 19:17:45 GMT Subject: 1st non-trivial program - gentle criticism requested References: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> <8d4tgu$11qa$1@nntp6.u.washington.edu> <38F6193A.66284778@gte.com> Message-ID: Gary D. Duzan wrote: > This potential stumbling block makes me wonder if allowing the > singleton case was really wise. stumbling block? what kind of programmer changes his code without thinking, reading what he just typed, or running the resulting program? if you want to optimize python for that kind of programmer, you have to change a whole lot more than the string formatting operator... From johnm at magnet.com Thu Apr 20 13:12:45 2000 From: johnm at magnet.com (John Mitchell) Date: Thu, 20 Apr 2000 13:12:45 -0400 Subject: Creating Classes Dynamically? In-Reply-To: Message-ID: On Thu, 20 Apr 2000, Jerome Chan wrote: > Is there a way to create an object of a class from a string? You can save and restore objects using the 'pickle' module: import pickle class Struct: pass # create new object 'j' # j = Struct() j.name = 'john' j.title = 'stud' # package it up # x = pickle.dumps(j) print x # "x" is a semi-printable representation of object "j": # => looks something like "(i__main__ Struct p0 # (dp1 S'title' p2 S'stud' p3 sS'name' p4 S'john' p5 sb." # z = pickle.loads(x) # "z" is a new object, loaded from "x", which is a # copy of our original object. To test it, print out its name. # print z.name # => "john" Also check out the shelve and binascii modules. - j From dan at cgsoftware.com Wed Apr 12 09:11:52 2000 From: dan at cgsoftware.com (Daniel Berlin+list.python) Date: 12 Apr 2000 09:11:52 -0400 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) In-Reply-To: m.faassen@vet.uu.nl's message of "12 Apr 2000 11:09:18 GMT" References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d1lgu$ga0$1@newshost.accu.uu.nl> Message-ID: >>>>> "Martijn" == Martijn Faassen writes: Martijn> Daniel Berlin+list.python wrote: tom> -- Is there a Python equivalent of CPAN and the Perl CPAN tom> module? The closest I know of is Parnassus. But Parnassus tom> is merely a collection of links, not an archive, and it tom> doesn't have any facilities (AFAIK) for automatic tom> installation. >> So, who gives a crap? I try not to be that lazy. Martijn> I care, for instance. The distutils people care. Please Martijn> don't assume nobody cares when there's a whole SIG about Martijn> this issue. I didn't say nobody cares, i was basically saying i don't see all that many complaints about this on the python lists. Maybe i'm just missing them. I realize their is a whole SIG about the issue, but it's not a problem for me. Martijn> It's not only about laziness (though that's a good trait Martijn> in a programmer :), it's about accessibility. Python Martijn> modules should be very easy to get and install. No doubt this is true. Martijn> This Martijn> makes Python more useable by people who don't know Martijn> Python, such as sysadmins, and users. It also is good for Martijn> Computer Programming for Everybody. Sure, i'm all for it too, I just don't see why it should be all that high of a priority. I also don't see why Tom praises the CPAN module so much. My main problem with it is " 203 installed modules have no parseable version number " Yet i haven't installed any modules for PERL on my own. Martijn> [snip] >> Why do i get the feeling you'll never be satisfied? Martijn> Why attacking Tom so much? I've not attacked him at all. I simply asked a question. Martijn> What has Tom done to you in Martijn> the past? Why does he get the bad reception he does? Because he comes in here with both barrels firing. What reception did he expect? Martijn> He Martijn> isn't spreading misinformation, is he? He has reasonable Martijn> requests, in my opinion. Martijn> Quick-someone-start-a-math-discussion!-ly yours, From rhicks at nospam.rma.edu Fri Apr 14 19:41:21 2000 From: rhicks at nospam.rma.edu (Robert Hicks) Date: Fri, 14 Apr 2000 23:41:21 GMT Subject: TCP/IP protocols References: Message-ID: Did you look at the LIB documentation? Python has a plethora of documentation (in PDF) on the website http://www.python.org/doc/ Have fun! Bob "Jeff Massung" wrote in message news:ZSMJ4.1099$Y14.27933 at news.uswest.net... > I'm new to Python programming, but am very experienced in C/C++. Could > someone point me to a good reference for TCP/IP programming with Python > (pdf, book, anything :]) thanks. > > Jeff > > From ullrich at math.okstate.edu Sun Apr 2 15:43:47 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Sun, 02 Apr 2000 14:43:47 -0500 Subject: Does Python have a long floating data type please? References: <000601bf9c18$4d147e00$182d153f@tim> Message-ID: <38E7A2F3.566CC0EE@math.okstate.edu> Tim Peters wrote: > [David C. Ullrich] > > ... > > Exactly what convinced me that a real should be a pair of > > longRationals (giving a lower bound and an upper bound for the > > "real" value). At least the basic arithmetic operations seem > > simple enough that a person could get them right, and they'd be > > obviously right. > > ... > [Stuff that Tim claimed he'd find exciting snipped] > > Yes, this is what I'd do too -- you'll get something you can trust much > faster this way. Jurjen's real.py can be viewed as space optimizations of > this approach, first representing the interval by a midpoint and a delta, > then fixing the delta at 1 by introducing a power-of-2 scale factor instead. > The details are tricky, though! > > Something all "interval" approaches have problems with is systematic > pessimism. The classic example is > > y = x - x > > y is in fact exactly 0 no matter how fuzzy x is, but straightforward > interval subtraction yields a result centered at 0 and twice as fuzzy as x. > > In your original post you had a milder example, x*x. This has got to be >= > 0 in actuality, but if x is e.g. [-2, 2] then straightforward interval > multiplication yields [-4, 4] instead of [0, 4]. > > Because of this pessimism, some simple series approaches to building > functions (like exp and sin etc) out of the arithmetic primitives can fail > to converge; this is where proofs start to get hard despite (or perhaps > because of ) the simplicity of the primitives. I guess I shouldn't say I don't see the problem until I've done it. Exp is increasing, so it seems easy: given that a <= x <= b what follows about exp(x) is exactly exp(a) <= exp(x) <= exp(b); you calculate exp(a) and exp(b) as precisely as needed, insert the appropriate fudge factor and there you are. (If you're talking about summing the power series with an interval-valued argument I see why that would be tricky. But I don't see why you'd do that.) Sin is not quite so simple, since it's not increasing. But given a <= x <= b what follows about sin(x) is A <= sin(x) <= B, where each of A and B is either sin(a), sin(b), 1, or -1, depending on where the multiples of Pi lie wrt the interval [a,b]. Seems like a few cases to consider (and we have to start by getting (a divmod pi) to the appropriate precision) but I don't see any big problems. Easy to say, I guess. > > doable-in-the-end-but-it-doesn't-stay-trivial-ly y'rs - tim From A.Weis at t-online.de Fri Apr 7 19:14:09 2000 From: A.Weis at t-online.de (Arnold Weis) Date: Fri, 07 Apr 2000 23:14:09 GMT Subject: Paid to work in Python? (was: Re: Choice Of Language) References: <8c3ats$b5f$1@nntp.Stanford.EDU> <38e5f8ed.29659873@news.nikoma.de> <8cl2mq$971$1@mawar.singnet.com.sg> Message-ID: <38ee674b.1229749@news.main-echo.net> ngps at madcap.dyndns.org (Ng Pheng Siong) wrote: >I once saw a German term that was translated to "improve-worse-ment." > >Can some one provide the German word, please? Verschlimmbesserung? (Trying to make something better, but making it worse instead) Regards Arnold From exarkun at flashmail.com Sun Apr 16 17:44:48 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Sun, 16 Apr 2000 21:44:48 +0000 Subject: Python w/ SSL Message-ID: <38FA3450.1DD845B2@flashmail.com> Can anyone point me to an *up to date* Python/SSL interface? I've found about 4 w/ search engines, but the most recent is from 1996 and has a link to Python 1.3 in case you are without an interpreter ;) (It also doesn't help that starship is still down - again :( ) Thanks in advance Jp -- If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per per gallon, and explode once a year killing everyone inside. -- Robert Cringely, InfoWorld -- 9:43pm up 19 days, 2:50, 0 users, load average: 0.02, 0.07, 0.09 From twcook at iswt.com Mon Apr 3 20:12:00 2000 From: twcook at iswt.com (Tim Cook) Date: Tue, 04 Apr 2000 00:12:00 +0000 Subject: PyGreSQL errors References: Message-ID: <38E93350.4BFAF363@iswt.com> Lee Joramo wrote: > > I am trying to get pygresql to work. I have a Cobalt RaQ3 server which runs > a slightly modified version of RedHat. The system came with PostgreSQL > pre-installed. When I import the pygresql's basics.py tutorial at pythons I have no experience with PygreSQL BUT! I suggest that you download and install PostgreSQL according to their documentation. I tried to go searching around for where the RH RPM put things and it was very different from the PostgreSQL docs. I just found it easier to do a full build from source. Hope this helps, -- Tim -- Open Source Health Care Alliance Join us to help build solutions! http://www.openhealth.com/en/healthcare.html From effbot at telia.com Thu Apr 13 06:33:56 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 13 Apr 2000 10:33:56 GMT Subject: Why is if a in dict.keys() so slow..... References: <38F5A075.CDFA32D9@bedford.waii.com> Message-ID: Martin Franklin wrote: > Just thought i'd throw this out there.... > > This is very slow:- > > if split[0] in map_dict.keys(): > print 'found it!', map_dict[split[0]] > else: > print 'not found' > > Compared to:- > > try: > print 'found it!',map_dict[split[0]] > > except: > print 'Not found' > > The dictionary had about 40000 key:value pairs and I needed to > look through it 250000 times..... > > Question is why? any special reason you couldn't figure this out from the documentation? ;-) if you read up on dictionaries and the "in" operator, you'll find that: keys() creates a list of 40,000 items, and "in" does a linear search in that list... ...while [key] looks the key up in a data structure which is carefully designed for fast lookups. (btw, the try/except version is faster only if you have more hits than misses. otherwise, you may get better performance by using "if dict.has_key(key)".) From sholden at bellatlantic.net Tue Apr 4 17:55:03 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 04 Apr 2000 21:55:03 GMT Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> Message-ID: <38EA640F.FBC878CB@bellatlantic.net> Ivan Van Laningham wrote: > > Hi All-- > I'm finally getting a chance to use Python at work. I have two > questions: > > 1) Is there a way to run silent (i.e., we determine where things go and > the customer never sees any wizards) installs of Python, Tcl/Tk and > Win32all? > I'll have to leave this to the cognoscenti: I just ran the standard install. > 2) What stuff do I need to use msaccess with Python? Do I need to use > Win32all, or can I use Tkinter for my (minimal) GUI, with msaccess? > Win32all might be more appropriate if you want to drive Access as a COM object, but if you just need access to it as a data source, ODCB is going to give you most of what you want. I would recommend, from personal experience, the mxODBC module, written by Marc-Andre Lemburg. There's no reason why you shouldn't mix this with Tkinter GUI code. It works fine alongside wxPython window interfaces. See http://starship.python.net/crew/lemburg/mxExtensions.html as your starting point. I also like mxDateTime, which is required anyway by mxODBC. regards Steve > -ly y'rs, > Ivan > ---------------------------------------------- > Ivan Van Laningham > Callware Technologies, Inc. > http://www.pauahtun.org > http://www.foretec.com/python/workshops/1998-11/proceedings.html > Army Signal Corps: Cu Chi, Class of '70 > Author: Teach Yourself Python in 24 Hours -- "Bulding information systems just because it's fun." Steve Holden sholden at bellatlantic.net 703 716 7275 From sholden at bellatlantic.net Sun Apr 2 14:41:29 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sun, 02 Apr 2000 18:41:29 GMT Subject: was Re: Why should I switch to Python? References: <1EeF4.43$CA.2422@news> <38E618D7.A15F9D9B@webwitches.com> <05AB7F747D3FC9FA.FF1C6A9D99274EAE.D8581C4B2696A7E4@lp.airnews.net> Message-ID: <38E79424.F10BA58@bellatlantic.net> Sounds like the time machine could come in handy here too :-) Cameron Laird wrote: > > In article <38E618D7.A15F9D9B at webwitches.com>, > Shae Erisson wrote: > . > . > . > >maybe a newsgroup bot that finds common text patterns and posts FAQtual > >replies? > . > . > . > Comp.lang.tcl does this, by the way; a bot emits > > to first-time posters. There is discussion now about > refinements involving multi-posting, posts that mention > "newbie", automated answers to common questions, ... > We're thinking as seriously as possible about how to > send it out *before* they first ask for it ... > -- > > Cameron Laird > Business: http://www.Phaseit.net > Personal: http://starbase.neosoft.com/~claird/home.html -- "Bulding information systems just because it's fun." Steve Holden sholden at bellatlantic.net 703 716 7275 From rhicks at nospam.rma.edu Wed Apr 19 15:21:24 2000 From: rhicks at nospam.rma.edu (Robert Hicks) Date: Wed, 19 Apr 2000 19:21:24 GMT Subject: SNiFF+ for Linux Message-ID: There was a "how-to" to integrate Python into SNiFF+. I have 2 questions regarding this: 1. Does anyone have this info? 2. Does it work with the free Linux version that only supports C/C++? Thanks, Bob From hniksic at iskon.hr Tue Apr 4 09:04:19 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 04 Apr 2000 15:04:19 +0200 Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> Message-ID: "Fredrik Lundh" writes: > -- tuples can be used as dictionary keys. mutable collections can > not. This is wrong. > -- good designers know that hypergeneralization tends to be a bad > idea. ...and this is arm-waiving. Sorry, couldn't resist. :-) From me at nospam.edu Wed Apr 26 16:32:43 2000 From: me at nospam.edu (Me) Date: Wed, 26 Apr 2000 20:32:43 GMT Subject: References: <8e4cc2$d5t@netnews.hinet.net> Message-ID: right...but since this newsgroup doesn't have the special designation...it is in English. Samuel A. Falvo II wrote in message news:slrn8gei3a.2um.kc5tja at garnet.armored.net... > In article , Andy Lester > wrote: > > >> The official language of usenet newsgroups is English, > > > >Oh? And where's THAT defined? > > If memory serves me correctly, I believe that it is a *recommendation* (not > necessarily a strict standard) that English be the `official' language of > Usenet newsgroups, in the RFCs. I recall seeing a statement to the effect > of (paraphrased), "Newsgroups which are not in English should append their > two-character ISO country identifier to the newsgroup name." Thus, the > French-speaking comp.lang.python would appear as comp.lang.python.fr; > likewise, an Italian alt.rec.radio.amateur would be formed as > alt.rec.radio.amateur.it. > > -- > KC5TJA/6, DM13, QRP-L #1447 > Samuel A. Falvo II > Oceanside, CA From nascheme at enme.ucalgary.ca Thu Apr 20 02:37:49 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Thu, 20 Apr 2000 00:37:49 -0600 Subject: __del__ problem - would adopting Garbage Collection fix this? In-Reply-To: ; from just@letterror.com on Thu, Apr 20, 2000 at 08:35:13AM +0100 References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> <38FE7F1E.168E914A@cosc.canterbury.ac.nz> Message-ID: <20000420003749.A31345@acs.ucalgary.ca> On Thu, Apr 20, 2000 at 08:35:13AM +0100, Just van Rossum wrote: > Maybe you're right, but to me it feels this is in the exact > same category as a __del__ exception, so ignoring & collecting > seems more logical to me as a default. It shouldn't be hard to change. I will wait until I get some more feedback though. Neil -- "More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason, including blind stupidity." -- W.A. Wulf From donn at u.washington.edu Mon Apr 24 18:29:48 2000 From: donn at u.washington.edu (Donn Cave) Date: 24 Apr 2000 22:29:48 GMT Subject: sys.exit References: <3904C35C.B16BDE75@mindspring.com> Message-ID: <8e2hss$1250$1@nntp6.u.washington.edu> Quoth Chuck Esterbrook : | The short question: | | If I catch a SystemExit exception (because of an invocation of | sys.exit(code)), how do I examine the argument to sys.exit()? ... | Upon printing the "excInfo" tuple I get: | | (, , ) | | And the attributes of the SystemExit instance are: | | ['__doc__', '__init__', '__module__'] | | I don't know how to get my hands on the exit code. That's not the instance you're looking at there, but the class, so that's kind of a red herring. The instance has a 'code' attribute for you. So you need something like eclass, einstance, etrace = sys.exc_info() if eclass == SystemExit: if einstance.code == 0: self._errorOccurred = 0 Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From thomas at cintra.no Thu Apr 20 16:02:29 2000 From: thomas at cintra.no (thomas at cintra.no) Date: Thu, 20 Apr 2000 20:02:29 GMT Subject: Sax installed, but not working Message-ID: <38ff5f04.1047500@news.c2i.net> Hi, I`m using Python 1.5.2 on a Mandrake 7.0 Linux box. Installed python-xml-0_5_1-2_i386.rpm and xml.sax exists in the site-packages folder. But when I try from xml.sax import * it fails and says there`s no module called sax. All the demo-scripts and tutorials I`ve tried fails too. What`s wrong? I`ve got the saxlib.zip and saxdrv.zip too, but they seem to be installed correctly. All I actually need is to traverse a tree generated from a xml-document and stuff each data-element into a database, based on tag-location and sibling-relations. Hints??? Thomas From gaiusm at my-deja.com Thu Apr 20 14:14:03 2000 From: gaiusm at my-deja.com (gaiusm at my-deja.com) Date: Thu, 20 Apr 2000 18:14:03 GMT Subject: pythonware site is down?? Message-ID: <8dnhcr$104$1@nnrp1.deja.com> I was trying to download the Python Imaging Library (PIL). But the pythonware site seems t be down. I'm seeing a directory tree and not much in it when I point my browser at www.pythonware.com. Puzzled, Gaius Sent via Deja.com http://www.deja.com/ Before you buy. From emile at fenx.com Thu Apr 20 22:55:37 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 20 Apr 2000 19:55:37 -0700 Subject: editor for win32 References: Message-ID: <01b301bfab3d$161fc9c0$01ffffc0@worldnet.att.net> And it supports line numbers (easier debugging from tracebacks) visible whitespace (no tab vs space issues) workspaces (multiple associated source files) find on disk with jump to's (great for finding examples of usage or source) Hex display mode (analyzing bianry content) save in dos/mac/unix format (edit other sources) and-reg-ex-search-and-replace-too ly y'rs, Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: news-server Newsgroups: comp.lang.python To: Sent: Thursday, April 20, 2000 6:37 PM Subject: Re: editor for win32 > Textpad is a great programming text-editor. It has Syntax highlighting for > all the popular languages and various other languages. Even has syntax > highlighting for SQL and IDL. > > You can get it at www.textpad.com (you can also add your python interpreter > to the tools and run your programs from within textpad). > > > Scott Hathaway wrote in message ... > >Can anyone recommend a python editor for Windows? > > > >If there is an IDE for windows (other than IDLE), even better. > > > >Thanks, > >Scott > > > > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From just at letterror.com Thu Apr 20 13:16:38 2000 From: just at letterror.com (Just van Rossum) Date: Thu, 20 Apr 2000 18:16:38 +0100 Subject: __del__ problem - would adopting Garbage Collection fix this? In-Reply-To: <000801bfaa9c$c9957aa0$d62d153f@tim> References: Message-ID: At 3:48 AM -0400 20-04-2000, Tim Peters wrote: >BTW, this was all discussed at extreme length on Python-Dev -- check it out! >I doubt anyone wants to repeat all of that whlie struggling to pretend it's >new & interesting . Last time I looked, I couldn't find a *single* link on python.org that points to python-dev subscription info. Even a search for "python-dev" reveals nothing... but-you've-convinced-me-anyway-ly yrs - just From jschmitt at vmlabs.com Mon Apr 24 14:28:23 2000 From: jschmitt at vmlabs.com (jschmitt at vmlabs.com) Date: Mon, 24 Apr 2000 18:28:23 GMT Subject: regulare expression searches and newlines References: <8e0oco$k75$1@nnrp1.deja.com> Message-ID: <8e23nr$21d$1@nnrp1.deja.com> I guess I forgot to mention that I got it to work by not looking at the beginning of the line. It turns out that for my data set, not looking for targets only at the beginning of a line was ok. I guess if I'm running Python in Windows and I'm searching inside (I'm assuming) a Linux or a Mac text file, Python thinks the file is just one long line. For the general case, the answer is to make the text files native to your platform. John In article , "Fredrik Lundh" wrote: > schmitthead at my-deja.com wrote: > > I was doing a search like this: > > > > searchobj = re.compile( r'^foobarbaz' ) > > > > where I was looking for something at the beginning of a line. This > > works well for native text files, but not when I was searching through > > Linux files running on NT or NT files on Linux or some other variation > > because of the newline difference, I guess. Is there any way to handle > > the general case? > > there's nothing wrong with your regular expression. > > I suggest printing the strings you're trying to match against, > to see if you can figure out what's wrong. > > if that doesn't help, post the code. > > > > Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Mon Apr 10 01:57:14 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 10 Apr 2000 07:57:14 +0200 (IST) Subject: A Mountain of Perl Books + Python Advocacy In-Reply-To: <8cr4an$j40$2@newshost.accu.uu.nl> Message-ID: On 9 Apr 2000, Martijn Faassen wrote: > Anyway, yeah, that's what I noticed in this newsgroup. Whenever someone asks > if Python is a good language Tim Peters tells them to check out Haskell, or > someone mentions Smalltalk or Scheme or Lisp or whatnot. It's rare that > people are being sent to C or C++ (unless it's for Python extensions) or > Perl though (but it does always get the 'good for fast text processing' > mention). It's nice to see so many comparisons between languages here. Ah, Martijn, this is all part of the standard Timbot trick to prove Python rules -- in his on words, about how to provide an objective comparisons between languages, "just say 5 good points about every language, and conclude 'it obvious that overall, Python wins'". (He also gives a few nice examples) world-domination-through-brain-washing-ly y'rs, Z. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From johann at physics.berkeley.edu Wed Apr 5 13:08:42 2000 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 05 Apr 2000 10:08:42 -0700 Subject: Why should I switch to Python? References: <000701bf9c5a$b806b420$752d153f@tim> <050420000914595917%pecora@anvil.nrl.navy.mil> Message-ID: Louis M Pecora writes: > In article , Michael Hudson > wrote: >> don't know it; I think it involves slinging Riemann zeta functions). > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > There's a good phrase. Holy slinging Riemann zeta functions, Batman! Quick, Robin, fetch the Bat-Conformal-Mapper. -- Johann Hibschman johann at physics.berkeley.edu From exarkun at flashmail.com Sat Apr 15 07:30:33 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Sat, 15 Apr 2000 11:30:33 +0000 Subject: Python CGI Message-ID: <38F852D9.E2144F17@flashmail.com> I recently converted one of my perl CGI's to Python, and came across an bizarre and extremely undesirable side affect - Whenever a form that uses the Python script as its ACTION, the python scripts seems to get executed about 8 times. At first I thought there was some logic error in my program making it octuple all the output, but I can't find anything that might do this. Has anyone seen this before, or know how to fix it? Thanks in advance, Jp -- Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes and weighs 30 tons, computers in the future may have only 1,000 vacuum tubes and weigh only 1.5 tons. -- Popular Mechanics, March 1949 -- 11:27am up 17 days, 16:34, 1 user, load average: 0.23, 0.11, 0.04 From shecter at darmstadt.gmd.de Tue Apr 25 22:27:57 2000 From: shecter at darmstadt.gmd.de (Robb Shecter) Date: Wed, 26 Apr 2000 04:27:57 +0200 Subject: Metaclasses? References: <3905F4A0.2B39C705@darmstadt.gmd.de> Message-ID: <3906542D.62B94F17@darmstadt.gmd.de> Michael Hudson wrote: > > b) How, when you've "fixed" Python do you propose, in method bodies, > to distinguish between local and instance variables? I might drop > my longstanding habit of complaining about people complaining about > the necessity of "self" if you can answer this question... > Ah hah. I see the problem. The language would need to be extended in one of three ways, right? Either: Choice A: Have a smalltalk-like instance variable declaration. Choice B: Have a smalltalk-like local declaration in each method. ...and then, depending on which way the language changed, this would determine the lookup rules for the variable. (ie. with choice A, it'd be: "if it's not explicitly declared, then it's a local variable.") Choice C: Have both A & B (like smalltalk does). This last one is probably not necessary, and not very much like a scripting language anymore. Now that I've written this all out, I have to say that I like "Choice A". I come from Java, and it did bug me a bit that there was no one easy place to see what instance variables a class has. It made understanding the XML parser source code harder, for example. PS: I didn't mean to imply that Python is "broken". I guess that the repeated "self" just rubs me the wrong way. - Robb From culliton at clark.net Sat Apr 1 15:28:01 2000 From: culliton at clark.net (Tom Culliton) Date: Sat, 01 Apr 2000 20:28:01 GMT Subject: Why should I switch to Python? References: <00033120055300.03687@quadra.teleo.net> Message-ID: In article , Aaron Turner wrote: >In article <00033120055300.03687 at quadra.teleo.net>, Patrick Phalen wrote: >Yeah, I found those before I posted (as well as reading the archives of >this group on deja news). Honestly I found them for the >most part very lacking in technical information. Mostly things like: > >- Perl code is ugly, Python code is easy to read >- Python was OO from the start, Perl's OO was a bolt on > >But things like this aren't particularly useful in trying to determine >which language gets the job done better. Code readibilty has >historically been a human problem which is solved with coding >standards set for the programmers IMHO. So I'm more interested in >things like: Calling readability a "human problem" begs the issue, some languages encourage readble code and discourage unreadble code while others make it almost painful to write stuff that makes sense a few days later. This issue is especially critical given the statistical trusim that half of the people developing code have skills which are below average. I'll go further and say that about 70-80% just want to get through their day without putting out anymore effort than absolutely necessary. A language that still makes it possible for this segment of the community to produce maintainable code is an enormous win. In my experience Python is such a language, and Perl most definitely is not. >- What is the impact of Python's OO being there from the start? >- Does it perform better? >- Is it significantly easier to use? >- More powerful/support features that aren't in Perl yet? > >Honestly the more I reasearch, the more it seems that it's purely >a matter of taste. If you like Perl, there's nothing inherient about >Python that makes it better. Sorry if this just sounds like a troll, but >I'm really trying to get a feel about something I know nothing about >from personal experiance. You're dismissing subjective arguments ("easy to read") in one breath and then asking subjective questions ("significantly easier to use") in the next. Do you honestly want to be convinced or are you just looking for rationalizations not to switch? >Basically if you know both languages, and were planning a mid-sized >project, why would you choose Python? It's hard to take my friend >seriously in his evaluation when he says he'd rather do this project >in C++ than in Perl (especially when he doesn't know Perl). We choose Python after doing a survey of "scripting"/VHLL languages, with Perl, TCL, Scheme, and Python being the main contenders. We also looked at (and continued to look at) a variety of less well know options. Going into the evaluation we had strong backgrounds in C, C++, shell, awk, ... and substantial experience with all of the better known languages but Python. Python still won going away. Perl was slightly faster but was just too cryptic and made it too hard to write maintainable code. TCL was smaller, a bit easier to extend/embed, and had tools like TK and Expect, but was just too slow, only really had two types (strings and lists od strings) and didn't catch typos that the Python compiler yelled about right away. Scheme was... well... scheme. Lisp fans to the contrary it just wasn't for us. It didn't have the libraries of modules we needed, we got lost in the parenthesis even with the editors help, ... Scheme is a beautiful elegant powerful expressive language, but it just isn't most peoples cup of tea. Python was a delight. At first we all pulled faces at the significant whitespace, but it grew on us since it enforced uniform layout. The libraries and builtin types were a treasure chest, the syntax clean and elegant, the support for OOP amazingly straight forward. The documentation was generally excellent, written with a clarity and lucidity which would put most native speakers to shame. ("This guy is Dutch? He writes like Brian Kernighan." (We'd all been struggling with Bjarne's 1st edition a bit too long.)) We were intrigued. We grew enthusiastic. We became rabid fans. There were things that we still wished for, more speed (but it was fast enough), the ability to do more static type checking (none of the langauages on our short list really provided this though), the ability to do more stringent encapsulation, ... But in practice we seldom found these to be real problems. You can teach the basics of Python to someone in an afternoon. I've done it many times. After getting past the inital resistance to learning something new, people with programming experience seem to "get it" amazingly fast. There are remarkably few puzzled or pained looks, and many smiles of delight. The enthusiasm grows quickly, especially when you show them things like a full blown multi-user chat server in a page of easily understood code, or a utility of roughly the same size and clarity to do DB to DB transfers without fighting with dump formats and the like, or when they whip together a clean solution to some otherwise difficult problem on their own in a couple hours. THIS is why the buzz about Python is on the verge of becoming deafening. Try it for a week or two. Do some small projects or utilities with it. Read a couple of the tutorials and the examples in the Lib, Demo, and Tools directory. You'll probably still find your self doing quick hacks in perl, but you'll probably also find yourself seeing your friends point. From smalleys at gte.net Wed Apr 12 23:01:15 2000 From: smalleys at gte.net (sue) Date: Thu, 13 Apr 2000 03:01:15 GMT Subject: Need an enum type extension Message-ID: <38F52A7A.D8841724@gte.net> Has anyone done an enum implementation? I'd prefer one like Ada (with attributes), but I can settle for one that works more like C. The main thing an enum_literal can't do is be equal to an integer. This rules out several of the simple implementations I found on DejaNews. Performance is not an issue at this time. Sue. From effbot at telia.com Tue Apr 18 18:13:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 18 Apr 2000 22:13:39 GMT Subject: Split References: <38FCC20D.624AB2F6@searchy.net> Message-ID: Penpal International wrote: > I've already managed to split a string with this: > > split = regsub.split(line,'\s+') footnote: split = string.split(line) is faster (in 1.6, line.split() is even better) > I should get something like this as result: > > ['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', ''] > > But how can I print only the 5th for example? print split[4] for more on lists, read section 3.1.3 of the tutorial (again?): http://www.python.org/doc/current/tut/node5.html From jstok at bluedog.apana.org.au Sun Apr 2 11:36:48 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 3 Apr 2000 01:36:48 +1000 Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> Message-ID: Guido van Rossum wrote in message <200004011740.MAA04675 at eric.cnri.reston.va.us>... >Complementary to the Distutils are the Imputils, or Import Utilities. >Python's import mechanism has been reworked to make it easy for Python >programmers to put "hooks" into the code that finds and loads modules. >The default import mechanism now includes hooks, written in Python, to >load modules via HTTP from a known URL. > >This has allowed us to drop most of the standard library from the >distribution. Now, for example, when you import a less-commonly-needed >module from the standard library, Python fetches the code for you. For >example, if you say > > import tokenize > >then Python -- via the Imputils -- will fetch >http://modules.python.org/lib/tokenize.py for you and install it on your >system for future use. (This is why the Python interpreter is now >installed as a setuid binary under Unix -- if you turn off this bit, you >will be unable to load modules from the standard library!) This is the only item silly enough to prove conclusively that we have an April Fool's joke! The problem with all these items is that they are all just too plausible. Double quote for unicode, single quote for ASCII -- I can just imagine someone coming up with that! Likewise the bizarre string mutability semantics, and the self correcting "split" method that decides which string is the split method by looking at which one occurs most frequently inside the other! From tjreedy at udel.edu Sat Apr 29 00:05:34 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 29 Apr 2000 00:05:34 -0400 Subject: The Simple Economics of Open Source References: <1255227918-2015166@hypernet.com> Message-ID: <8edmnr$od7$1@news.udel.edu> "Gordon McMillan" wrote in message news:1255227918-2015166 at hypernet.com... > Terry Reedy wrote: > > "Gordon McMillan" wrote in message news:1255272357- > > > One of those open source delusions is that being open source > > > somehow makes a difference to the end consumer. Bunk. > > Whether most consumers yet know it or not, there is all the > > difference in the world. > Of course there is; all your points are correct. But no end user > will read the source and discover the bug / trojan horse / > whatever. It's another developer that will. Which is what I thought I said, and certainly meant to say. > My point was that to the end user, those files are a waste of disk space. When binaries are available, agreed (and getting the source should then be optional). Like most Windows/Pythons users, I do not currently have the source files. > They get value from the fact that it's open sourced, not from the source. And my point was that they do get such value with respect to aspect of software which has been much in the news lately. In other words, I was trying to present an open-source selling point that I have not seen much discussed or exploited yet. I can imagine, sometime in the future, the existence of an independent, third-party, open-source examination and certification service. > - Gordon Terry From ppetru at coltronix.com Wed Apr 12 11:28:44 2000 From: ppetru at coltronix.com (Petru Paler) Date: Wed, 12 Apr 2000 18:28:44 +0300 Subject: No method overloadin I suppose ? In-Reply-To: <38F4938E.8F245B68@altern.org>; from tsmets@altern.org on Wed, Apr 12, 2000 at 03:15:42PM +0000 References: <38F4938E.8F245B68@altern.org> Message-ID: <20000412182844.G7538@coltronix.com> On Wed, Apr 12, 2000 at 03:15:42PM +0000, Thomas SMETS wrote: > ## Beginning of Python program ... > class Lister: > def __init__(self): > print 'In constructor ...' > __init__(1) > > def __init__(self, lValue): > print 'In constructor with parameter' > self.l = lValue > > def __repr__(self): > print '\n******\n\tValue is : ', l, '\n********' > > if __name__ == "__main__": > x = Lister() > y = Lister (2) > ## End of python program > > Trace of execution is : > Traceback (innermost last): > File "Minheritence.py", line 14, in ? > x = Lister() > TypeError: not enough arguments; expected 2, got 1 > End of trace ... > > I guess I can't do methods overloadin', as shown... WHY is that ? I'm > wrong ? Yes, you are wrong. Try: class Lister: def __init__(self, lValue=1) self.l = lValue -Petru From raffael at mediaone.net Sat Apr 22 23:35:02 2000 From: raffael at mediaone.net (Raffael Cavallaro) Date: Sat, 22 Apr 2000 23:35:02 -0400 Subject: The Simple Economics of Open Source In-Reply-To: <3901247A.E87B5D0A@rubic.com> Message-ID: > And the success of that approach has made painting > a profitable and lucrative career choice, in contrast > to the thousands of struggling software engineers who > can't even qualify for an NEA grant. > > If I didn't have my part-time performance art > income to help pay the bills, I could never > afford to support my programming lifestyle. > > -Jeff Sarcasm aside, I think you miss the point. Those artists least willing to share, most jealous of their "secrets" have always been those who were most successful. Unsucessful young artists are, by and large, quite willing to share ideas, working techniques, etc. It's actually the more established, financially succesful ones, who are not. I see a parallael to the software industry here as well. Those with a lucrative cash cow (e.g., MS) are reluctant to share code, but those who just make a living programming are happy to share source. It would seem that sharing is inversely proportional to the value of that which is shared. Ralph From dalke at acm.org Thu Apr 20 23:14:34 2000 From: dalke at acm.org (Andrew Dalke) Date: Thu, 20 Apr 2000 21:14:34 -0600 Subject: __del__ problem - would adopting Garbage Collection fix this? References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> Message-ID: <8doh1p$3sk$1@slb2.atl.mindspring.net> Neel Krishnaswami wrote: > An even more sensible idea would be to drop __del__ methods > altogether, since IMO you deserve to lose if you try to use > the same deallocator for arbitrary resources that you use for > memory, but that idea is probably not going to fly. ;) Whenever this topic comes up, I bring out my case. I've got a Python wrapped interface to a C library. The library also works with FORTRAN, so stores a table mapping externally exposed integer handles to internally used pointers. In other words, every object created is accessible, so even a C based GC cannot delete all unused objects. (At least to my rather limited understanding of how automatic garbage collectors work with non-cooperative C libraries.) My wrapper code, however, does know when it's appropriate to delete/free objects, and I've hooked that in using __del__. This, BTW, is why my code doesn't work with JPython using a JNI version of the C library instead of a SWIG one. Andrew dalke at acm.org From R.Brodie at rl.ac.uk Mon Apr 10 06:44:26 2000 From: R.Brodie at rl.ac.uk (Richard Brodie) Date: Mon, 10 Apr 2000 11:44:26 +0100 Subject: Python paradigms References: Message-ID: <8csbab$1422@newton.cc.rl.ac.uk> "Oleg Broytmann" wrote in message news:Pine.LNX.4.21.0004100757580.19783-100000 at fep132.fep.ru... > No. Code is intended not only to beeing run on processor, but also (and > often more important) to beeing read by human. Code is speech, it is the > way to interchange ideas. > In that sense ugly code is not working even if you add three books of > comments. Code should be readable. Period. If this were always the case, why does Python have an interactive mode? Python is a useful language to try out a few rough drafts in too. And I disagree that elegance and transparency are the same thing. The Fast Fourier Transform is one of the classic algorithmic optimisations but produces obscure code. Likewise most of the standard fast sorting algorithms. From michael at camelot-it.com Tue Apr 4 10:10:08 2000 From: michael at camelot-it.com (Michael Tiomkin) Date: Tue, 04 Apr 2000 16:10:08 +0200 Subject: Determining Classname of an object References: <8ccbk4$b6p$1@nnrp1.deja.com> Message-ID: <38E9F7C0.54899FE4@camelot-it.com> a.__class__.__name__ mpetroni at my-deja.com wrote: > > Is there a way to find out from which class an object has been created? From pinard at iro.umontreal.ca Wed Apr 26 09:07:53 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Apr 2000 09:07:53 -0400 Subject: Need advice performing a search In-Reply-To: scarblac-spamtrap@pino.selwerd.nl's message of "26 Apr 2000 08:48:44 GMT" References: <3905F795.A536CFA7@stsci.edu> <3906944F.F718FE91@teleatlas.com> Message-ID: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) writes: > from string import find > def testline(line): > return find(line, "first_string") or find(line, "second_string") Shouldn't we have: return find(line, "first_string") >= 0 or find(line, "second_string") >= 0 -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tismer at tismer.com Thu Apr 27 14:07:21 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 27 Apr 2000 20:07:21 +0200 Subject: Newbie Question: Is there a Python equiv to Perl's "do" statement? References: <8e9rna$ajh$1@nnrp1.deja.com> Message-ID: <390881D9.5661AD51@tismer.com> mdefreitas at sikorsky.com wrote: > > I'm trying to call a python script from another python script (given > the filename). Yes, you can use the execfile function to do that. execfile("otherscript.py") ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 phd at phd.russ.ru Mon Apr 10 04:00:03 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 10 Apr 2000 08:00:03 +0000 (GMT) Subject: Python paradigms In-Reply-To: <38F138CD.38983629@acm.org> Message-ID: On Mon, 10 Apr 2000, Robert W. Cunningham wrote: > Oleg Broytmann wrote: > > > python's "and" and "or" operators doesn't evaluate the > > > second argument unless they really have to... > > > > Yes, I missed that, sorry. > > So, it works just fine, right? No. Code is intended not only to beeing run on processor, but also (and often more important) to beeing read by human. Code is speech, it is the way to interchange ideas. In that sense ugly code is not working even if you add three books of comments. Code should be readable. Period. Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2.1/ phd2 at earthling.net Programmers don't die, they just GOSUB without RETURN. From akuchlin at mems-exchange.org Wed Apr 5 11:12:08 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 05 Apr 2000 11:12:08 -0400 Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> Message-ID: <3d3dp01t13.fsf@amarok.cnri.reston.va.us> rzantow at my-deja.com writes: > the whole language, and buying more books. I'm really surprised there > are as many as 13 Python books on the market. I'd have thought there > was a need for maybe three, along with about two pamphlets and a poster. I'm not surprised, and think there's room for still more. Hopefully the next wave of books will aim at specific topics: Python and {Tkinter,KDE,GTk+,wxWindows}, Python for numeric work, for Web stuff, for bioinformatics, for teaching programming, inside Zope, JPython for Java programmers who need to embed a scripting language, etc. Introductory books are a filled niche, IMHO, and they all sort of look the same, with the same topics and organization: here are the basic types, here are lists and dictionaries, here are modules, here are classes, etc... Probably this all stems from the Tutorial's ordering of topics. Doubtless there's some iconoclast who'd start with classes and work downward (or a Knuth who'd start with bytecode and then work up). Those variations would be interesting to see, but ringing more tiny changes on the same introductory structure seems like a poor way to spend time. -- A.M. Kuchling http://starship.python.net/crew/amk/ Nobody can find fault with legitimate ambition, but when the wealth of the spiritual and intellectual life is reduced to a formula for overcoming sales resistance, we protest. -- Robertson Davies, _A Voice from the Attic_ From sabren at manifestation.com Thu Apr 13 21:38:44 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 13 Apr 2000 21:38:44 -0400 (EDT) Subject: how do I know to what module an object belongs? Message-ID: Hey All, I'm not having much luck with the Python docs tonight. :) I'm building a wrapper around the Python DB-API. Each module that implements the API is supposed to define a bunch of objects like STRING, DATE, BINARY, etc, so you can tell what kind of field you're dealing with. But those values change from module to module.. Eg, the XYZ database module, might use strings, whereas the ABC module might use numeric codes. So basically, I need to test for something like: if fieldtype == somemodule.STRING: pass Now, because this is an abstraction layer, I don't know which module I'm dealing with. The user creates a connection object from whatever module they want, and then passes just that connection object to my class. I know I can just as easily have them pass a reference to the module along with it, but I'd be happier if I could just look at the connection object and know which module it came from. Can I do this? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From dave at dogwood.com Fri Apr 28 09:43:33 2000 From: dave at dogwood.com (Dave Cornejo) Date: Fri, 28 Apr 2000 13:43:33 GMT Subject: RESULT: comp.lang.ruby passes 200:16 References: <954456262.23656@isc.org> <955393816.29413@isc.org> Message-ID: <956929413.9394@isc.org> RESULT unmoderated group comp.lang.ruby passes 200:16 There were 200 YES votes and 16 NO votes, for a total of 216 valid votes. There were 5 abstentions and 2 invalid ballots. For a group to pass, YES votes must be at least 2/3 of all valid (YES and NO) votes. There must also be at least 100 more YES votes than NO votes. A five day discussion period follows this announcement. If no serious allegations of voting irregularities are raised, the moderator of news.announce.newgroups will create the group shortly thereafter. Newsgroups line: comp.lang.ruby The Ruby dynamic OO programming language. Voting closed at 23:59:59 UTC, 20 Apr 2000. This vote was conducted by a neutral third party. Questions about the proposed group should be directed to the proponent. Proponent: Conrad Schneiker Votetaker: Dave Cornejo RATIONALE: comp.lang.ruby Ruby is a very-high-level, dynamic object oriented programming language. Ruby provides many of the best-liked power and convenience features of Perl and Python on one hand, with an elegantly simple and powerful syntax that was partly inspired by Eiffel and Ada on the other hand. Ruby is a more thoroughly objected oriented language than Python, and some Ruby features were inspired by Smalltalk. Ruby is an open source language. There are over 1000 members of 4 Japanese Ruby mail lists (general, developers, math, extension writers), with a peak volume topping 100 messages per day. At present, there is one English Ruby mail list with about 175 members, with a recent volume often exceeding 10 messages per day and growing. Many users of the Japanese Ruby mail lists have some understanding of English and are also prospective comp.lang.ruby users as well. Much of 1999's newsgroup discussion of Ruby took place on comp.lang.python, which is not optimal, since comp.lang.python is dedicated to the Python language. For obvious reasons, Ruby users do not post there frequently. In 2000, most Ruby discussion has occurred in comp.lang.misc. This again is not ideal since other comp.lang.misc regulars are typically more interested in issues that transcend Ruby, and have said as much. In Japan, Ruby has overtaken Python in terms of popular usage. During 1999 and into early 2000, Ruby has been featured in several articles in the English language software trade press, indicating it is at the takeoff threshold that Perl and Python attained years ago. (Please see http://www-4.ibm.com/software/developer/library/ruby.html for the latest example.) The English language Ruby home page is http://www.ruby-lang.org/en/, which provides links to documentation and download pages for Ruby. CHARTER: comp.lang.ruby The comp.lang.ruby newsgroup is devoted to discussions of the Ruby programming language and related issues. Examples of relevant postings include, but are not be limited to, the following subjects: - Bug reports - Announcements of software written with Ruby - Examples of Ruby code - Suggestions for Ruby developers - Requests for help from new Ruby programmers The newsgroup is not moderated. Binaries are prohibited (except the small PGP type). Advertising is prohibited (except for announcements of new Ruby-related products). END CHARTER. comp.lang.ruby Final Voter list Voted YES ------------------------------------------------------------------------------- andy#research.canon.com.au Andy Newman joandvan#ihug.com.au joandvan alxx#tig.com.au al jim_g#tig.com.au Jim p.fuller#student.murdoch.edu.au Paul Fuller geldridg#progsoc.uts.edu.au Geoff Eldridge toivo#ucs.uwa.edu.au Toivo Pedaste gcross#netspace.net.au Graeme Cross doctor#doctor.nl2k.ab.ca Dave Yadallee trevort#vianet.on.ca Trevor Tymchuk MSteed#altiris.com Mike Steed ml#au.com Mike Linksvayer kimdv#best.com Kim DeVaughn dgoodger#bigfoot.com David Goodger jcm#bigskytel.com David Porter Eric.Peterson2#PSS.Boeing.com Eric Peterson Makoto.Nakagawa#jp.compaq.com Nakagawa Makoto fenghou#erols.com Jack Hou julesd#erols.com Jules Dubois smlucas#famvid.com Steven Lucas emile#fenx.com Emile van Sebille mzadka#geocities.com Moshe Zadka Henry#hdsSystems.com Henry Schneiker SchaeferFFM#hotmail.com Oliver Schaefer thucdat#hotmail.com Dat Nguyen tetsu#jpn.hp.com Tetsuya WATANABE gnhurst#hurstlinks.com Guy N. Hurst sullivan#Mathcom.COM Steve Sullivan petelyons#mindspring.com Pete Lyons Taka.Adachi#msdw.com Takanori Adachi tim_one#email.msn.com Tim Peters jolomo#netcom.com Joey Morris tgm#netcom.com Thomas G. McWilliams Ralph.Amissah#operamail.com Ralph Amissah tseaver#palladion.com Tres Seaver apter#panix.com stevan apter Tbone#pimpdaddy.com Tushar Samant jimrtex#pipeline.com Jim Riley wknaka#pobox.com Wes Nakamura wang#rjka.com Huayin Wang jbauer#rubic.com Jeff Bauer chris.browne#sabre.com Christopher Browne takaaki.higuchi#Japan.Sun.COM Takaaki Higuchi peter#taronga.com Peter da Silva Dave#Thomases.com Dave Thomas juliet#thomases.com Juliet Thomas andy#Toolshed.Com Andrew Hunt ellie#Toolshed.Com Ellie Callahan joe31416#voicenet.com Joe Myers Abhay.Natu#wcom.com Abhay Natu xanthian#well.com Kent Paul Dolan rascproponents#yahoo.com Brian P. Sweeney wpostma#ztr.com mrilu#ale.cx mrilu mertz#gnosis.cx David Mertz Juergen.Cohrs#alcatel.de Juergen Cohrs Ekkehard.Uthke#gmx.de Ekkehard Uthke peter.sommerfeld#gmx.de Peter Sommerfeld burow#ifh.de Burkhard D. Steinmacher-Burow sn#neopoly.de Sven Neuhaus vote-de#kholdan.snafu.de Tobias Erle Walter.Zettel#t-online.de Walter Zettel bouvin#daimi.au.dk Niels Olof Bouvin jpsecher#diku.dk Jens Peter Secher quinn#groat.ugcs.caltech.edu Quinn Dunkan cjc26#cornell.edu Cliff Crawford adam#mlug.missouri.edu Adam Procter neelk#alum.mit.edu Neel Krishnaswami behrends#cse.msu.edu Reimer Behrends shippy#cs.nmt.edu Jeff Shipman rcl211#is9.nyu.edu Robert C Linwood graham#ccs.ucsb.edu Graham Hughes reic0024#d.umn.edu Aaron J Reichow uscfadsl#ds.cesga.es David S de Lis hcjake#cs.hut.fi Jaakko Vayrynen decoux#moulon.inra.fr Guy Decoux dcalvelo#pharion.univ-lille2.fr Daniel Calvelo drew.mcdowell#msfc.nasa.gov Andrew D. McDowell legradi#alpha1.obuda.kando.hu Gabor Legradi ariels#compugen.co.il Ariel Scolnicov masato#csys.ce.hiroshima-cu.ac.jp Masato KIYAMA gotoken#math.sci.hokudai.ac.jp GOTO Kentaro masa#koala.astro.isas.ac.jp Masahiro Tanaka thitoshi#ne.scphys.kyoto-u.ac.jp TAKAHASHI Hitoshi nagai#ai.kyutech.ac.jp Hidetoshi NAGAI sinara#blade.nagaokaut.ac.jp Shin-ichiro HARA ogino#coop.nagoya-u.ac.jp Mitsuru Ogino naosone#naruto-u.ac.jp Naoto SONE ohdachi#nifs.ac.jp Satoshi Ohdachi washizu#kkc1.c.u-tokyo.ac.jp Hitoshi Washizu fukusima#goto.info.waseda.ac.jp Masaki Fukushima igarashi#ueda.info.waseda.ac.jp Hiroshi Igarashi os#iij.ad.jp OHARA Shigeki ksasaki#kddnet.ad.jp Kan Sasaki Taiji.Can#atesoft.advantest.co.jp Taiji Kan suenaga#birds.co.jp SUENAGA Tomohiro p95#brain-tokyo.co.jp Taku Nakajima kimura#sqa.canon.co.jp KIMURA Koichi fit0298#fitec.co.jp ARIMA Yasuhiro inoue#ftv.co.jp Hirosi Inoue ogi#open.nm.fujitsu.co.jp Takayuki Ogihara tachino#open.nm.fujitsu.co.jp Tachino Nobuhiro uno#open.nm.fujitsu.co.jp Shunji Uno ito#htk.hitachi-cable.co.jp Ito Kazumitsu kyamada#hitachi-densa.co.jp Yamada Kenji agawa#tir.hitachi-sk.co.jp Norio Agawa mt#izu.co.jp Masato Toyoshima taca#kyoto.jepro.co.jp Takahiro Kambe Shinichi_Hiramoto#justsystem.co.jp HIRAMOTO Shin-ichi kitamura#jzf.co.jp Mikiya Kitamura sa-sakamoto#kddwinstar.co.jp Sadayuki Sakamoto hide#lisa.co.jp Hideyuki Ezaki inouesin#pic.melco.co.jp Shinichi Inoue kima#np.bs1.fc.nec.co.jp KIMATA Isao h_inoue#netlab.co.jp Hiroshi Inoue matz#netlab.co.jp Yukihiro Matsumoto shugo#netlab.co.jp Shugo Maeda kondo#nik-prt.co.jp Mitsuhiro Kondo hmorita#ohmsha.co.jp Hisashi Morita adachi#tpegasus.lab.okidata.co.jp Jun Adachi miyagawa#sanritz.co.jp Seiichi Miyagawa komatsu#sarion.co.jp Katsuyuki Komatsu thata#net.sony.co.jp Takashi Hatakeyama tamori#sm.sony.co.jp Hirofumi Tamori kanematu#sra.co.jp Daiji KANEMATSU aoki#technoa.co.jp Hirotaka AOKI kawata#titan.co.jp Masahiro Kawata anakata#vector.co.jp Ataru NAKATA hengsu#winningrun.co.jp HengSu Kim takagi#etl.go.jp Hiromitsu Takagi irie#hri.pref.hokkaido.jp Yuji simtak#mua.biglobe.ne.jp Takashi Shimizu junji999#mud.biglobe.ne.jp Junzi TAKAHASHI kyano#mva.biglobe.ne.jp YANO Kyoji ikarashi#d3.dion.ne.jp IKARASHI Akira marutomo#jade.dti.ne.jp INOUE Tomoichi masao-k#a-net.email.ne.jp $B6b8w2mIW(B kai#star.email.ne.jp Kazuhiko IZAWA ymsd#ns.m-net.ne.jp Yuichi Masuda nnakamur#mxq.mesh.ne.jp Noritsugu Nakamura nobu.nakada#nifty.ne.jp Nobuyoshi Nakada felio#peanet.ne.jp YAMASHIRO Shunsuke greentea#fa2.so-net.ne.jp Tomoyuki Kosimizu tomokazu#pc4.so-net.ne.jp MATSUSHIMA Tomokazu toshirok#yb3.so-net.ne.jp Toshiro Kuwabara ozawa#mba.sphere.ne.jp Makoto Ozawa wakou#fsinet.or.jp Wakou Aoyama earth#hokuto7.or.jp Hisashi Wakai(earth) shoch#jsdi.or.jp Shoichi OZAWA ogochan#linux.or.jp platypus#a1.mbn.or.jp Yoshinori Tahara kaneoka#grn.mmtr.or.jp KANEOKA Shinji noroi#mob.or.jp IKEDA Kenji aygoofy#kt.rim.or.jp Akihiro Yamauchi hisashim#kt.rim.or.jp hisashi y. morita tadf#kt.rim.or.jp Tadayoshi Funaba inaba#st.rim.or.jp Inaba Hiroto hattori#ppp.upload.or.jp Masashi Hattori Suketa Masaki Suketa h.fulton#att.net Hal Fulton jaredr#bellsouth.net jared richardson n8gray#earthlink.net Nathaniel Gray rzimmerle#earthlink.net Robert Zimmerle kikutani#galaxy.net Kikutani, Makoto c.hintze#gmx.net Clemens Hintze d.hintze#gmx.net Dirk Hintze jmh#gmx.net Jan Haar shrogers#ionet.net Steven H. Rogers schneiker#jump.net Conrad Schneiker MAP2303#mapletown.net Daisuke Kanda franke#meso.net Stefan Franke cartisan#pacwestracing.net Neal Cappel edwards#rahul.net Gregory Edwards evert#royal.net Evert Meulie esq cind0revs#toadmail.toad.net Arthur J Mongan scarblac-rt#pino.selwerd.nl Remco Gerlich boud#rempt.xs4all.nl Boudewijn Rempt kai.andresen#chello.no Kai Andresen jaj39#student.canterbury.ac.nz J Alan Jackson John_David_Galt#acm.org John David Galt perin#acm.org Lewis Perin sferris#acm.org Scott M. Ferris darkskyz#cyberspace.org Tomer Brisker crouton#duelists.org OZAWA Sakuro quinet#gamers.org Raphael Quinet imain#gtk.org Ian Main h_inoue#hi-fun.org Hiro Inoue koyama#hoge.org KOYAMA Tetsuji jc#joerch.org Jvrg Czeranski t#kondara.org Toru Hoshina mentifex#scn.org Arthur T. Murray larry#smith-house.org Larry Smith dave#technopagan.org David E. Smith ysjj#unixuser.org Junji Yamashita wormboyslim#wiggly.org Nigel Rantor mak#mikroplan.com.pl Grzegorz Makarewicz qrczak#knm.org.pl Marcin 'Qrczak' Kowalczyk hgs#dmu.ac.uk Hugh Sasse james#obeah.demon.co.uk James Coupe bill#xencat.co.uk William Boughton Voted NO ------------------------------------------------------------------------------- yan#storm.ca Yves Bellefeuille ru#cls.usask.ca Ru Igarashi stainles#bga.com Dwight Brown mcclenon#erols.com Bob McClenon gprrspw#mindspring.com G.P. Ryan rootbeer#redcat.com Tom Phoenix pimentel#ultranet.com J Pimentel Thilo.Ernst#gmd.de Thilo Ernst naddy#mips.rhein-neckar.de Christian Weisgerber rick#bcm.tmc.edu Richard H. Miller 4ws#gibsoncounty.net Kurt Weber mmontcha#OregonVOS.net Matthew Montchalin denebeim#deepthot.org Jay Denebeim sthoenna#efn.org Yitzchak Scott-Thoennes phd#sun.med.ru Oleg Broytmann chriseb#ukshells.co.uk Chris Ebenezer Abstained ------------------------------------------------------------------------------- chris#kzim.com Christopher Robin Zimmerman sleepy#os.com Alexander Pennace r.vanette#pink.nl Robert-Jan van Ette james#sfgiants22.freeserve.co.uk James Farrar merlin#netlink.co.uk Darren Wyn Rees Invalid ballots ------------------------------------------------------------------------------- mntsui#netvigator.com tsui man ngar ! No vote statement in message mjd#plover.com ! No vote statement in message To restore the email addresses above, pipe the ack list through the following command: sed -e 's/#/@/g' -- Voting question & problems: Dave Cornejo Voting address: vote at dogwood.com From abouf066 at aix2.uottawa.ca Sat Apr 29 09:29:34 2000 From: abouf066 at aix2.uottawa.ca (abouf066 at aix2.uottawa.ca) Date: Sat, 29 Apr 2000 09:29:34 -0400 Subject: GUI developping with Python (Any tutorial ) Message-ID: Greetings, I wonder if anybody can point me to a site where I could find the starting steps to develop a GUI using python. Thnaks for your time and help. _____________________________________________________________ LaBoufarikoise From cut_me_out at hotmail.com Tue Apr 25 13:28:13 2000 From: cut_me_out at hotmail.com (Alex) Date: 25 Apr 2000 13:28:13 -0400 Subject: Don't understand error message References: Message-ID: > It goes like this: > > import sys, glob, operator > print sys.argv[1:] > sys.argv = reduce(operator.add, map(glob.glob, sys.argv)) > print sys.argv[1:] > > When called with "python glob.py *.py" on Win98 I'm supposed to get a list > of all .py files in the current directory but instead I get: > > Traceback (innermost last): > File "glob.py", line 1, in ? > import sys, glob, operator > File "glob.py", line 3, in ? > list = reduce(operator.add, map(glob.glob, '*.py')) > TypeError: call of non-function (type module) > > Anyone know why? Yeah, the problem is, your file is called glob.py, and that is loaded when you import glob. Instead, you should be loading the glob from the standard python library. To get around this, one thing you could do is rename your glob.py file to my_glob.py, and remove your old glob.py and glob.pyc. Then 'python my_glob.py *.py' should work fine. At least, that solved the problem for me. Alex. From jhefferon at my-deja.com Mon Apr 10 17:03:40 2000 From: jhefferon at my-deja.com (jhefferon at my-deja.com) Date: Mon, 10 Apr 2000 21:03:40 GMT Subject: How to compile Doc from tex format to pdf in win32 References: <8crdm2$2bff$1@news.cz.js.cn> Message-ID: <8ctfj0$qeo$1@nnrp1.deja.com> "fmr" wrote: > I want to compile Python Doc from Tex format to > Pdf or HTML format, Who can help me? What are your resources? If you have a standard TeX distribution (teTeX on a UNIX, MikTeX on a PC, for instance, then you should be able to just say: > pdflatex instead of `latex ' and it will probably work. (It might not work if, for instance, the documents use certain kinds of PostScript code, etc., but without looking at the documents (lately), I'd guess there is a 99.9% chance that what I said above works.) As for HTML, that's also possible. But I very much like the pdf myself. If you do not have one of these distributions, you'll have to be more specific about what you do have. Jim Hefferon tex at joshua.smcvt.edu Sent via Deja.com http://www.deja.com/ Before you buy. From skip at mojam.com Sat Apr 1 15:46:34 2000 From: skip at mojam.com (Skip Montanaro) Date: Sat, 01 Apr 2000 20:46:34 GMT Subject: Confusion about re lookahead assertions Message-ID: <8c5n76$9le$1@nnrp1.deja.com> I'm trying to use re's lookahead assertion constructs for the first time and am more than a bit confused. If I understand them correctly, the regular expression r'(?![.])([0-9]+)\s+' should only match digits if they are not preceeded by a dot, yet the example below clearly contradicts that. >>> pat = re.compile(r'(?![.])([0-9]+)\s+') >>> print pat.search("$5.00 mem") >>> print pat.search("$5.00 mem").group(1) 00 >>> mat = pat.search("$5.00 mem") >>> print mat >>> print mat.group(1) 00 >>> pat = re.compile(r'(?![-A-Za-z0-9:._])([0-9]+)\s+') >>> mat = pat.search("$5.00 mem") >>> print mat None I think mat should be None or mat.group(1) should be '0' in both cases. What am I missing? -- Skip Montanaro (skip at mojam.com) Mojam: http://www.mojam.com/ Musi-Cal: http://www.musi-cal.com/ Sent via Deja.com http://www.deja.com/ Before you buy. From tseaver at starbase.neosoft.com Sat Apr 22 23:42:11 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 22 Apr 2000 22:42:11 -0500 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7@lp.airnews.net> Message-ID: <7B7C00D8D0547D72.DD1773F4502EF503.0B129F97531509B3@lp.airnews.net> In article , Robin Becker wrote: >In article <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7 at lp.airnew >s.net>, Tres Seaver writes >... >>"That dog won't hunt!" Your claim that "basically no one makes the >>effort" is easily refuted: consider the League of Women Voters, >>and the guides they put out before each election -- that effort is >>well-organized, and involves coordinated, non-partisan effort on the >>scale of tens of thousands of volunteers (much like a large Open Source >>project). The League's explicit motive is to educate themselves and >>the population at large on the issues and candidates; that at least >>some of the effort here is altruistic is obvious to anyone who hasn't >>"internalized [economics'] assumptions." >> >>Altruism-is-a-shibboleth'ly, >> >>Tres. >I don't think the pessimists amongst whom I count myself reject altruism >totally. A purely altruistic action has benefit for others and none for >the actor. Very few of the altruistic examples in the thread come close. > >A lot of claims are made, but few are verifiable. I think the >internalized utility assumptions are a bit spurious as there is evidence >that many of the assumptions that economists make (about human >behaviour) are not verifiable and in some cases have been shown to be >true; a classic example is the assumption of risk averse behaviour in >investment decisions. I feel that the assumption that economic agents >(people) always behave as though they have a well defined utility is >false. I think that what economists are really saying is that they have >a model where the 'average' agent has such a utility and that the model >gives good results for certain problems. In this sense the average >volunteer feels they behave in a non-partisan altruistic way, but the >ensemble actually behaves selfishly although this is not selfishness in >the way we normally think of it. OK, I'll by the "significant empirical predictive power" bit; I was actually objecting to the specific example (voter apathy), and then vented my distaste for the prevailing mechanistic assumptions. Utility-is-for-ants,-give-me-virtue-anytime'ly :) Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at digicool.com http://www.zope.org Digital Creations From tim_one at email.msn.com Thu Apr 20 03:48:16 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 20 Apr 2000 03:48:16 -0400 Subject: __del__ problem - would adopting Garbage Collection fix this? In-Reply-To: Message-ID: <000801bfaa9c$c9957aa0$d62d153f@tim> [Just van Rossum, unaccountably arguing for ignoring __del__ methods] > ... > There's an additional argument, though: symmetry with JPython. That JPython is currenty diseased is no excuse either. Java certainly doesn't ignore finalization methods *no matter what*; JPython ignores __del__ mostly because Java's implementation of (non-default) finalizers was painfully slow. BTW, this was all discussed at extreme length on Python-Dev -- check it out! I doubt anyone wants to repeat all of that whlie struggling to pretend it's new & interesting . don't-do-the-crime-if-you-can't-pay-the-time-ly y'rs - baretta From thomas at xs4all.net Fri Apr 28 17:46:08 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 28 Apr 2000 23:46:08 +0200 Subject: Linux Processes from Python HOW-TO? In-Reply-To: <8ecpch$j73$1@nnrp1.deja.com>; from chris_barker@my-deja.com on Fri, Apr 28, 2000 at 07:39:00PM +0000 References: <8ecpch$j73$1@nnrp1.deja.com> Message-ID: <20000428234608.L11481@xs4all.nl> On Fri, Apr 28, 2000 at 07:39:00PM +0000, chris_barker at my-deja.com wrote: > Has anyone written a HOW-TO or tutorial that explains how to start and > manipulate other processes with Python. I imagine it's trivial if you > are familiar with the Linux/Unix process model, but I get very confused > about when to use: > system > popen and it's variants > exec and it's variants > fork > etc. Well, it's detailed in most books about UNIX, and in most books about operating systems in general. (At least on the programming level.) I dont know any HOWTO-level explanation of it, but I'm happy to supply you with some short descriptions. I'll do it in the reverse order of what you listed, though, because it's easier that way ;) First, the basics: under UNIX, and most current operating systems, a running program consists of one or more processes. A single program, or a single task, is usually a single process, but it's possible for several processes to communicate with eachother, to share workload. Each process has its own memoryspace, invisible to other processes, and it can only access its own memoryspace. To create a new process, you use the system call fork(). It duplicates the current process, copies all of its memory, instruction pointers, function stack, everything. The only difference between the two processes is the process-id (pid), and the return code of fork(): In the new process, the 'child', fork returns 0. In the original process, the 'parent', fork() returns the pid of the newly created child process. (If fork() fails, it wont create a child process, of course, and the return code will signify an error.) Because fork() creates an exact duplicate of the old process, you can't use it to start a new program. You use one of the 'exec*()' calls for that. This system call *replaces* the calling process by a new process, running a new program as indicated by the first argument to the exec() call. If exec() returns anything, it's always an error, because if it succeeds, the process that called it will be gone. The new process isn't really a new process, though, because it will have the pid of the old one. It'll just be running a different program ;) The difference between the various exec*() calls is fairly subtle, and a bit strange from a Python point of view: they are mostly about how to pass the arguments: the execl*() calls take a variable number of arguments, whereas the execv*() calls take a pointer to a list of arguments. The exec*p() calls search the environment variable PATH for the name of the executable, whereas the other exec*() functions expect the name of the executable to be a full path to the program. And lastly, the exec*e() calls also take an argument that list the environment variables that should be passed to the new program, whereas the other calls pass the same environment as the current process has. These two system calls are all that is necessary to create as many and as varying processes as you wish. None the less, the Standard C Library provides a few funky and helpful functions that save you a lot of time in the common cases: system() is a library call that takes a single string describing the program it should start, and the arguments it should get. It forks() and exec()s for you, and then waits for the child to exit (using one of the wait() calls) and returns the exit code. You dont have particularly much control over how the string is executed, other than via the standard 'shell' commands: system always starts /bin/sh with your string as argument. popen() and it's friends are similar functions, but instead of running the string you pass and returning the exitcode, it starts the new process with its standard input or standard output (or both, in the case of popen2) connected to the calling process (using a UNIX 'pipe', hence the first p in popen()). This way, the calling process can pass data to the program just as a user would type it on a computer, or read data that the new program writes to the terminal. So, basically, if you simply want to run a command and dont care much about runtime influence, you usually use system(). If you need to pass it some data for it to work on, for example 'gzip' or some other program that works on the input stream, you use popen(). And if you want more control over things, or if you simply want your python process to do two tasks at once, or you wish to start a lot of programs in a specific order, or other complicated things, you use fork() and exec() manually. > I'm really hoping someopne has written this up! Well, I just did, didn't I ? ;) There are a lot more details I didn't mention, by the way: threads (processes that share their memory space); redirecting stdin, stdout and stderr somewhere specific, or to another process; creating pipes and sockets yourself; how to avoid deadlocks in popen2; shared memory; controling ttys, how to see the difference between a simple pipe and a real user, and how to fool programs that try to see that difference; UNIX session ids; setuid() and other ways to change the current process's permissions; And probably a lot more ;P Nevertheless, I hope this helps a bit :-) If you need more info than this, either read a UNIX manualpage for one of those functions, or if you prefer readable material, buy a good book on UNIX programming. They usually start with a good explanation of processes, the memory layout, pipes, sockets and networking. Some even cover shared memory. Drained-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From parkw at freewwweb.com Wed Apr 26 23:09:22 2000 From: parkw at freewwweb.com (William Park) Date: Wed, 26 Apr 2000 23:09:22 -0400 Subject: regsub backreference question In-Reply-To: <8e89g7$dfg$0@216.39.162.232>; from dante@oz.net on Thu, Apr 27, 2000 at 02:43:19AM +0000 References: <8e89g7$dfg$0@216.39.162.232> Message-ID: <20000426230922.A1536@freewwweb.com> On Thu, Apr 27, 2000 at 02:43:19AM +0000, Michael Esveldt wrote: > I'm trying to figure out how back referencing works in python's regsub > module. I thought the following code would simply double the string > "foo" but it's just returning "foo". > > regsub.sub(r"(.*)", r"\1\1", "foo") > > What am I doing wrong here? Try regsub.sub(r"\(.*\)", r"\1\1", "foo") re.sub("(.*)", r"\1\1", "foo") --William From sbarron at ansic.net Mon Apr 3 10:49:55 2000 From: sbarron at ansic.net (Scott) Date: Mon, 3 Apr 2000 14:49:55 GMT Subject: Platf. indep. console lib. References: <8c03u1$igk$1@news.hit.fi> Message-ID: <38E8AF93.70F4CCF7@ansic.net> Hi, There is an slang module which wraps the slang library. It's available for Unix and Win32 though I haven't had the time to actually use it yet. Here is an ftp site for it: ftp://quasar.ipa.nw.ru/pub/avv/Python/pyslang . If you give it a try, let me know how it turns out! Scott "Matti Johannes K?rki" wrote: > > Hi! > > It seems that there isn't any platform independent console (text graphics) > library available in core Python distribution (or am I wrong?). Is there > some specific reason for that? As far as I can tell, it should be quite > easy to implement one with NCurses (*nix) and Conio (Windows: Watcom and > Borland directly, Visual C with Win32API?), other platforms, I don't know. > > I know that there is some kind of NCurses module for Python but I would > like to see something simple (such as Conio) which also would be supported > under Linux and Win32 in core Python package. It would be nice to know > that when I install the Python package to the computer, I'll be able to > write and run Python programs with text graphics user interfaces. I know > that Tkinter rules, but there has been some situations when I've been > missing console library with move/gotoxy, addch/putch and getch (and with > certainty that my programs will work both under Win32 and Linux terminal). > > What do you think? > > Sincerely, > > Matti From richard_chamberlain at ntlworld.com Thu Apr 27 05:45:22 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Thu, 27 Apr 2000 10:45:22 +0100 Subject: IP Address Message-ID: Is there a way of returning the IP address of the machine that a script is running on? Thanks Richard From quinn at riyal.ugcs.caltech.edu Tue Apr 4 20:21:45 2000 From: quinn at riyal.ugcs.caltech.edu (Quinn Dunkan) Date: 5 Apr 2000 00:21:45 GMT Subject: blessed be Guido, for "5 <= X <= 10" does what it should... References: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca> Message-ID: On Tue, 4 Apr 2000 13:42:41 -0500, Warren Postma wrote: > > >I was just playing around today,and it occurred to me to test the >'transitive' properties of comparison operators. Ie, writing on a >chalkboard, you might say X is in the range 5..9 this way: > > 5 <= X <= 9 Yes, this has always struck me as one of the weirder corners of python. There's a bit of magic for comparison operators: >From the lang ref 5.9: Formally, if a, b, c, ..., y, z are expressions and opa, opb, ..., opy are comparison operators, then a opa b opb c ...y opy z is equivalent to a opa b and b opb c and ... y opy z, except that each expression is evaluated at most once. It's kinda cool, I guess. Maybe ABC did it first? From willadams at aol.com Wed Apr 12 10:21:20 2000 From: willadams at aol.com (William F. Adams) Date: 12 Apr 2000 14:21:20 GMT Subject: Compiling Python Imaging under LinuxPPC References: <20000412234630.21095@nms.otc.telstra.com.au> Message-ID: <20000412102120.18661.00002626@ng-cg1.aol.com> Greg McFarlane was kind enough to clue me in to BLT being: >A graphics extension to Tk: > http://www.tcltk.com/blt/ I've got that, but still having trouble with python imaging, now because imaging.h isn't appropriately installed---I found a message on the Sketch list which had a patch, but that won't work on my LinuxPPC install, reports it as being garbage.... Can I just d/l Imaging.h manually from somewhere or copy it in to /usr/include/python1.5 by hand? William -- William Adams http://members.aol.com/willadams Sphinx of black quartz, judge my vow. From emile at fenx.com Fri Apr 7 10:35:20 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 7 Apr 2000 07:35:20 -0700 Subject: Creating variables on the fly... References: <38E8EFF0.D71D0415@gmd.de> Message-ID: <085f01bfa09e$83285a40$01ffffc0@worldnet.att.net> Lately, I've become skeptical of faster claims when they point away from the obvious. I know that there are exceptions, but this is not one. For a small number of arguments, the difference is negligible but measurable at a high number of iterations. The gap widens with more arguments. Emile van Sebille emile at fenx.com -------------------- from time import time def add1(*args): sum=0 for arg in args: sum=sum+arg return sum def add2(*args): return reduce(lambda x, y: x+y, args) items = (107, 132, 147, 159, 183, 194, 204, 285, 294, 1107, 2132, 3147, 4159, 5183, 6194, 7204, 8285, 9294, 10483, 14572) for count in (3, 8, 14, 20): print '\n---%s---' % count for iterations in (5000, 15000, 50000): print " ", iterations,":\n", for func in (add1, add2): print ' ',func.__name__, start = time() for i in range(iterations): apply(func, items[:count]) print '%6.2f' % (time()-start) ------------------- ----- Original Message ----- From: Tomek Lisowski Newsgroups: comp.lang.python To: Sent: Thursday, April 06, 2000 9:23 PM Subject: Odp: Creating variables on the fly... > U?ytkownik Joachim Kaeber w wiadomooci do grup dyskusyjnych > napisa?:38E8EFF0.D71D0415 at gmd.de... > > Hi, > > > > what about this: > > > > def add(*args): > > sum=0 > > for arg in args: > > sum=sum+arg > > return sum > > > > add(1,2,3,4) > > => 10 > > > > add (1,2,3,4,5,6,7) > > => 28 > > Why not: > > def add(*args): > return reduce(lambda x, y: x+y, args) > > I am not completely sure, but it may be faster, than a Python for loop > > Tomasz Lisowski > From cpu at bigfoot.com Sat Apr 29 00:49:53 2000 From: cpu at bigfoot.com (S. Hoon Yoon) Date: Sat, 29 Apr 2000 04:49:53 GMT Subject: ODBC / DBI help (via Win32 Extensions) References: Message-ID: I think that's because you should use format #date# on update. Unless, I did not understand your problems. That's really more of SQL and access convention rather than Python. Pls look at the docs for Access and SQL. UPDATE [BT Dates] SET [BT Dates].[date] = #12/12/2000#; This is what I get if I use Query wizard and you should follow it. Hope it helps, "Benjamin Schollnick" wrote in message news:rNHvjEdhm5Pp-pn2-RytgtQHbLg9d at d185d18f2.rochester.rr.com... > ==================================================== > (Remove "NoSpam" to Email me) > ==================================================== > Hi All, > > I'm doing some MS Access/SQL work via the ODBC & DBI > modules... and it's working great... > > I've got the read, and most of the "write" functions working > fine, except when it comes to utilizing the date values... > I can read and convert the date information into a python readable > value.... But I can't seem to do an UPDATE or INSERT INTO command > with a date value inside it. > > Can someone possibly post a example, or a fragment of a > working UPDATE / INSERT INTO command? Or point me to some > python resources that might assist? > > I've checked the ODBC how-to's on the python web site, and > they don't even touch on the subject of WRITING a date... The examples > on reading were very informative, but obviously I'm doing something > wrong. > > - Benjamin > > ==================================================== > (Remove "NoSpam" to Email me) > ==================================================== > Please feel free to copy any and or all of this sig. > A little something for spam bots: > > root at localhost postmaster at localhost admin at localhost > abuse at localhost postmaster at 127.0.0.1 > > Chairman William Kennard: bkennard at fcc.gov > Commissioner Susan Ness: sness at fcc.gov > Commissioner Harold Furchtgott-Roth: hfurchtg at fcc.gov > Commissioner Michael Powell: mpowell at fcc.gov > Commissioner Gloria Tristani: gtristan at fcc.gov > consumerline at ftc.gov > fccinfo at fcc.gov > ssegal at fcc.gov > From rhundt at cup.hp.com Wed Apr 5 22:26:54 2000 From: rhundt at cup.hp.com (Robert Hundt) Date: Wed, 05 Apr 2000 19:26:54 -0700 Subject: Error in "pow" on Itanium Message-ID: <38EBF5EE.98B905A@cup.hp.com> Hi @ll, Running Python 1.5.2 as a 64-bit process on Itanium delivers an error in test_pow. The test delivers different results whenever run! Sometimes it even succeeds! I looked into the sources of do_pow etc. but was not able to ficure out, what exactly is happening there. It seems not to be safe for every 64-bit architecture. Is that right? Any pointers are highly appreciated. Thanks in anticipation -- Robert Hundt HP 408-447-0546 rhundt at cup.hp.com From icarr at bullfrog-tech.com Mon Apr 17 18:31:16 2000 From: icarr at bullfrog-tech.com (icarr at bullfrog-tech.com) Date: Mon, 17 Apr 2000 16:31:16 -0600 Subject: Here is some starship.python.net news References: <38FA9A30.33DD1994@concentric.net> Message-ID: <38FB90B4.35E9CA1B@bullfrog-tech.com> I heard once more from the hosts of starship.python.net Apparently, the "responsible (for fixing it) person" is our very own Mike McLay, who is theoretically on-site with the machine today (Monday) and I got a "hopefully, it will be back up today" from the mscp guys. I say theoretically and hopefully because according to the news on my pager, today is the worst day in the history of Washington, D.C. traffic. So who knows if Mike McLay even made it to the machine. If he did or once he does, let us hope that he can put it back into working order. Manus Hand posting from God-knows-whose address, so please don't reply From matthias_w at my-deja.com Wed Apr 12 07:58:33 2000 From: matthias_w at my-deja.com (Matthias) Date: Wed, 12 Apr 2000 11:58:33 GMT Subject: Embedding Python in Visual C++ 6.0 References: <8d1he4$26d$1@nnrp1.deja.com> Message-ID: <8d1od2$9fl$1@nnrp1.deja.com> Sorry - but I realy tried. I have the same probleme with your pythonwin.cpp sourcecode when I try to debug it. In glue.DynamicApplicationInit(startup)everything looks nice, but if I step into glue.InitInstance() I get the unhandled exception (see below). The Address where the debugger "land's" seems right (1E401F69) it should be the address of BOOL Win32uiInitInstance() , but there is no code :.( and if I try to place a break-point in this function, it is deactivated from VisualC (white dot with red frame) I really do not have any idea what I am doing wrong - If a start pythonwin_d.exe from the explorer there is no problem! Thank you for your help Matthias :-) In article , "Mark Hammond" wrote: > You also need to override InitApplication(). > > I should update the docs, but until then, simply look at Pythonwin.cpp and > see what it does - whatever it does, it obviously works :-) > > Mark. > > wrote in message > news:8d1he4$26d$1 at nnrp1.deja.com... > > Hy! :-) > > > > Maybe someone (Mark Hammond??) can help me. I > > tried to embedd the win32 extentions from Mark in > > a visual c++ project, but everytime the > > Win32uiInitInstance() is called (via > > glue.InitInstance()) I get an unhandled > > exception at 0xC0000005 Access Violation and the > > debugger jumps to 1E401F69 - the address of the > > Win32uiInitInstance() function. When i try create > > a break-point in this function this break-point > > is disabled %-( by the compiler. The same is true > > if i try to debug the original pythonwin project. > > > > Help please! > > > > Matthias > > > > > > Sent via Deja.com http://www.deja.com/ > > Before you buy. > > Sent via Deja.com http://www.deja.com/ Before you buy. From jon_mclin at attglobal.net Tue Apr 25 10:15:06 2000 From: jon_mclin at attglobal.net (Jon McLin) Date: Tue, 25 Apr 2000 14:15:06 +0000 Subject: Python C++ Bindings Message-ID: <3905A86A.39C372FB@attglobal.net> Several links, from c.l.p From niels at endea.demon.nl Fri Apr 14 10:56:15 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Fri, 14 Apr 2000 16:56:15 +0200 Subject: an intern-like memory saver References: <8d5ing$heb$1@nnrp1.deja.com> Message-ID: <38F7318F.AE4F0EE5@endea.demon.nl> sjmachin at lexicon.net schreef: > > Problem: > I have an application that works with words and can have millions of them > in memory at one time. Apart from the main data structure, a dictionary is > used to maintain frequencies. As the words are loaded from files, multiple > instances of the same word don't share memory. The memory savings > could be huge --- see how frequent "the" is in English text, or "Smith" in > an Anglo telephone directory. > > Trial solution: > (1) Clone dictobject.c. Make it into an extension module for a type called > "mydict". Add a method called "key_ref".with one argument: > adict.key_ref(obj). If adict.has_key(obj) is true, this returns a reference to > the key value inside the dictionary; else it returns "obj". > (2) Make simple changes to the application: > (a) Change > freq_dict = {} > to > freq_dict = mydict.mydict() > (b) assuming for purposes of exposition that words are stored simply in a > list, after > freq_dict[w] = freq_dict.get(w, 0) + 1 > change > word_list.append(w) > to > word_list.append(freq_dict.key_ref(w)) > > Results: > Gratifying. An exercise that was running out of real memory (384 MB) and > taking a day now takes an hour or so. > > Questions: > (1) Would this be sufficiently generally useful to make it a method of the > standard dictionary object in Python? It seems to make sense. I don't know if it would be widely used though. I can think of a number of ways to do very much the same thing in Python. I don't know whether you've tried, but I think simply using w = intern(w) might be even faster than what you describe. > (2) As methods seem to be found by sequential search, wouldn't it be a > good idea to move "get" a bit higher up the method_def list in > dictobject.c? At the end, after "update" and "copy", doesn't seem like a > good idea. > (3) Has anyone had any success in compiling Python on WinNT 4.0 with > gcc 2.95.2? It's just fine for making extension modules; I haven't tried > compiling the whole Python yet. I'm working on 1.6a2 now (for Win95, should work for NT too). I've got the core to compile and run, but it takes some patches. I haven't got Tkinter working yet (problems linking the Tcl/Tk libaries, any suggestions other than building those from source welcome). If you like, I can send you what I have so far. > (4) Has anyone any better ideas for gauging Python memory usage than > sitting watching the graphical display in WinNT's Task Manager? Might an > instrumented or instrumentable malloc/free package (like Doug Lea's) that > permitted implementation of a Python builtin memused() be the way to go, > or is there a policy of using the standard malloc from the C library on each > platform? As far as I can tell, you can use any malloc package you like; there are no assumptions other than the C standard. -- Niels Diepeveen Endea automatisering From USENET at questionexchange.com Fri Apr 14 09:42:28 2000 From: USENET at questionexchange.com (QuestionExchange) Date: 14 Apr 2000 13:42:28 GMT Subject: Python equivalent of lynx -dump? References: <20000327200829.29200.qmail@web2101.mail.yahoo.com> Message-ID: <3310qx@questionexchange.com> The server only sends the raw HTML. If you want it formatted, you need to format it yourself -- sort of. To retrieve the data from the server, you can use urlopen from urllib. You could alternatively use httplib, but that's generally only necessary if you're doing something really fancy and HTTP specific. Once you've got the HTML, you can use htmllib to do the parsing. It needs a "formatter", which in turn needs a "writer" (see the fomatter module at http://www.python.org/doc/current/lib/module-formatter.html). The formatter module has an AbstractFormatter and a DumbWriter, which are both pretty basic, but reasonably close to what "lynx -dump" does. If you want better formatting, you can write your own formatter and/or writer. Here's some sample code that does basically what you want. Not that I use a StringIO, since DumbWriter wants to write to a file, but you want the value in a string: from urllib import urlopen import htmllib import formatter # first, retrieve the HTML... html = urlopen(url).read() # create a "string file"... outfile = StringIO() # create a writer and formatter... myWriter = formatter.DumbWriter(outfile) myFormatter = formatter.AbstractFormatter(myWriter) # now parse and format the HTML... parser = htmllib.HTMLParser(myFormatter) parser.feed(html) parser.close() # get the formatted output data = outfile.getValue() -- This answer is courtesy of QuestionExchange.com http://www.questionexchange.com/servlet3/qx.usenetGuest.showUsenetGuest?ans_id=13247&cus_id=USENET From jmassung at magpiesystems.com Wed Apr 26 16:20:28 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Wed, 26 Apr 2000 14:20:28 -0600 Subject: global variables or inheritence References: <28p8zy0irgc.fsf@lada.kom.auc.dk> <28p4s8oipzh.fsf@lada.kom.auc.dk> Message-ID: >testprog1.py: >import os, sys, string, testprog2 >def main(): > print 'hello' > myvar = 2 > testprog2.second() >if __name__ == '__main__': > main() NOTE: myvar is local to main() (not to the file) > >testprog2.py: >import os, sys, string, testprog1 >def second(): > print testprog1.myvar >if __name__ == '__main__': > print 'nope' > Also, just as coding practice - you're cirular use of the files is VERY bad... it can cause many problems (and is illegal in many languages - I can't believe Python would allow it). What is your program that you need to do this with? Just curious. Jeff From bozon at natur.cuni.cz Tue Apr 11 10:42:57 2000 From: bozon at natur.cuni.cz (Michal Bozon) Date: Tue, 11 Apr 2000 16:42:57 +0200 Subject: IDLE lability Message-ID: I use IDLE as an Python IDE on my computer (which is pow(d)ered by Win98). I really like it (IDLE, not Windows), but it is little bit unstable (Windows much more). I worked in 0.4 and 0.5 versions. Sometimes after opening new window (or closing) it yielded an error. But it is caused by tk80.dll module. Now, after Python 1.6 release I tried New IDLE 0.6 and it seems to be even more unstable (it falls always after closing a window). Again the error was in tk module, I thing tk83.dll or so. Michal Bozon - - - - - bozon at natur.cuni.cz http://www.natur.cuni.cz/~bozon From grant at nowhere. Fri Apr 14 15:38:19 2000 From: grant at nowhere. (Grant Edwards) Date: Fri, 14 Apr 2000 19:38:19 GMT Subject: How do I undo an import?? References: <7QrJ4.185421$Hq3.4353581@news2.rdc1.on.home.com> Message-ID: In article , Tom wrote: >After importing NetCfg I type: > >>>> del sys.modules['NetCfg'] > >Python responds as follows: > >Traceback (innermost last): > File "", line 1, in ? >NameError: sys > >Any ideas?? Did you do an "import sys"? -- Grant Edwards grante Yow! You mean you don't at want to watch WRESTLING visi.com from ATLANTA? From PClaerhout at CREO.BE Thu Apr 13 04:22:29 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Thu, 13 Apr 2000 10:22:29 +0200 Subject: Problems with PythonWin Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA72AF@MSGEURO1> Hello, I tried to reinstall PythonWin build 128 today, but I got errors when he was trying to register the Python AXScript engine. Any idea what could be wrong? Any help would be appreciated. Kind regards, Pieter Pieter_Claerhout at creoscitex.com From mfletch at tpresence.com Tue Apr 4 09:13:15 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Tue, 4 Apr 2000 09:13:15 -0400 Subject: Tuples -- who needs 'em Message-ID: I think the point that is being made is this: The _value_ of a mutable object cannot (easily) be used as a dictionary key... i.e. in this sequence, what is the value of the final line... s = [ 1,2,3 ] p = { s: 4, [2,3,4]: 5 } s[:] = [2,3,4] p[ [2,3,4] ] You can get around that by saying (effectively): When a mutable object's value is used as a dictionary key, a copy of the object is used, rather than the object itself (that is, further changes to the object do not alter the key mapping. Which is done, today, as: p = { tuple(s):4, tuple([2,3,4]):5 } The problem is, you still don't have anything like what you really want (that is, store the objects by the keys and somehow do magic behind the scenes to decide which instance is going to be "the one" when keys are equal. Rigorously define that in a simple-to-understand and teach way, with plausible implementation details, and you might get the powers to agree, no? Of course, you could always use id( listvalue) as the key, but that doesn't have the value, only the identity of the object, so two equal lists won't give the same key. Enjoy all, Mike -----Original Message----- From: Hrvoje Niksic [mailto:hniksic at iskon.hr] Sent: Tuesday, April 04, 2000 9:04 AM To: python-list at python.org Subject: Re: Tuples -- who needs 'em "Fredrik Lundh" writes: > -- tuples can be used as dictionary keys. mutable collections can > not. This is wrong. ... From urner at alumni.princeton.edu Sun Apr 2 14:33:37 2000 From: urner at alumni.princeton.edu (Kirby Urner) Date: Sun, 02 Apr 2000 11:33:37 -0700 Subject: Learning in Stereo: Math + Python References: Message-ID: > >>> pi(100) > 3.04936163598 > > >>> pi(10000) > 3.14149716395 > Of course you can push this slowly converging series even further by rewriting f(n) to multiply with long integers: >>> def f(n): return 1.0/long(x)*x >>> pi(100000) 3.14158310433 >>> pi(500000) 3.14159074373 Never use this as an efficient way to get PI!! Here's a continued fraction method: def pi(depth): # use continued fraction of user-supplied depth to refine pi n = 1.0 return 4.0 * 1.0/(1 + 1.0/pifract(n,depth)) def pifract(n,depth): if n>> import math >>> math.pi 3.14159265359 :-D Kirby From tim_one at email.msn.com Sun Apr 23 00:48:08 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 23 Apr 2000 00:48:08 -0400 Subject: LAmbda calculus evaluator (interactive) In-Reply-To: Message-ID: <000301bfacdf$1f5c7260$212d153f@tim> [Kragen Sitaker] > ... > Many years ago, Colby Kraybill suggested to me that it would be nice > to have something similar for mathematical expressions --- something > that would do nothing on its own, but would do the grunt-work involved > in an action like "take the reciprocal of both sides" or "divide both > the top and bottom by (x-1)". Hyland Software's "Merlyn" program does that; see http://www.hylandsoftware.com/ It's based on a general term-rewriting system, and is programmable by the end-user (indeed, almost all the builtin rules are exposed in files you can edit too). However, it's proprietary, costs money, source for the engine itself is not available, and it works only on Windows. I often use it instead of, e.g., Macsyma, because the high-powered systems drive me nuts with the pervasive & often unhelpful transformations they make in an eyeblink; Merlyn never does anything unless it's told to. Similar but weaker symbolic facilities can be found, e.g., in Dave Gillespie's Emacs calc, and high-end HP calculators. If the world were sane, they would have written all these things in Python . the-temptation-to-use-the-time-machine-is-often-overwhelming-ly y'rs - tim From mhammond at skippinet.com.au Fri Apr 21 20:55:32 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 22 Apr 2000 00:55:32 GMT Subject: win32all build 125 debug builds? References: <8dpsik$fsu$1@nnrp1.deja.com> Message-ID: <8M6M4.1334$v85.7864@news-server.bigpond.net.au> wrote in message news:8dpsik$fsu$1 at nnrp1.deja.com... > Does anyone have the debug builds for win32all build 125, or the source > so that I may build them. The source can always be extracted from CVS - use the "b125" tag. Mark. From pinard at iro.umontreal.ca Wed Apr 26 09:26:44 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Apr 2000 09:26:44 -0400 Subject: Sourceforge and Python In-Reply-To: yawyi@gmx.de's message of "Wed, 26 Apr 2000 12:42:13 +0200" References: <3906c7e8$0$29200@personalnews.de.uu.net> Message-ID: yawyi at gmx.de (Johannes Stezenbach) ?crit: > Fran?ois Pinard wrote: > > I would like to bring `recode' a bit closer to Python > There already exists a GNU recode wrapper module for python: > http://www.vex.net/parnassus/apyllo.py?find=recode > http://www.suxers.de/python/pyrecode.htm Thanks for the references. File `contrib/README' for the next `recode' distribution already has some of them, and I completed it from your post. By "bringing closer to Python", I was more thinking more in an administrative than a technical way. Technically, `recode' already uses Python to generate its C or Texinfo tables. Given some free time, I'll rewrite and maintain a parallel version `recode' in Python, just to make prototyping easier. Python 1.6 already has a lot of bundled facilities so simple recodings are very easy to do, to the point that in many cases, a `recode' interface might be seen as overkill. If I re-implement a parallel version of `recode' in Python, I would prefer to use bundled facilities, merely checking that they are congruent with `recode' knowledge, and try to get differences resolved if not. Administratively, I was more thinking of a site offering Mailman, and mostly based of Python scripting, or Python synchronisation methods if any. A way to me, and even for my users, to get closer to Python, even if indirectly. A kind of fuzzy move in a probably good direction :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From kc5tja at garnet.armored.net Wed Apr 26 12:16:13 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 26 Apr 2000 16:16:13 GMT Subject: plugins for browsers? References: <3904ccb0.32134281@news.demon.co.uk> Message-ID: In article , Alex wrote: >I guess if you're using Netscape, you can specify the command yourself. >Go to Edit -> Preferences, then in the dialogue that brings up, go to >Navigator -> Applications. Then go to New, and in the dialogue that >brings up, enter .py as the suffix, and python %s as the command. That's not a plug-in though -- that's just a helper program, and will launch Python applications outside of the browser window. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From kcazabon at home.com Sun Apr 9 19:38:38 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Sun, 09 Apr 2000 23:38:38 GMT Subject: More Tkinter... tkFileDialog to select a directory instead of a file? Message-ID: <2w8I4.122246$Dv1.1320515@news1.rdc1.bc.home.com> Is there any easy way to get tkFileDialog.selectopenfile() to select a directory instead of a file? I need an easy way to select a directory, even if it contains no files... Any suggestions are appreciated, as always! Kevin. From greg at cosc.canterbury.ac.nz Wed Apr 5 00:42:44 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Wed, 05 Apr 2000 16:42:44 +1200 Subject: Tuples -- who needs 'em References: Message-ID: <38EAC444.9994D2E0@cosc.canterbury.ac.nz> Mike Fletcher wrote: > > The question of what a "meaningful" hash function would be for a mutable > sequence is the crux of the issue The important thing is whether the object *behaves* immutably as far as comparison is concerned. If two objects a and b of a type T have the property that a == b always returns the same result regardless of what is done to a or b, then it makes sense to use objects of type T as dictionary keys. But there has to be *something* about them that can be regarded as immutable. So, in that broader sense, the statement that "only immutable objects can be used as dictionary keys" remains correct. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From sblakey at freei.com Thu Apr 13 15:06:37 2000 From: sblakey at freei.com (Sean Blakey) Date: Thu, 13 Apr 2000 12:06:37 -0700 (PDT) Subject: Simple formatting string question In-Reply-To: Message-ID: <20000413190220.C11CB1CDBA@dinsdale.python.org> On 13 Apr, Matthew Hirsch wrote: > Hi All, > > I'm trying to print something like this: > >>>> print 6*'%2i' '%1i' % tuple([5,5,5,5,5,5,1]) > > but I'm getting an error. > > Do you know what the correct syntax should be? > > Thanks, > Matt Two issues: First, you have to concatenate the format stings with plus. Second, formating binds more tightly than string formatting, so you will need parentheses around "6x'%2i' + '%1i'". What I got to work was: >>> print (6*'%2i' + '%1i') % tuple([5,5,5,5,5,5,1]) 5 5 5 5 5 51 -- Sean Blakey FreeInternet.com sblakey at freei.com (253)796-6500x1025 From thamelry at vub.ac.be Tue Apr 25 06:34:40 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 25 Apr 2000 10:34:40 GMT Subject: how to wrap c++ software to python? References: <8e3ggq$2r1d$1@news.cz.js.cn> Message-ID: <8e3sc0$jss$1@mach.vub.ac.be> fmr wrote: : I will call c++ routine in python,how to wrap : c++ routine for python. : Is there any utils to work except SWIG. Try: http://www.acl.lanl.gov/siloon/ There's also something called CXX that might be of interest to you. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From mrfx at 263.net Sun Apr 9 22:27:26 2000 From: mrfx at 263.net (fmr) Date: Mon, 10 Apr 2000 10:27:26 +0800 Subject: How to compile Doc from tex format to pdf in win32 Message-ID: <8crdm2$2bff$1@news.cz.js.cn> I want to compile Python Doc from Tex format to Pdf or HTML format, Who can help me? From cut_me_out at hotmail.com Thu Apr 13 09:35:08 2000 From: cut_me_out at hotmail.com (Alex) Date: 13 Apr 2000 09:35:08 -0400 Subject: Why should I switch to Python? References: <87u2h6nwak.fsf@psyche.evansnet> Message-ID: > > Mail-copies-to: [nobody|poster] > > Uh, I think that's supposed to be _one_ of: Oh, yeah, thanks. Forgot to change my .gnus.el file on this account. Alex. From bwinton at tor.dhs.org Mon Apr 10 15:35:47 2000 From: bwinton at tor.dhs.org (Blake Winton) Date: Mon, 10 Apr 2000 19:35:47 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8covpn$4jq$1@slb6.atl.mindspring.net> <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk> <3H4I4.709$4w1.17557@typhoon.nyroc.rr.com> <8cs3ho$l06$1@pegasus.csx.cam.ac.uk> Message-ID: On 10 Apr 2000 08:31:52 GMT, Nick Maclaren wrote: >In article <3H4I4.709$4w1.17557 at typhoon.nyroc.rr.com>, >Darrell wrote: >>> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0) >> >>x=0 >>if a != NULL: >> x=a[i].weeble >> >>if b != NULL: >> x=x+b[i].wombat >> >>Isn't this more clear? In fact isn't not much if any longer than the >>"C" version when you count the parens used. > >No. Firstly, it relies on an artifact of my example (i.e. that it is >in an assignment, rather than a test condition or function call) and, >secondly, the more lines that code takes the harder it is to see the >function in its entirety. Now perhaps it's just because I've been forced to switch brace styles at work, but this comment kind of rubs me the wrong way. Even on the linux console (possibly the least configurable text mode I know), you can get 80 lines on the screen at a time. It's my (not so) humble opinion that if your functions are 80 lines long, then you're probably doing something wrong. Even if you have to break your single line up into four or five, surely it's not causing your functions to run off the end of the screen, or if it is, perhaps it's time to break your functions up a little. And in my case, I far prefer the second version. One concept per line seems like a decent metric to go by, and "x = (a?b:c) + (d?e:f)" seems like a lot more than one concept to me... Finally, think of all the whitespace you've saved by not having to use "}"s all over the place. ;) Later, Blake. -- 2:54pm up 12 days, 15:28, 1 user, load average: 1.08, 1.02, 1.01 From effbot at telia.com Mon Apr 24 12:35:04 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 24 Apr 2000 16:35:04 GMT Subject: Simple list.append() question References: Message-ID: Matthew Hirsch wrote: > Hi All, > > I have this: > >>> entire_list=[[]]*3 > >>> entire_list > [[], [], []] > >>> entire_list[0].append(1.23) > >>> entire_list > [[1.23], [1.23], [1.23]] > > I only want to append 1.23 to entire_list[0]. Why did it also append it > to entire_list[1] and entire_list[2]? entire_list contains three references to the same list. for more info, see: http://www.python.org/doc/FAQ.html#4.50 From just at letterror.com Thu Apr 20 04:12:58 2000 From: just at letterror.com (Just van Rossum) Date: Thu, 20 Apr 2000 09:12:58 +0100 Subject: __del__ problem - would adopting Garbage Collection fix this? In-Reply-To: <20000420003749.A31345@acs.ucalgary.ca> References: ; from just@letterror.com on Thu, Apr 20, 2000 at 08:35:13AM +0100 <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> <38FE7F1E.168E914A@cosc.canterbury.ac.nz> Message-ID: At 12:37 AM -0600 20-04-2000, Neil Schemenauer wrote: >On Thu, Apr 20, 2000 at 08:35:13AM +0100, Just van Rossum wrote: >> Maybe you're right, but to me it feels this is in the exact >> same category as a __del__ exception, so ignoring & collecting >> seems more logical to me as a default. > >It shouldn't be hard to change. I will wait until I get some >more feedback though. Sure, I don't expect you to take my word for it ;-) There's an additional argument, though: symmetry with JPython. Just From hamish_lawson at yahoo.co.uk Fri Apr 7 10:02:04 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Fri, 07 Apr 2000 07:02:04 -0700 Subject: PPython References: <38ede548.353776233@news.oh.verio.com> Message-ID: <02d80e56.59818fe0@usw-ex0108-063.remarq.com> You may instead be interested in the mxCGIPython tool, which helps you to install Python on your ISP when your ISP won't/can't. http://starship.skyport.net/~lemburg/mxCGIPython.html * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From mikael at isy.liu.se Fri Apr 14 15:41:48 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Fri, 14 Apr 2000 21:41:48 +0200 (MET DST) Subject: How do I undo an import?? In-Reply-To: Message-ID: On 14-Apr-00 Tom wrote: > After importing NetCfg I type: > > >>> del sys.modules['NetCfg'] > > Python responds as follows: > > Traceback (innermost last): > File "", line 1, in ? > NameError: sys > > Any ideas?? Have you imported sys? I don't think so. /Mikael ----------------------------------------------------------------------- E-Mail: Mikael Olofsson WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael Phone: +46 - (0)13 - 28 1343 Telefax: +46 - (0)13 - 28 1339 Date: 14-Apr-00 Time: 21:41:15 This message was sent by XF-Mail. ----------------------------------------------------------------------- From effbot at telia.com Mon Apr 3 06:59:10 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 03 Apr 2000 10:59:10 GMT Subject: Tkinter: "Get root for a widget" is private? References: <20000331112048.A1257432@vislab.epa.gov> <20000331112048.A1257432@vislab.epa.gov> <20000403064335.A1560771@vislab.epa.gov> Message-ID: <2Q_F4.1092$n68.187097600@newsb.telia.net> Randall Hopper wrote: > Given this it seems we should have a public root() method. Could we > add a: > > root = _root > > definition to Tkinter's Misc class, to make this a public feature? the question is why? if you're only out to get an interpreter handle (e.g. to instantiate a variable or image object), any widget will do. if you wish to find the original application window, I'd say it's much cleaner if you keep track of that by yourself (IMO and IME, a good GUI design has one application level object, which should *not* be a subclass of Tk). so why, exactly, do you need the root? From che at debian.org Wed Apr 19 17:18:55 2000 From: che at debian.org (Ben Gertzfield) Date: 19 Apr 2000 14:18:55 -0700 Subject: [Announce] CDDB 1.0 Python module released! Message-ID: Hi everyone! I've received several patches for the CDDB module and lots of good feedback since the original 0.5 release, and so now it's time for a new version, 1.0! You can fetch it from the usual place: http://csl.cse.ucsc.edu/~ben/python/ CDDB.py provides an easy way for Python programs to fetch track and disc information on audio CDs. This information is acquired from CDDB, a very large online database of track listings and other information on audio CDs. Included is a C extension module to enable Python to read track listings from audio CDs under Linux, FreeBSD, Solaris, and Win32. The interface to this extension module is portable and is intended to be ported to other OSes easily. Brief summary of changes in the 1.0 release: This release includes a cdrom module that builds under Linux, Solaris, and FreeBSD, along with a Win32 cdrom module! There were several bugs in the old code related to multiple match returns from CDDB Please let me know if you find any bugs! :) Thanks! -- Brought to you by the letters S and O and the number 17. "A kinkle is a clever method." Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/ From alander at nortelnetworks.com Thu Apr 13 10:18:33 2000 From: alander at nortelnetworks.com (Anthony Lander) Date: 13 Apr 2000 14:18:33 GMT Subject: Thanks Message-ID: <8F15632D3anthonylander@47.80.11.122> Thanks guys. I think I've got it all sorted out now. peace, -anth From claird at starbase.neosoft.com Mon Apr 10 13:41:00 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 10 Apr 2000 12:41:00 -0500 Subject: Migrating Tcl system to Python References: Message-ID: <5C5D50759ACE4423.57E1CE451FB57C9E.2C33FE35E7FD9271@lp.airnews.net> In article , Moshe Zadka wrote: . . . >Tcl has exactly two types: strings, and arrays mapping strings to >strings. The problem is that those are often used to create >data-structures in strange and unpredictable ways. Hence, no good . . . 1. There are different ways of counting. It was long traditional to say that Tcl had only strings. 2. That "strange and unpredictable" stuff is what Tclers think of as programming. Mr. Zadka's right: the prospects for general autotranslation are bleak (you don't want to know about [trace] or [uplevel]), but simple marshalling schemes generally work quite well. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From gmcm at hypernet.com Thu Apr 20 08:14:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 20 Apr 2000 08:14:18 -0400 Subject: Confused by List behavior In-Reply-To: <8dmqsd$6m0$1@nnrp1.deja.com> Message-ID: <1255889636-29796319@hypernet.com> ejbaker_seekonk at my-deja.com wrote: > As a python newbie, I entered this script to explore list processing > behaviours. > > yy = dir() > for element in yy: > print element > > for element in yy: > print dir(element) > > The first 'for' loop works as expected. It returns, > ['__builtins__', '__doc__', '__name__']. > > The second loop, however, returns three empty lists. For the life of > me, I can't understand that. Becauese, if I type 'dir(__builtins__)', > in a script, I get all of the elements of __builtins__. You're confused by dictionaries, not lists. dir() returns the names of the objects (that is, a list of strings), not the objects themselves. One way: for element in dir(): print dir(eval(element)) More sensibly: for key, val in vars().items(): print key, val, dir(val) - Gordon From guido at python.org Thu Apr 6 17:30:21 2000 From: guido at python.org (Guido van Rossum) Date: Thu, 06 Apr 2000 17:30:21 -0400 Subject: [Python-Dev] Round Bug in Python 1.6? In-Reply-To: Your message of "Thu, 06 Apr 2000 23:22:30 +0200." <38ED0016.E1C4A26C@tismer.com> References: <38ED0016.E1C4A26C@tismer.com> Message-ID: <200004062130.RAA26273@eric.cnri.reston.va.us> > asa side effect, I happened to observe the following rounding bug. > It happens in Stackless Python, which is built against the > pre-unicode CVS branch. > > Is this changed for 1.6, or might it be my bug? > > D:\python\spc>python > Python 1.5.42+ (#0, Mar 29 2000, 20:23:26) [MSC 32 bit (Intel)] on win32 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> round(3.1415926585, 4) > 3.1415999999999999 > >>> ^Z > > D:\python>python > Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> round(3.1415926585, 4) > 3.1416 > >>> ^Z This is because repr() now uses full precision for floating point numbers. round() does what it can, but 3.1416 just can't be represented exactly, and "%.17g" gives 3.1415999999999999. This is definitely the right thing to do for repr() -- ask Tim. However, it may be time to switch so that "immediate expression" values are printed as str() instead of as repr()... --Guido van Rossum (home page: http://www.python.org/~guido/) From gresham at mediavisual.com Wed Apr 12 06:14:40 2000 From: gresham at mediavisual.com (Paul Gresham) Date: Wed, 12 Apr 2000 18:14:40 +0800 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> <874s9766r6.fsf@ifm.uni-kiel.de> <87zoqz4p9n.fsf@ifm.uni-kiel.de> Message-ID: <8d1iak$r1u2@imsp212.netvigator.com> "Janko Hauser" wrote in message news:87zoqz4p9n.fsf at ifm.uni-kiel.de... > Michael Hudson writes: > > > Nononono; think about what happens if you do this: > > > > class bob(paul): > > pass > > > > bob("adam").fired() > > > > What *I* think you want is: > > > > class paul(lazy): > > def __init__(self, name): > > lazy.__init__(self,name) > > self.april_pay = 0 > > > > def fired(self): > > print "Here's a box, collect the things from your desk" > > lazy.fired(self) > > > > After all, if you're going to inherit from a class, you must have > > access to it, right? > > > > I see, this is clearly better. But I do not understand, where the > class/instance?? of lazy.__init__() is stored. In this way the lazy class does not have an instance, but we can still call its member functions, as if they were a normal function. By passing them our instance of self, then our self will also be initialised. In the above example we can do this without risk, as we are inheriting from lazy, so we have all attributes. > > Some more slaps on the head, please :-) > > __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 hamish_lawson at yahoo.co.uk Sun Apr 23 12:50:27 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Sun, 23 Apr 2000 09:50:27 -0700 Subject: Overloading the = operator? References: Jerome Chan's message of "Sun, 23 Apr 2000 00:14:02 GMT" <1255667027-43185679@hypernet.com> Message-ID: <089fe23e.38bfd6ac@usw-ex0103-019.remarq.com> Jerome There seem to be two issues here: copying the contents of one object to another and adding two objects together. I'll use a cut-down version of your example. class Base: def __init__(self, q): self.list = q def __add__(self,other): return self.list + other.list x = Base([1,2]) y = Base([2,4,3]) z = Base([]) z = x + y I'm guessing that your coming at this from a C++ viewpoint, so I'll try to relate the discussion to C++ concepts. Let's deal with copying objects first. Whereas in C++ assignment is a copying operation, you have learnt by now that in Python it is a name binding operation. Thus the statement z = x doesn't copy the contents of x over to z, but instead makes the name z be another reference to the object that x refers to. If we want z to have the same value as x but be an independent object, then we first need to make a new object that is a clone of x and then assign z to this new object. We can clone objects using the copy module; we'll also define a __copy__() method for the Base class: class Base: def __init__(self, q): self.list = q def __add__(self,other): return self.list + other.list def __copy__(self): copiedlist = self.list[:] # make a copy of the list return Base(copiedlist) import copy x = Base([1,2]) z = copy.copy(x) # calls x.__copy__() In Python as in C++ the question of shallow and deep copying crops up. Our __copy__() method has been defined so that the cloned object gets its own copy of the list attribute (see the copy module for a discussion of shallow and deep copying). However you may not need to bother with copying if your real concern is with adding objects together, which we'll now consider. The __add__() method as currently defined returns a list, but it should really return a new Base object (this is in fact what an overloaded operator+ would be expected to do in C++ too). class Base: def __init__(self, q): self.list = q def __add__(self, other): return Base(self.list + other.list) # new Base obj def __copy__(self): copiedlist = self.list[:] return Base(copiedlist) x = Base([1,2]) y = Base([2,4,3]) z = x + y Since x + y produces a *new* Base object, this can simply be assigned to z without the need to make a copy. Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From nascheme at enme.ucalgary.ca Wed Apr 19 11:44:50 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Wed, 19 Apr 2000 15:44:50 GMT Subject: Python 1.6a2 crashes in test_fork1 on my Mandrake Linux 7 machine References: <20000413010344.A13931@owl.rhein-zeitung.de> <38F658C6.66AD9CA5@clark.net> <20000414154718.A15664@xs4all.nl> <20000414190308.A30502@owl.rhein-zeitung.de> <38F91D1B.3D663B0C@stanford.edu> <38FD72B1.DBB2F731@stanford.edu> Message-ID: Chad Netzer wrote: >Neil Schemenauer sent me the following code, which demonstrates >a problem quite clearly. It locks up on me in dual-CPU mode, but >works fine in single-CPU mode. Interesting. My machine is a single CPU and still locks up with that code. Neil -- "A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away." -- Antoine de Saint-Exuper From bgdarnel at my-deja.com Wed Apr 26 22:26:24 2000 From: bgdarnel at my-deja.com (Ben Darnell) Date: 27 Apr 2000 02:26:24 GMT Subject: Python compiler ? (was Re: Python for drivers?) References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> <3906f804@nntp.server.uni-frankfurt.de> <015b01bfaf8b$9cd03930$0500a8c0@secret.pythonware.com> <39076316@nntp.server.uni-frankfurt.de> <8e7sop$5io$1@nnrp1.deja.com> Message-ID: In article , Will Ware wrote: >gchiaramonte at my-deja.com wrote: >> How about $100 each? Then we only need 600 users. If his compiler >> really works, count me in. > >That's not a bad price per-person, but what are the chances that he'd >be willing to open-source it? He seems to regard this as a revenue >generator, so he'd likely consider the source code (or at least a >large fraction of it) a trade secret. I'd also be willing to kick in >$100 for an efficient Python compiler, but only if it were open source. You might want to post a request on cosource.com, a service which is designed to do just what you're talking about here - collect aggregate payments from the community for open source projects. You first post the request and get indications of interest from sponsors then see if any developer will submit a proposal. -Ben -- Ben Darnell bgdarnel at unity.nc su.edu http://thoughtstream.org From effbot at pythonware.com Fri Apr 7 13:59:10 2000 From: effbot at pythonware.com (effbot at pythonware.com) Date: Fri, 07 Apr 2000 17:59:10 GMT Subject: Python on Google? References: <8F0ED22EBjoshtinamecom@209.208.0.7> <8cjfk8$qtlo$1@fido.engr.sgi.com> Message-ID: <8cl7l3$4uk$1@nnrp1.deja.com> Paul Jackson wrote: > > |> to what extent Python is used on www.google.com? > > My vague impression is that quite a bit of the > original "interesting" code was done in Python, but > that most of the serious stuff now is being done > in C or C-like C++, due to the serious performance > challenges handling their current large and growing > load. > > Perhaps some of the non-critical path stuff is still > in Python. iirc, their crawlers have been python-powered from the very beginning. if you skip over to their jobs page: http://www.google.com/jobs.html you'll find that they're looking for programmers with various levels of Python experience. Sent via Deja.com http://www.deja.com/ Before you buy. From dfan at harmonixmusic.com Fri Apr 28 09:22:08 2000 From: dfan at harmonixmusic.com (Dan Schmidt) Date: 28 Apr 2000 09:22:08 -0400 Subject: Metaclasses? References: Message-ID: Moshe Zadka writes: | On Thu, 27 Apr 2000, GTE wrote: | | > On the other hand I kinda like Visual Basic's 'with' construct. Consider: | > def method(self,arg1,arg2): | > with self: | > .spam = "spam" | > .eggs = arg1+arg2 | | Here's a way to get almost that effect: | | def method(self, arg1, arg2): | _ = self | _.spam = "spam" | _.egss = arg1 + arg2 I just do this: def method(_, arg1, arg2): _.spam = "spam" _.eggs = arg1 + arg2 Will this practice get me kicked out of any Python Users Groups? -- Dan Schmidt | http://www.dfan.org From Jhlee at Brooks.com Tue Apr 4 17:25:26 2000 From: Jhlee at Brooks.com (Lee, Jaeho) Date: Tue, 4 Apr 2000 17:25:26 -0400 Subject: complete novice question Message-ID: <857F15D7E3D8D3118D290008C7CF058627071E@mail-naeast1.brooks.com> > I've run 'configure' and it seems to have worked. Now, according to the > Python package's README, I should be able to type 'make' for the rest of > the install. If I don't have a 'make' file, did the configure portion > not work? You don't need 'make' file to make. Don't worry. Just type 'make'. It needs Makefile or makefile, not make. From sctheagn at kraken.itc.gu.edu.au Thu Apr 20 01:30:11 2000 From: sctheagn at kraken.itc.gu.edu.au (Joal Heagney) Date: Thu, 20 Apr 2000 15:30:11 +1000 Subject: Testing a module's return Message-ID: <38FE95E3.1A10D5B0@kraken.itc.gu.edu.au> I've found that I have to define several of my modules such that they return a string if they fail, rather than 0. (Let's face it, there are a lot more things that can go wrong than right). Now I originally wanted to have these modules return the values I was after. eg. def function_name(arg1, arg2, arg3, .... argN): do something with the args, return value But as a beginner, *grins* I've found returning error strings a little more important def function_name(arg1, arg2, arg3, .... argN): check for error condition 1: return 'Whoops' check for error condition 2: return 'What are you doing, Dave?' check for error condition 3: return 'That ain't right, or humanly decent either' do something with the args, return something. I can't sort out, should I return 0 for a success, and give the answer as a set attribute (Eg. a class variable)? Or is there a much neater way of doing things? There'd have to be. I'd appreciate if answers were posted by email as well as newsgroup. It could take me a while to get back to them. Thank you, Joal Heagney/AncientHart From gmcm at hypernet.com Mon Apr 24 12:35:07 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 24 Apr 2000 12:35:07 -0400 Subject: ftplib sendcmd In-Reply-To: <3904722D.12EE9927@bam.com> Message-ID: <1255528387-51524611@hypernet.com> Bill Scherer wrote > I'm having trouble with ftplib's sendcmd method (Python 1.5.2 on > RH linux 6.1): > > >>> ftp = ftplib.FTP(host, user, password) > >>> ftp.sendcmd('umask 002') > Traceback (innermost last): > File "", line 1, in ? > File "/usr/local/lib/python1.5/ftplib.py", line 228, in sendcmd > return self.getresp() > File "/usr/local/lib/python1.5/ftplib.py", line 201, in getresp > raise error_perm, resp > ftplib.error_perm: 500 'UMASK 002': command not understood. > >>> > > The umask command does, of course, work using a standard ftp > client to the same host. > > Other commands, chmod, etc, suffer equal fate. > > Is this not what sendcmd is for? What am I doing wrong? Thanks! These are not rcf 959 commands. GNU ftpd will support them as SITE UMASK x and SITE CHMOD mod file. - Gordon From jon at dgs.monash.edu.au Fri Apr 7 01:35:40 2000 From: jon at dgs.monash.edu.au (Jonathan Giddy) Date: Fri, 7 Apr 2000 15:35:40 +1000 (EST) Subject: Socket Programming Question In-Reply-To: from "Ray Van Dolson" at Apr 07, 2000 05:01:58 AM Message-ID: <200004070535.PAA18944@nexus.csse.monash.edu.au> >def main_server_thread(): > while 1: > (clientsocket, address) = serversocket.accept() > ct = Thread(target=client_thread,args=((clientsocket),)) > ct.run() You need to call ct.start(), not ct.run(). The start method creates the new thread to execute the run method.. Jon. From scarblac-spamtrap at pino.selwerd.nl Mon Apr 17 12:37:20 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 17 Apr 2000 16:37:20 GMT Subject: How do I make a constant global variable in Python Please References: Message-ID: Jeff Massung wrote in comp.lang.python: > Along the same lines... is there a way to say a variable must be declared > before use? I know Perl has something like this. I just want to avoid > something like this following: No, simply because there is no way to declare a variable. > ate = 1 > while ate: > # do something here > ... > are = 1 > > This will loop infinitely just because of a typo (that if the above were > added I would get an error saying that "are" wasn't declared). It's happened a few times to me, but you notice that sort of error almost immediately, in my experience. Note that it would loop too if it said "ate = 1" as you seemed to intend - you need to test to find errors anyway... Also, this problem only occurs with assignment. If you try to use a new variable in an expression, an exception will be raised, because the variable can't be found. ate = 1 x = are gives an exception. Python has no declarations, and nothing is a 'constant' as in other languages. -- Remco Gerlich, scarblac at pino.selwerd.nl This is no way to be Man ought to be free -- Ted Bundy That man should be me From quinn at zloty.ugcs.caltech.edu Wed Apr 12 16:22:44 2000 From: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) Date: 12 Apr 2000 20:22:44 GMT Subject: modifying os.environ Message-ID: Is there any way to delete things from the environment in python? A look at os.py reveals that _Environ only overrides __setitem__ to putenv. So how do you *delete* environment values? perl does it, and a look at the source seems to indicate that it doodles with the C environ directly. So perhaps python needs a delenv _Environ can use or something, or implement os.environ in C? Or perhaps there's a better way to do the (common) thing I'm trying to do: clean the environment to insure some minimum sane values. I can't make a copy of the environ and then pass to execve() since that doesn't help much for popen and system. I can set values to '', but that doesn't seem as safe as just removing them entirely (IFS, LD_LIBRARY_PATH, etc.?) From akuchlin at mems-exchange.org Mon Apr 24 11:27:50 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 24 Apr 2000 11:27:50 -0400 Subject: The Simple Economics of Open Source References: <3903316C.5D6F1611@tcac.net> Message-ID: <3dya63y0ww.fsf@amarok.cnri.reston.va.us> wware at world.std.com (Will Ware) writes: > very small. Are there other talented artists with distinctive styles > for whom it wouldn't be very unreasonable for there to be undiscovered > works appearing? Probably not. The Dutch artist Vermeer is sort of the opposite case; the number of actual Vermeers is slowly being whittled away by scholarship as paintings are attributed to his students. I think the number of original Vermeer paintings is now put at around 30. A forger named Han van Meegeren painted several forged Vermeers, some of which fooled people for many years. (http://www.mystudios.com/gallery/han/) This connects to two obsessions of mine. Robertson Davies's excellent novel _What's Bred in The Bone_ has a subplot based on van Meegeren. And Peter Greenaway's film _A Zed and Two Noughts_ features a character named van Meegeren who's a doctor obsessed with Vermeer, and lighting design and photography influenced by Vermeer (always lit from the left, for example. In the screenplay PG gives a far lower number of actual Vermeers than any other source: 23. -- A.M. Kuchling http://starship.python.net/crew/amk/ 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_ (1986) From m.faassen at vet.uu.nl Tue Apr 11 09:24:12 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 11 Apr 2000 13:24:12 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8ctc9m$sp2$1@pegasus.csx.cam.ac.uk> <8ctkm5$bko$2@newshost.accu.uu.nl> <8cur12$5pf$1@pegasus.csx.cam.ac.uk> Message-ID: <8cv91s$q2i$1@newshost.accu.uu.nl> Nick Maclaren wrote: > In article <8ctkm5$bko$2 at newshost.accu.uu.nl>, > Martijn Faassen wrote: >>Nick Maclaren wrote: >>[if your function gets longer than a screenfull, it's time to start >>thinking about splitting it up] >> >>> It really is quite amusing to see these same old myths coming back >>> every few decades :-) >> >>You think splitting a function up is a myth? I find it helps >>me and my code. It becomes more readable and writeable. I'm genuinely >>surprised by your assertion this is an 'old myth'. > The myth is that splitting functions up necessarily improves clarity. > Sometimes it does; sometimes it doesn't. It depends on how you do the splitting, I'd still say. I think the cases are rare that one long complicated function is more readable than two or three or more *well-chosen* shorter ones. >>> That particular dogma was very popular back in the late 1960s and >>> early 1970s, when practical programmers pointed out that it was a >>> virtually impossibility for a normal person to keep track of 50 >>> trivial functions in their head, but it was quite easy to look >>> at 60 lines of sequential code. That didn't get listened to >>> then, either! >> >>Of course if you go about randomly chopping up your function into >>multiple ones, that's not going to improve matters. The idea is >>to conceptually split your function into multiple smaller ones >>that make more sense, are more easy to adapt, are coherent by >>themselves, and make the original big function more readable, as >>by writing all the smaller functions you've hopefully also given >>them names. It's called refactoring, of course. :) > The dogma is that there is a maximum size of function that should > ever be written, Putting a strict limit on the number of lines is of course silly. > and that complex functions necessarily split up > cleanly into smaller sections. I think they do; perhaps not multiple functions per se, but multiple classes, definitely. Particularly in a language like Python! > Sometimes they do; sometimes they > don't. I have seen codes where the median size of functions was > below 5 lines, and you had to keep the specification of over 50 in > your head just to read the simplest function! Didn't the functions have readable names then? Of course it's silly to take all this to ridiculous extremes, but if the naming was done well you have a lot of contextual information when you're reading a function which you wouldn't have otherwise. >>My guidelines are: >> >>If your function is long and complicated, too many concepts >>and abstractions are mingling in the same place. Do a better job >>of abstracting stuff, and you'll end up with shorter, clearer >>functions. > Sometimes. I have very often done that and backed off, because the > complex function was clearer. Another good rule is, if auxiliary > functions need to access more arguments and artificial global > variables than they have lines of code, consider whether they would > be better written inline. If you run into that, use records or classes. OO is pretty good at this; you can still bundle a set of methods into an object. The object can do complicated things, but its parts are simple. I don't recall cases where this was impossible, but then again my experience may be too limited. >>If your function is long and repetitive, you're not being a lazy >>enough programmer. Write some smaller functions that generate the >>stuff, read it from a file or database, whatever. > If the repetitiveness is not quite regular enough to make that easy, > you are making unnecessary work for yourself. Sometimes that is the > right solution; sometimes it isn't. The repetitiveness is always regular enough to abstract it into a bunch of classes, make a dictionaries of lists or whatnot. If there is no regularity at all repetitiveness isn't the problem. >>Are you saying these guidelines are based on a myth? > No - the myth is that they invariably improve things. Life is not > that simple. No, they don't improve anything if you don't think well before you refactor. But I do believe it's always possible to split up longer complicated functions into smaller ones (or objects), given enough thought, and that this makes the code more clear. >>> My current infliction is a accounting file format, and the the >>> function to check the input (you DO check your input, don't you?) >>> needs to perform 100 tests in series. Yes, I am inventing >>> trivial functions, but it would be clearer to put more of the >>> tests inline. >> >>Why not split this up into a bunch of validation objects or >>something, and then check the input that way? And aren't at least >>some of these tests similar enough to abstract into a function >>(such as tests for maximum various lengths of strings). Of course >>the accounting file format may be so baroque your function just >>has to be baroque, but that sort of thing *ought* to be rare. :) > That is, of course, what I am doing. But designing in enough > commonality takes a lot longer (and is more complex) than simply > repeating the very simple tests. After all, it gains you nothing > by calling an auxiliary that then has a massive switch statement > with special code for each of its calls - and some people do write > code like that! > In this particular case, there are 50-60 entries, which need > 40-50 separate test conditions. By thinking, I can common up > quite a lot of that code, but there is some which is not amenable > to that. Yes, but even that code could probably be split out into some way so that it's clear that something special, uncommon is happening, right? And that would likely be clearer than it just being thrown in a big function, I think? More work, yes, perhaps. At least more up-front work. > If you remember, I asked whether there were any equivalent to a > couple of very common paradigms, that have been used to clarify > code for over 30 years. Obfuscate code at least as often as clarify. > The answer appears to be "no", so I have > to use somewhat less satisfactory ones. This is not a major > problem - been there, done that, in dozens of languages. In some cases, perhaps you'll have to use less satisfactory ones. I think in most cases the alternatives are *more* satisfactory, however. > What isn't acceptable, however, is putting up with people saying > that it is heretical to admit that such requirements exist! Fads > are one thing, but dogma is harmful. Fads, dogma, but what about wisdom, though? Python's idea is that ?: and assignment-in-expression both tend to obfuscate the code. It'd be nice to have something replacing the assignment-in-expression in the example in your first post, but I disagree that your ?: construction makes the code more easy to read than than various alternatives. I can grok C's (?:), but its main advantage is that it makes code more writeable, not more readable, in my opinion. Likewise any replacement to enable the niceness assignment-in-expression allows (in 'if' and 'while' loops) will *not* be assignment-in-expression but something more readable and less general. In general, the pattern in Python is that it avoids several handy but easy to convolute constructs; for instance we have no C style for(;;) loop either, while it's clearly the general case. Instead in Python you tend to work with more specific idioms like its own 'for' loop, 'range', and lists. This appears to make the code more readable. People have been showing you some examples of special case idioms that in part take over the functionality of (?:). I think the idea is that such special case idioms help in making the code more readable, and catch 90% or more of the cases. No 'heretical'. Just trade-offs. Python's idioms for writing Python. The strategy does have a pay-off: Python code tends to be fairly readable. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From thomas at xs4all.net Tue Apr 11 07:51:03 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Tue, 11 Apr 2000 13:51:03 +0200 Subject: Thread-safe atomic operation In-Reply-To: <8cuf0o$p9a$1@news1.kornet.net>; from sadwolf@chollian.net on Tue, Apr 11, 2000 at 03:02:28PM +0900 References: <8cuf0o$p9a$1@news1.kornet.net> Message-ID: <20000411135103.B28687@xs4all.nl> On Tue, Apr 11, 2000 at 03:02:28PM +0900, Dong-gweon Oh wrote: > Is there any documents which describe Python's atomic operation in > multithreaded environment. I guess Python virtual instruction is atomic. > But, without definitive documentation in high level Python statements, I > tend to over-lock my programs. > Are these statements thread-safe? > 1. import xxx > 2. xxx = __import__('xxx') > 3. reload(xxx) > 4. dict['xxx'] = sys.modules['xxx'] > 5. dict.has_key('xxx') Well, Python uses a global interpreter lock. This means that no matter howmany threads are instantiated, only one of them will be executing Python code. Inside python code, and in C modules and extensions, however, the C code itself takes care to allow/disallow multiple threads to run a block of code. So, the answer to your question is: Yes, all of them are thread-safe, but none of them will benifit from threading. Some of them may block and allow threads, though, so you might get *some* aditional performance if you are doing something else in another thread, at the same time. You can safely assume all your python code is always thread-safe, and if you do not bother with the 'Py_BEGIN_ALLOW_THREADS'/'Py_END_ALLOW_THREADS' C macros, so will all your C extension code (as long as you dont do anything funky with cloning threads yourself.) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From greg at quokka.demon.co.uk Mon Apr 24 18:40:07 2000 From: greg at quokka.demon.co.uk (greg at quokka.demon.co.uk) Date: Mon, 24 Apr 2000 22:40:07 GMT Subject: plugins for browsers? Message-ID: <3904ccb0.32134281@news.demon.co.uk> Are there any plugins or other means of running Python in Web browsers? I seem to recall that there were a while ago ... Greg Lewin From pecora at anvil.nrl.navy.mil Sun Apr 30 09:55:47 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Sun, 30 Apr 2000 13:55:47 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <280420000746597329%pecora@anvil.nrl.navy.mil> Message-ID: <300420000955487866%pecora@anvil.nrl.navy.mil> [[ This message was both posted and mailed: see the "To," "Cc," and "Newsgroups" headers for details. ]] In article , Will Ware wrote: > Louis M. Pecora (pecora at anvil.nrl.navy.mil) wrote: > > I'm sure some way of declaring variables 'local' could be done in the > > class defintion, but I doubt Guido would do that now. > > It wouldn't be too hard to write a preprocessor that would do this > for you. You might put tags in your code such as > #Locals: foo bar xyzzy > and > #Endlocals [cut] > The choice to use the word 'self' is not imposed by Python, it's just > a convention for readability. You can use 's' instead if you wish. [cut] Thanks for both ideas and pointers. Writing a preprocessor is out of the question for me. I doubt I'm that good or even have the time. I like the second suggestion. Thanks, again. From bboard at parc.xerox.com Tue Apr 18 19:43:08 2000 From: bboard at parc.xerox.com (Mail Archiving Daemon) Date: Tue, 18 Apr 2000 16:43:08 PDT Subject: does Python actually handle SIGTERM and call sys.exitfunc? Message-ID: <00Apr18.164300pdt."3438"@watson.parc.xerox.com> I'm looking at the documentation for the signal module in the 1.5.2 Library document, which says: Python installs a small number of signal handlers by default: `SIGPIPE' is ignored (so write errors on pipes and sockets can be reported as ordinary Python exceptions), `SIGINT' is translated into a `KeyboardInterrupt' exception, and `SIGTERM' is caught so that necessary cleanup (especially `sys.exitfunc') can be performed before actually terminating. All of these can be overridden. I can find no evidence that SIGTERM is ever caught anywhere in the interpreter. Can someone point me to the place where this is done? Also, when I try the following small program: import sys, time, signal def writeit (msg): sys.stdout.write("exiting (" + msg + ")...\n") sys.stdout.flush() sys.exitfunc = lambda x="foo": writeit(x) time.sleep(60) running it thusly: /tmp 359 % python test.py & [2] 11067 /tmp 360 % kill 11067 /tmp 361 % [2] Terminated python test.py /tmp 361 % I see no output saying "exiting (foo)...". This might be a documentation bug. Bill From dgreen at kryten.kitenet.net Wed Apr 5 13:51:04 2000 From: dgreen at kryten.kitenet.net (Dan Green) Date: Wed, 05 Apr 2000 17:51:04 GMT Subject: ASP web-type stuff References: <8cfea6$71$1@gxsn.com> Message-ID: Ah. I suppose I should have made myself more clear. What I meant was that I was interested in writing a CGI/FastCGI type script so that the same code could be used under Apache/Netscape Enterprise/insert your favorite unix web server here. I already have a prototype working under Apache with a CGI redirect. I'd like to write interfaces to httpdapy and PyApache as well. In article <8cfea6$71$1 at gxsn.com>, Richard Chamberlain wrote: >Hi Dan, > >ASP is not language dependent, most of the stuff you'll see is written in >VBScript or JScript but you can actually configure it to use other >languages. > >See http://starship.python.net/crew/pirx/asp/py_asp.html to show you how to >use Python with ASP. > >Richard > >"Dan Green" wrote in message >news:RZyG4.3061$9o.5812531 at news.magma.ca... >> Ahoy, folks. >> I was looking over things like Embperl and Apache::ASP and liked the >> idea. I would like the idea more if I could do with python. So I had a >> couple of questions: >> >> Is there such a thing? >> Is there interest in such a thing? >> Does anbody want to hear about my 75 lines of code hack that basically >does >> the trick, but needs a lot of work? >> >> If nobody cares at all, I'll just shut up and go home. :) >> >> For those of you who have no idea what I'm talking about, it's basically >an >> alternative to CGI that allows you to embed the code right into the HTML. >> >> something like this: >> >> >> >> <% for i in range(5): %> >> Loop item <%= i %>
>> >> >> >> would look like this when called from a browser: >> >> >> >> Loop item 1
>> Loop item 2
>> Loop item 3
>> Loop item 4
>> Loop item 5
>> >> >> >> Let me know. If you're interested, please e-mail me. >> >> -- >> Dan Green | "So What? It's your problem to learn to live with, >> Developer | destroy us, or make us saints." >> Rewind Technologies | -- Ministry, "So What?" > > -- Dan Green | "So What? It's your problem to learn to live with, Developer | destroy us, or make us saints." Rewind Technologies | -- Ministry, "So What?" From python-list at teleo.net Mon Apr 10 14:59:56 2000 From: python-list at teleo.net (Patrick Phalen) Date: Mon, 10 Apr 2000 11:59:56 -0700 Subject: Problem running Python script as cron job In-Reply-To: References: <0004071555090M.01234@quadra.teleo.net> Message-ID: <0004101202210J.00831@quadra.teleo.net> [William R. Dickson, on Mon, 10 Apr 2000] :: In article <0004071555090M.01234 at quadra.teleo.net>, Patrick Phalen :: wrote: :: :: > [William R. Dickson, on Fri, 07 Apr 2000] :: > :: Anybody know of any issues with running python scripts from Cron? :: > :: > No. I've had multiple Python scripts running every one, two, five and :: > ten minutes around the clock for years on multiple servers without :: > problems. :: > :: > I'd suspect you might have a bug lurking. :: :: I think so too, but I can't find it, because the script runs flawlessly :: every time I run it by hand, and the buffer never flushes the output to :: the log when it's run by Cron. Are you "running by hand" as the same user as your script? Maybe you have a permissions problem, assuming the script needs to write to a file or whatever. From fredrik at pythonware.com Thu Apr 27 05:44:16 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 27 Apr 2000 11:44:16 +0200 Subject: xmlrpclib problem References: <8e8591$2ro$0@216.39.162.232> Message-ID: <00c801bfb02e$091d69d0$0500a8c0@secret.pythonware.com> Michael Esveldt wrote: > I'm working with xmlrpclib to talk to Userland's Manila application and > I'm having a problems sending html via xmlrpc. Here's the code I'm > working with > > mysite = xmlrpclib.Server("http://mysite.editthispage.com") > mysite.manila.message.set(username, password, sitename, msgNum, "my > subject", "body containing html", "text/x-outline-tabbed", {}, > {"name":"pikeRenderer", "flRenderOnEntry":"true"}) > > I've tried changing "text/x-outline-tabbed" to "text/plain" and > "text/html", none of these have any effect. What's happening is that my > "body containing html" is coming out on the other side with < and > > instead of actual tags. Obviously this results in displaying html > instead of rendering it. > > Is this a problem with xmlrpclib, how I'm using it, or with the server > decoding my xmlrpc messages? it's a bug in Manila: http://discuss.userland.com/msgReader$16672 here's a workaround for xmlrpclib.py: http://zopefish.weblogs.com/discuss/msgReader$19 From mhammond at skippinet.com.au Sat Apr 22 10:02:21 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 22 Apr 2000 14:02:21 GMT Subject: code not true? References: <8ds3ku$q0l$1@nnrp1.deja.com> <3901aa0f.0@news.proweb.co.uk> Message-ID: "Grant Edwards" wrote in message news:M3iM4.518$wJ1.17829 at ptah.visi.com... > This seems to be something that we were all told as freshmen > but stumble over later anyway. One wonders if a safe language > intended for use by beginners should even have an equality > operator for floating point objects. Of all the solutions to this problem, this does strike me as one of the best - simply remove equality testing al together for floating point: >>> 1.0==1.0 Traceback (whatever it says today) File in ? Floating points numbers cant be compared. In fact, life would be better if you could pretend they didnt even exist. Dont even ask. You were warned. Mark. From effbot at telia.com Mon Apr 24 03:51:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 24 Apr 2000 07:51:39 GMT Subject: regulare expression searches and newlines References: <8e0oco$k75$1@nnrp1.deja.com> Message-ID: schmitthead at my-deja.com wrote: > I was doing a search like this: > > searchobj = re.compile( r'^foobarbaz' ) > > where I was looking for something at the beginning of a line. This > works well for native text files, but not when I was searching through > Linux files running on NT or NT files on Linux or some other variation > because of the newline difference, I guess. Is there any way to handle > the general case? there's nothing wrong with your regular expression. I suggest printing the strings you're trying to match against, to see if you can figure out what's wrong. if that doesn't help, post the code. From claird at starbase.neosoft.com Tue Apr 4 15:37:39 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 4 Apr 2000 14:37:39 -0500 Subject: What is python's language level? References: <38EA1B8F.A797A130@lmco.com> Message-ID: In article , Warren Postma wrote: . . . >2. What's a function point? Who decides what a "function point" is, and >says that it applies across all the various kinds of people who write >software as part of their professional duties? How many lines of COBOL does . . . The International Function Point Users Group is made up of the kinds of people who decide what a function point is. They take it quite seriously. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From m69ph83q at students.su.se Sun Apr 2 09:48:32 2000 From: m69ph83q at students.su.se (Per Hogberg) Date: 2 Apr 2000 13:48:32 GMT Subject: Some bugs in Pythonwin b.128 References: <_NaE4.6119$V56.24967@news-server.bigpond.net.au> Message-ID: <8F0AAC6BEm69ph83qstudentssuse@127.0.0.1> mhammond at skippinet.com.au (Mark Hammond) wrote in <_NaE4.6119$V56.24967 at news-server.bigpond.net.au>: >"Michal Bozon" wrote in message >news:Pine.OSF.4.10.10003281852310.6437-100000 at prfdec.natur.cuni.c >z... >> known from IDLE 0.5, I mean when I write a function name and >> the beginning bracket, it appears a tip "window" with list of >>arguments >> of function and the docstring. > >This works for every one else :-) Actually, if you're one of those cursed few with a non-US/Brit./Australian keyboard you may have to tinker a bit. The events for parenthesis in the config file are wired to the Shift-9 & 0 keys. My keyboard uses Shift-8 & 9. Try changing these settings in your config file: Shift-9 = <> Shift-0 = <> BTW, I never managed to put my changes in a separate file and use fallback to the default file. Not even idle.cfg in the distribution worked this way. I ended up copying the whole default.cfg file. I didn't try hard so this just might work for everyone else :-) Per. From m.faassen at vet.uu.nl Fri Apr 14 15:27:33 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 14 Apr 2000 19:27:33 GMT Subject: Complaint Dept: My shoes! References: Message-ID: <8d7rf5$odi$1@newshost.accu.uu.nl> Moshe Zadka wrote: > On Thu, 13 Apr 2000 musingattheruins at my-deja.com wrote: >> If shoe is None then len(shoe) raises an exception. Would be nice if >> len(None) was 0 and NOT raise an exeption. > Huh? Why not have len(None) 4? Or -1? > If you want an empty string, use an empty string. The good thing > about None is that it supports so few operations, functions not expecting > it would break right away, instead of having a hidden bugs. I agree completely. You DON'T want len(None) to not raise an exception. It's good that it does. I agree with all posters. Don't do it. Don't. ... And now I'm going to tell you how to make len(None) return 0. This is an implementation detail. It's a *bug* that ought to be fixed. Put this in the module where you want len(None) to be 0: None = "" Now it works as you want. But you *don't* want to want this. If you go down on this path, the Python Secret Underground will come and destroy you. Perhaps retroactively wipe you out. The only good thing that may come out of this is Guido going back in his time machine to fix this. Just don't do it. This-is-not-what-G*d*-indented!-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From effbot at telia.com Tue Apr 18 12:45:20 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 18 Apr 2000 16:45:20 GMT Subject: Lists References: Message-ID: Daley, MarkX wrote: > This feels like a real newbie question, but here is the code that is causing > my question: > > # Learning exceptions > > def test(): > a = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] > print a > b = 5 > for item in a: > try: > print b / a[item] > except ZeroDivisionError: > pass > > Here is the output of this code under IDLE: > > [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] > 5 > 2 > 1 > 1 > 1 > -1 > -2 > -2 > -3 > -5 > > Why is the list being processed in reverse? The exception works fine, but > the math is backwards. I don't recall this happening before. note that you divide by a[item], not by item. try printing item and a[item] in the loop and see if you can figure out what's going on... (where did you find this script, btw? "100 obfuscated python scripts for beginners?" ;-) From donb at init.com Tue Apr 18 09:45:51 2000 From: donb at init.com (Donald Beaudry) Date: Tue, 18 Apr 2000 09:45:51 -0400 Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> <200004172120.RAA11102@zippy.init.com> Message-ID: <200004181345.JAA24254@zippy.init.com> "Jeff Massung" wrote, > > Donald Beaudry wrote in message <200004172120.RAA11102 at zippy.init.com>... > >and this one is better still (at least on my machine): > > > > def do_it(): > > from random import randint > > r = [0,] * 100000 > > for i in xrange(100000): > > r[i] = randint(1,10) > > do_it() > > > > With the "from/import" being local, does the namespace go away after the > function is done? No, only the local binding to it goes away. > How fast is importing (say I called do_it() 10000 times - then how > efficient is your function?) A from/import, or just an import for that matter, can be slow the first time but very fast every time thereafter. Modules (under normal circumstances) only get loaded once and that's what takes the time. Regardless, if I knew I was going to be calling do_it() many times in a performance critical application I would not put the import inside the function. In that case, I would write: import random def do_it(randint = random.randint): r = [0,] * 100000 for i in xrange(100000): r[i] = randint(1,10) In my original example I put the from/import inside the function because I felt that it was a less obscure way to get randint into the function's local name space (and I knew it would only get called once). Getting randint into the local name space is a big win for two reasons. First, the dictionary look-up in the random name space is eliminated. Second, variable references inside functions are optimised to array references thus they are not dictionary look-ups as they are when outside a function. -- Donald Beaudry Ab Initio Software Corp. 201 Spring Street donb at init.com Lexington, MA 02421 ...So much code, so little time... From python-list at teleo.net Mon Apr 3 02:30:12 2000 From: python-list at teleo.net (Patrick Phalen) Date: Sun, 2 Apr 2000 23:30:12 -0700 Subject: embeddable Python web server In-Reply-To: References: Message-ID: <00040223335404.04535@quadra.teleo.net> [Brian Schmidt, on Sun, 02 Apr 2000] :: Does anyone know of a webserver written in Python that is embeddable into a :: Python application, something similar to tclhttpd available for Tcl? There's SimpleHTTPServer.py (in the distribution) and also (free for non-commercial use) Medusa, available from http://www.nightmare.com. From bingdo19 at earthlink.net Tue Apr 25 12:06:54 2000 From: bingdo19 at earthlink.net (Bob Langdon) Date: Tue, 25 Apr 2000 16:06:54 GMT Subject: €€Newbie Needs Help -- Name and Key errors Message-ID: Hi, New to Python, and moving a site for a client. The backend sas developed by another developer in Python. I've i9nstalled Python1.5.2 in my home direcpory and tested it. The interpreter seems to functioning properly. However, some paths seem to be defined incorrectly. When running a script "getresume.py" for example, >>try: import sys sys.stderr = sys.stdout sys.path.insert(0,'.') sys.path.append('/usr/local/lib/python1.5') sys.path.append('/usr/local/lib/python1.5/site-packages') import os TEMPLATES=os.environ['DOCUMENT_ROOT'] from calendar import month_name from types import * from formhandler import FormHandler from string import strip, split, join, atol, atof, upper, lower, capitalize from refer import getReferer, addGetResume from time import asctime, localtime, time, strftime from urllib import quote_plus, unquote_plus from fcsetup import LOCALHOSTNAME from fcsetup import * import Mail except: print '
\n'
   import traceback
   traceback.print_exc()
   print sys.path

resumeDIR = DEPOT

      
class GetResumeHandler(FormHandler):
yada yafda yada...<<


I get the following errors:


Traceback (innermost last):
  File "./getresume.py", line 10, in ?
    TEMPLATES=os.environ['DOCUMENT_ROOT']
  File "/home/fcinc/python/Python-1.5.2/lib/python1.5/UserDict.py", line 
14, in __getitem__
    def __getitem__(self, key): return self.data[key]
KeyError: DOCUMENT_ROOT
['.', '.', '/home/fcinc/python/Python-1.5.2/lib/python1.5/', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/plat-linux2', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/lib-tk', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/lib-dynload', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/Gadfly', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/HTMLgen', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/MySQL', 
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/kwParsing', 
'/home/fcinc/python/Python-1.5.2', 
'/home/fcinc/python/Python-1.5.2/lib/Python1.5/site-packages']
Traceback (innermost last):
  File "./getresume.py", line 28, in ?
    resumeDIR = DEPOT
NameError: DEPOT

I think DEPOT might be a reference to the MySQL database, using the 
Berkley dbmodule (which I can't find). I certainly can't find a 
directory named DEPOT anywhere on the old host's server.

Neither can I fathom where "DOCUMENT_ROOT" is defined, or find a file 
called "os.environ."

Please help!

TIA,


From chafik at nevrax.com  Thu Apr  6 04:00:14 2000
From: chafik at nevrax.com (Sameh chafik pro)
Date: Thu, 6 Apr 2000 10:00:14 +0200
Subject: looking for LL(1), LR(1), or LALR(1) syntaxic analysis in python.
Message-ID: <00bc01bf9f9e$240c53a0$1001a8c0@nevrax.net>

Hello evry body,
At present i develop an open source in agent IA, i write for you because i'm looking for any LL(1), LR(1), or LALR(1) syntaxic analysis in python implementation.
thanks for your answer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From kern at caltech.edu  Sun Apr 23 05:57:10 2000
From: kern at caltech.edu (Robert Kern)
Date: 23 Apr 2000 09:57:10 GMT
Subject: [Ann] PyFT 0.65 -- Python Bindings for FreeType
Message-ID: <8duhdm$ipr@gap.cco.caltech.edu>

I have released a new version of the Python wrappers of FreeType, the
TrueType rendering engine.

New in this version (besides bugfixes) is PyFT.py, a high(er)-level
interface for rendering text.

While I wait for my Starship account to be restored, the files are located
on my own computer.  Beware, though: I try to keep my computer up 24-7, but
sometimes it does come down.  It is not a dedicated server, either.

http://taliesen.caltech.edu:9673
http://taliesen.caltech.edu:9673/PyFT-0.65.tar.gz

-- 
Robert Kern
kern at caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter


From remove.me.wwicker at spectratechnologies.com  Wed Apr 26 14:34:15 2000
From: remove.me.wwicker at spectratechnologies.com (William Wicker)
Date: Wed, 26 Apr 2000 18:34:15 GMT
Subject: Python COM troubles
Message-ID: <390a2f04.149999918@news.onlineisp.com>

I'm trying to use Python with SolidWorks, a really cool CAD package.
SolidWorks has a COM interface which plays reasonably well with
Python.

Unfortunately, the interface does not seem to provide run-time type
info. This appears to confuse the gen_py interface, which means that
all of my dispatch objects are dynamic. (bummer)
In turn, this looks like it means that I cannot use
DispatchWithEvents, as it seems to rely on the gen_py library being
recognizable.

Is there a way around this appearance of typelessness? There is a type
library, and I've run make-py successfully. I just can't see an easy
way into it.

It should by now be evident that I know little about Python, and less
about COM. Enlightenment welcome.

And now for something completely different:
COM dispatch methods that are documented to return SAFEARRAYS of
dispatch pointers fail with pythonwin v125 and 128 (the only ones I've
felt safe enough to try). The traceback is something like this:
>>> import win32com.client
>>> swx = win32com.client.Dispatch("SldWorks.Application")
>>> adoc = swx.ActiveDoc	#get the active model
>>> sel = adoc.SelectionManager #get the current list of selected objects
>>> sel.GetSelectedObjectCount #how many are there?
1
>>> face = sel.GetSelectedObject3(1) #I already know that I selected a face, so lets get it.
>>> face
>
>>> edges = face.GetEdges() #should return a tuple full of dispatch pointers to edge objects...
Traceback (innermost last):
  File "", line 1, in ?
  File "C:\tools\Python\win32com\client\dynamic.py", line 393, in
__getattr__
    ret =
self._oleobj_.Invoke(retEntry.dispid,0,pythoncom.DISPATCH_PROPERTYGET,1)
SystemError: NULL result without error in call_object
>>> 

Suggestions?

	William.


From wrd at awenet.com  Mon Apr 10 16:24:12 2000
From: wrd at awenet.com (William R. Dickson)
Date: Mon, 10 Apr 2000 13:24:12 -0700
Subject: Problem running Python script as cron job
References:  <38EE41F4.8050708@gmx.net>  
Message-ID: 

In article , Michael Hudson 
 wrote:

> > > Try stderr?
> > > /path/prog > /path/log 2>&1
> > > 
> > > Maybe it spits some errors?
> > 
> > Tried that, but I still wind up with an empty log.  Anyway to force it 
> > to write immediately rather than buffering?
> 
> [mwh21 at atrus mwh21]$ python --bleargh
> Unknown option: --
> usage: python [option] ... [-c cmd | file | -] [arg] ...
> Options and arguments (and corresponding environment variables):
> -d     : debug output from parser (also PYTHONDEBUG=x)
> -i     : inspect interactively after running script, (also 
> PYTHONINSPECT=x)
>          and force prompts, even if stdin does not appear to be a 
>          terminal
> -O     : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)
> -OO    : remove doc-strings in addition to the -O optimizations
> -S     : don't imply 'import site' on initialization
> -t     : issue warnings about inconsistent tab usage (-tt: issue errors)
> -u     : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
> -v     : verbose (trace import statements) (also PYTHONVERBOSE=x)
> -x     : skip first line of source, allowing use of non-Unix forms of 
> #!cmd
> -X     : disable class based built-in exceptions
> -c cmd : program passed in as string (terminates option list)
> file   : program read from script file
> -      : program read from stdin (default; interactive mode if a tty)
> arg ...: arguments passed to program in sys.argv[1:]
> Other environment variables:
> PYTHONSTARTUP: file executed on interactive startup (no default)
> PYTHONPATH   : ':'-separated list of directories prefixed to the
>                default module search path.  The result is sys.path.
> PYTHONHOME   : alternate  directory (or :).
>                The default module search path uses /python1.5.
> 
> so that'll be `python -u' then ...
> 
> Cheers,
> M.

Heh...dowh.  If you're ever in Seattle, I owe you a beer :).

-Bill


From aahz at netcom.com  Tue Apr  4 16:11:54 2000
From: aahz at netcom.com (Aahz Maruch)
Date: 4 Apr 2000 20:11:54 GMT
Subject: Debugging Python 1.3 -> 1.5.2 (was Re: Python 1.6 alpha 1 released)
References:  <8cca93$9oh$1@nnrp1.deja.com>  
Message-ID: <8cdiaa$44i$1@slb7.atl.mindspring.net>

In article ,
Fredrik Lundh  wrote:
>
>   [....]
>I suggest you dig up my list of "change cost" criterias, and apply
>them to all non-compatible changes (possibly starting with 1.5.2's
>class object change, which broke *lots* of code in really naughty
>ways [1]).  I've done that, and I still think that "connect" is the
>*least* critical of all code-breaking changes in the python core,
>since 1.3 or so.
>
>   [....]
>1) stumbled upon one today: it turned out that by changing from 1.3
>to 1.5.2, large data transfers from a high-performance server to clients
>on an 10 Mbit Ethernet were unexpectedly terminated.  the same trans-
>fers worked just fine with high-performance workstations, on an FDDI
>network.  ten guru points to anyone who can explain why.

Not without a bit more info about the data transfer mechanism and the
error reported by client & server.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."


From mwh21 at cam.ac.uk  Sun Apr 16 15:59:23 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 16 Apr 2000 20:59:23 +0100
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>   <38F9F01B.57273052@tismer.com>  <38FA05FA.B0526CAB@tismer.com>
Message-ID: 

Christian Tismer  writes:

> > I cam across a great quote the other day; I think it was attributed to
> > Alan Perlis, and it was:
> > 
> >     Simplicity follows complexity, not the other way round.
> 
> Thank you a lot, it was exactly the quote I was trying
> to look up, but I didn't find it again. It is very true.

Actually from

    http://www.cs.yale.edu/~perlis-alan/quotes.html

we find:

31. Simplicity does not precede complexity, but follows it. 

so I got the wording slightly wrong.  The intent's clear though.

now-wait-while-I-add-most-of-those-to-my-sig-file-ly y'rs
Michael

-- 
  On the other hand,  the following areas are subject to boycott
  in reaction to the rampant impurity of design or execution, as
  determined after a period of study, in no particular order: 
    ...                            http://www.naggum.no/profile.html


From bparsia at email.unc.edu  Wed Apr  5 20:16:02 2000
From: bparsia at email.unc.edu (Bijan Parsia)
Date: Wed, 5 Apr 2000 20:16:02 -0400
Subject: Teaching the art of programming, in python
References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> 
Message-ID: <1e8mov8.1yh8ryv1kp6z0lN%bparsia@email.unc.edu>

Warren Postma  wrote:

[snip]
> You see, I have this idea of 'elegance' in my head which Python satisfies,
> but I haven't found a book that really captures that. I have read a few (4),
> and none really do justice to the Art side.
> 
> Remember the famous 'Smalltalk-80 - The Language and Implementation'
> purple-book?
[snip]

Pedantic correction: The Language and Implementation version is the
*blue* book. The Blue Book is no longer in print, although the *purple*
book: Smalltalk-80 The Language is still in print (and you can get the
implementation chapters on the web) and it still a wonderful, wonderful,
wonderful read. It is beautiful to look at, a pleasure to read, and
deeply instructive.

-- 
Bijan Parsia
http://monkeyfist.com/
...among many things.


From dennis_marti at yahoo.com  Sat Apr  1 01:06:02 2000
From: dennis_marti at yahoo.com (Dennis Marti)
Date: Sat, 01 Apr 2000 01:06:02 -0500
Subject: Qutting the interpreter
References: <38E42BC6.4591E2E7@simplyweb.net>
Message-ID: 

In article <38E42BC6.4591E2E7 at simplyweb.net>, Michael Ackerman 
 wrote:

>    I am trying to find a way of quitting the interpreter. On p.3 of the
> tutorial it says this can be done by 'import sys; sys.exit()', but this
> produces an error message when I try it. I used to be able to quit by
> 'raise SystemExit', but that no longer works either. So how is this done?

File -> Quit works, as does command-q.

control-d, "raise SystemExit", and "import sys; ..." work when the 
interpreter is running by itself, but not with the IDE.

>    I am using version 1.5.2c.1 of Python on a Mac.

me too. an iBook, in case Matheus is reading.

Dennis


From python at rose164.wuh.wustl.edu  Sat Apr  8 06:33:26 2000
From: python at rose164.wuh.wustl.edu (David Fisher)
Date: Sat, 8 Apr 2000 05:33:26 -0500
Subject: Refeing to substring in list of strings
References: 
Message-ID: <00c301bfa145$dff11f80$0201a8c0@spkydomain>

Referencing a substring works fine for me:

>>> ll = ['1234','asdf','qwer']
>>> for i in range(len(ll)):
    for j in range(len(ll[i]) - 1):
        print ll[i][j:j+2]


12
23
34
as
sd
df
qw
we
er
>>>

If you're trying to assign to the substring, like s[1:2] = 'e',  you can't,
strings are immutable.
dnf

----- Original Message -----
From: "Peter Kovalsky" 
Newsgroups: comp.lang.python
To: 
Sent: Saturday, April 08, 2000 4:15 AM
Subject: Refeing to substring in list of strings


> Hi,
>
> I am new to Python and experienced a little problem with referencing
> lately. I have a list of strings that I have to modify. Thereofre I chose
> a for-construct (for index in range(len(mylist)):). I found certain
> substrings that i want to extract - but don' t know how to adress these
> substrings. I tried a
> mylist[index][lborder:rborder]
> which won' r work for some reason - and I don' t know why. Can anybody
> help???





From tiddlerdeja at my-deja.com  Tue Apr 11 12:59:57 2000
From: tiddlerdeja at my-deja.com (tiddlerdeja at my-deja.com)
Date: Tue, 11 Apr 2000 16:59:57 GMT
Subject: Free Python magazine
References: <8bauug$9m7$0@216.39.159.17>
Message-ID: <8cvlm7$sa$1@nnrp1.deja.com>

I can't see this on the site. Could you give a bit more information?

Thanks.


In article <8bauug$9m7$0 at 216.39.159.17>,
  fyl at ssc.com wrote:
> With the May issue of Linux Journal we are including a 28-page
supplement on
> Python.  As a special deal for Python fans, we are making this
issue/supplement
> available for free.  The info is on our main web page at www.ssc.com.
>
> The only catch is that we ask a few questions as we want to see what
> your interests may be.  No other strings.
>
> If you are into Monty Python I think you will really enjoy the
supplement.
> The parody starts with the cover and continues throughout the
supplement.
> Besides the humor (which is in the form of graphics), you will see
> the following articles:
>   * Computer Porgramming for Everybody by Guido van Rossum
>   * Why Python? by Eric Raymond
>   * JPython by David Ascher
>   * Mailman by Barry A. Warsaw
>   * Book reviews on three new Python books
> Plus you get a whole (180 page) issue of Linux Journal.
>
> --
> Phil Hughes, SSC, Inc. P.O. Box 55549, Seattle, WA 98155  (206)PUBS-
REF
> >>> Publishers of pocket references for UNIX, C, ..., Linux Journal
<<<
>     E-mail: fyl at ssc.com  Phone: (206)782-7733 x104  Fax: (206)782-7191
> SSC/Linux Journal web site: http://www.ssc.com/
>


Sent via Deja.com http://www.deja.com/
Before you buy.


From samschul at pacbell.net  Sat Apr  1 12:41:38 2000
From: samschul at pacbell.net (Sam Schulenburg)
Date: Sat, 01 Apr 2000 17:41:38 GMT
Subject: Python1.6 alpha bugs
Message-ID: <8c5ccg$u96$1@nnrp1.deja.com>

I am posting this in the news group as I can not access python.org.

The following problems were seen while testing Python1.6a:

1) I had to recompile the source to python1.6a under windows to get the
python16.lib file to link with my extended c routines. The default lib
file with the distrubution would not link.

2) IDLE and python crashes when trying to close an edit window that has
been opened in IDLE.

3) The help menu in IDLE, F1 key shows the default stderr color to be
dark green instead of red.

Sam Schulenburg


Sent via Deja.com http://www.deja.com/
Before you buy.


From gmcm at hypernet.com  Thu Apr 27 09:23:52 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Thu, 27 Apr 2000 09:23:52 -0400
Subject: Namespace Problem with global declaration in module
In-Reply-To: <8e912d$cpi$1@nnrp1.deja.com>
Message-ID: <1255280660-66425116@hypernet.com>

spex66 at my-deja.com wrote:

> hmm, deja is not so fast as my newsreader :), so here is a reply
> of Gordons message
> 
> >spex66 at my-deja.com wrote:
> >
> >> Hi,
> >> it seemed very simple but don't worked like expected:
> >>
> >> #FILE: test.py
> >> dd = None #INIT a shadow instance for automated access
[snip]
> >>
> >> >>> from test import *
> >
> >There's your problem. "from test import *" copies names from
> >test to your namespace. Now dd is another name for None. yy()
> >affects the dd in test's namespace, not yours.
> >
> >- Gordon
> 
> I see the point, but I like the from statement :)

Tough :-). import * is mostly a shortcut for interactive work. Look at the 
top of Tkinter.py to see what a module needs to do to make import * 
safe.

> Is it a bug? 

No.

> It's not the way I expected this code to work... and
> I cannot find a hook in the documentation that explicit explained
> this misbehaviour.

It's there, in 6.11 of the Language Ref:

The from form does not bind the module name: it goes through the 
list of identifiers, looks each one of them up in the module found in 
step (1), and binds the name in the local namespace to the object 
thus found. If a name is not found, ImportError is raised. If the list 
of identifiers is replaced by a star ("*"), all names defined in the 
module are bound, except those beginning with an underscore ("_"). 

No, the implications of that statement are not immediately obvious.

> Any idea for a workaround (I need the from-statement for further
> code readability)?

No, you want it for type-ability. Come back to it in a few months and 
you'll wish you'd spelled out where all those names came from.

- Gordon



From eviltofu at rocketmail.com  Sun Apr  2 11:23:42 2000
From: eviltofu at rocketmail.com (Jerome Chan)
Date: Sun, 02 Apr 2000 15:23:42 GMT
Subject: Is www.python.org down?
Message-ID: 

Have not been able to connect to the web server although the machine 
responds to pings. Is it just me?


From daniels at mindspring.com  Thu Apr 20 23:05:52 2000
From: daniels at mindspring.com (Alan Daniels)
Date: 21 Apr 2000 03:05:52 GMT
Subject: editor for win32
References: 
Message-ID: 

On Thu, 20 Apr 2000 17:48:29 GMT, Scott Hathaway 
wrote:

>Can anyone recommend a python editor for Windows?

VIM, available at http://www.vim.org.

That is, if you enjoy the VI way of doing things. :-) Even if you
haven't tried it before, I highly recommend it: Once I learned it, I
realized I'm able to blaze through text now because I'm never reaching
for the mouse (or ctrl-key combinations <0.5 wink>). I made the switch
because VIM is available on every machine I've ever come in contact
with (Windows, Linux, Solaris, yada yada).

Haven't-looked-back-since-ly your's, Alan.

-- 
============================================================
Alan Daniels
daniels at mindspring.com


From mikael at isy.liu.se  Tue Apr  4 11:57:48 2000
From: mikael at isy.liu.se (Mikael Olofsson)
Date: Tue, 04 Apr 2000 17:57:48 +0200 (MET DST)
Subject: New Features in Python 1.6
In-Reply-To: 
Message-ID: 

On 02-Apr-00 Lloyd Zusman wrote:
 >  Well, I guess this isn't all that bad, because I can cut down on the
 >  download bandwidth by compressing all those Python modules.  I'll use
 >  the new compression algorithm I recently invented.  It's amazing!
 >  .. it compresses *anything* down to one bit.
 >  
 >  I'm still working on the de-compression algorithm, though ...

Ahh, the famous BlackHole alpha release...

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson 
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    04-Apr-00
Time:    17:57:18

This message was sent by XF-Mail.
-----------------------------------------------------------------------


From fredrik at pythonware.com  Wed Apr 26 10:27:53 2000
From: fredrik at pythonware.com (Fredrik Lundh)
Date: Wed, 26 Apr 2000 16:27:53 +0200
Subject: Python compiler ? (was Re: Python for drivers?)
References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> <3906f804@nntp.server.uni-frankfurt.de>
Message-ID: <015b01bfaf8b$9cd03930$0500a8c0@secret.pythonware.com>

mlauer at trollinger-fe.rz.uni-frankfurt.de wrote:
> Speaking if this... there was a guy in this newsgroup claiming
> that he could write a Python compiler if there would be enough
> interest. What has become of this (guy | project) ?

if you have $60,000 to spare:
http://home.t-online.de/home/aotto/compiler.html






From bjorn at roguewave.com  Tue Apr  4 16:32:31 2000
From: bjorn at roguewave.com (Bjorn Pettersen)
Date: Tue, 04 Apr 2000 14:32:31 -0600
Subject: Python 1.6 alpha 1 released
References:  <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <8cca93$9oh$1@nnrp1.deja.com>  

Fredrik Lundh wrote:
> 
> Bjorn Pettersen  wrote:
> > Your definition of broken seems very peculiar.  Correct me if I'm wrong,
> > but it seems to go something like:
> 
> I've explained all this to you already.  lousy newsfeed? :-)

you keep repeating yourself, but you're certainly not explaining... not
having a good stance to argue from?

> >   - you don't know if examples are binding documentation

I take it this is still an unknown?  It's a pretty easy question.  When
example code in the documentation works as advertised, should people be
able to rely on it?  You can repeat that examples have been broken in
the past as much as you want, that's not what I'm asking about.

> >   - pair in the description of connect _must_ mean tuple
> >     and _not_ a pair of arguments because ???
> 
> I've explained that in another post -- the library reference use
> a special syntax for optional arguments.  the description of the
> connect method doesn't use that syntax.  other method
> descriptions do (this includes descriptions on the same page).
> 
> besides, "pair" is used quite extensively in the library reference,
> usually with exactly the same meaning as here: a 2-tuple.  see,
> for example, the description of "socket.error", "accept", and
> "recvfrom".

Apparently it is only used extensively enough that a large segment of
the Python community still thought the example was perfectly valid.

> >     (I would have thought it would have said tuple if it meant
> >     tuple -- tuples being Python concept as opposed to pairs)
> 
> I've explained that in another post -- it tells you that the
> address format is (host, port) -- which is perfectly valid tuple
> syntax.

...in context it can also be viewed as a perfectly valid parenthentical
note telling the reader what each of the two arguments to connect are --
especially since the "host, port" part is in italics and the parens
aren't.

> but alright, let's change "pair" to "2-tuple" everywhere.  will
> fixing this make you accept the change?

That would be clear, but it wouldn't change the fact that this change
involves changing a documented API. (And please argue why the example is
not documentation instead of repeating "the example is wrong, it
conflicts with the documentation", a perfectly reasonable reading of the
documentation, both description and example, gives you a two-argument
connect.

> >   - the example in question is broken because, even though
> >     it works, and seems to follow the description from the
> >     previous page, ...
> 
> I've explained that in another post -- it worked because the
> connect implementation didn't handle its argument properly,
> not because it was designed that way.  it stopped working
> when Guido fixed the argument handling bug.

that is purely an implementation detail. Any reasonable reader would
assume it worked because the implementation followed the documented
interface.

> and yes, this is exactly the same reason why append, insert,
> etc. did work in 1.5.2, and why they don't work in 1.6.
> yet, you think there is a difference.

That's also an implementation detail, but it's not documented. _That_ is
what the difference is.

> >   - ... other examples have been broken in the past...
> 
> I've explained that in another post -- broken examples are
> obviously not formally binding.  You replied that broken
> examples should be fixed.  Of course it should.  So should
> all broken demo code and the broken examples, just like
> all code that uses "append" etc must be fixed.

I haven't heard anyone argue that non-working examples should be
binding, but you seem to argue that working examples shouldn't be
binding either.  It's a perfectly valid opinion, and it is a stance that
other official programming language documentation has taken, I just
don't think it would be a good idea for Python -- and besides you, I
haven't heard anyone else argue that it would be.

[...]
> > The good news is that Guido realized how much code this would break, and
> > will fix the code.
> 
> yeah, and he'll probably break it again in 1.7.

I'm sorry you hold Guido in such low regard.  Waffling back and forth is
not a Guido characteristic as far as I can tell.

> just like he'll break append and a few other things in 1.6,
> and just like he broke stuff in 1.5.  and in 1.4.  etc.
> 
> you can keep on arguing until the end of c.l.py, but there's
> nothing special about "connect".  except, maybe, that you
> *know* that you're affected by this change, and you think
> you're not affected by any of the others.
> 
> if so, that's not only a very egocentric view, it's also rather
> naive.

So, I have to read your posts but not vice versa?  (I guess I'm in good
company with my egocentric views...)

> (no, don't reply.  just read my other posts in this thread. or
> if you think I don't have a clue, don't.  I don't really care)

You're sure arguing hard for a person who doesn't care. (and regressing
to schoolyard argumenting tactics certainly indicates that this thread
has lost any usefulness it may have had... not that I'm not expecting
you to come back with a 'last word' though )

> 

-b



From pinard at iro.umontreal.ca  Thu Apr 20 14:07:39 2000
From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=)
Date: 20 Apr 2000 14:07:39 -0400
Subject: docstrings
In-Reply-To: Ben Wolfson's message of "Thu, 20 Apr 2000 16:05:38 GMT"
References: <00bufsonasp7bgkf86lfb6sv5np5v8mqlj@4ax.com>
Message-ID: 

Ben Wolfson  writes:

> is there a way to use %c and %s within a docstring, or to add strings
> together in a docstring, so that if some strings are used in all
> docstrings, but might be changed, I can simply change one or two
> variables?

You could merely write docstrings as formats, using %(VARIABLE)s notation.
Then, whenever you want to process it, just use __doc__ % locals(), or
more generally __doc__ % DICTIONARY, with a suitable DICTIONARY.

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard





From jcm at bigskytel.com  Tue Apr 25 00:35:42 2000
From: jcm at bigskytel.com (David Porter)
Date: Mon, 24 Apr 2000 22:35:42 -0600
Subject: The Simple Economics of Open Source
In-Reply-To: <24042000.3@sanctum.jae.ddns.org>; from jae@ilk.de on Mon, Apr 24, 2000 at 11:57:47PM +0200
References:  <3903316C.5D6F1611@tcac.net>  <390451C0.4B5D3196@tcac.net>  <24042000.3@sanctum.jae.ddns.org>
Message-ID: <20000424223542.B4648@bigskytel.com>

* Juergen A. Erhard :

> Fundamental question is: Are we just a complex arrangement of
> bio-chemical (and thus ultimately physical) processes... or is there
> more to being `human beings'?

Both. There is no "just" about complex arrangements of bio-chemical
processes, and who cares whether we are just physical... Of course there is
much more to being human beings, unless you are the greediest of
reductionists. 

> If we are just a collection of bio-chemical processes, it's simple to
> `simulate' or replicate us in machine form[1].

I disagree. Especially with the simple part. Ask someone in AI or cognitive
science whether they feel it is simple. We had better understand how those
processes work before we call them simple!

> If we are more... than it will not be possible.

But that's asking for magic and, that has to be explained too.

> - -- 

Is this type of discussion regular fare for c.l.py? 

  David

 



From gregm at iname.com  Thu Apr 20 10:47:52 2000
From: gregm at iname.com (Greg McFarlane)
Date: Fri, 21 Apr 2000 00:47:52 +1000
Subject: Lazy imports (was Re: module naming)
In-Reply-To: ; from Peter Funk on 18 Apr 2000 at 01:59:29PM
References:  
Message-ID: <20000421004752.05406@nms.otc.telstra.com.au>

On 18 Apr, Peter Funk wrote:
> You could try to adopt the lazy loader concept implemented in 
> the Pmw package.  ...


I think there is a bug in your code.  Several lines have the wrong
indentation.  The following:
>         for name in dict.keys():
>             self.__dict__[name] = {}
>             d = {}
>             execfile(os.path.join(self._path, _EXP_DEF), d)
>             for k,v in d.items():
>                 if dict.has_key(k):
>                     if type(v) == types.TupleType:
>                         for item in v:
>                             ## modpath = self._package + item
>                             modpath = item
>                             dict[k][item] = modpath
>                     elif type(v) == types.DictionaryType:
>                         for k1, v1 in v.items():
>                             ## modpath = '_'+self._package +'.'+ v1
>                             modpath = v1
>                             dict[k][k1] = modpath

should be:
>         for name in dict.keys():
>             self.__dict__[name] = {}
>         d = {}
>         execfile(os.path.join(self._path, _EXP_DEF), d)
>         for k,v in d.items():
>             if dict.has_key(k):
>                 if type(v) == types.TupleType:
>                     for item in v:
>                         ## modpath = self._package + item
>                         modpath = item
>                         dict[k][item] = modpath
>                 elif type(v) == types.DictionaryType:
>                     for k1, v1 in v.items():
>                         ## modpath = '_'+self._package +'.'+ v1
>                         modpath = v1
>                         dict[k][k1] = modpath

-- 
Greg McFarlane     INMS Telstra Australia     gregm at iname.com



From eviltofu at rocketmail.com  Fri Apr 21 17:27:41 2000
From: eviltofu at rocketmail.com (Jerome Chan)
Date: Fri, 21 Apr 2000 21:27:41 GMT
Subject: Overloading methods?
Message-ID: 

I have the following:

class mc:
    def __init__(self,a):
        self.a = a
    def dosomething(self,a):
        self.a = self.a + a

class yc(mc):
    def __init__(self,a,b):
        mc.__init__(self,a)
        self.b = b
    def dosomething(self,a,b):
        mc.dosomething(self,a)
        self.b = self.b + b

x = mc(1)
y = yc(1,2)

x.dosomething(1)
y.dosomething(1,2)

y = yc(1) <--- Got expected 3 but got 2 error
y.dosomething(1) <--- Got exptected 3 but got 2 error

Does this mean that method overloading is not allowed?

I tried the following workaround, by dispatching the call myself:

class mc:
    def __init__(self,a1):
        self.a = a1
    def dosomething(self,a1):
        self.a = self.a + a1

class yc(mc):
    def __init__(self,a1=None,b1=None):
        if a1:
            mc.__init__(self,a1)
        if b1:
            self.b = b1
    def dosomething(self,a1=None,b1=None):
        if a1:
            mc.dosomething(self,a1)
        if b1:
            self.b = self.b + b1

x = mc(1)
y = yc(1)

x.dosomething(1)
y.dosomething(b=1,a=2) <-- got attribute error: b

So it seems that if if you can't use b until it has been instantiated 
previously.

By the way, being able to call methods with keyword arguments in any 
order is one of the neatess things I like about python.


From ullrich at math.okstate.edu  Sun Apr  2 15:29:45 2000
From: ullrich at math.okstate.edu (David C. Ullrich)
Date: Sun, 02 Apr 2000 14:29:45 -0500
Subject: Function override?
References: <000101bf9b9b$312f8fe0$2f2d153f@tim> <38E64275.CF8F97DC@math.okstate.edu> 
Message-ID: <38E79FA8.4FB26C1@math.okstate.edu>

Bernhard Herzog wrote:

> "David C. Ullrich"  writes:
>
> >     Or I could if I hadn't just read the bit about how in 1.6 strings
> > have a split method, and if s1 and s2 are strings then
> >
> > s1.split(s2)
> >
> > either splits s1 using s2 as the delimiter or the other way around,
> > depending on which occurs more frequently in the other. I mean
> > surely it will happen that we want to split a bunch of strings
> > using 'delimiter' as a delimiter, and then it just happens that
> > the routine that does that gets passed 'lim' as an argument and
> > does the opposite of what we want?
>
> Oh, that's easy to work around. I'm sure we'll all get used to the
> following new idiom:
>
> (text + delim).split(delim)[:-1]

    What puzzles me about _this_ is that it was posted on
April 2. (So I'm slow - they don't call me "DU" for nothing...)

DU




From remove.me.wwicker at spectratechnologies.com  Thu Apr 27 12:34:34 2000
From: remove.me.wwicker at spectratechnologies.com (William Wicker)
Date: Thu, 27 Apr 2000 16:34:34 GMT
Subject: Python COM troubles
References: <390a2f04.149999918@news.onlineisp.com> 
Message-ID: <390864e0.229263112@news.onlineisp.com>

On Thu, 27 Apr 2000 00:46:35 GMT, "Mark Hammond"
 wrote:

>"William Wicker"  wrote in
>message news:390a2f04.149999918 at news.onlineisp.com...
>
>> Is there a way around this appearance of typelessness? There is a type
>> library, and I've run make-py successfully. I just can't see an easy
>> way into it.
>
>You can try running "makepy.py -i", and select your type library.  This
>will spit out some code, something like:
>
>gencache.EnsureModule(...)
>
>change this to:
>
>mod = gencache.EnsureModule(...)
>
>And you should be able to create any of the class objects in the makepy
>module - eg:
>
>ob = mod.TheClassName()
>

This works great!

There is one hitch (maybe). At some point, as I dive deeper into the
object structure (SolidWorks -> Document -> Selection ->
SelectedObject), I get a handle to an object which exists only to
super-class others. Can I pull some trick to force an unknown COM
object to use a specific class interface?

>If you search deja news, there should be lots of info about this - but
>generally relating to "Lotus Notes", which also has the same problem.
>
>[BTW - drop them a line, and tell them they should fix their objects :-]
>
>> COM dispatch methods that are documented to return SAFEARRAYS of
>> dispatch pointers fail with pythonwin v125 and 128 (the only ones I've
>> felt safe enough to try). The traceback is something like this:
>
>> SystemError: NULL result without error in call_object
>> >>>
>
>From a CVS checkin message on 11th of Feb:
>Can you believe that we have never been able to recieve arrays of
>IDispatch or IUnknown objects?!?!?
>
>If you tried, you would have got "SystemError: NULL result without error
>in call_object"
>
>:-)  This was fixed in 129.  But 129 hasnt made it public yet - I will do
>this as soon as I can log back in to starship!
>
>Mark.

Wonderful! I'm looking forward to it.


From amitp at Xenon.Stanford.EDU  Thu Apr 13 21:59:35 2000
From: amitp at Xenon.Stanford.EDU (Amit Patel)
Date: 14 Apr 2000 01:59:35 GMT
Subject: readline skips on line
References: <8culp8$23a$1@porthos.nl.uu.net>
Message-ID: <8d5u27$fsu$1@nntp.Stanford.EDU>

 Soundwave  wrote:
| I got a part of a programm looking like this
| 
| f=open('test.txt', 'r')
| while f.readline()!='':
|     print f.readline()
| print 'ready'
| 

You're calling readline() twice.  The first line is checked to see if
it is != '', and the second line is printed.  The third line is
checked to see if it is != '', and the fourth line is printed.  And so
on.  Try this:

f = open('test.txt', 'r')
while 1:
    line = f.readline()
    if line == '': break
    print line
print 'ready'


      - Amit

--
Amit J Patel, Computer Science Department, Stanford University
http://www-cs-students.stanford.edu/~amitp/




From tim_one at email.msn.com  Wed Apr 19 00:56:04 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Wed, 19 Apr 2000 00:56:04 -0400
Subject: IDLE lability
In-Reply-To: 
Message-ID: <000401bfa9bb$90ed1be0$d42d153f@tim>

[Michal Bozon]
> I use IDLE as an Python IDE ...
> Win98 ...
> ...
> Now, after Python 1.6 release I tried New IDLE 0.6 and it seems to be even
> more unstable (it falls always after closing a window). Again the error
> was in tk module, I thing tk83.dll or so.

You didn't say which version of 1.6.  If 1.6a1, many people had this problem
on Windows flavors.  1.6a2 backed off to an earlier release of Tcl/Tk, and
that fixed the "death on window closing" problem for many.

more-info-for-more-info-ly y'rs  - tim





From thomas at xs4all.net  Wed Apr 19 15:15:40 2000
From: thomas at xs4all.net (Thomas Wouters)
Date: Wed, 19 Apr 2000 21:15:40 +0200
Subject: Python in the future
In-Reply-To: <38FDB8A7.E701F81F@sec.noaa.gov>; from jvickroy@sec.noaa.gov on Wed, Apr 19, 2000 at 07:46:15AM -0600
References: <38FDB8A7.E701F81F@sec.noaa.gov>
Message-ID: <20000419211540.P15664@xs4all.nl>

On Wed, Apr 19, 2000 at 07:46:15AM -0600, j vickroy wrote:

> I'm relatively new to Python and am trying to gain support for it at my
> work place.  To that end, I'm giving a brief (overview) presentation.
> One of the items I have been asked to consider is where will Python be
> 5-10 years from now.  I certainly don't know where C++ or Java will be
> in that time frame!  Any ideas on where to research the future plans for
> Python would be appreciated.

Well, if you want to see glimpes of Pythons' future, what better way than
Guido's very own timemachine ? Guido is being the true visionary, saying
more about the *direction* in which Python is going (or he wishes it to go,
which ammounts much to the same thing, currently) than the lowlevel,
technical, unimportant bits. And Guido is working on CP4E, Computer
Programming For Everyone -- making programming easy, for everyone, even
those with no affinity for computers what so ever. Python is a good step in
that direction, and hopefully other tools will follow. Other languages,
because diversity is good, but also good developement tools, interfaces, new
toys to play with, new areas for Python to concur.

Ten years, even five years, is a long way for computers. (For humans too,
seeing that five years ago i'd dropped out of school and was hauling pallets
of boxes at the local hospital, and today I could get any job I would wish
for.) We can say very little about how technology will look in ten years.
It'll still be recognizable, but the cutting edge of the techworld will
definately be new and exciting. And Python will definately be there, even if
only propelled by momentum. I, for one, would probably still port Python to
every OS I can get my hands on. Maybe I can even be the first for once, then
;)

For more information about CP4E, follow the 'essays' link on Guido's
homepage (http://www.python.org/~guido) or go directly to
http://www.python.org/doc/essays/. You can probably find some more
information in the edu-sig, and perhaps even some in other places by using a
normal search engine.

Gee-i-hope-i-understood-that-cp4e-thing-correct-ly y'rs

-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



From hudson_melville at my-deja.com  Mon Apr 17 20:35:39 2000
From: hudson_melville at my-deja.com (hudson_melville at my-deja.com)
Date: Tue, 18 Apr 2000 00:35:39 GMT
Subject: Beginner: string to long
Message-ID: <8dgakr$2i$1@nnrp1.deja.com>

I'm a very beginner, and I have a program with
nested loops that put numeric operators (+,-) in
a string of numbers ('3564752617') The outputs
are similar to '3564-752+617' How do I convert it
so it can evaluate into a long integer? Is there
a built-in that I don't know about that would do
this?


Sent via Deja.com http://www.deja.com/
Before you buy.


From fredrik at pythonware.com  Tue Apr  4 04:57:45 2000
From: fredrik at pythonware.com (fredrik at pythonware.com)
Date: Tue, 04 Apr 2000 08:57:45 GMT
Subject: Images (.bmp,.jpg,gif) in Tkinter windows (Tk newbie)
References: <38df6cfe.2185312@news.integrityonline.com> <8bo8gc$gic$1@nnrp1.deja.com> <38e8dd4f.15889708@news.integrityonline.com>
Message-ID: <8ccaq5$ab1$1@nnrp1.deja.com>

Tim Ottinger wrote:
> >   image = PhotoImage(file="myfile.gif")
> >   widget.config(image=image)
> >   widget.image = image # make sure to hang on to the image
>
> Well, that would be okay, except that it doesn't actually display the
> image on the screen (for me). Neither in '98 (boo) or 'NT (boo).

this definitely works, given a label or button widget.

maybe you should post your code, so we can figure out
what the problem really is.




Sent via Deja.com http://www.deja.com/
Before you buy.


From aa8vb at yahoo.com  Fri Apr  7 08:44:10 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Fri, 07 Apr 2000 08:44:10 -0400
Subject: Beginning to be disapointed
In-Reply-To: 
References: 
Message-ID: <20000407084410.A1757097@vislab.epa.gov>

Hugues Demers:
 |Can somebody help me on this? I'm using python to read big arrays (100x2000)
...
 |The cpu percentage used by python goes up and there is nothing else to be
 |done except to kill the interpreter. I have no idea what's going on. Do I
 |need to free memory in some way ? Am I doing something wrong ? 

This may not be it, but if you compiled Python with threading support,
try compiling it out.  Seems a big buggy.

On both FreeBSD and IRIX, when I hit Ctrl-C in the Python interpreter, I
get a hung Python that maxes out the CPU.

-- 
Randall Hopper
aa8vb at yahoo.com



From ivanlan at callware.com  Tue Apr  4 23:35:24 2000
From: ivanlan at callware.com (Ivan Van Laningham)
Date: Tue, 04 Apr 2000 21:35:24 -0600
Subject: What is python's language level?
References: <38EA1B8F.A797A130@lmco.com> <38E9DDD3.3313FF6@bioreason.com>   <38EA9CD4.3473B910@callware.com> 
Message-ID: <38EAB47C.F792326C@callware.com>

Hola, Listeros--

Roy Smith wrote:
> 
> Ivan Van Laningham  wrote:
> > Yes indeed.  Any n/troff source file could qualify.  Macro files, by
> > definition, transcend obfuscated.  I wonder what's next up that ladder?
> 
> Have you ever looked at the output of a bib | tbl | eqn pipeline?
> 

Yes!  I've *read* it.  Even worse, I've understood it.

-ly
y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
http://www.pauahtun.org and
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



From hniksic at iskon.hr  Thu Apr 13 03:59:31 2000
From: hniksic at iskon.hr (Hrvoje Niksic)
Date: 13 Apr 2000 09:59:31 +0200
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au> <38F4996F.E3BD2626@acm.org> <8d2p3q$2vj9o$1@fido.engr.sgi.com>  <8d2uji$301cu$1@fido.engr.sgi.com>
Message-ID: 

pj at sgi.com (Paul Jackson) writes:

> |> Nope, both lynx, and links, exist.
> 
> oh - could you offer a link to "links" -- it's a hard name to search
> for -- too many false hits.

Not so on freshmeat -- comes up first.


From dave at humancode.com  Mon Apr  3 19:05:11 2000
From: dave at humancode.com (Dave Barrett)
Date: Mon, 3 Apr 2000 18:05:11 -0500
Subject: embedding python question
Message-ID: <38e922ef$0$27307@wodc7nh7.news.uu.net>

Hola,

    Here is what I would like to do...

    Let's say I have N python scripts i would like to run.  I have a set
amount of time I would like them to run (eg.  500 milliisecs), splitting the
time between them. In other words, I would like each script to run for
approx N/time millisecs, then suspend itslef return to the C++ main
procedure to call the next one in order.  During the next timeslot I would
like to resume running the scripts where they stopped.  The timing does not
have to be exact, just close.  How would I go about doing this with the
embedded api ?  Is it possible ?  If not, are they any similiar things I can
try ?


Thanks,

Dave





From smalleys at gte.net  Wed Apr 12 22:53:57 2000
From: smalleys at gte.net (sue)
Date: Thu, 13 Apr 2000 02:53:57 GMT
Subject: Python and VTK and TK
References: <38F51AB1.29FB4C1D@earthlink.net>
Message-ID: <38F528C8.2C18364F@gte.net>

Scott -

Unfortunately, it depends on your definition of moderate.
Can you elaborate a bit?

You might want to start a dirty prototype in TK, to check
your overall design, and go to VTK/FLTK when time (speed or
due date :) becomes an issue.

You might want to check pyFLTK as well.  I've compiled all
three without any major problems, but if I remember
correctly, VTK ends up wanting several other small libs.

I think someone was working on a "generic GUI" file that
could map to any one of the three, trading off recoding for
a bit of a speed hit.

Sue.


From kdart at techie.com  Mon Apr  3 20:48:21 2000
From: kdart at techie.com (Keith Dart)
Date: Tue, 04 Apr 2000 00:48:21 +0000 (GMT)
Subject: info to spice up web pages with python
In-Reply-To: <008e01bf9b79$3b2f7fe0$0101a8c0@highwayi.com>
References: <008e01bf9b79$3b2f7fe0$0101a8c0@highwayi.com>
Message-ID: <20000404.482100@leviathan.kdart.com>


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 3/31/00, 5:25:56 PM, "Geoff Nordli"  wrote regarding 
info to spice up web pages with python:


> Hello All.

> I normally just use Python to script things, and help me with
> admin tasks.  I know very little about web page development.

> I have a young nephew.  He is really interested in web page
> development.  He wanted to learn JavaScript, but I convinced
> him to give Python a go.

Well, there is actually one good reason to use Javascript: it is run 
by the client (browser). This
allows small scripts to be embedded in web pages. This can be done 
because all modern browsers 
have embedded Javascript (also called Ecmascript) interpreters. To do 
the same thing with Python
would require a Python browser plug-in, and I'm not aware of any that 
exist. There is a Tcl plug-in,
however. 

On the other hand, if you want to do server-side scripting (e.g. CGI), 
then Python works just fine with
your Apache server. In fact, there is a mod_python (from PyApache 
package) available for Apache. This
makes server/CGI scripts run faster, but won't really be necessary for 
CGI experimenting.

HTH,
Keith Dart






From ralf.claus at teleatlas.com  Mon Apr 17 05:18:02 2000
From: ralf.claus at teleatlas.com (Ralf Claus)
Date: Mon, 17 Apr 2000 11:18:02 +0200
Subject: a progress bar in tkinter ?
Message-ID: <38FAD6CA.6198CF2A@teleatlas.com>

Hello,
i search about a "widget", that works like a ProgressBar in VB.
Is there a possibility given by Tkinter?

thanks

Ralf


From markus.oberhumer at jk.uni-linz.ac.at  Wed Apr 12 16:29:12 2000
From: markus.oberhumer at jk.uni-linz.ac.at (Markus F.X.J. Oberhumer)
Date: Wed, 12 Apr 2000 22:29:12 +0200
Subject: [ANNOUNCE] PySol 4.00 - a solitaire game collection
Message-ID: <20000412222912.A10580@laetitia.oberhumer.com>

-----BEGIN PGP SIGNED MESSAGE-----


                    PySol - a Solitaire Game Collection
                              Version 4.00

                          http://pysol.tsx.org

           Copyright (C) 1998, 1999, 2000 Markus F.X.J. Oberhumer
                   


What is PySol ?
===============

PySol is an exciting collection of 173 solitaire card games.

Among the supported games are classics like Aces Up, Baker's Game,
Canfield, FreeCell, Forty Thieves, Golf, Klondike, Monte Carlo,
Osmosis, Pyramid, Scorpion, Spider, Yukon, and many more...

PySol may be freely distributed under the terms of the GNU GPL.

PySol aims to be Commercial Quality Freeware.


Why yet another solitaire game ?
================================

Here are some highlights of PySol:

  - freely available
  - distributed under the GNU GPL with full source code
  - currently supports 173 (!) distinct solitaire variants
  - based upon an extensible solitaire engine
  - very nice look and feel including multiple cardsets
    and background table tiles
  - sound samples and background music
  - unlimited undo & redo
  - load & save games
  - player statistics and log files
  - hint system and demo games
  - support for user written plug-ins - add your own solitaire variants
  - integrated HTML help browser
  - lots of documentation
  - fully portable across Unix/X11, Windows 95/98/2000/NT and MacOS
  - written in 100% pure Python
  - just run it - no need to compile anything


Nice. And what's new ?
======================

  * PySol now supports Mahjongg games

  * PySol now plays Tarot type games

  * Added a floating "Demo" logo

  * Fixed a number of minor problems


Cool. Where can I get it ?
==========================

Point your browser to http://pysol.tsx.org
The PySol Gallery is awaiting your visit as well.


What do I need to start playing ?
=================================

PySol requires Python 1.5.2 and Tcl/Tk 8.0.5. Both packages are
freely available for Unix, Windows 95/98/NT and Macintosh.

BTW, there is no need to compile anything since the whole program is just
a Python script. Just run it, and that's all.

The Windows version ships as a completely self-contained setup file.


License terms
=============

PySol is Copyright (C) 1998, 1999, 2000 Markus Franz Xaver Johannes Oberhumer

PySol is distributed under the terms of the GNU General Public License (GPL).
See the file COPYING.


Have fun,
Markus

http://pysol.tsx.org



-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBOPTcWG10fyLu8beJAQH6wQP/SR6LJX2TqGaaRZ5kdiGvtxzX0HroPmke
kZRq3sb2NxZmwfhqLH/Bz4W0aP6pAhrA7VyRiM8kyLUSR8Mlu0CSD60bNzUxKAur
BxhCgw7iNcHkTBR3oQL1squBzqolQNDS+fuAmPNIszQY8u7KQ66/jOsXhzXjIfBT
dtXVi1jNCqE=
=Hi3/
-----END PGP SIGNATURE-----



From M_Pope at shef.rage.co.uk  Thu Apr 20 04:54:03 2000
From: M_Pope at shef.rage.co.uk (Mark Pope)
Date: Thu, 20 Apr 2000 09:54:03 +0100
Subject: dir(..)   vs.   PyList_GetItem
Message-ID: <213CDEBFDDA7D3118081009027E40C56071163@SHEF-MS1>

Rollocks.

Yes, I understand now. Thanks very much, you've saved me from yet more cloud
gazing...

mark.

> -----Original Message-----
> From: Greg Ewing [mailto:greg at cosc.canterbury.ac.nz]
> Sent: 20 April 2000 3:22 AM
> To: python-list at python.org
> Subject: Re: dir(..) vs. PyList_GetItem
> 
> 
> Mark Pope wrote:
> > 
> > The code I posted was just a snippet.
> > I have already successfully imported the module. I now need 
> to get a list of
> > the functions it exposes.
> 
> Are you *sure* you have imported the module properly?
> Because the result you posted looked an awful lot like
> you were looking at an empty module. Note that even if
> you imported the module previously, PyModule_New will
> *still* create a new module object. 
> 
> Can you post the code you actually ran?
> 
> If you've got the right module object, I can't imagine
> why looking at the keys of the module dict wouldn't
> work -- particularly since it works in Python, too:
> 
> >>> import string
> >>> dir(string)
> ['__builtins__', '__doc__', '__file__', '__name__', '_idmap', 
> '_idmapL',
> '_lower', '_re', '_safe_env', '_swapcase', '_upper', 'atof',
> 'atof_error', 'atoi', 'atoi_error', 'atol', 'atol_error', 
> 'capitalize',
> 'capwords', 'center', 'count', 'digits', 'expandtabs', 'find',
> 'hexdigits', 'index', 'index_error', 'join', 'joinfields', 'letters',
> 'ljust', 'lower', 'lowercase', 'lstrip', 'maketrans', 'octdigits',
> 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 
> 'splitfields',
> 'strip', 'swapcase', 'translate', 'upper', 'uppercase', 'whitespace',
> 'zfill']
> >>> string.__dict__.keys()
> ['_safe_env', '_idmap', '_swapcase', 'capitalize', 'atoi_error',
> 'octdigits', 'rfind', 'index', 'expandtabs', 'center', 
> 'join', 'lower',
> 'digits', 'atof', '__name__', 'hexdigits', 'atol', 'zfill', 'count',
> 'atoi', 'atof_error', '_re', 'swapcase', '__file__', '__builtins__',
> 'joinfields', 'lowercase', '__doc__', 'translate', 'rstrip', 'split',
> 'splitfields', '_lower', 'atol_error', 'rindex', 'whitespace',
> '_idmapL', '_upper', 'rjust', 'find', 'ljust', 'strip', 'index_error',
> 'capwords', 'replace', 'maketrans', 'uppercase', 'lstrip', 'letters',
> 'upper']
> >>>
> 
> The only difference seems to be that dir() sorts the
> list.
> 
> -- 
> Greg Ewing, Computer Science Dept,
> +--------------------------------------+
> University of Canterbury,	   | A citizen of 
> NewZealandCorp, a	  |
> Christchurch, New Zealand	   | wholly-owned subsidiary of 
> USA Inc.  |
> greg at cosc.canterbury.ac.nz	   
+--------------------------------------+
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 



From bingdo19 at earthlink.net  Thu Apr 20 11:26:10 2000
From: bingdo19 at earthlink.net (Bob Langdon)
Date: Thu, 20 Apr 2000 15:26:10 GMT
Subject: Test_time Fails? / Installing on Virtual DOmain
References: 
Message-ID: 

In article , 
Bob Langdon  wrote:

> Hi,
> 
> Upon installing Python in the home directory of a virtual domain (after 
> making the necessary configure file changes; i.e.: replacing all 
> instances of "/usr/" with: "/home/username/python/usr/")
> 
> "make test" results in 1 error:
> 
> >>1 test failed: test_time
> 19 tests skipped: test_al test_audioop test_bsddb test_cd test_cl 
> test_crypt test_dbm test_dl test_gdbm test_gl test_gzip test_imageop 
> test_imgfile test_nis test_rgbimg test_sunaudiodev test_thread 
> test_timing test_zlib<<
> 
> Running Lib/test/test_time.py results in:
> >>Lib/test/test_time.py: import: command not found
> Lib/test/test_time.py: time.altzone: command not found
> Lib/test/test_time.py: line 5: syntax error near unexpected token `t'
> Lib/test/test_time.py: line 5: `t = time.time()'<<
> 
> Is this something I've failed to install, or something missing from the 
> system?



Of course if I add the correct path test_time.pl

then I get the following error:


>>Traceback (innermost last):
  File "Lib/test/test_time.py", line 5, in ?
    time.altzone
AttributeError: altzone<<


From aahz at netcom.com  Tue Apr 11 16:22:54 2000
From: aahz at netcom.com (Aahz Maruch)
Date: 11 Apr 2000 20:22:54 GMT
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>   <87em8ccywq.fsf@deneb.cygnus.argh.org>
Message-ID: <8d01iu$ca0$1@slb2.atl.mindspring.net>

In article <87em8ccywq.fsf at deneb.cygnus.argh.org>,
Florian Weimer   wrote:
>
>Yes.  AFAIK, Python doesn't perform well in a SMP environment, because
>the interpreter only runs on one CPU at a given time, even if you
>create multiple Python threads.

That is true if you stick to pure Python code and extensions that don't
release the global interpreter lock.  For example, if you're using HTTP,
the socket library releases the global lock and threads are extremely
effective.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac,
and Ritalin?  --Aahz


From mlauer at trollinger-fe.rz.uni-frankfurt.de  Wed Apr 26 17:43:50 2000
From: mlauer at trollinger-fe.rz.uni-frankfurt.de (mlauer at trollinger-fe.rz.uni-frankfurt.de)
Date: 26 Apr 2000 23:43:50 +0200
Subject: Python compiler ? (was Re: Python for drivers?)
References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> <3906f804@nntp.server.uni-frankfurt.de> <015b01bfaf8b$9cd03930$0500a8c0@secret.pythonware.com>
Message-ID: <39076316@nntp.server.uni-frankfurt.de>

Fredrik Lundh (fredrik at pythonware.com) wrote:
> mlauer at trollinger-fe.rz.uni-frankfurt.de wrote:
> > Speaking if this... there was a guy in this newsgroup claiming
> > that he could write a Python compiler if there would be enough
> > interest. What has become of this (guy | project) ?

> if you have $60,000 to spare:
> http://home.t-online.de/home/aotto/compiler.html

Hmm... $60.000 - this is a funny guy... however,
do we have 60.000 python users ? If everyone was
to donate 1$... :))

--
--
    Regards & Gruesse from Mickey @ http://www.Vanille.de
  ---------------------------------------------------------
  How could anyone know me - when I don't even know myself ?




From a.eyre at optichrome.com  Tue Apr  4 07:31:07 2000
From: a.eyre at optichrome.com (Adrian Eyre)
Date: Tue, 4 Apr 2000 12:31:07 +0100
Subject: builtding library .pyd file format
In-Reply-To: <010f01bf9e0d$78af96c0$1001a8c0@nevrax.net>
Message-ID: <000b01bf9e29$4490a0c0$3acbd9c2@optichrome.com>

> Hello evry body,

Can you not post HTML in future, please?

> I want to know how to do to built a .pyd library file format form
> the windows .dll file format

Just rename the .dll to .pyd

No... really. It's *that* simple.




From donb at init.com  Wed Apr 26 08:01:01 2000
From: donb at init.com (Donald Beaudry)
Date: Wed, 26 Apr 2000 08:01:01 -0400
Subject: Metaclasses? 
References: <3905F4A0.2B39C705@darmstadt.gmd.de> 
Message-ID: <200004261201.IAA05678@zippy.init.com>

quinn at hedono.ugcs.caltech.edu (Quinn Dunkan) wrote,
> Anyway, even if you could figure out the ambiguity problem, I don't
> think metaclasses would help you, bytecodehacks might.

*If* bytecodehacks could help, metaclasses could be used to make
calling them neat and clean.  The idea is that during class
instantiation the metaclass would, using bytecodehacks, rewrite all of
the class's methods.  This might confuse the poor guy who comes along
and tries to derive a new class from one of these 'self less'.

--
Donald Beaudry                                     Ab Initio Software Corp.
                                                   201 Spring Street
donb at init.com                                      Lexington, MA 02421
                  ...So much code, so little time...




From peter at whetstonelogic.com  Mon Apr 17 19:06:25 2000
From: peter at whetstonelogic.com (Peter Halliday)
Date: Mon, 17 Apr 2000 19:06:25 -0400
Subject: Pointers
References: <38D00DCE.9740380F@be-research.ucsd.edu> <8bfsqo$kje$1@tribune.oar.net>   <4k5D4.7566$0o4.54442@iad-read.news.verio.net>
Message-ID: <38FB98F1.239EC0FB@whetstonelogic.com>

I just started learning python.  I just want to make sure that I understand the
object interaction you were discussion here.  To use your statement.  So x + 1
is an object, x is an object, and y is an object.  Y and x happen to both be
pointing to x + 1.  Is this right?  If you then did something to y would you be
doing something to x + 1?  I would say, no because it is a seperate object
right!  You can't have a dangling pointer like in C++ right?  Because of the
full functional objects.  If this is true, and I understand this right, then
Python rocks.


>
>         x = x + 1
>         y = x
>
>

Peter Halliday



From sabren at manifestation.com  Sun Apr 23 02:54:27 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Sun, 23 Apr 2000 02:54:27 -0400 (EDT)
Subject: code not true?
In-Reply-To: 
Message-ID: 

On Sun, 23 Apr 2000, Kragen Sitaker wrote:

> In base 3, one third is 0.1.  Two thirds is 0.2.

hey, I was right! :)

[snipped analogy of why 0.1 in base 3 is hard to write
in decimal]
 
> That said, it *is* just a speed issue --- there are representations
> other than floating point, like the ordered-pair rational-number
> representation, that give the right answer but are slower to work
> with.

But... Python is a scripting language.. It's okay to be slow.  From
what I'm hearing, many people on this list shy away from floats simply
because of the innacuracy.. Why don't we use the way that gets the
right answer?

Isn't unicode much slower to work with than regular strings? But
the benefit outweighs the cost.

Other than speed, is there a pro side to floats? Would switching
to altnerate representations break people's code?

I'm just wondering... :)

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------




From dalke at acm.org  Mon Apr 24 05:04:35 2000
From: dalke at acm.org (Andrew Dalke)
Date: Mon, 24 Apr 2000 03:04:35 -0600
Subject: Sorting a list of classes
References: 
Message-ID: <8e12gp$qpa$1@slb6.atl.mindspring.net>

lexberezhny wrote:
>If i have a python list of classes, can i do something like
classList.sort()
>and how can i control this behavior within the classes. ie
>i have a address book, and a have a class called 'Person', and it has an
>attribute Person.Name, so i have a list of 'Person's how can i sort the
>list, and maybe sort it by name? do i have to write my own function or can
i
>use list.sort() some how?


I wrote a mini-HOWTO on this subject.  It's at
http://python.org/doc/howto/sorting/sorting.html

If you will only ever sort on name, you can implement the __cmp__
method in your Person

class Person:
  ...
  def __cmp__(self, other):
    return cmp(self.Name, other.Name)

Most likely you will want to pass the comparison function to sort(),
as in

def byName(x, y):
   return cmp(x.Name, y.Name)

nameList.sort(byName)

There are more variations in that HOWTO.

                    Andrew
                    dalke at acm.org





From hamish_lawson at yahoo.co.uk  Fri Apr  7 20:04:46 2000
From: hamish_lawson at yahoo.co.uk (Hamish Lawson)
Date: Fri, 07 Apr 2000 17:04:46 -0700
Subject: Meaning of __rlshift__ and __rrshift__ ?
References: <20000407192251.A1974@yetix.sz-sb.de>
Message-ID: <07b20beb.2fe8f249@usw-ex0103-019.remarq.com>

__rrshift__ is the reversed-operand version of __rshift__. There
are reversed-operand versions of the other binary operators.
They are invoked for the object on the right-hand side of a
binary operator when the left-hand-side object doesn't support
the operator in question.

For example, consider the expression

    x / y

If x has a __div__() method defined then x.__div__(y) will be
invoked. But if x doesn't have __div__() defined then an attempt
will be made to invoke y.__rdiv__(x) instead.

Hamish Lawson


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From sabren at manifestation.com  Tue Apr 18 12:42:50 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Tue, 18 Apr 2000 12:42:50 -0400 (EDT)
Subject: o'rielly python devcenter
Message-ID: 

I didn't see this posted already, but sorry if its old news.
O'Reilly started a new python site:

     http://www.oreillynet.com/python/


Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------




From moshez at math.huji.ac.il  Thu Apr 20 16:19:12 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Thu, 20 Apr 2000 23:19:12 +0300 (IDT)
Subject: Good style for multi-valued returns
In-Reply-To: <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7@lp.airnews.net>
Message-ID: 

On 20 Apr 2000, Cameron Laird wrote:

> Examples of multi-valued returns:  
...
> (CAR, CDR)


Ummm....wouldn't that be a bit twisted? Just return the pair!

sorry-couldn't-resist-ly y'rs, Z.
--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From someone at somewhere.com  Tue Apr 18 15:58:59 2000
From: someone at somewhere.com (Charley Horse)
Date: Tue, 18 Apr 2000 19:58:59 GMT
Subject: Using python on the web
References:  <8di2bk$l1s$1@newshost.accu.uu.nl>  <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com>
Message-ID: 

It was just an unexpected surprise. I'm fairly new to all of this and 
always heard of CGI in the context of "you don't have to user CGI 
anymore because of the fancy new blah blah technology we offer!" I'll 
try it and I'm sure it'll be fine. If all of you clean-code loving 
python users can live with it then I'm sure I can too. 

In article <_W2L4.986$GK5.20898 at news2-win.server.ntlworld.com>, 
richard_chamberlain at ntlworld.com says...
> I'm curious why you would be put off using cgi?
> 
> having used python and cgi, plus java servlets/jsp and asp at various
> different times I cannot say I see your point.
> 
> In many ways my preferred method would be python because I can get something
> working in such a short space of time, and there's no significant speed
> difference between, for instance, java and python.
> 
> cgi has to be about the most common way of construction on the fly web
> pages, and I don't think it's going away just yet.
> 
> Richard
> 
> Charley Horse  wrote in message
> news:MPG.136631472f892a119896ac at news...
> > Thanks to all of those pointers. Finding out that CGI plays an important
> > role in the python world was a shock to me as I only started working
> > with web stuff in the last couple of years. I've just never touched a
> > CGI script, shockingly I suppose . ASP/CF and PHP are what I've
> > worked with and CGI was just the "old world" technology for
> > interactivity that I read about but never had to work with.
> >
> > So coming at this as a newbie, and for years hearing about python's
> > elegance and oo-ness, it just seemed a strange pairing, python and CGI.
> > Puzzling in fact! I see why it makes sense, but it's just not what I
> > expected.
> >
> > I'll fool with CGi and perhaps it won't be enough of a turn off to
> > affect my interest.
> >
> > In article <8di2bk$l1s$1 at newshost.accu.uu.nl>, m.faassen at vet.uu.nl
> > says...
> > > Charley Horse  wrote:
> > > > I've just started fooling with python. I've looked around the python
> > > > site and a number of the other sites referenced there and am a bit
> > > > puzzled. Umm... how does one go about using python for web
> applications,
> > > > especially database driven apps? Almost everything deals with python
> > > > just as a language, as C++ would be.
> > >
> > > That's because Python is a language. Python isn't a web-specific
> language,
> > > after all.
> > >
> > > > Not much about the web specifically.
> > > > I was a bit shocked to find the only direct refs on about
> > > > this at python.org are entwined with CGI (unless I missed it).
> > >
> > > Why is CGI so shocking? It's used quite a bit, after all? You can write


From effbot at telia.com  Sun Apr 23 05:50:33 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Sun, 23 Apr 2000 09:50:33 GMT
Subject: code not true?
References: 
Message-ID: 

Michal Wallace (sabren)  wrote:
> Isn't unicode much slower to work with than regular strings?

nope.






From dworkin at ccs.neu.edu  Wed Apr  5 13:38:08 2000
From: dworkin at ccs.neu.edu (Justin Sheehy)
Date: 05 Apr 2000 13:38:08 -0400
Subject: A Mountain of Perl Books + Python Advocacy
In-Reply-To: "Jason Stokes"'s message of "Wed, 5 Apr 2000 16:00:20 +1000"
References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <3FAG4.62951$3b6.243372@ozemail.com.au>
Message-ID: 

"Jason Stokes"  writes:

> The market for Perl is 10-100 times bigger than Python.

The "market", as defined how?

-Justin

 



From moshez at math.huji.ac.il  Fri Apr 28 01:06:58 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Fri, 28 Apr 2000 08:06:58 +0300 (IDT)
Subject: Converting = to ==
In-Reply-To: 
Message-ID: 

On Thu, 27 Apr 2000, Warren Postma wrote:

> I have an "end user query tool" that uses Python expressions, but I want
> comparisons to be able to be written either as A=B or A==B then I want to
> compare them using Python's Eval function.

Try using the tokenize model to tokenize the string, and replacing "="
with "==" at the token level. This will also gurrantee you won't be fooled
by strings containing "=" or other evils.

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From g_will at cyberus.ca  Wed Apr  5 00:17:31 2000
From: g_will at cyberus.ca (Gordon Williams)
Date: Wed, 05 Apr 2000 04:17:31 GMT
Subject: Installer Problem Finding Modules
Message-ID: <01bf9eb5$7ee884e0$1e41c3d1@Cyberus>

Hi,

I am trying to run Gordon McMillan's Installer (3f on W95) and I am having
a problem with it finding the modules that I am importing into the main
program.  The first part of my program goes like

"The main module for running the bitscope program"
import traceback
import GlobalVar
from Menu import myMenu
from MyCanvas import plotCanvas
from OperationMode import opModePanel
from TriggerPanel import triggerPanel
from SampleRatePanel import sampleRatePanel
from AnalogSourcePanel import analogSourcePanel
from SampleButtonPanel import sampleButtonPanel
import Registers
from wxPython.wx import *

reload(GlobalVar)
g= GlobalVar

Registers.openPort()		#sets up the port for IO


... and then goes on to define classes etc.

The installer ignores the all the imports except for the wxPython stuff
which it appears to get all of.  Any ideas where I may be going wrong.  I
hope that I dont have to list all these modules as dependancies as some of
these modules also call other modules.

Maybe this is a related problem, but I dont think so:
All the modules along with the main module are in a sub directory of the
installer program.  When I run python ..\simple.py bs_main.py from a dos
box
I was geting an error "can't open 'E:Program" when it it was trying to
start build.py.  I ended up changing simple.py line 74 to
cmd = '"%s" %s %s %s' % (sys.executable,
                           '../Builder.py',                      <<< change
is here
                           cfgfile, tkcfg)

to get it to work.

Thanks

Gordon Williams


From landauer at apple.com  Fri Apr  7 15:10:03 2000
From: landauer at apple.com (Doug Landauer)
Date: Fri, 07 Apr 2000 12:10:03 -0700
Subject: Teaching the art of programming, in python
References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com>  <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> <38EB73B6.6C0913A7@callware.com> <8chsij$k5r$1@newsserver.rrzn.uni-hannover.de>  <38EDDACC.8641FF8C@callware.com>
Message-ID: 

> "Teach your self Internet in 10 minutes". Seems there is
> inflation (or perhaps deflation) in these things.

I think I'll wait for the Cliff's Notes to come out ... that
might get it down to 2 minutes.


From robin at jessikat.demon.co.uk  Tue Apr 25 03:02:29 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Tue, 25 Apr 2000 08:02:29 +0100
Subject: new linereading standard?
References: <3904D21B.333DD930@visionart.com> <390510C9.A744D22E@yahoo.com>
Message-ID: 

In article <390510C9.A744D22E at yahoo.com>, Al-Amerrho H. Amerin
 writes
>Pete Shinners wrote:
>
>>
.....
>_
>>    pete at visionart.com
>
>A beginner myself, I would write it like this:
>
>inputlines = open('myfile.txt').readlines()
>for line in inputlines:
>    print line
>
>Instead of the 'while 1: ....break' thingy.
>
>Al-
>

am I wrong for writing

for line in open('myfile.txt').readlines():
    print line

-- 
Robin Becker


From gherman at darwin.in-berlin.de  Tue Apr 18 15:54:31 2000
From: gherman at darwin.in-berlin.de (Dinu C. Gherman)
Date: Tue, 18 Apr 2000 21:54:31 +0200
Subject: BAD starship.python.net news!
References: <38FC852A.9B11F458@concentric.net>
Message-ID: <38FCBD77.A5925D65@darwin.in-berlin.de>

Manus Hand wrote:
> 
> This from Mike McLay.  Everyone, let's pony up what it takes to recover
> our starship!
> 
> Manus (who will backup more and more often than he has until now)

Not a bad idea! Sigh...

I think Christian Tismer used to make regular copies of
large parts of the Starship, at least in former times...

Thinking of the not so long ago shut-down of Starship Py-
thon I (starship.skyport.net)... couldn't that be a source 
to recover substantial parts of the previous data??

Sigh!

Dinu

-- 
Dinu C. Gherman
................................................................
"The thing about Linux or open software in general is that 
it actually tries to move software from being witchcraft to 
being a science," [...] "A lot of the programs you see today 
are actually put together by shamans, and you just take it and 
if the computer crashes you walk around it three times... and 
maybe it's OK." (Linus Thorvalds, LinuxWorld 2000, NYC)


From klaus-gerd.meyer at gmx.de  Fri Apr 21 18:36:35 2000
From: klaus-gerd.meyer at gmx.de (Klaus-Gerd Meyer)
Date: Sat, 22 Apr 2000 00:36:35 +0200
Subject: Tkinter crash with Cleansweep
Message-ID: <8dql2j$1k52$1@msheas02.msh.de>

I'm new to Python. I installed Python 1.52 and TCL/TK on a Win98 PC.

On exit from IDLE and other Tkinter programs the programs often hangs and i
have to reboot.

To keep my PC clean, i have installed Norton CleanSweep 4.5.
I found, that CleanSweep runs always a program CSINJECT.EXE at startup, even
if i have disabled all the Cleansweep "Monitoring" options.
CSINJECT loads QDCSPI.DLL and that seems the problem(?).

If i remove CSINJECT.EXE from startup, all the Tkinter programs run fine!

Maybe this helps other users...

(Excuse my bad english)
--
MfG   K.- G. Meyer




From fig at oreilly.com  Fri Apr 14 13:45:32 2000
From: fig at oreilly.com (Stephen R. Figgins)
Date: Fri, 14 Apr 2000 17:45:32 GMT
Subject: Python tools for PDE and Linear algebra
References: 
Message-ID: <38F75987.26AD3FEA@oreilly.com>

> Does anyone know
> some PDE tools or are working on such projects? Support for different
> numerical methods as Finite Difference and Finite Element Methods
> would be nice.

I don't know of any in Python, Roger, but there are some free libraries
available for C++.  You can find them listed at: 

  http://oonumerics.org/oon/

You might be able to adapt one of these, rewrite it in python or maybe
just call it from python. 

I expect these would be rather computationally expensive, and so you
might be better off with having them written in C or C++.  

Stephen Figgins


From jpb at mycroft.communiweb.net  Wed Apr 26 23:22:01 2000
From: jpb at mycroft.communiweb.net (jpb)
Date: Thu, 27 Apr 2000 03:22:01 GMT
Subject: python-only crypt()?
References:  <39065A08.F776CBE1@home.com> <87d7nd444b.fsf@psyche.evansnet>
Message-ID: 

In article <87d7nd444b.fsf at psyche.evansnet>, Carey Evans 
 wrote:

>bo Vandenberg  writes:
>
>> "a pure Python implementation of the Unix crypt(3) algorithm"
>> 
>> http://home.clear.net.nz/pages/c.evans/sw/
>
>Wow.  I finished writing that and uploaded it less than six hours
>before your post.  Would you mind letting me know how you found it so
>quickly?

Guido has been lending out the time machine again, I guess.

jpb


From clarence at netlojix.com  Sat Apr 15 16:59:20 2000
From: clarence at netlojix.com (Clarence Gardner)
Date: Sat, 15 Apr 2000 13:59:20 -0700
Subject: else clauses in while and for loops
References:   <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> <8d9c66$el7$1@pegasus.csx.cam.ac.uk>
Message-ID: <955832508.2143160134@news.silcom.com>

On Sat, 15 Apr 2000, Nick Maclaren wrote:
>In article <38F79B93.B03F0A6B at mindspring.com>,
>Chuck Esterbrook   wrote:
>>So did anyone present, in this thread, an example that shows a real need?
>
>Whether or not they have one, there is a fairly common case:
>
>    Perform an action XXX provided that no member of sequence YYY
>fulfils a particular criterion.
>
I never thought of that general wording, but it certainly fits.
I did this just yesterday:

for fname in ('keyword','terms','title','journal','author','pubdate','thd','entrynumber'):
    if Form.has_key(fname):
        break
else:
    Errs.append('No search field supplied')


From paul.magwene at yale.edu  Tue Apr 11 10:38:06 2000
From: paul.magwene at yale.edu (Paul Magwene)
Date: Tue, 11 Apr 2000 10:38:06 -0400
Subject: Tcl vs Tkinter
References: <38f31c65$0$27527@wodc7nh0.news.uu.net>
Message-ID: <38F338CE.1507B802@yale.edu>

T Zimmerman wrote:
> 
>     I again am looking for help on the use of 'alt-*' to access the menus in
> any application written with Tkinter. I have tried the tcl examples that
> were included with the download of Python and they work as expected. So, I
> am confused as to why it does not work for Tkinter widgets.  The following
> script should work and should open the 'File' menu when 'alt-f' is pressed.
> On NT this does nothing.
> 
> ==================================================================
> import Tkinter
> 
> root = Tkinter.Tk()
> 
> button = Tkinter.Menubutton(text = 'File', underline = 0)
> button.pack()
> menu = Tkinter.Menu(button)
> button.configure(menu = menu)
> menu.add_command(label = 'Hello World', underline = 0)
> 
> root.mainloop()
> ==================================================================

Odd, your code works as expected using Python 1.5.2 on FreeBSD (3.x
stable), but doesn't work right on NT.

However, the following, which uses only Menu objects and cascades, DOES
work on both FreeBSD and NT:

#==================================================================
import Tkinter

root = Tkinter.Tk()

MnMenu = Tkinter.Menu()

menu = Tkinter.Menu(MnMenu)
menu.add_command(label = 'Hello World', underline = 0)

MnMenu.add_cascade(label='File',underline=0,menu=menu)

root.config(menu=MnMenu)

root.mainloop()
#==================================================================


Go figure.  Maybe the effbot has some insight?

--Paul


From javanet at dynacap.com  Tue Apr 11 20:50:01 2000
From: javanet at dynacap.com (Arnaldo Riquelme)
Date: Tue, 11 Apr 2000 16:50:01 -0800
Subject: Python 4 DOS
Message-ID: 

Can anyone tell me if I can get python binaries for DOS (16-bit).
I heard of  Hans Nowak 's  Python-DX but the links to his website is broken?
Where are you Hans?

Thanks



ajr


have fun





From exarkun at flashmail.com  Sun Apr  2 08:55:19 2000
From: exarkun at flashmail.com (Jp Calderone)
Date: Sun, 02 Apr 2000 12:55:19 +0000
Subject: Hmm, little Tk question.
References: <20000402165146.20535.cpmta@c000.sfo.cp.net>
Message-ID: <38E74337.35A912A8@flashmail.com>

Falknor wrote:
> 
> Allo peoples :)
> 
>     I was wonderin, is it possible to initiate a Tk fully functional Tk window across a socket connection?  Ie they are connected to me through a generic telnet app and have the Tk libs installed and operational.  Mudding is one of my hobbies and I had an idea last night while talkin to a player, got me thinkin bout this.  I believe I've heard someone talk about it on one of the mud mailing lists a good while ago but I can't seem to recall.  Ah well, any input is appreciated. :)
> 

export DISPLAY="my.ip.address:0.0"
./spiffyTkMudClient.py &

This assumes, of course, that they are running an X-server (Generally not
a safe assumption for the average MUD user)

> Falknor of the WoT MUD project,
> http://www.tarmongaidon.org/wotmud
> ______________________________________________________________
> Get free Internet service and email at http://www.worldspy.com

-- 
It is practically impossible to teach good programming style to
students that have had prior exposure to BASIC: as potential
programmers they are mentally mutilated beyond hope of
regeneration.        -- Dijkstra
--
 12:53pm up 4 days, 18:00, 0 users, load average: 0.21, 0.07, 0.02


From lutz at rmi.net  Tue Apr 25 12:18:54 2000
From: lutz at rmi.net (lutz at rmi.net)
Date: Tue Apr 25 12:18:54 2000
Subject: Nudge, nudge (LJ May issue)
Message-ID: <200004251821.MAA00625@chevalier.rmi.net>

I can't believe nobody has posted this yet, but 
just in case...

   http://www2.linuxjournal.com/lj-issues/issue73/lstoc.html

--Mark Lutz  (http://rmi.net/~lutz)  [PyMail 1.0]




From akuchlin at mems-exchange.org  Sat Apr 22 10:57:33 2000
From: akuchlin at mems-exchange.org (Andrew M. Kuchling)
Date: 22 Apr 2000 10:57:33 -0400
Subject: Starship status, April 22
Message-ID: <3dln26ji8y.fsf@amarok.cnri.reston.va.us>

More progress: 

* User accounts have been recreated. 

* Mail service has restored to most users.  Exceptions are:

No address found: tdfunk, stevel, sdm7g, moshez, mclay, bwilk
Forwarded back to starship (no non-starship address): bhoel,
manus, marduk, scharf, sk, tbryan, tommy, xoltar

* The contents of the FTP server have been restored, as have the Web
  pages.

* If you set up an SSH key for your account, you should be able to log
  in again.  IMPORTANT: We are still waiting to hear from the data
  recovery firm about the contents of the old disk.  Don't embark on
  any massive updating of your Web pages, in case we have to restore
  the more recent data.

  Just update any old software releases that will bury you in support
  e-mail, fix any really critical problems 

Still to do: Mailman, Zope, Web site config tweaks, passwords for
people who didn't use SSH.

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
If you can, and if you are a playgoer and a filmgoer, you should be able to
find voices for all the characters in the books you read.
  -- Robertson Davies, _A Voice from the Attic_



From mhammond at skippinet.com.au  Tue Apr 11 20:21:56 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Wed, 12 Apr 2000 00:21:56 GMT
Subject: ANNOUNCE: Python 1.6 alpha 2
References: <200004112029.QAA09762@eric.cnri.reston.va.us>
Message-ID: 

Note that win32all-131 for this version of Python is available via
http://starship.python.net/crew/mhammond/win32

Works like a charm :-)

Mark.

"Guido van Rossum"  wrote in message
news:200004112029.QAA09762 at eric.cnri.reston.va.us...
> I've just released a source tarball and a Windows installer for Python
> 1.6 alpha 2 to the Python website:
>
>   http://www.python.org/1.6/
>
...





From darrell at funkomite.com  Thu Apr 13 00:20:52 2000
From: darrell at funkomite.com (darrell)
Date: Wed, 12 Apr 2000 21:20:52 -0700
Subject: simple httplib and urllib timeout question
References: 
Message-ID: <1WbJ4.86$9B.7202@news.bc.tac.net>

Yeah I would love to:
a) check out your Internet Robot
b) help out with any code

Ive already made a database module using mysqldb for inserting urls
into a table and updating the db relationships etc, for classifying the
urls.

I played a bit today with Michal's botlib , it seems to work really well ,
and increases my bots speed alot (being that it doesn't hang on any urls) so
far. Ive left it running for the evening , and see how it goes.

Anyway , I would love to help out, if I can. My goal is to build a fast(as
possible) robot in python that will be ultra flexible and hopefully
intelligent as well that can add & classify urls.

So count me in if you want some help.

Darrell

"Oleg Broytmann"  wrote in message
news:Pine.LNX.4.21.0004120814500.6832-100000 at fep132.fep.ru...
> Hi, there!
>
> On Tue, 11 Apr 2000, Michal Wallace (sabren) wrote:
> > meanwhile... HEY OLEG! -> have you done anything w/ this?
>
>    I am about to release the third version of my "Bookmarks database and
> Internet robot" project. It is 98% finished, I just need a bit more
> testing. If you are interested, I can publish it in current beta state.
>
>    The third version is a complete rewrite. All things had been revamped,
> and rewriteen in OO manner, and made more modular and pluggable. I don't
> value OO by itself, but this time the OO approach helped me to make the
> code simpler, smaller, more readable and reusable.
>
>    After releasing it, I'll continue to work on new modules and plugins.
> There are thre areas for plugins - database managers, so called writers
> (data dumpers that could dump data to different text formats) and robots.
>    Currently I (re)implemented 2 robots - simple and forking, Forking
robot
> is fine, but slow - it checks one URL at a time.
>
>    In the field of your interest - yes, I want to write more robots, at
> least two - I want a threading robot, but much more than that I want an
> asyncore-based robot. I haven't done anything yet; it seems I need to
> rewrite the entire urllib to use asyncore, and it is hard work. Anyway I
> need the work to be done, so if no one would help me - I will do it
myself.
> At least will TRY to do it :)
>
> Oleg.
> ----
>     Oleg Broytmann    http://members.xoom.com/phd2.1/
phd2 at earthling.net
>            Programmers don't die, they just GOSUB without RETURN.
>
>




From joacim at home.se  Thu Apr 27 10:09:30 2000
From: joacim at home.se (JJ)
Date: Thu, 27 Apr 2000 16:09:30 +0200
Subject: Concatening string and integer
References: <8e9gco$jlt$1@vg170.it.volvo.se> 
Message-ID: <8e9hnv$ru9$1@vg170.it.volvo.se>

Thanks for all your fast answers

BR
Joacim

"Remco Gerlich"  wrote in message
news:slrn8gghgk.el7.scarblac-spamtrap at flits104-37.flits.rug.nl...
> JJ wrote in comp.lang.python:
> > Hi!
> >
> > I want to concatenate a string containing both strings and integers
like:
> >
> > strTemp = 'I make test number: ' + iMyNumber + ' once again'
> >
> > It doesn't work, how should I do this?
>
> 1) You make a string of the integer:
>
> strTemp = 'I make test number: ' + str(iMyNumber) + ' once again'
>
> 2) You use string formatting:
>
> strTemp = 'I make test number: %d once again' % iMyNumber
>
> --
> Remco Gerlich,  scarblac at pino.selwerd.nl
> Hi! I'm a .sig virus! Join the fun and copy me into yours!




From mwh21 at cam.ac.uk  Tue Apr  4 08:39:50 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 04 Apr 2000 13:39:50 +0100
Subject: Bugs in Python 1.6 alpha 1
References:  <8c8vfj$5n6$1@news.udel.edu> <8ccmah$chj$1@pegasus.csx.cam.ac.uk>
Message-ID: 

nmm1 at cus.cam.ac.uk (Nick Maclaren) writes:

>     6) test_unicode fails on Hitachi systems -- Writing: '*', expected:
> 'T'.  But only if -v is NOT specified!  Again, I failed to tie it down,
> and it looks like a test harness problem.

That's the way regrtest works; if you specify `-v' all output goes to
stdout, if you specify `-g' it goes into the output directory and if
you specify neither it goes into some internal buffer to be compared
with what's in the output directory.

A bit odd, yes.  I don't know if it's a deliberate behaviour (doubt
it).

Cheers,
Michael

-- 
well, take it from an old hand: the only reason it would be easier
to program in C is that you can't easily express complex  problems
in C, so you don't.                 -- Erik Naggum, comp.lang.lisp


From grisha at ispol.com  Thu Apr 27 08:25:06 2000
From: grisha at ispol.com (Gregory Trubetskoy)
Date: Thu, 27 Apr 2000 08:25:06 -0400
Subject: when to use intern()
Message-ID: 

It says in the manual that some things in Python get interned
automatically. I'm not sure where intern() is necessary - 

if I have a statement like:

if self.config.has_key("PythonOption"):
   ...

that gets executed a lot - should I consider interning "PythonOption" or
is it done automatically?

what about

PYTHON_OPTION = "PythonOption"
if self.config.has_key(PYTHON_OPTION):
   ...

is this interned?


Thanks!


--
  Gregory (Grisha) Trubetskoy
       grisha at ispol.com



From rob at hooft.net  Tue Apr 25 06:23:53 2000
From: rob at hooft.net (Rob W. W. Hooft)
Date: 25 Apr 2000 12:23:53 +0200
Subject: Good style for multi-valued returns
References: <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7@lp.airnews.net>
Message-ID: 

>>>>> "CL" == Cameron Laird  writes:

 CL> Let me guess: folks generally pass tuples for small and
 CL> determinate-in-number multi-values, and dictionaries other- wise,
 CL> 'cept some do it all with tuples.  Accurate?

I sometimes use:

class Record:
    """Empty class for misc use"""
    _format={}
    
    def __init__(self,**kw):
        for key,value in kw.items():
            setattr(self,key,value)

    def __repr__(self):
        t=[]
        for i in dir(self):
            if i[0]!="_":
                if self._format.has_key(i):
                    if self._format[i]:
                        t.append("%s=%s"%(i,self._format[i]%getattr(self,i)))
                else:
                    t.append("%s=%s"%(i,repr(getattr(self,i))))
        import string
        return "Record: "+string.join(t)

    def copy(self):
        import copy
        return copy.copy(self)
    

-- 
=====   rob at hooft.net          http://www.xs4all.nl/~hooft/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========


From mark at chem.uwa.edu.au  Thu Apr 27 19:52:13 2000
From: mark at chem.uwa.edu.au (Mark C Favas)
Date: 27 Apr 00 23:52:13 GMT
Subject: Can there be scrollbar attached to group widget
References: <3903C15D.E33126@swt.edu>
Message-ID: 

ABC  writes:

>I have a notebook and the group is embedded in the notebook. can the
>scrollbar can be attached to the group.

You could try putting the group inside a PmwScrolledFrame, which is itself
embedded in the notebook...

Mark
--
Email  - mark at chem.uwa.edu.au      ,-_|\                           Mark C Favas
Phone  - +61 9 380 3482           /     \               Department of Chemistry
Fax    - +61 9 380 1005      ---> *_,-._/   The University of Western Australia
                                       v                               Nedlands
Loc    - 31.97 S, 115.81 E                               Western Australia 6009


From dgoodger at bigfoot.com  Sat Apr  8 23:34:58 2000
From: dgoodger at bigfoot.com (David Goodger)
Date: Sat, 08 Apr 2000 23:34:58 -0400
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk>
Message-ID: 

on 2000-04-08 04:38, Nick Maclaren (nmm1 at cus.cam.ac.uk) wrote:
> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0)

C's ?: operator, ie:

    test ? true : false

can be done in Python, with:

    ((test and [true]) or [false])[0]

Note that I said *can* be done, not *should* be done! It is very ugly and
counter-intuitive and naughty. But sometimes necessary. Use sparingly,
especially if your code will ever be read (even by you!).

I got this expression from Mark Lutz' book "Programming Python", end of
Chapter 5, page 135 (under "The Naughty Bits", "if as an expression").

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)



From rurban at x-ray.at  Sun Apr  9 11:16:13 2000
From: rurban at x-ray.at (Reini Urban)
Date: Sun, 09 Apr 2000 15:16:13 GMT
Subject: Python Language Support for ArcView GIS
References:  <38EFAC08.2A10932D@verecomm.com>
Message-ID: <38f09fee.21313387@judy>

Peter Kropf wrote:
>Just an FYI: You might want to consider moving AVPython to
>sourceforge.net. The entire environment is designed for 
>various levels of open source development... 

When AVPython will be open source...


>Bruce Dodson wrote:
>> Python is free and open source.  I hope AVPython will eventually be the
>> same, but we haven't yet settled on an acceptable open source license, so
>> for now the best I can do is provide a binary that is freely
>> redistributable.

--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html


From pf at artcom-gmbh.de  Thu Apr 20 12:53:26 2000
From: pf at artcom-gmbh.de (Peter Funk)
Date: Thu, 20 Apr 2000 18:53:26 +0200 (MEST)
Subject: Lazy imports (was Re: module naming) (corrected version)
Message-ID: 

Hi!

Two days ago I posted a followup to a question by Michal Wallace, 
which included some Python code, which was BUGGY!  But see below.

> Michal Wallace (sabren) asks:
> >   That's certainly a lot cleaner! But is there a way to do that and
> > not have it load each one of those files every time? There's actually
> > more than 3, and even though they're all fairly small, I'd rather not
> > have the overhead of loading them until they're needed.
> 
> You could try to adopt the lazy loader concept implemented in 
> the Pmw package.  The idea is to use a small tool, that builds a 
> dictionary of exported features (classes and more) by investigating
> all module files in the package and places this in a file called
> for example 'exports.def'.  Than you can use the following
> __init__.py file to load features (classes, constants, functions,
> or modules, what you want) on demand.  The idea is "stolen" from
> Greg McFarlanes wonderful Pmw package:

As Greg McFarlane pointed out to me, a block of my program got the
wrong indentation, so it will not work as I intended it to.  Here is
an updated (and hopefully more correct version).  Many thanks to
Greg McFarlane for his original work and the time he spent to review
my code.  This time I also included a little helper script used to
automatically generate the 'exports.def' file used by the lazy importer.

Regards, Peter
---- 8< ---- 8< ---- cut here ---- 8< ---- schnipp ---- 8< ---- schnapp ----
#!/usr/bin/env python
## vim:ts=4:et:nowrap
"""__init__ : This file is executed when the package is imported.  It creates
a lazy importer/dynamic loader for the package and replaces the package 
module with it.  This is a very simplified version of the loader supplied 
with Pmw.  All the package version management has been stripped off."""

import sys, os, string, types

_EXP_DEF = 'exports.def'       # export definition file
_BASEMODULE = 'base'           # Name of Base module for the package

class _Loader:
    """An instance of this class will replace the module in sys.modules"""

    def __init__(self, path, package):
        self._path, self._package = path, package
        self._initialised = 0
        
    def _getmodule(self, modpath):
        __import__(modpath)
        mod = sys.modules[modpath]
        return mod

    def _initialise(self):
        # Create attributes for the Base classes and functions.
        basemodule = self._getmodule('_'+self._package+'.'+_BASEMODULE)
        for k,v in basemodule.__dict__.items():
            if k[0] is not '_' and type(v) != types.ModuleType:
                self.__dict__[k] = v
        # Set the package definitions from the exports.def file.
        dict = {
            '_features'     : {},
            '_modules'      : {},
        }
        for name in dict.keys():
            self.__dict__[name] = {}
            d = {}
            execfile(os.path.join(self._path, _EXP_DEF), d)
            for k,v in d.items():
                if dict.has_key(k):
                    if type(v) == types.TupleType:
                        for item in v:
                            ## modpath = self._package + item
                            modpath = item
                            dict[k][item] = modpath
                    elif type(v) == types.DictionaryType:
                        for k1, v1 in v.items():
                            ## modpath = '_'+self._package +'.'+ v1
                            modpath = v1
                            dict[k][k1] = modpath
        self.__dict__.update(dict)
        self._initialised = 1

    def __getattr__(self, name):
        """This will solve references to not yet used features"""
        if not self._initialised:
            self._initialise()
            # Beware: _initialise may have defined 'name'
            if self.__dict__.has_key(name):
                return self.__dict__[name]
        # The requested feature is not yet set. Look it up in the
        # tables set by exports.def, import the appropriate module and
        # set the attribute so that it will be found next time.
        if self._features.has_key(name):
            # The attribute is a feature from one of the modules.
            modname = self._features[name]
            mod  = self._getmodule('_'+self._package+'.'+modname)
            feature = getattr(mod, name)
            self.__dict__[name] = feature
            return feature
        elif self._modules.has_key(name):
            # The attribute is a module
            mod = self._getmodule('_'+self._package+'.'+name)
            self.__dict__[name] = mod
            return mod
        else:
            # The attribute is not known by the package, report an error.
            raise AttributeError, name

# Retrieve the name of the package:
_package = os.path.split(__path__[0])[1]
# Rename (hide) the original package for later perusual:
sys.modules['_'+_package] = sys.modules[_package]
# Create the dynamic loader and install it into sys.modules:
sys.modules[_package] = _Loader(__path__[0], _package)
---- 8< ---- 8< ---- cut here ---- 8< ---- schnipp ---- 8< ---- schnapp ----
#!/usr/bin/env python
## vim:ts=4:et:nowrap                    
"""build_exports.py -- create 'exports.def' helper file for lazy importer

This is a hack to aid changing the substructure of a ggui
package quickly and painless.
"""
import sys, types, pprint

modules = []
features = {}

multiple_defined = {}

template = '''## vim:ts=4:et:nowrap                     
# [Emacs: -*- python -*-]
"""export.def --- This is an exports definition file ---

this was automatically created by %(prog)s

It is invoked by a dynamic import loader in __init__.

    features      : dictionary from feature names to modules names.
    modules       : tuple of module names 
"""
#

_features = %(features)s

_modules = %(modules)s

'''

def spewout(stream=sys.stdout, modules=(), features={}):
    pp = pprint.PrettyPrinter(indent=4)
    d = { 'prog': sys.argv[0], 
          'modules': pp.pformat(tuple(modules)), 
          'features': pp.pformat(features),
    }
    stream.write(template % d)

def inspect(modulename, modules, features, multiple_defined):
    if modulename[-3:] == ".py": modulename = modulename[:-3]
    __import__(modulename)
    mod = sys.modules[modulename]
    for symbol in dir(mod):
        if symbol[:1] != '_' or (symbol == '_' and modulename == 'base'):
            obj = mod.__dict__[symbol]
            if type(obj) == types.ModuleType or symbol == "Pmw":
                if not symbol in modules:
                    modules.append(symbol)
            else:
                if features.has_key(symbol):
                    if multiple_defined.has_key(symbol):
                        multiple_defined[symbol] = multiple_defined[symbol] + \
                            " " + features[symbol]
                    else:
                        multiple_defined[symbol] = features[symbol]
                features[symbol] = modulename

if __name__ == "__main__":
    sys.path.insert(0, '.')
    if len(sys.argv) > 1:
        for arg in sys.argv[1:]:
            inspect(arg, modules, features, multiple_defined)
        outfile = sys.stdout
    else:
        import glob
        l = glob.glob("[a-z]*.py")
        print l
        for module in l:
            inspect(module, modules, features, multiple_defined)
        if multiple_defined == {}:
            outfile = open("exports.def", "w")
    if multiple_defined == {}:
        spewout(outfile, modules,  features)
    else:
        for k, v in multiple_defined.items():
            print k, "has multiple definitions in:", v, features[k]




From sabren at manifestation.com  Wed Apr 26 06:50:04 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Wed, 26 Apr 2000 06:50:04 -0400 (EDT)
Subject: python-only crypt()?
In-Reply-To: <87d7nd444b.fsf@psyche.evansnet>
Message-ID: 

On Wed, 26 Apr 2000, Carey Evans wrote:

> > http://home.clear.net.nz/pages/c.evans/sw/
> 
> Wow.  I finished writing that and uploaded it less than six hours
> before your post.  Would you mind letting me know how you found it so
> quickly?
> 
> > Post back if this is helpful
> 
> Given that I ported it because I couldn't get Michal's port of
> UnixCrypt going, it probably is.

:) Yup! Thanks again, Carey!

Just to clarify for everyone, there are at least two styles of crypt()
routines floating around out there:

http://home.clear.net.nz/pages/c.evans/sw/ is the original, DES-style crypt().
http://www.sabren.com/code/python/crypt/ is the other, MD5-style crypt().

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------





From mhammond at skippinet.com.au  Fri Apr 28 19:35:05 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Fri, 28 Apr 2000 23:35:05 GMT
Subject: Newbie - COM parameters problem
References: <3909F954.9B51E117@cti.ecp.fr>
Message-ID: 

"Martin Rehak"  wrote in message
news:3909F954.9B51E117 at cti.ecp.fr...

> In one method , we have to pass the reference to the object as an [in]
> parameter.

Have you tried it?  You should just be able to pass the object!

> And my question is, how can we actually do it, when the only VARIANT
> "sub-type" fit for this is an IDispatch * and in the whole Python
> documentation, that I found on the net,  is no mention of some pointer
> type or its substitution ?

Python fully supports the VARIANT, including all the funky pointers it
contains.  It is not exposed to the Python programmer - it "just works"
(or should :-).  Passing a COM object will result in the IDispatch * of
the VARIANT getting correctly set - and if the param was [in,out], would
result in the IDispatch ** getting correctly set!

If you have problems, post the complete traceback, but passing other COM
objects works just fine...

Mark.





From pennybridge_pioneer at my-deja.com  Thu Apr 13 23:32:05 2000
From: pennybridge_pioneer at my-deja.com (pennybridge_pioneer at my-deja.com)
Date: Fri, 14 Apr 2000 03:32:05 GMT
Subject: intelligent reply please
Message-ID: <8d63fl$3ji$1@nnrp1.deja.com>

I am looking for someone knowledgable to help me decompile command
interpeter, ie command.com.  I wish to translate it from assembly to
machine language to readable ascii to be able to read the information
contained within.  If you think this can be done and you are someone
who can help me invent a decompiler for this purpose or if you have any
questions mail me at 


Sent via Deja.com http://www.deja.com/
Before you buy.


From thanos at 0x01.com  Mon Apr  3 10:32:40 2000
From: thanos at 0x01.com (thanos)
Date: Mon, 03 Apr 2000 10:32:40 -0400
Subject: CGI - Hidden Fields (NS4.7/IE5)
References: <38D625B2.5E0E88FD@student.tuwien.ac.at>
Message-ID: <38E8AB88.5E5E60E5@0x01.com>

Make shure you are using POST and not GET. EI handle form method GET
badly!!!!

Tamer Fahmy wrote:

> Hi!
>
> I have got a strange problem with my CGI-script. If I call my
> page from Netscape through Apache I get all hidden Fields and
> values. But if I instead call it from Internet Explorer 5 the
> hidden fields don't show up in my FieldStorage.
>
> I noticed in the apache Log Files that IE5 claims itself to be
> HTTP/1.1 comformant and Netscape says HTTP/1.0. Could this be
> the reason or am I missing something?
>
> A hidden line in my CGI-script looks like this:
> 
> and I use method="post" in my form tag.
>
> Any hints?
>
> Thanks,
>   Tamer.
>
> --
> ------------------------------------------------------------------------
>        -////-         | Tamer FAHMY, computer science student at the
>       --o o --        |              university of technology in Vienna
>      --- <  ---       |       aka: Tut-Ench-Tamer       irc: tuhtah
>     ---  v   ---      | eMail:    e9526976 at student.tuwien.ac.at
>      ---    ---       | home page: http://stud4.tuwien.ac.at/~e9526976
>  ^^^  --    --  ^^^   |        Support bacteria -- it's the only culture
> :) Tut-Ench-Tamer (:  |          some people have !    -- Linux fortunes
> ------------------------------------------------------------------------



From miles at caddr.com  Sat Apr 15 11:47:29 2000
From: miles at caddr.com (miles)
Date: Sat, 15 Apr 2000 15:47:29 GMT
Subject: Nasty Zope & Python Imaging Library name collision
References:  
Message-ID: 

In article , Fredrik Lundh wrote:
>miles  wrote:
>> I've finally traced a mysterious failure in some Zope external methods
>> I've been working on to a module name collision between Zope.  In a
>> nutshell, they both contain an 'ImageFile' module and the wrong one
>> gets loaded.
>>
>> This is essentially what my external method does:
>>
>> import Image
>> i = Image.open(filename.jpg)
>> i = i.resize((x,y))
>> i.save(newfilename.jpg)
>>
>> This eventually results in the construction of a Jpeg image object which
>> is supposed to derive from ImageFile.ImageFile from the Imaging library.
>> Sadly, the __init__ method from Zope's ImageFile module is called instead,
>> which promptly goes berserk.
>>
>> Is there anything I can do to fix this?  How do people do deal with these
>> kinds of problems in general?  It seems to be very easy to inadvertently
>> collide with another module.  Perl avoids this by allowing arbitrarily
>nested
>> modules.  For example, in this case I'd have Zope::ImageFile and
>> Imaging::ImageFile and everything would be roses.
>
>assuming you have PIL 1.0, just make sure you've installed
>all the PIL files in a directory named PIL, and then do:
>
>    from PIL import Image
>
>instead of "import Image".
>
>if you have an older version, you may have to add an
>__init__.py file to the PIL directory, and explicitly import
>format handlers for the file formats you want to use (e.g.
>import PIL.JpegImagePlugin, PIL.GifImagePlugin)
>
>

That did the trick!  Thanks for your help & thanks for PIL!

-- 
miles at caddr dot com


From gmcm at hypernet.com  Mon Apr 24 10:02:49 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Mon, 24 Apr 2000 10:02:49 -0400
Subject: Tkinter+win32 Installer question
In-Reply-To: <8e1hg2$dq2$1@nnrp1.deja.com>
Message-ID: <1255537525-50974959@hypernet.com>

gregholmes at my-deja.com wrote:

> I am developing multiple programs using Tkinter and win32 extensions.
> 
> Is there a reliable, brute force way to use the Installer to make a
> distribution that will work? I realize I am not posting specifics here,
> but that is kind of the point; is there a general solution? The default
> behavior seems to exclude necessary things.
> 
> I don't mind reinventing the wheel if needed ;) but has this wheel
> already been invented?

You sure are short on specifics: I guess you're talking about 
my Installer. I also guess you're talking about the default 
exclude of win32api and PyWinTypes15.dll. Simply remove 
the offending excludes line from the config and run Builder on 
it, (or remove it from the templates in Simple, Standalone and 
or Freeze, whichever you're using).

They are excluded because most people don't specifically use 
them, but the framework uses the os module, which will 
include these. But os uses them only for the abspath function, 
and has a reasonable fallback if they're not installed. So for 
most users they would be excess baggage that they didn't 
ask for.


- Gordon



From robin at jessikat.demon.co.uk  Fri Apr 21 07:15:27 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Fri, 21 Apr 2000 12:15:27 +0100
Subject: finding real $0
References: 
 
Message-ID: <0H+c2XAPhDA5EwLw@jessikat.demon.co.uk>

In article , Mark
Hammond  writes
>Isnt sys.executable what you are after?
>
>Mark.
>
>"Robin Becker"  wrote in message
>news:OWeCyjAOWCA5Ew86 at jessikat.demon.co.uk...
>> Is there any pythonic way to locate the original argument zero of the
>> process? I mean the location of python itself not the script. This would
>> allow me to launch subscripts without having to rely on the path being
>> set up correctly.
>> --
>> Robin Becker
>
>
yes I'm just stupid.
-- 
Robin Becker


From darrell at dorb.com  Tue Apr 11 19:51:59 2000
From: darrell at dorb.com (Darrell)
Date: Tue, 11 Apr 2000 23:51:59 GMT
Subject: Filter
References: <955427129.619305@neptune.uniserve.ca>
Message-ID: 

"Matthew"  wrote in message
news:955427129.619305 at neptune.uniserve.ca...
> I need to write a filter that inserts tabs between Log values .  So that
> lines 1 to 3 come out looking something like lines 4 to 6.

import re, string

def tabIt(buf):
        # Markup that single letter
    buf=re.sub("(L11.*)([A-Za-z]) ","\g<1>\t\g<2>",buf)

    def twos(mo):
        """
        Add tabs to groups of two then remove extra tabs
        """
        g=mo.groups()
        g1=re.sub("(\w\w)","\t\g<1>\t",g[1])
        g1=re.sub("\t\t+","\t",g1)
        return g[0]+g1

    buf=re.sub("(L11)(.*)",twos,buf)
    return buf


print tabIt(open(fname).read())


--Darrell





From hniksic at iskon.hr  Tue Apr 11 11:35:40 2000
From: hniksic at iskon.hr (Hrvoje Niksic)
Date: 11 Apr 2000 17:35:40 +0200
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com>  <87r9cdhdb0.fsf@deneb.cygnus.argh.org>   
Message-ID: 

wware at world.std.com (Will Ware) writes:

> Hrvoje Niksic (hniksic at iskon.hr) wrote:
> > This is still different from being able to embed multiple Python
> > instances in threads.
> 
> Are we talking about multiple Python instances running in a single
> thread?

No, we're talking (I think) about multiple Python instances running in
a single process, each in its own thread.  To quote Florian:

    > Is it possible to extend your GC in a way which would permit the
    > execution of several bytecode interpreters in multiple threads?

That may be hard, but it's still easier than what you're talking about
-- you needn't handle context switches, etc.


From ajung at sz-sb.de  Fri Apr 28 08:41:19 2000
From: ajung at sz-sb.de (Andreas Jung)
Date: Fri, 28 Apr 2000 14:41:19 +0200
Subject: sleep function?
In-Reply-To: <8ebvud$l6h$1@nnrp1.deja.com>; from tiddlerdeja@my-deja.com on Fri, Apr 28, 2000 at 12:24:57PM +0000
References: <8ebvud$l6h$1@nnrp1.deja.com>
Message-ID: <20000428144118.B20818@sz-sb.de>

On Fri, Apr 28, 2000 at 12:24:57PM +0000, tiddlerdeja at my-deja.com wrote:
> Does python have a sleep function? e.g. sleep(60) to wait 60 seconds?
> 
> I realise this is a lame question, but I have no python documentation
> around just now.

Yeah - it?s quite lame :)

import time
time.sleep(60)

Andreas 



From mwh21 at cam.ac.uk  Mon Apr 17 20:38:17 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 18 Apr 2000 01:38:17 +0100
Subject: Another question
References:  <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> <200004172120.RAA11102@zippy.init.com> 
Message-ID: 

"Jeff Massung"  writes:

> Donald Beaudry wrote in message <200004172120.RAA11102 at zippy.init.com>...
> >and this one is better still (at least on my machine):
> >
> >  def do_it():
> >      from random import randint
> >      r = [0,] * 100000
> >      for i in xrange(100000):
> >         r[i] = randint(1,10)
> >  do_it()
> >
> 
> With the "from/import" being local, does the namespace go away after the
> function is done? How fast is importing (say I called do_it() 10000 times -
> then how efficient is your function?)

Pretty fast; two dictionary lookups (once in sys.modules, another in
random.__dict__), for strings that will have been interned.

For that last dreg of performance you might try:

import random
def do_it(randint=random.randint,xrange=xrange):
    r = [0,] * 100000
    for i in xrange(100000):
       r[i] = randint(1,10)
do_it()

But really, this is getting silly; if performance is this much of an
obsession you aren't going to have that much fun with Python.

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/~perlis-alan/quotes.html


From tom-main at REMOVEME.home.com  Thu Apr 13 22:17:38 2000
From: tom-main at REMOVEME.home.com (Tom)
Date: Fri, 14 Apr 2000 02:17:38 GMT
Subject: How do I undo an import??
References: <7QrJ4.185421$Hq3.4353581@news2.rdc1.on.home.com> 
Message-ID: <6dvJ4.186934$Hq3.4382652@news2.rdc1.on.home.com>

I tried the environment variable as you suggested, pointing to a file
containing the following:

print "about to ... from NetCfg import *"
from NetCfg import *

This partially works.  Now, when I run the python shell I see the printed
text twice, but the functions in NetCfg aren't added to the namespace.

Tom.

"Michael Hudson"  wrote in message
news:m3d7nthbbj.fsf at atrus.jesus.cam.ac.uk...
> "Tom"  writes:
>
> > I'm a C++ programmer, new to Python, working with v1.5.2 on Windows.
> >
> > I run the command-line interpreter, then I type:
> >
> > >>> from NetCfg import *
> >
> > to import my extension.  Now I want to unload my NetCfg DLL without
exiting
> > the interpreter.  How do I do this?
>
> You don't, in general.
>
> del sys.modules['NetCfg']
>
> goes some of the way, but it's unlikely it goes far enough to let the
> dll be unloaded from memory.
>
> > Also, I type the above import command every time I start the
interpreter.
> > Is there some way to get have this command executed automatically?
>
> Set the environment variable "PYTHONSTARTUP" to point to a file
> containing commands you want executed.
>
> At least, that's what I do on Linux.
>
> 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 willadams at aol.com  Tue Apr 11 17:39:04 2000
From: willadams at aol.com (William F. Adams)
Date: 11 Apr 2000 21:39:04 GMT
Subject: Compiling Python Imaging under LinuxPPC
Message-ID: <20000411173904.18637.00002261@ng-cg1.aol.com>

I'm trying to do this, and not getting far.

Here's what I get:
.0 -L/usr/X11R6/lib -lX11 -lXext -lXmu -ltiff -ljpeg -lz -lXpm -0 _tkinter.so
/usr/bin/ld: cannot find -lBLT
collect2: ld returned 1 exit status
make: *** [_tkinter.so] Error 1
Bad exit status from /var/tmp/rpm-tmp.39884 (%build)

What's BLT?

Thanks!

William

-- 
William Adams
http://members.aol.com/willadams
Sphinx of black quartz, judge my vow.



From moshez at math.huji.ac.il  Mon Apr  3 18:37:35 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Tue, 4 Apr 2000 00:37:35 +0200 (IST)
Subject: Python 1.6 alpha 1 released
In-Reply-To: <8catgc$5i84$1@uvaix7e1.comp.UVic.CA>
Message-ID: 

On 3 Apr 2000, John Aycock wrote:

> I'm not going to take sides here, but I coincidentally just finished
> reading something highly relevant:


I beg to differ: it's not highly relevant. What Guido did was correct
a *bug* in the implementation. That people depended on it is sad, and
just goes to show it should be corrected ASAP before more people depend
on it.

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From paro at ieee.org  Mon Apr 17 11:59:29 2000
From: paro at ieee.org (Parag Shah)
Date: Mon, 17 Apr 2000 15:59:29 GMT
Subject: Project idea - python
Message-ID: 

hi,
   i am planning to do a project for my bachelors where i wish to write a translator for a language (undecided at 
the moment ) which generates java bytecode. how do i go about doing it???
thanx in advance
cheers
parag
paro at ieee.org


==================================
Posted via http://nodevice.com
Linux Programmer's Site


From scarblac-spamtrap at pino.selwerd.nl  Wed Apr 26 04:48:44 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 26 Apr 2000 08:48:44 GMT
Subject: Need advice performing a search
References: <3905F795.A536CFA7@stsci.edu> <3906944F.F718FE91@teleatlas.com>
Message-ID: 

Klaus Bruns wrote in comp.lang.python:
> mybe try this:import re
> 
> file = open("file","r")
> 
> alllines = file.readlines()
> pattern1 = re.compile("first_string") ## first_string as regualr
> expression
> pattern2 = re.compile("secound_string") ## secound_string as regular
> expression
> 
> result = []
> 
> for line in alllines:
>     if pattern1.search(line) or pattern2.search(line):
>         result.append(line)
> 
> print result ## result is maybe ['line1','line2','line3']

I think using regular expressions is overkill for simply searching a
substring. Use string.find(string, substring) instead?

file = open("file","r")
alllines = file.readlines()
file.close()

from string import find
def testline(line):
  return find(line, "first_string") or find(line, "second_string")

print filter(testline, alllines)

Is another way to do it.
-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
Hi! I'm a .sig virus! Join the fun and copy me into yours!


From tismer at tismer.com  Tue Apr 25 20:09:19 2000
From: tismer at tismer.com (Christian Tismer)
Date: Wed, 26 Apr 2000 02:09:19 +0200
Subject: Metaclasses?
References: <3905F4A0.2B39C705@darmstadt.gmd.de>
Message-ID: <390633AE.FB7FEA83@tismer.com>


Robb Shecter wrote:
> 
> Hi,
> 
> I read an old post about metaclasses (included on the cd-rom with the
> book "Mit Python programmieren"), and got very interested, because I
> imagine that by making a new metaclass, I could maybe fix the one thing
> about Python that annoys me: the obligatory use of "self" in method
> declarations and variable access.  (Python's syntax is so clean and neat
> in all other areas, I feel like it's a shame that there's excess
> verbosity in this one place.)

No-no. No? No!
There are reasons why people might want to use metaclasses.
But not just to get rid of that verbose "self" argument.

I'd suggest to stay with both the shame and classes as they
are now. This is the cheapest possible way here: Change your
mind about self --
-- it is not *the* problem. it is *really* no problem.

The problem is very much different and harder.
Ask me via private mails if you don't get it.

ciao - chris

-- 
Christian Tismer             :^)   
Applied Biometrics GmbH      :     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 richard at cogsci.ed.ac.uk  Wed Apr  5 12:40:15 2000
From: richard at cogsci.ed.ac.uk (Richard Tobin)
Date: 5 Apr 2000 16:40:15 GMT
Subject: Why should I switch to Python? - Infinity of Primes
References:  <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> <38EA369C.26A1C25@math.okstate.edu> <38EAC8C4.ADC25640@cosc.canterbury.ac.nz>
Message-ID: <8cfq9f$2q5e$1@pc-news.cogsci.ed.ac.uk>

In article <38EAC8C4.ADC25640 at cosc.canterbury.ac.nz>,
Greg Ewing   wrote:

>Um, no it doesn't - it constructs a number which is
>*either* prime *or* divisible by some other prime bigger
>than the one you started with.

It trivially gives you a procedure for finding a larger prime: you
just find the factors of the constructed number (eg by trying all
possible divisors), and if there are any then one will be a new prime,
otherwise the constructed number is a new prime.

-- Richard
-- 
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

"The Internet is really just a series of bottlenecks joined by high
speed networks." - Sam Wilson


From dgoodger at bigfoot.com  Wed Apr 12 23:21:54 2000
From: dgoodger at bigfoot.com (David Goodger)
Date: Wed, 12 Apr 2000 23:21:54 -0400
Subject: Python idiom: Multiple search-and-replace
References: <20000412100816.A2431031@vislab.epa.gov><5C%I4.645$rc9.190288896@newsb.telia.net> <20000412120012.D2446939@vislab.epa.gov><0s1J4.655$rc9.190631424@newsb.telia.net>
Message-ID: 

on 2000-04-12 12:25, Fredrik Lundh (effbot at telia.com) wrote:
> while you're at it, try replacing the original readline loop with:
> 
> while 1:
> lines = fp.readlines(BUFFERSIZE)
> if not lines:
> break
> lines = string.join(lines, "")
> lines = re.sub(...)
> out_fp.write(lines)
> 
> where BUFFERSIZE is 1000000 or so...

why not just,

    while 1:
        lines = fp.read(BUFFERSIZE)
        if not lines:
            break
        lines = re.sub(...)
        out_fp.write(lines)

? Saves the string.join() step. Or am I missing something? (I await
enlightenment...)

BTW, excellent idiom (especially the first one, represented by '...' above).
I can put it to immediate use. You've just sold another copy of your book
... as soon as it's Mac-friendly. And can I copy & paste from it? If not,
maybe I'll wait for the tree-killing edition.

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)



From meh9 at cornell.edu  Thu Apr  6 10:44:54 2000
From: meh9 at cornell.edu (Matthew Hirsch)
Date: Thu, 06 Apr 2000 10:44:54 -0400
Subject: More about variables
Message-ID: 

Hi All,

Let's say I had something like:

number_of_variables=int(raw_input('Enter number of variables: '))

if number_of_variables==1:
   variable1=[]
elif number_of_variables==2:
   variable1=[]
   variable2=[]
elif number_of_variables==3:
   variable1=[]
   variable2=[]
   variable3=[]
elif number_of_variables==4:
   variable1=[]
   variable2=[]
   variable3=[]
   variable4=[]
elif number_of_variables==5:
   variable1=[]
   variable2=[]
   variable3=[]
   variable4=[]
   variable5=[]
else:
   print 'else'

Is there a more efficient way of doing this? What if I wanted to create 
100 variables (lists).  It doesn't make sense to write an if statement 
for that many conditions.

Thanks for your help,
Matt


From rcunning at acm.org  Tue Apr  4 01:31:14 2000
From: rcunning at acm.org (Robert W. Cunningham)
Date: Tue, 04 Apr 2000 05:31:14 GMT
Subject: Advice requested: GUI project beginning
References:  
Message-ID: <38E97E29.2687864D@acm.org>

Jim Richardson wrote:

> On Fri, 31 Mar 2000 09:23:47 +0200,
>  Christian Tanzer, in the persona of ,
>  brought forth the following words...:
>
> >
> >"Russell E. Owen"  wrote:
> >
> >> I am starting work on a telescope remote control user interface. It's a
> >> big program with lots of windows and controls and display graphics
> >> supporting the telescope and numerous instruments.
>
> Not discourage you from writing the app yourself, but there is a
> linux Telescope control app at http://206.169.225.102/eots.html
> certainly worth a look at least. I know nothing of the app itself, don't
> know if it would fit the bill for you.

Programming?  Telescope control?  Doesn't this thread belong in a Forth NG?

I mean, wasn't Forth CREATED to control a telescope?

-BobC




From tseaver at starbase.neosoft.com  Sat Apr 15 14:24:46 2000
From: tseaver at starbase.neosoft.com (Tres Seaver)
Date: 15 Apr 2000 13:24:46 -0500
Subject: TCP/IP protocols
References: 
Message-ID: <5911665EC85DE246.5C7B608EA19D735B.E388A3CBF3EE1E96@lp.airnews.net>

In article ,
Jeff Massung  wrote:
>I'm new to Python programming, but am very experienced in C/C++. Could
>someone point me to a good reference for TCP/IP programming with Python
>(pdf, book, anything :]) thanks.
>
>Jeff
>
>

Aaron Watters, Guido van Rossum, James Ahlstrom. _Internet Programming
      with Pyton_. M&T Books, 1996. ISBN 1-55851-484-8.

Now out-of-print (I think) -- you may be able to find it through the net.
-- 
---------------------------------------------------------------
Tres Seaver        tseaver at digicool.com     http://www.zope.org
Digital Creations


From chapman at bioreason.com  Thu Apr 20 16:30:17 2000
From: chapman at bioreason.com (Mitch Chapman)
Date: Thu, 20 Apr 2000 14:30:17 -0600
Subject: Good style for multi-valued returns
References: <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7@lp.airnews.net>
Message-ID: <38FF68D9.6D23FB38@bioreason.com>


Cameron Laird wrote:
> 
> Examples of multi-valued returns:  (head, tail); (quotient,
> remainder); (left, right); (prologue, body, epilogue);
> (data, code); (CAR, CDR); (count, size); (handle, status);
> (decomposition; remainder); ...
> 
> Let me guess:  folks generally pass tuples for small and
> determinate-in-number multi-values, and dictionaries other-
> wise, 'cept some do it all with tuples.  Accurate?

If there are many returned values, I tend to define a new class 
for the return type rather than returning a dictionary.  This
usually pays off, because the consumers of those return values 
often want to perform the same sorts of operations on the values.  
If I start off representing the return value as a dictionary,
clients duplicate the logic for those operations.  If I start off
with a class for the new return type, those operations get
expressed once, as methods of the new class.

--
Mitch Chapman
chapman at bioreason.com


From smalleys at gte.net  Sun Apr 30 17:18:20 2000
From: smalleys at gte.net (sue)
Date: Sun, 30 Apr 2000 21:18:20 GMT
Subject: Reading in strings -> numbers ??
References: <300420001033289484%pecora@anvil.nrl.navy.mil>
Message-ID: <390CA332.E8EA45B6@gte.net>

Check the HOWTO and topic guides for databases.  I remember
references to table.py, csv.py and a bunch of others.

Sue.


From hamish_lawson at yahoo.co.uk  Fri Apr  7 12:24:17 2000
From: hamish_lawson at yahoo.co.uk (Hamish Lawson)
Date: Fri, 07 Apr 2000 09:24:17 -0700
Subject: Migrating Tcl system to Python
Message-ID: <095cc48a.7e9b36dd@usw-ex0108-063.remarq.com>

I'd be interested in anyone's experience of migrating a (several-
thousand line) system written in Tcl to Python. And since we'll
have to deploy new functionality while we're in the process of
migrating, I'd particularly like to hear of experiences with
having Tcl code using Python code (and vice versa). I'm
considering XML-RPC/SOAP as a possible way to do that, but what
other approaches might there be?

Hamish Lawson


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From cbbrowne at news.hex.net  Thu Apr 27 21:04:51 2000
From: cbbrowne at news.hex.net (Christopher Browne)
Date: Fri, 28 Apr 2000 01:04:51 GMT
Subject: The Simple Economics of Open Source
References:  <390534BB.3D6CEBDF@libc.org>  <3907AD52.FC0630FD@tcac.net>
Message-ID: 

Centuries ago, Nostradamus foresaw a time when Albert Wagner would say:
>Raffael Cavallaro wrote:
>> 
>
>> I think that many open source advocates have
>> failed to apply simple logic to the economics of open source, believing
>> that somehow, the internet, or software, is immune from simple laws of
>> supply and demand. They are not.
>> 
>I am going to have to go back and reread all of your previous posts. 
>You seem to be rebutting a point that was never made.  Of course, Open
>Source software is not immune to the laws of supply and demand.  Who
>said it was?  It is in response to those laws that it is free.  But free
>only in the world of economics where dollar worth is all that matters.
>It is this very world, where the only motivation taken into account is
>money profit, that Open Source has escaped.  And the escape has been
>dazzling.  

_Economics_ is not the study of money.

_Finance theory_ is the study of money.

Economics, in contrast, has to do with the study of the allocation of
resources.

The theory generally regards the allocation of _scarce_ resources.

It is entirely common for the basic "denomination" to be treated as
money, but the analytical tools economics provides are equally
applicable when the "coin of the realm" is the _time developers spend_
as it is when the "coin" represents dollars and cents.
-- 
Rule of Scarcity
"If it's not allocated by a market, then it's more expensive than
money."
-- Mark Miller
cbbrowne at ntlug.org- 


From nmm1 at cus.cam.ac.uk  Mon Apr 10 04:36:22 2000
From: nmm1 at cus.cam.ac.uk (Nick Maclaren)
Date: 10 Apr 2000 08:36:22 GMT
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8covpn$4jq$1@slb6.atl.mindspring.net> <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk> <38F13CA1.1A91D85@mindspring.com>
Message-ID: <8cs3q6$l4e$1@pegasus.csx.cam.ac.uk>

In article <38F13CA1.1A91D85 at mindspring.com>,
Chuck Esterbrook   wrote:
>Nick Maclaren wrote:
>
>> To the several people who suggested:
>>
>>     (a() and [b()] or [c()])[0]
>>
>> Thank you for the suggestion.  I have occasionally used perversities
>> like that (such as '*(x ? &a : &b) = y;' in C to mimic the Algol 68
>> facility), but I don't regard them as clarifying the code, either!
>
>OK, so what does the Algol 68 code look like for that C code and any other interesting cases?

If I remember correctly (and I may well be misremembering), an Algol 68
unit could return a name and not just an expression - i.e.:

    (a | b | c) := y;

or:

    if a then b else c fi := y;

However, I may be getting confused with which language it was.  As I
said, it is not a construction that I regard as particularly clear,
and therefore almost never used it.  I use the expression form very
heavily, in any language that has it, because so many operations are
precisely that construction.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679


From karl-sve at dsv.su.se  Mon Apr  3 12:33:22 2000
From: karl-sve at dsv.su.se (Kalle Svensson)
Date: Mon, 3 Apr 2000 18:33:22 +0200
Subject: Platf. indep. console lib.
In-Reply-To: <38E8AF93.70F4CCF7@ansic.net>
References: <8c03u1$igk$1@news.hit.fi> <38E8AF93.70F4CCF7@ansic.net>
Message-ID: 

On Mon, 3 Apr 2000, Scott wrote:

> There is an slang module which wraps the slang library.  It's available
> for Unix and Win32 though I haven't had the time to actually use it
> yet.  Here is an ftp site for it: 
> ftp://quasar.ipa.nw.ru/pub/avv/Python/pyslang .  If you give it a try,
> let me know how it turns out!

It's been a while since I used it, but at the time it wasn't perfectly
cross-platform, (for example, I couldn't get the arrow keys to work in
Win98 with a Swedish keyboard).
Anyway, the program I wrote can be found on 
http://www.dsv.su.se/~karl-sve/tdsweeper.shtml but beware, it's ugly...

HTH,
  Kalle

--

"When faced with a problem, some people think.
Now they have three problems."  -- The timbot

/------------------------------------------------------\
| karl-sve at dsv.su.se   http://www.dsv.su.se/~karl-sve/ |
| Proud member of Technological Dimensions:            |
|                 http://hem.passagen.se/tech/?noframe |
\------------------------------------------------------/



From clee at thalamus.wustl.edu  Fri Apr 28 11:12:42 2000
From: clee at thalamus.wustl.edu (clee at thalamus.wustl.edu)
Date: Fri, 28 Apr 2000 15:12:42 GMT
Subject: memory leak debugging in C modules
Message-ID: <8ec9oq$k7$1@nnrp1.deja.com>

I'm looking for advice on fixing memory leaks in a python C module.
How do the C modules gurus out there do it?

Thanks in advance for any help,

-chris lee

P.S.  What I've done so far:

- working on a linux machine primarily
- using gcc with -g flag
- debugging with gdb python 
- I've done some preliminary experiments with linking my module with a
utility called electric fence, and I've tried running my module under
the gnome memory checker, memprof.  Both of these options show some
promise but clearly give problematic results.  (I won't go into all the
problems---I suspect the cause of many of them may be that my python
interpreter is compiled with the --with-threads options.  I'm going to
recompile python next.)




Sent via Deja.com http://www.deja.com/
Before you buy.


From tjg at avalongroup.net  Tue Apr  4 18:35:22 2000
From: tjg at avalongroup.net (Timothy Grant)
Date: Tue, 04 Apr 2000 15:35:22 -0700
Subject: Two questions
References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> <38EA7C18.8F3150D1@roguewave.com>
Message-ID: <38EA6E2A.B7ACEF91@exceptionalminds.com>

Bjorn Pettersen wrote:

> > mxODBC works beautifully, but I've never used it to access and access
> > database, only SQL database. Perchance do you know how Windows
> > advertises an Access database to an ODBC driver?
> [snip]
 
> In the control panel there should be a Odbc 32 control (should be
> installed with ms access).  It has a simple point-and-click interface
> where you have to choose the ms access driver, give the filename for the
> database, and choose a DSN (Data Source Name?).  The DSN is what you use
> to connect with.

I just fired up my trusty VMWare and figured this out. I wasn't thinking
about the driver interface being setup differently for different types
of drivers, but sure enough it was. Every-so-often this Windows stuff
actually surprises me in a positive sense.

-- 
Stand Fast,
    tjg.

Timothy Grant                         tjg at exceptionalminds.com
Chief Technology Officer              www.exceptionalminds.com
Red Hat Certified Engineer                      (503) 246-3630
Avalon Technology Group, Inc.              fax  (503) 246-3124
>>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<<



From glyph at twistedmatrix.com  Sat Apr 22 17:24:39 2000
From: glyph at twistedmatrix.com (Glyph Lefkowitz)
Date: 22 Apr 2000 16:24:39 -0500
Subject: The Simple Economics of Open Source
In-Reply-To: m.faassen@vet.uu.nl's message of "22 Apr 2000 14:18:41 GMT"
References: <14591.15630.192472.440375@goon.cnri.reston.va.us>  <3900611F.3B525BDA@cfdrc.com>   <22042000.2@sanctum.jae.ddns.org>  <8dscc1$n1o$2@newshost.accu.uu.nl>
Message-ID: 

m.faassen at vet.uu.nl (Martijn Faassen) writes:

> Glyph Lefkowitz  wrote:
> 
> [snip]
> > For example, if you run across some dusty two-year-old python code
> > that (f'rinstance) facilitates time-travel, and you hack on it for a
> > while, bring it up to date, but get bored or disinterested because of
> > more pressing concerns, like the upcoming alien invasion, you can put
> > your code out there and somebody else with a like mind might come
> > along and pick up where you left off.
> 
> Heh. *Everybody* reads those off-topic threads, don't they? :)

Off-topic?  I thought they were the point of the newsgroup!! They're
better than most net comics... is someone going to be publishing a
"guido mythos" compilation anytime soon? :)

-- 
                  __________________________________________
                 |    ______      __   __  _____  _     _   |
                 |   |  ____ |      \_/   |_____] |_____|   |
                 |   |_____| |_____  |    |       |     |   |
                 |   @ t w i s t e d m a t r i x  . c o m   |
                 |   http://www.twistedmatrix.com/~glyph/   |
                 `__________________________________________'



From ullrich at math.okstate.edu  Sun Apr 23 14:02:33 2000
From: ullrich at math.okstate.edu (David C. Ullrich)
Date: Sun, 23 Apr 2000 18:02:33 GMT
Subject: code not true?
References: 
Message-ID: <39033a68.436738407@news>

On Sun, 23 Apr 2000 09:47:00 +0300 (IDT), Moshe Zadka
 wrote:

>On Sun, 23 Apr 2000, Kragen Sitaker wrote:
>
>> How many decimal digits are needed to make sure that 3 * (1/3) is
>> indistinguishable from 1?
>
>moshe-bombei:/home/moshe>python
>Python 1.5.2 (#1, Feb 21 2000, 14:52:33)  [GCC 2.95.2 19991024 (release)]
>on sunos5
>Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>> (1.0/3)*3 == 1
>1
>
>
>Less then 17

	Aha. And now how many digits do we need for
x=1.0/3 to ensure that all calculations we do in the
future with x will come out right?

DU



From tim_one at email.msn.com  Wed Apr  5 02:07:38 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Wed, 5 Apr 2000 02:07:38 -0400
Subject: Why should I switch to Python? - Infinity of Primes
In-Reply-To: <38EAC8C4.ADC25640@cosc.canterbury.ac.nz>
Message-ID: <000d01bf9ec5$3fb90820$3e2d153f@tim>

[Greg Ewing]
> ...
> If someone actually came up with a formula for constructing
> primes, it would be rather large news -- isn't that one of
> the Big Unsolved Problems?

Several such formulas were developed in the 70's, although they're strained.
Paulo Ribenboim's accessible "The Little Book of Big Primes"
(Springer-Verlag, 1991) gives a bunch of 'em in chapter 3, along with 6
other proofs of the infinitude of the primes.

not-that-archimedes-plutonium-will-be-fooled-ly y'rs  - tim





From thomas at xs4all.net  Mon Apr 17 03:47:38 2000
From: thomas at xs4all.net (Thomas Wouters)
Date: Mon, 17 Apr 2000 09:47:38 +0200
Subject: building on linux w/o threads?
In-Reply-To: <8ddokt$65t$1@nnrp1.deja.com>; from firefly64@my-deja.com on Mon, Apr 17, 2000 at 01:16:24AM +0000
References: <8ddokt$65t$1@nnrp1.deja.com>
Message-ID: <20000417094738.E15664@xs4all.nl>

On Mon, Apr 17, 2000 at 01:16:24AM +0000, firefly64 at my-deja.com wrote:

> I've done everything I can think of, including
> ./configure --without-thread and editing the
> Makefiles to include -DWITH_THREAD=0.

Dont do that :) Just do a 'make distclean' (possibly backupping your
Modules/Setup file first, if you dont want to edit it again) and do
./configure without *any* thread related options (you can use --prefix= and
such, of course.)

> The build process still always either produces a python linked to
> libpthreads or dies complaining about not being able to find various
> thread functions. (Yes, I've done make clean).

The latter, complaints about the thread functions, is probably because you
changed the WITH_THREAD option in the Makefile without editing the
Modules/Setup.thread file. If you disable threading by hand, be sure to
comment the line about the thread module, in that file. (It's the only
uncommented line there ;)

Make distclean && ./configure should do the trick, though.

-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



From effbot at telia.com  Thu Apr 20 04:33:07 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Thu, 20 Apr 2000 08:33:07 GMT
Subject: help learning "re"
References: <38FE6E5A.E7673A83@visionart.com>
Message-ID: <7hzL4.3189$Za1.47032@newsc.telia.net>

Pete J Shinners  wrote:
> i'm trying to get the hang of these regular expression
>
> i'm trying to write a function that takes two filenames
> and copies one to the other. while it is copying i want
> it to scan for any environment variable names and substitute
> the expanded value.

os.path.expandvars(name)

> sounded like a fabulous time to learn the regexp.
> sadly it doesn't work. the code runs, but none of the
> variables are found or substituted
>
> here's what i expected to work
> ----------------------------------------------
> import os, re
>
>
> def subvar(regfind):
>     "callback for regex substitution"
>     var = regfind.group(0)[1:]
>     print 'REGEX found var:', var #temp debugging. never gets here
>     return os.environ.get(var, '$'+var)
>
>
> def smartcopy(source, dest):
>     "copies files. substites env.variables with values"
>     srcfile = open(source, 'r')
>     dstfile = open(dest, 'w')
>     regexp = re.compile(r"\$[0-9A-Z_]+")
>     while 1:
>         line = srcfile.readline()
>         if not line: break
>         regexp.sub(subvar, line)

regexp.sub returns the new value, it doesn't modify
line in place.

>         dstfile.write(line)
>
> -----------------------------------------------
> surely this can be done correctly, but how?

the only bug I can spot is the regexp.sub return value.  the
expression and the substitution function works just fine for
me...

(try adding "print regexp.sub(subvar, '$HOME')" just after
the re.compile to see what I mean)






From aa8vb at yahoo.com  Wed Apr 12 12:00:12 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Wed, 12 Apr 2000 12:00:12 -0400
Subject: Python idiom: Multiple search-and-replace
In-Reply-To: <5C%I4.645$rc9.190288896@newsb.telia.net>
References: <20000412100816.A2431031@vislab.epa.gov>
 <5C%I4.645$rc9.190288896@newsb.telia.net>
Message-ID: <20000412120012.D2446939@vislab.epa.gov>

Fredrik Lundh:
 |Randall Hopper  wrote:
 |> Is there a Python feature or standard library API that will get me less
 |> Python code spinning inside this loop?   re.multisub or equivalent? :-)
 |
 |haven't benchmarked it, but I suspect that this approach
 |is more efficient:
 |
 |

Thanks!  It's much more efficient.  The 140 seconds original running time
was reduced to 11.6 seconds.  I can certainly live with that.

-- 
Randall Hopper
aa8vb at yahoo.com



From lvw at lfpt.rwth-aachen.de  Fri Apr 28 06:25:15 2000
From: lvw at lfpt.rwth-aachen.de (Lars von Wedel)
Date: Fri, 28 Apr 2000 12:25:15 +0200 (MET DST)
Subject: Using BaseHTTPServer
In-Reply-To: 
References: <200004280649.IAA00894@kazul.rwth-aachen.de>
	
Message-ID: <200004281025.MAA02435@kazul.rwth-aachen.de>

Hello,

 > > Within any of the do_GET methods, how do I access data that has been
 > > sent by the client (...&data1=val1?data2=val2?...)?
 >
 > Use the CGI module . Just copy the code from CGIHTTPServer to create
 > the dictionary, (not as os.environ), and use the cgi module to parse
 > that dictionary.

I have been looking into CGIHTTPServer.py a little. I think, it should
be possible to modify run_cgi() (in a subclass) in the following way:

 - Decode self.cgi_info as shown additionally use cgi.parse_qs
   to write results (directory with CGI arguments) into
   e.g. self.cgi_args

 - fork the process (same as original run_cgi())

 - Associate stdin with self.rfile and stdout with self.wfile

 - Instead of running a script with name 'scriptname'
   call a method on 'self' called 'scriptname'.

 - The method called can access self.cgi_args to access
   the data passed and it can simply write to stdout
   using print.


Lars





From lewst at yahoo.com  Wed Apr  5 01:07:09 2000
From: lewst at yahoo.com (lewst)
Date: Tue, 4 Apr 2000 22:07:09 -0700 (PDT)
Subject: Starving for an Advanced Python Book
Message-ID: <20000405050709.25794.qmail@web2106.mail.yahoo.com>

Willie Peloquin  wrote:

> Try "Python and Tkinter Programming" by John E. Grayson. It is an
> excellent book, full of useful information on using Python in the
> real world.

I already own this one, and I agree it's a really comprehensive and
nicely organized book.  Just make sure you are fairly-to-very
comfortable with Python before taking it on.  It jumps right into some
(IMO) complicated example code and doesn't let up.  I figure this text
will become more useful to me as I become more comfortable and
experienced with Python itself.


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com



From andymac at bullseye.apana.org.au  Thu Apr  6 06:44:41 2000
From: andymac at bullseye.apana.org.au (Andrew MacIntyre)
Date: Thu, 6 Apr 2000 20:44:41 +1000 (EST)
Subject: Tkinter and C extensions
In-Reply-To: 
Message-ID: 

On 6 Apr 2000, Bernhard Herzog wrote:

> Andrew MacIntyre  writes:
> 
> [...]
> > My research has turned up ways of determining these via Tk's API
> > (Tk_Display(), Tk_Window() in tk.h) provided I can extract the tkwin
> > handle from Tkinter's canvas widget - something I've yet to figure out how
> > to do from within a C extension.
> > 
> > I'm wondering whether its possible to get at this information via Tkinter,
> > which would simplify the interactions between the various components.
> 
> Tkinter widgets have a tk attribute which is basically a tcl
> interpreter. It's interpaddr() method returns the TclInterp* pointer as
> a python int object. Just pass that and the name of the widget to a
> C-extension function and the rest follows from that...

Thanks for this thought - it fills in another gap.

After more research and another read of Fredrik's Tkinter docs, I've
reached the conclusion that its only the X Display pointer thats a problem
- the Window handle is available from the widget's winfo_id() method.  Oh,
and a Frame would be better than a Canvas for the intended purpose too.

AFAICT the only way to convert a widget's name to a pointer to its
Tk_Window structure, so that the Display pointer can be retrieved, 
requires a pointer to _another_ Tk_Window structure in the same widget
tree :-( Somewhat of a recursive problem when just one such pointer would
probably give me the info I require....

This is probably one of the very few situations where Tkinter's "arms
length" usage of Tk is an impediment.

I've still a couple of ideas to follow up though....

> > Any hints on additional sources of enlightment, such as other modules
> > which have similarities, would be appreciated.
> 
> Sketch's paxmodule does something similar. Sketch uses it to implement
> widgets in Python, which allow you to handle expose events yourself and
> use Xlib functions to draw the widgets.

Thanks for this suggestion as well.

BTW, it was SVGAmodule rather than GDmodule whose link from the Vaults of
Parnassus led to a dead end.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andrew.macintyre at aba.gov.au    (work) | Snail: PO Box 370
        andymac at bullseye.apana.org.au  (play) |        Belconnen  ACT  2616
        andymac at pcug.org.au           (play2) |        Australia




From gmcm at hypernet.com  Wed Apr 12 14:29:16 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 12 Apr 2000 14:29:16 -0400
Subject: static attributes & __getattr__ override
In-Reply-To: <38f4b2e0@news.raccoon.com>
Message-ID: <1256558337-47149947@hypernet.com>

Vadim Suvorov wrote:

> I am trying to redefine class attributes access, to include static
> attributes definitions from class (shared by all class instances). It is ok
> for instance to shade class attribute. So I wrote
> 
> class MyClass:
>     var1 = 1
>     var2 = 2
>     def __init__(self, x3):
>         self.var3 = x3
> 
>     def __getattr__(self, name):
>         return self.__class__.__dict__.get(name, None)
> 
> MyObj = MyClass(3)
> print MyObj.var1, MyObj.var2, MyObj.var3, MyObj.var4
> 
> (expected result) >>> 1 2 3 None
> 
> It works fine for attributes. 

Are you sure? Did you realize that only MyObj.var4 invokes 
__getattr__?

> However, I can not access standard methods of
> MyClass. I resorted to define __str__ and __repr__ (to be able to 'print
> MyObj'), and even then I could not use MyObj <> None which really hurts me.
> 
> Can you advice me on best way to proceed, and explain briefly what is going
> on? I do not think it is a bug, I probably missing something in the way
> attributes/methods work.

"obj.var" is the same as "getattr(obj, 'var')". Where obj is of 
InstanceType, that involves looking in the instance __dict__, 
the obj.__class__.__dict__, and then a search of the 
__dict__s of obj.__class__.__bases__. Only if all of that fails 
is the __getattr__ method tried.

Methods normally live in obj.__class__.__dict__, or in the 
__dict__ of one of the classes in __bases__. The only 
difference between a variable and a method is that the getattr 
code, upon finding it, will magically wrap it up into a bound 
method (squirrelling away the "self" pointer where the code 
object can make use of it).

- Gordon



From effbot at telia.com  Tue Apr  4 11:53:09 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Tue, 04 Apr 2000 15:53:09 GMT
Subject: Python 1.6 alpha 1 released
References:  <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <8cca93$9oh$1@nnrp1.deja.com> 
Message-ID: 

Tres Seaver wrote:
> >not true.  the documented interface explicitly says that
> >there is one single argument.  it does not mention optional
> >arguments.
>
> Your insistence that the "documented interface" consists only of the
> description in the module reference, and not of the example on the next
> page or of the way the API is actually used in the standard libraries
> baffles me.

I thought I explained that in the next sentence:

> >(the example was broken, but so were other examples in earlier
> >releases of the documentation.  see other messages in this
> >thread for details)

> >> No Python module in the standard library uses the single-argument
> >> connect, period.
> >
> >*all* python modules in the 1.6 standard library use
> >single-argument socket connect.
>
> Invalid argument -- nobody depends on the 1.6 library yet.

umm.  if you plan to use the 1.5.2 standard library with 1.6,
you're in for some *serious* surprises...

> Here is a check from my (unfiddled) Python distro -- its the same on
Windows,
> too:

[only of few of the examples are socket.connect calls...]

> So don't tell me that the 1.5.2 library used one-argument connect().

didn't think I did.  I thought you told me that *all* connect
calls in the standard library used two arguments, but maybe
you didn't.  in either case, as you just noticed yourself, it
wasn't true.

> The append() change is hard to find, but fixes something that shouldn't
work.

why shouldn't that work?  after all, lots of sample code use that
form.  library code use that form (popular libraries like PIL, Medusa,
Zope, just to name a few).  books use that form.

and as I've said a million times, code using "append" is much harder
to fix, since "append" is 1) far more likely to be used in contexts
where a TypeError is expected, but for other reasons, and 2) often
used as a bound method in performance critical code.  the former
makes it hard to find this by running the code, the second makes
it hard to find it by grepping through the sources.

I suggest you dig up my list of "change cost" criterias, and apply
them to all non-compatible changes (possibly starting with 1.5.2's
class object change, which broke *lots* of code in really naughty
ways [1]).  I've done that, and I still think that "connect" is the
*least* critical of all code-breaking changes in the python core,
since 1.3 or so.

I still don't understand why others seem to think that this is the
most critical of them all, and nobody seem to be capable of ex-
plaining that to me.

(I guess some people will change their minds when other changes
in 1.6 causes their code to explode.  are you sure your code doesn't
use multi-argument appends, or expect str(1L) to include the L, or
expect certain operations to raise exceptions if given longs instead
of integers, etc.  and if you think you are, are you sure all non-std
libraries you depend on doesn't do that?  thought so ;-)

> In fact, I think one could make a reasonable case that the real bug here
> is in the API doc:  single-argument connect() is unintuitive for AF_INET
> sockets, and exists primarily to shoehorn orthagonality with AF_UNIX ones
> (where a default port argument would do just as well.)

if you look at the socket API a bit more carefully, you'll notice that
there are a number of functions in there which can *only* deal with
(host, port) tuples.  so in other words, it's internal API consistency
we're talking about here:  if someone returns an address, it's reason-
able to be able to pass it on to anyone expecting an address, no
matter what format the address structure happens to have.  heck,
the C socket API handles that, so why shouldn't Python do that too?

...

but who cares?  as just announced, 1.6 will support connect(host, port)
as a special case -- and it won't surprise me if it's gone again in 1.7.

until then, over and out.



1) stumbled upon one today: it turned out that by changing from 1.3
to 1.5.2, large data transfers from a high-performance server to clients
on an 10 Mbit Ethernet were unexpectedly terminated.  the same trans-
fers worked just fine with high-performance workstations, on an FDDI
network.  ten guru points to anyone who can explain why.




From aturner_ at _pobox.com  Sat Apr  1 13:21:13 2000
From: aturner_ at _pobox.com (Aaron Turner)
Date: Sat, 01 Apr 2000 10:21:13 -0800
Subject: Why should I switch to Python?
References: <00033120055300.03687@quadra.teleo.net>
Message-ID: 

In article <00033120055300.03687 at quadra.teleo.net>, Patrick Phalen  wrote:
> [Aaron Turner, on Fri, 31 Mar 2000]
> :: A friend of mine is trying to convince me we should 
> :: do a project using ORBit in Python.  I've been 
> :: coding Perl for over 3 years and really like it.  
> :: (Especially it's syntax and ability to grok my 
> :: programming style.)  Now, I understand the Perl
> :: vs. Python war and everyone has their preferred
> :: taste in the matter.  
> :: 
> :: What I'd like to hear from people is what technical 
> :: resons I should switch to Python.  Are there any 
> :: features that Python has (perhaps in it's OO 
> :: offering) that Perl lacks?  From what I can tell
> :: people tend to prefer Python over Perl mostly
> :: for its syntax, which I find very likable.
> 
> 
> Aaron,
> 
> Please see:
> 
> http://www.python.org/doc/Comparisons.html
> 
> http://www.perl.com/pub/language/versus/python.html
> 
> Plus a Google search on "perl vs python" should give you plenty more to
> chew on without reviving that tiresome thread here.
> 

Yeah, I found those before I posted (as well as reading the archives of
this group on deja news).   Honestly I found them for the
most part very lacking in technical information.  Mostly things like:

- Perl code is ugly, Python code is easy to read
- Python was OO from the start, Perl's OO was a bolt on

But things like this aren't particularly useful in trying to determine
which language gets the job done better.  Code readibilty has 
historically been a human problem which is solved with coding
standards set for the programmers IMHO.   So I'm more interested in 
things like:

- What is the impact of Python's OO being there from the start?
- Does it perform better?
- Is it significantly easier to use?  
- More powerful/support features that aren't in Perl yet?

Honestly the more I reasearch, the more it seems that it's purely 
a matter of taste.  If you like Perl, there's nothing inherient about
Python that makes it better.   Sorry if this just sounds like a troll, but
I'm really trying to get a feel about something I know nothing about 
from personal experiance.

Basically if you know both languages, and were planning a mid-sized 
project, why would you choose Python?  It's hard to take my friend
seriously in his evaluation when he says he'd rather do this project
in C++  than in Perl (especially when he doesn't know Perl).

Thank you for your patience.

-Aaron


From moshez at math.huji.ac.il  Fri Apr 28 01:12:09 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Fri, 28 Apr 2000 08:12:09 +0300 (IDT)
Subject: Metaclasses?
In-Reply-To: 
Message-ID: 

On Thu, 27 Apr 2000, GTE wrote:

> On the other hand I kinda like Visual Basic's 'with' construct. Consider:
> def method(self,arg1,arg2):
>     with self:
>         .spam = "spam"
>         .eggs = arg1+arg2

Here's a way to get almost that effect:

def method(self, arg1, arg2):
	_ = self
	_.spam = "spam"
	_.egss = arg1 + arg2

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From gmol at my-deja.com  Sat Apr 15 03:35:33 2000
From: gmol at my-deja.com (gmol at my-deja.com)
Date: Sat, 15 Apr 2000 07:35:33 GMT
Subject: General question of "SystemError:NULL result..."
Message-ID: <8d9645$fsa$1@nnrp1.deja.com>

Hi all, disclaimer, I am new to python so I may be doing something
severly stupid.

I have a problem, while it is with VTK, I was wondering if someone could
tell me if it is in fact a general one.

I have installed VTK and python on my sys,and some of the python
examples work, and some don't...the ones that don't say always say
something like:

  File "KSpline.py", line 106, in ?
    profileTubes.SetInput(profileData)
SystemError: NULL result without error in call_object

Now, no one has been able to figure this out on the VTK list...but I do
know that people can run the same examples on the same python under the
same platform (linux) and the same Mesa...

Has anyone ever had problems like this in another package; where some
examples do work (showing that is it not a problem about compilation
with shared suppourt or anything)? Could someone let me in on what I
could do to find out exactly what call is being made in the compiled lib
that is returning the NULL result?

Sigh, I realize this is a shot in the dark,but I am desparate and
someone knows whats going on :)


Sent via Deja.com http://www.deja.com/
Before you buy.


From JamesL at Lugoj.Com  Sat Apr  1 00:46:21 2000
From: JamesL at Lugoj.Com (James Logajan)
Date: Fri, 31 Mar 2000 21:46:21 -0800
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com> 
Message-ID: <38E58D2D.384F1546@Lugoj.Com>

Fredrik Lundh wrote:
> 
> Bjorn Pettersen  wrote:
> > Just read the announcement page, and found that socket.connect() no
> > longer takes two arguments as was previously documented.
> 
> note that the actual reference page says that connect takes
> just one argument, and it has done so since at least 1.4.
> 
> > A quick look shows that this breaks all the network scripts I have
> > installed (at least the ones that I found, undoubtedly there are many
> > more).  Because of this I will put any upgrade plans on hold.
> 
> were you really planning to *upgrade* to a rough alpha?
> 
> 

Sorry, but Bjorn Pettersen has a perfectly valid point. The copy of the
reference page that I have on hand at the moment (1.5b1) uses the word
"pair", not "tuple" and the example clearly shows a two argument call, not a
one argument call using a tuple. In the face of conflicting information in
the Python library reference manual (which has been significantly less than
perfect), I have tended to use examples as a guide. I should also note that
a quick check of some old code of mine indicates use of the two argument
form for connect. So you have at least two idiots who read the library
reference and still managed to do the wrong thing (and made it work; I
wonder how...). Worse, the idiot implementor of the connect interface
managed to support the same thing! I wonder who the third idiot is? I've
noticed the world is full of idiots like me and I bet there is a lot more
code out there that will break due to this.

Also, how good are you at math? You seem to feel that 5 minutes of "Guido
the god's" time is of much more value than that of 1000 knuckle-dragging
Neanderthal programmers like myself spending a mere 10 minutes each to make
sure their code doesn't break. Of course, if we happen to take more than 10
minutes its our own damn fault I'm sure you'll agree.

Now how did I get so pissed over this exchange of posts?


From olivier at phgroup.com  Tue Apr 18 03:41:25 2000
From: olivier at phgroup.com (Olivier Migeon)
Date: Tue, 18 Apr 2000 09:41:25 +0200
Subject: readline skips on line
References: <8culp8$23a$1@porthos.nl.uu.net>
Message-ID: <38FC11A5.627E1EA9@phgroup.com>

readline() actually reads a line and put the cursor at the beginning of the
next one each time you invoke it. And you invoke it in the loop.
I suggest:

f=open('test.txt','r')
while 1:
    mline=f.readline()
    if not mline : break
    print mline

> ----------------------------------Oo
>
> I got a part of a programm looking like this
>
> f=open('test.txt', 'r')
> while f.readline()!='':
>     print f.readline()
> print 'ready'
>
> but when it is runned, it wil print out the lines in the text file, but it
> skips all the the odd line, it only displays line 2,4,6,8,10 and further
>
> How can I solve this problem ?
>



 Sent via Deja.com http://www.deja.com/
 Before you buy.


From akuchlin at mems-exchange.org  Sat Apr 15 12:34:47 2000
From: akuchlin at mems-exchange.org (Andrew Kuchling)
Date: 15 Apr 2000 12:34:47 -0400
Subject: TCP/IP protocols
References: 
Message-ID: <3dn1mvb9w8.fsf@newcnri.cnri.reston.va.us>

"Jeff Massung"  writes:
> I'm new to Python programming, but am very experienced in C/C++. Could
> someone point me to a good reference for TCP/IP programming with Python
> (pdf, book, anything :]) thanks.

Try Gordon McMillan's HOWTO on socket programming:
http://www.python.org/doc/howto/sockets/

--amk


From lenny at squiggie.com  Mon Apr 10 13:35:42 2000
From: lenny at squiggie.com (Lenny Self)
Date: Mon, 10 Apr 2000 10:35:42 -0700
Subject: using httpdlib with a proxy server
Message-ID: 

I am attempting to write a small script that sends a list of URLs though a
proxy server and then records a bit of information on the respose.  I though
I could use the httplib module to help with this, however, I don't see where
it can send a request though a proxy server. Does anyone know of a module
that will allow me to do this?


    -- Lenny Self
        lenny at squiggie.com




From sabren at manifestation.com  Thu Apr 13 21:01:22 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Thu, 13 Apr 2000 21:01:22 -0400 (EDT)
Subject: IndexError and for x in list
Message-ID: 

Hey all,

Thanks everyone who helped with the indexed dictionary thing..

What I wanted to be able to do was simulate Evilsoft's "Collection"
concept from Visual Basic. Anyway, I have it working (and will release
the code soon as part of a larger project)... But..

I wanted to be able to do this:

idic = IdxDict()

for item in idic:
    print item


which should print the value, whereas:

for key in idic.keys():
    print key

would print the key.

The seqdict class on Parnassus couldn't do this, but the standard
UserList can... I thought this magical behavior might from
__getslice__ or even __len__ or count()... But it doesn't..

for x in list:
   print x


does something like this:


@@@ i = 0
@@@ while true:
@@@     try:
@@@         x = list[i]
@@@         print x
@@@     except IndexError:
@@@         break
@@@     i = i+1


So in order for my object to allow "for x in idic" I needed to
have __getitem__ raise an IndexError, like so:


    def _toStringKey(self, key):
        """Convert numeric keys into string keys. Leaves string keys as is"""
        # handle numeric keys:
        if _isNum(key):
            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 __getitem__(self, key):
        key = self._toStringKey(key)
        return self.data[key]



Anyway, aside from informing you all of some Python Trivia :), my
purpose in writing all this is to ask: where is this documented?
The docs for "for" say:

> When the items are exhausted (which is immediately when the sequence
> is empty), the suite in the else clause, if present, is executed, and
> the loop terminates

But it doesn't mention HOW it knows when the list is exhausted.

>From the library reference:

> IndexError
>
> Raised when a sequence subscript is out of range. (Slice indices are
> silently truncated to fall in the allowed range; if an index is not a
> plain integer, TypeError is raised.)

Does "for x in y" have a hidden slice in there?

Basically, I don't want to rely on an undocumented feature that could
go away sometime. Is IndexError the right way to simulate a list?


Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------




From lewst at yahoo.com  Wed Apr  5 00:41:54 2000
From: lewst at yahoo.com (lewst)
Date: Tue, 4 Apr 2000 21:41:54 -0700 (PDT)
Subject: Starving for an Advanced Python Book
Message-ID: <20000405044154.10369.qmail@web2103.mail.yahoo.com>

Don Tuttle  wrote:

> I went ahead and bought it because Oreilly's cheif editor says, "We're
> timing the new edition of Programming Python to follow shortly after the
> release of Python 2.0."(aka Python 3K).  If that turns out to be the case,
> it won't published until sometime in 2001.  See his complete (and somewhat
> dated) remarks at  http://www.oreilly.com/frank/python.html

Those remarks are misleading and should probably be removed.  I won't
disclose my source, but I'll you bet dollars to donuts that the 2nd
edition of PP will be out this summer -- much closer to the release of
Python 1.6 than P3K.


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com



From Lisowski.Tomasz at sssa.nospam.pl  Fri Apr  7 02:45:29 2000
From: Lisowski.Tomasz at sssa.nospam.pl (Tomek Lisowski)
Date: Fri, 07 Apr 2000 06:45:29 GMT
Subject: Odp: Odp: Python on Alpha OpenVMS
References:  <_KCD4.2797$a01.54385@news.tpnet.pl> 
Message-ID: 

U?ytkownik Ian Parker  w wiadomooci do grup dyskusyjnych
napisa?:ZRhvtDAzBR74EwzH at gol.com...
> In article <_KCD4.2797$a01.54385 at news.tpnet.pl>, Tomek Lisowski
>  writes
> >U?ytkownik Ian Parker  w wiadomo?ci do grup dyskusyjnych
> >napisa?:hDlBpKAS7T34Ew1e at gol.com...
> >> In article , Tomek Lisowski
> >>  writes
> >> >Hi!
> >> >
> >> >I have tried to compile Python sources on my VAX OpenVMS system, but
soon
> >I
> >> >realized, that instead of my trusty DEC C++ compiler I need a native C
> >> >compiler. Unfortunately my C++ compiler cannot be reverted to a native
C
> >> >language mode. Has anyone succeeded to create VAX OpenVMS Python
> >binaries?
> >> >
> >> >Note: Apart from VAX OpenVMS I have also an Alpha OpenVMS server, but
> >here I
> >> >don't have any C/C++ compiler available. If anyone has created Alpha
> >OpenVMS
> >> >Python binaries, please contact me too.
> >> >
> >> >Thanks in advance
> >> >
> >> >Tomasz Lisowski
> >> >
> >>
> >> Tomasz
> >>
> >> If you aren't planning changes to the source, why not just download and
> >> link the object modules from:
> >> http://decus.decus.de/~zessin/python/obj.html
> >>
> >> I'm so inspired by this solution, I'm at last downloading them myself.
> >
> >I am just not sure, for which platform were these modules compiled, and
for
> >which version of OpenVMS system. I suppose, there could be some
differences
> >between the OpenVMS versions. At least you can see them in the source
code,
> >where there are some #ifdef and #if directives concerning the OpenVMS
> >version string.
> >
> >Please report, if you succeeded in making your Python running properly,
> >including the platform and OS info.
> >
> >Regards
> >
> >Tomasz Lisowski
> >
>
> Tomasz
>
> I'm glad to say that the VMS objects worked perfectly on both Alpha and
> VAX VMS systems.  They're both V7.x - I didn't bother to check specific
> version numbers.  I'm planning to deploy to about 20 VMS Alpha and VAX
> boxes.  I even built a backup saveset of the resultant directory tree
> and a have a DCL script that does the VAX or Alpha assembly and linking
> on the target box - this keeps it very simple.   I may even go all the
> way and make a VMSINSTALL/PCSI kit.
>
> I'm really impressed with the OpenVMS port (Uwe, please keep up the good
> work!).  Only one qualification, at the moment I think the objects don't
> support threading, but haven't really investigated yet.

Good to hear that!

I will try too those object files, as I am using the same Open VMS version.
Thanks for the information





From aa8vb at yahoo.com  Mon Apr 17 08:57:33 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Mon, 17 Apr 2000 08:57:33 -0400
Subject: Imaging Library & Numerical Python
In-Reply-To: <38F883B6.A8ADF538@engineering.uiowa.edu>
References: <38F7F865.9C86399C@engineering.uiowa.edu>
 
 <38F883B6.A8ADF538@engineering.uiowa.edu>
Message-ID: <20000417085733.A301135@vislab.epa.gov>

Juerg Tschirren:
>
> Does anybody have experience with getting the Imaging Library and
> Numerical Python working together? What I would like to do is importing
> an imaging with the Imaging Library and then using functions from both
> -- the Imaging Library and Numerical Python -- on this image.

I just recently did some list searches on this.  Past posts indicate that
if you're careful about formats, you can use the tostring() and
fromstring() methods of each library to shuffle data back and forth between
the two extensions.

You can also push the data across one pixel at a time using
getpixel()/putpixel(), but it's very slow.

-- 
Randall Hopper
aa8vb at yahoo.com



From craniac at datapro.co.za  Sun Apr 30 11:09:52 2000
From: craniac at datapro.co.za (Steve Crane)
Date: Sun, 30 Apr 2000 17:09:52 +0200
Subject: Do I always have to write "self." ?
In-Reply-To: <300420001008012011%pecora@anvil.nrl.navy.mil>; from pecora@anvil.nrl.navy.mil on Sun, Apr 30, 2000 at 02:08:00PM +0000
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <8ecsgj$6lp$1@slb0.atl.mindspring.net>  <300420001008012011%pecora@anvil.nrl.navy.mil>
Message-ID: <20000430170952.A502@datapro.co.za>

On Sun, Apr 30, 2000 at 02:08:00PM +0000, Louis M. Pecora wrote:

> Isn't this called something like "Hungarian" variable naming?

Hungarian Notation was introduced by Charles Simonyi (who happened to
work for Microsoft).  In it's initial form it used a prefix to indicate
the data type of the variable but not the scope.  Later people started
to add a scope prefix but I don't think that Microsoft uses this as a
standard.

While it may seem to make code harder to read it is in fact very useful
when working on large projects involving may programmers.  However if
you're writing a program yourself and don't think that anyone else will
ever have to read the code you can probably steer clear of Hungarian
Notation in either form.

For an explanation of the notation by Charles Simonyi himself, see
http://msdn.microsoft.com/library/techart/hunganotat.htm.
-- 
Steve Crane
http://craniac.daveworld.org



From m.faassen at vet.uu.nl  Wed Apr 26 06:18:54 2000
From: m.faassen at vet.uu.nl (Martijn Faassen)
Date: 26 Apr 2000 10:18:54 GMT
Subject: Simple list.append() question
References:   <39046FA2.603EAFE5@roguewave.com>  <8e4akc$p7o$1@newshost.accu.uu.nl> 
Message-ID: <8e6fqe$f0q$1@newshost.accu.uu.nl>

[I spoil Kevin's fun]
Kevin Cazabon  wrote:
> Aw, comon, I was having fun... q:]

Oops, sorry to spoil your fun. :)

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


From g_will at cyberus.ca  Mon Apr 10 17:24:56 2000
From: g_will at cyberus.ca (Gordon Williams)
Date: Mon, 10 Apr 2000 21:24:56 GMT
Subject: Installer Producing Page Fault
References: <1256735085-36518465@hypernet.com>
Message-ID: <01bfa332$df04f6c0$5240c3d1@Cyberus>


Gordon McMillan  wrote in article
<1256735085-36518465 at hypernet.com>...
> Gordon Williams wrote:
> 
> > I am using Gordon's installer program to make a standalone program that
> > self installs.  After running the install_BS_main.exe created,
everything
> > is put into the proper directory (I think).  Then running BS_main.exe I
> > immediately get a crash with the following:
> 
> Never tried it myself, but I got this note once from Gary Herron:
> 
> > ** Numeric Python.  The 'import Numeric' statment imports _numpy.pyd,
> > but this is not caught by builder.py.  Add
> >   misc= C:\Program Files\Python\Numeric\_numpy.pyd
> > in the appropriate target of the cfg file.
> 

Yes that did the trick and it is now working.  The wxPython stuff was all
found (a bit to my supprise) but the serial IO module had a problem and
required a few extra lines in the .cfg file.

Thanks

Gordon


From gmcm at hypernet.com  Sat Apr 22 09:10:07 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Sat, 22 Apr 2000 09:10:07 -0400
Subject: The Simple Economics of Open Source
In-Reply-To: <22042000.3@sanctum.jae.ddns.org>
References: <39011EEF.4BAEC3C9@tcac.net> (message from Albert Wagner on Fri,	21 Apr 2000 22:39:27 -0500)
Message-ID: <1255713487-40391203@hypernet.com>

Juergen A. Erhard wrote:

>     Albert> Those with cooperative strategies have discovered that
>     Albert> there are an infinite number of pies.
> 
> Wrong.[1] They simply discovered (or, rather, understood) that there
> are enough pies so that *everyone* can be more than satiated ("Jeder
> kann sich bis zum Erbrechen den Bauch vollschlagen" I'd say in
> german).

> [1] The human-accessible part of this solar system is finite, right?
> So there simple cannot be an infinite number of pies, even if you
> could bake a pie out of one atom... ;-)

But you can grow more wheat and grow more apples and raise 
more cows and make more pies tomorrow.

"Infinite", in an economic context, simply means "more than 
what Bill Gates has" .

- Gordon



From python-list at teleo.net  Thu Apr 13 23:39:28 2000
From: python-list at teleo.net (Patrick Phalen)
Date: Thu, 13 Apr 2000 20:39:28 -0700
Subject: *total* newbie help
In-Reply-To: 
References: 
Message-ID: <00041321053602.02223@quadra.teleo.net>

[Collin Greene, on Thu, 13 Apr 2000]
:: I am new to to programming but it would seem to em that you could white some
:: code and then run it in a different action, does python ingrate these into
:: one action? I am just a little confused

Collin,

I'm a little confused too. When you say "write some code and then run it
in a different action," I think of several possible meanings. Maybe
you're talking about creating a function and then invoking it. Have you
read in the tutorial about functions?

How about giving us a more specific example of an action you have in
mind?

Or, since you're new to programming, I bet you'll find some useful
information here:
http://members.xoom.com/alan_gauld/tutor/tutindex.htm



From smalleys at gte.net  Sat Apr 15 13:48:21 2000
From: smalleys at gte.net (sue)
Date: Sat, 15 Apr 2000 17:48:21 GMT
Subject: Python and VTK and TK
References: <38F51AB1.29FB4C1D@earthlink.net> <38F528C8.2C18364F@gte.net> <38F7815C.57EC8A83@boi.hp.com>
Message-ID: <38F89D69.1CC83E26@gte.net>

Yes, I ended up reading header files for some things.  But
the speed and size tradeoff is very nice.

Sue.


From timo at iol32.com  Mon Apr  3 18:55:31 2000
From: timo at iol32.com (Tim Ottinger)
Date: Mon, 03 Apr 2000 22:55:31 GMT
Subject: Images (.bmp,.jpg,gif) in Tkinter windows (Tk newbie)
References: <38df6cfe.2185312@news.integrityonline.com> <8bo8gc$gic$1@nnrp1.deja.com>
Message-ID: <38e8dd4f.15889708@news.integrityonline.com>

On Mon, 27 Mar 2000 18:16:17 GMT, effbot at pythonware.com wrote:

>Tim Ottinger wrote:
>> I'm in Win32. I need an example (that works) of loading a graphical
>> image using Tkinter and python. Looking at the image and bitmap
>> options hasn't helped me, because I'm reading win32 .bmp files, not
>> xbm files. I'd like to read and display gifs, jpgs, and the like as
>> part of my Tkinter dialogs.
>
>native Tkinter supports GIF and PPM files (use the PhotoImage
>class to load them).
>
>   image = PhotoImage(file="myfile.gif")
>   widget.config(image=image)
>   widget.image = image # make sure to hang on to the image

Well, that would be okay, except that it doesn't actually display the
image on the screen (for me). Neither in '98 (boo) or 'NT (boo).

Tim


From mlh at idi.ntnu.no  Thu Apr  6 12:39:33 2000
From: mlh at idi.ntnu.no (Magnus Lie Hetland)
Date: Thu, 6 Apr 2000 18:39:33 +0200
Subject: NumPy modelling of Belief Tables?
Message-ID: <8ciem1$scb$1@kopp.stud.ntnu.no>

Hi!

I'm dabbling in Bayesian Networks at the moment, and have considered
implementing a system/framework in Python, using NymPy for the
Belief Table calculations... The calculations are quite simple, but I'm not
sure how I should do them all in Numeric Python...

In short, a Belief Table represents a discrete joint probability function
over
a set of variables, where each dimension of the table represents a variable,
and the indices of the dimension represent different values it may take.

When manipulating information in Bayesian Networks, you need to do some
operations on these tables. For instance, you may want to multiply them.
If the tables have the same dimensions (variables) then the standard NumPy
multiplication (i.e. *not* matrix multiplication) applies. Now that's
fine...
But if they *don't* have the same dimensions, then this won't work
directly...

If, for instance, the table t1 has the dimensions X and Y, while t2 has the
dimensions X and Z, then for each x, y, z in X, Y, X,

        (t1 * t2)[x,y,z] = t1[x,y] * t2[x,z].

This may be simple to do in NumPy (it is certainly easy to do
algorithmically) - I just can't see how...

Division is about the same thing, except that 0/0 = 0... For tables with the
same dimensions, I guess one could use something like

        t1 / where(equal(t2,0),1,t2)

where 1 is just an arbitrary value. (I'm not sure how this solution
generalizes when the dimensions differ...)

The other operation needed is marginalization of the tables. When a table
is marginalized over some of its dimensions, the elements having equal
coordinates in the remaining dimensions (i.e. the ones not being
marginalized
over) are added. For instance, if you have a two-dimensional table, t, over
the variables X and Y, and you want to marginalize out Y, then for each
x in X,

        m[x] = sum with x in Y { t[x,y] },

where m is the marginalized table.

If anyone finds these problems interesting, I would appreciate any hints
or solutions.

--

  Magnus
  Lie
  Hetland                            magnus @ hetland . org





From josht at iname.com  Fri Apr  7 21:03:40 2000
From: josht at iname.com (Josh Tompkins)
Date: Sat, 08 Apr 2000 01:03:40 GMT
Subject: Searching for Python Material...
References: <8F0ED18C1joshtinamecom@209.208.0.7> 
Message-ID: <8F0FD068Fjoshtinamecom@209.208.0.7>

Thanks for the reply...

I've got Learning Python on order at Barnes & Noble, and I'm finding some 
of the stuff at Parnassus informative.

Thanks again.

Josue
 
________________________________________________________________

"Destined For Great Things -- but pacing myself."
- From a t-shirt.

E-Mail:  josht at iname.com 
ICQ:  21219667
AIM:  JosueTheGreat
Web:  http://www.crosswinds.net/~josht
_________________________________________________________________


From mhammond at skippinet.com.au  Wed Apr 12 06:15:36 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Wed, 12 Apr 2000 10:15:36 GMT
Subject: Seg fault in Python/C API: PyString_FromString(NULL)
References: <38F422C5293.A67BYEMARTIN@smtp.garage.co.jp>
Message-ID: 

"Yves-Eric Martin"  wrote in message
news:38F422C5293.A67BYEMARTIN at smtp.garage.co.jp...

>     First, I am new to the Python/C API, so correct me if I am wrong:
> shouldn't PyString_FromString(NULL) return Py_None? Or am I out to
> lunch?

Nope - you must check for NULL before making the call.

Mark.





From noreply at antispam.com  Sat Apr  1 17:06:15 2000
From: noreply at antispam.com (Brian Schmidt)
Date: Sat, 01 Apr 2000 22:06:15 GMT
Subject: Why should I switch to Python?
References: 
Message-ID: 

Hi Aaron,

I don't know if anyone has pointed you to this yet, but here's a very nice
paper entitled "An empirical comparison of C, C++, Java, Perl, Python, Rexx
and Tcl ..." that I found to be very informative:
http://wwwipd.ira.uka.de/~prechelt/Biblio/jccpprtTR.pdf    (PDF format)

HTH,
Brian


"Aaron Turner"  wrote in message
news:seas5ia89177 at corp.supernews.com...
>
> A friend of mine is trying to convince me we should
> do a project using ORBit in Python.  I've been
> coding Perl for over 3 years and really like it.
> (Especially it's syntax and ability to grok my
> programming style.)  Now, I understand the Perl
> vs. Python war and everyone has their preferred
> taste in the matter.
>
> What I'd like to hear from people is what technical
> resons I should switch to Python.  Are there any
> features that Python has (perhaps in it's OO
> offering) that Perl lacks?  From what I can tell
> people tend to prefer Python over Perl mostly
> for its syntax, which I find very likable.
>
> Thanks.




From tom-main at REMOVEME.home.com  Thu Apr 13 18:26:11 2000
From: tom-main at REMOVEME.home.com (Tom)
Date: Thu, 13 Apr 2000 22:26:11 GMT
Subject: How do I undo an import??
Message-ID: <7QrJ4.185421$Hq3.4353581@news2.rdc1.on.home.com>

I'm a C++ programmer, new to Python, working with v1.5.2 on Windows.

I run the command-line interpreter, then I type:

>>> from NetCfg import *

to import my extension.  Now I want to unload my NetCfg DLL without exiting
the interpreter.  How do I do this?

Also, I type the above import command every time I start the interpreter.
Is there some way to get have this command executed automatically?

Thanks,

Tom.





From aahz at netcom.com  Sun Apr  2 13:18:24 2000
From: aahz at netcom.com (Aahz Maruch)
Date: 2 Apr 2000 17:18:24 GMT
Subject: Why should I switch to Python?
References: <00033120055300.03687@quadra.teleo.net> 
Message-ID: <8c7vd0$67o$1@slb0.atl.mindspring.net>

In article ,
Aaron Turner   wrote:
>
>Honestly the more I reasearch, the more it seems that it's purely 
>a matter of taste.  If you like Perl, there's nothing inherient about
>Python that makes it better.   Sorry if this just sounds like a troll, but
>I'm really trying to get a feel about something I know nothing about 
>from personal experiance.
>
>Basically if you know both languages, and were planning a mid-sized 
>project, why would you choose Python?  It's hard to take my friend
>seriously in his evaluation when he says he'd rather do this project
>in C++  than in Perl (especially when he doesn't know Perl).

As a person who has now used Perl and Python for roughly equal amounts
of time (more than a year), I think the most important distinction is
the way that Perl's TMTOWTDI destroys multi-person projects.  Not just
at the pretty-printing level, but all the way up to module layout and
general code design.

Perl is the result of attempting to make code "readable" by combining
the syntax and semantics of popular Unix utilities.  Python is the
result of attempting to make code readable by designing a language based
on real programming usability studies.  If you're already a Unix shell
hacker, Perl is likely to make you more immediately productive, but it
simply doesn't scale.  In all other cases, I think Python wins.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."


From dwhite2 at seas.upenn.edu  Fri Apr 14 19:26:35 2000
From: dwhite2 at seas.upenn.edu (dave white)
Date: Fri, 14 Apr 2000 19:26:35 -0400
Subject: Debugging with IDLE
Message-ID: <38F7A90A.5019937D@seas.upenn.edu>

Hello,

I'd like to debug a python script using IDLE.  The way my script is
written, it requires command like arguments when run -- e.g.  I run my
script on the command line by typing :

>python script.py input.txt

and 'input.txt' goes into sys.argv[1].  

Is there a way to provide a command line value to IDLE so that when I
run script.py, it will be evaluated with 'input.txt' in sys.argv[1]?

thanks,
david


From vetler at ifi.uio.no  Mon Apr  3 04:02:31 2000
From: vetler at ifi.uio.no (Vetle Roeim)
Date: 03 Apr 2000 10:02:31 +0200
Subject: Emacs Python mode
References:    <8c794n$mjq$1@zingo.tninet.se>
Message-ID: 

* Andr? Dahlqvist
> > all in all, *emacs* has lots of shortcuts for handy things. I wish I
> > knew more about it.. :)
> 
> While we're on the subject of Emacs Python mode, why is it that I can't 
> indent a line under a line which has been commanted out? Emacs 
> refuses to let me tab in there, but if I remove the comment it will happily 
> let me do it.

try writing:

def foobar(zot):
    print "and now for something completely different"
## this is a comment
    print "ni!"



vr


From hinsen at cnrs-orleans.fr  Wed Apr 19 05:40:50 2000
From: hinsen at cnrs-orleans.fr (Konrad Hinsen)
Date: 19 Apr 2000 11:40:50 +0200
Subject: Standard Makefile for embedding Python?
Message-ID: 

Is there anything similar to the standard Makefile for modules
(Misc/Makefile.pre.in) for making executables that embed Python?
Ideally with the option of adding built-in modules...

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------


From tim.hochberg at ieee.org  Tue Apr 25 10:01:59 2000
From: tim.hochberg at ieee.org (Tim Hochberg)
Date: Tue, 25 Apr 2000 14:01:59 GMT
Subject: Simple list.append() question
References:  <0CF260C495FED111A6610000F866308D0D893596@mail3.ntu.edu.sg>
Message-ID: 

For those who _need_ a one-liner, the following works:

map(list, [()]*3)

as does

map(list, [[]]*3)

and

map(copy.copy, [[]]*3)


-tim





From yawyi at gmx.de  Tue Apr  4 19:45:38 2000
From: yawyi at gmx.de (Johannes Stezenbach)
Date: Wed, 5 Apr 2000 01:45:38 +0200
Subject: ldap support?
References: 
Message-ID: <38ea8c40$0$28633@personalnews.de.uu.net>

oliver  wrote:
>I wonder is there any standard LDAP support module in python? I looked up
>SIGs, doesn't show anything there. I appreciate your help.

SuSE Linux (6.3) comes with a python ldap module written by
David Leonard and downloadable from
http://www.csee.uq.edu.au/~leonard/dc-prj/ldapmodule/
It works with OpenLDAP (www.openldap.org).
See http://www.web2ldap.de/ for example usage.



From mhammond at skippinet.com.au  Sat Apr  1 06:49:47 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Sat, 01 Apr 2000 11:49:47 GMT
Subject: arraymodule questions
References: <8c4iqv$2na$1@nntp9.atl.mindspring.net>
Message-ID: 

> So my questions are about changes for Python 1.6:
>   1) would it be okay to make the arrayobject C API available?
>   2) could I add the .append optimizations mentioned above?
>   3) should I also add the code to preallocated space?

How about if we better expose a "buffer" object.  There is a
Python C API for a new read-write buffer object, but it is not
exposed to Python code.

It is basically a fixed array("c"), and supports all slicing and
assignment operations.  The difference from an array object is
that its size is fixed, but that can sometimes be a bonus.

I wouldnt mind seeing the builtin buffer() function check for an
integer argument, and have it return a read-write buffer object
of that size.

eg:
buffer(string_object) now returns a read-only buffer into the
string object.  As buffer(10) doesnt make sense in that context,
buffer(10) could return a read-write buffer of size 10.

>From you description, this would be an alternative solution?

Mark.




From arthur.haas at westgeo.com  Thu Apr 27 18:35:46 2000
From: arthur.haas at westgeo.com (Art Haas)
Date: 27 Apr 2000 17:35:46 -0500
Subject: Newbie Question
References: 
Message-ID: 

"Arnaldo Riquelme"  writes:

> Suppose I have a file name tick.tkr that looks like this
> 
> SUNW.
> MFST.
> FOO.
> SPAM.
> MOO.
> End_Of_File
> 
> I want to read the file into a list
> 
> myfile = open("tick.tkr", "r")
> mylist = myfile.readlines()
> 
> Now I have mylist with the contents of tick.tkr. "mylist" looks like this
> ['SUNW.\012', 'MSFT.\012', ..........'End_of_File/012']
> 
> How do I read the file into a list without getting the newline character, so
> I can accomplish this
> 


> for tic in mylist:
>     #create file tic.prn
> 
> I know the other P language has something like 'chop' or something like
> that, but I'm not going there.

In the other `P' language you'd probably use chomp() ...

my $file = 'tick.tkr';
open(TICK,"<$file") || die "Can't open '$file'! $!\n"
chomp(my @lines = );
close(TICK);

In python ...

>>> import string
>>> myfile = open("tick.tkr", "r")
>>> mylist = map(string.strip, myfiles.readlines())
>>> myfile.close()
>>> mylist
['SUNW.', 'MFST.', 'FOO.', 'SPAM.', 'MOO.']
>>>

-- 
###############################
# Art Haas
# (713) 689-2417
###############################


From mpetroni at my-deja.com  Fri Apr  7 04:52:07 2000
From: mpetroni at my-deja.com (mpetroni at my-deja.com)
Date: Fri, 07 Apr 2000 08:52:07 GMT
Subject: Determining Classname of an object
References: <8ccbk4$b6p$1@nnrp1.deja.com> <38E9F7C0.54899FE4@camelot-it.com>
Message-ID: <8ck7ji$20s$1@nnrp1.deja.com>

In article <38E9F7C0.54899FE4 at camelot-it.com>,
  Michael Tiomkin  wrote:
> a.__class__.__name__
>
> mpetroni at my-deja.com wrote:
> >
> > Is there a way to find out from which class an object has been
created?
>

yope, thanx, got it!


Sent via Deja.com http://www.deja.com/
Before you buy.


From quinn at drachma.ugcs.caltech.edu  Sun Apr 16 13:13:47 2000
From: quinn at drachma.ugcs.caltech.edu (Quinn Dunkan)
Date: 16 Apr 2000 17:13:47 GMT
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>    <38F9F01B.57273052@tismer.com>
Message-ID: 

>> - Even so, Chris and I agree that continuations should eventually
>>   be completely hidden from the user, since it's so incredibly
>>   obscure, hardly anyone will understand it. Not good for CP4E ;-)
>
>Today I'm saying so. But I think there will come a time
>where people are told "look, a continuation is as simple as 1+1",
>and they'll say "sure? I thought a co is simpler."

I'm not sure I understand correctly, but does "completely hidden from the
user" mean "only visible (in the "raw" form) from C"?  In that case, I think
it should still be visible from python.

I don't see how it's different from metaclasses or the "new" module:  just
put big red stickers on it.  It'd be nice to have around for people who want
to experiment, write obfuscated code, or maybe even write a useful
continuation-using extension.  I don't think there's much trouble with people
abusing the Beaudry hook to explode anyone's head other than their own.


From sabren at manifestation.com  Thu Apr 27 17:49:21 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Thu, 27 Apr 2000 17:49:21 -0400 (EDT)
Subject: web site test framework? in python?
In-Reply-To: <8e9uor$eaa$1@nnrp1.deja.com>
Message-ID: 

On Thu, 27 Apr 2000 tiddlerdeja at my-deja.com wrote:

> I'd also like to code the testing framework in Python.
> 
> Again, has anyone any experience in this testing websites arena?

Well, there's http://pyunit.sourceforge.net/ .. I't s a pretty good
test suite manager.


> I was thinking of having JSP or ASP pages check for a testing variable
> (registry or environment). If pages were called in test mode they would
> return XML to be parsed which would can then be used as input data to
> call the page again (this way you could store the test data with the
> page you are testing). The XML would also contain the desired correct
> data to check against to ensure the page is working correctly.

Perhaps you should stick all this code in an object so you don't have
to complicate your tests by communicating via http. You can set it
up so you just pass objects around..

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------




From matsaleh at my-deja.com  Sat Apr 22 16:52:55 2000
From: matsaleh at my-deja.com (matsaleh at my-deja.com)
Date: Sat, 22 Apr 2000 20:52:55 GMT
Subject: pickle.py and cPickle.c - persistent_id() is always called - why?
Message-ID: <8dt3f2$r0v$1@nnrp1.deja.com>

Hello fellow .py types...

I am doing a bit of work using pickle/cpickle and am trying to
optimize. I found that my user-defined persistent_id() function is
being called for (just about) every attribute (name and value) in my
object that is being pickled.

My specific (somewhat ad-hoc) test case pickles ~100 objects in a
containment hierarchy, using persistent_id to break the containment
relationship and replace the references with a proprietary object id.
Although I have only ~100 object references to resolve, persistent_id()
is called ~6400 times. In tracing the code, it appears to be called for
every attribute and value in my objects.

This appears to be caused by the fact that pickle.py:save() is called
with the default pers_save flag of 0 in all cases except for when it is
called by save_pers(). This appears to indicate that all types: tuples,
dicts, sequences, longs, strings, etc, cause my persistent_id() to be
called, when all I want is for it to be called for object instances.

I modified pickle.py to change the default of the pers_save flag to 1
in the save() method, and then call it with a 0 only from within the
save_inst() method. This amounts to invoking my persistent_id()
function only when a reference to an object instance is encountered as
my objects are being pickled.

My pickled objects do not appear to be adversely  affected by this
change, and the number of calls to persistent_id() was reduced from
~6400 to ~500, reducing the time spent in this method by an order of
magnitude (0.37 sec to 0.03 sec).

I have not yet tested this change in cPickle.c, but in my original
tests, persistent_id() was a much more significant factor in my runs
using cPickle, because all the pickling code is in C and is relatively
much faster than my persistent_id() method, which is in Python. I
expect the performance boost my making the change in cPickle to be even
greater, relatively speaking.

My question is, why is persistent_id() being invoked so often? I do not
see the reason for calling it for basic python types and structures
such as tuples, dicts, and the like. Is this a reasonable change to
make to the python source, or is it not a safe change for the general
pickling cases that the pickle/cPickle modules have to handle? I'm sure
this code has been scruitinized by many folks much more experienced
than I - I would be grateful for your insights.

Regards.



Sent via Deja.com http://www.deja.com/
Before you buy.


From mjhand at concentric.net  Tue Apr 18 10:42:02 2000
From: mjhand at concentric.net (Manus Hand)
Date: Tue, 18 Apr 2000 08:42:02 -0600
Subject: Upgrading IIS to 1.6 problem....
References: <2B1262E83448D211AE4B00A0C9D61B03BA72C9@MSGEURO1>
Message-ID: <38FC743A.86008959@concentric.net>

Thanks, Pieter!

That was indeed the problem.  My IIS Mgr settings still had the 1.5.2
installation listed.  (Makes me wonder how important the registry
setting is in NT.)

Manus




From root at sirius.ftsm.ukm.my  Mon Apr 10 05:41:03 2000
From: root at sirius.ftsm.ukm.my (root)
Date: Mon, 10 Apr 2000 17:41:03 +0800
Subject: statistic on python (Rpy)
In-Reply-To: <20000410084948.7D7D01CDE1@dinsdale.python.org>; from python-list-request@python.org on Mon, Apr 10, 2000 at 04:49:48AM -0400
References: <20000410084948.7D7D01CDE1@dinsdale.python.org>
Message-ID: <20000410174103.A3558@sirius.ftsm.ukm.my>

hai,

/* I am not an expert on C or python, but know enough to make my way around C
 * programs. This is very preliminary, and is primary to generate interest.
 */
 
currently there is not much support for doing statistical computing on
python (distributions, random numbers ). as an experiment, I took R src
code, (http://www.r-project.org),(R is  a computer language for doing
statistic , based heavily on S and Scheme), hack a bit and use SWIG to
implement the basic statistical distributions as python modules.

after a few days, I finally able to build a python module consist of basic
distributions. (the distributions computing is wrote in C)

my opinion is that, I would nice to port R statistical engine into python
module, and the user could use python as the front-end for statistical
programming. anybody willing to try this? this would greatly complement
Numpy, and help establish python as a computing platform.

R also have graphical interface.

Some interesting notes;

1. the basic distributions computation is in C, this can be imported into
      Python as module. however, the C src is a bit difficult to follow. I
      have to resort to try-and-error to finally get the module done.

2. the graphic is nice, not sure how port this to python.

3. some function is based on lapack. use in linear aljebra.

4. there quite a lot of R specific code that you have to consider in making
     the module. this is hard an time consuming.

5. most statistical function is writing in S, it is probably possible to do
     R2Py. Some of them are straight forward, and can be reimplemented using
     Numpy.

zamri



From thomas at xs4all.net  Sun Apr 30 06:15:44 2000
From: thomas at xs4all.net (Thomas Wouters)
Date: Sun, 30 Apr 2000 12:15:44 +0200
Subject: How do I make list global please?
In-Reply-To: ; from cmfinlay@SPAMmagnet.com.au on Sun, Apr 30, 2000 at 07:42:59PM +1000
References: 
Message-ID: <20000430121544.M11481@xs4all.nl>

On Sun, Apr 30, 2000 at 07:42:59PM +1000, cmfinlay at SPAMmagnet.com.au wrote:
> How do I make list global please?
> 
> I have a list which comprise of mags[0] and mags[1]
> I want to pass and return it from a subroutine.
> my code is (in two text files)
> 
> 
> from inittest import InitTest
> mags = [333]
> mags.remove(333)
> mags.append(0) # (Big) array of magnets
> mags.append(1) # (Big) array of magnets
> print mags[0]
> print mags[1]
> InitTest()
> print mags[0]
> print mags[1]
> 
> # file :inittest.py
> def InitTest():
>    global mags
>    print "I am in the Sub"
>    Print mags[0]
>    Print mags[1]
>    print "Leaving Sub"
>    return
> 
> I get the error message
> QUOTE
> Traceback (innermost last):
>   File "inittest1.py", line 1, in ?
>     from inittest import InitTest
>   File "inittest.py", line 5
>     Print mags[0]
> SyntaxError: invalid syntax

You actually have 2 problems: One is typing 'Print' instead of 'print';
Python is case-sensitive, which causes the SyntaxError message you see. The
other problem is your real problem, you dont define 'mags' anywhere in your
inittest.py file. The 'global' statement doesn't do what you expect it to do
(it makes the variables global even if you assign to them. Normally
variables you assign to are always local, whereas variables you only read
from are read globally only if they dont exist locally.)

Your problem is not that 'mags' is global, not local, but that 'mags' is
undefined completely. The 'inittest.py' file doesn't know what it should be,
where it should come from, etc. You can do two things: in inittest.py,
import the first file (which creates a circular dependancy, never a good
thing) or (much better) pass InitTest the list to work on, like so:

from inittest import InitTest
mags = [333]
mags.remove(333)
mags.append(0) # (Big) array of magnets
mags.append(1) # (Big) array of magnets
print mags[0]
print mags[1]
InitTest(mags)
print mags[0]
print mags[1]

# file :inittest.py
def InitTest(mags):
    print "I am in the Sub"
    Print mags[0]
    Print mags[1]
    print "Leaving Sub"
    return

You can change the name of 'mags' in the 2nd file, of course.

> my code works when it is all in the main routine.

Yes, it would (barring the Print/print thing) -- but you wouldn't need the
'global' statement, as you dont assign to mags, you only modify mags.

-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



From tom-main at REMOVEME.home.com  Thu Apr 13 22:23:19 2000
From: tom-main at REMOVEME.home.com (Tom)
Date: Fri, 14 Apr 2000 02:23:19 GMT
Subject: How do I undo an import??
References: <7QrJ4.185421$Hq3.4353581@news2.rdc1.on.home.com>  <6dvJ4.186934$Hq3.4382652@news2.rdc1.on.home.com>
Message-ID: 

I had given my startup file the same name as my extension ... so it was
finding itself.

Tom.

"Tom"  wrote in message
news:6dvJ4.186934$Hq3.4382652 at news2.rdc1.on.home.com...
> I tried the environment variable as you suggested, pointing to a file
> containing the following:
>
> print "about to ... from NetCfg import *"
> from NetCfg import *
>
> This partially works.  Now, when I run the python shell I see the printed
> text twice, but the functions in NetCfg aren't added to the namespace.
>
> Tom.
>
> "Michael Hudson"  wrote in message
> news:m3d7nthbbj.fsf at atrus.jesus.cam.ac.uk...
> > "Tom"  writes:
> >
> > > I'm a C++ programmer, new to Python, working with v1.5.2 on Windows.
> > >
> > > I run the command-line interpreter, then I type:
> > >
> > > >>> from NetCfg import *
> > >
> > > to import my extension.  Now I want to unload my NetCfg DLL without
> exiting
> > > the interpreter.  How do I do this?
> >
> > You don't, in general.
> >
> > del sys.modules['NetCfg']
> >
> > goes some of the way, but it's unlikely it goes far enough to let the
> > dll be unloaded from memory.
> >
> > > Also, I type the above import command every time I start the
> interpreter.
> > > Is there some way to get have this command executed automatically?
> >
> > Set the environment variable "PYTHONSTARTUP" to point to a file
> > containing commands you want executed.
> >
> > At least, that's what I do on Linux.
> >
> > 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 m.faassen at vet.uu.nl  Mon Apr 10 18:30:29 2000
From: m.faassen at vet.uu.nl (Martijn Faassen)
Date: 10 Apr 2000 22:30:29 GMT
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <3H4I4.709$4w1.17557@typhoon.nyroc.rr.com> <8cs3ho$l06$1@pegasus.csx.cam.ac.uk>  <8ctc9m$sp2$1@pegasus.csx.cam.ac.uk>
Message-ID: <8ctkm5$bko$2@newshost.accu.uu.nl>

Nick Maclaren  wrote:
[if your function gets longer than a screenfull, it's time to start
thinking about splitting it up]

> It really is quite amusing to see these same old myths coming back
> every few decades :-)

You think splitting a function up is a myth? I find it helps 
me and my code. It becomes more readable and writeable. I'm genuinely
surprised by your assertion this is an 'old myth'.

> That particular dogma was very popular back in the late 1960s and
> early 1970s, when practical programmers pointed out that it was a
> virtually impossibility for a normal person to keep track of 50
> trivial functions in their head, but it was quite easy to look
> at 60 lines of sequential code.  That didn't get listened to
> then, either!

Of course if you go about randomly chopping up your function into
multiple ones, that's not going to improve matters. The idea is
to conceptually split your function into multiple smaller ones
that make more sense, are more easy to adapt, are coherent by 
themselves, and make the original big function more readable, as
by writing all the smaller functions you've hopefully also given
them names. It's called refactoring, of course. :)

My guidelines are:

If your function is long and complicated, too many concepts
and abstractions are mingling in the same place. Do a better job
of abstracting stuff, and you'll end up with shorter, clearer
functions.

If your function is long and repetitive, you're not being a lazy
enough programmer. Write some smaller functions that generate the
stuff, read it from a file or database, whatever.

If your function is long and simple..do these happen? They don't seem
to happen in my code. Then again, my "this is complicated" reflex is
triggered pretty quickly; I'm just not too smart. :)

Are you saying these guidelines are based on a myth?

[snip]
> My current infliction is a accounting file format, and the the
> function to check the input (you DO check your input, don't you?)
> needs to perform 100 tests in series.  Yes, I am inventing
> trivial functions, but it would be clearer to put more of the
> tests inline.

Why not split this up into a bunch of validation objects or 
something, and then check the input that way? And aren't at least
some of these tests similar enough to abstract into a function
(such as tests for maximum various lengths of strings). Of course
the accounting file format may be so baroque your function just
has to be baroque, but that sort of thing *ought* to be rare. :)

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


From Gareth.McCaughan at pobox.com  Wed Apr  5 14:59:47 2000
From: Gareth.McCaughan at pobox.com (Gareth McCaughan)
Date: 05 Apr 2000 19:59:47 +0100
Subject: Why should I switch to Python?
References: <000701bf9c5a$b806b420$752d153f@tim>
	
	
	
	<050420000914595917%pecora@anvil.nrl.navy.mil>
	
	
Message-ID: <867lec74rg.fsf@g.local>

Michael Hudson wrote:

>  - mind you "Riemann zeta function" is a pretty cool name for
> any function.  I also like "Weierstrass p-function", but mainly
> because the p is usually drawn in an entertainly deranged way.

Which, incidentally, Weierstrass himself invented.

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction


From robin at jessikat.demon.co.uk  Fri Apr 21 09:43:20 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Fri, 21 Apr 2000 14:43:20 +0100
Subject: IDLE patch to use py2pdf
Message-ID: 

A minimal patch to allow the latest CVS idle to use Dinu Gherman's
py2pdf for printing is available at ftp://ftp.reportlab.com/idle.pat;
this patch hasn't been thoroughly tested yet, but I would like some
input on all the problems. 

After applying the patch using

cd idle
patch -p1 

> I have a Library written in C with its Headerfiles but without the
> Sourcecode.
> Does anybody know an easy way to extend Python with this Library?
> 

Sure -- it's no different than adding hooks for the Win32 stuff or
whatnot.  Just create a new Python C extension module with an API
corresponding to the interesting pieces of the header file you have.

Then your C-extension is just a jump-off point where Python objects
come in, you convert them to whatever the C-library needs, and you
provide a valid Python-style return type.

Review the examples in the source code for details, or see Mark Lutz's
"Programming Python" book.

Regards,

-Brent



From gmcm at hypernet.com  Thu Apr 27 23:57:08 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Thu, 27 Apr 2000 23:57:08 -0400
Subject: The Simple Economics of Open Source
In-Reply-To: 
References: <1255272357-66924550@hypernet.com>
Message-ID: <1255228265-1994958@hypernet.com>

Raffael Cavallaro wrote:

[I wrote]
> > The closed source world is based on a diseased model
> > (pretending software is a product).
> 
> This "diseased model" has made billions for a number of firms,
> so, from an economic standpoint, your argument rings rather
> hollow, especially when compared to numerous open source ventures
> which have yet to post a cent of profit.

So has bashing people over the head and taking all their 
money. And many proprietary ventures have yet to make a 
cent of profit (like all those dot coms with ridiculous stock 
prices).

> 
> > Scarcity of an intellectual secret may make a software
> > package containing that secret more valuable, but scarcity of a
> > software package is likely to make it less valuable (since
> > support will be hard to find, and upgrades unlikely). OTOH it's
> > scarcity of a piece of artwork that makes it valuable.
> 
> You're conflating separate markets. Unique artworks (paintings,
> for example) have no real equivalent in the software world,
> because software sales are based on essentially unlimited
> identical copies.

'Twas your analogy.
 
> My example referred to IP in the art world - secret working
> methods that allowed artists to produce works their
> contemporaries could not - methods of bronze casting, for
> example, or formulas for oil painting media. These IPs are like
> closed source in that, without them, competitors are shut out of
> a lucrative market.

There's very little of that in code. The question "how do they 
do that?" is rarely unanswered for longer than a few months.
 
> My point was, and is, that it makes no economic sense to open
> source an IP that could be used to create a monopoly. MS
> understands this, and works ceaslessly to create such monopolies.
> Note that this has *nothing whatsoever* to do with what is best
> for consumers. 

You really think MS's "monopoly" is based on IP?

> I think part of the open source community's problem is this naive
> belief that just because a certain model (open source) leads to
> products that benefit consumers more, markets will allow
> consumers to choose this production model. This belief is naive
> because it fails to consider that the producers' interests are in
> no way congruent with the consumer's.

An indicator that the model is diseased.

> The producer has every
> reason to go closed source and attempt to secure a quick
> monopoly. We live in this world now, and there's no reason to
> believe that it's going to go away any time soon. I think open
> source advocates grossly underestimate the power of monopolies,
> and the unwillingness of consumers to break ranks even though it
> *may* provide long term benefits, because breaking ranks entails
> large short term costs, especially in network utility - i.e., the
> loss of interoperability with the rest of the monopolist's
> customers.

They are not "monopolies". They are large companies with a 
lot of money, salesman, distribution channels, lawyers and 
programmers. The competition has quite a few programmer, 
and just started to get a little money.

If instead of analyzing profits you looked at market share, in 
the area of web servers at least, you would have to draw the 
opposite conclusion.
 
> BTW, all software is *not* support. This is another open source
> community bias which comes from living in the server room. Lots
> of software is *client* software, which requires little or no
> support from the vendor. 

And client software is often free. Where software has client 
and server, the money's all made from the server. If the 
vendor's smart, they'll open up the client side so they won't 
have to waste time developing it.

> Instead, these support services are
> provided by full time IT people, who may be certified by the
> vendor, but who are paid by the enterprise. In other words, MS
> makes their money on enterprise licences for Office, not for
> troubleshooting the enterprise's problems with Office.

Bzzt. A 10,000 seat license complains that X is broken, X will 
get fixed. (And when enterprise learns that Y requires only 
50% the support costs, they will switch.)

>  For the
> most lucrative software businesses, software *is* a product, not
> a service.

No. The only thing they share is that they both require 
investment, as does almost anything else.

Congress does not understand software. Lawyers and judges 
do not. Most businesses do not. Most people do not. The 
world has never before encountered anything with a 
vanishingly small marginal cost of production, but something 
that has so much "value".

Software companies adopted the "product" model. The fact 
that some of them make money does not make the model 
sane. It just means software can be lucrative.

In fact, let's compare Apple and MS. Apple could be where 
MS is now, but Steve Jobs repeatedly insisted on shutting out 
the competition, keeping developers ignorant and making 
them pay. MS, believe it or not, gives away a great deal. 
Anybody can browse all the MSDN docs. If you buy MSVC, 
you have the source to the c runtime library. MS publishes 
large amounts of specs. Yes, they usually withhold something 
- about a six month to one year lead on the market. IP in this 
market has a very short shelf life.

They're commanding position has nothing to do with IP. Most 
of the maybe-almost-original things they've done (ODBC and 
COM) are pretty thoroughly documented. Their success is due 
to business practices that are common in, say, the food 
industry or the mega-store segment, but are (rightfully) 
considered evil in the software market.

The open source model(s) will almost certainly require 
adjustment - they are mostly a reflection of the fact that the 
current model is warped. But the big boys are dinosaurs. They 
will change their models, or die (Bill won't make it, but neither 
will Scott or Larry).

But before things become sane, people will have to figure out 
a "sale" is; and we're nowhere close to that :-(.

- Gordon



From richard_chamberlain at ntlworld.com  Wed Apr 19 06:51:20 2000
From: richard_chamberlain at ntlworld.com (Richard Chamberlain)
Date: Wed, 19 Apr 2000 11:51:20 +0100
Subject: testing true condition
References: 
Message-ID: <8dk337$349$1@gxsn.com>

You could use something like this:

file=open("test.txt","r")
for line in file.readlines():
    print line

Richard


"Gregoire Welraeds"  wrote in message
news:Pine.BSF.4.10.10004191138390.292-100000 at hercule.perceval.be...
> Hi,
>
> I know that I can't do something like the following:
>
> >>> while (line= f.readline()):
> ...
>
> as i could in C.  Is there any replacement tricks ?
> I know that I could use something with f.read() but i don't want to have
> the file completly loaded in memory
>
> Best regards,
>
> --
> Life is not fair
> But the root password helps
> --
>
> Gregoire Welraeds
> greg at perceval.be
> Perceval Development team
> --------------------------------------------------------------------------
-----
> Perceval Technologies sa/nv Tel: +32-2-6409194
> Rue Tenbosch, 9 Fax: +32-2-6403154
> B-1000 Brussels general information:   info at perceval.net
> BELGIUM technical information: helpdesk at perceval.net
> URL: http://www.perceval.be/
> --------------------------------------------------------------------------
-----
>
>




From tjg at avalongroup.net  Mon Apr  3 16:53:17 2000
From: tjg at avalongroup.net (Timothy Grant)
Date: Mon, 03 Apr 2000 13:53:17 -0700
Subject: calendar.py
References: <38E901BB.A41CEB25@rtpro.net>
Message-ID: <38E904BD.BD0274F9@exceptionalminds.com>

Tesla Coil wrote:
> 
> Who maintains calendar.py?  I'd like to propose inclusion
> of functions to facilitate such calculations as "what will the
> date be in 45 days," or "print dates for twelve 28 day cycles
> beginning from 3/1/2000."   Excuse the undercooked code,
> but something like the following:

Not directly on point, but you might like to look at M.-A. Lemburg's
mxDateTime module which--I believe--does exactly what you are looking
for.

-- 
Stand Fast,
    tjg.

Timothy Grant                         tjg at exceptionalminds.com
Chief Technology Officer              www.exceptionalminds.com
Red Hat Certified Engineer                      (503) 246-3630
Avalon Technology Group, Inc.              fax  (503) 246-3124
>>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<<



From hschroeder at gmx.net  Sun Apr 30 12:05:45 2000
From: hschroeder at gmx.net (Henning Schroeder)
Date: Sun, 30 Apr 2000 18:05:45 +0200
Subject: [Announce] BoboMail 0.3 - a webmailer
Message-ID: <390C59D9.797EFAEC@gmx.net>

Hi,
I'm pleased to announce:

BoboMail Version 0.3
====================

BoboMail is a so-called webmail application using Zope's ZPublisher and
ZTemplates. It provides mail access through a web interface and is 
distributed under the GNU GPL.

Current features:
 * read, write, reply, forward and delete messages
 * direct support for the following MIME types:
   message/rfc822, message/delivery-status, multipart/alternative,
   multipart/mixed, multipart/report, multipart/related,
   text/plain, text/html, text/x-vcard, image/jpeg, 
   image/png, image/x-xpixmap, image/gif
 * works with POP3-servers
 * easy to modify and to customize through HTML-templates
 * modular design provides easy interface for other authentication
   methods and mail protocols
 * provides optionally its own fast multithreading webserver
(BoboMailHTTPD)
 * multi-lingual support (i18n) - currently English and German

For more information go to http://bobomail.sourceforge.net

Call for help: Can anyone help to improve the speed by making a Python-C
module
for a RFC822-/MIME-parser with Swig (e.g. of the c-client library) ?

  Henning





From emile at fenx.com  Wed Apr 12 06:02:13 2000
From: emile at fenx.com (Emile van Sebille)
Date: Wed, 12 Apr 2000 03:02:13 -0700
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <87og7fopvs.fsf@ifm.uni-kiel.de>
Message-ID: <003401bfa466$2f5e6c80$01ffffc0@worldnet.att.net>

Nice utility Janko.  Thank-you.

For anyone interested, here are the diffs I threw at this
for use on my Win95 system:

Compare: (<)D:\Program Files\Python\Lib\Fenx\Lib\docindex.py (12132l
bytes)
   with: (>)D:\Program Files\Python\temp.py (12063l bytes)

51c51
< pager = None # 'less'
---
> pager = 'less'
318,321c318
<    try:
<     self.docdb = os.path.join(os.environ['HOME'],'.ipphelp')
<    except:
<     self.docdb = os.path.join(os.environ['TMP'],'.ipphelp')
---
>    self.docdb = os.path.join(os.environ['HOME'],'.ipphelp')
421c418,422
<  help = docreader((r'D:\Program Files\Python\Doc_1.5.2\lib',))
---
>  help = docreader(('/home/user/Doc/html/NumPy/',
>        '/home/user/PYHTML/lib/'))
>
>  help('round')
>
423,425d424
<  help('round')
<
<


Emile van Sebille
emile at fenx.com
-------------------


----- Original Message -----
From: Janko Hauser 
Newsgroups: comp.lang.python
To: 
Sent: Tuesday, April 11, 2000 10:21 PM
Subject: Re: Python/Perl Popularity (Re: A Mountain of Perl...)


> Use docindex.py!
>
> This module is definetly no substitute for perldoc but a start that
> answers your question. It gets the relevant information from the html
> tree which needs to be installed on your system.
>
> A benefit over docstrings is, that one does not need to import a
> module. This is a prototype, but shows that it is possible. Not that
> this will change your mind about Python :-)
>
> HTH,
> __Janko
>






From z3penguin at penguinpowered.com  Sun Apr 23 11:19:58 2000
From: z3penguin at penguinpowered.com (Z 3 Penguin)
Date: Sun, 23 Apr 2000 11:19:58 -0400
Subject: Posting CGI
Message-ID: <8dv4j8$2bs$1@bob.news.rcn.net>

How would I go about submiting a CGI post form in python?  (This sounds like
it should be simple, but I can't figure it out :-) Thanks.

-Z




From gherron at aw.sgi.com  Fri Apr 14 13:46:54 2000
From: gherron at aw.sgi.com (Gary Herron)
Date: Fri, 14 Apr 2000 10:46:54 -0700
Subject: Questions on 1.6a2's string methods
References: <38F6C904.76B538E5@concentric.net>
Message-ID: <38F7598E.97A07412@aw.sgi.com>

Manus Hand wrote:
> 
> 1.  I see that string objects now support (as methods) most of the
>     functions from the string module.  Among these are:
>         upper, lower, split, strip, find
>     and surely others.  My question is, why is capwords (which seems
>     to be in the same genre as upper and lower) not a method?
> 
> 2.  Along these same lines, since split() became a method of the
>     string type, wouldn't it make sense to make join() a method of
>     the list type?
> 
> 3.  Are the classlike standard types (list, dictionary, and now
>     string) equipped with a __dict__ attribute?  I can see the names
>     of all functions supported by a user-defined class by saying
>     className.__dict__.keys(), but I cannot see the list of methods
>     for the string type (at least not in the same way).  Thus my
>     need to ask silly questions like #1 above (maybe capwords is
>     there by some other name??)
> 
 
It looks like `capwords' has changed name to `title' with a slight
change in functionality.

>>> '  This    is   a test'.title()
'  This    Is   A Test'

This capitalizes words, but does not change white space as `capwords'
did.

Take a look at the other functions:

>>> ''.__methods__
['capitalize', 'center', 'count', 'endswith', 'expandtabs', 'find',
'index', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join',
'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust',
'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase',
'title', 'translate', 'upper']

Most are familiar.   I'm happy to see 'startswith' and 'endswith'.

-- 
Dr. Gary Herron 
206-287-5616
Alias | Wavefront
1218 3rd Ave, Suite 800, Seattle WA 98101



From jwbnews at scandaroon.com  Sun Apr 23 01:41:49 2000
From: jwbnews at scandaroon.com (John W. Baxter)
Date: Sat, 22 Apr 2000 22:41:49 -0700
Subject: code not true?
References: 
Message-ID: 

In article , Moshe 
Zadka  wrote:

> On Sat, 22 Apr 2000, John W. Baxter wrote:
> 
> > > > >>> print 7.0 == 7
> > > > 1
> > > > >>> print (.07 * 100) == 7
> > > > 0
> > > 
> > > Because computers represent floats with too little bits.
> > > Never ever compare two floats for equality!
> > > 
> > Not quite.  No number of bits is sufficient to represent .07 exactly in 
> > the typical (and IEEE standard) representation.  
> 
> Yes, but enough bits could make sure that 0.07*100 is indistinguishable
> from 7.0

We have that many bits now...we just have to define "indistinguishable" 
properly.  For example

Python 1.5.2 (#2, Dec 23 1999, 13:16:10)  [GCC egcs-2.91.66 19990314 
(egcs-1.1.2  on bsdos4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> a = .07 * 100
>>> b = 7
>>> epsilon = 1e-15
>>> abs(a-b) < epsilon
1
>>> a == b
0
>>> 

The above is not how == is defined.  It is one way (with a suitable 
epsilon...this one may not be suitable for one's particular problem) to 
test two numbers for "close enough to be indistinguishable, so we'll 
call them equal".  (And don't forget the abs()...forgetting that can 
ruin an evening.)

   --John (who also fought with plus zero and minus zero, both in 
integers and floating point)

-- 
John W. Baxter   Port Ludlow, WA USA  jwbnews at scandaroon.com


From exarkun at flashmail.com  Fri Apr 21 11:03:14 2000
From: exarkun at flashmail.com (Jp Calderone)
Date: Fri, 21 Apr 2000 15:03:14 +0000
Subject: The Simple Economics of Open Source
References: <14591.15630.192472.440375@goon.cnri.reston.va.us>
	  <3900611F.3B525BDA@cfdrc.com>
	  
Message-ID: <39006DB2.FD215253@flashmail.com>

Robin Becker wrote:
> 
> In article , Will Ware 
> writes
> >Ed (elb at cfdrc.com) wrote:
> >> ... I didn't think much of the article...
> >> ...they gave the impression that programmers behave
> >> somewhat like monkeys, motivated primarily by concerns
> >> about group status and dominance...
> >
> >They also mentioned, but immediately belittled, the possibility
> >that altruism might be a real motivation. They may have been
> >projecting their own thinking upon programmers in doing so. I'm
> >not an open source purist, but I can easily see that a future world
> >with a lot of free software will be a lot more pleasant for me to
> >live in than one from which free software is absent. Benefits to
> >the rest of society and to myself are not in conflict here. Maybe
> >that's not really altruism, maybe it's just long-term thinking, a
> >motivation they didn't mention at all.
> 
> I'm afraid your desire for a better world reduces your altruism
> quotient.
> Doing it because it helps others is altruism, doing it to help your self
> and or relatives isn't really. The indian otters which help injured
> friends were thought to be altruists until it was shown that by doing so
> they reduced their own risk of predation (the slow one attracted the
> predators most). Real altruism is rare.
> 

 Of course; for the reason you allude to, it isn't evolutionarily
advantagious to be altruistic.  

The phrase "enlightened self-interest" comes to mind :)

 Jp

> [snip]

> --
> Robin Becker

-- 
 3:01pm up 23 days, 20:08, 2 users, load average: 1.29, 0.90, 0.47


From meh9 at cornell.edu  Fri Apr  7 11:08:33 2000
From: meh9 at cornell.edu (Matthew Hirsch)
Date: Fri, 07 Apr 2000 11:08:33 -0400
Subject: Algorithm: combinations of (k) taken from (n) values
References:  <38ED5285.719F26D7@udel.edu>
Message-ID: 

Thanks for your help.  This is exactly how I pictured it, starting with 
lists of numbers up to n, and then adding on to them from there.

Matt




In article <38ED5285.719F26D7 at udel.edu>, Charles Boncelet 
 wrote:

> Matthew Hirsch wrote:
> 
> > Hi All,
> >
> > Onto the next question...
> >
> > Can anyone think of an algorithm to store as lists all possible
> > combinations of k numbers taken from n possible numbers.  For example,
> > given 5 values, I want to choose 2.  The number of possible combinations
> > is given by 5!/(3!2!)=10.  They are:
> >
> 
> Funny you should ask, since I just wrote one two days ago:
> 
> def combs(n,k=None):
>     """returns sorted list of k items taken from n."""
>     if k==None:
>         k=n
>     l = []
>     for c in range(n):
>         l.append([c])
>     for i in range(k-1):
>         li = []
>         for c in l:
>             for j in range(c[-1]+1,n):
>                 li.append(c+[j])
>         l = li
>     return l
> 
>     Charlie Boncelet
> ------
> Charles Boncelet, University of Delaware,
> On sabbatical at ADFA, Canberra Australia,
> Home Page: http://www.ece.udel.edu/~boncelet/
> 
>


From roy at popmail.med.nyu.edu  Tue Apr  4 21:21:23 2000
From: roy at popmail.med.nyu.edu (Roy Smith)
Date: Tue, 04 Apr 2000 21:21:23 -0400
Subject: What is python's language level?
References: <38EA1B8F.A797A130@lmco.com> <38E9DDD3.3313FF6@bioreason.com> 
Message-ID: 

zawrotny at gecko.sb.fsu.edu (Michael Zawrotny) wrote:
> Lets start with the fact that nroff and html are markup
> languages not programming languages.

HTML certainly is markup, but I don't know if I'd call nroff markup.  
It's much more like a programing language.

Nroff has arithmetic expressions and operators, conditional execution, 
several different forms of data structures (number registers, text 
diversions), user-definable functions with argument passing, traps, etc.  
I don't remember if it supports recursion or not, but I think so.

I will admit, the syntax leaves something to be desired (an obfuscated 
nroff contest would be pointless because it'd be too hard to pick one 
winner).  I'll leave it to the theory wonks to figure out if it's Turing 
complete or what not, but it's very much more than just a markup 
language.


From ajung at sz-sb.de  Fri Apr  7 13:22:51 2000
From: ajung at sz-sb.de (Andreas Jung)
Date: Fri, 7 Apr 2000 19:22:51 +0200
Subject: Meaning of __rlshift__ and __rrshift__ ?
Message-ID: <20000407192251.A1974@yetix.sz-sb.de>

The documentation say nothing concerning the meaning
of the functions above ?

Any comments ?

Cheers,
Andreas



From rogerha at ifi.uio.no  Fri Apr 14 10:11:20 2000
From: rogerha at ifi.uio.no (Roger Hansen)
Date: 14 Apr 2000 16:11:20 +0200
Subject: Python tools for PDE and Linear algebra
Message-ID: 

Hi everyone.

I'm looking for some tools for solving Partial Differential Equations,
and I want to program in Python of course. I've searched the net and
found some Linear Algebra packages but not PDE tools. Does anyone know
some PDE tools or are working on such projects? Support for different
numerical methods as Finite Difference and Finite Element Methods
would be nice.


TTFN,

Roger


From aahz at netcom.com  Sun Apr 16 00:04:04 2000
From: aahz at netcom.com (Aahz Maruch)
Date: 16 Apr 2000 04:04:04 GMT
Subject: Python idiom: Multiple search-and-replace
References: <20000412100816.A2431031@vislab.epa.gov> <20000412120012.D2446939@vislab.epa.gov> <0s1J4.655$rc9.190631424@newsb.telia.net> <20000414084023.A2012@vislab.epa.gov>
Message-ID: <8dbe3k$tkt$1@nntp9.atl.mindspring.net>

In article <20000414084023.A2012 at vislab.epa.gov>,
Randall Hopper   wrote:
>
>It's hard to believe we're burning 8.9 sec out of 11.6 seconds (77%) just
>in the simple loop overhead of iterating over lines.  Where's that JIT
>Python interpreter when you need it ;-)  

It's not the loop overhead per se so much as the readlines() overhead.
readline() is relatively inefficient.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

"First one back from the bathroom gets to be the bottom."


From Vladimir.Marangozov at inrialpes.fr  Sat Apr 15 11:49:58 2000
From: Vladimir.Marangozov at inrialpes.fr (Vladimir Marangozov)
Date: Sat, 15 Apr 2000 17:49:58 +0200
Subject: an intern-like memory saver
References: <8d5ing$heb$1@nnrp1.deja.com> <38F7318F.AE4F0EE5@endea.demon.nl> <8d8fe0$nr5$1@nnrp1.deja.com>
Message-ID: <38F88FA6.35ED9CB9@inrialpes.fr>

sjmachin at lexicon.net wrote:
> 
> I was happy enough with the idea of having an instrumented malloc in my
> own Python (when I get around to compiling it with gcc), but was
> wondering about the possibility of having an instrumented malloc as
> part of the *standard* Python distribution.

Heads up! It's on the way -- Python 1.6 is expected to be user-malloc
friendly, so you'll be able to link your executable with the malloc of
your choice. Actually, this is painful and you have few chances to do
it right if you're not a Python guru.

No default replacement of libc malloc is envisioned for the distribution,
though. At least not yet.

encouraging'ly y'rs
-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov at inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252


From sabren at manifestation.com  Sun Apr  9 22:30:24 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Sun, 9 Apr 2000 22:30:24 -0400 (EDT)
Subject: indexed dictionaries?
Message-ID: 

Hey all,

  I just KNOW this has been done before, but I can't seem to find an
example... I'm looking for a cross between a dictionary and a list,
such that keys() always returns keys in the order in which they were
added, and that instance[0] refers to the first key...

eg:

>>> import IdxDict
>>> x = IdxDict()
>>> x["a"] = "first one"
>>> x["b"] = "second one"
>>> x[0]
'first one'
>>> x["a"]
'first one'
>>> x.keys()
('a', 'b')

Anyone got something like this?  

Thanks,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------




From zeitlin at seth.lpthe.jussieu.fr  Wed Apr 19 11:55:18 2000
From: zeitlin at seth.lpthe.jussieu.fr (Vadim Zeitlin)
Date: 19 Apr 2000 15:55:18 GMT
Subject: How to compile wxpython in win98 using vc6.0 for wxWindows2.1.15!
References: <8djn4c$22ch$1@news.cz.js.cn>
Message-ID: 

On Wed, 19 Apr 2000 15:37:12 +0800, fmr  wrote:
>wx.cpp:
>wchar.h(700) : error C2733: second C linkage of overloaded function
>'wmemchr' not allowed
>wchar.h(699) : see declaration of 'wmemchr'

 This is really weird because:

1. my wx/wxchar.h doesn't have 700 lines (it's about 650)
2. there is no mention of wmemchr in it at all
3. are you trying to compile it in Unicode mode (won't work under Win98
   anyhow then)? Otherwise, wxxx() functions shouldn't be referenced
   at all.

 Check your installation of wxWin, in particular check that you didn't
mix the new headers with some left overs of a previous version.

 Regards,
VZ


From pj at sgi.com  Wed Apr 12 18:50:26 2000
From: pj at sgi.com (Paul Jackson)
Date: 12 Apr 2000 22:50:26 GMT
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au> <38F4996F.E3BD2626@acm.org> <8d2p3q$2vj9o$1@fido.engr.sgi.com> 
Message-ID: <8d2uji$301cu$1@fido.engr.sgi.com>

|> Nope, both lynx, and links, exist.

oh - could you offer a link to "links" -- it's
a hard name to search for -- too many false hits.

-- 

=======================================================================
I won't rest till it's the best ...	   Software Production Engineer
Paul Jackson (pj at sgi.com; pj at usa.net) 3x1373 http://sam.engr.sgi.com/pj


From kc5tja at garnet.armored.net  Sun Apr 30 20:19:53 2000
From: kc5tja at garnet.armored.net (Samuel A. Falvo II)
Date: 1 May 2000 00:19:53 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <8ecsgj$6lp$1@slb0.atl.mindspring.net>  <300420001008012011%pecora@anvil.nrl.navy.mil><20000430170952.A502@datapro.co.za>  
Message-ID: 

In article , Dave Abrahams wrote:
>As Simonyi, the author of the Hungarian notation concept writes, "the basic
>idea is to name all quantities by their types". If you are naming quantities
>by their interface, you are taking a step away from Hungarian. Do as I do,
>naming quantities by their *role*, and you have taken a long leap away from
>Hungarian.

If an object exposes a particular interface, then it is guaranteed to be of
a particular type.  Defining parameters in terms of their roles is
analogous.  Again, I just don't see the distinction.

>I can see how it might help to name a variable by its interface, especially
>in Python if you don't write comments. But: do you write listDogs, tupleDogs
>or sequenceDogs when you're being passed a sequence of dogs? Don't the

Yes.  In particular, listDogs, tupDogs, or seqDogs.  Depending on certain
issues, I may well go so far as to write listOfDogs, tupleOfDogs, or even
sequenceOfDogs (<- especially when dealing with CORBA).

>Suppose you're writing UserDict. What do you name your function arguments
>which represent keys and values? Not too many requirements on the value
>type, are there? Is Hungarian applied only selectively?

The names would be key and value, accordingly.  Variables which hold keys
would be called keyX, keyUser, etc.  Likewise with values.

Finally, yes, Hungarian is best used only selectively.  I strongly dislike
redundant information source code.  For example:

	def PrintName( name ):
	   print "The name is %s" % name

	.
	.
	.

	for listOfNames in listOfListOfNames:
	   for name in listOfNames:
	      PrintName( name )

Note that I do NOT use Hungarian inside of PrintName(), because it would be
completely redundant.  Within the context of the function, the type of a
name would obviously have to be a string.

But outside the function, where the context could be *anything*, I use
Hungarian notation to make it patently obvious the types of data I'm dealing
with.

Some might say, "listOfListOfNames" isn't Hungarian notation.  Isn't it?
Isn't Hungarian notation just a consistent system by which you tag variable
names with the intended datatypes of the objects they hold/refer to?  If we
chose to use an abbreviation, we'd get llNames, which is decidedly closer to
what Microsoft uses in their software.

This technique is not new, nor was it "invented" at Microsoft either.
Mathematicians have often used the "Factor Label" method for solving
equations for eons.  There's a whole algebra of working with units.  For
example, if you're going X miles/hour, and you've been travelling for Y
hours, then the distance you've travelled is Z=(X*Y) miles.  Or:

	distanceZ = speedX * timeY

Why can't this be applied to computer programming too?  Given a pointer to a
pointer to an object,

	pObject = *ppObject;	/* The * operator cancels out a p */

or:

	pArgument = argv[2];
	
Oh, here's a beautiful example of 'reverse' Hungarian notation, which
someone else on this newsgroup recommended/inquired about:

	void main( int argc, char *argv[] );
			  ^	      ^
-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA


From philh at vision25.demon.co.uk  Sun Apr 30 16:11:15 2000
From: philh at vision25.demon.co.uk (phil hunt)
Date: Sun, 30 Apr 2000 21:11:15 +0100
Subject: The Simple Economics of Open Source
References:    
Message-ID: 

On Mon, 24 Apr 2000 03:57:00 GMT, 
Raffael Cavallaro  wrote:
>In article , Richard 
>Hale  wrote:
>
>>The Open Source software that I have used has been very valuable to me.  
>>Did those who produced it not see as much value in it?
>
>Well, they probably knew they couldn't sell it as a closed source 
>product and make much money from it.
>
>Fact is, only commodity items, that are known to many programmers, are 
>open sourced. 

Eh?

Consider Parrot and leafwa, two open source packages I am writing.
When I put them up on my website, they were known to exactly *one* 
programmer.

>If there were sufficient demand to support a closed source 
>business, then it would have happened that way.

Demonstrably wrong.

At the time Linus wrote his kernel, there were several closed source
Unices for x86.

>The closed source biggies are not open sourcing the crown jewels. Why? 
>Cause there's plenty of cash still left to milk from those cows. Notice 
>that Apple has open sourced only those parts of MacOS X that *aren't* 
>lucrative consumer software. Where's the Darwin QuickTime (not the 
>streaming server, but the client?) Where's Darwin Quartz, Darwin Aqua, 
>Darwin Cocoa? Don't hold your breath for these, because these parts of 
>the OS are what allows Apple to turn a profit. If they became open 
>source commodities, Apple would become just another clone maker.

This is a reasonably comment.

If Apple open sourced the Mac user interface, they'd be worse off.

What they could do however, is disclose the source (so you can look
at it, but not do anything with it) and and put it on a time-delayed open
source licence (so any release will become open source after X years).

At the same time, they could release a version of MacOS for Wintel
boxes. They could base it on the Linux kernel; this would mean they 
wouldn't have to go to their own separate effort to write device drivers
etc. (They could of course do this without open sourcing the Mac
user interface code).


-- 
***** Phil Hunt ***** send email to phil at comuno.com *****
Moore's Law: hardware speed doubles every 18 months
Gates' Law: software speed halves every 18 months 


From fredrik at pythonware.com  Tue Apr  4 05:32:38 2000
From: fredrik at pythonware.com (fredrik at pythonware.com)
Date: Tue, 04 Apr 2000 09:32:38 GMT
Subject: Unicode program representation
References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> <3xXF4.1060$n68.186533888@newsb.telia.net> <001201bf9d62$3e1ac1c0$36dd3fcb@neil> <%o3G4.1111$n68.191610880@newsb.telia.net> 
Message-ID: <8cccrm$cc3$1@nnrp1.deja.com>

Francois Pinard wrote:
> > hmm.  wouldn't that mean that we end up using different encodings in
> > different parts of the script?  feels a little scary, to say the
least...
>
> This is very likely to happen, but this should not be seen as scary.
>
> Modules handling linguistic or cultural matters might come from
various
> sources, which sources do not necessarily use the same encodings, but
yet
> be used simultaneously in a program building on them all.

sure, I'm all for letting different *scripts* (or different
modules in a larger program) use different encodings; say
utf-8 in some files, iso latin 2 in another, chinese in a
third one...

what scares me is if we end up with multiple encodings in the
same source file.

(and no, it's not because we're developing a python
development environment -- supporting this in our python
editor would be fairly trivial ;-)




Sent via Deja.com http://www.deja.com/
Before you buy.


From m.faassen at vet.uu.nl  Mon Apr  3 12:42:22 2000
From: m.faassen at vet.uu.nl (Martijn Faassen)
Date: 3 Apr 2000 16:42:22 GMT
Subject: Who is this years winner?
References: <000101bf9d2d$b724e1c0$e02d153f@tim>
Message-ID: <8cahle$356$1@newshost.accu.uu.nl>

Tim Peters  wrote:
> Since then, potential winners other than ME have,
> umm, gracefully withdrawn.  I'm sure it's just coincidence that the PSA
> Steering Committee has never been heard from again.

That's susp[PSU/UsenetInterrupt$_]
Mr. Peters, Nr. Timbot,

The PSU notifies you for the first and last time have not paid our fees for:

  * Use of Guido's time machine to wipe out the existence of Peter Tims,
    2nd winner of the Pythonic Award.

  * Liquidation and replacement with bot of F. Lundth, who threatened to
    win the Pythonic Award.

Please transfer the money to our Swiss bank account immediately, or you will
be discontinued.
[PSU/UsenetInterruptEnd$_]ious, Tim! Something to do with the PSU? :)

There-is-no-such-thing-as-the-Python-Secret-Underground-ly yours,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


From R.Brodie at rl.ac.uk  Tue Apr 25 09:25:19 2000
From: R.Brodie at rl.ac.uk (Richard Brodie)
Date: Tue, 25 Apr 2000 14:25:19 +0100
Subject: what does XDR stand for? and what is it?
References: <002101bfaeb5$b57f5dc0$2801000a@iel.ie>
Message-ID: <8e46c6$1aoa@newton.cc.rl.ac.uk>

"Shaun"  wrote in message news:002101bfaeb5$b57f5dc0$2801000a at iel.ie...
>
> im here looking and trying to figure out the xdrlib module,
> it says here - http://www.python.org/doc/current/lib/module-xdrlib.html
> "The xdrlib module defines two classes,
> one for packing variables into XDR representation,
> and another for unpacking from XDR representation.
> There are also two exception classes."
> my question is what is XDR? what does it stand for?

XDR stands for 'external data representation'. It has a few simple
encoding rules: use IEEE floating point, send integers big-endian etc.
It is used primarily in Sun style remote procedure calls - those
associated with the portmapper (e.g. NFS), though it sees some use
in portable file formats also.

Sun produced an informational RFC about it, which should be on your
nearest repository.





From dennis_marti at yahoo.com  Mon Apr 24 10:53:14 2000
From: dennis_marti at yahoo.com (dennis_marti at yahoo.com)
Date: Mon, 24 Apr 2000 14:53:14 GMT
Subject: crypt() results
References: 
Message-ID: <8e1n4k$jt7$1@nnrp1.deja.com>

In article ,
  "Michal Wallace (sabren)"  wrote:
>
>
> Well. I tried porting both Crypt::UnixCrypt and Crypt::PasswdMD5 to
> python.  And neither one of the python versions give the same results
> as the perl versions. They come out in the same format, but with
> different values.
>
> I've pounded my head, pulled out my hair, and finally given up. I
> simply don't know enough about the algorithms or perl's bit twiddling
> to understand what these modules are actually doing.

It wasn't in the bit twiddling. You reversed the conditionals in the
first for loop in unix_md5_crypt().

/home/dennis $ diff md5crypt.py md5crypt.py.orig
73,74d72
<             ctx = ctx + final[:16]
<         else:
75a74,75
>         else:
>             ctx = ctx + final[:16]

Hope you didn't lose too much hair.

Dennis Marti


Sent via Deja.com http://www.deja.com/
Before you buy.


From mskott at image.dk  Mon Apr 24 08:05:12 2000
From: mskott at image.dk (Martin Skøtt)
Date: Mon, 24 Apr 2000 12:05:12 GMT
Subject: Trouble compiling PyGreSQL 2.4 on Linux
References: 
Message-ID: 

Oleg Broytmann  writes:

> On Sun, 23 Apr 2000, Martin Sk?tt wrote:
>    You forget to mention path to postgres libs (-L /usr/local/pgsql/lib).

I knew it was something like that, thanks :-)
> > I can't use the make command mentioned in the readme.linux file
> > because the simply isn't any make file in the archive. Can you help me
> > getting it compiled?
> 
>    There is no Makefile 'cause the module is intended to use standard
> Python Makefile.pre.in/Setup.in scheme.

That is onlu if you chose the standard Python module installation. Red
Hat has made something special where modules are stored in a directory
called lib-dyn/ some where. To me it seems like the modules then are
loaded automaticly.
As I mention in my first posting the readme.linux file describes how
to do an red hat install (make redhat) but it doesn't seem to work. An
address is also mentioned for an RPM but the file doesn't exist on the server.

-- 
Martin Sk?tt
mskott at image.dk

'In a certain sense, all decent programming languages are equally powerfull'
Dr. Alan Turing


From amused at webamused.com  Sun Apr 30 14:43:40 2000
From: amused at webamused.com (Joshua Macy)
Date: Sun, 30 Apr 2000 18:43:40 GMT
Subject: Comments/Help on Index-module
References: <390c564b.102144@news.c2i.net>
Message-ID: <390C721D.24380F19@webamused.com>

 Without spending much time looking at your script (to say the least), I
suspect it would be easier and more robust to use pickle to store and
retrieve the data, instead of trying to do it yourself through struct
packing, shelving and the like.

 Joshua


From effbot at telia.com  Tue Apr 18 10:39:14 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Tue, 18 Apr 2000 14:39:14 GMT
Subject: TKinter-destroying a window
References: <8dhk0j$cj5$1@nnrp1.deja.com>
Message-ID: 

gregholmes at my-deja.com wrote:
> Sorry, I'm reading TFM but haven't figured this
> out yet. If I am done with a secondary (or
> tertiary, or whatever) window (in TKinter), can I
> just destroy the window or do I need to get rid
> of any class instantiation that is
> attached/associated to it? i.e.
>
> ....
> theWindow=Toplevel()
> solveThis=SolveThis(theWindow)
> ....
> theWindow.destroy()
>
> Will the class instantiation and its variables
> and everything still be laying around?

not everything -- destroy releases all the Tk specific
stuff, but the proxy object hangs around until you've
removed all references to it.

(since Python objects don't know who's referring to
them, they cannot destroy all references by them-
selves).

in your case, assuming that "theWindow" is a global
variable, you can use:

    del theWindow

or

    theWindow = None

to get rid of it (assuming SolveThis doesn't create
a circual reference, that is).

if the code is local scope (inside a function or a
method), the variable will be deleted by Python
when you leave that scope.






From nospam at nowhere.net  Fri Apr 21 00:05:19 2000
From: nospam at nowhere.net (Ray&Maria)
Date: Thu, 20 Apr 2000 22:05:19 -0600
Subject: Tkinter Canvas -- help?
References: <8ddtdm$b2s$1@nnrp1.deja.com> 
Message-ID: 

Whatever happen to your excellant (and only) Tkinter manual site Fredrik?
The pages are gone for the last 2 days, and python.org does not respond to
my e-mail except the thank you robot.  It appears that pythonware no longer
holds any content for Tkinter.  Does anyone know if I can download a copy
from a mirror site?

Jueiming Chen
NOSPAMjchen at NOSPAMquark.com


"Fredrik Lundh"  wrote in message
news:dRyK4.2542$Za1.37532 at newsc.telia.net...
>  wrote:
> > I'm just starting to learn Python/tkinter, and I have found that there
> > is virtually _no_ documentation for the tkinter canvas. Could anybody
> > help? I'm specifically looking for stuff like creating an image by a
> > grid in canvas on "mouseDown", and how to read the items in the canvas,
> > and write them to a text file, in their proper positions. I would
> > _really_ appreciate it if anybody could help me with this.
>
> how to capture mouse down:
>
http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.h
> tm
>
> how to create image items:
> http://www.pythonware.com/library/tkinter/introduction/canvas-image.htm
>
> how to read items in the canvas:
> http://www.pythonware.com/library/tkinter/introduction/canvas.htm
> (look under methods, for find_all, coords, etc)
>
> > P.S. The only tkinter canvas documentation that I have is the
> > "Introduction to Tkinter" from pythonware.com
>
> 
>
>




From dgallion1 at yahoo.com  Wed Apr 12 10:46:09 2000
From: dgallion1 at yahoo.com (Darrell Gallion)
Date: Wed, 12 Apr 2000 07:46:09 -0700 (PDT)
Subject: Python idiom: Multiple search-and-replace
Message-ID: <20000412144609.7026.qmail@web2006.mail.yahoo.com>

Been there done that.

My solution is more work than Fredrik's, unless you
plan on making a lot of changes to the buffer.
Like many hundreds of patterns on a large buffer.

Keep a list of changes to be performed.
(start, seqNumber, text, end)

seqNumber stabilizes the sort of this list.

If the start==end then delete a section.

Sort the list and perform all operations at once.
This is like a transaction, which allows for some
other cool features. Such as detecting conflicting or
overlapping changes. 

I have code if you want it.










=====
Darrell Gallion




__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com



From kno at jtan.com  Wed Apr 12 20:02:32 2000
From: kno at jtan.com (Matt Dunford)
Date: Thu, 13 Apr 2000 00:02:32 GMT
Subject: global variables - how??
References: <8d2bne$qn7$1@news101.telia.com>
Message-ID: 

I usually set a module aside for global variables:

import glob_vars
glob_vars.count = 6

def printme( num ):
  print num

printme( glob_vars.count )

you get the idea...

"Anders Eggers-Krag"  writes:

>how do I define a propper global variable that works in all functions in all
>modules?

>I have tried simply
>defining one outside of any function in the main module,
>I have tried using the global keyword under the same cicumstances,
>but they are not even avialible inside of functions within the main
>module...


>--
>Anders Eggers - Krag


--


From michael.stroeder at inka.de  Thu Apr 27 18:01:47 2000
From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Fri, 28 Apr 2000 00:01:47 +0200
Subject: run detached
Message-ID: <3908B8CB.97A0755D@inka.de>

HI!

How can I automatically detach from console after starting up with
SocketServer? (E.g. web server with access and error logging to
files.)

Ciao, Michael.


From ejbaker_seekonk at my-deja.com  Sun Apr  9 10:57:37 2000
From: ejbaker_seekonk at my-deja.com (ejbaker_seekonk at my-deja.com)
Date: Sun, 09 Apr 2000 14:57:37 GMT
Subject: awk-like usage of Python
Message-ID: <8cq5os$8b9$1@nnrp1.deja.com>

I'm a relative newbie to Python. But, I have extensive experience with
awk (it's an old stand-by that I rely on over and over).

Are there any library modules that make python behave more like awk?
Lacking that, what's the best way to achieve line by line parsing
and pattern matching with Python?

Thanks


Sent via Deja.com http://www.deja.com/
Before you buy.


From pointal at lure.u-psud.fr  Thu Apr 27 11:04:37 2000
From: pointal at lure.u-psud.fr (Laurent POINTAL)
Date: Thu, 27 Apr 2000 15:04:37 GMT
Subject: global variables or inheritence
References: <28p8zy0irgc.fsf@lada.kom.auc.dk>
Message-ID: <39085541.2079513161@news.u-psud.fr>

On Wed, 26 Apr 2000 19:37:40 GMT, Thomas Rasmussen
 wrote:

>: Hi
>: 
>: I have quite a big problem. I have two different files, where I in one
>: file want to declare a variable and then in the other file be able to
>: access and use this variable (no need to change it), but I just can't
>: seem to get it to work... Is there any nice way of doing this easily?
>: I have tried the global var but this doesn't seem to work.
>: 
>: Anyone got a good idea?

Be careful that when you write "from module import *", you get
duplication of the imported module public names into your namespace,
with their current referenced objects.

If one module change(*) the object which is referenced in its
namespace, the other module dont see the modification.

Ex.
    #mod1
    var = 12

    #mod2
    from mod1 import *
    # Here you get var with value 12.
    var = 18
    # Here you have var with value 18 and mod1 has var with value 12.


To avoid this problem, you must access globals by their modules names.

Ex.
    #mod2
    import mod1
    mod1.var = 18
    # And its ok.

Here, to force the use of module prefix, we have adopted the rule to
all times use a _ before globals names, so that they MUST be accessed
by their modules names.

A+

Laurent.

(*) Change the object instance!!! If you have a 'shared' list between
modules, you can do operations on it and all modules ill see them...
except the bad module which create a new list instance and assign it
to its namespace'name.

---
Laurent POINTAL - CNRS/LURE - Service Informatique Experiences
Tel/fax: 01 64 46 82 80 / 01 64 46 41 48
email  : pointal at lure.u-psud.fr  ou  lpointal at planete.net 


From python at rose164.wuh.wustl.edu  Tue Apr 25 07:34:27 2000
From: python at rose164.wuh.wustl.edu (David Fisher)
Date: Tue, 25 Apr 2000 06:34:27 -0500
Subject: urllib (sort of reload) question
References: 
Message-ID: <001801bfaeaa$3727ece0$0201a8c0@spkydomain>

Hi,
I've never actually done this so caveat emptor.  A glance at rfc2616 tells
me you're going to need to add a "Pragma: no-cache" to the outgoing header.
Add the line:

h.putheader("Pramga","no-cache")

somewhere before h.endheaders() in the method open_http() of class
URLopener.  Right next to the GET would probably be good.
Good luck,
David


----- Original Message -----
From: "John Littler" 
Newsgroups: comp.lang.python
To: 
Sent: Friday, April 21, 2000 8:24 PM
Subject: urllib (sort of reload) question


>
> Hi,
> I use urllib to get a number of URLs and parse the
> results. One pesky URL doesn't expire it's content
> correctly and as an interim measure I need to reload
> the page in my browser before getting the data with
> python. I'm going through squid so I guess that's where
> the old stuff is being picked up.
> Does anyone know how to emulate browser "reload" in
> python? Looking at the urllib code didn't provide me
> with any clues.
> TIA
> John
>
>
> --
> pgp public key @ http://www.crosswinds.net/~linuxmusic/pubring.html
> --
> http://www.python.org/mailman/listinfo/python-list




From nospam.newton at gmx.li  Sat Apr  1 13:57:47 2000
From: nospam.newton at gmx.li (Philip 'Yes, that's my address' Newton)
Date: Sat, 01 Apr 2000 18:57:47 GMT
Subject: Paid to work in Python? (was: Re: Choice Of Language)
References:  <8ajmib$elo$1@nnrp1.deja.com> <8c3ats$b5f$1@nntp.Stanford.EDU> 
Message-ID: <38e5f8ed.29659873@news.nikoma.de>

On Fri, 31 Mar 2000 23:24:18 GMT, nobody at nowhere.nohow (Grant Edwards)
wrote:

>Pointless tanget: Is it just me, or is Google really the last usable search
>engine?

Or possibly the last search engine -- all other previous search engines
seeming to have turned into portals or other advertisement-laden,
all-singing-all-dancing sites. (The German term "eierlegende
Wollmilchsau"[1] comes to mind.)

Cheers,
Philip

[1] literally, "egg-laying wool-milk-sow [female pig]", i. e., something
that tries to do too much at once.
-- 
Philip Newton 


From mindlace at imeme.net  Wed Apr 26 16:49:12 2000
From: mindlace at imeme.net (mindlace)
Date: Wed, 26 Apr 2000 14:49:12 -0600
Subject: newbie regexp question
Message-ID: <39075648.CA622A7D@imeme.net>

Flying Circus,

I've got a re.compile('\W') that I can use to search for non-alphanumeric characters in a
variable.  However, if the variable has ( in it, for example, the search breaks. is there a
quoted_var = string.quote(somevar) or similar? Do I want to use string.maketrans(somevar,
quoted_var) ?
 
Thanks,
-- 
ethan mindlace fremen        mindlace at imeme.net
zope    -&-     imap email   -&-   mailing list
weave your web with the web at http://imeme.net



From dalke at acm.org  Wed Apr  5 18:11:45 2000
From: dalke at acm.org (Andrew Dalke)
Date: Wed, 5 Apr 2000 16:11:45 -0600
Subject: UserDict's has_key() and get() should use __getitem__()
References: <0535db98.ec878f67@usw-ex0101-005.remarq.com>  <29328840.06b5b87b@usw-ex0101-005.remarq.com>
Message-ID: <8cgdp3$nm5$1@slb6.atl.mindspring.net>

Hamish Lawson wrote:
>I grant that my proposal is a bit less efficient, but I see that
>as part of the cost for the proper abstraction. Given that
>UserDict exists primarily to be subclassed, and usually for the
>purpose of providing new definitions of setting and getting
>items, I do think that UserDict should be implemented in such a
>way as not to require those methods which are conceptually
>dependent to be redefined in the derived class.

I don't believe your estimate, that UserDicts are usually derived
"for the purpose of providing new definitions of setting and
getting items", is correct.

Most of the times I've used UserDict/UserList were to add extra
functionality.  For example, a UserDict which preserves the
input order (modifies __setitem__ and keys; __delitem__ and
items/values should be added, but just needed a quick hack).

Or the Dict is supposed to emulate a dictionary-like format,
so I've had __str__ return the properly formatted string.
(Eg, consider a dictionary for HTML-like tags.)

Only rarely have it used it to do normalization - I try to
push that into the I/O routines.

In addition, in a good OO design, you should be able to use
an instance of a derived class anywhere you use an instance
of a base class.  Your example (a caseless Dict), changes
how/when lookup failures occur.  Thus, a "CaselessDict" really
isn't a type of UserDict, you're just using it for some
implementation reuse.

Instead, you want a minimal interface, which puts the least
amount of assumptions on the class as possible.  This corresponds
to something like:

class AbstractUserDict:
  ...
  def __getitem__(self, key):
    raise NotImplementedError
  def __setitem__(self, key, val):
    raise NotImplementedError
  def keys(self):
    raise NotImplemenetedError
  def has_key(self, key):
    try:
      self[key]
      return 1
    except KeyError:
      return 0
  def items(self):
    items = []
    for key in self.keys():
        items.append(self[key])
    return tuple(items)
  ...

Then Python's UserDict is just an implementation of the
AbstractUserDict base class.

This is the sort of design you need in a stricter compile-time
language like Java or C++.  Because this is Python, you don't
need to tell the complier you're implementing an interface -
you just implement it.  And because this is Python, it's easy to
implement.

                    Andrew
                    dalke at acm.org





From USENET at questionexchange.com  Tue Apr  4 18:54:53 2000
From: USENET at questionexchange.com (QuestionExchange)
Date: 4 Apr 2000 22:54:53 GMT
Subject: Does Python have a long floating data type please?
References: 
Message-ID: <2728qx@questionexchange.com>

http://www.python.org/doc/current/lib/typesnumeric.html
This link descirbes the python data types. It looks like
a float in python will be the same size as a C double. Keep
in mind this is machine dependant.
However, third party modules exist.
http://www.vex.net/parnassus/apyllo.py/684222876.3267957

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet3/qx.usenetGuest.showUsenetGuest?ans_id=12552&cus_id=USENET


From echuck at mindspring.com  Sun Apr  9 22:43:05 2000
From: echuck at mindspring.com (Chuck Esterbrook)
Date: Sun, 09 Apr 2000 22:43:05 -0400
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>
Message-ID: <38F13FB9.D1D16AF@mindspring.com>

Neil Schemenauer wrote:

> Garbage collection for Python:
>
>     http://www.enme.ucalgary.ca/~nascheme/python/gc.html
>
> I think I have all of the wrinkles ironed out of this patch.
> Reference cycles involving lists, tuples, instances, classes,
> dictionaries, and functions are found.  Instances with __del__
> methods are handled in a sane way.  It is easy to add GC support
> to new types.  GC enabled Python is binary compatible with
> regular Python.
>
> Generational collection works (currently three generations).  The
> overhead measured by pybench is less than 1 percent and is not
> measurable with pystone (on my machine).  Virually all extension
> modules should work unchanged (I had to modify new and cPickle in
> the standard distribution).  A new module called gc is available
> for tuning the collector and setting debugging options.
>
> The collector should be portable across all platforms but I have
> only tested on my Linux machine.  The patched version of Python
> passes all regression tests and runs Grail, Idle and Sketch
> without problems.
>
> The patch is against the current CVS version of Python.  If
> enough people ask for a patch against the stable version of
> Python I will make one.  Please send comments and bug reports.
>
>     Neil
>
> --
> "Simplicity does not precede complexity, but follows it." -- Alan Perlis

Looking at Python FAQ 6.14 on GC, I see another one as well:

http://starship.python.net/crew/gandalf/gc-ss.html


Can you compare/contrast the two?  Also, you might want to get yours mentioned in the FAQ.


-Chuck



From scarblac-spamtrap at pino.selwerd.nl  Fri Apr 21 14:06:22 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 21 Apr 2000 18:06:22 GMT
Subject: List comprehensions?
Message-ID: 

I thought list comprehensions had been in CVS for quite a while, so I
expected them to be in 1.6. But I can't find anything about them, and the
syntax as I find it on Deja doesn't work.

What's the deal? Features that are in CVS but don't make it into the next
release?

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
-rwxr-xr-x  1 root  5.89824e37 Oct 22  1990 /usr/bin/emacs [STR]


From ngps at madcap.dyndns.org  Mon Apr 17 10:55:03 2000
From: ngps at madcap.dyndns.org (Ng Pheng Siong)
Date: 17 Apr 2000 14:55:03 GMT
Subject: Filtering web proxy
References: 
Message-ID: <8df8k7$rqp$1@coco.singnet.com.sg>

According to Oleg Broytmann  :
> Once I tried Junkbuster, but found it inadequate. My need is simple -
> just a short list of "white" sites. Never tried adzapper...

I use Alfajor and am happy with it. I only need cookie filtering,
which Alfajor does very well.

Cheers.

-- 
Ng Pheng Siong  * http://www.post1.com/home/ngps



From phd at phd.russ.ru  Mon Apr 24 07:28:21 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Mon, 24 Apr 2000 11:28:21 +0000 (GMT)
Subject: Trouble compiling PyGreSQL 2.4 on Linux
In-Reply-To: 
Message-ID: 

On Sun, 23 Apr 2000, Martin Sk?tt wrote:
> I'm trying to compile the PyGreSQL 2.4 module on my Red Hat Linux 6.1
> box. I use the following command:
> 
> gcc -fpic -shared -o _pg.so -I/usr/include/python1.5
> -I/usr/local/pgsql/include pgmodule.c -lpq
> 
> With the following result:
> pgmodule.c: In function `pgconnect':
> pgmodule.c:694: warning: passing arg 4 of `PyArg_ParseTupleAndKeywords' from incompatible pointer type
> /usr/bin/ld: cannot open -lpq: No such file or directory

   You forget to mention path to postgres libs (-L /usr/local/pgsql/lib).

> I can't use the make command mentioned in the readme.linux file
> because the simply isn't any make file in the archive. Can you help me
> getting it compiled?

   There is no Makefile 'cause the module is intended to use standard
Python Makefile.pre.in/Setup.in scheme.

> And a little addon queston:
> How stable is the DB-API version of the PostgreSQL module? Can it
> be used for production work (or semi serious)?

   It was relased few days ago, so it just hadn't been tested...

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.




From echuck at mindspring.com  Fri Apr 14 20:09:52 2000
From: echuck at mindspring.com (Chuck Esterbrook)
Date: Fri, 14 Apr 2000 20:09:52 -0400
Subject: else clauses in while and for loops
References: <200004142351.JAA02824@nexus.csse.monash.edu.au>
Message-ID: <38F7B350.5D6548E1@mindspring.com>

Jonathan Giddy wrote:

> Chuck Esterbrook declared:
> >
> >So did anyone present, in this thread, an example that shows a real need?
>
> The difficulty is what will you accept as a "real need"?  It sounds like you
> want an example that cannot be done any other way.  Even those who like else
> clauses in for and while will admit they're not essential.

I don't know why you think it 'sounds like' that. Most of the posts didn't have any examples and the one that did wasn't all that cogent. I'm just looking for something that is [a] an example and [b] shows some obvious advantage.


> Just like there's no "real need" for tuples (use lists), for loops (use
> while), or elif (use else: if).
>
> All of these concepts are redundant in the sense that they can be mimicked
> using an alternative sequence of code.  But they're nice because they
> express higher-level concepts about the algorithm.

I'm aware of all of this. In fact, I think we could all get our work done with ADD, NEG, JMP and JMPZ.   :-)

But no thank you.



> OTOH, a quick look at my code shows that I regularly use tuples, for
> loops, and elif, but I rarely use else with anything but if and
> try..except clauses.
>
> The only example I found creates a list of usable temporary directories on
> Unix, checking the environment first.  Certainly no real need here.
>
> _tmpdirs = ['/tmp', '/var/tmp']
>
> for envname in ['TMPDIR', 'TMP', 'TEMP']:
>     try:
>         paths = [os.environ[envname]]
>     except KeyError:
>         pass
>     else:
>         basepaths = validate_paths(paths)
>         if basepaths:
>             break
> else:
>     basepaths = validate_paths(_tmpdirs)

This example looks good to me. It eliminates a redundant "if" after the "for" loop to see if "basepaths" still needs to be set.

Thanks.


On another topic: With regards to the "try...except" technique above (which I've seen quite a bit in Python) does the following code do the same thing and if so, which do you find more readable?

_tmpdirs = ['/tmp', '/var/tmp']

for envname in ['TMPDIR', 'TMP', 'TEMP']:
    if os.environ.has_key(envname):
        basepaths = validate_paths(path)
        if basepaths:
            break
else:
    basepaths = validate_paths(_tmpdirs)


-Chuck




From tim_one at email.msn.com  Wed Apr 26 23:12:14 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Wed, 26 Apr 2000 23:12:14 -0400
Subject: arithmetic in longobject.c
In-Reply-To: <39071752.51DB78B9@stud.ntnu.no>
Message-ID: <000401bfaff6$632a5ec0$272d153f@tim>

[posted & mailed]

[Peter Schneider-Kamp]
> I got a few questions about longobject.c which a quick
> glance at the source could not answer.
>
> What algorithms does longobject.c implement for
> multiplication and division of long integers?

Knuth's.

> What representation is used for long integers?

See the comment block near the top of Include/longintrepr.h (signed
magnitude, base 2**15, using only 15 of each 16 bits -- or however long a C
short happens to be on your platform).

> I'd like to add a rns representation option in python
> for speedups in multiplication.  Internal knowledge
> of the long integer arithmetic would be helpful
> to make the right design choices.

Unless you're just having fun, read about the mpz module in the Library
Reference Manual (which allows use of GMP from within Python).  "Optimized"
bigint arithmetic is unlikely to get into the Python core.

too-little-demand-for-so-much-hairy-code-ly y'rs  - tim





From hgoldste at mpcs.com  Sun Apr  9 08:53:27 2000
From: hgoldste at mpcs.com (Howard Goldstein)
Date: Sun, 09 Apr 2000 12:53:27 GMT
Subject: Python Language Support for ArcView GIS
References: 
Message-ID: <8914.955284807.daemon@warez.bofh.sebastian.fl.us>

On Sat, 8 Apr 2000 16:43:23 -0300, Bruce Dodson  wrote:
 : Python Language Support for ArcView GIS (aka AVPython) is now available
 : online as a free download.  I promised this several months ago but never
 : managed to find a home for it (too busy) so finally I decided to just slap
 : together a page for it on GeoCities:
 : www.geocities.com/brucedodson.rm/avpython.htm

Sweet!  Thank you for making this available to the GIS and python
community


From shogan at iel.ie  Thu Apr 20 09:20:56 2000
From: shogan at iel.ie (Shaun)
Date: Thu, 20 Apr 2000 14:20:56 +0100
Subject: how do i pack and unpack messages in python?
Message-ID: <008301bfaacb$42fe2c60$2801000a@iel.ie>

im still new to python and i have this problem to solve and i have not a
clue where to start can anyone please put me on the right track...

say i have a form, with the values:

Name: Shaun Hogan
Address: Anytown, Anywhere
Credit Card Number: 1234567890

so i have 3 values that i want to pack into a message so as the info can be
sent (but dont worry about th3 sending bit for the mo)

i have a message that looks like this when broken down:
(makes more sense if you read from the bottom up!)

{
Message:
    (type)int(value)id            // the message has its id
    (type)int(value)subid       //and subid
     NVsequence                 //and list of NV pairs
NVsequence:
     NV pair []                   //NVsequence consists of an array/list of
NV
                                         // pairs
NV pair:
     int name                       //we assign id names to the values
     value v                          //eg. [14:"shaun"], [20:"Any..."],
[34:1234...]
                                         //creating [name:value] pairs
Value:
     char type                    //here we determine and state the type of
the
     void *pVal                 //values, "shaun"=string,
"Anyt...,Anyw.."=list,
                                       //1234567890=int, and we establish a
*pointer
                                       //to the values.

Value List:                       //here we have a list of values
     Value[]
                //"shaun","Anytown,Anywhere",1234567890]       }

so i now have a message that looks like:

id                       : 10
subid                  :13
NV sequence :   {14, "shaun"-string
                         {20, ["Anytown, Anywhere"]-list
                         {34, 1234567890-int


i want to pack the message to look like this:

10 fs 13 fs 14 fs s shaun fs 20 fs l s anytown fs s anywhere fs i 1234567890
gs gs

(NV=Name Value Pair, fs=field seperator, s=string, i=int, l=list, group
seperator)

can anyone please tell me how id go about manipulating the strings so as i
can join them using field seperators, any ideas anyone, or even tell me
where i might find out how to do this problem.

Thanks a Million
Shaun

=====================
Shaun Hogan
Interactive Enterprise Ltd.
alt. E-mail : shaun_hogan at yahoo.com
+353 86 8342529





From tseaver at starbase.neosoft.com  Sat Apr 22 12:50:56 2000
From: tseaver at starbase.neosoft.com (Tres Seaver)
Date: 22 Apr 2000 11:50:56 -0500
Subject: The Simple Economics of Open Source
References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com>  
Message-ID: <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7@lp.airnews.net>

In article ,
Neel Krishnaswami  wrote:
>
>One of the interesting things about this thread is that it has given
>me a bit of insight into what economics looks like to people who
>haven't internalized its assumptions. I'm afraid that I'm tainted
>enough that it no longer looks like the dismal science to me. :)
>
>Seriously, the rejection of altruism as a possible motive strikes me
>as a very reasonable decision. Altruism is generally not sufficient
>motive in other aspects of life -- and since there's no particular
>reason that programmers in particular are more likely to be altruistic
>than the rest of the population, positing that hackers have greater
>virtue is at best a dubious proposition. Consider, for example, how
>much better government would be if all the voters studied the issues
>and took care to be informed voters, and that basically no one makes
>the effort. Most people don't even bother digging up evidence to
>support their prejudices, let alone try to come to a careful decision.
>And searching the Census and BLS websites is *easier* than hacking on
>the Python core.

"That dog won't hunt!"  Your claim that "basically no one makes the
effort" is easily refuted:  consider the League of Women Voters,
and the guides they put out before each election -- that effort is
well-organized, and involves coordinated, non-partisan effort on the
scale of tens of thousands of volunteers (much like a large Open Source
project).  The League's explicit motive is to educate themselves and
the population at large on the issues and candidates;  that at least
some of the effort here is altruistic is obvious to anyone who hasn't
"internalized [economics'] assumptions."

Altruism-is-a-shibboleth'ly,

Tres.
-- 
---------------------------------------------------------------
Tres Seaver        tseaver at digicool.com     http://www.zope.org
Digital Creations


From breiter at usf.Uni-Osnabrueck.DE  Mon Apr  3 15:43:32 2000
From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter)
Date: 3 Apr 2000 19:43:32 GMT
Subject: Python 1.6 alpha 1 released
References: <200004010159.LAA00403@piglet.dstc.edu.au>
    <8c9nq3$ghk$4@newsserver.rrzn.uni-hannover.de>
    
Message-ID: <8cas94$po5$1@newsserver.rrzn.uni-hannover.de>

In article ,
	Michael Hudson  writes:
> breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) writes:
> 
>> In article <200004010159.LAA00403 at piglet.dstc.edu.au>,
>> 	David Arnold  writes:
>> > -->"Bjorn" == Bjorn Pettersen  writes:
>> > 
>> >   Bjorn> The more time I spend on fixing
>> >   Bjorn> compatibility issues in Python scripts, the less time I spend
>> >   Bjorn> on "real" work.
>> > 
>> > you have been using incorrect arguments.  the fact that they worked
>> > was unfortunate because it leads to circumstances like this.  but the
>> > time you have spent on these emails would have been enough to run a
>> > simple script over your code to fix the problem ... ;-)
>> 
>> Hmm how simple would a script be to get all occurences of:
>> 
>> 	socket.connect(what, \ 
>> 			else \
>> 			)
>> 
>> 	sc=socket.connect
>> 
>> 	sc(what,else)
>> 	sc(what, \
>> 		else)
>> 
> 
> Yes, but `grep -w connect' and the minimal application of a human
> eyeball is surely enough to get 90%+ of the cases sorted out.  I can't
> imagine sock.connect is called from all that many places in one's code
> (but I might be wrong).  And, to answer you're question, about as
> complicated as:
> 
> http://x42.deja.com/[ST_rn=ps]/getdoc.xp?AN=591243549
> 
> after `sed -e s/append/connect/', which doesn't get the bound method
> case, but I am having trouble imagining circumstances in which you'd
> reasonably do that.

True the whole discussion is kind of pointless.
Nontheless it is not an easy taks to just rewrite your code with
a simple regular expression replacement. ;-) (And that was my point.)

	Bernhard

-- 
Professional Service around Free Software                (intevation.net)  
The FreeGIS Project				            (freegis.org)
Association for a Free Informational Infrastructure            (ffii.org)


From nick at spam_me_notvideosystem.co.uk  Thu Apr 13 11:20:24 2000
From: nick at spam_me_notvideosystem.co.uk (Nick Trout)
Date: Thu, 13 Apr 2000 16:20:24 +0100
Subject: List mapping?
References: <38f5d68e@news.xtml.co.uk> 
Message-ID: <38f5e714@news.xtml.co.uk>

> Try this:
> mylist = ['/a','1','/b','2','/c','3']
> map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0,
> len(mylist), 2))

Very good! I wasnt familiar with the reduce function. I would certainly not have
come up with something of this complexity.

This begs the question: Is there an archive of code snippets for Python? These
could form an excellent tutorial. Quite a few messages arrive on this newsgroup
asking for good starting points for Python (and thats just the people who come
here and ask).

N




From mdefreitas at sikorsky.com  Thu Apr 27 17:03:37 2000
From: mdefreitas at sikorsky.com (mdefreitas at sikorsky.com)
Date: Thu, 27 Apr 2000 21:03:37 GMT
Subject: MORE INFO
References: <8ea0ao$fro$1@nnrp1.deja.com>
Message-ID: <8ea9uu$rh0$1@nnrp1.deja.com>

By the way... I finally tested the code I wrote and it evidently is
incorrect. It works fine on the first nest level, but my application
aborts on the second nest level.

The error message is:
Fatal Python Error: PyThreadState_Get: no current thread

OK... I'm lost. Any ideas? Anybody? Buelher?


Sent via Deja.com http://www.deja.com/
Before you buy.


From mjhand at concentric.net  Tue Apr 18 10:42:49 2000
From: mjhand at concentric.net (Manus Hand)
Date: Tue, 18 Apr 2000 08:42:49 -0600
Subject: Upgrading IIS to 1.6 problem....
References: <2B1262E83448D211AE4B00A0C9D61B03BA72C9@MSGEURO1>
Message-ID: <38FC7469.79082530@concentric.net>

Thanks, Pieter!

That was indeed the problem.  My IIS Mgr settings still had the 1.5.2
installation listed.  (Makes me wonder how important the registry
setting is in NT.)

Manus




From donn at u.washington.edu  Thu Apr 27 12:05:46 2000
From: donn at u.washington.edu (Donn Cave)
Date: 27 Apr 2000 16:05:46 GMT
Subject: IP Address
References: <014801bfb030$141df690$0500a8c0@secret.pythonware.com> 
Message-ID: <8e9ogq$hqi$1@nntp6.u.washington.edu>

Quoth "Fredrik Lundh" :
| Richard Chamberlain wrote:
| > Is there a way of returning the IP address of the machine that a =
| script is
| > running on?
|
| here's one way to do it:
| ip = socket.gethostbyname(socket.gethostname())

Took the words out of my mouth.  But I would add, while this is
the right thing for general use, there are situations where it's
not reliable, where it might return an IP address that is in some
sense valid but not useful.  Consider this as an alternative for
those situations:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('123.345.567.789', 53))
ip, localport = s.getsockname()
s.close()

This establishes an IP connection to a remote host.  It happens to
be to the DNS service port -- thinking this remote host would be the
primary DNS for your host, chosen because it's one of those network
identities without which little else has meaning.  But any host and
service will do, the point is that you know it will be ``out there''
and accepting connections.  The getsockname() on this connection
tells you what your IP address is in the context of ``out there'',
as opposed to one of perhaps several IP addresses that are or were
valid in some back door network shown in /etc/hosts.  It also will
get your network up first, if you're in an ``on demand'' situation
where the address is dynamically assigned.

	Donn Cave, University Computing Services, University of Washington
	donn at u.washington.edu


From herzog at online.de  Wed Apr  5 18:49:16 2000
From: herzog at online.de (Bernhard Herzog)
Date: 06 Apr 2000 00:49:16 +0200
Subject: Tkinter and C extensions
References: 
Message-ID: 

Andrew MacIntyre  writes:

[...]
> My research has turned up ways of determining these via Tk's API
> (Tk_Display(), Tk_Window() in tk.h) provided I can extract the tkwin
> handle from Tkinter's canvas widget - something I've yet to figure out how
> to do from within a C extension.
> 
> I'm wondering whether its possible to get at this information via Tkinter,
> which would simplify the interactions between the various components.

Tkinter widgets have a tk attribute which is basically a tcl
interpreter. It's interpaddr() method returns the TclInterp* pointer as
a python int object. Just pass that and the name of the widget to a
C-extension function and the rest follows from that...

> Any hints on additional sources of enlightment, such as other modules
> which have similarities, would be appreciated.

Sketch's paxmodule does something similar. Sketch uses it to implement
widgets in Python, which allow you to handle expose events yourself and
use Xlib functions to draw the widgets.

-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/


From just at letterror.com  Tue Apr  4 19:23:01 2000
From: just at letterror.com (Just van Rossum)
Date: Wed, 5 Apr 2000 00:23:01 +0100
Subject: ANN: Stackless Python for MacOS
Message-ID: 

I Proudly Present a Not-For-Everybody(tm) Release:

   S T A C K L E S S   P Y T H O N   F O R   M A C O S

I've uploaded a "drop-in" replacement for the PythonCore 1.5.2 shared
library here:
  

It should be fully compatible with the latest MacPython release.


What it is?

Well, it's a modified version of Python which avoids the C stack, written
by Christian Tismer.


But, what *is* it?

Erm, for one, see  and then, for it's killer app
-- Micro Threads -- see .
Stackless Python adds cool, but mind boggling features to Python:
continuations & co-routines.

I'm playing with MicroThread additions to the MacPython IDE, using separate
threads for scripts. This looks *very* promising. If I manage to make
something stable-ish, I'll post IDE patches to the MacPython sig.

General Stackless talk should probably take place on comp.lang.python, Mac
specific issues (as IDE support) should be discussed on the MacPython sig.

Even though I still hardly understand the implications of it all yet,
Stackless is IHMO the most exciting new Python development at the time,
together with Unicode support in 1.6. Stackless will most likely not be
incorporated into Python 1.6, but *maybe* if we make enough noise we can
convince Guido it should go into 1.7... More stackless killer apps please!


Have fun,

Just





From shogan at iel.ie  Fri Apr 28 12:10:27 2000
From: shogan at iel.ie (Shaun)
Date: Fri, 28 Apr 2000 17:10:27 +0100
Subject: struct, xdrlib and array examples?
Message-ID: <00ca01bfb12c$448e0a20$2801000a@iel.ie>

where would i find examples of the struct, xdrlib and array modules in
action?

=====================
Shaun Hogan
Interactive Enterprise Ltd.
alt. E-mail : shaun_hogan at yahoo.com
+353 86 8342529






From hamish_lawson at yahoo.co.uk  Fri Apr  7 05:13:20 2000
From: hamish_lawson at yahoo.co.uk (Hamish Lawson)
Date: Fri, 07 Apr 2000 02:13:20 -0700
Subject: Cacheing sys.path rather than building it each time?
Message-ID: <2e070214.0e300ac8@usw-ex0108-063.remarq.com>

Some overhead in Python's startup time is caused by building
sys.path. Of course you could use the -S option, but then you
don't get a proper sys.path! What about cacheing the constructed
path and a command-line option to specify use of that rather
than building it each time? Presumably you'd also need a tool to
rebuild the path when necessary - perhaps it could be invoked
automatically by the distribution tools whenever a new module
gets installed.

Hamish Lawson


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From thomas at xs4all.net  Fri Apr 21 06:48:17 2000
From: thomas at xs4all.net (Thomas Wouters)
Date: Fri, 21 Apr 2000 12:48:17 +0200
Subject: finding real $0
In-Reply-To: ; from robin@jessikat.demon.co.uk on Fri, Apr 21, 2000 at 10:55:26AM +0100
References: 
Message-ID: <20000421124817.C11481@xs4all.nl>

On Fri, Apr 21, 2000 at 10:55:26AM +0100, Robin Becker wrote:

> Is there any pythonic way to locate the original argument zero of the
> process? I mean the location of python itself not the script. This would
> allow me to launch subscripts without having to rely on the path being
> set up correctly.

Use 'sys.executable':

centurion:~ > python
>>> import sys 
>>> sys.executable
'/usr/bin/python'

centurion:~ > ln -s /usr/bin/python penguin-on-the-telly
centurion:~ > ./penguin-on-the-telly 
>>> import sys
>>> sys.executable
'./penguin-on-the-telly'

It behaves the same way in a script (it returns the python executable
started, not the script.) Dont forget about relative paths though, if you
are going to do stuff based on sys.executable. You probably want to get the
cwd at the earliest possible moment, and translate sys.executable into an
absolute path.

-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



From tjreedy at udel.edu  Thu Apr 27 23:25:57 2000
From: tjreedy at udel.edu (Terry Reedy)
Date: Thu, 27 Apr 2000 23:25:57 -0400
Subject: How can I get the name of an object???
References: <8e712k$65c$1@nnrp1.deja.com>  <8e9090$c4d$1@nnrp1.deja.com>
Message-ID: <8eb01p$kmk$1@news.udel.edu>

As noted already, PyObjects do not have *a* name.
 They do have *an* id (a unique integer),
which is simply retrieved with the id() function.




From glen at electricorb.com  Thu Apr 20 08:03:28 2000
From: glen at electricorb.com (Glen Starchman)
Date: Thu, 20 Apr 2000 12:03:28 GMT
Subject: Java editor for Python
References: <8atgsd$ava$1@vg170.it.volvo.se> 
Message-ID: <38FF1CC5.4A0F7DAF@electricorb.com>

> Be there is a colonizing editor that comes with Python for Python.
> Checkout Idle in the tools directory or Pythonwin.
> 
OUCH! A colonizing editor sounds very painful. Could one consider vi a
colonizing editor?

;-)


> --Darrell


From gberger at channel1.com  Mon Apr 10 21:26:19 2000
From: gberger at channel1.com (Gabriel Berger)
Date: Mon, 10 Apr 2000 21:26:19 -0400
Subject: downloading jpeg using python--extra bytes?
Message-ID: 

Hello,

I wrote a python script to download jpegs from web sites.
(I realize that it's possible to do this using my browser, but
as an exercise, I'd like to be able to do it directly.)

The script works, with one exception: the jpeg image has
extra bytes in it that corrupt the file.  I'm not sure exactly
how the bytes are dispersed, but they're not all at the
beginning or at the end.

I would imagine that I need to modify my http request, but
I don't know how to do so.  Any help would be appreciated.

Here is the script:

import httplib
h = httplib.HTTP('www.something.com')
h.putrequest('GET','/directory/picture.jpg')
h.putheader('Accept','image/jpeg')
h.endheaders()
errcode,errmsg,headers = h.getreply()
f=h.getfile()
data=f.read()
f.close()
g = open("myjpeg.jpg","w")
g.write(data)
g.close()

Thanks in advance,

Gabriel Berger




From tiskander at hologic.com  Mon Apr 24 11:28:29 2000
From: tiskander at hologic.com (Tim Iskander x7483)
Date: Mon, 24 Apr 2000 11:28:29 -0400
Subject: questions about imports and classes
Message-ID: <3904681D.FE39B41A@hologic.com>

Hi,
as a relatively new python user I have a couple of questions...

1 - is it possisble to get the instance name of an object (similar to
the class.__name__
        attribute)

2 - has there been any/much discussion on extending the import command
to allow
        renaming the module at import time,
        ie: import myLongWindedModuleName as myShortName

        using the (new) keyword "as" to rename the module. We are
dealing with a multi
       developer, multitask application using lots of python modules and
we would like to
        give the files non-ambiguous names without having unruly module
names in our code.


Thanks
/Tim

p.s. I am not very vi - literate and cannot get it to use spaces instead
of tabs for autoindent... I will go
and read the FAQ etc... but if its a simple answer that someone can send
me I'd be really happy :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tiskander.vcf
Type: text/x-vcard
Size: 335 bytes
Desc: Card for Tim Iskander x7483
URL: 

From brent.fulgham at xpsystems.com  Wed Apr 19 18:35:54 2000
From: brent.fulgham at xpsystems.com (Brent Fulgham)
Date: Wed, 19 Apr 2000 15:35:54 -0700
Subject: Dynamic web pages! not Dynamic HTML 
Message-ID: 

> [Sunil Hadap]
> > I am really dumb in databases and perl. I am good at python and it's
> > my scripting language for whatever I do in graphics. I want to start
> > doing my homepage which is inspired from
> > 
> > http://www.photo.net/photo/
> > 
> [snip] 
> > 
> > I want to do this in Python. Is zope useful for this, I 
> > don't want to learn a big system as I only want few specific 
> > functions only. Which free database?
> 

Sunil,

The photo.net site is based on a product called the ACS.  It's based on
the open-source AOLserver running in conjunction with an Oracle RDBMS.
It runs on "big iron" and is in nearly all respects beyond the resources
of the average joe for a "live" site because Oracle licenses are so
costly.  The ACS software, however, is GPL'd and can be downloaded from
http://arsdigita.com.

For us mortals, a port of the ACS to run on the PostgreSQL database has 
been accomplished.  See http://acspg.benadida.com.  I have some preliminary
debian packages to set up a skeleton system, which I can make available
if anyone cares.

The only problem with the ACS-pg is that you still need to do your
scripting in Tcl.

So, Titus Brown and I have successfully embedded Python in the AOLserver.
See our project at http://pywx.sourceforge.net.  It is now actually
semi-stable for simple CGI-style operations, and provides a 4-5x speedup
over the straight CGI.

Titus has gotten most of the database-related Tcl functions from the
AOLserver
Tcl API ported to Python.  I'm working on a few others.  Eventually we'll
get them all, but for now it's still a bit limited.

Our near-term goal is to provide access to the ACS and AOLserver through
Python so extensions can be made to a "skeleton" ACS without having to
expend a lot of effort learning Tcl.

Thanks,

-Brent



From mjhand at concentric.net  Fri Apr 21 11:54:12 2000
From: mjhand at concentric.net (Manus Hand)
Date: Fri, 21 Apr 2000 09:54:12 -0600
Subject: Starship update: April 21
References: <3daeirht58.fsf@amarok.cnri.reston.va.us>
Message-ID: <390079A4.73E66400@concentric.net>

Given the update you just put out (that there is only a 25% chance
of recovery!  Aauugghh!!) do you think a proper course of
action is to restore from the 1 Feb backup to the new disk, and
then later -- if the 25% chance comes through -- offer the shipmates
a chance to do a massive diff or something on their files compared
to those that are recovered?

That way at least the ship would start moving again.

Just an idea, and please do not hesitate to call on me for funds
if and when they are needed.

Manus (virtually in tears now, but 1 Feb is a lot better than nothing)




From huy at nsw.bigpond.net.au  Tue Apr 25 08:13:22 2000
From: huy at nsw.bigpond.net.au (Bigpond)
Date: Tue, 25 Apr 2000 12:13:22 GMT
Subject: downloading jpeg using python--extra bytes?
References: 
Message-ID: 

Try using the urllib module,

it handles all this low level stuff for you.

one line can do all that you have specified below, and it works...


Gabriel Berger  wrote in message
news:sf5001f0cqv98 at corp.supernews.com...
> Hello,
>
> I wrote a python script to download jpegs from web sites.
> (I realize that it's possible to do this using my browser, but
> as an exercise, I'd like to be able to do it directly.)
>
> The script works, with one exception: the jpeg image has
> extra bytes in it that corrupt the file.  I'm not sure exactly
> how the bytes are dispersed, but they're not all at the
> beginning or at the end.
>
> I would imagine that I need to modify my http request, but
> I don't know how to do so.  Any help would be appreciated.
>
> Here is the script:
>
> import httplib
> h = httplib.HTTP('www.something.com')
> h.putrequest('GET','/directory/picture.jpg')
> h.putheader('Accept','image/jpeg')
> h.endheaders()
> errcode,errmsg,headers = h.getreply()
> f=h.getfile()
> data=f.read()
> f.close()
> g = open("myjpeg.jpg","w")
> g.write(data)
> g.close()
>
> Thanks in advance,
>
> Gabriel Berger
>
>




From mwh21 at cam.ac.uk  Thu Apr 13 05:37:59 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 13 Apr 2000 10:37:59 +0100
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>
Message-ID: 

"Neil Schemenauer"  writes:

> Garbage collection for Python:
> 
>     http://www.enme.ucalgary.ca/~nascheme/python/gc.html
> 
> I think I have all of the wrinkles ironed out of this patch.
> Reference cycles involving lists, tuples, instances, classes,
> dictionaries, and functions are found.  Instances with __del__
> methods are handled in a sane way.  It is easy to add GC support
> to new types.  GC enabled Python is binary compatible with
> regular Python.  

Woohoo!

> Generational collection works (currently three generations).  The
> overhead measured by pybench is less than 1 percent and is not
> measurable with pystone (on my machine).  Virually all extension
> modules should work unchanged (I had to modify new and cPickle in
> the standard distribution).  A new module called gc is available
> for tuning the collector and setting debugging options.

And in some cases it can be faster; eg. bytecodehacks does a lot of
scary hackery to avoid producing cycles, and if I take the hackery out
and run it under a patched python, it goes quicker (test case in 7.2s
vs 12.5s, so not to be sniffed at).

> The patch is against the current CVS version of Python.  If
> enough people ask for a patch against the stable version of
> Python I will make one.  Please send comments and bug reports.

Haven't found a problem yet.


To someone who might know: what hope is there for this to go into 1.6?


It would be, in my opinion, be a really really really good thing; for
one thing it would help in language wars...

hopeful-ly y'rs
Michael

-- 
  it's not that perl programmers are idiots, it's that the language
  rewards idiotic behavior in a  way that no other language or tool 
  has ever done                        -- Erik Naggum, comp.lang.lisp


From ivanlan at callware.com  Wed Apr 12 15:40:13 2000
From: ivanlan at callware.com (Ivan Van Laningham)
Date: Wed, 12 Apr 2000 13:40:13 -0600
Subject: Off-topic
References: <38F4BE12.A0C73D1D@callware.com>  <38F4C52C.450F611F@callware.com> <38F4C8D6.1AF36727@rubic.com>
Message-ID: <38F4D11D.569AC449@callware.com>

Hi Jeff, All--

Jeff Bauer wrote:
> 
> Ivan Van Laningham wrote:
> > Sh scripts do work, as long as I remember to do ./script ;-).  I'm
> > running as root (but the same thing happens when I run as myself, too).
> 
> Okay, my last post to you went out before I saw the above
> on c.l.py.
> 
> Is there an issue with your PATH environ?
> 
> $ hello.py
> bash: hello.py: command not found
> 
> $ echo $PATH
> /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/jbauer/bin:\
> /usr/local/mysql/bin:/usr/local/jdk/bin:/var/share/s0/bin
> 
> $ export PATH=.:$PATH
> $ hello.py
> Hello, nerd.
> 
> Note that it's probably dangerous to use '.' in your root path.
> 

Yup, of course.

The problem turned out to be two things:  the "h2n" command had not
after all been changed to unix line endings, which made it not work
unless the interpreter was explicitly invoked on it; and forgetting to
/test.py instead of test.py.  Even though I had *just* ./test.sh 5
seconds before, I forgot on test.py.  Bleaugh.

Sorry to waste bandwidth.

ly y'rs,
Ivan;-(
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
http://www.pauahtun.org 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



From jmg at ecs.soton.ac.uk  Wed Apr  5 04:08:38 2000
From: jmg at ecs.soton.ac.uk (Jacek Generowicz)
Date: Wed, 05 Apr 2000 09:08:38 +0100
Subject: Why should I switch to Python? - Infinity of Primes
References: <1257244378-5884705@hypernet.com>
Message-ID: <38EAF486.D5CA8A75@ecs.soton.ac.uk>

Gordon McMillan wrote:

> David C. Ullrich wrote:
>
> > ... Could be that there's a proof of the existence
> > of infinitely many primes using FTA that has some property
> > not shared by Euclid's proof, but "constructive" isn't it.
>
> Oh, come on. There are at least 3 well known constructive
> proofs that all odd numbers are prime:
>
> The mathematician's:
>  3 is prime,
>  5 is prime,
>  7 is prime
>  as so on, by induction.
>
> The physicist's:
>  3 is prime,
>  5 is prime,
>  7 is prime,
>  9 is prime 
>  11 is prime...
>
> The computer scientist's:
>  3 is prime,
>  3 is prime,
>  3 is prime ....
>
> - Gordon

The engineer's:
3 is prime,
5 is prime,
7 is prime,
9 is prime,
11 is prime,
13 is prime,
15 is prime,
.
.
.





From brokeninside at my-deja.com  Mon Apr 24 16:36:50 2000
From: brokeninside at my-deja.com (Lee Malatesta)
Date: Mon, 24 Apr 2000 20:36:50 GMT
Subject: Installing Python on NT
Message-ID: <8e2b92$9n6$1@nnrp1.deja.com>

I'm interested in installing Python on a properly battened down NT
workstation for which I do not have administrative priveledges.  This is
my workstation at work.  Mostly I just want to play around with
SGMLtools which is largely written in Python.  The installer told me
that I have to install logged in as administrator.  This is the first
program I've installed where this was necessary.  Unfortuntely for me to
install this as admin, I'd have to put in a request to PC support, they
would have to review to see if there is a need for me to have Python
installed and then send one of the PC support personelle out to install
for me.

Anyone know of anyway I can circumvent the need to be root to install?

BTW, for the most part I use the Workstation as an Xterminal to do work
on our Solaris boxes, but I'm not even going to start on the
administrative nightmare that would be required to get SGMLtools
installed on our Solaris machines which already have python installed.

Thanks much,

-lee

--
====================================================
Lee Malatesta
Unix Programmer by Day, Wild Eyed Mystic by Night


Sent via Deja.com http://www.deja.com/
Before you buy.


From ljz at asfast.com  Sat Apr  1 10:39:21 2000
From: ljz at asfast.com (Lloyd Zusman)
Date: 01 Apr 2000 10:39:21 -0500
Subject: Why should I switch to Python?
References:  <1EeF4.43$CA.2422@news> 
Message-ID: 

Fran?ois Pinard  writes:

> "Chris Ryland"  writes:
> 
> > Oh, no, not another Perl vs. Python war! ;-)
> 
> That remembers me of a little story that made me smile, years ago.
> This was the comment of a discouraged nurse at a recruiting centre for
> the army, at the entrance of the medical examination room.  "I told
> them for _years_ to remove their shirt, and they still do not know
> they should."
> 
> There will be newcomers to Python all the time, [ ... ]
> [ ... ]
> You people received me with an exquisite
> politeness and patience, and my liking of Python deepened instantly as
> it got kind of fuzzily intermixed, in my fragile mind, with the
> feeling of good human values, as well.

I share your appreciation for the civility and humaneness here in
c.l.python, and I would also add that the lack of this is one of the
main reasons I stopped contributing to a certain other newsgroup that
used to be one of my main haunts for years.  There are literally
dozens of times when I saw newcomers to that newsgroup being treated
with a mind-set that matched that of the nurse in your little story
(and often much worse).

Your story is a gem and I wish I had known it back then, when I had
been trying many other ways to get through to the regulars in that
infamous other newsgroup.

> We should not see the potential for a war every time Perl is
> discussed, and be patient instead.  It looks all pretty bearable so
> far.  And if it was becoming too heavy, we could prepare pre-canned
> replies for the most questions, and even suggest a pointer to this FAQ
> right into the message footer generated for this list.  Welcoming
> people in person is better!

I agree.  The problem will be that once Python reaches a certain
critical mass of popularity, a steady stream of interested newcomers
will start showing up with these FAQ's.  It appears that Python is
nearing that critical mass, and I think that the ensuing influx of
newcomers might very well tax the patience of many of us.  This could
cause many of us to find ourselves temporarily suffering from the
dreaded malady called "ANFM" ("Anti-Newbie Flame Mode").  I would like
to nominate your wonderful little story about the nurse in the
recruiting station as the official Pythonic remedy and vaccine for
ANFM.

> Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard

-- 
 Lloyd Zusman
 ljz at asfast.com


From donn at oz.net  Sun Apr 23 00:04:55 2000
From: donn at oz.net (Donn Cave)
Date: 23 Apr 2000 04:04:55 GMT
Subject: executable "wrapper" gui -- advice sought
References: 
Message-ID: <8dtsp7$e7h$0@216.39.151.169>

Quoth "Grant Goodyear" :
| I'm in the process of writing an exceedingly simple gui that will take an
| already existing binary executable and input text file (I don't want to
| break the
| working system!) and allow the user to modify the input arguments,
| if desired, and then start the executable.  That part is straightforward.
| What I'm not sure how to do is to capture the executable's std out as
| it's generated.  My goal is to echo that output to a seperate window, and
| also to use it to generate a periodically updated html "status report" so
| that the program's progress can be monitored remotely.  Working
| through the gui aspects isn't all that difficult, but I have _no_ idea how
| to grab the executable's std out _while it is running_ and then have the
| python gui do something (anything!) with that data.  Any advice?

To start with, have you decided what operating system you're
going to use for this project?  That will matter a lot!  It
sort of sounds like we're on some type of UNIX, but it may
be important which one.

Can you modify the ``existing binary executable'', if it turns
out to have some minor problems with this arrangement?

Does it have a generally teletype-like interface, where its
output appears at the bottom and everything eventually will
scroll off the top, or does is it a ``full screen'' system?

If you'd rather just start bashing around on something, you
might look at os.popen().  Or depending on your UNIX flavor,
the "pty" module might carry the day.

	Donn Cave, donn at oz.net


From robin at alldunn.com  Thu Apr 27 11:07:33 2000
From: robin at alldunn.com (Robin Dunn)
Date: Thu, 27 Apr 2000 08:07:33 -0700
Subject: [ANNOUNCE] New wxPython
Message-ID: <00be01bfb05a$5178ce00$3225d2d1@ARES>

wxPython 2.1.15 is now available for download from
http://alldunn.com/wxPython/  This release includes new features such as a
new and improved wxGrid, ActiveX wrappers and a wxStyledTextCtrl class.

--
Robin Dunn
Software Craftsman
robin at AllDunn.com
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!





From charlie at intelligenesis.net  Fri Apr 14 12:10:16 2000
From: charlie at intelligenesis.net (Charlie Derr)
Date: Fri, 14 Apr 2000 12:10:16 -0400
Subject: Comparing PythonWin and IDLE?
In-Reply-To: <38F66A4E.92E3BDCA@gmx.de>
Message-ID: 

 	instead of:

import myModule

	try this:

reload(myModule)

	and you should be able to get your recently modified changes to take effect
without restarting python

	~c


Michael Scharf wrote:
|
|David Smith wrote:
|>
|> Warren Postma wrote:
|>
|> >  I find once a module has
|> > been imported once, it often will not import again, even if I
|have changed
|> > the source (.py) file, the .pyc file does not appear to be
|regenerated, and
|> > any errors in the .py file can only be fixed by editing and
|saving the .py
|> > file, quitting the IDE and restarting. This appears to happen
|for both IDLE
|> > and Python. Anybody else seen this?
|>
|> When you edit a file under Idle, Save it and then hit Control-F5.  Then
|> you can re-import the file.
|
|But a re-import should also change existing instances of
|functions, classes and methods defined in the module. OK,
|there are some cases, where a new version is incompatible
|with the old data members, but sometimes it would be
|helpful....
|
|
|Michael
|--
|     ''''\     Michael Scharf
|    ` c-@@     TakeFive Software GmbH, a Wind River Company
|    `    >     http://www.WindRiver.com
|     \_ V      mailto:Michael.Scharf at gmx.de
|--
|http://www.python.org/mailman/listinfo/python-list
|




From mwh21 at cam.ac.uk  Sun Apr  2 16:16:09 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 02 Apr 2000 21:16:09 +0100
Subject: Debugging confusion -- too many stacks!
References: <000a01bf9c6b$3f80c2a0$752d153f@tim> <38E739A1.45F4B199@tismer.com>  <38E75E9C.7501756C@tismer.com>
Message-ID: 

Christian Tismer  writes:

> Hey, we forgot about a stack :-))
> 
> Michael Hudson wrote:
> > 
> > Christian Tismer  writes:
> > 
> > > This VM stack could also be replaced by a set of registers, since
> > > the maximum stack size is always known at compile time.
> > 
> > My gut tells me that making this work with exceptions would be a dog.
> 
> I don't think so. Exception handlers have their own little stack
> in each frame. It is currently fixed to 20 items, wasting quite
> a lot of space most of the time (and this will vanish in
> Stackless "Heresy" 1.2), but it won't cause problems with a
> register machine.

Hmm.  You still need a evalutaion stack though, don't you?  I mean,
implementing function call without would one mean a pretty radical
change to the interpreter.

> > It's the sort of thing that might be fun to play with if the compiler
> > and eval loop were written in Python, but if I have to hack C to play
> > with these things, it just becomes tedious.  Still, maybe if I have a
> > month or two with nothing else to do...
> 
> A while ago, I considered this, too. Meanwhile I don't, since
> it doesn't bear a very reasonable speed gain. The win would be
> to have less of the tiny operations occouring all the time,
> and to have less of stack pointer operations. But when looking
> closer to it, you will find that the most slowdown lies in
> the outmost interpreter loop, which checks for periodic things
> for every opcode, regardless wether it is very fast or a slow
> function call.
> In Stackless Python, I have stolen these cycles already. The eval
> loop has some internal shortcuts to avoid this many checks. The fast
> opcodes are all running as fast as possible, avoiding these
> checks. One could still save some jumps and some assignments,
> but this is not enough to justify the lots of changes that a
> register implementation would impose to other modules.

Oh right.  I haven't looked at stackless python's ceval.c for a while.
A register machine might be a bit more elegant, but not much, I
suspect.

> It can still make sense to provide a hand-full of combined
> opcodes which have high frequency. jump_if_true combined
> with pop_top for instance, or some load/store combinations.
> If you have a proposal, and if you will support them through
> the bytecodehacks, I'd be happy to add them to Stackless Heresy.

Another thing that would make sense is typed bytecodes and typed
registers or a typed stack.  So if you can prove a and b are integers,
say, then you can stick a,b in registers 1,2 and compile

 a = a + b

into 

 IBINARY_ADD 1 2 1

Another observation: all the bytecodes currently understood by the
Python VM have length 1 or 3.  There's no hard limit though;
IBINARY_ADD above would have to be at least four bytes long.  Further,
there's no reason you can't embed chunks of another bytecode in the
midsts of the one the Python VM understands, such as one that operates
on typed registers.  Then you use bytecodehacks to pick functions
apart, do some cfa and dfa to find which variables are floats or ints
and generate typed bytecode for operations on them.

I did some of the above once, then it became apparent that the flow
analysis was far too hard for me.  I might give it another whack
sometime...

Cheers,
M.

-- 
well, take it from an old hand: the only reason it would be easier
to program in C is that you can't easily express complex  problems
in C, so you don't.                 -- Erik Naggum, comp.lang.lisp


From linuxmusic at crosswinds.net  Fri Apr 21 21:24:12 2000
From: linuxmusic at crosswinds.net (John Littler)
Date: 22 Apr 2000 11:24:12 +1000
Subject: urllib (sort of reload) question
Message-ID: 

Hi,
I use urllib to get a number of URLs and parse the
results. One pesky URL doesn't expire it's content
correctly and as an interim measure I need to reload
the page in my browser before getting the data with
python. I'm going through squid so I guess that's where
the old stuff is being picked up.
Does anyone know how to emulate browser "reload" in
python? Looking at the urllib code didn't provide me
with any clues.
TIA
John


-- 
pgp public key @ http://www.crosswinds.net/~linuxmusic/pubring.html


From c.evans at clear.net.nz  Fri Apr 28 05:41:51 2000
From: c.evans at clear.net.nz (Carey Evans)
Date: Fri, 28 Apr 2000 09:41:51 GMT
Subject: Python COM troubles
References: <390a2f04.149999918@news.onlineisp.com>
	
Message-ID: <877ldi36lc.fsf@psyche.evansnet>

"Mark Hammond"  writes:

> If you search deja news, there should be lots of info about this - but
> generally relating to "Lotus Notes", which also has the same problem.
> 
> [BTW - drop them a line, and tell them they should fix their objects :-]

Good news!  From 5.0.2b onwards the Notes client comes with a new COM
interface, in addition to the old `OLE Automation' that doesn't work
very well.  It's only an interface to the backend objects, i.e. things
like NotesSession and NotesDatabase, not the objects with "UI" in
their names, but it's better than LotusScript.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

		 "I can't believe it's not Cthulhu!"


From gmcm at hypernet.com  Wed Apr  5 10:41:20 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 5 Apr 2000 10:41:20 -0400
Subject: Installer Problem Finding Modules
In-Reply-To: <01bf9eb5$7ee884e0$1e41c3d1@Cyberus>
Message-ID: <1257176798-9949680@hypernet.com>

Gordon Williams wrote:

> I am trying to run Gordon McMillan's Installer (3f on W95) and I am having
> a problem with it finding the modules that I am importing into the main
> program. 
[snip]
> The installer ignores the all the imports except for the wxPython stuff
> which it appears to get all of.  Any ideas where I may be going wrong.  I
> hope that I dont have to list all these modules as dependancies as some of
> these modules also call other modules.

These modules are in the same directory as your main script? 
For some reason Win95 fails here, though NT succeeds. The 
workaround seems to be to set 
PYTHONPATH=
in the DOS box before running the Installer.
 
> Maybe this is a related problem, but I dont think so:
> All the modules along with the main module are in a sub directory of the
> installer program.  When I run python ..\simple.py bs_main.py from a dos
> box
> I was geting an error "can't open 'E:Program" when it it was trying to
> start build.py.  I ended up changing simple.py line 74 to
> cmd = '"%s" %s %s %s' % (sys.executable,
>                            '../Builder.py',                      <<< change
> is here
>                            cfgfile, tkcfg)
> 
> to get it to work.

Grrr. The fact that Windows allows spaces in directory names 
doesn't mean the "feature" should be used.

A better fix, I think, is to quote all the %s's.

- Gordon



From effbot at telia.com  Tue Apr 25 10:06:21 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Tue, 25 Apr 2000 14:06:21 GMT
Subject: Question about exception-handling mechanism
References: <8e46mt$4nh$1@nnrp1.deja.com>
Message-ID: 

willfg at my-deja.com wrote:
>    I'm new to Python, but find its exception handling mechanism much
> more powerful than comparable languages; but a question was put to me
> that being new I can't come up with a very articulate answer. A
> colleague asked why in an exception handling mechanism you'd want the
> ELSE block to be executed if you don't throw an exception as opposed to
> a FINALLY block. Anyone used this feature in practice? Thanks in
> advance for your input.

the standard pattern for try/except/else is:

    try:
        do something
    except SomeError:
        deal with error
    else:
        deal with success
    proceed

this could also be written:

    try:
        do something
        deal with success
    except SomeError:
        deal with error
    proceed

but this only works if the "deal with success"
code cannot raise a SomeError exception...

...

try-finally is different; the code in the finally
clause will be executed in either case, but if
there was an exception, it's reraised after the
finally clause has finished:

    create a mess
    try:
        raise SomeError
    finally:
        clean up
    this line will never be reached

hope this helps!










From dworkin at ccs.neu.edu  Tue Apr 25 19:36:51 2000
From: dworkin at ccs.neu.edu (Justin Sheehy)
Date: 25 Apr 2000 19:36:51 -0400
Subject: os.path.walk() question.
In-Reply-To: "Andrew McDowell"'s message of "25 Apr 2000 22:19:44 GMT"
References: <8e55m0$pvl$1@hammer.msfc.nasa.gov>
Message-ID: 

"Andrew McDowell"  writes:

> I need to find out if a file exists under a directory hierarchy.
> The hierarchy could be quite large so I don't want to continue recursing
> through the hierarchy if the file is found one or two directories down.   Is
> there a way that you can tell os.path.walk() to stop searching?

You could put the os.path.walk() call inside a try/except, and raise
an appropriate exception when the desired item is found.

-Justin

 



From tony at lsl.co.uk  Tue Apr 11 10:41:11 2000
From: tony at lsl.co.uk (Tony J Ibbs (Tibs))
Date: Tue, 11 Apr 2000 15:41:11 +0100
Subject: Regular Expression Help for Python Newbie.
In-Reply-To: 
Message-ID: <000901bfa3c3$fabd3f80$f0c809c0@lslp7o.lsl.co.uk>

I was being a pedant about HTML allowing 's to be absent or not...

> Fredrik Lundh replied:
> you're right -- but only in theory ;-)

Well, yes, I knew that!

> so when the browser stumbles upon a  followed by
> a  tag. This is incredible to me
because both Netscape and IE read can view the tables properly. But the
HTMLParser dies on them.

Let me be a little more explicit. The problem files, and there are over
300 of them, have the following structure to their tables.

, it can easily figure the rest out itself, based on the > DTD. in that case, and in the example given, because it's not in a record 'cos it's just ended one, yes, it's obviously easy. Then, on trying to "guess" what to do next: > > And obviously that's what some browsers do. This way also lies > > madness. > > some? I suspect 99.99% of browsers used for serious surfing > do things like this -- and *much* more... (if you want to see > some real madness, go browse the original navigator sources ;-) as I said, madness did lie that way! (you perhaps haven't spent as much time as I have trying to get browsers to behave correctly when they have *correct* HTML, or striving to find out what is wrong when they guess wildly incorrectly because of a stupid typo - "where did the rest of my page go?". I seem to be fated that way sometimes). I don't mind the browser attempting to continue, what I mind is wild unpredictability... > (the real design mistake is of course to do the fixes in the > browser, instead of doing them in the authoring system or > the server, but that's another story). on which we agree entirely. Unfortunately, given all the people who don't know what they're doing when they write authoring (well, I hesitate to say "systems") I guess we're stuck. But it's still a pity, and I can't help grumbling. And (as you gave an example) obscure messages from validators don't help at all. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.demon.co.uk/ Feet first with 5 wheels... My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From dan at cgsoftware.com Sun Apr 9 12:22:17 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Sun, 9 Apr 2000 09:22:17 -0700 (PDT) Subject: tabular data In-Reply-To: <8cq9io$ca0$1@nnrp1.deja.com> Message-ID: On Sun, 9 Apr 2000 poupaerte at my-deja.com wrote: > Hi > > > def sortedby(list,*indices): > > I didn't know Python worked with pointers, or else what does *indices > mean? The fine manuals do not explain the *var construct ... It's not a pointer, it's a tuple of the rest of the arguments passed in. def test(a,*b): print "a",a,"b",b >>> test(5,6,7,8,9,10,11) a 5 b (6, 7, 8, 9, 10, 11) > > > nlist = map( lambda x,indices=indices: > > The expression "indices=indices" seems absolutely strange to me. I > don't have a clue of what it could be doing, except for being true at > all times. > i missed the rest of the message, so i can't tell without the rest of the map command. > Is there some kind of lengthier tutorial on the lambda construct; it > seems quite an advanced construct not easily to be found elsewhere in > other programming languages, a bit like regexes ... I want to say lambda originated in LISP, but i could be wrng. It's used extensively in lisp and scheme. > > Greetings > Erik > From mdefreitas at sikorsky.com Thu Apr 27 14:19:22 2000 From: mdefreitas at sikorsky.com (mdefreitas at sikorsky.com) Date: Thu, 27 Apr 2000 18:19:22 GMT Subject: Q: Recursive embedded Python interpreters? Message-ID: <8ea0ao$fro$1@nnrp1.deja.com> I am working on a helicopter simulation user-interface that takes commands such as: > start_sim > freeze_sim > altitude = 100.0 > end_sim I would like to add scripting capabilities to this user-interface, so I am attempting to extend and embed Python. I am adding a new command (python) to my user interface that will run a python script with optional arguments: > python script.py arg1 arg2 My first step was to extend python with a module ?ui? that python scripts can import to execute various user interface commands. This was fairly easy. I am now trying to embed the python interpreter into my user interface. I anticipate a possible problem when a python scripts executes the ?ui? command to run another python script. I anticipate re- entry issues. I assume I have to create a new interpreter for each nested call to the python interpreter. I really don?t understand the mechanics of how this works, but from comp.lang.python archives, and from the Demos/pysvr example that came bundled with the python1.5 distribution this is what I think I have to do: static int nest_level = 0; static PyThreadState *gtstate = 0; void interp(char *script) { if (nest_level == 0) { nest_level++; // init topmost interp Py_Initialize(); PyEval_InitThreads(); gtstate = PyEval_SaveThread(); } else { PyEval_ReleaseLock(); // nested interp needs to relinquish lock? } PyEval_AcquireLock(); PyThreadState *tstate = Py_NewInterpreter(); FILE *fd = fopen(script, ?r?); PyRun_SimpleFile(fd, script); Py_EndInterpreter(tstate); PyEval_ReleaseLock(); nest_level--; if (nest_level == 0) { PyEval_AcquireThread(gtstate); // top-most interp... clean up gtstate = 0; Py_Finalize(); } else { PyEval_AcquireLock(); // need to reacquire lock if nested? } } Is this right? Did I miss anything? Also? how do I pass arguments to the (possibly nested) scripts. Thanks in advance for any help. Sent via Deja.com http://www.deja.com/ Before you buy. From donn at u.washington.edu Wed Apr 26 18:03:52 2000 From: donn at u.washington.edu (Donn Cave) Date: 26 Apr 2000 22:03:52 GMT Subject: global variables or inheritence References: <28pzoqghaoh.fsf@lada.kom.auc.dk> <28p8zy0irgc.fsf@lada.kom.auc.dk> <28p4s8oipzh.fsf@lada.kom.auc.dk> Message-ID: <8e7p48$ljg$1@nntp6.u.washington.edu> Quoth Thomas Rasmussen : ... | Well i'm programming a small admin tool, which must use the users | $EDITOR for editing files. This works fine if the EDITOR sysenv is | set, if not, then i want to ask the user which editor he want to use, | and then pass this variable to the module that handles | filemanipulation. This modules is also in another file if it | matters... I must add that this is my first real program made in | python... When things get difficult in Python, my reflex is to write a big hairy class. Maybe something like this would work, or at least give you an idea: import os import sys class UserEditor: def __init__(self, default_editor = None): self.program = default_editor def get(self): if not self.program: try: self.program = os.environ['EDITOR'] except KeyError: sys.stdout.write('Editor? ') ... etc. return self.program def set(self, editor): self.program = editor def invoke(self, file): program = self.get() return os.system('%s %s' % (program, file)) == 0 editor = UserEditor() Let's say that's at module scope in the "interfaces" module. In other modules you may say filemanipulation.xyzfile(interfaces.editor.get(), ...) or maybe this class will turn out to be a convenient place to do some stuff that is now cluttering up filemanipulation, so you should say filemanipulation.xyzfile(interfaces.editor, ...) Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From aahz at netcom.com Sun Apr 9 01:45:09 2000 From: aahz at netcom.com (Aahz Maruch) Date: 9 Apr 2000 05:45:09 GMT Subject: Windows quotes (was Re: Installer Problem Finding Modules) References: <1257176798-9949680@hypernet.com> Message-ID: <8cp5d5$qcu$1@slb6.atl.mindspring.net> In article <1257176798-9949680 at hypernet.com>, Gordon McMillan wrote: > >Grrr. The fact that Windows allows spaces in directory names doesn't >mean the "feature" should be used. > >A better fix, I think, is to quote all the %s's. I re-discovered recently that you need to use "-style quotes on Windows; '-style quotes don't work. -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac, and Ritalin? --Aahz From conversy at lri.fr Thu Apr 20 13:10:17 2000 From: conversy at lri.fr (Stephane Conversy) Date: Thu, 20 Apr 2000 19:10:17 +0200 Subject: problem implementing a threaded module References: <38FF2069.1F25@marshall.edu> Message-ID: <38FF39F9.6334571F@lri.fr> Hi. I'm trying to implement a C module that launches a pthread and calla a python call-back. I think it's not a big deal for those who know how to do it, but my implementation does not work (seg fault). I didn't really understand what to do exaclty: should I create an interpreter state for each thread, using PyInterpreterState_New ? should I create a thread state for each thread with PyThreadState_New and swap it with the current thread state ? I can't figure out what to do. Is there any example that just creates a pthread and calls a python func ? Thank you. -- St?phane Conversy http://www-ihm.lri.fr/~conversy/ mailto:conversy at lri.fr From warlock at eskimo.com Sun Apr 9 16:08:11 2000 From: warlock at eskimo.com (Jim Richardson) Date: Sun, 09 Apr 2000 20:08:11 GMT Subject: Why should I switch to Python? - Infinity of Primes References: <8coh4i$hnu$1@newshost.accu.uu.nl> Message-ID: On 8 Apr 2000 23:59:14 GMT, Martijn Faassen, in the persona of , brought forth the following words...: >Summary of the thread: > >Why should I switch to Python from Perl? >[usenet lore knows that huge flamewar may be about to explode] >Some discussion on Python versus Perl. >Under what circumstances Python could be better. >Several people say: stick to Perl if you're already comfortable with it. >[usenet lore scratches its head] >Tim Peters joins in. >thread segues into math. >[usenet lore looks flabbergasted] >long discussion on math, formal proof of the infinity of primes ensues >Constructivist math, Brouwer, half of Pythondom joins into the discussion >[usenet lore panics!] >Discussion mentiones Haskell and Scheme, as they always do. >[usenet lore goes mad and concludes original poster should switch to >Haskell, *now*] > >I just think this thread is very funny. It should count as a reason to >use Python. Although the place has become a bit hectic at times in this >newsgroups, we seem to have various antibodies against flamewars here. :) > It's Python-jitsu Don't fight the flamers, use their energy for constuctive discussions :) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From effbot at telia.com Mon Apr 3 17:45:41 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 03 Apr 2000 21:45:41 GMT Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E52716.A1C63B5D@roguewave.com> <38E52D76.1820FC32@roguewave.com> <8c7tfd$k80$1@nntp9.atl.mindspring.net> <8catgc$5i84$1@uvaix7e1.comp.UVic.CA> Message-ID: <9i8G4.1196$n68.192123904@newsb.telia.net> John Aycock wrote: > Although I don't have time to volunteer, it wouldn't be too difficult > to write a program which would look through existing Python code and > warn of potential uses of these changed constructs. after reading your post, tim peters used barry's new "post via the time machine" facility: http://www.deja.com/=dnc/getdoc.xp?AN=591243549 changing it to look for "connect" should be trivial (he's probably done that by now). fwiw, while it may miss many real appends (see comments in script), I'm pretty the number of missed connect calls are very close to zero. From neelk at brick.cswv.com Fri Apr 28 19:44:20 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 28 Apr 2000 23:44:20 GMT Subject: What does "first class" mean? References: <3909F2F5.A6F91256@spacenet.tn.cornell.edu> Message-ID: Tom Loredo wrote: > > I've often seen reference here (and on the Ruby page) to Python's > treatment of functions and methods as "first class objects." What > does this mean? It means that functions and methods are values just like like lists and numbers. Basically, you can write functions that accept functions as arguments, return them as values, create new ones and bind them to variables just like any other object. In Pascal or C, for example, you can't write a procedure that creates a function and returns it to its callers, whereas in Scheme or Python this is trivial. Neel From duncan at rcp.co.uk Wed Apr 19 07:11:52 2000 From: duncan at rcp.co.uk (Duncan Booth) Date: 19 Apr 2000 11:11:52 GMT Subject: WBMP support for PIL Message-ID: <8F1B74290duncanrcpcouk@194.238.50.13> I just wrote a WBMP module for PIL. If anyone wants it they can download it from http://www.rcp.co.uk/distributed/Downloads (the file is wbmpconvsrc.zip). The download includes a script for converting between WBMP and any other PIL supported bitmap format. For those that dont know: WBMP is wireless bitmap format, the graphic format used by WAP mobile phones. PIL is Python Imaging Library, but you all knew that anyway. From mhammond at skippinet.com.au Wed Apr 12 06:17:17 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 12 Apr 2000 10:17:17 GMT Subject: Embedding Python in Visual C++ 6.0 References: <8d1he4$26d$1@nnrp1.deja.com> Message-ID: You also need to override InitApplication(). I should update the docs, but until then, simply look at Pythonwin.cpp and see what it does - whatever it does, it obviously works :-) Mark. wrote in message news:8d1he4$26d$1 at nnrp1.deja.com... > Hy! :-) > > Maybe someone (Mark Hammond??) can help me. I > tried to embedd the win32 extentions from Mark in > a visual c++ project, but everytime the > Win32uiInitInstance() is called (via > glue.InitInstance()) I get an unhandled > exception at 0xC0000005 Access Violation and the > debugger jumps to 1E401F69 - the address of the > Win32uiInitInstance() function. When i try create > a break-point in this function this break-point > is disabled %-( by the compiler. The same is true > if i try to debug the original pythonwin project. > > Help please! > > Matthias > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From none at none Wed Apr 19 15:43:20 2000 From: none at none (Eric Jacobs) Date: Wed, 19 Apr 2000 14:43:20 -0500 Subject: Very Horrible Question About Goto's References: <6325E90C8B6ED21189080001FA7E2ADA0D4051@IBA1><2hkL4.8514$5D.18609@ozemail.com.au> Message-ID: In article <2hkL4.8514$5D.18609 at ozemail.com.au>, "Jason Stokes" wrote: > > >Richard Jones wrote in message >><6325E90C8B6ED21189080001FA7E2ADA0D4051 at IBA1>... > >I'm trying to create a converter from our own internal language > (horrid) >into python. My only problem so far is that the original language > uses >*LOTS* of goto's. Is there any way that this can be replicated within >>python ? > > > Yes and no. It should be possible to translate arbitary gotos into > Python constructs, but the results won't be readable by a human programmer. > I'm not quite sure how right now, but I could think about it. Because the > Goto is such an unstructured construct, it's hard to translate it into > structured terms without bizarre circumlocutions. In fact, it may not even be directly possible in a general case. Here's a loop with two entry points: if (something) goto entry2 entry1: ... (1) entry2: ... (2) goto entry1 The idea here is called reducibility; it means the edges in the flow graph which create cycles must point to blocks which have already been encountered on the path to that edge ("back edges"). Here, the second goto violates that requirement. This means that it can't be reduced to a hierarchy of blocks (whether Pythonic blocks or otherwise.) It IS possible to translate it by duplicating code: if (something) { ... (2) } entry1: ... (1) ... (2) goto entry1 and that's how most C compilers would probably handle it anyway (for optimization purposes). Formally, it's not the same flow graph, but it does the same things. From phd at phd.russ.ru Sun Apr 9 12:37:48 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Sun, 9 Apr 2000 16:37:48 +0000 (GMT) Subject: Python paradigms In-Reply-To: <1j2I4.252$rc9.186596864@newsb.telia.net> Message-ID: On Sun, 9 Apr 2000, Fredrik Lundh wrote: > Oleg Broytmann wrote: > > blah = ((foo() and [poo()]) or [boo()])[0] > > > > In C, "foo() ? poo() : boo()" will not call boo() if foo() returns > true; > > but in Python, you'll have a side-effect of calling boo() even if foo() > > returns true - what is wrong, usually. > > did you try running the code? > > python's "and" and "or" operators doesn't evaluate the > second argument unless they really have to... Yes, I missed that, sorry. Anyway, it is strange (not to say "ugly") construct; I prefer not to see it in a code... Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From schmitthead at my-deja.com Mon Apr 24 02:08:29 2000 From: schmitthead at my-deja.com (schmitthead at my-deja.com) Date: Mon, 24 Apr 2000 06:08:29 GMT Subject: regulare expression searches and newlines Message-ID: <8e0oco$k75$1@nnrp1.deja.com> I was doing a search like this: searchobj = re.compile( r'^foobarbaz' ) where I was looking for something at the beginning of a line. This works well for native text files, but not when I was searching through Linux files running on NT or NT files on Linux or some other variation because of the newline difference, I guess. Is there any way to handle the general case? Sent via Deja.com http://www.deja.com/ Before you buy. From gregm at iname.com Thu Apr 27 08:08:21 2000 From: gregm at iname.com (Greg McFarlane) Date: Thu, 27 Apr 2000 22:08:21 +1000 Subject: accessing BLT vectors from C In-Reply-To: <8dq957$tc8$1@nnrp1.deja.com>; from genehilton@my-deja.com on 21 Apr 2000 at 07:11:47PM References: <8dq957$tc8$1@nnrp1.deja.com> Message-ID: <20000427220821.63091@nms.otc.telstra.com.au> Gene, What is the value of bltname? The names that Pmw give to Blt vectors are PY_VEC0, PY_VEC1, PY_VEC2, etc. You can see what Tcl calls are being made by calling Pmw.tracetk(). For example, this Pmw: v = Pmw.Blt.Vector(1) prints: CALL TK> 1: ('::blt::vector', 'create', 'PY_VEC0(1)') -> '::PY_VEC0' Which means, in tcl: ::blt::vector create PY_VEC0(1) --> ::PY_VEC0 So Blt_VectorExists(interp,"PY_VEC0") should return true. If not, I'm not sure what the problem is. Greg On 21 Apr, genehilton at my-deja.com wrote: > Has anyone out there written anything that will enable me to access > the BLT C api. I am using BLT as a part of a data acquisition > system. It works great, but filling the vectors is really slow in > python. I wrote a python module in C to use the Blt c api, but it can't > find the vectors I created with Pmw.Blt.Vector(). I can access (in the > c module) vectors that I create in the c-module. This must be some sort > of TCL thing I don't understand. Here is a snippet from the C module > > > if (!PyArg_ParseTuple(args, "OO",&master,&bltobj)) return NULL; > > /* get the name of the vector - PMW stores it as the repr. */ > bltobjname=PyObject_Str(bltobj); > if (!bltobjname) return NULL; > bltname=PyString_AsString(bltobjname); > if (!bltname) return NULL; > printf("%s\n",bltname); > /* get the interpreter from an argument (for now) */ > interp=((TkappObject *)master)->interp; > > /* this doesn't work (returns a 0) */ > printf("%d\n",Blt_VectorExists(interp,bltname)); > printf("%d\n",Blt_CreateVector(interp,"myvec",1,&vec)); > /* this works (returns a 1) */ > printf("%d\n",Blt_VectorExists(interp,"myvec")); > > I call it with the following python code > > import Tkinter > import Pmw > import mymod > v=Pmw.Blt.Vector(1) > mymod.myroutine(master.tk,v) > v=Pmw.Blt.Vector(1) > > I get an output like > 0 (couldn't find it - v created in python) > 0 (created ok in c) > 1 (found the one created in c) > > Any pointers would be real helpful > > Gene Hilton > hilton at boulder.nist.gov > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list > -- Greg McFarlane INMS Telstra Australia gregm at iname.com From sabren at manifestation.com Sun Apr 23 02:42:43 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 23 Apr 2000 02:42:43 -0400 (EDT) Subject: code not true? In-Reply-To: Message-ID: On Sun, 23 Apr 2000, David Goodger wrote: > > Why is this the case? I mean.. I understand why decimals are hard to > > show in binary... But why can't we use variably long strings, or > > something? Is it just a speed issue? > > Try writing 1/3 in decimal. How many digits do you need to represent it > *exactly*? Same issue for 0.07 in binary floating point. Hmm... I see your point.. I'm going to go out on a limb here, though.. wouldn't "0.1" be a simple string representation of that number in base 3? We could make it: "3:0.1" or something to show which base its in.. If python is going to have radix methods for numbers, then it would seem to me that you could store floats in whichever system made it easiest to express them. I guess there's still numbers like pi out there... But even so, if you're only talking about adding and subtracting and multiplying floating points.. Hmm... Well, okay... I give up. :) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From paulb at infercor.no Tue Apr 4 04:37:45 2000 From: paulb at infercor.no (Paul Boddie) Date: Tue, 04 Apr 2000 10:37:45 +0200 Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> Message-ID: <38E9A9D9.20556D1C@infercor.no> Tres Seaver wrote: > [Single argument 'connect' and the standard libraries] > This is *not* the same case as the list.append() one, where the > published interface was itself consistent -- I was quite surprised to > learn just this spring that multi-argument append was even possible. Same here. > But the socket module is one of the first I learned in Python, and I > have consistenly used the two-argument connect. Constructing a spurious > "address" object (which has no behavior, and exists only to be torn > apart inside the implementation) seems a foolish consistency, beyond > doubt. Yes, without defining the type of the argument there and then, the reader is going to start looking around for some kind of hint, and what do they find? And I can hardly see any positive aesthetic in the use of a tuple as an argument when "normal" arguments would be more "Pythonic" - they would at least allow you to write this: s.connect(address="123.45.678.9", port=1234) Although I hear that some code uses a tuple for 'address'... ;-) > Rough-consensus-and-running-code-wins-every-time'ly Indeed. Paul From thomas at xs4all.net Mon Apr 17 16:12:13 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Mon, 17 Apr 2000 22:12:13 +0200 Subject: Another question In-Reply-To: ; from jmassung@magpiesystems.com on Mon, Apr 17, 2000 at 09:22:05AM -0600 References: Message-ID: <20000417221213.I15664@xs4all.nl> On Mon, Apr 17, 2000 at 09:22:05AM -0600, Jeff Massung wrote: > Okay, another quick question. If it is quicker to do: > import random > from random import randint > for i in range(1,1000000): > print randint(1,10) > than this: > import random > for i in range(1,1000000): > print random.randint(1,10) > Why would I not do "from import *" with every module I load? Everyone else already gave you good answers, but since you're primarily concerned about minor speedups: Using 'from module import *' is a bad idea if you want speed; it turns off certain optmizations ! Exactly the oposite of what you intended :) See a posting by Tim Peters a couple of months back, on optimizations. The gist of the message was something like this: In absense of unpredicably namespace modifying code ('from module import *' and 'exec something' in the local namespace, if I recall correctly) all local variable lookups are translated into a simple vector into the local namespace. So, 'dont do that'. If you *insist* on that kind of speedup, import all items by name. (But dont forget: if your module namespace gets too large, you'll end up paying a price in performance ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jon at dgs.monash.edu.au Tue Apr 11 22:40:23 2000 From: jon at dgs.monash.edu.au (Jonathan Giddy) Date: Wed, 12 Apr 2000 12:40:23 +1000 (EST) Subject: ANNOUNCE: Python 1.6 alpha 2 In-Reply-To: <"00Apr11.191729pdt.3438"@watson.parc.xerox.com> from "Bill Janssen" at Apr 11, 2000 07:17:38 PM Message-ID: <200004120240.MAA11342@nexus.csse.monash.edu.au> Bill Janssen declared: > >ILU seems to work fine with it. > >Bill Without wishing to jinx this good news, isn't the release of 1.6 the appropriate time to remove the redundant thread.h file? Jon. From bobalex at home.com Mon Apr 3 11:24:08 2000 From: bobalex at home.com (Bob Alexander) Date: Mon, 3 Apr 2000 08:24:08 -0700 Subject: Tuples -- who needs 'em Message-ID: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> This is not an [intentional] flame bait, nor an April Fool's message, but think about it: Python has two "sequence" data types, lists and tuples, which from the Python programmer's perspective are only slightly different. How does having both types significantly improve life for Python programmers? I can think of a few ways in which it makes life worse. Although I doubt that having both types prevents anyone from mastering the language, it does add some cognitive load in choosing whether to use a list or a tuple when a sequence data type is needed. There are times when I started with the "tuple" choice (since it's more "minimal" than list one should choose it when one doesn't need the additional list features, right?) but later changed it to list because I needed a list-type feature. Usually that would be the need for mutability, but sometimes it's unrelated to mutability, like wanting a method to search for a specific element (list.index()). (Can someone tell me why index() and count() are not available for tuples?) Even small reductions in cognitive load can yield significant benefits in ease of use of a language. Suppose Python had only one sequence data type: list, and that we could use it in all places where tuples are needed now. I would never have to think about whether to use tuple or list. I would never have to convert from tuple to list or vice versa. Just one more thing I don't have to bother with. I suspect there will be several answers offered as to why we need both types, but I also suspect most of the benefits are for the Python implementor(s), not programmers. Yes, there are probably a few times where the ability to create an immutable sequence is useful, but is that enough to warrant the additional complexity of a whole additional datatype? If immutable sequences are so useful, then why not immutable mapping types, etc. etc.? Note that this message is coming from a Python fan, not a critic. This is just an issue that has piqued my curiosity. Python is for the most part a language where design choices have been in favor of ease of programming, with few concessions to making life easier for language implementors. Having both lists and tuples seems to be an exception. -- Bob From gregm at iname.com Thu Apr 20 11:25:47 2000 From: gregm at iname.com (Greg McFarlane) Date: Fri, 21 Apr 2000 01:25:47 +1000 Subject: A tkMessageBox question! In-Reply-To: <38FDC335.B9FDCFE4@icestormfx.com>; from Sylvie Bruneau on 19 Apr 2000 at 10:31:18AM References: <38FDC335.B9FDCFE4@icestormfx.com> Message-ID: <20000421012547.10596@nms.otc.telstra.com.au> Instead of using the built-in Tk dialogs you may like to try the Pmw dialoges. All options of all component widgets can be fully configured. For example: dialog = Pmw.MessageDialog( title = 'Simple message dialog', message_font = 'Times 12', defaultbutton = 0, message_text = 'A simple message dialog\nwith no callback.' ) The 'message_font' component option accesses the 'font' option of the 'message' component (which is a Tkinter.Label widget), so you can reconfigure to your heart's content. Pmw home page: http://www.dscpl.com.au/pmw/ On 19 Apr, Sylvie Bruneau wrote: > Hi Everybody. > > I am using Python for an inhouse tool that runs on irix and WinNT. I needed to > popup some message dialogs so I used the dialogs provided by Tkinter, ie, the > tkMessageBox. On irix, the appearance of the dialogs are really ugly since the font > is 'Times 18'. I want to change the font of the dialogs but I can't find how I can > do it ! > > I look at the available options for the tkMessageBox at > http://w1.132.telia.com/~u13208596/tkintrobook/standard-dialogs.htm. None of them > let me change the font. Then I looked in the code of tkMessageBox.py to find that > the dialogs are completely done in Tcl/Tk and the 'Times 18' is hardcoded in a file > called msgbox.tcl. > > How can I change this font ? Thank you for you help ! > > Sly > > -- > /=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/ > Sylvie Bruneau ( sylvieb at icestormfx.com ) Tel: (514) 527-3963 > Software Developer, IceStorm Digital. Fax: (514) 527-5165 > 2595 Place Chasse, Montreal, Quebec, H1Y 2C3. > > La vie est un cadeau parfois difficile a deballer. (P. Brassard) > > -- Greg McFarlane INMS Telstra Australia gregm at iname.com From warlock at eskimo.com Sat Apr 8 00:50:36 2000 From: warlock at eskimo.com (Jim Richardson) Date: Sat, 08 Apr 2000 04:50:36 GMT Subject: opening a serial port at a given baudrate. How? References: <200004050319.NAA08789@piglet.dstc.edu.au> <38EB577C.E1EC5704@bioreason.com> Message-ID: On Wed, 05 Apr 2000 09:10:52 -0600, Mitch Chapman, in the persona of , brought forth the following words...: > > >David Arnold wrote: >> >> -->"Jim" == Jim Richardson writes: >> >> Jim> I have been using open('/dev/ttyS0','r+') but need to control >> Jim> baud rate. fcntl.ioctl() will do this? >> >> as someone else pointed out (sorry, lost the mail), the termios module >> is the go for setting baud rates, parity, etc. > >Here's an old answer, courtesy of www.deja.com: >http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=309748544&fmt=text > >Search for "# Set the baud rate." > >-- Thanks, this is helpful :) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From gresham at mediavisual.com Fri Apr 14 14:30:32 2000 From: gresham at mediavisual.com (Gresh) Date: Sat, 15 Apr 2000 02:30:32 +0800 Subject: problem with os.system calls under win32 References: <1256392132-57146878@hypernet.com> Message-ID: <8d7o4d$c8h1@imsp212.netvigator.com> Actually I was trying a similar thing, and decided to be smart and use os.path.join but this is what happened: >>> import os >>> os.system(os.path.join("D:","My Documents","test.bat")) 'D:\My' is not recognized as an internal or external command, operable program or batch file. 1 However: >>> os.path.exists(os.path.join("D:","My Documents","test.bat")) 1 That's a bit confusing ! Of course from Gordon's example: >>> os.system('"%s"' % (os.path.join("D:","My Documents","test.bat"))) 0 works Regards, Paul "Gordon McMillan" wrote in message news:1256392132-57146878 at hypernet.com... > william_93402 at my-deja.com wrote: > > > I am attempting to do a system call in a directory with spaces in the > > name. For example: > > > > >>>import os > > >>>os.system('c:\\f o o\\bar.exe') > > 1 > > > > when I place the executable in a dir such as c:\\foo I can successfully > > execute the system call. Is there something special I have to do when > > directory names contain spaces? Just for notes I am running by example > > in build 125 of pythonwin. > > Follow MS's rules: > os.system('"c:\\f o o\\bar.exe"') > > (must be double-quotes). > > - Gordon > From ullrich at math.okstate.edu Sat Apr 1 14:07:35 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Sat, 01 Apr 2000 13:07:35 -0600 Subject: Does Python have a long floating data type please? References: <000201bf9b9b$32560e80$2f2d153f@tim> Message-ID: <38E648F7.D4AB7F7F@math.okstate.edu> Tim Peters wrote: > [David C. Ullrich, notes some examples of dubious intervals computed > by Jurjen N.E. Bos's real.py module] One was dubious, the other was wrong. (Never mind...) > Yes, and I've posted others in the past (including cases that aren't near > 0). Musta been before my time. > Jurjen used a very clever storage-efficient representation, but didn't > record correspondingly clever correctness arguments . Sometimes it's > easy to see a bug, sometimes I have no idea what he was thinking. > > This isn't unusual for these kinds of pkgs, though! Correctness proofs can > be quite involved. Val?rie M?nissier-Morain has submitted a 59-page article > giving correctness proofs for her version of this quest, available somewhere > more-or-less obvious under > > http://pauillac.inria.fr/~menissier/ > > > ... - at this point I decided to give up on real.py and make my own. > > Which is why there are a dozen packages like this out in the world each with > its own set of unique subtle bugs . Since this stuff runs too slow to > use for truly large problems anyway, I never understood why pkgs try to > conserve storage at the cost of vastly subtler reasoning. Exactly what convinced me that a real should be a pair of longRationals (giving a lower bound and an upper bound for the "real" value). At least the basic arithmetic operations seem simple enough that a person could get them right, and they'd be obviously right. > Guess it's seen > as a challenge. > > personally-more-excited-by-things-that-are-obviously-right-than-by- > things-that-aren't-obviously-wrong-ly y'rs - tim class real: def __init__(self, l, u): self.l = l self.u = u def __add__(self, other): return real(self.l + other.l, self.u + other.u) Pretty exciting stuff. (Well, the correctness of __mul__ might not be obvious at one glance like __add__ above, because of what happens if l < 0 and u > 0, but it should nonetheless be extremely trivial to verify.) DU From effbot at telia.com Mon Apr 17 12:45:26 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 17 Apr 2000 16:45:26 GMT Subject: Python flak??? References: <8dfdmq$v1o$1@nnrp1.deja.com> Message-ID: Arint? wrote: > What are the reprecussions of doing a PyErr_Clear() when there is > no error? also see: http://www.python.org/doc/current/api/exceptionHandling.html void PyErr_Clear () Clear the error indicator. If the error indicator is not set, there is no effect. From MSteed at altiris.com Tue Apr 25 13:24:57 2000 From: MSteed at altiris.com (Mike Steed) Date: Tue, 25 Apr 2000 11:24:57 -0600 Subject: Don't understand error message Message-ID: <65118AEEFF5AD3118E8300508B1248774CB2B4@ALTNET> > From: Michael Hudson [mailto:mwh21 at cam.ac.uk] > Sent: Tuesday, April 25, 2000 11:22 AM > To: python-list at python.org > Subject: Re: Don't understand error message > > > "Lars Lundstedt" writes: > > > import sys, glob, operator > > print sys.argv[1:] > > sys.argv = reduce(operator.add, map(glob.glob, sys.argv)) > > print sys.argv[1:] > > > > When called with "python glob.py *.py" on Win98 I'm > supposed to get a list > > of all .py files in the current directory but instead I get: > > > > Traceback (innermost last): > > File "glob.py", line 1, in ? > > import sys, glob, operator > > File "glob.py", line 3, in ? > > list = reduce(operator.add, map(glob.glob, '*.py')) > > TypeError: call of non-function (type module) > > > > Anyone know why? > > "Works here". Is that *really* your *entire* script? You haven't > snuck a module called "reduce" in anywhere? It works on WinNT 4 too. I see that the line that Python is complaining about does not appear anywhere in the script in your message (close, but not exactly). Something is missing. > Mind you, I'm on Linux - but that's shouldn't really affect this. > > Cheers, > M. ^^ (I thought that was my .sig) M. From M_Pope at shef.rage.co.uk Mon Apr 10 08:41:10 2000 From: M_Pope at shef.rage.co.uk (Mark Pope) Date: Mon, 10 Apr 2000 13:41:10 +0100 Subject: Extending built-in language (Win 95) Message-ID: <213CDEBFDDA7D3118081009027E40C56071113@SHEF-MS1> Hi, I would like to extend the objects available in python, however It is not appropriate to build normal extension dll's. The file: \python-1.5.3\objects\xxobject.c Appears to be a template for defining new built in objects which will be compiled into the Python static lib. However there must be other steps to making the new object reachable from python script. There are plenty of examples on how to make the normal DLL extensions, but this doesn't help. Can somebody point me at a tutorial for extending the built-in functionality. thanks, mark. From bobalex at home.com Thu Apr 6 11:14:30 2000 From: bobalex at home.com (Bob Alexander) Date: Thu, 6 Apr 2000 08:14:30 -0700 Subject: Tuples -- who needs 'em References: <200004060137.LAA27607@nexus.csse.monash.edu.au> Message-ID: <009a01bf9fda$ce66e540$74eb0b18@stcla1.sfba.home.com> "Jonathan Giddy" wrote: > I nearly fell out of my tree when Alexander, Bob declared: > > >I am wondering where the serious concern about mutable lists comes from, as > >it is a pattern in the responses I've gotten on this topic. For me, the > >immutable list is a relatively new concept, since I can't think of many > >other languages that have it. I'm a programming-language-design kind of > >person, and I never really saw mutable lists as a problem that needed > >solving. > > How about C? Surely 'const' is an attempt to mark arrays as immutable. Okay, that's true. Clearly my statement is exaggerated. Still, I can't recall many instances where having only mutable sequences has caused me trouble -- and this is over 30+ years of programming. And sometimes I pine for the days before "const" was introduced :-) > Avoiding the x[i] = y construct is much harder in non-trivial programs, > where assumptions about mutability need to be specified as part of the call > interface. Hence the proliferation of const in the C string library. Agreed -- any function that modifies a structure should spell that out loudly in its interface description. Programming languages make tradeoffs between easy coding vs. early error detection. For example, the greater annotation required in C programs (e.g. type declarations) makes coding harder, but allows detection of many errors at compile time that would wait until run time in Python. In this case, the distinction between tuples and lists is an "annotation" that allows us to detect improper modification of a sequence earlier -- at the point of attempted modification instead of later when it causes some other failure. Most of Python opts for less annotation for easier coding vs. early error detection -- having both mutable and immutable sequences is a move in the other direction. By the way, I personally prefer the low annotation level of Python-type languages over C-type languages. It seems to me that programming is more pleasant and overall the job gets done faster. -- Bob From M_Pope at shef.rage.co.uk Tue Apr 18 11:29:54 2000 From: M_Pope at shef.rage.co.uk (Mark Pope) Date: Tue, 18 Apr 2000 16:29:54 +0100 Subject: dir(..) vs. PyList_GetItem Message-ID: <213CDEBFDDA7D3118081009027E40C56071155@SHEF-MS1> Hi, Can someone explain the difference between calling 'dir(moduleName)' from python, and 'PyModule_GetDict( pModule )' from the C API. I'd presumed they'd be the same thing, but appear to return different lists. Details: In Python, I enter the following: import myScript dir( myScript ) and receive the output: ['myFunc1', 'myFunc2', '__builtins__', '__doc__', '__file__', '__name__'] >From the C API, I call: PyObject *pModule, *pDictionary, *pKeys; pModule = PyModule_New( "myScript" ); if( pModule ) { pDictionary = PyModule_GetDict( pModule ) ; pKeys = PyDict_Keys( pDictionary ); } and the 'keys' list just holds: __doc__ and __name__ I would like to have a list of the script functions available in C. thanks, mark. From wayne.izatt at myself.com Sat Apr 8 02:01:55 2000 From: wayne.izatt at myself.com (Wayne Izatt) Date: Sat, 08 Apr 2000 06:01:55 GMT Subject: MySQL-module References: <55jH4.145$rD3.2312@news1.online.no> Message-ID: <38EECB5D.328B141E@myself.com> MySQLdb is the way to go. MySQLmodule is no longer well supported, and MySQLdb adheres to the Python Database API 2. I've used it extensively, and you can do anything you need to do, including creating you tables etc... Thomas Weholt wrote: > Hi, > > I`m going to try MySQL and want to access stuff using Python. At Python.org > I found to links to two different modules, one written in python, the other > C. Is there a special reason for choosing one over the other? > > I`d like to use all python, not compile anything cuz I`m scared python won`t > work anymore. Had this problem earlier with re-compilation of python. zlib > etc. didn`t work anymore. > > Any tips? I can create the actual databases/tables manually, but need to > acces/insert/manipulate the data from a python-script. > > Thomas From shapr at uab.edu Sat Apr 29 06:24:44 2000 From: shapr at uab.edu (Shae Erisson) Date: Sat, 29 Apr 2000 10:24:44 GMT Subject: other patterns in python? References: <8ebpl4$eq9$1@nnrp1.deja.com> Message-ID: <390ABB26.3831DDD1@uab.edu> Darrell wrote: > > wrote in message > > Anyone got an example of a Command pattern/framework that they have > > used in python? > > > > This pattern wraps an action or command in an instance with an execute > method. > The instance can be passed around like a function pointer. Has anyone else written pattern demos in python? I'd like to see more if they're out there. -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre blah. mornings suck. From djc at itga.com.au Wed Apr 12 03:07:11 2000 From: djc at itga.com.au (Dave Cole) Date: 12 Apr 2000 17:07:11 +1000 Subject: Sybase module - release 0.5 Message-ID: <873dor3ihs.fsf@heresy.itga.com.au> Sybase is a module which provides a Python interface to the Sybase relational database system (surprise). The Sybase package supports almost all of the Python Database API, version 2.0 with extensions. The Sybase package is designed to work with Python versions 1.5.2 and later and Sybase versions 11.0.3 and later. It is based on the Sybase Client Library (ct_* API), and the Bulk-Library Client (blk_* API) interfaces. The module contains the following items: Module interface Connection objects Cursor objects Bulkcopy objects The homepage http://www.itga.com.au/~djc/sybase.html contains a description of the deviations from the Database API specification. The module can also be downloaded from ftp://ftp.itga.com.au/pub/python/Sybase-0.5.tar.gz Changes in this release: - DST bug fix. datetime fields were always converted to daylight saving time for some bizarre reason ('cos I am an idiot). - Numeric columns with scale == 0 are now retrieved as Python longs. - You can bulkcopy Python long values into numeric columns when the numeric has scale == 0. - Dave From schmitthead at my-deja.com Wed Apr 26 02:37:11 2000 From: schmitthead at my-deja.com (schmitthead at my-deja.com) Date: Wed, 26 Apr 2000 06:37:11 GMT Subject: huh? Python says that AttributeError: 'string' object has no attribute 'split' Message-ID: <8e62qm$511$1@nnrp1.deja.com> I received a whole folder full of files with MacOS type text files, with different newline characters. I thought, a perfect job for python. Below is my attempt, but it generates the following error message: >mac2dos tt_prvt.h Traceback (innermost last): File "C:\bin\mac2dos.py", line 33, in ? mac2dos( directory ) File "C:\bin\mac2dos.py", line 24, in mac2dos os.path.walk( os.getcwd(), callbackfunc, '' ) File "d:\python\Lib\ntpath.py", line 265, in walk func(arg, top, names) File "C:\bin\mac2dos.py", line 18, in callbackfunc mac2dosfile( file ) File "C:\bin\mac2dos.py", line 9, in mac2dosfile lines = myline.split( myline, chr(10) ) AttributeError: 'string' object has no attribute 'split' #mac2dos.py------------------------------------------------------------- import os import sys import string #----------------------------------------------------------------------- def mac2dosfile( file ): myline = file.read() lines = myline.split( myline, chr(10) ) for l in lines: l = l.strip( l ) file.writelines( lines ) #----------------------------------------------------------------------- def callbackfunc( junk, dir, names ): for name in names: file = open( name, 'r+' ) mac2dosfile( file ) close( file ) #----------------------------------------------------------------------- def mac2dos( dir ): os.path.walk( os.getcwd(), callbackfunc, '' ) #----------------------------------------------------------------------- if __name__ == '__main__': if ( len(sys.argv) < 2 ): directory = os.getcwd() else: directory = sys.argv[1] mac2dos( directory ) #-end-of-mac2dos.py----------------------------------------------------- Sent via Deja.com http://www.deja.com/ Before you buy. From rumjuggler at home.com Fri Apr 21 14:14:36 2000 From: rumjuggler at home.com (Ben Wolfson) Date: Fri, 21 Apr 2000 18:14:36 GMT Subject: docstrings References: <00bufsonasp7bgkf86lfb6sv5np5v8mqlj@4ax.com> <8dnasp$iep$1@news.wrc.xerox.com> Message-ID: <6v61gs8b1op8esg3o7hf0hii97jlvma01r@4ax.com> On 20 Apr 2000 16:22:49 GMT, mjackson at wc.eso.mc.xerox.com (Mark Jackson) wrote: >Ben Wolfson writes: >> is there a way to use %c and %s within a docstring, or to add strings >> together in a docstring, so that if some strings are used in all >> docstrings, but might be changed, I can simply change one or two >> variables? > >This might do what you want, although it's ugly (in the sense that it >serves the code-documentation - as opposed to user-documentation - >function less well): > > cat > spam.py > """I am a docstring""" > > sharedoc = """ and I am a widely-reused docstring clause""" > > __doc__ = __doc__ + sharedoc > > del sharedoc > ^D > yngvi> python > Python 1.5.2 (#7, May 6 1999, 14:39:45) [GCC 2.8.1] on sunos5 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import spam > >>> print spam.__doc__ > I am a docstring and I am a widely-reused docstring clause > >>> This approach doesn't work for function docstrings, unless I tried it wrong. -- Barnabas T. Rumjuggler He still loves life, But O O O O how he wishes The good Lord would take him. -- W. H. Auden From cgw at fnal.gov Fri Apr 14 16:42:19 2000 From: cgw at fnal.gov (Charles G Waldman) Date: Fri, 14 Apr 2000 15:42:19 -0500 (CDT) Subject: Memory leaks in Python 1.6 Message-ID: <14583.33451.120821.695270@buffalo.fnal.gov> I've been running a small script I wrote called "leaktest" (attached below) which runs tests from the the Python/Lib/test directory in a loop, while watching the memory use of the process. I've found quite a few memory leaks this way, and am working on fixing them. I will be submitting a bunch of patches to the patches list over the next several days. Script: leaktest.py #!/usr/bin/env python """ Runs tests repeatedly, looking for memory leaks If you have gnuplot installed you can also get nice plots of memory usage vs. time Usage: leaktest [-max max] [-min min] [-check check] [testname] [testname]... runs one or more tests repeatedly, looking for memory leaks The tests can be specified as module name (test_gzip) or file name (/path/to/test_gzip.py) memory usage is checked every "check" iterations of the test. at least "min" readings are taken, and at most "max" readings. If no memory leak is detected after "min", the test stops. If "DO_LOG" is set to 1, memory usage will be logged to a file. If "DO_PLOT" is set to 1, pretty pictures will be drawn. If "VERBOSE" is set to 1, memory usage will be printed during the test """ import sys import os import time import string DO_LOG=1 DO_PLOT=1 VERBOSE=0 def open_file(name): if os.path.exists(name): os.system("cp -b %s %s.bak"%(name,name)) f=open(name,'w') return f def mem_usage(pid): p=os.popen('ps uwp %s'%pid) lines=p.readlines() status=p.close() if status or len(lines)!=2: return None return int(string.split(lines[1])[4]) def no_increase(l): for i in xrange(1,len(l)): if l[i]>l[i-1]: return 0 return 1 def run_test(testname, min_readings=10, max_readings=50, check_interval=10): print "RUN %s min %d max %d check %d"%(testname,min_readings, max_readings, check_interval) if DO_LOG: log = open_file('%s.log'%testname) logdata=[] ret=1 pid=os.getpid() stdout, stderr = sys.stdout, sys.stderr sys.stdout, sys.stderr = open_file('%s.out'%testname), open_file('%s.err'%testname) for loop_readings in xrange(max_readings): mem = mem_usage(pid) if not mem: break if VERBOSE: stdout.write('%s\n'%mem) logdata.append(mem) if DO_LOG: log.write('%s\n'%mem) log.flush() for n in xrange(check_interval): try: if loop_readings==0: exec "import test.%s"%testname else: exec('reload(test.%s)'%testname) except: ret=-1 break if ret<0: break if len(logdata)>=min_readings and no_increase(logdata[-min_readings:]): ret=0 break sys.stdout.close() sys.stderr.close() sys.stdout, sys.stderr = stdout, stderr if DO_LOG: log.close() return ret, logdata def do_plot(testname): cmdfile=open('%s.gnuplot' % testname, 'w') template='set nokey\nset xlabel "Iterations"\nset ylabel "Memory Use (KB)"\n\ set title "%s\nplot "%s" with lines\npause 60\n' cmdfile.write(template % (testname, testname+'.log')) cmdfile.close() os.system("gnuplot %s.gnuplot &"%testname) def main(args): check_interval=10 min_readings=10 max_readings=50 while args: arg = args.pop(0) if arg=='-min': min_readings = int(args.pop(0)) continue if arg=='-max': max_readings = int(args.pop(0)) continue if arg=='-check': check_interval = int(args.pop(0)) continue ## allow the test module names to be specified as full pathnames ## for ease in calling this from shellscripts arg = os.path.split(arg)[1] arg = os.path.splitext(arg)[0] status, data=run_test(arg, min_readings, max_readings, check_interval) if status<0: print "test", arg, "did not run" elif status==0: print arg, "no memory leak detected", data else: print arg, "leaks memory", data if DO_PLOT: do_plot(arg) if __name__ == '__main__': main(sys.argv[1:]) From ivanlan at callware.com Tue Apr 4 18:36:55 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 04 Apr 2000 16:36:55 -0600 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> Message-ID: <38EA6E87.40EDB542@callware.com> Hi All-- Bjorn Pettersen wrote: > [bobbit] > > If you want to package up your program into an exe and execute it, > Installer from Gordon's starship pages can do this > (http://starship.python.net/crew/gmcm/distribute.html). It's actually > _much_ easier than it looks ;-) > This sounds like the right course to me. I'd like to force customers to install Python on their machines, but my boss doesn't think that's all that great an idea (dunno why). My only concern is size--just how big are the executables produced by Gordon's flummery^H^H^H^H^H^H^H^Hmagic? > > You'll probably want to check out one of the odbc packages. (I haven't > used any of them myself, but mxODBC seems to be highly recomended...) > Well, that's two recommendations. And judging from previous Marc-Andre packages I've used, it'll be a snap. Steve Holden, in another post, said that Tkinter should work fine along with mxODBC. That's a relief, but does anyone have direct personal experience with doing so? -ly y'rs, Ivan (I think I've spelled that right--I don't have the OED online.) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From ivanlan at callware.com Tue Apr 18 17:44:22 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 18 Apr 2000 15:44:22 -0600 Subject: [Fwd: o'reilly python devcenter] Message-ID: <38FCD736.13282680@callware.com> Hi All-- Dennis Hamilton, in this forwarded letter, has kindly corrected my misapprehensions regarding O'Reilly's Python Devcenter. However, he replied only to me, so I attach his response for your collective delight. But, regarding point 3 (books), Dennis says: > 3) Why would they do that? You can do that and perhaps be seen to have > objectivity in providing it. I would not expect O'Reilly to promote the > books of others. Would you? (Expect it or use your own site to do it?) > There is already python.org and starship, yes? Actually, I _would_ expect O'Reilly to well, not exactly promote, but certainly _mention_ worthwhile books from other publishers. They can certainly afford it, and it would do nothing except bolster their already exemplary reputation. Dennis also asks, > Regarding hard sell, what were you looking at? Well, since I was so wrong about the other points, this really doesn't hold water anymore. My opinion that it was "hard sell" was based on the (incorrect) presumption that they were trying to control everything Python. That made me cranky. Since they're not, I withdraw all complaints but number three (which is a vestige of its former self). -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -------------- next part -------------- An embedded message was scrubbed... From: "Dennis E. Hamilton" Subject: RE: o'reilly python devcenter Date: Tue, 18 Apr 2000 12:04:50 -0700 Size: 4255 URL: From bragib at my-deja.com Mon Apr 3 13:58:50 2000 From: bragib at my-deja.com (bragib at my-deja.com) Date: Mon, 03 Apr 2000 17:58:50 GMT Subject: Text editing/replacing Message-ID: <8cam4g$gdj$1@nnrp1.deja.com> Are there any good algorithms available for text editing/replacing of words in a huge text file. If anyone knows of any sample codes, books, algorithms etc. I would appreciate it. Thanks, Bragi Sent via Deja.com http://www.deja.com/ Before you buy. From mjhand at concentric.net Fri Apr 14 11:44:26 2000 From: mjhand at concentric.net (Manus Hand) Date: Fri, 14 Apr 2000 09:44:26 -0600 Subject: starship.python.net References: Message-ID: <38F73CDA.40958FEE@concentric.net> python.net is once again down -- this time for over a day. Anyone have any prospects for us? Manus From dgoodger at bigfoot.com Sat Apr 1 10:54:50 2000 From: dgoodger at bigfoot.com (David Goodger) Date: Sat, 01 Apr 2000 10:54:50 -0500 Subject: Why should I switch to Python? References: Message-ID: on 2000-03-31 22:43, Aaron Turner (aturner_ at _pobox.com) wrote: > What I'd like to hear from people is what technical > resons I should switch to Python. For me, readability is the ultimate factor. I've written thousands of lines of Perl code, and I still had trouble understanding others' code, and even my own! (Even though I tried to write readable stuff, revisiting code from weeks or months earlier was an exercise in frustration.) Python works the way I do, and that's why I like it. It forces readability through its syntax rules (block start/end via indentation, etc.), which I followed anyhow; now I don't have to worry about missing semicolons. I love Perl for what it is, but now that I've used Python (about 1.5 years now), I can't imagine going back. Functionally, they both do the job. But Python's "interface" suits me better. Isn't it great that there are so many tools out there? Everyone can find one that suits their style. -- David Goodger dgoodger at bigfoot.com Open-source projects: - The Go Tools Project: http://gotools.sourceforge.net (more to come) From tismer at tismer.com Fri Apr 28 10:19:46 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 28 Apr 2000 16:19:46 +0200 Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> <8e4akc$p7o$1@newshost.accu.uu.nl> <3908E6EC.B9E6B2E8@cosc.canterbury.ac.nz> <39099069.7BFD8387@tismer.com> Message-ID: <39099E02.E68483E7@tismer.com> Michael Hudson wrote: > > Christian Tismer writes: > > > Greg Ewing writes: > > > > Maybe the LC syntax should include something like > > > > > > > > [[] times 10] > > > > > > But wouldn't that make "times" a keyword? Not sure I'd want that... > > > > Currently, yes, but it is absolutely not necessary to be so. > > It requires to change the grammar to treat operators > > differently. > > But then what happens to things like > > times = 10 > return [[] times times] No problem for me. I wouldn't write this, for clarity. No reason to forbid it, anyway. > ? I'm not sure context senstive keywords are a good idea (in any > language, ever). Currently a naked identifier in Python is either a > variable reference or a keyword, and you can tell which just by > looking at *it*, not at its surroundings - and I think I like that. > > Though it would be occasionally useful to be able to call a variable > `class'. Well, we would get into trouble anyway, if keywords appear in other contexts but as attributes. self.class would be ok, but class as a parameter, and you can't access it. Algol68's-bold-stropping-had-its-benefits - ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 thomas at cintra.no Sat Apr 22 13:36:20 2000 From: thomas at cintra.no (thomas at cintra.no) Date: Sat, 22 Apr 2000 17:36:20 GMT Subject: Sax installed, but not working References: <38ff5f04.1047500@news.c2i.net> <3dya68o3yb.fsf@amarok.cnri.reston.va.us> Message-ID: <3901df21.7429914@news.c2i.net> On 20 Apr 2000 17:30:36 -0400, akuchlin at mems-exchange.org (Andrew M. Kuchling) wrote: >thomas at cintra.no writes: >> from xml.sax import * >> >> it fails and says there`s no module called sax. All the demo-scripts >> and tutorials I`ve tried fails too. > >Check that xml/__init__.py and xml/sax/__init__.py exist. (They might >be of length 0, which is OK.) Does 'import xml' work? > >-- >A.M. Kuchling http://starship.python.net/crew/amk/ >I wrote my name, but I can find it no longer; my ashes blow like dust around >the invisible labyrinth. > -- Zatara, in BOOKS OF MAGIC #1 > > Hi, __ini__.py in both folders. other stuff seem to work, like xml.dom etc. but not xml.sax. Hm ... can`t see anything wrong. Ex. 'from xml.sax import saxlib' will fail. Anything else I can check? Thomas From scott at csihq.com Mon Apr 24 11:35:38 2000 From: scott at csihq.com (Scott Bortman) Date: Mon, 24 Apr 2000 11:35:38 -0400 Subject: Need Help w/JPython deployment Message-ID: Hello, I am having a bit of difficulty using jpythonc. I have a script I want to deploy and I want to have everything it needs in a single jar file. This is because JPython is NOT on the machine I want to run the script (but Java is). Here's the options I've tried using: --deep --all --compiler --jar And then the name of my script: .py But, I get the following error: processing npp_lab_status_mai Required packages: java.lang java.text* java.sql* java.util* Creating adapters: Creating .java files: npp_lab_status_mai module Compiling .java to .class... Compiling with args: ['h:\\jdk1.3\\bin\\javac', '-classpath', 'H:\\JPython-1.1\\jpython.jar;I:\\JClass36J\\lib\\jcchart361J.jar;I:\\JClass 36J;;h:\\jbuilder3\\beans\\classes12.zip', '.\\jpywork\\npp_lab_status_mai.java'] 0 Building archive: npp_lab_status_mai.jar Tracking java dependencies: Traceback (innermost last): File "H:\JPython-1.1\Tools\jpythonc2\jpythonc.py", line 5, in ? File "H:\JPython-1.1\Tools\jpythonc2\main.py", line 291, in main File "H:\JPython-1.1\Tools\jpythonc2\main.py", line 284, in writeResults File "H:\JPython-1.1\Tools\jpythonc2\jar.py", line 86, in dump File "H:\JPython-1.1\Tools\jpythonc2\jar.py", line 80, in dumpFiles File "H:\JPython-1.1\Tools\jpythonc2\jar.py", line 94, in addOneClass AttributeError: java package 'org.python.modules' has no attribute '__path__' Is there something I missed? Thanks in advance, scottie From gdeeringNONEOFTHAT at acslink.SPAMTHANKS.aone.net.au Wed Apr 5 05:00:36 2000 From: gdeeringNONEOFTHAT at acslink.SPAMTHANKS.aone.net.au (Geoff Deering) Date: Wed, 05 Apr 2000 09:00:36 GMT Subject: map.yahoo.com uses Python? References: Message-ID: <38eb00af.8905516@news.mel.aone.net.au> I've heard all of Yahoo is Python based. From JoeSmith at bogusaddress.com Sat Apr 15 16:18:46 2000 From: JoeSmith at bogusaddress.com (Joe Smith) Date: Sat, 15 Apr 2000 20:18:46 GMT Subject: TCP/IP protocols References: Message-ID: <38F8CF63.40771176@bogusaddress.com> I get a name error for p. What type is p supposed to be? John Mitchell wrote: > On Sat, 15 Apr 2000, Thomas Wouters wrote: > > > On Fri, Apr 14, 2000 at 04:28:03PM -0600, Jeff Massung wrote: > > > > > I'm new to Python programming, but am very experienced in C/C++. Could > > > someone point me to a good reference for TCP/IP programming with Python > > > (pdf, book, anything :]) thanks. > > > If you're looking for some higher-level programming, see libraries like > > httplib, ftplib, telnetlib, urllib, SocketServer, *HTTPServer, etc. > > These are actually just two libraries: client-side (urllib handles FTP, > HTTP, local files), plus server-side (Socket/HTTPServer). > > For example, to fetch a web page is this: > > import urllib > data = urllib.urlopen('http://www.magnet.com/') > > To get some information out, it's much more complicated: 3 lines: > > import htmllib, formatter > p.feed(data) > p.title > # => 'Magnet Interactive Communications' > > Show this to your local Java weenie. He'll whine like a stuck pig! > > > Documentation for all these modules comes with the python source (in the > > Doc/lib/ directory) in TeX format, with most binary distributions in some > > form or another, or can be downloaded or browsed online at > > http://www.python.org/doc/lib/ (There's an entire chapter, 11, dedicated to > > 'Internet Protocols and Support'.) > > oh yeah. But the above is your 60-second introduction. > > - j From dalke at acm.org Sun Apr 23 01:29:22 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 22 Apr 2000 23:29:22 -0600 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us><3900611F.3B525BDA@cfdrc.com> <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7@lp.airnews.net> Message-ID: <8du1in$hth$1@slb7.atl.mindspring.net> Robin Becker wrote: >I don't think the pessimists amongst whom I count myself reject altruism >totally. A purely altruistic action has benefit for others and none for >the actor. Very few of the altruistic examples in the thread come close. The one I came up with, the first time I heard this argument (freshman year of college, I think), was the following: I'm walking down the street and there is a hole in my front pocket. I keep money in that pocket. I have a hand in that pocket because it's cold, and I'm jostling the money. As I pass a beggar, some money falls out through the hole. It is altruistic or an accident? The only way to find out is to ask me, and I can lie, so there's no observational way to tell the difference. Thus, I considered the definition of "altruistic", when used in this extreme case, to be useless. Andrew dalke at acm.org From aek at mail1.stofanet.dk Wed Apr 12 15:47:19 2000 From: aek at mail1.stofanet.dk (Anders Eggers-Krag) Date: Wed, 12 Apr 2000 21:47:19 +0200 Subject: global variables - how?? References: <20000412175218.784841CE49@dinsdale.python.org> Message-ID: <8d2jsh$3a9$1@news101.telia.com> it is obvious not to use global variables except when the use of them is obvious, in my case I could otherwise send them along with every function, creating a huge overhead passing a million pointers around, using exactly the same amount of memory, or in fact more, than I would using globals. I did figure out how to do it myself after a lot of trying, but as you said it is ugly, but this really anoys me, and I *was* starting to like python... -- Anders Eggers - Krag "Sean Blakey" wrote in message news:20000412175218.784841CE49 at dinsdale.python.org... > On 12 Apr, William Park wrote: > > On Wed, Apr 12, 2000 at 07:28:37PM +0200, Anders Eggers-Krag wrote: > >> how do I define a propper global variable that works in all functions in all > >> modules? > > > > As far as I know, you can't. You have to use 'global ...' inside all > > your functions. > > > > --William > > > >> > >> I have tried simply > >> defining one outside of any function in the main module, > >> I have tried using the global keyword under the same cicumstances, > >> but they are not even avialible inside of functions within the main > >> module... > >> > >> > >> -- > >> Anders Eggers - Krag > >> > >> > >> -- > >> http://www.python.org/mailman/listinfo/python-list > > > > Short answer: Python discourages globals. This is probably intentional. > > Long answer: You can do some work with globals, but it is painful and > ugly. You also need to keep track of namespaces (globals from your > main module will be in the __main__ namespace). > > For example: > -----file one.py----- > TEST_VALUE = 'spam' > > def printTest(): > print TEST_VALUE > > def changeTest(): > global TEST_VALUE # Without this, the next line > # will simply assign 'spamspam' > # to the local variable > # TEST_VALUE > TEST_VALUE = TEST_VALUE + TEST_VALUE > > if __name__ == '__main__': > import two > printTest() > two.printTest() > changeTest() > printTest() > two.printTest() > > -----file two.py----- > import __main__ > > def printTest(): > print __main__.TEST_VALUE > > > Now, from the shell: > seanb at seanb:~$ python one.py > spam > spam > spamspam > spamspam > > > -- > > Sean Blakey > FreeInternet.com > sblakey at freei.com > (253)796-6500x1025 > > From m.faassen at vet.uu.nl Wed Apr 12 13:04:08 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 12 Apr 2000 17:04:08 GMT Subject: Why should I switch to Python? References: Message-ID: <8d2aa8$n58$1@newshost.accu.uu.nl> Blake Winton wrote: > On Fri, 31 Mar 2000 19:43:58 -0800, Aaron Turner wrote: >>I've been coding Perl for over 3 years and really like it. (Especially >>it's syntax and ability to grok my programming style.) > Now, just as a side note, why is it that the sets of The Perl Hackers I > Know, and The People I Know Who Use The Word "Grok" are the same set? It's in the hacker's dictionary: http://www.tuxedo.org/~esr/jargon/html/entry/grok.html And common in hacker slang (from the science fiction world). Actually, Python 3000 will contain the 'grok' statement (I posted about this long ago). It works like this: grok: So, you can do things like this: grok: Hello, please give me a web page out of the financial reports of the third quarter 1999. It should be fast! And your Python program will grok it and do it. In fact, I lied: the indentation rules in the 'grok' statement can be broken and Python 3k will grok that too: if a == 1: grok: Hello this isn't really indented right but Python can figure it out anyway...give me a 3d pacman game if I press the 'pacman' button a = a + 1 # continue suite with normal indentation But the recommendation is not to do this as it will result in unreadable code. Wrong indentation may not work in future versions of Python 3k either, as it's an implementation detail -- if you use it anyway expect the effbot to snip at you. Then again, the timbot will release groknanny to fix this, so you are probably safe. It'll look like this: (grokindent.py) grok: Please fix the indentation of grok code in all files which have wrong indentation of grok code. now-this-is-easy-ly y'rs - tim As you see, it has all the usual timbot elegance and charm. :) Yes-I've-been-using-the-time-machine-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From effbot at telia.com Sun Apr 23 12:31:37 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 23 Apr 2000 16:31:37 GMT Subject: Posting CGI References: <8dv4j8$2bs$1@bob.news.rcn.net> Message-ID: Z 3 Penguin wrote: > How would I go about submiting a CGI post form in python? (This sounds like > it should be simple, but I can't figure it out :-) Thanks. http://www.python.org/doc/current/lib/module-urllib.html import urllib request = urllib.urlencode({ "name": "effbot", "email": "effbot at telia.com" }) fp = urllib.urlopen("http://www.spam.egg", request) response = fp.read() From effbot at telia.com Tue Apr 11 11:39:52 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 15:39:52 GMT Subject: AF_INET error References: <8cvero$g8k$1@porthos.nl.uu.net> Message-ID: Soundwave wrote: > I want to learne some things about socket programming, so I started the > socet programming tutorial on www.python.org > > but when I copy te code from some sample programm's and run it, it doesn't > work, it don't recognize the AF_INET thing, is this because I am using > Windows ?? > > can somebody please explain this to me ? > > Or what am I doeing wrong ? well, since you forgot to tell us what example you tried to run, how you typed it in, and what error you got, I can only guess. -- make sure to import the socket module -- make sure to use the "socket." prefix, so Python knows where to look for the AF_INET "thing" (it's a variable). From matt at mondoinfo.com Mon Apr 24 20:25:54 2000 From: matt at mondoinfo.com (Matthew Dixon Cowles) Date: Mon, 24 Apr 2000 19:25:54 -0500 Subject: sys.exit References: <3904C35C.B16BDE75@mindspring.com> Message-ID: <240420001925542853%matt@mondoinfo.com> In article <3904C35C.B16BDE75 at mindspring.com>, Chuck Esterbrook wrote: > The short question: > > If I catch a SystemExit exception (because of an invocation of > sys.exit(code)), how do I examine the argument to sys.exit()? [snip] try: sys.exit(42) except SystemExit,detail: print detail Getting access to many exceptions' arguments works similarly. Regards, Matt From spex66 at my-deja.com Fri Apr 28 12:22:36 2000 From: spex66 at my-deja.com (spex66 at my-deja.com) Date: Fri, 28 Apr 2000 16:22:36 GMT Subject: Namespace Problem with global declaration in module References: <1255280660-66425116@hypernet.com> Message-ID: <8ecdro$5gf$1@nnrp1.deja.com> In article <1255280660-66425116 at hypernet.com>, gmcm at hypernet.com wrote: [snip] > > I see the point, but I like the from statement :) > > Tough :-). import * is mostly a shortcut for interactive work. Look at the > top of Tkinter.py to see what a module needs to do to make import * > safe. > > > Is it a bug? > > No. > > > It's not the way I expected this code to work... and > > I cannot find a hook in the documentation that explicit explained > > this misbehaviour. > > It's there, in 6.11 of the Language Ref: > > The from form does not bind the module name: it goes through the > list of identifiers, looks each one of them up in the module found in > step (1), and binds the name in the local namespace to the object > thus found. If a name is not found, ImportError is raised. If the list > of identifiers is replaced by a star ("*"), all names defined in the > module are bound, except those beginning with an underscore ("_"). > > No, the implications of that statement are not immediately obvious. > > > Any idea for a workaround (I need the from-statement for further > > code readability)? > > No, you want it for type-ability. Come back to it in a few months and > you'll wish you'd spelled out where all those names came from. Not only, it is for automated code-generation *and* simple interactive work :-) I've found a solution working for me, I posted it in my other actual thread "How can I get the name of an object???" 28/4/00 17:20 probably it's getting a little bit clearer why I'm riding that horse :) thanks for your input Peter (=PA=) Sent via Deja.com http://www.deja.com/ Before you buy. From chega_ at yahoo.com Fri Apr 21 03:29:02 2000 From: chega_ at yahoo.com (Vadim Chugunov) Date: Fri, 21 Apr 2000 07:29:02 GMT Subject: __del__ problem - would adopting Garbage Collection fix this? References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> Message-ID: <2rTL4.887$a6.294989@paloalto-snr1.gtei.net> "Just van Rossum" wrote in message news:l03102802b5245023a247@[193.78.237.147]... > >"Warren Postma" writes: > >I don't think so. You still have to destroy things; true gc might > >help I suppose, but I'm fairly sure it doesn't solve the problem > >completely. > > I'm not sure if I understood it correctly, but I think the newly proposed > garbage collector does *not* call __del__ if the object in question is part > of a cycle. It seems indeed impossible to do so correctly. I think the site > explained quite well why this is, but I can't seem to repeat it off the top > of my head. If you are not going to settle for anything less than a perfect solution, than this is indeed impossible. On the other hand, I do remember Python prophets saying that "practicality beats purity" :-)). Ask yourself: "What kind of stuff do I typically do in __del__ methods?". Close files, close sockets, write "Good-bye" to stdout... SWIG generated code would call a destructor of the wrapped object. And, I think, that's about it. Note, that __del__ does not usually involve access to sibling objects participating in the cycle. (assumption) IMHO, this means that we can: 1. pick any PyInstanceObject that comes along and call it's __del__ method. 2. change object's __class__ to, say, DeletedObject (which is defined as class DeletedObject: pass) 3. clean out instance __dict__, which will hopefully break the cycle. 4. repeat as needed. If anyone *does* break the above assumption, well, life is tough... They will get an AttributeError exception. Actually, step 2 above is optional. It is there just to make possible an explicit check for deleted objects. Vadim From gmcm at hypernet.com Tue Apr 18 08:47:55 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 18 Apr 2000 08:47:55 -0400 Subject: Using python on the web In-Reply-To: Message-ID: <1256060415-19523925@hypernet.com> Charley Horse wrote: > I've just started fooling with python. I've looked around the python > site and a number of the other sites referenced there and am a bit > puzzled. Umm... how does one go about using python for web applications, > especially database driven apps? Almost everything deals with python > just as a language, as C++ would be. Not much about the web > specifically. I was a bit shocked to find the only direct refs on about > this at python.org are entwined with CGI (unless I missed it). I have no > exposure to CGI, but rather to php, CF, and ASP, so python has gone from > looking very attractive to looking... well, like a puzzle. I know about > Zope, but am interested in how one uses python on the web just by > itself. ASP, php and CF are all descended from CGI. By creating a CGI framework and / or putting hooks into the web server (there are a number of pure Python ones to play with) you can create environments that look like any one of these. Almost any web server will run CGI (with sometimes a bit of tweaking) so the docs focus on that. At the other end of the scale, Zope does everything those guys do, and usually better. IIS is widespread enough that there's a significant Python subculture doing ASP in Python. But the grandaddy of them all (and still the only portable one) is CGI. - Gordon From brent.fulgham at xpsystems.com Thu Apr 13 17:40:36 2000 From: brent.fulgham at xpsystems.com (Brent Fulgham) Date: Thu, 13 Apr 2000 14:40:36 -0700 Subject: Module Loading Issues Message-ID: Is there any disadvantage to having many modules loaded at the same time? I.e., is it possible for badly-written modules to write entries into the "__main__" namespace that might clash with other entries? Or is the only concern memory use? Thanks, -Brent From spex66 at my-deja.com Wed Apr 26 11:13:41 2000 From: spex66 at my-deja.com (spex66 at my-deja.com) Date: Wed, 26 Apr 2000 15:13:41 GMT Subject: How can I get the name of an object??? Message-ID: <8e712k$65c$1@nnrp1.deja.com> Hi again, other trivial (looking) question: >>> class zz: pass >>> dd = zz() I cannot find the hook to get back the name of 'dd' as a string. Why? Cause I need the names for code generation :-) like estimated >>> dd.__name__ >>> 'dd' #DON'T WORK any hacks available? Peter (=PA=) Sent via Deja.com http://www.deja.com/ Before you buy. From smalleys at gte.net Wed Apr 12 23:09:19 2000 From: smalleys at gte.net (sue) Date: Thu, 13 Apr 2000 03:09:19 GMT Subject: pattern-based string expansion Message-ID: <38F52C61.A5D72F89@gte.net> I need to generate a (largish) set of strings from a pattern, sort of like glob with csh-style expansion. Given "foo{,bar,baz/[aced]{,x,z}}", generate: foo foobar foobaz/a foobaz/c foobaz/e foobaz/d foobaz/ax foobaz/az etc. The manual doesn't seem to have this glob(3) option. Sue. From wayne.izatt at myself.com Wed Apr 5 04:21:54 2000 From: wayne.izatt at myself.com (Wayne Izatt) Date: Wed, 05 Apr 2000 08:21:54 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> Message-ID: <38EAF7A0.E372EB2C@myself.com> Books are one thing, but a regular printed journal would be especially useful. A journal is visible, creates a strong sense of community, and is an easy way to combine advanced and general Python topics in one tight package. I wonder what the minimum number of Pythoners it would take to keep something like that afloat? jm2cw lewst wrote: > Before I launch into another question and gripe, I'd like to thank > everyone who offered comments and suggestions on the advanced Python > books that are out there. > > Now something I can't quite figure out is: why are there so many more > books on Perl out there than on Python? > > Searching through Fatbrain.COM (which is where I order my books from), > I found 68 books, 4 training manuals, and 2 eMatter documents on Perl. > Compare this to Python's 13 books and 2 eMatter documents. > > What is it about Perl that makes it so much more popular and have such > a huge grassroots swell? I personally find Perl an abomination and > Python a breath of fresh air. Perl has that first mover advantage I > suppose, but should that really make such a hugh difference? > > I'll admit that Perl is what led me to Python in the first place. > After hearing about how great Perl was several years ago from the > local sysadmin, I learned it and started using it for my scripting > needs. If there is one thing that sums up my Perl experience, it is > that it always took me too long write the programs that I needed to > write. The syntax was always no unnatural for me that I could never > get my head out of the reference manual, and errors were always so > tough to track down. In the end was frustration albeit a working > result. This frustration led me to look into Python and I'll never > touch Perl again. Python was so natural for me I often found myself > correctly "guessing" at the syntax as I learned it. I rewrote all my > Perl scripts in one weekend and most of them worked on the first try. > > At this point I wondered if my brain was just different than all those > Perl junkies out there. But now I really don't think so; I think it's > a question of awareness. Perl is very publicized and well-known while > the better language is sitting here a dark corner unnoticed. Sure > there will always be some religious fanatics that won't even give > Python a try, but I think Python's popularity could be vastly improved > with some serious advocacy work. CNRI and/or PSA should seriously > look into funding a Python "marketing" campaign of sorts. I think the > result would be allot of converts and more understanding and respect > for Python. > > With this in mind, let me include one of my favorite pro-Python quotes > of all time. This is from a message to the fetchmail-announce mailing > list by Eric S. Raymond , the famous > open-source advocate and author of many popular software programs. He > is discussing "fetchmailconf" which is the Tkinter GUI for his > fetchmail POP/IMAP mail client. I think it demonstrates the point I > make above perfectly. > > "A note about fetchmailconf. It took me approximately six days to > write this elaborate multi-paneled GUI -- that's counting the four > days it took me to learn the implementation language in the process. > This could easily have been a two-month project in C (with six weeks > of that spent debugging and bugs still left). Or a week-long > project in Perl, with working but ugly and unmaintainable results." > > "The verdict: Python is *waaaay* cool! I'm sold. It's clean, it's > elegant, it's easy, and it's astonishingly powerful. I'm not going > to program anything longer than one screenful of script in Perl > anymore. I love Larry Wall dearly, but Guido van Rossum is the > better designer -- I haven't had this much fun with a language since > the glory days of LISP. Eric sez check it out." > > Regards. > > __________________________________________________ > Do You Yahoo!? > Talk to your friends online with Yahoo! Messenger. > http://im.yahoo.com From kc5tja at garnet.armored.net Sun Apr 30 09:00:22 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 30 Apr 2000 13:00:22 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8ecsgj$6lp$1@slb0.atl.mindspring.net> <300420001008012011%pecora@anvil.nrl.navy.mil> <20000430170952.A502@datapro.co.za> <8ehrb9$mm5$1@ites.inria.fr> Message-ID: In article <8ehrb9$mm5$1 at ites.inria.fr>, Cedric Adjih wrote: > If you can read, you should be able to read the definition of >any variable, and there are serious drawbacks. A flame of this >notation is for instance in "Developing Windows NT Device Drivers": >"The so-called `Hungarian Notation' (developped by a Hungarian >programmer at Microsoft) is one of the worst ideas to have hit >software development in many years" "All good ideas are judged from the enemies they make." -- I forgot who. > The main problem, is that when you change the type of a structure >you _cannot_ change the name (because other people are using it), >so the type specification becomes plain wrong. The 'wParam' >is reported to be such an example (now unsigned 32 bits), there >are other examples in Microsoft API (should be worse with Win64). Hungarian notation is fine for the definition of an API, as long as its used to describe abstract concepts, like arrays, pointers to things, a count of whatever, etc. Hardcoding the bit-widths of types is obviously going to get you into trouble in the future. Just because Microsoft fscked up the execution doesn't mean the idea is somehow "bad." Like I said earlier, I use it only when it makes *sense* to. Like anything else you have in your toolshed, Hungarian notation is a tool. Those who are skilled in its use will not have the problems you cite above. :) Those who aren't only use it because it's a fad. > Also each time you change the type of one variable/parameter, >you have change all the variable names of all the code under >your control. In my work with Dolphin, I've found, on several occasions, where I needed to change symbol names pervasively throughout the source. I have found #MORE BUGS# just waiting to crop up and bite me in the butt this way than through any other technique. The very thing you cite as a "problem" is the very thing that will help reduce the number of bugs in Dolphin upon its final release. Is it painful? You bet. Just ask Billy -- the translation from old symbol names to new names broke the compile for weeks. But once it was all over, I had fixed no less than 14 bugs that would *never* become apparent until after I'd released the code to the public. Most of the bugs were bound to be of the "intermittent" type too, so I was particularly pleased at the end result. I view it as sheer laziness on the programmers part. You get what you pay for. > And finally, for multi-platform code, it makes less sense: >what happens if you don't have 2-bytes integers and you >have code with wXXXX variables (unsigned int 16 bits) ? On PowerPCs, a word is 32-bits. On Intels, 16-bits. So what's the lesson to be learned here? Don't hardcode widths in the meanings of your symbols. Hungarian notation as used by Microsoft is by far NOT the only way to use it. For example, I *never* identify word-widths in my Hungarian notated variable names. Why? Because of the very problem you cite above. However, I do indicate higher-level meanings with prefixes: p for pointer, c for a count (e.g., cb for a count of bytes, cuint32 for a count of 32-bit unsigned integers, etc), a for array, etc. Again, it takes skill to use a tool well. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From jimc at regnoc.com Sun Apr 2 19:23:59 2000 From: jimc at regnoc.com (Jim Conger) Date: Sun, 02 Apr 2000 23:23:59 GMT Subject: Just doing local file testing References: <38E796BC.23191B2@regnoc.com> <00040214141502.04535@quadra.teleo.net> Message-ID: <38E7D6DE.EA09C891@regnoc.com> An HTML attachment was scrubbed... URL: From mwh21 at cam.ac.uk Mon Apr 3 06:26:49 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 03 Apr 2000 11:26:49 +0100 Subject: Python 1.6 alpha 1 released References: <200004010159.LAA00403@piglet.dstc.edu.au> <8c9nq3$ghk$4@newsserver.rrzn.uni-hannover.de> Message-ID: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) writes: > In article <200004010159.LAA00403 at piglet.dstc.edu.au>, > David Arnold writes: > > -->"Bjorn" == Bjorn Pettersen writes: > > > > Bjorn> The more time I spend on fixing > > Bjorn> compatibility issues in Python scripts, the less time I spend > > Bjorn> on "real" work. > > > > you have been using incorrect arguments. the fact that they worked > > was unfortunate because it leads to circumstances like this. but the > > time you have spent on these emails would have been enough to run a > > simple script over your code to fix the problem ... ;-) > > Hmm how simple would a script be to get all occurences of: > > socket.connect(what, \ > else \ > ) > > sc=socket.connect > > sc(what,else) > sc(what, \ > else) > Yes, but `grep -w connect' and the minimal application of a human eyeball is surely enough to get 90%+ of the cases sorted out. I can't imagine sock.connect is called from all that many places in one's code (but I might be wrong). And, to answer you're question, about as complicated as: http://x42.deja.com/[ST_rn=ps]/getdoc.xp?AN=591243549 after `sed -e s/append/connect/', which doesn't get the bound method case, but I am having trouble imagining circumstances in which you'd reasonably do that. Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From ng at hardlight.couk.com Mon Apr 10 22:40:38 2000 From: ng at hardlight.couk.com (.:|:.) Date: Tue, 11 Apr 2000 03:40:38 +0100 Subject: downloading jpeg using python--extra bytes? References: Message-ID: <38f2919b.0@news.proweb.co.uk> Hi Gabriel, > The script works, with one exception: the jpeg image has > extra bytes in it that corrupt the file. I'm not sure exactly > how the bytes are dispersed, but they're not all at the > beginning or at the end. > g = open("myjpeg.jpg","w") I can only presume you are in an MS-DOS environment where you need to use g = open("myjpeg.jpg","wb") instead of g = open("myjpeg.jpg","w") otherwise linefeeds are converted into carriage return / linefeed pairs (it does tell you this in the manual page for open :-) Matt From matheusrodrigues at hotmail.com Sat Apr 8 12:28:15 2000 From: matheusrodrigues at hotmail.com (Matheus Rodrigues) Date: Sat, 08 Apr 2000 16:28:15 GMT Subject: I need MacPython screenshots! Message-ID: <20000408162815.50658.qmail@hotmail.com> Hello everybody I need some screenshots of a Macintosh running MacPython. If possible I would like to receive one screenshot of the MacPython Installation too. The faster you can provide some material to me the more I thank you. Please send the files (zipped) to my email as we dont want to create huge traffic in the list. It's not necessary to crop the images. btw, where is the Macintosh discussion list ? Thank you Matheus ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From maybe at lucky.com Sat Apr 8 11:51:11 2000 From: maybe at lucky.com (Soundwave) Date: Sat, 8 Apr 2000 17:51:11 +0200 Subject: starting python Message-ID: <8cnkfi$at7$1@porthos.nl.uu.net> Hi, I want to learn a bit python, I know a bit C and PASCAL, but I am intrested in other languages. where can I start ???? Do you naad a compiler or something for python, and where can I find one ? also, if anyone got a good tutor, please, give me the URL thanx Niels From helge.hess at mdlink.de Sat Apr 8 09:48:44 2000 From: helge.hess at mdlink.de (Helge Hess) Date: Sat, 08 Apr 2000 15:48:44 +0200 Subject: calendar/scheduling app References: <38EE332E.2954EA49@fizzylab.com> Message-ID: <38EF38BC.EE32E983@mdlink.de> Hi, you can try out SKYRIX, which is a set of groupware applications with a wholly HTML based GUI. You can find a demo version at http://www.skyrix.com/de/products/trial_download.html or on every SuSE Linux CD starting with version 6.2. (parts of it are even implemented in Python ;-) best regards Helge paul beard wrote: > > I am interesting in having a meeting scheduler/calendar app that does > what something like Exchange purports to do without requiring me to use > a client that doesn't exist. In other words, it should be > platform-agnostic and use webforms/cookies to handle transactions and > display options. > > Possible in Zope? How hard? How long to do, given a baseline knowledge > store of zero? > > -- > Paul Beard / 206 728 4282 x138 > Fizzylab / 2025 First Ave, Suite 1150 > Seattle WA 98121 From jbauer at rubic.com Wed Apr 19 11:07:28 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Wed, 19 Apr 2000 10:07:28 -0500 Subject: Playing wave files on Windows References: <38FB6ED7.4C72773E@callware.com> <38FB7624.943A8C35@rubic.com> <38FB7862.7B15633@callware.com> <38FCE40A.1D882566@quasar.ipa.nw.ru> Message-ID: <38FDCBB0.46FF3DAF@rubic.com> [ Me & Ivan ] >>> Then I can't interest you in my Python interface to >>> the Diamond Rio MP3 player? <0.5 wink> >> >> Not unless everyone that I'll be distributing my application >> to will have one plugged in and ready to go;-) [ Alexander Voinov ] > But indeed, is it inevitable to have a specific module for > one specific MP3 player? It's inevitable if it's the only MP3 I own. <0.5 wink> Seriously, I'm likely to add support for additional players, assuming the Snowblind Alliance remains intact and adds driver support for additional platforms. > I have no ideas about MP3, but it's strange that > there are no abstraction layers. I think we may be talking about two different issues. The manipulation and conversion of MP3 files (e.g. .WAV -> MP3 conversion) is unrelated to copying MP3's to MP3 players via the parallel or USB port. Though I would agree it would be nice to have a single abstraction layer for the download interface. OTOH, if we don't add support for other players, we may never need it. ;-) Jeff Bauer Rubicon Research From gmcm at hypernet.com Wed Apr 12 12:30:23 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 12 Apr 2000 12:30:23 -0400 Subject: comparing strings and ints In-Reply-To: <20000412112935.A2446939@vislab.epa.gov> References: Message-ID: <1256565470-46720619@hypernet.com> Randall Hopper writes: [vast snippery] > I was of course referring to the behavior Gordon McMillan mentioned in the > message I replied to. Namely, that sorting a list of objects of > hetrogenous primitive types "groups" the instances of a particular type > together (ints together, strings together, etc.). Back to the original subject: should comparing unlike types throw an exception. The argument for seems to be that comparing unlike types is *probably* a programmer mistake. Certainly sometimes it is a programmer mistake (else this thread would not exist). Other times it is not. (I know I have made use of this behavior, though I think only in ad-hoc interpreter usage.) I find myself aware that all Python objects (implicit in Python, but explicit in implementation) have a common root (in C, PyObject). In that sense, it's perfectly natural to be able to compare arbitrary objects safely. In fact, current behavior already relies on "types" (eg, "Number") that are not explicit: >>> .9 < 1 < 1.1 1 >>> Certainly nothing in Doc/lib/built-in-funcs.html mentions any danger in comparing arbitrary objects, nor the discussion in 2.1.5.2 ( Lib | Built-in Types | Mutable Sequence Types | sort). Personally, I read Doc/ref/comparisons.html as warning that the ordering of types may change, not that comparing different types might become illegal. So, I'd think it is safe to rely on the types being ordered; even if it is not safe to rely on the ordering. - Gordon From gregm at iname.com Thu Apr 20 10:58:45 2000 From: gregm at iname.com (Greg McFarlane) Date: Fri, 21 Apr 2000 00:58:45 +1000 Subject: Combobox in Tkinter In-Reply-To: <8db0b1$b3o$1@nnrp1.deja.com>; from johngrayson@home.com on 16 Apr 2000 at 12:09:13AM References: <38F8F133.54FCC64B@swt.edu> <8db0b1$b3o$1@nnrp1.deja.com> Message-ID: <20000421005845.36765@nms.otc.telstra.com.au> On 16 Apr, johngrayson at home.com wrote: > In article <38F8F133.54FCC64B at swt.edu>, > "Shah, Navneet" wrote: > > How to decrease the width of the combobox in Tkinter? Do we have any > > option for that > > set the width of the entryfield component: > > assuming the combobox id is 'xxx': > > xxx.component('entryfield').configure(width=4) This is not quite correct. The Pmw.ComboBox has an Pmw.EntryField component, named 'entryfield', which has a Tkinter.Entry component, named 'entry'. So, more correctly: xxx.component('entryfield').component('entry').configure(width = 4) Since this is long winded, you can use Pmw's component options: xxx.configure(entryfield_entry_width = 4) Or even shorter, since the Tkinter.Entry sub-sub-component of the Pmw.ComboBox has an alias named 'entry': xxx.configure(entry_width = 4) Component options (and aliases) can also be used during construction: xxx = Pmw.ComboBox(entry_width = 4) For more detail, see the Pmw documentation. -- Greg McFarlane INMS Telstra Australia gregm at iname.com From rcunning at acm.org Fri Apr 7 03:34:43 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Fri, 07 Apr 2000 07:34:43 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> <8cfa75$fho$1@newshost.accu.uu.nl> <38ED4292.2EE8D3CA@cosc.canterbury.ac.nz> Message-ID: <38ED8EF2.B0835BE1@acm.org> Greg Ewing wrote: > Unfortunately, Python *does* need 1-tuples. If > only ASCII had more kinds of brackets, Guido might > have chosen differently. Maybe if Python 3000 uses > Unicode for source files... Well, if they can be syntactically disambiguated from Python relational comparison operators, "<" and ">" can be used as "brokets". Then again, we can always resort to something like trigraphs... Whoops, Python has already started down that road: """ -BobC From greg at cosc.canterbury.ac.nz Mon Apr 17 21:41:44 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 18 Apr 2000 13:41:44 +1200 Subject: module naming? References: Message-ID: <38FBBD58.D1AF7A77@cosc.canterbury.ac.nz> "Michal Wallace (sabren)" wrote: > > def Record(dbc, table): > import zdc.record, zdc > zdc.Record = zdc.record.Record > return zdc.record.Record(dbc, table) > > Is there a better way to do this? Yes. In your __init__.py, simply say from Record import Record That will put the Record class in the zdc package namespace. The only drawback is that all the submodules will be loaded as soon as zdc is imported, even if they're not all used. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From bingdo19 at earthlink.net Tue Apr 25 15:01:02 2000 From: bingdo19 at earthlink.net (Bob Langdon) Date: Tue, 25 Apr 2000 19:01:02 GMT Subject: Newbie Needs Help -- Name and Key errors References: Message-ID: Thanks Fredrik! Dumb ?, but how do I set the DOCUMENT_ROOT environment variable? >From the fcsetup module? > just guessing here, but it looks like > > 1) you need to the DOCUMENT_ROOT environment variable > before running the script > > 2) the fcsetup.py module should define a variable called DEPOT, > but doesn't. > > > I think DEPOT might be a reference to the MySQL database, using the > > Berkley dbmodule (which I can't find). I certainly can't find a > > directory named DEPOT anywhere on the old host's server. > > DEPT is a variable name, not a directory name. the "from > fcsetup import *" line imports all variables from the fcsetup > module. > > > Neither can I fathom where "DOCUMENT_ROOT" is defined, or find a file > > called "os.environ." > > "os.environ" refers to a variable in the standard "os" module, > not a file. see the library reference for more info. > > > > From lewst at yahoo.com Sun Apr 2 16:33:38 2000 From: lewst at yahoo.com (lewst) Date: Sun, 2 Apr 2000 13:33:38 -0700 (PDT) Subject: NameError when assigning dictionary values Message-ID: <20000402203338.21701.qmail@web2105.mail.yahoo.com> This simple problem is driving my crazy. I can't figure out why I get a NameError with this program. # add each key-value pair to the dictionary and # then for each value, create an empty list. mydict = {} for key,value in [ (".", "one"), ("+", "two") ]: mydict[key] = value value = [] print mydict print one,two Whe I run this I get "NameError: one". Why aren't my 2 empty lists named "one" and "two" being created? __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From pete at visionart.com Thu Apr 27 13:49:13 2000 From: pete at visionart.com (Pete Shinners) Date: Thu, 27 Apr 2000 10:49:13 -0700 Subject: Concatening string and integer References: <8e9gco$jlt$1@vg170.it.volvo.se> <390846EF.79A67E02@yale.edu> Message-ID: <39087D99.3CAEF5AA@visionart.com> Paul Magwene wrote: > > JJ wrote: > > > > I want to concatenate a string containing both strings and integers like: > > > > strTemp = 'I make test number: ' + iMyNumber + ' once again' > > > > It doesn't work, how should I do this? > > Use the str() function (one of the builtins), like so: > > strTemp = "I make a test number: " + str(iMyNumber) + " once again" you can also use the back ticks as a shortcut for the str() builtin. you can do it like this; strTemp = "I make a test number: " + `iMyNumber` + " once again" From rcunning at acm.org Tue Apr 4 05:23:27 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Tue, 04 Apr 2000 09:23:27 GMT Subject: From Python Newbie to Python Guru on the Fast Track: HOW? Message-ID: <38E9B48F.F1827543@acm.org> Well, I just bit off more than I can chew. While I know barely enough Python to patch the occasional errant script, I've never written a thing of my own. Now I need to get up to speed FAST to design and develop a cross-platform UI interoperability environment for Windows-to-Linux that will allow much tighter integration of Windows apps running on a Linux desktop, no matter if the Windows app is running locally under Win4Lin or VMware, or is running remotely on a machine on a LAN or WAN or even the Internet (via a remote-control app such as VNC). I've selected Python simply due to the massive support it enjoys on both platforms (Windows Python is nothing less than amazing), the simplicity of the language itself, and it's ability to be used for fairly large distributed programs (via DOPY or PYRO or Fnorb). However, when the Windows app is running locally, all unnecessary communication layers should be eliminated, since there is only one CPU available to run Linux, the Windows app, and this interface (making for one very busy CPU). The goal will be to provide only the connective interface needed to bridge "the User Interface Gap" in the simplest way possible, even if that way is not optimal at the start. For example, all shared filesystems will be either vfat (if local) and/or NFS and Samba (until Windows gets native ext2 support ;^)). This will allow the implementation of services such as Drag&Drop to avoid having to transport the dragged item itself, if it is a file, and will allow files to be used as an intermediary mechanism (including on RAM disks, to simplify or eliminate any shared memory issues). Ultimately, I hope to expose Python Linux interfaces to many Windows services, ones that would permit dynamic application interaction (such as via ActiveX or OLE/COM), and maybe even to give Linux access to the Windows Media Player. The primary focus will be two-fold: 1) Make it easier for Windows apps to be sued from the Linux desktop. 2) Give Linux full access to Windows applications that have no true Linux equivalent (such as MathCad, LabView, TurboTax, Quicken, FaxTalk [answering machine + speakerphone + fax + BBS + ...], etc.). One thing I like about this entire approach is that it makes Windows seem more like an optional Linux add-on than a competitor! I'm an embedded real-time systems wonk, with lots of hardware how-to (I hate device drivers with a passion - I've written far too many), fantastic debugging skills, a decade of design and programming, a thin layer of OOP, and very little Python experience. I already program in at least 10 languages, so picking up a new one won't be hard. But learning to use it well can be a bit harder, not to mention all the extension packages. As for the time angle: I'm self-employed, and presently between clients. I have at least a few weeks to devote 100% to this effort, maybe more. At *least* a hundred hours or so, just to get started. Then there's the money angle: I don't mind spending $100 on this, but I'd like to keep it minimal (I also need to get a new system this month - this one is on its last legs). Given where I am, and where I hope to go, what is the fastest way to fill in the gaps in my knowledge? I'm looking for the best books and tutorials that will do the job, with my only access to other Python expertise being this newsgroup (or any other similar forum that may be recommended). I will be completely unable to evaluate these resources until AFTER I've put substantial time into the effort, so I'd really like to avoid the lemon I'd likely wind up with if I shop randomly on FatBrain. And I need to proceed to solid discussions of (and practice with) the various Python packages fairly quickly. Please also include any on-line classes that are known to be fast-paced and effective. Right now, I'm reading everything on Python.org, since I'll need to be familiar with that documentation no matter what else I use. Suggestions? TIA, -BobC From wrd at awenet.com Mon Apr 10 16:23:25 2000 From: wrd at awenet.com (William R. Dickson) Date: Mon, 10 Apr 2000 13:23:25 -0700 Subject: Problem running Python script as cron job References: <0004071555090M.01234@quadra.teleo.net> <0004101202210J.00831@quadra.teleo.net> Message-ID: In article <0004101202210J.00831 at quadra.teleo.net>, Patrick Phalen wrote: > :: > :: Anybody know of any issues with running python scripts from Cron? > :: > > :: > No. I've had multiple Python scripts running every one, two, five > :: > and > :: > ten minutes around the clock for years on multiple servers without > :: > problems. > :: > > :: > I'd suspect you might have a bug lurking. > :: > :: I think so too, but I can't find it, because the script runs > :: flawlessly > :: every time I run it by hand, and the buffer never flushes the output > :: to > :: the log when it's run by Cron. > > Are you "running by hand" as the same user as your script? Maybe you > have a permissions problem, assuming the script needs to write to a > file or whatever. In both cases, it's running as root. Thanks, -Bill From ljmacken at charter.net Tue Apr 25 06:31:59 2000 From: ljmacken at charter.net (Luke macken) Date: Tue, 25 Apr 2000 06:31:59 -0400 Subject: Newbie Question Message-ID: Hello, i just started teaching myself Python the other day, and I have been getting very into it. I have both the Linux version of it and the Windows version. I just want to know how i make executable files with it. Thanks From Michael.Scharf at gmx.de Thu Apr 6 12:22:38 2000 From: Michael.Scharf at gmx.de (Michael Scharf) Date: Thu, 06 Apr 2000 18:22:38 +0200 Subject: More about variables References: Message-ID: <38ECB9CE.44A73C13@gmx.de> Matthew Hirsch wrote: > > Hi All, > > Let's say I had something like: > > number_of_variables=int(raw_input('Enter number of variables: ')) > > if number_of_variables==1: > variable1=[] > elif number_of_variables==2: > variable1=[] > variable2=[] > elif number_of_variables==3: > variable1=[] > variable2=[] > variable3=[] > elif number_of_variables==4: > variable1=[] > variable2=[] > variable3=[] > variable4=[] > elif number_of_variables==5: > variable1=[] > variable2=[] > variable3=[] > variable4=[] > variable5=[] > else: > print 'else' > > Is there a more efficient way of doing this? What if I wanted to create > 100 variables (lists). It doesn't make sense to write an if statement > for that many conditions. Just do: for i in range(number_of_variables): vars()["variable%s" %(i+1)]=[] Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software GmbH, a Wind River Company ` > http://www.WindRiver.com \_ V mailto:Michael.Scharf at gmx.de From alberanid at bigfoot.togli.questo.com Sun Apr 30 07:54:34 2000 From: alberanid at bigfoot.togli.questo.com (Davide Alberani) Date: Sun, 30 Apr 2000 11:54:34 GMT Subject: Problem running NNTP example from docs. References: <87hfckk6fv.fsf@tea.thpoon.com> Message-ID: <0nvge8.7ua.ln@snoopy.mio> Arcady Genkin wrote: > > Could somebody point out what I am missing? Try: s = nntp.NNTP('news') Or using this 'import' statement: from nntplib import NNTP and than: s = NNTP('news') -- Cinereview: Stigmate: "tecnicamente" non male, un po' meno _/Davide\_ gli altri aspetti troppo superficiali. Voto: 5.5 \Alberani/ From dworkin at ccs.neu.edu Thu Apr 27 12:31:33 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 27 Apr 2000 12:31:33 -0400 Subject: Python 2.0 In-Reply-To: m.faassen@vet.uu.nl's message of "27 Apr 2000 12:36:45 GMT" References: <3907B52D.B01D5748@myself.com> <8e9c8t$hi6$1@newshost.accu.uu.nl> Message-ID: m.faassen at vet.uu.nl (Martijn Faassen) writes: > * case insensitivity. foo = Foo() would break > > Opinions on them vary; they may reek a bit like Do-What-I-Mean, > but nobody thinks either change would be a disaster. Yow. I would personally consider that one a disaster, but my vote doesn't count for much. I very much like the idiom of an instance being a lowercased version of its class name, in some cases. I guess it depends on one's definition of "distaster"... There will be plenty of time to argue over this stuff before it becomes really relevant, in any case. -Justin From jnw22 at cam.ac.uk Tue Apr 11 08:31:51 2000 From: jnw22 at cam.ac.uk (James "Wez" Weatherall) Date: Tue, 11 Apr 2000 13:31:51 +0100 Subject: WinNT and TCL/TK References: Message-ID: <8cv5vo$f0v$1@pegasus.csx.cam.ac.uk> "Jerome Chan" wrote in message news:eviltofu-9BCDF3.08165411042000 at news.earthlink.net... > Have installed Python 1.5.2 on a WinNT Server but it says it can't find > a TCL lib when I start it up. Do I have to add something? This is a path-setting bug, as far as I can tell. Under the My Computer Properties tab in Windows, change the system's PATH to include the directory containing the Tcl library (usually c:\program files\tcl\bin). The other option is to copy the tcl80.dll (?) file from that directory into the system32 directory. That way you needn't alter the system PATH but you will have a rogue file in your system directory! Hope that helps, -- James "Wez" Weatherall From PClaerhout at CREO.BE Wed Apr 12 06:30:01 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 12 Apr 2000 12:30:01 +0200 Subject: Saving a copy of a remote NT event log Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA72A0@MSGEURO1> It does indeed, and it works like this: import win32evtlog evtLogSys = win32evtlog.OpenEventLog('pclaerhout', 'system') win32evtlog.BackupEventLog(evtLogSys, 'c:\\system.evt') win32evtlog.CloseEventLog(evtLogSys) Kind regards, Pieter Pieter_Claerhout at creoscitex.com -----Original Message----- From: Mark Hammond [mailto:mhammond at skippinet.com.au] Sent: Wednesday, April 12, 2000 2:16 AM To: python-list at python.org Subject: Re: Saving a copy of a remote NT event log Im fairly sure the win32evtlog module will do this for you. Check the docs. Mark. "Pieter Claerhout" wrote in message news:2B1262E83448D211AE4B00A0C9D61B03BA7295 at MSGEURO1... > Hello, > > does anyone know if it's possible to save a copy of the NT-event log > from a remote machine using Python? Normally, you have to do a > save as from that machine, and then copy over the logfile, but I want > to automate this using Python. Any ideas? > > Kind regards, > > > Pieter > > [ Pieter Claerhout :: CreoScitex Response Centre :: Applications support ] > [ Pieter_Claerhout at creoscitex.com :: http://www.creoscitex.com/ ] > [ CreoScitex Europe :: Excelsiorlaan 21 :: 1930 Zaventem :: Belgium ] > > -- http://www.python.org/mailman/listinfo/python-list From wrd at awenet.com Fri Apr 7 15:28:25 2000 From: wrd at awenet.com (William R. Dickson) Date: Fri, 07 Apr 2000 12:28:25 -0700 Subject: Problem running Python script as cron job Message-ID: Hi all, I've got a Python script that runs very nicely from the command line, but seems to hang up and loaf around forever if I run it as a cron job. >From the command line, I do: /path/to/statsthing -r That works well. The script prints many status messages to STDOUT as it runs. I want to preserve these messages when running the script automatically, so I do this in the crontab: /path/to/statsthing -r > /usr/local/temp/.log This is a script I rewrote from an old Perl version as a learning exercise to teach myself Python. The Perl version runs from Cron very happily with that command. The Python version runs to a point, then simply stops, and I need to kill the processes. The log contains some data, but I'm pretty sure some of it is never being flushed to disk, so I'm not sure exactly where it's halting. Anybody know of any issues with running python scripts from Cron? Thanks, -Bill From kent at tiamat.goathill.org Thu Apr 20 12:44:24 2000 From: kent at tiamat.goathill.org (Kent Polk) Date: 20 Apr 2000 16:44:24 GMT Subject: Mac Python Questions References: <38FE8032.DE233C29@cosc.canterbury.ac.nz> Message-ID: <956247497.216189@fezzik.endicor.com> On Thu, 20 Apr 2000 15:57:38 +1200, Greg Ewing wrote: >Jeff Massung wrote: >> >> b) No matter what I do, I can't get Tkinter to work :(. > >Neither can I, and from what I've seen here, neither >can anyone else. Tkinter just seems to be broken on >the Mac at present. I have the distributed Python 1.5.2 with tkinter (precompiled) working on some older PPC macs and even some G3's (or whatever they are). I know nothing about Macs, but I finally got around to writing a tkinter frontend for a PCR data postprocessor that had to run on the wetlab Macs that run the ABI 'Genotyper' software. I developed on unix and just had to adapt some printer support code that I found in the included mac-specific stuff for it to run on the Macs. The standard Python installation program installed the wrong version of the _tkinter shared library and(/or) didn't set the path to the correct (ppc) version, so Python couldn't load _tkinter. If that is the problem, there are several ways to solve it. If that isn't the problem, I'm not sure what to tell you as it's working on I think 3 or 4 different mac platforms here. From tim_one at email.msn.com Sat Apr 1 14:54:07 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 1 Apr 2000 14:54:07 -0500 Subject: Why should I switch to Python? In-Reply-To: Message-ID: <000201bf9c14$0a79d9e0$182d153f@tim> [Aaron Turner] > ... > Basically if you know both languages [Perl & Python], and were planning > a mid-sized project, why would you choose Python? When I was very young, I wondered why my dad's electric razor didn't rip his face to shreds. As a budding empirical scientist, I tested my theories by trying it first on my cheek, and then on my tongue. This was very educational -- although it's still painful to talk about . In other words, "voice of experience". There aren't a lot of bilingual P programmers out there, but I expect you'll find the majority of them hanging out on c.l.py rather than c.l.p.m. That should tell you the conclusion you're likely to reach if you decide to become one of them too. Nobody is going to argue you into it, though, and Python is easy enough to learn that there's no significant barrier against just giving it a try. >From what I've seen-- which matches my own experience --people generally switch over gradually. The prime motivation seems to be that, time after time, when tracking down a bug in a Perl program, you increasingly realize "hmm -- if I had written this in Python, this wouldn't have happened". Whether it's the 200th time you've been shredded by an array-vs-scalar context surprise, or the 12th time an implicit coercion guessed the wrong way, they're traps you *can't* fall into in Python. Python's syntax is simpler, its semantics more regular, and its philosophy of raising exceptions is "gripe whenever there's a reasonable doubt" rather than "assume the programmer meant whatever they wrote". These conspire to make larger Python systems less work over the long haul, and especially in a team project (TMTOWTDI loses its cowboy charm when you have to decipher 6 other peoples' code every day too). > It's hard to take my friend seriously in his evaluation when he says > he'd rather do this project in C++ than in Perl (especially when he > doesn't know Perl). Depends on the project. I make my living these days on a project that's about a half million lines of C++ and assembler -- Perl and Python are both too fat and slow to have much use in it apart from automating testing. Perl gets used a lot for the latter, but other groups where I work, with large projects that can afford the fat of either P language, all use Python now, or Java + JPython. There's no company policy on this, it's a group-by-group decision. And despite that we now have many more lines of Python than Perl, I still spend most of my "help others debug their scripts" time staring at Perl. a-day-of-experience-is-worth-a-decade-of-usenet-ly y'rs - tim From mjhand at concentric.net Sun Apr 16 03:22:26 2000 From: mjhand at concentric.net (Manus Hand) Date: 16 Apr 2000 03:22:26 EDT Subject: Python Starship Grounded?? References: <38F6B2DF.940E7C23@concentric.net> <8db5sb$gsc$1@nnrp1.deja.com> Message-ID: <38F969B5.D2B201E@concentric.net> I too live my whole life on the ship. And many other people do too, through the use of my Websites. I certainly hope someone is reading these cries for assistance and doing what can be done about putting the starship back in working order. I have twice mailed the mcsp folks who host the machine, but no answer as of yet. Manus From rumjuggler at home.com Sun Apr 16 13:35:46 2000 From: rumjuggler at home.com (Ben Wolfson) Date: Sun, 16 Apr 2000 17:35:46 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8dbdj3$dgt$1@slb2.atl.mindspring.net> <8dcpom$fbc$1@slb3.atl.mindspring.net> Message-ID: <9nujfs0p7vn2idr0b7buls12fvdq19llhh@4ax.com> On Sun, 16 Apr 2000 04:17:22 -0600, "Andrew Dalke" wrote: >You can imagine: > >def expression_if(test, true_string, false_string): > # some nasty code to get the locals of the calling function > if test: > return eval(true_string with the given locals) > else: > return eval(false_string with the given locals > >x = expression_if(a is not None, "a[i].weeble", "0") + ... I did this. Instead of the nasty code to get the locals of the calling function, you can change the parameter list to def expression_if(test, true_string, false_string, gbals, lcals): and pass in globals and locals when you call it. -- Barnabas T. Rumjuggler Half our days we pass in the shadow of the earth; and the brother of death exacteth a third part of our lives. -- Thomas Browne. From paul.robinson at quantisci.co.uk Thu Apr 13 09:18:48 2000 From: paul.robinson at quantisci.co.uk (Paul Robinson) Date: Thu, 13 Apr 2000 14:18:48 +0100 Subject: Python CGI running commands under NT References: <2B1262E83448D211AE4B00A0C9D61B03BA72B1@MSGEURO1> Message-ID: <38F5C938.8278EBFA@quantisci.co.uk> Pieter Claerhout wrote: > > Are there any other ways to accomplish this? There is always: import os, tempfile t = tempfile.mktemp() command = 'ipconfig > ' + t os.system(command) p = open(t, 'r') But I'm sure someone can think of a better way of doing this. This question has definately been asked before (possibly by me!) so see if you can find a fuller answer at dejanews... Paul. ----------------------------------- Business Collaborator Team Enviros Software Solutions http://www.businesscollaborator.com ----------------------------------- From tismer at tismer.com Mon Apr 17 13:38:57 2000 From: tismer at tismer.com (Christian Tismer) Date: Mon, 17 Apr 2000 19:38:57 +0200 Subject: How do I make a constant global variable in Python Please References: Message-ID: <38FB4C31.734DFBB3@tismer.com> Hi, cmfinlay at magnet.com.au wrote: > > How do I make a constant global variable in Python Please. > or just a constant. > or just a global. > > I bought a Python Book. however I can't find this info in it. > > Please e-mail me at cmfinlay at magnet.com.au > -- > http://www.python.org/mailman/listinfo/python-list There is no such concept as you required, but it can be modelled. If you can live with the rule that you need to use one global thunk that holds your real vars/consts, then the following will work for you. The advantage of this approach: After the debugging phase, you can replace the "declared" class with an empty class, and things will work just faster. You can also use it to monitor usage of certain variables if you like. ciao - chris file declared.py -------------------------------------------------------------------- # declared global variables # done with a class. # # Christian Tismer, Y2k0417 class declared: """A class that mimicks declaration of variables before use. Usage example: g = declared("hi there") gives you write access to the attributes "hi" and "there". Note that they cannot be read before they have been set. """ def __init__(self, namestring=""): self.__dict__["__names__"] = {} self.declare(namestring) def __setattr__(self, key, value): dic = self.__dict__ nam = dic["__names__"] dic[nam[key]] = value def __getattr__(self, key): dic = self.__dict__ nam = dic["__names__"] return dic[nam[key]] def vars(self): return self.__names__.keys() def declare(self, namestring): import string for name in string.split(namestring): self.__names__[name] = name sample_session = """ >>> g=declared("hi there") >>> g.vars() ['hi', 'there'] >>> g.hi Traceback (innermost last): File "", line 1, in ? File "D:\python\spc\declared.py", line 24, in __getattr__ return dic[nam[key]] KeyError: hi >>> g.hi=4 >>> g.hi 4 >>> del g.hi >>> g.hi Traceback (innermost last): File "", line 1, in ? File "D:\python\spc\declared.py", line 24, in __getattr__ return dic[nam[key]] KeyError: hi >>> """ ------------------------------------------------------------------ -- Christian Tismer :^) Applied Biometrics GmbH : 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 hakan at netg.se Thu Apr 13 11:50:19 2000 From: hakan at netg.se (Hakan Nilsson) Date: Thu, 13 Apr 2000 17:50:19 +0200 (CEST) Subject: List mapping? In-Reply-To: Message-ID: On Thu, 13 Apr 2000, Robert Cragie wrote: > > Try this: > > mylist = ['/a','1','/b','2','/c','3'] > > map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0, > > len(mylist), 2)) > > Sorry, forgot to assign... > > mylist = ['/a','1','/b','2','/c','3'] > tuplist = map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0, > len(mylist), 2)) > > Robert Cragie > > Howcome you use reduce at all? Works fine with just doing tuplist = map(lambda x: (mylist[x], mylist[x+1]), range(0, len(mylist), 2)) Reduce has many uses, but I can't see why this should be one of them ;o) (as mentioned, getopts would be even better though;) /H H?kan Nilsson NetGuide Scandinavia hakan at netg.se 031-50 79 40 From jay_love at mindspring.com Mon Apr 3 19:27:57 2000 From: jay_love at mindspring.com (Jay Love) Date: Mon, 03 Apr 2000 18:27:57 -0500 Subject: PyGreSQL errors References: Message-ID: <8cb9db$p0k$1@slb3.atl.mindspring.net> The first thing that comes to mind is, have you created the test database? Jay In article , Lee Joramo wrote: > I am trying to get pygresql to work. I have a Cobalt RaQ3 server which runs > a slightly modified version of RedHat. The system came with PostgreSQL > pre-installed. When I import the pygresql's basics.py tutorial at pythons > command line, I follow the instructions to create a connection and get an > error: > > >>>> cnx = basics.DB('mytest') > Traceback (innermost last): > File "", line 1, in ? > File "/usr/lib/python1.5/pg.py", line 34, in __init__ > self.db = apply(connect, args, kw) > pg.error: FATAL 1: Database mytest does not exist in pg_database > > > > What has gone wrong? > > -- > Lee A. Joramo ljoramo at nickads.com > The Nickel Want Ads www.nickads.com > Internet Manager 970-242-5555 > > -- > > Onward and Upward! > > Lee A. Joramo }}-----> Cowboy on the Electronic Frontier > > lee at joramo.com > > Alamar Ranch - Palisade - Colorado > > ThreeRivers|Eagle|UCD|D&D|TNC|DX|Mac|221B|Cannondale|Deutsch > > From nick at spam_me_notvideosystem.co.uk Thu Apr 13 11:01:38 2000 From: nick at spam_me_notvideosystem.co.uk (Nick Trout) Date: Thu, 13 Apr 2000 16:01:38 +0100 Subject: List mapping? References: Message-ID: <38f5e2b0@news.xtml.co.uk> I came up with something similar: processfn = { 'del':deletefiles } comm = None flist = [] fileopts = sys.argv[2:] while fileopts: if fileopts[0]=='/c': comm = fileopts[1] fileopts = fileopts[2:] elif fileopts[0]=='/d': fdir = fileopts[1] ext = fileopts[2] fileopts = fileopts[3:] flist.extend( readdir(fdir,ext) ) else: raise "Unknown flag:",fileopts[0] processfn[comm](flist) There are obviously a lot of ways to do this in Python, the most elegant way doesnt always seem obvious at first! Just wondered how others would approach this problem. Cheers, Nick. "Mike Fletcher" wrote in message news:CC59868A0A76D311B1F50090277B321C1F326A at VRTMAIL... > not elegant, but here's another way... > > original = string.split( x, ' ') > result = [] > while original: > result.append( tuple(original[:2]) ) > del original[:2] > > and another... > > original = string.split( x, ' ') > result = [] > for x in range(0, len(original), 2 ): > result.append( tuple( original[x:x+2])) > > HTH, > Mike > > -----Original Message----- > From: Nick Trout [mailto:nick at spam_me_notvideosystem.co.uk] > Sent: Thursday, April 13, 2000 10:10 AM > To: python-list at python.org > Subject: List mapping? > > > Is there a nice way of pairing up the members to form tuple pairs in another > list? ie. like you might to processing input args. > > ie. changing ['/a','1','/b','2','/c','3'] into [ ('/a','1'), ('/b','2'), > ('/c','3') ] > > eg: > > args = '/a 1 /b 2 /c 3' > listargs= string.split(args) > tuplist = [] > i=0 > while i < len(listargs): > tuplist.append( (listargs[i],listargs[i+1]) ) > i = i+2 > for i in tuplist: > processargs(i) > > or: > > args = '/a 1 /b 2 /c 3' > for i in string.split(args): > i = argflag > # i want next arg now as a parameter!!! > > Can I (you!) get rid of the long winded while loop cleverly?!! :-) > > Thanks in advance, > Nick. > > > > > > -- > http://www.python.org/mailman/listinfo/python-list > From neelk at brick.cswv.com Thu Apr 13 19:12:18 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 13 Apr 2000 23:12:18 GMT Subject: Why is if a in dict.keys() so slow..... References: <38F5A075.CDFA32D9@bedford.waii.com> Message-ID: Martin Franklin wrote: > Hi, > > Just thought i'd throw this out there.... > > This is very slow:- > > if split[0] in map_dict.keys(): > print 'found it!', map_dict[split[0]] > else: > print 'not found' > > Question is why? dict.keys() generates a list of the keys each time it is called, so you are generating a list of 40K elements 250,000 times. Then, to do the "split[0] in map_dict.keys()" test, you are searching through that list one element at a time. So on average you'll search 40K/2 = 20K elements before finding the key. Lookup for dictionaries (ie, writing dict[foo]) is very fast -- the time to do a lookup doesn't go up, no matter how many items you put in the dictionary. So the try/except statement should run around 20K times faster. If you just want to check whether an element is in a dictionary, there is a method called dict.has_key(foo); it will return true if foo is a key in the dictionary and false if not. This is also a very fast lookup. So you could also write: if map_dict.has_key(split[0]) print "Found it!" else: print "Not found!" The choice of try/except versus dict.has_key() is mostly one of taste; the speed differences between the two is quite small, so you should pick whichever one makes your intent clearer. (Incidentally, this will also usually be the faster choice.) Neel From sabren at manifestation.com Sun Apr 23 23:02:50 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 23 Apr 2000 23:02:50 -0400 (EDT) Subject: crypt() results Message-ID: Well. I tried porting both Crypt::UnixCrypt and Crypt::PasswdMD5 to python. And neither one of the python versions give the same results as the perl versions. They come out in the same format, but with different values. I've pounded my head, pulled out my hair, and finally given up. I simply don't know enough about the algorithms or perl's bit twiddling to understand what these modules are actually doing. If anyone else wants to take a stab at it, my code's at: http://www.sabren.com/code/python/crypt/ (That page also has links to the perl versions on CPAN) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From kragen at dnaco.net Sun Apr 23 01:33:47 2000 From: kragen at dnaco.net (Kragen Sitaker) Date: Sun, 23 Apr 2000 05:33:47 GMT Subject: The Simple Economics of Open Source References: Message-ID: <%WvM4.1478$RM6.3452288@news-east.usenetserver.com> In article , Raffael Cavallaro wrote: >Sarcasm aside, I think you miss the point. Those artists least willing to >share, most jealous of their "secrets" have always been those who were most >successful. Unsucessful young artists are, by and large, quite willing to >share ideas, working techniques, etc. It's actually the more established, >financially succesful ones, who are not. > >I see a parallael to the software industry here as well. Those with a >lucrative cash cow (e.g., MS) are reluctant to share code, but those who >just make a living programming are happy to share source. It would seem that >sharing is inversely proportional to the value of that which is shared. Those spenders most willing to spend profligately have always been those who had the most money. Unsuccessful young spenders are, by and large, unwilling to spend money on luxuries like expensive cars, large houses, etc. It's actually the more established, financially successful ones who do. Those with a lucrative trust fund (e.g. Bill Gates) are happy to spend lots of money on nonessential things, but those who just make a living flipping burgers at McDonald's are reluctant to do so. It would seem that spending is directly proportional to the value of that which is to be spent. Correlation doesn't imply causality, and when it does, it's easy to get causality backwards if you're not careful. You could get misled into spending lots of money to get rich if you just look at the correlations. -- Kragen Sitaker The Internet stock bubble didn't burst on 1999-11-08. Hurrah! The power didn't go out on 2000-01-01 either. :) From tseaver at starbase.neosoft.com Tue Apr 4 00:58:49 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 3 Apr 2000 23:58:49 -0500 Subject: Python 1.6 alpha 1 released References: Message-ID: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> In article , Moshe Zadka wrote: >On 3 Apr 2000, John Aycock wrote: > >> I'm not going to take sides here, but I coincidentally just finished >> reading something highly relevant: > > >I beg to differ: it's not highly relevant. What Guido did was correct >a *bug* in the implementation. That people depended on it is sad, and >just goes to show it should be corrected ASAP before more people depend >on it. The point of this debate is that classifying it as a *bug* is, well, debateable. Years of socket programming experience makes: s.connect( host, port ) seem like a perfectly reasonable, sane interface; disallowing it may preserve "orthagonality," or some other academic purity, but it *breaks existing applications coded to the published interface*, with no appreciable real-world benefit (yes, I realize that the published interface is inconsistent; I do not accept the deprecation of the examples as a reasonable argument.) Consider that *every one* of the protocol modules which offers a connect() method uses a two-argument signature for it: ftplib, gopherlib, httplib, imaplib, nntplib, poplib, smtplib, telnetlib, urllib. And they all *use* the two-argument connect when invoking their underlying socket! No Python module in the standard library uses the single-argument connect, period. This is *not* the same case as the list.append() one, where the published interface was itself consistent -- I was quite surprised to learn just this spring that multi-argument append was even possible. But the socket module is one of the first I learned in Python, and I have consistenly used the two-argument connect. Constructing a spurious "address" object (which has no behavior, and exists only to be torn apart inside the implementation) seems a foolish consistency, beyond doubt. Rough-consensus-and-running-code-wins-every-time'ly Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at digicool.com http://www.zope.org Digital Creations From jon at dgs.monash.edu.au Mon Apr 10 21:13:20 2000 From: jon at dgs.monash.edu.au (Jonathan Giddy) Date: Tue, 11 Apr 2000 11:13:20 +1000 (EST) Subject: Frames in TK In-Reply-To: <38F266FB.2363E980@swt.edu> from "Shah, Navneet" at Apr 10, 2000 07:42:51 PM Message-ID: <200004110113.LAA17487@nexus.csse.monash.edu.au> Shah, Navneet declared: > >Can anyone let me know the code for making frames in TK. I need to have >two frames in the window with the top frame should cover 65% of the >window while the remaining 35% should be covered by the second frame. For that level of control, use the Tk place command. Alternatively, the Pmw PanedWidget gives the user more control. from Tkinter import * def create_frames(master): # relief and borderwidth arguments make frames visible frame1 = Frame(master, relief='sunken', borderwidth=2) frame2 = Frame(master, relief='sunken', borderwidth=2) frame1.place(relx=0, rely=0, relwidth=1, relheight=0.65) frame2.place(relx=0, rely=0.65, relwidth=1, relheight=0.35) # put something in the frames label1 = Label(frame1, text="Hello") label1.grid(row=0, column=0) label2 = Label(frame2, text="World!") label2.grid(row=0, column=0) root = Tk() create_frames(root) root.mainloop() From gmcm at hypernet.com Thu Apr 20 11:12:45 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 20 Apr 2000 11:12:45 -0400 Subject: Using popen in windows In-Reply-To: Message-ID: <1255878929-30440209@hypernet.com> Robert Cragie > I tried this and it still hangs; cvs.exe is definitely not a built in: > > from win32pipe import popen > p = popen('c:\\cygwin\\contrib\\bin\\cvs -v','r') > str = p.read() > print str > > Again, the equivalent works fine on Linux. Works fine on NT, too. Bill Tutt put out something that works around the Win9x bug. Searching dejanews on popen and Win95 should find it. > So how do I run a command in > Windows and capture the output? The following works, but is clumsy, and you > get the annoying DOS box while it runs - is there a better way?: > > import os > os.system('dir >temp') > f = open('temp', 'r') > f.read() Yeah, os.listdir('.') . To get around the singing, dancing consoles, you need to use os.spawnv, which is another whole can of worms. Python 1.5.42+ (#0, Mar 28 2000, 20:39:47) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import os >>> os.spawnv(os.P_WAIT, 'd:\\util\\bin\\cvs.exe', ('d:\\util\\bin\\cvs.exe', '-v')) Concurrent Versions System (CVS) 1.9 (client) Copyright (c) 1993-1994 Brian Berliner Copyright (c) 1993-1994 david d `zoo' zuhn Copyright (c) 1992, Brian Berliner and Jeff Polk Copyright (c) 1989-1992, Brian Berliner CVS may be copied only under the terms of the GNU General Public License, a copy of which can be found with the CVS distribution kit. 0 >>> If you really want to understand this crap, look at win32process.CreateProcess(), because every method of method of starting a new process on Windows ends up making this call; and the cruntime lib (*nix emulation) calls are all hopelessly braindead in some way or other. - Gordon From aa8vb at yahoo.com Sat Apr 1 08:25:13 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Sat, 01 Apr 2000 08:25:13 -0500 Subject: Emacs Python mode In-Reply-To: References: Message-ID: <20000401082513.B1353928@vislab.epa.gov> Vetle Roeim: |I just had an idea. Using the Emacs python-mode, would it be possible |to somehow hide the function-bodies? | |Sometimes it would be useful to get an overview of the functions |provided by a class. Your prayers have been answered. See Ken Manheimer's outdent.el for Emacs (http://www.python.org/emacs/). Collapsable Python blocks, block skips, etc. ...that is, once they get http://www.python.org back up: TCP connection to 'www.python.org' failed: Broken pipe. -- Randall Hopper aa8vb at yahoo.com From gary_thomson at yahoo.com Sun Apr 30 07:06:23 2000 From: gary_thomson at yahoo.com (gary thomson) Date: Sun, 30 Apr 2000 11:06:23 GMT Subject: IDLE & Win 95 Message-ID: <390c1265.4105818@news.force9.net> I've installed Python 1.5.2 and Tcl/Tk on my machine. I wanted to use IDLE. Downloaded it from the net and overwrote the IDLE folder in the Tools directory. When I go to IDLE (Python GUI) in the Start menu, nothing happens. Similarly double clicking idle.pyw. What makes this more mysterious is that I managed to do this at work (under Windows 98) without any problems. IDLE is cool! Hence I'd like to be able to work with it at home. can anyone see what I need to do to get it working? TIA Gary Thomson garyt at garyt.force9.co.uk Try MindProbe. Let your PC read your mind Visit http://www.garyt.f9.co.uk From python at rose164.wuh.wustl.edu Tue Apr 25 06:32:09 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Tue, 25 Apr 2000 05:32:09 -0500 Subject: serial port and event loop question References: <8doe40$h8$1@nnrp1.deja.com> Message-ID: <003101bfaea1$82a3be00$0201a8c0@spkydomain> ----- Original Message ----- From: Newsgroups: comp.lang.python To: Sent: Thursday, April 20, 2000 9:24 PM Subject: serial port and event loop question > Hi everyone. This is mostly a general programming question, but since > I'm using Python for this project, I thought I'd ask here... I wrote > database written with Python and Gadfly, and I've got a nice little > Tkinter GUI for it. I need to make it monitor the serial port for > incoming data (from a barcode scanner). I'm using the Serial module, > but I don't know how to have my program watch for new data > constantly...any help? > Hi, If you're talking about the win32 serial io module, you don't need to do anything special for it to watch for new data. It buffers the incoming data until you read() or readTerminated() to get the data. Good luck, David From chafik at nevrax.com Mon Apr 10 04:11:25 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Mon, 10 Apr 2000 10:11:25 +0200 Subject: (no subject) Message-ID: <017d01bfa2c4$5d4d4ce0$1001a8c0@nevrax.net> Hello i want to erase my existing subscription from the the mail list -------------- next part -------------- An HTML attachment was scrubbed... URL: From jschmittNOjsSPAM at vmlabs.com.invalid Fri Apr 7 14:31:29 2000 From: jschmittNOjsSPAM at vmlabs.com.invalid (John Schmitt) Date: Fri, 07 Apr 2000 11:31:29 -0700 Subject: Tkinter install? Message-ID: <081c4ffb.329993cd@usw-ex0102-014.remarq.com> What environment variables are needed to use Tk/Tkinter? Are you supposed to be able to edit the environment variables from within PythonWin's Tools/EditPytonPath menu? I can't seem to change anything from there. I really want to point the relevant variables to the right path, but don't know how to do that with PythonWin. Any advice? What brought this question on is this: I did a clean install of py152 (NT4, if it matters) and did the install of tcl/tk. I have Grayson's Tkinter book, and I'm trying to run one of the examples. I get this message in Tkinter.py:886: ------------------- TclError: Can't find a usable init.tcl in the following directories: {} ./lib/tcl8.0 D:/pyprojects/grayson/tcl8.0/library D:/pyprojects/grayson/Examples/library This probably means that Tcl wasn't installed properly. ------------------- Thanks. John * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From tjg at avalongroup.net Tue Apr 4 17:49:32 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Tue, 04 Apr 2000 14:49:32 -0700 Subject: Tkinter, > in tkinter? > > the nearest I have been able to find is from Pmw, and it doesn't really look > like windows... Hmm, I thought that the Pmw.ComboBox() when used in drop down mode looked almost just like the Windows Drop Down box. What is your problem with it? -- Stand Fast, tjg. Timothy Grant tjg at exceptionalminds.com Chief Technology Officer www.exceptionalminds.com Red Hat Certified Engineer (503) 246-3630 Avalon Technology Group, Inc. fax (503) 246-3124 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From m.faassen at vet.uu.nl Wed Apr 5 14:00:45 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 5 Apr 2000 18:00:45 GMT Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <01f801bf9e80$5a522a80$29dc9f26@unitedelectric> <38EA6517.978953E4@callware.com> Message-ID: <8cfv0d$l0e$1@newshost.accu.uu.nl> Ivan Van Laningham wrote: > Query for information, using a not-very-complicated schema. Read a file > and, after massaging the data, stuff the information into the db. > As reading the file progresses and the information gets transferred to > the db, update a progress indicator (that's the extent of the GUI;-) I have been using Win32all's ODBC support successfully for a long time now. Just install Win32all, create a system DSN for your access database with the Windows odbc manager, and do: import odbc, dbi ..after that you can use the Python DB API (version 1) to do SQL queries. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From claird at starbase.neosoft.com Mon Apr 24 18:46:11 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 24 Apr 2000 17:46:11 -0500 Subject: Why doesn't O'Reilly use parrots on its python books? References: Message-ID: In article , David Goodger wrote: >How about half a bee? > >If they ever run out of fauna and need to go flora, the only choice would >be: the larch. > Pruned into shrubbery. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From thomas at xs4all.net Wed Apr 12 01:58:15 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Wed, 12 Apr 2000 07:58:15 +0200 Subject: Huh? func_defaults, default values in function calls In-Reply-To: <38F3EBBF.7B23@marshall.edu>; from hathawa2@marshall.edu on Tue, Apr 11, 2000 at 09:17:10PM -0400 References: <8cv5qj$35p$1@zinc.intern.netconnect.no> <8cv8ra$hio$1@pegasus.csx.cam.ac.uk> Message-ID: <20000412075815.A14644@xs4all.nl> On Tue, Apr 11, 2000 at 09:17:10PM -0400, Mark Hathaway wrote: > > I think this is the first time I've seen show up with dictionaries, usually > > is shows up with lists. > At least this idiom gets the job done, but it sincerely defeats the > idea of having default values to have to say "z=None". Not really. I agree that it is slightly counter-intuitive, which is very suprising in Python, but it adds a pretty valuable construct -- that of a 'static' variable in C. I dont think there is another way to do that, except global variables or using an explicit namespace. As for the use of default values, the use stays in the case of immutable values, and also for mutable values which you do not mutilate. mutable-as-in-mutiny?-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From soundhack at hotmail.com Thu Apr 20 07:14:31 2000 From: soundhack at hotmail.com (Robert) Date: Thu, 20 Apr 2000 07:14:31 -0400 Subject: win32all-128.exe availability? References: <38fd01b2$0$10982@senator-bedfellow.mit.edu> <3k9qfs0ropdsv515f9he7lkpdrf1qfputv@4ax.com> Message-ID: <38fee74c$0$10971@senator-bedfellow.mit.edu> Well thanks to calishar's patience, I finally have it. It's available to everyone on www.idrive.com/soundhack Thanks again to calishar! Robert Calishar wrote in message <3k9qfs0ropdsv515f9he7lkpdrf1qfputv at 4ax.com>... >On Tue, 18 Apr 2000 20:49:08 -0400, "Robert" >wrote: > >>Now that starship has crashed, I was wondering if it was possible to >>get the 128 build of Pythonwin extensions off the net? By an unfortunate >>coincidence, my own hard drive chose to crash around the time starship >>did. > >Don't know if any sites have a mirror of win32all-128, but I have it >on my HD (love being a packrat, still have -127 too). If you want I >can try e-mailing it to you. I say try because the file is 3.2M and >@home gives me a 5M message size limit. > >Let me know if you want it via mail. > >Calishar > >calishar at home.com From dalcolmo at mediaone.net Sat Apr 22 13:43:21 2000 From: dalcolmo at mediaone.net (Josef Dalcolmo) Date: Sat, 22 Apr 2000 17:43:21 GMT Subject: editor for win32 References: Message-ID: Scott Hathaway wrote in message news:NpHL4.779$fK2.113609 at news.flash.net... > Can anyone recommend a python editor for Windows? > > If there is an IDE for windows (other than IDLE), even better. Yes, there is Pythonwin (download and install(run) Win32all.exe). Thats a full IDE If you just want an editor any of the ones others already recommended are good, but beware that Emacs is huge (20+ MB), and not trivial to learn, although powerful. Vim is good too, and some versions can use Python as an extension language, but again, unless you come from the unix world it may appear rather strange to you and your fingers. PFE is a bit less powerful than the two above, but is a real Windows application, easy to learn and has some quite neat features, I use it a lot. If you like Emacs, but don't want the 20MB monster and don't need Lisp, you can use Jed, which comes with a good Python mode too. I use all of the above at times. PFE is the only one without a specific Python mode, but I still use it the most, since I find it is the best integrated with Windows (I use it as a Notepad replacement). For Python programming I use mostly Win32all from the python site. - Josef From akuchlin at mems-exchange.org Wed Apr 19 14:05:57 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 19 Apr 2000 14:05:57 -0400 Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) References: <20000419154202.B480@owl.rhein-zeitung.de> Message-ID: <3d4s8yotiy.fsf@amarok.cnri.reston.va.us> "Fredrik Lundh" writes: > www.pythonware.com is down > the reason appears to be hardware problems on > the ISP site. ... First Zope.org (down because an Ethernet cable got pulled out), then Starship (disk crash), now pythonware.com. Has someone released evil whitespace-eating nanobots that also attack computer hardware? --amk From mfletch at tpresence.com Wed Apr 26 17:09:45 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Wed, 26 Apr 2000 17:09:45 -0400 Subject: [Win32] Retrieve icon for file type? Message-ID: Well, I think I'm almost there, but I can't figure out how to create a colour device context, and drawing a colour icon into the black-and-white context just gives me a failed message. Anyone know any tricks. Incidentally, the IShellFolder/IShellIcon stuff looks like the "right" way to do this, I just don't see any way to touch it from Python (apparently you need the functions "SHGetDesktopFolder" etceteras in shell32.dll to get anywhere with it. Here's what I've got so far (based on Thomas' work). Suggestions appreciated... Mike def getIcon(srcpath): import os.path, string index = None try: srcpath, index = map (string.strip, string.split (srcpath, ',')) index = int (index) except: pass print "PATH, INDEX", srcpath, index srcext = os.path.splitext (srcpath)[1] if string.lower (srcext) == '.ico': return None # CopyIcons_FromIco (dstpath, srcpath) import win32api, win32ui #, win32con ## hdst = win32api.BeginUpdateResource (dstpath, 0) hsrc = win32api.LoadLibraryEx (srcpath, 0, LOAD_LIBRARY_AS_DATAFILE) if index is None: grpname = win32api.EnumResourceNames (hsrc, RT_GROUP_ICON)[0] elif index >= 0: grpname = win32api.EnumResourceNames (hsrc, RT_GROUP_ICON)[index] else: grpname = -index data = win32api.LoadResource (hsrc, RT_GROUP_ICON, grpname) for iconname in win32api.EnumResourceNames (hsrc, RT_ICON): icon = win32ui.GetApp().LoadIcon( iconname ) bitmap = getBitmapFromIcon( icon ) win32api.FreeLibrary (hsrc) return data def getBitmapFromIcon( iconresource ): import win32ui try: dc = win32ui.GetActiveWindow().GetDC() except win32ui.error: dc = win32ui.CreateWnd().GetDC() ## dc = win32ui.CreateDC() # create in-memory dc with display params... mdc = dc.CreateCompatibleDC( None ) bitmap = win32ui.CreateBitmap() bitmap.CreateCompatibleBitmap( mdc, 32, 32 ) mdc.SelectObject( bitmap ) ## mdc.DrawIcon( (0,32), iconresource ) # fails :( # just for testing... bitmap.SaveBitmapFile( mdc, "test4.bmp" ) return bitmap if __name__ == "__main__": import sys getIcon( 'd:\\bin\\lang\\python\\python.exe' ) -----Original Message----- From: Thomas Heller [mailto:thomas.heller at ion-tof.com] Sent: Wednesday, April 26, 2000 12:22 PM To: Mike Fletcher; Python Listserv (E-mail) Subject: Re: [Win32] Retrieve icon for file type? > I'm attempting to use the Windows registry to retrieve (and convert to a > PNG/JPEG) the Windows icons for given files (so that a Windows-based server > can display file-type-specific icons). I do not seem to be able to find the > function shellapi.ExtractIcon ( > http://msdn.microsoft.com/library/psdk/winui/icons_7h2m.htm ) in the Win32 > extensions. You might want to look at MEInc/Dist/icon.py in Gordon's win32 installer package. This file uses LoadResource to extract icons from executable files. (Note however that you get the raw data, and not an HICON). Thomas -- http://www.python.org/mailman/listinfo/python-list From shapr at uab.edu Fri Apr 28 04:53:51 2000 From: shapr at uab.edu (Shae Erisson) Date: Fri, 28 Apr 2000 08:53:51 GMT Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> <200004172120.RAA11102@zippy.init.com> <20000418234932.L15664@xs4all.nl> Message-ID: <3909543E.C775CAD6@uab.edu> Thomas Wouters wrote: > Of course not all Python code can be boiled down to these two things (they > aren't really 'rules', by the way, merely descriptions of the Python view of > the world) but understanding these subtle differences can really make you > grok Python ;) Tim Peters once wrote down the Python Philosophy (or zen): Can you tell me where you found the python philosophy quote? I'd like to read more along these lines. thanks, -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt 13:00pm up 1 season, 1 squirrel, load average: 1+1j 0.5+2j 0.2+0.5j From richard_chamberlain at ntlworld.com Thu Apr 6 05:45:08 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Thu, 6 Apr 2000 10:45:08 +0100 Subject: Installer / mxDateTime problem Message-ID: <8chm9o$qbv$1@gxsn.com> Hi! I've got a simple script that uses mxDateTime that I want to run as an exe. I run it through simple.py and I get the following error: NameError: Case mismatch for module name feasts (filename C:\Program Files\Python\DateTime\Feasts.py) Sorry if this has been covered before, I'm a little slow to catch on! Thanks, Richard From mhammond at skippinet.com.au Wed Apr 12 10:00:18 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 12 Apr 2000 14:00:18 GMT Subject: Embedding Python in Visual C++ 6.0 References: <8d1he4$26d$1@nnrp1.deja.com> <8d1od2$9fl$1@nnrp1.deja.com> Message-ID: "Matthias" wrote in message news:8d1od2$9fl$1 at nnrp1.deja.com... > Sorry - but I realy tried. I have the same probleme with your > pythonwin.cpp sourcecode when I try to debug it. In > glue.DynamicApplicationInit(startup)everything looks nice, but > if I step into glue.InitInstance() I get the unhandled exception > (see below). The Address where the debugger "land's" seems right > (1E401F69) it should be the address of BOOL Win32uiInitInstance() You are probably loading win32ui.pyd instead of win32ui_d.pyd - this would explain the crash and the lack of source code. You may have win32ui.lib on the command line for your builds - if so, you should remove it and it will magically work correctly. Mark. From tim.hochberg at ieee.org Mon Apr 24 12:02:38 2000 From: tim.hochberg at ieee.org (Tim Hochberg) Date: Mon, 24 Apr 2000 16:02:38 GMT Subject: Need Help w/JPython deployment References: Message-ID: "Scott Bortman" wrote in message news:sg8pqclrcdo26 at corp.supernews.com... > I am having a bit of difficulty using jpythonc. [SNIP] > But, I get the following error: [SNIP] > AttributeError: java package 'org.python.modules' has no attribute > '__path__' > > > Is there something I missed? This is a jpythonc bug. You should download Finn Bock's errata which contains a set of patches to fix various problems in jpythonc that have surfaced since the last release. It can be found at http://sourceforge.net/project/?group_id=1842. Once you have this it should just be a matter of figuring out the correct set of options and it sounds like you were most of the way there.... -tim From oli at rz-online.net Wed Apr 12 19:03:44 2000 From: oli at rz-online.net (Oliver Andrich) Date: Thu, 13 Apr 2000 01:03:44 +0200 Subject: Python 1.6a2 crashes in test_fork1 on my Mandrake Linux 7 machine Message-ID: <20000413010344.A13931@owl.rhein-zeitung.de> Hi, I just tried to build a first alpha release of the Linux distribution of Python, and the testall.py run crashes on the test_fork1 script. Sometimes it just hangs, as soon as I switch on full optimizations during compilation I get a nice seg fault. The freezes occurs when I compile python without any but the standard optimizations on my machine. I am running glibc 2.1.2 and gcc 2.95.2. With 1.5.2 this works really fine. I will try to investigate this issue. But for this I have to check the CVS logs of the relevant files. Anybody with a useful hint should feel free to mail me. ;-)) Best regards, Oliver From moeller at networksplus.net Mon Apr 10 17:42:29 2000 From: moeller at networksplus.net (Derek Moeller) Date: Mon, 10 Apr 2000 16:42:29 -0500 Subject: Teaching the art of programming, in python In-Reply-To: ; from landauer@apple.com on Fri, Apr 07, 2000 at 12:10:03PM -0700 References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> <38EB73B6.6C0913A7@callware.com> <8chsij$k5r$1@newsserver.rrzn.uni-hannover.de> <38EDDACC.8641FF8C@callware.com> Message-ID: <20000410163700.B20635@networksplus.net> On Fri, Apr 07, 2000 at 12:10:03PM -0700, Doug Landauer wrote: > > "Teach your self Internet in 10 minutes". Seems there is > > inflation (or perhaps deflation) in these things. > > I think I'll wait for the Cliff's Notes to come out ... that > might get it down to 2 minutes. Remember Number 7's reading performance with dictionaries in "Shortcircuit"? That's my excuse for the title of my next vaporbook. -- Derek Moeller Learn Python 20 times faster than those silly SAMS books promise! From greg at cosc.canterbury.ac.nz Wed Apr 5 00:28:50 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Wed, 05 Apr 2000 16:28:50 +1200 Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> Message-ID: <38EAC102.7D5DF504@cosc.canterbury.ac.nz> Bob Alexander wrote: > > BTW, both tuples and lists are ordered collections of non-homogeneous values > (i.e. the elements can be if different types). In Haskell, a statically-typed language which also has both tuples and lists, the two types play distinctly different roles, and both are needed. A tuple is a fixed-size structure whose elements may be of different types, whereas a list is a variable-size structure whose elements must be of the *same* type. This is the way I tend to use them in Python as well -- lists for homogeneous collections, tuples for "records". If static typing is introduced into Python, a more rigid distinction may have to be made, in which case we may be glad that we already have the two kinds of structure. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From aa8vb at yahoo.com Mon Apr 17 12:13:50 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Mon, 17 Apr 2000 12:13:50 -0400 Subject: Numeric-13 build failure on Python 1.6a2 Message-ID: <20000417121350.A316132@vislab.epa.gov> I'm getting a build failure with Numeric-13 with Python 1.6a2. There seem to be two problems at work here: --------------------------------------------------------------------------- 1) The first problem is the linker tries to link for the wrong architecture. When makesetup writes $(LDSHARED) command-lines, it doesn't include $(LDFLAGS) on that command-line. In Python's config/Makefile, LDFLAGS=-n32 here on IRIX. It's this line in makesetup that writes these link lines: rule="$rule; \$(LDSHARED) $objs $libs -o $file" If I add \$(LDFLAGS) to it, we're past that hurdle. --------------------------------------------------------------------------- 2) The second problem is that in Python's config/Makefile, it has: LDSHARED= ld But it should be: LDSHARED= ld -shared As a result, when Numeric goes to link a shared object, it inadvertantly tries to link it as an executable, which of course fails. Changing this declaration as described above fixes problem #2. --------------------------------------------------------------------------- Before I add this to the bug database, could someone confirm that these are the right fixes for this problem? Thanks, Randall ============================================================================== ERROR #1: ... cc -n32 -I./Include -O -KPIC -OPT:Olimit=0 -I/home/rhh/bin/../software/python-1.6/include/python1.6 -I/home/rhh/bin/../software/python-1.6/PLATFORM/plat-irix646-n32/include/python1.6 -DHAVE_CONFIG_H -c ./Src/ufuncobject.c ld _numpymodule.o arrayobject.o ufuncobject.o -o _numpymodule.so ld: FATAL 12 : Expecting o32 objects: _numpymodule.o is n32. *** Error code 4 (bu21) ============================================================================== ERROR #2: ... ld -n32 _numpymodule.o arrayobject.o ufuncobject.o -o _numpymodule.so ld32: ERROR 33 : Unresolved text symbol "Py_InitModule4" -- 1st referenced by _numpymodule.o. ld32: ERROR 33 : Unresolved text symbol "PyModule_GetDict" -- 1st referenced by _numpymodule.o. ld32: ERROR 33 : Unresolved text symbol "PyCObject_FromVoidPtr" -- 1st referenced by _numpymodule.o. ... ============================================================================== From phd at phd.russ.ru Mon Apr 24 12:15:19 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 24 Apr 2000 16:15:19 +0000 (GMT) Subject: Trouble compiling PyGreSQL 2.4 on Linux In-Reply-To: Message-ID: On Mon, 24 Apr 2000, Martin Sk?tt wrote: > Seems like a great time for me to learn how to write a make file. I > will post it to him one of the following days. You couldn't write a plain makefile - there are many different systems, and installations, etc. Better, learn to write Distutil, and write one for PyGreSQL - that's a Real Challenge! Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From hanche at math.ntnu.no Thu Apr 6 01:19:19 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 06 Apr 2000 01:19:19 -0400 Subject: Why should I switch to Python? - Infinity of Primes References: <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> <38EA369C.26A1C25@math.okstate.edu> <38EAC8C4.ADC25640@cosc.canterbury.ac.nz> <8cfq9f$2q5e$1@pc-news.cogsci.ed.ac.uk> Message-ID: + richard at cogsci.ed.ac.uk (Richard Tobin): | In article <38EAC8C4.ADC25640 at cosc.canterbury.ac.nz>, | Greg Ewing wrote: | | >Um, no it doesn't - it constructs a number which is | >*either* prime *or* divisible by some other prime bigger | >than the one you started with. | | It trivially gives you a procedure for finding a larger prime: you | just find the factors of the constructed number (eg by trying all | possible divisors), and if there are any then one will be a new prime, | otherwise the constructed number is a new prime. This thread is already much too long, but I can't resist pointing out that the good old Erathostenes' sieve together with the ideas introduced earlier in the thread provides a splendid constructive proof: Essentially, if the sieve has produced primes 2, 3, ..., p then let q be one plus the product of 2, 3, ..., p. Then the sieve will produce a new prime no later than q. Since this is a posted to a computer language group, after all, I include my own simple implementation of the Sieve in Haskell: primes :: [Integer] primes = 2 : ([3..] `except` composites) composites :: [Integer] composites = flatten (map (\ p -> [p*p, p*(p+1)..]) primes) union :: [Integer] -> [Integer] -> [Integer] xl@(x:xs) `union` yl@(y:ys) | xy = y : xl `union` ys | otherwise = x : xs `union` ys except :: [Integer] -> [Integer] -> [Integer] xl@(x:xs) `except` yl@(y:ys) | x [Integer] flatten ((x:xs):zz) = x : xs `union` (flatten zz) I wonder if someone can come up with an equally immediate solution (i.e., a straight translation from the mathematical formulation) in python? Indeed, I would be tempted to say that Haskell is better suited for learning (some kinds of) mathematics than python. but-I-wouldn't-dare-say-so-in-comp.lang.python-ly y'rs, -- * Harald Hanche-Olsen - "There arises from a bad and unapt formation of words a wonderful obstruction to the mind." - Francis Bacon From bjorn at roguewave.com Tue Apr 4 17:56:24 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Tue, 04 Apr 2000 15:56:24 -0600 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> Message-ID: <38EA6508.90BF630C@roguewave.com> Ivan Van Laningham wrote: > > Hi All-- > I'm finally getting a chance to use Python at work. I have two > questions: Congratulations :-) > 1) Is there a way to run silent (i.e., we determine where things go and > the customer never sees any wizards) installs of Python, Tcl/Tk and > Win32all? If you want to package up your program into an exe and execute it, Installer from Gordon's starship pages can do this (http://starship.python.net/crew/gmcm/distribute.html). It's actually _much_ easier than it looks ;-) > 2) What stuff do I need to use msaccess with Python? Do I need to use > Win32all, or can I use Tkinter for my (minimal) GUI, with msaccess? You'll probably want to check out one of the odbc packages. (I haven't used any of them myself, but mxODBC seems to be highly recomended...) -- bjorn From m.faassen at vet.uu.nl Fri Apr 21 09:11:14 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 21 Apr 2000 13:11:14 GMT Subject: Pickling Robustly References: Message-ID: <8dpk1i$7de$1@newshost.accu.uu.nl> Glyph Lefkowitz wrote: [snip pickle is cool] > Except... > It appears that Pickle is not terribly robusta [snip] > Due to the extremely self-referential nature of the data structures > I'm using, it is much easier to keep everything in one pickle (and > that effectively happens anyway, even if I don't try to, thanks to the > dependency resolution that pickle does). The problem is that pickle > (as far as I can tell, anyway) does not allow one to register error > handlers to keep track of when a problem occurrs. If an unpicklable > datatype is attempted to pickle, EVERYTHING previously pickled will > suddenly vanish and no indication will be given about where the > offending data was. > If you've got a large data structure like I > anticipate, this means writing and loading code on-the-fly to attempt > a traversal of that structure to determine where the unpicklable type > is. The Digicool people must've run into similar problems with their Zope Object Database, which is based on Pickle. Perhaps looking at the ZODB wouldn't be a bad idea, if you haven't already, therefore: http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html http://www.zope.org/Members/michel/HowTos/ZODB-How-To http://www.zope.org/Documentation/Developer/Models/ZODB Though I'm not sure if they indeed have solved your problem, as far as I understand it. Regards, Martijn From lvw at lfpt.rwth-aachen.de Wed Apr 19 08:01:01 2000 From: lvw at lfpt.rwth-aachen.de (Lars von Wedel) Date: Wed, 19 Apr 2000 14:01:01 +0200 (MET DST) Subject: Using CGI module with 'canned queries' In-Reply-To: <38FD8C36.4242425F@infercor.no> References: <200004190828.KAA03403@gromit.rwth-aachen.de> <38FD8C36.4242425F@infercor.no> Message-ID: <200004191201.OAA04426@gromit.rwth-aachen.de> Paul, The %'s were obviously wrong, but they got mixed up when I transferred the string from '%s:%s...' % (a,b,c) into the e-mail where I wrote some bogus stuff. Indeed I overlookes the .value attribute of the keys. Thanks, Lars Paul Boddie writes: > Lars von Wedel wrote: > > > > Hello, > > > > I want to use Python to implement some CGI scripts. I want these > > scripts to be callable from any link (not only via a form), > > e.g. the user shall be able to enter something like > > > > http://.../test.py?name=Bill > > > > into Netscape directly. > > The parameter(s) should still be received correctly in the CGI script. > > > I expected that such a URL could be processed using > > > > form = cgi.FieldStorage() print '
foo bar
12
34
Incredibly, this will display correctly (or rather incorrectly as is shouldn't display at all) in most browsers. What I need to do to fix this is run a quick pre-processor and using the re module replace all occurences of junk with junk where junk does not contain the tag Can anyone tell me what the re for this is? I can't seem to get anything to work. right now. Regards, Raoul-Sam From P.J.W.S.VRIJLANDT at INT.azg.nl Tue Apr 18 12:32:04 2000 From: P.J.W.S.VRIJLANDT at INT.azg.nl (P.J.W.S. Vrijlandt) Date: Tue, 18 Apr 2000 17:32:04 +0100 Subject: telnetlib and NT vs. AIX In-Reply-To: <8dhnr5$glm$1@nnrp1.deja.com> Message-ID: <1D0BE221345@nds-3.azg.nl> On 18 Apr 00 at 13:27, dbeagle at my-deja.com wrote: > I am trying to figure out what the difference is > between telnet to Windows NT and AIX. As you can > see below the calls made to each telnet server > are the same but for some reason (unknown to me) > after I enter username in the NT telnet session > it never returns asking for the password. > Testing on the AIX system worked as expected. The > printout from both sessions is shown below. > > Thank you for your help > db > [WinNT] > Telnet(WinNT4SVR_1,23): IAC DO 253 > Telnet(WinNT4SVR_1,23): IAC WILL 251 I suppose the problem is here. telnetlib does not attempt to do any protocol negotiation. In this point, telnetlib does not adhere to the relevant rfc's, because some requests must be anwered. I have not found time to implement an adequate option negotiation yet. That's partly because I don't need it: Answering any DO with WONT and WILL with DONT was sufficient for my problem. Note that standard telnet does not ECHO and requires GO-AHEAD. You might want to enable these options on the server side. Any chr(0) in the input stream gets lost in telnetlib and this is not correct if you recieve binary files. I will mail you my solution (not ready for publication) seperately when I'm at home. Patrick Vrijlandt From gslee111 at daisy.kwangwoon.ac.kr Sun Apr 2 20:57:00 2000 From: gslee111 at daisy.kwangwoon.ac.kr (Gang Seong Lee) Date: Mon, 3 Apr 2000 09:57:00 +0900 Subject: getting a key without an echo and Enter Message-ID: Hi, How can I get a key input without having it echoed. The following statement echoes and waits until I press Enter key. ch = sys.stdin.read(1) Can I get the key as soon as I press it without an echo. (No Enter key) Thanks in advance Gang From ljz at asfast.com Tue Apr 4 18:35:44 2000 From: ljz at asfast.com (Lloyd Zusman) Date: 04 Apr 2000 18:35:44 -0400 Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <8cdbvg$3vi$1@news.udel.edu> <38ea3fda.47259642@news.nikoma.de> Message-ID: nospam.newton at gmx.li (Philip 'Yes, that's my address' Newton) writes: > On Tue, 4 Apr 2000 14:30:06 -0400, "Terry Reedy" > wrote: > > >> Python strings can now be stored as Unicode strings. To make it easier > >> to type Unicode strings, the single-quote character defaults to creating > >> a Unicode string, while the double-quote character defaults to ASCII > >> strings. > > > >' = 1 byte/char, " = 2 bytes/ char is more straightforward. > > Yes, but this depends on what you mean by "Unicode". You have to > represent those Unicode characters in bytes, somehow, and how many bytes > you need depends on the format. Also, full Unicode is 32-bit (not just > the 16 bits of the Basic Multilingual Plane). UTF-16 is two bytes (but > can be four for surrogates), UTF-8 is a *variable* number of bytes (1 to > 6, I believe), etc. It's not always 2 bytes per Unicode character. Well, then, a good solution would be to preceed each character by the right combination of single and double quotes to signal how many bytes it takes up, as summarized in this handy table: # of bytes Preceding character sequence(s) 1 ' 2 '' " 3 '" "' 4 '''' "'' '"' ''" 5 ''''' "''' '"'' ''"' '''" ""' "'" '"" 6 '''''' "'''' '"''' ''"'' '''"' ''''" ""'' "'"' "''" '"'" ''"" '""' """ This could result in fairly long string representations, but that problem could be solved by using my new algorithm to compess all of these UTF-whatever representations as one bit (see my earlier post for details). Then, using . (dot) and - (dash) for a zero-bit and a one-bit, respectively, all UTF-whatever strings could then be easily represented as either . or - in our Python programs. For example: # old program print ""''H"'e'"'''l'l""'o'' ''""w"""o'"r'''''l'"'d"! # new program print - -- Lloyd Zusman ljz at asfast.com From meh9 at cornell.edu Fri Apr 7 16:12:24 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Fri, 07 Apr 2000 16:12:24 -0400 Subject: More about variables References: <3X3H4.16435$0o4.108310@iad-read.news.verio.net> Message-ID: Thanks for the advice. It makes a lot of sense. Matt In article , Matthew Hirsch wrote: > Why create named variables? > > I always thought that having 20 lists saved more space than having one > list of 20 lists. Maybe I'm wrong. > > Thanks for your help, > Matt > > > > > > > In article <3X3H4.16435$0o4.108310 at iad-read.news.verio.net>, > culliton at clark.net (Tom Culliton) wrote: > > > What (or maybe what do you think) you are trying to do? Most likely > > you would be better off with just a list or tuple if you're dealing > > with and unknown number of data items. Not everything needs a name, > > and there isn't much difference between: > > > > v0, v1, v2, v3, v4, v5 > > > > and > > > > v[0], v[1], v[2], v[3], v[4], v[5] > > > > Why do you think this variable length collection of data needs > > individual names? > > > > Now, if after consideration there is still some compelling reason to > > generate names, you can use something like this with a dictionary > > (possibly the one returned by globals()): > > > > v = {} > > for i in range(number_of_variables): > > name = "variable%d" % i > > v[name] = [] > > > > But again, Why? > > > > In article , > > Matthew Hirsch wrote: > > >Hi All, > > > > > >Let's say I had something like: > > > > > >number_of_variables=int(raw_input('Enter number of variables: ')) > > > > > >if number_of_variables==1: > > > variable1=[] > > >elif number_of_variables==2: > > > variable1=[] > > > variable2=[] > > >elif number_of_variables==3: > > > variable1=[] > > > variable2=[] > > > variable3=[] > > >elif number_of_variables==4: > > > variable1=[] > > > variable2=[] > > > variable3=[] > > > variable4=[] > > >elif number_of_variables==5: > > > variable1=[] > > > variable2=[] > > > variable3=[] > > > variable4=[] > > > variable5=[] > > >else: > > > print 'else' > > > > > >Is there a more efficient way of doing this? What if I wanted to > > >create > > >100 variables (lists). It doesn't make sense to write an if statement > > >for that many conditions. > > > > > >Thanks for your help, > > >Matt From effbot at telia.com Sat Apr 8 04:52:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 08 Apr 2000 08:52:33 GMT Subject: Regular Expression Help for Python Newbie. References: <38EE3799.DA0A9638@ez-ways.com> Message-ID: Raoul-Sam Daruwala wrote: > I have a problem. I wrote a python program to parse HTML files using the > HTMLParser and all that I need to do with the files can be done very > easily using this wonderful class. Kudos to the authors! > > My problem is that one of the sets of files that I'm trying to parse has > badly formatted tables. Now when I do a view source on the files I can > see the problem clearly. It's quite simple, the tables in these files > starts out properly formatted but after a standard header the script > than generates them leaves out the tag. This is incredible to me > because both Netscape and IE read can view the tables properly. 's are optional -- if the browser stumbles upon in a context, it should insert 's all by itself. > What I need to do to fix this is run a quick pre-processor and using the > re module replace all occurences of > > junk with > junk > where junk does not contain the tag > > Can anyone tell me what the re for this is? I can't seem to get anything > to work. right now. if you cannot get it to work, how come you're so sure you need to use the re module? ;-) try using the sgmllib parser instead; here's an example from the eff-bot guide (see below). it shouldn't be that hard to tweak the filter class to insert TR tags if it sees a TD following directly after a TABLE. # sgmllib-example-4.py import sgmllib import cgi, string, sys class SGMLFilter(sgmllib.SGMLParser): # sgml filter. override start/end to manipulate # document elements def __init__(self, outfile=None, infile=None): sgmllib.SGMLParser.__init__(self) if not outfile: outfile = sys.stdout self.write = outfile.write if infile: self.load(infile) def load(self, file): while 1: s = file.read(8192) if not s: break self.feed(s) self.close() def handle_entityref(self, name): self.write("&%s;" % name) def handle_data(self, data): self.write(cgi.escape(data)) def unknown_starttag(self, tag, attrs): tag, attrs = self.start(tag, attrs) if tag: if not attrs: self.write("<%s>" % tag) else: self.write("<%s" % tag) for k, v in attrs: self.write(" %s=%s" % (k, repr(v))) self.write(">") def unknown_endtag(self, tag): tag = self.end(tag) if tag: self.write("" % tag) def start(self, tag, attrs): return tag, attrs # override def end(self, tag): return tag # override class Filter(SGMLFilter): def fixtag(self, tag): if tag == "em": tag = "i" if tag == "string": tag = "b" return string.upper(tag) def start(self, tag, attrs): return self.fixtag(tag), attrs def end(self, tag): return self.fixtag(tag) c = Filter() c.load(open("samples/sample.htm")) From bkhunter at best.com Wed Apr 26 20:15:18 2000 From: bkhunter at best.com (Bill Hunter) Date: Wed, 26 Apr 2000 17:15:18 -0700 Subject: BAD starship.python.net news! References: <38FC852A.9B11F458@concentric.net> <38FCBD77.A5925D65@darwin.in-berlin.de> <38FD8FC1.EC5DDCD7@tismer.com> Message-ID: <6oQHOYGsk3CUxVh00LNjwelELGrD@4ax.com> Many ISP's, at least if they are over some threshold of professionalism, run backup tapes on a schedule and save archival copies at intervals. While they might be unsympathetic to putting in a lot of work to recover something for an individual, they might be persuaded that this is important to an entire global community - which it is. My two cents worth. (It is far from being a sure thing that a disk recovery will work, by the way, no matter how much you pay the specialist recovery firm.) On Wed, 19 Apr 2000 12:51:45 +0200, Christian Tismer wrote: >Ironically, yes it could have been used. My last copy wasn't older >than a month. But I forgot about that when I gave up >starship.skyport, and I asked my ISP about it: >They wiped the machine last Friday. From dalke at acm.org Sat Apr 8 14:24:36 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 8 Apr 2000 12:24:36 -0600 Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> Message-ID: <8cntqp$upi$1@slb0.atl.mindspring.net> Nick Maclaren wrote > x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0) > [...] >What paradigms are there for replacing such constructions by? How about x = getattr(a, "weeble", 0) + getattr(b, "wombat", 0) ? Andrew dalke at acm.org From youngd at digiship.com Thu Apr 27 15:54:00 2000 From: youngd at digiship.com (Darren Young) Date: Thu, 27 Apr 2000 14:54:00 -0500 Subject: DCOracle Message-ID: Question for all, I have a module with the following text: import SICKvars import sys sys.path.append('/usr/lib/python1.5/DCOracle') from DCOracle import Connect # Check for the database # def checkdb(dbuser, dbpass): try: connectString = dbuser + '/' + dbpass + '@' + SICKvars.dbinfo["server"] dbc = Connect(connectString) con = dbc.cursor() dbc.execute("SELECT table_name FROM user_tables where table_name = 'SICKAUTH'") check = dbc.fetchall() dbc.close() return len(check) except: print "Caught exception: ", sys.exc_type, sys.exc_value I have another script tha#!/usr/bin/env python # import os import sys import glob import time import string import shutil import oradbinstall dbuser = "" dbpass = "" # # If the password is blank, we'll assume that there isn't one..(untested) # NOTE: Oracle might not allow that # while not dbuser: dbuser=raw_input("What is your database admin username? [root]: ") if not dbuser: dbuser = "root" os.system("stty -echo") dbpass = raw_input("What is the admin's password?: ") os.system("stty echo") redo="" try: isinstalled = oradbinstall.checkdb(dbuser, dbpass) except: isinstalled = 0 if isinstalled: print "\n\nIt appears that the database is already there..." redo=raw_input("Would you like me to remove and re-install it? (y/n) ") else: print "\n\nIt's not installed."t looks like this: When I run it I get this: [root at linsrv01 SICKnotes-0.6c]# ./orainstall What is your database admin username? [root]: cm What is the admin's password?: It's not installed. Segmentation fault (core dumped) [root at linsrv01 SICKnotes-0.6c]# No matter what I try, it cores out on me... --------------------- Darren Young Digiship 312-527-9440 --------------------- From osuchw at ecn.ab.ca Mon Apr 24 09:16:11 2000 From: osuchw at ecn.ab.ca (WaldekO) Date: Mon, 24 Apr 2000 07:16:11 -0600 Subject: Using DAO and Python References: Message-ID: <8e1hit$171$1@iceman.tac.net> dsavitsk wrote in message news:bMHM4.23114$fF5.684678 at news1.rdc1.il.home.com... > here is what i have tried (esentially following the example on pg 252 of > python programming on win32) > 1. ran makepy and selected microsoft dao 3.6 from the list > 2. in PythonWin typed > >>> import win32com.client > >>> daoengine = win32com.client.Dispatch('DAO.DBEngine') You did not provide full name of DBEngine. Try: daoengine = win32com.client.Dispatch('DAO.DBEngine.36') For a sample of using MSAccess refer to: http://starship.python.net/crew/bwilk/access.html From gmcm at hypernet.com Tue Apr 11 10:29:11 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 11 Apr 2000 10:29:11 -0400 Subject: Getting an overview if all available driveletters on NT In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA7294@MSGEURO1> Message-ID: <1256659135-41087041@hypernet.com> Pieter Claerhout wrote: > is there a module in Python, which can list all available driveletters, together with > their label. I'm using Windows NT? I already thought of iterating over all possible > driveletters, and see if the path exists or not, but I also want to separate the > network volumes from the other volumes. Any ideas? In Mark's Win32 extensions the module win32api has GetLogicalDriveStrings() and GetVolumeInformation(...). - Gordon From doughellmann at home.com Sun Apr 30 08:23:07 2000 From: doughellmann at home.com (Doug Hellmann) Date: Sun, 30 Apr 2000 12:23:07 GMT Subject: python + linux + cron = problem References: <39081703.48B64D1A@spekter.no> <3908265E.A3C21409@home.com> <3908350F.922D7B4E@spekter.no> Message-ID: <390C26A3.EB8263DD@home.com> What OS are you on? I'm not getting any output from that df command (even if I remove the "grep eggum") under Linux. After registering the python script directly as a cron job, I had no problem getting it to run. The commands module actually runs a different command than what you send in: pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r') Have you tried running that shell command yourself from the command line to see if you get a better error message? Doug J?rn Eilertsen wrote: > > here's the whole script, well the part that gives me grief at least > : > #!/usr/bin/python > import commands > > koblinger = commands.getoutput('df | grep eggum | cut -d 1 -f 1 | cut -d / -f > 4') > > I've tried to put the shell command into a shell script and run > commands.getoutput on the script but with the same result. Here's the cron > entry: > 0 1 * * * /usr/local/bin/sjekkmounts > and I've tried sh /usr/local/bin/sjekkmounts > > Jorn > > Doug Hellmann wrote: > > > J?rn Eilertsen wrote: > > > > > > Hi, > > > > > > I've posted this earlier but noone replied so I'm trying again > > > > > > I have this small program which includes the following line og code: > > > mounts = commands.getoutput('df | grep eggum | cut -d 1 -f 1 | cut -d / > > > -f 4') > > > > > > this runs fine from the commandline but when run as a cronjob I get the > > > following error: > > > > > > File "/usr/lib/python1.5/commands.py", line 42, in getoutput > > > return getstatusoutput(cmd)[1] > > > File "/usr/lib/python1.5/commands.py", line 53, in getstatusoutput > > > sts = pipe.close() > > > IOError: (10, 'No child processes') > > > > > > The use of pipes seems to be the trouble here. > > > > > > Any help on how the get around this would be greatly appreciated. > > > > > > > > > > If the problem is really having pipes in the command, why not put your > > shell commands in a shell script, then run commands.getoutput() on that? > > > > If the program runs from the command line but not cron, the problem is > > more likely to be related to PATH problems within the cron environment. > > How do you set up the cron job? > > > > Doug From cut_me_out at hotmail.com Thu Apr 13 10:53:13 2000 From: cut_me_out at hotmail.com (Alex) Date: 13 Apr 2000 10:53:13 -0400 Subject: List mapping? References: Message-ID: from operator import getitem def pair (l): assert len (l) % 2 == 0 evens = range (0, len (l), 2) evens = map (getitem, len (evens) * [l], evens) odds = range (1, len (l), 2) odds = map (getitem, len (odds) * [l], odds) return map (None, evens, odds) if __name__ == '__main__': print pair (range (10)) Alex. From icurhere2 at nowhere.here Tue Apr 11 15:34:33 2000 From: icurhere2 at nowhere.here (icurhere2) Date: Tue, 11 Apr 2000 19:34:33 GMT Subject: Python and Zope help needed for test project Message-ID: Hello, My name is Mike Becraft, and I am one of the Test Development Managers at http://www.brainbench.com , an online, independent certification company. I am looking into the possibility of having a test on Python and Zope knowledge developed for use on our web site, and I was wondering if there was anyone interested in assisting. If this is a possibility, I would be more than happy to speak with anyone with relevant programming experience. I also encourage you to visit our site (free for individuals) to check out some of the tests and certifications we currently offer. Thanks greatly, Michael Becraft Michael Bryan Becraft Assessment Development Manager - Brainbench http://www.brainbench.com mailto:michael.becraft@(please-remove-this-area)brainbench.com -- Free audio & video emails, greeting cards and forums Talkway - http://www.talkway.com - Talk more ways (sm) From effbot at telia.com Sat Apr 8 04:43:54 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 08 Apr 2000 08:43:54 GMT Subject: Tkinter install? References: <081c4ffb.329993cd@usw-ex0102-014.remarq.com> Message-ID: John Schmitt wrote: > ------------------- > TclError: Can't find a usable init.tcl in the following > directories: > {} ./lib/tcl8.0 D:/pyprojects/grayson/tcl8.0/library > D:/pyprojects/grayson/Examples/library > > This probably means that Tcl wasn't installed properly. > ------------------- this might help: http://www.pythonware.com/people/fredrik/fyi/fyi02.htm From banderson at boi.hp.com Fri Apr 14 16:48:06 2000 From: banderson at boi.hp.com (Bill Anderson) Date: Fri, 14 Apr 2000 14:48:06 -0600 Subject: ANN: Python training in Boulder References: <000101bfa571$e31a43a0$71d95da6@lutz> Message-ID: <38F78406.2032D7AB@boi.hp.com> Mark Lutz wrote: > > This is to announce that the second Python training session > to be held at Tom Christiansen's site in Boulder, Colorado, > will be held May 24-26. > > These classes are equivalent to the on-site Python training I > offer, and are open to individuals on a first-come first-served > basis. I am the instructor, but all registration details are > handled by Tom's company. For more information, please visit > these pages: > > http://home.rmi.net/~lutz/boulder-classes.html (my page) > http://training.perl.com/open-courses.html (tom's page) ^^^^^^^^^ Maybe it's me, but something seems fundamentally wrong here. ;^) -- Bill Anderson Linux/Unix Administrator, Security Analyst ESBU (ARC) bill_anderson at boi.hp.com My opinions are just that; _my_ opinions. From embed at geocities.com Mon Apr 3 16:29:34 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 3 Apr 2000 15:29:34 -0500 Subject: Creating variables on the fly... References: Message-ID: You're using the Wrong Tool for the Job. You want a Dictionary, or an Array. If you really like naming these objects a,b, and c, use a dictionary: V = {} # create a dictionary just for this bunch of variables def AddVars( a, count, initial_value): global V c=ord(a[0]) for n in range(c,c+count): V[chr(n)] = initial_value def Sum(dict): n = 0 for i in dict.keys(): n = n + dict[i] return n def Dump(dict): k = dict.keys() k.sort() for i in k: print i, "= ",dict[i] AddVars("a",25,0) V["a"] = 5 V["b"] = 10 print Sum(V) Dump(V) From someone at somewhere.com Tue Apr 18 03:23:04 2000 From: someone at somewhere.com (Charley Horse) Date: Tue, 18 Apr 2000 07:23:04 GMT Subject: Using python on the web Message-ID: I've just started fooling with python. I've looked around the python site and a number of the other sites referenced there and am a bit puzzled. Umm... how does one go about using python for web applications, especially database driven apps? Almost everything deals with python just as a language, as C++ would be. Not much about the web specifically. I was a bit shocked to find the only direct refs on about this at python.org are entwined with CGI (unless I missed it). I have no exposure to CGI, but rather to php, CF, and ASP, so python has gone from looking very attractive to looking... well, like a puzzle. I know about Zope, but am interested in how one uses python on the web just by itself. Thanks From tom_hines at my-deja.com Fri Apr 28 16:59:10 2000 From: tom_hines at my-deja.com (Tom Hines) Date: Fri, 28 Apr 2000 20:59:10 GMT Subject: win32com: _NewEnum being cached References: <8ecta7$nn5$1@nnrp1.deja.com> Message-ID: <8ecu2l$ol1$1@nnrp1.deja.com> BTW, I'm using Python 1.5.2 and win32com build 125. In article <8ecta7$nn5$1 at nnrp1.deja.com>, Tom Hines wrote: > Hello. As you know, to implement "for x in my_list" functionality in > COM, you must code a get__NewEnum() function, which I have done and it > works fine under Visual Basic. But when called from Python, the call > seems to get cached, as subsequent Python "for" blocks don't result in > calls to get__NewEnum(). > > I have a COM class that implements a dynamic collection, so I > need "for" blocks to result in calls to get__NewEnum() every time. > Does anybody know how to force this? > > Thanks. > > -- > Tom Hines > Rockville, MD > > Sent via Deja.com http://www.deja.com/ > Before you buy. > Sent via Deja.com http://www.deja.com/ Before you buy. From sabren at manifestation.com Sun Apr 23 06:32:53 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 23 Apr 2000 06:32:53 -0400 (EDT) Subject: python-only crypt()? Message-ID: Hey all, Is there a python-only implementation of the crypt() module? I'm looking for users who don't have access to rebuild python with crypt enabled... I could only find C modules... I'm taking a crack at porting Crypt::UnixCrypt from perl, but I can't really tell what the code is doing once it gets down into the DES algorithm, so it's a little tedious. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From gresham at mediavisual.com Wed Apr 12 04:03:41 2000 From: gresham at mediavisual.com (Paul Gresham) Date: Wed, 12 Apr 2000 16:03:41 +0800 Subject: Classes, Inheritance - Stupid lazy question Message-ID: <8d1cfh$hme7@imsp212.netvigator.com> Hi, This is stupid and lazy of me, I have looked through the docs, but I think my brain is fried today, I just couldn't see it ... when I have a sub-class with an overridden function/method how do I call the same function/method in the parent ? i.e. class lazy(): __init__(self, name): self.name = name fired(self): print 'You are fired %s' % self.name class paul(lazy): __init__(self, name): self.name = name # <---- ????? self.april_pay = 0 fired(self): print 'Here's a box, collect the things from your desk' lazy.fired(self) # <--- ?????? The thing I'm just not clear about is the __init__ in my subclass, I want to do an additional initialisation, without having to the whole init from the parent class. I think what I am doing is kindof close ... but just want to know the real way to do this !! Sorry I've just really lost the plot today! Thanks guys Paul From robin at jessikat.demon.co.uk Thu Apr 27 14:33:08 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 27 Apr 2000 19:33:08 +0100 Subject: module case bug in 1.6a2 Win9x References: <390873A2.BD0EF60F@endea.demon.nl> Message-ID: In article <390873A2.BD0EF60F at endea.demon.nl>, Niels Diepeveen writes > > >Robin Becker schreef: >> >> I believe there's a module case bug with long named modules under win98 >> at least. I believe the bug relates to the length of the filename >> somehow. >> > >Yes, that looks like a bug in import.c:allcaps8x3(). It seems to return >true instead of false for long filenames. As far as I can tell, this >probably happens on all Win32 platforms at least since 1.5.2. > It seems a bit odd that allcaps83 returns 1 if the first chunk is longer than 8 or the extension is longer than 3 or there are more than one '.' in the name doesn't it. I guess all of these return 1's should be return 0's except the last. -- Robin Becker From moshez at math.huji.ac.il Tue Apr 25 13:47:55 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 25 Apr 2000 20:47:55 +0300 (IDT) Subject: Question about exception-handling mechanism In-Reply-To: <8e46mt$4nh$1@nnrp1.deja.com> Message-ID: On Tue, 25 Apr 2000 willfg at my-deja.com wrote: > Hello all, > > I'm new to Python, but find its exception handling mechanism much > more powerful than comparable languages; but a question was put to me > that being new I can't come up with a very articulate answer. A > colleague asked why in an exception handling mechanism you'd want the > ELSE block to be executed if you don't throw an exception as opposed to > a FINALLY block. Anyone used this feature in practice? Thanks in > advance for your input, -- Will Lots of time. Consider some sort of def f(file): try: fp = open(file) except IOError: return 0 # it doesn't exist else: return fp.read(2)=='PK' To check if a certain file is both readable and is a zip-file. You don't want the except to cover the "read" -- an error in read is unexpected. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From dalcolmo at mediaone.net Sat Apr 22 13:31:49 2000 From: dalcolmo at mediaone.net (Josef Dalcolmo) Date: Sat, 22 Apr 2000 17:31:49 GMT Subject: Python for drivers? References: <3900EDBE.282BC85@dsuper.net> Message-ID: <9mlM4.11346$QX1.481771@typhoon.ne.mediaone.net> Dave wrote in message news:3900EDBE.282BC85 at dsuper.net... > Can Python be used for writing device drivers? I just got BeOS 5 and it > doesn't support some video cards. I'd like to write one for the Cirrus > Logic card and I want a language that's clear and concise- Python. I've > never written device drivers. Any suggestions? > Just my five cents here: for writing a device driver you want a language that can compile to native code, in order to gain best machine access and best speed. C or Assembly are suitable, but so are some versions of Pascal, Oberon and Forth (amongst others). Note however that writing device drivers is something VERY close to the hardware, and unless a language has built-in support for it, forget it and use C, which can be used for about anything, even though it is not an elegant language for high level programming. - Josef From phd at phd.russ.ru Mon Apr 10 04:51:58 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 10 Apr 2000 08:51:58 +0000 (GMT) Subject: win32all: set process title In-Reply-To: Message-ID: Hello! I am working an a module to set process name (title) in the output of "ps" command. It is UNIX-only module, of course. I want to provide some portability, if at all possible, but do not know anything about modern Windows and Python for Win (I departed from DOS/Windows 3.1 world many yeras ago :) Can you help me? Could you please send me a snippet of code and a list of platforms - how I can set process name (some comments on how user can look at process name will be good accessories :) Something like this (I rememeber seeing such code in c.l.py some time ago): import sys if sys.platform == "posix": # Oops, wrong test, DJGPP-compiled DOS port is "posix", too :/ from setproctitle import setproctitle elif sys.platform in ("nt", "md95"): from win32all import CurProc, SetProcessName def setproctitle(title): SetProcessName(CurProc(), title) else: raise NotImplementedError("Your platform is not supported") Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2.1/ phd2 at earthling.net Programmers don't die, they just GOSUB without RETURN. From jvickroy at sec.noaa.gov Thu Apr 20 15:28:22 2000 From: jvickroy at sec.noaa.gov (j vickroy) Date: Thu, 20 Apr 2000 13:28:22 -0600 Subject: can't find SWIG for Python Message-ID: <38FF5A56.F76794D8@sec.noaa.gov> Hello all, I have been unable to locate SWIG for Python. My references list www.swig.org but the server can not be found. Could someone point me to the site or provide some other Win 32 options for easing the process of extending Python to use existing C libraries. Thanks for your time. From morse at harborcom.net Fri Apr 7 09:44:43 2000 From: morse at harborcom.net (Kevin Dahlhausen) Date: Fri, 07 Apr 2000 13:44:43 GMT Subject: PPython Message-ID: <38ede548.353776233@news.oh.verio.com> So many web hosting sites only allow Perl scripting, I got to thinking. That's often a dangerous thing. Would it be possible to implement the Python virtual machine in Perl? OK, anything is possible, but I guess the real question is does anyone have a feel for the scope of such a project? Say using a native interpreter to pre-compile the Python code to pyc files and the perl cgi vm to run them? Feasible, or just a silly idea? From ullrich at math.okstate.edu Wed Apr 26 14:57:23 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Wed, 26 Apr 2000 18:57:23 GMT Subject: Simple Function Question References: <8e7ddt$18n@autodesk.autodesk.com> Message-ID: <39073aef.12145997@news> On Wed, 26 Apr 2000 11:44:10 -0700, "Akira Kiyomiya" wrote: >Hi, Could you explain this in dummy's language? > >This function prints out '4' and I have a feeling that x=1 and n=3, so >add1(3) prints '4'. > >However, I have a difficlut time trying to see how these two arguments >assigned to both x (especially x) and n. Not sure exactly what the question is, but here's what happens: ># Return a function that returns its argument incremented by 'n' >def make_incrementer(n): > def increment(x, n=n): > return x+n > return increment > >add1 = make_incrementer(1) Think about what just happened when you said make_incrementer(1). This actually executed the following function definition: def increment(x, n=1): return x+n The "n=1" means that n is an optional parameter - if you don't include n then it is set to 1; so calling increment(3) is the same as saying increment(3, 1), which should return 4. If you'd said add2 = make_incrementer(2) that would execute the definition def increment(x, n=2): return x+n and set add2 to the function so defined - then add2(x) is the same as add2(x,2). >print add1(3) # This prints '4' > > > From python-list at teleo.net Sun Apr 9 18:31:37 2000 From: python-list at teleo.net (Patrick Phalen) Date: Sun, 9 Apr 2000 15:31:37 -0700 Subject: new Scripting Language Survey at scripting.com Message-ID: <00040915402004.00554@quadra.teleo.net> Yet Another What is Your Favorite Scripting Language survey just got going at http://www.scripting.com. Not surprisingly (considering that is Frontier country), Frontier is in the lead. Surprisingly, Python is placing a strong second, well ahead of AppleScript, Javascript, Perl, PHP, Tcl, VBScript and Other. Actually, Other is doing rather well ... vote-early-and-often-ly y'rs - patrick From effbot at telia.com Tue Apr 25 14:12:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 25 Apr 2000 18:12:39 GMT Subject: mxODBC error trapping References: Message-ID: Daley, MarkX wrote: > I am accessing databases using the notes by John Dell'Aquila for ODBC using > Python Database API. It works fine, but now I am trying to set up error > trapping in the event that a connection fails to be made. Here is the basic > code structure: > > def collect(): > "Routine to query all servers for all names for time period defined > in timer." > # Define some variables > for index in servername: > try: > # Big routine to collect data and write to file > except dbi.operation-error: > servername.append(index) "operation-error" is not a valid name (it's interpreted as "operation" minus "error"). > I guess I don't know enough about exceptions to trap them properly. Any > hints? according to the DB specification [1], OperationalError is the correct name. you still have to qualify it with the module name, though: try: ... except dbi.OperationalError: ... if that doesn't work, try printing the contents of the "dbi" module: print dir(dbi) 1) http://www.python.org/topics/database/DatabaseAPI-2.0.html From Richard.Jones at fulcrum.com.au Mon Apr 10 17:11:27 2000 From: Richard.Jones at fulcrum.com.au (Richard Jones) Date: Tue, 11 Apr 2000 07:11:27 +1000 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) In-Reply-To: Message from tom__98@my-deja.com of 2000-Apr-10 20:8:31, <8ctcar$ml9$1@nnrp1.deja.com> Message-ID: <200004102111.HAA03380@envy.fulcrum.com.au> [tom__98 at my-deja.com] > In article <20000405053920.20579.qmail at web2102.mail.yahoo.com>, > lewst wrote: > > What is it about Perl that makes it so much more popular and have such > > a huge grassroots swell? I personally find Perl an abomination and > > Python a breath of fresh air. Perl has that first mover advantage I > > suppose, but should that really make such a hugh difference? > > I don't know about others, but I frequently end up using > Perl instead of Python, even though I greatly prefer Python > as a language. Tom you little troll-meister. Half those arguments you cite are bollocks if you _really_ knew and "greatly prefer" Python. Try again. Richard From dirck at pacbell.net Tue Apr 18 15:45:48 2000 From: dirck at pacbell.net (Dirck Blaskey) Date: Tue, 18 Apr 2000 12:45:48 -0700 Subject: module __call__ Message-ID: Just a little GWIBNI.... ...Gee-Wouldn't-It-Be-Nice-If... modules could def __call__(): so you could call a module, i.e. import StringIO f = StringIO() instead of import StringIO f = StringIO.StringIO() or from StringIO import StringIO f = StringIO() Yes, it's a very little gwibni... (Not-hip-enough-to-sign-with-an-adverb) d From effbot at telia.com Wed Apr 12 12:46:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 12 Apr 2000 16:46:58 GMT Subject: comparing strings and ints References: <1256565470-46720619@hypernet.com> Message-ID: <6M1J4.662$rc9.209708544@newsb.telia.net> Gordon McMillan wrote: > Certainly nothing in Doc/lib/built-in-funcs.html mentions any > danger in comparing arbitrary objects, nor the discussion in > 2.1.5.2 ( Lib | Built-in Types | Mutable Sequence Types | sort). otoh, 1.6a2 cannot compare strings safely: Python 1.6a2 (#0, Apr 5 2000, 23:56:55) Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> u"abc" < "???" Traceback (most recent call last): File "", line 1, in ? ValueError: UTF-8 decoding error: unexpected code byte From vlaw at my-deja.com Sat Apr 8 18:06:38 2000 From: vlaw at my-deja.com (vlaw at my-deja.com) Date: Sat, 08 Apr 2000 22:06:38 GMT Subject: Merchant Empires - python CGI based game up on SourceForge Message-ID: <8coah6$buv$1@nnrp1.deja.com> I've got a SourceForge (www.sourceforge.net) site set up for Merchant Empires, my python CGI web-based strategy game here: http://merchempires.sourceforge.net Anyone wanting to learn CGI based python might take a look at this. Anyone who knows a lot about it might also and tell me if I am doing anything wrong. I'm using cookies for authentication. I also use PostgreSQL, PyGreSQL, and HTMLgen. I couldn't find any complete Python (CGI) based web application of the web to use for examples. I can only assume I'm doing things right with the use of Cookie.py. I'm looking for people to assist with this project. Oh yeah I just learned Python last week so some of the code is probably pretty rough. Sent via Deja.com http://www.deja.com/ Before you buy. From just at letterror.com Sun Apr 30 12:43:10 2000 From: just at letterror.com (Just van Rossum) Date: Sun, 30 Apr 2000 17:43:10 +0100 Subject: [Python-Dev] Re: Python 1.6a2 Unicode bug (was Re: comparing strings and ints) In-Reply-To: <45919991@data.franken.de> References: <39072F0C.5214E339@lemburg.com> <45919986@data.franken.de> <048501bfb0b4$c793d760$4add3fcb@neil> Message-ID: At 9:56 AM +0200 28-04-2000, Walter Doerwald wrote: >But I find UCS-2 much cleaner, because it's easily distinguished from >ASCII/UTF-8/ISO8859-1/..., distinguishing between UTF-8 and ISO8859-1 has >to be done by "external" methods. How does Python do it? It doesn't; it'll just assume utf-8... Just From embed at geocities.com Mon Apr 3 15:50:31 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 3 Apr 2000 14:50:31 -0500 Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> Message-ID: > How does having both types significantly improve life for Python > programmers? I don't want to reopen the can of worms, but here's how I think of it, conceptually: First, every time you invoke a function: f(x,y,z) - Python looks in it's namespace(s) for the function f, this is a python object - Python creates a Tuple of the arguments you passed, ie, args=(x,y,z) - Python invokes the function internally like this: Apply(f,args) So, Tuples are an unavoidable concept inside the construction of Python. The only remaining question is, what value is there in exposing them to the user. Well, the first value to me, is that Python by nature allows introspection to an unprecedented degree. That is the most powerful thing, to me, about Python programming. I can separate a function name from the parameters, store them some place, and combine them, chemistry-set style, using map and apply. Nice Uses of Tuples-"The Point": A point consists of X,Y point pairs. This is a natural use for a Tuple. If the file format was 3D, you'd have an X,Y,Z tuple. As a whole, the tuple represents a single point in space. It is no longer two unrelated integers. It's a literal-value with a presence in two-space or three-space, if you like to think of things that way. Of course, you can't change part of a Tuples, any more than you can change Part of the number 3. It's either 3 or it's not, and it's a point at (5,10) or it's not. If you still don't get the Immutable thing, you need to meditate some more on the Way of the Pythonista. Read the Manuals, while chanting the Newbie Mantra: "Hmmm". Lists + Tuples: "Sequence of Points" Imagine putting the tuples (point pairs) together into a List of points. A list is the appropriate type, because you can insert and delete items from a list, something which would be a Bad Idea in Tuples, because they are Immutable. The list of tuples gives you the best of both worlds. Variable length in the list, so you can have any number of Points in the list, but you can't go adding a third item to a Tuple once created, nor delete the second item. You can pass this tuple around the system by reference and it will never get Messed With either. If someone changes their own local copy, they get a new tuple just for them. So without the distinction, Python's "object reference" scheme would be horribly broken. Dictionaries + Tuples: "Point to Name Map" Suppose now you are mapping Points on a Map to City Names. A map could be large, and it might be a bad idea to create a 2 dimensional array. You can't use a List as the Key to a dictionary, and here's an example of where a Tuple is just the ticket: CityName = {} # empty dictionary CityName[(5,24)] = 'London' CityName[(7,23)] = 'Paris' CityName[(9,24)] = 'Berlin' A dictionary using a Tuple as the key is a nice way to do some kinds of Sparse arrays. Tuples in Tuples: "Gettin' Jiggy with Recursion" Tuples nested inside Tuples can be useful as well. You can use them to do certain recursive types of things nicely: from types import * b = ( 9, "*", (7, "-", 2)) # infix sequence of operations as a tuple def f(x): if (type(x)!=TupleType): return x a,b,c = x v = str(f(a))+b+str(f(c)) print v return eval( v ) print f(b) #output: # # 7-2 # 9*5 # 45 Warren From gregm at localhost.localdomain Thu Apr 6 00:16:14 2000 From: gregm at localhost.localdomain (Greg McFarlane) Date: 6 Apr 2000 14:16:14 +1000 Subject: Tkinter, >> > in tkinter? >> >=20 >> > the nearest I have been able to find is from Pmw, and it doesn't = >really look >> > like windows... >>=20 >> Hmm, I thought that the Pmw.ComboBox() when used in drop down mode >> looked almost just like the Windows Drop Down box. >>=20 >> What is your problem with it? >well take a look at this picture and tell me if you think they look = >alike >http://www.aek.dk/python.gif > >left is windows in case there is any doubt :-) > >my personal oppinion is the difference is too great for my user... Pmw is highly configurable. I am sure that it could be configured to look just like Mr Gates' dropdown box. If you tell me what you want to change, I will be able to tell you the Pmw options to set. Greg McFarlane Open Telecommunications gregm at ot.com.au -- Greg McFarlane Open Telecommunications gregm at ot.com.au From paul at qc-ns.com Mon Apr 3 12:21:00 2000 From: paul at qc-ns.com (Paul MAJGIER) Date: Mon, 03 Apr 2000 18:21:00 +0200 Subject: SubmitWolf Message-ID: <38E8C4EC.ECF4794A@qc-ns.com> Hello everyone, Do you happen to know of a program or part of a program which can submit a site to a thousand search engines at the same time ? To give you a more precise idea of what I am looking for, I can give you the example of "submitwolf" which does something similar under windows. I could obviously come up with such a program myself but there are many types of forms to enter and if such a program exists already, it must certainly have a rich form database and that would be very helpful to me. Thanks in advance for your help. From nospam at nowhere.net Wed Apr 26 00:56:36 2000 From: nospam at nowhere.net (Ray&Maria) Date: Tue, 25 Apr 2000 22:56:36 -0600 Subject: Sorting a list of classes References: Message-ID: No, you can sort classes, too. It is very useful if you want to sort a list of plug-ins in a pull-down menu. class A: className = "A" class B: className = "B" class C: className = "C" classList = [B, C, A] print "before sorting:", classList classList.sort(lambda a, b: cmp(a.className, b.className)) print "after sorting:", classList Ray NOSPAMjchen at NOSPAMquark.com "Michael Hudson" wrote in message news:m3snwafxek.fsf at atrus.jesus.cam.ac.uk... > "lexberezhny" writes: > > > If i have a python list of classes, can i do something like > > classList.sort() and how can i control this behavior within the > > classes. > > Do you mean "class"? In which case, no. If you mean "instance", then > see the other replies... > > Cheers, > M. > > -- > 41. Some programming languages manage to absorb change, but > withstand progress. > -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From m.faassen at vet.uu.nl Fri Apr 21 15:20:19 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 21 Apr 2000 19:20:19 GMT Subject: Using python on the web References: Message-ID: <8dq9lj$pjg$2@newshost.accu.uu.nl> Brent Fulgham wrote: > A couple of questions: >> We build medium-busy, CGI-intensive sites in Python. We were briefly >> quite excited about Zope, but once we realized it locked us into Yet >> Another Programming Language, we lost interest. DHTML is particularly >> problematic, > 1. I'm not familiar with Zope. Is DHTML specific to Zope? It seems > to be proudly advertised on a lot of "webware" brochures I see these > days. Acronym mixup. DHTML (Dynamic HTML) and DTML (Document Template Markup Language) have little in common besides that they both are used with HTML. DHTML is client side (in the browser), DTML server side (in Zope). DHTML is to do fancy graphics effects, DTML is a reporting language that talks to Zope (read Python) objects and usually generates HTML. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From news at bachi.ch Tue Apr 25 05:54:44 2000 From: news at bachi.ch (Martin Bachmann) Date: 25 Apr 2000 09:54:44 GMT Subject: Python/Zope or better PHP4 Message-ID: <8F2172931newsbachich77@192.168.1.1> We're currently developping our web applications in PHP for use with Apache/mod_php. This works great and PHP4 seems to bring lots of improvements. However, we're looking for an integrated, object-oriented development frame with some security concepts, so Zope came to our view. My question now, does anyone here have experience with both PHP and Zope? Would it be worth take the effort to change to Zope? What about advantages/disadvantages? How well does Python work as a web programming language compared to PHP (which was designed right from the start for this purpose) ? Thanks for any comments and views, Martin From greg at cosc.canterbury.ac.nz Tue Apr 4 23:20:35 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Wed, 05 Apr 2000 15:20:35 +1200 Subject: Pass by reference ? References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38E8D449.FBC1E2AD@roguewave.com> <8caohp$j4v$1@pegasus.csx.cam.ac.uk> Message-ID: <38EAB103.E76E74C2@cosc.canterbury.ac.nz> Nick Maclaren wrote: > > Unless I am thoroughly confused, Python uses bog-standard call by > reference, with the wrinkle that assignment is a rebinding rather > than a copying operation. AM I confused about that? The trouble with describing Python parameter passing as "call by reference" is that that term implies something like a Pascal VAR parameter, which Python most certainly does *not* have. That's why Mr. Generowicz got confused - he thought it meant that a reference to the *variable* x was being passed. If I had to pick one of the standard terms, I would describe Python parameter passing as call-by-value, with the wrinkle that the value being passed is always a reference to an object. But I think it's better to avoid using any of the terms developed for describing parameter passing in Algol-like languages when explaining Python to a newcomer, because none of them really fit properly, and further explanation is needed to avoid confusion. It's better to just give the full explanation in the first place. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From samschul at pacbell.net Mon Apr 24 23:07:28 2000 From: samschul at pacbell.net (Sam Schulenburg) Date: Tue, 25 Apr 2000 03:07:28 GMT Subject: Pythonwin COM Question Message-ID: <8e3259$i5$1@nnrp1.deja.com> In Visual Basic I have the following: '=============================================== Dim theFrame As Varient Dim dx as DocFile Dim ex as New ExpSetup Dim bRes as Integer if (ex.Start(dx)) then While ex.GetParam(EXP_RUNNING,bRes) DoEvents 'Wait for detector to finish Wend dx.GetFrame 1, theFrame 'Retreive one image end if '=============================================== In Python I have the equivalent: from PrincetonInst import * # Get the renamed Makepy file for the # COM object theFrame = [] # Set up the Varient dx = DocFile() # Get the DocFile class ex = win32com.client.Dispatch(ExpSetup.CLSID) bRes = 0 if (ex.Start(dx)) then # Start detector scanning for data While ex.GetParam(EXP_RUNNING,bRes): # Detector is scanning ## DoEvents # Wait for detector to finish, This has no # equivalent in Pythonwin s = 1 # This gives the while loop something to do #### This is where everything falls apart #### theFrame is not the correct datatype dx.GetFrame(1,theFrame) # Retreive one image How do I define the correct Varient type in Python? Sam Schulenburg Sent via Deja.com http://www.deja.com/ Before you buy. From pecora at anvil.nrl.navy.mil Sun Apr 30 10:00:06 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Sun, 30 Apr 2000 14:00:06 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <280420000746597329%pecora@anvil.nrl.navy.mil> <8ec67h$b14$1@ites.inria.fr> Message-ID: <300420001000073453%pecora@anvil.nrl.navy.mil> [[ This message was both posted and mailed: see the "To," "Cc," and "Newsgroups" headers for details. ]] In article <8ec67h$b14$1 at ites.inria.fr>, Cedric Adjih wrote: > or the other suggestions for read-only attributes: > > > class Polynom2: > def delta(self): > a,b,c=self.a,self.b,self.c > return b*b-4*a*c Yes, read only. Thanks. From jmassung at magpiesystems.com Tue Apr 18 15:47:50 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Tue, 18 Apr 2000 13:47:50 -0600 Subject: else clauses in while and for loops References: <%TNK4.430$vr2.32615@news.uswest.net> <2JKK4.325$vr2.19414@news.uswest.net> <38DD2EE3.C7F3CB54@webamused.com> <8boe2k$gmh$1@inputplus.demon.co.uk> <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> <8dg14u$f08$1@nntp6.u.washington.edu> <8dh0ss$4ia$0@216.39.151.169> Message-ID: Donn Cave wrote in message <8dh0ss$4ia$0 at 216.39.151.169>... >Now it's simpler to say "else executes if break doesn't". Got it now ;). Thanks. Jeff From thomas at cintra.no Sun Apr 30 12:39:15 2000 From: thomas at cintra.no (thomas at cintra.no) Date: Sun, 30 Apr 2000 16:39:15 GMT Subject: Comments/Help on Index-module Message-ID: <390c564b.102144@news.c2i.net> Hi, I`m trying to make a index-module. Words are mapped to a tuple containg info using a dbhash-based dictionary. The tuple contains a file-position and how many bytes to read. A second file contain a serie of integers making a serie of ids. Three integers are used as a id. I`ve managed to write integers to a single file, but I need to merge several files created like above into one huge one. The problem is that somewhere something got screwed up, and the integers I`ve put into the scripts are not the same as the ones coming out when I try lookup words. I put in: >>> x.add('eggs',(33,2,42)) and this comes out : >>> looking for eggs: [(536870912, 16777216, -1610612641)] Other values seem to get thru ok, but it looks like they are located first in the file with integers. I therefore suspect that the error is located somewhere in the seeking in the binary-file. If somebody understands what I`m trying to do can point to where I screw up, or has another faster, better or perhaps easier way of doing this, I`d be grateful I`ve included my script below. Sorry if this is lots of text and take up lots of bandwidth, but I`ve spent hours on this and don`t seem to come any closer to a solution. thanks. Thomas #!/usr/bin/python import dbhash import shelve import struct import os StillOpen = "Indexer is still open. Close before searching." Nothoing2Merge = "Nothin to merge. Add more entries." def opendb(file): return shelve.Shelf(dbhash.open(file, "crw")) class Storage: def __init__(self): self.items = {} self.indexed_items = 0 if not os.path.exists('main.dat'): self.outputfile1 = 'main.idx' self.outputfile2 = 'main.dat' else: self.outputfile1 = 'idx_cd.idx' self.outputfile2 = 'idx_cd.dat' self.dat = opendb(self.outputfile2) self.out = open(self.outputfile1, "wb") self.open = 1 def close(self): self.dat.close() self.out.close() self.open = 0 def flush(self): where_ = 0 fmt = 'lll' sz = struct.calcsize(fmt) for key in self.items.keys(): self.dat[key] = (where_, len(self.items[key])) where_ = where_ + len(self.items[key]) for entry in self.items[key]: self.out.write(struct.pack(fmt, entry[0], entry[1], entry[2])) self.items = {} self.indexed_items = 0 self.dat.close() self.out.close() self.open = 0 def add(self, word, id): if not self.items.has_key(word): self.items[word] = [] self.items[word].append(id) def merge(self): if not os.path.exists('idx_cd.dat'): raise Nothoing2Merge else: processed = [] fmt = 'lll' sz = struct.calcsize(fmt) os.rename('main.dat', '_main.dat') os.rename('main.idx', '_main.idx') dOld = opendb('_main.dat') iOld = open('_main.idx','rb') dNew = opendb('idx_cd.dat') iNew = open('idx_cd.idx','rb') d = opendb('main.dat') i = open('main.idx','wb') where = 0 for key in dOld.keys(): processed.append(key) whereOld, noOld = dOld[key] seek2 = whereOld iOld.seek(seek2) for j in range(0, noOld): data = iOld.read(sz) ds = struct.unpack(fmt, data) i.write(struct.pack(fmt, ds[0], ds[1], ds[2])) if dNew.has_key(key): whereNew, noNew = dNew[key] seek2 = whereNew iNew.seek(seek2) noOld = noOld + noNew for j in range(0, noNew): data = iNew.read(sz) ds = struct.unpack(fmt, data) i.write(struct.pack(fmt, ds[0], ds[1], ds[2])) d[key] = (where, noOld) where = i.tell() for key in dNew.keys(): if not key in processed: where_, no = dNew[key] seek2 = where_ iNew.seek(seek2) for j in range(0, no): data = iNew.read(sz) ds = struct.unpack(fmt, data) i.write(struct.pack(fmt, ds[0], ds[1], ds[2])) d[key] = (where, no) where = i.tell() d.close() i.close() dOld.close() iOld.close() dNew.close() iNew.close() if os.path.exists('_main.dat'): os.remove('_main.dat') os.remove('_main.idx') if os.path.exists('idx_cd.dat'): os.remove('idx_cd.dat') os.remove('idx_cd.idx') class Locator: def __init__(self, words, intersection = 1): self.hits = {} self.result = [] f = open('main.idx','rb') d = opendb('main.dat') fmt = 'iii' sz = struct.calcsize(fmt) for word in words: self.hits[word] = [] where, no = d[word] seek2 = where f.seek(seek2) for j in range(0,no): data = f.read(sz) ds = struct.unpack(fmt, data) self.hits[word].append(ds) workOn = [] for key in self.hits.keys(): workOn.append(self.hits[key]) if intersection: res = [] if workOn: for x in workOn[0]: for other in workOn[1:]: if not x in other:break else: res.append(x) for list in res: self.result.append(list) else: # union => match all words res_ = {} for list in workOn: for item in list: res_[item] = None self.result = res_.keys() if __name__ == '__main__': x = Storage() x.add('spam',(21,2,32)) x.add('spam',(24321,3232,3232)) x.add('spam',(321,32,432)) x.add('eggs',(33,2,42)) x.add('spam',(33,2,42)) x.add('python',(312,3232,44322)) x.add('spam',(3323,12,443222)) x.flush() x = Storage() x.add('python',(3323,12,142)) x.add('monty',(1133,22,4662)) x.add('cheese',(33213,121,1142)) x.add('biscuit',(3323,132,41322)) x.add('spam',(2333,32,432)) x.flush() x.merge() y = Locator(['eggs']) print "looking for eggs:", y.result From jeremy at cnri.reston.va.us Thu Apr 20 13:23:26 2000 From: jeremy at cnri.reston.va.us (Jeremy Hylton) Date: Thu, 20 Apr 2000 13:23:26 -0400 (EDT) Subject: The Simple Economics of Open Source Message-ID: <14591.15630.192472.440375@goon.cnri.reston.va.us> A brief article in today's NY Times discusses a new (Feb 2000) paper explores the economics of open source software: http://www.nytimes.com/library/financial/columns/042000econ-scene.html (The article requires user registration.) The paper itself is available from one of the authors -- http://www.people.hbs.edu/jlerner/simple.pdf The Simple Economics of Open Source Abstract: "There has been a recent surge of interest in open source software development, which involves developers at many different localtions and organizations sharing code to develop and refine programs. To an economist, the behavior of individual programmers and commercial companies engaged in open source projects is initially startling. We highlight the extent to which labor economics, especially the literature on 'career concerns,' can explain many of these projects' features. Aspects of the future of open source development process, however, remain somewhat difficult to predict with 'off-the-self' economic models." The authors are Josh Lerner -- http://www.people.hbs.edu/jlerner/ -- and Jean Tirole -- http://www.elsevier.nl/hes/homepage/cvs/tirole.htm I haven't read the paper yet, but the abstract and the discussion in the Times make it sound like a worthwhile read. Thought I'd share the pointer to the paper and see if anyone else has read the paper or has comments on it. Jeremy From markx.daley at intel.com Thu Apr 27 17:10:50 2000 From: markx.daley at intel.com (Daley, MarkX) Date: Thu, 27 Apr 2000 14:10:50 -0700 Subject: ODBC error trap resolved! Now... Message-ID: OK, so the error trapping is good, but now I run into an append problem. I have a list defined in the beginning of the function, like so: servername = ['ServerA', 'ServerB', 'ServerC'] for index in servername: try: #Big routine to collect and write data to a file. except dbi.opError: servername.append(index) So, if one of the servers doesn't make the connection, it gets added to the end of the list until it does connect. This worked great in my test scripts, but when put to practice, I get this: Traceback (innermost last): File "", line 1, in ? collect.collect() File "C:\PROGRA~1\Python\collect.py", line 51, in collect servername.append(index) AttributeError: 'string' object has no attribute 'append' I didn't see this when I tested my append function. What do I not understand about lists in this context? Once again, thank you for all your help in advance. - Mark From rupole at compaq.net Wed Apr 19 19:36:40 2000 From: rupole at compaq.net (Roger Upole) Date: Wed, 19 Apr 2000 23:36:40 GMT Subject: Where do I send a contribution for the Starship recovery ? Message-ID: I personally would consider it money well spent. (unlike most of the other things I spend money on) Roger Upole From ljz at asfast.com Sun Apr 23 12:01:19 2000 From: ljz at asfast.com (Lloyd Zusman) Date: 23 Apr 2000 12:01:19 -0400 Subject: code not true? References: <1255627015-45592331@hypernet.com> Message-ID: "Gordon McMillan" writes: > [ ... ] > > The theoretically correct alternative is rationals. But they're > slow and use unpredictable amounts of memory. I think > Python should have BCD as an alternative. While slow, they're > predictable in memory use, and the mathematical > shortcomings they have are exactly those that a naive user > expects. Python already has unlimited-precision long integers as part of the language, and the `mpz' module that comes with the standard Python release is another multiple-precesion option (built on top of GNU MP). See sections 2.1.4 ("Numeric Types") and 15.2 ("mpz") of the Python Library Reference manual. It should be fairly straightforward to use the unlimited-precision long integers or `mpz' to implement a BCD module that handles decimal arithmetic and not just integer math. Ages ago I wrote an unlimited-precision BCD math library in C ... I'm sure I could do it again (and much more easily and quickly) in Python. Then again, I'd hate to re-invent the wheel ... I'd be surprised if someone hasn't already created such a thing in Python ... ??? > [ ... ] > > - Gordon -- Lloyd Zusman ljz at asfast.com From mhammond at skippinet.com.au Fri Apr 14 09:31:02 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 14 Apr 2000 13:31:02 GMT Subject: Future compatibility of the Python C API References: Message-ID: No one can speak for Guido, so here are my opinions and guesses :-) "Keith Davidson" wrote in message news:lwEJ4.7980$Ib7.101092 at typhoon2.kc.rr.com... > 1) Has there been any discussion about the upwards compatibility of the C > API in future versions of Python? Yes. > Historically our libraries have had a > 7-10+ year lifespan where we provide 95+% backwards compatibility (i.e. we > don't want our C API users to have to make more than a day or so worth of > changes between releases). And this is the goal with the 1.x family. > My big concern is Python 3000- what are the odds > that its C API will be backwards compatibility with Python 1.x? Not very good. If it is a real problem, simply dont upgrade. I would however expect the changes to cause compiler errors that are simple to fix - ie, very similar APIs, and unlikely to silently change behaviour. > 2) We are considering using the Python C API heavily in a set of libraries > that will be used by both C applications and as Python extension modules. > Has anyone else done this? How did it work out? Sure. Great. Really, there is no difference between a set of libraries and an application that embeds Python - just the entry points change! Mark. From schorsch at schorsch.com Wed Apr 19 06:34:36 2000 From: schorsch at schorsch.com (Georg Mischler) Date: Wed, 19 Apr 2000 10:34:36 GMT Subject: urllib redirect References: <4.1.20000418125557.030592d0@202.95.1.37> Message-ID: <8dk23t$4c2$1@nnrp1.deja.com> Anthony J Wilkinson wrote: > On Tue, 18 Apr 2000, Thomas wrote: > > > I want one of my functions to redirect the URL. > > (ie I call the script and off I go to www.spam.com) > > > > So, here's what I get, and have not overcome yet: > > > > import urllib > > def simpleredirect() : > > ############ > > print "Content-type: text/html" > > print urllib.urlopen('http://www.spam.com').read() > > > > simpleredirect() > > You really aren't redirecting but attempting to get the data yourself. > If you just print out the following you can use the browser's own > redirection facility. > > Content-type: text/html > > ... > This can be done in a much simpler way, whitout sending any acutal page data to the client: your_new_path = 'http://www.spam.com/' print 'Status: 302 Redirected' print 'Location: %s' your_new_path As soon as the browser (works with *every* browser!) sees the "Location:" header, it will stop and try fetching the new page. Unless the original poster didn't really want redirection as claimed in the text, but rather a proxy service as hinted at in the code. I think the latter is only recommendable in very special circumstances. Have fun! -schorsch -- Georg Mischler -- simulations developer -- schorsch at schorsch.com +schorsch.com+ -- lighting design tools -- http://www.schorsch.com/ Sent via Deja.com http://www.deja.com/ Before you buy. From jae at ilk.de Sat Apr 22 00:29:56 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Sat, 22 Apr 2000 06:29:56 +0200 Subject: How2 use curses for data input In-Reply-To: <38FF8F9C.9D533E74@sprint.ca> (message from Miles Thompson on Thu, 20 Apr 2000 20:15:40 -0300) References: <38FF6DE2.5751423A@sprint.ca> <38FF8F9C.9D533E74@sprint.ca> Message-ID: <22042000.4@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Miles" == Miles Thompson writes: Miles> I located it on the RH system here in the office at Miles> home. The target machine is Debian, and I think I can Miles> install RPM on it so that if need be, I can get the Miles> RPM. Debian doesn't seem to have a snack package. My Debian system has a snack package... `snack' and `snack-dev'. But that is potato (the upcoming release)... so it might be that slink didn't. If you need it for slink... well, you could try to build it for slink. Might even work ;-) (*Building* a Debian source package is really simple... lemme know if you try it and need assistance...) HTH(S), Bye, J - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html GNU Privacy Guard (http://www.d.shuttle.de/isil/crypt/gnupg.html) "Windows NT" is an acronym for "Windows? No thanks." -- Russ McManus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkBKsAACgkQN0B+CS56qs3EdACeIlyz6xB7/RZTQ1ZowMnPPqpN kHsAoI3KNP27chgRgC0ItaV5/aPVPlOe =ByvG -----END PGP SIGNATURE----- From rhicks at nospam.rma.edu Mon Apr 17 11:10:34 2000 From: rhicks at nospam.rma.edu (Robert Hicks) Date: Mon, 17 Apr 2000 15:10:34 GMT Subject: Editors and books References: Message-ID: try this... http://www.python.org/download/download_mac.html I am not a Mac person...but it might get you there. Bob "Jeff Massung" wrote in message news:XBFK4.16$Uq2.1831 at news.uswest.net... > First, I'd like to give my undying praise to PYTHON: Essential Reference, by > David M. Beazley. I'm an accomplished C/C++ programmer who wanted to learn > Python. This book was IT! Anyone whose reading this that is in my shoes - > get this book! It's some of the best $35 I've spent! > > Next, a question for those who've been doing this: is there a color IDE > (just a nicer thing that IDLE) for the Mac? I've heard that Alpha (which I > just downloaded) has a Python mode, but I can't seem to find it. Is there > something else, either? can MPW do it? BBEdit? > > Thanks, guys. > > Also, on another NG there's talk about Python, and how it does (and still > doesn't) do garbage collecting. Could someone here expand on it so I know > what it can and can't do? Memory is a big issue in my project and I need to > know how to structure my program so that garbage is collected. Thanks > again!! > > -- Jeff Massung (jmassung at magpiesystems.com) > -- Lead programmer for Magpie Systems > -- Bringing smart pigs to the pipeline industry! > > From Michael.Scharf at gmx.de Fri Apr 14 15:43:33 2000 From: Michael.Scharf at gmx.de (Michael Scharf) Date: Fri, 14 Apr 2000 21:43:33 +0200 Subject: Comparing PythonWin and IDLE? References: Message-ID: <38F774E5.E34B0365@gmx.de> Charlie Derr wrote: > > instead of: > > import myModule > > try this: > > reload(myModule) > > and you should be able to get your recently modified changes to take effect > without restarting python Well, not quite: if you wrire (in another module) from myModule import MyFunction,MyClass ... MyFunction() my_callback=MyFunction my_instance=MyClass() reload will *not* change the function nor the myinstance. If you would write: import myModule ... myModule.MyFunction() my_callback=myModule.MyFunction my_instance=myModule.MyClass() the new version of MyFunction an MyClass will be called, but existing instances of MyClass will not be changed to the new version. Also the old version of my_callback would be called. I know it is possible to change the code of existing functions. So, with some ticks it should be possible to replace the code of existing functions. The same must be done for all mutable objects (list, dicts etc.). Only not mutable direct imported variable (int, string, tuple etc.) cannot be changed that way. I just wonder if anybody has written such a clever reimport... Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software GmbH, a Wind River Company ` > http://www.WindRiver.com \_ V mailto:Michael.Scharf at gmx.de From tom-main at REMOVEME.home.com Fri Apr 14 15:29:11 2000 From: tom-main at REMOVEME.home.com (Tom) Date: Fri, 14 Apr 2000 19:29:11 GMT Subject: How do I undo an import?? References: <7QrJ4.185421$Hq3.4353581@news2.rdc1.on.home.com> Message-ID: After importing NetCfg I type: >>> del sys.modules['NetCfg'] Python responds as follows: Traceback (innermost last): File "", line 1, in ? NameError: sys Any ideas?? Thanks, Tom. "Michael Hudson" wrote in message news:m3d7nthbbj.fsf at atrus.jesus.cam.ac.uk... > "Tom" writes: > > > I'm a C++ programmer, new to Python, working with v1.5.2 on Windows. > > > > I run the command-line interpreter, then I type: > > > > >>> from NetCfg import * > > > > to import my extension. Now I want to unload my NetCfg DLL without exiting > > the interpreter. How do I do this? > > You don't, in general. > > del sys.modules['NetCfg'] > > goes some of the way, but it's unlikely it goes far enough to let the > dll be unloaded from memory. > > > Also, I type the above import command every time I start the interpreter. > > Is there some way to get have this command executed automatically? > > Set the environment variable "PYTHONSTARTUP" to point to a file > containing commands you want executed. > > At least, that's what I do on Linux. > > 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 greg at cosc.canterbury.ac.nz Thu Apr 6 21:54:35 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Apr 2000 13:54:35 +1200 Subject: Why should I switch to Python? - Infinity of Primes References: <1257244378-5884705@hypernet.com> Message-ID: <38ED3FDB.D4954AB8@cosc.canterbury.ac.nz> Gordon McMillan wrote: > > David C. Ullrich wrote: > > There are at least 3 well known constructive > proofs that all odd numbers are prime: And, of course, you are all familiar with the proof that every natural number has an interesting property: The number 1 has the interesting property of being the first natural number. Now suppose that all natural numbers up to n have interesting properties, but n+1 does not. That would make n+1 the first natural number without an interesting property -- and that is an interesting property! This-is-my-last-post-on-this-topic-really-I-promise, -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From dalke at acm.org Sat Apr 1 06:28:36 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 1 Apr 2000 04:28:36 -0700 Subject: Function override? References: <8c0dtu$lr3$1@nnrp1.deja.com> <38E4D7A4.4C83CFF7@math.okstate.edu> Message-ID: <8c4mds$5p7$2@slb6.atl.mindspring.net> David C. Ullrich wrote: > This is certainly one of the things that _I_ find keen, >amyway - I hope the people who are talking about adding >stricter typing to Python make it optional somehow. There >are obvious advantages to stricter typing but you lose >something as well. (For example, I get a big kick out of >the fact that exactly the same euclidean-algorithm code >works to find the GCD of two integers or the GCD of >two polynomials. Etc.) I went to a talk by Stepanov about the Standard Template Library in C++. One of his examples was a geneic GCD algorithm which works on integers and polynomials. Thus, stricter typing and generic programming don't have to be the same thing. In Python, this could be done by a syntax requiring not that "i" and "j" are ints, but that type(i) == type(j). Andrew dalke at acm.org From thomas at xs4all.net Tue Apr 18 16:31:05 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Tue, 18 Apr 2000 22:31:05 +0200 Subject: Pointers In-Reply-To: <8dhu2j$1gm$1@proxy2.fe.internet.bosch.de>; from Klaus-Gerd.Meyer@de.bosch.com on Tue, Apr 18, 2000 at 05:13:21PM +0200 References: <38D00DCE.9740380F@be-research.ucsd.edu> <8bfsqo$kje$1@tribune.oar.net> <4k5D4.7566$0o4.54442@iad-read.news.verio.net> <38FB98F1.239EC0FB@whetstonelogic.com> <8dhu2j$1gm$1@proxy2.fe.internet.bosch.de> Message-ID: <20000418223105.K15664@xs4all.nl> On Tue, Apr 18, 2000 at 05:13:21PM +0200, Klaus-Gerd Meyer wrote: > Integers and strings with same value are identical, but tuples and list with > same value are not identical... Not all integers and strings with the same value are identical, though! > >>> x = 1 > >>> y = 1 > >>> id(x),id(y) > (7879224, 7879224) > >>> x is y #x and y: same value and identical > 1 >>> x = 100000 >>> y = 100000 >>> id(x),id(y) (135113376, 135230104) >>> x is y 0 >>> x == y 1 > >>> > >>> x = "a" > >>> y = "a" > >>> id(x),id(y) > (8041104, 8041104) > >>> x is y #x and y: same value and identical > 1 >>> x = "Ham, spam, eggs, spam, bacon, spam, pate foie gras, spam, saussages and spam" >>> y = "Ham, spam, eggs, spam, bacon, spam, pate foie gras, spam, saussages and spam" >>> id(x),id(y) (135233304, 135240648) >>> x is y 0 >>> x == y 1 For strings, you can 'fix' this by using 'intern()': >>> y = intern("Ham, spam, eggs, spam, bacon, spam, pate foie gras, spam, saussages and spam") >>> x = intern("Ham, spam, eggs, spam, bacon, spam, pate foie gras, spam, saussages and spam") >>> id(x),id(y) (135241592, 135241592) >>> y == x 1 >>> y is x 1 But you have to force *both* strings this way, interning one isn't enough. It also doesn't work for integers (i dont think there is a way to do it with ints) so the best solution is just to not rely on this behaviour. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From lars.lundstedt at telia.com Wed Apr 26 00:30:35 2000 From: lars.lundstedt at telia.com (Lars Lundstedt) Date: Wed, 26 Apr 2000 04:30:35 GMT Subject: SV: Don't understand error message References: Message-ID: Ahhhh...that did the trick! Thanks! Alex skrev i diskussionsgruppsmeddelandet:etd1z3uf5ua.fsf at w20-575-109.mit.edu... > > > It goes like this: > > > > import sys, glob, operator > > print sys.argv[1:] > > sys.argv = reduce(operator.add, map(glob.glob, sys.argv)) > > print sys.argv[1:] > > > > When called with "python glob.py *.py" on Win98 I'm supposed to get a list > > of all .py files in the current directory but instead I get: > > > > Traceback (innermost last): > > File "glob.py", line 1, in ? > > import sys, glob, operator > > File "glob.py", line 3, in ? > > list = reduce(operator.add, map(glob.glob, '*.py')) > > TypeError: call of non-function (type module) > > > > Anyone know why? > > Yeah, the problem is, your file is called glob.py, and that is loaded > when you import glob. Instead, you should be loading the glob from the > standard python library. To get around this, one thing you could do is > rename your glob.py file to my_glob.py, and remove your old glob.py and > glob.pyc. Then 'python my_glob.py *.py' should work fine. At least, > that solved the problem for me. > > Alex. From dirck at pacbell.net Wed Apr 5 13:57:54 2000 From: dirck at pacbell.net (Dirck Blaskey) Date: Wed, 5 Apr 2000 10:57:54 -0700 Subject: Extending Python with C-Libs References: <8cfpl8$9b2$1@newnews.ilk.de> Message-ID: Frank Rotermund wrote in message news:8cfpl8$9b2$1 at newnews.ilk.de... > Hello > > I have a Library written in C with its Headerfiles but without the > Sourcecode. > Does anybody know an easy way to extend Python with this Library? Don't miss http://www.swig.org it will make the process easier. From just at letterror.com Sat Apr 8 13:23:48 2000 From: just at letterror.com (Just van Rossum) Date: Sat, 8 Apr 2000 18:23:48 +0100 Subject: No threads in MacPython 1.5.2? In-Reply-To: <8cl7rh$kvm$3@flotsam.uits.indiana.edu> Message-ID: At 6:02 PM +0000 07-04-2000, Gregory L. Hansen wrote: >My Python can find Tkinter now, thanks for the help. But now it can't >find the module named "thread". And yet there it is in the Lib folder, >thread.py Erm, there is no such module as thread.py. >and threading.py, and the search path $(PYTHON):Lib is set for >it. > >Now what's wrong? Nothing: MacPython is currently not built with thread support. That's not so much because the OS like Christian suggested, but rather that there was no posix-compatible thread implementation available, making Python integration hard. However, this has changed with GUSI2 (a posixey I/O emulation library), and the upcoming MacPython 1.6a1 *does* have threads. I haven't seen it yet, so I don't know how well it works. Subscribe to the pythonmac-sig, and you'll soon find out! (In the meantime I have microthreads running like a charm, thanks to Stackless Python ;-) Just From grisha at ispol.com Fri Apr 21 09:44:47 2000 From: grisha at ispol.com (Gregory Trubetskoy) Date: Fri, 21 Apr 2000 09:44:47 -0400 Subject: suggestion on an operator In-Reply-To: <3900043E.78539877@nsw.bigpond.net.au> References: <3900043E.78539877@nsw.bigpond.net.au> Message-ID: On Fri, 21 Apr 2000, John Lehmann wrote: > Gregory Trubetskoy wrote: > > What is wrong with using the period again? > > eg. > > PythonAuthenHandle mypackage.mymodule.authenticate With a period I don't know where the module ends and stuff in it begins. I have to import the module to gain access to what's in it. For example - a.b.c.d could be interpreted as package.module.object.function, or package.subpackage.subsubpackage.function. If Python allowd me to access string.split without doing "import string" first, then the period would work, but such is not the case. David Gooder suggested a space - a space won't work because I would like to keep the option of allowing multiple handler separated by space, a la mod_perl. Grisha From pj at sgi.com Tue Apr 18 11:15:06 2000 From: pj at sgi.com (Paul Jackson) Date: 18 Apr 2000 15:15:06 GMT Subject: else clauses in while and for loops References: <2JKK4.325$vr2.19414@news.uswest.net> <8dg14u$f08$1@nntp6.u.washington.edu> <%TNK4.430$vr2.32615@news.uswest.net> <2VTK4.421$wYl.187705344@newsb.telia.net> Message-ID: <8dhu5q$14anj$1@fido.engr.sgi.com> Perhaps I need some more coffee, but I suspect that the example in the previous message is indented wrong, and should be: s = list_of_strings for i in range(len(s)): if s[i] == something: break else: print "didn't find anything" raise ValueError print "index is", i -- ======================================================================= I won't rest till it's the best ... Software Production Engineer Paul Jackson (pj at sgi.com; pj at usa.net) 3x1373 http://sam.engr.sgi.com/pj From owen at astroNOJNK.washington.edu.invalid Thu Apr 20 14:47:27 2000 From: owen at astroNOJNK.washington.edu.invalid (Russell E. Owen) Date: Thu, 20 Apr 2000 11:47:27 -0700 Subject: Mac Python Questions References: <38FE8032.DE233C29@cosc.canterbury.ac.nz> Message-ID: <8dnjbt$hcs$1@nntp6.u.washington.edu> In article <38FE8032.DE233C29 at cosc.canterbury.ac.nz>, Greg Ewing wrote: >Jeff Massung wrote: >> >> b) No matter what I do, I can't get Tkinter to work :(. > >Neither can I, and from what I've seen here, neither >can anyone else. Tkinter just seems to be broken on >the Mac at present. It works fine. Tricks: - Make sure the necessary paths are added (as another poster detailed) - Make sure PythonInterpreter is configured to NOT go into interactive mode after the script completes. (Drop PythonInterpreter onto EditPythonPrefs, then push the button that lets you configure startup defaults; it's the first checkbox). I have not seen this mentioned before, but I find it crucial for Tk scripts to exit correctly! - Put your Tk scripts in files and drop them onto PythonInterpreter. Don't use the IDE!!! (Typing scripts into the interpreter may also work; I've not tried it.) -- Russell From darcy at vex.net Mon Apr 24 07:50:53 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 24 Apr 2000 11:50:53 GMT Subject: Trouble compiling PyGreSQL 2.4 on Linux References: Message-ID: <8e1cet$kmd$1@news.tht.net> Oleg Broytmann wrote: >> How stable is the DB-API version of the PostgreSQL module? Can it >> be used for production work (or semi serious)? > It was released few days ago, so it just hadn't been tested... In fact it hasn't been released yet but you can pick up the beta for testing from ftp://ftp.druid.net/pub/distrib/PyGreSQL-beta.tgz. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.vex.net/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. From dwhite2 at seas.upenn.edu Fri Apr 7 18:00:10 2000 From: dwhite2 at seas.upenn.edu (dave white) Date: Fri, 07 Apr 2000 18:00:10 -0400 Subject: Why should I switch to Python? - Infinity of Primes References: <000601bf9f8e$bd31e780$ea2d153f@tim> Message-ID: <38EE5A40.4557F4EA@seas.upenn.edu> Since we're on the subject of primes... I've heard that there's a nice probabilistic algorithm for computing large primes using Fermat's Little Theorem. Python seems like it would be well suited for this since bignums are built into the language. Does anyone know this algorithm? Fermat's Little Theorem: Let p be a prime which does not divide the integer a, then a^(n-1) = 1(mod p) cheers, david From thomas at xs4all.net Tue Apr 18 04:28:17 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Tue, 18 Apr 2000 10:28:17 +0200 Subject: Here is some starship.python.net news In-Reply-To: <38FBE4DB.67289F42@mindspring.com>; from echuck@mindspring.com on Tue, Apr 18, 2000 at 12:30:19AM -0400 References: <38FA9A30.33DD1994@concentric.net> <38FB90B4.35E9CA1B@bullfrog-tech.com> <38FBE4DB.67289F42@mindspring.com> Message-ID: <20000418102817.J15664@xs4all.nl> On Tue, Apr 18, 2000 at 12:30:19AM -0400, Chuck Esterbrook wrote: > The situation with the Starship seems to reveal that: > [a] It's highly relied upon by the Python community (consider all the > modules people find at V of P that are really hosted on the Starship for > downloading). > [b] It's not well monitored and/or taken care of > [c] There is no suitable backup/contingency machine to switch over to. > How can the PSA change the situation to address [b] and [c]? I'd certainly > be willing to pay higher dues if that's what it took, but there may be > other ideas. Official mirrors ? I'd be willing to lobby for a starship (and python.org ?) mirror at XS4ALL (dutch ISP, where I work, so it shouldn't be too hard to arange) but it kind of depends on the needs for the starship website -- having different platforms it runs on might screw up the scripts that run there. Would having a data/webpage only mirror be sufficient ? -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From btang at pacific.jpl.nasa.gov Mon Apr 17 19:23:33 2000 From: btang at pacific.jpl.nasa.gov (Benyang Tang) Date: Mon, 17 Apr 2000 16:23:33 -0700 Subject: RE question Message-ID: <38FB9CF5.444457CF@pacific.jpl.nasa.gov> >>> m = re.match("([abc])+", "abc"); m.group(1) 'c' Why is it 'c', instead of 'a'? From aa8vb at yahoo.com Wed Apr 12 11:32:47 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 12 Apr 2000 11:32:47 -0400 Subject: Trouble with Tkinter under IDLE In-Reply-To: <8F13B1259anthonylander@47.80.11.122> References: <8F139460Canthonylander@47.80.11.122> <38F37BF9.DCAB3570@exceptionalminds.com> <8F13B1259anthonylander@47.80.11.122> Message-ID: <20000412113247.B2446939@vislab.epa.gov> Anthony Lander: |Looking through the Tkinter.py source, it seems that there is a variable |called _default_root which wants to be set to the default root window. Is |the normal procedure to check this variable and use it as the root window |if it's defined? No. By convention any module identifier that begins with an _ is private. Tkinter sets this internally. I believe idIf you create a widget and don't specify a parent, Tkinter takes it to be default_root. -- Randall Hopper aa8vb at yahoo.com From fredh at ix.netcom.com Wed Apr 5 02:25:59 2000 From: fredh at ix.netcom.com (Fred W. Helenius) Date: Wed, 05 Apr 2000 02:25:59 -0400 Subject: Why should I switch to Python? - Infinity of Primes References: <8ccoug$f4o$1@pegasus.csx.cam.ac.uk> <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> <38EA369C.26A1C25@math.okstate.edu> <38EAC8C4.ADC25640@cosc.canterbury.ac.nz> Message-ID: Greg Ewing wrote: >If someone actually came up with a formula for constructing >primes, it would be rather large news -- isn't that one of >the Big Unsolved Problems? Actually, many formulas for primes are known; the catch is that they are too inefficient for practical use, as the evaluation of the formulas covertly includes all the work to test many numbers for primality, or depends upon the use of a real constant that encodes all the primes. A few such formulas are exhibited at http://mathworld.wolfram.com/PrimeFormulas.html . The sci.math FAQ includes many additional references to formulas for primes, see http://www.cs.unb.ca/~alopez-o/math-faq/node36.html . -- Fred W. Helenius From tismer at tismer.com Sun Apr 2 10:52:12 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 02 Apr 2000 16:52:12 +0200 Subject: Debugging confusion -- too many stacks! References: <000a01bf9c6b$3f80c2a0$752d153f@tim> <38E739A1.45F4B199@tismer.com> Message-ID: <38E75E9C.7501756C@tismer.com> Hey, we forgot about a stack :-)) Michael Hudson wrote: > > Christian Tismer writes: > > > This VM stack could also be replaced by a set of registers, since > > the maximum stack size is always known at compile time. > > My gut tells me that making this work with exceptions would be a dog. I don't think so. Exception handlers have their own little stack in each frame. It is currently fixed to 20 items, wasting quite a lot of space most of the time (and this will vanish in Stackless "Heresy" 1.2), but it won't cause problems with a register machine. > It's the sort of thing that might be fun to play with if the compiler > and eval loop were written in Python, but if I have to hack C to play > with these things, it just becomes tedious. Still, maybe if I have a > month or two with nothing else to do... A while ago, I considered this, too. Meanwhile I don't, since it doesn't bear a very reasonable speed gain. The win would be to have less of the tiny operations occouring all the time, and to have less of stack pointer operations. But when looking closer to it, you will find that the most slowdown lies in the outmost interpreter loop, which checks for periodic things for every opcode, regardless wether it is very fast or a slow function call. In Stackless Python, I have stolen these cycles already. The eval loop has some internal shortcuts to avoid this many checks. The fast opcodes are all running as fast as possible, avoiding these checks. One could still save some jumps and some assignments, but this is not enough to justify the lots of changes that a register implementation would impose to other modules. It can still make sense to provide a hand-full of combined opcodes which have high frequency. jump_if_true combined with pop_top for instance, or some load/store combinations. If you have a proposal, and if you will support them through the bytecodehacks, I'd be happy to add them to Stackless Heresy. Thanks for reminding me of that extra stack :-) ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 we're tired of banana software - shipped green, ripens at home From moshez at math.huji.ac.il Fri Apr 28 00:56:08 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 28 Apr 2000 07:56:08 +0300 (IDT) Subject: Newbie Question In-Reply-To: Message-ID: On Thu, 27 Apr 2000, Arnaldo Riquelme wrote: > Suppose I have a file name tick.tkr that looks like this > > SUNW. > MFST. > FOO. > SPAM. > MOO. > End_Of_File > > I want to read the file into a list > > myfile = open("tick.tkr", "r") > mylist = myfile.readlines() > > Now I have mylist with the contents of tick.tkr. "mylist" looks like this > ['SUNW.\012', 'MSFT.\012', ..........'End_of_File/012'] > > How do I read the file into a list without getting the newline character, so > I can accomplish this > > for tic in mylist: > #create file tic.prn > > I know the other P language has something like 'chop' or something like > that, but I'm not going there. Try "string.strip". In your case, it should do fine. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From tim_one at email.msn.com Thu Apr 6 02:09:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 6 Apr 2000 02:09:59 -0400 Subject: Why should I switch to Python? - Infinity of Primes In-Reply-To: Message-ID: <000601bf9f8e$bd31e780$ea2d153f@tim> [Harald Hanche-Olsen] > ... > Since this is a posted to a computer language group, after all, I > include my own simple implementation of the Sieve in Haskell: > > primes :: [Integer] > primes = 2 : ([3..] `except` composites) > > composites :: [Integer] > composites = flatten (map (\ p -> [p*p, p*(p+1)..]) primes) > > union :: [Integer] -> [Integer] -> [Integer] > xl@(x:xs) `union` yl@(y:ys) | x | x>y = y : xl `union` ys > | otherwise = x : xs `union` ys > > except :: [Integer] -> [Integer] -> [Integer] > xl@(x:xs) `except` yl@(y:ys) | x | x==y = xs `except` ys > | otherwise = xl `except` ys > > flatten :: [[Integer]] -> [Integer] > flatten ((x:xs):zz) = x : xs `union` (flatten zz) > > I wonder if someone can come up with an equally immediate solution > (i.e., a straight translation from the mathematical formulation) in > python? Hmm. Try out this one-liner Haskell defn, which is so pretty it *should* bring tears of joy to everyone's eyes : primes = sieve [2..] where sieve (p:rest) = p : sieve [n | n <- rest, mod n p /= 0] Within the last month or two I posted a Python version of that under subject "Fun w/ Lazy Streams". Given general machinery for supporting lazy streams (see the thread), the sieve example ended up looking like: def removemults(s, n): # s but without any multiples of n def notdivisible(i, n=n): return i % n return sfilter(s, notdivisible) def sieve(s): return Stream(s.head(), lambda s=s: sieve(removemults(s.tail(), s.head()))) primes = sieve(srange(2)) That's approximately as irritating as it is in Scheme, were laziness also needs to be faked. > Indeed, I would be tempted to say that Haskell is better suited for > learning (some kinds of) mathematics than python. > > but-I-wouldn't-dare-say-so-in-comp.lang.python-ly y'rs, I would -- I've often recommended Haskell here. Learning to think in a purely functional way is really helpful, right up until it get counterproductive . if-god-intended-us-to-use-functional-languages-he-wouldn't-have- created-guido-ly y'rs - tim From dworkin at ccs.neu.edu Wed Apr 5 18:56:22 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 05 Apr 2000 18:56:22 -0400 Subject: was Re: Why should I switch to Python? In-Reply-To: m.faassen@vet.uu.nl's message of "2 Apr 2000 18:16:14 GMT" References: <1EeF4.43$CA.2422@news> <38E618D7.A15F9D9B@webwitches.com> <8c82pe$pf0$2@newshost.accu.uu.nl> Message-ID: m.faassen at vet.uu.nl (Martijn Faassen) writes: > > Emacs allows for multiple windows on multiple displays. > How do you do this? I wanna know! I'm not sure about FSF Emacs, but under XEmacs the function `make-frame-on-display' may get you going in the right direction. -Justin From thomas at xs4all.net Mon Apr 17 03:49:59 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Mon, 17 Apr 2000 09:49:59 +0200 Subject: Python w/ SSL In-Reply-To: <38FA3450.1DD845B2@flashmail.com>; from exarkun@flashmail.com on Sun, Apr 16, 2000 at 09:44:48PM +0000 References: <38FA3450.1DD845B2@flashmail.com> Message-ID: <20000417094959.F15664@xs4all.nl> On Sun, Apr 16, 2000 at 09:44:48PM +0000, Jp Calderone wrote: > Can anyone point me to an *up to date* Python/SSL interface? I've > found about 4 w/ search engines, but the most recent is from 1996 and > has a link to Python 1.3 in case you are without an interpreter ;) > (It also doesn't help that starship is still down - again :( ) Python 1.6's socket library has direct support for SSL (if you enable this, during compilation. It requires OpenSSL) and modules like urllib and httplib use this to provide SSL connections, too. I'm not sure if there's a seperate patch for 1.5.2, though, but perhaps you can give 1.6a2 a shot ? ;-) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From aahz at netcom.com Tue Apr 4 16:42:45 2000 From: aahz at netcom.com (Aahz Maruch) Date: 4 Apr 2000 20:42:45 GMT Subject: Advice requested: GUI project beginning References: <38E97E29.2687864D@acm.org> Message-ID: <8cdk45$ts9$1@nntp9.atl.mindspring.net> In article , Jim Richardson wrote: >On Tue, 04 Apr 2000 05:31:14 GMT, > Robert W. Cunningham, in the persona of , > brought forth the following words...: >> >>Programming? Telescope control? Doesn't this thread belong in a Forth NG? >>I mean, wasn't Forth CREATED to control a telescope? > >hm, I thought that was Algol? Nope, Forth. -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of cigarettes, it's dark, and we're wearing sunglasses." "Hit it." From dalke at acm.org Sun Apr 9 00:12:33 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 8 Apr 2000 22:12:33 -0600 Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> Message-ID: <8covpn$4jq$1@slb6.atl.mindspring.net> I wrote: >Nick Maclaren wrote >> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0) >> [...] >How about > x = getattr(a, "weeble", 0) + getattr(b, "wombat", 0) My code, BTW, is wrong. I didn't see the "[i]" part of the original expression. To my view of things, this means the expression is too complex. You asked about other idioms. You could have a class wrapper for accessing elements, like: class SpecialLookup: def __init__(self, container, attr, default = 0): self.container = container self.attr = attr self.default = default def __getitem__(self, i): if self.container is None: return self.default return getattr(self.container[i], attr) new_a = SpecialLookup(a, "weeble") new_b = SpecialLookup(b, "wombat") x = new_a[i] + new_b[i] For slightly better performance, you could even create a special __getitem__ for empty containers so the check for a None container is only done ones. Andrew dalke at acm.org From claird at starbase.neosoft.com Sat Apr 1 11:07:16 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 1 Apr 2000 10:07:16 -0600 Subject: was Re: Why should I switch to Python? References: <1EeF4.43$CA.2422@news> <38E618D7.A15F9D9B@webwitches.com> Message-ID: <05AB7F747D3FC9FA.FF1C6A9D99274EAE.D8581C4B2696A7E4@lp.airnews.net> In article <38E618D7.A15F9D9B at webwitches.com>, Shae Erisson wrote: . . . >maybe a newsgroup bot that finds common text patterns and posts FAQtual >replies? . . . Comp.lang.tcl does this, by the way; a bot emits to first-time posters. There is discussion now about refinements involving multi-posting, posts that mention "newbie", automated answers to common questions, ... We're thinking as seriously as possible about how to send it out *before* they first ask for it ... -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From ng at hardlight.couk.com Sat Apr 22 09:27:57 2000 From: ng at hardlight.couk.com (.:|:.) Date: Sat, 22 Apr 2000 14:27:57 +0100 Subject: code not true? References: <8ds3ku$q0l$1@nnrp1.deja.com> Message-ID: <3901aa0f.0@news.proweb.co.uk> interestingly enough on both Win32 and Linux >>> a = 0.07 * 100 >>> a 7.0 >>> a == 7.0 0 >>> int(a) == 7 1 >>> type(a) >>> type(7.0) >>> (0.7 * 10) == (0.07 * 100) 0 >>> (0.07 * 10) == (0.007 * 100) 1 >>> (0.07 * 100) == (0.007 * 1000) 0 >>> (0.07 * 1000.0) == (0.007 * 10000.0) 1 From mskott at image.dk Tue Apr 25 14:36:32 2000 From: mskott at image.dk (Martin Skøtt) Date: Tue, 25 Apr 2000 18:36:32 GMT Subject: Working with data returned by PyGreSQL Message-ID: Hi I have finally installed the PyGreSQL module and it works fine (I can do connects and querys). My problem is how do I get to anything other than print my query results? What datatype does the query return? I would prefer if it came out in either a list or a dictionary (for my current project I only need strings but a dictionary might be needed later). I know the DB-API compliant Postgres module is in beta but has any one tried and to which extent does it work? -- Martin Sk?tt mskott at image.dk 'In a certain sense, all decent programming languages are equally powerfull' Dr. Alan Turing From tismer at tismer.com Sun Apr 2 08:14:25 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 02 Apr 2000 14:14:25 +0200 Subject: Debugging confusion -- too many stacks! References: <000a01bf9c6b$3f80c2a0$752d153f@tim> Message-ID: <38E739A1.45F4B199@tismer.com> Tim Peters wrote: > > [Jason Stokes] > > I'm confused about the difference between the C stack, the Frame > > stack, and the stack *inside* each execution frame. > > The difference between the first two is an artifact of the current > implementation; indeed, getting rid of the distinction is the major point of > Christian Tismer's "Stackless" Python variant (where "less" refers to > getting rid of the C-stack component). Yes, at first "less" referred to getting rid of the C stack. Later, I realized that the resulting tree (see below) is no stack at all, since it can now be modified at any point. > > From reading the source, I believe that each new code object gets a new > > frame allocated on the frame stack, > > Each *invocation* of a code object, yes; and, e.g., if a function calls > itself recursively, there's only one code object but a separate frame for > each call level. Meanwhile, functions feel to me a little like classes, and frames are their instances. > Note that in CT's Stackless Python, the frames actually form a tree > (although at any leaf, the path back to the root is unique and can be viewed > as a stack). My current view is like chains, paths, with a common root. These paths are the default sequence when an explicit or implicit return is executed. "returning" from a function instance is to move one step towards the common chain root. "calling" a function is to extend the current chain by appending a new function instance. The other important role of these paths are the responsibility for exceptions. This hierarchy is upside down: The closest function instance is consulted first about exception handlers. This has a bit of similarity to inheritance in classes, but just a little: We have a dynamic chain of instances which propagate exceptions, but the behavior is only like single inheritance. > > within which is stored all kinds of useful information about the > > context the code is executing in -- the global and local environment, > > a tuple of constants, a tuple of arguments etc. *Within* each frame > > is *another* stack, upon which the Python virtual machine loads and > > manipulates intermediate values. > > This is another artifact of the current implementation, and is best viewed > as an internal detail of no visible consequence. This VM stack could also be replaced by a set of registers, since the maximum stack size is always known at compile time. > > However, I'm not sure what the terminology is to refer to this > > third stack. > > "The frame's eval stack" works for me . > > > Understanding the distinction seems to be vital to using pdb, though. > > I don't use pdb much, but don't see why this would be true. The frame's > eval stack is invisible, and the C and frame stacks happen to be intertwined > one-for-one today because a Python call happens to invoke the interpreter > recursively (at the C level) today. Conceptually, there's only one stack > involved in calls. > > Perhaps you could be specific about what in pdb is confusing you, and > someone who uses it could straighten it out. Personally, I prefer to use the Visual Studio debugger. Debugging is still not easy with any debugger, since you always have a hard time to se what's in an object. Almost all source code uses the general object interface, and especially the eval loop does so. To figure out what type an object actually is and what it contains, is quite difficult. In Visual Studio, you can set up some watches with typecasts. That helps for frames (but not their stack), integers, and seeing the size of lists and tuples. To see the contents of variable sized objects like strings, you need to add watches like ((char*)v+20) or do proper casts like (PyStringObject*)v and then open the structure (which takes more time). Inspection of other dynamic objects is much harder, since there is no built-in support for them like with strings. One very useful watch for eval_loop is this: Cast the current frame in a way that you can see the name of the running Python function. The following watches are always active when I'm debuging: (are there similar ways to do this with PDB?) (char*)(f->f_code->co_name)+20 # current function name (char*)(f->f_code->co_filename)+20 # current file name f->f_lineno # line number In order to see which frame is calling you, do the same, but replace "f" by "f->f_back". Well, as a last hint, how do I find a certain place in my Python code? The trick is this: Use a seldom used opcode and set a breakpoint. I prefer to use "BINARY_LSHIFT". Put a line like "1 << 42" into your Python script, right before the place you want to debug. You will find yourself at the BINARY_LSHIFT breakpoint, just a few opcodes apart from your place, and it is easy to single step until you are there. What I really wished were a way to extend a given debugger with your own support code, to make PyObjects more visible. cheers - chrs -- Christian Tismer :^) Applied Biometrics GmbH : 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 we're tired of banana software - shipped green, ripens at home From robin at alldunn.com Tue Apr 18 16:47:53 2000 From: robin at alldunn.com (Robin Dunn) Date: Tue, 18 Apr 2000 13:47:53 -0700 Subject: can someone tell me about... References: <38FCBB16.BF50EB03@stsci.edu> Message-ID: > Interactively, python will recognize a variable name that begins with > one underscore (_myVar). The variable naming rules even say that is > acceptable. > > However, when I try to use it in a module, it bombs. > When you say "use it in a module" do you mean like this: from the_module import * print _myVar If so then that is normal as names begining with an underscore are not imported with the *, (it's a way to help prevent namespace pollution.) On the other hand, this should work: import the_module print the_module._myVar -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From m.faassen at vet.uu.nl Sat Apr 22 10:11:33 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 22 Apr 2000 14:11:33 GMT Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> <22042000.2@sanctum.jae.ddns.org> Message-ID: <8dsbul$n1o$1@newshost.accu.uu.nl> Juergen A. Erhard wrote: > Neel> Seriously, the rejection of altruism as a possible motive strikes me > Neel> as a very reasonable decision. Altruism is generally not sufficient > Neel> motive in other aspects of life -- [...] > Same goes for egoism... see below. Not as much. See below. > Neel> Second, economists assume that everyone is basically self interested, > Neel> including themselves -- it's a standard analytic assumption, not > Neel> snobbery. > But it is not just a `basic analytic assumption' in most cases... most > people in the field, as you yourself have stated above, have > `internalized its assumptions'. Now, you could argue that you didn't > mean it like *that*... but my impression of people in that field of > science[1] is that the *did* indeed internalize this... which means > that *everything*, ever single point of data that goes into an > analysis, into a study, is colored and filtered by this worldview. But the assumption that people are selfish makes quite a bit of biological sense. The whole theory of evolution, selfish genes, limited resources, and so on. Then of course kin selection and even more importantly, game theory, come and throw lots and lots of mud in the water. Biological conclusion: our genetic core is selfish, but selfish behavior, especially in social, intelligent beings like humans, may entail so much cooperation and altruism that it's indistinguishable from the real thing (if there *is* any more real form of cooperation than that for selfish reasons -- if you're cooperating out of altruistic reasons, i.e. you're losing by cooperating, is that cooperation or slavery?) And economics is a field that thinks about game theory, like theoretical biology. Theoretical economics and theoretical biology have lots in common, though theoretical biology does focus more on the creative aspects of the process more than economics; economics are interested in the process of itself, optimizing that, while biologists in the end are interested in the outcome of the process (things like elephants, humans and trees), and why they happened. [snip] > No, I think (and this thought just occurred to me, so it's pretty > fresh) that there's a third thing... it's the answer to the old > question asked of a mountaineers: "Why did you climb that mountain?". > "Well... because it was there." Or, in other words, "because I had > to".[4] That's an interesting distinction; I think that maps to what theoretical biologists are interested in; complexity and life in the world is driven by natural selection, but that's not the only thing. There has to be some mathematical structure to the whole process that allows the complexity to happen. Though perhaps that's an anthropic point of view. > Egoism is often equated with the profit motive these days (little > wonder in our money-based society...[2]) > Now this is a nice explanation for many things... but not for all. > I'm certain that the greatest thinkers, the greatest musicians, > artists... the greatest innovators were *not* motivated by that... But they were hardly being so interested in their field of interest because they hated it. See my finishing note. [why did Einstein do it?] > Well, I think because he *had* *to*. [snip] > I think this can be compared to egoism and altruism like this: > Egoism is "I get something". > Altruism is "`They' get something". > Xyzzy (for lack of a name[3]) is "I get *rid* of something". Or "I > get something of my chest". No, xyzzy is "I am." The creative individual does this because that individual is *defined* by what he does. "This is ME." "Hello world." Interesting analysis. This belongs in the field of psychology at least for a large part, though. [snip] > [4] I'm sure someone has found some weird explanation that makes this > something egoistical... They have. According to some, this expression of selfhood is the most egoistic thing one can possibly do. Also the most valuable, as value to the individual is measured by that individual, in the end. But of course there is quite a bit of societal value derived from it. The world is a complicated, messy thing, and any attempt at explanation is by necessity partial. So biology, economy, psychology and so on do need to work with some basic assumptions, otherwise they'll never get any abstractions off the ground. So let's forgive the economists in this case. They discounted some important things a bit easily (the shared commons that improves faster than the partitioned one). The economics of informational products does differ significantly from that of physical goods. But they had some interesting things to say, and an interesting toolkit they brought for their analysis. An off topic thread that I can contribute lots of deep sounding stuff to! I didn't know enough about mathematics to contribute to that infinity of primes one. Ah, but philosophy, ah! :) Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From kaeber at gmd.de Mon Apr 3 15:24:32 2000 From: kaeber at gmd.de (Joachim Kaeber) Date: Mon, 03 Apr 2000 21:24:32 +0200 Subject: Creating variables on the fly... References: Message-ID: <38E8EFF0.D71D0415@gmd.de> Hi, what about this: def add(*args): sum=0 for arg in args: sum=sum+arg return sum add(1,2,3,4) => 10 add (1,2,3,4,5,6,7) => 28 Matthew Hirsch wrote: > > Hi All, > > Let's say I have four variables: > > a=1 > b=2 > c=3 > d=4 > > And I have a function that adds these variables together: > > def add(a,b,c,d): > return a+b+c+d > > But now let's say I have twenty variables that I want to add together. > This function will no longer work. I would have to rewrite it as > a+b+c+d+e+f+g+...+(20th letter). Is there a way to dynamically create a > variable name? So that my add function can automatically determine how > many variable names to create and then add the values together. In > other words, I'd ideally like something like: > > def add(number_of_variables): > return a+b+c+...+(letter corresponding to number_of_variables) > > Thanks for your help, > > Matt -- Joachim Kaeber (kaeber at gmd.de) (http://imk.gmd.de/~kaeber) GMD - Forschungszentrum Informationstechnik GmbH - German National Research Center for Information Technology Schloss Birlinghoven email: kaeber at gmd.de D-53757 Sankt Augustin 1, Germany phone: (+49 2241) 14-2546 From zessin at my-deja.com Fri Apr 7 04:51:20 2000 From: zessin at my-deja.com (Uwe Zessin) Date: Fri, 07 Apr 2000 08:51:20 GMT Subject: Odp: Python on Alpha OpenVMS References: <_KCD4.2797$a01.54385@news.tpnet.pl> Message-ID: <8ck7i4$20p$1@nnrp1.deja.com> In article , Ian Parker wrote: > In article <_KCD4.2797$a01.54385 at news.tpnet.pl>, Tomek Lisowski > writes [...] > >I am just not sure, for which platform were these modules compiled, > >and for which version of OpenVMS system Tomek, I thought that is clearly described on the page that Ian has mentioned... > Tomasz > > I'm glad to say that the VMS objects worked perfectly on both Alpha > and VAX VMS systems. They're both V7.x - I didn't bother to check > specific version numbers. I develope on OpenVMS VAX V6.1 - there are currently no features beyond that version. Given OpenVMS?s good upward compatibility I am not that much surprised ;-) [...] > I'm really impressed with the OpenVMS port (Uwe, please keep up the > good work!). Thanks. That?s encouraging... > Only one qualification, at the moment I think the objects don't > support threading, but haven't really investigated yet. That is correct. I haven?t done much in this area yet, however I have received very value feedback for the next release (sorry, no date, yet). I am sure you won?t be disappointed, though... Please remember that you need to recompile everything for thread support and you might have to do some changes for OpenVMS V7 and up. -- Uwe Zessin Sent via Deja.com http://www.deja.com/ Before you buy. From zorro at zipzap.ch Wed Apr 26 07:25:54 2000 From: zorro at zipzap.ch (Boris Borcic) Date: Wed, 26 Apr 2000 13:25:54 +0200 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> Message-ID: <3906D242.EB68BFED@zipzap.ch> Robin Becker wrote: > > I'm afraid your desire for a better world reduces your altruism > quotient. > Doing it because it helps others is altruism, doing it to help your self > and or relatives isn't really. This comment can be made irrefutable, provided you *define* "self and relatives" as the beneficiaries of ("pseudo") altruism. Reciprocally, altruism may be defined as the action of paradoxical definitions of self. Paradoxical - means it conflicts with the choices that follow from other, more common, definitions of self, that make the term "selfish" determinate. Language that postulates a unique applicable definition of self from the start, is thus inadequate to an enlightened discussion of altruism, imho. BB -- "I think as I think, therefore I am who I am" From greg at perceval.be Wed Apr 26 03:32:02 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Wed, 26 Apr 2000 09:32:02 +0200 (CEST) Subject: HTML type form? In-Reply-To: <003301bfaec2$c4529c60$2801000a@iel.ie> Message-ID: In reply to the message of Shaun sent on Apr 25 (see below) : hummm, it is absolutly unsave to record Credit card numbers... :) -- Life is not fair But the root password helps -- Gregoire Welraeds greg at perceval.be Perceval Development team ------------------------------------------------------------------------------- Perceval Technologies sa/nv Tel: +32-2-6409194 Rue Tenbosch, 9 Fax: +32-2-6403154 B-1000 Brussels general information: info at perceval.net BELGIUM technical information: helpdesk at perceval.net URL: http://www.perceval.be/ ------------------------------------------------------------------------------- On Tue, 25 Apr 2000, Shaun wrote: > Date: Tue, 25 Apr 2000 15:30:12 +0100 > From: Shaun > To: python > Subject: HTML type form? > > > how would i create a HTML type user interface using python which would take > in say, -name-address-credit card number- and record it with the intention > of struct.pack-ing the values entered, > thanks > Shaun > ===================== > Shaun Hogan > Interactive Enterprise Ltd. > alt. E-mail : shaun_hogan at yahoo.com > +353 86 8342529 > > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From scarblac-spamtrap at pino.selwerd.nl Wed Apr 12 13:52:30 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 12 Apr 2000 17:52:30 GMT Subject: global variables - how?? References: <8d2bne$qn7$1@news101.telia.com> Message-ID: Anders Eggers-Krag wrote in comp.lang.python: > how do I define a propper global variable that works in all functions in all > modules? You can't. A global variable can be accessed everywhere in its module, but not in all modules. You can import the module with the variable and use it that way in other modules though. -- Remco Gerlich, scarblac at pino.selwerd.nl Murphy's Rules, "Triple time! Triple time!": In Avalon Hill's Squad Leader, an infantryman carrying a flamethrower can run at 25 mph along a road, providing a sergeant or other leader is encouraging him. From smalleys at gte.net Wed Apr 19 22:51:50 2000 From: smalleys at gte.net (sue) Date: Thu, 20 Apr 2000 02:51:50 GMT Subject: pattern-based string expansion References: <38F52C61.A5D72F89@gte.net> <8del87$5md$1@slb6.atl.mindspring.net> Message-ID: <38FE70DB.29A4B1A1@gte.net> I'm not looking for all possible strings with a wildcard, just a pseudo-RE-based expansion. The RE would not support open-ended arguments (* or +), but would have ?,[] and so on. The expansion needs to be ordered. I've thought about hacking the glob(3) code to work on an input RE, but I was hoping this already existed somewhere. I have csh scripts which generate a set of strings, and then operate on the string sets. (The strings are NOT filenames, csh doesn't actually care.) I'd like to move them over to Python, but until I can get expansions, I'm stuck. I didn't see an expansion utility in "Understanding REs". Everything I've seen so far is focused on matching or reducing strings. Sue. From maybe at lucky.com Mon Apr 10 05:23:08 2000 From: maybe at lucky.com (Soundwave) Date: Mon, 10 Apr 2000 11:23:08 +0200 Subject: check EOF Message-ID: <8cs6g4$rje$1@porthos.nl.uu.net> how can I check EOF in python ??? From ivanlan at callware.com Mon Apr 24 22:59:54 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Mon, 24 Apr 2000 20:59:54 -0600 Subject: Tkinter References: Message-ID: <39050A2A.D71E9EFD@callware.com> Hi All-- Fredrik Lundh wrote: > > Daley, MarkX wrote: > > I am trying to use Tkinter for a GUI interface, but I am having a hard > time > > finding manuals for it. Is there documentation comparable to Python's? > > http://www.python.org/topics/tkinter/doc.html > While /F's documentation is invaluable, online and free, there are two other books which may help clarify the situation. 1) If you're at a beginning level, then I recommend the final 8 chapters of my _Teach Yourself Python in 24 Hours_. These are the eight chapters I wish had been available when I started using Tkinter. 2) If you're at a more advanced level, where the /F documentation doesn't cover enough, or not in enough depth, take a look at John Grayson's _Python and Tkinter Programming_. John's writing style is appealing, he covers the topics in admirable depth, and he gives clever and entertaining examples. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From effbot at telia.com Tue Apr 18 11:53:12 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 18 Apr 2000 15:53:12 GMT Subject: Tkinter items question References: <38fc7a7d@news2.sireco.de> Message-ID: Weil wrote: > def DeleteLastItem(self,event): > items = self.find_all() > if items: > self.delete(items[-1]) > > But, I was wondering, if there is a more direct way to > access the last item other than retrieving all items first. > I could of course keep a list of all created items myself, > but that seems a bit ugly, especially as my app couldn't > use this list for anything else. you don't want to keep track of the items yourself, and you don't want to use Tk's list of items? hmm... okay, how about storing a serial number as a tag. when you create a new object, do something like: self.serial = self.serial + 1 tag = "item%d" % self.serial self.create_item(..., tags=tag) and tag = "item%d" % self.serial self.delete(self.serial) serial.serial = serial.serial - 1 you'd probably consume less memory by storing a list of int(handle)'s, but that's another story. From aquarius at kryogenix.albatross.co.uk Tue Apr 18 20:53:43 2000 From: aquarius at kryogenix.albatross.co.uk (Aquarius) Date: 19 Apr 2000 01:53:43 +0100 Subject: Telnet client using curses Message-ID: <8dj02n$61k$1@kryogenix.yi.org> Having used Python for a few brief scripts (the sort of thing I used to use Perl for :), I thought I'd try something a bit more ambitious, to teach myself the language. What I decided on, because I need one, is a telnet client. The key thing is that I'd like to use curses to give me one input line into which text it typed, while data returned from the connection goes into the window above. Something like TinyFugue. Looking at telnetlib, it uses select to poll stdin. However, I'll be getting user input using curses input functions, not input() or raw_input(), so the user input doesn't go into stdin. Is the best way to handle this: 1. get user input with the curses function and then somehow slip this input into stdin, so it looks like it came from raw_input() or whatever? Obviously, raw_input() gets its data into stdin, but it's a built-in function, so I don't know how it does it :-) 2. write a file object which I feed data *into* from the curses input function, and which then feeds that data back out when requested to do so, and poll *that* instead of stdin? 3. A better solution? If your answer is "3", some kind of suggestion as to the Right Way to do it would be appreciated :-) Aquarius -- Well *done*, Aquarius -- a phrase we love typing because it makes us feel like the boss-character from a 1980s Glen A Larson action series... NTK, http://www.ntk.net/index.cgi?back=archive99/now0618.txt&line=292#l From rwiserREMOVEthis at mindspring.com Wed Apr 12 18:55:14 2000 From: rwiserREMOVEthis at mindspring.com (Randy Wiser) Date: Wed, 12 Apr 2000 22:55:14 GMT Subject: Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20? References: <200004120650.QAA22353@nexus.csse.monash.edu.au> Message-ID: <38f4fc63.3036292948@news> On Wed, 12 Apr 2000 16:50:52 +1000 (EST), Jonathan Giddy wrote: >Anyway, my (non-)solution was to redesign my code to wait from the same >thread as the fork(). If you can't move the waitpid() into the main thread, >maybe you can move the fork() into the second thread. > >Jon. > Thanks! I tried your suggestion and it seems to work fine on Linux for now (should work on Solaris as well). I heard a rumor that this Linux feature will be changed to be more like other UNIXs in the future? - Randy From gmunsey at adobe.com Sun Apr 23 22:02:21 2000 From: gmunsey at adobe.com (Grant Munsey) Date: Sun, 23 Apr 2000 19:02:21 -0700 Subject: Anyone generating SWF content with Python? Message-ID: Is anyone out there generating Shochwave Flash (swf) format files from Python? From hniksic at iskon.hr Wed Apr 12 07:05:55 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 12 Apr 2000 13:05:55 +0200 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> Message-ID: tom__98 at my-deja.com writes: > -- How can I browse the Python documentation without firing > up a web browser? By using Info. That's what I do, all the time. Info has the added nicety of being able to search through the whole documentation for a keyword. > function or class quickly? Is there any equivalent of > "perldoc -f split" or "perldoc Net::POP3"? For the latter, I use `info python-lib' followed by `g poplib RET'. From jmassung at magpiesystems.com Wed Apr 26 16:02:15 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Wed, 26 Apr 2000 14:02:15 -0600 Subject: global variables or inheritence References: <28p8zy0irgc.fsf@lada.kom.auc.dk> Message-ID: Sorry if I get this wrong... but I thought you'd just import your other file. Example: # File1.py myVar = 2 # File2.py import File1 print File1.myVar #should print 2 Jeff Thomas Rasmussen wrote in message <28p8zy0irgc.fsf at lada.kom.auc.dk>... >Hi > >I have quite a big problem. I have two different files, where I in one >file want to declare a variable and then in the other file be able to >access and use this variable (no need to change it), but I just can't >seem to get it to work... Is there any nice way of doing this easily? >I have tried the global var but this doesn't seem to work. > >Anyone got a good idea? > >Thomas >-- >KOM Network student helper > >"To alcohol! The cause of - and solution to - all of life's problems!" >-- Homer Simpson From python-list at teleo.net Tue Apr 4 13:10:05 2000 From: python-list at teleo.net (Patrick Phalen) Date: Tue, 4 Apr 2000 10:10:05 -0700 Subject: Starving for an Advanced Python Book In-Reply-To: References: <20000404040941.7766.qmail@web2106.mail.yahoo.com> Message-ID: <00040410183100.05408@quadra.teleo.net> [Don Tuttle, on Tue, 04 Apr 2000] :: "lewst" :: >ORA's "Programming Python" is a natural choice, but I :: > can't bear buying this outdated book when the 2nd edition is due out :: > in a few months (I'm dying here Lutz, hurry it up already!). :: :: I went ahead and bought it because Oreilly's cheif editor says, "We're :: timing the new edition of Programming Python to follow shortly after the :: release of Python 2.0."(aka Python 3K). If that turns out to be the case, :: it won't published until sometime in 2001. See his complete (and somewhat :: dated) remarks at http://www.oreilly.com/frank/python.html I'd also suggest going ahead with a purchase of Programming Python. If you're starving, this food isn't exactly rancid. It's an excellent book still, despite its age. People have criticized its organization, which is probably due to the fact that it is really more a textbook than a reference book. IOW, if you start at the beginning and "do" the whole text, you'll be exposed to nearly the full range of Python functionality, but it can be frustrating to try to zero in on something pertinent to your immediate problem domain. Do, however, check out the errata on the Web site and mark them in the book. I haven't seen anyone mention The Quick Python Book in this thread. Also worth having on your bookshelf. From richard_chamberlain at ntlworld.com Sat Apr 29 04:20:32 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Sat, 29 Apr 2000 09:20:32 +0100 Subject: ODBC / DBI help (via Win32 Extensions) References: Message-ID: Benjamin, I've set up a simple table with one field a date field and inserted into it okay. On your INSERT statement you had speech marks around the date so: '#12/15/00#' mycursor.execute('INSERT INTO Table1 (myDate) VALUES (#12/15/2000#)') I know that doesn't answer your question about dbiDates but you may not require that depending on where you're getting your date from. Richard You don't actually need those so it should be just #12/15/00#. My statement was Benjamin Schollnick wrote in message news:rNHvjEdhm5Pp-pn2-dzBINcOCBoWi at d185d18f2.rochester.rr.com... > On Sun, 29 Apr 3900 04:49:53, "S. Hoon Yoon" wrote: > > > I think that's because you should use format #date# on update. Unless, I did > > not understand your problems. > > That's really more of SQL and access convention rather than Python. > > Pls look at the docs for Access and SQL. > > > > UPDATE [BT Dates] SET [BT Dates].[date] = #12/12/2000#; > > > > This is what I get if I use Query wizard and you should follow it. > > Hope it helps, > > The real problem is that I can't find any documentation on the DBI > module... > > The pound convention I found out about... > Unfornately, I don't have my code with me... But...(From memory) > > sql_cmd = """ > INSERT INTO logfile (datetime, loglevel,, logdata) > VALUES ('#12/15/2000#', 1, 'test') > """ > # I've tried 12/15/00, 09/09/99, 09/09/1999, and a few other > # date variants.... > > # And as far as I can tell the ODBC execute command > # appends a semicolon? Or at least everything works > # without having me add one... > > If I attempt to execute that command, I get a SQL error from the ODBC > driver. > > If I remove the datetime field and just submit using the loglevel, > logdata > it works fine... (But that sort of defeats the purpose of a log > file....) > > The datetime field is setup in Access as a standard "Date/Time" > field, so I figure I might need to convert the datetime field into a > dbiDate > record, but as I mentioned I can't find any instructions on the fields > & > methods for the dbiDate field(s).... (I checked the Win 32 > documentation > without any luck). > > - Benjamin From johann at physics.berkeley.edu Tue Apr 25 14:23:23 2000 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 25 Apr 2000 11:23:23 -0700 Subject: new linereading standard? References: <3904D21B.333DD930@visionart.com> <390510C9.A744D22E@yahoo.com> Message-ID: Robin Becker writes: > am I wrong for writing > for line in open('myfile.txt').readlines(): > print line Of course not! Wrongness is such a relative thing that no one, especially inhuman compilers, clearly cannot judge it. If it seems right to you, that is all that matters. But seriously, I don't think there's anything wrong with that. It depends on what you're doing. You can get away with a lot of syntax crunching if what you're doing is basically simple. That code fits the basically simple criteria in my brain. In short, looks fine to me, and I do it a lot, when all I need from a file is a list of lines in order. ObComplexity: To go off on a wild tangent, this reminds me of the whole map/lambda functional programming fracas. See, I agree with most people that I don't really want to see code like map(lambda s: string.split(string.strip(s), ',')[0], open('data.dat').readlines()) I much prefer out = [] for s in open('data.dat').readlines(): fields = string.split(string.strip(s), ',') out.append(fields[0]) But, if I'm doing this at the interactive prompt, what I end up typing is most often something like: >>> lines = open('data.dat').readlines() >>> lines = map(string.strip, lines) >>> lines = map(lambda l: string.split(l, ','), lines) >>> out = map(lambda fs: fs[0], lines) So, basically, I find the functional stuff much more useful from the command line than I do from actual programs. I think of the right transform, then I apply it. Interesting. Heh. I'm free-associating here, please bear with me. Anyone else have this experience? --Johann -- Johann Hibschman johann at physics.berkeley.edu From pecora at anvil.nrl.navy.mil Sun Apr 30 10:14:01 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Sun, 30 Apr 2000 14:14:01 GMT Subject: Mac Python Questions References: Message-ID: <300420001014013701%pecora@anvil.nrl.navy.mil> In article , Jeff Massung wrote: > Okay, I've been looking all over the net and the documentation that came > with the MacPython distribution, but can't seem to find the answers to these > questions. Hopefully someone else out there on a Mac can help me out? > > a) There is a file In $(PYTHON):Mac:Contrib:... called PyColorEdit.py. Good > color editor. I would like to use that instead of PyEdit.py. Is there a way > to install the color one? Don't know about that one. > b) No matter what I do, I can't get Tkinter to work :(. Lately I'm led to > believe that the Mac version of Python doesn't use it, but uses the Mac > stuff instead. Is this the case? If not, how can I get Tkinter to work? > Whenever I run something that imports it, it dies on the line with the > comment "If this dies your computer might not be set up for tkinter". How > can I set up my machine for it? Thanks :) Here are two "answers" re: MacPython & Tk I culled from previous messages. Maybe they'll help. Also, you should tune into the PythonMacSIG (see: http://www.python.org/pipermail/pythonmac-sig/ and http://www.python.org/mailman/listinfo/pythonmac-sig. Good people hang out there who can give lots of answers. --------------------------------------------------- (1) Tk and setting the right Mac path Thanks to Ben Coburn and Richard Gordon I was able to get Tk to work on my mac. I fixed the problem by placing the following path's in the Python Preferences: $(PYTHON):Lib:lib-tk $(PYTHON):Extensions:Imaging:PIL Is there a reason that these two paths are not automatically set during the installation. I was a bit frustrated when I couldn't get through the example code in Chapter 1 of Learning Python (pg 23 has a Tk sample). (2) How to: Tk on Mac Programming graphical user interfaces (GUI's) with the Tk-toolkit and MacPython is easy and makes fun. But unfortunately if you try the simplest demo script with a fresh installed MacPython you will get the following error messages: Traceback (innermost last): File "MacHD:Python 1.5.2c1:Demo:tkinter:matt:animation-w-velocity-ctrl.py", line 1, in ? from Tkinter import * File "MacHD:Python 1.5.2c1:Lib:lib-tk:Tkinter.py", line 8, in ? import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter The reason therefore is a bug in the installer of MacPython1.5.2c1: It puts the shared libs ?_tkinter.CFM68K.slb? as well as ?_tkinter.ppc.slb? in the folder ?TK? which is in the folder ?Imaging? in the folder ?Extensions?. You have to put one of them (or both ) in the folder ?PlugIns? which is in the folder ?Mac?. And also the fresh standard installation has no path to ?$(PYTHON):Lib:lib-tk?, you have to add that manually with the program ?EditPythonPrefs?. Unfortunately there is also a bug within the interpreter. Calling ?Tkinter? from the interpreter interactivetely freezes them. You can only run Tk-based Python scripts by typing them in your editor and running them by dropping over the interpreter or saving them as Python files and starting them by doubleclick. And you never can run Tkinter based scripts from the IDE. But this behaviour is documented. From weil at sireconnect.de Thu Apr 20 11:01:29 2000 From: weil at sireconnect.de (Weil) Date: Thu, 20 Apr 2000 17:01:29 +0200 Subject: Tkinter items question References: <38fc7a7d@news2.sireco.de> Message-ID: <38ff1c2b@news2.sireco.de> Fredrik Lundh schrieb in im Newsbeitrag: Ix%K4.462$wYl.187476480 at newsb.telia.net... [snip] > okay, how about storing a serial number as a tag. when > you create a new object, do something like: > > self.serial = self.serial + 1 > tag = "item%d" % self.serial > self.create_item(..., tags=tag) > > and > > tag = "item%d" % self.serial > self.delete(self.serial) Shouldn't this read: self.delete(tag) ? Or am I getting something wrong? > serial.serial = serial.serial - 1 > > you'd probably consume less memory by storing a list of > int(handle)'s, but that's another story. That's right, I think. > Thanks a lot for your help. At least now I know it wasn't my fault I didn't find any 'last'-tag, automatically handled by Tk as for example 'current'. From parkw at better.net Tue Apr 4 12:37:12 2000 From: parkw at better.net (William Park) Date: Tue, 4 Apr 2000 12:37:12 -0400 Subject: Clear screen? In-Reply-To: <38eb6a36@207.71.36.3>; from artswan@ktc.com on Wed, Apr 05, 2000 at 11:33:03AM -0500 References: <38eb6a36@207.71.36.3> Message-ID: <20000404123712.A934@better.net> On Wed, Apr 05, 2000 at 11:33:03AM -0500, Art Swan wrote: > In Perl I can clear the screen using system("cls"). What is the > equivalent in Python? os.system("cls") :-) From bsb at winnegan.de Sun Apr 9 02:16:40 2000 From: bsb at winnegan.de (Siggy Brentrup) Date: 09 Apr 2000 08:16:40 +0200 Subject: tabular data In-Reply-To: poupaerte@my-deja.com's message of "Sat, 08 Apr 2000 20:26:20 GMT" References: <8co4l2$5r2$1@nnrp1.deja.com> Message-ID: <873dovhk8n.fsf@orge.winnegan.de> poupaerte at my-deja.com writes: > Hi > [...] > For example, say that I have the following tabular data: [(2,1,"REC02"), > (1,3,"REC03"),(3,1,"REC01")], and I want to obtain: [(1,3,"REC03"), > (2,1,"REC02"),(3,1,"REC01")], that is, the tabular data should be > sorted on the first and then the second column. > How can I have Python perform an in-place sort on a combination of > several columns? Simply use the list's sort() method, it does a lex sort: Python 1.5.2 (#0, Apr 3 2000, 14:46:48) [GCC 2.95.2 20000313 (Debian GNU/Linux)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> l = [(2,1,"REC02"),(1,3,"REC03"),(3,1,"REC01")] >>> l.sort() >>> l [(1, 3, 'REC03'), (2, 1, 'REC02'), (3, 1, 'REC01')] >>> l.append((1,2,'REC4')) >>> l.sort() >>> l [(1, 2, 'REC4'), (1, 3, 'REC03'), (2, 1, 'REC02'), (3, 1, 'REC01')] >>> # You may even specify a comparision function >>> l.sort(lambda a,b: cmp((a[1],a[0]),(b[1],b[0]))) >>> l [(2, 1, 'REC02'), (3, 1, 'REC01'), (1, 2, 'REC4'), (1, 3, 'REC03')] > By the way, should I represent rows by tuples or by embedded lists? See the thread "Tuples -- who needs 'en" [Gordon McMillan] | Lists are collections. The competing choice to a list is a | dictionary. Tuples are toy structs; the competing choice is a class. [...] Regards Siggy -- Siggy Brentrup - bsb at winnegan.de - http://www.winnegan.de/ bsb at north.de - http://www.north.de/~bsb/ ****** ceterum censeo javascriptum esse restrictam ******* From cut_me_out at hotmail.com Tue Apr 18 16:19:09 2000 From: cut_me_out at hotmail.com (Alex) Date: 18 Apr 2000 16:19:09 -0400 Subject: Split References: <38FCC20D.624AB2F6@searchy.net> Message-ID: > split = regsub.split(line,'\s+') > > how can I print only the 5th for example? print split[4] will probably do what you want. Alex. From embed at geocities.com Thu Apr 27 15:57:55 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 27 Apr 2000 15:57:55 -0400 Subject: Converting = to == Message-ID: I have an "end user query tool" that uses Python expressions, but I want comparisons to be able to be written either as A=B or A==B then I want to compare them using Python's Eval function. Problem is if you search and replace all = with == then users have to use the single-equals convention, and some of them will be python programmers, and will want to use the "non idiot mode" of the query tool. So i did this, but is there a better way? >>> string.replace( string.replace("a=b a==b", "=", "=="), "====","==") a==b a==b Warren From arcanedragonNOSPAM at NOSPAMhome.com Thu Apr 6 08:15:54 2000 From: arcanedragonNOSPAM at NOSPAMhome.com (Chris Herborth) Date: Thu, 06 Apr 2000 12:15:54 GMT Subject: [OT] Dr. Fun vs Guido Message-ID: <_d%G4.17632$9g4.526936@news5.giganews.com> Just in case nobody's pointed this out already, today's Dr. Fun cartoon (http://metalab.unc.edu/Dave/Dr-Fun/df200004/df20000406.jpg) is Python- related. :-) -- ----------========================================================---------- Chris Herborth, DNRC Holder of Past Knowledge Arcane Dragon -==(UDIC)==- BeOS hacker, Catharon Productions, Inc. http://www.catharon.com/ CTO, Next Generation Entertainment http://www.ngent.com/ From andrew at andrewcooke.free-online.co.uk Thu Apr 27 06:02:36 2000 From: andrew at andrewcooke.free-online.co.uk (Andrew Cooke) Date: Thu, 27 Apr 2000 10:02:36 GMT Subject: Metaclasses? References: <3905F4A0.2B39C705@darmstadt.gmd.de> <3906542D.62B94F17@darmstadt.gmd.de> Message-ID: <8e937n$f4p$1@nnrp1.deja.com> In article <3906542D.62B94F17 at darmstadt.gmd.de>, Robb Shecter wrote: > Michael Hudson wrote: [...] > Choice A: Have a smalltalk-like instance variable declaration. [...] > to say that I like "Choice A". I come from Java, and it did bug me a > bit that there was no one easy place to see what instance variables a > class has. It made understanding the XML parser source code harder, for > example. this doesn't really save typing - instead of typing self you have to type the local declaration. worse, this introduces extra syntax (after all, you still need "."). but more importantly, having "self" is good for the soul. in most other languages objects function in some "magical" manner. having self makes the mechanism clear - which is helpful both to newbies understanding OOP for the first time, and to fools like me that get easily confused when things happen behind their back... andrew ps it doesn't have to be "self", afaik - you could use just "s" to save key presses.... :-) Sent via Deja.com http://www.deja.com/ Before you buy. From grant at nowhere. Fri Apr 7 14:43:24 2000 From: grant at nowhere. (Grant Edwards) Date: Fri, 07 Apr 2000 18:43:24 GMT Subject: More about variables References: <3X3H4.16435$0o4.108310@iad-read.news.verio.net> <38ED017E.1E374737@bellatlantic.net> Message-ID: In article <38ED017E.1E374737 at bellatlantic.net>, Steve Holden wrote: > >> Why create named variables? > >> I always thought that having 20 lists saved more space than having one >> list of 20 lists. Maybe I'm wrong. > >First make it work. *Then* make it work better! That's an _extremely_ valuable thing to remember. And it seems to be something that many CSci graduates escape from college without learning. _Some_ of the engineering graduates have learned it, but not many. In practice you'll find that 1) Half of the time you'll discover what you thought you wanted wasn't really what you needed, so having something that does it smaller or faster is equally useless as something that does it bigger and slower. The sooner you get to that point the better off you are. 2) The other half of the time, you'll discover than something slightly bigger or slower is good enough, and time spent making it work better is best spend on something else. Taking these observations into account, a second good rule to remember is: First make it work. Then make something else work. ;) -- Grant Edwards grante Yow! I'm into SOFTWARE! at visi.com From artymiak at home.linuxapprentice.com Sun Apr 9 04:38:27 2000 From: artymiak at home.linuxapprentice.com (Jacek Artymiak) Date: Sun, 09 Apr 2000 08:38:27 GMT Subject: LinuxJournal Python Article Message-ID: Hi All, This is just to let you know that the links to code samples in my Python article published by LinuxJournal are working now. http://www2.linuxjournal.com/lj-issues/issue73/3946.html Enjoy! Jacek Artymiak ------------------------------------------------------------------- See how many people have registered at the Python Users Counter! http://www.wszechnica.safenet.pl/cgi-bin/checkpythonuserscounter.py ------------------------------------------------------------------- Autor/Dziennikarz/Konsultant - Author/Journalist/Consultant artymiak at safenet.pl, http://www.wszechnica.safenet.pl co-author: StarOffice for Linux Bible (IDG Books Worldwide, Inc.) http://www.amazon.com/exec/obidos/ASIN/0764533630/polskawszechnica ------------------------------------------------------------------- From bruce_dodson.nospam at bigfoot.com Sun Apr 9 18:15:37 2000 From: bruce_dodson.nospam at bigfoot.com (Bruce Dodson) Date: Sun, 9 Apr 2000 19:15:37 -0300 Subject: Python Language Support for ArcView GIS References: <38EFAC08.2A10932D@verecomm.com> Message-ID: A good thought, but as Reini pointed out, it doesn't yet qualify to go there. I hope the current license allows enough freedom that you won't feel too constrained in what you can do with it. Peter Kropf wrote in message <38EFAC08.2A10932D at verecomm.com>... >Just an FYI: You might want to consider moving AVPython to >sourceforge.net. The entire environment is designed for >various levels of open source development... From smalleys at gte.net Mon Apr 24 19:30:44 2000 From: smalleys at gte.net (sue) Date: Mon, 24 Apr 2000 23:30:44 GMT Subject: partial parsing? References: <8dvilp$88s$1@slb6.atl.mindspring.net> <8e10n7$rkl$1@slb3.atl.mindspring.net> <8e1ng0$4sao$1@uvaix7e1.comp.UVic.CA> Message-ID: <3904D93B.E47BBC89@gte.net> I think I remember a followup article in DDJ about a year later in their annual "Parsing" issue. Sue. From mwh21 at cam.ac.uk Wed Apr 26 09:45:16 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 26 Apr 2000 14:45:16 +0100 Subject: Metaclasses? References: <3905F4A0.2B39C705@darmstadt.gmd.de> <200004261201.IAA05678@zippy.init.com> Message-ID: Donald Beaudry writes: > quinn at hedono.ugcs.caltech.edu (Quinn Dunkan) wrote, > > Anyway, even if you could figure out the ambiguity problem, I don't > > think metaclasses would help you, bytecodehacks might. > > *If* bytecodehacks could help, metaclasses could be used to make > calling them neat and clean. The idea is that during class > instantiation the metaclass would, using bytecodehacks, rewrite all of > the class's methods. This might confuse the poor guy who comes along > and tries to derive a new class from one of these 'self less'. What, like this? :-) This has recieved light testing only, so be suitably careful. deadline-on-Tuesday?-no-I-must-have-imagined-it-ly y'rs Michael from bytecodehacks.code_editor import Function from bytecodehacks.ops import * import types def rewrite_method(meth,attrs): f = Function(meth) code = f.func_code cs = code.co_code code.co_varnames.insert(0,"self") code.co_names.insert(0,"self") i = 0 while i < len(cs): op = cs[i] if op.__class__ in [LOAD_FAST,STORE_FAST,DELETE_FAST]: op.arg = op.arg + 1 if (op.has_name_or_local() and op.name in attrs and op.__class__ not in [LOAD_ATTR,STORE_ATTR]): if op.arg < code.co_argcount: raise ValueError, "parameter also instance member!" if op.__class__ in [LOAD_FAST, LOAD_NAME, LOAD_GLOBAL]: attrop = LOAD_ATTR else: attrop = STORE_ATTR cs[i:i+1] = [LOAD_FAST(0),attrop(op.name)] i = i + 2 else: i = i + 1 code.co_argcount = code.co_argcount + 1 return f.make_function() class SelflessClass: def __init__(self,name,bases,ns): self.__name__ = name self.__bases__ = bases self.__namespace__ = ns if ns.has_key('__attrs__'): attrs = ns['__attrs__'] for k,v in ns.items(): if type(v) is types.FunctionType: ns[k] = rewrite_method(v,attrs) def __call__(self): return SelflessInstance(self) class MetaMethodWrapper: def __init__(self, func, inst): self.func = func self.inst = inst self.__name__ = self.func.__name__ def __call__(self, *args, **kw): return apply(self.func, (self.inst,) + args, kw) class SelflessInstance: def __init__(self,klass): self.__klass__ = klass try: init = self.__klass__.__namespace__["__init__"] except: pass else: init(self) def __getattr__(self, name): try: value = self.__klass__.__namespace__[name] if type(value) is types.FunctionType: return MetaMethodWrapper(value,self) else: return value except KeyError: raise AttributeError, name Selfless = SelflessClass("Selfless",(),{}) class MyClass(Selfless): __attrs__ = ["a"] def __init__(): a = 1 def get_a(): return a def set_a(newa): a = newa -- If i don't understand lisp, it would be wise to not bray about how lisp is stupid or otherwise criticize, because my stupidity would be archived and open for all in the know to see. -- Xah, comp.lang.lisp From breiter at usf.Uni-Osnabrueck.DE Thu Apr 20 09:30:59 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 20 Apr 2000 13:30:59 GMT Subject: Mac Python Questions References: <38FE8032.DE233C29@cosc.canterbury.ac.nz> Message-ID: <8dn0qj$8gt$1@newsserver.rrzn.uni-hannover.de> In article <38FE8032.DE233C29 at cosc.canterbury.ac.nz>, Greg Ewing writes: > Jeff Massung wrote: >> >> b) No matter what I do, I can't get Tkinter to work :(. > > Neither can I, and from what I've seen here, neither > can anyone else. Tkinter just seems to be broken on > the Mac at present. Well it works for me here. Little tests and the demo run fine with the distribution I got for the Mac. (It tell you python 1.5.2c, but it is supposed to be a 1.5.2) Here is some exerpt of my correspondence with Jack Jansen: | > Tk was not installed correclty, import Tkinter after import _tkinter | > failed. I had to add Lib:lib-tk to the Python Configuration. | | This is a known bug in this distribution. And unfortunately this | distribution has suffered quite some delays, so that by the time this | problem surfaced it had become pretty much impossible to do a new one, | as my sources had progressed quite a bit beyond 1.5.2. The fix is to | either move _tkinter from Extensions:img to Plugins, or to add the | folder where _tkinter lives to sys.path with EditPythonPrefs. Bernhard -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) From michael.stroeder at inka.de Thu Apr 20 07:30:12 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 20 Apr 2000 13:30:12 +0200 Subject: socket.SO_REUSEADDR Message-ID: <38FEEA44.6C05E2B0@inka.de> HI! For avoiding problems with errors like socket.error: (98, 'Address already in use.') during immediate restart of my web server I'm following the hint to set the socket option SO_REUSEADDR. But I did not succeed. The server starts and works. When I stop it and try to restart immediately the above message appears again. I had a short look at man 7 socket and man setsockopt but this was a little bit too much for me... Ciao, Michael. My code looks like this: ------------------------ bite here ------------------------- class MyHTTPServer(SocketServer.TCPServer): def server_bind(self): """Override server_bind to set socket options.""" self.socket.setsockopt( socket.getprotobyname('tcp'), socket.SO_REUSEADDR,1 ) SocketServer.TCPServer.server_bind(self) ------------------------------------------------------------ From danzap_python at bol.com.br Sat Apr 8 11:12:15 2000 From: danzap_python at bol.com.br (danzap_python) Date: Sat, 8 Apr 2000 12:12:15 -0300 Subject: Getting file version information Message-ID: I'd like to know how to get the file version information in Windows. I've looked up at the win32api module, but there isn't a GetFileVersionInfo function. So how to access it ??? Thanks. Daniel ______________________________________________ EconoMiner Tudo sobre Economia? O Miner acha para voc?. http://miner.bol.com.br/econominer.html From markmcmahon at my-deja.com Mon Apr 10 12:28:50 2000 From: markmcmahon at my-deja.com (Mark) Date: Mon, 10 Apr 2000 16:28:50 GMT Subject: Redirecting stdin/stdout on Windows with '>'and '<' Message-ID: <8csvff$7pn$1@nnrp1.deja.com> Hi, I seem to have a problem and can't find it in the archives or FAQ. I would like to redirect output of my script with '>' or '<' If I try to redirect out then the file is created but has no contents. If I try to redirect in eg... "test.py < autoexec.bat" I get the following traceback Traceback (most recent call last): File "C:\test.py", line 4, in ? s = sys.stdin.read() IOError: [Errno 9] Bad file descriptor Does anybody have an idea!!! (Windows nt 4 sp 6, python 1.52) Thanks Mark Sent via Deja.com http://www.deja.com/ Before you buy. From BobAlex at uppercase.xerox.com Wed Apr 5 15:22:28 2000 From: BobAlex at uppercase.xerox.com (Alexander, Bob) Date: Wed, 5 Apr 2000 12:22:28 -0700 Subject: Tuples -- who needs 'em Message-ID: m.faassen at vet.uu.nl [mailto:m.faassen at vet.uu.nl] wrote: > > Bob Alexander wrote: > > I agree with this, too (noting Lisp as possibly the worst example -- > > although a fine language with clear favorable influences on > Python). But > > my issue is not about syntax. > > > However, too bad about that nasty syntax irregularity that > using parens for > > tuples presents (1,) (Couldn't resist ;-) BTW, a couple of folks pointer out my error in associating the parentheses with tuple syntax. The parens aren't really part of the syntax, although they are often used for grouping and visual distinction. However the dangling comma, as we well know, is always need for one-element tuples. > But tuples are nice in particular for their *syntax*. With tuples, you > can do: > > def foo(): > return 1, 2, 3, 4 > > first, second, third, fourth = foo() > > I think this is nice syntax. Without tuples it'd not be as > nice. It's not > so much about efficiency. This pattern occurs all over Python. I like that syntax too. If tuples and lists were unified, that bracket-free syntax could also be used for the list/tuple datatype, and nice syntax you mention would not change. > [snip] > > Yet the concept of array is pretty fundamental to > programming. Arrays are > > usually thought of as mutable. Anyone having trouble with > that concept is > > pre-beginner :-) > > Anyone having trouble with the concept of immutable lists > must have never > heard of functional programming? > > [snip] > > I'm sure tuples are not an acciental feature. And my issue > comes from > > understanding, not lack of understanding. > > Given the above two items, I don't think you understand tuples yet. I > consider tuples to be mostly nice syntax (with one nit, the > single element > tuple). You could almost see the immutability semantics being there to > support the syntax, not the other way around. It might be > possible to preserve > the nice syntax and still get rid of tuples, if you still allow this: > > foo, bar, baz = [1, 2, 3] > > But this is less symmetrical, and since lists are mutable, > this may go wrong > far more easily. I am wondering where the serious concern about mutable lists comes from, as it is a pattern in the responses I've gotten on this topic. For me, the immutable list is a relatively new concept, since I can't think of many other languages that have it. I'm a programming-language-design kind of person, and I never really saw mutable lists as a problem that needed solving. I've used many Python-type languages that have mutable lists but not immutable ones, and if I don't want the elements to change they don't change -- I simply avoid the x[i] = y construct :-) And I still haven't heard from anyone about why there isn't similar concern about immutable dictionaries. Anyway, it seems to me that most of the tuple advantages we enjoy could and should still exist with a merged tuple-list type, and the only possible drawback is the loss of an immutable sequence type. The gain, though, is one less decision that we must frequently make (between tuple and list) while programming. -- Bob From thomas at cintra.no Fri Apr 7 06:39:31 2000 From: thomas at cintra.no (Thomas Weholt) Date: Fri, 7 Apr 2000 12:39:31 +0200 Subject: MySQL-module Message-ID: <55jH4.145$rD3.2312@news1.online.no> Hi, I`m going to try MySQL and want to access stuff using Python. At Python.org I found to links to two different modules, one written in python, the other C. Is there a special reason for choosing one over the other? I`d like to use all python, not compile anything cuz I`m scared python won`t work anymore. Had this problem earlier with re-compilation of python. zlib etc. didn`t work anymore. Any tips? I can create the actual databases/tables manually, but need to acces/insert/manipulate the data from a python-script. Thomas From grant at nowhere. Fri Apr 21 13:23:09 2000 From: grant at nowhere. (Grant Edwards) Date: Fri, 21 Apr 2000 17:23:09 GMT Subject: How2 use curses for data input References: <38FF6DE2.5751423A@sprint.ca> <38FF8F9C.9D533E74@sprint.ca> Message-ID: In article <38FF8F9C.9D533E74 at sprint.ca>, Miles Thompson wrote: >I located it on the RH system here in the office at home. The >target machine is Debian, and I think I can install RPM on it >so that if need be, I can get the RPM. Debian doesn't seem to >have a snack package. It's something that RH did for use in their installer and system admin tools, so I don't think it's part of the standard Python dist. Which is a shame. >Thanks for the lead, much appreciated. I've searched google, >www.python.org, and www.debian.org for information on how to >use it. Didn't find much, eh? (Been there.) >All that's on my system is snack.py, .pyc and _snackmodule.so. >I *hoped* there might be some clues in __builtin__ or in >snakc.py, but I drew a blank. Here's a little demo program: ====================================================================== import snack import time screen = snack.SnackScreen() screen.drawRootText(1,1,"background text") screen.refresh() time.sleep(1) x = snack.ButtonChoiceWindow(screen, "test window", "This is a test of the button choice window") y = snack.EntryWindow(screen, "EntryWindow Title", "This is some text", ["prompt1", "prompt2"]) z = snack.ListboxChoiceWindow(screen, "ListboxChoiceWindow Title", "This is a bunch of text for thelist box choice window", ['item1','item2','item3']) time.sleep(1) screen.finish() print x print y print z ====================================================================== The above program uses some pre-defined window layouts. The newt source package contains some other more complex examples showing how to layout your own windows using a grid placement manager. The nested checkbox-tree widget is pretty cool. I'll put the newt source package in my ftp directory: Newt/snack is really a handy little package. Too bad it's so little known. The tutorial contained in the source package I have is a bit out of date and doesn't explain grid widgets, so you've got to figure them out based on the source code and the example programs. I should look around to see if there's a newer version of newt available... -- Grant Edwards grante Yow! I OWN six pink at HIPPOS!! visi.com From quinn at euro.ugcs.caltech.edu Wed Apr 19 13:56:03 2000 From: quinn at euro.ugcs.caltech.edu (Quinn Dunkan) Date: 19 Apr 2000 17:56:03 GMT Subject: modifying os.environ References: <8di2il$10oq$1@nntp6.u.washington.edu> Message-ID: On 18 Apr 2000 16:30:13 GMT, Donn Cave wrote: >Quoth Martin von Loewis : >| quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) writes: >... >| > Or perhaps there's a better way to do the (common) thing I'm trying >| > to do: clean the environment to insure some minimum sane values. I >| > can't make a copy of the environ and then pass to execve() since >| > that doesn't help much for popen and system. >| >| You could implement popen and system yourself, starting from popen2 >| (for example). > >That may sound like the re-invention of the wheel, but there are >other improvements that can be made at the same time: > > - eliminate system()'s sh -c 'shell command', which can be a > security liability in some situations. The shell can do > some really useful things, but if you don't need those things > you should be able to pass in an argv sequence and skip sh. I do need the shell's useful things, and the system() commands are constants, so things should be pretty bulletproof as long as the environment is also constant, right? But it *would* be useful to have a spawn() or run() or something builtin which does a proper vfork/exec with no subshell involved. I often find myself writing one of those. > - Raise exception on exit status, complete with error output as > exception value. A bit of a pain to implement, and again not > not always the right thing to do, but usually it is the right > thing. I don't understand... are you saying the close() method should throw the exception? What's wrong with just checking it's return value normally? How is a child you started exiting exceptional? And if the child has been started asynchronously, do you mean throw an exception from the SIGCHLD handler, or waitpid()? I wound up just writing unsetenv(), and then setenviron() which sets the environ to a given dict. From trossignol at my-deja.com Tue Apr 25 15:50:34 2000 From: trossignol at my-deja.com (trossignol at my-deja.com) Date: Tue, 25 Apr 2000 19:50:34 GMT Subject: threads on Linux freezing? References: <20000413010344.A13931@owl.rhein-zeitung.de> <38F658C6.66AD9CA5@clark.net> <20000414154718.A15664@xs4all.nl> <20000414190308.A30502@owl.rhein-zeitung.de> <38F91D1B.3D663B0C@stanford.edu> <38FD72B1.DBB2F731@stanford.edu> Message-ID: <8e4su3$rmv$1@nnrp1.deja.com> I've duplicated your results on a couple of dual PIII servers and a workstation all running glibc 2.1.2 or 2.1.3. I was able to run the python test script on a machine running glibc 2.0.7 and the problem did not show up. This machine just continued to print stars. I'm running Zope (http://zope.org), which is written in Python, and on occation I've been getting mysterious lockups. This only has been occurring on the machines with the newer version of glibc. Could this be related? Does anyone know how to change the scheduling policy for python? In the FAQ previously quoted it was indicated that SCHED_RR or SCHED_FIFO might correct this condition. Sent via Deja.com http://www.deja.com/ Before you buy. From JoeSmith at bogusaddress.com Sat Apr 1 22:41:55 2000 From: JoeSmith at bogusaddress.com (Joe Smith) Date: Sun, 02 Apr 2000 03:41:55 GMT Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <_pyF4.25562$E85.640966@news1.rdc1.md.home.com> Message-ID: <38E6C25C.8D45A388@bogusaddress.com> I think that there are security issues with the auto download. I feel comfortable being able to download one big thing and being able to examine it source code wise and with anti-virus programs and so forth. I get kind of worried about somebody some how injecting malicous code in transit or fooling my machine into downloading something from a hacker's box because they have done something to a DNS server or something. There should be a way to disable this feature on a per machine basis. William Tanksley wrote: > On Sun, 02 Apr 2000 02:39:54 GMT, Eric Hagemann wrote: > >What are the options for users wanting 1.6 that may not have access to > >modules.python.org > >on a regular basis or at all. I'd hate to be disconnected from the net and > >find I need that > >'one' function that used to be in the standard library ......... e.g. can I > >down load the > >entire library and forgo the net check ? What happens if there is no net -- > >will the import function > >get unhappy ? > > It's actually not a problem -- all modern OSes support TCP/IP even when > you're disconnected from the net, and one particular address, 127.0.0.1, > is always live. This happens to be the site from which Python loads its > modules (we have an agreement with the owner of that site, which also > hosts many other products of the same nature, including some marketing > apps). > > >Also when you import like this does the code check the net for a newer > >version or only when you have no version of the particular sub-module ? > > Only when you have no version. That's not a bad idea, though. I suspect > it would be best as a single, user-initiated command, though. > > >"Guido van Rossum" wrote in message > > >> 2. Imputils > > >> Complementary to the Distutils are the Imputils, or Import Utilities. > >> Python's import mechanism has been reworked to make it easy for Python > >> programmers to put "hooks" into the code that finds and loads modules. > >> The default import mechanism now includes hooks, written in Python, to > >> load modules via HTTP from a known URL. > >> > >> This has allowed us to drop most of the standard library from the > >> distribution. Now, for example, when you import a less-commonly-needed > >> module from the standard library, Python fetches the code for you. For > >> example, if you say > >> > >> import tokenize > >> > >> then Python -- via the Imputils -- will fetch > >> http://modules.python.org/lib/tokenize.py for you and install it on your > >> system for future use. (This is why the Python interpreter is now > >> installed as a setuid binary under Unix -- if you turn off this bit, you > >> will be unable to load modules from the standard library!) > >> > >> If you try to import a module that's not part of the standard library, > >> then the Imputils will find out -- again from modules.python.org -- > >> where it can find this module. It then downloads the entire relevant > >> module distribution, and uses the Distutils to build and install it on > >> your system. It then loads the module you requested. Simplicity > >> itself! > > -- > -William "Billy" Tanksley From wware at world.std.com Tue Apr 11 10:00:06 2000 From: wware at world.std.com (Will Ware) Date: Tue, 11 Apr 2000 14:00:06 GMT Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com> <87r9cdhdb0.fsf@deneb.cygnus.argh.org> Message-ID: Hrvoje Niksic (hniksic at iskon.hr) wrote: > This is still different from being able to embed multiple Python > instances in threads. Are we talking about multiple Python instances running in a single thread? That sounds like a very big challenge. The Python VM would need to be rewritten to be reentrant so that multiple VMs could simultaneously coexist, with distinct copies of the entire computing environment (globals, locals, which modules had been imported, etc). Then you'd need to arrange context switches; this might be borrowed from the context switcher in Chris Tismer's Stackless Python. Making the PyVM reentrant would be a ridiculously large amount of work, for which no other demand exists, as far as I'm aware. Maybe the most helpful thing to do would be to point him to some other language that already has a reentrant VM. Does Lua or Pike fit this description? -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From rupole at compaq.net Sun Apr 9 19:48:06 2000 From: rupole at compaq.net (Roger Upole) Date: Sun, 09 Apr 2000 23:48:06 GMT Subject: win32com and Reflection2 Message-ID: I'm scripting Reflection2 sessions with win32com.client.Dispatch. However, there are some constants (error codes, transmission modes, etc) in a typelib that I can't seem to get at from the Dispatch object. Anybody know of a way to access these from Python ? If not, is there any way to get to them from C++ ? I have very little experience with C, but if it is simple I can probably blunder my way through it. Roger Upole From janssen at parc.xerox.com Tue Apr 11 22:17:38 2000 From: janssen at parc.xerox.com (Bill Janssen) Date: Tue, 11 Apr 2000 19:17:38 PDT Subject: ANNOUNCE: Python 1.6 alpha 2 In-Reply-To: Your message of "Tue, 11 Apr 2000 13:29:51 PDT." <200004112029.QAA09762@eric.cnri.reston.va.us> Message-ID: <00Apr11.191729pdt."3438"@watson.parc.xerox.com> ILU seems to work fine with it. Bill From gregm at iname.com Thu Apr 20 10:20:52 2000 From: gregm at iname.com (Greg McFarlane) Date: Fri, 21 Apr 2000 00:20:52 +1000 Subject: Tkinter/Pmw/Python 1.6a#: xsync? In-Reply-To: ; from Rob W. W. Hooft on 19 Apr 2000 at 10:22:01AM References: Message-ID: <20000421002052.34558@nms.otc.telstra.com.au> Why not try to narrow it down a bit? First, check if a Tkinter-only program exhibits the same behviour. If not, then it is probably Pmw that is causing the problem (unlikely :). Otherwise, try a Tk gui (no python), then an X only gui, then change your desktop - use a really simple windown manager, such as twm (the first and still the best). You could also change your X library or X server. Eventually, you will change or eliminate something and the problem will go away - and then you will have found the culprit. But you already know all this. On 19 Apr, Rob W. W. Hooft wrote: > I upgraded too many things at the same time: Computer, OS revision, > Desktop environment, and Python version.... > > For the python software that I make for my work, I also create a > package including the python interpreter and all extensions required > by my python code. > > Since I upgraded to Python-in-CVS (from 1.5.2b1), Pmw0.8.3 (from 0.8) > and started running on RedHat Linux 6.2 in Gnome, I have the > impression that there are sometimes a bunch of X commands that stick > in the pipeline: the buildup of the GUI stalls every time for about 1 > second just when the application starts a calculation or becomes > idle waiting for input. Dialog windows do pop up immediately, but > they stay blank for a while. > > - Is there anyone that has seen a similar effect? > - Is there a way I can avoid this? > > Regards, > > Rob Hooft > -- > ===== rob at hooft.net http://www.xs4all.nl/~hooft/rob/ ===== > ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== > ===== PGPid 0xFA19277D ========================== Use Linux! ========= > -- > http://www.python.org/mailman/listinfo/python-list > -- Greg McFarlane INMS Telstra Australia gregm at iname.com From bawolk at pacbell.net Wed Apr 12 01:33:07 2000 From: bawolk at pacbell.net (Bruce Wolk) Date: Tue, 11 Apr 2000 22:33:07 -0700 Subject: How to know what re.sub took? References: <38F387AE.1010704@gmx.net> Message-ID: <38F40A93.9051A4A4@pacbell.net> Try this: >>> rex.findall(st) ['hans'] There would be more elements in the list if there were more matches made. >>> st = "max hans bill fred" >>> rex.findall(st) ['hans', 'fred'] Cheers, Bruce Per Kistler wrote: > > Hello > > How to know what has been substituted away, if one does something like: > > >>> import re > >>> rex = re.compile(r"(hans|fred|simon)") > >>> st = "max hans bill" > >>> st2 = rex.sub("",st) > >>> st2 > 'max bill' > > It took "hans" away, but how can I learn this automatically? > > Thanks, Per. From tom at parlant.com Mon Apr 3 18:08:38 2000 From: tom at parlant.com (Thomas Lane) Date: Mon, 03 Apr 2000 16:08:38 -0600 Subject: tkinter - changing the mouse pointer? Message-ID: <38E91666.D3B87B4C@parlant.com> Does anyone out there know how to change the mouse pointer in tkinter? I'd like to change the mouse pointer to an hourglass (or the default 'wait' icon for the os) and back to normal after a short operation. How do I go about doing this? I've hunted through the Grayson book without success. Thomas Lane Parlant Technology tom at parlant.com From mwh21 at cam.ac.uk Wed Apr 19 05:12:08 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 19 Apr 2000 10:12:08 +0100 Subject: Pointers References: <38D00DCE.9740380F@be-research.ucsd.edu> <8bfsqo$kje$1@tribune.oar.net> <4k5D4.7566$0o4.54442@iad-read.news.verio.net> <38FB98F1.239EC0FB@whetstonelogic.com> <8dhu2j$1gm$1@proxy2.fe.internet.bosch.de> <20000418223105.K15664@xs4all.nl> Message-ID: Thomas Wouters writes: > But you have to force *both* strings this way, interning one isn't > enough. It also doesn't work for integers (i dont think there is a > way to do it with ints) so the best solution is just to not rely on > this behaviour. Compiling the code they turn up in is one way: >>> def f(): ... x = 100000 ... y = 100000 ... return x is y ... >>> f() 1 But, yes. M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From someone at somewhere.com Tue Apr 18 20:30:35 2000 From: someone at somewhere.com (Charley Horse) Date: Wed, 19 Apr 2000 00:30:35 GMT Subject: Using python on the web References: <8di2bk$l1s$1@newshost.accu.uu.nl> <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> <9N4L4.499$wYl.191816704@newsb.telia.net> Message-ID: OK, thanks for the warning . I already admire Zope, I'm just trying to learn some python to make sure I like the framework language. In article <9N4L4.499$wYl.191816704 at newsb.telia.net>, effbot at telia.com says... > Charley Horse wrote: > > It was just an unexpected surprise. I'm fairly new to all of this and > > always heard of CGI in the context of "you don't have to user CGI > > anymore because of the fancy new blah blah technology we offer!" > > in Python land, that fancy technology is called > Zope (www.zope.org). > > well worth checking out, but be careful -- your > brain might explode. > > > From mwh21 at cam.ac.uk Wed Apr 19 06:05:33 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 19 Apr 2000 11:05:33 +0100 Subject: testing true condition References: Message-ID: Gregoire Welraeds writes: > Hi, > > I know that I can't do something like the following: > > >>> while (line= f.readline()): > ... > > as i could in C. Is there any replacement tricks ? > I know that I could use something with f.read() but i don't want to have > the file completly loaded in memory Tried the standard library module fileinput? Cheers, M. -- 112. Computer Science is embarrassed by the computer. -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From chris at hazelnut.millersv.edu Sat Apr 29 19:31:36 2000 From: chris at hazelnut.millersv.edu (Christopher Medalis) Date: Sat, 29 Apr 2000 19:31:36 -0400 (EDT) Subject: converting word documents to html In-Reply-To: <390B501C.1891CB80@uiuc.edu> Message-ID: There is a package that does the job available here: http://www.csn.ul.ie/~caolan/docs/MSWordView.html Hope it helps! =) cheers -clm On Sat, 29 Apr 2000, Joe Saltiel wrote: #:Date: Sat, 29 Apr 2000 16:11:56 -0500 #:From: Joe Saltiel #:To: python-list at python.org #:Newsgroups: comp.lang.python #:Subject: converting word documents to html #: #:Hey, #: #: I was wondering if anybody had done any work on converting #:word processors type documents to html. (word or word perfect, #:pdf or anything else). I am looking for a nice way to post #:documents online that are laden with footnotes/endnotes. #:Word2000 does an allright job, but adds a bunch of #:junk that makes the file 3-4 larger then it has to be. #:I was thinking of writing something to do that but just want #:to check before I reinvent the wheel..... #: #:thanks #: #:Joe #: #: #:-- #:http://www.python.org/mailman/listinfo/python-list #: ============================================================ Christopher Medalis chris at hazelnut.millersv.edu chris at millersv.edu (work) From robin at jessikat.demon.co.uk Sat Apr 22 03:44:29 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sat, 22 Apr 2000 08:44:29 +0100 Subject: The Simple Economics of Open Source References: <1255771356-36910442@hypernet.com> <3dya67xga4.fsf@amarok.cnri.reston.va.us> Message-ID: <833l8JAdhVA5Ewp$@jessikat.demon.co.uk> In article <3dya67xga4.fsf at amarok.cnri.reston.va.us>, Andrew M. Kuchling writes .... >Also, ever had to debug a problem in a binary-only library through >trial-and-error? You can burn lots of time that way. >"Hmm... maybe that parameter can't be NULL." "Maybe that >struct field should be 1." . I like the fact that, if I >start seeing mysterious errors, I can dive down into the language >interpreter, farther down into the C library, and even into the kernel >if needed. Though I've only followed a problem all the way into the >Linux kernel once (to discover it was my error), it was reassuring to >be able to do so. > Well I did a bit of reverse engineering in my time, but I think that along with many others I'm living in the past. Software doesn't cost nearly so much as it used to. In real terms the average application doesn't cost nearly so much as my perceived $10k=car. The computer I have at home is about the same power as a CDC 8600 of 20 years ago. It doesn't need 50 people to run it and the software cost me around 300$. I don't think I need to worry about cost (even though it still seems to hurt). I worry more about the control of the software development process more than the economics. As for diving into the mechanics, would you do the same to your car? How about fixing the video recorder or the mobile phone? Similar intellectual requirements, but not so interesting to the 'nerds'. -- Robin Becker From schorsch at schorsch.com Fri Apr 14 06:23:59 2000 From: schorsch at schorsch.com (Georg Mischler) Date: Fri, 14 Apr 2000 10:23:59 GMT Subject: simple httplib and urllib timeout question References: Message-ID: <8d6rjk$tdd$1@nnrp1.deja.com> phd at phd.russ.ru wrote: > Georg Mischler wrote: > > What exactly is your problem with signal.alarm() ? > > Python delivers alarm only when in Python VM. If the script is > blocked in C (even worse - in system call), the signal will NOT be > delivered. > Of course, URL checker, while running through a big list of URLs, > certainly spend most of the time in connect() and recv() system calls. > This makes signals unusable. This surprises me, because the snipped I posted is in everyday use in something very similar to a link checker, and it works perfectly well there. Reading throught the Python docs on signals again, I guess that the different behaviour might be caused by the underlying OS implementation. I use it on Linux (going to check on FreeBSD soon), and it looks like Linux will interrupt system level IO calls when a signal arrives for the process. What platform does it fail on for you? -schorsch -- Georg Mischler -- simulations developer -- schorsch at schorsch.com +schorsch.com+ -- lighting design tools -- http://www.schorsch.com/ Sent via Deja.com http://www.deja.com/ Before you buy. From gregholmes at my-deja.com Tue Apr 18 08:21:51 2000 From: gregholmes at my-deja.com (gregholmes at my-deja.com) Date: Tue, 18 Apr 2000 12:21:51 GMT Subject: TKinter-destroying a window Message-ID: <8dhk0j$cj5$1@nnrp1.deja.com> Sorry, I'm reading TFM but haven't figured this out yet. If I am done with a secondary (or tertiary, or whatever) window (in TKinter), can I just destroy the window or do I need to get rid of any class instantiation that is attached/associated to it? i.e. .... theWindow=Toplevel() solveThis=SolveThis(theWindow) .... theWindow.destroy() ?? Will the class instantiation and its variables and everything still be laying around? Sent via Deja.com http://www.deja.com/ Before you buy. From rzantow at my-deja.com Wed Apr 5 09:12:47 2000 From: rzantow at my-deja.com (rzantow at my-deja.com) Date: Wed, 05 Apr 2000 13:12:47 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> Message-ID: <8cfe42$o02$1@nnrp1.deja.com> In article <20000405053920.20579.qmail at web2102.mail.yahoo.com>, lewst wrote: ... > What is it about Perl that makes it so much more popular and have such > a huge grassroots swell? I personally find Perl an abomination and > Python a breath of fresh air. Perl has that first mover advantage I > suppose, but should that really make such a hugh difference? ... Here's my theory, which is my own: It all depends on syntax. Perl's is so nasty that its newbies *need* the books to make any use of it. Python's is so clean that the occasional online nudge is sufficient. Publishers see the market in Perl books, so they keep cranking them out, and Perl users keep searching for the elusive key to understanding the whole language, and buying more books. I'm really surprised there are as many as 13 Python books on the market. I'd have thought there was a need for maybe three, along with about two pamphlets and a poster. Sent via Deja.com http://www.deja.com/ Before you buy. From aa8vb at yahoo.com Sat Apr 1 08:19:08 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Sat, 01 Apr 2000 08:19:08 -0500 Subject: Tkinter dying a Flailing Death? In-Reply-To: <3.0.6.32.20000331090918.007e4480@njdc.com> References: <3.0.6.32.20000331090918.007e4480@njdc.com> Message-ID: <20000401081908.A1353928@vislab.epa.gov> anders schneiderman: |I've been working for a while on a Tkinter program, and almost every time I |quit it, it twice complains that "This program has performed an illegal |operation and will be shut down." | |Since I'm new to Python, I figured it must be something I was doing. So, I |tried running a demo from the Tkinter library, Dialog.py. Surprise! It |also dies twice, bitterly complaining about illegal operations. The code |below is the Tkinter demo. Any idea why it's so unhappy when it quits? Sounds like an installation problem. Someone with Python-on-MSWindows experience is going to need to help you. FWIW, your code works fine here on SGI IRIX (Python 1.5.2, Tcl/Tk 8.0.4). -- Randall Hopper aa8vb at yahoo.com From rcunning at acm.org Wed Apr 5 11:10:13 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Wed, 05 Apr 2000 15:10:13 GMT Subject: Pass by reference ? References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38EAF8D8.4B7C43B4@ecs.soton.ac.uk> Message-ID: <38EB56AE.F938CE06@acm.org> Jacek Generowicz wrote: > Jacek Generowicz wrote: > > > Hi, > > > > I'm just trying to familiarize myself with Python. > > In Magnus Lie Hatland's Instant Python, he > > mentions that `all parameters in Python are passed > > by reference'. > > [snip] > > Thank you for your answers. > > I would welcome a critique of the following summary: > > Python variables are implemented as references to > values. > > Assignment (potentially) alters the reference rather > than the value to which it refers. > > Objects can be classified into two sets: mutalble and > immutable. > > Mutation of a mautable passed into a function will be > reflected in the mutation of the object which was > passed into the function; achieving similar behaviour > for immutables is more complicated. > > Jacek As a Python newbie, this sounds about right to me. In my own mind, to escape the ambiguity of how "Pass By Reference" and "Pass By Value" are discussed in Computer Science, and how those same terms are (mis)used when discussing Python, I've been using the idea of "Pass By Clone". In essence, it seems to me Python and traditional CS meanings of these phrases are cleanly separated by one level of abstraction. And, given that the two types of passing are themselves separated by one level of abstraction (pass the data vs. pass a pointer to the data), confusion seems inevitable. Python can either 1) Pass a reference to the original data, or 2) Pass a reference to a copy of the original data. At no time does Python "pass the data" directly (as in the "C" sense of, say, a register variable), since everything is treated as though it were (in some sense) an object (even if not "really" an object of the First Water). Which, when mapped to conventional CS terminology (as extended by Moi), becomes "Pass By Reference" and "Pass By Clone". Clearly, "Pass By Clone" makes the original data item completely inaccessible within the called function (ignoring bytehacks for now), and thus immutable. For me, this helps to clarify things, since Python literally passes only references. But, of course, that depends: Is this a clarification, an obfuscation, or Just Plain Wrong? Finished-the-Python-tutorial-yesterday-and-the-FAQ-today-ly yours, -BobC From greg at cosc.canterbury.ac.nz Wed Apr 12 22:36:34 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 13 Apr 2000 14:36:34 +1200 Subject: global variables - how?? References: <20000412175218.784841CE49@dinsdale.python.org> <8d2jsh$3a9$1@news101.telia.com> Message-ID: <38F532B2.C1518977@cosc.canterbury.ac.nz> Anders Eggers-Krag wrote: > > in my case I could otherwise send them along with every function, creating a > huge > overhead passing a million pointers around If you find yourself doing that, your program is badly in need of redesign. Think about grouping related global variables together and making them attributes of a class instance rather than globals. Then pass a reference to the instance instead of passing all the variables separately. Even better, make the functions which operate on those variables methods of the class whenever you can. > but this really anoys me, and I *was* starting to like python... Don't give up! It's always possible to redesign any program which uses a lot of global variables so that it uses very few, or even none. And in my experience, the new design is *always* better - clearer, easier to understand, easier to modify and extend. And once you get over global-variable-withdrawal, you'll just keep liking Python more and more! -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From nascheme at enme.ucalgary.ca Sat Apr 15 17:54:21 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Sat, 15 Apr 2000 21:54:21 GMT Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F65501.665243F6@gmx.de> <38F77397.45F26301@boi.hp.com> Message-ID: Bill Anderson wrote: >I would love to see a patch for 1.5.2! Okay: http://www.enme.ucalgary.ca/~nascheme/python/gc-cycle-152.diff http://www.enme.ucalgary.ca/~nascheme/python/py152_gc1.zip The zip file contains a Python 1.5.2 DLL for people on compiler challenged machines. Neil -- Real programmers don't make mistrakes From avv at quasar.ipa.nw.ru Tue Apr 18 18:39:06 2000 From: avv at quasar.ipa.nw.ru (Alexander V. Voinov) Date: Tue, 18 Apr 2000 15:39:06 -0700 Subject: Playing wave files on Windows References: <38FB6ED7.4C72773E@callware.com> <38FB7624.943A8C35@rubic.com> <38FB7862.7B15633@callware.com> Message-ID: <38FCE40A.1D882566@quasar.ipa.nw.ru> Hi, Ivan Van Laningham wrote: > > Then I can't interest you in my Python interface to > > the Diamond Rio MP3 player? <0.5 wink> > > > > Not unless everyone that I'll be distributing my application to will > have one plugged in and ready to go;-) But indeed, is it inevitable to have a specific module for one specific MP3 player? I have no ideas about MP3, but it's strange that there are no abstraction layers. Seriously I'd be interested in crossplatform solutions. Does this FAQ have an entry for ALSA/OSS? MIDI? Regards Alexander From warlock at eskimo.com Tue Apr 4 02:15:05 2000 From: warlock at eskimo.com (Jim Richardson) Date: Tue, 04 Apr 2000 06:15:05 GMT Subject: Why should I switch to Python? References: <000701bf9c5a$b806b420$752d153f@tim> Message-ID: On 02 Apr 2000 08:16:57 -0400, Fran?ois Pinard, in the persona of , brought forth the following words...: >"Tim Peters" writes: > >> When in doubt, there's no substitute for exhaustive enumeration. > >Hmph! Hope you do not doubt there is an infinite number of primes! :-) Out of curiousity, how does one (mathematically) prove that? (if this turns out to be one of those 12' blackboards full of greek letters and funny squiggles, Ok, I cry uncle...) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From joacim at home.se Thu Apr 27 09:46:26 2000 From: joacim at home.se (JJ) Date: Thu, 27 Apr 2000 15:46:26 +0200 Subject: Concatening string and integer Message-ID: <8e9gco$jlt$1@vg170.it.volvo.se> Hi! I want to concatenate a string containing both strings and integers like: strTemp = 'I make test number: ' + iMyNumber + ' once again' It doesn't work, how should I do this? BR Joacim From donn at oz.net Tue Apr 18 02:55:24 2000 From: donn at oz.net (Donn Cave) Date: 18 Apr 2000 06:55:24 GMT Subject: else clauses in while and for loops References: <%TNK4.430$vr2.32615@news.uswest.net> <2JKK4.325$vr2.19414@news.uswest.net> <38DD2EE3.C7F3CB54@webamused.com> <8boe2k$gmh$1@inputplus.demon.co.uk> <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> <8dg14u$f08$1@nntp6.u.washington.edu> Message-ID: <8dh0ss$4ia$0@216.39.151.169> Quoth "Jeff Massung" : | Donn Cave wrote in message <8dg14u$f08$1 at nntp6.u.washington.edu>... |> Yes, but if you look at the examples, they also use "break". After a |> loop, "else" basically means "if no iteration of the loop met the |> conditions to break out." It's a common usage, where in C we'd compare |> the final loop index with the maximum (or whatever) loop index to see |> if the loop ran all the way through. | | I don't think that I'm following you, give me an example where the loop | ends, but the else wouldn't be executed and I think I'll better understand. OK, let's bring back the example from a few posts back: for envname in ['TMPDIR', 'TMP', 'TEMP']: if os.environ.has_key(envname): path = [os.environ[envname]] basepaths = validate_paths(path) if basepaths: break else: basepaths = validate_paths(_tmpdirs) Here the else branch executes if none of the envnames turns up in environ. The conditions to break out are 1) envname is there, and 2) validate_paths() can use it; if those conditions are never met, the else clause executes. Now it's simpler to say "else executes if break doesn't". I'm just trying to complicate matters with a formula that tries to make sense in terms of the common usage of "else" in other familiar contexts. Donn Cave, donn at oz.net From sabren at manifestation.com Sun Apr 16 20:39:00 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 16 Apr 2000 20:39:00 -0400 (EDT) Subject: module naming? Message-ID: Hey All, I've got a package I'm getting ready to share named zdc, and it has some submodules: zdc.Record, zdc.Field, zdc.IdxDict.. Each one of those contains a class with the corresponding name: zdc.Record.Record, zdc.Field.Field, zdc.IdxDict.IdxDict. I've read the essay on built-in package support, ( http://www.python.org/doc/essays/packages.html ), but I just don't like the notion of having to say: import zdc.Record rec = zdc.Record.Record() when this looks so much nicer: import zdc rec = zdc.Record() Now, I know I can do this by putting all my classes in zdc.py, but I think it's a lot cleaner to keep my classes in their own files. I also don't want to do "from zdc import *" because people who use my modules will probably only want one of the classes at a time. Or at least I will. :) The other approach I'm considering is changing my module names to lowercase, and doing something like this in zdc/__init__.py : def Record(dbc, table): import zdc.record, zdc zdc.Record = zdc.record.Record return zdc.record.Record(dbc, table) .. That way, the first time you call zdc.Record() it imports zdc.record, and every time after that, it just initializes a zdc.record.Record object... Is there a better way to do this? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From effbot at telia.com Tue Apr 4 13:09:14 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 04 Apr 2000 17:09:14 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> Message-ID: <_kpG4.5040$74.81544@newsc.telia.net> Hrvoje Niksic wrote: > "Fredrik Lundh" writes: > > > -- tuples can be used as dictionary keys. mutable collections can > > not. > > This is wrong. this is why it usually takes more than one iteration to come up with a watertight specification. yeah, you're right -- python allows you to pretend that a mutable collection class isn't really that mutable... ...just like tuples are basically lists that pretend they're not really mutable (okay, CPython stores tuples in a slightly more efficient ways, but that's an optimization) > > -- good designers know that hypergeneralization tends to be a bad > > idea. > > ...and this is arm-waiving. oh, I don't know. I've designed stuff for some 20 years, and I've seen way too many failed attempts to design overly general stuff (even when the designers succeed, it can take ages for ordinary users to catch up -- just witness SGML vs. XML vs. SML vs. good old text files...). but maybe it's just me. From alwagner at tcac.net Mon Apr 24 21:10:10 2000 From: alwagner at tcac.net (Albert Wagner) Date: Mon, 24 Apr 2000 20:10:10 -0500 Subject: Tkinter References: Message-ID: <3904F072.DAD6D48D@tcac.net> http://www.python.org/topics/tkinter/doc.html "Daley, MarkX" wrote: > > I am trying to use Tkinter for a GUI interface, but I am having a hard time > finding manuals for it. Is there documentation comparable to Python's? > Also, is there a demo script floating around anywhere that gives generic > examples for common GUI functions or widgets? > > TIA > > - Mark -- Small is Beautiful From sp00fD at yahoo.com Mon Apr 24 14:44:24 2000 From: sp00fD at yahoo.com (sp00fD) Date: Mon, 24 Apr 2000 18:44:24 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <38ED40B0.A48EC4CC@udel.edu> Message-ID: <8e24m5$2vn$1@nnrp1.deja.com> This is probably the only thing that I hate about python, the lack of good freakin' documentation. I used perl formerly and found it to be sooo easy (partially because I'm a unix admin and perl is very unix- like), there were wonderful examples everywhere on how to do things. Python, on the other hand, has __extremely__ poor documentation (as do most languages), and I believe this is a large part of why perl has become so popular. Most people can't discuss theory and get coding ideas from it, nor can they see a method and parameters and know exactly how to use the module correctly. Frankly, the stock python documentation is worthless to me, and often times I find myself perusing modules, without luck because unfortunately most of them are not very well commented either. I think I'm going to have to go club Tchrist over the head and reprogram him into a pythoneer, then maybe we'd have some good documentation as well. Mike In article , i_luv_fudge at I_HATE_SPAM.hotmail.com (.,.) wrote: > > > >> Now something I can't quite figure out is: why are there so many more > >> books on Perl out there than on Python? > > >6 months ago, I discovered Python and it immediately clicked. > >Learned most of Python before buying my first Python book. > > I don't know about any of the rest of you guys, but I figure this is where I > should speak up. I have just discovered Python in the last week. I was > trying to manipulate about 400 smallish text files with identical datafields > and differing values into a format that I could display on the web. After > spending about 80 hours cutting, pasting deleting and hten realizing that it > would be good to start again, so I could include that peice of info afterall, > I decided there had to be a better way. > > I have done one semester in C++ about 2 years back, and nothing before or > since. I have a very great friend who is helping me out with my script and > what I want to do, but this is because they have also only just discovered > Python and have a direct need to use it for a project over the next week. > This is very lucky for me, cause I am so close to forgetting absolutely > everything I learnt in that semester, except the basic tenets of form and > structure. > > Trying to get information out of the python website is virtually impossible > for the layman trying to learn Python. I am finding it very very hard to > expand on the stuff my mate has shown me already, and I need to expand so > much! I am looking for the Learning Python book now, but I doubt I will find > it on any shelves in my town, as I live in a backwater country downunder. > > ====== > > Whuddaya know? I just rang TechBooks and they have 4 in stock :-) > > I am off to buy one. > > It still doesn't change the fact that this is a VERY hard language to learn as > a layman without a guide or some sort of coding TLA translator. When and if I > get proficient I might write a page for people with that in mind. > > :-) > > I have no doubt you will be hearing from me again as I post newbie > questions.... > > *sigh* > > Nemir > Sent via Deja.com http://www.deja.com/ Before you buy. From rpm at wag.caltech.edu Wed Apr 19 16:14:10 2000 From: rpm at wag.caltech.edu (Richard P. Muller) Date: Wed, 19 Apr 2000 13:14:10 -0700 Subject: Building python on HPUX-10.2 Message-ID: <38FE1392.D1C01D64@wag.caltech.edu> I have successfully built python on a number of diffent platforms, but I'm having serious problems on HPUX 10.2. I go through the normal configure/make procedure, but the make crashes right away, when it is trying to link the first object (pgen), because it can't find the correct dl library (?). Has anyone successfully compiled Python on HPUX-10.*? If so, what configure string did you use? Rick From moshez at math.huji.ac.il Sat Apr 15 01:26:57 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 15 Apr 2000 07:26:57 +0200 (IST) Subject: Complaint Dept: My shoes! In-Reply-To: <8d7rf5$odi$1@newshost.accu.uu.nl> Message-ID: On 14 Apr 2000, Martijn Faassen wrote: > And now I'm going to tell you how to make len(None) return 0. This > is an implementation detail. It's a *bug* that ought to be fixed. > > Put this in the module where you want len(None) to be 0: > > None = "" Even better, anywhere in the application put import __builtin__ __builtin.None = "" del __builtin__ making-python-scarier-for-everybody-ly y'rs, Z. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From effbot at telia.com Thu Apr 13 05:58:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: 13 Apr 2000 04:58:40 -0500 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Apr 13) Message-ID: <75FC993A455AAF55.E13EAC3AEC7F76DE.AD552F20A3413B64@lp.airnews.net> Sightings: Python 1.6 alpha 2 is out! Lots of bug fixes, changes to the windows installer, and more. Expect a third alpha within two weeks or so. http://www.python.org/1.6/ On a related note: argumentclinic.py http://www.deja.com/=dnc/getdoc.xp?AN=606780882 Python Wins Jolt Productivity Award: http://www.sdmagazine.com/sdonline/jolts/joltopen.html Linux Journal: Python Programming for Beginners http://www2.linuxjournal.com/lj-issues/issue73/3946.html Remember the slightly misleading 1.6 release note we pointed to last week? Turned out that Guido didn't do it -- or at least that's what he says: http://www.deja.com/=dnc/getdoc.xp?AN=605330122 http://www.deja.com/=dnc/getdoc.xp?AN=606107926 In fact, Greg Ward claims he did it. And you know what? He might be right -- after all, who else would use the word "frob" sixteen times in a single post? http://www.deja.com/=dnc/getdoc.xp?AN=606237127 On the other hand, we keep hearing rumors that Greg is just a scapegoat, and that the real story is that Barry has found a portal into Guido's head: http://www.lfw.org/jminc/Guido%20Van%20Rossum/http://www.python.org/ Or whatever... http://metalab.unc.edu/Dave/Dr-Fun/df200004/df20000406.jpg Stuff: Neil Schemenauer: Garbage collection for Python http://www.deja.com/=dnc/getdoc.xp?AN=608256399 Kevin Cazabon: PIL compatible fonts http://members.home.com/lenticular/ Bruce Dodson: Python Language Support for ArcView GIS http://www.deja.com/=dnc/getdoc.xp?AN=608466145 Mark Hammond: win32all 130 for Python 1.6 available http://www.deja.com/=dnc/getdoc.xp?AN=605169788 Ken Seehof: Implementing generators in Python http://starship.python.net/crew/seehof/Generator.html Thomas Bellman: Why your network code may stop working when switching from FDDI to Ethernet http://www.deja.com/=dnc/getdoc.xp?AN=606778326 Just van Rossum: Stackless Python for MacOS http://www.deja.com/=dnc/getdoc.xp?AN=606779928 Michael Hudson: bytecodehacks, April 2000 http://www.deja.com/=dnc/getdoc.xp?AN=605263124 ======================================================================== Everything you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the center of Pythonia http://www.python.org eff-bot's complements this digest with his daily python url http://hem.passagen.se/eff/url.htm Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ Python Consortium emerges as an independent nexus of activity http://www.python.org/consortium The Vaults of Parnassus ambitiously collects Python resources http://www.vex.net/~x/parnassus/ Python To-Do List anticipates some of Python's future direction http://www.python.org/cgi-bin/todo.py 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 Archive probing trick of the trade: http://www.dejanews.com/dnquery.xp?QRY=&DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=threaded&showsort=date&maxhits=100&groups=comp.lang.python Previous - (U)se the (R)esource, (L)uke! - messages are listed here: http://purl.org/thecliff/python/url.html or http://www.dejanews.com/dnquery.xp?QRY=~g%20comp.lang.python%20Python-URL%21 Suggestions/corrections for next week's posting are always welcome. http://www.egroups.com/list/python-url-leads/ 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 burnout at heathers.stdio.com Fri Apr 14 14:24:32 2000 From: burnout at heathers.stdio.com (Eric H.) Date: Fri, 14 Apr 2000 14:24:32 -0400 Subject: Looking for IRIX Python programmers for help Message-ID: <38F76260.16603101@heathers.stdio.com> Hi, While building Python 1.5.2 for IRIX 6.5, I was editing Modules/Setup and discovered there is a section that mentions that you need a "multimedia development option(I think)" to build the "al" module and a couple others. Can someone clarify this? Is this really needed and if so, where do I get it? Thanx for your wonderful response and L8a P.S. A response via email would be much welcome since I don't get to check newsgroups every day. -- Parts of this message, including the email address, ? 2000-Eric Haddix. Use implies agreement to the terms and conditions made available on my homepage. Keep the Internet free, refuse to support the providers that copyright YOUR email and messages. All rights reserved. U.C.C. 1-207 visit my homepage @ http://www.bounce.to/EyesCremeProductions From neelk at brick.cswv.com Thu Apr 27 22:09:43 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 28 Apr 2000 02:09:43 GMT Subject: The Simple Economics of Open Source References: <390534BB.3D6CEBDF@libc.org> <3908DB34.5549085F@libc.org> Message-ID: Bill Anderson wrote: > > *All* software is under copyright or patent. By your argument, no > software is commodity. Minor correction: it's possible to place software, like any other IP, in the public domain. Some quite significant open source projects, such as the CMUCL Common Lisp compiler, are in the public domain. j Neel From dworkin at ccs.neu.edu Tue Apr 4 17:26:28 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 04 Apr 2000 17:26:28 -0400 Subject: ldap support? In-Reply-To: oliver's message of "Tue, 4 Apr 2000 16:06:06 -0400" References: Message-ID: oliver writes: > I wonder is there any standard LDAP support module in python? I looked up > SIGs, doesn't show anything there. I appreciate your help. Nothing standard at this time, but there is Python-LDAP. http://python-ldap.sourceforge.net/ -Justin From quinn at riyal.ugcs.caltech.edu Tue Apr 4 20:27:28 2000 From: quinn at riyal.ugcs.caltech.edu (Quinn Dunkan) Date: 5 Apr 2000 00:27:28 GMT Subject: Getting the argument names passed to a function ? References: <20000404225810.A12156@sz-sb.de> Message-ID: On Tue, 04 Apr 2000 21:08:55 GMT, Fredrik Lundh wrote: >Andreas Jung wrote: >> >> def myfunc(arg1,arg2): >> ... >> >> >> a=1;b=2 >> myfunc(a,b) >> >> Is it possible to get the name of variables that were >> used as arguments to call myfunc(). myfunc() should be >> able to determine the names 'a' and 'b'. Don't ask >> me why I need this - it's for a worse Python hack :-) > >short answer: no > >longer answer: maybe, using the incredibly clever and >totally evil bytecodehacks stuff: > > http://bytecodehacks.sourceforge.net Hmm, could you say: def arghack(arg): for k, v in globals().items(): if arg is v: return k else: return None Seems to work ok... From scarblac-spamtrap at pino.selwerd.nl Thu Apr 27 11:07:55 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 27 Apr 2000 15:07:55 GMT Subject: How can I get the name of an object??? References: <8e712k$65c$1@nnrp1.deja.com> <8e9090$c4d$1@nnrp1.deja.com> Message-ID: spex66 at my-deja.com wrote in comp.lang.python: > In article , > Alex wrote: > > > > An object could be referred to by any number of names: > > > > dd = zz () > > ee = dd > > > > Which name for the object do you wish to know? ee or dd? > > dd or in other words, the name of the FIRST made instance... What would happen in the following cases: 1) dd = zz() ee = dd del dd print ee.__name__ 2) dd = [xx(), yy(), zz()] print dd[2].__name__ 3) print zz().__name__ Classes have a name (the one used in their class: statement). Instances have no name, period. But why would you need it? In most cases where people try to use something like this, dictionaries are a solution. -- Remco Gerlich, scarblac at pino.selwerd.nl "This gubblick contains many nonsklarkish English flutzpahs, but the overall pluggandisp can be glorked from context" (David Moser) From scarblac-spamtrap at pino.selwerd.nl Fri Apr 14 10:12:08 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 14 Apr 2000 14:12:08 GMT Subject: Future compatibility of the Python C API References: <8d76t2$pig@newton.cc.rl.ac.uk> Message-ID: Richard Brodie wrote in comp.lang.python: > > "Mark Hammond" wrote in message > news:q4FJ4.1198$1D.10037 at news-server.bigpond.net.au... > > > > My big concern is Python 3000- what are the odds > > > that its C API will be backwards compatibility with Python 1.x? > > > > Not very good. If it is a real problem, simply dont upgrade. I would > > however expect the changes to cause compiler errors that are simple to > > fix - ie, very similar APIs, and unlikely to silently change behaviour. > > I suppose that someone out there is working on persuading SWIG to > generate suitable wrapper code? Since noone knows what Python 3000 is going to look like yet, that would be very hard, wouldn't it? :) -- Remco Gerlich, scarblac at pino.selwerd.nl 5:08pm up 39 days, 4:28, 8 users, load average: 2.27, 2.10, 2.09 From phd at phd.russ.ru Tue Apr 11 07:18:11 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 11 Apr 2000 11:18:11 +0000 (GMT) Subject: Redirecting the output from sys.stdout In-Reply-To: Message-ID: On Tue, 11 Apr 2000, Mikael Olofsson wrote: > > while 1: > > Why not the following? It was just an example. Usually I do parsing line-by-line, instead of slurping the whole file in - I often work with huge files... Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2.1/ phd2 at earthling.net Programmers don't die, they just GOSUB without RETURN. From jstok at bluedog.apana.org.au Sat Apr 1 04:20:19 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Sat, 1 Apr 2000 19:20:19 +1000 Subject: Debugging confusion -- too many stacks! Message-ID: <7cjF4.60441$3b6.236709@ozemail.com.au> I'm confused about the difference between the C stack, the Frame stack, and the stack *inside* each execution frame. >From reading the source, I believe that each new code object gets a new frame allocated on the frame stack, within which is stored all kinds of useful information about the context the code is executing in -- the global and local environment, a tuple of constants, a tuple of arguments etc. *Within* each frame is *another* stack, upon which the Python virtual machine loads and manipulates intermediate values. However, I'm not sure what the terminology is to refer to this third stack. Understanding the distinction seems to be vital to using pdb, though. From kc5tja at garnet.armored.net Sat Apr 29 14:11:27 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 29 Apr 2000 18:11:27 GMT Subject: What does "first class" mean? References: <3909F2F5.A6F91256@spacenet.tn.cornell.edu> Message-ID: In article , Neel Krishnaswami wrote: >In Pascal or C, for example, you can't write a procedure that creates >a function and returns it to its callers, whereas in Scheme or Python >this is trivial. This isn't *strictly* true. The following code, for x86 processors, returns a function that does nothing: typedef void NoOp(); NoOp *GenerateNoOpFunction( void ) { char *buf; buf = malloc( 2 ); if( buf != NULL ) { buf[0] = 0x90; /* NOP instruction; for demonstration */ buf[1] = 0xC3; /* RET instruction */ } return buf; } Sorry, I couldn't resist. :-) Seriously, though, this technique has been used in various graphics drivers, most often with software-only blit engines (where speed is critical). They'd basically act as dedicated compilers. Windows 95's stock VGA device driver does this, if memory serves me correctly. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From akuchlin at mems-exchange.org Tue Apr 11 16:13:38 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 11 Apr 2000 16:13:38 -0400 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com> <87r9cdhdb0.fsf@deneb.cygnus.argh.org> <38F319A4.89621192@mdlink.de> <38F351B0.45E137AA@roguewave <38F3836A.5F9A7C6F@roguewave.com> Message-ID: <3d7le4gzv1.fsf@amarok.cnri.reston.va.us> Synchronicity again ... someone just submitted some patches that seem to make this change and use interlocked functions for refcounting; see http://www.python.org/pipermail/patches/2000-April/000413.html . We'll have to wait and see if they get in. --amk From wilkes at memphisonline.com Fri Apr 21 11:36:53 2000 From: wilkes at memphisonline.com (wilkes at memphisonline.com) Date: Fri, 21 Apr 2000 15:36:53 GMT Subject: win32all build 125 debug builds? Message-ID: <8dpsik$fsu$1@nnrp1.deja.com> Does anyone have the debug builds for win32all build 125, or the source so that I may build them. Thanks, Wilkes Joiner wilkes at electracash.com Sent via Deja.com http://www.deja.com/ Before you buy. From greg at cosc.canterbury.ac.nz Wed Apr 19 23:31:12 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 20 Apr 2000 15:31:12 +1200 Subject: __del__ problem - more details provided. still stumped though. References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> Message-ID: <38FE7A00.102FB5A1@cosc.canterbury.ac.nz> Warren Postma wrote: > > class DBPtr : > def __init__(self,this): > self.this = this > self.thisown = 0 > def __del__(self): > if self.thisown == 1 : > dbc.delete_DB(self.this) # appears some exceptions being raised > here. That's a SWIG-generated shadow class! I had the very same kind of problem when I used SWIG to wrap some Xlib functions. What is boils down to is that: *** SWIG generates buggy __del__ methods! *** They don't protect themselves against the loss of module-level names at finalisation time. In the example above, if 'dbc' in the current module, or 'delete_DB' in the dbc module, has been clobbered by Py_Finalize before the __del__ method is called, trouble will result. My solution was to write my own shadow classes rather than relying on SWIG (I had other reasons to do this in any case). In your case, you could try editing the __del__ method to say def __del__(self, delete_DB = dbc.delete_DB): if self.thisown == 1 : delete_DB(self.this) and similarly in any other __del__ methods that are lying about. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From psl at mitre.org Thu Apr 27 10:50:33 2000 From: psl at mitre.org (Pete) Date: Thu, 27 Apr 2000 10:50:33 -0400 Subject: getting return values from calldll Message-ID: <390853B8.87AEBF0C@mitre.org> How can I check the return value from calldll? I called a function with a boolean return, and tried printing both the return value argument and a variable I set equal to the function call, but they both printed out nothing. From ulf.engstrom at b2b-link.com Wed Apr 5 04:36:35 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F8m?=) Date: Wed, 5 Apr 2000 10:36:35 +0200 Subject: alphanumerics in mails Message-ID: <029501bf9eda$0dd8e2c0$858647c1@DEVELOPMENT> I've made a small mail-client which is working very good, except for when I get mails with alphanumerics (which happens quite often since I'm in scandinavia;). If I send a mail with subject: 'Ett ?' The subject line in my mailclient will say: '=?iso-8859-1?Q?Ett_=E5?=' Is there some kind of parser for this, has someone made anything like this or do I have to make one? Handling my mail uses poplib,cgi,multifile and mimetools. Regards Ulf From tim_one at email.msn.com Sun Apr 2 01:18:25 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 2 Apr 2000 01:18:25 -0500 Subject: multiple interpreter sessions In-Reply-To: <8c2lkc$1di$1@cantaloupe.srv.cs.cmu.edu> Message-ID: <000b01bf9c6b$413cca80$752d153f@tim> [Helge Hess] > I would like to have separate Python runtimes in a single server, so > that they don't affect each other (eg for security and state reasons). > ... See the description of Py_NewInterpreter() in the "Initialization, Finalization, and Threads" section of the Python/C API manual. You can create sub-interpreters from a C extension this way, but there's no Python-level interface to this at present. Haven't used it myself, and, indeed, have yet to see any use of it. you-could-be-the-first-on-your-block!-ly y'rs - tim From markx.daley at intel.com Tue Apr 18 12:26:34 2000 From: markx.daley at intel.com (Daley, MarkX) Date: Tue, 18 Apr 2000 09:26:34 -0700 Subject: Lists Message-ID: This feels like a real newbie question, but here is the code that is causing my question: # Learning exceptions def test(): a = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] print a b = 5 for item in a: try: print b / a[item] except ZeroDivisionError: pass Here is the output of this code under IDLE: [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] 5 2 1 1 1 -1 -2 -2 -3 -5 Why is the list being processed in reverse? The exception works fine, but the math is backwards. I don't recall this happening before. TIA - Mark From aek at mail1.stofanet.dk Wed Apr 12 13:28:37 2000 From: aek at mail1.stofanet.dk (Anders Eggers-Krag) Date: Wed, 12 Apr 2000 19:28:37 +0200 Subject: global variables - how?? Message-ID: <8d2bne$qn7$1@news101.telia.com> how do I define a propper global variable that works in all functions in all modules? I have tried simply defining one outside of any function in the main module, I have tried using the global keyword under the same cicumstances, but they are not even avialible inside of functions within the main module... -- Anders Eggers - Krag From mjackson at wc.eso.mc.xerox.com Thu Apr 20 12:22:49 2000 From: mjackson at wc.eso.mc.xerox.com (Mark Jackson) Date: 20 Apr 2000 16:22:49 GMT Subject: docstrings References: <00bufsonasp7bgkf86lfb6sv5np5v8mqlj@4ax.com> Message-ID: <8dnasp$iep$1@news.wrc.xerox.com> Ben Wolfson writes: > is there a way to use %c and %s within a docstring, or to add strings > together in a docstring, so that if some strings are used in all > docstrings, but might be changed, I can simply change one or two > variables? This might do what you want, although it's ugly (in the sense that it serves the code-documentation - as opposed to user-documentation - function less well): cat > spam.py """I am a docstring""" sharedoc = """ and I am a widely-reused docstring clause""" __doc__ = __doc__ + sharedoc del sharedoc ^D yngvi> python Python 1.5.2 (#7, May 6 1999, 14:39:45) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import spam >>> print spam.__doc__ I am a docstring and I am a widely-reused docstring clause >>> -- Mark Jackson - http://www.alumni.caltech.edu/~mjackson An advertiser will happily make you feel bad about yourself if that will make you buy, say, a Bic pen. - George Meyer From wware at world.std.com Sun Apr 9 22:29:19 2000 From: wware at world.std.com (Will Ware) Date: Mon, 10 Apr 2000 02:29:19 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <000f01bf9eca$2eec8c60$3e2d153f@tim> <38ECF4E6.B85C62D5@sightreader.com> <8cr4an$j40$2@newshost.accu.uu.nl> Message-ID: Martijn Faassen (m.faassen at vet.uu.nl) wrote: > WRONGO! ALL UTHER LANGUZEZ SUCKZ!! PHYTHON IS THE BESTEST!!!!!1 FOR > EVERYTHING AND I HATEZ M$ TUU!! NOBUDDY ECSPEXTS THE SPANNISH ENQIUSITOAN > HAHAHAHH! PHYTHON JOKE SPAM SPAM! <.75 WINK WINK NUDGE>!!!!!!!1 I had been searching for the perfect way to express my feelings for Python. Your eloquence has brought an ineffable peace to my soul. But I'd probably want to shorten it before I stick it in my .sig. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From gmcm at hypernet.com Thu Apr 27 09:23:52 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 27 Apr 2000 09:23:52 -0400 Subject: Import File Madness In-Reply-To: <8e8ik5$t4v$1@nnrp1.deja.com> Message-ID: <1255280657-66425781@hypernet.com> jsolbrig at my-deja.com wrote: > Several Questions/Comment on the python import statement > > 1: Once a python application is large and various classes have > static member objects of different types, import statements seem > to have a similar logic to C include files. I.E., the question of > what order to do the include becomes non-trivial. Is there anyway > around this or ways to escape this? I'm not understanding your first sentence. import is easier than #include. For one thing, the first import of a module does all the work and installs it in sys.modules. Subsequent imports just get a reference from sys.modules. For another, unless you're using "from ... import ..." you're effectively creating mount points, and changes wrought by other modules will be visible. > 2: The import order/mechanism seems to be slightly different in > different variations of python - WinNT vs. Unix The search path (sys.path) is built differently, but the import mechanism is the same. > 3: It would be nice to some equivalent of "forward definitions" - > statements would let you construct a static element of type X > before you have imported the file with X in it. Ah, you are doing "from ... import ...". Don't do that. > 4: There seem to simply be bugs in the import mechanism which can > cause modules to be None after being imported intermitantly. Is > this known, is that this some "feature"? Is this my imagination? > It seems to happen in large applications - 200K source code. Never seen it, never heard of it, unless you're using "from". from Module import Variable causes the current Module.Variable to be bound to the name Variable in your namespace. Subsequent assignments to Module.Variable outside your namespace won't be visible inside your namespace. They would, if you'd used "import Module" and referenced "Module.Variable". - Gordon From algaba at my-deja.com Thu Apr 13 16:09:37 2000 From: algaba at my-deja.com (Manuel Gutierrez Algaba) Date: Thu, 13 Apr 2000 20:09:37 GMT Subject: Crosswords for Linux Backtracking recursive crossword generator Message-ID: <8d59hk$6to$1@nnrp1.deja.com> Crosswords for Linux Backtracking recursive crossword generator ------- Dear pythonistas, I'm the current maintainer of Crosswords For Linux http://www.ctv.es/USERS/irmina/cruo/cruolinux.htm And I'm the process of releasing all the generators and filters. I've finished the translation of the generator, which may be interesting for many of you , it's only 400 lines code and fast enough : http://www.ctv.es/USERS/irmina/cruo/genaut.py It's runnable, it doesn't need threads, nor other special libraries nor data, just download and : python genaut.py Comments/improvements are welcome! -- ------------- Manolo Sent via Deja.com http://www.deja.com/ Before you buy. From ben at co.and.co Mon Apr 17 22:22:41 2000 From: ben at co.and.co (ben at co.and.co) Date: Tue, 18 Apr 2000 02:22:41 GMT Subject: Scripting and Gnome and KDE References: <8d95m0$9j6$1@news1.xs4all.nl> <8damat$4ja$1@slb2.atl.mindspring.net> <8dbsgc$35o$1@news1.xs4all.nl> <38FB4336.2BC6C235@bioreason.com> <8dftlp$3s1$1@news1.xs4all.nl> Message-ID: Boudewijn Rempt wrote: >>> Absolutely, but I don't know that an essay on the problems is exactly >>> the right way of introducing the toolkit. > >> That's probably true. Given the goal of showing how to do non-obvious >> things with a toolkit, what changes would you recommend? > > Well, I'm not sure I saw any really non-obvious things - a treeview > isn't that spectacular nowadays, and neither is layout management. Layout managment was a relief after some MFC experience, and when I made the mistake of choosing a 22pt default font in licq (Qt plugin), I started seeing the merits of it. But then again, I'm not a seasoned Qt developper. >> it tells the reader how to solve a specific problem, but >> doesn't provide a general method for discovering how to use other >> parts of the toolkit. After reading the tutorial on http://wwww.valdyas.org (hope I get it right), I wondered how much PyQt and PyGtk resembled each other. IMVVHO, a general purpose signal/slot-mechanism would be nice addition to pyton. > Besides, toolkits are different enough that migrating from one to > another often demands a complete new way of thinking: that's something > the article in Dr Dobbs did show: tkInter is one way of working, > PyQt another, but PyGTK is completely different once again. That's > an important insight, I feel. There's still a huge problem with the various licences, as they don't really match Python's license. Greetings, -- ben . de . rydt at pandora . be ------------------ your comments http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora From grant at nowhere. Tue Apr 18 12:57:24 2000 From: grant at nowhere. (Grant Edwards) Date: Tue, 18 Apr 2000 16:57:24 GMT Subject: Integer solutions to linear equation? References: Message-ID: In article , Michael Hudson wrote: >> 64x = 41y + 1 >> >> Where x and y are both integers. After scratching our heads >> for a while, we used the brute force approach: >> >> for x in range(1,100): >> y = ((64*x)-1)/41 >> if 64*x == 41*y+1: >> print (x,y) >Use Euclid's algorithm; here's some code that does that: You know, that looks vaguely familiar. I took numerical analysis 20 years ago and haven't used it since. I'll have to do some reading on this (I've got a 20 hour plane trip coming up soon, so I should have plenty of time). -- Grant Edwards grante Yow! I request a weekend at in Havana with Phil visi.com Silvers! From dgoodger at bigfoot.com Sun Apr 23 23:56:44 2000 From: dgoodger at bigfoot.com (David Goodger) Date: Sun, 23 Apr 2000 23:56:44 -0400 Subject: Why doesn't O'Reilly use parrots on its python books? References: Message-ID: How about half a bee? If they ever run out of fauna and need to go flora, the only choice would be: the larch. From rcc at nospamthanks_jennic.com Wed Apr 26 04:31:14 2000 From: rcc at nospamthanks_jennic.com (Robert Cragie) Date: Wed, 26 Apr 2000 08:31:14 GMT Subject: Unsigned integer arithmetic References: Message-ID: Ray&Maria wrote in message news:PxvN4.1335$sf5.16905 at news.corecomm.net... | What's wrong with this: | | myInt = 0x7fffffff | myLong = long(myInt) #coerce to long | myInt2 = int(myLong) #coerce to int (if it fits) | | def printU32Hex(n): | if n > 0xffffffffL: | raise ValueError | print "0x%01x%07x" % (int(n >> 28), int(n & 0xfffffffL)) | | printU32Hex(0x7fffffffL) | printU32Hex(0xffffffffL) | printU32Hex(0x100000000L) Nothing at all in principle, but it would be nice to have a neater solution. I guess I'm showing my C background here, but it would be nicer to have a notion of unsigned numbers and also to be able to print longs. I don't like this, as it implies that 'i' is a 32 bit signed integer, but you don't have any control. It blows up here because it won't extend the type to a long - as it's typeless, I don't see why it should be able to do this automatically. >>> i = 0x7fffffff >>> i = i + 1 Traceback (innermost last): File "", line 1, in ? i = i + 1 OverflowError: integer addition Typeless languages are all very well, but there are times when I really would like to say 'this is a 32 bit unsigned integer - treat it as such' instead of implied typing. The warning bells sounded a bit on p33 of 'Learning Python' when it suggested that "as a rule of thumb, if you find yourself wanting to flip bits in Python, you should think long and hard about which language you're really using". But there are more compelling reasons why I am using Python than C for my particular application. I don't particularly want to have to start writing C companion libraries if I can avoid it. Robert From gbreed at cix.compulink.co.uk Fri Apr 28 06:47:12 2000 From: gbreed at cix.compulink.co.uk (gbreed at cix.compulink.co.uk) Date: 28 Apr 2000 10:47:12 GMT Subject: Converting = to == References: Message-ID: <8ebq7g$lfr$1@plutonium.compulink.co.uk> On Thu, 27 Apr 2000, Warren Postma wrote: > I have an "end user query tool" that uses Python expressions, but I want > comparisons to be able to be written either as A=B or A==B then I want > to > compare them using Python's Eval function. > > Problem is if you search and replace all = with == then users have to > use > the single-equals convention, and some of them will be python > programmers, > and will want to use the "non idiot mode" of the query tool. That's not the only problem. You'll also find != gets converted to !==, <= to <== and >= to >==. This would not be the expected behaviour in "non idiot mode". > So i did this, but is there a better way? > > >>> string.replace( string.replace("a=b a==b", "=", "=="), > > "====","==") > a==b a==b If you want to catch != etc as well, you'll need s = string.replace("a=b a==b b!=c", "=", "==") s = string.replace(s,"====","==") s = string.replace(s,"!==","!=") s = string.replace(s,"<==","<=") s = string.replace(s,">==",">=") Or you could use a regular expression. I think this works: s = re.sub("([^<>!=])=([^=])",r"\1==\2","a=b a==b b!=c") Or the equivalent: expr = re.compile(""" ([^<>!=]) # check for no preceding <,>,! or = = # matches = but not ==,<=, >= or != ([^=]) # catch both parts of == """, re.VERBOSE) s = expr.sub(r"\1==\2","a=b a==b b!=c") Which is clearer than a one-line regular expression, but longer than doing all the substitutions. It may be more efficient if the expression is only compiled once, but executed many times. From drew.mcdowell at msfc.nasa.gov Thu Apr 6 17:19:32 2000 From: drew.mcdowell at msfc.nasa.gov (Andrew McDowell) Date: 6 Apr 2000 21:19:32 GMT Subject: Was Re: need wrapper for ssh/scp Message-ID: <8civ14$rm7$1@hammer.msfc.nasa.gov> Thomas Wouters wrote: >ssh/scp (and indeed most programs that ask for a password) talk directly to >the tty when getting sensitive information (like the password or the >passphrase.) You can catch this by using the 'pty' module. You probably want >to pty.fork(), and then redirect stdin/stdout, and fiddle with the terminal >on both ends to easily pass the passphrase... You face the usual deadlock >problems though, when both ends of the pipe are waiting for the other to >send data. Umm....Help? :) I also working with ssh to execute some remote commands on different servers. I'd previously been hobbling together this strange idea of generating an Expect script in python then running it. (*bleh*) So once I saw was clued onto the pty module I started playing with it. Well...I'm either severely confused, or something isn't working properly. Could anyone offer some help? Here's a sample of how I'm attempting it now: #!/usr/local/bin/python import os, string, pty, time, signal def remote_ex(hostname, password): pid, fd = pty.fork() if pid == 0: os.execv("/usr/local/bin/ssh",[hostname]) else: time.sleep(2) print "Child says %s" % string.strip(os.read(fd,1024)) print "Child took %d password bytes." % os.write(fd, password) time.sleep(4) #being over cautious print "Child took %d command bytes" % os.write(fd, "echo $HOST > ptyhost.txt") print "Child took %d exit bytes." % os.write(fd, "exit") os.kill(pid, signal.SIGKILL) return #=-=-=-=-=-Main=-=-=-=-=-=-=# def main(): myhost = string.strip(raw_input("Enter a host:")) mypass = string.strip(raw_input("Enter your Password:")) remote_ex(myhost, mypass) ########################## if __name__ == "__main__": main() From quinn at mono.ugcs.caltech.edu Mon Apr 10 20:44:34 2000 From: quinn at mono.ugcs.caltech.edu (Quinn Dunkan) Date: 11 Apr 2000 00:44:34 GMT Subject: Why should I switch to Python? References: Message-ID: On Mon, 10 Apr 2000 20:02:40 GMT, Blake Winton wrote: >On Fri, 31 Mar 2000 19:43:58 -0800, Aaron Turner wrote: >>I've been coding Perl for over 3 years and really like it. (Especially >>it's syntax and ability to grok my programming style.) > >Now, just as a side note, why is it that the sets of The Perl Hackers I >Know, and The People I Know Who Use The Word "Grok" are the same set? I always suspected perl programmers were from Mars. Now if we could figure out where python programmers are from, someone could write a book and get rich. *runs and ducks* From nospam.newton at gmx.li Thu Apr 6 01:43:47 2000 From: nospam.newton at gmx.li (Philip 'Yes, that's my address' Newton) Date: Thu, 06 Apr 2000 05:43:47 GMT Subject: blessed be Guido, for "5 <= X <= 10" does what it should... References: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca> Message-ID: <38ec201b.80500674@news.nikoma.de> On Tue, 4 Apr 2000 13:42:41 -0500, "Warren Postma" wrote: >Hey, is the APL symbol set anywhere in Unicode!? Of course :-) In the "Miscellaneous Technical" Block, there's a subsection "APL" from U+2336 to U+237A. HTH. Cheers, Philip -- Philip Newton From spamfranke at bigfoot.de Wed Apr 26 19:26:21 2000 From: spamfranke at bigfoot.de (Stefan Franke) Date: Wed, 26 Apr 2000 23:26:21 GMT Subject: SPARK / Earley Parser question Message-ID: <3907774d.32199072@news.btx.dtag.de> I'm designing a grammar with John Aycock's SPARK toolkit. Earley's algorithm is said to be n^3 time bound in general, n^2 for unambiguous grammars and linear for most practical programming language grammars. Are there some rules of thumbs which kind of rules should be avoided to retain linear complexity? In particular, I wonder if using empty right-hand sides for rules has any disadvantages. Online references would be appreciated. Stefan From effbot at telia.com Thu Apr 13 13:02:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 13 Apr 2000 17:02:42 GMT Subject: Complaint Dept: My shoes! References: <8d4s4d$mvr$1@nnrp1.deja.com> Message-ID: musingattheruins at my-deja.com wrote: > if len(shoe)>0: print shoe, hit_on_head() real python programmers use: if shoe: print shoe, hit_on_head() for more information, read the fine manual; section 5.10 in the language reference describes what's true and what's false: http://www.python.org/doc/current/ref/lambda.html From donb at init.com Wed Apr 5 13:02:36 2000 From: donb at init.com (Donald Beaudry) Date: Wed, 05 Apr 2000 13:02:36 -0400 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <8cfqf7$4ml$4@newsserver.rrzn.uni-hannover.de> Message-ID: <200004051702.NAA04361@zippy.init.com> In article , "Warren Postma" writes: > Speaking of Dummies, was there/is there a LISP for Dummies, or > Smalltalk for Dummies? Can Python for Dummies be far off? You can find the answer to those and similar questions in "The Complete Idiot's Guide to the Dummy Series" -- Donald Beaudry Ab Initio Software Corp. 201 Spring Street donb at init.com Lexington, MA 02421 ...Will hack for sushi... From hamish_lawson at yahoo.co.uk Sun Apr 9 12:19:26 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Sun, 09 Apr 2000 09:19:26 -0700 Subject: Migrating Tcl system to Python References: <095cc48a.7e9b36dd@usw-ex0108-063.remarq.com> <000C48B993BF96DA.95DEBE4215A79896.7F63D15FB99EE88D@lp.airnews.net> Message-ID: <248819a8.00d5228e@usw-ex0106-045.remarq.com> Cameron Laird wrote: [Stuff about communicating between Tcl and Python.] > Minotaur. CORBA. ILU. COM, maybe. Pipes. Named pipes. The systems will be on Linux so COM is out but the rest are possibilities. As far as I can see, one of the main issues in communicating between Tcl and Python will be how to handle passing lists and dictionaries (arrays in Tcl). XML-RPC manages this automatically and although I don't have any experience with either CORBA or ILU, I imagine they do too. If I were to use a pipe approach, there would presumably be a need for a layer to translate between Tcl's and Python's representations of data structures; though I think this might be reasonably simple, are there solutions already available, or issues I'd need to be aware of? Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From gregm at iname.com Thu Apr 27 08:25:13 2000 From: gregm at iname.com (Greg McFarlane) Date: Thu, 27 Apr 2000 22:25:13 +1000 Subject: Radio-button in Tkinter In-Reply-To: <39028096.24B972B4@swt.edu>; from ns56645 on 22 Apr 2000 at 11:48:22PM References: <39028096.24B972B4@swt.edu> Message-ID: <20000427222513.04343@nms.otc.telstra.com.au> Shah, This is a well-known feature of Tkinter.Variable - you must keep a reference or the Tcl variable is destroyed. In your case you will need to keep a reference to v1 and and v2. If the code snippet you supplied is from a method in a class, use self.v1 and self.v2 instead of just v1 and v2. If the code is in a function, you will have to make v1 and v2 globals. Aside: Why didn't you supply us with a snippet that we could run, rather than just cut out a bit from your code? There would be two benefits to doing this: First, myself and others would not have to work out how to recreate the bits that you have left out (such as frame3). Secondly, if you had done what I did (and John Grayson, it would appear) and run the code at the top level, rather than in a function, you would have noticed that the problem went away - you probably would have then realise what the cause was and would not have had to post to the news group in the first place. Moral - if you have code that does not behave as you expect, create the absolute smallest runnable program that demonstrates the problem. If that does not lead you to the solution, post it. Greg On 22 Apr, ns56645 wrote: > In the following code the radiobuttons that have been set are not seen > as default selected in the output. > For e.g v1.set(3) # initialize should set the radiobutton with > text 'BOTH' as default. > > > What could be the wrong with the code? > Please help? > > Shah > > > ####### Frame 3 Radio Buttons > ########################################################## > > # Create the "Location" contents of the page. > group = Pmw.Group(frame3, tag_text = 'Location') > group.pack(fill = 'both', expand = 1, padx = 15, pady = 10) > > v1 = IntVar() > v1.set(3) # initialize > rb1 = Radiobutton(group.interior(), text = 'SWT', variable=v1, > value=1) > rb1.grid(row = 0, column = 0) > rb2 = Radiobutton(group.interior(), text = 'WHS', variable=v1, > value=2) > rb2.grid(row = 0, column = 1) > rb3 = Radiobutton(group.interior(), text = 'BOTH', variable=v1, > value=3) > rb3.grid(row = 0, column = 2) > > > # Create the "Level" contents of the page. > group = Pmw.Group(frame3, tag_text = 'Level') > group.pack(fill = 'both', expand = 1, padx = 15, pady = 10) > > v2 = IntVar() > v2.set("13") # initialize > rb11 = Radiobutton(group.interior(), text = 'Grad', variable=v2, > value=11) > rb11.grid(row = 0, column = 0) > rb12 = Radiobutton(group.interior(), text = 'UnderGrad', > variable=v2, value=12) > rb12.grid(row = 0, column = 1) > rb13 = Radiobutton(group.interior(), text = 'BOTH', variable=v2, > value=13) > rb13.grid(row = 0, column = 2) > > -- Greg McFarlane INMS Telstra Australia gregm at iname.com From ivanlan at callware.com Thu Apr 13 00:30:59 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 12 Apr 2000 22:30:59 -0600 Subject: need help just begining References: <11822ca0.dd34a400@usw-ex0109-068.remarq.com> <38F41190.C0BB507B@sympatico.ca> <38F53E5A.977913FE@cosc.canterbury.ac.nz> Message-ID: <38F54D83.B0F620A8@callware.com> Hi All-- Greg Ewing wrote: > > R E Heath wrote: > > > SheaMon wrote: > > > > > > can > > > I just leave the numbers and stuff like that and just edit > > > the rest? I get so lost in the number part of the > > > programming. > [snip] > I don't think that's necessarily good advice. If > numbers turn you off, traditional BASIC is going to > turn you off even more. You can do quite a lot of > useful things in Python without ever going near a > number -- something that can't be said about > traditional BASIC! > [snip] > There are introductory books to Python around. I > haven't had personal experience of any of them, but > many people seem to think that "Learning Python" > is reasonably good. Whether it's any less biased > towards number-intensive examples I don't know. > I'm sure others will offer advice on the matter. > I'm holding in my hands the very first copy of _Teach Yourself Python in 24 Hours_. I would like to recommend it to you, SheaMon, and I will, with the caveat that there is a bit of number stuff in there. However, what's included isn't that hard, and I give pointers to websites where you can do a little catchup. The hardest "number stuff" in the book is the Mandelbrot set, and Python makes the math *easy*. I encourage you to take a look at it; there's plenty of info in there for the compleat newbie to programming, so don't dismiss it out of hand. Check the PSA Bookstore, or your local B&N or Borders if you want to see it before you buy it. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From aahz at netcom.com Sun Apr 16 14:04:55 2000 From: aahz at netcom.com (Aahz Maruch) Date: 16 Apr 2000 18:04:55 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8dbdj3$dgt$1@slb2.atl.mindspring.net> <8dcpom$fbc$1@slb3.atl.mindspring.net> Message-ID: <8dcvc7$au2$1@nntp9.atl.mindspring.net> In article , Remco Gerlich wrote: > >Pass functions? > >def exp_if(test, true, false): > if test: return true() > else: return false() > >x = exp_if(a is not None, lambda a=a,i=i: a[i].weeble, lambda: 0) > >Getting silly, though :) It's not so silly if true() and false() are coroutines or generators. That way you can get rid of the lambda. ;-) -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "First one back from the bathroom gets to be the bottom." From sholden at bellatlantic.net Wed Apr 5 18:25:37 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 05 Apr 2000 22:25:37 GMT Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> <38EA7C18.8F3150D1@roguewave.com> <38EA87DD.3F24BEBF@exceptionalminds.com> Message-ID: <38EBBC4A.C2F94F8F@bellatlantic.net> Timothy Grant wrote: > [ODBC DSN creation details snipped] > > OK, So I've created a system level DSN named TestDB and pointed it at an > MDB file my server. > > When I do the following in the interactive window... > > import ODBC.Windows > > db = ODBC.Windows.Connect('TestDB') > > ...I get the following error... > > NotSupportedError: ('IM001', 0, '[Microsoft][ODBC Driver Manager] Driver > does not support this function', 4226) > > What am I doing wrong? > > -- > Stand Fast, > tjg. > Here's an extract from a program I'm using to index email in an Access database: class SubIndex: """Implements indexing of messages by subject and various other keys.""" def __init__(self): self.db = ODBC.Windows.connect("Mail") self.CR = self.db.cursor() This seems to work fine. Thought you might have a case error in your code, but it also seems to work if I use self.db = ODBC.Windows.Connect("Mail") so I'm not sure why you are getting this error. UNLESS you have the database open in Access as you work? Might be a weird locking problem? Can't manage to reproduce it here, though. So far I'm working with LOCAL FILES as databases. There may be a problem with accessing a file on a network share? Hold on ... (copies 57 MB file to server and reconfigures ODBC source) ... dammit, that works too. Out of bright ideas. Let me know what you find. I'm using Windows 98, with the 3.50.342800 driver. I could try an NT client if that would help. regards Steve -- "Bulding information systems just because it's fun." Steve Holden sholden at bellatlantic.net 703 716 7275 From aa8vb at yahoo.com Fri Apr 14 13:39:55 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 14 Apr 2000 13:39:55 -0400 Subject: Doesn't anybody write to paper anymore? In-Reply-To: References: <38F5FDF3.EE2FBA01@tcac.net> Message-ID: <20000414133955.A5376@vislab.epa.gov> Alex: |> I would like to pass it into the queue. IO redirection in the shell |> is ugly and awkward. | |I don't know whether this counts as ugly and awkward IO redirection, but |perhaps you could do something like this: | |from os import popen |printer = popen ('lpr') |printer.write("page 1\n\r\f") |printer.write("page 2\n\r\f") |printer.close () If it doesn't work, try lp instead of lpr. Try a test from the shell (command window) and see what works: echo "This is an lpr test" | lpr echo "This is an lp test" | lp Note that both assume you or someone has configured the printing service on this box (possibly not the case for a home FreeBSD or Linux box). If this hasn't been done, search your OS documentation (printcap, lpd, and lpsched are useful search strings). -- Randall Hopper aa8vb at yahoo.com From glyph at twistedmatrix.com Wed Apr 19 13:20:00 2000 From: glyph at twistedmatrix.com (Glyph Lefkowitz) Date: 19 Apr 2000 12:20:00 -0500 Subject: Pickling Robustly Message-ID: Please forgive me if I've missed something obvious, and don't flame too hard -- I've read the FAQs, and in general tried to do my homework. This is my first post on USENET. (Apologies again if this shows up multiple times; my ISP doesn't provide netnews, and the server I managed to snag doesn't allow posting :-( ) I am currently writing a client-server application in Python. The server has significant state, in the form of a directed graph with many cyclic and shared references. I was OVERJOYED to discover Pickle. The persistence format that I was using before (in the slower, buggier, more obfuscated Java version of this software) was rather naive, performed poorly, and imposed several arbitrary and inconvenient restrictions on the type of data that was allowable. (Funny, I worked with Java for 2 years, and python for only a few months, but I find myself saying things like "inconvenient and arbitrary" about Java all the time now ... as well as things like "slower, buggier, more obfuscated") Pickle is everything I wanted, and more. The copy_reg module makes it moreso. I am so thrilled I can barely contain myself. Except... It appears that Pickle is not terribly robust. One of the major necessary features of the software I'm writing is the ability of naive programmers to write all sorts of arbitrary code: the more naive and the more arbitrary the better. Python makes this part so easy it feels like I'm not even doing anything. However, it also means I may have to put all this code into restricted execution mode (and therefore reduce its random arbitrarity (is that a word?)) to prevent it from munging the whole of my persistent data. I am also terrified that if I try this approach I will miss some special case that will be pointed out to me when I lose a day's worth of work because someone assigned a data member to some "bad" type. Due to the extremely self-referential nature of the data structures I'm using, it is much easier to keep everything in one pickle (and that effectively happens anyway, even if I don't try to, thanks to the dependency resolution that pickle does). The problem is that pickle (as far as I can tell, anyway) does not allow one to register error handlers to keep track of when a problem occurrs. If an unpicklable datatype is attempted to pickle, EVERYTHING previously pickled will suddenly vanish and no indication will be given about where the offending data was. If you've got a large data structure like I anticipate, this means writing and loading code on-the-fly to attempt a traversal of that structure to determine where the unpicklable type is. I am using the following code to make some things more amenable to pickling (see below) but it's not nearly enough; I can't hope to catch every datatype this way. (Or can I? Is it possible to define some sort of catch-all type?) If there is no way to do this with the existing pickle, would it be possible to hack it in somewhere easily, or shall I have to do my own persistance algorythm? Note -- it is perfectly acceptible to me for the solution to this problem to merely ignore those types which it does not persist. All I want to do is be able to explicitly say 'these attributes are unpicklable', and have them fail to appear when the pickle is re-loaded. The more types persist correctly, the better, of course, but that's not my main concern. ---cut here: pickleplus.py--- import copy_reg, types, new from cPickle import * def method_pickle(method): return method_unpickle, (method.im_func.__name__, method.im_self, method.im_class) def method_unpickle(im_name, im_self, im_class): unbound=getattr(im_class,im_name) if im_self is None: return unbound bound=new.instancemethod(unbound.im_func, im_self, im_class) return bound def function_pickle(function): function_name=function.__name__ module_name=function.func_globals['__name__'] return function_unpickle, (module_name, function_name) def function_unpickle(module_name, function_name): module=__import__(module_name, # none none because there is no context # for this import, 1 because we want the # subpackage (if this is one) None,None,1) return getattr(module, function_name) copy_reg.pickle(types.MethodType, method_pickle, method_unpickle) ---cut here--- Thanks very much for any help! -- __________________________________________ | ______ __ __ _____ _ _ | | | ____ | \_/ |_____] |_____| | | |_____| |_____ | | | | | | @ t w i s t e d m a t r i x . c o m | | http://www.twistedmatrix.com/~glyph/ | `__________________________________________' From thomas at xs4all.net Thu Apr 6 04:05:30 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 6 Apr 2000 10:05:30 +0200 Subject: CLI over Sockets? In-Reply-To: <20000406002732.D1027@shell2.xcom.net>; from cdaniel@xcom.net on Thu, Apr 06, 2000 at 12:27:32AM -0400 References: <20000406002732.D1027@shell2.xcom.net> Message-ID: <20000406100529.A13830@xs4all.nl> On Thu, Apr 06, 2000 at 12:27:32AM -0400, Cliff Daniel wrote: > Any such module exist that might help in implementing a > CLI over sockets? One such beast would preferrably operate in > character mode and would would need to implement vt100 to provide > the command line editing features (arrow keys, insert at cursor, etc). > I'm know I'm asking for a lot but it's worth a shot in case someone > has implemented this already. I wrote a little thing like that once, to provide a front-end for our Lucent (formerly Livingston) Portmasters. I needed a telnet that could log, and log timestamps. (Portmasters have extraordinary debug information... all the hexdumps of PPP packets and ISDN frames you want, but no timestamps.) I shortly thought about adding command history & editing as well (which the PMs lack too) but the tool had served my purpose and i haven't had use for it since. It's dead easy to write such a tool though: look at telnetlib for some good examples. I ended up overriding the interact() method to add my logging, but you still get all the protocol stuff for free. (telnet is more than just a TCP socket, you see.) I'd guess that it isn't too much trouble to add readline and your own completer function (if necessary, that last bit) but i'm not sure if readline works properly with the select() method interact uses... you might want to use mt_interact or something similar instead. (Then again, i haven't looked at readline at all, partly because of it's lack of documentation last time i looked, so it might be a lot harder than that.) I have my logging telnet somewhere on my laptop still, i could send it if you want an example. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From chafik at nevrax.com Fri Apr 7 03:40:35 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Fri, 7 Apr 2000 09:40:35 +0200 Subject: Some problem with python 1.6 Message-ID: <021b01bfa064$8fab3880$1001a8c0@nevrax.net> I work with Visual C++ (6.0). When i build a project who have a python support i have the following error: 1) The library Python16_d.lid dos not existe. I renamed in the config.h the pragama comment (lib,"python16_d.lib") to pragama comment (lib,"python16.lib"). But now i have the follow link error: 2) Linking... Creating library Debug/PYTHONLIB.lib and object Debug/PYTHONLIB.exp PyLib.obj : error LNK2001: unresolved external symbol __imp___Py_Dealloc PyLib.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal PyLib.obj : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs PythonMethode.obj : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs This link error happen only with the debug version, not that the difference between the debug and release comme from the _DEBUG preprocessor. .....................Thanks for answer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.faassen at vet.uu.nl Fri Apr 21 15:22:23 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 21 Apr 2000 19:22:23 GMT Subject: Using python on the web References: <8dq6k3$qmb$1@nnrp1.deja.com> Message-ID: <8dq9pf$pjg$3@newshost.accu.uu.nl> spenrose at my-deja.com wrote: > In article , > Brent Fulgham wrote: >> A couple of questions: >> >> > We build medium-busy, CGI-intensive sites in Python. We were briefly >> > quite excited about Zope, but once we realized it locked us into Yet >> > Another Programming Language, we lost interest. DHTML is >> > particularly >> > problematic, >> 1. I'm not familiar with Zope. Is DHTML specific to Zope? It seems >> to be proudly advertised on a lot of "webware" brochures I see these >> days. > My limited understanding of Zope is that to run Zope is to use DHTML and > vice-versa. I welcome corrections on this point. No, that's *DTML*, not DHTML. Confusing naming! DTML stands for "Document Template Markup Language" and is quite a different beast than DHTML. See my other post. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From m.faassen at vet.uu.nl Tue Apr 4 07:07:44 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 4 Apr 2000 11:07:44 GMT Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> Message-ID: <8ccie0$7fs$1@newshost.accu.uu.nl> Just van Rossum wrote: > At 8:48 AM +0000 04-04-2000, fredrik at pythonware.com wrote: >>> Consider that *every one* of the protocol modules which offers >>> a connect() method uses a two-argument signature for it: ftplib, >>> gopherlib, httplib, imaplib, nntplib, poplib, smtplib, telnetlib, >>> urllib. And they all *use* the two-argument connect when invoking >>> their underlying socket! >> >>not true. look again (doesn't matter if you look in the 1.5.2 >>library or the 1.6 library -- what you just said is not correct >>in either case). > Here's the result from a quick search through the Python 1.5.2 lib: [snip internals using host, port arguments] And what Tres also mentioned was the external interfaces of ftplib, etc. A quick glance at the 1.6 alpha shows that they also have separate host/port arguments. It would seem inconsistent to change 'connect' to use tuples in one case, but 'connect' in ftplib a host and port argument.. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From kbd at iti-oh.com Thu Apr 13 08:41:08 2000 From: kbd at iti-oh.com (tribune.oar.net) Date: Thu, 13 Apr 2000 08:41:08 -0400 Subject: [Announce] CAD data access from Python Message-ID: <8d4fec$7bm$1@tribune.oar.net> After becoming hooked on Python 2 years ago, we have been developing code to allow Python to directly access CAD data (with other related types in the works). We have just released our first product, CADScript, based on this technology. We are also releasing a new version of our CAD model quality checker, CAD/IQ, that is written completely in CADScript. The full press release is below. Note that we will be portions of this freely available to developers, more details will be announced over the next several weeks. I'd like to say thanks to Guido and everyone else in the Python community who has made Python what it is today. Thanks to Python, we are allowing a *much* larger group of people to access data that, until now, has been only accessible to people with a full blown C/C++ development environment. We've also significantly cut our internal development time/costs by embracing Python and encourage others to take a serious look at Python. Keith Davidson Chief Technology Director International TechneGroup Inc. ---------------------------------------------------------------------------- ---------- International TechneGroup Incorporated (ITI) announces the release of CADScript, a Python based development tool that significantly reduces the time and effort spent developing and maintaining multi-CAD applications. CADScript is based on the Python scripting language and provides modules that allow access to native CAD data. CADScript programs can be written once and then run against any CAD API. The software is extremely valuable for a vendor of downstream applications whose software complements multiple CAD systems. CADScript serves as an enhancement for native CAD APIs and is not intended to replace them. ITI's CADScript provides a consistent method of accessing multiple CAD APIs for data and functionality. By utilizing the Python language, CAD developers immediately have access to the powerful OS, internet, and other modules included with Python. ITI will be announcing an online community for CADScript developers in the near future. For more information visit http://www.iti-oh.com/pdi or contact Robert Farrell at 800-783-9199, 513-576-3900, or info at iti-oh.com. From aa8vb at yahoo.com Mon Apr 17 14:02:33 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Mon, 17 Apr 2000 14:02:33 -0400 Subject: comparing strings and ints In-Reply-To: <20000412112935.A2446939@vislab.epa.gov> References: <2YmI4.366$rc9.188014080@newsb.telia.net> <20000411134358.A2352304@vislab.epa.gov> <1256641282-42160637@hypernet.com> <20000412075812.A2449004@vislab.epa.gov> <20000412112935.A2446939@vislab.epa.gov> Message-ID: <20000417140233.A319729@vislab.epa.gov> Arg. This just bit again (me this time), but with the max() function: >>> max(3,'2') '2' I wish there'd have been a type exception here. For now, I guess just be very careful when parsing datafiles that you convert all your numeric strings to some other type; you'll get no warning if you don't. -- Randall Hopper aa8vb at yahoo.com From mhammond at skippinet.com.au Sun Apr 9 21:30:00 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 10 Apr 2000 01:30:00 GMT Subject: win32com and Reflection2 References: Message-ID: You should be able to run "makepy" over the reflection object (makepy will present a list of objects). You can find "makepy" on the Pythonwin "tools" menu. Once you have done that and created the Reflection object, the constants should be available in win32com.client.constants eg, win32com.client.constants.SomeConstantName Note that the Reflection constants wont appear until you have created the reflection object using win32com.client.Dispatch() Mark. "Roger Upole" wrote in message news:WE8I4.100257$ra.2387838 at news.easynews.com... > I'm scripting Reflection2 sessions with win32com.client.Dispatch. > However, there are some constants (error codes, transmission modes, > etc) in a typelib that I can't seem to get at from the Dispatch object. > Anybody know of a way to access these from Python ? > If not, is there any way to get to them from C++ ? > I have very little experience with C, but if it is simple I can > probably blunder my way through it. > Roger Upole > > > From jsolbrig at my-deja.com Thu Apr 27 01:19:10 2000 From: jsolbrig at my-deja.com (jsolbrig at my-deja.com) Date: Thu, 27 Apr 2000 05:19:10 GMT Subject: Import File Madness Message-ID: <8e8ik5$t4v$1@nnrp1.deja.com> Several Questions/Comment on the python import statement 1: Once a python application is large and various classes have static member objects of different types, import statements seem to have a similar logic to C include files. I.E., the question of what order to do the include becomes non-trivial. Is there anyway around this or ways to escape this? 2: The import order/mechanism seems to be slightly different in different variations of python - WinNT vs. Unix 3: It would be nice to some equivalent of "forward definitions" - statements would let you construct a static element of type X before you have imported the file with X in it. 4: There seem to simply be bugs in the import mechanism which can cause modules to be None after being imported intermitantly. Is this known, is that this some "feature"? Is this my imagination? It seems to happen in large applications - 200K source code. Joe Solbrig jsolbrig at webcom.com Sent via Deja.com http://www.deja.com/ Before you buy. From schmertz at wam.umd.edu Tue Apr 18 11:41:59 2000 From: schmertz at wam.umd.edu (Bob Schmertz) Date: Tue, 18 Apr 2000 11:41:59 -0400 Subject: Project idea - python In-Reply-To: <38FC0E72.9AB025DB@webwitches.com> References: <38FC0E72.9AB025DB@webwitches.com> Message-ID: On Tue, 18 Apr 2000, Shae Erisson wrote: >Parag Shah wrote: >> >> hi, >> i am planning to do a project for my bachelors where i wish to write a translator for a language (undecided at >> the moment ) which generates java bytecode. how do i go about doing it??? >> thanx in advance >> cheers This is almost exactly what I'm doing for a class, only we're actually using Java. > >read up on jpython, it uses JavaCC. > >http://www.jpython.org/docs/compile.html You may also want to use the following: Plex - essentially a Python version of Lex, the most popular lexical analyzer (http://www.cosc.canterbury.ac.nz/~greg/python/Plex/) SPARK - sounds like a Python implementation of Yacc/Bison, though from what I can tell it doesn't handle complex grammars such as LR (http://www.csr.UVic.CA/~aycock/python/) JavaClass - OK, I haven't had a chance to look at this, and since it's in and about Java, I'm not sure if this is actually going to help. Anyway, this seems to be related to generating or manipulating Java bytecode. Is this the sort of help you were looking for? -- Cheers, Bob Schmertz From dan at cgsoftware.com Wed Apr 12 19:11:31 2000 From: dan at cgsoftware.com (Daniel Berlin+list.python) Date: 12 Apr 2000 19:11:31 -0400 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) In-Reply-To: pj@sgi.com's message of "12 Apr 2000 22:50:26 GMT" References: <200004102111.HAA03380@envy.fulcrum.com.au> <38F4996F.E3BD2626@acm.org> <8d2p3q$2vj9o$1@fido.engr.sgi.com> <8d2uji$301cu$1@fido.engr.sgi.com> Message-ID: pj at sgi.com (Paul Jackson) writes: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/links/ > |> Nope, both lynx, and links, exist. > > oh - could you offer a link to "links" -- it's > a hard name to search for -- too many false hits. > From helge.hess at mdlink.de Tue Apr 11 13:14:25 2000 From: helge.hess at mdlink.de (Helge Hess) Date: Tue, 11 Apr 2000 19:14:25 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com> <87r9cdhdb0.fsf@deneb.cygnus.argh.org> <38F319A4.89621192@mdlink.de> <38F351B0.45E137AA@roguewave.com> Message-ID: <38F35D71.4DD20040@mdlink.de> Bjorn Pettersen wrote: > Helge Hess wrote: > > I think what he wants to do (me too ;-) is to run several copies of the > > interpreter in *one* process, possibly in multiple threads. > > But I'm not sure whether this is a GC issue though (RC isn't thread-safe > > anyway, right ?). > > Well, it actually can be -- at least on Windows :-) The question is, what overhead is involved here. If these Windows functions wrap the RC ops in locks you have gained nothing (wrapping RCs in locks breaks performance in a big way). Note that std-RC is often only one CPU op (incr,decr). Also note that not only the ++ or -- needs to be protected, but the '==0' check as well. Eg: [task1] [task2] dec(obj); inc(obj); could be [task1] [task2] obj->rc--; if (obj->rc==0) obj->rc++; free(obj); object-freed assumes to have a valid obj [note that checking for 0 in task2 doesn't solve the problem, since the check wouldn't be atomic again, but maybe I'm missing something]. A (m&s) GC is somewhat in advantage here, since it is run only at specified (safe) points, so there is no locking required at such high frequency. Helge From a.eyre at optichrome.com Tue Apr 4 09:40:33 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 4 Apr 2000 14:40:33 +0100 Subject: Converting a hex string to an integer In-Reply-To: Message-ID: <000c01bf9e3b$596e1970$3acbd9c2@optichrome.com> > >>> import string > >>> string.atoi("0xab", 0) > 171 > > or in 1.6: > > >>> int("0xab", 0) > 171 or (probably available since v1.0): >>> eval("0xab") 171 #include ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From effbot at telia.com Sat Apr 1 11:58:30 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 01 Apr 2000 16:58:30 GMT Subject: Paid to work in Python? (was: Re: Choice Of Language) References: <8ajmib$elo$1@nnrp1.deja.com> <8c3ats$b5f$1@nntp.Stanford.EDU> Message-ID: Grant Edwards wrote: > > >I should post Google's Python-related job openings to > > http://www.python.org/Jobs.html > > Pointless tanget: Is it just me, or is Google really the last > usable search engine? I just love their new MentalPlex search feature! (doesn't work in eff-bot mode, though -- I keep getting "error 008: remove aluminum foil") From kragen at dnaco.net Sun Apr 23 01:48:58 2000 From: kragen at dnaco.net (Kragen Sitaker) Date: Sun, 23 Apr 2000 05:48:58 GMT Subject: Distribution References: <39013f48@flexnet239.uunt.net> Message-ID: In article , David Goodger wrote: >on 2000-04-22 01:57, Highdesertman (HighdesertmanREMOVE at yahoo.com) wrote: >> >The user must have Python installed. But since it's absolutely free with no >strings attached whatsoever, and multi-platform to boot, that's not a >problem. Maybe you should go back and read the Tanenbaum vs. Torvalds debate about why allowing redistribution of patches makes Minix unviable. It's the same debate. I just built Python on NeXTSTEP 3.3 a few weeks ago. It took me less than an hour to get it installed and working properly (as far as it's possible for it to work properly.) An hour is a lot of work to install a program. >> In addition, one of the real advantages of the >> development of the compiler was that it gave your code a level of protection >> against being tampered with and made it easily useable by a wide audience. > >One of the greatest advantages of interpreted languages in general, and >Python in particular, is that their programs can be run under multiple >operating systems (if they are written correctly, of course). You are >running Win95. I run MacOS. Bruce runs Linux. We can all run the same Python >program. Result: even wider audience! Well, platform-independent bytecode is platform-independent, too. Python does have .pyc code, which can be run without the .py file it was compiled from. I don't know how platform-independent it is; my guess is "very". That said, one of the greatest advantages of interpreted languages is that the user can "tamper" with the code easily. I'd be nervous about trying to run code from someone who thought they had the right to "protect" the code telling *my* machine what to do *on my behalf* from me knowing what it did or changing it to suit my fancy. >If someone really wants to get into (decompile, reverse engineer) a compiled >program (.exe), they can. It takes some work to do this, but compiling is >not secure encryption. You can't have secure encryption if you're going to run your code on a machine under someone else's control. If it were securely encrypted, their machine wouldn't be able to read it in order to run it. :) -- Kragen Sitaker The Internet stock bubble didn't burst on 1999-11-08. Hurrah! The power didn't go out on 2000-01-01 either. :) From amused at webamused.com Fri Apr 28 04:43:03 2000 From: amused at webamused.com (Joshua Macy) Date: Fri, 28 Apr 2000 08:43:03 GMT Subject: file open() problem References: <8ebcm3$lo$1@nnrp1.deja.com> Message-ID: <390941CF.BFB93167@webamused.com> That's the right syntax, and it works for me (admittedly, on Linux, Win95, and WinNT, not Win98) Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> f = open('file.txt', 'r') Traceback (innermost last): File "", line 1, in ? IOError: [Errno 2] No such file or directory: 'file.txt' >>> f = open('file.txt', 'w') >>> f.write('Spam, Eggs, and Spam') >>> f.close() >>> f = open('file.txt', 'r') >>> r = f.readlines() >>> print r ['Spam, Eggs, and Spam'] >>> Have you done anything that might have hidden the builtin "open" with a different one? Is this the first thing that you're doing at the >>> prompt, or have you entered some "from blah import *" lines first? Joshua ekw1 at my-deja.com wrote: > > I am using python1.5.2 on windows98se. all of the following gives me > an error. > > f = open('file.txt', 'r') > f = open("file.txt", "r") > f = open('c:/dir/file.txt', 'r') > f = open('c:\dir\file.txt', 'r') > f = open("c:/dir/file.txt", "r") > f = open("c:\dir\file.txt", "r") > f = open("c:\\dir\\file.txt", "r") > > The error from the python shell for any of the above is: > > Traceback (innermost last): > File "", line 1, in ? > f = open('file.txt', 'r') > TypeError: illegal argument type for built-in operation > > Can anyone help me? Thanks. > > ekw > > Sent via Deja.com http://www.deja.com/ > Before you buy. From ivanlan at callware.com Mon Apr 17 19:05:01 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Mon, 17 Apr 2000 17:05:01 -0600 Subject: TKMessageBox, and TKINTER console? References: Message-ID: <38FB989C.C8AECBD8@callware.com> Hi All-- Benjamin Schollnick wrote: > > Folks, > [bobbitry] > I've tried a variety of different things to get rid of it...For > example, calling > junk= TK.tk() to a variable, and passing it as "master=junk", or as > "parent=junk" > in the code... > > I'm not sure if there is anyway to get rid of that darn console. > > Anyone got some suggestions for a really confused first time > Tkinter'er? > root=Tk() ...blah,blah,blah ...build your popups here.... root.withdraw() root.mainloop() -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From gmcm at hypernet.com Fri Apr 28 00:02:58 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 28 Apr 2000 00:02:58 -0400 Subject: The Simple Economics of Open Source In-Reply-To: <8eavgs$ker$1@news.udel.edu> Message-ID: <1255227918-2015166@hypernet.com> Terry Reedy wrote: > > "Gordon McMillan" wrote in message > news:1255272357- > > > One of those open source delusions is that being open source > > somehow makes a difference to the end consumer. Bunk. > > Whether most consumers yet know it or not, there is all the > difference in the world. Of course there is; all your points are correct. But no end user will read the source and discover the bug / trojan horse / whatever. It's another developer that will. My point was that to the end user, those files are a waste of disk space. They get value from the fact that it's open sourced, not from the source. - Gordon From ivanlan at callware.com Mon Apr 17 16:47:30 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Mon, 17 Apr 2000 14:47:30 -0600 Subject: Playing wave files on Windows References: <38FB6ED7.4C72773E@callware.com> <38FB7624.943A8C35@rubic.com> Message-ID: <38FB7862.7B15633@callware.com> Hi All-- Jeff Bauer wrote: > > > Ivan Van Laningham wrote: > > How can I play a sound file on Windows. > > Ivan, use the built-in winsound module, e.g.: > > >>> import winsound > >>> winsound.PlaySound(r'C:\WINNT\Media\tada.wav', winsound.SND_FILENAME) > Yup, about 2 minutes after I posted the query, I found the documentation for that. I still think it should be a FAQ entry. ... > > I don't want to do anything else, just play a > > wave file. ... > > Then I can't interest you in my Python interface to > the Diamond Rio MP3 player? <0.5 wink> > Not unless everyone that I'll be distributing my application to will have one plugged in and ready to go;-) -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From ppetru at coltronix.com Thu Apr 13 15:08:29 2000 From: ppetru at coltronix.com (Petru Paler) Date: Thu, 13 Apr 2000 22:08:29 +0300 Subject: Simple formatting string question In-Reply-To: ; from meh9@cornell.edu on Thu, Apr 13, 2000 at 02:56:38PM -0400 References: Message-ID: <20000413220829.C7824@coltronix.com> On Thu, Apr 13, 2000 at 02:56:38PM -0400, Matthew Hirsch wrote: > I'm trying to print something like this: > > >>> print 6*'%2i' '%1i' % tuple([5,5,5,5,5,5,1]) > > but I'm getting an error. > > Do you know what the correct syntax should be? print (6*'%2i'+'%1i') % tuple([5,5,5,5,5,5,1]) -Petru From slhath at flash.net Thu Apr 20 13:48:29 2000 From: slhath at flash.net (Scott Hathaway) Date: Thu, 20 Apr 2000 17:48:29 GMT Subject: editor for win32 Message-ID: Can anyone recommend a python editor for Windows? If there is an IDE for windows (other than IDLE), even better. Thanks, Scott From effbot at telia.com Wed Apr 12 09:48:04 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 12 Apr 2000 13:48:04 GMT Subject: Huh? func_defaults, default values in function calls References: <8cv5qj$35p$1@zinc.intern.netconnect.no><8cv8ra$hio$1@pegasus.csx.cam.ac.uk> Message-ID: Mark Hathaway wrote: > >> As a result, if you set a mutable object (list, dictionary, etc) as a > >> default, it'll be set when the function is defined and then if the > >> function changes it, it'll stay changed for subsequent invokations. > >> The function effectively has a "side-effect", of modifying it's own > >> default! > > This way you'll never really know what the default is going to be. uhuh? so you mean evaluating the default value every time the function is called would automatically make it easier to know what the default is going to be? what about non-trivial default values? what about scoping? what about side effects? what about per- formance? etc. > Ha ha ha ha. that's pathetic. really? I'm pretty sure Guido designed things this way on purpose, but maybe you can come up with a better way to do it? From claird at starbase.neosoft.com Tue Apr 4 15:46:35 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 4 Apr 2000 14:46:35 -0500 Subject: Why should I switch to Python? - Infinity of Primes References: <8ccoug$f4o$1@pegasus.csx.cam.ac.uk> <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> <38EA369C.26A1C25@math.okstate.edu> Message-ID: <467ED74C3A44BDFC.B66525D52208472C.27972C76E272D139@lp.airnews.net> In article <38EA369C.26A1C25 at math.okstate.edu>, David C. Ullrich wrote: . . . > There's nothing non-constructive about the traditional >proof of the infinitude of the sequence of primes - given >a sequence of primes it _constructs_ a prime not on the >list. (Of course it doesn't actually return infinitely many . . . The constructivist sect most familiar to me says, sure, "it constructs a prime not on the list", but that's sub- ordinated in the proof to a *reductio ad absurdum*, which is inherently non-constructive. That's part of the pro- gram: rewriting such formulations in purely constructive language. Or am I myself speaking entirely in anachronisms? Has modern constructivism somehow come to rely on the Excluded Middle (something like the Roman Church and monotheletism)? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From jeremy at cnri.reston.va.us Thu Apr 27 19:41:53 2000 From: jeremy at cnri.reston.va.us (Jeremy Hylton) Date: Thu, 27 Apr 2000 19:41:53 -0400 (EDT) Subject: [ANNOUNCE] Pisces 1.0a1 release Message-ID: <14600.53313.621205.524349@goon.cnri.reston.va.us> I'm pleased to announce the first alpha release of Pisces, a Python implementation of the SPKI/SDSI Certificate standard. http://www.cnri.reston.va.us/software/pisces/ This release, 1.0 alpha 1, contains a mostly complete implementation of the SPKI/SDSI protocols. It is missing a few features, like threshold subjects. I hope to include these in the final 1.0 release. It also contains: - spkitool.py, a command-line utility for managing keys, certificates, and signatures in the style of PGP or GPG, - pyarrowd.py, a Yarrow-160 random number generator for Linux and Solaris, and - two demonstration applications, one implementing access controls on method calls of a Python instance and one implementing a client-server secure socket protocol in the style of TLS. I plan to issue a few more alpha and beta releases next month. Any comments, suggestions, or questions are welcome. -- Jeremy Hylton From spex66 at my-deja.com Wed Apr 26 10:54:41 2000 From: spex66 at my-deja.com (spex66 at my-deja.com) Date: Wed, 26 Apr 2000 14:54:41 GMT Subject: Namespace Problem with global declaration in module Message-ID: <8e6vv9$4n8$1@nnrp1.deja.com> Hi, it seemed very simple but don't worked like expected: #FILE: test.py dd = None #INIT a shadow instance for automated access class zz: #ONLY one class will be instantiated def __init__(self): self.name = 'hallo' global dd dd = self #END OF FILE >>> from test import * >>> yy = zz() >>> dd.name ... AttributeError ... ++++++++++++++ the same code interactive at the python console works perfect! >>> ...same as above... >>> dd.name 'hallo' any hints? in use: 1.5.2 / idle0.5 thanks Peter (=PA=) Sent via Deja.com http://www.deja.com/ Before you buy. From cfelling at iae.nl Fri Apr 14 20:29:59 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 15 Apr 2000 02:29:59 +0200 Subject: reduce versus recursion? what am I missing... References: Message-ID: <8d8d67$ii$1@vvs.superst.iae.nl> Warren Postma wrote: > # I am trying to figure out why function d (recursive) and e (reduce) > # DON'T do the SAME thing: > def d(*tup): > "why doesn't this work?" > if len(tup)>1: > return d(tup[1:])+abs(tup[0]-tup[1]) Wel to start with, why not use a loop? def m(*tup): r = 0 # mind you, you 'seeded' the reduce with 0! for t in tup: r = abs(r-t) return r You see fast, clear and crisp and no surprises here:) But if you insist on recursion... def d(*tup): # don't forget the 'seed' value for the recursive 'reduce' print "why, it works!", return d(0, tup) def dd(r, tup): if len(tup)>0: # return d(tup[1:])+abs(tup[0]-tup[1]) return dd(abs(r-tup[0]), tup[1:]) else: return r -- groetjes, carel From felixt at dicksonstreet.com Fri Apr 28 00:39:48 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Thu, 27 Apr 2000 23:39:48 -0500 Subject: The Simple Economics of Open Source In-Reply-To: <24042000.3@sanctum.jae.ddns.org> References: <3903316C.5D6F1611@tcac.net> <390451C0.4B5D3196@tcac.net> Message-ID: <3.0.5.32.20000427233948.0093f530@mail.dicksonstreet.com> At 23:57 4/24/00 +0200, Juergen A. Erhard wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >>>>>> "Robin" == Robin Becker writes: > > Robin> In article <390451C0.4B5D3196 at tcac.net>, Albert Wagner > Robin> writes > >> You STILL don't understand. Artifice can only copy. It cannot invent. > >> An end product can be copied, even a style can be copied, but not the > >> creative process itself. > >> > >> Raffael Cavallaro wrote: > Robin> ... > > Robin> This position is like the weak AI position; you assert > Robin> there's something magical about creation. I think A Turing > Robin> was right; any human behaviour can be simulated and the > Robin> best simulators (people) are around already. > >Fundamental question is: Are we just a complex arrangement of >bio-chemical (and thus ultimately physical) processes... or is there >more to being `human beings'? > >If we are just a collection of bio-chemical processes, it's simple to >`simulate' or replicate us in machine form[1]. No it's not. Even when we're looking at (what seem to us to be) simple processes like a solution of a pure compound in a pure solvent, a lot of the data we're interested in (solubility, acidity) has to be empirically determined. Let me underline this point: a. we _know_ (as much as we know anything) that chemicals are just part of the material world, and the domain of chemistry (atoms, molecules, solutions) is built of the domain of physics (dynamics, masses, waves) b. still, we can't reduce the behavior of a solution to a set of fudge-factorless equations. So I don't see that there's any reason to believe that our being all biochemical implies we are simple to simulate. Just-because-we-may-not-be-what-we-think-we-are-doesn't-mean-we- aren't-what-we've-always-been-ly yrs, Felix > >If we are more... than it will not be possible. > >Since I'm a christian, I guess it's obvious where I'll put my bets... > >Bye, J > >[1] I'm just reading Bill Joy's Wired essay `Why the future doesn't >need us'... > >PS: For the record, I'm 100% with Albert (though maybe he's not 100% >with me ;-) > >- -- >J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 > MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html > "Ever wonder why the SAME PEOPLE > make up ALL the conspiracy theories?" -- Michael K. Johnson >-----BEGIN PGP SIGNATURE----- >Version: GnuPG v1.0.1 (GNU/Linux) >Comment: Use Mailcrypt and GnuPG > >iEYEARECAAYFAjkEw1oACgkQN0B+CS56qs09zQCfTMfxscQZVhcLpqgIiSVYShoO >vjwAn0G8CdZImNdfPk1s5mvgOjR7GxVu >=W73r >-----END PGP SIGNATURE----- > >-- >http://www.python.org/mailman/listinfo/python-list > > From lefebvre at medz.mcgill.ca Thu Apr 20 10:07:09 2000 From: lefebvre at medz.mcgill.ca (Luc Lefebvre) Date: Thu, 20 Apr 2000 14:07:09 GMT Subject: Mac Python Questions References: <38FE8032.DE233C29@cosc.canterbury.ac.nz> Message-ID: In article <38FE8032.DE233C29 at cosc.canterbury.ac.nz>, Greg Ewing wrote: > Jeff Massung wrote: > > > > b) No matter what I do, I can't get Tkinter to work :(. > > Neither can I, and from what I've seen here, neither > can anyone else. Tkinter just seems to be broken on > the Mac at present. I managed to have a look at this (demos and some test code) and it seems to work for me on a superficial level. I have MacPython 1.5.2 with MacOS8.1 on a beige PowerMac G3. Rather a python newbie though (more experience with Tcl/Tk). -- *** Luc Lefebvre NOTE: if your reply via email please remove the z from my return address *** From jayFreem at direcpc.com Fri Apr 14 19:00:25 2000 From: jayFreem at direcpc.com (Jay Freeman) Date: Fri, 14 Apr 2000 18:00:25 -0500 Subject: Doesn't anybody write to paper anymore? References: <38F5FDF3.EE2FBA01@tcac.net> <38F73C80.E1432809@sage.att.com> Message-ID: <38F7A309.F1242F00@direcpc.com> Let's see: C:\WINDOWS>ping www.fcc.gov Pinging infoserver.fcc.gov [192.104.54.12] with 32 bytes of data: Reply from 192.104.54.12: bytes=32 time=510ms TTL=246 Reply from 192.104.54.12: bytes=32 time=511ms TTL=246 Reply from 192.104.54.12: bytes=32 time=510ms TTL=246 Reply from 192.104.54.12: bytes=32 time=511ms TTL=246 Ping statistics for 192.104.54.12: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 510ms, Maximum = 511ms, Average = 510ms Yep, still have a government, so we must still have paper too, QED :). Jay Garry Hodgson wrote: > "Daddy, what's "paper"?" > > well, maybe not yet... > > -- > Garry Hodgson Every night > garry at sage.att.com a child is born > Software Innovation Services is a Holy Night. > AT&T Labs - Sophia Lyon Fahs -- *------------------------------------------* * Jay Freeman - WT9S ARRL * * G-QRP 10319 QRP-ARCI 9981 ARS 562 * * SASS #18700 NRA Life * *------------------------------------------* From mhammond at skippinet.com.au Wed Apr 19 22:08:31 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 20 Apr 2000 02:08:31 GMT Subject: Can COM-objects be used in a thread? References: Message-ID: Python COM fully supports all COM threading models. However, you are correct in that COM (not Python) does impose certain restrictions on COM threads - however, they arent as simple to explain as "must have a message loop" (although in some cases that is true). I dont have time to explain in detail again. I believe I DejaNews should find a post from me with some detail in this area, or Andy and my book goes into this in depth, including sample code demonstrating these rules... Mark. "Olaf Trygve Berglihn" wrote in message news:dn1g0sj1vxw.fsf at kikp0524.chembio.ntnu.no... > I'd like to make a thread work on a COM-object created by the main > thread. Is this possible? Can the COM-object be passed to the thread > and function properly there? > > I vaguely remember that somebody posted a message about this, saying > it is not possible for a thread to host a COM-object as the main > thread is not dispatching Windows messages to it. > -- > * Olaf Trygve Berglihn From mfletch at tpresence.com Tue Apr 4 09:43:14 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Tue, 4 Apr 2000 09:43:14 -0400 Subject: Tuples -- who needs 'em Message-ID: Certainly it raises a TypeError, currently the implementation prevents you from making the mistake of using a mutable sequence as a dictionary key. If you prefer, the question is: in this sequence, what should be the value of the final line, if we allow mutable sequences as dictionary keys. The question of what a "meaningful" hash function would be for a mutable sequence is the crux of the issue, and the thrust of my attempted clarification. Without a fixed value, the "meaning" of a hash function for a mutable sequence is currently undefined. Define what that meaning should be (and do so convincingly), and the implementers might be able to implement it :) . Of course, since you were just playing with the words, I'll let the matter rest (matters are often tired out by all this word-play, crotchety old things, should never let them out of the rest home...) :) *poof* -----Original Message----- From: Hrvoje Niksic [mailto:hniksic at iskon.hr] Sent: Tuesday, April 04, 2000 9:43 AM To: Mike Fletcher Cc: python-list at python.org Subject: Re: Tuples -- who needs 'em Mike Fletcher writes: > I think the point that is being made is this: > The _value_ of a mutable object cannot (easily) be used as a > dictionary key... > i.e. in this sequence, what is the value of the final line... > > s = [ 1,2,3 ] > p = { s: 4, [2,3,4]: 5 } > s[:] = [2,3,4] > p[ [2,3,4] ] The second line raises a TypeError, therefore the last line does not have a meaningful value. I only noted that Fredrik's sentence, as it was formulated, was wrong. Mutable collections can be used as dictionary keys, as long as they provide a meaningful hash function. -- http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Sun Apr 2 18:56:57 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 02 Apr 2000 22:56:57 GMT Subject: Web hosting python CGI and or Zope References: <8c8hie$5lo$1@nnrp1.deja.com> Message-ID: zsoltman at my-deja.com wrote: > Question: Does anyone know of Web Hosting companies that support > python or Zope? this might help: http://www.zope.org/Resources/ZSP From pinard at iro.umontreal.ca Wed Apr 26 10:26:02 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Apr 2000 10:26:02 -0400 Subject: Python - Next Release Questions In-Reply-To: Mark Atwood's message of "23 Apr 2000 20:20:54 -0700" References: Message-ID: Mark Atwood writes: > I.E., the various cultural groups that dislike the Unicode Han unification > because they wish to continue their racial illusion that C, J, & V > characters are completely different and seperate sets, and that it's > somehow corrupting to stir them together. I would rather let people judge what is good for them, than impose my opinion or judgemental remarks to them, while not even understanding or sharing the culture. Such statements might be good incentive for Asian people to escape Americanish colonialism, and maybe Unicode in particular. The nicest would be for me to shut up, when things are none of my business. I got a few people haughty enough to preach me, in English, about my needs for French. You really have to live the experience to know the feeling! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From scarblac-spamtrap at pino.selwerd.nl Sat Apr 29 16:50:27 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 29 Apr 2000 20:50:27 GMT Subject: Problem running NNTP example from docs. References: <87hfckk6fv.fsf@tea.thpoon.com> Message-ID: Arcady Genkin wrote in comp.lang.python: > I'm very new to Python, and was trying to run the example from > documentation to nntplib library. I get an error when I try to > instantiate NNTP object. > > ,---- > | >>> import nntplib > | >>> s = NNTP('news') > | Traceback (innermost last): > | File "", line 1, in ? > | NameError: NNTP > `---- > > Could somebody point out what I am missing? You have imported the module nttplib; to use the object NNTP within it, you write nntlib.NNTP. Ie, s = nntplib.NNTP('news') (have never used that lib myself, but this is probably it) -- Remco Gerlich, scarblac at pino.selwerd.nl Hi! I'm a .sig virus! Join the fun and copy me into yours! From genius at idirect.com Sat Apr 29 16:03:18 2000 From: genius at idirect.com (Snoopy :-))) Date: Sat, 29 Apr 2000 20:03:18 GMT Subject: Help Needed-IDLE (Linux)Upgrading References: <3909CC26.D684AD92@idirect.com> Message-ID: <390B3F75.404DD416@idirect.com> Hi Bob :-) Thanks for the reply. Your sugestion helped me to solve the problem. Actually I was able to figure it out and solve it last night. I just didn't have the chance to get back until now. What I did was: to go into GnoRpm and did a "Query" on Python and was able to trace idle. Then I just followed the downloaded README by copying the files into the old directory. So what do you think? Is there any hope for me in becoming a genius one day?? :-)) Best regards Charles Me wrote: > > It is there! I did the same thing...either do a search for "python" or > "idle" or look in (forgive me I am not on my box at the moment) /usr/share > ???? IT IS THERE THOUGH! I would move the old (just in case) and then copy > it in. I am new too. > > Bob > > "Snoopy :-))" wrote in message > news:3909CC26.D684AD92 at idirect.com... > > No Flames Please. I am a NEWBIE :-)) > > > > Using Linux (RH-6.1) I have downloaded the Idle-0.5 Upgrade "tgz". > > package.But I don't know where and how to install the package. > > > > After unzipping the package I've read the README > > file which doesn't seem togive clear instructions regarding installation > > of the upgrade. On my system Idle is in /usr/bin > > but this is only the executable file without subdirectories where I > > would be able to put the untared and uzippedfiles. > > > > I would appreciate a helping hand > > Best regards > > Charles Takacs From cut_me_out at hotmail.com Wed Apr 26 18:56:02 2000 From: cut_me_out at hotmail.com (Alex) Date: 26 Apr 2000 18:56:02 -0400 Subject: first non-trivial python program References: Message-ID: > would it be considered rude to post it here for helpful advice? Well, frankly, you're showing quite a hide by even asking, but we'll let you post it this time. :) People are unlikely to read such a large program in its entirety for altruistic reasons, but you might get a couple of helpful ideas. Alex. From phd at phd.russ.ru Fri Apr 21 11:52:08 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 21 Apr 2000 15:52:08 +0000 (GMT) Subject: PyApache memory leak? In-Reply-To: <00042107521900.02973@quadra.teleo.net> Message-ID: On Fri, 21 Apr 2000, Patrick Phalen wrote: > [Oleg Broytmann, on Fri, 21 Apr 2000] > :: I don't see how httpdapy could help spawn less interpreters instances - > :: it is Apache job to fork and reap off children. > > A clarification, from the Httpdapy README: > > """ > 2. PyApache creates a sub-interpreter (Py_NewInterpreter()) for every > request and destroys it when done. This means that if your script > begins with "import HTMLgen", HTMLgen is imported (bytecode read from > file) for every hit. > > Httpdapy keeps the interpreter around from the first hit and until the > process dies. So only the first hit will actually read HTMLgen.py(c), > all the subsequent won't. > """ This don't help saving memory. Other way round - PyApache destroys subinterpreter after processing a request, thus saving memory; but httpdapy keeps the interpreter with all (unneccessary and superfluos) imported modules, thus leaking memory. At least this is how I understand the situation. Not that I'm saying PyApache is "best" and httpdaoy is "worst" - both are great products, and I am happy they are there. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From kevinmcd at NOSPAM.linuxsolutions.demon.co.uk Wed Apr 26 11:39:51 2000 From: kevinmcd at NOSPAM.linuxsolutions.demon.co.uk (Kevin McDermott) Date: Wed, 26 Apr 2000 16:39:51 +0100 Subject: Best database to use with Python References: <3906ea27.698463777@news.online.no> Message-ID: <39070DC7.37F8089D@NOSPAM.linuxsolutions.demon.co.uk> Hi Thomas, > > What database-system is easiest, fastest etc. to use with Python? I`ve > looked at MySQL, but it seems a little overkill just to get a little > more functionality than Berkley DB-functionality. What about Postgres? > mSQL? > > Postgres comes with my Linux distro and seem smaller than MySQL. How > does it compare to MySQL when it comes to administration and speed, > scalability etc. ? > > I`m doing alot of index-lookups for a > Yahoo/Altavista/WhatEverSearchEngine-like web-app. > > > It have to be fast, capable of HUGE amounts of data, free and easy to > install and administer. > > MySQL is very fast, capable of LARGE amounts of data, depends on what you term HUGE I suppose. It's very stable, but it lacks is Transactions and some advanced SQL techniques. Depends on what you want to use it for...if it's to connect CGI programs to, then I'd recommend MySQL. PostgreSQL is different, the support for BLOBs is not quite as good, but the V7.0 release expected RSN should be a good deal faster. mSQL is not as good as either of the above once you get above a certain level, there is no facility for GROUPing data or SUM functions. It's reasonably fast and very lightweight, but for storing HUGE amounts of data, I'd not recommend it. Kevin From kilian.lorenz at dkfz-heidelberg.de Sun Apr 9 14:06:31 2000 From: kilian.lorenz at dkfz-heidelberg.de (Kilian Lorenz) Date: Sun, 09 Apr 2000 20:06:31 +0200 Subject: Tkinter: centering windows on screen References: Message-ID: <38F0C6A7.10878609@dkfz-heidelberg.de> Kevin Cazabon wrote: > > I'm having a bit of a problem controlling where on screen a Toplevel() or > Tk() widget appears on the screen... > > I have some large widgets that sometimes appear partially off-screen, and I > want to make sure that (at least) they're centered. > I have a similar problem ... I would like to call the tk_getOpenFile Standard Dialog that is provided by Tk but I don't know how to do it. If I use it as an option for a widget like this self.filemenu.add_command(label='Open', command='tk_getOpenFile') that works but doesn't help me much because I'm interested in the return value. So I would really like to know how to call Tk commands from within Python because that would solve both our problems ...you could send a Tk command like 'wm geometry ' to receive an return value like this: '200x200+400+300' and you could change the position just by sending 'wm geometry +20+30' to move it to somewhere near the left, upper corner. In the meantime I found out that exactly this can be done with Tkinter with the wm_geometry() method. Regards, Kilian From glyph at twistedmatrix.com Mon Apr 24 15:50:53 2000 From: glyph at twistedmatrix.com (Glyph Lefkowitz) Date: 24 Apr 2000 14:50:53 -0500 Subject: Pickling Robustly References: <8dpk1i$7de$1@newshost.accu.uu.nl> Message-ID: jepler.lnk at lnk.ispi.net (jepler epler) writes: > On 21 Apr 2000 14:06:28 -0500, Glyph Lefkowitz > wrote: > >Perhaps I should ask this question in a different way. How does > >Pickle tell if an object is pickleable or not? Is there some > >pickle.ispicklable method I could refer to? > > If you have control over the object hierarchy, why not use this > 'unpicklable mixin' and convenience functions I just tossed together: [ code snipped ] Your suggestion didn't solve the problem (thanks for the code though, useful nonetheless); however, I believe it may have elucidated to me that what I want is fundamentally impossible. If I boil down my request, it's for control over the object heirarchy without control over the object heirarchy... With the additions that I've stuck in, the only unpicklable things are native code... I can achieve the control that I want by overriding the interfaces that the pickle module describes, I think ... It would still be nice if there were an option to register an error handler to just ignore attributes which couldn't be pickled, rather than failing. At this point though, I think I'd need to rewrite the module to get that. -- __________________________________________ | ______ __ __ _____ _ _ | | | ____ | \_/ |_____] |_____| | | |_____| |_____ | | | | | | @ t w i s t e d m a t r i x . c o m | | http://www.twistedmatrix.com/~glyph/ | `__________________________________________' From ulf.engstrom at b2b-link.com Fri Apr 28 05:16:34 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F8m?=) Date: Fri, 28 Apr 2000 11:16:34 +0200 Subject: Concatening string and integer References: Message-ID: <018e01bfb0f2$73fda480$858647c1@DEVELOPMENT> Also important to remember when using ` with strings is this: >>> text = 'text' >>> `text` "'text'" >>> num = 5 >>> `num` '5' Adding an unknown variable to a textstring, the variable being a number is fine, being a string already gives you 'text "variable" and more text', not very pretty. (Other way to deal with that is 'text %s and more text' % (unknownvariabletype), or checking type() before using it) Regards Ulf > Actually the back ticks appear to be a shortcut for repr() not str() > which in the above case give the same result but won't for all objects, > for example: > > >>> class aclass: > ... def __str__(self): > ... return 'spam' > ... > >>> a = aclass() > >>> `a` > '<__main__.aclass instance at f93a8>' > >>> str(a) > 'spam' > >>> repr(a) > '<__main__.aclass instance at f93a8>' > > Cheers, > Anthony > _____________________________________________________________________ > Anthony J Wilkinson anthony at dstc.edu.au > Software Engineer http://www.fnorb.com > DSTC Pty Ltd Ph: +61 7 3365 4310 > > > > -- > http://www.python.org/mailman/listinfo/python-list From gmcm at hypernet.com Sat Apr 22 09:10:07 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 22 Apr 2000 09:10:07 -0400 Subject: The Simple Economics of Open Source In-Reply-To: <3901247A.E87B5D0A@rubic.com> Message-ID: <1255713484-40391375@hypernet.com> Jeff Bauer ed: > If I didn't have my part-time performance art > income to help pay the bills, I could never > afford to support my programming lifestyle. Mimes for food and MIMEs for fun... - Gordon From effbot at telia.com Sat Apr 15 12:45:49 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 15 Apr 2000 16:45:49 GMT Subject: BSDi and PIL References: Message-ID: <111K4.40$wYl.186672128@newsb.telia.net> David Reid wrote: > Has anyone had any joy in getting Python 1.5.2 and PIL 1.0 to build together > on BSDi 4.0.1? $ cd libImaging $ ./configure $ make $ cd .. $ make -f Makefile.pre.in boot $ make $ ls -l _imaging.so how far did you get? From donn at u.washington.edu Tue Apr 18 12:30:13 2000 From: donn at u.washington.edu (Donn Cave) Date: 18 Apr 2000 16:30:13 GMT Subject: modifying os.environ References: Message-ID: <8di2il$10oq$1@nntp6.u.washington.edu> Quoth Martin von Loewis : | quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) writes: ... | > Or perhaps there's a better way to do the (common) thing I'm trying | > to do: clean the environment to insure some minimum sane values. I | > can't make a copy of the environ and then pass to execve() since | > that doesn't help much for popen and system. | | You could implement popen and system yourself, starting from popen2 | (for example). That may sound like the re-invention of the wheel, but there are other improvements that can be made at the same time: - eliminate system()'s sh -c 'shell command', which can be a security liability in some situations. The shell can do some really useful things, but if you don't need those things you should be able to pass in an argv sequence and skip sh. - Raise exception on exit status, complete with error output as exception value. A bit of a pain to implement, and again not not always the right thing to do, but usually it is the right thing. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From aaron_watters at my-deja.com Wed Apr 26 10:39:58 2000 From: aaron_watters at my-deja.com (aaron_watters at my-deja.com) Date: Wed, 26 Apr 2000 14:39:58 GMT Subject: Sourceforge and Python References: <007b01bfaf14$f33114b0$3cdd3fcb@neil> Message-ID: <8e6v3r$3ss$1@nnrp1.deja.com> In article , kc5tja at garnet.armored.net (Samuel A. Falvo II) wrote: > How the *hell* did you get your CVS repo to work on SourceForge? :) > > Whenever I try to upload to the repo I've set up for my own project, it > tells me I don't have write permissions after processing about four or five > files (I forget the exact error phrase, but that's basically what it > reports). Now, I've used CVS before -- I have a repo set up on my box at > home. What am I missing with respect to CVS with SourceForge? I don't know if this will help, but I had trouble with this too and with the help of Andy R. I came up with the following command line which always works. cvs -z6 -d :ext:aaron_watters at cvs.reportlab.sourceforge.net:/cvsroot/reportlab commit pdfdoc.py It then prompts me for a password etc. This is using the ssh and the cvs versions recommended by sourceforge and carefully setting up the needed directories and environment variables, vis, in autoexec.bat set HOME=c:\users\arw set path=%path%;c:\usr\local\bin;c:\python;"C:\Program Files\GNU\WinCvs" set CVS_RSH=ssh SET CVSROOT=aaron_watters at cvs.reportlab.sourceforge.net:/cvsroot/reportlab SET USERNAME=aaron_watters SET HOMEDRIVE=c: SET HOME=\users\arw SET HOMEPATH=\users\arw SET CVS_RSH=ssh and in c:\etc\passwd arw:x:1:10:Watters, Aaron R.:/users/arw/:/windows/cmd.exe Why this particular black magic does the trick, I've no clue, neither do I know whether it's all really needed, but I don't waste cycles thinking too hard about it. In my youth I used to waste immense amounts of emotional energy getting mad about this kind of nonsense. Now I'm just trying to have a little fun before I die, as the muse says... -- Aaron Watters === and the colored girls go doot tadoot doot doottadoot... -- Lou Reed Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Thu Apr 27 19:14:05 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Apr 2000 00:14:05 +0100 Subject: mail forwarding not working on the starship? References: <3908538A.E74456A5@GermanLloyd.org> <8eagr4$30h$1@nnrp1.deja.com> Message-ID: timehorse at unforgettable.com writes: > Anyway, one thing that everyone on Starship should know is that we > are no longer using SENDMAIL as our transport agent. We have been > moved to qmail as it is LEAPS AND BOUNDS easier to maintain. starship's been on qmail for as long as I've been there (about 18 months; long before the crash). So it's not that... Cheers, M. -- 41. Some programming languages manage to absorb change, but withstand progress. -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From aa8vb at yahoo.com Tue Apr 11 13:43:58 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Tue, 11 Apr 2000 13:43:58 -0400 Subject: comparing strings and ints In-Reply-To: <2YmI4.366$rc9.188014080@newsb.telia.net> References: <8css5t$tti$1@merrimack.Dartmouth.EDU> <2YmI4.366$rc9.188014080@newsb.telia.net> Message-ID: <20000411134358.A2352304@vislab.epa.gov> Fredrik Lundh: |Mark H.H. Montague wrote: |> Does anyone know why it is not a type error to compare a string and an |> int with '>' ? For example, I just spent over an hour debugging code |> that essentially did this: |> |> >>> 45 > '0' |> 0 |> |> Of course, the '0' was a variable read in from a file, which I forgot |> to convert to a string. Bad old perl habits. But I'm having a hard |> time imagining a situation where someone would be intentionally and |> meaningfully comparing a string and an int. |> |> Any ideas? | |why not read the fine documentation: |http://www.python.org/doc/current/ref/comparisons.html I suspect many folks consult it first, but (though excellent on most topics) occasionally it's difficult to find what you want. And sometimes (rarely) if and when you find the topic, the behavior doesn't "seem" to make much sense at first glance. Thus prompting a question to the group. (An example is the % operator. It's an operator so it's in the language ref manual, right? No, not exactly. If you don't think "string method" you'll never find it. Compare to +/-. Why is it special? Beats me.) |which explains that: | | Objects of different types always compare unequal, | and are ordered consistently but arbitrarily. Reminds me of qsort() core dumps because the compiled C library compared NaNs and Infs arbitrarily. I can see 45 == '45' being false, and 45 != '45' being true. But it seems to me that not throwing an exception for attempts at an ordered comparison with logical ordering operators (<, <=, etc.) on objects of different primitive types (e.g. 45 < '45', 45 > '45') only lets bugs pass through. Is there a case where this could be useful (with its undefined behavior)? I believe that is the root of the question. | This unusual definition of comparison was used to | simplify the definition of operations like sorting and | the "in" and "not in" operators. == and != seems to cover "in"/"not in". In what context is sorting done on instances that have different primitive types? |and goes on to say: | | In the future, the comparison rules for objects of | different types are likely to change. Possibly making ording operations illegal in this case (?) -- Randall Hopper aa8vb at yahoo.com From parkw at better.net Sun Apr 2 16:12:29 2000 From: parkw at better.net (William Park) Date: Sun, 2 Apr 2000 16:12:29 -0400 Subject: Creating variables on the fly... In-Reply-To: ; from meh9@cornell.edu on Mon, Apr 03, 2000 at 03:16:03PM -0400 References: Message-ID: <20000402161229.A1954@better.net> On Mon, Apr 03, 2000 at 03:16:03PM -0400, Matthew Hirsch wrote: > Hi All, > > Let's say I have four variables: > > a=1 > b=2 > c=3 > d=4 > > And I have a function that adds these variables together: > > def add(a,b,c,d): > return a+b+c+d > > But now let's say I have twenty variables that I want to add together. > This function will no longer work. I would have to rewrite it as > a+b+c+d+e+f+g+...+(20th letter). Is there a way to dynamically create a > variable name? So that my add function can automatically determine how > many variable names to create and then add the values together. In > other words, I'd ideally like something like: > > > def add(number_of_variables): > return a+b+c+...+(letter corresponding to number_of_variables) > > Thanks for your help, > > Matt Straightforward approach is def add(*argv): sum = add(a, b, c, ...) Or, you can use dictionary, def add(**argv): sum = add(a=a, b=b, ...) --William From aahz at netcom.com Sat Apr 15 23:55:15 2000 From: aahz at netcom.com (Aahz Maruch) Date: 16 Apr 2000 03:55:15 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> Message-ID: <8dbdj3$dgt$1@slb2.atl.mindspring.net> In article <8cmr70$b0e$1 at pegasus.csx.cam.ac.uk>, Nick Maclaren wrote: > > x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0) Here's a solution I haven't seen before (refactored slightly for the most likely equivalent Python idiom): def expression_if( test, true, false ): if test: return true else: return false x = expression_if( a is not None, a[i].weeble, 0) + expression_if( b is not None, b[i].wombat, 0) -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "First one back from the bathroom gets to be the bottom." From markx.daley at intel.com Wed Apr 12 14:10:45 2000 From: markx.daley at intel.com (Daley, MarkX) Date: Wed, 12 Apr 2000 11:10:45 -0700 Subject: global variables - how?? Message-ID: You can also assign them as lists instead of standard variables. Then, when you reference them in your modules, just use the first entry in the list. e.g. a = [Vorpal] b = [Bunny!] def eek(): print a[0] print b[0] I find this list usage quite useful. Hope this helps! Mark -----Original Message----- From: William Park [mailto:parkw at better.net] Sent: Wednesday, April 12, 2000 10:41 AM To: python-list at python.org Subject: Re: global variables - how?? On Wed, Apr 12, 2000 at 07:28:37PM +0200, Anders Eggers-Krag wrote: > how do I define a propper global variable that works in all functions in all > modules? As far as I know, you can't. You have to use 'global ...' inside all your functions. --William > > I have tried simply > defining one outside of any function in the main module, > I have tried using the global keyword under the same cicumstances, > but they are not even avialible inside of functions within the main > module... > > > -- > Anders Eggers - Krag > > > -- > http://www.python.org/mailman/listinfo/python-list From jvickroy at sec.noaa.gov Mon Apr 24 09:59:41 2000 From: jvickroy at sec.noaa.gov (j vickroy) Date: Mon, 24 Apr 2000 07:59:41 -0600 Subject: Slashdot review of Python Programming On Win32 References: Message-ID: <3904534D.2D324F7B@sec.noaa.gov> I recently purchased a copy of this book and have only skimmed most chapters to date. I have, however, read Chapter 22 more carefully and found it essential for developing a dll extension library for Python. Being unfamiliar with Win 32 programming, I found the chapter clear, complete, and accurate. Mike Fletcher wrote: > http://slashdot.org/article.pl?sid=00/04/17/1147228&mode=nocomment > > Generally positive review, got me thinking I should buy the book. > > Enjoy all, > Mike > __________________________________ > Mike C. Fletcher > Designer, VR Plumber > http://members.home.com/mcfletch -------------- next part -------------- An HTML attachment was scrubbed... URL: From quynhna at hotmail.com Thu Apr 13 23:36:17 2000 From: quynhna at hotmail.com (Nguyen Anh Quynh) Date: Thu, 13 Apr 2000 20:36:17 -0700 Subject: Change NT password with Python Message-ID: <38F69231.EE1D9B6D@hotmail.com> Dear my friends, I am looking for the way to write on Python stuff helping me to change NT password, since I would like to change the password of WinNT domain via Web page. (That Python stuff will be the CGI) Could you point me the way? Thank you very much, From thomas at xs4all.net Fri Apr 14 09:47:18 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 14 Apr 2000 15:47:18 +0200 Subject: Python 1.6a2 crashes in test_fork1 on my Mandrake Linux 7 machine In-Reply-To: <38F658C6.66AD9CA5@clark.net>; from jrl@clark.net on Thu, Apr 13, 2000 at 06:31:18PM -0500 References: <20000413010344.A13931@owl.rhein-zeitung.de> <38F658C6.66AD9CA5@clark.net> Message-ID: <20000414154718.A15664@xs4all.nl> On Thu, Apr 13, 2000 at 06:31:18PM -0500, John Lloyd wrote: > Oliver Andrich wrote: [ about test_fork1 failing on a Mandrake 7 system ] I dont know enough about threads to say anything useful about this, but it is kind of strange that you dont see the same problem under Python 1.5.2. My redhat boxes pass the test, though the BSDI boxes dont (but threading is screwed in more than one way under most BSDI versions.) I haven't tried compiling 1.5.2 under BSDI 4.1 (the newest, which seems to work reasonably ok with threading) though, so it might be a change in python's thread-handling... Wasn't Mandrake based on Redhat ? Does it use a different/strange libc or something ? i dont quite see why there should be a difference in rh 6.1 and mandrake, in this context. > I had the same fault but when I compiled without thread support it works > OK. This is not very suprising, since test_fork1 tests for the combination of threading and fork. (wether threads survive after a fork(); apparently they shouldn't, but they do, on many systems.) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From tismer at tismer.com Thu Apr 6 17:22:30 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 06 Apr 2000 23:22:30 +0200 Subject: Round Bug in Python 1.6? Message-ID: <38ED0016.E1C4A26C@tismer.com> Hi, asa side effect, I happened to observe the following rounding bug. It happens in Stackless Python, which is built against the pre-unicode CVS branch. Is this changed for 1.6, or might it be my bug? D:\python\spc>python Python 1.5.42+ (#0, Mar 29 2000, 20:23:26) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> round(3.1415926585, 4) 3.1415999999999999 >>> ^Z D:\python>python Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> round(3.1415926585, 4) 3.1416 >>> ^Z ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 gmcm at hypernet.com Mon Apr 10 13:32:46 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 10 Apr 2000 13:32:46 -0400 Subject: Redirecting stdin/stdout on Windows with '>'and '<' In-Reply-To: <8csvff$7pn$1@nnrp1.deja.com> Message-ID: <1256734529-36551909@hypernet.com> Mark wrote: > I seem to have a problem and can't find it in the archives or FAQ. Not sure why not. It's come up enough times. > I would like to redirect output of my script with '>' or '<' > > If I try to redirect out then the file is created but has no contents. > > If I try to redirect in eg... > "test.py < autoexec.bat" > > I get the following traceback > > Traceback (most recent call last): > File "C:\test.py", line 4, in ? > s = sys.stdin.read() > IOError: [Errno 9] Bad file descriptor > > Does anybody have an idea!!! > > (Windows nt 4 sp 6, python 1.52) Apparently the bug is fixed in Win2K, but in NT and Win9x, redirection is busted unless you spell it out: python test.py >test.out - Gordon From sabren at manifestation.com Sun Apr 23 06:34:10 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 23 Apr 2000 06:34:10 -0400 (EDT) Subject: code not true? In-Reply-To: Message-ID: On Sun, 23 Apr 2000, Fredrik Lundh wrote: > Michal Wallace (sabren) wrote: > > Isn't unicode much slower to work with than regular strings? > > nope. A teeny bit slower? :) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From lutz at rmi.net Thu Apr 13 13:58:34 2000 From: lutz at rmi.net (Mark Lutz) Date: Thu, 13 Apr 2000 11:58:34 -0600 Subject: ANN: Python training in Boulder Message-ID: <000101bfa571$e31a43a0$71d95da6@lutz> This is to announce that the second Python training session to be held at Tom Christiansen's site in Boulder, Colorado, will be held May 24-26. These classes are equivalent to the on-site Python training I offer, and are open to individuals on a first-come first-served basis. I am the instructor, but all registration details are handled by Tom's company. For more information, please visit these pages: http://home.rmi.net/~lutz/boulder-classes.html (my page) http://training.perl.com/open-courses.html (tom's page) --Mark Lutz (http://rmi.net/~lutz) From jae at ilk.de Sat Apr 22 00:08:42 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Sat, 22 Apr 2000 06:08:42 +0200 Subject: The Simple Economics of Open Source In-Reply-To: <39011EEF.4BAEC3C9@tcac.net> (message from Albert Wagner on Fri, 21 Apr 2000 22:39:27 -0500) References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> <39011EEF.4BAEC3C9@tcac.net> Message-ID: <22042000.3@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Albert" == Albert Wagner writes: Albert> [...] All that is required is that a "critical mass" of Albert> participants realize that the shared rewards of long term Albert> cooperation exceed the rewards of short term reward at the Albert> expense of others. Right... but the more important the stock exchanges of this world become (in the public eye), the bigger this problem gets... there seem to be (at least to the eyes of a layman (like me ;-)) a lot of companies which *only* look at their stock price... and thus only at their quarterly balance report (or whatever that was called). And not at any long-term effects of what they're doing... Albert> Those with uncooperative strategies view the pie as finite Albert> and feel that they must optimize their slice by Albert> diminishing the share of others. When money's all you see (and most of those people do...), it *is* a zero-sum game. So their strategies are mostly correctly adapted to the way they see the world around them. But when you look at the bigger picture (`Spaceship Earth' comes to mind[2])... Albert> Those with cooperative strategies have discovered that Albert> there are an infinite number of pies. Wrong.[1] They simply discovered (or, rather, understood) that there are enough pies so that *everyone* can be more than satiated ("Jeder kann sich bis zum Erbrechen den Bauch vollschlagen" I'd say in german). In short: They found that there's enough for everyone... And the long-term benefits are immeasurable (simply because you can't measure the opposite... you can't know what *would* have happened, just what *has* :-). Bye, J [1] The human-accessible part of this solar system is finite, right? So there simple cannot be an infinite number of pies, even if you could bake a pie out of one atom... ;-) - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html The GNU Project (http://www.gnu.org) Win32 has many known work arounds. For example, Linux. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkBJcUACgkQN0B+CS56qs1g4gCfUTKfxxZMQO/EOwr3FDT+TnZc hRYAn14uzj1MeewijEOjo2uGeVPVYJb5 =X+0+ -----END PGP SIGNATURE----- From alwagner at tcac.net Tue Apr 18 07:15:43 2000 From: alwagner at tcac.net (Albert Wagner) Date: Tue, 18 Apr 2000 06:15:43 -0500 Subject: How to write to printer in Windows? Message-ID: <38FC43DF.78A38D5D@tcac.net> How can I write(aLine) to a printer in Windows? I tried this: from win32pipe import popen : self.printer = popen('lpt1' 'w') : self.printer.write(aLine) but get a general protection fault. Any help will be greatly appreciated. -- Small is Beautiful From ke at gnu.franken.de Thu Apr 27 12:51:03 2000 From: ke at gnu.franken.de (Karl EICHWALDER) Date: 27 Apr 2000 18:51:03 +0200 Subject: Scripting and Gnome and KDE References: <3dk8hzb90u.fsf@newcnri.cnri.reston.va.us> Message-ID: Jody Winston writes: > I have to agree with Andrew because I have had these problems and > more. I don't work on a Linux machine, but an SGI. This is a completely different story. Andrew said GNOME needs patched tools; this isn't the truth. > It was very difficult to get the libraries that GNOME needs to work to > run. If time permits and good bug reports are submitted the GNOME developers are very friendly to change the code etc. Since the developers normally don't have access to all these systems you might guess how difficult it is to support them. > It looks like to me that we have gone back to the model that all the > world is a Vax and if it compiles and runs on the Vax there isn't any > problem with the software. All the world isn't Linux and the only > compiler isn't gcc. Sure, but sooner or later, Linux will run on all architecure and you'll be free to choose the OS that fits your needs best :) -- work : ke at suse.de | : http://www.suse.de/~ke/ | ------ ,__o home : ke at gnu.franken.de | ------ _-\_<, : http://www.franken.de/users/gnu/ke/ | ------ (*)/'(*) From effbot at telia.com Tue Apr 4 17:08:55 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 04 Apr 2000 21:08:55 GMT Subject: Getting the argument names passed to a function ? References: <20000404225810.A12156@sz-sb.de> Message-ID: Andreas Jung wrote: > > def myfunc(arg1,arg2): > ... > > > a=1;b=2 > myfunc(a,b) > > Is it possible to get the name of variables that were > used as arguments to call myfunc(). myfunc() should be > able to determine the names 'a' and 'b'. Don't ask > me why I need this - it's for a worse Python hack :-) short answer: no longer answer: maybe, using the incredibly clever and totally evil bytecodehacks stuff: http://bytecodehacks.sourceforge.net From fra at bastardi.org Tue Apr 4 15:07:17 2000 From: fra at bastardi.org (Fra) Date: Tue, 04 Apr 2000 19:07:17 GMT Subject: Map a Network Drive and Printers in NT? Message-ID: <38ea3a47.7163227@news.flashnet.it> Hi all How can I map a network drive and a printer in Win NT and in Win 95? Can I iport the dos command line and type the command "Net use...." or is there a different way? And could you also tell me how to ping with a Python script? And maybe how to let this script analyse the result. I couldn't find it on the Tutorial, neither on the FAQ. Am I wrong? Thank you, Greetings, Francesca From python-list at teleo.net Wed Apr 12 12:16:50 2000 From: python-list at teleo.net (Patrick Phalen) Date: Wed, 12 Apr 2000 09:16:50 -0700 Subject: Looking for BoboHTTPServer.py In-Reply-To: <8d28r6$9bs$2@news.cineca.it> References: <8d28r6$9bs$2@news.cineca.it> Message-ID: <00041209195100.01669@quadra.teleo.net> [Alessandro Muzzetta, on Wed, 12 Apr 2000] :: Hello, :: :: I'm looking for BoboHTTPServer.py but cannot find it anywhere. :: Can someone tell me where I can find it, or some other server :: that integrates Bobo (not Medusa). Bobo has grown up; now it's called Zope. http://www.zope.org Look at ZServer (and ZPublisher, ZODB) From fw at deneb.cygnus.argh.org Tue Apr 11 13:35:56 2000 From: fw at deneb.cygnus.argh.org (Florian Weimer) Date: 11 Apr 2000 19:35:56 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com> <87r9cdhdb0.fsf@deneb.cygnus.argh.org> <38F319A4.89621192@mdlink.de> <38F351B0.45E137AA@roguewave.com> Message-ID: <87n1n0czgj.fsf@deneb.cygnus.argh.org> Bjorn Pettersen writes: > Windows have system calls for atomic increment/decrement > (InterlockedIncrement/InterlockedExchangeAdd), something that is sorely > lacking from Unix (*sigh*) A system call is much too slow for that purpose. If you've got hardware support, you can use it, otherwise, it becomes quite expensive. From thomas at cintra.no Thu Apr 27 13:22:44 2000 From: thomas at cintra.no (thomas at cintra.no) Date: Thu, 27 Apr 2000 17:22:44 GMT Subject: Using struct writing integers Message-ID: <390873b2.726725@news.c2i.net> Hi, I got a list of tuples containing integers, like : stuff = [ (21,323,32), (432,43,3234), (432,565,532), (434,43,987) ] Each tuple in the list represent an id for a entry in a database, the three integers form a key. The list above contains four ids. I want to write them to a binary file using the struct module. Then I want to read them pack, unpack them into the same kind of list. Any hints, examples etc? Thanks. Thomas From nmm1 at cus.cam.ac.uk Wed Apr 5 04:56:30 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 5 Apr 2000 08:56:30 GMT Subject: blessed be Guido, for "5 <= X <= 10" does what it should... References: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca> Message-ID: <8cev3u$bm5$1@pegasus.csx.cam.ac.uk> In article , Quinn Dunkan wrote: >On Tue, 4 Apr 2000 13:42:41 -0500, Warren Postma wrote: >> >> >>I was just playing around today,and it occurred to me to test the >>'transitive' properties of comparison operators. Ie, writing on a >>chalkboard, you might say X is in the range 5..9 this way: >> >> 5 <= X <= 9 > >Yes, this has always struck me as one of the weirder corners of python. >There's a bit of magic for comparison operators: > >From the lang ref 5.9: > >Formally, if a, b, c, ..., y, z are expressions and opa, opb, ..., opy are >comparison operators, then a opa b opb c ...y opy z is equivalent to a opa b >and b opb c and ... y opy z, except that each expression is evaluated at most >once. > >It's kinda cool, I guess. Maybe ABC did it first? Dunno. If I remember correctly, the three operand form was there in an early version of SPSS (late 1960s.) Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From cmfinlay at SPAMmagnet.com.au Sun Apr 30 08:15:38 2000 From: cmfinlay at SPAMmagnet.com.au (cmfinlay at SPAMmagnet.com.au) Date: Sun, 30 Apr 2000 22:15:38 +1000 Subject: My Question has now been answered by a member of this Usenet group. Thanks References: Message-ID: My Question has now been answered by a member of this Usenet group. Thank you for providing such a vital service and community From rvprasad at cis.ksu.edu Sun Apr 30 18:04:06 2000 From: rvprasad at cis.ksu.edu (Venkatesh Prasad Ranganath) Date: 30 Apr 2000 17:04:06 -0500 Subject: Discrepency between JPython and CPython Message-ID: Hi, Consider the expression str(1.14 * 200). In CPython it yields 228.0 In JPython it yields 227.99999999999997 Shouldn't this result in consistent values across variuos implementation? If so, which of the implementation is buggy? I think it is JPython, may be I am wrong. -- Venkatesh Prasad Ranganath e-mail: rvprasad at cis.ksu.edu, rvprasad at ksu.edu Address: Department of Computing and Information Science, 234 Nichols Hall, Kansas State University, Manhattan, KS 66506 Phone: (785)-532-6350 Extn: 48 From johann at physics.berkeley.edu Tue Apr 18 13:00:51 2000 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 18 Apr 2000 10:00:51 -0700 Subject: Lists References: Message-ID: Daley, MarkX writes: > This feels like a real newbie question, but here is the code that is causing > my question: > # Learning exceptions > def test(): > a = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] > print a > b = 5 > for item in a: > try: > print b / a[item] > except ZeroDivisionError: > pass No, it's iterating in order. On the first step, item = -5, a[item] = 1, and 5/1 = 1 then item = -4, a[item] = 2, and 5/2 = 2 then item = -3, a[item] = 3, and 5/3 = 1 I'm guessing that you either: 1. Really want "b/item" not "b/a[item]" or 2. Don't understand negative indexing. A negative index to a list counts from the back of the list front. -- Johann Hibschman johann at physics.berkeley.edu From dante at oz.net Wed Apr 26 21:31:13 2000 From: dante at oz.net (Michael Esveldt) Date: 27 Apr 2000 01:31:13 GMT Subject: xmlrpclib problem Message-ID: <8e8591$2ro$0@216.39.162.232> I'm working with xmlrpclib to talk to Userland's Manila application and I'm having a problems sending html via xmlrpc. Here's the code I'm working with mysite = xmlrpclib.Server("http://mysite.editthispage.com") mysite.manila.message.set(username, password, sitename, msgNum, "my subject", "body containing html", "text/x-outline-tabbed", {}, {"name":"pikeRenderer", "flRenderOnEntry":"true"}) I've tried changing "text/x-outline-tabbed" to "text/plain" and "text/html", none of these have any effect. What's happening is that my "body containing html" is coming out on the other side with < and > instead of actual tags. Obviously this results in displaying html instead of rendering it. Is this a problem with xmlrpclib, how I'm using it, or with the server decoding my xmlrpc messages? many thanks, Michael _______________________________________________________________ dante at oz.net - Michael Esveldt - #FightThePower on Openprojects From phd at phd.russ.ru Tue Apr 11 06:15:38 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 11 Apr 2000 10:15:38 +0000 (GMT) Subject: Redirecting the output from sys.stdout In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA7297@MSGEURO1> Message-ID: On Tue, 11 Apr 2000, Pieter Claerhout wrote: > Any examples on how to use the popen of the os module? Never used it before. import os, string pipe = os.popen("dir /w", 'r') # Open pipe for reading lines = [] while 1: line = pipe.readline() if not line: break # EOF lines.append(line) print string.join(lines, '') # Every line already contains newline, not need it here Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2.1/ phd2 at earthling.net Programmers don't die, they just GOSUB without RETURN. From jbauer at rubic.com Fri Apr 14 10:24:52 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Fri, 14 Apr 2000 09:24:52 -0500 Subject: Complaint Dept: My shoes! References: <8d4s4d$mvr$1@nnrp1.deja.com> <38F72CE2.CB7B7C5D@att.net> Message-ID: <38F72A33.69B244DA@rubic.com> aflinsch wrote: > musingattheruins at my-deja.com wrote: > > > > If shoe is None then len(shoe) raises an exception. > > Would be nice if len(None) was 0 and NOT raise an > > exeption. > > > I think I would prefer it if len(None) returned None. > Makes a bit more sense to me having an unsized object > return None, rather than zero. It's no more appropriate for len() to return a value for None than for it to return a value for the length of an integer, a function, or an open socket connection. In all cases the appropriate action is to raise a TypeError. This isn't an argument in favor of purity of design (or whatever). It's of practical consequence for the interpreter to pass useful information back to the user (in the form of an exception), rather than for the interpreter to assume it understands the programmer's intentions. Jeff Bauer Rubicon Research From nick at spam_me_notvideosystem.co.uk Thu Apr 13 11:58:02 2000 From: nick at spam_me_notvideosystem.co.uk (Nick Trout) Date: Thu, 13 Apr 2000 16:58:02 +0100 Subject: List mapping? References: Message-ID: <38f5efe6@news.xtml.co.uk> "Mike Fletcher" wrote in message news:CC59868A0A76D311B1F50090277B321C1F326B at VRTMAIL... > Oh, how would I actually do the work of parsing command lines? Probably use > the getopt module :) Oops. Didnt know about that. Doesnt work with DOS style /'s though :-/ And my flags have multiple arguments!! And it seems to stop parsing options once it meets an argument (ie. not a - option). From dante at oz.net Sun Apr 16 17:36:57 2000 From: dante at oz.net (Michael Esveldt) Date: 16 Apr 2000 21:36:57 GMT Subject: trapping dict alterations in a class Message-ID: <8ddbpp$7dp$0@216.39.162.232> I want to be able to do for a dictionary in a given class what __setattr__ does for variable binding. class foo: def __setattr__(self, name, value): print name, value self.__dict__[name] = value bar = foo() bar.quux = 1 bar.baz = {"key":"value"} The above obviously prints "quux 1" and then "baz {'key':'value'}". But what if I want to trap further alterations to the foo.baz dictionary? Is this possible? thanks, Michael _______________________________________________________________ dante at oz.net - Michael Esveldt - #FightThePower on Openprojects From jkahanpa at pcu.helsinki.fi.invalid Fri Apr 7 08:36:43 2000 From: jkahanpa at pcu.helsinki.fi.invalid (Jere Kahanpaa) Date: 7 Apr 2000 12:36:43 GMT Subject: Newbie: How to do an exit ? References: <38EDC1DA.62CBFCF3@sxb.bsf.alcatel.fr> Message-ID: <8ckkor$jrt$1@oravannahka.helsinki.fi> Pascal Fremaux wrote: : How to exit from a program ? : I don't find a command such as exit(0) in C The 'sys' module has everything you need Try import sys sys.exit() or from sys import exit exit() BTW: This is explained in the tutorial in chapter 2.1 (at least in version 1.5.2). Unfortunately the standard Python tutorial is not very user-friendly: it doesn't have any index or searching tools. Personally used to do a lot or grepping around until I found the clues I needed. Happy hacking Jere Kahanp?? From mwh21 at cam.ac.uk Mon Apr 10 15:49:27 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 10 Apr 2000 20:49:27 +0100 Subject: Problem running Python script as cron job References: <38EE41F4.8050708@gmx.net> Message-ID: "William R. Dickson" writes: > In article <38EE41F4.8050708 at gmx.net>, Per Kistler > wrote: > > > Hi Bill > > > > Try stderr? > > /path/prog > /path/log 2>&1 > > > > Maybe it spits some errors? > > Tried that, but I still wind up with an empty log. Anyway to force it > to write immediately rather than buffering? [mwh21 at atrus mwh21]$ python --bleargh Unknown option: -- usage: python [option] ... [-c cmd | file | -] [arg] ... Options and arguments (and corresponding environment variables): -d : debug output from parser (also PYTHONDEBUG=x) -i : inspect interactively after running script, (also PYTHONINSPECT=x) and force prompts, even if stdin does not appear to be a terminal -O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x) -OO : remove doc-strings in addition to the -O optimizations -S : don't imply 'import site' on initialization -t : issue warnings about inconsistent tab usage (-tt: issue errors) -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x) -v : verbose (trace import statements) (also PYTHONVERBOSE=x) -x : skip first line of source, allowing use of non-Unix forms of #!cmd -X : disable class based built-in exceptions -c cmd : program passed in as string (terminates option list) file : program read from script file - : program read from stdin (default; interactive mode if a tty) arg ...: arguments passed to program in sys.argv[1:] Other environment variables: PYTHONSTARTUP: file executed on interactive startup (no default) PYTHONPATH : ':'-separated list of directories prefixed to the default module search path. The result is sys.path. PYTHONHOME : alternate directory (or :). The default module search path uses /python1.5. so that'll be `python -u' then ... 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 dworkin at ccs.neu.edu Mon Apr 17 21:36:07 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 17 Apr 2000 21:36:07 -0400 Subject: Beginner: string to long In-Reply-To: hudson_melville@my-deja.com's message of "Tue, 18 Apr 2000 00:35:39 GMT" References: <8dgakr$2i$1@nnrp1.deja.com> Message-ID: hudson_melville at my-deja.com writes: > The outputs are similar to '3564-752+617' How do I convert it so it > can evaluate into a long integer? Is there a built-in that I don't > know about that would do this? >>> eval('3564-752+617') 3429 -Justin From ivanlan at callware.com Wed Apr 19 18:56:24 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 19 Apr 2000 16:56:24 -0600 Subject: Browse dialog in PythonWin References: <38FE32AB.520C1736@callware.com> <38fe3297.36998571@news-server.socal.rr.com> Message-ID: <38FE3998.1ED7FB24@callware.com> Hi All, Roger-- Roger Burnham wrote: > [snippery] > > Here's a dialog I adapted from something I found in the PythonWin > distribution. > [more ruthless snippery] That will do *very* nicely! Thank you! -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From josht at iname.com Sun Apr 30 22:03:18 2000 From: josht at iname.com (Josh Tompkins) Date: Mon, 01 May 2000 02:03:18 GMT Subject: Python Compiler Message-ID: <8F26DEAB4joshtinamecom@209.208.0.7> This is maybe a dumb question, but here goes: (donning asbestos underwear) What would be the difficulty of writing a real python compiler? Or maybe a compiler/interpreter similar to the one in VB? Leaving platform indepenacy and other similar concerns aside, what are the technical hurdles? Is it hard to write a compiler? Given proper pointers to tutorials and references I'd give it a shot, if it wasn't above my (low) level of programming skill... Anyway, thanks for your time. Josue -- ________________________________________________________________ "Destined For Great Things -- but pacing myself." - From a t-shirt. E-Mail: josht at crosswinds.net ICQ: 21219667 AIM: JosueTheGreat Web: http://www.crosswinds.net/~josht _________________________________________________________________ From tismer at tismer.com Tue Apr 11 14:31:16 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 11 Apr 2000 20:31:16 +0200 Subject: Modifying "traceback" objects References: <20000406075124.A1848828@vislab.epa.gov> Message-ID: <38F36F74.A14349DE@tismer.com> Michael Hudson wrote: > > Randall Hopper writes: > > > Is it possible to add frames to the current traceback object from > > inside a C extension? > > I'd say it would be difficult. What would you put in the "f_code" field? Just have a look at the builtins "map" code in Stackless Python. It provides a name, a code object and so forth, and it appears nicely inside tracebacks. I think it was very similar to what Michael proposes. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 pecora at anvil.nrl.navy.mil Mon Apr 10 18:22:59 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Mon, 10 Apr 2000 22:22:59 GMT Subject: Why should I switch to Python? References: Message-ID: <100420001822595187%pecora@anvil.nrl.navy.mil> In article , Blake Winton wrote: > On Fri, 31 Mar 2000 19:43:58 -0800, Aaron Turner wrote: > >I've been coding Perl for over 3 years and really like it. (Especially > >it's syntax and ability to grok my programming style.) > > Now, just as a side note, why is it that the sets of The Perl Hackers I > Know, and The People I Know Who Use The Word "Grok" are the same set? Sorry. I don't know Perl. I guess the sets just have some overlap. I'm just a physicist formerly of the hippy generation who read Heinelin's Stranger in a Strange Land which I grokked. :-) From tim_one at email.msn.com Thu Apr 6 20:29:15 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 6 Apr 2000 20:29:15 -0400 Subject: C's ?: expression In-Reply-To: <38ED28D6.2C5519ED@bioeng.ucsd.edu> Message-ID: <000801bfa028$4eaa8fc0$34a0143f@tim> [Curtis Jensen] > I while back I posted about how to simulate C's ?: expression in > Python. There were quite a few responces to it. Recently, I found on > pp135-136 of Mark Lutz's "Programmin Python" book that there is a way. > If anyone is interested: > > ((TEST and [trueAction]) or [falseAction])[0] > > where TEST is the boolean expression and tueAction is what to do if the > expression is true and falseAction is what to do if the expression is > false. Yes, I invented that, and you could have found it more easily in the Python FAQ (note that the inner parens aren't needed -- "and" binds tighter than "or"). However, I have never used it in real code, and have been known to kill people who do. You really want to risk that, just to avoid an obvious if/else ? better-programming-thru-intimidation-ly y'rs - tim From aa8vb at yahoo.com Sat Apr 1 07:57:17 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Sat, 01 Apr 2000 07:57:17 -0500 Subject: Single-line functions In-Reply-To: <8c2gu2$j2i$1@kopp.stud.ntnu.no> References: <20000331094943.A1251675@vislab.epa.gov> <8c2gu2$j2i$1@kopp.stud.ntnu.no> Message-ID: <20000401075717.A1359257@vislab.epa.gov> Magnus Lie Hetland: |Seems you can't begin more than one block on one line... | |For instance, | | if 1: if 1: print "spam" | |doesn't work, although | | if 1: print "spam" | |does. Thanks. I figured it was something like that. Just didn't remember ever reading that in the Python docs. Digging further, I see that it is in Mark Lutz's _Programming Python_. -- Randall Hopper aa8vb at yahoo.com From pup at pobox.com Mon Apr 24 15:31:24 2000 From: pup at pobox.com (Joel Burton) Date: Mon, 24 Apr 2000 15:31:24 -0400 Subject: Gzip -> FTP w/o using a temporary file Message-ID: <8e279b$2rf0$1@nnrp-corp.news.cais.net> I'm writing a small program to help users move a large file. Since I can't predict what FTP command-line programs they will have, it's being written as part of a python script. I have a simple working solution using gzip and ftplib. I create a new file and gzip it w/Python's gzip lib, then send it using ftplib's ftp. However, in doing this, I end up creating a real gzipped file. Since ftplib has me sending a file using a file descriptor, it would appear that I could gzip -> fd -> FTP, w/o the overhead and space of creating a real file. However, I'm stuck trying to get this to work. I tried using os.pipe() to create an r/w pipe, but the 'w' part of the pipe isn't writable, according to gzip.GzipFile() Has anyone a clue? Thanks in advance. From aahz at netcom.com Tue Apr 4 16:27:26 2000 From: aahz at netcom.com (Aahz Maruch) Date: 4 Apr 2000 20:27:26 GMT Subject: Creating variables on the fly... References: Message-ID: <8cdj7e$tqr$1@nntp9.atl.mindspring.net> In article , Warren Postma wrote: > >def Sum(dict): > n = 0 > for i in dict.keys(): > n = n + dict[i] > return n I think you mean: def Sum(dict): n = 0 for i in dict.values(): n = n + i return n This should be faster. -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of cigarettes, it's dark, and we're wearing sunglasses." "Hit it." From smalleys at gte.net Sun Apr 30 17:33:21 2000 From: smalleys at gte.net (sue) Date: Sun, 30 Apr 2000 21:33:21 GMT Subject: Environmental variable $PYTHONPATH References: <77363B9E386.AAA2589@smtp1.polyu.edu.hk> Message-ID: <390CA6BB.37CF0618@gte.net> I think any app installed under PYTHONHOME is automatically visible. (I set python up two years ago and haven't had to touch it. :-) These both default to your python install dir. I also put an apps.pth file in the python install directory. Then I filter the output from dir into it, with one of two conventions for the filter: 1. that every subdirectory is an app. 2. Or I have a "site_pkg" directory to match the UNIX structure and apps are under that. Either works. And the filter is in Python. Actually, I think it's glob.glob() now, instead of dir. You can read the gory details in site.py in the standard library. On the other hand, at least you can read it, unlike registry-based stuff. Sue. From hnowak at cuci.nl Wed Apr 12 01:12:57 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Wed, 12 Apr 2000 07:12:57 +0200 Subject: Python 4 DOS Message-ID: <200004120513.e3C5Dqf26509@hera.cuci.nl> On 11 Apr 00, at 16:50, Arnaldo Riquelme wrote: > Can anyone tell me if I can get python binaries for DOS (16-bit). > I heard of Hans Nowak 's Python-DX but the links to his website is broken? > Where are you Hans? I'm right here! :) And the URL has changed. Try: http://www.hvision.nl/~ivnowa/newsite/Python/Python-DX/python-dx.html Note that Python-DX is unmaintained, and I will probably not upgrade to 1.6. Blessed be, --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://www.hvision.nl/~ivnowa/newsite/ Python questions? See http://tor.dhs.org/~zephyrfalcon/snippets You call me a masterless man. You are wrong. I am my own master. From rob at hooft.net Wed Apr 19 04:22:01 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 19 Apr 2000 10:22:01 +0200 Subject: Tkinter/Pmw/Python 1.6a#: xsync? Message-ID: I upgraded too many things at the same time: Computer, OS revision, Desktop environment, and Python version.... For the python software that I make for my work, I also create a package including the python interpreter and all extensions required by my python code. Since I upgraded to Python-in-CVS (from 1.5.2b1), Pmw0.8.3 (from 0.8) and started running on RedHat Linux 6.2 in Gnome, I have the impression that there are sometimes a bunch of X commands that stick in the pipeline: the buildup of the GUI stalls every time for about 1 second just when the application starts a calculation or becomes idle waiting for input. Dialog windows do pop up immediately, but they stay blank for a while. - Is there anyone that has seen a similar effect? - Is there a way I can avoid this? Regards, Rob Hooft -- ===== rob at hooft.net http://www.xs4all.nl/~hooft/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! ========= From bwilk_97 at yahoo.com Wed Apr 26 04:52:50 2000 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Wed, 26 Apr 2000 08:52:50 GMT Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> Message-ID: oh. I see. Even though it is making a copy of the original list. It is a reference to the same copy three times. Thanks :) "Fredrik Lundh" wrote in message news:vM5N4.1522$wYl.188802560 at newsb.telia.net... | Bill Wilkinson wrote: | > l = [[][:]] * 3 | | same problem as the original code: | | >>> l = [[][:]] * 3 | >>> l | [[], [], []] | >>> l[0].append(1) | >>> l | [[1], [1], [1]] | | | | From gmcm at hypernet.com Thu Apr 27 14:22:01 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 27 Apr 2000 14:22:01 -0400 Subject: Using struct writing integers In-Reply-To: <390873b2.726725@news.c2i.net> Message-ID: <1255262771-67501474@hypernet.com> thomas at cintra.no wrote: > Hi, > > I got a list of tuples containing integers, like : > > stuff = [ (21,323,32), (432,43,3234), (432,565,532), (434,43,987) > ] > > Each tuple in the list represent an id for a entry in a database, > the three integers form a key. The list above contains four ids. > I want to write them to a binary file using the struct module. > Then I want to read them pack, unpack them into the same kind of > list. > > Any hints, examples etc? >>> stuff = [ (21,323,32), (432,43,3234), (432,565,532), (434,43,987) ] >>> import struct >>> f = open('test.out','wb') >>> fmt = 'lll' >>> sz = struct.calcsize(fmt) >>> for x,y,z in stuff: ... f.write(struct.pack(fmt, x, y, z)) ... >>> f.close() >>> stuff2 = [] >>> f = open('test.out', 'rb') >>> while 1: ... s = f.read(sz) ... if not s: ... break ... tpl = struct.unpack(fmt, s) ... stuff2.append(tpl) ... >>> stuff2 [(21, 323, 32), (432, 43, 3234), (432, 565, 532), (434, 43, 987)] - Gordon From python-list at teleo.net Thu Apr 20 13:58:27 2000 From: python-list at teleo.net (Patrick Phalen) Date: Thu, 20 Apr 2000 10:58:27 -0700 Subject: PyApache memory leak? In-Reply-To: <8dni3s$1o1$1@nnrp1.deja.com> References: <8dimg4$kii$1@nnrp1.deja.com> <8dni3s$1o1$1@nnrp1.deja.com> Message-ID: <00042011042800.02559@quadra.teleo.net> [spenrose at my-deja.com, on Thu, 20 Apr 2000] :: We commented out PyApache in httpd.conf. Two days and six hours :: later...the server did not freeze. We've been up for 11 days and :: counting and that was the only change we made. I freely acknowledge that :: this is not definitive proof of a showstopper in PyApache, but I am not :: up to reading thousands of lines of C to pursue other theories. I haven't used PyApache, but am under the impression that it spawns multiple interpreter instances, which could certainly cause memory problems on a busy, CGI-intensive site. Have you looked at Httpdapy (soon to be renamed mod_python)? http://www.ispol.com/home/grisha/httpdapy/ From aa8vb at yahoo.com Wed Apr 12 11:40:01 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 12 Apr 2000 11:40:01 -0400 Subject: Python idiom: Multiple search-and-replace In-Reply-To: <871z4bqtbg.fsf@orge.winnegan.de> References: <20000412100816.A2431031@vislab.epa.gov> <871z4bqtbg.fsf@orge.winnegan.de> Message-ID: <20000412114001.C2446939@vislab.epa.gov> Siggy Brentrup: |Randall Hopper: |> I want to do search-and-replace of multiple symbols on each line of a file. |> But the simple-minded code below takes a while. ... |> -------------------------------------------------------------------------- |> |> symbol_map = { 'oldsym1' : 'newsym1', oldsym2' : 'newsym2', ... } |> fp = open( net_path, "r" ) |> |> while 1: |> line = fp.readline() |> if not line: break |> |> for old_sym in symbol_map.keys(): |> line = string.replace( line, old_sym, symbol_map[ old_sym ] ) |> |> out_fp.write( line ) |> |> -------------------------------------------------------------------------- | |symbol_items = symbol_map.items() | |while 1: | line = fp.readline() | if not line: break | | for old, new in symbol_items: | line = string.replace(line, old, new) | | out_fp.write(line) Actually I'd tried this. About the same speed (a few seconds slower). The dictionary lookups were not slowing the original algorithm. But thanks. -- Randall Hopper aa8vb at yahoo.com From cbbrowne at news.hex.net Mon Apr 3 20:41:08 2000 From: cbbrowne at news.hex.net (Christopher Browne) Date: Tue, 04 Apr 2000 00:41:08 GMT Subject: Smalltalk on the small end (was: Advice requested: GUI project beginning) References: <8D79BC9E4960ED70.7B6609342D6EB723.7625773D14AD9140@lp.airnews.net> Message-ID: Centuries ago, Nostradamus foresaw a time when Cameron Laird would say: >In article , >Christian Tanzer wrote: > . > . > . >>Recently, I find myself writing Python scripts of 5 to 20 lines for >>which I normally would have used the unix shell. I wouldn't use >>Smalltalk for this purpose. >But others do (particularly with GNU Smalltalk), >so this isn't conclusive. > >Actually, there's another thread here asking to >be launched. Python (and Tcl, too, in a somewhat >different fashion is (are) really quite extraor- >dinary for shell-level scripting and operation. >I find myself wondering more and more how people >get along without such (*particularly* on the >conventional desktops--Win* and MacOS). I do >think Python is clearly superior to Smalltalk >for those one-page scripts that most people do >with /bin/sh; still, I'm willing to consider that >Smalltalk is more capable in this regard than I >yet realize, and, in any case, I can well imagine >Smalltalk proponents favoring it over /bin/sh. The "power" of Smalltalk comes not when you're writing one page shell scripts, but when you have a bunch of "objects that do useful things" that can all run in a single Smalltalk environment. The point is that there's little point to "scripting" in Smalltalk when it doesn't really get powerful 'til you build up a rich set of functionality in a "Smalltalk Environment." And *that* is something you don't want to respawn repeatedly... Similar could be said about scripting in Common Lisp. There are CL implementations (notably CLISP) that can load fairly quickly, but the merits of writing script-like applications in CL would come not in having a bunch of little scripts invoked via #!/usr/bin/clisp but rather by building a somewhat larger environment that expresses those "little scripts" as Lisp functions that can all run within a single CL instance. The same is probably also true for attempts to build applications in Java; you don't want to keep spawning more JVMs, but rather to invoke a bunch of applications from within the same one. -- Developmental Psychology "Schoolyard behavior resembles adult primate behavior because "Ontogeny Recapitulates Phylogeny" doesn't stop at birth." -- Mark Miller cbbrowne at hex.net- From n8gray at earthlink.net Wed Apr 12 14:50:47 2000 From: n8gray at earthlink.net (Nathaniel Gray) Date: Wed, 12 Apr 2000 18:50:47 GMT Subject: CGI for voting Message-ID: <38F4C64C.8AD133CA@earthlink.net> Can somebody point me to a CGI script in Python for a voting form that can enforce "one user, one vote"? I'm a newbie to CGI scripting and Python, so simplicity is more important to me than functionality. Thanks! -- Nathaniel A. Gray -- "But the sun is going down!" "No, no, you're all confused. The horizon is moving up." -The Firesign Theatre -- PGP Key: http://certserver.pgp.com:11371/pks/lookup?op=get&search=0x95345747 For PGP: http://www.pgpi.com/ From sjmachin at lexicon.net Thu Apr 13 18:46:13 2000 From: sjmachin at lexicon.net (sjmachin at lexicon.net) Date: Thu, 13 Apr 2000 22:46:13 GMT Subject: an intern-like memory saver Message-ID: <8d5ing$heb$1@nnrp1.deja.com> Problem: I have an application that works with words and can have millions of them in memory at one time. Apart from the main data structure, a dictionary is used to maintain frequencies. As the words are loaded from files, multiple instances of the same word don't share memory. The memory savings could be huge --- see how frequent "the" is in English text, or "Smith" in an Anglo telephone directory. Trial solution: (1) Clone dictobject.c. Make it into an extension module for a type called "mydict". Add a method called "key_ref".with one argument: adict.key_ref(obj). If adict.has_key(obj) is true, this returns a reference to the key value inside the dictionary; else it returns "obj". (2) Make simple changes to the application: (a) Change freq_dict = {} to freq_dict = mydict.mydict() (b) assuming for purposes of exposition that words are stored simply in a list, after freq_dict[w] = freq_dict.get(w, 0) + 1 change word_list.append(w) to word_list.append(freq_dict.key_ref(w)) Results: Gratifying. An exercise that was running out of real memory (384 MB) and taking a day now takes an hour or so. Questions: (1) Would this be sufficiently generally useful to make it a method of the standard dictionary object in Python? (2) As methods seem to be found by sequential search, wouldn't it be a good idea to move "get" a bit higher up the method_def list in dictobject.c? At the end, after "update" and "copy", doesn't seem like a good idea. (3) Has anyone had any success in compiling Python on WinNT 4.0 with gcc 2.95.2? It's just fine for making extension modules; I haven't tried compiling the whole Python yet. (4) Has anyone any better ideas for gauging Python memory usage than sitting watching the graphical display in WinNT's Task Manager? Might an instrumented or instrumentable malloc/free package (like Doug Lea's) that permitted implementation of a Python builtin memused() be the way to go, or is there a policy of using the standard malloc from the C library on each platform? Sent via Deja.com http://www.deja.com/ Before you buy. From scarblac-spamtrap at pino.selwerd.nl Thu Apr 13 13:32:40 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 13 Apr 2000 17:32:40 GMT Subject: List mapping? References: Message-ID: Robert Cragie wrote in comp.lang.python: > > Howcome you use reduce at all? > > > > Works fine with just doing > > > > tuplist = map(lambda x: (mylist[x], mylist[x+1]), range(0, len(mylist), > 2)) > > Yep, that's neater. My excuse is that I've only been learning Python for a > couple of weeks... In that case, forget you ever read something about map, lambda and reduce. Save it for later and code nice for loops now. 95% of the time, those things only obfuscate code anyway. -- Remco Gerlich, scarblac at pino.selwerd.nl This is no way to be Man ought to be free -- Ted Bundy That man should be me From vsuvorov at cccglobal.com Wed Apr 12 13:15:48 2000 From: vsuvorov at cccglobal.com (Vadim Suvorov) Date: Wed, 12 Apr 2000 12:15:48 -0500 Subject: static attributes & __getattr__ override Message-ID: <38f4b2e0@news.raccoon.com> Hello, I am trying to redefine class attributes access, to include static attributes definitions from class (shared by all class instances). It is ok for instance to shade class attribute. So I wrote class MyClass: var1 = 1 var2 = 2 def __init__(self, x3): self.var3 = x3 def __getattr__(self, name): return self.__class__.__dict__.get(name, None) MyObj = MyClass(3) print MyObj.var1, MyObj.var2, MyObj.var3, MyObj.var4 (expected result) >>> 1 2 3 None It works fine for attributes. However, I can not access standard methods of MyClass. I resorted to define __str__ and __repr__ (to be able to 'print MyObj'), and even then I could not use MyObj <> None which really hurts me. Can you advice me on best way to proceed, and explain briefly what is going on? I do not think it is a bug, I probably missing something in the way attributes/methods work. Thanks, Vadim From sabren at manifestation.com Wed Apr 26 06:57:21 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Wed, 26 Apr 2000 06:57:21 -0400 (EDT) Subject: [ANNOUNCE] weblib Message-ID: Weblib is a library for Python programmers who want to build interactive websites. It offers objects that are similar in feel to those found in Active Server Pages and the PHP base libraries. More specifically, weblib provides the following objects: * request : manages cookies, forms, and query strings coming from the browser. * response : manages your script's response. * sess : manages persistent sessions. * auth : provides an authentication framework. * perm : provides permission handling. In addition, weblib provides a wrapper module that handles most of the CGI work and provides the above services transparently to your scripts. ---------- The project is still pre-Alpha, but there's documentation and CVS access over at sourceforge: http://weblib.sourceforge.net/ Any feedback would be much appreciated. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From fw at deneb.cygnus.argh.org Tue Apr 11 13:46:06 2000 From: fw at deneb.cygnus.argh.org (Florian Weimer) Date: 11 Apr 2000 19:46:06 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com> <87r9cdhdb0.fsf@deneb.cygnus.argh.org> <87bt3geszz.fsf@deneb.cygnus.argh.org> Message-ID: <87itxocyzl.fsf@deneb.cygnus.argh.org> Michael Hudson writes: > 1) Neil's scheme does not replace reference counting. Oh. > 2) There are more things between the status quo and a free threaded > interpreter than reference counting issues. Yes, of course. But the reference counting appears to be quite a challange (at least if you haven't got an atomic load-increment-store operation). > So the answer to your question is: "no". I see. From gavrilov at iname.com Mon Apr 10 13:19:23 2000 From: gavrilov at iname.com (Alexander Gavrilov) Date: Mon, 10 Apr 2000 17:19:23 GMT Subject: The gzip module... neverending story References: <8cr7os$du3$1@lacerta.tiscalinet.it> Message-ID: Look at zipfile.py in ftp://ftp.interet.com/pub/pylib.html "FrancescO" wrote in message news:8cr7os$du3$1 at lacerta.tiscalinet.it... > Hello!, > I have, another questions!! > How can I zip i list of files? (i have done it, but... the files can't be > readed from winzip and gunzip...) > > Wich is the correct usage of the fileobj (4th parameters in the > gzip.GzipFile.. explain..: > GzipFile ([filename[, mode[, compresslevel[, fileobj]]]]) )? > > Is the name of the zipfile? what kind of object is it? > i'have try in a lot of ways to call this object, but I'm not "good" to work > it with the 4th parameter please... > > HELP ME...!!!! > > > > From rnog2438 at mail.usyd.edu.au Sun Apr 16 11:40:44 2000 From: rnog2438 at mail.usyd.edu.au (Ricardo Nogueira) Date: Mon, 17 Apr 2000 01:40:44 +1000 Subject: Event triggering and weak references References: <8dbif3$hm0$1@metro.ucc.usyd.edu.au> Message-ID: <8dcmv0$7ub$1@metro.ucc.usyd.edu.au> Robert Getter wrote in message news:MPG.1363441c166d9ca98969e at news-server... > In article <8dbif3$hm0$1 at metro.ucc.usyd.edu.au>, > rnog2438 at mail.usyd.edu.au says... > > First thanks for this beautiful language : ) > > > > I am Smalltalk addicted : ) and this means that I can't do with any other > > language, ex. C, C++, Java, : ( > > This was true until I found Python 2 weeks ago at Sydney Uni. I loved its > > modularity, pluggin behaviour and freedom. > > But I am missing Smalltalk event handling... Smalltalk (like Python) support > > the call-Back mechanism, but there is a more powerful inter-object interest > > registering that I haven't found in Python (so far). > > > > This is what I would like to do: > > Imagine I could have two or more Widgets open displaying a car speed value, > > say a numerical and a graphic display, if this car speed changes (ex. some > > one pushes the break), I would like to have any open widget on this value > > updated (on opening each window would register interest with this car > > speed). > > > > Smalltalk implements this with: > > > > The widget would register interest in one aspect of the car (on opening > > over aCar): > > aCar when:#speedChanged send: #updateSpeedDisplay to: self > > > > And the car would just notify who is interested, if any (when its speed > > changes): > > self trigger: #speedChanged > > > > But if any of this windows is not referenced anymore or crashes I would like > > the garbage collector clear it (the car would not be notified and his > > pointer to the window shouldn't keep the garbage collector form freeing the > > window memory). > > > > Again, Smalltalk implements this with weak references, that doesn't count > > for the garbage collector. > > > > Is there support for this in Python? > > > > Any suggestions? > > > > > > > > Here's some code which does some of what you want: > ========= > # simple test of a scheme for registering interest in an event. > # exception safety is left as an exercise for the reader > > class watcher: > def __init__(self, watchee, voyeur=None): > self.watchee = watchee > if voyeur == None: > self.list = [] > else: > self.list = [ voyeur ] > > def __call__(self, *args, **kwargs): > rc = apply(self.watchee, args, kwargs) > for voyeur in self.list: > apply(voyeur, args, kwargs) > return rc > > def register(self, voyeur=None): > if not voyeur: return > self.list.append(voyeur) > > def unregister(self, voyeur=None): > if voyeur: self.list.remove(voyeur) > return len(self.list) > > > def register(object, method, voyeur=None): > # try to add this voyeur to the watcher object > try: > getattr(object, method).register(voyeur) > # if this fails, there is no watcher object. Add one. > except: > try: > setattr(object, method, > watcher(getattr(object, method), voyeur)) > # if this fails, there is no method of that name. return > None. > except: > return None > # finally, return the newly installed watcher method > return getattr(object, method) > > def unregister(object, method, voyeur=None): > try: > if not getattr(object, method).unregister(voyeur): > # list is empty. remove watcher > setattr(object, method, > getattr(object, method).watchee) > except: pass > > class test: > def x(self): print "x()" > > def watch1(): > print "watch1()" > > def watch2(): > print "watch2()" > > def main(): > a = test() > a.x() > print > register(a, "x", watch1) > a.x() > print > register(a, "x", watch2) > a.x() > print > unregister(a, "x", watch1) > a.x() > print > unregister(a, "x", watch2) > a.x() > > if __name__ == "__main__": main() > ======== > > What this code does is install a wrapper around the method you want to > watch. This wrapper maintains a list of interested parties. There are a > few problems with this method: > > 1. No weak references. I think there is a weak reference extension > somewhere which could be added without too much trouble. > > 2. In Smalltalk, AFAIK, a method can only be referenced through its > object. In Python, each method is a callable object which can be > manipulated separately. In other words, object methods in Python are > really instance variables which just happen to be callable. As a result, > anywhere that objects pass bound methods around won't work right. If a > bound method is passed before the wrapper is installed, calls to the > method will not be sent to the watchers. This means that watchers can't > be reliably watched, since they work by getting references to themselves > put on a list in the watcher class. > > The only real solution I can think of for problem 2 is a generic > mechanism for attaching watchers to any callable object. This is similar > to what a debugger does. If you look into the debugging API, you may find > something that is suitable or can be modified. > > I never much thought about it before, but this could be a really useful > capability to have. > > Another way that this could be done which would also allow other nice > things to happen would be the ability to globally change all references > to one object into references to a different object. > -- > Rob Getter This is amazing! If I were this object "a" in your main method, I would feel like a child that have his "coca-cola" swapped to a "cuba"! I do really have lots to learn in this "do-what-ever-you-want-to-someones-object" filosofy. I will keep this wrapper around the method in mind. I implemented this observer pattern with a class that register interest from any boundedMethod to be called when a named event occurs. Then the object that inherits from this class has the option of triggering these events when it wants. The advantage is more encapsulation, with colaboration between objects. The disadvantage is that the trigger has to predict what will be wanted from him in advance. But both versions work with boundedMethods for the observer. If you change your main() to register(a, "x" , objY.msg) it will keep objY from being garbageCollected if we clear any other references to it. It is necessary to always call unregister before the "last" pointer to objY is cleared. Not very nice. How can we read objY reference count? If we come to know this number, compare to the number of boundedMessages we have for it, we can conclude if it is garbage and clear its references instead of calling its methods. Still, weak references would do the job beautifully... : ) ----- RiNo From maybe at lucky.com Tue Apr 11 03:56:18 2000 From: maybe at lucky.com (Soundwave) Date: Tue, 11 Apr 2000 09:56:18 +0200 Subject: readline skips on line Message-ID: <8culp8$23a$1@porthos.nl.uu.net> I got a part of a programm looking like this f=open('test.txt', 'r') while f.readline()!='': print f.readline() print 'ready' but when it is runned, it wil print out the lines in the text file, but it skips all the the odd line, it only displays line 2,4,6,8,10 and further How can I solve this problem ? From arnold at dstc.edu.au Sat Apr 1 19:48:57 2000 From: arnold at dstc.edu.au (David Arnold) Date: Sun, 02 Apr 2000 10:48:57 +1000 Subject: New Features in Python 1.6 In-Reply-To: Your message of "Sat, 01 Apr 2000 22:00:59 GMT." Message-ID: <200004020048.KAA31167@piglet.dstc.edu.au> -->"Fredrik" == Fredrik Lundh writes: Fredrik> I think things are worse than this -- someone just sent me Fredrik> something that looks like a draft press release, announcing Fredrik> that O'Reilly had taken over Python development, with Jon Fredrik> Orwant as CTO, and Larry Wall as the Python 1.6 release Fredrik> manager. and the date on the release was ??? d From sabren at manifestation.com Tue Apr 18 23:39:12 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Tue, 18 Apr 2000 23:39:12 -0400 (EDT) Subject: module naming? In-Reply-To: <38FD1A1D.D59B594B@kraken.itc.gu.edu.au> Message-ID: On Wed, 19 Apr 2000, Joal Heagney wrote: > I'm new to the pythoning game, but is there a way to check to see if a file > is loaded. I seem to remember that the from statement doesn't support that, > but maybe you could make a call to a function that does a check on if the > class already exists in program space, and if it doesn't imports it using > the from ... import statement? here's what I wound up doing (in weblib/__init__.py) ################# def Request(): import Request, weblib weblib.Request = Request.Request return Request.Request() ################## So, the first time I call it I'm really calling a function that calls a constructor and returns the new object.. and the second time, I call the constructor directly. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From effbot at telia.com Sat Apr 1 09:23:24 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 01 Apr 2000 14:23:24 GMT Subject: why did string.py change in 1.6? References: <8c4mdr$5p7$1@slb6.atl.mindspring.net> Message-ID: Andrew Dalke wrote: > In the CVS version (1.6a1) I see that string.py has been > The function strop.join still exists (so there is duplicated > code between that and the string module). Given the extra > method call overhead, can anyone tell me why this change was > made? python 1.6 has two string types. the 'strop' module only supports one of them. (the 'strop' module is obsolete. the 'string' module should be considered as "mostly deprecated", at least for anything that is better done via string methods :-) From wpostma at earthlink.net Thu Apr 6 19:51:07 2000 From: wpostma at earthlink.net (Warren Postma) Date: Thu, 06 Apr 2000 23:51:07 GMT Subject: "tostring" as a string method? References: <8c45ue$b7u$1@slb1.atl.mindspring.net> Message-ID: > Here's an example, which is used to translate DNA to > protein: > > def translate(dna, table = Translation.standard_table): > s = dna # or "dna.tostring()" for array.array > x = [] > for i in range(0, len(s), 3): > x.append(table[s[i:i+3]]) > return string.join(x, "") > Why not write str(dna) and overload __str__ where necessary? # polymorphism exhibited for all types, conversion to string: class myClass: def __init__(self,value='something'): self.value ='something' def __str__(self): return self.value myObject = myClass() a = [ 5, 5.5, myObject, 'test'] for i in a: print str(i) Warren From meh9 at cornell.edu Thu Apr 13 14:56:38 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Thu, 13 Apr 2000 14:56:38 -0400 Subject: Simple formatting string question Message-ID: Hi All, I'm trying to print something like this: >>> print 6*'%2i' '%1i' % tuple([5,5,5,5,5,5,1]) but I'm getting an error. Do you know what the correct syntax should be? Thanks, Matt From tismer at tismer.com Fri Apr 28 09:21:45 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 28 Apr 2000 15:21:45 +0200 Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> <8e4akc$p7o$1@newshost.accu.uu.nl> <3908E6EC.B9E6B2E8@cosc.canterbury.ac.nz> Message-ID: <39099069.7BFD8387@tismer.com> Michael Hudson wrote: > > Greg Ewing writes: > > > Bernhard Herzog wrote: > > > > > > It would be a good idea IMO to find a > > > good syntax for this case and ISTM that list comprehensions might be > > > useful here: > > > > > > multi_list = [[] for i in range(10)] > > > > > > or whatever the precise syntax was. Hmm, the unused variable in there is > > > a bit ugly though. > > > > Maybe the LC syntax should include something like > > > > [[] times 10] > > But wouldn't that make "times" a keyword? Not sure I'd want that... Currently, yes, but it is absolutely not necessary to be so. It requires to change the grammar to treat operators differently. A similar change would allow me to use def foo(from=1, to=42): ... since there is no reason to recognise from as a keyword in parameter position. Similarily: in class foo: def impossible(self, a, b, c): self.pass = a self.continue = b self.return = c could quite easily be allowed. But I'm tired to fight such a proposal again for no result... ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 dalke at acm.org Sat Apr 15 17:11:01 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 15 Apr 2000 15:11:01 -0600 Subject: Scripting and Gnome and KDE References: <8d95m0$9j6$1@news1.xs4all.nl> Message-ID: <8damat$4ja$1@slb2.atl.mindspring.net> Boudewijn Rempt said: > when I read the article on PyGTK > in Dr Dobbs I can only be glad I choose for PyQt and PyKDE. It painted > a very bleak picture... Even though it says "The result is a great environment for rapid development of GUI-based applications." ? I used to work at Bioreason, though I wasn't involved in the GUI development. They are pretty happy about PyGTK. The idea of the DDJ article was to point out how to take advantage of the toolkit, based on finding out what doesn't work. You could write a similarly bleak picture of any toolkit. Take the last section, "Troubleshooting." It says the method and parameters names aren't always sufficient, so you need a copy of the documentation. But the docs don't keep up with the code so you need the code as well. The same text can be applied to Python. Andrew dalke at acm.org From robin at jessikat.demon.co.uk Fri Apr 14 15:51:44 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 14 Apr 2000 20:51:44 +0100 Subject: Python idiom: Multiple search-and-replace References: <20000412100816.A2431031@vislab.epa.gov> <5C%I4.645$rc9.190288896@newsb.telia.net> Message-ID: In article <5C%I4.645$rc9.190288896 at newsb.telia.net>, Fredrik Lundh writes >Randall Hopper wrote: >> Is there a Python feature or standard library API that will get me less >> Python code spinning inside this loop? re.multisub or equivalent? :-) > >haven't benchmarked it, but I suspect that this approach >is more efficient: > >... > ># based on re-example-5.py > >import re >import string > >symbol_map = { "foo": "FOO", "bar": "BAR" } > >def symbol_replace(match, get=symbol_map.get): > return get(match.group(1), "") > >symbol_pattern = re.compile( > "(" + string.join(map(re.escape, symbol_map.keys()), "|") + ")" > ) > >print symbol_pattern.sub(symbol_replace, "foobarfiebarfoo") > >... > > > ... I'm trying to use the above idiom for the strings '(' ')' '\\' but seem to have a speed problem ie import re import string from time import time symbol_map = { '(': '\\(', ')': '\\)', '\\': '\\\\' } def symbol_replace(match, get=symbol_map.get): return get(match.group(1), "") PAT = "(" + string.join(map(re.escape, symbol_map.keys()), "|") + ")" print PAT symbol_pattern = re.compile( PAT ) def doit(str,n): N = xrange(n) t0 = time() for n in N: s=string.replace(str,'\\','\\\\') s=string.replace(s,'(','\(') s=string.replace(s,')','\)') t1 = time() print 'string %s %.4f' % (s,t1-t0) t0 = time() for n in N: t = symbol_pattern.sub(symbol_replace, str ) t1 = time() print 're %s %.4f' % (t,t1-t0) doit("a b (c) \\t",10000) produces (\\|\(|\)) string a b \(c\) \\t 0.4900 re a b \(c\) \\t 5.3900 ie for this simple case string is best. Could I do better? -- Robin Becker From zhuravle at us.ibm.com Mon Apr 17 16:30:15 2000 From: zhuravle at us.ibm.com (zhuravle at us.ibm.com) Date: 17 Apr 2000 16:30:15 EDT Subject: Resume Message-ID: <44311C77F56CD31187F40090279C687A08366D@RUSSELL> Thank you and be careful -- there is a severe weather alert in Washington area Polina Zhuravlev IBM Global Services I/T Specialist Phone: (614)659-7347 T/L: 657-7347 Fax: (614)659-7300 Pager: (800)759-8888 PIN 1364734 E-mail: zhuravle at us.ibm.com From kern at caltech.edu Sat Apr 1 15:27:46 2000 From: kern at caltech.edu (Robert Kern) Date: 1 Apr 2000 20:27:46 GMT Subject: Python/GTK on Windows? References: <#XSVXB5m$GA.240@cpmsnbbsa03> Message-ID: <8c5m42$1dv@gap.cco.caltech.edu> In article <#XSVXB5m$GA.240 at cpmsnbbsa03>, "lexberezhny" writes: > Hi, > I was wondering if anyone was able to get PyGTK to work on windows, and if > its possible at all. I am trying to port a Linux app to windows that uses > PyGTK. If you know anything about this or can point me in the right > direction, I would really appreciate it. Thanks. http://theopenlab.uml.edu/pygtkwin/ > - Lex Berezhny -- Robert Kern kern at caltech.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter From milesthompson at sprint.ca Thu Apr 20 19:15:40 2000 From: milesthompson at sprint.ca (Miles Thompson) Date: Thu, 20 Apr 2000 20:15:40 -0300 Subject: How2 use curses for data input References: <38FF6DE2.5751423A@sprint.ca> Message-ID: <38FF8F9C.9D533E74@sprint.ca> Grant, I located it on the RH system here in the office at home. The target machine is Debian, and I think I can install RPM on it so that if need be, I can get the RPM. Debian doesn't seem to have a snack package. Thanks for the lead, much appreciated. I've searched google, www.python.org, and www.debian.org for information on how to use it. All that's on my system is snack.py, .pyc and _snackmodule.so. I *hoped* there might be some clues in __builtin__ or in snakc.py, but I drew a blank. Do you have any suggestions where I might dig something up? (I had really hoped that RH might have something, but nope!) Regards - Miles Grant Edwards wrote: > In article <38FF6DE2.5751423A at sprint.ca>, Miles Thompson wrote: > > >I 've read the curses part of the manual, and the HOWTO, but I'm not > >much wiser. I need to capture some user input (name of a new directory > >for archiving some web files), and I understand how to define a window, > >etc. What I don't know to do is how to edit the lines, and loop from > >last to first. > > You might want to take a look at the "snack" module, which is a > wrapper for the newt library (which is based on slang rather > than curses). It impliments a set of text-mode widgets such as > buttons, scroll lists, data entry fields, checkboxes, etc. You > stick a bunch of them on a "form" and pop it up. When the user > is done, you get the values back somehow (I forget exactly). > > If all you need to do is prompt the user for some data, it > should do the trick. > > Redhat's text-mode installer is (or at least was) written in > Python using snack/newt. > > -- > Grant Edwards grante Yow! Why was I BORN? > at > visi.com From andre at beta.telenordia.se Sun Apr 2 07:59:43 2000 From: andre at beta.telenordia.se (André Dahlqvist) Date: Sun, 02 Apr 2000 12:59:43 +0100 Subject: Emacs Python mode References: Message-ID: <8c794n$mjq$1@zingo.tninet.se> > all in all, *emacs* has lots of shortcuts for handy things. I wish I > knew more about it.. :) While we're on the subject of Emacs Python mode, why is it that I can't indent a line under a line which has been commanted out? Emacs refuses to let me tab in there, but if I remove the comment it will happily let me do it. // Andr? From tiddlerdeja at my-deja.com Fri Apr 28 08:24:57 2000 From: tiddlerdeja at my-deja.com (tiddlerdeja at my-deja.com) Date: Fri, 28 Apr 2000 12:24:57 GMT Subject: sleep function? Message-ID: <8ebvud$l6h$1@nnrp1.deja.com> Does python have a sleep function? e.g. sleep(60) to wait 60 seconds? I realise this is a lame question, but I have no python documentation around just now. Thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From dirck at pacbell.net Tue Apr 11 10:54:04 2000 From: dirck at pacbell.net (Dirck Blaskey) Date: Tue, 11 Apr 2000 07:54:04 -0700 Subject: WinNT and TCL/TK References: <8cv5vo$f0v$1@pegasus.csx.cam.ac.uk> Message-ID: <8_GI4.1349$uE2.530668@news.pacbell.net> James "Wez" Weatherall wrote in message news:8cv5vo$f0v$1 at pegasus.csx.cam.ac.uk... > "Jerome Chan" wrote in message > news:eviltofu-9BCDF3.08165411042000 at news.earthlink.net... > > Have installed Python 1.5.2 on a WinNT Server but it says it can't find > > a TCL lib when I start it up. Do I have to add something? > > This is a path-setting bug, as far as I can tell. Under the My Computer > Properties tab in Windows, change the system's PATH to include the directory > containing the Tcl library (usually c:\program files\tcl\bin). > > The other option is to copy the tcl80.dll (?) file from that directory into > the system32 directory. That way you needn't alter the system PATH but you > will have a rogue file in your system directory! Extra copies of the tcl/tk dlls can cause the 'init.tcl not found' error instead of the dll not found error, so copying the dlls into system32 isn't recommended. Change the PATH or use a modified FixTk.py: http://www.danbala.com/python/fixtk More information is also available here: http://www.pythonware.com/people/fredrik/fyi/fyi02.htm Good luck d =========================== Dirck Blaskey Danbala Software dirck at danbala.com http://www.danbala.com From phd at phd.russ.ru Mon Apr 24 11:46:21 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 24 Apr 2000 15:46:21 +0000 (GMT) Subject: questions about imports and classes In-Reply-To: <3904681D.FE39B41A@hologic.com> Message-ID: On Mon, 24 Apr 2000, Tim Iskander x7483 wrote: > 1 - is it possisble to get the instance name of an object (similar to > the class.__name__ > attribute) It is impossible. Consider a = A() b = a Now both a and b points to the same instance; what is the name, a or b? :) > 2 - has there been any/much discussion on extending the import command > to allow You need __import__ builtin function. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From neelk at brick.cswv.com Wed Apr 5 19:18:58 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 5 Apr 2000 23:18:58 GMT Subject: Why should I switch to Python? - Infinity of Primes References: Message-ID: Moshe Zadka wrote: > > [the axiom of choice] > > Thus, the question was taken out of mathematics and into philosophy, > and hence cannot be answered, so the only answer I can give is my > own: I refuse to use the axiom of choice, but I do use the > ultra-filter axiom. This relates in a deep way to how I view the > future of mathematics. I tend towards Chaitin's view: "Axioms are very cool -- make some more up! After all, mathematics is basically arbitrary anyway!" I guess this shows I am really a frustrated Hilbertist at heart. :) Seriously, I've developed an interest in constructive mathematics since running across the whole style of syntax-directed soundness proofs in type theory. It has (finally) dawned on me that getting acquainted with a more constructive style of analysis will likely make me a better programmer. Can you suggest a good textbook? Neel From dalke at acm.org Thu Apr 20 01:48:22 2000 From: dalke at acm.org (Andrew Dalke) Date: Wed, 19 Apr 2000 23:48:22 -0600 Subject: pattern-based string expansion References: <38F52C61.A5D72F89@gte.net> <8del87$5md$1@slb6.atl.mindspring.net> <38FE70DB.29A4B1A1@gte.net> Message-ID: <8dndbe$dcu$1@slb6.atl.mindspring.net> Nick Mathewson wrote: >It's a very very simplified version of (a subset of (a more general >regex-manipulation module for (a project that I'm working on))). I >didn't need an expansion function for my project, but it was pretty >easy to hack one up. You'ld probably be interested to know that Python 1.6a has an sre_parse module which parses regular expressions into a Python data structure. But technically the distribution says you can only use that module for alpha/beta testing. Andrew From jmg at ecs.soton.ac.uk Mon Apr 17 13:42:34 2000 From: jmg at ecs.soton.ac.uk (Jacek Generowicz) Date: Mon, 17 Apr 2000 18:42:34 +0100 Subject: Handling errors in open Message-ID: <38FB4D0A.489FF50F@ecs.soton.ac.uk> Hi, Is there a way to prevent a Python script from terminating when `open' fails, and have it handle the error more helpfully . . . I was thinking along these lines: from sys import argv try: file = open(argv[1],"r") except IOerror: print "You lied about that file." Jacek From akira.kiyomiya at autodesk.com Thu Apr 27 17:20:06 2000 From: akira.kiyomiya at autodesk.com (Akira Kiyomiya) Date: Thu, 27 Apr 2000 14:20:06 -0700 Subject: Simple Modules Question Message-ID: <8eaaul$16p@autodesk.autodesk.com> I see NameError when I try to do string.atoi("45"). Is it because 'string' is at a different location?? Thanks Akira from string import atoi # imports 'string' # places atoi in current namespace print atoi("12345") # invokes 'atoi' without module name string.atoi("45") # NameError: string From boncelet at udel.edu Thu Apr 6 22:53:06 2000 From: boncelet at udel.edu (Charles Boncelet) Date: Fri, 07 Apr 2000 12:53:06 +1000 Subject: NumPy modelling of Belief Tables? References: <8ciem1$scb$1@kopp.stud.ntnu.no> Message-ID: <38ED4D92.6A256DB2@udel.edu> Magnus Lie Hetland wrote: > > > If, for instance, the table t1 has the dimensions X and Y, while t2 has the > dimensions X and Z, then for each x, y, z in X, Y, X, > > (t1 * t2)[x,y,z] = t1[x,y] * t2[x,z]. > > This may be simple to do in NumPy (it is certainly easy to do > algorithmically) - I just can't see how... Two ideas: 1. loop over the columns (rows) of one of the matrices and let numpy broadcasting work for you. Then convert back to a single numpy object. 2.try multiply.outer(t1,t2) or multiply.outer(t2,t1) followed by some diagonal magic: tt = multiply.outer(t2,t1) t = diagonal(tt,axis1=1,axis2=3) (You may need to rearrange things to get the output in the order you want. Bear in mind that tt is a 4d object, so this may be slow.) > > > Division is about the same thing, except that 0/0 = 0... For tables with the > same dimensions, I guess one could use something like > > t1 / where(equal(t2,0),1,t2) > > where 1 is just an arbitrary value. (I'm not sure how this solution > generalizes when the dimensions differ...) This should work. (Note to others: he is assuming that t2=0 implies t1=0.) > > > The other operation needed is marginalization of the tables. When a table > is marginalized over some of its dimensions, the elements having equal > coordinates in the remaining dimensions (i.e. the ones not being > marginalized > over) are added. For instance, if you have a two-dimensional table, t, over > the variables X and Y, and you want to marginalize out Y, then for each > x in X, > > m[x] = sum with x in Y { t[x,y] }, > > where m is the marginalized table. > "sum" is your friend here. If a=array([0,1],[2,3]), the sum(a)=array([2.4]) and sum(a,1)=array([1,5]). Just specify the axis over which you want to sum. If you produce anything interesting, please publish it if you can. Charlie Boncelet ------ Charles Boncelet, University of Delaware, On sabbatical at ADFA, Canberra Australia, Home Page: http://www.ece.udel.edu/~boncelet/ From pyython-list at teleo.net Mon Apr 17 10:38:00 2000 From: pyython-list at teleo.net (Patrick Phalen) Date: Mon, 17 Apr 2000 07:38:00 -0700 Subject: Filtering web proxy In-Reply-To: References: Message-ID: <00041707431801.00880@quadra.teleo.net> [Oleg Broytmann, on Mon, 17 Apr 2000] :: I want a filtering web proxy. I can write one myself, but if there is a :: thing already... well, I don't want to reinvent the wheel. If there is such :: thing (free and opensourse, 'course), I'll extend it for my needs. Try CTC (Cut the Crap). It's written in Python and is GNU'd. http://softlab.ntua.gr/~ckotso/CTC/ From bwinton at tor.dhs.org Mon Apr 10 15:25:40 2000 From: bwinton at tor.dhs.org (Blake Winton) Date: Mon, 10 Apr 2000 19:25:40 GMT Subject: What is python's language level? References: <38EA1B8F.A797A130@lmco.com> <38EA9CD4.3473B910@callware.com> Message-ID: On 4 Apr 2000 23:04:01 -0500, Cameron Laird wrote: >Roy Smith wrote: >>Have you ever looked at the output of a bib | tbl | eqn pipeline? >Are you kids still using that as a pick-up line? Well, you've got to admit that it's better than "Shocking bad hat". Kids these days... Blake. -- 2:54pm up 12 days, 15:28, 1 user, load average: 1.08, 1.02, 1.01 From pecora at anvil.nrl.navy.mil Fri Apr 28 07:46:58 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Fri, 28 Apr 2000 11:46:58 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> Message-ID: <280420000746597329%pecora@anvil.nrl.navy.mil> In article , Remco Gerlich wrote: > No. However, this seems to make code *more* readable. In fact, many C++ > programmers use 'this.x' for all their instance variables, to be able to > see at a glance which are just local variables of the function and which are > instance variables. It's just more work to write, but that doesn't matter > much. I understand the potential for readability, but I do a lot of mathematical programming so the expressions can get pretty cluttered with variables and operators. More self's only makes it worse for me. Maybe that's my problem, but then that's my complaint. > Python needs it to know which vars are instance variables, and which are > local variables. I'm sure some way of declaring variables 'local' could be done in the class defintion, but I doubt Guido would do that now. > Funny how people say that every aspect of Python they don't like make the > language less "clean". It is extremely consistent though. Funny, I guess. Harder to read for me. > You *can* use another word for 'self' though, 's' or 'me' or something. But > it makes your code harder to read, of course... You mean by doing something like s=self at the beginning of each class method? Thanks. From hgg9140 at george.org Sat Apr 1 18:48:44 2000 From: hgg9140 at george.org (Harry George) Date: 01 Apr 2000 15:48:44 -0800 Subject: Why should I switch to Python? References: Message-ID: Of course, read the language comparisons. But what you seem to be seeking is personal experiences, so here is another one: For 3 years I've written perl code. 1 LOC, 10 LOC, 100 LOC, 1000 LOC, and larger. It revolutionized our group's productivity and I got several other people interested. I made a point of timing projects with a stopwatch (27 minutes from notion through rqmts, spec, code, alpha, beta, and implementation is my personal best). We also did code reviews with at least 1 experienced perl-ist in the review -- this was valuable in improving community coding skills. I noticed that people who wrote in it all the time did ok, but if you go away (e.g., code in lisp, prolog, C, C++, Java), and come back, you forget the rules for stuff like references. I was spending a lot of time helping people maintain code they originally wrote but could no longer understand. Personally, I write as maintainably as I can ("-wt", "use strict", subset of available syntax, etc.), but even I was getting lost on references. Then I did a multi-module, OO project with several thousand lines. It was heavily into references and overrides and hashes inside of arrays inside of hashes. I survived it, but was ready for another approach. So I redid it in python. It took a couple weeks to catch on to some of the idioms, but the result was fewer files, fewer lines of code total, and vastly more maintainable. Among other things, I could see the forest for the trees, anc changed some algorithms. HOWEVER: It ran slower than the equivalent perl code. Is this important? Not for my task, where the difference is roughly 2 seconds vs 1 second. Profiling showed a lot of that was in reg expr tasks, so I'll see what 1.6 does. I found python didn't support perl-ish idioms, some of which are very succinct and just plain cool. So I wrote pyperl and cgipm. With those in hand, python gets the perl idioms but still has python's robust syntax. Next, I started porting java apps (e.g., XML and database stuff) to python. Again, dramatic improvements in LOC, development time, and maintainability. These days, I still write perl and java where required by work conditions, but use python where permitted. Unfortunately, I've managed to "sell" perl to several managers (who have invested in sending their people to classes), and they aren't happy that I'm now pushing something else. Aaron Turner writes: > A friend of mine is trying to convince me we should > do a project using ORBit in Python. I've been > coding Perl for over 3 years and really like it. > (Especially it's syntax and ability to grok my > programming style.) Now, I understand the Perl > vs. Python war and everyone has their preferred > taste in the matter. > > What I'd like to hear from people is what technical > resons I should switch to Python. Are there any > features that Python has (perhaps in it's OO > offering) that Perl lacks? From what I can tell > people tend to prefer Python over Perl mostly > for its syntax, which I find very likable. > > Thanks. -- Harry George hgg9140 at seanet.com From effbot at telia.com Mon Apr 3 03:14:07 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 03 Apr 2000 07:14:07 GMT Subject: Unicode program representation References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> Message-ID: <3xXF4.1060$n68.186533888@newsb.telia.net> Neil Hodgson wrote: > I think this should be changed to interpreting the literal as a UTF-8 > literal. The advantage here is that non-roman string literals become a > natural part of the language. however, perfectly valid ISO Latin 1 strings (or any other standard 8-bit encoding) are invalid UTF-8 strings. changing the default to UTF-8 this is likely to break many existing scripts. maybe we can change the default in Python 3000, but to fix this be- fore that, we'll need to introduce an "encoding pragma" of some kind, and leave the default as "pass through". From robin at jessikat.demon.co.uk Sat Apr 22 08:19:03 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sat, 22 Apr 2000 13:19:03 +0100 Subject: code not true? References: <8ds3ku$q0l$1@nnrp1.deja.com> Message-ID: <4b9kXXA3iZA5EwLn@jessikat.demon.co.uk> In article <8ds3ku$q0l$1 at nnrp1.deja.com>, jeff_islay at my-deja.com writes >Why does the second example return false? > >>>> print 7.0 == 7 >1 >>>> print (.07 * 100) == 7 >0 > > >Sent via Deja.com http://www.deja.com/ >Before you buy. .07 isn't exactly representable in your (probably IEEE) binary floating point representation. print .07*100 -7 8.8817841970012523e-016 -- Robin Becker From javanet at dynacap.com Thu Apr 27 18:00:27 2000 From: javanet at dynacap.com (Arnaldo Riquelme) Date: Thu, 27 Apr 2000 14:00:27 -0800 Subject: Newbie Question Message-ID: Suppose I have a file name tick.tkr that looks like this SUNW. MFST. FOO. SPAM. MOO. End_Of_File I want to read the file into a list myfile = open("tick.tkr", "r") mylist = myfile.readlines() Now I have mylist with the contents of tick.tkr. "mylist" looks like this ['SUNW.\012', 'MSFT.\012', ..........'End_of_File/012'] How do I read the file into a list without getting the newline character, so I can accomplish this for tic in mylist: #create file tic.prn I know the other P language has something like 'chop' or something like that, but I'm not going there. Thanks Arnaldo, From embed at geocities.com Fri Apr 7 11:57:37 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 7 Apr 2000 11:57:37 -0400 Subject: reduce versus recursion? what am I missing... Message-ID: # I am trying to figure out why function d (recursive) and e (reduce) # DON'T do the SAME thing: def d(*tup): "why doesn't this work?" if len(tup)>1: return d(tup[1:])+abs(tup[0]-tup[1]) else: return 0 l = (1,3,5,7,9) def e(*tup): "it works" return reduce(lambda x,y:abs(x-y),tup,0) print "--- test:" print "recursion: ",apply(d,l) print "reduce: ",apply(e,l) #--- #Warren # # output: #--- test: #recursion: 2 ( appears not to actually be recursing more than 1 level!!!???) #reduce: 5 From effbot at telia.com Sat Apr 1 05:26:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 01 Apr 2000 10:26:58 GMT Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com> <38E58D2D.384F1546@Lugoj.Com> Message-ID: James Logajan wrote: > Also, how good are you at math? You seem to feel that 5 minutes of "Guido > the god's" time is of much more value than that of 1000 knuckle-dragging > Neanderthal programmers like myself spending a mere 10 minutes each to make > sure their code doesn't break. Of course, if we happen to take more than 10 > minutes its our own damn fault I'm sure you'll agree. the strange thing here is that there are changes listed on that page that are far more difficult to spot and fix, but for some reason, neither you or bjorn seem to care. instead, bjorn announced that he'd never upgrade to 1.6 based on a single change in 1.6a1, despite the fact that there will be a 1.6a2, a3, b1, b2, rc1, etc. before it's time to really make that decision. others have politely asked for backwards compatibility on this one (which would mean *adding* extra code to handle multiple calling syntaxes). someone will probably come up with a patch well before the next alpha, but probably not because you guys are flaming away on this newsgroup. besides, the notion that 10 minutes spent on fixing this will outweigh all others costs involved in upgrading to a new release of the core interpreter strikes me as rather odd... (heck, both of you have probably spent far more than ten minutes each writing your posts...) > Now how did I get so pissed over this exchange of posts? now how come I find your "guido the god" argument to be directly offensive? From BLAISE.BONNEVILLE at wanadoo.fr Fri Apr 21 02:49:01 2000 From: BLAISE.BONNEVILLE at wanadoo.fr (BLAISE BONNEVILLE) Date: Fri, 21 Apr 2000 08:49:01 +0200 Subject: print a pixel References: <8dmcvb$r6n$1@wanadoo.fr> <20000420080534.A623423@vislab.epa.gov> Message-ID: <000201bfab5e$c8e3a1a0$a688fcc1@wanadoo.fr> By "printing a pixel", I mean to open a new window on the screen with nothing in it. Then I want to get a pixel in this window when I enter its coordinates (x ; y) and I would like to be able to chose its color as well. I hope you can now understand my question. I send the program in which I want to use this "print a pixel" function. Maybe it will help you understand exactly what I want to do. It should draw Mandelbrot's fractal : to do so, it tests every pixel in a blank window to dertermine if this particular pixel checks a property (what I called the "test" function"). If so, this pixel must appear in the window. Thank you. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: mandel.py URL: From kc5tja at garnet.armored.net Sun Apr 30 19:55:27 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 30 Apr 2000 23:55:27 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8ecsgj$6lp$1@slb0.atl.mindspring.net> <300420001008012011%pecora@anvil.nrl.navy.mil> Message-ID: >OK, let's bite :-) > > int WriteData(void *buffer, char *str, int len) > >I fail to see how this is somehow hard to read :-) It's not, in this context. But it was a decidedly simple example. How about this: int Evaluate( char *str1, char *param1, char *param2 ); Note the `param1' and `param2' argument names. Hate to tell you this, but that's Hungarian notation -- you're identifying those arguments as "parameters". But what the heck would str1 represent? The command that acts on those parameters? You don't know -- you CAN'T know from this definition. It's cases like this that I choose to use hungarian notation: uint32 Evaluate( char *cmd, char *param1, char *param2 ); -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From gmcm at hypernet.com Tue Apr 11 15:45:49 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 11 Apr 2000 15:45:49 -0400 Subject: Functions and objects In-Reply-To: Message-ID: <1256640143-42229404@hypernet.com> Matthew Hirsch wrote: > >>> a > [5] > >>> for x in range(5): # Case A > ... temp=a > ... print a > ... temp.append(1) > ... > [5] > [5, 1] > [5, 1, 1] > [5, 1, 1, 1] > [5, 1, 1, 1, 1] > > >>> a=f(5) > >>> for x in range(5): # Case B > ... temp=a[:] > ... print a > ... temp.append(1) > ... > [5] > [5] > [5] > [5] > [5] > >>> > > In case A, why doesn't temp reset itself to the value of a, [5], that > was predetermined before it entered the loop? Why do you need to copy > the list to get the behavior I'm looking for in Case B? Doesn't a > always equal [5]? In case A, temp is another name for a. In B, temp is a copy of a. The existence of "f" has nothing to do with it. - Gordon From m.faassen at vet.uu.nl Wed Apr 12 10:24:29 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 12 Apr 2000 14:24:29 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d1lgu$ga0$1@newshost.accu.uu.nl> Message-ID: <8d20ut$gbe$1@newshost.accu.uu.nl> Daniel Berlin+list.python wrote: [I mention that people do care about distutils] > I didn't say nobody cares, i was basically saying i don't see all that > many complaints about this on the python lists. That's probably because people are patiently waiting for the distutils. The issue has been raised quite a few times. > Maybe i'm just missing them. I realize their is a whole SIG about the issue, > but it's not a problem for me. That's good for you. You came across a bit hostile, though, with your 'who gives a crap?' response. [snip] > Sure, i'm all for it too, I just don't see why it should be all that > high of a priority. Apparently Tom thinks it's nice; I didn't think he was telling people to fix it now. He just mentioned some features of Perl that he considers nice and absent in Python, right? > I also don't see why Tom praises the CPAN module so much. [problem description with CPAN snipped] I haven't used Perl and CPAN, but I've heard from several people on this list that CPAN is pretty nice. Since I haven't used it myself, I don't know about your problem. [Daniel] >>> Why do i get the feeling you'll never be satisfied? [me] >> Why attacking Tom so much? [Daniel] > I've not attacked him at all. > I simply asked a question. Okay, then let me inform you that your style of posting and asking questions does come across a trifle hostile once in a while to me. Perhaps others disagree with me, but that's how it feels to me. >> What has Tom done to you in >> the past? Why does he get the bad reception he does? > Because he comes in here with both barrels firing. > What reception did he expect? Um, I didn't see him do that at all. And even if someone comes in with both barrels firing, you're not supposed to fire back. You're supposed to discuss mathematical proofs of an infinity of primes. :) [not that the thread I'm referring to had someone coming in with both barrels firing either!] Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From jhauser at ifm.uni-kiel.de Wed Apr 12 04:52:29 2000 From: jhauser at ifm.uni-kiel.de (Janko Hauser) Date: 12 Apr 2000 10:52:29 +0200 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> Message-ID: <874s9766r6.fsf@ifm.uni-kiel.de> I think this will do it class lazy: def __init__(self, name): self.name = name def fired(self): print 'You are fired %s' % self.name class paul(lazy): def __init__(self, name): self.name = name # <---- ????? self.april_pay = 0 def fired(self): print "Here's a box, collect the things from your desk" self.__class__.__bases__[0].fired(self) te = paul('myname') te.fired() 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 mhammond at skippinet.com.au Mon Apr 10 20:39:07 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 11 Apr 2000 00:39:07 GMT Subject: Python 1.6 -- Any hope for new threading core? References: Message-ID: "Brent Fulgham" wrote in message news:EDFD2A95EE7DD31187350090279C6767706F14 at THRESHER... > Just curious if any of this behavior is changed > with 1.6? Nope. Mark. From embed at geocities.com Wed Apr 19 10:53:57 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 19 Apr 2000 10:53:57 -0400 Subject: Very Horrible Question About Goto's References: <6325E90C8B6ED21189080001FA7E2ADA0D4051@IBA1> Message-ID: >I'm trying to create a converter from our own internal language (horrid) into python. > My only problem so far is that the original language uses *LOTS* of goto's. >Is there any way that this can be replicated within python ? Sounds like you're trying to avoid dealing with the Accidental Complexity in your system. You'd probably find that it's going to kill you if you don't deal with it. I'm saying this only because I've done that myself. However, I find programmers like myself are always loath to wander into irreducibly complex problems without first trying to take a stab into the heart of whatever complexity they've run up against. Given that, you might get Creative and try to write a code-analyzer and translator in Python to parse all your Horrid 1.0 Sources and output the sorts of "meta-data" that might help you in constructing your new system, or even help you automate your conversion process. People on this newsgroup are always up for a challenge, so why not post a sample snippet of Horrid 1.0 and say what you'd like to do with it to Pythonize it. It's also possible for you to consider a "state based" or "event model" based system for your existing code. You could create a dictionary of state objects, and a "directed graph" model of showing the connections from state to state. If you want to be really slick, make a visual model of your state-charts. :-) We are working on a state-based model of programming for Python, probably going to use C.T's stackless-python eventually, but for now we are just playing with some trivial python scripts to get a prototype of our event model working. I am also considering the "graph" capabilities of the little kjBuckets extension (see the GadFly web page for this little C extension) which provides some extremely Nifty and Fast set/graph/dictionary extensions that are helpful in this sort of case. Warren From alwagner at tcac.net Mon Apr 17 09:03:50 2000 From: alwagner at tcac.net (Albert Wagner) Date: Mon, 17 Apr 2000 08:03:50 -0500 Subject: Printer & redirection follow-up Message-ID: <38FB0BB6.F8174FF8@tcac.net> To all who replied to my posts, thanks again. Below is the result of my hacking and your advice. For you Windows guys: This works under Linux; will it work under Windows? # import sys from DisplayFileList import * try: queue = 'lpt' from win32pipe import popen except ImportError: queue = 'lpr' from os import popen class Paginator: def __init__(self): self.lineCount = 0 self.linesMax = 50 self.pageCount = 1 def printList(self, rootDir, rootName): self.rootName = rootName self.displayer = DisplayFileList() sys.stdout = self # Output of displayer redirected here self.printer = popen(queue, 'w') self.displayer.displayTree(rootDir) #prints to sys.stdout self.printer.close() sys.stdout = sys.__stdout__ def write(self, aLine): #Used by sys.stdout if self.lineCount == 0: #If first page then... self.pageHeader() #print 1st page header self.printer.write(aLine) if len(aLine) > 1: #only count real lines, not \n only lines self.lineCount = self.lineCount + 1 if self.lineCount > self.linesMax: #If end of page then... self.printer.write("\f") #eject and print page header self.pageHeader() def pageHeader(self): -- Small is Beautiful From gmcm at hypernet.com Tue Apr 4 15:55:16 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 4 Apr 2000 15:55:16 -0400 Subject: Why should I switch to Python? - Infinity of Primes In-Reply-To: <38EA369C.26A1C25@math.okstate.edu> Message-ID: <1257244378-5884705@hypernet.com> David C. Ullrich wrote: > ... Could be that there's a proof of the existence > of infinitely many primes using FTA that has some property > not shared by Euclid's proof, but "constructive" isn't it. Oh, come on. There are at least 3 well known constructive proofs that all odd numbers are prime: The mathematician's: 3 is prime, 5 is prime, 7 is prime as so on, by induction. The physicist's: 3 is prime, 5 is prime, 7 is prime, 9 is prime 11 is prime... The computer scientist's: 3 is prime, 3 is prime, 3 is prime .... - Gordon From python-list at teleo.net Sun Apr 2 19:43:36 2000 From: python-list at teleo.net (Patrick Phalen) Date: Sun, 2 Apr 2000 16:43:36 -0700 Subject: Just doing local file testing In-Reply-To: <38E7D6DE.EA09C891@regnoc.com> References: <38E796BC.23191B2@regnoc.com> <00040214141502.04535@quadra.teleo.net> <38E7D6DE.EA09C891@regnoc.com> Message-ID: <00040216504403.04535@quadra.teleo.net> [Jim Conger, on Sun, 02 Apr 2000] :: :: Yeeks. You forgot to turn off HTML formatting for your message. :: I'm not even to the point of using Apache yet - I'm just to launch the :: script locally from within the browser by having the form element point :: to a script on disk.  In other words, this is just a development environment :: using only local files. ::

Any other clues? My original advice still holds, but now I'll add that you probably need to do some additional study on client/server computing. IOW, your browser is the client. Where's the server? From vetler at ifi.uio.no Thu Apr 13 06:27:38 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 13 Apr 2000 12:27:38 +0200 Subject: Python and VTK and TK References: <38F51AB1.29FB4C1D@earthlink.net> Message-ID: * Scott Harris > Has anyone gotten VTK to work with the TkRenderWidget? > I've got a simple code that draws two buttons and a vtkTkRenderWidget in > a frame. > It works under win98, but crashes my XServer on Linux. > > I'm using RH6.1 with XFree864.0 and a Voodoo3 card (so I have > accelerated GL rendering) > I've got VTK 3.1 Yes, I've gotten VTK to work with vtkTkRenderWidget without any problems. Do other OpenGL applications work properly? -- Vetle Roeim Graduate Student Departement of Informatics, University of Oslo, Norway From garabik at center.fmph.uniba.spam.sk Tue Apr 25 12:06:02 2000 From: garabik at center.fmph.uniba.spam.sk (Radovan Garabik) Date: 25 Apr 2000 16:06:02 GMT Subject: invisible cursor in ncurses5 References: <87wvlnjlxd.fsf@lemon.tky.hut.fi> Message-ID: <956678736.128659@cdwork.cvt.stuba.sk> Ulf Betlehem wrote: > Using curses modules included with most python distributions, > there seems to be no way to turn off the cursor if the module > is linked against ncurses5. (earlier versions are ok) try http://pyncurses.sourceforge.net/ it is a (written from scratch) curses binding for python, and leaveok() and curs_set() work as expected. -- ---------------------------------------------------------- | Radovan Garabik http://www.fmph.uniba.sk/~garabik/ | | __..--^^^--..__ garabik @ center.fmph.uniba.sk | ---------------------------------------------------------- From d98aron at dtek.chalmers.se Wed Apr 12 14:17:32 2000 From: d98aron at dtek.chalmers.se (Fredrik Aronsson) Date: 12 Apr 2000 18:17:32 GMT Subject: Python paradigms References: <000401bfa1dd$930fe500$172d153f@tim> Message-ID: <8d2ejs$jfr$1@nyheter.chalmers.se> In article <000401bfa1dd$930fe500$172d153f at tim>, "Tim Peters" writes: > (a() and [b()] or [c()])[0] > Just a litte thougth, can't I just use (a() and b()) or c() ? /Fredrik From mhammond at skippinet.com.au Tue Apr 4 20:04:27 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 05 Apr 2000 00:04:27 GMT Subject: win32all-130 for Python 1.6 available References: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au> Message-ID: "Wolfgang Strobl" wrote in message news:d5rjeskov6c6drsok4n7vvcvvi74155lna at 4ax.com... > "Mark Hammond" wrote: > > While using the debugger, I've managed to move the floating breakpoint > list window to a position where the title bar is outside (above) the > desktop. Now these detachable windows can be moved by dragging them by OK - I will fix this (by ensuring that when a toolbar is re-displayed, it is completely on screen. > their title bar, only, so I'm stuck. I've found the registry entry in > question (or so I thougth), and fiddled with Software\Python 1.6\Python > for Win32\ToolbarDebugging-Bar7, but in vain. Delete _all_ "Toolbar*" subkeys - probably 20 or so in total! Mark. From akuchlin at mems-exchange.org Tue Apr 11 11:05:45 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 11 Apr 2000 11:05:45 -0400 Subject: The gzip module... neverending story References: <8cr7os$du3$1@lacerta.tiscalinet.it> Message-ID: <3daej0he46.fsf@amarok.cnri.reston.va.us> "FrancescO" writes: > I have, another questions!! > How can I zip i list of files? (i have done it, but... the files can't be > readed from winzip and gunzip...) First, if you're trying to generate PKZIP-style .zip archives, the gzip module is the wrong one. Jim Ahlstrom's zipfile.py, which someone else posted a pointer to, is the right module to use in that case. Since you mention gunzip, I assume that you really do want gzip-style files. > Wich is the correct usage of the fileobj (4th parameters in the > gzip.GzipFile.. explain..: > GzipFile ([filename[, mode[, compresslevel[, fileobj]]]]) )? Did you look at the documentation for the module, at http://www.python.org/doc/lib/module-gzip.html ? It explains: The new class instance is based on fileobj, which can be a regular file, a StringIO object, or any other object which simulates a file. It defaults to None, in which case filename is opened to provide a file object. It's not clear what you're trying to do: compress a list of files into individual compressed files, or compress a bunch of files into one big huge file. To do the former, the code would be something like (untested): import gzip filenames = ['a.txt', 'b.txt', 'c.exe'] for f in filenames: input = open(f, 'rb') output = gzip.open(f + '.gz', 'wb') # Copy the contents of the input file while 1: chunk = input.read(1024) if chunk == "": break output.write( chunk ) input.close() ; output.close() gzip doesn't support storing multiple files, though you can concatenate several gzipped files; the decompressed data would then be the contents of the original files in one big file. -- A.M. Kuchling http://starship.python.net/crew/amk/ Desire was right. Also untrustworthy, acerbic, dangerous, and cruel. But right. You would have been better off leaving well enough alone. -- Destruction, in SANDMAN #48: "Brief Lives:8" From moshez at math.huji.ac.il Fri Apr 21 23:32:22 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 22 Apr 2000 06:32:22 +0300 (IDT) Subject: finding real $0 In-Reply-To: Message-ID: On Fri, 21 Apr 2000, Robin Becker wrote: > Is there any pythonic way to locate the original argument zero of the > process? I mean the location of python itself not the script. This would > allow me to launch subscripts without having to rely on the path being > set up correctly. No. I could give you a dozen algorithms that half work, but that'd be wasting your time and mine. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From jp at NOSPAMdemonseed.net Thu Apr 27 18:28:24 2000 From: jp at NOSPAMdemonseed.net (Jason Petrone) Date: Thu, 27 Apr 2000 17:28:24 -0500 Subject: PyOpenGL References: <8e9fed$lm4$1@news.rz.uni-karlsruhe.de> Message-ID: <8ueae8.0vj.ln@demonseed.net> Bjoern Giesler wrote: > Hi, > is there an archive that carries a newer version of PyOpenGL? The newest I > have is from the contrib-09-Dec-99 directory on ftp.python.org, and that > seems to require tcl7.6, which I don't want to use anymore. http://starship.python.net/crew/da/pythondists/ or cvs http://www.google.com/search?q=cache:starship.python.net:9673/crew/da/Code /PyOpenGL/cvs.html (sorry, the ugly url is because that page no longer exists on starship) -jlp From echuck at mindspring.com Thu Apr 20 22:50:55 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Thu, 20 Apr 2000 22:50:55 -0400 Subject: [ANNOUNCE] Webware for Python 0.1 References: <5650A1190E4FD111BC7E0000F8034D26A0F40D@huina.oceanic.com> <38FEF62B.2A4402CD@mindspring.com> <2cd13488.77055138@usw-ex0108-063.remarq.com> Message-ID: <38FFC20F.A372174F@mindspring.com> Don, I sent you an e-mail today with the same solution. Was wondering if you got it? -Chuck Don Tuttle wrote: > > Thanks Hamish! You were righton the money. (and the code ain't bad either > ;-) > > Don > > > The file is actually a gzipped tar file, but your browser is > > probably curtailing the extension to .tar, thus miseading WinZip. > > You can get round this by manually giving the file a .tar.gz > > extension when you save it from your browser. The saved file > > should now open OK in WinZip. > > > > Alternatively you could do it The Python Way (TM) :-) > > > > >>> import urllib > > >>> urllib.urlretrieve( > > 'http://writewithme.com/Webware/download.cgi', 'webware.tar.gz') > > > > > > Hamish Lawson > > > > > > > > > > * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network > * > > The fastest and easiest way to search and participate in Usenet - Free! > > From ulf.engstrom at b2b-link.com Thu Apr 13 07:32:37 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F8m?=) Date: Thu, 13 Apr 2000 13:32:37 +0200 Subject: Authenticate with smtp Message-ID: <018701bfa53b$f831f3e0$858647c1@DEVELOPMENT> How can I log into an smtp server that requires authentication and send a mail with smtplib, or is there any other package that helps? (Yes, I'm authorized) Regards Ulf -------------- next part -------------- A non-text attachment was scrubbed... Name: Ulf Engstr?m.vcf Type: text/x-vcard Size: 831 bytes Desc: not available URL: From darcy at vex.net Fri Apr 21 06:44:36 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 21 Apr 2000 10:44:36 GMT Subject: Using python on the web References: <8dopfu$nrl$1@news1.xs4all.nl> Message-ID: <8dpbek$nc3$1@news.tht.net> Boudewijn Rempt wrote: > Brent Fulgham wrote: >> Of course, the Postgres Python bindings may be just as bad from your >> perspective. :-) > Well, the Postgres Python bindings don't even conform to the > DB-API II specs - that kind of rules them out for a lot of The next release will have DB-API support. I (the PyGreSQL maintainer) don't know much about the spec so I invite any and all criticism as long as it comes with code patches on our mailing list so that others on the team can review them before they become part of the package. I expected to have a release by this weekend but there appears to be a few small problems to clear up yet. > work. I myself am quite satisfied with the MySQL bindings, but > like the original poster, I had to write my own object layer > around the primitive functions. Maybe it would be a good idea > to have another standard layer on top of DB-API II, for those > who want a more sophisticated interface? Actually, I kind of like the original PyGreSQL interface, especially with the dictresult() method. I am thinking of adding a few more convenience methods like that. For example, a method that takes a select and returns a dictionary of dictionaries rather than a list of dictionaries. http://www.druid.net/pygresql/ for details. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.vex.net/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. From R.Brodie at rl.ac.uk Fri Apr 14 10:43:28 2000 From: R.Brodie at rl.ac.uk (Richard Brodie) Date: Fri, 14 Apr 2000 15:43:28 +0100 Subject: Future compatibility of the Python C API References: <8d76t2$pig@newton.cc.rl.ac.uk> Message-ID: <8d7aqh$19qo@newton.cc.rl.ac.uk> "Remco Gerlich" wrote in message news:slrn8fed2o.4fe.scarblac-spamtrap at flits104-37.flits.rug.nl... > > I suppose that someone out there is working on persuading SWIG to > > generate suitable wrapper code? > > Since noone knows what Python 3000 is going to look like yet, that would be > very hard, wouldn't it? :) Well possibly. However, I assumed that someone has an idea how it should look. I presumed that one would not start by assuming that there wouldn't be backwards compatibility, until far enough down the design to see that it wouldn't be practical. Unless you work for MS, lack of compatibility isn't usually a design goal. From mwh21 at cam.ac.uk Sun Apr 16 18:24:42 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 16 Apr 2000 23:24:42 +0100 Subject: trapping dict alterations in a class References: <8ddbpp$7dp$0@216.39.162.232> Message-ID: Michael Esveldt writes: > I want to be able to do for a dictionary in a given class what > __setattr__ does for variable binding. > > class foo: > def __setattr__(self, name, value): > print name, value > self.__dict__[name] = value > bar = foo() > bar.quux = 1 > bar.baz = {"key":"value"} > > The above obviously prints "quux 1" and then "baz {'key':'value'}". But > what if I want to trap further alterations to the foo.baz dictionary? Is > this possible? Well, you could implement __getattr__ and then when asked for "baz" return a wrapper to the dictionary. Eg: import UserDict class Wrapper(UserDict.UserDict): def __setitem__(self,item,value): print item, value UserDict.UserDict.__setitem__(self,item,value) class Foo: def __init__(self): self.__dict__['magic'] = {} def __setattr__(self,attr,value): print attr, value self.magic[attr] = value def __getattr__(self,attr): return Wrapper(self.magic[attr]) This is far from being complete (writing __{get,set}attr__ methods is a tricky and subtle business), but it's a start. Watch out for cycles, too. HTH, Michael -- 81. In computing, turning the obvious into the useful is a living definition of the word "frustration". -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From mwh21 at cam.ac.uk Fri Apr 28 18:33:27 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Apr 2000 23:33:27 +0100 Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8ecsgj$6lp$1@slb0.atl.mindspring.net> Message-ID: dkuhlman at netcom.com (G. David Kuhlman) writes: > > No. However, this seems to make code *more* readable. In fact, many C++ > > programmers use 'this.x' for all their instance variables, to be able to > > see at a glance which are just local variables of the function and which > > are instance variables. It's just more work to write, but that doesn't > > matter much. > > Thinking about readability, I wrote the C++ coding standard here > where I work. When we programmers reviewed it, a co-worker > insisted that part of our standard be to prefix the names of all > member variables in any class with "m_" so that we could > distinguish them from other variables. I believe that "m_" is a > Microsoft-ism and in my humble opinion is just another way to spell > "self.". I think this shows that even C++ programmers are capable > of seeing the wisdom of the Pythonic way. I have unpleasant memories of trying to understand C++ code that named a *local* variable m_something. Bleargh. Unambiguous is good. Cheers, M. -- 81. In computing, turning the obvious into the useful is a living definition of the word "frustration". -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From wicarrol at unity.ncsu.edu Wed Apr 12 11:46:48 2000 From: wicarrol at unity.ncsu.edu (William Isaac Carroll) Date: 12 Apr 2000 15:46:48 GMT Subject: Python and Curses under MS Windows Message-ID: <8d25p8$7u9$1@uni00nw.unity.ncsu.edu> I'm interested in finding a curses package that works under Windows. I've searched the FAQ and archives with no results. Does such a thing exist? And does it come in a pre-compiled form? (I have no decent Windows compiler available.) Thank you. -- W Isaac Carroll (icarroll at pobox.com) "People do not eat at once for all time, even when they eat a good deal." -- Planchet From JGRAVES3 at austin.rr.com Fri Apr 7 08:30:35 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Fri, 07 Apr 2000 12:30:35 GMT Subject: Any news of ActiveState's Python developments? References: <13caa058.14a1c69c@usw-ex0108-063.remarq.com> Message-ID: Hamish Lawson wrote in message <13caa058.14a1c69c at usw-ex0108-063.remarq.com>... >Is there any news of Python developments at ActiveState since >they adopted the language? The only thing I've seen is their >announcement of plans to port Python (and Perl) to the Intel >Itanium. I traded some email with David Ascher about this a couple of weeks ago. He indicated that the will be announcing some stuff in the 1.6 timeline. This was _before_ the 1.6 beta test started, so I don't know if they knew it was coming up so quickly. The only really concrete thing that he said was that ActiveState's Python offering will be less Windows-centric than their Perl offerings. HTH Jay Graves From marc at oscar.noc.cv.net Tue Apr 25 10:32:02 2000 From: marc at oscar.noc.cv.net (Marc Spitzer) Date: Tue, 25 Apr 2000 14:32:02 GMT Subject: The Simple Economics of Open Source References: Message-ID: In article , Justin Sheehy wrote: >Raffael Cavallaro writes: > >> Fact is, only commodity items, that are known to many programmers, are >> open sourced. If there were sufficient demand to support a closed source >> business, then it would have happened that way. The proof of this is the >> BSDs, which would allow a closed source, proprietary fork at any time. >> Hasn't happened 'cause there's no demand for such a product. > >You mean like BSD/OS, from BSDI? > >It happened 9 years ago, and they've been selling it ever since. > >Interesting "proof" you have there. > >-Justin > this sounds like a religious argument, be carful when you show evadence that contradicts the 1 true faith. marc > > From moshez at math.huji.ac.il Sun Apr 23 01:09:17 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 23 Apr 2000 08:09:17 +0300 (IDT) Subject: Python for drivers? In-Reply-To: Message-ID: On Sun, 23 Apr 2000, jepler epler wrote: > If you can use a tool like SWIG (or a hand written C module) to provide > access to the necessary low-level features, you may be able to do this. > > For instance, if the card needs the idea of 'store {8,16,32}-bit integer X at > index L of the video card's address space' and 'read {8,16,32}-bit > integer at index L of the video card's address space', then you'd just > need to write those following functions in a C module for Python to call. Um...unless you're talking about something like Hurd-like userspace drivers, it'd still be pretty close to impossible. In general, you avoid memory allocation and deallocation inside the kernel like the flu, especially few-bytes allocation. On the other hand, the Python interpreter usually allocates and dellocates like crazy. This would probably kill a Linux kernel. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From teemu.keskinarkaus at ramk.fi Sun Apr 30 07:36:25 2000 From: teemu.keskinarkaus at ramk.fi (Teemu Keskinarkaus) Date: Sun, 30 Apr 2000 11:36:25 GMT Subject: Reading user input References: <39096d88.3112113532@news.ramk.fi> <01d101bfb108$88862290$858647c1@DEVELOPMENT> Message-ID: <390c1a3e.3287338993@news.ramk.fi> On Fri, 28 Apr 2000 13:54:39 +0200, =?iso-8859-1?Q?Ulf_Engstr=F8m?= wrote: >I guess what you're looking for is raw_input(). Works like this: >>>> text = raw_input('Enter text here->') >Enter text here->Anything I want >>>> text >'Anything I want' >Hope it helps :) That's it! That I was looking for. I've coded with C so many years that I didn't noticed that. I was looking for getch or readline (or something like that) function. :) Thanks for answers. TK From mwh21 at cam.ac.uk Wed Apr 12 14:54:00 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 12 Apr 2000 19:54:00 +0100 Subject: Off-topic References: <38F4BE12.A0C73D1D@callware.com> <38F4C52C.450F611F@callware.com> Message-ID: Ivan Van Laningham writes: > Hi All-- > > Michael Hudson wrote: [schnipp] > > Someone's taken /usr/bin/python away? Tried strace-ing it? > > > > Perl and Python both work if I do 'perl h2n' or 'python hello.py'. > Interactive mode works fine. But are python & perl in /usr/bin? `which python`? > Sh scripts do work, as long as I remember to do ./script ;-). I'm > running as root (but the same thing happens when I run as myself, too). > However, this could be explained by the default behavour of exec(), > which states that if the kernel can't run a program, it execs sh and > hands it the program name in argv. Really? Here (rh 6.1) "man execve" says: execve() executes the program pointed to by filename. filename must be either a binary executable, or a script starting with a line of the form "#! interpreter [arg]". In the latter case, the interpreter must be a valid path? name for an executable which is not itself a script, which will be invoked as interpreter [arg] filename. gotta-love-computers-ly y'rs M. -- languages shape the way we think, or don't. -- Erik Naggum, comp.lang.lisp From tim_one at email.msn.com Sat Apr 1 22:48:25 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 1 Apr 2000 22:48:25 -0500 Subject: New Features in Python 1.6 In-Reply-To: Message-ID: <000501bf9c56$4ce41600$752d153f@tim> [mailed, not posted] > now posting from Belgium, Tim Peters wrote: >> What we've seen here is simply Guido *finally* embracing a >> policy of giving people exactly what they ask for. [Fredrik Lundh] > I think things are worse than this -- someone just sent me > something that looks like a draft press release, announcing > that O'Reilly had taken over Python development, with Jon > Orwant as CTO, and Larry Wall as the Python 1.6 release > manager. > > (it wasn't clear if it was intended for public consumption > at this time, so please don't spread the word around just > yet. if I get permission, I'll post more info to the list). And so on. You're *almost* right, but I couldn't say so on the list. Guido and I have been fighting this behind the scenes for two solid weeks, which is why we've both been nearly invisible on c.l.py for the duration. But, like they say, the show ain't over 'til the python swallows the rat -- can't say more than that now, but watch c.l.py for Really Big News from Guido Himself over the next couple of weeks. Even you'll be surprised . worst-part-of-moving-to-belgium-is-learning-to-belch-ly y'rs - tim From moshez at math.huji.ac.il Thu Apr 27 02:01:42 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 27 Apr 2000 09:01:42 +0300 (IDT) Subject: condense whitespace to single space? In-Reply-To: <36NN4.31937$Xk2.119087@tor-nn1.netcom.ca> Message-ID: On Wed, 26 Apr 2000, k wrote: > How do I condense the sections of spaces in this string: > > "abc def ghi" > > into single spaces? > string.join(string.split(s), ' ') -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From tseaver at starbase.neosoft.com Tue Apr 4 09:08:12 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 4 Apr 2000 08:08:12 -0500 Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <8cca93$9oh$1@nnrp1.deja.com> Message-ID: In article <8cca93$9oh$1 at nnrp1.deja.com>, wrote: >Tres Seaver wrote: >> > it *breaks existing applications coded to the published interface*, > >not true. the documented interface explicitly says that >there is one single argument. it does not mention optional >arguments. Your insistence that the "documented interface" consists only of the description in the module reference, and not of the example on the next page or of the way the API is actually used in the standard libraries baffles me. > >(the example was broken, but so were other examples in earlier >releases of the documentation. see other messages in this >thread for details) > >> Consider that *every one* of the protocol modules which offers >> a connect() method uses a two-argument signature for it: ftplib, >> gopherlib, httplib, imaplib, nntplib, poplib, smtplib, telnetlib, >> urllib. And they all *use* the two-argument connect when invoking >> their underlying socket! > >not true. look again (doesn't matter if you look in the 1.5.2 >library or the 1.6 library -- what you just said is not correct >in either case). I just did, see below. The only error I can see is that I falsely lumped imaplib with the others as *exposing* a two-argument connect(), when in fact it merely *uses* two-argument connect(). > >> No Python module in the standard library uses the single-argument >> connect, period. > >*all* python modules in the 1.6 standard library use >single-argument socket connect. Invalid argument -- nobody depends on the 1.6 library yet. Here is a check from my (unfiddled) Python distro -- its the same on Windows, too: [/home/tres] $ python Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66 19990314/Linux (egcs - on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> ^D [/home/tres] $ cd /usr/lib/python1.5 [/usr/lib/python1.5] $ grep "connect(" *.py asyncore.py: self.handle_connect() asyncore.py: self.handle_connect() asyncore.py: self.handle_connect() ftplib.py: Then use self.connect() with optional host and port argument. ftplib.py: # Optional arguments are host (for connect()), ftplib.py: resp = self.connect(host) ftplib.py: def connect(self, host = '', port = 0): ftplib.py: self.sock.connect(self.host, self.port) ftplib.py: (this is read and squirreled away by connect())''' ftplib.py: conn.connect(host, port) gopherlib.py: s.connect(host, port) httplib.py: if host: self.connect(host, port) httplib.py: def connect(self, host, port = 0): httplib.py: self.sock.connect(host, port) httplib.py: h.connect(host) imaplib.py: self.sock.connect(self.host, self.port) nntplib.py: self.sock.connect(self.host, self.port) poplib.py: self.sock.connect(self.host, self.port) smtplib.py: (code, msg) = self.connect(host, port) smtplib.py: def connect(self, host='localhost', port = 0): smtplib.py: self.sock.connect(host, port) smtplib.py: raise SMTPServerDisconnected('please run connect() first' ) telnetlib.py: self.sock.connect((self.host, self.port)) urllib.py: self.ftp.connect(self.host, self.port) The CVS log comment for the checkin you just made *six days ago* to smtplib says: This fixes a bunch of socket.connect(host, post) calls. Note that I haven't tested all modules -- I don't have enough servers here... So don't tell me that the 1.5.2 library used one-argument connect(). > >> This is *not* the same case as the list.append() one, where the >> published interface was itself consistent. > >why not? after all, there were many more uses of multi-argument >append in the 1.5.2 standard library than uses of multi-argument >socket calls. > >see my other post in this thread for the list of questions >I ask myself for each change in Python. if you use other >criteria, which make it obvious to you that "append" is a >good change, and "connect" is a bad one, please tell me what >they are. > >(bogus facts or double standards doesn't count). > >after all, with tons of code all over the Python universe, >I'm affected by *all* backwards incompatible changes in >Python 1.6. but for some reason, the "append" change is >the only one that makes me worried. what am I missing? The append() change is hard to find, but fixes something that shouldn't work. The connect() change could be equally hard to find (although I grant that the call-through-a-differently-named-bound-pointer bit is much less likely) but fixes something which *isn't* broken, *for no reason*. In fact, I think one could make a reasonable case that the real bug here is in the API doc: single-argument connect() is unintuitive for AF_INET sockets, and exists primarily to shoehorn orthagonality with AF_UNIX ones (where a default port argument would do just as well.) Still-haven't-seen-a-reasonable-defense-of-one-argument-connect()'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at digicool.com http://www.zope.org Digital Creations From shecter at darmstadt.gmd.de Tue Apr 25 15:40:16 2000 From: shecter at darmstadt.gmd.de (Robb Shecter) Date: Tue, 25 Apr 2000 21:40:16 +0200 Subject: Metaclasses? Message-ID: <3905F4A0.2B39C705@darmstadt.gmd.de> Hi, I read an old post about metaclasses (included on the cd-rom with the book "Mit Python programmieren"), and got very interested, because I imagine that by making a new metaclass, I could maybe fix the one thing about Python that annoys me: the obligatory use of "self" in method declarations and variable access. (Python's syntax is so clean and neat in all other areas, I feel like it's a shame that there's excess verbosity in this one place.) So - are metaclasses just a random idea, or is there something in the works? Thanks, Robb From amitp at Xenon.Stanford.EDU Sat Apr 8 20:37:26 2000 From: amitp at Xenon.Stanford.EDU (Amit Patel) Date: 9 Apr 2000 00:37:26 GMT Subject: Problem with gzip module References: <8cdojr$69n$1@lacerta.tiscalinet.it> Message-ID: <8cojc6$li9$1@nntp.Stanford.EDU> FrancescO wrote: | Hi! | I can't understand how is the right way to use the gzip mudule to perform a | compression of a list of files, that i must read with gunzip or winzip | ecc... | | I have read some examples from starship.python.com but... | | I must write a cron script to zip log files from a directory, now i used the | zlib module, but for decompress I must use the uncompress method of the | zlib... the program do it very well, but the compressed files must be readed | from winzip from a Winnt on the net... | does anyone explain me, maybe with an example? | I believe the "gzip" format is used for a single file, unlike the "pkzip" (winzip) format, which is used for multiple files. In Unix, the "tar" program is used to turn multiple files into one, and the resulting "tarball" is compressed using gzip. Winzip can read gzipped tar files. If you need to compress more than one file, you need to somehow tar them into one. (Sorry, I don't know the tar format.) - Amit From sverker.is at home.se Sun Apr 2 18:50:13 2000 From: sverker.is at home.se (Sverker Nilsson) Date: Mon, 03 Apr 2000 00:50:13 +0200 Subject: popen2 made >7 times faster! Message-ID: <38E7CEA5.4CECEE0D@home.se> Hi, I was using the popen2 module to call out to a program. I found it suspiciously slow to run a small quick program so I began to look for the reason. Turned out that there was a loop in __init__ in the Popen3 class that closes files numbered 3 to 255 before it exec's the new program. This took a very long time compared to the other code and also compared to the time for the OS's fork and exec functions. When I rewrote this loop in C it became much faster: The time to call out 100 times to a hello world program dropped from 15 seconds to 2 seconds (*). The time for 100 calls to the actual program I wanted to run (PGP) dropped from 18 seconds to 6 seconds. I guess there are a number of ways to fix this, I made just a quick hack to close the files 3 to 255 from C. Should be better to keep track of the files that are actually open to avoid the system calls altogether - probably not too significant if there could only be 256 files open but would become a problem if the OS allows more files. Also, popen2 has an hard-coded assumption that there can only be 256 files open, regardless of what the OS actually allows. Anyway, maybe somebody is working on this already...? 'yours Sverker Nilsson (*) Pentium 90 Linux 2.0 From mikael at isy.liu.se Tue Apr 25 05:21:29 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 25 Apr 2000 11:21:29 +0200 (MET DST) Subject: Strange translation in GET Message-ID: Hi! This question is certainly not related to python, but I haven't the slightest idea where else to post it. Since I have great confidence in the participants of this group, I dare to post it here. Here goes: I have a python script that is called as http://wherever/whatever?a=A&b=B The argument ends up as 'a=A&b=B' which is perfectly OK. When I call this script in a link on a web page using the HTML code spam it usually works OK. Now to the problem: According to my logs, this link was recently clicked by someone in Japan, and my script failed because the argument had somehow been translated to a+AD0-A+ACY-b+AD0-B That is, each '=' was translated to '+AD0-', and each '&' was translated to '+ACY-'. This probably has to do with the character set used by the caller. My questions are: Does anyone know what might have happened here? Shall I suspect this to happen again? Should I consider it worth while fixing this? I guess this all boils down to: Is this _the_ Japanese standard, or only _a_ Japanese standard? Fixing this particular peculiarity is easy, but if I can expect several different variations on this theme, it seems uninterresting unless there is a way to cover all these variations easily. I wrote the script early, when I had little experience in Python, so I did not use any cgi-whatever module. So I should perhaps also ask: Is this (and other) translation(s) covered by some snazzy module? someone-will-probably-tell-me-to-read-some-friendly-manual-ly y'rs /Mikael ----------------------------------------------------------------------- E-Mail: Mikael Olofsson WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael Phone: +46 - (0)13 - 28 1343 Telefax: +46 - (0)13 - 28 1339 Date: 25-Apr-00 Time: 11:12:26 This message was sent by XF-Mail. ----------------------------------------------------------------------- From effbot at telia.com Thu Apr 20 04:40:59 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 20 Apr 2000 08:40:59 GMT Subject: Testing a module's return References: <38FE95E3.1A10D5B0@kraken.itc.gu.edu.au> Message-ID: Joal Heagney wrote: > I've found that I have to define several of my modules such that they > return a string if they fail, rather than 0. (Let's face it, there are a > lot more things that can go wrong than right). Now I originally wanted > to have these modules return the values I was after. eg. > > def function_name(arg1, arg2, arg3, .... argN): > do something with the args, return value > > But as a beginner, *grins* I've found returning error strings a little > more important > > def function_name(arg1, arg2, arg3, .... argN): > check for error condition 1: > return 'Whoops' > check for error condition 2: > return 'What are you doing, Dave?' > check for error condition 3: > return 'That ain't right, or humanly decent either' > do something with the args, return something. > > I can't sort out, should I return 0 for a success, and give the answer > as a set attribute (Eg. a class variable)? Or is there a much neater way > of doing things? There'd have to be. if you had read the tutorial, you'd seen the answer: exceptions! def function_name(arg1, arg2, arg3, .... argN): assert not error condition 1, "Whoops!" assert not error condition 2, 'What are you doing, Dave?' ... do something with the args return something for details, see chapter 8 in the tutorial: http://www.python.org/doc/current/tut/node10.html more info on the "assert" statement is found here: http://www.python.org/doc/current/ref/assert.html From karl at ulbrich.org Wed Apr 26 18:22:00 2000 From: karl at ulbrich.org (Karl G. Ulbrich) Date: Wed, 26 Apr 2000 18:22:00 -0400 Subject: PIL compile/make bombs out at step #7 -- help? In-Reply-To: ; from effbot@telia.com on Wed, Apr 26, 2000 at 08:37:26PM +0000 References: <20000426135724.A26663@exeter.exeter.org> Message-ID: <20000426182200.B27107@exeter.exeter.org> Quoting Fredrik Lundh (effbot at telia.com): [...] > from the look of it, you either have a broken /bin/sh, > or you messed something up when editing the Setup > file... /bin/sh might really be /bin/bash under the hood, as Linux seems most-fond of bash, but no other shellscripts I've seen die on it. > can you perhaps post the Setup file ? Here's my setup file -- I disabled the TK part as I neglected to install that package with Linux, but I have the python .h files, jpeg and libz stuff. # Setup file for the Imaging module # ================================= # # INSTRUCTIONS: # # 1) Edit the configuration settings as described below. # # 2) Go to the libImaging directory and build the support library. # # 3) Run "make -f Makefile.pre.in boot" # # 4) Run "make" # # This file has the same format as /Modules/Setup.in. # # -------------------------------------------------------------------- # Remove (or comment) the following line if you wish to build a # statically linked python interpreter. *shared* # -------------------------------------------------------------------- # Edit or remove the library specifications to match your configura- # tion. As they stand, they assume that you have the IJG JPEG library # 6.0a and zlib 1.0.4 (or newer versions of these libraries) in a # standard location. You can comment out the Tcl/Tk stuff if you # don't need ImageTk, or if you're using a custom _tkinter instead # (like in earlier versions of PIL). _imaging _imaging.c decode.c encode.c map.c display.c outline.c path.c \ -IlibImaging libImaging/libImaging.a \ # # *** IJG JPEG library (libjpeg) location # -I/usr/local/include -L/usr/local/lib -ljpeg \ -I/usr/include -L/usr/lib -ljpeg \ # # *** ZLIB (libz) location # -I/usr/local/include -L/usr/local/lib -lz \ -I/usr/include -L/usr/lib -lz \ # # *** Tcl/Tk support and library location # Tk/tkImaging.c -DWITH_TKINTER -I/usr/local/include -L/usr/local/lib -ltcl8.0 -ltk8.0 # -------------------------------------------------------------------- # uncomment to enable the SANE driver (see Sane/README for more info) # _sane Sane/_sanemodule.c -IlibImaging -L/usr/local/lib/sane/ -lsane-dll From sabren at manifestation.com Thu Apr 13 21:49:41 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 13 Apr 2000 21:49:41 -0400 (EDT) Subject: how do I know to what module an object belongs? In-Reply-To: Message-ID: On Thu, 13 Apr 2000, Michal Wallace (sabren) wrote: > I know I can just as easily have them pass a reference to the > module along with it, but I'd be happier if I could just look at the > connection object and know which module it came from. Can I do this? Um.. Okay.... for just about every module I've tried, I can do: module = eval(dbc.__class__.__module__) ... EXCEPT for ODBC.Windows.. >>> dbc >>> dbc.__class__ Traceback (innermost last): File "", line 1, in ? AttributeError: __class__ >>> what gives? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From KingArthur at roundtable.dyndns.org Thu Apr 20 19:37:53 2000 From: KingArthur at roundtable.dyndns.org (news-server) Date: Thu, 20 Apr 2000 23:37:53 GMT Subject: Medusa and POSTing... Message-ID: I'm writing an MP3 Server/Player in Python using the Medusa HTTP server and my own handlers written in Python... Alls well & good until I try to read POSTed data from the client. I came up with a sure-fire way to test it (an HTML form with a query button and hidden entry fields that submits its data via posting). Does anyone know how to get the form data? I've tried reading stdin and the CGI module. I've also tried browsing through the medusa code to find something but haven't had much success. I appreciate the help, John Brainard KingArthur at roundtable.dyndns.org_remove_me From spamfranke at bigfoot.de Thu Apr 13 18:54:17 2000 From: spamfranke at bigfoot.de (Stefan Franke) Date: Thu, 13 Apr 2000 22:54:17 GMT Subject: DCOM configuration tool for Win98/2 Message-ID: <38f64ecb.1417276@news.btx.dtag.de> This may be of interest for anyone who tries to follow the DCOM examples in chapter 12 of "Python Programming in Win32": Obviously Microsoft forgot to include the configuration tool (dcomcnfg.exe) on the Windows 98 2nd Edition CD. The article http://support.microsoft.com/support/kb/articles/Q253/3/11.ASP contains a link to the download site. Stefan From darrell at dorb.com Sun Apr 9 01:16:13 2000 From: darrell at dorb.com (Darrell) Date: Sun, 09 Apr 2000 05:16:13 GMT Subject: Algorithm: combinations of (k) taken from (n) values References: <38ED5285.719F26D7@udel.edu> Message-ID: Pasted the Charles algorithm into a class using a coroutine to provide iterators. The idea being to make the algorithm lazy. Is it possible to figure out a combination at some huge offset without figuring out all previous combinations? Seems like it might be, in which case the isn't much use. import coroutine class Choices: def __init__(self,n,k=None) : """ Prepares to return elements from a list consisting of all k-element (ordered) subsets of {0 ... n-1}. """ self._combinations=[] self._skip=1 def combs(n=n,k=k, self=self): """returns sorted list of k items taken from n.""" l=self._combinations if k==None: k=n for c in range(n): l.append([c]) for i in range(k-1): li = [] for c in l: for j in range(c[-1]+1,n): li.append(c+[j]) // Bet Christian can show me a better way to do this. if self._skip==0: self._combinations=li coroutine.resume_caller (li[-1]) self._skip=self._skip-1 l = li return l self._coroutine=coroutine.coroutine(combs) def next(self): self._skip=1 return self._coroutine.resume() def __getitem__(self, i): if i < len(self._combinations): return self._combinations[i] cnt=i-len(self._combinations)+1 self._skip=cnt self._coroutine.resume() return self._combinations[i] def __getslice__(self, i, j): self[j] return self._combinations[i:j] choices=Choices(30,2) for x in range(3): print choices.next() print 'getitem:',choices[7] print 'getslice:', choices[40:50] From bingdo19 at earthlink.net Thu Apr 20 10:41:57 2000 From: bingdo19 at earthlink.net (Bob Langdon) Date: Thu, 20 Apr 2000 14:41:57 GMT Subject: Test_time Fails? / Installing on Virtual DOmain Message-ID: Hi, Upon installing Python in the home directory of a virtual domain (after making the necessary configure file changes; i.e.: replacing all instances of "/usr/" with: "/home/username/python/usr/") "make test" results in 1 error: >>1 test failed: test_time 19 tests skipped: test_al test_audioop test_bsddb test_cd test_cl test_crypt test_dbm test_dl test_gdbm test_gl test_gzip test_imageop test_imgfile test_nis test_rgbimg test_sunaudiodev test_thread test_timing test_zlib<< Running Lib/test/test_time.py results in: >>Lib/test/test_time.py: import: command not found Lib/test/test_time.py: time.altzone: command not found Lib/test/test_time.py: line 5: syntax error near unexpected token `t' Lib/test/test_time.py: line 5: `t = time.time()'<< Is this something I've failed to install, or something missing from the system? From claird at starbase.neosoft.com Tue Apr 4 13:42:01 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 4 Apr 2000 12:42:01 -0500 Subject: Why should I switch to Python? - Infinity of Primes References: <8ccoug$f4o$1@pegasus.csx.cam.ac.uk> Message-ID: <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> In article <8ccoug$f4o$1 at pegasus.csx.cam.ac.uk>, Nick Maclaren wrote: > >In article , "Dennis E. Hamilton" writes: >|> The standard approach is a proof by contradiction starting from the >|> assumption that there is a largest prime. > >There is also a constructive proof based on the Fundamental >Theorem of Arithmetic, that is little more complex. . . . To what extent are constructive proofs supplanting *... ad absurdum* as standards? At about the time I left academe I was working on my own arguments that our conventional view of the former as "more complex" is, as Brouwer et al. taught, essentially only convention. Tilting at construc- tivist windmills is one of the half-dozen careers I'm considering for my retirement; I recognize, though, that I've quite lost touch with current practice. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From nospam at nowhere.net Wed Apr 26 02:15:33 2000 From: nospam at nowhere.net (Ray&Maria) Date: Wed, 26 Apr 2000 00:15:33 -0600 Subject: Unsigned integer arithmetic References: Message-ID: > def printU32Hex(n): > if n > 0xffffffffL: > raise ValueError > print "0x%01x%07x" % (int(n >> 28), int(n & 0xfffffffL)) just in case someone send in int by mistake... def printULHex(n): if n > 0xffffffffL or n < 0: raise ValueError print "0x%01x%07x" % (int(n >> 28), int(n & 0xfffffffL)) From effbot at telia.com Sun Apr 2 05:16:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 02 Apr 2000 09:16:32 GMT Subject: Tkinter: "Get root for a widget" is private? References: <20000331112048.A1257432@vislab.epa.gov> Message-ID: Randall Hopper wrote: > I have a widget and want to retrieve the root. I see the _root() method, > but by Python convention, isn't this method private? > > Should users of Tkinter be calling this? as long as nobody calls the Tkinter police, you're safe. however, using the *toplevel* rather than the actual root object is usually sufficient: root = widget.winfo_toplevel() to get from the toplevel to the real root, just add: if root.master: root = root.master # real root From stevee at redac.co.uk Fri Apr 7 09:33:59 2000 From: stevee at redac.co.uk (stevee at redac.co.uk) Date: Fri, 07 Apr 2000 13:33:59 GMT Subject: Cascading menus Message-ID: <8cko46$j2i$1@nnrp1.deja.com> Hello, I am attempting to convert a program using an old in house GUI system to use Python and Tkinter. The in house system uses an interactive stack based language rather like Forth, called EPL. Our current interface is a horrible! It contains masses of cascaded menus. We wish to move a more modern style using with much fewer menus. However for the first phase we want to end up with the same menu set as we currently have but implemented in Python. We can then improve this using Python/Tkinter. I have produced a translator that converts one of our old style menu definitions into Python which works OK. However I have problems with cascading menus due to a major difference between the way Python and EPL do this. EPL behaves like this: A menu button with an associate sub menu knows that it is to display a right arrow to the right of the menu and that when selected the menu cascade has to remain on screen. It also has some EPL code associated with it that gets run whenever the menu button is selected. Somewhere inside that EPL code it will ask to display a sub menu. That sub menu will be posted in the correct location relative to the original menu. This mechanism allows a lot of flexibility in what happens before and after the sub menu is displayed. One thing that does happen is that a choice between several different sub menus can happen. In python of course sub menus are directly connected to their parent menu buttons using add_cascade() and python/Tkinter copes with displaying the sub menu immediately when the user selects the options. Now I have two possible solutions to this. I either: 1. translate EPL into a more Python style. This is my preferred option as it is a better step towards having a Python based GUI. or: 2. Produce a modified Python/Tkinter with a new form of add_cascade (with a different name, so we can still use add_cascade) that: a) Displays an arrow on the menu button. b) On selection it leaves the current menus displayed. c) It can have a Python command associated with that we can use to run some arbitrary EPL code. d) No sub menu is automatically displayed. Then add a version of the menu post command that displays the menu at the correct location relative to the currently displayed menu. The obvious down side of this approach is that we will have our own version of Python/Tkinter/Tk that will need to be re applied if we wish to move to newer versions of the software in future. (This of course assumes that our changes will not be considered sufficiently general to go into the real source code.) The plus point is that this solution should be much faster to implement and I am very short of time (as usual!). So my questions (finally) about the modified Python/Thinter approach are: 1. What do people think of it? 2. Is it feasible? 3. Are there any gotchas I haven't considered? Thanks for any help you may provide. Steve Sent via Deja.com http://www.deja.com/ Before you buy. From rgb122 at my-deja.com Tue Apr 4 11:00:17 2000 From: rgb122 at my-deja.com (rgb122 at my-deja.com) Date: Tue, 04 Apr 2000 15:00:17 GMT Subject: Loading image from URL with PIL References: <8cau6t$pph$1@nnrp1.deja.com> <8ccagj$a1m$1@nnrp1.deja.com> Message-ID: <8cd01o$13k$1@nnrp1.deja.com> > fp = urllib.urlopen(myurl) > im = Image.open(fp) That gives me an exception: Traceback (innermost last): File "", line 1, in ? File "D:\Program Files\Python\Lib\PIL\Image.py", line 878, in open fp.seek(0) AttributeError: seek -Rob Sent via Deja.com http://www.deja.com/ Before you buy. From bluearms at nownuri.net Thu Apr 20 16:37:33 2000 From: bluearms at nownuri.net (H.C. Jin) Date: Fri, 21 Apr 2000 05:37:33 +0900 Subject: can't find SWIG for Python References: <38FF5A56.F76794D8@sec.noaa.gov> Message-ID: <39004b90.0@news.nownuri.net> "j vickroy" wrote in message news:38FF5A56.F76794D8 at sec.noaa.gov... > Hello all, > > I have been unable to locate SWIG for Python. My references list > www.swig.org but the server can not be found. > > Could someone point me to the site or provide some other Win 32 options > for easing the process of extending Python to use existing C libraries. > > Thanks for your time. > I found SWIG at the sourceforge.net with sourceforge search engine. From jmassung at magpiesystems.com Mon Apr 24 11:31:31 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Mon, 24 Apr 2000 09:31:31 -0600 Subject: Simple list.append() question References: Message-ID: I'm just learning, but my guess is this: >>> l=[[]]*3 >>> l [[], [], []] >>> l[0].append(3) >>> l [[3], [3], [3]] >>> id(l[0]) 8539088 >>> id(l[1]) 8539088 >>> id(l[2]) 8539088 >>> The *3 just made three lists pointing to the same place. I don't know how to get what you want tho ;) someone else can enlighten me, too :). - Jeff Massung (jmassung at magpiesystems.com) - Lead software engineer for Magpie Systems (www.magpiesystems.com) - Bringing smart pigs and data analysis to the pipeline industry! From kistler at gmx.net Tue Apr 11 16:14:38 2000 From: kistler at gmx.net (Per Kistler) Date: Tue, 11 Apr 2000 22:14:38 +0200 Subject: How to know what re.sub took? Message-ID: <38F387AE.1010704@gmx.net> Hello How to know what has been substituted away, if one does something like: >>> import re >>> rex = re.compile(r"(hans|fred|simon)") >>> st = "max hans bill" >>> st2 = rex.sub("",st) >>> st2 'max? bill' It took "hans" away, but how can I learn this automatically? Thanks, Per. From johann at physics.berkeley.edu Tue Apr 25 12:09:09 2000 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 25 Apr 2000 09:09:09 -0700 Subject: Efficient coding advice? References: <8e2sjn$te4l$1@swen.emba.uvm.edu> Message-ID: Kelvin Chu writes: > data = fp.readframes(nframes) > left = Numeric.zeros(nframes) > right = Numeric.zeros(nframes) > for i in range(0,nframes): > left[i] = ord(data[i*2]) > right[i] = ord(data[i*2+1]) Try: ords = map(ord, data) # take the ord of all the chars ords.shape = (nframes/2, 2) # reshape the array in place left = ords[:,0] # pick out individual columns right = ords[:,1] That should be durn fast, as long as "readframes" isn't the bottleneck. -- Johann Hibschman johann at physics.berkeley.edu From bsb at winnegan.de Thu Apr 13 16:10:04 2000 From: bsb at winnegan.de (Siggy Brentrup) Date: 13 Apr 2000 22:10:04 +0200 Subject: threading question In-Reply-To: "Thomas Heller"'s message of "Thu, 13 Apr 2000 19:00:42 +0200" References: <018e01bfa569$cda0cd80$4500a8c0@thomasnotebook> Message-ID: <87r9c9kbj7.fsf@orge.winnegan.de> "Thomas Heller" writes: > I want a thread to run in parallel with the interactive > interpreter. > Simple: > > def do_work(): > import time > while 1: > time.sleep (1) > ... > > import threading change this > threading.Thread (target=do_work()).start() to worker = threading.Thread (target=do_work) worker.setDaemon(1) worker.start() > But when I hit EOF, python waits until this thread is finished. > How can I avoid this? I want python to terminate the thread > and exit in this case. The main thread is special in installing an exitfunc that waits for all non-daemonic threads to complete. Siggy From ivanlan at callware.com Wed Apr 12 13:35:36 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 12 Apr 2000 11:35:36 -0600 Subject: Why should I switch to Python? References: <8d2aa8$n58$1@newshost.accu.uu.nl> <8d2blf$b1n$1@pegasus.csx.cam.ac.uk> Message-ID: <38F4B3E8.637D6EB5@callware.com> Hi All-- Nick Maclaren wrote: > [snip] > According to something I read, incorrectly attributed! Apparently > Heinlein got it from something he read, and forgot the fact - it > was then pointed out to him and he said something equivalent to > "Oops". That doesn't stop the attribution to him circulating :-) > I've never heard this story before; I also never encountered the term before 1961. To the best of my knowledge, Heinlein is the source of the term "grok." Can you provide more information re the attribution story? -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From cjc26 at nospam.cornell.edu Mon Apr 3 12:06:02 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Mon, 03 Apr 2000 16:06:02 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> Message-ID: * Bob Alexander menulis: | This is not an [intentional] flame bait, nor an April Fool's message, but | think about it: We have. Search DejaNews. :) | Python has two "sequence" data types, lists and tuples, | which from the Python programmer's perspective are only slightly different. | How does having both types significantly improve life for Python | programmers? Mutable sequences aren't too usable as dictionary keys. -- cliff crawford -><- http://www.people.cornell.edu/pages/cjc26/ icq 68165166 "IS I yes wardrobe yield [the] evaluation." member of A.H.M.A.D. From tim_one at email.msn.com Thu Apr 20 03:41:54 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 20 Apr 2000 03:41:54 -0400 Subject: __del__ problem - would adopting Garbage Collection fix this? In-Reply-To: Message-ID: <000701bfaa9b$e729eac0$d62d153f@tim> [Neil Schemenauer] > With the default debugging options the collector prints a message to > sys.stderr when it finds uncollectable objects. Redesigning the > class structure should fix the problem. [Just van Rossum] > Maybe you're right, but to me it feels this is in the exact same category > as a __del__ exception, so ignoring & collecting seems more logical to me > as a default. Except this isn't Fortran <0.5 wink>: "in the face of ambiguity, refuse the temptation to guess" is the Python Way. That exceptions in __del__ are diseased is no excuse for designing illness into more areas. If you don't want the msg, don't write sick code! even-five-year-olds-understand-they're-supposed-to-clean-up-their- own-mess-ly y'rs - tim From g_will at cyberus.ca Mon Apr 10 12:46:10 2000 From: g_will at cyberus.ca (Gordon Williams) Date: Mon, 10 Apr 2000 16:46:10 GMT Subject: Installer Producing Page Fault Message-ID: <01bfa30b$e0707f60$2040c3d1@Cyberus> Hi All, I am using Gordon's installer program to make a standalone program that self installs. After running the install_BS_main.exe created, everything is put into the proper directory (I think). Then running BS_main.exe I immediately get a crash with the following: BS_MAIN caused an invalid page fault in module MULTIARRAY.PYD at 0137:01523569. Registers: EAX=00000000 CS=0137 EIP=01523569 EFLGS=00010202 EBX=1e123550 SS=013f ESP=0063ebbc EBP=78024838 ECX=18865dbb DS=013f ESI=009673e0 FS=4fff EDX=0000000b ES=013f EDI=00967990 GS=0000 Bytes at CS:EIP: 8b 08 51 68 74 5c 52 01 57 ff d3 8b 35 84 40 52 Stack dump: 0063f034 0063f180 78024838 780120cc 1e12e3f5 01520000 1e12e42d 00000003 00000000 1e170238 0063f180 00000000 00000000 0063ec45 bff713e2 00000137 My code is using the numerical package if that matters. (It appears to be causing the fault as multiarray is part of the package) Any ideas? thanks, Gordon Williams From moshez at math.huji.ac.il Thu Apr 20 15:40:12 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 20 Apr 2000 22:40:12 +0300 (IDT) Subject: docstrings In-Reply-To: <00bufsonasp7bgkf86lfb6sv5np5v8mqlj@4ax.com> Message-ID: On Thu, 20 Apr 2000, Ben Wolfson wrote: > is there a way to use %c and %s within a docstring, or to add strings > together in a docstring, so that if some strings are used in all > docstrings, but might be changed, I can simply change one or two > variables? Short answer: no Long answer: of course, but it'll take some doing. class a: __doc__ = 'hello '*3+'world' Works fine... -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From nick at spam_me_notvideosystem.co.uk Thu Apr 13 10:09:52 2000 From: nick at spam_me_notvideosystem.co.uk (Nick Trout) Date: Thu, 13 Apr 2000 15:09:52 +0100 Subject: List mapping? Message-ID: <38f5d68e@news.xtml.co.uk> Is there a nice way of pairing up the members to form tuple pairs in another list? ie. like you might to processing input args. ie. changing ['/a','1','/b','2','/c','3'] into [ ('/a','1'), ('/b','2'), ('/c','3') ] eg: args = '/a 1 /b 2 /c 3' listargs= string.split(args) tuplist = [] i=0 while i < len(listargs): tuplist.append( (listargs[i],listargs[i+1]) ) i = i+2 for i in tuplist: processargs(i) or: args = '/a 1 /b 2 /c 3' for i in string.split(args): i = argflag # i want next arg now as a parameter!!! Can I (you!) get rid of the long winded while loop cleverly?!! :-) Thanks in advance, Nick. From jstok at bluedog.apana.org.au Wed Apr 5 02:04:10 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Wed, 5 Apr 2000 16:04:10 +1000 Subject: complete novice question References: <38EA5995.F7B9815D@newbridge.com> Message-ID: Paul Madsen wrote in message <38EA5995.F7B9815D at newbridge.com>... >Downloaded Python-1.5.2. > >I've run 'configure' and it seems to have worked. Now, according to the >Python package's README, I should be able to type 'make' for the rest of >the install. If I don't have a 'make' file, did the configure portion >not work? Look for Makefile or makefile in the top level directory. Also, it's usually easier just to install a prepackaged, compiled Python. For example, in Debian Linux using the dpkg utility. From drew.mcdowell at msfc.nasa.gov Fri Apr 7 11:21:02 2000 From: drew.mcdowell at msfc.nasa.gov (Andrew McDowell) Date: 7 Apr 2000 15:21:02 GMT Subject: Was Re: need wrapper for ssh/scp References: <8civ14$rm7$1@hammer.msfc.nasa.gov> <20000407130942.E13830@xs4all.nl> <8cksnu$in2$1@hammer.msfc.nasa.gov> Message-ID: <8ckucu$jka$1@hammer.msfc.nasa.gov> Ahhhh Hah! Found the problem...the /etc/issue file was larger than I was telling os.read() to expect. (I was trying to pull some fields out of it for error checking) Thanks for all the help! This python group is wonderful. -Drew Andrew McDowell wrote > Thomas Wouters wrote > > Help is easiest if you also explain what the problem is ;) From anthony at dstc.edu.au Tue Apr 18 02:18:06 2000 From: anthony at dstc.edu.au (Anthony J Wilkinson) Date: Tue, 18 Apr 2000 16:18:06 +1000 (EST) Subject: urllib redirect In-Reply-To: <4.1.20000418125557.030592d0@202.95.1.37> Message-ID: On Tue, 18 Apr 2000, Thomas wrote: > I've got a pretty tame question. > > I want one of my functions to redirect the URL. > (ie I call the script and off I go to www.spam.com) > > So, here's what I get, and have not overcome yet: > > import urllib > def simpleredirect() : > ############ > print "Content-type: text/html" > print urllib.urlopen('http://www.spam.com').read() > > simpleredirect() You really aren't redirecting but attempting to get the data yourself. If you just print out the following you can use the browser's own redirection facility. Content-type: text/html redirect page If your browser does not support redirection, click here to continue. Cheers, Anthony _____________________________________________________________________ Anthony J Wilkinson anthony at dstc.com Software Engineer http://dstc.com DSTC Pty Ltd Ph: +61 7 3365 4310 From dalke at acm.org Mon Apr 3 01:52:49 2000 From: dalke at acm.org (Andrew Dalke) Date: Sun, 2 Apr 2000 23:52:49 -0600 Subject: arraymodule questions References: <8c4iqv$2na$1@nntp9.atl.mindspring.net> Message-ID: <8c9bee$641$1@slb0.atl.mindspring.net> Mark Hammond said: >How about if we better expose a "buffer" object. >It is basically a fixed array("c"), and supports all slicing and >assignment operations. The difference from an array object is >that its size is fixed, but that can sometimes be a bonus. > From you description, this would be an alternative solution? I need a character array which is resizeable, so this won't work. Some of the final array sizes are not known a priori, and I need a data structure which can be used, for instance, in a GUI sequence editor. Andrew dalke at acm.org From kragen at dnaco.net Sun Apr 23 02:21:34 2000 From: kragen at dnaco.net (Kragen Sitaker) Date: Sun, 23 Apr 2000 06:21:34 GMT Subject: code not true? References: Message-ID: In article , Moshe Zadka wrote: >> Not quite. No number of bits is sufficient to represent .07 exactly in >> the typical (and IEEE standard) representation. > >Yes, but enough bits could make sure that 0.07*100 is indistinguishable >from 7.0 How many decimal digits are needed to make sure that 3 * (1/3) is indistinguishable from 1? >But I agree with the point -- floats are evil. Very very evil. In fact, >I wouldn't mind at all if there was some specific command-line flag to the >interpreter to enable floats. That would be kind of nice. -- Kragen Sitaker The Internet stock bubble didn't burst on 1999-11-08. Hurrah! The power didn't go out on 2000-01-01 either. :) From grant at nowhere. Tue Apr 18 12:12:53 2000 From: grant at nowhere. (Grant Edwards) Date: Tue, 18 Apr 2000 16:12:53 GMT Subject: Running shell programs from Python References: <38FC64DA.7D297563@ffi.no> Message-ID: In article <38FC64DA.7D297563 at ffi.no>, seh at ffi.no wrote: >I have just started with Python and have some questions.. I have some >compiled c programs that I normally run from the shell. I can use | to >pipe the output from one as input to the next. I would like to call the >programs from Python. Could someone please indicate how this is done? >Any references? If you just want to run the programs you can use: os.system("foo | bar") If you want to capture the output of the pipeline: p = os.popen("foo | bar","r") outputString = p.read() If you want to write data to the pipeline: p = os.popen("foo | bar","w") p.write("data to be sent to foo\n") p.write("more data to foo\n") p.close() (Remember to do an "import os" if you want to do any of the above) If you want to both write data to the pipeline and capture it's output, use the popen2 module, examples of which can be found in the on-line docs -- Grant Edwards grante Yow! I'm protected by at a ROLL-ON I rented from visi.com AVIS... From tim_one at email.msn.com Sat Apr 1 15:24:37 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 1 Apr 2000 15:24:37 -0500 Subject: Does Python have a long floating data type please? In-Reply-To: <38E648F7.D4AB7F7F@math.okstate.edu> Message-ID: <000601bf9c18$4d147e00$182d153f@tim> [David C. Ullrich] > ... > Exactly what convinced me that a real should be a pair of > longRationals (giving a lower bound and an upper bound for the > "real" value). At least the basic arithmetic operations seem > simple enough that a person could get them right, and they'd be > obviously right. > ... > class real: > def __init__(self, l, u): > self.l = l > self.u = u > def __add__(self, other): > return real(self.l + other.l, self.u + other.u) > > Pretty exciting stuff. (Well, the correctness of __mul__ > might not be obvious at one glance like __add__ above, > because of what happens if l < 0 and u > 0, but it should > nonetheless be extremely trivial to verify.) Yes, this is what I'd do too -- you'll get something you can trust much faster this way. Jurjen's real.py can be viewed as space optimizations of this approach, first representing the interval by a midpoint and a delta, then fixing the delta at 1 by introducing a power-of-2 scale factor instead. The details are tricky, though! Something all "interval" approaches have problems with is systematic pessimism. The classic example is y = x - x y is in fact exactly 0 no matter how fuzzy x is, but straightforward interval subtraction yields a result centered at 0 and twice as fuzzy as x. In your original post you had a milder example, x*x. This has got to be >= 0 in actuality, but if x is e.g. [-2, 2] then straightforward interval multiplication yields [-4, 4] instead of [0, 4]. Because of this pessimism, some simple series approaches to building functions (like exp and sin etc) out of the arithmetic primitives can fail to converge; this is where proofs start to get hard despite (or perhaps because of ) the simplicity of the primitives. doable-in-the-end-but-it-doesn't-stay-trivial-ly y'rs - tim From andy at petdance.com Thu Apr 27 09:55:10 2000 From: andy at petdance.com (Andy Lester) Date: Thu, 27 Apr 2000 08:55:10 -0500 (CST) Subject: Concatening string and integer In-Reply-To: <8e9gco$jlt$1@vg170.it.volvo.se> References: <8e9gco$jlt$1@vg170.it.volvo.se> Message-ID: > > I want to concatenate a string containing both strings and integers like: > > strTemp = 'I make test number: ' + iMyNumber + ' once again' > > It doesn't work, how should I do this? strTemp = 'I make test number: %d once again' % iMyNumber xoxo, Andy -- Andy Lester, andy at petdance.com, http://www.petdance.com "Inflammable material is planted in my head It's a suspect device that's left two thousand dead." "Hey, is this the new Green Day?" From alwagner at tcac.net Sun Apr 2 13:05:45 2000 From: alwagner at tcac.net (Albert Wagner) Date: Sun, 02 Apr 2000 12:05:45 -0500 Subject: tcl 8.2 OK? References: <38E4BE16.497FB1B@tcac.net> Message-ID: <38E77DE9.E1BED71C@tcac.net> Thank you, Fredrik. I tried a little example from Learning Python: >>> from Tkinter import * >>> w = Button(text="Hello", command='exit') >>> w.pack() >>> w.mainloop() It seems to work. Fredrik Lundh wrote: > > Albert Wagner wrote: > > For use by tkinter I installed tcl/tk8.2 (I couldn't make 8.0.4 > > compile). Is this OK? Or can I expect trouble later? > > if you can get a simple program to work (like the test code in > Tkinter.py), it's probably okay. > > there are some initialization issues with Tk 8.1, but they may be > fixed in 8.2. if you get messages like "cannot find usable tk.tcl in > the following directories" followed by a number of empty lines, > you need to patch the _tkinter module. > > (don't have a pointer handy; if you need the patch and cannot > find it, followup to this post). > > -- Small is Beautiful From tim_one at email.msn.com Sat Apr 1 15:01:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 1 Apr 2000 15:01:59 -0500 Subject: New Features in Python 1.6 In-Reply-To: Message-ID: <000301bf9c15$23a18f20$182d153f@tim> [Tom Culliton] > OK, it's April 1st so maybe I'm just not getting the joke but... > ... > I'm not one of the folks who howl at tightening up the behaviour of > list.append, socket.connect and the like but these changes, especially > viloating immutability, strike me as too bizarre and dangerous for > words. Please tell us it's just and April Fools joke! It's very well known that Guido has no sense of humor. What we've seen here is simply Guido *finally* embracing a policy of giving people exactly what they ask for . i-especially-love-that-"split"-guesses-which-arg-is-the-splittee-ly y'rs - tim From edcjones at erols.com Mon Apr 3 14:04:43 2000 From: edcjones at erols.com (Edward C. Jones) Date: Mon, 03 Apr 2000 14:04:43 -0400 Subject: List and Dicts as default args References: <326536345498D311B3BC00105A39802A074654@newsintern.dspace.de> Message-ID: <38E8DD3B.AC8B0AE1@erols.com> Fredrik Lundh wrote: > Stefan Migowsky wrote: > > I was just wondering how to handle lists and dictionaries in > > a simple way as default arguments to functions. Since following > > strange behaviour occured : > > when exposed to "strange" behaviour, please check the FAQ > http://www.python.org/doc/FAQ.html#6.25 > > or the fine manual > http://www.python.org/doc/current/ref/function.html > > before posting. Migowsky asked an advanced newbie question. People who are inexperienced with a language have not learned enough facts yet to easily use the documentation (even good documentation, like Python's). When I have questions like this, I try to guess the "magic words" (here "default arguments") Then I run a big grep grep 'default argument' /usr/doc/python-docs-1.5.2p2/*/*.html A good context for this is provided by "Words and Rules: The Ingredients of Language" by Stephen Pinker (Basic Books, 1999). From nadavh at envision.co.il Mon Apr 3 13:02:35 2000 From: nadavh at envision.co.il (Nadav Horesh) Date: Mon, 03 Apr 2000 19:02:35 +0200 Subject: IDLE 0.6 Bug Message-ID: <38E8CEAB.18BDC87E@envision.co.il> Someone reported that python 1.6a1 crashes on closing edit window. It crashes also when closing the help window --- could be the same problem. Nadav. -------------- next part -------------- A non-text attachment was scrubbed... Name: nadavh.vcf Type: text/x-vcard Size: 360 bytes Desc: Card for Nadav Horesh URL: From aek at mail1.stofanet.dk Tue Apr 4 19:35:59 2000 From: aek at mail1.stofanet.dk (Anders Eggers-Krag) Date: Wed, 5 Apr 2000 01:35:59 +0200 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> <38EA7452.9BFDF37E@callware.com> <8cdt7c$cl1$1@news101.telia.com> <38EA7D9C.7024CF0B@roguewave.com> Message-ID: <014801bf9e8e$8a72fec0$2c6ba8c0@frodo> > > > > an alternative solution is to call an ADO (ActiveX Data Object) object and > > use it through > > there which is quite simple. > > If you do this, make sure you get Mark's programming win32 book. It's > an excellent book for many reasons, but it goes into special detail on > COM programming (and is so far the only resource I've seen of how COM > can be simple and useful -- instead of the normal > add-on-later-because-we-need-the-buzzword I normally associate with COM > ). > it is not like ADO is a complex system, it is extremely easy to use, I use it alle time writing database systems for ASP. Anders Eggers - Krag From bhahn at spam-spam.g0-away.com Mon Apr 3 19:53:05 2000 From: bhahn at spam-spam.g0-away.com (Brendan Hahn) Date: Mon, 03 Apr 2000 16:53:05 -0700 Subject: Creating variables on the fly... References: <38E8EFF0.D71D0415@gmd.de> Message-ID: Matthew Hirsch wrote: >I like this solution. How do I use the apply function in the body to >call add()? (I won't know ahead of time how many arguments are going in >the function). You would "apply(add, list-or-tuple-full-of-arguments)". You don't really need a separate add-up-a-list function, though, you can use reduce: "reduce(operator.add, list-or-tuple-full-of-arguments)". bhahn at transoft.mmangle.net <-- unmangle address to reply From kcazabon at home.com Sun Apr 9 11:28:06 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Sun, 09 Apr 2000 15:28:06 GMT Subject: Tkinter: centering windows on screen Message-ID: I'm having a bit of a problem controlling where on screen a Toplevel() or Tk() widget appears on the screen... I have some large widgets that sometimes appear partially off-screen, and I want to make sure that (at least) they're centered. Any pointers to the best solution would be appreciated... I've searched through Fred's Tkinter manual online, but no luck. Kevin. From gmcm at hypernet.com Wed Apr 5 10:41:21 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 5 Apr 2000 10:41:21 -0400 Subject: Debug builds on WIndows (was Re: (no subject) ) In-Reply-To: <006b01bf9ed9$dd9b5660$1001a8c0@nevrax.net> Message-ID: <1257176809-9949178@hypernet.com> Sameh chafik pro wrote: > > Are there any way to have the python16_d.lib and .dll, or the python15_d.dll ????? > You need to build Python from source to get these. You will need to have python_d.exe, python16_d.dll and the debug build of your extension module all in the same dir to debug. You also need to be sure that the python dll and your extension dll use exactly the same C runtime library. For debug that's "Debug Multithreaded DLL" and for release "Multithreaded DLL". - Gordon From lbear11 at my-deja.com Sun Apr 16 22:37:29 2000 From: lbear11 at my-deja.com (lbear11 at my-deja.com) Date: Mon, 17 Apr 2000 02:37:29 GMT Subject: Tkinter Canvas -- help? Message-ID: <8ddtd7$b2k$1@nnrp1.deja.com> I'm just starting to learn Python/tkinter, and I have found that there is virtually _no_ documentation for the tkinter canvas. Could anybody help? I'm specifically looking for stuff like creating an image by a grid in canvas on "mouseDown", and how to read the items in the canvas, and write them to a text file, in their proper positions. I would _really_ appreciate it if anybody could help me with this. P.S. The only tkinter canvas documentation that I have is the "Introduction to Tkinter" from pythonware.com Thanks, jkior Sent via Deja.com http://www.deja.com/ Before you buy. From thomas at xs4all.net Fri Apr 14 18:49:20 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sat, 15 Apr 2000 00:49:20 +0200 Subject: TCP/IP protocols In-Reply-To: ; from jmassung@magpiesystems.com on Fri, Apr 14, 2000 at 04:28:03PM -0600 References: Message-ID: <20000415004919.B15664@xs4all.nl> On Fri, Apr 14, 2000 at 04:28:03PM -0600, Jeff Massung wrote: > I'm new to Python programming, but am very experienced in C/C++. Could > someone point me to a good reference for TCP/IP programming with Python > (pdf, book, anything :]) thanks. The standard lib documentation on the 'socket' library should be what you need. It's basically a wrapper around the systems' socket() call, which returns an object which wraps the systems' accept(), bind(), connect(), send(), write(), read(), recv(), etc. For async network I/O, there's asyncore. If you're looking for some higher-level programming, see libraries like httplib, ftplib, telnetlib, urllib, SocketServer, *HTTPServer, etc. Documentation for all these modules comes with the python source (in the Doc/lib/ directory) in TeX format, with most binary distributions in some form or another, or can be downloaded or browsed online at http://www.python.org/doc/lib/ (There's an entire chapter, 11, dedicated to 'Internet Protocols and Support'.) (If you insist, i'm sure we can find some book you can buy that lists the same thing... but a lot of good docs can be found online, and you can convert to pdf if you insist ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jlehmann at nsw.bigpond.net.au Fri Apr 21 03:55:17 2000 From: jlehmann at nsw.bigpond.net.au (John Lehmann) Date: Fri, 21 Apr 2000 07:55:17 GMT Subject: "n choose m" module Message-ID: <39000874.27D185B3@nsw.bigpond.net.au> One day, in a fit of boredom when my newscientist subscription was a week late and I was reduced to solving the enigma puzzle, I wrote a class to generate the permutations from a list. I assume I was wasting my time and that would have been something in the standard libraries, but in case anyone finds it useful... -------------- next part -------------- """ a class for generating permutations from an array # choose 2 letters from 'abcd' c = Chooser(['a', 'b', 'c', 'd'], 2) while c.hasMoreElements(): print c.next() """ import time, copy class NoMoreChoices(StandardError): pass class Chooser: def __init__(self, l, n): " generate permutations of n choices of l " if n > len(l): raise StandardError("cannot make %d choices from a list %d items long"%(n, len(l))) self.l = l self.n = n self.c = range(n) self.dirty = 0 def hasMoreElements(self): " determine whether there more elements to generate " if self.c == None: return false if self.dirty: self.generatenext() return self.c <> None def next(self): " get the next element " if self.dirty: self.generatenext() self.dirty = 1 return self.getmap(self.c) def getmap(self, c): m = [] for i in c: m.append(self.l[i]) return m def generatenext(self): # from the current choice self.dirty = 0 c = self.c n = self.n ll = len(self.l) done = 0 i = n - 1 try: while not done: # take the last element and increment by 1 c[i] = c[i] + 1 # check for modulo overflow while c[i] == ll: # carry the 1 c[i] = 0 i = i - 1 c[i] = c[i] + 1 if i == -1: raise NoMoreChoices() i = n - 1 if not self.containsduplicates(c): done = 1 self.c = c except NoMoreChoices, e: self.c = None def containsduplicates(self, c): " check for duplicate entries " for i in range(self.n): if c[i] in c[i + 1:]: return 1 return 0 From nospam.newton at gmx.li Tue Apr 4 15:37:35 2000 From: nospam.newton at gmx.li (Philip 'Yes, that's my address' Newton) Date: Tue, 04 Apr 2000 19:37:35 GMT Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <8cdbvg$3vi$1@news.udel.edu> Message-ID: <38ea3fda.47259642@news.nikoma.de> On Tue, 4 Apr 2000 14:30:06 -0400, "Terry Reedy" wrote: >> Python strings can now be stored as Unicode strings. To make it easier >> to type Unicode strings, the single-quote character defaults to creating >> a Unicode string, while the double-quote character defaults to ASCII >> strings. > >' = 1 byte/char, " = 2 bytes/ char is more straightforward. Yes, but this depends on what you mean by "Unicode". You have to represent those Unicode characters in bytes, somehow, and how many bytes you need depends on the format. Also, full Unicode is 32-bit (not just the 16 bits of the Basic Multilingual Plane). UTF-16 is two bytes (but can be four for surrogates), UTF-8 is a *variable* number of bytes (1 to 6, I believe), etc. It's not always 2 bytes per Unicode character. Cheers, Philip -- Philip Newton From mwh21 at cam.ac.uk Mon Apr 3 16:17:22 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 03 Apr 2000 21:17:22 +0100 Subject: Python 1.6 alpha 1 released References: <200004010159.LAA00403@piglet.dstc.edu.au> <8c9nq3$ghk$4@newsserver.rrzn.uni-hannover.de> <8cas94$po5$1@newsserver.rrzn.uni-hannover.de> Message-ID: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) writes: > True the whole discussion is kind of pointless. > Nontheless it is not an easy taks to just rewrite your code with > a simple regular expression replacement. ;-) (And that was my point.) Downright impossible (the old "can't match nested parens" would rear it's head, would it not?). I'd have thought it possible with a real parser, though. i-know-lets-flog-this-thread-a-bit-more-ly y'rs Michael -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From m.faassen at vet.uu.nl Wed Apr 5 14:04:31 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 5 Apr 2000 18:04:31 GMT Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> Message-ID: <8cfv7f$l0e$2@newshost.accu.uu.nl> Timothy Grant wrote: > mxODBC works beautifully, but I've never used it to access and access > database, only SQL database. Perchance do you know how Windows > advertises an Access database to an ODBC driver? Windows does this automagically. If you have the ODBC manager in the control panel, you can create a system DSN that points to the Access database file. It'll allow you to send SQL to your db. You don't even have to have MS Access installed, just the ODBC stuff. Of course you can only access it from a Windows box, though there are ODBC bridging solutions so you can connect to a Windows box with the database on it over the network and transparently use ODBC from your Unix machine. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From andrew at andrewcooke.free-online.co.uk Sat Apr 22 16:00:32 2000 From: andrew at andrewcooke.free-online.co.uk (Andrew Cooke) Date: Sat, 22 Apr 2000 20:00:32 GMT Subject: LAmbda calculus evaluator (interactive) References: <8dro55$eq6$1@nnrp1.deja.com> Message-ID: <8dt0cq$nte$1@nnrp1.deja.com> ok, is this one of those pedantic geek jokes? the worst problem with never having studied computer science (apart from having to learn about lambda calculus now) is that my sense of humour was never warped to the point where i could detect this kind of thing for sure... ...but if not, i thought the (unquoted) context made clear that i was talking about programs that manipulated expressions in lambda calculus (so a "not interactive" program simply takes an expression and follows some evaluation strategy as far as possible; an "interactive" program allows me to step reduction by reduction, do abstractions, etc). in other words, manipulate the appropriate ast. anyway, i'm writing my own using the "little languages in python" framework (now called spark) - but would still appreciate pointers to other work. cheers, andrew In article , Justin Sheehy wrote: > Andrew Cooke writes: > > > I know where I can get various (Oca)ML programs, but I'm not sure > > they're interactive > > % ocaml > Objective Caml version 2.04 > > # 1 + 1;; > - : int = 2 > # > > -Justin > > Sent via Deja.com http://www.deja.com/ Before you buy. From wrd at awenet.com Mon Apr 10 15:42:38 2000 From: wrd at awenet.com (William R. Dickson) Date: Mon, 10 Apr 2000 12:42:38 -0700 Subject: Problem running Python script as cron job References: <38EE41F4.8050708@gmx.net> Message-ID: In article <38EE41F4.8050708 at gmx.net>, Per Kistler wrote: > Hi Bill > > Try stderr? > /path/prog > /path/log 2>&1 > > Maybe it spits some errors? Tried that, but I still wind up with an empty log. Anyway to force it to write immediately rather than buffering? Thanks, -Bill From mrfx at 263.net Wed Apr 19 03:37:12 2000 From: mrfx at 263.net (fmr) Date: Wed, 19 Apr 2000 15:37:12 +0800 Subject: How to compile wxpython in win98 using vc6.0 for wxWindows2.1.15! Message-ID: <8djn4c$22ch$1@news.cz.js.cn> when i compile wxpython in win98 using visual c++ 6.0 for wxWindows2.1.15, i got following error: wx.cpp: wchar.h(700) : error C2733: second C linkage of overloaded function 'wmemchr' not allowed wchar.h(699) : see declaration of 'wmemchr' ... How can i compile it? please help me! From m.faassen at vet.uu.nl Tue Apr 11 10:11:44 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 11 Apr 2000 14:11:44 GMT Subject: Pass by reference ? References: <1257157531-11108477@hypernet.com> <38EBCD7D.7030602@acm.org> Message-ID: <8cvbr0$q2i$2@newshost.accu.uu.nl> Robert W. Cunningham wrote: [snip] > None changed! Therefore, representations the functions modified were > DIFFERENT from those passed, though it is clear that the correct VALUE > was passed. Reference semantics is indistinguishable from value semantics if the objects manipulated are all immutable. There was no modification in your example; there was only assignment. Assignment does *not* modify an object, unless it is changing a reference inside a mutable object (such as a[0] = 'foo'). > This behavior meets the classical definition of "Pass By Value". Reference semantics is indistinguishable from value semantics if the objects involved are all immutable. Some objects in Python such as integers, string and tuples, are immutable, others can be mutated. Reference semantics is indistinguishable from value semantics if you use a mutable object in an immutable way (this takes lots of discipline, though). Assignment only changes what variables (or list elements, or dictionary elements, or object attributes) refer to, but this indistinguishable from value semantics if you use immutable objects or treat objects immutably. Function or method arguments have the exact same semantics as Python assignment. I don't think there's any dictionary if you understand this. Python works with references only. As long as you deal with immutable objects, or treat objects as immutables, this is identical to value semantics, though. It's very easy to think about. Easier than C's pointers for instance, in my experience. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From mwh21 at cam.ac.uk Fri Apr 28 09:21:02 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Apr 2000 14:21:02 +0100 Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> <8e4akc$p7o$1@newshost.accu.uu.nl> <3908E6EC.B9E6B2E8@cosc.canterbury.ac.nz> <39099069.7BFD8387@tismer.com> Message-ID: Christian Tismer writes: > > Greg Ewing writes: > > > Maybe the LC syntax should include something like > > > > > > [[] times 10] > > > > But wouldn't that make "times" a keyword? Not sure I'd want that... > > Currently, yes, but it is absolutely not necessary to be so. > It requires to change the grammar to treat operators > differently. But then what happens to things like times = 10 return [[] times times] ? I'm not sure context senstive keywords are a good idea (in any language, ever). Currently a naked identifier in Python is either a variable reference or a keyword, and you can tell which just by looking at *it*, not at its surroundings - and I think I like that. Though it would be occasionally useful to be able to call a variable `class'. Cheers, M. -- nonono, while we're making wild conjectures about the behavior of completely irrelevant tasks, we must not also make serious mistakes, or the data might suddenly become statistically valid. -- Erik Naggum, comp.lang.lisp From dkuhlman at netcom.com Fri Apr 28 16:32:19 2000 From: dkuhlman at netcom.com (G. David Kuhlman) Date: 28 Apr 2000 20:32:19 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> Message-ID: <8ecsgj$6lp$1@slb0.atl.mindspring.net> > > No. However, this seems to make code *more* readable. In fact, many C++ > programmers use 'this.x' for all their instance variables, to be able to > see at a glance which are just local variables of the function and which are > instance variables. It's just more work to write, but that doesn't matter > much. > Thinking about readability, I wrote the C++ coding standard here where I work. When we programmers reviewed it, a co-worker insisted that part of our standard be to prefix the names of all member variables in any class with "m_" so that we could distinguish them from other variables. I believe that "m_" is a Microsoft-ism and in my humble opinion is just another way to spell "self.". I think this shows that even C++ programmers are capable of seeing the wisdom of the Pythonic way. - Dave From neilh at hare.net.au Thu Apr 20 21:21:39 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Fri, 21 Apr 2000 11:21:39 +1000 Subject: Using python on the web References: <8di2bk$l1s$1@newshost.accu.uu.nl> <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> <9N4L4.499$wYl.191816704@newsb.telia.net> <8do2te$kpr$1@nnrp1.deja.com> Message-ID: <07ae01bfab2f$f2ea09a0$5ddd3fcb@neil> > DHTML is particularly > problematic, AFAI can tell, because it doesn't appear to allow the > segregation of HTML development from coding the way Python string > substitution does. We hire very skilled HTML people to do HTML and tell > them to leave our sustitution tags alone, rather than taking the time > and money to create novice DHTML people to do the same work. I think you are confusing Zope's DTML (Document Template Markup Language) with DHTML, Dynamic HTML. I was about to launch into a stinging attack on the belittlement of such a wonderful technology as DHTML but then realised it is probably just an acronym mixup. Neil From grant at nowhere. Thu Apr 20 17:11:11 2000 From: grant at nowhere. (Grant Edwards) Date: Thu, 20 Apr 2000 21:11:11 GMT Subject: How2 use curses for data input References: <38FF6DE2.5751423A@sprint.ca> Message-ID: In article <38FF6DE2.5751423A at sprint.ca>, Miles Thompson wrote: >I 've read the curses part of the manual, and the HOWTO, but I'm not >much wiser. I need to capture some user input (name of a new directory >for archiving some web files), and I understand how to define a window, >etc. What I don't know to do is how to edit the lines, and loop from >last to first. You might want to take a look at the "snack" module, which is a wrapper for the newt library (which is based on slang rather than curses). It impliments a set of text-mode widgets such as buttons, scroll lists, data entry fields, checkboxes, etc. You stick a bunch of them on a "form" and pop it up. When the user is done, you get the values back somehow (I forget exactly). If all you need to do is prompt the user for some data, it should do the trick. Redhat's text-mode installer is (or at least was) written in Python using snack/newt. -- Grant Edwards grante Yow! Why was I BORN? at visi.com From zsoltman at my-deja.com Sun Apr 2 19:07:04 2000 From: zsoltman at my-deja.com (zsoltman at my-deja.com) Date: Sun, 02 Apr 2000 23:07:04 GMT Subject: NameError when assigning dictionary values References: <20000402220351.9903.qmail@web2103.mail.yahoo.com> Message-ID: <8c8jqf$851$1@nnrp1.deja.com> If I am not mistaken, you are trying create two new list variables on the fly (If I'm wrong, you can ignore the rest). If this is what you are trying to do, you need to use the exec and eval functions. Below is an example. Let me warn though, you must be vigilant with your error trapping. These functions can end up causing you a major headache otherwise. (Notice I threw the invalid variable name '^' to show how confusing this can get) print listVariables=['one','^','two','three'] for eachVariable in listVariables: execString=eachVariable+'= []' try: print 'Running statement '+execString exec(execString) except: print 'Something went wrong trying to execute the statement "'+execString+'"' print 'one = ',one print 'two = ',two print 'three = ',three # to dynamically get these values print 'Now getting dynamically' for eachVariable in listVariables: try: print eachVariable+' =',eval(eachVariable) except: print 'Something went wrong trying to evaluate variable named "'+eachVariable+'"' In article <20000402220351.9903.qmail at web2103.mail.yahoo.com>, lewst wrote: > Gordon McMillan wrote: > > > > # add each key-value pair to the dictionary and > > > # then for each value, create an empty list. > > > mydict = {} > > > for key,value in [ (".", "one"), ("+", "two") ]: > > > mydict[key] = value > > > value = [] > > > print mydict > > > print one,two > > > > > > Whe I run this I get "NameError: one". Why aren't my 2 empty lists > > > named "one" and "two" being created? > > > > You're creating two empty lists, both named "value".The first > > is thown away by creating the second. Nowhere are "one" and > > "two" variable names, hence the NameError. > > Ok. So now how do I get the program to do what I want? > > __________________________________________________ > Do You Yahoo!? > Talk to your friends online with Yahoo! Messenger. > http://im.yahoo.com > > Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Tue Apr 11 02:50:38 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 06:50:38 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8covpn$4jq$1@slb6.atl.mindspring.net> <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk> <3H4I4.709$4w1.17557@typhoon.nyroc.rr.com> <8cs3ho$l06$1@pegasus.csx.cam.ac.uk> Message-ID: <2XzI4.1123$Za1.20108@newsc.telia.net> Nick Maclaren writes: > in what I am doing, they arise naturally out of the problem. > The pity is that the expression that I am trying to evaluate > is EXACTLY what the logic of the program requires, but it > cannot be written in Python (or Fortran) without artificial > variables. > No. Firstly, it relies on an artifact of my example (i.e. that it is > in an assignment, rather than a test condition or function call) how about telling us *exactly* what you're doing? as long as you don't tell us, and just keep replying "no, that won't work in *my* case" to anyone trying to help you, you're just wasting everybody's time. From pete at visionart.com Wed Apr 19 22:41:30 2000 From: pete at visionart.com (Pete J Shinners) Date: Wed, 19 Apr 2000 19:41:30 -0700 Subject: help learning "re" Message-ID: <38FE6E5A.E7673A83@visionart.com> i'm trying to get the hang of these regular expression i'm trying to write a function that takes two filenames and copies one to the other. while it is copying i want it to scan for any environment variable names and substitute the expanded value. sounded like a fabulous time to learn the regexp. sadly it doesn't work. the code runs, but none of the variables are found or substituted here's what i expected to work ---------------------------------------------- import os, re def subvar(regfind): "callback for regex substitution" var = regfind.group(0)[1:] print 'REGEX found var:', var #temp debugging. never gets here return os.environ.get(var, '$'+var) def smartcopy(source, dest): "copies files. substites env.variables with values" srcfile = open(source, 'r') dstfile = open(dest, 'w') regexp = re.compile(r"\$[0-9A-Z_]+") while 1: line = srcfile.readline() if not line: break regexp.sub(subvar, line) dstfile.write(line) ----------------------------------------------- surely this can be done correctly, but how? From claird at starbase.neosoft.com Thu Apr 13 07:07:39 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 13 Apr 2000 06:07:39 -0500 Subject: Rewards of celebrity (was: Dr. Dobb's Python-URL! - weekly Python news and links (Apr 3)) References: <42FC2C22B9F94665.58B059EC6AF1AB7B.326AADF624B2C732@lp.airnews.net> Message-ID: In article <42FC2C22B9F94665.58B059EC6AF1AB7B.326AADF624B2C732 at lp.airnews.net>, Fredrik Lundh wrote: >The Software Development conference in San Jose turned out to be a major >Python event. . . . > Some media coverage. Like it or not, but Python is hot! :-) . . . I've had occasion lately to scan a lot of comp.lang.perl content. I came across a few surprises that might interest those with a stake in Python's popularity and prospects, and perhaps suggestive of the merits of comp.lang.python* reorganization. comp.lang.perl.misc has a reputation for nastiness. The past few months have been less combative than it was in 1999; still, there's simply no mistaking c.l.p.m for c.l.p. The biggest surprise for me has been how thin the c.l.perl* newsgroups are. While I don't expect c.l.python's academi- cism or even its aesthetic excesses, my current impression is that comp.lang.perl.{misc,modules,moderated,tk} together don't have as many serious and interesting posts as c.l.python. It's not for lack of possibilities; Perlites have plenty left to talk about on such subjects as OO style, new data-management APIs, Win32 utility, GUI bindings, Unicode, thread capabilities, numeric extensions, extensibility, how to teach reference use, ... However, comp.lang.perl.misc is absolutely FULL of lowbrow trespassing--Web site "developers" whose "shopping carts need e-mail validation, and they'd rather do it in HTML anyway than CGI, so could someone please give them either the perlscript or netscape to make it work, even if it's unix?" While that's my paraphrase, it's absolutely not an unfair one; the true postings are often worse. Jeff Zucker went to the trouble of beginning a collection of such drivel for the elevated purpose of investigating patterns of learning. In any case, Pythonians need not fret that they're missing a whirlwind of production somewhere over in c.l.perl*. Only a sliver of what's happening there is other than forgettable. Most of the good stuff appears to be happening in mailing lists, which are, again, more pugnacious and posturing than Python's, but otherwise comparable. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From davehurt at flash.net Fri Apr 28 16:25:43 2000 From: davehurt at flash.net (David Hurt) Date: Fri, 28 Apr 2000 20:25:43 GMT Subject: newbie dbase dataaccess References: Message-ID: Take a loot at MetaKit http://www.equi4.com, I believe In article , "Georg Hammerbacher" wrote: >Hello Anders, > >thanks for your guess. > >The thing inside my head is to write an adressmanager >- which is the *central* adressbook >- who works under Windows and Linux >- has an GUI Interface >this are the features for the beginning. > >my dream is (under the GPL licence), to expand this piece of software and >integrate the good Features of MS-Outlook and Lotus Organizer. (comments are >welcome) > >I?ve found "gadfly" for databasing. Is it really so good as it seems?? > >Thanks >Georg > > >Anders M Eriksson schrieb in im >Newsbeitrag: mtiigskn8uumhk94rklnr2fdealunasoot at 4ax.com... >> On Thu, 27 Apr 2000 11:40:46 +0200, "Georg Hammerbacher" >> wrote: >> >> >Hello everybody, >> > >> >> Hello Georg! >> >> >I?m just new in programming Python and now I want to make my own personal >> >adressmanager with a simple dBase-file. >> >How can I get access to it or where can I find more info?s about using >> >dbase-files within Python? >> > >> First: Why do you want to use dBASE as the database format? >> >> I haven't found any good dBASE interface for Python. So if you want to >> use the dBASE format you need to use ODBC and then you hopefully are >> on a computer that runs unders Windows NT/98. >> >> If you don't NEED to use dBASE then look at >> http://www.python.org/topics/database/ here you will find alot of info >> about how to use Python for accessing databases.... >> >> // Anders >> > > From pinard at iro.umontreal.ca Wed Apr 26 09:45:11 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Apr 2000 09:45:11 -0400 Subject: new linereading standard? In-Reply-To: Johann Hibschman's message of "25 Apr 2000 11:23:23 -0700" References: <3904D21B.333DD930@visionart.com> <390510C9.A744D22E@yahoo.com> Message-ID: Johann Hibschman writes: > Robin Becker writes: > > am I wrong for writing > > for line in open('myfile.txt').readlines(): > > print line Under JPython (which I do not know), your file might stay opened until the next garbage collection. But I find the above writing so neat that I prefer to rely on CPython reference counting, and consciously postpone a lot of tedious rewriting if I ever have to use JPython. All the clear writings which are allowed because reference counting are now, for me, a strong source of Python addiction. I feel ready to rely on it, after I've been told that Python is going to stick with reference counting. More to the specifics: for line in open('myfile.txt').readlines(): print line will give you a double spaced copy of your file, as `print' will add its own newline after `line', which already has one. You could write any of: for line in open('myfile.txt').readlines(): print line, for line in open('myfile.txt').readlines(): print line[:-1] for line in open('myfile.txt').readlines(): print line[:-len(os.linesep)] depending on taste, the system you are using, and the fact that the last line is terminated or not. Getting simpler and faster, you might try: for line in open('myfile.txt').readlines(): sys.stdout.write(line) sys.stdout.writelines(open('myfile.txt').readlines()) sys.stdout.write(open('myfile.txt').read()) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From rcc at nospamthanks_jennic.com Thu Apr 20 07:07:10 2000 From: rcc at nospamthanks_jennic.com (Robert Cragie) Date: Thu, 20 Apr 2000 11:07:10 GMT Subject: Using popen in windows Message-ID: I tried the following in Windows 98 as an experiment: from win32pipe import popen p = popen('dir','r') str = p.read() print str It just hangs when trying to do the read, and I have to kill the shell off. I have tried IDLE 0.5 and PythonWin and the 'DOS' command line, both do the same. I am using Python 1.5.2, and the win32pipe.pyd DLL is dated 3rd May 1999. I have done the equivalent on Linux and it works fine: from os import popen p = popen('ls','r') str = p.read() print str Anyone got any ideas? TIA Robert Cragie From jbauer at rubic.com Sat Apr 22 00:03:06 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Fri, 21 Apr 2000 23:03:06 -0500 Subject: The Simple Economics of Open Source References: <3900611F.3B525BDA@cfdrc.com> <1255786824-35980039@hypernet.com> Message-ID: <3901247A.E87B5D0A@rubic.com> >> Robin wrote: >> Painters exchange ideas, concepts and criticism freely, >> but compete for customers. > Raffael responded: > Speaking as a painter, I can tell you that many painters > do not share ideas and concepts, but are quite secretive > about them. In fact, there is a long history of artists > keeping their working methods secret from each other, > for precisely the same reason that any other set of > business competitors do. And the success of that approach has made painting a profitable and lucrative career choice, in contrast to the thousands of struggling software engineers who can't even qualify for an NEA grant. If I didn't have my part-time performance art income to help pay the bills, I could never afford to support my programming lifestyle. -Jeff From gherman at darwin.in-berlin.de Mon Apr 10 13:54:47 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Mon, 10 Apr 2000 19:54:47 +0200 Subject: [reportlab-users] ReportLab PDF Library v0.92 - print code and presentations to PDF! References: Message-ID: <38F21567.C9BC701@darwin.in-berlin.de> Andy Robinson wrote: > > [announcing RL 0.92] > > New features in this release include: > - A preview of Dinu Gherman's "py2df", which prints Python > code with correct syntax colorizing and a host of options I've just uploaded the entire final version 0.4 of py2pdf into the egroups.com ReportLab-users vault: http://www.egroups.com/files/reportlab-users/dinu Please note that there are many sample PDF docs that are not included with the ReportLab distribution (for good rea- sons). Also not that this is the final version 0.4 compared to the current pre-release in RL 0.92. Unfortunately, I was not able to remove the previous 0.3 ZIP file from the vault which is most likely because of some changes to the Egroups site, but anyway... From here it will also migrate to my starship cabin today or tomorrow... Regards, Dinu -- Dinu C. Gherman ................................................................ "The thing about Linux or open software in general is that it actually tries to move software from being witchcraft to being a science," [...] "A lot of the programs you see today are actually put together by shamans, and you just take it and if the computer crashes you walk around it three times... and maybe it's OK." (Linus Thorvalds, LinuxWorld 2000, NYC) From r2d2 at shaka.acc.umu.se Fri Apr 7 03:27:44 2000 From: r2d2 at shaka.acc.umu.se (Niklas Frykholm) Date: 7 Apr 2000 07:27:44 GMT Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> <38EB73B6.6C0913A7@callware.com> <8chsij$k5r$1@newsserver.rrzn.uni-hannover.de> Message-ID: >>> And all in 24 hours? >>> This is as misleading as the dummy attribute. > >> I don't think so. You can go at your own speed. The book is broken up >> into 24 chapters, each taking more or less than an hour to read. > >Well I guess that a good speed would be 14 days, then. :) >With two hour lections plus time to exercise. As an interesting side note, a publisher here in Sweden has recently started a 10-minute series, with titles such as "Teach your self Internet in 10 minutes". Seems there is inflation (or perhaps deflation) in these things. And it _is_ a silly practice. But then again, corporate silliness doesn't surprise me that much anymore. // Niklas From josht at iname.com Sun Apr 30 22:00:09 2000 From: josht at iname.com (Josh Tompkins) Date: Mon, 01 May 2000 02:00:09 GMT Subject: Circular Dependancies Message-ID: <8F26D44DDjoshtinamecom@209.208.0.7> I've read in a couple of places that circular dependancies are not a good thing to have in a program. I'm actually kind of curious: why is this? Is it a style thing, or something that can actually confuse the interpreter/compiler? Thanks. josue -- ________________________________________________________________ "Destined For Great Things -- but pacing myself." - From a t-shirt. E-Mail: josht at crosswinds.net ICQ: 21219667 AIM: JosueTheGreat Web: http://www.crosswinds.net/~josht _________________________________________________________________ From kelley at bioreason.com Tue Apr 4 08:19:31 2000 From: kelley at bioreason.com (Brian Kelley) Date: Tue, 04 Apr 2000 13:19:31 +0100 Subject: What is python's language level? References: <38EA1B8F.A797A130@lmco.com> Message-ID: <38E9DDD3.3313FF6@bioreason.com> Chuck Meyers wrote: > Does anyone know python's language level? I did not find it in the list > at: > > http://www.spr.com/library/0langtbl.htm > > I would guess that it would be somewhere between 15 and 30. This is an > important point, even if language levels are imprecise they can make it > easier to convince people to look at or try a language like python. > > -Thanx > Okay, I'll bite. This seems kind of arbitrary to me. Let me put it this way, looking at the lists of "language levels", special purpose languages rank highly: Mathcad, excel, lotus, etc. I use python to create libraries for manipulation chemistry and related feature vectors. These packages becomes available to our chemists and AI researches to work with. From their point of view, the "language level" for these constructs are incredibly high. From my point of view the "language level" is much lower. So who's right? They get a big win because I put time and effort converting python from a general language to a specific language. I get a big win because I don't have to teach them make, gcc compiler flags, etc... Of course every time somebody creates an HTML/XML/whatever package the "language level" increases from my point of view. Batteries included indeed. So, who gets to judge the language level, eh? > > chuck.meyers at LMCO.COM -- Brian Kelley (505) 982-7884 ext 207 Bioreason, Inc kelley at bioreason.com 105 Washington #303, Santa Fe NM, 87501 From javanet at dynacap.com Tue Apr 18 13:19:51 2000 From: javanet at dynacap.com (Arnaldo Riquelme) Date: Tue, 18 Apr 2000 09:19:51 -0800 Subject: BAD starship.python.net news! References: <38FC852A.9B11F458@concentric.net> Message-ID: I'm willing to donate some money. Just tell me who to talk to or when to send it. Manus Hand wrote in message news:38FC852A.9B11F458 at concentric.net... > This from Mike McLay. Everyone, let's pony up what it takes to recover > our starship! > > Manus (who will backup more and more often than he has until now) > > > From: Mike McLay (mclay at nist.gov) > > Subject: Re: starship.python.net?? > > > > The prognosis isn't good. The old drive is toast and backup software > > was never installed. I've located a data recovery company that will > > provide a quote on the chances of recovery for $125. The cost of > > recovery, if it is possible, will be between $300-$1000. They can > > turn around the recovery in a few days time. Someone will need > > to fund the recovery. So far I have a $200 pledge. > > > > I bought a new drive and installed it in the server last night. The > > system will be back online tomorrow by noon. > From jp at NOSPAMdemonseed.net Tue Apr 18 09:30:41 2000 From: jp at NOSPAMdemonseed.net (jason petrone) Date: Tue, 18 Apr 2000 08:30:41 -0500 Subject: gaming and python References: <000c01bfa91c$f421d6a0$0f8d0b3f@oemcomputer> Message-ID: <12ohd8.4rs.ln@demonseed.net> mrnatch wrote: > I told a friend of mine that I am learning to program using Python (I chose > Python as my first language on the advice of a Llama) and he asked me an > interesting question: Can Python be used for programming video games? And > does it work with Windows API? Just curious. Sure Python can be used for video games! Though it would be difficult to write a complex game without dipping into any C programming, there are modules for sound and 3d graphics available. Check out PyOpengl. Later on, when you find enough things you can't do in Python, you can learn enough C to write some extension modules. -jp From mhammond at skippinet.com.au Sat Apr 1 03:38:18 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 01 Apr 2000 08:38:18 GMT Subject: win32all-130 for Python 1.6 available Message-ID: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au> Hi all, To help encourage testing of Python 1.6, I have made a version of win32all available. This should also be considered alpha! It is available via http://starship.python.net/crew/mhammond/win32/Downloads.html - from that page: For Python 1.6 only. If you want a version for Python 1.5.2, see win32all-128. Like Python 1.6 itself, this should be considered alpha. This co-exists fine with Python 1.5 and any of the 1.5 win32all builds. All my testing shows no problems with 1.5 and 1.6 installed concurrently. NOTE: The installer will copy Python16.dll from the Python directory to your system32 directory. I couldn't even make the installer load Python16.dll from the Python directory, let alone Pythonwin or COM objects! This build has dropped the local Unicode object defined in pywintypes in favour of the built-in Python Unicode object. Win32com code no longer converts Unicode objects to strings. The COM test suite works fine, which indicates the long awaited string-and-unicode integration is complete! The version of Pythonwin in this build has some significant new features, mainly thanks for a new Scintilla. Source-code folding is very cool, and each editor window now has a horizontal splitter for a second view of the file! A number of debugger bugs have been fixed. Please let me know of any problems... Thanks, Mark. From quinn at hedono.ugcs.caltech.edu Tue Apr 25 18:23:01 2000 From: quinn at hedono.ugcs.caltech.edu (Quinn Dunkan) Date: 25 Apr 2000 22:23:01 GMT Subject: Metaclasses? References: <3905F4A0.2B39C705@darmstadt.gmd.de> Message-ID: On Tue, 25 Apr 2000 21:40:16 +0200, Robb Shecter wrote: >Hi, > >I read an old post about metaclasses (included on the cd-rom with the >book "Mit Python programmieren"), and got very interested, because I >imagine that by making a new metaclass, I could maybe fix the one thing >about Python that annoys me: the obligatory use of "self" in method >declarations and variable access. (Python's syntax is so clean and neat >in all other areas, I feel like it's a shame that there's excess >verbosity in this one place.) > >So - are metaclasses just a random idea, or is there something in the >works? Metaclasses have been implemented for a long time, see src/Python-x.y.z/Demo/metaclasses. I don't think many people use them, presumably because they like neat and clean, and metaclasses, while clever, are not (shall we say) conducive to clarity of understanding. Python's syntax has "excess" verbosity in *many* places (that's a feature), but self.foo is not one of them. In python, you *always* access the attribute of an object with obj.attr Some people don't like this, and there have been threads in the past about it, but other people think "more verbosity and less magic" is more pythonic than "less verbosity and more magic". Anyway, even if you could figure out the ambiguity problem, I don't think metaclasses would help you, bytecodehacks might. Or you could just grit your teeth, type five extra characters, and as a bonus get something that can be read by other people. You could shorten those five chars further by writing a macro or abbr for your editor. From BLAISE.BONNEVILLE at wanadoo.fr Thu Apr 20 03:44:06 2000 From: BLAISE.BONNEVILLE at wanadoo.fr (BLAISE BONNEVILLE) Date: Thu, 20 Apr 2000 09:44:06 +0200 Subject: print a pixel Message-ID: <8dmcvb$r6n$1@wanadoo.fr> I am a beginner in Python and I would like to know how to print a pixel in Python with Windows 98, given its coordinates. Thank you! From cgw at alum.mit.edu Sat Apr 1 13:46:48 2000 From: cgw at alum.mit.edu (Charles G Waldman) Date: Sat, 01 Apr 2000 12:46:48 -0600 Subject: new method for string objects References: <8c44e8$5hj$1@slb6.atl.mindspring.net> Message-ID: <8c5g6o$prr$1@info3.fnal.gov> In article , "Fredrik Lundh" wrote: > (if numeric python doesn't support the buffer interface, > it should be fixed). > > > It doesn't, yet, so I decided to sit down and add this support. However I haven't been able to dig up documentation on the buffer interface - is there a document somewhere describing this, or do I just need to look at code such as Objects/stringobject.c and figure out the buffer interface by reading that? It's a little more complex in the case of Numeric Python since Numeric supports non-contiguous arrays. I see that there is a bf_getsegcount method which seems like it would be appropriate in this case, but without a little more information I'm not sure that I'm using it correctly. From jamarijr at hotmail.com Mon Apr 17 12:18:13 2000 From: jamarijr at hotmail.com (Arinté) Date: Mon, 17 Apr 2000 16:18:13 GMT Subject: newbie question Message-ID: <8dfdfk$uum$1@nnrp1.deja.com> If i PyErr_SetString(PyExc_TypeError,"Invalid command value for IOCTL"); in my c/c++ program, how would python script get that error string? Thanx Sent via Deja.com http://www.deja.com/ Before you buy. From punck at SpamIsBadPenguinPowered.com Wed Apr 26 21:42:17 2000 From: punck at SpamIsBadPenguinPowered.com (Chris Armstrong) Date: Wed, 26 Apr 2000 20:42:17 -0500 Subject: Several Questions Message-ID: Hey all. Got a few questions here, they're all about a telnet-able game I'm writing, in the spirit of LORD. 1> I'm kinda worried about how much memory each python process will take up. Is there anything I can do about this? make it single-threaded maybe? (like the boa httpd) Are my worries even rational? 2> This one's derived from the last one. Does importing a module multiple times within a program take up x amount of memory for each time it's loaded? For instance if I import a module in my main program and one of the Plugins written for my game import the same plugin. 3> Speaking of modules, I'm writing one for my battle system. Is there any reason to make it a class, other than being able to create instances of it? (I don't need multiple instances.) 4> Currently I run my game with telnetd and the -L parameter to it, so it can handle different terminals and the like to display my ncurses display. This seems pretty "ghetto" to me, and I'd like to know if there are any modules or ways to handle the displaying to different terms myself. -- Chris Armstrong http://penguinmints.cx Geek code version 3.12 GCS d? s:-- a--- 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? Go to www.geekcode.com to find out what on earth this is. From effbot at telia.com Tue Apr 4 12:26:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 04 Apr 2000 16:26:35 GMT Subject: tkinter - changing the mouse pointer? References: <38E91666.D3B87B4C@parlant.com> Message-ID: <%IoG4.5028$74.81199@newsc.telia.net> Thomas Lane wrote: > Does anyone out there know how to change the mouse pointer in tkinter? I'd like > to change the mouse pointer to an hourglass (or the default 'wait' icon for the > os) and back to normal after a short operation. How do I go about doing this? > I've hunted through the Grayson book without success. this might help: http://www.deja.com/[=dnc]/getdoc.xp?AN=392027946 From ng at hardlight.couk.com Fri Apr 14 05:54:43 2000 From: ng at hardlight.couk.com (.:|:.) Date: Fri, 14 Apr 2000 10:54:43 +0100 Subject: exception problem Message-ID: <38f6ebc3.0@news.proweb.co.uk> File "/pr0n/getGroup.py", line 58, in ? ArticleToFile(s, `i`) File "/pr0n/getGroup.py", line 26, in ArticleToFile decode(uufn, binfh) File "/usr/lib/python1.5/uu.py", line 95, in decode raise Error, 'No valid begin line found in input file' uu.Error: No valid begin line found in input file from uu import * decode(infile, outfile) raise Error, 'No valid begin line found in input file' uu.Error: No valid begin line found in input file how do i trap it i've tried try: decode(infile, outfile) except uu.error: pass gives me NameError uu : tia Matt From musingattheruins at my-deja.com Thu Apr 13 17:39:15 2000 From: musingattheruins at my-deja.com (musingattheruins at my-deja.com) Date: Thu, 13 Apr 2000 21:39:15 GMT Subject: Complaint Dept: My shoes! References: <8d4s4d$mvr$1@nnrp1.deja.com> Message-ID: <8d5eq1$d38$1@nnrp1.deja.com> > if shoe: > print shoe, hit_on_head() good point, thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From sjmachin at lexicon.net Fri Apr 14 21:08:23 2000 From: sjmachin at lexicon.net (sjmachin at lexicon.net) Date: Sat, 15 Apr 2000 01:08:23 GMT Subject: an intern-like memory saver References: <8d5ing$heb$1@nnrp1.deja.com> <38F7318F.AE4F0EE5@endea.demon.nl> Message-ID: <8d8fe0$nr5$1@nnrp1.deja.com> In article <38F7318F.AE4F0EE5 at endea.demon.nl>, Niels Diepeveen wrote: > > > sjmachin at lexicon.net schreef: > > > > Problem: > > I have an application that works with words and can have millions of them > > in memory at one time. Apart from the main data structure, a dictionary is > > used to maintain frequencies. As the words are loaded from files, multiple > > instances of the same word don't share memory. The memory savings > > could be huge --- see how frequent "the" is in English text, or "Smith" in > > an Anglo telephone directory. > > > > Trial solution: > > (1) Clone dictobject.c. Make it into an extension module for a type called > > "mydict". Add a method called "key_ref".with one argument: > > adict.key_ref(obj). If adict.has_key(obj) is true, this returns a reference to > > the key value inside the dictionary; else it returns "obj". > > (2) Make simple changes to the application: > > (a) Change > > freq_dict = {} > > to > > freq_dict = mydict.mydict() > > (b) assuming for purposes of exposition that words are stored simply in a > > list, after > > freq_dict[w] = freq_dict.get(w, 0) + 1 > > change > > word_list.append(w) > > to > > word_list.append(freq_dict.key_ref(w)) > > > > Results: > > Gratifying. An exercise that was running out of real memory (384 MB) and > > taking a day now takes an hour or so. > > > > Questions: > > (1) Would this be sufficiently generally useful to make it a method of the > > standard dictionary object in Python? > > It seems to make sense. I don't know if it would be widely used though. > I can think of a number of ways to do very much the same thing in > Python. I don't know whether you've tried, but I think simply using > w = intern(w) > might be even faster than what you describe. I tried "intern" and read the source code for it. Speed is not a consideration until I run out of real memory and start swapping to disk. My objective is to reduce memory usage so that that doesn't happen. "intern" has its *own* hidden dictionary; if I use it, it may even *increase* my memory usage. I already have my own dictionary with all those strings as keys, so I save the overhead part of the intern dictionary. For what it's worth my key_ref method works with any objects that can be dictionary keys, not just strings. What are the other ways you say one can do very much the same thing in Python? > > > (3) Has anyone had any success in compiling Python on WinNT 4.0 with > > gcc 2.95.2? It's just fine for making extension modules; I haven't tried > > compiling the whole Python yet. > > I'm working on 1.6a2 now (for Win95, should work for NT too). I've got > the > core to compile and run, but it takes some patches. I haven't got > Tkinter working yet (problems linking the Tcl/Tk libaries, any > suggestions other than building those from source welcome). > If you like, I can send you what I have so far. Hmmm ... thanks but no thanks, I don't have any spare time to work on that at the moment. > > > (4) Has anyone any better ideas for gauging Python memory usage than > > sitting watching the graphical display in WinNT's Task Manager? Might an > > instrumented or instrumentable malloc/free package (like Doug Lea's) that > > permitted implementation of a Python builtin memused() be the way to go, > > or is there a policy of using the standard malloc from the C library on each > > platform? > > As far as I can tell, you can use any malloc package you like; there are > no assumptions other than the C standard. I was happy enough with the idea of having an instrumented malloc in my own Python (when I get around to compiling it with gcc), but was wondering about the possibility of having an instrumented malloc as part of the *standard* Python distribution. > > -- > Niels Diepeveen > Endea automatisering Thanks for your interest & comments, John Machin Sent via Deja.com http://www.deja.com/ Before you buy. From mhammond at skippinet.com.au Mon Apr 3 19:26:09 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 03 Apr 2000 23:26:09 GMT Subject: Python and COM without Automation (Dispatch) References: Message-ID: "Vespe Savikko" wrote in message news:vphd7o7b1vc.fsf at hiirihaukka.cs.tut.fi... > > From the book _Python Programming on Win32_ I gather that I would have > to create a PythonCOM extension DLL and that might even be quite a > simple and possibly automated process (with the help of SWIG and other > tools), but I haven't been able to find any detailed instructions on > the subject. Yes, and unfortunately there are no detailed instructions. These will never become "general tools" - they were written to assist with the work already done, and are obviously free to be used by anyone - but they will never become polished, documented tools. > I haven't walked through the win32com source code yet so if the > necessary information is located somewhere among the source files, you > can ignore this message. I suggest you use SWIG, as it sounds like you only need to call interfaces, not implement them. In this case I would look at the way MAPI is done, and just clone that. You will need the SWIG you should be able to find buried at my starship page... Mark. From ng at hardlight.couk.com Tue Apr 11 07:40:39 2000 From: ng at hardlight.couk.com (.:|:.) Date: Tue, 11 Apr 2000 12:40:39 +0100 Subject: readline skips on line References: <8culp8$23a$1@porthos.nl.uu.net> <38F2EB27.751EFFDD@gmd.de> Message-ID: <38f310b2.0@news.proweb.co.uk> > try this: > > f=open('test.txt', 'r') > > while 1: > line=f.readline() > if not line: > break > print line > > print "ready" while this is functionallty correct I prefer : f=open('text.txt', 'r') line = f.readline() while line: print line line = f.readline() print 'ready' which is actually a few cycles quicker however 1. the print will append and extra carriage return on the end putting blank lines in 2. the data will be lost to the porogram 3. repeated disk reads though buffered will slow your inner loop 4. it looks ugly i'd go for this : f = open('text.txt', 'r') lines = f.readlines() for line in lines: print line[:-1] print 'ready' > > f=open('test.txt', 'r') > > while f.readline()!='': > > print f.readline() > > print 'ready' > > > > but when it is runned, it wil print out the lines in the text file, but it > > skips all the the odd line, it only displays line 2,4,6,8,10 and further From mwh21 at cam.ac.uk Tue Apr 25 13:22:03 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Apr 2000 18:22:03 +0100 Subject: Don't understand error message References: Message-ID: "Lars Lundstedt" writes: > I'm halfway through "Learning Python" and I'm stuck on the example on page > 255. > > It goes like this: > > import sys, glob, operator > print sys.argv[1:] > sys.argv = reduce(operator.add, map(glob.glob, sys.argv)) > print sys.argv[1:] > > When called with "python glob.py *.py" on Win98 I'm supposed to get a list > of all .py files in the current directory but instead I get: > > Traceback (innermost last): > File "glob.py", line 1, in ? > import sys, glob, operator > File "glob.py", line 3, in ? > list = reduce(operator.add, map(glob.glob, '*.py')) > TypeError: call of non-function (type module) > > Anyone know why? "Works here". Is that *really* your *entire* script? You haven't snuck a module called "reduce" in anywhere? Mind you, I'm on Linux - but that's shouldn't really affect this. Cheers, M. -- "declare"? my bogometer indicates that you're really programming in some other language and trying to force Common Lisp into your mindset. this won't work. -- Erik Naggum, comp.lang.lisp From gmcm at hypernet.com Tue Apr 11 15:26:52 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 11 Apr 2000 15:26:52 -0400 Subject: comparing strings and ints In-Reply-To: <20000411134358.A2352304@vislab.epa.gov> References: <2YmI4.366$rc9.188014080@newsb.telia.net> Message-ID: <1256641282-42160637@hypernet.com> Randall Hopper wrote: > Fredrik Lundh: > |which explains that: > | > | Objects of different types always compare unequal, > | and are ordered consistently but arbitrarily. > > Reminds me of qsort() core dumps because the compiled C library compared > NaNs and Infs arbitrarily. > > I can see 45 == '45' being false, and 45 != '45' being true. But it seems > to me that not throwing an exception for attempts at an ordered comparison > with logical ordering operators (<, <=, etc.) on objects of different > primitive types (e.g. 45 < '45', 45 > '45') only lets bugs pass through. > > Is there a case where this could be useful (with its undefined behavior)? > I believe that is the root of the question. I'd happily bet your wife and firstborn child that there's code that relies on it , if only because after sorting a list, all the ints will end up in a clump, and all the strings in another, etc. - Gordon From rms2000 at bellatlantic.net Tue Apr 4 09:17:19 2000 From: rms2000 at bellatlantic.net (Richard M. Smith) Date: Tue, 04 Apr 2000 13:17:19 GMT Subject: Python and .HTA files in IE5 Message-ID: <38E9EBA2.CF62323A@bellatlantic.net> Hello, I am attempting to use Python as a scripting language in a .HTA (HTML Application) file. .HTA files are executed by IE5 just like .HTM files except that there are no secrutiy restrictions on what script code can do. In a .HTA files, scripts can run programs, read and write files, access the Windows registry, etc. They are usefull for developing Windows applications that use IE5 for their user interface. I am having trouble executing the following simple Python script to read the contents of AUTOEXEC.BAT and output it on the .HTA page: I am getting an AttributeError in line 400 of the file dynamic.py. It looks like the __getattr__ method is failing when the readlines method is called by my script code. Anyone know what is going on here and how to fix the proble?. A couple more data points here. If I rename the .HTA file to have the .HTM extension, I get the identical error message. This leads me to believe that the Python runtime library isn't distinguishing between .HTA and .HTM files. OTOH the equivalent .ASP file works fine: Richard From jnw22 at cam.ac.uk Tue Apr 11 10:39:08 2000 From: jnw22 at cam.ac.uk (James "Wez" Weatherall) Date: Tue, 11 Apr 2000 15:39:08 +0100 Subject: Huh? func_defaults, default values in function calls References: <8cv5qj$35p$1@zinc.intern.netconnect.no> <8cv8ra$hio$1@pegasus.csx.cam.ac.uk> Message-ID: <8cvdec$lb8$1@pegasus.csx.cam.ac.uk> > > You won't get this behaviour with something like: > > > > def myfun(x, a = 5): > > a = x > > > > though, I don't think, because "5" isn't mutable. > > footnote: that has nothing to do with mutability. in > the following example, the list isn't modified either: True. A better example might be def myfunc(x, a=[]): print x, a a.append(x) def myfunc2(x, a=0): print x, a a = a + x I suppose. :) -- James "Wez" Weatherall From mwh21 at cam.ac.uk Wed Apr 5 07:42:48 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 05 Apr 2000 12:42:48 +0100 Subject: Getting the argument names passed to a function ? References: <8ce6dm$4vp$1@news.wrc.xerox.com> Message-ID: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) writes: > On 5 Apr 2000 01:55:02 GMT, Mark Jackson wrote: > >But you forget about: > > > >>>> a=1 > >>>> b=a > >>>> arghack(a) > >'a' > >>>> arghack(b) > >'a' > >>>> > > > >Your move. . . :-) > > Hmm. How about: > [snip] Wow. Have you downloaded bytecodehacks yet? Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From phd at phd.russ.ru Sun Apr 9 12:23:34 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Sun, 9 Apr 2000 16:23:34 +0000 (GMT) Subject: tabular data In-Reply-To: <8cq9io$ca0$1@nnrp1.deja.com> Message-ID: On Sun, 9 Apr 2000 poupaerte at my-deja.com wrote: > > nlist = map( lambda x,indices=indices: > > The expression "indices=indices" seems absolutely strange to me. I > don't have a clue of what it could be doing, except for being true at > all times. Seems you are a novice, just doing your first steps in Python! Welcome! :) "indices=indices" is not an expression at all - it is an assignment. The "lambda" constructs a function in the global namespace, and the function doesn't have access to local var "indices". The assignment give such access. > Is there some kind of lengthier tutorial on the lambda construct; it > seems quite an advanced construct not easily to be found elsewhere in > other programming languages, a bit like regexes ... It is from LISP, well-known programming language. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From mjackson at wc.eso.mc.xerox.com Tue Apr 4 21:55:02 2000 From: mjackson at wc.eso.mc.xerox.com (Mark Jackson) Date: 5 Apr 2000 01:55:02 GMT Subject: Getting the argument names passed to a function ? References: Message-ID: <8ce6dm$4vp$1@news.wrc.xerox.com> quinn at riyal.ugcs.caltech.edu (Quinn Dunkan) writes: > > > Hmm, could you say: > > > > > > def arghack(arg): > > > for k, v in globals().items(): > > > if arg is v: > > > return k > > > else: > > > return None > > > > > > Seems to work ok... > > This only works if the argument passed in is a global. For example: > > >>> def hackSpoiler(): > > ... a = 2 > > ... print arghack(a) > > ... > > >>> hackSpoiler() > > None > > Ok, Mr. Spoilsport :) > > import sys > def arghack(arg): > try: > 1/0 > except: > frame = sys.exc_info()[2].tb_frame.f_back > while frame: > for k, v in frame.f_locals.items(): > if arg is v: > return k > frame = frame.f_back > else: > return None But you forget about: >>> a=1 >>> b=a >>> arghack(a) 'a' >>> arghack(b) 'a' >>> Your move. . . :-) -- Mark Jackson - http://www.alumni.caltech.edu/~mjackson An advertiser will happily make you feel bad about yourself if that will make you buy, say, a Bic pen. - George Meyer From pj at sgi.com Thu Apr 6 16:40:08 2000 From: pj at sgi.com (Paul Jackson) Date: 6 Apr 2000 20:40:08 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <000f01bf9eca$2eec8c60$3e2d153f@tim> <38ECF4E6.B85C62D5@sightreader.com> Message-ID: <8cisn8$ogi7$1@fido.engr.sgi.com> Ken Seehof wrote: |> Indeed. I've noticed that while just about everyone |> who I've known who has tried python ends up liking |> it alot, there aren't many fanatics. ... |> |> Perhaps this is partly because python borrows all |> the best stuff from many other languages rather than |> being built around some wild, revolutionary idea. I think it's because Python is too easy. Fanaticism is founded on fear of failure - the extra energy required in the struggle to master (or even get by with) a tool is sometimes expressed as fanatic devotion. -- ======================================================================= I won't rest till it's the best ... Software Production Engineer Paul Jackson (pj at sgi.com; pj at usa.net) 3x1373 http://sam.engr.sgi.com/pj From richard.jones at ibahealthcare.com Wed Apr 19 03:09:01 2000 From: richard.jones at ibahealthcare.com (Richard Jones) Date: Wed, 19 Apr 2000 08:09:01 +0100 Subject: Very Horrible Question About Goto's Message-ID: <6325E90C8B6ED21189080001FA7E2ADA0D4051@IBA1> I'm trying to create a converter from our own internal language (horrid) into python.? My only problem so far is that the original language uses *LOTS* of goto's.? Is there any way that this can be replicated within python ? ? Thanks for any help. ? Richard Jones ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-list at teleo.net Mon Apr 17 10:57:38 2000 From: python-list at teleo.net (Patrick Phalen) Date: Mon, 17 Apr 2000 07:57:38 -0700 Subject: How do I make a constant global variable in Python Please In-Reply-To: References: Message-ID: <00041708033202.00880@quadra.teleo.net> [cmfinlay at magnet.com.au, on Mon, 17 Apr 2000] :: How do I make a constant global variable in Python Please. :: or just a constant. :: or just a global. :: :: I bought a Python Book. however I can't find this info in it. Which book did you buy? A quick look at all the Python books on my shelf shows that this information is available by looking up "global" in the index. Did you try that? I see also that a Google search for "python global" is productive. From tim.hochberg at ieee.org Tue Apr 11 01:43:41 2000 From: tim.hochberg at ieee.org (Tim Hochberg) Date: Tue, 11 Apr 2000 05:43:41 GMT Subject: Filter References: <955427129.619305@neptune.uniserve.ca> Message-ID: "Matthew" wrote in message news:955427129.619305 at neptune.uniserve.ca... > I need to write a filter that inserts tabs between Log values . So that > lines 1 to 3 come out looking something like lines 4 to 6. > I can then open it in Excel as a dat file with the values in different > cells, where i can then use formulas and macros. > The first 9 lines are constants in the header ,but there could be serveral > headers with data in the whole file . > > I'm totaly at square one here. > I have to figure out how to open the file for modification - as a string ? > write a for loop for each line beginning with L11 ? > And a function to insert the white space's between the values. > > > I imagine this to be an ideal task for a small script , but untill i get > there any advice or help appreciated. Maybe the following (untested, use at your own risk, etc) code will get you started and help you refine your question a bit. You will probably wish to improve it at least some -- for instance I think a blank line (bare newline) would cause this to hang. import string def tabbify(infile, outfile): # Read and write the version line outfile.write(infile.readline()) # Read first line line = infile.readline() # Loop till we run out of data while line != "": # No more data to be read (blank lines are "\n"): # Write 8 header lines unchanged for i in range(8): outfile.write(infile.readline()) # Now read lines, converting spaces to tabs till more header lines are reached while 1: # loop forever line = infile.readline() if line == "" or line[0] == "H": # File's empty or we have a new set of headers break line = string.replace(line, " ", "\t") # replace spaces with tabs outfile.write(line) infile = open("somefilename") outfile = open("someotherfilename", 'w') tabbify(infile, outfile) Enjoy, -tim > VER1.5A > "H0:1,45" > "H1:9085,*.* " > "H2:71G,NORTHVIEW DLS, ,MITSUI" > "H3:VANCOUVER,CHILLIWACK" > "H4:00100S,100,SB4,01, , , " > "H5:000330, AH00-93-,SPRUCE, ,N" > "H6:45,126825" > H7:220000 > L11SSSP 503438G 1627 # 1 > L11SSSP 563338G 1826 > L11SSSP 573036G 1924 > L11 SS SP 55 36 40 G 18 28 # 4 > L11 SS SP 51 40 46 G 17 31 > L11 SS SP 57 30 37 H 19 24 > etcXXXXXXXXXXXXXXXXXXXXXXX > "H9:1,45" > > > From jae at ilk.de Mon Apr 24 17:49:58 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Mon, 24 Apr 2000 23:49:58 +0200 Subject: The Simple Economics of Open Source In-Reply-To: <8du1in$hth$1@slb7.atl.mindspring.net> (dalke@acm.org) References: <14591.15630.192472.440375@goon.cnri.reston.va.us><3900611F.3B525BDA@cfdrc.com> <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7@lp.airnews.net> <8du1in$hth$1@slb7.atl.mindspring.net> Message-ID: <24042000.2@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Andrew" == Andrew Dalke writes: [...] Andrew> I'm walking down the street and there is a hole in my Andrew> front pocket. I keep money in that pocket. I have a hand Andrew> in that pocket because it's cold, and I'm jostling the Andrew> money. As I pass a beggar, some money falls out through Andrew> the hole. It is altruistic or an accident? The only way Andrew> to find out is to ask me, and I can lie, so there's no Andrew> observational way to tell the difference. Thus, I Andrew> considered the definition of "altruistic", when used in Andrew> this extreme case, to be useless. *You* still know what it was... and that is ultimately what counts. If a tree falls in the forrest and no-one is there to witness it, did it still fall? Of course it did. And of course you know whether it was an accident or intentional. We're talking motivation here... Bye, J - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://members.tripod.com/Juergen_Erhard "Outside of a dog, a man's best friend is a book; inside of a dog, it's very dark." -- Groucho Marx -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkEwYMACgkQN0B+CS56qs2lLQCggwBbErYOqv/rDoKw7BmlkLXt XIUAnjUZMaYjyd6yVv7k9e6hNJ5aMAmM =tCAq -----END PGP SIGNATURE----- From mbel44 at dial.pipex.net Fri Apr 28 04:05:05 2000 From: mbel44 at dial.pipex.net (Toby Dickenson) Date: Fri, 28 Apr 2000 09:05:05 +0100 Subject: Need help with COMObject for Zope References: <8e7jeo$s8c$1@nnrp1.deja.com> <0EA44467D272A9D6.326DFBDD03E0FA2F.F1D433246D3DFD31@lp.airnews.net> Message-ID: tseaver at starbase.neosoft.com (Tres Seaver) wrote: >>Add the 2 lines: >>import pythoncom >>pythoncom.CoInitialize() NOOOoooooooo....... >>before your code, and it will almost certainly work. >> >>The Zope guys should document this fairly well. Note that Zope is almost >>certainly initializing COM on a different thread than your code is being >>called on (hence you see this message) - but there are some serious >>implications with COM and threading. Yes, this is definitely a problem. Zope products can't always play by the apartment threading rules, therefore you _must_ call CoInitializeEx(COINIT_MULTITHREADED). >I dont believe you will hit them here, but someone will sometime :-) > >We have a bug in the Collector on the COMObject project for this issue: > > http://classic.zope.org:8080/Collector/842/view > >The bug page has three distinct workarounds: one is essentially what >Mark posted (it has some ugly issues, but will work, slowly, for most code); ^^^^^^^^^ >one requires hooking the thread creation to perform the CoInitialize() then; ....and works for all code ;-) Toby Dickenson tdickenson at geminidataloggers.com From philipp.jocham at salomon.at Fri Apr 21 05:19:37 2000 From: philipp.jocham at salomon.at (philipp.jocham at salomon.at) Date: Fri, 21 Apr 2000 09:19:37 GMT Subject: Python 1.5.2 on HP-UX 11.00 Message-ID: If tried to compile the pyton interpreter on HP-UX 11.00 with the bundled c-compiler. Boldly I added both readline(Modules/Setup) and thread support. ./configure --with-thread ./make Everything worked without problems, but when I tried to run some tests, the executable couldn't be started because of undefined symbols ( mutex something). Further investigation showed that the configure process found the pthread_create() function in the 'cma' library. Looking in pthread.h revealed that pthread_create() was defined there as a static inline function just calling __pthread_create_system() Now I tricked configure, by editing configure.cache (just change the yes/no flags at the appropriate tests) rerun the configure/make process and the interpreter conducts all tests without error. Sorry that I don't supply a patch for configure.in (with a test for __pthread_create_system()), but I'm not sure if this the correct way to handle this problem. Bye, Philipp -- Philipp Jocham SALOMON AUTOMATION GmbH Friesacherstr. 15 mailto: philipp.jocham at salomon.at A-8114 Friesach bei Stuebing From boud at rempt.xs4all.nl Tue Apr 18 01:45:42 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 18 Apr 2000 05:45:42 GMT Subject: Scripting and Gnome and KDE References: <8d95m0$9j6$1@news1.xs4all.nl> <8damat$4ja$1@slb2.atl.mindspring.net> <8dbsgc$35o$1@news1.xs4all.nl> <38FB4336.2BC6C235@bioreason.com> <8dftlp$3s1$1@news1.xs4all.nl> Message-ID: <8dgsq6$a21$1@news1.xs4all.nl> ben at co.and.co wrote: > Layout managment was a relief after some MFC experience, and when I made > the mistake of choosing a 22pt default font in licq (Qt plugin), I > started seeing the merits of it. But then again, I'm not a seasoned Qt > developper. I can imagine with that background ;-). I've spent some time on layout management in Visual Basic, until I discovered the various third party controls that automate it, so I feel with you. Of course, Qt offers a lot of possibilities in layout management. There's even a graphical gui designer, qtArchitect, that lets you design dialogs with layout management. > After reading the tutorial on http://wwww.valdyas.org (hope I get it > right), I wondered how much PyQt and PyGtk resembled each other. > IMVVHO, a general purpose signal/slot-mechanism would be nice addition > to pyton. The resemblance isn't even skin-deep, I feel, not even when you discount signals/slots. At least, I feel that knowing my way about in PyQt doesn't really help me reading PyGTK (or tkInter) code. wxPython looks more like PyQt, I think. > There's still a huge problem with the various licences, as they don't > really match Python's license. Yes... We asked Troll for a free copy of Qt for Windows, in order to produce a binary distribution of PyQt (it's an app - not every developer needs the developers licence of Qt...), but they firmly remained silent. And that's only the most obvious of the problems ;-(. GPL, and even the LGLP, aren't as free as Python either. -- Boudewijn Rempt | http://www.valdyas.org -- Boudewijn Rempt | http://www.valdyas.org From dalke at acm.org Thu Apr 6 07:47:13 2000 From: dalke at acm.org (Andrew Dalke) Date: Thu, 6 Apr 2000 05:47:13 -0600 Subject: UserDict's has_key() and get() should use __getitem__() References: <0535db98.ec878f67@usw-ex0101-005.remarq.com> <29328840.06b5b87b@usw-ex0101-005.remarq.com> <8cgdp3$nm5$1@slb6.atl.mindspring.net> <0aa264d3.021266df@usw-ex0101-005.remarq.com> Message-ID: <8chta6$aam$1@slb6.atl.mindspring.net> > * Do we know how much less efficient? Take a look at Barry Warsaw's paper at http://www.python.org/~bwarsaw/ecshort.pdf . The answer is a question - will the lookup mostly fail or mostly succeed? ] This indicates that the has_key() idiom is usually the best ] one to choose, both because it is usually faster than the ] exception idiom, and because its costs are less variable. ] However, it does indicate that a common pattern that, for ] example, uses dictionaries to count events may be better off ] using the exception idiom, since it is likely that the key ] will be missing from the dictionary only once. For what you're proposing, there's another method lookup (since has_key() turns around to call self.__getitem__(key) ) which makes your proposal even slower than those numbers. Andrew dalke at acm.org From abrahams at mediaone.net Sun Apr 30 14:00:03 2000 From: abrahams at mediaone.net (Dave Abrahams) Date: Sun, 30 Apr 2000 18:00:03 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8ecsgj$6lp$1@slb0.atl.mindspring.net> <300420001008012011%pecora@anvil.nrl.navy.mil><20000430170952.A502@datapro.co.za> Message-ID: in article 20000430170952.A502 at datapro.co.za, Steve Crane at craniac at datapro.co.za wrote on 4/30/00 10:09 AM: > However if > you're writing a program yourself and don't think that anyone else will > ever have to read the code you can probably steer clear of Hungarian > Notation in either form. Alternatively, if you're writing a large program with many abstractions and think lots of other people will have to read it steer clear of Hungarian Notation in either form ;) Hungarian breaks abstraction by tying the interface of an object to its implementation, and seems utterly antithetical to the generic nature of coding in Python. Who cares if it's a dict or a UserDict, or some other object which models the appropriate mapping semantics? flame-baiting-ly y'rs, dave From banderson at boi.hp.com Fri Apr 14 15:47:59 2000 From: banderson at boi.hp.com (Bill Anderson) Date: Fri, 14 Apr 2000 13:47:59 -0600 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> Message-ID: <38F775EF.3256705B@boi.hp.com> tom__98 at my-deja.com wrote: > > In article <200004102111.HAA03380 at envy.fulcrum.com.au>, > Richard.Jones at fulcrum.com.au wrote: > > Tom you little troll-meister. Half those arguments > > you cite are bollocks if you _really_ knew and > > "greatly prefer" Python. Try again. > > Maybe you can contribute more constructively: > > -- How can I browse the Python documentation without firing > up a web browser? How do I get information on a single Python > function or class quickly? Is there any equivalent of > "perldoc -f split" or "perldoc Net::POP3"? What do you > do in that situation? A) The docs are available in more than html (see the site) B) load the interpreter, and print the doc string: >>> import os >>> print os.link.__doc__ link(src, dst) -> None Create a hard link to a file. >>> > -- Is there a Python equivalent of CPAN and the Perl CPAN > module? The closest I know of is Parnassus. But Parnassus > is merely a collection of links, not an archive, and it > doesn't have any facilities (AFAIK) for automatic installation. CPAN is IME, highly overrated. > > -- Several extensions I have wanted to install have required access > to the full Python source tree, not just the header files and > the library. Is that going to change? Otherwise, how can I've had perl extensions like that. Ask the author of the particular extension. > I install Python extensions that want access to the source > tree on, say, a standard RedHat system? Having the standard > RPM-based installation in parallel with a /usr/local installation > from source is confusing, and removing the RPM-based installation > risks breaking things. For the compiling modules: ./configure --prefix=/usr -- Bill Anderson Linux/Unix Administrator, Security Analyst ESBU (ARC) bill_anderson at boi.hp.com My opinions are just that; _my_ opinions. From shapr at uab.edu Fri Apr 28 09:15:28 2000 From: shapr at uab.edu (Shae Erisson) Date: Fri, 28 Apr 2000 13:15:28 GMT Subject: soaplib??? References: <8ebud1$jk4$1@nnrp1.deja.com> Message-ID: <39099193.C8A6068D@uab.edu> tiddlerdeja at my-deja.com wrote: > > Is anyone working on a soaplib? yes: http://casbah.org/Scarab/ The actual (incomplete?) code can be seen/acquired from their cvsweb: http://casbah.org/cgi-bin/cvsweb.cgi/Scarab/python/ -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre Heard about the Indian Tailor? He's named Dances With Gloves. From quinn at zloty.ugcs.caltech.edu Wed Apr 12 16:19:34 2000 From: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) Date: 12 Apr 2000 20:19:34 GMT Subject: modifying os.environ Message-ID: Is there any way to delete things from the environment in python? A look at os.py reveals that _Environ only overrides __setitem__ to putenv. So how do you *delete* environment values? perl does it, and a look at the source seems to indicate that it doodles with the C environ directly. So perhaps python needs a delenv _Environ can use or something, or implement os.environ in C? Or perhaps there's a better way to do the (common) thing I'm trying to do: clean the environment to insure some minimum sane values. I can't make a copy of the environ and then pass to execve() since that doesn't help much for popen and system. I can set values to '', but that doesn't seem as safe as just removing them entirely (IFS, LD_LIBRARY_PATH, etc.?) From embed at geocities.com Wed Apr 5 12:56:11 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 5 Apr 2000 11:56:11 -0500 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> Message-ID: > Here's my theory, which is my own: It all depends on syntax. Perl's is > so nasty that its newbies *need* the books to make any use of it. > Python's is so clean that the occasional online nudge is sufficient. As per Occam's Razor, I offer you a Simpler Explanation: Perl has merely been around longer. More books doesn't mean anything. One LISP-lover wrote something to this effect in a magazine editorial a few years back. I can only broadly paraphrase what he said: << C++ is too complicated. It's badly oversold and poorly designed, and it requires reams and reams of books to explain to someone how to create something useful with it, without falling into the thousands of pitfalls that come up along the way. People then see the reams of C++ documentation and say "Gee, that's a really popular and well documented language" and so they decide to use it. >> I disagree with *some* the above bracketed text, primarily, because it Smacks of Bitterness, but I think that most people admit that a language requires different kinds of documentation. I think the provided Python documents are useful, practical, and minimal. Exactly the sort that should come with Python. What I would like to find is an introduction to the Art of Programming, in Python. No language, Python, Smalltalk, etc, is so easy to understand that it requires no documentation. You see, Python will rise, and one day fall, but the skill of programming, the ideas that went into the design of Python are themselves timeless. These are the things which must be placed into a Sacred Codex and never forgotten! At least Perl programmers seem to admit that Perl grew from a rich and quirky set of Unix command line tools. If you know bash, awk, grep, etc, then you can see where Perl is coming from. In Larry Wall's own words, it's 'Postmodern'. I would say instead, "chaotic and byzantine". No apologies are offered. Perhaps I will attempt to write my own version of the Art of Programming, Python Style. You see, I have this idea of 'elegance' in my head which Python satisfies, but I haven't found a book that really captures that. I have read a few (4), and none really do justice to the Art side. Remember the famous 'Smalltalk-80 - The Language and Implementation' purple-book? The Python texts I've read are good References to Getting Stuff Done, but they Don't Teach the Art. Speaking of Dummies, was there/is there a LISP for Dummies, or Smalltalk for Dummies? Can Python for Dummies be far off? Warren From mvanier at endor.bbb.caltech.edu Thu Apr 6 17:38:24 2000 From: mvanier at endor.bbb.caltech.edu (Michael Vanier) Date: 06 Apr 2000 14:38:24 -0700 Subject: favorable media attention :-) Message-ID: Hey everyone, check out the April 6th Doctor Fun cartoon, currently at: http://metalab.unc.edu/Dave/Dr-Fun/latest.jpg You'll be glad you did ;-) BTW IMO Doctor Fun is the funniest cartoon around these days; it reminds me of the Far Side at its peak. Mike -------------------------------------------------------------- Mike Vanier mvanier at bbb.caltech.edu Department of Computation and Neural Systems, Caltech 216-76 GNU/Linux: We can't lose; we're on a mission from God. From scarblac-spamtrap at pino.selwerd.nl Thu Apr 27 17:28:42 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 27 Apr 2000 21:28:42 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> Message-ID: Louis M. Pecora wrote in comp.lang.python: > I am two weeks plus into learning Python and have started on a first > real project. Amazing language. BUT, now that I've gotten going with > classes, I'm finding I hate seeing all those "self." prefixes on the > class variables. Python is generally very clean, but the classes I > write use a lot of "per-instance" variables, hence seem to require > self. As a result the expressions can become cluttered and harder to > read than C++ in this particular case -- imagine that! Is there any > relief here? Any (simple) way around writing that self. every time? No. However, this seems to make code *more* readable. In fact, many C++ programmers use 'this.x' for all their instance variables, to be able to see at a glance which are just local variables of the function and which are instance variables. It's just more work to write, but that doesn't matter much. Python needs it to know which vars are instance variables, and which are local variables. Funny how people say that every aspect of Python they don't like make the language less "clean". It is extremely consistent though. You *can* use another word for 'self' though, 's' or 'me' or something. But it makes your code harder to read, of course... -- Remco Gerlich, scarblac at pino.selwerd.nl Hi! I'm a .sig virus! Join the fun and copy me into yours! From dalke at acm.org Fri Apr 7 04:55:12 2000 From: dalke at acm.org (Andrew Dalke) Date: Fri, 7 Apr 2000 02:55:12 -0600 Subject: "tostring" as a string method? References: <8c45ue$b7u$1@slb1.atl.mindspring.net> Message-ID: <8ck7kq$1cu$1@slb3.atl.mindspring.net> Warren Postma said: > Why not write str(dna) and overload __str__ where necessary? > class myClass: > def __init__(self,value='something'): > self.value ='something' > def __str__(self): > return self.value > > myObject = myClass() What I am looking for is a way to have the "value" be a string or an array.array or even a Numeric.array. The solution you have only works for strings. Adding a "tostring()" method to strings would let me have a def __str__(self): return self.value.tostring() /F pointed out the buffer interface, which is the route I'm going to look at - I'm only using strings now because it turns out building up a [] and string.join'ing them is faster than using an array.array. (Though I have ways to make arrays be faster.) Meanwhile, on the biopthon.org list, Jeff Chang pointed out that __str__ is in general an ill-defined quantity. The usual interpretation is that __str__ returns a human-representation while __repr__ returns a computer representation. So using __str__ to return the character stream is not the right interface. We're now using "tostring()", which is more obvious. Andrew dalke at acm.org From paul.magwene at yale.edu Wed Apr 12 17:57:54 2000 From: paul.magwene at yale.edu (Paul Magwene) Date: Wed, 12 Apr 2000 17:57:54 -0400 Subject: scrolledListBox problem References: <38F4CE3C.3D6E7A68@mitre.org> Message-ID: <38F4F162.B2B033FC@yale.edu> Pete wrote: > > I am using makeing a GUI that contains 2 scrolledListBoxes, and I have > come across something unfortunate. When I select an item in one list, > the currently selected item in the other list becomes deselected, so > only one list can have an item selected at any point in time. Is this a > bug in PMW? Any ideas as to how to fix this? This is a Tkinter thing. By default the selection in a Listbox widget is also the X selection, and selecting something outside the listbox deselects it. You need to set the exportselection option to zero to get the behavior you want. For example, ---------------------- Pure Tkinter solution: ---------------------- from Tkinter import * root = Tk() sl1 = Listbox(root,exportselection=0) sl1.insert(END,'bob') sl1.insert(END,'fred') sl2 = Listbox(root,exportselection=0) sl2.insert(END,'mary') sl2.insert(END,'jane') sl1.pack() sl2.pack() root.mainloop() ----------------------- Pmw solution ----------------------- from Tkinter import * import Pmw root = Pmw.initialise() sl1 = Pmw.ScrolledListBox(root,items=('bob','fred','mary'), listbox_exportselection=0) sl2 = Pmw.ScrolledListBox(root,items=('jim','john','bob'), listbox_exportselection=0) sl1.pack() sl2.pack() root.mainloop() -- Paul Magwene paul.magwene at yale.edu From mwh21 at cam.ac.uk Wed Apr 12 05:30:57 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 12 Apr 2000 10:30:57 +0100 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> <874s9766r6.fsf@ifm.uni-kiel.de> Message-ID: Janko Hauser writes: > I think this will do it > > class lazy: > def __init__(self, name): > self.name = name > > def fired(self): > print 'You are fired %s' % self.name > > class paul(lazy): > def __init__(self, name): > self.name = name # <---- ????? > self.april_pay = 0 > > def fired(self): > print "Here's a box, collect the things from your desk" > self.__class__.__bases__[0].fired(self) Nononono; think about what happens if you do this: class bob(paul): pass bob("adam").fired() What *I* think you want is: class paul(lazy): def __init__(self, name): lazy.__init__(self,name) self.april_pay = 0 def fired(self): print "Here's a box, collect the things from your desk" lazy.fired(self) After all, if you're going to inherit from a class, you must have access to it, right? another option is: class paul(lazy): super = lazy def __init__(self, name): self.super.__init__(self,name) self.april_pay = 0 def fired(self): print "Here's a box, collect the things from your desk" self.super.fired(self) Though this has problems with repeated & multiple inheritance. Cheers, M. -- "declare"? my bogometer indicates that you're really programming in some other language and trying to force Common Lisp into your mindset. this won't work. -- Erik Naggum, comp.lang.lisp From embed at geocities.com Wed Apr 19 10:25:05 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 19 Apr 2000 10:25:05 -0400 Subject: __del__ problem - more details provided. still stumped though. References: Message-ID: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> Okay, more details, since i've obviously oversimplified the previous attempt at explaining the problem. I have four modules here, all used in an embedded Python application on Windows (using static linking, not the python15.dll, because this is a deeply embedded system with no DLLs on the target CPU). ztrdb.py - this is my "application specifics" module, containing a basic "data definition" of the tables used in my database layer. lwdb.py - lightweight database class (lwdb_base) and some inherited classes that implement various data storage techniques, from a simple "pickle rows to a text file" to various techniques that rely on the BSDDB 2.0's hash and btree file storage. Basically, I wanted to separate the Instances of Tables that were application specific, from my generic and hopefully reusable data-handling-classes. I also wanted lwdb.py to track ALL instances of tables created from ANY class defined in lwdb.py. In other words, I wanted to be able to do operations on all tables (such as closing all tables at once, or flushing changes to disk on all tables at once). So, in lwdb.py: lwdb_tables = {} class lwdb_base: def __init__(self,tablename,description, row_class_obj, filename) global lwdb_tables # rest of constructor snipped because it's not important here lwdb_tables[tablename] = self Next, for reasons which are still not clear even to me, I built ztrdb.py, which was my own instances. It did things like this: table1 = lwdb.lwdb_base("tablename","a description", table1rowclassobj, "tablename.txt") Now because the Object reference was stored to both lwdb_tables (a strong reference) and table1 also a strong reference) and there is no easy way to make a weak-reference, there were now TWO reference counts to each table object. The problem I was having was that at shutdown I was getting this exception, emitted somewhere from the bowels of the BSD Database layer 2.0 module (written by Robin Dunn, and as far as I know it has been reliable, yet it is complex enough that if it *was* having a problem, I wouldn't have the foggiest idea how to fix it.). Here is the text of the exception, which occurs when the module lwdb is being destroyed, and the lwdb_tables dictionary, and the table objects it contains are finally going out of scope: Exception except.AttributeError: "'None' object has no attribute 'time'" in ignored Exception except.AttributeError: "'None' object has no attribute 'delete_DB'" in ignored Exception except.AttributeError: "'None' object has no attribute 'time'" in ignored In this case I have figured out the following: 1. this message indicates that errors during __del__ are masked, so that the destructor can finish cleaning up. 2. there is one lwdb_base object being destroyed and two lwdb_hash objects (a subclass of lwdb_base that uses a BSDDB hash file for storage). I have figured out a workaround, but can't figure out why it works: 1. Don't keep the reference count of the table objects at 2, so you may only have ONE reference to it. Here's how I did it: # in ztrdb.py # the lwdb.lwdb_tables dictionary now has a refcount of 2 #but the contents are still at refcount of 1 tables = lwdb.lwdb_tables # at the beginning of shutting the system down, before anything # else shuts down, we delete the table objects: def call_me_at_shutdown(): del lwdb.lwdb_tables tables=None Also, in the lwdb_base.__del__ method I inserted a print statement so I could see when __del__ got called. If All table Objects __del__ methods are called before my C program reaches the Py_Finalize() call in my C program, then everything is fine. If however the modules are left to clean up things in their own preferred orders inside Py_Finalize, I get those errors above. I found where those errors are originating from, too, but I'm still no closer to understanding this. The file db.py, which is included with Robin Dunn's BSDDB 2.0 package for python, includes this definition: class DBPtr : def __init__(self,this): self.this = this self.thisown = 0 def __del__(self): if self.thisown == 1 : dbc.delete_DB(self.this) # appears some exceptions being raised here. # rest of class DBPtr snipped That still leaves the two messages regarding unknown attribute named "time". the only reference to time in my modules is calls to time.time() in a function that could be called in the destructor of the table objects, while updating the table headers one last time before closing the file. Is it possible that the stuff added to our namespace by the "import time" function has already been deleted before the objects in the module are deleted? Shouldn't all instances of objects be deleted before the global namespace of a module gets trashed? What gives? Any help sorting these mysteries out would be greatly appreciated. The code itself is about 10k, perhaps too large to attach here, but certainly small enough to send to anyone. If it's possibly a fault with the bsddb 2.0 I'd like to help find it and fix it if I can, and give Robin Dunn a patch. Unfortunately, I'm stumped! Warren From dalke at acm.org Fri Apr 7 09:32:54 2000 From: dalke at acm.org (Andrew Dalke) Date: Fri, 7 Apr 2000 07:32:54 -0600 Subject: [Python-Dev] Round Bug in Python 1.6? References: <38ED0016.E1C4A26C@tismer.com> <200004062130.RAA26273@eric.cnri.reston.va.us> <20000407084914.A13606@mems-exchange.org> Message-ID: <8cknsa$1r4$1@slb6.atl.mindspring.net> Greg Ward exclaimed: >Oh, joy! oh happiness! someday soon, I may be able to type >"blah.__doc__" at the interactive prompt and get a readable result! I agree. I write __str__ to be human readable, while __repr__ is more mean to be used in evals. I have code which looks like: def __repr__(self): return "%s(%s, %s)" % (self.__class__.__name__, repr(self.data), repr(self.alphabet)) def __str__(self): if len(self.data) > 60: s = repr(self.data[:60] + " ...") else: s = repr(self.data) return "%s(%s, %s)" % (self.__class__.__name__, s, repr(self.alphabet)) The size of self.data could be megabytes, and I don't want that scrolling line after line up the screen when in interactive mode. I would much rather have the __str__ version which only shows the first 60 characters. Andrew dalke at acm.org From kcazabon at home.com Sat Apr 15 01:48:31 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Sat, 15 Apr 2000 05:48:31 GMT Subject: problem with os.system calls under win32 References: <1256392132-57146878@hypernet.com> <8d7o4d$c8h1@imsp212.netvigator.com> Message-ID: If you want it to be even more bullet-proof, use the Win32 call for GetShortPathName, and don't worry about it. >>> import win32api >>> print win32api.GetShortPathName('c:\\f o o\\bar.exe') c:\FOO~1\BAR.EXE q:] Kevin. "Gresh" wrote in message news:8d7o4d$c8h1 at imsp212.netvigator.com... > Actually I was trying a similar thing, and decided to be smart and use > os.path.join > but this is what happened: > > >>> import os > >>> os.system(os.path.join("D:","My Documents","test.bat")) > 'D:\My' is not recognized as an internal or external command, > operable program or batch file. > 1 > > However: > >>> os.path.exists(os.path.join("D:","My Documents","test.bat")) > 1 > > That's a bit confusing ! > > Of course from Gordon's example: > >>> os.system('"%s"' % (os.path.join("D:","My Documents","test.bat"))) > 0 > > works > > Regards, > Paul > > > "Gordon McMillan" wrote in message > news:1256392132-57146878 at hypernet.com... > > william_93402 at my-deja.com wrote: > > > > > I am attempting to do a system call in a directory with spaces in the > > > name. For example: > > > > > > >>>import os > > > >>>os.system('c:\\f o o\\bar.exe') > > > 1 > > > > > > when I place the executable in a dir such as c:\\foo I can successfully > > > execute the system call. Is there something special I have to do when > > > directory names contain spaces? Just for notes I am running by example > > > in build 125 of pythonwin. > > > > Follow MS's rules: > > os.system('"c:\\f o o\\bar.exe"') > > > > (must be double-quotes). > > > > - Gordon > > > > From tseaver at starbase.neosoft.com Wed Apr 26 23:08:15 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 26 Apr 2000 22:08:15 -0500 Subject: Need help with COMObject for Zope References: <8e7jeo$s8c$1@nnrp1.deja.com> Message-ID: <0EA44467D272A9D6.326DFBDD03E0FA2F.F1D433246D3DFD31@lp.airnews.net> In article , Mark Hammond wrote: > wrote in message >news:8e7jeo$s8c$1 at nnrp1.deja.com... > >> I created a COMObject with id = word and Dispatch >> = "Word.Application". WHen I try to connect this >> COM object, it raises the following exception >> Error Type: com_error >> Error Value: (-2147221008, 'CoInitialize has not >> been called.', None, None) > >Add the 2 lines: >import pythoncom >pythoncom.CoInitialize() > >before your code, and it will almost certainly work. > >The Zope guys should document this fairly well. Note that Zope is almost >certainly initializing COM on a different thread than your code is being >called on (hence you see this message) - but there are some serious >implications with COM and threading. I dont believe you will hit them >here, but someone will sometime :-) We have a bug in the Collector on the COMObject project for this issue: http://classic.zope.org:8080/Collector/842/view The bug page has three distinct workarounds: one is essentially what Mark posted (it has some ugly issues, but will work, slowly, for most code); one requires hooking the thread creation to perform the CoInitialize() then; the third makes use of a "pseudo-thread-local" table to track whether CoInitialize() has been called for the current thread yet. I favor the third, myself, as it can be done without modifying Zope to support an unsupported product. Take-the-COMObject-product....PLEASE!'ly Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at digicool.com http://www.zope.org Digital Creations From infonuovo at email.com Wed Apr 5 00:17:06 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Tue, 4 Apr 2000 21:17:06 -0700 Subject: APL Characters in Unicode In-Reply-To: Message-ID: Character codes for the APL characters are in Unicode Standard Version 3.0. They are on the U+2300 - U+23FF code page. Their names are such things as APL FUNCTIONAL SYMBOL IOTA, APL FUNCTIONAL SYMBOL ZILDE, etc. They don't have all of APL glyphs as unique Unicode APL characters. There is APL FUNCTIONAL SYMBOL EPSILON UNDERBAR, but it is apparently not necessary to have APL FUNCTIONAL SYMBOL EPSILON separate from some other code such as SMALL ELEMENT OF, which is closer to the APL epsilon than the GREEK SMALL LETTER EPSILON in terms of the glyphs used in the book. (Messy, messy.) I found this in a Borders Books & Music all by itself in the midst of the computer books. The Unicode Consortium. "The Unicode Standard: Version 3.0" Addison-Wesley Longman (Reading, MA: 1991-2000). ISBN 0-201-61633-5. There are over 49,000 assigned character codes. The assigned characters are assigned to 16-bit codes. There are extensions devices for using paired code values in UTF-16, but no assignments have been made for any of those. I always thought quine corners were Quine corners, but I guess not. (This is like getting lost in a dictionary. What does quincuncial mean anyhow?) -- Dennis -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Fran?ois Pinard Sent: Tuesday, April 04, 2000 15:09 To: Samuel A. Falvo II Cc: python-list at python.org; python-list at python.org Subject: Re: blessed be Guido, for "5 <= X <= 10" does what it should... kc5tja at garnet.armored.net (Samuel A. Falvo II) writes: > Astonishingly enough, it is. Or so I've been told. Not sure where or how > to verify this, though, as I've never used APL. It's part of their 32-bit > character set. Unicode is more waving around 16 bits, aiming 20 maybe, and having 31 as ultimate maximum. They never had 32 bits in their plan, so far that I know. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard -- http://www.python.org/mailman/listinfo/python-list From ivanlan at callware.com Wed Apr 19 18:26:51 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 19 Apr 2000 16:26:51 -0600 Subject: Browse dialog in PythonWin Message-ID: <38FE32AB.520C1736@callware.com> Hi All-- OK, I've been able to get my dialogs up and even install handlers for button clicks, but now I need to start up a browse dialog that lets users choose directories. And is there any news on Mark Hammond's Starship page? -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From dworkin at ccs.neu.edu Tue Apr 25 19:47:37 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 25 Apr 2000 19:47:37 -0400 Subject: The Simple Economics of Open Source In-Reply-To: marc@oscar.noc.cv.net's message of "Tue, 25 Apr 2000 14:32:02 GMT" References: Message-ID: marc at oscar.noc.cv.net (Marc Spitzer) writes: > this sounds like a religious argument, be carful when you > show evadence that contradicts the 1 true faith. Hm? I was merely pointing out an obvious factual error. -Justin From PClaerhout at CREO.BE Wed Apr 26 10:11:21 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 26 Apr 2000 16:11:21 +0200 Subject: VIM NT +python Message-ID: <2B1262E83448D211AE4B00A0C9D61B03011152BA@MSGEURO1> If you download VIM 5.6, unzipped it and ran install.exe, you can choose to turn on syntax highlighting. Once you did this, the _vimrc file is created with (python) syntax highlighting turned on. Pieter -----Original Message----- From: Mike Steed [mailto:MSteed at altiris.com] Sent: Tuesday, April 25, 2000 11:01 AM To: python-list at python.org Subject: RE: VIM NT +python Hi, I just built the latest version (5.6.69) with the default feature set, plus the Python interface. I have not tested it beyond :python print 'hi' which passed with flying colors. http://athani.pair.com/msteed/vim/gvim56py.zip M. > From: Me [mailto:me at nospam.edu] > Sent: Tuesday, April 25, 2000 11:27 AM > To: python-list at python.org > Subject: Re: VIM NT +python > > > So would I! > > wrote in message > news:8e4j27$hgq$1 at nnrp1.deja.com... > > Does anyone here have a winNT build of the VIM editor that > has python > > support switched on? > > > > I'd love to get my hands on a copy. > > > > > > Sent via Deja.com http://www.deja.com/ > > Before you buy. -- http://www.python.org/mailman/listinfo/python-list From markus.oberhumer at jk.uni-linz.ac.at Tue Apr 18 14:18:44 2000 From: markus.oberhumer at jk.uni-linz.ac.at (Markus F.X.J. Oberhumer) Date: Tue, 18 Apr 2000 20:18:44 +0200 Subject: [ANNOUNCE] PySol 4.10 - a solitaire game collection Message-ID: <20000418201844.A9959@laetitia.oberhumer.com> -----BEGIN PGP SIGNED MESSAGE----- PySol - a Solitaire Game Collection Version 4.10 http://pysol.tsx.org Copyright (C) 1998, 1999, 2000 Markus F.X.J. Oberhumer What is PySol ? =============== PySol is an exciting collection of 273 solitaire games. Among the supported games are classics like Aces Up, Baker's Game, Canfield, FreeCell, Forty Thieves, Golf, Klondike, Monte Carlo, Osmosis, Pyramid, Scorpion, Spider, Yukon, and many more... PySol may be freely distributed under the terms of the GNU GPL. PySol aims to be Commercial Quality Freeware. Why yet another solitaire game ? ================================ Here are some highlights of PySol: - freely available - currently supports 273 (!) distinct solitaire variants - lots of classic games like Forty Thieves, FreeCell, Klondike and Spider - special games like Hanafuda, Mahjongg, Poker and Tarot type games - based upon an extensible solitaire engine - very nice look and feel including multiple cardsets and background table tiles - sound samples and background music - unlimited undo & redo - load & save games - player statistics and log files - hint system and demo games - support for user written plug-ins - add your own solitaire variants - integrated HTML help browser - lots of documentation - fully portable across Unix/X11, Windows 95/98/2000/NT and MacOS - distributed under the GNU GPL with full source code - written in 100% pure Python - just run it - no need to compile anything Nice. And what's new ? ====================== * completely new Mahjongg game driver * fixed a bad memory leak (when will there finally be a real garbage collector in Python ???) Cool. Where can I get it ? ========================== Point your browser to http://pysol.tsx.org The PySol Gallery is awaiting your visit as well. What do I need to start playing ? ================================= PySol requires Python 1.5.2 and Tcl/Tk 8.0.5. Both packages are freely available for Unix, Windows 95/98/NT and Macintosh. BTW, there is no need to compile anything since the whole program is just a Python script. Just run it, and that's all. The Windows version ships as a completely self-contained setup file. License terms ============= PySol is Copyright (C) 1998, 1999, 2000 Markus Franz Xaver Johannes Oberhumer PySol is distributed under the terms of the GNU General Public License (GPL). See the file COPYING. Have fun, Markus http://pysol.tsx.org -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: noconv iQCVAwUBOPyg7W10fyLu8beJAQHN9wP/XpBKnGuQzQO9zxYP1zkeCb6Nwxj8lf51 1UnpB8yNgYzstc0j45s0Ay8GrTVnGqwQvdale4cMfbMqTK7IWu1kV5KgBdeT5rne TF6yCAEx7Yl9YEL3HctUR3floUyOPJXsPoEgKrVsp+AFUVwtypvtXIWwSGgDDgsb w4OX2mXQPiw= =IDJ9 -----END PGP SIGNATURE----- From maybe at lucky.com Wed Apr 12 09:35:21 2000 From: maybe at lucky.com (Soundwave) Date: Wed, 12 Apr 2000 15:35:21 +0200 Subject: making a .exe Message-ID: <8d1u0u$ikb$1@porthos.nl.uu.net> How can I make an executable file from the *.py files ? thanx From rupole at compaq.net Sat Apr 15 10:29:13 2000 From: rupole at compaq.net (Roger Upole) Date: Sat, 15 Apr 2000 14:29:13 GMT Subject: Change NT password with Python References: <38F69231.EE1D9B6D@hotmail.com> Message-ID: You can use cgi.FieldStorage to get the old passwd, new passwd and passwd confirmation off the web page, and use win32net.NetUserChangePassword to perform the required action. Roger Upole "Nguyen Anh Quynh" wrote in message news:38F69231.EE1D9B6D at hotmail.com... > Dear my friends, > I am looking for the way to write on Python stuff helping me to change > NT password, since I would like to change the password of WinNT domain > via Web page. (That Python stuff will be the CGI) > Could you point me the way? > Thank you very much, > > From ivanlan at callware.com Wed Apr 5 12:24:03 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 05 Apr 2000 10:24:03 -0600 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> Message-ID: <38EB68A3.B1B5809F@callware.com> Hola, Listeros-- Warren Postma wrote: > [snip] > What I would like to find is an introduction to the Art of Programming, in > Python. > [snip]*2 > The Python texts I've read are good References to Getting Stuff Done, but > they Don't Teach the Art. Speaking of Dummies, was there/is there a LISP for > Dummies, or Smalltalk for Dummies? Can Python for Dummies be far off? > > Please forgive the BSP (Blatant Self-Promotion) here. On April 17, according to Macmillan, my book _Teach Yourself Python in 24 Hours_ will finally be out. Its mission is to provide exactly what you're looking for, a book that teaches programming, art, attitude and philosophy, using Python. I don't know how well I succeed. That's left to the critics to determine. The book should really have been called _Python Mind, Beginner's Mind_, because it draws heavily on Shunryu Suzuki's _Zen Mind, Beginner's Mind_. It is not a _Python for Dummies_ book, however, because I don't believe that people who want to learn how to program should either be called or treated like dummies. I try to convey how much fun programming is, and try to show some of the really neat things you can do with Python. There are even Mayan glyphs in the book. You can visit the web page (which includes the "advance praise" page;-) at http://www.pauahtun.org/TYPython/ -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From aahz at netcom.com Sun Apr 16 13:15:32 2000 From: aahz at netcom.com (Aahz Maruch) Date: 16 Apr 2000 17:15:32 GMT Subject: Event triggering and weak references References: <8dbif3$hm0$1@metro.ucc.usyd.edu.au> <8dcmv0$7ub$1@metro.ucc.usyd.edu.au> Message-ID: <8dcsfk$h$1@nntp9.atl.mindspring.net> In article <8dcmv0$7ub$1 at metro.ucc.usyd.edu.au>, Ricardo Nogueira wrote: > >But both versions work with boundedMethods for the observer. If you change >your main() to register(a, "x" , objY.msg) it will keep objY from being >garbageCollected if we clear any other references to it. It is necessary to >always call unregister before the "last" pointer to objY is cleared. Not >very nice. > >How can we read objY reference count? >If we come to know this number, compare to the number of boundedMessages we >have for it, we can conclude if it is garbage and clear its references >instead of calling its methods. With the partial exception of the various garbage collection patches, the Python model is that the programmer is responsible for managing references. If there are no references pointing at an object, the object gets automatically cleaned up. The Python scope model makes this fairly easy, as long as you don't have any pure circular references. -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "First one back from the bathroom gets to be the bottom." From effbot at telia.com Tue Apr 18 17:51:00 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 18 Apr 2000 21:51:00 GMT Subject: can someone tell me about... References: <38FCBB16.BF50EB03@stsci.edu> Message-ID: <8N4L4.498$wYl.191816704@newsb.telia.net> Kia Arab wrote: > variable names that start an underscore "_". > > Interactively, python will recognize a variable name that begins with > one underscore (_myVar). The variable naming rules even say that is > acceptable. > > However, when I try to use it in a module, it bombs. "bombs"? > What's the deal? lousy subject line, no code sample, no error message, vague description of the actual problem. but alright, I'll guess: when you read this page: http://www.python.org/doc/current/ref/import.html you missed the following sentence: If the list of identifiers is replaced by a star ("*"), all names defined in the module are bound, except those beginning with an underscore ("_"). From moshez at math.huji.ac.il Mon Apr 3 18:33:20 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 4 Apr 2000 00:33:20 +0200 (IST) Subject: Creating variables on the fly... In-Reply-To: Message-ID: On Mon, 3 Apr 2000, Matthew Hirsch wrote: > But now let's say I have twenty variables that I want to add together. > This function will no longer work. I would have to rewrite it as > a+b+c+d+e+f+g+...+(20th letter). Is there a way to dynamically create a > variable name? So that my add function can automatically determine how > many variable names to create and then add the values together. In > other words, I'd ideally like something like: Try: def sum(*args): res = 0 for arg in args: res = res+arg return res -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From shae at webwitches.com Sat Apr 1 10:39:41 2000 From: shae at webwitches.com (Shae Erisson) Date: Sat, 01 Apr 2000 15:39:41 GMT Subject: was Re: Why should I switch to Python? References: <1EeF4.43$CA.2422@news> Message-ID: <38E618D7.A15F9D9B@webwitches.com> Fran?ois Pinard wrote: > We should not see the potential for a war every time Perl is discussed, > and be patient instead. It looks all pretty bearable so far. And if it > was becoming too heavy, we could prepare pre-canned replies for the most > questions, and even suggest a pointer to this FAQ right into the message > footer generated for this list. Welcoming people in person is better! > > -- > Fran?ois Pinard http://www.iro.umontreal.ca/~pinard maybe a newsgroup bot that finds common text patterns and posts FAQtual replies? Seriously though, I joined the python community because perlers treated me like a worthless newbie, and pythonistas patiently answered my questions, no matter how clueless they were. I think that attitude is what makes the python community so wonderful. I wonder if the Sapir-Whorf hypothesis works within Perl and Python also? To me at least, Python seems written to be simple and open, Perl seems to want to be mystical, magical, and arcane. Their communities seem to think that way at least, so I may be overly influenced by that. I wonder if the next step to CP4E would be online 'classes?' Emacs allows for multiple windows on multiple displays. A friend and I have used that to try out multi-user editing of a single document across 800km, and it works. Does anyone have other suggestions? -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt From bhoel at starship.python.net Sun Apr 2 16:36:44 2000 From: bhoel at starship.python.net (Berthold Höllmann) Date: 02 Apr 2000 22:36:44 +0200 Subject: GTK Referenc References: <38E7A868.A1C9BD7C@searchy.net> Message-ID: Penpal International writes: > I couldn't find anywhere a reference for the GTK module for Python. Does > anyone know one? > On gtk's site I could only find some for C(++). I've send a little script to the PyGTK mailing list (see http://www.mail-archive.com/pygtk at daa.com.au/msg01225.html). It uses pythondoc t generate a class and functuon reference. Due to the lack of doc strings in the whole module, it is of only limited use, but it helps me getting an idea of the gtk module classes. Besides that, you have to use the GTK+ documentation. Greetings Berthold -- bhoel at starship.python.net / 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 ljoramo at nickads.com Mon Apr 17 11:55:17 2000 From: ljoramo at nickads.com (Lee Joramo) Date: Mon, 17 Apr 2000 09:55:17 -0600 Subject: Editors and books In-Reply-To: References: Message-ID: >Next, a question for those who've been doing this: is there a color IDE >(just a nicer thing that IDLE) for the Mac? I've heard that Alpha (which I >just downloaded) has a Python mode, but I can't seem to find it. Is there >something else, either? can MPW do it? BBEdit? You have several choices: Alpha: I believe that two python modes have been developed independently. Here is a link to one of them: toward the bottom of the page you should find info about an Alpha mode. Modes are written in TCL, so you can roll your own. BBEdit: while I find that Alpha is a very powerful, I tend to use BBEdit for most of my Python work. BBEdit is powerful enough and has a great user interface. In BBEdit's language preferences I have created a file extension of .py for python and set it to use the highlighting for TCL. The resulting color highlighting very closely matches the needs of python. Note: BareBones is considering adding direct support for Python in the next release of BBedit. If you use BBEdit, I suggest you contact BBEdit and add your vote for Python. Mac Python IDE: I believe that the next release of MacPython is scheduled to include syntax highlighting. Maybe this summer. -- Lee A. Joramo ljoramo at nickads.com The Nickel Want Ads www.nickads.com Internet Manager 970-242-5555 From rumjuggler at home.com Tue Apr 18 12:48:58 2000 From: rumjuggler at home.com (Ben Wolfson) Date: Tue, 18 Apr 2000 16:48:58 GMT Subject: [Announce] autoreload.py References: <001601bfa8a0$c6d86f50$4500a8c0@thomasnb> Message-ID: <9p4pfsch59ovo5atgl9l4usb91gl6qs5vs@4ax.com> On Mon, 17 Apr 2000 21:11:46 +0200, "Thomas Heller" wrote: My newsreader seriously munged this. Can you repost the code, not as an attachment? Thanks -- Barnabas T. Rumjuggler Ibi nullus timet mortem Sed pro Baccho mittunt sortem -- Carmina Burana From matsaleh at my-deja.com Sat Apr 22 16:50:18 2000 From: matsaleh at my-deja.com (matsaleh at my-deja.com) Date: Sat, 22 Apr 2000 20:50:18 GMT Subject: pickle.py and cPickle.c - persistent_id is always called - why? Message-ID: <8dt3a5$r03$1@nnrp1.deja.com> Hello fellow .py types... I am doing a bit of work using pickle/cpickle and am trying to optimize. I found that my user- defined persistent_id() function is being called for (just about) every attribute (name and value) in my object that is being pickled. My specific (somewhat ad-hoc) test case pickles ~100 objects in a containment hierarchy, using persistent_id to break the containment relationship and replace the references with a proprietary object id. Although I have only ~100 object references to resolve, persistent_id() is called ~6400 times. In tracing the code, it appears to be called for every attribute and value in my objects. This appears to be caused by the fact that pickle.py:save() is called with the default pers_save flag of 0 in all cases except for when it is called by save_pers(). This appears to indicate that all types: tuples, dicts, sequences, longs, strings, etc, cause my persistent_id() to be called, when all I want is for it to be called for object instances. I modified pickle.py to change the default of the pers_save flag to 1 in the save() method, and then call it with a 0 only from within the save_inst() method. This amounts to invoking my persistent_id() function only when a reference to an object instance is encountered as my objects are being pickled. My pickled objects do not appear to be adversely affected by this change, and the number of calls to persistent_id() was reduced from ~6400 to ~500, reducing the time spent in this method by an order of magnitude (0.37 sec to 0.03 sec). I have not yet tested this change in cPickle.c, but in my original tests, persistent_id() was a much more significant factor in my runs using cPickle, because all the pickling code is in C and is relatively much faster than my persistent_id() method, which is in Python. I expect the performance boost my making the change in cPickle to be even greater, relatively speaking. My question is, why is persistent_id() being invoked so often? I do not see the reason for calling it for basic python types and structures such as tuples, dicts, and the like. Is this a reasonable change to make to the python source, or is it not a safe change for the general pickling cases that the pickle/cPickle modules have to handle? I'm sure this code has been scruitinized by many folks much more experienced than I - I would be grateful for your insights. Regards. Sent via Deja.com http://www.deja.com/ Before you buy. From paul at fizzylab.com Fri Apr 7 15:12:46 2000 From: paul at fizzylab.com (paul beard) Date: Fri, 07 Apr 2000 12:12:46 -0700 Subject: calendar/scheduling app Message-ID: <38EE332E.2954EA49@fizzylab.com> I am interesting in having a meeting scheduler/calendar app that does what something like Exchange purports to do without requiring me to use a client that doesn't exist. In other words, it should be platform-agnostic and use webforms/cookies to handle transactions and display options. Possible in Zope? How hard? How long to do, given a baseline knowledge store of zero? -- Paul Beard / 206 728 4282 x138 Fizzylab / 2025 First Ave, Suite 1150 Seattle WA 98121 From brockn at deskmedia.com Mon Apr 10 23:21:13 2000 From: brockn at deskmedia.com (Brock Noland) Date: Mon, 10 Apr 2000 22:21:13 -0500 Subject: Jpython?? References: <955394930.758181@newdm.deskmedia.com> Message-ID: <955423157.1114@newdm.deskmedia.com> Thanks "Fredrik Lundh" wrote in message news:W7rI4.431$rc9.188052480 at newsb.telia.net... > Brock Noland wrote: > > Hello I am a web developer.. Well part time. I can 'program' in HTML > and > > am interested in learning Java but I was told that I should learn Python > > first because it is a fairly newbie friendly language. To the point I saw > a > > post about Jpython yesterday what is it?? > > www.jpython.org > > > > From aa8vb at yahoo.com Thu Apr 20 20:36:31 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Thu, 20 Apr 2000 20:36:31 -0400 Subject: Python Parsers In-Reply-To: References: Message-ID: <20000420203631.A608349@vislab.epa.gov> Mike Fletcher: |Here's part of it :) | |from simpleparse import generator |from TextTools import TextTools Kudos to you an Mark L on an excellent tool! I had it parsing and reformatting my syntax in no time. I think this would make a great addition to the core distribution, ...particular after having seen the wealth of "regexes won't work for recursive grammar" posts in the archives. Also using this package is "easy" (thanks to your and Mark's efforts) and the syntax grammar is very readable -- more so than re expressions IMO, even with the verbose option on. This is a good tool to have up your sleeve. ;-) Thanks again, Randall (For the Dejanews and the list archive, I've attached my short parser. The grammer is briefly described in the class docstring, and the output of the test stub is listed below: ============================================================================== RAW STRING TO PARSE PARSED PYTHON ------------------- ----------------------------------- 1 :: [1] 2.3 :: [2.2999999999999998] 3.4e20 :: [3.4e+20] 56 78 :: [56, 78] "string" :: ['string'] identifier :: ['@@ identifier @@'] [] :: [()] [1] :: [(1,)] [ 1.0 2.0 ] :: [(1.0, 2.0)] [[1,2,3],[3,4,5 ] ] :: [((1, 2, 3), (3, 4, 5))] {} :: [[]] {{ "str" }} :: [[['str']]] { 1, [2,3], "str" } :: [[1, (2, 3), 'str']] { ident1, ident2 } :: [['@@ ident1 @@', '@@ ident2 @@']] {[]{}} :: [[(), []]] { [ 1 2 ][ 4 5 ] } :: [[(1, 2), (4, 5)]] ============================================================================== -- Randall Hopper aa8vb at yahoo.com -------------- next part -------------- #!/usr/bin/env python # # grammar_parse.py - Parse a recursive grammar into basic Python data types. # from simpleparse import generator from TextTools import TextTools import types, string class Parser: """ GRAMMAR CONVERTED TO PYTHON AS ------------------ ---------------------- { ... } is a list - List ( ... ) is a vector - Tuple (vector, matrix, tensor, etc.) "..." is a string - String ("string") ident is an ID str - String ("@@ ident @@") 1 is an integer - Integer 2.3 is a float - Float """ PARSERDECLARATION = r''' root := ts, element* element := (('"',string,'"')/vector/list/number/identifier), ts list := '{', ts, element*, '}' vector := '[', ts, vect_element*, ']' vect_element := (vector/number), ts number := [-+]*, ( ('0',[xX],[0-9]+) / ([0-9.]+,([eE],[-+0-9.]+)?)) string := (char/escapedchar)* char := -[\134"]+ escapedchar := '\134"' / '\134\134' identifier := [a-zA-Z_@], [a-zA-Z0-9_'@]* := ( [ \011-\015,]+ / ('#',-'\012'*,'\n')+ )* ''' #'" #<-- Keep python.el mode happy with quoting :-( PARSERTABLE = generator.buildParser( PARSERDECLARATION ) ROOTITEMPARSER = PARSERTABLE.parserbyname( "root" ) def __init__( self, string ): self.data = string def Parse( self, parseonly = 0 ): success, tags, next = TextTools.tag( self.data, Parser.ROOTITEMPARSER ) if not success: raise ValueError, "TextTools.tag failed" if next != len( self.data ): raise ValueError, "Failed to parse entire expression" #import pprint #pprint.pprint( tags ) if parseonly: return tags else: return self.ConvertToPython( tags ) def ConvertToPython( self, tags ): return map( self._dispatch, tags ) def _dispatch( self, (tag, start, stop, children) ): return getattr( self, tag)( (tag, start, stop, children) ) # tag handlers def element( self, (tag, start, stop, (child,) ) ): '''Always has a single child: either string, vector, list number, or identifier ''' val = self._dispatch( child ) return val def vect_element( self, (tag, start, stop, (child,)) ): '''Always has a single child: either vector or number''' return self._dispatch( child ) def vector( self, (tag, start, stop, elements) ): '''Some arbitrary number of elements, return as list''' val = map( self._dispatch, elements ) if type(val) == types.ListType: return tuple(val) else: return val def list( self, (tag, start, stop, elements) ): '''Some arbitrary values returned as list''' return map( self._dispatch, elements ) def string( self, (tag, start, stop, children) ): '''A quoted string''' return self.data[ start:stop ] def identifier( self, (tag, start, stop, children) ): '''An identifier''' return "@@ %s @@" % self.data[ start:stop ] def number( self, (tag, start, stop, children) ): '''Could be either int or float, check first, then second''' try: return string.atoi( self.data[ start:stop ], 0 ) except ValueError: return string.atof( self.data[ start:stop ] ) if __name__ == "__main__": test_expr = ( '1', ' 2.3', '3.4e20 ', '56 78', '"string"', ' identifier', '[]', '[1]', ' [ 1.0 2.0 ] ', '[[1,2,3],[3,4,5 ] ]', '{}', ' {{ "str" }}', '{ 1, [2,3], "str" } ', '{ ident1, ident2 }', '{[]{}}', '{ [ 1 2 ][ 4 5 ] }' ) for expr in test_expr: #print Parser( expr ).Parse( parseonly = 1 ) print '%-20s :: %s' % ( expr, repr( Parser( expr ).Parse() ) ) From meh9 at cornell.edu Mon Apr 3 15:52:17 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Mon, 03 Apr 2000 15:52:17 -0400 Subject: Creating variables on the fly... References: Message-ID: I've been trying to figure this out for some time now. I didn't realize I could use *args. Thanks again, Matt In article , Matthew Hirsch wrote: > Hi All, > > Let's say I have four variables: > > a=1 > b=2 > c=3 > d=4 > > And I have a function that adds these variables together: > > def add(a,b,c,d): > return a+b+c+d > > But now let's say I have twenty variables that I want to add together. > This function will no longer work. I would have to rewrite it as > a+b+c+d+e+f+g+...+(20th letter). Is there a way to dynamically create a > variable name? So that my add function can automatically determine how > many variable names to create and then add the values together. In > other words, I'd ideally like something like: > > > def add(number_of_variables): > return a+b+c+...+(letter corresponding to number_of_variables) > > Thanks for your help, > > Matt From effbot at telia.com Mon Apr 10 11:51:17 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 10 Apr 2000 15:51:17 GMT Subject: Extending built-in language (Win 95) References: <213CDEBFDDA7D3118081009027E40C56071118@SHEF-MS1> Message-ID: Mark Pope wrote: > I've added xxmodule to the lib and recompiled. Entering: > a = xx.new() > just gives a name error on xx. > > Have I missed something? 1) the Modules/Setup file is used to add modules to the standard library. 2) you forgot to *import* the xx module. From johngrayson at home.com Sun Apr 9 18:29:47 2000 From: johngrayson at home.com (John Grayson) Date: Sun, 09 Apr 2000 22:29:47 GMT Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> Message-ID: <38F1045C.FA3CEDD2@home.com> Well, you can't use Win32all with Tkinter -- but you know that already :-) I got a good ODBC interface working with Tkinter for an airline application. I can send you the extension module, if it will help... John Ivan Van Laningham wrote: > > Hi All-- > I'm finally getting a chance to use Python at work. I have two > questions: > > 1) Is there a way to run silent (i.e., we determine where things go and > the customer never sees any wizards) installs of Python, Tcl/Tk and > Win32all? > > 2) What stuff do I need to use msaccess with Python? Do I need to use > Win32all, or can I use Tkinter for my (minimal) GUI, with msaccess? > > -ly y'rs, > Ivan > ---------------------------------------------- > Ivan Van Laningham > Callware Technologies, Inc. > http://www.pauahtun.org > http://www.foretec.com/python/workshops/1998-11/proceedings.html > Army Signal Corps: Cu Chi, Class of '70 > Author: Teach Yourself Python in 24 Hours From aa8vb at yahoo.com Thu Apr 6 07:51:24 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Thu, 06 Apr 2000 07:51:24 -0400 Subject: Modifying "traceback" objects Message-ID: <20000406075124.A1848828@vislab.epa.gov> Is it possible to add frames to the current traceback object from inside a C extension? I have Python calling C, which makes callbacks to Python, and I'm missing the middle C layers in my tracebacks. Tim Peters summarizes it nicely: | If A calls B tails calls C tail calls D blows up, I damn sure don't | want a traceback claiming that A called D directly. I want to get a | traceback object with the full chain intact Thanks, -- Randall Hopper aa8vb at yahoo.com From shae at webwitches.com Wed Apr 26 17:40:16 2000 From: shae at webwitches.com (Shae Erisson) Date: Wed, 26 Apr 2000 21:40:16 GMT Subject: global variables or inheritence References: <28p8zy0irgc.fsf@lada.kom.auc.dk> <28p4s8oipzh.fsf@lada.kom.auc.dk> <28pzoqghaoh.fsf@lada.kom.auc.dk> Message-ID: <390764A7.E986CEF8@webwitches.com> Thomas Rasmussen wrote: > Well I still want to be able to do this.... > > >> testprog2.py: import os, sys, string, testprog1 def second(): > >> print testprog1.myvar if __name__ == '__main__': print 'nope' > >> > Well i'm programming a small admin tool, which must use the users > $EDITOR for editing files. This works fine if the EDITOR sysenv is > set, if not, then i want to ask the user which editor he want to use, > and then pass this variable to the module that handles > filemanipulation. This modules is also in another file if it > matters... I must add that this is my first real program made in > python... this is untested code, but it might give you some ideas: import os import usefulmodule def ask(): usereditor = raw_input("What's your choice of editor?") return usereditor try: usereditor = os.environ['EDITOR'] except KeyError: usereditor = askforeditor() usefulmodule.dostuff(usereditor) -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt 13:00pm up 1 season, 1 squirrel, load average: 1+1j 0.5+2j 0.2+0.5j From ullrich at math.okstate.edu Tue Apr 4 19:34:39 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: 4 Apr 2000 23:34:39 GMT Subject: Learning in Stereo: Math + Python References: <38EA329F.4D407309@math.okstate.edu> Message-ID: <01bf9e8f$d054e600$6296cdcf@daves-dell> David C. Ullrich wrote in article <38EA329F.4D407309 at math.okstate.edu>... > Kirby Urner wrote: > > > [...] > > And here's another fast converger [to pi] using every other > > Fibonacci number: > > > > def pifib(n): > > # return approximation for pi using > > # arctan(1) = 4 * SIGMA [ arctan(1.0/Fib(2i+1))] Or arctan(1) = SIGMA [ arctan(1.0/Fib(2i+1))] or something. > > sum = 0 > > for i in range(1,n+1): > > sum = sum + math.atan(1.0/fibo(2*i+1)) > > return 4*sum > > I didn't know that arctan(1) was equal to that sum, But it is (heh-heh): you show by induction that the difference between arctan(1) and the sum of the first n terms is exactly arctan(1/fibo(2*n+2)) (or 2*n+1 or something, the notation's different in my notes...) (This is on-topic because Python got used in finding the proof: You need to show that x_n -> 0, where the error is arctan(x_n). A little trigonometry gives a purely algebraic recurrence involving the numbers x_n. Now you look at the first few using your favorite rational.py and they look like 1/3, 1/8, ... then you know what to prove.) DU From fredrik at pythonware.com Wed Apr 5 06:45:39 2000 From: fredrik at pythonware.com (fredrik at pythonware.com) Date: Wed, 05 Apr 2000 10:45:39 GMT Subject: Starving for an Advanced Python Book References: <38EA9A5D.F35B3E74@callware.com> Message-ID: <8cf5gh$eil$1@nnrp1.deja.com> Ivan Van Laningham wrote: > My only quibble with the printed version--sucky index. didn't know there was an index :-) there's a script/module index, but no traditional index. this will be fixed in the printed edition. Sent via Deja.com http://www.deja.com/ Before you buy. From dave at dogwood.com Mon Apr 10 15:10:17 2000 From: dave at dogwood.com (Dave Cornejo) Date: Mon, 10 Apr 2000 19:10:17 GMT Subject: 2nd CFV: comp.lang.ruby References: <954456262.23656@isc.org> Message-ID: <955393816.29413@isc.org> LAST CALL FOR VOTES (of 2) unmoderated group comp.lang.ruby Newsgroups line: comp.lang.ruby The Ruby dynamic OO programming language. Votes must be received by 23:59:59 UTC, 20 Apr 2000. This vote is being conducted by a neutral third party. Questions about the proposed group should be directed to the proponent. Proponent: Conrad Schneiker Votetaker: Dave Cornejo RATIONALE: comp.lang.ruby Ruby is a very-high-level, dynamic object oriented programming language. Ruby provides many of the best-liked power and convenience features of Perl and Python on one hand, with an elegantly simple and powerful syntax that was partly inspired by Eiffel and Ada on the other hand. Ruby is a more thoroughly objected oriented language than Python, and some Ruby features were inspired by Smalltalk. Ruby is an open source language. There are over 1000 members of 4 Japanese Ruby mail lists (general, developers, math, extension writers), with a peak volume topping 100 messages per day. At present, there is one English Ruby mail list with about 175 members, with a recent volume often exceeding 10 messages per day and growing. Many users of the Japanese Ruby mail lists have some understanding of English and are also prospective comp.lang.ruby users as well. Much of 1999's newsgroup discussion of Ruby took place on comp.lang.python, which is not optimal, since comp.lang.python is dedicated to the Python language. For obvious reasons, Ruby users do not post there frequently. In 2000, most Ruby discussion has occurred in comp.lang.misc. This again is not ideal since other comp.lang.misc regulars are typically more interested in issues that transcend Ruby, and have said as much. In Japan, Ruby has overtaken Python in terms of popular usage. During 1999 and into early 2000, Ruby has been featured in several articles in the English language software trade press, indicating it is at the takeoff threshold that Perl and Python attained years ago. (Please see http://www-4.ibm.com/software/developer/library/ruby.html for the latest example.) The English language Ruby home page is http://www.ruby-lang.org/en/, which provides links to documentation and download pages for Ruby. CHARTER: comp.lang.ruby The comp.lang.ruby newsgroup is devoted to discussions of the Ruby programming language and related issues. Examples of relevant postings include, but are not be limited to, the following subjects: - Bug reports - Announcements of software written with Ruby - Examples of Ruby code - Suggestions for Ruby developers - Requests for help from new Ruby programmers The newsgroup is not moderated. Binaries are prohibited (except the small PGP type). Advertising is prohibited (except for announcements of new Ruby-related products). END CHARTER. HOW TO VOTE: Follow these instructions *exactly*! Votes are counted by computer. You should send E-MAIL (posts to a newsgroup are invalid) to: vote at dogwood.com Please do not assume that just replying to this message will work. Check the address before you mail your vote. Your mail message should contain one and only one of the following vote statements: I vote YES on comp.lang.ruby I vote NO on comp.lang.ruby Voter name: If your mail software does not indicate your real name (for example, AOL does not), include _exactly_ the statement above on a _separate_ line and add your name after the colon. Having your name in your signature line is NOT enough! Do NOT join the lines together or remove the words "Voter name"! You may also vote ABSTAIN (which records an empty vote) or CANCEL (which removes any earlier votes). ABSTAIN does not affect the final vote count in any way but is listed, whereas CANCEL is not. IMPORTANT VOTING PROCEDURE NOTES: Standard Guidelines for voting apply. One vote per person, one account per voter. Votes must be mailed directly from the voter to the votetaker. Anonymous, forwarded or proxy votes are not valid. Votes mailed by WWW/HTML/CGI forms are considered to be anonymous votes. Votes from non-existent email addresses are not valid. Vote counting is automated. Failure to follow these directions may mean that your vote does not get counted. If you do not receive an acknowledgment of your vote within three days contact the votetaker about the problem. It's your responsibility to make sure your vote is registered correctly. Duplicate votes are resolved in favor of the most recent valid vote. Addresses, names and votes of all voters will be published in the final voting results post. The purpose of a Usenet vote is to determine the genuine interest of persons who would read a proposed newsgroup. Soliciting votes from disinterested parties defeats this purpose. Please do not distribute this CFV. If you must, direct people to the official CFV as posted to news.announce.newgroups. Distributing pre-marked or otherwise edited copies of this CFV is generally considered to be vote fraud. When in doubt, ask the votetaker. -- Voting question & problems: Dave Cornejo Voting address: vote at dogwood.com From amitp at Xenon.Stanford.EDU Mon Apr 17 22:49:54 2000 From: amitp at Xenon.Stanford.EDU (Amit Patel) Date: 18 Apr 2000 02:49:54 GMT Subject: Filtering web proxy References: Message-ID: <8dgigi$89e$1@nntp.Stanford.EDU> Neil Schemenauer wrote: | | Yes and if your connection is fast enough that you don't need | incremental loading you probably don't care too much about ads. | In my experience, filtering ads greatly enhances your experience | if your browsing on a slow connection. Even with a fast connection, there are still things like filtering out pop-ups, blocking cookies from certain sites, forcing pages to be cachable (by modifying Cache-Control headers .. evil evil!) that can be useful. One really handy thing I wrote was to highlight keywords you searched for, so for example, you search for "big dog" and visit a page, and it'll highlight "big" and "dog" on that page. However, Google just added this feature (when you use its cached link) so I don't need it so much in a proxy. | Is the situation with XML the same as HTML? Are XML documents | forced to adhere to the standard or are parsers supposed to try | to do something intelligent with whatever crap they get fed? I believe XML and XHTML parsers are required to reject bad stuff. | Saying that is parses HTML is a bit of a stretch however. It | just uses a couple of regexs. I'm sure Tim Peters would love | it. :) Regexps can "parse" HTML tags. There was something called REX.py that was posted here somewhere. It's based on REX for Perl, which is based on Robert D. Cameron "REX: XML Shallow Parsing with Regular Expressions", Technical Report TR 1998-17, School of Computing Science, Simon Fraser University, November, 1998. The idea is that REX is a humongous hairy regexp (sorry Timbot!) that will match one tag or non-tag at a time. You just keep feeding it data and it can keep giving you tags/non-tags. With that, I hope to build a filtering proxy that tokenizes all the HTML and does evil transformations to it, incrementally. - Amit P.S. Here's the regexp, just for Tim Peters: '[^<]+|<(?:!(?:--(?:[^-]*-(?:[^-][^-]*-)*->?)?|\\[CDATA\\[(?:[^\\]]*](?:[^\\]]+])*]+(?:[^\\]>][^\\]]*](?:[^\\]]+])*]+)*>)?|DOCTYPE(?:[\\n\\t\\r]+(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*(?:[\\n\\t\\r]+(?:(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*|"[^"]*"|\'[^\']*\'))*(?:[\\n\\t\\r]+)?(?:\\[(?:<(?:!(?:--[^-]*-(?:[^-][^-]*-)*->|[^-](?:[^\\]"\'><]+|"[^"]*"|\'[^\']*\')*>)|\\?(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*(?:\\?>|[\\n\\r\\t][^?]*\\?+ (?:[^>?][^?]*\\?+)*>))|%(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*;|[\\n\\t\\r]+)*](?:[\\n\\t\\r]+)?)?>?)?)?|\\?(?:(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*(?:\\?>|[\\n\\r\\t][^?]*\\?+(?:[^>?][^?]*\\?+)*>)?)?|/(?:(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*(?:[\\n\\t\\r]+)?>?)?|(?:(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*(?:[\\n\\t\\r]+(?:[A-Za-z_:]|[^\\x00-\\x7F])(?:[A-Za-z0-9_:.-]|[^\\x00-\\x7F])*(?:[\\n\\t\\r]+)?=?(? :[ \\n\\t\\r]+)?(?:"[^<"]*"|\'[^<\']*\'|\\w+))*(?:[ \\n\\t\\r]+)?/?>?)?)' -- Amit J Patel, Computer Science Department, Stanford University http://www-cs-students.stanford.edu/~amitp/ -- -- Amit J Patel, Computer Science Department, Stanford University http://www-cs-students.stanford.edu/~amitp/ From corg at copernic.com Wed Apr 19 11:17:21 2000 From: corg at copernic.com (Gaetan Corneau) Date: Wed, 19 Apr 2000 11:17:21 -0400 Subject: Very Horrible Question About Goto's Message-ID: Hi, > 1) the only valid use of goto's in C I've seen looks like this: > > if (bogus) > goto cleanup > do stuff; > return(okay); > cleanup: > close file handles; > do cleanup > return(error) There are, at least, two other valid uses: 1) the most important: goto's are used a lot by code generators (it simplifies writing the generator alot in some cases) 2) in extreme cases, to improve performances. IMHO, Goto's *are* evil in languages where you can jump around from one function to another, but they can be useful in some cases. My own rules are: - don't use goto's if you HAVE to use goto's: - don't jump from one function to another (if your language supports it) - don't jump backward I was surprised to learn that Python doesn't have a goto statement. Would it be difficult to add? ______________________________________________________ Gaetan Corneau Software Developer Copernic.com http://www.copernic.com E-mail: corg at copernic.com ______________________________________________________ "Tu l'as trop ?cras?, C?sar, ce Port Salut" From mskott at image.dk Tue Apr 25 16:56:31 2000 From: mskott at image.dk (Martin Skøtt) Date: Tue, 25 Apr 2000 20:56:31 GMT Subject: Working with data returned by PyGreSQL References: Message-ID: I apoligize for asking this question without checking all the available documentation. After reading the source in pgmodule.c everything became much more clear to me. I have now subscribed to the PyGreSQL mailing list and plan to start testing the new DB-API module one of the following days. -- Martin Sk?tt mskott at image.dk 'In a certain sense, all decent programming languages are equally powerfull' Dr. Alan Turing From erno at iki.fi Tue Apr 4 15:20:25 2000 From: erno at iki.fi (Erno Kuusela) Date: 04 Apr 2000 22:20:25 +0300 Subject: opening a serial port at a given baudrate. How? References: <200004041153.VAA15869@piglet.dstc.edu.au> Message-ID: >>>>> "davida" == David Arnold writes: davida> on unix (including linux), just open the device special davida> file corresponding to the serial port of interest davida> (ie. /dev/ttyS0) and you can then control it using davida> fcntl.ioctl() function and otherwise read from and write davida> to it like a normal file object. i believe the termios module is for ftwiddling with serial ports on unix. see for example ftp://ftp.tummy.com/pub/tummy/cid/ for example code. -- erno From hamish_lawson at yahoo.co.uk Thu Apr 20 10:40:28 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Thu, 20 Apr 2000 07:40:28 -0700 Subject: [ANNOUNCE] Webware for Python 0.1 References: <5650A1190E4FD111BC7E0000F8034D26A0F40D@huina.oceanic.com> <38FEF62B.2A4402CD@mindspring.com> Message-ID: <2cd13488.77055138@usw-ex0108-063.remarq.com> Don Tuttle wrote: > WinZip is having problems with your tar. It's giving me the > error "Error reading header after processing 0 times." The file is actually a gzipped tar file, but your browser is probably curtailing the extension to .tar, thus miseading WinZip. You can get round this by manually giving the file a .tar.gz extension when you save it from your browser. The saved file should now open OK in WinZip. Alternatively you could do it The Python Way (TM) :-) >>> import urllib >>> urllib.urlretrieve( 'http://writewithme.com/Webware/download.cgi', 'webware.tar.gz') Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From pinard at iro.umontreal.ca Sat Apr 1 09:16:09 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 01 Apr 2000 09:16:09 -0500 Subject: Why should I switch to Python? In-Reply-To: "Chris Ryland"'s message of "Sat, 01 Apr 2000 04:09:33 GMT" References: <1EeF4.43$CA.2422@news> Message-ID: "Chris Ryland" writes: > Oh, no, not another Perl vs. Python war! ;-) That remembers me of a little story that made me smile, years ago. This was the comment of a discouraged nurse at a recruiting centre for the army, at the entrance of the medical examination room. "I told them for _years_ to remove their shirt, and they still do not know they should." There will be newcomers to Python all the time, and they are likely to ask questions which I asked, and which you asked, when you initially came here. I quite remember I got in, not so long ago, with this brilliant, brand new, clever idea that we should write a Perl to Python automatic converter. You people received me with an exquisite politeness and patience, and my liking of Python deepened instantly as it got kind of fuzzily intermixed, in my fragile mind, with the feeling of good human values, as well. We should not see the potential for a war every time Perl is discussed, and be patient instead. It looks all pretty bearable so far. And if it was becoming too heavy, we could prepare pre-canned replies for the most questions, and even suggest a pointer to this FAQ right into the message footer generated for this list. Welcoming people in person is better! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From mfletch at tpresence.com Thu Apr 13 10:33:25 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 13 Apr 2000 10:33:25 -0400 Subject: List mapping? Message-ID: not elegant, but here's another way... original = string.split( x, ' ') result = [] while original: result.append( tuple(original[:2]) ) del original[:2] and another... original = string.split( x, ' ') result = [] for x in range(0, len(original), 2 ): result.append( tuple( original[x:x+2])) HTH, Mike -----Original Message----- From: Nick Trout [mailto:nick at spam_me_notvideosystem.co.uk] Sent: Thursday, April 13, 2000 10:10 AM To: python-list at python.org Subject: List mapping? Is there a nice way of pairing up the members to form tuple pairs in another list? ie. like you might to processing input args. ie. changing ['/a','1','/b','2','/c','3'] into [ ('/a','1'), ('/b','2'), ('/c','3') ] eg: args = '/a 1 /b 2 /c 3' listargs= string.split(args) tuplist = [] i=0 while i < len(listargs): tuplist.append( (listargs[i],listargs[i+1]) ) i = i+2 for i in tuplist: processargs(i) or: args = '/a 1 /b 2 /c 3' for i in string.split(args): i = argflag # i want next arg now as a parameter!!! Can I (you!) get rid of the long winded while loop cleverly?!! :-) Thanks in advance, Nick. -- http://www.python.org/mailman/listinfo/python-list From leursst at aol.com Sat Apr 8 16:14:23 2000 From: leursst at aol.com (Leursst) Date: 08 Apr 2000 20:14:23 GMT Subject: starting python References: <8cnkfi$at7$1@porthos.nl.uu.net> Message-ID: <20000408161423.19747.00000485@ng-ba1.aol.com> Hi! You can find the Python langage on the web site www.python.org (official). You can download the version 1.5.2 for windows 95,98,NT or other systems. You've got, on this site, all the documents you need to begin Python. Good luck... From paul.magwene at yale.edu Tue Apr 11 16:06:41 2000 From: paul.magwene at yale.edu (Paul Magwene) Date: Tue, 11 Apr 2000 16:06:41 -0400 Subject: Functions and objects References: Message-ID: <38F385D1.9ED3FACC@yale.edu> Matthew Hirsch wrote: > > Hi All, > > I'm confused. Take a look at the following: > > >>> def f(x): > ... return [x] > ... > >>> a=f(5) > >>> a > [5] > >>> for x in range(5): # Case A > ... temp=a > ... print a > ... temp.append(1) > ... > [5] > [5, 1] > [5, 1, 1] > [5, 1, 1, 1] > [5, 1, 1, 1, 1] > > >>> a=f(5) > >>> for x in range(5): # Case B > ... temp=a[:] > ... print a > ... temp.append(1) > ... > [5] > [5] > [5] > [5] > [5] > >>> > > In case A, why doesn't temp reset itself to the value of a, [5], that > was predetermined before it entered the loop? Why do you need to copy > the list to get the behavior I'm looking for in Case B? Doesn't a > always equal [5]? > > Thanks for your help, > Matt Matthew, Many of your questions to the group are addressed in the tutorial and/or FAQ. Obviously people in this newsgroup are glad to offer help and information, but it's always a good idea to try and track down your own sources of info first. You question in this case is addressed in the Python tutorial, sections 4.6 and 4.7 (and footnote 4.1). In a Python function, what gets passed to the function is an object reference. Assignment always stores a reference to an object, it DOES NOT make a copy of the object. The object you are passing in both cases is a list, therefore mutable. In case A, the assignment temp = a, is equivalent to sticking a new "label" on your mutable list object. Then your appending stuff to this object (called either "a" or "temp"). In case B, your are generating a new copy of a list object, and calling this new object "temp". Therefore, modifying the "temp" object has no bearing on the "a" object. If you are going to do a significant amount of Python programming it might be useful to acquire one of the several available python texts. Learning Python, by Lutz and Ascher is a good one to start. Best, Paul From dyoo at uclink4.berkeley.edu Tue Apr 25 13:03:55 2000 From: dyoo at uclink4.berkeley.edu (dyoo) Date: Tue, 25 Apr 2000 17:03:55 GMT Subject: new linereading standard? References: <3904D21B.333DD930@visionart.com> Message-ID: <%dkN4.33801$k5.960576@news1.frmt1.sfba.home.com> In article <3904D21B.333DD930 at visionart.com>, Pete Shinners wrote: > i've come to the point where i can't get by even the simplest python > project without dumping this code into my files. it is a simple class > that handles the "while 1: .... break" carnival for reading files. > now i can code in a preferred style > myfile = open('myfile.txt', 'r') > for line in filelines(myfile): > print line > myfile.close() > as a person trying to introduce his friends to python, i repeatedly find > this is the ugliest wart while doing basic stuff with python. Python does allow you to read the whole file at a time. readlines() will give you a list of all the lines in the file, so your code can look like: myfile = open('myfile.txt', 'r') for line in myfile.readlines(): print line myfile.close() From arnold at dstc.edu.au Tue Apr 4 23:19:31 2000 From: arnold at dstc.edu.au (David Arnold) Date: Wed, 05 Apr 2000 13:19:31 +1000 Subject: opening a serial port at a given baudrate. How? In-Reply-To: Your message of "Tue, 04 Apr 2000 19:08:39 MST." Message-ID: <200004050319.NAA08789@piglet.dstc.edu.au> -->"Jim" == Jim Richardson writes: Jim> I have been using open('/dev/ttyS0','r+') but need to control Jim> baud rate. fcntl.ioctl() will do this? as someone else pointed out (sorry, lost the mail), the termios module is the go for setting baud rates, parity, etc. some old code: not sure if it works, but might be useful ... #-- open serial port to device self.ir_file = open(str_port, "w+") ir_fh = self.ir_file.fileno() #-- get current settings [c_iflag, c_oflag, c_cflag, c_lflag, ispeed, ospeed, ccs] = \ termios.tcgetattr(ir_fh) #-- input flags off = 0 off = off | TERMIOS.IGNBRK # don't ignore break off = off | TERMIOS.BRKINT # no interrupt on break off = off | TERMIOS.IGNPAR # don't throw away parity errors off = off | TERMIOS.PARMRK # don't mark parity errors off = off | TERMIOS.ISTRIP # don't strip 8bit off = off | TERMIOS.INLCR # no nl->cr xlate off = off | TERMIOS.IGNCR # don't ignore CR off = off | TERMIOS.ICRNL # no cr->nl xlate off = off | TERMIOS.IXON # no output flow control off = off | TERMIOS.IXOFF # no input flow control on = 0 on = on | TERMIOS.INPCK # disable parity checking c_iflag = (c_iflag & ~off) | on #-- output flags off = 0 off = off | TERMIOS.OPOST # no ouput processing off = off | TERMIOS.OLCUC # no lower to upper xlate off = off | TERMIOS.OCRNL # no cr->nl xlate off = off | TERMIOS.ONOCR # cr at 0 ok off = off | TERMIOS.ONLRET # nl does not imply cr off = off | TERMIOS.OFILL # no fill chars generated on = 0 c_oflag = (c_oflag & ~off) | on #-- control flags (see p10, CE-IR2 manual) off = 0 off = off | TERMIOS.CSIZE # zero out the char-size bits off = off | TERMIOS.CSTOPB # one stop bit off = off | TERMIOS.HUPCL # don't hangup on close on = 0 on = on | TERMIOS.CS8 # 8 bit chars on = on | TERMIOS.CREAD # allow receives on = on | TERMIOS.PARENB # enable parity generation on = on | TERMIOS.PARODD # use odd parity on = on | TERMIOS.CLOCAL # ignore modem status lines c_cflag = (c_cflag & ~off) | on #-- local flags off = 0 off = off | TERMIOS.ECHO # no local echo of output off = off | TERMIOS.ISIG # no signals from special chars off = off | TERMIOS.ICANON # disable canonical processing off = off | TERMIOS.IEXTEN # disable other special chars off = off | TERMIOS.NOFLSH # no flush on signal off = off | TERMIOS.TOSTOP # no stop for background output on = 0 c_lflag = (c_lflag & ~off) | on #-- set VTIME and VMIN both to zero (ie. poll and return what's there) ccs[TERMIOS.VMIN] = 0 # read a minimum of 0 chars ccs[TERMIOS.VTIME] = 0 # wait for 0/10 sec for data to arrive termios.tcsetattr(ir_fh, TERMIOS.TCSANOW, \ [c_iflag,c_oflag,c_cflag,c_lflag,9600,9600,ccs]) From andy at reportlab.com Mon Apr 10 07:15:06 2000 From: andy at reportlab.com (Andy Robinson) Date: Mon, 10 Apr 2000 12:15:06 +0100 Subject: ReportLab PDF Library v0.92 - print code and presentations to PDF! Message-ID: ReportLab version 0.92 is now available. ReportLab is an Open Source library for creating PDF documents in pure Python. ReportLab puts Python and PDF together to create the ultimate reporting tool - acquire data from anywhere, format it any way you want, deliver it any way you want. New features in this release include: - A preview of Dinu Gherman's "py2df", which prints Python code with correct syntax colorizing and a host of options - PythonPoint, an app to make presentation slides from XML markup. - experimental support for outlines and hyperlinks - enhanced support for colors - use HTML color names Check out the gallery and demos at http://www.reportlab.com/ to see what our users have created. Download (about 340kb): ftp://ftp.reportlab.com/reportlab.tgz or ftp://ftp.reportlab.com/reportlab.zip Support and discussion: Send a message with 'subscribe' in the subject line to "reportlab-users-subscribe at egroups.com" Andy Robinson CEO and Chief Architect, ReportLab Inc. From bill at libc.org Thu Apr 27 20:55:15 2000 From: bill at libc.org (Bill Anderson) Date: Thu, 27 Apr 2000 18:55:15 -0600 Subject: The Simple Economics of Open Source References: <390534BB.3D6CEBDF@libc.org> Message-ID: <3908E173.5E2DFD72@libc.org> Raffael Cavallaro wrote: > > In article <390534BB.3D6CEBDF at libc.org>, Bill Anderson > wrote: > > >Unless you are redefining > >'commodity' (possibly by your 'known to many' remark) to fit whatever is > >provided as counter evidence. > > A commodity is that which is available in large quantities, from many > vendors offering essentially interchangeable product. This makes > commodities inexpensive, hence the term "at commodity prices" meaning, > "inexpensive." > > In intellectual property then, a commodity is that which is known to > many and not under copyright or patent. All software is under copyright and/or patent. You are confusing license/use/ubiquitousness with patent/copyright. > Because of the near zero cost of > copying, the large quantity availability is a non-issue with software. > What matters is whether or not it is known to many, because you then > have many potential suppliers. If it is only known to a few, then the > number of potential suppliers is few, and prices are not like those of a > commodity market. > > Examples: The JPEG standard is known to many, and not under copyright or > patent. Therfore, software that compresses/decompresses JPEGs is > available from many suppliers (again, the ease of copying electronic > media moots the quantity issue). Because of the fact that JPEG > compression/decompression is known to many, software to perform these > functions is plentiful and cheap (i.e., often free). Incorrect. Although the "baseline" variety of JPEG is *believed* patent-free, there are many patents associated with some optional features of JPEG, namely arithmetic coding and hierarchical storage. GIF is at least as prevalent as JPEG, yet it is under restrictions (note again, this is different than copyright) > The Microsoft Word (.doc) format is not known to many (really, only to > MS programmers) and binaries to read/display/edit data in this format > are under copyright. Although others have tried to reverse engineer this > ever changing format, they have not been 100% successful. The result is > that if you want to be certain that you can read/display/edit a document > in this format, you have only one supplier, namely, Microsoft. Because > of this, software to perform these functions is not a commodity item, > and is quite expensive. The MSWord format is not under patent or copyright. Software to read and write MSWord format is freely available, and free. You may want to pick a better example set. > In short, I'm not "redifining" the word "commodity." I'm using it as it > has always been used. I think that many open source advocates have > failed to apply simple logic to the economics of open source, believing > that somehow, the internet, or software, is immune from simple laws of > supply and demand. They are not. Yes, you are most certainly redefining commodity. At a minimum you are misinterpreting what 'commodities' are. Perhaps the below will help: """ 1 : an economic good: as a : a product of agriculture or mining b : an article of commerce especially when delivered for shipment c : a mass-produced unspecialized product 2 a : something useful or valued b : CONVENIENCE, ADVANTAGE 3 obsolete : QUANTITY, LOT 4 : one that is subject to ready exchange or exploitation within a market """ Absolutely nothing here is in accordance with your use of commodity. I have _never_ heard commodity used in the way you are using or defining it. -- In flying I have learned that carelessness and overconfidence are usually far more dangerous than deliberately accepted risks. -- Wilbur Wright in a letter to his father, September 1900 From Michael.Scharf at gmx.de Wed Apr 12 21:36:05 2000 From: Michael.Scharf at gmx.de (Michael Scharf) Date: Thu, 13 Apr 2000 03:36:05 +0200 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> <874s9766r6.fsf@ifm.uni-kiel.de> Message-ID: <38F52485.1599B01C@gmx.de> Michael Hudson wrote: > another option is: > > class paul(lazy): > super = lazy > def __init__(self, name): > self.super.__init__(self,name) > self.april_pay = 0 > > def fired(self): > print "Here's a box, collect the things from your desk" > self.super.fired(self) > > Though this has problems with repeated & multiple inheritance. What happens if you want to inherit from paul? self.super would be overwritten! Make super private (__super) and it will work fine. We use a similar trick in C++ (a private ), so changing the superclass requires only two changes in the header... #---snip--- class lazy: def __init__(self, name): self.name = name def fired(self): print 'You are fired %s!' % self.name class paul(lazy): __super=lazy def __init__(self, name): self.__super.__init__(self,name) self.april_pay = 0 def fired(self): print "Here's a box, collect the things from your desk." self.__super.fired(self) class michael(paul): __super=paul def fired(self): print self.name, "will fire paul!" self.__super.fired(self) lazy("lazy").fired() print paul("paul").fired() print michael("michael").fired() #---snap--- Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software GmbH, a Wind River Company ` > http://www.WindRiver.com \_ V mailto:Michael.Scharf at gmx.de From niels at endea.demon.nl Thu Apr 27 13:06:42 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Thu, 27 Apr 2000 19:06:42 +0200 Subject: module case bug in 1.6a2 Win9x References: Message-ID: <390873A2.BD0EF60F@endea.demon.nl> Robin Becker schreef: > > I believe there's a module case bug with long named modules under win98 > at least. I believe the bug relates to the length of the filename > somehow. > Yes, that looks like a bug in import.c:allcaps8x3(). It seems to return true instead of false for long filenames. As far as I can tell, this probably happens on all Win32 platforms at least since 1.5.2. -- Niels Diepeveen Endea automatisering From mlh at swl.msd.ray.com Thu Apr 27 09:58:05 2000 From: mlh at swl.msd.ray.com (Milton Hankins) Date: Thu, 27 Apr 2000 13:58:05 GMT Subject: plugins for browsers? References: <3904ccb0.32134281@news.demon.co.uk> Message-ID: <8e9h15$tm0$1@nnrp1.deja.com> In article <3904ccb0.32134281 at news.demon.co.uk>, greg at quokka.demon.co.uk wrote: > Are there any plugins or other means of running Python in Web > browsers? I seem to recall that there were a while ago ... I think WPY has some support for doing that. There was some work on a plug-in by Brook and Smirl, but I think it has since vanished into the great abyss. I worked on a Tkinter plug-in for Netscape at my company, but there is quite a bit of red tape involved in releasing any info on that. I could act as a technical reference for anyone wishing to start such a new endeavor on their own. Sent via Deja.com http://www.deja.com/ Before you buy. From nmm1 at cus.cam.ac.uk Tue Apr 4 08:14:09 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 4 Apr 2000 12:14:09 GMT Subject: Bugs in Python 1.6 alpha 1 References: <8c8vfj$5n6$1@news.udel.edu> Message-ID: <8ccmah$chj$1@pegasus.csx.cam.ac.uk> Here are some problems with building and running the tests of the 1.6 Alpha release: 1) The Modules/sre* files have control-M at the end. 2) The 'unsigned char *' on lines 596 and 631 of mmapmodule.c should be 'char *'. There is also a pointless check '(where >= 0)' for an unsigned value on line 408. 3) _sre.c lines 222 and 225 and mmapmodule.c lines 715 compare pointers to object types and pointers to void - this is not allowed, but I don't think that it is particularly unsafe. But it is an error in a few compilers, so should be fixed. 4) If the call to mmap in mmapmodule.c fails, the diagnostic is "Invalid argument" - which can be downright wrong (as it was in this case.) 5) There is something very odd with the test harness, though I can't see the problem in regrtest.py. 'make test' says test_pyexpat crashed, but running the single test says that the module is not configured. This happens even under Irix. 6) test_unicode fails on Hitachi systems -- Writing: '*', expected: 'T'. But only if -v is NOT specified! Again, I failed to tie it down, and it looks like a test harness problem. 7) configure is still buggy and gets things wrong :-( 8) A few other failures weren't Python's fault, and I have reported them to the vendors. Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From musingattheruins at my-deja.com Thu Apr 13 12:20:47 2000 From: musingattheruins at my-deja.com (musingattheruins at my-deja.com) Date: Thu, 13 Apr 2000 16:20:47 GMT Subject: Complaint Dept: My shoes! Message-ID: <8d4s4d$mvr$1@nnrp1.deja.com> If shoe is None then len(shoe) raises an exception. Would be nice if len(None) was 0 and NOT raise an exeption. Example: (Python 1.5.2) def show_shoe_wear_to_complaint_dept(name): if name == "Idle": return None else: return "pick up hammer..." def hit_on_head(): return "POW!!!" shoe = "" shoe = show_shoe_wear_to_complaint_dept("Idle") if len(shoe)>0: print shoe, hit_on_head() If len(shoe) returned 0 then the example would work without error, the example above raises an exception whenever Idle shows his shoe to the complaint department. The work around for the above is.... shoe = show_shoe_wear_to_complaint_dept("Idle") or "" which gets rid of the problem but feels weird. On the other hand, if len(shoe) returned None then we would have to discuss why the following prints "oww!" if None>1: print "oww!" and maybe we don't want to go there. L8R :-) Sent via Deja.com http://www.deja.com/ Before you buy. From jae at ilk.de Thu Apr 27 18:17:16 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Fri, 28 Apr 2000 00:17:16 +0200 Subject: Scripting and Gnome and KDE In-Reply-To: (message from Jody Winston on 27 Apr 2000 08:35:12 -0500) References: <3dk8hzb90u.fsf@newcnri.cnri.reston.va.us> Message-ID: <28042000.1@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Jody" == Jody Winston writes: [...] Jody> It looks like to me that we have gone back to the model that Jody> all the world is a Vax and if it compiles and runs on the Jody> Vax there isn't any problem with the software. All the Jody> world isn't Linux and the only compiler isn't gcc. I have to say that for *me*, all the world *I know* *is* Linux... I do not have access to anything else, so I don't even *know* what works or what doesn't (I've worked on a DECStation 5100 a *loong* time ago, and I've had the `pleasure' of working in VMS Pascal (on a Vax of course)). This is one thing I found lacking in autoconf (which is generally a great tool for these things): A guide to things that should be autoconfiscated (beyond the obvious like word order etc[1]). Hmmm, someone should really start something like this... Generally, most Free Software developers are dependent on user reports (and patches). So, if something doesn't work on your box, let the developers know... Bye, J [1] `Obvious' is, of course, very subjective. Word order is obvious for *me* because I once did all my (personal) development on an Amiga... which is big-endian in contrast to Intel chips. - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://members.tripod.com/Juergen_Erhard Linux - Free PC Unix (http://www.linux.org) pros do it for money -- amateurs out of love. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkIvGsACgkQN0B+CS56qs0ZegCgmDIN8gSngm4E2QIKdPhFv6w1 6mAAn0U2siR4xtQ9aoaMNOiIMRGeN4fn =0dHj -----END PGP SIGNATURE----- From gmcm at hypernet.com Tue Apr 11 16:49:37 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 11 Apr 2000 16:49:37 -0400 Subject: Thread-safe atomic operation In-Reply-To: <8d016r$jbf$1@nntp9.atl.mindspring.net> Message-ID: <1256636312-42459974@hypernet.com> Aahz Maruch wrote: > In article <1256659126-41087547 at hypernet.com>, > Gordon McMillan wrote: > >Dong-gweon Oh writes: > >> > >> Are these statements thread-safe? > >> 1. import xxx > >> 2. xxx = __import__('xxx') > >> 3. reload(xxx) > >> 4. dict['xxx'] = sys.modules['xxx'] > >> 5. dict.has_key('xxx') > > > >Numbers 2 and 4 could be interrupted between evaluation of > >the RHS and assigment to LHS. For #2 that would be of > >concern only if xxx was a global. > > Are you absolutely certain about item 1? That implies that Python as a > whole could block on importing a module that did something like > > for i in range(100): > sleep(1) I didn't say it was atomic, I agreed it was thread safe. There's special code in there dealing with competing imports between threads, but the global lock is not held for the duration of the import (in particular, the top level Python code in the imported module executes according to the normal rules). - Gordon From chafik at nevrax.com Wed Apr 12 08:33:01 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Wed, 12 Apr 2000 14:33:01 +0200 Subject: Are there any one know how can i do to run a node table ? Message-ID: <8d1mhg$aa2$1@gw.localdomain> Hello evrybody, I find in the Python C API the folwing function: struct _node* PyParser_SimpleParseString (char *str, int start); struct _node* PyParser_SimpleParseFile (FILE *fp, char *filename, int start); but i do'nt fin a function like PyObject* PyRun_String (struct _node *str, int start); Are there any one, now how can i do to run a node table ? From dalke at acm.org Sat Apr 8 21:06:17 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 8 Apr 2000 19:06:17 -0600 Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> <8cocgb$iuk$1@pegasus.csx.cam.ac.uk> Message-ID: <8cokt5$opj$1@slb1.atl.mindspring.net> Me: >>How about >> x = getattr(a, "weeble", 0) + getattr(b, "wombat", 0) Nick Maclaren: >Thank you, yes, that does deal with that specific example. But >it does not extend to the general case. Ahh, I thought the general case was "test if something exists and, if so, get data from it, otherwise use a given value." What is the general case you are interested in - that of C's ternary ?: operator? I've rarely missed it, because most of the subcases are handled by things like getattr. Andrew dalke at acm.org From nickb at earth.ox.ac.uk Tue Apr 18 08:42:44 2000 From: nickb at earth.ox.ac.uk (Nick Belshaw) Date: Tue, 18 Apr 2000 13:42:44 +0100 Subject: May 27th PARTY! References: <006201bfa756$896e5a80$da00a8c0@austin.rr.com> Message-ID: <38FC5844.D7DF90EB@earth.ox.ac.uk> Gees - I know they want everyone to go but - do you think we could just send Guido as our representative? - I am busy on the 27th. /N From aa8vb at yahoo.com Fri Apr 21 07:40:28 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 21 Apr 2000 07:40:28 -0400 Subject: how do i pack and unpack messages in python? In-Reply-To: <00ed01bfaad2$abcf3200$2801000a@iel.ie> References: <008301bfaacb$42fe2c60$2801000a@iel.ie> <20000420100706.A624577@vislab.epa.gov> <00ed01bfaad2$abcf3200$2801000a@iel.ie> Message-ID: <20000421074028.A734152@vislab.epa.gov> Shaun: |Randall: |> Shaun: |> |id : 10 |> |subid : 13 |> |NV sequence : {14, "shaun"-string |> | {20, ["Anytown, Anywhere"]-list |> | {34, 1234567890-int |> | |> |i want to pack the message to look like this: |> | |> |10 fs 13 fs 14 fs s shaun fs 20 fs l s anytown fs s anywhere fs i |> |1234567890 gs gs |> |> I was going to mention the struct, array, or xdrlib modules to you, but |> from your desired output format (all ASCII it appears), it looks like |> a simple string.join would do the job: | |actually randall, i kinda simplified the output, it was more representative |than actual, so if you have time to mention the struct, array, or xdrlib |modules, i would be gratefull. struct gives you packing and unpacking of basic Python types into binary data structures (like C structures). array does this for long homogeneous sequences of integer and floating point types (you can use struct, but array saves looping in Python). And xdrlib gives you the capability to serialize to a binary RFC 1014 stream such as that used by RPC. So if you want to write a binary stream of the above data, you may want to check out struct or xdrlib. >>> import struct >>> struct.pack( 'iiii5s', 10, 13, 14, len('shaun'), 'shaun' ) '\000\000\000\012\000\000\000\015\000\000\000\016\000\000\000\005shaun' >>> import xdrlib >>> packer = xdrlib.Packer() >>> packer.pack_int( 10 ) >>> packer.pack_int( 13 ) >>> packer.pack_int( 14 ) >>> packer.pack_string( 'shaun' ) >>> packer.get_buffer() '\000\000\000\012\000\000\000\015\000\000\000\016\000\000\000\005shaun\000\000\000' -- Randall Hopper aa8vb at yahoo.com From mwh21 at cam.ac.uk Fri Apr 14 04:27:03 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Apr 2000 09:27:03 +0100 Subject: how do I know to what module an object belongs? References: Message-ID: "Michal Wallace (sabren)" writes: > On Thu, 13 Apr 2000, Michal Wallace (sabren) wrote: > > > I know I can just as easily have them pass a reference to the > > module along with it, but I'd be happier if I could just look at the > > connection object and know which module it came from. Can I do this? > > Um.. Okay.... > > for just about every module I've tried, I can do: > > module = eval(dbc.__class__.__module__) > > ... EXCEPT for ODBC.Windows.. > > >>> dbc > > >>> dbc.__class__ > Traceback (innermost last): > File "", line 1, in ? > AttributeError: __class__ > >>> > > what gives? Presumably dbc is not a Python class, but an extension type. See what type(dbc).__name__ says; maybe you can special case for that? Otherwise, I think you're hosed. I'm not sure it's a good idea; it sounds rather fragile to me. 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 vetler at ifi.uio.no Sat Apr 1 08:59:25 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: Sat, 1 Apr 2000 15:59:25 +0200 (MET DST) Subject: Emacs Python mode In-Reply-To: <20000401082513.B1353928@vislab.epa.gov> Message-ID: on 2000-04-01, Randall Hopper wrote: > |I just had an idea. Using the Emacs python-mode, would it be possible > |to somehow hide the function-bodies? > | > |Sometimes it would be useful to get an overview of the functions > |provided by a class. > > Your prayers have been answered. See Ken Manheimer's outdent.el for Emacs > (http://www.python.org/emacs/). Collapsable Python blocks, block skips, > etc. sounds great! thanks :) vr From frankr at first-mind.de Thu Apr 13 12:16:05 2000 From: frankr at first-mind.de (Frank Rotermund) Date: Thu, 13 Apr 2000 18:16:05 +0200 Subject: Call by Reference / Value Message-ID: <8d4rr7$t8k$1@newnews.ilk.de> Hello I'm building an interface between Python and a library written in C by using Swig. My problem is, that many methods of the library are changing the parameters that are given to them. Is there a way, to tell Python that it should work on with the changed values after a method-call. Thanks in advance! From markx.daley at intel.com Tue Apr 25 13:45:38 2000 From: markx.daley at intel.com (Daley, MarkX) Date: Tue, 25 Apr 2000 10:45:38 -0700 Subject: mxODBC error trapping Message-ID: I am accessing databases using the notes by John Dell'Aquila for ODBC using Python Database API. It works fine, but now I am trying to set up error trapping in the event that a connection fails to be made. Here is the basic code structure: def collect(): "Routine to query all servers for all names for time period defined in timer." # Define some variables for index in servername: try: # Big routine to collect data and write to file except dbi.operation-error: servername.append(index) Here is the error message I get: Traceback (innermost last): File "", line 1, in ? collect.collect() File "C:\PROGRA~1\Python\collect.py", line 50, in collect except dbi.operation-error: AttributeError: operation If I change the exception to just OperationError, I get this: Traceback (innermost last): File "", line 1, in ? collect.collect() File "C:\PROGRA~1\Python\collect.py", line 50, in collect except OperationalError: NameError: OperationalError I guess I don't know enough about exceptions to trap them properly. Any hints? - Mark From martin.franklin at waii.com Thu Apr 13 06:24:53 2000 From: martin.franklin at waii.com (Martin Franklin) Date: Thu, 13 Apr 2000 11:24:53 +0100 Subject: Why is if a in dict.keys() so slow..... Message-ID: <38F5A075.CDFA32D9@bedford.waii.com> Hi, Just thought i'd throw this out there.... This is very slow:- if split[0] in map_dict.keys(): print 'found it!', map_dict[split[0]] else: print 'not found' Compared to:- try: print 'found it!',map_dict[split[0]] except: print 'Not found' The dictionary had about 40000 key:value pairs and I needed to look through it 250000 times..... Question is why? Thanks, Martin. From mwh21 at cam.ac.uk Sat Apr 1 08:33:07 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 01 Apr 2000 14:33:07 +0100 Subject: Emacs Python mode References: Message-ID: Vetle Roeim writes: > I just had an idea. Using the Emacs python-mode, would it be possible > to somehow hide the function-bodies? Try "M-8 C-x $", which isn't the easiest thing to type, but it works reasonably well. It's worth readong through the extended help on python-mode (type "C-c C-h m" or "C-c ?"), which I did yesterday and realised that there were lots of shortcuts for handy things I never knew existed. Of course I now can't remember what the key combinations for any of these cool things were. Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From ivanlan at callware.com Tue Apr 4 21:43:57 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 04 Apr 2000 19:43:57 -0600 Subject: Starving for an Advanced Python Book Message-ID: <38EA9A5D.F35B3E74@callware.com> Hi All-- Bjorn Pettersen wrote: > [snip] > At $12.00 I would say the book is a steal and contains a wealth of > information no serious Python programmer should be without :-) And if > you're like me, you'll print it out, bind it at Kinko's, and place it > half way between your Linux and win2k boxes . > I agree. Even without Linux support and with the stupid licensing (it ought to be per person, not per computer--that means I can't legally use it at home), it's a steal. I paid $16 to have it double-sided and bound at Kinko's, and consider it a small price to pay for an excellent resource. My only quibble with the printed version--sucky index. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From moshez at math.huji.ac.il Sat Apr 29 10:24:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 29 Apr 2000 17:24:59 +0300 (IDT) Subject: GUI developping with Python (Any tutorial ) In-Reply-To: Message-ID: On Sat, 29 Apr 2000 abouf066 at aix2.uottawa.ca wrote: > Greetings, > > I wonder if anybody can point me to a site where I could find the > starting steps to develop a GUI using python. The first step would be to decided what GUI toolkit to use, which in turn depends on your platform (UNIX? Windows? Mac? Multi-platform), available tools (C compilers, C++ compilers) and other things. If you indicate what you need to develop GUI for, we might be able to help you choose a GUI toolkit, and find a tutorial for it. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From tjreedy at udel.edu Thu Apr 27 23:16:58 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 27 Apr 2000 23:16:58 -0400 Subject: The Simple Economics of Open Source References: <1255272357-66924550@hypernet.com> Message-ID: <8eavgs$ker$1@news.udel.edu> "Gordon McMillan" wrote in message news:1255272357- > One of those open source delusions is that being open source > somehow makes a difference to the end consumer. Bunk. Whether most consumers yet know it or not, there is all the difference in the world. The closed source model gives us spyware (Trojon-horse ware) like RealJukebox and many others (and, if rumor were true, Windows -- the possibility is always there). On ad-related spy engine has apparently been used in hundreds of 'free' (closed source) programs (I believe www.grc.com is URL with info on this). Fom a privacy/security viewpoint, putting closed-source software on a networked computer with anything inportant on it is a bit insane. I predict that in a few years, more consumers will understand this. > End users don't read code, and never will. Does not matter for privacy/security checking see above and below. > Opening the source > benefits other developers, who in turn will almost certainly > benefit you by making the code better, or integrating with > other software - thus indirectly benefitting users. The other benefit is that responsible people can check for funny business. This is much easier with open source than with having to reverse engineer the behavior of closed-source stuff. Terry J. Reedy From raffael at mediaone.net Wed Apr 26 20:57:57 2000 From: raffael at mediaone.net (Raffael Cavallaro) Date: Thu, 27 Apr 2000 00:57:57 GMT Subject: The Simple Economics of Open Source References: <390534BB.3D6CEBDF@libc.org> Message-ID: In article <390534BB.3D6CEBDF at libc.org>, Bill Anderson wrote: >Unless you are redefining >'commodity' (possibly by your 'known to many' remark) to fit whatever is >provided as counter evidence. A commodity is that which is available in large quantities, from many vendors offering essentially interchangeable product. This makes commodities inexpensive, hence the term "at commodity prices" meaning, "inexpensive." In intellectual property then, a commodity is that which is known to many and not under copyright or patent. Because of the near zero cost of copying, the large quantity availability is a non-issue with software. What matters is whether or not it is known to many, because you then have many potential suppliers. If it is only known to a few, then the number of potential suppliers is few, and prices are not like those of a commodity market. Examples: The JPEG standard is known to many, and not under copyright or patent. Therfore, software that compresses/decompresses JPEGs is available from many suppliers (again, the ease of copying electronic media moots the quantity issue). Because of the fact that JPEG compression/decompression is known to many, software to perform these functions is plentiful and cheap (i.e., often free). The Microsoft Word (.doc) format is not known to many (really, only to MS programmers) and binaries to read/display/edit data in this format are under copyright. Although others have tried to reverse engineer this ever changing format, they have not been 100% successful. The result is that if you want to be certain that you can read/display/edit a document in this format, you have only one supplier, namely, Microsoft. Because of this, software to perform these functions is not a commodity item, and is quite expensive. In short, I'm not "redifining" the word "commodity." I'm using it as it has always been used. I think that many open source advocates have failed to apply simple logic to the economics of open source, believing that somehow, the internet, or software, is immune from simple laws of supply and demand. They are not. Ralph -- Raffael Cavallaro, Ph.D. raffael at mediaone.net From hniksic at iskon.hr Thu Apr 13 03:59:02 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 13 Apr 2000 09:59:02 +0200 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> Message-ID: Alex writes: > > > -- How can I browse the Python documentation without firing > > > up a web browser? > > > > By using Info. That's what I do, all the time. Info has the added > > nicety of being able to search through the whole documentation for a > > keyword. > > I love to use info, too. Unfortunately, I can't get the latest > version of the documentation in that format, so I don't know whether > I'm going to be able to use it for much longer. Well, I don't know. I'm using the Debian package `python-doc' which contains info, so I guess it's possible to create it. From bjorn at roguewave.com Mon Apr 24 12:00:34 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Mon, 24 Apr 2000 10:00:34 -0600 Subject: Simple list.append() question References: Message-ID: <39046FA2.603EAFE5@roguewave.com> Jeff Massung wrote: > > I'm just learning, but my guess is this: > > >>> l=[[]]*3 > >>> l > [[], [], []] > >>> l[0].append(3) > >>> l > [[3], [3], [3]] > >>> id(l[0]) > 8539088 > >>> id(l[1]) > 8539088 > >>> id(l[2]) > 8539088 > >>> > > The *3 just made three lists pointing to the same place. I don't know how to > get what you want tho ;) someone else can enlighten me, too :). One way is: x = map(lambda x:[], [[]]*3) although there has to be a prettier way... -- bjorn From jtschirr at engineering.uiowa.edu Sat Apr 15 01:03:43 2000 From: jtschirr at engineering.uiowa.edu (Juerg Tschirren) Date: Sat, 15 Apr 2000 05:03:43 GMT Subject: Imaging Library & Numerical Python Message-ID: <38F7F865.9C86399C@engineering.uiowa.edu> Does anybody have experience with getting the Imaging Library and Numerical Python working together? What I would like to do is importing an imaging with the Imaging Library and then using functions from both -- the Imaging Library and Numerical Python -- on this image. Juerg From effbot at telia.com Mon Apr 10 12:04:14 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 10 Apr 2000 16:04:14 GMT Subject: comparing strings and ints References: <8css5t$tti$1@merrimack.Dartmouth.EDU> Message-ID: <2YmI4.366$rc9.188014080@newsb.telia.net> Mark H.H. Montague wrote: > Does anyone know why it is not a type error to compare a string and an > int with '>' ? For example, I just spent over an hour debugging code > that essentially did this: > > >>> 45 > '0' > 0 > > Of course, the '0' was a variable read in from a file, which I forgot > to convert to a string. Bad old perl habits. But I'm having a hard > time imagining a situation where someone would be intentionally and > meaningfully comparing a string and an int. > > Any ideas? why not read the fine documentation: http://www.python.org/doc/current/ref/comparisons.html which explains that: Objects of different types always compare unequal, and are ordered consistently but arbitrarily. This unusual definition of comparison was used to simplify the definition of operations like sorting and the "in" and "not in" operators. and goes on to say: In the future, the comparison rules for objects of different types are likely to change. From niels at endea.demon.nl Mon Apr 17 09:09:22 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Mon, 17 Apr 2000 15:09:22 +0200 Subject: an intern-like memory saver References: <8d5ing$heb$1@nnrp1.deja.com> <38F7318F.AE4F0EE5@endea.demon.nl> <8d8fe0$nr5$1@nnrp1.deja.com> Message-ID: <38FB0D02.49B6F3CD@endea.demon.nl> sjmachin at lexicon.net schreef: > > I tried "intern" and read the source code for it. Speed is not a > consideration until I run out of real memory and start swapping to > disk. My objective is to reduce memory usage so that that doesn't > happen. "intern" has its *own* hidden dictionary; if I use it, it may > even *increase* my memory usage. If the number of distinct strings weren't large, that would not be a problem, but if it is, it is. > I already have my own dictionary with > all those strings as keys, so I save the overhead part of the intern > dictionary. For what it's worth my key_ref method works with any > objects that can be dictionary keys, not just strings. What are the > other ways you say one can do very much the same thing in Python? Variations on the same theme. All of them will use more memory than what you were proposing. -- Niels Diepeveen Endea automatisering From m.faassen at vet.uu.nl Tue Apr 18 12:26:28 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 18 Apr 2000 16:26:28 GMT Subject: Using python on the web References: Message-ID: <8di2bk$l1s$1@newshost.accu.uu.nl> Charley Horse wrote: > I've just started fooling with python. I've looked around the python > site and a number of the other sites referenced there and am a bit > puzzled. Umm... how does one go about using python for web applications, > especially database driven apps? Almost everything deals with python > just as a language, as C++ would be. That's because Python is a language. Python isn't a web-specific language, after all. > Not much about the web specifically. > I was a bit shocked to find the only direct refs on about > this at python.org are entwined with CGI (unless I missed it). Why is CGI so shocking? It's used quite a bit, after all? You can write a database driven web application using Python with CGI. CGI from Python isn't hard either. > I have no exposure to CGI, but rather to php, CF, and ASP, so python has > gone from looking very attractive to looking... well, like a puzzle. I'm not sure why your exposure to PHP, ColdFusion or ASP instead of CGI would turn Python into a puzzle. There _is_ ASP support for Python, enabling you to use Python as a ASP language. Others will have to explain to you how and where to look for information, as I've never used it. > I know about Zope, but am interested in how one uses python on the web just > by itself. Zope would be the equivalent of ColdFusion for Python, as it's a web application server. Besides using Python with CGI or ASP, you can use Zope's ZPublisher (formerly Bobo) independently to publish arbitrary Python objects to the web. I've never used this, and the documentation may be scarce, but it looks quite neat. You may want to look that up. Database integration in Python isn't bad either, look at the database topic guide: http://www.python.org/topics/database/ And look at the web topic guide if you haven't seen it: http://www.python.org/topics/web/ The vaults of Parnassus are also a good resource, here is for instance a link to its web category: http://www.vex.net/~x/parnassus/apyllo.py/812237977.127386987 Also look at the 'info' category of the Vaults. Good luck! Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From scherbi at bam.com Mon Apr 24 12:11:25 2000 From: scherbi at bam.com (Bill Scherer) Date: Mon, 24 Apr 2000 12:11:25 -0400 Subject: ftplib sendcmd Message-ID: <3904722D.12EE9927@bam.com> Howdy - I'm having trouble with ftplib's sendcmd method (Python 1.5.2 on RH linux 6.1): >>> ftp = ftplib.FTP(host, user, password) >>> ftp.sendcmd('umask 002') Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python1.5/ftplib.py", line 228, in sendcmd return self.getresp() File "/usr/local/lib/python1.5/ftplib.py", line 201, in getresp raise error_perm, resp ftplib.error_perm: 500 'UMASK 002': command not understood. >>> The umask command does, of course, work using a standard ftp client to the same host. Other commands, chmod, etc, suffer equal fate. Is this not what sendcmd is for? What am I doing wrong? Thanks! -- William K. Scherer Sr. Member of Applications Staff Verizon Wireless From mbel44 at dial.pipex.net Wed Apr 5 07:12:15 2000 From: mbel44 at dial.pipex.net (Toby Dickenson) Date: Wed, 05 Apr 2000 12:12:15 +0100 Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <5l7leern5v.fsf@eric.cnri.reston.va.us> <8cdg92$j0m$1@nntp6.u.washington.edu> <8cdig3$s7f$1@slb6.atl.mindspring.net> Message-ID: aahz at netcom.com (Aahz Maruch) wrote: >In article <8cdg92$j0m$1 at nntp6.u.washington.edu>, >Russell E. Owen wrote: >> >>But tuples seem a less than wonderful choice to me. Protocol flexibility >>presumably requires each protocol to have its own tuple with its own >>numer of fields in its own order. That's a lot to remember and try not >>to get mixed up. > >I second this. I'd be happy with either dict or class, with a *slight* >preference for a class. Does the single-argument connect require a 2-tuple, or just a two element sequence? If a sequence will do, then you can use an address class today. Toby Dickenson tdickenson at geminidataloggers.com From embed at geocities.com Thu Apr 20 11:24:20 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 20 Apr 2000 11:24:20 -0400 Subject: Python Parsers Comparison References: <20000420093945.A624723@vislab.epa.gov> Message-ID: > For example, a comma-separated list of nested vectors would be a good example: > > [ 1, 2 ], [ 3, 4 ] > [ [ 1,2 ],[ 3,4 ] ], [ 5.6 ] > etc. > Wherever I am able to do so, I use eval() and design my grammar to be basically PYTHON. Very nice scheme, and you can even use 'restricted execution' if safety is a concern. In the above cases: safedict={"__builtins__":{},"NULL":None} # your own symbols, and constants str = '[1,2,],[1,2],[[1,2],[1,2]],[NULL,NULL]' x = eval("["+str+"]",safedict,safedict) print x If you are in control of the grammar, and you are inventing it, why not stick with python, if on the other hand, the grammar is something you're stuck with 'as-is', and it's not a proper subset of some Python construct, then all bets are off. I certainly WOULD like to see some tutorial material on constructing such parsers, because I don't know the first thing about them. We studied this stuff in undergrad C.S., but it was trivial stuff (BNF grammars, some simple parsing code techniques in C). We never did learn the Nifty Hardcode Stuff. Warren From echuck at mindspring.com Thu Apr 20 00:23:28 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Thu, 20 Apr 2000 00:23:28 -0400 Subject: [ANNOUNCE] Webware for Python 0.1 References: <5650A1190E4FD111BC7E0000F8034D26A0F40D@huina.oceanic.com> Message-ID: <38FE863F.BBCC8399@mindspring.com> Thanks for the report. I tested before hand, but apparently not well enough. It should be fixed now. -Chuck Doug Stanfield wrote: > The following intrigues me but its not probably the best endorsement. When > I hit your published link I get: > > ERROR > > Traceback (innermost last): > File "MainPage.py", line 55, in main > _main() > File "MainPage.py", line 49, in _main > inc_counter() > File "MainPage.py", line 23, in inc_counter > f.write(repr(counter+1)) > NameError: counter > > But I guess you're at V0.1 so proving the error reporting works is a good > thing. :-) > > This was from a redirect to http://writewithme.com/Webware/ by the way, so > maybe therin lies the problem. I am still interested in looking at the > package. > > -Doug- > > > -----Original Message----- > > From: Chuck Esterbrook [mailto:echuck at mindspring.com] > > Sent: Wednesday, April 19, 2000 5:52 PM > > To: python-list at python.org > > Subject: [ANNOUNCE] Webware for Python 0.1 > > > > > > > > Webware for Python is a definitive suite of Python software > > components for use in web development. Each component has a > > focused purpose and can often be used on it's own. At the > > same time, the components are designed to work together where > > appropriate. As a user of Webware, you can bite off as much > > or as little as you want to chew. > > > > You can find more and download at: > > > > http://www.writers-webshop.com/Webware > > > > > > -Chuck > > -- > > http://www.python.org/mailman/listinfo/python-list > > From chafik at nevrax.com Wed Apr 5 04:48:03 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Wed, 5 Apr 2000 10:48:03 +0200 Subject: python16_d.lib, python16_d.dll python15_d.dll Message-ID: <013101bf9edb$a76984c0$1001a8c0@nevrax.net> ----- Original Message ----- From: Sameh chafik pro To: Python mail list Sent: Wednesday, April 05, 2000 10:35 AM Subject: (no subject) Hello evry body, Are there any way to have the python16_d.lib and .dll, or the python15_d.dll ????? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwh21 at cam.ac.uk Sun Apr 2 21:12:28 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 03 Apr 2000 02:12:28 +0100 Subject: getting a key without an echo and Enter References: Message-ID: "Gang Seong Lee" writes: > Hi, > > How can I get a key input without having it echoed. > The following statement echoes and waits until I press Enter key. > > ch = sys.stdin.read(1) > > Can I get the key as soon as I press it without an echo. (No Enter key) > > Thanks in advance Heh. I was trying to do this the other day; I came up with the rather hairy & unix specific: import termios,TERMIOS,os,select,string,sys def read1(): oldattr = termios.tcgetattr(0) try: attr = termios.tcgetattr(0) attr[2] = (attr[2] & ~TERMIOS.NLDLY) | TERMIOS.NL0 attr[3] = attr[3] & ~(TERMIOS.ICANON|TERMIOS.ECHO) termios.tcsetattr(0,TERMIOS.TCSANOW,attr) return os.read(0,1) finally: termios.tcsetattr(0,TERMIOS.TCSANOW,oldattr) On windows, I think some variant of import msvcrt msvcrt.getch() do the job, but I can't test that here. HTH, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From mal at lemburg.com Tue Apr 4 05:43:46 2000 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue, 04 Apr 2000 11:43:46 +0200 Subject: Starving for an Advanced Python Book References: <20000404040941.7766.qmail@web2106.mail.yahoo.com> Message-ID: <38E9B952.A56C3877@lemburg.com> lewst wrote: > > Having finished "Learning Python", I'm now looking for an advanced > Python text. ORA's "Programming Python" is a natural choice, but I > can't bear buying this outdated book when the 2nd edition is due out > in a few months (I'm dying here Lutz, hurry it up already!). However, > I really need something in the interim period. The library reference > manual is fine but usage is difficult for me to figure out sometimes > because there are very few examples included. > > Does anyone have any suggestions? I suppose I'm looking for a text > that has examples of how to solve various kinds of programming > problems in Python and also examples of code showing how the library > and various modules actually work. How is the "Python Essential > Reference" on examples? Is it just a rebinding of the python.org > library reference Fredrik Lundh has compiled such a cookbook. I don't have the URL handy, but I'm sure you'll find it on their www.pythonware.com site. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From warlock at eskimo.com Mon Apr 3 00:36:02 2000 From: warlock at eskimo.com (Jim Richardson) Date: Mon, 03 Apr 2000 04:36:02 GMT Subject: Just doing local file testing References: <38E796BC.23191B2@regnoc.com> <00040214141502.04535@quadra.teleo.net> <38E7D6DE.EA09C891@regnoc.com> Message-ID: On Sun, 02 Apr 2000 23:23:59 GMT, Jim Conger, in the persona of , brought forth the following words...: > > >I'm not even to the point of using Apache yet - I'm just to launch the >script locally from within the browser by having the form element point >to a script on disk.  In other words, this is just a development environment >using only local files. This won't work, as it is the webserver that decides that the .py is a script and passes it to python for execution. In local mode, your browser simply treats the script as another text file, and an improperly formatted (in html terms) on at that. -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From jbauer at rubic.com Tue Apr 18 18:09:50 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Tue, 18 Apr 2000 17:09:50 -0500 Subject: Date class? References: <8dikk2$p4s@flatland.dimensional.com> Message-ID: <38FCDD2E.A1C2CF6E@rubic.com> Alex, Thanks for the kind words. I emailed Jim a copy of normalDate.py, since the Starship is still down. Jeff Bauer Rubicon Research Alex wrote: > You could try normalDate. I have found that fairly useful, > once or twice. From guido at cnri.reston.va.us Tue Apr 4 09:49:48 2000 From: guido at cnri.reston.va.us (Guido van Rossum) Date: 04 Apr 2000 09:49:48 -0400 Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> Message-ID: <5l7leern5v.fsf@eric.cnri.reston.va.us> tseaver at starbase.neosoft.com (Tres Seaver) writes: > The point of this debate is that classifying it as a *bug* is, well, > debateable. Years of socket programming experience makes: > > s.connect( host, port ) > > seem like a perfectly reasonable, sane interface; disallowing it > may preserve "orthagonality," or some other academic purity, but > it *breaks existing applications coded to the published interface*, > with no appreciable real-world benefit (yes, I realize that the published > interface is inconsistent; I do not accept the deprecation of the > examples as a reasonable argument.) Consider that *every one* of the > protocol modules which offers a connect() method uses a two-argument > signature for it: ftplib, gopherlib, httplib, imaplib, nntplib, poplib, > smtplib, telnetlib, urllib. And they all *use* the two-argument connect > when invoking their underlying socket! No Python module in the standard > library uses the single-argument connect, period. > > This is *not* the same case as the list.append() one, where the > published interface was itself consistent -- I was quite surprised to > learn just this spring that multi-argument append was even possible. > But the socket module is one of the first I learned in Python, and I > have consistenly used the two-argument connect. Constructing a spurious > "address" object (which has no behavior, and exists only to be torn > apart inside the implementation) seems a foolish consistency, beyond > doubt. > > Rough-consensus-and-running-code-wins-every-time'ly Before more people mail this to me, let me apologize. I didn't realize that there were so many examples of the 2-argument form. I don't want to break that much code, so I'll revert the decision in the next alpha release. However, I'll do so for purely backwards compatible reasons, and I will continue to press for the tuple address as the correct form. This has nothing to do with academic purity. It is because sockets are, by their very nature, address family neutral, and not all address families use a host and a port to identify a socket. For example, Unix sockets use just a filename. The argument that gopherlib c.s. define a 2-arg connect() doesn't mean that socket should, to: those are all Internet specific protocols, where host+port is the norm; the lower-level socket API must support other address families. The argument that the address object is spurious doesn't hold water. There are many places where it is convenient to hold an address in a single variable, and a tuple is the obvious way to represent this. (The alternative, a "host:port" string, seems too Perlish to me.) Note also that recvfrom() returns the address as a tuple (if it is an IP address) and sendto() requires the address to be passed as a tuple -- the canonical form of an address is clearly a tuple. Repeat after me: SOCKETS ARE NOT JUST FOR IP CONNECTIONS. But I will fix the code -- it's the only practical thing to do. --Guido van Rossum (home page: http://www.python.org/~guido/) From mhammond at skippinet.com.au Mon Apr 24 22:31:25 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 25 Apr 2000 02:31:25 GMT Subject: Pythonwin com question References: <8dqver$l4v$1@nnrp1.deja.com> <8e2sfb$r6e$1@nnrp1.deja.com> Message-ID: <1s7N4.3219$v85.20999@news-server.bigpond.net.au> "Sam Schulenburg" wrote in message news:8e2sfb$r6e$1 at nnrp1.deja.com... > ## DoEvents # Wait for detector to finish, This has no > # equivalent in Pythonwin Actually, you _may_ need to call pythoncom.PumpWaitingMessages() here (and it can never really hurt :-) > s = 1 # This gives the while loop something to do > #### This is where everything falls apart > #### theFrame is not the correct datatype > dx.GetFrame(1,theFrame) # Retreive one image > > How do I define the correct Varient type in Python? You shouldnt need to. Try saying: theFrame = dx.GetFrame(1) [Or try passing None as the second param] And magically it should all work. If it doesnt, look into running "makepy" over your object and try again. If it still doesnt work, post the code makepy generated for the GetFrame() method and the specific traceback you see... Mark. From ian_maurer at my-deja.com Wed Apr 12 11:18:27 2000 From: ian_maurer at my-deja.com (Ian Maurer) Date: Wed, 12 Apr 2000 15:18:27 GMT Subject: making a .exe References: <8d1u0u$ikb$1@porthos.nl.uu.net> Message-ID: <8d243j$mro$1@nnrp1.deja.com> In article <8d1u0u$ikb$1 at porthos.nl.uu.net>, "Soundwave" wrote: > How can I make an executable file from the *.py files ? > > thanx > > http://www.mcmillan-inc.com/install1.html -- Ian Maurer Sent via Deja.com http://www.deja.com/ Before you buy. From jhauser at ifm.uni-kiel.de Fri Apr 14 04:22:28 2000 From: jhauser at ifm.uni-kiel.de (Janko Hauser) Date: 14 Apr 2000 10:22:28 +0200 Subject: Questions on 1.6a2's string methods References: <38F6C904.76B538E5@concentric.net> Message-ID: <87snwp3xdn.fsf@ifm.uni-kiel.de> Manus Hand writes: > 3. Are the classlike standard types (list, dictionary, and now > string) equipped with a __dict__ attribute? I can see the names > of all functions supported by a user-defined class by saying > className.__dict__.keys(), but I cannot see the list of methods > for the string type (at least not in the same way). Thus my > need to ask silly questions like #1 above (maybe capwords is > there by some other name??) > I haven't tried it with the new string type but you can look up the methods bye the __methods__ attribute. >>> a=[1,2] >>> a.__methods__ ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>> b={1:''} >>> b.__methods__ ['clear', 'copy', 'get', 'has_key', 'items', 'keys', 'update', 'values'] 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 zorro at zipzap.ch Fri Apr 14 08:41:11 2000 From: zorro at zipzap.ch (Boris Borcic) Date: Fri, 14 Apr 2000 14:41:11 +0200 Subject: Python Starship Grounded?? References: <38F6B2DF.940E7C23@concentric.net> Message-ID: <38F711E7.3FA0CA58@zipzap.ch> Manus Hand wrote: > > Anyone here able to do anything about the illness that seems to have > come over starship.python.net? I second the question. Boris Borcic -- "Money was invented to enslave arithmetics" From fredrik at pythonware.com Thu Apr 20 08:23:23 2000 From: fredrik at pythonware.com (fredrik at pythonware.com) Date: Thu, 20 Apr 2000 12:23:23 GMT Subject: socket.SO_REUSEADDR References: <38FEEA44.6C05E2B0@inka.de> Message-ID: <8dmsrd$8ta$1@nnrp1.deja.com> Michael Str?der wrote: > For avoiding problems with errors like > > socket.error: (98, 'Address already in use.') > > during immediate restart of my web server I'm following the hint to > set the socket option SO_REUSEADDR. But I did not succeed. The > server starts and works. When I stop it and try to restart > immediately the above message appears again. I had a short look at > man 7 socket and man setsockopt but this was a little bit too much > for me... that getproto stuff looks strange. try this instead: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) Sent via Deja.com http://www.deja.com/ Before you buy. From nick at webthing.com Thu Apr 20 17:30:04 2000 From: nick at webthing.com (Nick Kew) Date: Thu, 20 Apr 2000 21:30:04 +0000 Subject: Using python on the web References: <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> Message-ID: In article , claird at starbase.neosoft.com (Cameron Laird) writes: > CGI has been dead for at least five years. :-) > I recognize no one here is disputing the proposition. It's > just struck me recently how pervasive the propaganda on this > score is. CGI has an *abyssmal* popular reputation. Several reasons. Like the number of non-programmers who dabble with it, and produce something horrible that gives the impression of working. But I think the main reason is, it's the standard every bandwagon and marketing department has to knock. M$ of course have worked hard to undermine it, with severely broken implementations and "alternatives". The JAVA folks push servlets. And nobody in the open source community has made any serious effort to stand up for it: indeed, rather the opposite - with things like mod_perl stressing that it is Not CGI[1]. I have to confess to some measure of guilt. I started work on an Apache module to implement non-forking CGI, eliminating the so-called CGI overhead. In test conditions it benchmarked very nicely against standard CGI, static HTML pages, and mod_perl, but I never completed it to an operational standard. Well, maybe I'll resurrect it as a getting-to-know-apache-2.0 exercise. [1] Actually mod_perl _is_ CGI, in that it meets the CGI spec. Though of course it does a whole lot more too. -- Nick Kew From andres at corrada.com Wed Apr 26 22:08:00 2000 From: andres at corrada.com (Andres Corrada) Date: Wed, 26 Apr 2000 22:08:00 -0400 Subject: condense whitespace to single space? References: <36NN4.31937$Xk2.119087@tor-nn1.netcom.ca> Message-ID: <3907A100.4C8522E1@corrada.com> k wrote: > > How do I condense the sections of spaces in this string: > > "abc def ghi" > > into single spaces? > > "abc def ghi" One way to do this that avoids using regular expressions is: stringParts = string.split( stringToSplit ) reconstitutedString = string.join( stringParts ) -- ------------------------------------------------------ Andres Corrada-Emmanuel Email: andres at corrada.com ------------------------------------------------------ From smalleys at gte.net Mon Apr 24 17:09:58 2000 From: smalleys at gte.net (sue) Date: Mon, 24 Apr 2000 21:09:58 GMT Subject: pattern-based string expansion References: <38F52C61.A5D72F89@gte.net> <8del87$5md$1@slb6.atl.mindspring.net> <38FE70DB.29A4B1A1@gte.net> <8dndbe$dcu$1@slb6.atl.mindspring.net> Message-ID: <3904B835.327E27AB@gte.net> I've hacked RE engines before, starting with HPUX 7, using regex.h. Nick - Thank you for the source. I'll try and work on it this week. Andrew - Python access to an RE engine. My Ada parser will love it. Thanks! Sue. From bsb at winnegan.de Fri Apr 7 13:06:09 2000 From: bsb at winnegan.de (Siggy Brentrup) Date: 07 Apr 2000 19:06:09 +0200 Subject: Paid to work in Python? (was: Re: Choice Of Language) In-Reply-To: ngps@madcap.dyndns.org's message of "7 Apr 2000 16:34:34 GMT" References: <8c3ats$b5f$1@nntp.Stanford.EDU> <38e5f8ed.29659873@news.nikoma.de> <8cl2mq$971$1@mawar.singnet.com.sg> Message-ID: <877le9suwu.fsf@orge.winnegan.de> ngps at madcap.dyndns.org (Ng Pheng Siong) writes: > According to Philip 'Yes, that's my address' Newton : > > (The German term "eierlegende Wollmilchsau"[1] comes to mind.) > > > > [1] literally, "egg-laying wool-milk-sow [female pig]", i. e., something > > that tries to do too much at once. > > I once saw a German term that was translated to "improve-worse-ment." > > Can some one provide the German word, please? I guess you mean Ver-schlimm-besserung (remove dashes), but thats a worsening correction. You won't find it in dictionaries though. Siggy -- Siggy Brentrup - bsb at winnegan.de - http://www.winnegan.de/ ****** ceterum censeo javascriptum esse restrictam ******* From kcazabon at home.com Mon Apr 17 23:44:52 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Tue, 18 Apr 2000 03:44:52 GMT Subject: TKMessageBox, and TKINTER console? References: Message-ID: Hey Benjamin; I think your problem is that the TKMESSAGEBOX is not meant to be a main window, but a child of a parent window. So, when you invoke the "Frame" for it, it creates a Toplevel widget to go along with it. Normally, your 'root' application is a Tkinter.Tk() widget, which you pack all your other things into. The "popup" would be a child of that window, and both would be displayed on the screen. If you create a non-toplevel style widget on it's own, such as a "Frame", it will automatically create the Toplevel as a second window. This is your problem. If you don't want the "parent" to be displayed, create it, but 'withdraw' it before the mainloop() is called. do this by calling x.withdraw() However, if you're using the "Message" widget, just pack it in the parent Tk window, as follows, instead of having it as a separate Frame. ######################## import Tkinter a = Tkinter.Tk() b = Tkinter.Message(a, text = "Hello, this is a Message Widget") # the first argument above specifies the 'parent' to pack it in. b.pack() a.mainloop() ######################## "Benjamin Schollnick" wrote in message news:rNHvjEdhm5Pp-pn2-Y8HWP45V5PG0 at d185d18f2.rochester.rr.com... > Folks, > > Crazy Question..... I'm starting to mess around with Tkinter, and > for now at least, just trying to display "pop-up" dialogs. I found > the > TKMESSAGEBOX unit, in the lib-tk directory, and that works great for > my purposes. > > Except, for a small "appearance" problem. I call the TKmessagebox > routines, and their are TWO windows. One is the pop-up I've called, > and the > other is the Tkinter "Console" (??). Or at least that's the nickname, > I've given it. > > I've tried a variety of different things to get rid of it...For > example, calling > junk= TK.tk() to a variable, and passing it as "master=junk", or as > "parent=junk" > in the code... > > I'm not sure if there is anyway to get rid of that darn console. > > Anyone got some suggestions for a really confused first time > Tkinter'er? > > - Benjamin > ==================================================== > (Remove "NoSpam" to Email me) > ==================================================== > Please feel free to copy any and or all of this sig. > A little something for spam bots: > > root at localhost postmaster at localhost admin at localhost > abuse at localhost postmaster at 127.0.0.1 > > Chairman William Kennard: bkennard at fcc.gov > Commissioner Susan Ness: sness at fcc.gov > Commissioner Harold Furchtgott-Roth: hfurchtg at fcc.gov > Commissioner Michael Powell: mpowell at fcc.gov > Commissioner Gloria Tristani: gtristan at fcc.gov > consumerline at ftc.gov > fccinfo at fcc.gov > ssegal at fcc.gov > From noreply at antispam.com Sun Apr 2 12:35:29 2000 From: noreply at antispam.com (Brian Schmidt) Date: Sun, 02 Apr 2000 16:35:29 GMT Subject: www.python.org Message-ID: Anyone else having problems getting into www.python.org the last couple of days? From m.faassen at vet.uu.nl Sun Apr 2 18:47:18 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 2 Apr 2000 22:47:18 GMT Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> Message-ID: <8c8ilm$7fs$1@newshost.accu.uu.nl> Tom Culliton wrote: >>4. assignment to None now works > Huhn? What exactly changed here? You can assign to None in current > versions just like you can to any other name. I thought the push was > to _prevent_ this. Wild, I never knew that the current behavior allowed assigning to None. Quite confusing if you do it: >>> [None, None] [None, None] (okay..) >>> None = 3 >>> [None, None] [3, 3] >>> None 3 Never caused any bugs for me, but I could imagine that could be confusing... It's still in the 1.6a too. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From thomas at xs4all.net Fri Apr 7 07:09:42 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 7 Apr 2000 13:09:42 +0200 Subject: Was Re: need wrapper for ssh/scp In-Reply-To: <8civ14$rm7$1@hammer.msfc.nasa.gov>; from drew.mcdowell@msfc.nasa.gov on Thu, Apr 06, 2000 at 09:19:32PM +0000 References: <8civ14$rm7$1@hammer.msfc.nasa.gov> Message-ID: <20000407130942.E13830@xs4all.nl> On Thu, Apr 06, 2000 at 09:19:32PM +0000, Andrew McDowell wrote: > I also working with ssh to execute some remote commands on different > servers. I'd previously been hobbling together this strange idea of > generating an Expect script in python then running it. (*bleh*) So once I > saw was clued onto the pty module I started playing with it. Well...I'm > either severely confused, or something isn't working properly. Could anyone > offer some help? Help is easiest if you also explain what the problem is ;) I already see one problem though: you read the password with 'string.strip(raw_input())', which means the terminating newline gets stripped off the password, but you dont supply it with os.write(), which means ssh thinks there is more password to come, and patiently sits waiting for it, untill you brutally kill it ;) In your real app you probably want to use select(), by the way, before attempting to read something. Doing a read() when there's no data to be read makes a blocking read, which can lead to deadlocks. See telnetlib for some examples on how to use it. > Here's a sample of how I'm attempting it now: > def remote_ex(hostname, password): [..] > pid, fd = pty.fork() > if pid == 0: > os.execv("/usr/local/bin/ssh",[hostname]) > else: > time.sleep(2) > print "Child says %s" % string.strip(os.read(fd,1024)) > print "Child took %d password bytes." % os.write(fd, password) [..] > def main(): > myhost = string.strip(raw_input("Enter a host:")) > mypass = string.strip(raw_input("Enter your Password:")) > remote_ex(myhost, mypass) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From bjorn at roguewave.com Fri Apr 14 20:10:23 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Fri, 14 Apr 2000 18:10:23 -0600 Subject: The Opposite of list(a,b,c)? References: <38F7A07F.9B0F309C@bigfoot.com> Message-ID: <38F7B36F.C7E8BD0@roguewave.com> "Andrew P. Jewell" wrote: > > Can someone please tell me the opposite of list("A", "b", "string")? > Or maybe there's a smarter way to do what I'm trying to do. I have a > dictionary that looks like this: > > dtnA["key1"] = [val1, val2] > dtnA["key2"] = [val3, val4] > dtnA["key3"] = [val5, val6] > > I want to do something like this: > > def func(SearchTerm): > <...> > retval = [] > for keyval in (dtnA.keys()): > mtch = re.search(patSrchTrm, keyval) > if mtch: > retval.append(UNLIST(dtnA[keyval])) retval = reval + UNLIST(dtnA[keyval]) -bjorn > > I want to end up with just a list of matching values from the > dictionary, ala: > ['val1, val2', 'val3, val4'] > > But I can only get a list of lists: [[val1,val2],[val3,val4]] - which > makes perfect sense based on how I'm doing it - but I don't WANT a > list of lists! Is there anyway to do this? I don't really want to > tuple-ize my dictionary since it's attached to its list values in > other ways. It seems ugly to have to iterate my dictionary value list > to UN-list them manually - and the repr deal is REALLY ugly. What am I > missing?? Thanks for any help! > > Andy > > -- http://www.python.org/mailman/listinfo/python-list From tseaver at starbase.neosoft.com Wed Apr 26 11:00:29 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 26 Apr 2000 10:00:29 -0500 Subject: VIM NT +python References: <2B1262E83448D211AE4B00A0C9D61B03011152BA@MSGEURO1> Message-ID: <56ABD32374048A4C.D7ACAC2B7E495CA1.2AA90F35BCFCAA8E@lp.airnews.net> In article <2B1262E83448D211AE4B00A0C9D61B03011152BA at MSGEURO1>, Pieter Claerhout wrote: >If you download VIM 5.6, unzipped it and ran install.exe, you can >choose to turn on syntax highlighting. Once you did this, the _vimrc >file is created with (python) syntax highlighting turned on. Just to clarify -- this thread is about finding a Vim for Win32 with the embedded Python interpreter compiled in -- *not* about python syntax highlighting with Vim. Mike very generously compiled and made available for download such an executable, which is a hard thing to do if you don't have access to M$ VC--. > >Pieter > >-----Original Message----- >From: Mike Steed [mailto:MSteed at altiris.com] >Sent: Tuesday, April 25, 2000 11:01 AM >To: python-list at python.org >Subject: RE: VIM NT +python > > >Hi, > > I just built the latest version (5.6.69) with the default feature set, >plus the Python interface. I have not tested it beyond > > :python print 'hi' > >which passed with flying colors. > >http://athani.pair.com/msteed/vim/gvim56py.zip > >M. > >> From: Me [mailto:me at nospam.edu] >> Sent: Tuesday, April 25, 2000 11:27 AM >> To: python-list at python.org >> Subject: Re: VIM NT +python >> >> >> So would I! >> >> wrote in message >> news:8e4j27$hgq$1 at nnrp1.deja.com... >> > Does anyone here have a winNT build of the VIM editor that >> has python >> > support switched on? >> > >> > I'd love to get my hands on a copy. Now-to-figure-out-how-to-use-ftplib/urllib-from-within-Vim'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at digicool.com http://www.zope.org Digital Creations From bjorn at roguewave.com Tue Apr 4 19:41:16 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Tue, 04 Apr 2000 17:41:16 -0600 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> <38EA7452.9BFDF37E@callware.com> <8cdt7c$cl1$1@news101.telia.com> Message-ID: <38EA7D9C.7024CF0B@roguewave.com> Anders Eggers-Krag wrote: > > an alternative solution is to call an ADO (ActiveX Data Object) object and > use it through > there which is quite simple. If you do this, make sure you get Mark's programming win32 book. It's an excellent book for many reasons, but it goes into special detail on COM programming (and is so far the only resource I've seen of how COM can be simple and useful -- instead of the normal add-on-later-because-we-need-the-buzzword I normally associate with COM ). -b From dalke at acm.org Sat Apr 22 02:54:28 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 22 Apr 2000 00:54:28 -0600 Subject: getting win32clipboard data Message-ID: <8drih8$d54$1@slb7.atl.mindspring.net> Hello, I've been trying to figure out how to get data from the clipboard using win32clipboard. I'm having a problem turning the integer handle returned from GetClipboardData into something I can extract data from. I've done a workaround using Sam Rushing's calldll and DynWin.windll, based on hints from Wesley Phoa's "clipboard.py" at http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=486991372&fmt=text = = = = kernel32 = windll.module('Kernel32') def get_data_by_format_id(id): win32clipboard.OpenClipboard(0) h = win32clipboard.GetClipboardData(id) if not h: win32clipboard.CloseClipboard() return "" kernel32.GlobalLock(h) try: size = kernel32.GlobalSize(h) text = [] for j in range(size): t = calldll.read_byte(h+j) # read_byte returns a signed character if t < 0: t = t + 256 text.append(t) finally: kernel32.GlobalUnlock(h) win32clipboard.CloseClipboard() # convert to the actual byte string text = string.join(map(chr, text), "") return text = = = = (Note: this isn't the original function - I moved in the Open/Close Clipboard calls from the calling function, but haven't tested it.) I would like to replace the kernel32.{GlobalLock, GlobalUnlock, GlobalSize} and the calldll.read_byte calls with something part of the standard win32 distribution. I figure that if win32clipboard is a standard module, there has to be a way to use it. Also, I'm not reading text data, which explains the read_byte loop as compared to Wesley Phoa's use of read_string. It seems to work. It would be nice to have a "read_data" :) Andrew dalke at acm.org From rburnham at cri-inc.com Wed Apr 19 18:38:07 2000 From: rburnham at cri-inc.com (Roger Burnham) Date: Wed, 19 Apr 2000 22:38:07 GMT Subject: Browse dialog in PythonWin References: <38FE32AB.520C1736@callware.com> Message-ID: <38fe3297.36998571@news-server.socal.rr.com> On Wed, 19 Apr 2000 16:26:51 -0600, Ivan Van Laningham wrote: >Hi All-- >OK, I've been able to get my dialogs up and even install handlers for >button clicks, but now I need to start up a browse dialog that lets >users choose directories. > >And is there any news on Mark Hammond's Starship page? > >-ly y'rs, >Ivan >---------------------------------------------- >Ivan Van Laningham >Callware Technologies, Inc. >http://www.pauahtun.org >http://www.foretec.com/python/workshops/1998-11/proceedings.html >Army Signal Corps: Cu Chi, Class of '70 >Author: Teach Yourself Python in 24 Hours > Ivan, Here's a dialog I adapted from something I found in the PythonWin distribution. ------------------------------------------------------------------- import sys, os import win32ui, win32api, win32con, win32file import string from pywin.tools import hierlist import commctrl def dirParts(path): parts = [] drive, path = os.path.splitdrive(path) pp = os.path.split(path) parts.append(pp[-1]) while pp[0] != path: path = pp[0] pp = os.path.split(path) if pp[-1]: parts.append(pp[-1]) parts.append(drive+'\\') parts.reverse() return parts class DirHierList(hierlist.HierList): def __init__(self, root, listBoxID=win32ui.IDC_LIST1, defaultDir=None): self.defDir = defaultDir hierlist.HierList.__init__(self, root, win32ui.IDB_HIERFOLDERS, listBoxID) self.choice = None def HierInit(self, parent, listControl=None ): hierlist.HierList.HierInit(self, parent, listControl) if self.defDir is not None: parts = dirParts(self.defDir) path = '' for part in parts: path = os.path.join(path, part) items = self.itemHandleMap.items() for key,val in items: if string.lower(val) == string.lower(path): self.list.SelectItem(key) if self.IsExpandable(val): try: self.list.Expand(key, commctrl.TVE_EXPAND) except: pass def GetText(self, item): ret = os.path.basename(item) if not ret: ret = item return ret def GetSubList(self, item): if os.path.isdir(item): try: ret = map(lambda path, base=item: os.path.join(base, path), os.listdir(item)) ret = filter(os.path.isdir, ret) except os.error: ret = None elif item == 'My Computer': possible = string.splitfields(win32api.GetLogicalDriveStrings(), '\000') ret = [] for drive in possible: dType = win32file.GetDriveType(drive) if (drive and dType == win32con.DRIVE_FIXED or dType == win32con.DRIVE_REMOTE): try: os.listdir(drive) ret.append(string.upper(drive)) except os.error: pass else: ret = None if ret is None: return ret else: ret.sort() return ret def IsExpandable(self, item): return os.path.isdir(item) def GetSelectedBitmapColumn(self, item): return self.GetBitmapColumn(item)+6 def TakeDefaultAction(self, item): return PerformItemSelected(item) def PerformItemSelected(self, item): self.choice = item w = len(self.title) self.dlg.SetWindowText(self.title+' ...%s' % item[-(49-w):]) def DirectoryDialog(title, topDir, defDir): dirList = DirHierList('My Computer', defaultDir=defDir) dirList.title = title dlg = hierlist.HierDialog(title, dirList) dirList.dlg = dlg if dlg.DoModal() == win32con.IDOK: return dirList.choice else: return None if __name__== '__main__': direc = DirectoryDialog('Test of directory selection', 'My Computer', 'C:\\CRI\\Images') win32ui.MessageBox('You chose: %s' % direc) ------------------------------------------------------------------- Cheers, Roger Burnham rburnham at cri-inc.com From effbot at telia.com Mon Apr 17 12:44:10 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 17 Apr 2000 16:44:10 GMT Subject: Python flak??? References: <8dfdmq$v1o$1@nnrp1.deja.com> Message-ID: Arint? wrote: > What are the reprecussions of doing a PyErr_Clear() when there is > no error? same as setting a variable to NULL if it already contains NULL. (well, to be precise, PyErr_Clear actually clears three internal variables...) From tom__98 at my-deja.com Mon Apr 10 16:08:31 2000 From: tom__98 at my-deja.com (tom__98 at my-deja.com) Date: Mon, 10 Apr 2000 20:08:31 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> Message-ID: <8ctcar$ml9$1@nnrp1.deja.com> In article <20000405053920.20579.qmail at web2102.mail.yahoo.com>, lewst wrote: > What is it about Perl that makes it so much more popular and have such > a huge grassroots swell? I personally find Perl an abomination and > Python a breath of fresh air. Perl has that first mover advantage I > suppose, but should that really make such a hugh difference? I don't know about others, but I frequently end up using Perl instead of Python, even though I greatly prefer Python as a language. The reasons? Several: * perldoc makes it really easy to find documentation for modules * CPAN and the CPAN module make it really easy to find and install modules: they are all in a single place, they are well indexed, they are searchable, and they can be downloaded and installed with one or two commands. * Even when installing by hand, I find Perl modules easier to install than Python modules. * There seem to be a lot more Perl modules out there than Python modules. * Some modules that are important to me (HTTP, HTML, database, etc.) seem to be more up-to-date for Perl than for Python. * Perl actually has a few handy language features, including lexical closures and automatic caching of compiled regular expressions, which makes it feel not quite as clunky as it is. Also, its syntax makes writing short scripts and one liners disproportionately easy. * Perl now comes preinstalled on a lot of operating systems, so I can pretty much use it in place of the shell for scripting (and it's a lot nicer than the shell for anything non-trivial). Again, I greatly prefer Python. But if the choice is between writing a 100 line Perl script based on a module that takes a minute to download and install or trying for an hour to find and install some Python extension, Python loses out. Of course, the bigger the job, the more important Python's linguistic advantages become. So, I end up writing lots of smaller Perl scripts (some of which, unfortunately, grow to be quite big), and the occasional larger Python project. Tom. Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Wed Apr 12 10:19:45 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 12 Apr 2000 14:19:45 GMT Subject: Python idiom: Multiple search-and-replace References: <20000412100816.A2431031@vislab.epa.gov> Message-ID: <5C%I4.645$rc9.190288896@newsb.telia.net> Randall Hopper wrote: > Is there a Python feature or standard library API that will get me less > Python code spinning inside this loop? re.multisub or equivalent? :-) haven't benchmarked it, but I suspect that this approach is more efficient: ... # based on re-example-5.py import re import string symbol_map = { "foo": "FOO", "bar": "BAR" } def symbol_replace(match, get=symbol_map.get): return get(match.group(1), "") symbol_pattern = re.compile( "(" + string.join(map(re.escape, symbol_map.keys()), "|") + ")" ) print symbol_pattern.sub(symbol_replace, "foobarfiebarfoo") ... From tim_one at email.msn.com Tue Apr 25 01:43:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 25 Apr 2000 01:43:59 -0400 Subject: List comprehensions? In-Reply-To: Message-ID: <000601bfae79$41485b00$152d153f@tim> [Remco Gerlich] > I thought list comprehensions had been in CVS for quite a while, so I > expected them to be in 1.6. ... Greg Ewing's patch (against 1.5.2) for list comprehensions is all there is, and you'll have to get that from Greg (see DejaNews for his announcement, and his URL). a-false-premise-may-yet-lead-to-a-true-conclusion-ly y'rs - tim From echuck at mindspring.com Tue Apr 18 00:30:19 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Tue, 18 Apr 2000 00:30:19 -0400 Subject: Here is some starship.python.net news References: <38FA9A30.33DD1994@concentric.net> <38FB90B4.35E9CA1B@bullfrog-tech.com> Message-ID: <38FBE4DB.67289F42@mindspring.com> icarr at bullfrog-tech.com wrote: > > I heard once more from the hosts of starship.python.net > > Apparently, the "responsible (for fixing it) person" is our very own > Mike McLay, who is theoretically on-site with the machine today > (Monday) and I got a "hopefully, it will be back up today" from the > mscp guys. > > I say theoretically and hopefully because according to the news on > my pager, today is the worst day in the history of Washington, D.C. > traffic. So who knows if Mike McLay even made it to the machine. > > If he did or once he does, let us hope that he can put it back into > working order. > > Manus Hand > posting from God-knows-whose address, so please don't reply The situation with the Starship seems to reveal that: [a] It's highly relied upon by the Python community (consider all the modules people find at V of P that are really hosted on the Starship for downloading). [b] It's not well monitored and/or taken care of [c] There is no suitable backup/contingency machine to switch over to. How can the PSA change the situation to address [b] and [c]? I'd certainly be willing to pay higher dues if that's what it took, but there may be other ideas. -Chuck From chuyser at flash.net Sun Apr 23 00:28:22 2000 From: chuyser at flash.net (Cindy Huyser) Date: Sat, 22 Apr 2000 23:28:22 -0500 Subject: Tkinter bind of class -- help Message-ID: <39027BE6.8DF89328@flash.net> I've created a class that contains a number of Canvas widgets inside frames. When I import this class and instantiate it in my main program I put it inside a frame. What I would like to do is to get x,y coordinate information on events (either or ) that occur in the area occupied by the class instance so that I can display detail information in another area of the main window. At first, I tried to use bind() on the class instance, but received an error. I have tried callbacks from the frame in which the object resides, but find I only get event information for that area unoccupied by the object; I have tried looking at information stored in a member variable of the class, but have found the response unacceptably slow. Any suggestions for solving this problem would be greatly appreciated by this newbie Tkinter programmer. From akuchlin at mems-exchange.org Sun Apr 23 10:11:42 2000 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 23 Apr 2000 10:11:42 -0400 Subject: SSL w/ urllib References: <3901D800.DB50D968@flashmail.com> <3ditx9v851.fsf@newcnri.cnri.reston.va.us> <390249B5.F5D545F7@flashmail.com> Message-ID: <3dhfcsnbz5.fsf@newcnri.cnri.reston.va.us> Jp Calderone writes: > If I switch it over to a GET request, it works fine, but I > really need POST to work. Is this another bug or am I doing > something wrong? Oops! I wrote the patch too quickly and forgot one more piece; it never sends the body of the POST. This time for sure! --amk Index: urllib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/urllib.py,v retrieving revision 1.91 diff -C2 -r1.91 urllib.py *** urllib.py 2000/02/04 15:28:41 1.91 --- urllib.py 2000/04/23 14:09:44 *************** *** 328,331 **** --- 328,333 ---- for args in self.addheaders: apply(h.putheader, args) h.endheaders() + if data is not None: + h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() From hgg9140 at seanet.com Mon Apr 17 20:47:25 2000 From: hgg9140 at seanet.com (Harry George) Date: 17 Apr 2000 17:47:25 -0700 Subject: Python CGI References: <38F852D9.E2144F17@flashmail.com> Message-ID: I run python cgi's on RS6000 (AIX 4.3.2), using Netscape Enterprise Server. No problem. Can you post the code, or at least a skeleton which exhibits the behavior (leaving out sensitive content)? Jp Calderone writes: > I recently converted one of my perl CGI's to Python, and came across an > bizarre and extremely undesirable side affect - Whenever a form that uses > the Python script as its ACTION, the python scripts seems to get executed > about 8 times. At first I thought there was some logic error in my program > making it octuple all the output, but I can't find anything that might do > this. Has anyone seen this before, or know how to fix it? > > Thanks in advance, > Jp > > -- > Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes and > weighs 30 tons, computers in the future may have only 1,000 vacuum tubes and > weigh only 1.5 tons. -- Popular Mechanics, March 1949 > -- > 11:27am up 17 days, 16:34, 1 user, load average: 0.23, 0.11, 0.04 -- Harry George hgg9140 at seanet.com From boncelet at udel.edu Thu Apr 6 23:14:14 2000 From: boncelet at udel.edu (Charles Boncelet) Date: Fri, 07 Apr 2000 13:14:14 +1000 Subject: Algorithm: combinations of (k) taken from (n) values References: Message-ID: <38ED5285.719F26D7@udel.edu> Matthew Hirsch wrote: > Hi All, > > Onto the next question... > > Can anyone think of an algorithm to store as lists all possible > combinations of k numbers taken from n possible numbers. For example, > given 5 values, I want to choose 2. The number of possible combinations > is given by 5!/(3!2!)=10. They are: > Funny you should ask, since I just wrote one two days ago: def combs(n,k=None): """returns sorted list of k items taken from n.""" if k==None: k=n l = [] for c in range(n): l.append([c]) for i in range(k-1): li = [] for c in l: for j in range(c[-1]+1,n): li.append(c+[j]) l = li return l Charlie Boncelet ------ Charles Boncelet, University of Delaware, On sabbatical at ADFA, Canberra Australia, Home Page: http://www.ece.udel.edu/~boncelet/ From boud at rempt.xs4all.nl Sat Apr 29 16:02:21 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 29 Apr 2000 20:02:21 GMT Subject: GUI developping with Python (Any tutorial ) References: Message-ID: <8eff4d$ftl$1@news1.xs4all.nl> abouf066 at aix2.uottawa.ca wrote: > Greetings, > I wonder if anybody can point me to a site where I could find the > starting steps to develop a GUI using python. One starting place is http://www.valdyas.org/python/tutorial.html - but that's only for PyQt and PyKDE. There's such a variety of gui's available, and most of them wildly different from each other, that you really need to look around and try a few. -- Boudewijn Rempt | http://www.valdyas.org From m.faassen at vet.uu.nl Fri Apr 21 15:29:28 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 21 Apr 2000 19:29:28 GMT Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) References: <20000419154202.B480@owl.rhein-zeitung.de> <3d4s8yotiy.fsf@amarok.cnri.reston.va.us> Message-ID: <8dqa6o$pjg$4@newshost.accu.uu.nl> Andrew M. Kuchling wrote: > "Fredrik Lundh" writes: >> www.pythonware.com is down >> the reason appears to be hardware problems on >> the ISP site. ... > First Zope.org (down because an Ethernet cable got pulled out), then > Starship (disk crash), now pythonware.com. Has someone released evil > whitespace-eating nanobots that also attack computer hardware? It also happened to www.happypenguin.org, but that was all a plot by sourceforge to take it over. Since the PSU is bigger than the sourceforge conspiracy, that couldn't happen to us. Also, since the PSU has access to Guido's time machine and didn't prevent this, the PSU must be in on this. Perhaps they're testing those samples of whitespace-eating nanoviruses that they got from that UFO crash near Roswell back in the 50s. Paranoid-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From tuttledon at hotmail.com Thu Apr 20 19:36:30 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Thu, 20 Apr 2000 23:36:30 GMT Subject: Why MFC instead of Tkinter -- was Re: Pythonwin? References: <4QtL4.24$v85.41@news-server.bigpond.net.au> <7LDL4.534$v85.2563@news-server.bigpond.net.au> <38ff21b8$0$10972@senator-bedfellow.mit.edu> <38FF281E.5B2DCC71@tismer.com> <38ff823d$0$10971@senator-bedfellow.mit.edu> Message-ID: <2wML4.15897$O7.23504@typhoon.southeast.rr.com> "Robert" > I was actually referring to using the dialog > editor vs. programmatically adding your widgets using a layout manager, and > not specfically VC++. Visual Basic > (and I assume) Delphi has similar and probably even easier editors... Which brings up the question near and dear to a lazy man's heart like myself.. Which is the eaiser Windows GUI builder for Python--VB or VC++ ? With VB, I've only seen Python mentioned as a COM object to be used by VB. Are there other ways? With VC++, I gather you use the dialog editor to generate the MFC code that you then plug into Python? Correct? Don From p.agapow at ic.ac.uk Wed Apr 19 10:22:50 2000 From: p.agapow at ic.ac.uk (Paul-Michael Agapow) Date: Wed, 19 Apr 2000 15:22:50 +0100 Subject: 1st non-trivial program - gentle criticism requested References: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> <38F59E2E.308BD8C4@acm.org> Message-ID: <1e9322v.axv3rdi1jtwaN@gershwin.bio.ic.ac.uk> Thanks to all for your suggestions - getting the mindset of a new language can be tricky, but this exercise has defintely been worthwhile. Oh and ... Robert W. Cunningham wrote: > I couldn't get it to run under Linux until I trivially initialized the > following variables: > > gTarget = "" > gNumGenerations = gMutationRate = gStepSize = None ... which didn't present any problem on the Macintosh. Interesting. -- Paul-Michael Agapow (p.agapow at ic.ac.uk), Biology, Silwood Park "The world is made of fire." From effbot at telia.com Wed Apr 19 10:43:53 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 19 Apr 2000 14:43:53 GMT Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) References: <20000419154202.B480@owl.rhein-zeitung.de> Message-ID: Oliver Andrich wrote: > I can't access the www.pythonware.com webpages since yesterday > evening. Does someelse also have the problems or is it just me? quoting the daily python URL (http://hem.passagen.se/eff/url.htm): www.pythonware.com is down the reason appears to be hardware problems on the ISP site. this also affects mail traffic to (but not from) the pythonware.com and secretlabs.com domains. our ISP is working on this, and expect to have the site back online within a few hours. urgent mail can be sent to this address. From mlauer at trollinger-fe.rz.uni-frankfurt.de Mon Apr 3 06:11:55 2000 From: mlauer at trollinger-fe.rz.uni-frankfurt.de (mlauer at trollinger-fe.rz.uni-frankfurt.de) Date: 3 Apr 2000 12:11:55 +0200 Subject: GTK Referenc References: <38E7A868.A1C9BD7C@searchy.net> Message-ID: <38e86e6b@nntp.server.uni-frankfurt.de> Penpal International (ppi at searchy.net) wrote: > I couldn't find anywhere a reference for the GTK module for Python. Does > anyone know one? > On gtk's site I could only find some for C(++). Check out http://theopenlab.uml.edu/pygtools -- -- Regards & Gruesse from Mickey @ http://www.Vanille.de --------------------------------------------------------- How could anyone know me - when I don't even know myself ? From phd at phd.russ.ru Fri Apr 21 03:44:30 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 21 Apr 2000 07:44:30 +0000 (GMT) Subject: PyApache memory leak? In-Reply-To: <00042011042800.02559@quadra.teleo.net> Message-ID: On Thu, 20 Apr 2000, Patrick Phalen wrote: > I haven't used PyApache, but am under the impression that it spawns > multiple interpreter instances, which could certainly cause memory > problems on a busy, CGI-intensive site. > > Have you looked at Httpdapy (soon to be renamed mod_python)? > http://www.ispol.com/home/grisha/httpdapy/ I don't see how httpdapy could help spawn less interpreters instances - it is Apache job to fork and reap off children. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From don.limpio at gmx.net Thu Apr 27 05:40:46 2000 From: don.limpio at gmx.net (Georg Hammerbacher) Date: Thu, 27 Apr 2000 11:40:46 +0200 Subject: newbie dbase dataaccess Message-ID: Hello everybody, I?m just new in programming Python and now I want to make my own personal adressmanager with a simple dBase-file. How can I get access to it or where can I find more info?s about using dbase-files within Python? Thanks Georg From charlie at intelligenesis.net Mon Apr 10 11:53:49 2000 From: charlie at intelligenesis.net (Charlie Derr) Date: Mon, 10 Apr 2000 11:53:49 -0400 Subject: Extending built-in language (Win 95) In-Reply-To: <213CDEBFDDA7D3118081009027E40C56071118@SHEF-MS1> Message-ID: ~ > ? No, you use open() instead, which just returns an instance of a file ~ > object. In the xxmodule, xx_new is used to make new instances, which ~ > can be called from Python as xx.new(). ~ ~ I've added xxmodule to the lib and recompiled. Entering: ~ a = xx.new() ~ ~ just gives a name error on xx. ~ ~ Have I missed something? ~ I think you need to import your module: import xxmodule or from xxmodule import * ~ ~ (thanks for helping) ~ you're welcome (if it's the right answer :-] ) ~ mark. ~ ~ -- ~ http://www.python.org/mailman/listinfo/python-list ~ From rgetter at usa.net Sun Apr 16 04:31:01 2000 From: rgetter at usa.net (Robert Getter) Date: Sun, 16 Apr 2000 08:31:01 GMT Subject: Event triggering and weak references References: <8dbif3$hm0$1@metro.ucc.usyd.edu.au> Message-ID: In article <8dbif3$hm0$1 at metro.ucc.usyd.edu.au>, rnog2438 at mail.usyd.edu.au says... > First thanks for this beautiful language : ) > > I am Smalltalk addicted : ) and this means that I can't do with any other > language, ex. C, C++, Java, : ( > This was true until I found Python 2 weeks ago at Sydney Uni. I loved its > modularity, pluggin behaviour and freedom. > But I am missing Smalltalk event handling... Smalltalk (like Python) support > the call-Back mechanism, but there is a more powerful inter-object interest > registering that I haven't found in Python (so far). > > This is what I would like to do: > Imagine I could have two or more Widgets open displaying a car speed value, > say a numerical and a graphic display, if this car speed changes (ex. some > one pushes the break), I would like to have any open widget on this value > updated (on opening each window would register interest with this car > speed). > > Smalltalk implements this with: > > The widget would register interest in one aspect of the car (on opening > over aCar): > aCar when:#speedChanged send: #updateSpeedDisplay to: self > > And the car would just notify who is interested, if any (when its speed > changes): > self trigger: #speedChanged > > But if any of this windows is not referenced anymore or crashes I would like > the garbage collector clear it (the car would not be notified and his > pointer to the window shouldn't keep the garbage collector form freeing the > window memory). > > Again, Smalltalk implements this with weak references, that doesn't count > for the garbage collector. > > Is there support for this in Python? > > Any suggestions? > > > Here's some code which does some of what you want: ========= # simple test of a scheme for registering interest in an event. # exception safety is left as an exercise for the reader class watcher: def __init__(self, watchee, voyeur=None): self.watchee = watchee if voyeur == None: self.list = [] else: self.list = [ voyeur ] def __call__(self, *args, **kwargs): rc = apply(self.watchee, args, kwargs) for voyeur in self.list: apply(voyeur, args, kwargs) return rc def register(self, voyeur=None): if not voyeur: return self.list.append(voyeur) def unregister(self, voyeur=None): if voyeur: self.list.remove(voyeur) return len(self.list) def register(object, method, voyeur=None): # try to add this voyeur to the watcher object try: getattr(object, method).register(voyeur) # if this fails, there is no watcher object. Add one. except: try: setattr(object, method, watcher(getattr(object, method), voyeur)) # if this fails, there is no method of that name. return None. except: return None # finally, return the newly installed watcher method return getattr(object, method) def unregister(object, method, voyeur=None): try: if not getattr(object, method).unregister(voyeur): # list is empty. remove watcher setattr(object, method, getattr(object, method).watchee) except: pass class test: def x(self): print "x()" def watch1(): print "watch1()" def watch2(): print "watch2()" def main(): a = test() a.x() print register(a, "x", watch1) a.x() print register(a, "x", watch2) a.x() print unregister(a, "x", watch1) a.x() print unregister(a, "x", watch2) a.x() if __name__ == "__main__": main() ======== What this code does is install a wrapper around the method you want to watch. This wrapper maintains a list of interested parties. There are a few problems with this method: 1. No weak references. I think there is a weak reference extension somewhere which could be added without too much trouble. 2. In Smalltalk, AFAIK, a method can only be referenced through its object. In Python, each method is a callable object which can be manipulated separately. In other words, object methods in Python are really instance variables which just happen to be callable. As a result, anywhere that objects pass bound methods around won't work right. If a bound method is passed before the wrapper is installed, calls to the method will not be sent to the watchers. This means that watchers can't be reliably watched, since they work by getting references to themselves put on a list in the watcher class. The only real solution I can think of for problem 2 is a generic mechanism for attaching watchers to any callable object. This is similar to what a debugger does. If you look into the debugging API, you may find something that is suitable or can be modified. I never much thought about it before, but this could be a really useful capability to have. Another way that this could be done which would also allow other nice things to happen would be the ability to globally change all references to one object into references to a different object. -- Rob Getter From bawolk at pacbell.net Thu Apr 20 10:00:32 2000 From: bawolk at pacbell.net (Bruce Wolk) Date: Thu, 20 Apr 2000 07:00:32 -0700 Subject: Tkinter aspect question Message-ID: <38FF0D80.7B6EBA8C@pacbell.net> I tried to post this earlier but it never appeared. Apologies if both show up. How can I keep the aspect ratio of a window fixed? I want my window to stay square, no matter what its size is. The aspect method seemed promising, but when I tried win = Toplevel(master) win.geometry('400x400+100+100') win.aspect(1,1,1,1) it didn't have any effect. The aspect could still be changed. Thanks. Bruce From m.faassen at vet.uu.nl Thu Apr 27 06:17:41 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 27 Apr 2000 10:17:41 GMT Subject: Simple del[] list question References: Message-ID: <8e9445$f22$1@newshost.accu.uu.nl> Gregoire Welraeds wrote: > In reply to the message of Martijn Faassen sent on Apr 26 (see below) : >> Note that another strategy which tends to avoid these troubles is to >> construct a new list if you modify one. That is, usually if you're going > Isn't it time and memory consuming when working on big list (eg with 1000 > or above elements) ? Yes, probably, depending on what you do. If you're going to delete a lot of elements in a 1000 element list, the list will internally be copied several times as well, each time it's resized, if I understand it well. This happens in fast C code, though. Still, this is going to add up. At some point it may start to be faster to construct a new list (using the cheap 'append()' operation) and just leave those elements out. I don't know when that's the case, however. It depends on the cost of each for loop iteration, the length of the list, the amount of elements that are deleted. If it's really speed critical, just try out both strategies, I suppose. I think there's no difference in memory consumption; the copy the list strategy will generally be cheaper, unless you're only going to delete a single element, and in that case it won't matter, I think. I think for shorter lists with multiple deletes the 'construct a new list' strategy will often be clearer and faster. Note that in the deletion case the program needs to find out which elements to delete; this often involves going through the lists already. All this said, I think it's far more important in general that the 'construct a new list' idiom produces code that's easier to understand; efficiency is a secondary concern. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From pinard at iro.umontreal.ca Sun Apr 2 08:16:57 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 02 Apr 2000 08:16:57 -0400 Subject: Why should I switch to Python? In-Reply-To: "Tim Peters"'s message of "Sat, 1 Apr 2000 23:20:03 -0500" References: <000701bf9c5a$b806b420$752d153f@tim> Message-ID: "Tim Peters" writes: > When in doubt, there's no substitute for exhaustive enumeration. Hmph! Hope you do not doubt there is an infinite number of primes! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From firefly64 at my-deja.com Sun Apr 16 21:16:24 2000 From: firefly64 at my-deja.com (firefly64 at my-deja.com) Date: Mon, 17 Apr 2000 01:16:24 GMT Subject: building on linux w/o threads? Message-ID: <8ddokt$65t$1@nnrp1.deja.com> Hi, I'm trying to build python 1.5.2 on a linux box but without thread support. I'm using gcc 2.9.5, on Mandrak Linux 6.1 kernel version 2.2.14 Even though my system has threads, I don't want any thread support in python (no linkage to libpthreads). I just can't seem to convince the build process to proceed without threads. I've done everything I can think of, including ./configure --without-thread and editing the Makefiles to include -DWITH_THREAD=0. The build process still always either produces a python linked to libpthreads or dies complaining about not being able to find various thread functions. (Yes, I've done make clean). The reason I'm doing this is because I'm trying to get httpdapy to work. The author suggested that I try building a python without threads. Thanks a lot everyone, mike salib Sent via Deja.com http://www.deja.com/ Before you buy. From fig at oreilly.com Tue Apr 18 19:41:34 2000 From: fig at oreilly.com (Stephen R. Figgins) Date: Tue, 18 Apr 2000 23:41:34 GMT Subject: o'rielly python devcenter References: Message-ID: <38FCF25E.4D945D81@oreilly.com> It isn't old news, it just went public last night(Monday) Sort of a soft launch, as I don't have much in the way of content up yet. But I am working on that problem! I will have some original articles in a couple of weeks. The Network is actually a subsidiary of O'Reilly & Associates, and I am plenty happy to plug other's books. (Actually I think the only book I have linked right now is the venerable Programming Python, and that is just because I mentioned it in me introduction.) The links I am building under topics are not links to other sites, but rather to documents on other sites. I am looking for tutorials, articles, documentation, anything good and juicy with information. I am open to suggestions. And I like criticism, particularly the constructive kind. So send me plenty. And if any of you want to line up for writing some good articles for me, I am paying! Stephen R. Figgins Editor, O'Reilly Network From pinard at iro.umontreal.ca Tue Apr 4 15:22:52 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 04 Apr 2000 15:22:52 -0400 Subject: New Features in Python 1.6 In-Reply-To: "Terry Reedy"'s message of "Tue, 4 Apr 2000 14:30:06 -0400" References: <200004011740.MAA04675@eric.cnri.reston.va.us> <8cdbvg$3vi$1@news.udel.edu> Message-ID: "Terry Reedy" writes: > ' = 1 byte/char, " = 2 bytes/ char is more straightforward. It would be much more logical, indeed. Of course, we known that ASCII is ideally 7/8 of an apostrophe, but we could use a whole apostrophe as an acceptable compromise. For Unicode, which is internally represented as UCS-2, a double quote is very natural. When Python will later be adapted to process UCS-4 internally, we could use quadruple apostrophes, conveniently represented by two double quotes, like in ""This is an UCS-4 string"". We could also use '''', "'', '"' and ''" to discriminate between the four usual kind of endianness and byte swapping. P.S. - Sorry! :-) Just letting some of the steam out... Back to work! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From aa8vb at yahoo.com Thu Apr 20 13:39:52 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Thu, 20 Apr 2000 13:39:52 -0400 Subject: Python Parsers Comparison In-Reply-To: References: <20000420093945.A624723@vislab.epa.gov> Message-ID: <20000420133952.A626243@vislab.epa.gov> Warren Postma: |> For example, a comma-separated list of nested vectors would be a good |example: |> |> [ 1, 2 ], [ 3, 4 ] |> [ [ 1,2 ],[ 3,4 ] ], [ 5.6 ] |> etc. |> | |Wherever I am able to do so, I use eval() and design my grammar to be |basically PYTHON. ... |If you are in control of the grammar, and you are inventing it, why not |stick with python, if on the other hand, the grammar is something you're |stuck with 'as-is', and it's not a proper subset of some Python construct, |then all bets are off. You've hit it on the head. The grammer is from a third-party tool which I'm picking up and using as-is. For simply expressions I already re.sub it into Python and eval. But more complex expressions don't play so nice with this approach. |I certainly WOULD like to see some tutorial material on constructing such |parsers, because I don't know the first thing about them. We studied this |stuff in undergrad C.S., but it was trivial stuff (BNF grammars, some simple |parsing code techniques in C). We never did learn the Nifty Hardcode Stuff. Exactly. We covered them as well and I have no doubt that with sufficient time and effort I (or most folks certainly) could learn them all and pick the best one. Though, a "Python Parsers FAQ" written from the 30,000 foot view (feature comparison, limitations, examples, still-maintained status, etc.) would really be a timesaver for folks looking for the best parser for their task. -- Randall Hopper aa8vb at yahoo.com From gmcm at hypernet.com Mon Apr 10 13:23:29 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 10 Apr 2000 13:23:29 -0400 Subject: Installer Producing Page Fault In-Reply-To: <01bfa30b$e0707f60$2040c3d1@Cyberus> Message-ID: <1256735085-36518465@hypernet.com> Gordon Williams wrote: > I am using Gordon's installer program to make a standalone program that > self installs. After running the install_BS_main.exe created, everything > is put into the proper directory (I think). Then running BS_main.exe I > immediately get a crash with the following: > > > > BS_MAIN caused an invalid page fault in > module MULTIARRAY.PYD at 0137:01523569. [snip] > My code is using the numerical package if that matters. (It appears to be > causing the fault as multiarray is part of the package) > > Any ideas? Never tried it myself, but I got this note once from Gary Herron: > ** Numeric Python. The 'import Numeric' statment imports _numpy.pyd, > but this is not caught by builder.py. Add > misc= C:\Program Files\Python\Numeric\_numpy.pyd > in the appropriate target of the cfg file. That was a couple releases ago, so I don't know if it still applies. - Gordon From nospam at nowhere.net Wed Apr 26 01:55:53 2000 From: nospam at nowhere.net (Ray&Maria) Date: Tue, 25 Apr 2000 23:55:53 -0600 Subject: Unsigned integer arithmetic References: Message-ID: What's wrong with this: myInt = 0x7fffffff myLong = long(myInt) #coerce to long myInt2 = int(myLong) #coerce to int (if it fits) def printU32Hex(n): if n > 0xffffffffL: raise ValueError print "0x%01x%07x" % (int(n >> 28), int(n & 0xfffffffL)) printU32Hex(0x7fffffffL) printU32Hex(0xffffffffL) printU32Hex(0x100000000L) Ray NOSPAMjchen at NOSPAMquark.com "Robert Cragie" wrote in message news:newscache$51sktf$rzc$1 at jenpc07.jennic.co.uk... > Hi all, > > I'm having a lot of trouble with arithmetic manipulation of numbers above > 0x7fffffff. Whilst an integer is represented in a 32 bit word, as you'd > expect, 0x80000000 - 0xffffffff are treated as negative numbers. However, I > want to treat a 32 bit number as an unsigned value, and be able to do i = i > + 1 for an integer number above 0x7fffffff without getting an overflow. > > I'm finding I have to use the inefficient longs for the arithmetic, and do > clumsy conversions using the struct module, e.g. > > import struct > > # integer to unsigned long > # in the strings, it's an upper case 'eye' and a lower case 'ell' in that > order > myUlong = struct.unpack('I', struct.pack('l',myInt))[0] > > # unsigned long to integer > # in the strings, it's a lower case 'ell' and an upper case 'eye' in that > order > myInt = struct.unpack('l', struct.pack('I',myUlong))[0] > > Also, I can't seem to print a long using > > print '0x%08x' % myLong > > if 'myLong' is greater than 0x7fffffff - I get the rather obscure 'long int > too long to convert'. > > Is there a better way to do all this? > > TIA > > Robert Cragie > > > From mwh21 at cam.ac.uk Tue Apr 25 17:47:33 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Apr 2000 22:47:33 +0100 Subject: Metaclasses? References: <3905F4A0.2B39C705@darmstadt.gmd.de> Message-ID: Robb Shecter writes: > I read an old post about metaclasses (included on the cd-rom with > the book "Mit Python programmieren"), and got very interested, > because I imagine that by making a new metaclass, I could maybe fix > the one thing about Python that annoys me: the obligatory use of > "self" in method declarations and variable access. (Python's syntax > is so clean and neat in all other areas, I feel like it's a shame > that there's excess verbosity in this one place.) a) No, metaclasses are unlikely to "help". b) How, when you've "fixed" Python do you propose, in method bodies, to distinguish between local and instance variables? I might drop my longstanding habit of complaining about people complaining about the necessity of "self" if you can answer this question... > So - are metaclasses just a random idea, or is there something in > the works? Metaclasses are real, but have this tendency to make one's head explode... Cheers, M. -- If i don't understand lisp, it would be wise to not bray about how lisp is stupid or otherwise criticize, because my stupidity would be archived and open for all in the know to see. -- Xah, comp.lang.lisp From lewst at yahoo.com Wed Apr 5 01:39:20 2000 From: lewst at yahoo.com (lewst) Date: Tue, 4 Apr 2000 22:39:20 -0700 (PDT) Subject: A Mountain of Perl Books + Python Advocacy Message-ID: <20000405053920.20579.qmail@web2102.mail.yahoo.com> Before I launch into another question and gripe, I'd like to thank everyone who offered comments and suggestions on the advanced Python books that are out there. Now something I can't quite figure out is: why are there so many more books on Perl out there than on Python? Searching through Fatbrain.COM (which is where I order my books from), I found 68 books, 4 training manuals, and 2 eMatter documents on Perl. Compare this to Python's 13 books and 2 eMatter documents. What is it about Perl that makes it so much more popular and have such a huge grassroots swell? I personally find Perl an abomination and Python a breath of fresh air. Perl has that first mover advantage I suppose, but should that really make such a hugh difference? I'll admit that Perl is what led me to Python in the first place. After hearing about how great Perl was several years ago from the local sysadmin, I learned it and started using it for my scripting needs. If there is one thing that sums up my Perl experience, it is that it always took me too long write the programs that I needed to write. The syntax was always no unnatural for me that I could never get my head out of the reference manual, and errors were always so tough to track down. In the end was frustration albeit a working result. This frustration led me to look into Python and I'll never touch Perl again. Python was so natural for me I often found myself correctly "guessing" at the syntax as I learned it. I rewrote all my Perl scripts in one weekend and most of them worked on the first try. At this point I wondered if my brain was just different than all those Perl junkies out there. But now I really don't think so; I think it's a question of awareness. Perl is very publicized and well-known while the better language is sitting here a dark corner unnoticed. Sure there will always be some religious fanatics that won't even give Python a try, but I think Python's popularity could be vastly improved with some serious advocacy work. CNRI and/or PSA should seriously look into funding a Python "marketing" campaign of sorts. I think the result would be allot of converts and more understanding and respect for Python. With this in mind, let me include one of my favorite pro-Python quotes of all time. This is from a message to the fetchmail-announce mailing list by Eric S. Raymond , the famous open-source advocate and author of many popular software programs. He is discussing "fetchmailconf" which is the Tkinter GUI for his fetchmail POP/IMAP mail client. I think it demonstrates the point I make above perfectly. "A note about fetchmailconf. It took me approximately six days to write this elaborate multi-paneled GUI -- that's counting the four days it took me to learn the implementation language in the process. This could easily have been a two-month project in C (with six weeks of that spent debugging and bugs still left). Or a week-long project in Perl, with working but ugly and unmaintainable results." "The verdict: Python is *waaaay* cool! I'm sold. It's clean, it's elegant, it's easy, and it's astonishingly powerful. I'm not going to program anything longer than one screenful of script in Perl anymore. I love Larry Wall dearly, but Guido van Rossum is the better designer -- I haven't had this much fun with a language since the glory days of LISP. Eric sez check it out." Regards. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From richard_chamberlain at ntlworld.com Wed Apr 26 14:19:34 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Wed, 26 Apr 2000 19:19:34 +0100 Subject: Python Time classes References: Message-ID: You could use mxDateTime which are at: http://starship.python.net/crew/lemburg/mxDateTime.html Richard phil hunt wrote in message news:slrn8ge5b0.1gu.philh at vision25.demon.co.uk... > Is there a high-level Time class for Python? > > I'm aware of the 'time' module in the standard library. But I'm > looking for something more high-level (I can't find anything > relevant on Parnassus or Freshmeat). What I want is roughly the > ability to say things like: > > t1 = Time.now() > # (t1) is an instance of Time containing the time now > > t2 = Time(2000, 4, 26, 17, 4, 0) > # (t2) is 2000-Apr-26 17:04:00 > > sec = t1 - t2 > # (sec) is the number of seconds between (t1) and (t2) > > str = t1.format("%H:%M:%S") > # (str) is a string containing the hours minutes and seconds of (t1) > # in a form like 23:59:06 > > It'd also be nice if there was a similar Date class which stored > a date (this would behave like a Time except that (i) the hh:mm:ss > would always be 00:00:00, and (ii) subtracting two dates would return > the number of days difference). Obviously times and dates would be > easily convertable to each other: > > aTime = Time(aDate) > aDate = Date(aTime) > > (or similar). > > > Does this exist, or shall I write one? > > -- > ***** Phil Hunt ***** send email to phil at comuno.com ***** > Moore's Law: hardware speed doubles every 18 months > Gates' Law: software speed halves every 18 months From adjih at crepuscule.com Sun Apr 30 12:45:48 2000 From: adjih at crepuscule.com (Cedric Adjih) Date: 30 Apr 2000 16:45:48 GMT Subject: MORE INFO References: <8ea0ao$fro$1@nnrp1.deja.com> <8ea9uu$rh0$1@nnrp1.deja.com> <8ecad6$bun$1@ites.inria.fr> <8ecref$lck$1@nnrp1.deja.com> Message-ID: <8ehnvs$m0h$1@ites.inria.fr> mdefreitas at sikorsky.com wrote: >> Do you want to run several python scripts (and several ui.commands >> C code) concurently (how would you synchronize?) ? > I do not want to run concurrently, I just want to run in one thread of > execution, but recursively. Ok. >> Note that if all you want is to have C code that calls Python >> code that calls C code (through a module) that calls Python code >> without threads, PyRun_XXX functions are re-entrant. > Thanks! That's what I needed to know. I now modified (and simplified) > my code as follows: > void interp(char *script) { > static int nest_level = 0; > FILE *fd = fopen(script, "r"); > if (nest_level == 0) { > Py_Initialize(); > PyRun_SimpleString("import ui\n"); // import my ui > } > nest_level++; > PyRun_SimpleFile(fd, script); > nest_level--; > if (nest_level == 0) Py_Finalize(); > } > The only problem is that the nested script that is run "remembers" the > variable settings from it's caller. Is there a way to give each nested > python script a fresh, clean environment? The nested script should not > effect the environment of it's caller either. Is that what the global > and local dictionaries for the API function PyRun_File are for? If so, > is there any examples on their usage. The C/API doc isn't all that > explicit. Indeed. PyRun_File is actually implementing most of the "execfile(...)" code (see http://www.python.org/doc/current/lib/built-in-funcs.html). Python source code for execfile is also an example of use for PyRun_File. Passing empty dictionaries would be a way to have a "clean" environment except if a script imports a Python module and fiddles with its internals. Because modules will be shared among scripts. But fiddling with internals is very bad style. -- Cedric From dalke at acm.org Mon Apr 24 22:20:04 2000 From: dalke at acm.org (Andrew Dalke) Date: Mon, 24 Apr 2000 20:20:04 -0600 Subject: new linereading standard? References: <3904D21B.333DD930@visionart.com> Message-ID: <8e2v7j$cod$1@slb1.atl.mindspring.net> Pete Shinners wrote: > it is a simple class > that handles the "while 1: .... break" carnival for reading files. [...] > i'm sure someone has posted a class like the before, but i'm hoping it > can one day make it in as a python standard someday. (6.0, there's still > time!) Try looking at the standard 'fileinput' module. > now i can code in a preferred style > > myfile = open('myfile.txt', 'r') > for line in filelines(myfile): > print line > myfile.close() import fileinput myfile = fileinput.FileInput('myfile.txt') for line in myfile: print line myfile.close() Not quite the same, since it only deals with filenames and yours uses any file-like object. So the module for what you want is present. You'll find that nearly no one uses it. Part of the reason is the standard idiom (your 'carnival') is used for a lot more than reading files, so people get used to seeing it. Another reason is the performance suffers some since you have the extra method call overhead. Indeed, I've only used fileinput in examples for non-Python people where I don't want to have to explain the while 1:/test loop. They more easily follow "this is a black box thingy which returns input lines" compared to having to explain "yes, I know it's a couple extra lines compared to C, but you get used to it and it prevents some hard to find errors." Andrew dalke at acm.org From gmcm at hypernet.com Wed Apr 12 17:15:01 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 12 Apr 2000 17:15:01 -0400 Subject: global variables - how?? In-Reply-To: <8d2jsh$3a9$1@news101.telia.com> Message-ID: <1256548392-47748201@hypernet.com> Anders Eggers-Krag wrote: > it is obvious not to use global variables except when the use of them is > obvious, > in my case I could otherwise send them along with every function, creating a > huge > overhead passing a million pointers around, using exactly the same amount of > memory, > or in fact more, than I would using globals. Oh, it uses more memory all right (the code objects are larger, and more stack gets used), but it's also significantly faster (fewer name lookups). > I did figure out how to do it myself after a lot of trying, but as you said > it is ugly, > but this really anoys me, and I *was* starting to like python... There are a number of ways to do it (most of which will lose the speed advantage). I don't find anything ugly about everyone importing a common module, for example (or passing around a single context object). - Gordon From rjroy at takingcontrol.com Wed Apr 19 18:47:35 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Wed, 19 Apr 2000 22:47:35 GMT Subject: Building python on HPUX-10.2 References: <38FE1392.D1C01D64@wag.caltech.edu> Message-ID: <38fe34a4.1103181328@news1.on.sympatico.ca> I have built python successfully on several HPUX 10.2 boxes using GCC. If you are using the basic cc compiler, you might have problems. If you have the full development version, I don't know. On one machine I had to install GCC, (hmmm that might have been because of one of the libraries I was linking now that I think if it.) GNU make is also a good idea... Another gotcha is that once compiled, it might fail the fcntl tests. see http://x22.deja.com/[ST_rn=ps]/getdoc.xp?AN=517003463&CONTEXT=956184259.663814174 for how to fix this On Wed, 19 Apr 2000 13:14:10 -0700, "Richard P. Muller" wrote: >I have successfully built python on a number of diffent platforms, but >I'm having serious problems on HPUX 10.2. I go through the normal >configure/make procedure, but the make crashes right away, when it is >trying to link the first object (pgen), because it can't find the >correct dl library (?). > >Has anyone successfully compiled Python on HPUX-10.*? If so, what >configure string did you use? > >Rick > From hamish_lawson at yahoo.co.uk Sun Apr 2 10:43:33 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Sun, 02 Apr 2000 07:43:33 -0700 Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <8c6mkg$8i$1@slb2.atl.mindspring.net> Message-ID: <0a509c7e.1fbf25d6@usw-ex0101-006.remarq.com> As I read Guido's announcement an increasing sense of unease came over me. Then I saw the posting date. Ah, it must be an April Fool joke. No, really ... It MUST be an April Fool Joke! However (assuming it was a joke) some people seem to have taken the bait and are quite concerned. Might it be a good idea now to admit that it was a joke before more Fear, Uncertainty and Doubt is spread? Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From drs at labs.agilent.com Thu Apr 13 12:17:23 2000 From: drs at labs.agilent.com (David Smith) Date: Thu, 13 Apr 2000 09:17:23 -0700 Subject: Comparing PythonWin and IDLE? References: Message-ID: <38F5F313.832B4CE6@labs.agilent.com> Warren Postma wrote: > I find once a module has > been imported once, it often will not import again, even if I have changed > the source (.py) file, the .pyc file does not appear to be regenerated, and > any errors in the .py file can only be fixed by editing and saving the .py > file, quitting the IDE and restarting. This appears to happen for both IDLE > and Python. Anybody else seen this? When you edit a file under Idle, Save it and then hit Control-F5. Then you can re-import the file. David Smith From lewst at yahoo.com Tue Apr 4 19:13:58 2000 From: lewst at yahoo.com (lewst) Date: Tue, 4 Apr 2000 16:13:58 -0700 (PDT) Subject: Starving for an Advanced Python Book Message-ID: <20000404231358.17447.qmail@web2105.mail.yahoo.com> "M.-A. Lemburg" wrote: > Fredrik Lundh has compiled such a cookbook. I don't have the URL > handy, but I'm sure you'll find it on their www.pythonware.com > site. Yes, this is Fredrik Lundh's eff-bot guide to The Standard Python Library which is an on-line book in e-Matter format. This looks like it would be a great book for what I need, but there are a few problems. First, eMatter is not currently available for Unix/Linux. While I do have access to Microsoft Windows, I don't own such a machine. Because the eMatter license is tied to the particular computer you install the book on, this pretty much rules it out for me as a possibility which is unfortunate. Second, at $12.00, the book seems a bit expensive for what it is. I can understand paying that much for an eMatter version of a published book which has gone through a rigorous and professional editing process, but not otherwise. Nonetheless, I'd still buy it if it supported Linux. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From pecora at anvil.nrl.navy.mil Thu Apr 27 17:06:38 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Thu, 27 Apr 2000 17:06:38 -0400 Subject: Do I always have to write "self." ? Message-ID: <270420001706386648%pecora@anvil.nrl.navy.mil> I am two weeks plus into learning Python and have started on a first real project. Amazing language. BUT, now that I've gotten going with classes, I'm finding I hate seeing all those "self." prefixes on the class variables. Python is generally very clean, but the classes I write use a lot of "per-instance" variables, hence seem to require self. As a result the expressions can become cluttered and harder to read than C++ in this particular case -- imagine that! Is there any relief here? Any (simple) way around writing that self. every time? Thanks. Love Python so far otherwise. From gmcm at hypernet.com Wed Apr 26 15:48:25 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 26 Apr 2000 15:48:25 -0400 Subject: How can I get the name of an object??? In-Reply-To: Message-ID: <1255343973-62617861@hypernet.com> Jerome Chan wrote: > object.__name__ returns a tuple of all vars referencings the > object? Not at all. Not all objects have an attribute "__name__", and Python does not attempt to point back to referencing objects. Those objects having a __name__ attribute (eg, class objects, function objects) tend to use it for the name given when the object was defined. class A: pass Now A.__name__ is "A". B = A And so is B.__name__. - Gordon From Richard.Jones at fulcrum.com.au Mon Apr 10 18:44:23 2000 From: Richard.Jones at fulcrum.com.au (Richard Jones) Date: Tue, 11 Apr 2000 08:44:23 +1000 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) In-Reply-To: Message from Martijn Faassen of 2000-Apr-10 22:37:18, <8ctl2u$bko$3@newshost.accu.uu.nl> Message-ID: <200004102244.IAA03513@envy.fulcrum.com.au> [Martijn Faassen] > Richard Jones wrote: > > [tom__98 at my-deja.com] > >> I don't know about others, but I frequently end up using > >> Perl instead of Python, even though I greatly prefer Python > >> as a language. > > > Tom you little troll-meister. Half those arguments you cite are bollocks > > if you _really_ knew and "greatly prefer" Python. Try again. > > It's considered good Usenet style to include at least an attempt at > refuting arguments, instead of just saying they're bollocks. :) > > Is this an example of a flaming Python advocacy as talked about earlier > in the thread? :) bah! > PHYTON-RULZEZ!!!-ly yours, You forgot PERL SUKZ!!!! Richard who is tired of the endless "vs" crap in the newsgroup :) From neilh at hare.net.au Tue Apr 25 20:18:28 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Wed, 26 Apr 2000 10:18:28 +1000 Subject: Sourceforge and Python References: Message-ID: <007b01bfaf14$f33114b0$3cdd3fcb@neil> > So, merely beginning to explore the possibility, I'm asking for advice > on this list, as to if there is environments offering a set of services > similar to `sourceforge', but that would be especially Python-using, > or Python-aware. Of course, and also given some recent saga reported on > this list, stability and availability are parts of the requirements :-). I don't know about a more Python specific site, but I moved part of Scintilla to SourceForge a couple of months ago. Most of it is OK, but some aspects of SourceForge are more difficult than they should be. The worst to me is file uploading where you upload each file over FTP to a staging area (shared with all the other projects) then use a slow set of web pages to move them file by file (with no remembering of common input between files) into your download area. If your distribution is only one or two files then it will be OK, but for a large set of downloadables, it is too hard. Aspects which are good at SourceForge include having MailMan to set up mailing lists with archives and no advertising. Your site may be found by people searching or browsing SourceForge. CVS access is normally good although there are problems on Windows with SourceForge's choice of SSH version _1_ for write access. Neil From donn at u.washington.edu Wed Apr 5 17:35:33 2000 From: donn at u.washington.edu (Donn Cave) Date: 5 Apr 2000 21:35:33 GMT Subject: Some suggestion for a GUI kit evolved on Perl References: <8cg7oo$m10$1@newsg4.svr.pol.co.uk> Message-ID: <8cgbj5$n1s$1@nntp6.u.washington.edu> Quoth "Makhno" : | I have written a GUI kit called Orchard. It is essentially a code library | with c-like functions which when called correctly will create windows, | buttons and other controls. I have had great success writing an interface | for this with Perl, and now I'm about to attempt a Python module. | One of the main points of Orchard is to keep the GUI-creation code as quick | and as neat as possible. Because Perl ignores whitespace, I have designed | the module in such a way so that the user can take advantage of this and use | whitespace indicate GUI structure. For example, the following code creates a | window with a button and a label in it: | | Orchard::NewOrcWindow | ( | title=>"Test" | )->Add | ( | OrcVGroup | ( | OrcButton, | $label=OrcLabel | ) | )->Show; | | As you can see, the window consists of a button and a label arranged | horizontally. A ref is kept to the label so it can be changed in later code, | and the window's Add() method returns a ref to the window so that Show() can | be called on it. (Looks to me like the button and label are arranged vertically?) | The problem I'm having is that Python has reserved whitespace (to indicate | program scope). Having looked at the Tk modules, I see it doing the | equivalent of: | | window=Orchard.NewOrcWindow(title="Test") | button=OrcButton | label=Label | vgroup=OrcVGroup | window.add(vgroup) | vgroup.add(button) | vgroup.add(label) | window.Show | | The problem is that this code stores references to everything (There's often | no need to keep references to buttons, it's looked after internally), it's | not as easy to read, and is easily complicated by GUI additions. | | An alternative would be to use the style I've used with Perl; creating GUI | elements in the contructors of other GUI elements. | | Orchard.NewOrcWindow(title=Text).Add(OrcVGroup(... | | But without whitespace to help separate the elements I end up with a long | line that looks even worse than before. Separating the long line to several | smaller lines doesn't help readablity either (it just ends up all wrapped | round rather than structured). And the line has to be split up when I want | to keep a reference to the element anyway. | | This complication is precisely the sort of thing I wished to avoid when | creating Orchard! | Does anybody have any advice as to how I could 'structure' Python code to | make neat, extendable GUI code? Essentially it comes down to what I can use | to indicate GUI structure. I can't use whitespace, so what can I use? I hope I'm not missing the point here, but I'm not sure you can't use white space. For example, following is legal Python: label = OrcLabel NewOrcWindow( title = "Test" ).Add( OrcVGroup( OrcButton, label ) ).Show() The "label" variable has to be assigned outside the function call, that's just the way it is. Other than that, we're looking at a couple of changes around the parentheses. I changed "Show" to "Show()", assuming you don't mean to return the bound function but rather the result of its execution. If it does the same thing as the Perl example, it's not all that different in appearance. Donn Cave, donn at oz.net From fig at oreilly.com Mon Apr 3 12:39:25 2000 From: fig at oreilly.com (Stephen R. Figgins) Date: Mon, 03 Apr 2000 16:39:25 GMT Subject: Python Topics Message-ID: <38E8C989.3BDE6D00@oreilly.com> I am working on setting up a Python Developer's Center for the O'Reilly Network. One of my tasks is to select topics to organize existing resources on the web. I only want 10 of these, and I want them to be useful for people looking for particular resources. Here is what I have so far: Topic Keywords Systems Programming Network, Sockets, Signals, Sys Admin Development Tools Idle, IDE, Debugging, SWIG Education CP4E, Python in the Classroom User Interfaces GUI, Tk, GTK, Gnome Database XML, ODBC, Python Database Internet CGI, ZOPE, Applets Jpython Java, Servlets, Applets Graphic 3D, PyOpenGL Scientific Numerical Python, Astronomy, Genetics Distributed COM, DCOM, CORBA What do you think? Are there resources out there that really don't fit in any of these? Are these useful divisions? From paulb at infercor.no Wed Apr 26 06:31:17 2000 From: paulb at infercor.no (Paul Boddie) Date: Wed, 26 Apr 2000 12:31:17 +0200 Subject: mxODBC error trapping References: <390640A8.F1392B0F@webamused.com> Message-ID: <3906C575.8B933429@infercor.no> Joshua Macy wrote: > > "Daley, MarkX" wrote: > > > > Traceback (innermost last): > > File "", line 1, in ? > > collect.collect() > > File "C:\PROGRA~1\Python\collect.py", line 50, in collect > > except dbi.OperationalError: > > AttributeError: OperationalError > > > > Here is the printout of the dbi module: > > > > ['DATE', 'NUMBER', 'RAW', 'ROWID', 'STRING', 'TYPES', '__doc__', '__file__', > > '__name__', 'dataError', 'dbDate', 'dbRaw', 'dbiDate', 'dbiRaw', > > 'integrityError', 'internalError', 'noError', 'opError', 'progError'] > > According to the dbi module dictionary (which you've printed), it > looks like it should be opError, not OperationalError. Or you could > just use an unqualified except, and be sure of catching any error that > the dbi can raise. You should be looking in the module where the 'connect' function was defined. So, if you used 'ODBC.iODBC.connect' to connect to the database, you will find that 'OperationalError' is defined in 'ODBC.iODBC' too: >>> dir(ODBC.iODBC) ['BIGINT', 'BINARY', 'BIND_USING_PYTHONTYPE', 'BIND_USING_SQLTYPE', 'BIT', 'CHAR', 'Connect', 'DATE', 'DATETIME_DATETIMEFORMAT', 'DECIMAL', 'DOUBLE', 'DataError', 'DatabaseError', 'DriverConnect', 'Error', 'FLOAT', 'INTEGER', 'IntegrityError', 'InterfaceError', 'InternalError', 'LONGVARBINARY', 'LONGVARCHAR', 'NUMERIC', 'NotSupportedError', 'OperationalError', 'ProgrammingError', 'REAL', 'SMALLINT', 'SQL', 'STRING_DATETIMEFORMAT', 'TIME', 'TIMESTAMP', 'TIMEVALUE_DATETIMEFORMAT', 'TINYINT', 'TUPLE_DATETIMEFORMAT', 'VARBINARY', 'VARCHAR', 'Warning', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', 'apilevel', 'connect', 'error', 'errorclass', 'mxODBC', 'mxODBCType', 'mxODBCursorType', 'paramstyle', 'sqltype', 'threadlevel'] It would be "expected" that errors and exceptions were defined in the same module as the classes and functions, but I suppose the structure of mxODBC makes this assumption a little uncertain. Still, 'dir' used liberally often tells you what you need to know. Paul From shogan at iel.ie Wed Apr 26 06:34:49 2000 From: shogan at iel.ie (Shaun) Date: Wed, 26 Apr 2000 11:34:49 +0100 Subject: how would i make a HTML type UI? Message-ID: <000f01bfaf6b$0c9c6200$2801000a@iel.ie> how would i create a HTML type user interface using python which would take in say, -name-address-date of birth- and record it with the intention of struct.pack-ing the values entered, thanks Shaun ===================== Shaun Hogan Interactive Enterprise Ltd. alt. E-mail : shaun_hogan at yahoo.com +353 86 8342529 From falknor at worldspy.net Sun Apr 2 12:51:46 2000 From: falknor at worldspy.net (Falknor) Date: 2 Apr 2000 09:51:46 -0700 Subject: Hmm, little Tk question. Message-ID: <20000402165146.20535.cpmta@c000.sfo.cp.net> An embedded and charset-unspecified text was scrubbed... Name: not available URL: From ivanlan at callware.com Wed Apr 12 14:18:58 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 12 Apr 2000 12:18:58 -0600 Subject: Off-topic Message-ID: <38F4BE12.A0C73D1D@callware.com> Hi All-- This is not precisely about Python, but it does affect my *usage* of Python on redhat 6.1. Why don't #! scripts seem to work anymore? #!/usr/bin/python and #!/usr/bin/perl scripts don't work. Error is bash: ./h2n: No such file or directory but "perl h2n" gives: Must specify one -d and at least one -n. I give up ... sorry. Which is the correct behaviour. h2n starts with #!/usr/bin/perl blah .... There are no funny things going on with line-endings, no control characters, no extra spaces. This all works just fine on redhats 5.2 and 6.0, but it fails consistently with 6.1. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From btang at pacific.jpl.nasa.gov Tue Apr 18 12:44:21 2000 From: btang at pacific.jpl.nasa.gov (Benyang Tang) Date: Tue, 18 Apr 2000 09:44:21 -0700 Subject: Lists References: Message-ID: <38FC90E5.455DC023@pacific.jpl.nasa.gov> Is following what you want to do? a = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] print a b = 5 for item in range(len(a)): try: print b / a[item] except ZeroDivisionError: pass "Daley, MarkX" wrote: > > This feels like a real newbie question, but here is the code that is causing > my question: > > # Learning exceptions > > def test(): > a = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] > print a > b = 5 > for item in a: > try: > print b / a[item] > except ZeroDivisionError: > pass > > Here is the output of this code under IDLE: > > [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] > 5 > 2 > 1 > 1 > 1 > -1 > -2 > -2 > -3 > -5 > > Why is the list being processed in reverse? The exception works fine, but > the math is backwards. I don't recall this happening before. > > TIA > > - Mark -- <> Benyang Tang <> From shapr at uab.edu Fri Apr 28 11:43:03 2000 From: shapr at uab.edu (Shae Erisson) Date: Fri, 28 Apr 2000 15:43:03 GMT Subject: parser and tokenize modules: sample code? Message-ID: <3909B42D.2E564923@uab.edu> Can someone point me to sample code for the parser and tokenize modules? As Moshe Zadka says, the parser module doesn't seem easy to use. I've read through the example.py for the parser module, but I'd like to see more code if someone has some. thanks, -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius On fIre nossirEaehS?ikiw/nib-igc/moc.2c://ptth From roy at popmail.med.nyu.edu Tue Apr 4 23:10:25 2000 From: roy at popmail.med.nyu.edu (Roy Smith) Date: Tue, 04 Apr 2000 23:10:25 -0400 Subject: What is python's language level? References: <38EA1B8F.A797A130@lmco.com> <38E9DDD3.3313FF6@bioreason.com> <38EA9CD4.3473B910@callware.com> Message-ID: Ivan Van Laningham wrote: > Yes indeed. Any n/troff source file could qualify. Macro files, by > definition, transcend obfuscated. I wonder what's next up that ladder? Have you ever looked at the output of a bib | tbl | eqn pipeline? From al_amerin at yahoo.com Mon Apr 24 23:28:09 2000 From: al_amerin at yahoo.com (Al-Amerrho H. Amerin) Date: Mon, 24 Apr 2000 22:28:09 -0500 Subject: new linereading standard? References: <3904D21B.333DD930@visionart.com> Message-ID: <390510C9.A744D22E@yahoo.com> Pete Shinners wrote: > > now i can code in a preferred style > > myfile = open('myfile.txt', 'r') > for line in filelines(myfile): > print line > myfile.close() > > as opposed to > > myfile = open('myfile.txt', 'r') > while 1: > line = myfile.readline() > if not line: break > print line > myfile.close() > > > _____Pete Shinners______ > pete at visionart.com A beginner myself, I would write it like this: inputlines = open('myfile.txt').readlines() for line in inputlines: print line Instead of the 'while 1: ....break' thingy. Al- From aa8vb at yahoo.com Wed Apr 12 12:07:51 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 12 Apr 2000 12:07:51 -0400 Subject: Python idiom: Multiple search-and-replace In-Reply-To: <20000412144609.7026.qmail@web2006.mail.yahoo.com> References: <20000412144609.7026.qmail@web2006.mail.yahoo.com> Message-ID: <20000412120751.E2446939@vislab.epa.gov> Darrell Gallion: |My solution is more work than Fredrik's, unless you |plan on making a lot of changes to the buffer. |Like many hundreds of patterns on a large buffer. | |Keep a list of changes to be performed. |(start, seqNumber, text, end) | |seqNumber stabilizes the sort of this list. | |If the start==end then delete a section. | |Sort the list and perform all operations at once. |This is like a transaction, which allows for some |other cool features. Such as detecting conflicting or |overlapping changes. | |I have code if you want it. For the dataset and change sizes I'm working with, Fredrick's re replacement function approach gets the running time down sufficiently. Thanks for the reply though. I'll keep your technique in mind if I'm faced with much larger datasets. -- Randall Hopper aa8vb at yahoo.com From embed at geocities.com Fri Apr 7 10:24:28 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 7 Apr 2000 10:24:28 -0400 Subject: freeze not working (win) Message-ID: I read the README in c:\python\tools\freeze, and it said to try this as a starting point for Freeze: >freeze -p c:\Python hello.py (Using Python source directory) [--snipped about 50 lines--] freezing string ... freezing tempfile ... freezing types ... generating table of frozen modules C:\Python\win32\win32api.dsp: [Errno 2] The system cannot find the file specified: 'C:\\Python\\win32\\win32api.dsp' No definition of module win32api in any specified map file. Warning: unknown modules remain: win32api What do I do? If i had to guess I'd say that the *.dsp is a Visual C++ Project file. What does Freeze want with the source code to the Win32 extensions? Do I have to get this file from somewhere? I looked on Mark Hammonds page and my only option is to grab source from CVS. {Haven't done that before. don't know how.} What do I do!? Warren From senn at maya.com Wed Apr 19 13:23:17 2000 From: senn at maya.com (Jeff Senn) Date: 19 Apr 2000 13:23:17 -0400 Subject: __del__ problem - more details provided. still stumped though. In-Reply-To: "Gordon McMillan"'s message of "Wed, 19 Apr 2000 10:55:05 -0400" References: <1255966388-25179470@hypernet.com> Message-ID: "Gordon McMillan" writes: > Warren Postma wrote: ... > > def __del__(self): ... > The problem is that the Py_Finalize logic has a real hard time > knowing in what order to zap things. By the time this __del__ > runs, the dbc module has already been zapped. Squirrelling > away a reference in the method definition will ensure it's > existence. In general, a __del__ method (or anything called > from a __del__ method) cannot rely on any references outside > the object unless it uses this trick. Yes -- a number of folks who come from (non-Python) "OO" languages seem to fall into this particular trap. Variables assigned in the module look a lot like things that would be called "static (class) variables" in other languages -- the fact is, that instances of classes in Python can outlive the module in which the class was defined. So this pattern of using "module variables" as "(class) statics" is a dubious thing in Python -- it tends to work only because people don't tend to write code that cleans up modules... it will show up other places then __del__ if you try that (anyone tried calling reload() aggressively? e.g. in a dynamic development env...) If this is not in docs somewhere with an example it probably should be... -- -Jas From spenrose at my-deja.com Thu Apr 20 19:12:58 2000 From: spenrose at my-deja.com (spenrose at my-deja.com) Date: Thu, 20 Apr 2000 23:12:58 GMT Subject: Using python on the web References: <8di2bk$l1s$1@newshost.accu.uu.nl> <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> <9N4L4.499$wYl.191816704@newsb.telia.net> Message-ID: <8do2te$kpr$1@nnrp1.deja.com> We build medium-busy, CGI-intensive sites in Python. We were briefly quite excited about Zope, but once we realized it locked us into Yet Another Programming Language, we lost interest. DHTML is particularly problematic, AFAI can tell, because it doesn't appear to allow the segregation of HTML development from coding the way Python string substitution does. We hire very skilled HTML people to do HTML and tell them to leave our sustitution tags alone, rather than taking the time and money to create novice DHTML people to do the same work. If we were going to learn another language for production purposes, Perl, Java, and C++ all have vastly larger infrastructures (code bases, labor pools, documentation, etc.) than DHTML ever will. There are enough hassles in using Python, which I love, because of its relatively small installed base. No way am I going to something which is an order of magnitude less supported. The biggest hassle for us has been the weak MySQL support in Python. The spec keeps changing and the interface is raw. (That should not be read as a complaint directed at the people who have worked on the current modules. I am tremendously grateful for their existence; I just wish the community had more resources to throw at the problem.) We've written a dictionary-based interface to sit on top of the modules, but it's remains the source of much wailing and gnashing of teeth. In article <9N4L4.499$wYl.191816704 at newsb.telia.net>, "Fredrik Lundh" wrote: > Charley Horse wrote: > > It was just an unexpected surprise. I'm fairly new to all of this and > > always heard of CGI in the context of "you don't have to user CGI > > anymore because of the fancy new blah blah technology we offer!" > > in Python land, that fancy technology is called > Zope (www.zope.org). > > well worth checking out, but be careful -- your > brain might explode. > > > > Sent via Deja.com http://www.deja.com/ Before you buy. From mfletch at tpresence.com Thu Apr 20 00:11:39 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 20 Apr 2000 00:11:39 -0400 Subject: [Announce] mcf.vrml release 2.0b Message-ID: mcf.vrml version 2.0 beta is now available at http://members.home.com/mcfletch/programming/mcf_vrml.htm >From the home page: The mcf.vrml libraries are an extensive set of programming tools for manipulating VRML 97 sceneGraphs. Their primary purpose is to allow the creation of design-time tools to programmatically process and generate complex VRML 97 content. Lately they have been used for generating VRML 97 sceneGraphs in response to Zope queries. * Full parser, supports all VRML 97 constructs. Written on top of the simpleparse parsing engine which is, in turn, built on top of the mxTextTools library. Parses/loads at approximately 160,000 cps (with considerable potential optimisation untapped). * All sceneGraph/Node/Route/etceteras objects can be pickled/unpickled. This allows for storage in Zope databases for server-side generation tasks. * Full mcf.walker processing/rewriting engine sub-classes allow for creating advanced processing applications (Tpresence's commercial SkeletonBuilder H|Anim avatar converter is based on mcf.vrml and mcf.walker) * Node-creation syntax in Python closely mimics VRML syntax while still standard Python * Robust linearisation/output including prototype dependency negotiation, USE negotiation, etcetera. Allows application developers to largely ignore the question of sceneGraph ordering. * Written in Python, which has a supportive developer community. * Includes useful tools including material stripper for 3DSMax pre-lighting support, and transform zeroing (convert coordinates to world-space) * Open Source (Python/BSD) license (see distribution for details) >From the release notes: 2000/04/19 -- version 2.0 beta This represents the first public release after re-writing the core node structures (prototype, node, etc.) and revising all scripts to use the new (simplified) interfaces (surprising minor revisions, giving the level of the change). The re-writing was triggered by switching to the SimpleParse parser generator from the older mcf.pars parser generator (it was simpler to write a new builder/parser using the SimpleParse generator's more reliable parse tree than to retro-fit the original fragile converter). In doing so, the memory overhead for parsing long files with many root-level nodes has been reduced. Overall speed appears somewhat better, but not dramatically so. Enjoy all, Mike __________________________________ Mike C. Fletcher Designer, VR Plumber http://members.home.com/mcfletch From breiter at usf.Uni-Osnabrueck.DE Wed Apr 12 10:56:16 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 12 Apr 2000 14:56:16 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d149t$jo6$1@nnrp1.deja.com> Message-ID: <8d22qg$oai$1@newsserver.rrzn.uni-hannover.de> In article <8d149t$jo6$1 at nnrp1.deja.com>, tom__98 at my-deja.com writes: >> tom> -- How can I browse the Python documentation without firing >> tom> up a web browser? >> >> Convert it to text format. It's latex, you can make it into anything >> you want, and do anything you want with it. > > Well, what I'm suggesting is that it might be a good idea > to make a command-line accessible version of the documentation, > together with a command line tool, available as part of the > standard distribution. lynx is a command line tool and will work fine and fast. Bernhard -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) From greg at cosc.canterbury.ac.nz Wed Apr 19 23:53:02 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 20 Apr 2000 15:53:02 +1200 Subject: __del__ problem - would adopting Garbage Collection fix this? References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> Message-ID: <38FE7F1E.168E914A@cosc.canterbury.ac.nz> Michael Hudson wrote: > > "Warren Postma" writes: > > > 2. Is this convincing proof, or not, that Garbage Collection would > > be a Good Thing. > > I don't think so. You still have to destroy things; true gc might > help I suppose, but I'm fairly sure it doesn't solve the problem > completely. Actually, it might. The reason that Py_Finalize explicitly destroys module namespaces is to break the circular references that occur between the module dictionary and the functions defined therein. With true GC, breaking references in an arbitrary order like that would no longer be necessary. Although another set of problems would then crop up, concerning in what order to finalise objects that reference each other. Last time this was discussed, I think we decided that the simplest option was simply not to call the __del__ methods of unreachable objects participating in cycles. The __del__ method would only be called if the object was collected as a result of its refcount dropping to 0. The destructors of C objects would still have to be called, so that resources external to the Python system (files, windows, etc.) would be reclaimed. Such C destructors would have to be careful about making any callbacks to Python code (preferably not do it at all). Another option would be to call all __del__ methods of all the objects about to be reclaimed first, then free the memory (after checking that none of them have been resurrected). Either way should reduce the chance of having something disappear out from under you unexpectedly in a __del__ method. By the way, does anyone know what the recently announced GC patch does about __del__ methods? -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From sigma_seitse at hotmail.com Mon Apr 17 13:43:49 2000 From: sigma_seitse at hotmail.com (sigma seitse) Date: Mon, 17 Apr 2000 17:43:49 GMT Subject: guestbook Message-ID: <20000417174349.71830.qmail@hotmail.com> hi. i'm trying to write a guestbook in python. well, it should consist additional feature like this: it should enable the owner to change and response to visitors' comments and show it out. have you got anything like this or maybe you know an address or smth, where I could find something like this? a newbie..:).... ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From gmcm at hypernet.com Sun Apr 2 17:43:33 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sun, 2 Apr 2000 17:43:33 -0400 Subject: NameError when assigning dictionary values In-Reply-To: <20000402203338.21701.qmail@web2105.mail.yahoo.com> Message-ID: <1257410679-53490486@hypernet.com> lewst writes: > This simple problem is driving my crazy. I can't figure out why I get > a NameError with this program. > > # add each key-value pair to the dictionary and > # then for each value, create an empty list. > mydict = {} > for key,value in [ (".", "one"), ("+", "two") ]: > mydict[key] = value > value = [] > print mydict > print one,two > > Whe I run this I get "NameError: one". Why aren't my 2 empty lists > named "one" and "two" being created? You're creating two empty lists, both named "value".The first is thown away by creating the second. Nowhere are "one" and "two" variable names, hence the NameError. - Gordon From culliton at clark.net Sat Apr 1 15:40:15 2000 From: culliton at clark.net (Tom Culliton) Date: Sat, 01 Apr 2000 20:40:15 GMT Subject: New Features in Python 1.6 References: <000301bf9c15$23a18f20$182d153f@tim> Message-ID: In article <000301bf9c15$23a18f20$182d153f at tim>, Tim Peters wrote: >[Tom Culliton] >> OK, it's April 1st so maybe I'm just not getting the joke but... >i-especially-love-that-"split"-guesses-which-arg-is-the-splittee-ly y'rs - That scared me too... From kevinmcd at NOSPAM.linuxsolutions.demon.co.uk Wed Apr 26 11:47:08 2000 From: kevinmcd at NOSPAM.linuxsolutions.demon.co.uk (Kevin McDermott) Date: Wed, 26 Apr 2000 16:47:08 +0100 Subject: Perl Documentation SHOCK! Message-ID: <39070F7C.8B6AA986@NOSPAM.linuxsolutions.demon.co.uk> Hmmm, Doesn't look like anybody's posted this before: >From the CPAN available file perlpalmdoc-doc-500503-1.tar README "Core Perl Documentation Formatted for your PalmPilot! 'Finally, you can have perl on your Palm!' 'An indispensable reference!' created with: pod2html and htmltodoc from the palm-doctoolkit pyrite (some Python scripts for dealing with PalmOS 'stuff') Converted by: Robert Spier PalmPerlDoc comes in two formats: 'doc' -> standard Palm doc format 'teal' -> fancier tealdoc format with links and fonts The entire core documentation requires about 1.2 MB of disk space. Space in your palm will vary. ChangeLog: Aug 06 1999 -> first release to CPAN" "Hmmm, gotta get a man to do a man's job?" Kevin From moshez at math.huji.ac.il Fri Apr 7 14:45:41 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 7 Apr 2000 20:45:41 +0200 (IST) Subject: [Python-Dev] Round Bug in Python 1.6? In-Reply-To: <200004062130.RAA26273@eric.cnri.reston.va.us> Message-ID: On Thu, 6 Apr 2000, Guido van Rossum wrote: > However, it may be time to switch so that "immediate expression" > values are printed as str() instead of as repr()... Just checking my newly bought "Guido Channeling" kit -- you mean str() but special case the snot out of strings(TM), don't you Trademark probably belong to Tim Peters. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From mwh21 at cam.ac.uk Wed Apr 12 14:30:51 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 12 Apr 2000 19:30:51 +0100 Subject: Off-topic References: <38F4BE12.A0C73D1D@callware.com> Message-ID: Ivan Van Laningham writes: > Hi All-- > This is not precisely about Python, but it does affect my *usage* of > Python on redhat 6.1. > > Why don't #! scripts seem to work anymore? #!/usr/bin/python and > #!/usr/bin/perl scripts don't work. Error is Someone's taken /usr/bin/python away? Tried strace-ing it? I presume /bin/sh scripts are still working (wouldn't like to think what happened if they went away). HTH, Michael -- incidentally, asking why things are "left out of the language" is a good sign that the asker is fairly clueless. -- Erik Naggum, comp.lang.lisp From mwh21 at cam.ac.uk Sun Apr 16 14:06:31 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 16 Apr 2000 19:06:31 +0100 Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8dbdj3$dgt$1@slb2.atl.mindspring.net> <8dcpom$fbc$1@slb3.atl.mindspring.net> Message-ID: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) writes: > Pass functions? > > def exp_if(test, true, false): > if test: return true() > else: return false() > > x = exp_if(a is not None, lambda a=a,i=i: a[i].weeble, lambda: 0) > > Getting silly, though :) Watch out, you'll be writing code in cps (continuation passing style) next... Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From dkuhlman at netcom.com Fri Apr 28 15:30:38 2000 From: dkuhlman at netcom.com (G. David Kuhlman) Date: 28 Apr 2000 19:30:38 GMT Subject: Remote debugging background processes Message-ID: <8ecosu$t1e$1@slb2.atl.mindspring.net> I would like to be able to re-route the output from and input to the Python debugger (pdb) to another window, possibly on another machine. We have background, server-side scripts that we run from within our Web server add-on that we want to be able to debug. I searched for this in DejaNews and found something about MrCreosote. That seems hopeful. I also looked briefly at the asynchat stuff in Medusa/ZServer. I'm a believer in Sam Rushing, so that looks very cool to me even though I don't understand it yet. Has someone already done something like this? Is there support for this kind of thing in mod_python or some other support for python in Apache? Where should I look? If anyone has some help, please let me know. Otherwise, I think I have a fun weekend project for myself. - Dave From phd at phd.russ.ru Mon Apr 24 07:07:33 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 24 Apr 2000 11:07:33 +0000 (GMT) Subject: compress_web.py In-Reply-To: <3900A524.4A32674D@binary.net> Message-ID: On Fri, 21 Apr 2000, Mike Hostetler wrote: > for i in newfiles: > tar = tar+ " " + i This is just tar = string.join(newfiles, " ") Simpler and faster. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From tzman at bhmi.com Tue Apr 11 08:36:52 2000 From: tzman at bhmi.com (T Zimmerman) Date: Tue, 11 Apr 2000 07:36:52 -0500 Subject: Tcl vs Tkinter Message-ID: <38f31c65$0$27527@wodc7nh0.news.uu.net> I again am looking for help on the use of 'alt-*' to access the menus in any application written with Tkinter. I have tried the tcl examples that were included with the download of Python and they work as expected. So, I am confused as to why it does not work for Tkinter widgets. The following script should work and should open the 'File' menu when 'alt-f' is pressed. On NT this does nothing. ================================================================== import Tkinter root = Tkinter.Tk() button = Tkinter.Menubutton(text = 'File', underline = 0) button.pack() menu = Tkinter.Menu(button) button.configure(menu = menu) menu.add_command(label = 'Hello World', underline = 0) root.mainloop() ================================================================== Regards, Travis Zimmerman tzman at bhmi.com From mjhand at concentric.net Fri Apr 14 03:32:12 2000 From: mjhand at concentric.net (Manus Hand) Date: 14 Apr 2000 03:32:12 EDT Subject: Questions on 1.6a2's string methods Message-ID: <38F6C904.76B538E5@concentric.net> 1. I see that string objects now support (as methods) most of the functions from the string module. Among these are: upper, lower, split, strip, find and surely others. My question is, why is capwords (which seems to be in the same genre as upper and lower) not a method? 2. Along these same lines, since split() became a method of the string type, wouldn't it make sense to make join() a method of the list type? 3. Are the classlike standard types (list, dictionary, and now string) equipped with a __dict__ attribute? I can see the names of all functions supported by a user-defined class by saying className.__dict__.keys(), but I cannot see the list of methods for the string type (at least not in the same way). Thus my need to ask silly questions like #1 above (maybe capwords is there by some other name??) Please copy me on any response. Thanks! Manus From loewis at informatik.hu-berlin.de Tue Apr 18 10:30:37 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 18 Apr 2000 16:30:37 +0200 Subject: modifying os.environ References: Message-ID: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) writes: > Is there any way to delete things from the environment in python? A > look at os.py reveals that _Environ only overrides __setitem__ to > putenv. So how do you *delete* environment values? perl does it, > and a look at the source seems to indicate that it doodles with the > C environ directly. So perhaps python needs a delenv _Environ can > use or something, or implement os.environ in C? Some systems provide unsetenv(3), but that is not generally available. > Or perhaps there's a better way to do the (common) thing I'm trying > to do: clean the environment to insure some minimum sane values. I > can't make a copy of the environ and then pass to execve() since > that doesn't help much for popen and system. You could implement popen and system yourself, starting from popen2 (for example). Regards, Martin From mjhand at concentric.net Mon Apr 17 01:01:37 2000 From: mjhand at concentric.net (Manus Hand) Date: 17 Apr 2000 01:01:37 EDT Subject: Here is some starship.python.net news Message-ID: <38FA9A30.33DD1994@concentric.net> Not good news, but news. This from the people at mcsp.com, the hosts of the ailing starship python. Does anyone know who the "responsible person" spoken of below might be and how the Python community can help bring the problem to his attention?? Manus (who has this fear that the "responsible person" has a python.net e-mail address, so he's not getting the messages being left for him :-) Forwarded message: From: "Paul Wolotsky" Date: Sun, 16 Apr 2000 06:33:51 -0400 Organization: Medical Computer Systems Yes - we are aware that the machine is down - we have left messages for our contact of the responsible person for the machine - but have had no reply - we finally shut the machine down the other day after several days of repetitive crashes and disk errors. There is nothing that we can do until the responsible parties come in and service the machine! ----------------------------------------------------------- Paul Wolotsky President, Medical Computer Systems 1729 21st Street, NW Washington, DC 20009-1101 From simpsons at kom.auc.dk Wed Apr 26 15:37:40 2000 From: simpsons at kom.auc.dk (Thomas Rasmussen) Date: Wed, 26 Apr 2000 19:37:40 GMT Subject: global variables or inheritence Message-ID: <28p8zy0irgc.fsf@lada.kom.auc.dk> Hi I have quite a big problem. I have two different files, where I in one file want to declare a variable and then in the other file be able to access and use this variable (no need to change it), but I just can't seem to get it to work... Is there any nice way of doing this easily? I have tried the global var but this doesn't seem to work. Anyone got a good idea? Thomas -- KOM Network student helper "To alcohol! The cause of - and solution to - all of life's problems!" -- Homer Simpson From ajung at sz-sb.de Sat Apr 29 10:31:58 2000 From: ajung at sz-sb.de (Andreas Jung) Date: Sat, 29 Apr 2000 16:31:58 +0200 Subject: How to get the python object from a variable name ? Message-ID: <20000429163158.A4091@yetix.sz-sb.de> Inside a C program I need to get a pointer to the python object for a object or variable by its variable name in the current namespace of the interpreter. What I want to do ? My programs gets names of variables and I need to get the str() representation for given variable/object names as a C (char *). Maybe a stupid question but I've no idea :) Merci, Andreas From embed at geocities.com Wed Apr 19 16:48:55 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 19 Apr 2000 16:48:55 -0400 Subject: __del__ problem - would adopting Garbage Collection fix this? References: <7ojL4.9424$HG1.254543@nnrp1.uunet.ca> Message-ID: I have received a helpful not explaing that the C function Py_Finalize does not always correctly figure out the right order in which to destroy things. The usual hack to work around this is like this: def myclass: def __del__(self,foo=foo): #ensure symbol foo is not freed foo.bar() # call foo method in destructor without worry Another similar hack I am now using: def myclass: _foo=foo def __del__(self): self._foo.bar() # class variable _foo (1 per class) My questions: 1. Shouldn't freeing modules in Py_Finalize be in the reverse order of the way in which the modules were created? Could a module-destruction order be explicitly maintained by the system? 2. Is this convincing proof, or not, that Garbage Collection would be a Good Thing. Is JPython immune to these bizarre behaviours? 3. What about adding a __finalize__ method to objects. Python could then finalize all objects first, and then delete them, and the rule is you ONLY EVER USE __del__ when you Absolutely Have to, and with some known issues (such as this). In other words, all objects are finalized in Py_Finalize, then destroyed. When an object is deleted with del(obj), it is finalized first, then freed. 4. Until such point as there is a __finalize__, I am actually going to explicitly call a finalization method, then delete objects. Side effects on Destructors can arguably be a Bad Thing. Any other thoughts? Warren From dgoodger at bigfoot.com Mon Apr 10 00:16:26 2000 From: dgoodger at bigfoot.com (David Goodger) Date: Mon, 10 Apr 2000 00:16:26 -0400 Subject: indexed dictionaries? In-Reply-To: References: Message-ID: on 2000-04-09 22:30, Michal Wallace (sabren) (sabren at manifestation.com) wrote: > I'm looking for a cross between a dictionary and a list, > such that keys() always returns keys in the order in which they were > added, and that instance[0] refers to the first key... ... > Anyone got something like this? I have implemented a list/dictionary hybrid in my SGF Parser Library (class Node in http://gotools.sourceforge.net/sgflib/ ). It doesn't do ordered keys(), but it does do indexing by integer (note that in this library, no numeric dictionary keys will ever be used). It may give you a few ideas. Please send me a copy of your final implementation of indexed dictionaries; I'd be interested to see what you come up with. -- David Goodger dgoodger at bigfoot.com Open-source projects: - The Go Tools Project: http://gotools.sourceforge.net (more to come!) From akira.kiyomiya at autodesk.com Wed Apr 26 14:44:10 2000 From: akira.kiyomiya at autodesk.com (Akira Kiyomiya) Date: Wed, 26 Apr 2000 11:44:10 -0700 Subject: Simple Function Question Message-ID: <8e7ddt$18n@autodesk.autodesk.com> Hi, Could you explain this in dummy's language? This function prints out '4' and I have a feeling that x=1 and n=3, so add1(3) prints '4'. However, I have a difficlut time trying to see how these two arguments assigned to both x (especially x) and n. Thanks Akira # Return a function that returns its argument incremented by 'n' def make_incrementer(n): def increment(x, n=n): return x+n return increment add1 = make_incrementer(1) print add1(3) # This prints '4' From johnm at magnet.com Wed Apr 19 10:44:53 2000 From: johnm at magnet.com (John Mitchell) Date: Wed, 19 Apr 2000 10:44:53 -0400 Subject: Very Horrible Question About Goto's In-Reply-To: Message-ID: On Wed, 19 Apr 2000, Daley, MarkX wrote: > It depends on what the GOTOs are doing. If they are providing a GOSUB-like > feature, you can do the same thing in Python by defining the task and then > invoking it in other functions. If they are providing flow control, it may > be a little trickier. > -----Original Message----- > From: Richard Jones [mailto:richard.jones at ibahealthcare.com] > Sent: Wednesday, April 19, 2000 12:09 AM > > I'm trying to create a converter from our own internal language (horrid) > into python. My only problem so far is that the original language uses > *LOTS* of goto's. Is there any way that this can be replicated within > python ? I have two suggestions: 1) the only valid use of goto's in C I've seen looks like this: if (bogus) goto cleanup do stuff; return(okay); cleanup: close file handles; do cleanup return(error) One way to do this in Python is using Exceptions, which in practice is much cleaner: status = error try: do stuff status = okay except Bogus: cleanup return status Also checkout try/finally for this type of thing. 2) Often, when porting a program from a procedural language (C, Perl) to Python, you'd be better off *rewriting* the entire program. Yes, I know it's a pain; but for some reason whenever I do this the code *shrinks* by about 30-50%, and is more flexible and easier to read. I used to write procedural code, then get sick of it after ~150 lines and refactor it into Objects and Methods (ie: cut-and-paste). Resulting program was shorter and much, much easier... just my 2c - j From kcazabon at home.com Sun Apr 9 16:39:32 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Sun, 09 Apr 2000 20:39:32 GMT Subject: Tkinter: centering windows on screen References: <38F0C6A7.10878609@dkfz-heidelberg.de> <38F0C95D.1F7E853@dkfz-heidelberg.de> Message-ID: <8U5I4.121484$Dv1.1314709@news1.rdc1.bc.home.com> Thanks Fred... It'll work, but that means that I'll actually have to do some work to get it positioned right! q:] I guessed it wouldn't be as easy as widget.place(CENTER). Oh well... Is there a Python or Tkinter call to return the screen resolution? I know I can probably get it through Win32, but I'd rather make it cross-platform... I'll do some digging. Kevin. "Fredrik Lundh" wrote in message news:xR4I4.274$rc9.188784640 at newsb.telia.net... > Kilian Lorenz wrote: > > >> that works but doesn't help me much because I'm interested in the > > >> return value. So I would really like to know how to call Tk commands > > >> from within Python because .... blah blah > > > > Now I also found out how this works ... pretty easy with > > .tk.call(, , ...) > > > > You just have to browse Tkinter.py and get the answers to all your > > questions ! :) > > if you browsed the source, how come you didn't find the > corresponding Tkinter methods? > > windows geometry: > http://w1.132.telia.com/~u13208596/tkintrobook/x9867-window-geometry-methods > .htm > > file dialogues: > http://w1.132.telia.com/~u13208596/tkintrobook/x1164-data-entry.htm > > (direct pointers to the current draft; official version at > www.pythonware.com will be synchronized next week). > > > > From jmassung at magpiesystems.com Mon Apr 17 12:34:15 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Mon, 17 Apr 2000 10:34:15 -0600 Subject: How do I make a constant global variable in Python Please References: Message-ID: Along the same lines... is there a way to say a variable must be declared before use? I know Perl has something like this. I just want to avoid something like this following: ate = 1 while ate: # do something here ... are = 1 This will loop infinitely just because of a typo (that if the above were added I would get an error saying that "are" wasn't declared). Jeff cmfinlay at magnet.com.au wrote in message ... >How do I make a constant global variable in Python Please. >or just a constant. >or just a global. > >I bought a Python Book. however I can't find this info in it. > >Please e-mail me at cmfinlay at magnet.com.au From francesco.contini at tiscalinet.it Tue Apr 4 18:05:23 2000 From: francesco.contini at tiscalinet.it (FrancescO) Date: Wed, 5 Apr 2000 00:05:23 +0200 Subject: Problem with gzip module Message-ID: <8cdojr$69n$1@lacerta.tiscalinet.it> Hi! I can't understand how is the right way to use the gzip mudule to perform a compression of a list of files, that i must read with gunzip or winzip ecc... I have read some examples from starship.python.com but... I must write a cron script to zip log files from a directory, now i used the zlib module, but for decompress I must use the uncompress method of the zlib... the program do it very well, but the compressed files must be readed from winzip from a Winnt on the net... does anyone explain me, maybe with an example? Thanks! From sabren at manifestation.com Fri Apr 14 06:54:59 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Fri, 14 Apr 2000 06:54:59 -0400 (EDT) Subject: how do I know to what module an object belongs? In-Reply-To: Message-ID: On 14 Apr 2000, Michael Hudson wrote: > Presumably dbc is not a Python class, but an extension type. yup. > See what type(dbc).__name__ says; maybe you can special case for that? > > Otherwise, I think you're hosed. I'm not sure it's a good idea; > it sounds rather fragile to me. it gives "mxODBC Connection". Huh. :/ I wound up just writing a wrapper module around ODBC.Windows, and it seemed to do the job. Not the best answer, but it worked. Thanks, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From cdh at mail.ala.net Wed Apr 5 22:41:51 2000 From: cdh at mail.ala.net (cdh) Date: Wed, 5 Apr 2000 21:41:51 -0500 Subject: special attributes (and greetings from a new list user) Message-ID: <002201bf9f71$ad333b80$4f186bce@ala.net> Hi, My name is Chris Hickman and though I've been using python for a while now, I'm new to the list. I've been a member on another prog-lang list before and found it very fun and interesting. Below is a module I'd like to submit for comments. It make's attribute handling a bit easier as it takes care of __getattr__ and __setattr__ for you. The document string should explain it fairly well. Happy python programming, Christoper D. Hickman ############################################################################### # Author: Christopher D. Hickman # Date: 4/3/2000 """ Module: spec_attr.py Simplifies adding special get and set handlers for attributes. Exports: class spec_attr: Defines the methods __getattr__ and __setattr__ implement magic handlers for special attributes. The special attribute must be defined with an _ (underscore) prepended. The methods are defined as getattr and setattr. The special attributes will then automatically call their handlers whenever accessed without the leading underscore. You may also implement "virtual attributes" which are handlers only with no special attribute supporting them. See example below for usage. class spec_attr_declarative: Same as the spec_attr class except it disallows implicit attribute creation. class SpecialAttributeError(AttributeError): Error class raised by spec_attr_declarative.__setattr__() when attempting to implicitly create a new attribute by assigning a value to a non-existant attribute. Example: >>> from spec_attr import spec_attr >>> class foo(spec_attr): ... _x = 0 # special attribute x ... _y = 0 ... _z = 0 ... count = 5 ... def getattr_x(self): # special get method for x ... print "x attribute of %s was read" % repr(self) # verbalize all accesses to x ... return self._x # caveat: you must use the underscore prepended form for all "gets" ... # of a special attribute when defining it's get method. ... # otherwise, infinite recursion will ensue. ... def setattr_x(self, value): ... print "x attribute of %s was changed from %s to %s" % (self, self._x, value) ... self._x = value # same caveat applies for sets in set methods as for gets in get methods. ... def setattr_y(self, value): ... if value % 2: ... raise "y must be even!" ... self._y = value ... def getattr_xyz(self): # a virtual get method (there's no xyz attribute) ... return self.x, self.y, self.z ... def setattr_xyz(self, value): # a virtual set method ... self.x, self.y, self.z = value ... def getattr_decr_count(self): ... val = self.count ... self.count = self.count - 1 ... return val ... >>> a = foo() >>> a.x x attribute of <__main__.foo instance at 10e2bf0> was read 0 >>> a.x = 12 x attribute of <__main__.foo instance at 10e2bf0> was changed from 0 to 12 >>> a.xyz = (1,2,3) x attribute of <__main__.foo instance at 10e2bf0> was changed from 12 to 1 >>> a.xyz x attribute of <__main__.foo instance at 10e2bf0> was read (1, 2, 3) >>> while a.decr_count: ... print a.count ... 4 3 2 1 0 >>> a.xyz = (6, 7, 8) x attribute of <__main__.foo instance at 10e2bf0> was changed from 1 to 6 Traceback (innermost last): File "", line 1, in ? . . . File "", line 16, in setattr_y y must be even! >>> """ class SpecialAttributeError(AttributeError): pass class spec_attr_declarative: # important things to remember about __getattr__: # 1. __getattr__ is *only* called when a "real" attr is not present # 2. hasattr() can cause recursion to __getattr__, and traps any exceptions generated def __getattr__(self, attr): # see if there is a method defined to handle gets for attr if attr[:8] == 'getattr_': # we've either recursed because getattr_ doesn't exist, (in which case the exception # generated here is trapped by the hasattr() call from the caller), or we tried to call # the non-existant getattr_ directly. raise AttributeError, attr if hasattr(self, 'getattr_' + attr): return eval ('self.getattr_' + attr + '()') # if no method is present, try to return the value of the special attribute behind the one # we're trying to access if attr[:2] == '__': # we're probably checking for ('_' + _) due to recursive calls, a private attribute, # or an undefined instance of one of python's "magic" attributes (like __repr__), # so give up. raise AttributeError, attr if hasattr(self, '_' + attr): return eval ('self._' + attr) # otherwise, it simply doesn't exist raise AttributeError, attr # unlike __getattr__, __setattr__ is always called def __setattr__(self, attr, value): # if it's in the __dict__ it's not special, so process it quickly if self.__dict__.has_key(attr): self.__dict__[attr] = value return # see if there is a method defined to handle sets for attr if hasattr(self, 'setattr_' + attr): exec ('self.setattr_' + attr + '(value)') return # if no method is present, try to set the value of the special attribute behind the one # we're trying to set if hasattr(self, '_' + attr): exec ('self._' + attr + ' = value') return # otherwise attr could be present in the .__class__.__dict__ (or somewhere), in which # case hasattr() will return true even though the above tests failed. Create a real attribute # in the instance's __dict__. (this mirrors the default behavior in this case when no __setattr__ # method is defined) if hasattr(self, attr): self.__dict__[attr] = value return # for the declarative version, don't allow de-facto creation of a new attribute. (explicitly use # __dict__ to circumvent this) raise SpecialAttributeError, "Attempted to create a new attribute %s for the declarative class instance %s" % (attr, repr(self)) class spec_attr(spec_attr_declarative): def __setattr__(self, attr, value): try: spec_attr_declarative.__setattr__(self, attr, value) except SpecialAttributeError: # allow creation of new normal attributes (without explicitly using __dict__) in the # non-declaritive version. self.__dict__[attr] = value -------------- next part -------------- An HTML attachment was scrubbed... URL: From R.Brodie at rl.ac.uk Thu Apr 13 06:45:02 2000 From: R.Brodie at rl.ac.uk (Richard Brodie) Date: Thu, 13 Apr 2000 11:45:02 +0100 Subject: Why is if a in dict.keys() so slow..... References: <38F5A075.CDFA32D9@bedford.waii.com> Message-ID: <8d48ff$ih0@newton.cc.rl.ac.uk> "Martin Franklin" wrote in message news:38F5A075.CDFA32D9 at bedford.waii.com... > Just thought i'd throw this out there.... > > This is very slow:- > > if split[0] in map_dict.keys(): > > Compared to:- > > try: > print 'found it!',map_dict[split[0]] > > The dictionary had about 40000 key:value pairs and I needed to > look through it 250000 times..... > > Question is why? I suppose creating a 40000 element list 250000 times might have something to do with it. Have you tried map_dict.has_key(split[0]) ? From jae at ilk.de Tue Apr 25 20:26:14 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Wed, 26 Apr 2000 02:26:14 +0200 Subject: new linereading standard? In-Reply-To: (message from Johann Hibschman on 25 Apr 2000 11:23:23 -0700) References: <3904D21B.333DD930@visionart.com> <390510C9.A744D22E@yahoo.com> Message-ID: <26042000.2@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Johann" == Johann Hibschman writes: [J W B] Johann> To go off on a wild tangent, this reminds me of the whole Johann> map/lambda functional programming fracas. See, I agree Johann> with most people that I don't really want to see code like Johann> map(lambda s: string.split(string.strip(s), ',')[0], Johann> open('data.dat').readlines()) Johann> I much prefer Johann> out = [] Johann> for s in open('data.dat').readlines(): Johann> fields = string.split(string.strip(s), ',') Johann> out.append(fields[0]) Johann> But, if I'm doing this at the interactive prompt, what I end up typing Johann> is most often something like: >>>> lines = open('data.dat').readlines() >>>> lines = map(string.strip, lines) >>>> lines = map(lambda l: string.split(l, ','), lines) >>>> out = map(lambda fs: fs[0], lines) Johann> So, basically, I find the functional stuff much more Johann> useful from the command line than I do from actual Johann> programs. I think of the right transform, then I apply Johann> it. Interesting. Actually, I find the third example more readable than the other two... map(string.strip, lines) is, IMHO, more readable than a for loop doing the same. Conciseness *can* improve readability. Though it also depends on what you're used to... (maps etc are *more* readable in Lisp... than in Python) Johann> Heh. I'm free-associating here, please bear with Johann> me. Anyone else have this experience? Free-associating? Yes, I know that experience... ;-) Bye, J PS: /me learned lisp a pretty long time ago from a four-part article in `Scientific American' by Douglas Hofstadter... :-) (Actually, it was a German translation in `Spektrum der Wissenschaft') - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://members.tripod.com/Juergen_Erhard "Outside of a dog, a man's best friend is a book; inside of a dog, it's very dark." -- Groucho Marx -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkGN6UACgkQN0B+CS56qs1+mwCfa9+imyRXQaLqwLXzb0uCkc0W XbYAoJAlRQENPIdp6dUZqvi8oIwCuaeL =7ZPG -----END PGP SIGNATURE----- From rkiendl at gmx.net Fri Apr 14 07:15:36 2000 From: rkiendl at gmx.net (Robert Kiendl) Date: Fri, 14 Apr 2000 13:15:36 +0200 Subject: what is pythonwin? Message-ID: <38F6FDD8.DA2CC785@gmx.net> i ve got embedded the normal pyhton (python15.dll) into a windows mfc-app. now i want to use some of the win32ui stuff, but cannot load that mysterious *.pyd files, whereas normal python.exe from the winall distribution does it. are these dll's? is pythonwin not based on the normal python? do i have to handle the pythonwin source-distribution? link another dll? i do not get the right track from the standard docs. can anyone point me to the correct coherences? robert From tismer at tismer.com Wed Apr 19 14:15:21 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 19 Apr 2000 20:15:21 +0200 Subject: Very Horrible Question About Goto's References: Message-ID: <38FDF7B9.9781CFDA@tismer.com> Michael Hudson wrote: > > Michael Hudson writes: > > > Gaetan Corneau writes: > > > > > I was surprised to learn that Python doesn't have a goto statement. > > > Would it be difficult to add? > > > > No. The necessary opcodes are there (well, the one you need: > > JUMP_ABSOLUTE). You could use bytecodehacks to implement it, if you > > liked... > > Oh, hang on: the block stack would cause problems; how would you get > > def f(x): > label: bob > for i in x: > if x: > goto: bob > > to work? (by declaring it to be an error, I suppose). This situation is exactly where continuations would be superior than just a goto. The goto would jump at bob's continuation, which simply does not have this block. But jumping from outside the block into the block would also not work with continuations, unless the block had a chance to start up before. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 wtopa at dmcom.net Sat Apr 8 12:12:47 2000 From: wtopa at dmcom.net (Wayne Topa) Date: Sat, 8 Apr 2000 12:12:47 -0400 Subject: starting python In-Reply-To: <8cnkfi$at7$1@porthos.nl.uu.net>; from maybe@lucky.com on Sat, Apr 08, 2000 at 05:51:11PM +0200 References: <8cnkfi$at7$1@porthos.nl.uu.net> Message-ID: <20000408121247.A18876@dmcom.net> Subject: starting python Date: Sat, Apr 08, 2000 at 05:51:11PM +0200 In reply to:Soundwave Quoting Soundwave(maybe at lucky.com): Soundwave> Hi, I want to learn a bit python, I know a bit C and PASCAL, but I am Soundwave> intrested in other languages. Soundwave> Soundwave> where can I start ???? Soundwave> Soundwave> Do you naad a compiler or something for python, and where can I find one ? Soundwave> Soundwave> also, if anyone got a good tutor, please, give me the URL Soundwave> You will find all of the above at http://www.python.org HTH -- "As part of the conversion, computer specialists rewrote 1,500 programs; a process that traditionally requires some debugging. -- USA Today, referring to the IRS switchover to a new computer system. _______________________________________________________ From jmassung at magpiesystems.com Fri Apr 14 18:28:03 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Fri, 14 Apr 2000 16:28:03 -0600 Subject: TCP/IP protocols Message-ID: I'm new to Python programming, but am very experienced in C/C++. Could someone point me to a good reference for TCP/IP programming with Python (pdf, book, anything :]) thanks. Jeff From tismer at tismer.com Fri Apr 21 15:29:26 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 21 Apr 2000 21:29:26 +0200 Subject: compress_web.py References: <3900A524.4A32674D@binary.net> Message-ID: <3900AC16.11E4B6D5@tismer.com> Mike Hostetler wrote: ... > Email me if you have questions, comments, or sympathies. Just a few comments. ... > def compress_web(tar,days,webdir,bad_files): > > os.chdir(webdir) > > newfiles = [] > > os.path.walk(webdir,find_time,newfiles) > > if (newfiles != []): It is a common pattern just to ask if newfiles: Also, you don't need the braces (probably from using C). For the next loop, I'd sugest to name the variable as what it is: a filename, for sure not an "i". for fname in newfiles: > for i in newfiles: > tar = tar+ " " + i > os.system(tar) > else: > print "\n### no files found that needed archived\n" > > ##################################### > # this function is called by the os.path.walk for each file in webdir > def find_time(newfiles, dirname, names): > > strlen = len(webdir)+1 > time_limit = time.time() - (86400 * days) > > for file in names: > filename= dirname+"/"+file > > # Wow, this line sucks. But it works. Yes, it sucks, since it is recommended practice to use filename = os.path.join(dirname, file) which handles all cases of slashes for you, for all OSes. Congrats for using Python now, with such success in the first place! ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 bawolk at pacbell.net Sat Apr 8 19:46:39 2000 From: bawolk at pacbell.net (Bruce Wolk) Date: Sat, 08 Apr 2000 16:46:39 -0700 Subject: Python Megawidgets - Pmw.Blt problem Message-ID: <38EFC4DF.76F3C698@pacbell.net> Has anyone been able to use the Pmw.Blt megawidget on a Win98 system? Pmw generally seems to work ok, but when I try the examples at http://www.ifi.uio.no/~hpl/Pmw.Blt/doc/ they don't run. I get errors like Traceback (innermost last): File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", line 131, in run_module_event execfile(filename, mod.__dict__) File "C:\Program Files\Python\Bruce\HelloWorld1.py", line 5, in ? g = Pmw.Blt.Graph(master) # make a new graph area File "C:\PROGRA~1\PYTHON\Pmw\Pmw_0_~1\lib\PmwBlt.py", line 260, in __init__ Tkinter.Widget.__init__(self, master, _graphCommand, cnf, kw) File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1084, in __init__ self.tk.call( TclError: invalid command name "::blt::graph" Any ideas? Bruce From lewst at yahoo.com Wed Apr 5 00:47:32 2000 From: lewst at yahoo.com (lewst) Date: Tue, 4 Apr 2000 21:47:32 -0700 (PDT) Subject: Starving for an Advanced Python Book Message-ID: <20000405044732.10810.qmail@web2103.mail.yahoo.com> Patrick Phalen wrote: > I haven't seen anyone mention The Quick Python Book in this thread. > Also worth having on your bookshelf. I originally thought this book was purely introductory so I ignored it. After checking it out this evening I actually decided to buy it. It really looks like it will make a nice intro-to-intermediate Python text while I wait for the next edition of Programming Python. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From mhammond at skippinet.com.au Mon Apr 3 06:09:18 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 03 Apr 2000 10:09:18 GMT Subject: Some bugs in Pythonwin b.128 References: <_NaE4.6119$V56.24967@news-server.bigpond.net.au> <8F0AAC6BEm69ph83qstudentssuse@127.0.0.1> <4cQF4.4791$74.76270@newsc.telia.net> Message-ID: "Fredrik Lundh" wrote in message news:4cQF4.4791$74.76270 at newsc.telia.net... > Mark Hammond wrote: > > > Try changing these settings in your config file: > > > Shift-9 = <> > > > Shift-0 = <> > > > > That is excellent to know. Does anyone know how I can determine > > the keyboard layout? ie, how can I programatically determine > > where the paren keys are? > > umm. why should you? shouldn't you either use TranslateMessage > and look for "(" or ")" WM_CHAR events, or use ToAscii/ToUnicode to > do the translation "inline"? Ahhh - of course - thanks! Pythonwin processes these on WM_KEYDOWN, so does indeed need this translation. > (in Tkinter, all you need to do is to bind to and , > but I supports you're not using that one here :-) Well, we can't have that, can we :-) OK - the next version of Pythonwin will use these exact same binding names in its .cfg file, and will be processed after the necessary translation (ie, any builds later than 130 should have this fixed!) Thanks, Mark. From willfg at my-deja.com Tue Apr 25 09:31:09 2000 From: willfg at my-deja.com (willfg at my-deja.com) Date: Tue, 25 Apr 2000 13:31:09 GMT Subject: Question about exception-handling mechanism Message-ID: <8e46mt$4nh$1@nnrp1.deja.com> Hello all, I'm new to Python, but find its exception handling mechanism much more powerful than comparable languages; but a question was put to me that being new I can't come up with a very articulate answer. A colleague asked why in an exception handling mechanism you'd want the ELSE block to be executed if you don't throw an exception as opposed to a FINALLY block. Anyone used this feature in practice? Thanks in advance for your input, -- Will Sent via Deja.com http://www.deja.com/ Before you buy. From bjorn at roguewave.com Sun Apr 23 16:55:28 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Sun, 23 Apr 2000 14:55:28 -0600 Subject: 'database' search Message-ID: <39036340.BE82BEAD@roguewave.com> I haven't done this before, so I thought I'd ask if anyone has any experience... I have a relatively stable database of between 1500 and 5000 items (new insertions are probably going to be less than 100 during the lifetime of the database). The items are keyed on a text string. I'm creating a gui where I want to implement field completion as the user is typing, i.e. if the user types 'aa', all entries (or at least a subset) with that prefix will be (unobtrusively) presented so the user can use an alternate selection method (similar to the file open dialog on win2k, although I'm not tied to any specific implementation). I'm interested in experiences anyone might have with respect to both which datastructure to use, and if any gui toolkit is better suited for this. The smallest datastructure I've found so far, is a 'prefix dictionary', so if e.g. "aardwark" was in the database, the 'prefix dictionary' would contain: pfdict = { 'a': ['aardwark', ...], 'aa': ['aardwark', ...], 'aar': ['aardwark'], 'aard': ['aardwark'], 'aardw': ['aardwark'], 'aardwa': ['aardwark'], 'aardwar': ['aardwark'], 'aardwark': ['aardwark'] } The maximum size for this would be n * avg len of item, with the real size being much(?) smaller with sufficient prefix sharing... -- bjorn From cjensen at bioeng.ucsd.edu Thu Apr 6 20:16:22 2000 From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Date: Thu, 06 Apr 2000 17:16:22 -0700 Subject: C's ?: expression Message-ID: <38ED28D6.2C5519ED@bioeng.ucsd.edu> I while back I posted about how to simulate C's ?: expression in Python. There were quite a few responces to it. Recently, I found on pp135-136 of Mark Lutz's "Programmin Python" book that there is a way. If anyone is interested: ((TEST and [trueAction]) or [falseAction])[0] where TEST is the boolean expression and tueAction is what to do if the expression is true and falseAction is what to do if the expression is false. -- Curtis Jensen cjensen at bioeng.ucsd.edu http://www-bioeng.ucsd.edu/~cjensen/ FAX (425) 740-1451 From rcc at nospamthanks_jennic.com Wed Apr 26 04:49:15 2000 From: rcc at nospamthanks_jennic.com (Robert Cragie) Date: Wed, 26 Apr 2000 08:49:15 GMT Subject: execl problem on linux References: <8e63b2$6v2$0@216.39.162.232> Message-ID: Michael Esveldt wrote in message news:8e63b2$6v2$0 at 216.39.162.232... | This may be bordering on off topic but the following is happening with | all the exec() methods... | | Python 1.5.2 (#0, Apr 3 2000, 14:46:48) [GCC 2.95.2 20000313 (Debian | GNU/Linux | )] on linux2 | Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam | >>> import os | >>> os.execl("/usr/bin/vim") | Internal error: lalloc(0, ) | Internal error: lalloc(0, ) | bash-2.03$ | | I'm at a loss, any ideas? I think you might be better off using system(), or popen() (or popen2()) if you need to pipe stuff into (and out of) the process. I found the following works: >>> import os >>> os.system("/usr/bin/vim") I'm not sure why execve() doesn't work, but I presume it might be something to do with the command taking over the process which calls execve(), whereas I presume system() etc. spawn a separate process. Maybe the real experts can help here :-) Robert From portaldata at my-deja.com Tue Apr 25 12:10:50 2000 From: portaldata at my-deja.com (portaldata at my-deja.com) Date: Tue, 25 Apr 2000 16:10:50 GMT Subject: how to wrap c++ software to python? References: <8e3ggq$2r1d$1@news.cz.js.cn> Message-ID: <8e4g20$eeq$1@nnrp1.deja.com> HOW DO I INSTANCE A SHARED OBJECT IN PYTHON. ALSO, HOW DO I POST A NEW MESSAGE IN THIS GROUP ? In article <8e3ggq$2r1d$1 at news.cz.js.cn>, "fmr" wrote: > I will call c++ routine in python,how to wrap > c++ routine for python. > > Is there any utils to work except SWIG. > > Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Sat Apr 29 04:15:35 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 29 Apr 2000 11:15:35 +0300 (IDT) Subject: Do I always have to write "self." ? In-Reply-To: <8edc3l$7sj$1@nnrp1.deja.com> Message-ID: On Sat, 29 Apr 2000 jsolbrig at my-deja.com wrote: > Actually, > What I'd like to see would for "self" to an official keyword rather than > simply a convention. The more things that are "conventional" but not > required, the more potential there is for occasional bugs. > And occasional bugs are the WORST. Here's a solution: Search the deja-news archives for "selfnanny", and run it over your code. It will warn you about all methods not beginning with "self". -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From eviltofu at rocketmail.com Sat Apr 22 20:14:02 2000 From: eviltofu at rocketmail.com (Jerome Chan) Date: Sun, 23 Apr 2000 00:14:02 GMT Subject: Overloading the = operator? Message-ID: Is this possible? class base: def __init__(self,q): self.list = q def __add__(self,other): # some type checking code return self.list + other.list class another(base): def opr(self): # do something pass class other(base): # do something too def work(self): pass x = base([1,2]) y = another([2,4,3]) z = other([]) z = x + y z.work() where z now contains x.list + y.list??? I'm confused... From zorro at zipzap.ch Thu Apr 27 05:53:05 2000 From: zorro at zipzap.ch (Boris Borcic) Date: Thu, 27 Apr 2000 11:53:05 +0200 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> <14837CB4E98A72FE.8FD547BA6E928594.5A103CFE68327EB7@lp.airnews.net> Message-ID: <39080E01.5DC5B4E@zipzap.ch> Robin Becker wrote: > > I don't think the pessimists amongst whom I count myself reject altruism > totally. A purely altruistic action has benefit for others and none for > the actor. Makes me wonder. It is relatively obvious to argue that a non-existent is the natural representation of the existents that resemble it most. As long as the actor survives, there must exist ways to view aspects of his/her further life as a benefit of the action. This leads to the totem-and-taboo case of Jesus Himself. One might say that Jesus redeems your argumentation by providing a admitted proof that perfect altruism is in principle possible - thus forbidding to take perfect altruism in your sense, as an adequate metaphor for the imperfect altruism that you exclude. But I gather that this was not the intention of the Scripture. I would satisfy myself with an action that is consistent with being purely motivated by the benefit for others. Altruism makes sense as a choice to behave while aiming at the greater common good *assuming by fiat* a society of like, mutually altruistic agents, thus making such a society *possible*, and in any case, such a society is inconsistent with the "goal" implied by your overstrict definition of altruism : depriving agents of any benefit, when they are viewed one by one. Regards, BB -- "Hope achieves the square root of the impossible" From effbot at telia.com Tue Apr 11 10:30:17 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 14:30:17 GMT Subject: Huh? func_defaults, default values in function calls References: <8cv5qj$35p$1@zinc.intern.netconnect.no> <8cv8ra$hio$1@pegasus.csx.cam.ac.uk> Message-ID: James "Wez" Weatherall wrote: > You won't get this behaviour with something like: > > def myfun(x, a = 5): > a = x > > though, I don't think, because "5" isn't mutable. footnote: that has nothing to do with mutability. in the following example, the list isn't modified either: def myfun(x, a = []): a = x From niels at endea.demon.nl Fri Apr 14 11:25:52 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Fri, 14 Apr 2000 17:25:52 +0200 Subject: IndexError and for x in list References: Message-ID: <38F73880.885E6DCE@endea.demon.nl> "Michal Wallace (sabren)" schreef: > def _toStringKey(self, key): > """Convert numeric keys into string keys. Leaves string keys as is""" > # handle numeric keys: > if _isNum(key): > 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 Or, a bit simpler: def _toStringKey(self, key): """Convert numeric keys into string keys. Leaves string keys as is""" # note that sequence indexes must be integers if type(key) is type(0): # note that sequence indexes must be integers return self.idx[key] # this will raise the IndexError when needed else: return key > Basically, I don't want to rely on an undocumented feature that could > go away sometime. Is IndexError the right way to simulate a list? If you take the above approach, that problem will go away, since you will simply pass on the error handling of a real list, whatever that may be. To be on the safe side, you might also implement __len__ if that isn't already done. That should take care of any alternative implementation of 'for' that I can imagine. If you really want to do everything a list can do, read 'Emulating sequence and mapping types' in the language reference. -- Niels Diepeveen Endea automatisering From vetler at ifi.uio.no Mon Apr 3 07:28:54 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 03 Apr 2000 13:28:54 +0200 Subject: www.python.org References: Message-ID: * Brian Schmidt > Anyone else having problems getting into www.python.org the last couple of > days? there was a posting here today or yesterda from the python.org webmaster. iirc, the httpd had stopped for some reason. anyway, it's working now. vr From josephwinston at mac.com Thu Apr 27 09:35:12 2000 From: josephwinston at mac.com (Jody Winston) Date: 27 Apr 2000 08:35:12 -0500 Subject: Scripting and Gnome and KDE References: <3dk8hzb90u.fsf@newcnri.cnri.reston.va.us> Message-ID: Karl EICHWALDER writes: > Andrew Kuchling writes: > > > Then reality sets in: GNOME uses patched versions of all sorts of > > things such as automake, but this is never clearly documented > > anywhere. > libtool might be an exception. But normally it's enough to use recent > versions of all involved tools. > > > There's a large pile of libraries, and it's not clear which ones are > > needed and which ones are obsolete; > > autoconf resp. ./configure is considered to do all needed checks for > you. If it fails for some reason it's a bug; please, report it. We'll > try to improve the check and add a note to the README file. > > The problem is, it works nicely for the devolopers and package makers > (like me) who are familiar with the progress GNOME makes. > I have to agree with Andrew because I have had these problems and more. I don't work on a Linux machine, but an SGI. It was very difficult to get the libraries that GNOME needs to work to run. I finally gave up on GNOME. These problems are not just with GNOME and its assorted libraries but with other Open Software tools such as gimp. I've been building and using Open Software since 1982 on all sorts of platforms. I've been using and devloping on Linux for over 5 years. This includes several commercial applications (Visual Shell, Digital Analysis for Pipeline corrosion and deformation) and custom device drivers (stepper motors, ccd camera controller). It looks like to me that we have gone back to the model that all the world is a Vax and if it compiles and runs on the Vax there isn't any problem with the software. All the world isn't Linux and the only compiler isn't gcc. -- Jody Winston From R.Brodie at rl.ac.uk Fri Apr 14 09:36:33 2000 From: R.Brodie at rl.ac.uk (Richard Brodie) Date: Fri, 14 Apr 2000 14:36:33 +0100 Subject: Future compatibility of the Python C API References: Message-ID: <8d76t2$pig@newton.cc.rl.ac.uk> "Mark Hammond" wrote in message news:q4FJ4.1198$1D.10037 at news-server.bigpond.net.au... > > My big concern is Python 3000- what are the odds > > that its C API will be backwards compatibility with Python 1.x? > > Not very good. If it is a real problem, simply dont upgrade. I would > however expect the changes to cause compiler errors that are simple to > fix - ie, very similar APIs, and unlikely to silently change behaviour. I suppose that someone out there is working on persuading SWIG to generate suitable wrapper code? It would be a pain if there were a long transitional period when you had to go back to handcrafting wrapper code. No doubt doing so for the whole of win32 would keep you out of trouble a while ;) From phd at phd.russ.ru Fri Apr 21 03:43:23 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 21 Apr 2000 07:43:23 +0000 (GMT) Subject: PyApache memory leak? In-Reply-To: <8dni3s$1o1$1@nnrp1.deja.com> Message-ID: On Thu, 20 Apr 2000 spenrose at my-deja.com wrote: > We rolled in PyApache; the guy who did it is gone but the tar ball is > labelled 4.19 so I assume that's the version. It is the latest released version. But I have never saw any memory problem beeing running PyApache for lon periods. Are you sure it is PyApache and not your programs/libraries/extensions? Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From mwh21 at cam.ac.uk Thu Apr 20 07:50:10 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 20 Apr 2000 12:50:10 +0100 Subject: Starship update: April 18 References: <3du2gzmiki.fsf@amarok.cnri.reston.va.us> Message-ID: akuchlin at mems-exchange.org (Andrew M. Kuchling) writes: [mixed news] Do you know how long it's going to be before python.net mail is working again, ie. should I go running around and unsubscribe from all these mailing lists I've subscribed to as mwh at python.net and resubscribe as something that works? Cheers, M. -- 3. Syntactic sugar causes cancer of the semicolon. -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From lewst at yahoo.com Wed Apr 5 17:34:38 2000 From: lewst at yahoo.com (lewst) Date: Wed, 5 Apr 2000 14:34:38 -0700 (PDT) Subject: Starving for an Advanced Python Book Message-ID: <20000405213438.11603.qmail@web2106.mail.yahoo.com> fredrik at pythonware.com wrote: > (first you dis my eBook using the usual publisher > arguments, and now you have inside information on > when PP2E will be out ;-) Actually, I saw the error in my ways and ended up buying your eBook last night. :-) Regards. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From btribble at blueshiftinc.com Wed Apr 5 18:14:29 2000 From: btribble at blueshiftinc.com (Brett Tribble) Date: Wed, 5 Apr 2000 15:14:29 -0700 Subject: os.utime limitation on Windows? Message-ID: I have the following routine: def synctime(self, source, target): try: syncstat = os.stat(source) except os.error: self.statuswindow.insert('end', source + ': cannot get stats\n') try: os.utime(target, (syncstat[ST_ATIME], syncstat[ST_MTIME])) except os.error: self.statuswindow.insert('end', target + ': cannot change time\n') return This works fine under NT on an NTFS drive, but doesn't seem to do anything on a 95 box on a FAT16 partition. Is this a limitation with 95, FAT16, Python, or a combination therein? Thanks in advance, Brett From alex at somewhere.round.here Thu Apr 6 10:55:05 2000 From: alex at somewhere.round.here (Alex) Date: Thu, 06 Apr 2000 14:55:05 GMT Subject: More about variables References: Message-ID: > Let's say I had something like: > > number_of_variables=raw_input('Enter number of variables: ') > > if number_of_variables==1: > variable1=[] > elif number_of_variables==2: > variable1=[] > variable2=[] There is probably a more appropriate way of solving whatever problem is behind this question. How do you plan on accessing the variables once they are created? On the face of it, I think you might have more luck trying this sort of arrangement: number_of_variables=raw_input('Enter number of variables: ') variables = [] for i in number_of_variables * [None]: variables.append ([]) However, if you are bent on using a separate name for each list, you could do something like this: for i in range (1, number_of_variables + 1): exec 'variable%i = []' % i Alex. From mjackson at wc.eso.mc.xerox.com Thu Apr 13 13:05:46 2000 From: mjackson at wc.eso.mc.xerox.com (Mark Jackson) Date: 13 Apr 2000 17:05:46 GMT Subject: Complaint Dept: My shoes! References: <20000413184853.D14644@xs4all.nl> Message-ID: <8d4upa$45i$1@news.wrc.xerox.com> Thomas Wouters writes: > It entirely depends on what > else you wish to do with your shoe. (Dont get me started on how Shoe should > actually be a class with it's 'put_on' and 'throw' methods... ;) Don't forget the ever-popular 'drop' method, which acts on the *other* instance of the Shoe class. . . -- Mark Jackson - http://www.alumni.caltech.edu/~mjackson An advertiser will happily make you feel bad about yourself if that will make you buy, say, a Bic pen. - George Meyer From phd at phd.russ.ru Fri Apr 28 08:40:34 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 28 Apr 2000 12:40:34 +0000 (GMT) Subject: sleep function? In-Reply-To: <8ebvud$l6h$1@nnrp1.deja.com> Message-ID: On Fri, 28 Apr 2000 tiddlerdeja at my-deja.com wrote: > Does python have a sleep function? e.g. sleep(60) to wait 60 seconds? from time import sleep Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From hniksic at iskon.hr Tue Apr 4 09:42:40 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 04 Apr 2000 15:42:40 +0200 Subject: Tuples -- who needs 'em In-Reply-To: Mike Fletcher's message of "Tue, 4 Apr 2000 09:13:15 -0400" References: Message-ID: Mike Fletcher writes: > I think the point that is being made is this: > The _value_ of a mutable object cannot (easily) be used as a > dictionary key... > i.e. in this sequence, what is the value of the final line... > > s = [ 1,2,3 ] > p = { s: 4, [2,3,4]: 5 } > s[:] = [2,3,4] > p[ [2,3,4] ] The second line raises a TypeError, therefore the last line does not have a meaningful value. I only noted that Fredrik's sentence, as it was formulated, was wrong. Mutable collections can be used as dictionary keys, as long as they provide a meaningful hash function. From pecora at anvil.nrl.navy.mil Sun Apr 30 10:22:35 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Sun, 30 Apr 2000 14:22:35 GMT Subject: Reading in strings -> numbers ?? References: <390A2D23.7029E557@fenx.com> <8ede36$9r6$1@nnrp1.deja.com> Message-ID: <300420001022354625%pecora@anvil.nrl.navy.mil> In article <8ede36$9r6$1 at nnrp1.deja.com>, wrote: > Well, the partner to file.write is file.read. What you are really > looking for is a partner to '%f %f'%(3,4), which is essentially an > sprintf(). So, what you want is an sscanf() or fscanf(). I've been > looking for that for a while. What I would like is a version like the > one in MATLAB, that gives you a whole matrix in one swipe. > > Unfortunatly, it doesn't exist for python. Someone did make a Python > sscanf module, but I never got around to compiling it. there is also a > tablio (or something like that) module around. In the mean time, you can > always use something like: > > > list = map(float,string.split(file.readline))) > > or, to use your example: > > >>> map(float,string.split((" %e %e %d" % (1.2, -3.5, 10)))) > [1.2, -3.5, 10.0] > > it doesn't work if you want mixed types, but it gets you by. Chris, Thanks. I'll try that. After three weeks of learning Python have I actually found a real wart? A common requirment in programming (especially for numerical stuff) is to read in data that is often generated by other programs and other people. The common form is a "table" structure: data11(white space)data12(white space)...data1m(return/newline) data21(white space)data22(white space)...data2m(return/newline) ... datan1(white space)datan2(white space)...datanm(return/newline/EOF) EOF So you're saying that reading in something as basic as this is a "work-around?" Sigh. Thanks for your help. From loredo at spacenet.tn.cornell.edu Fri Apr 14 13:54:13 2000 From: loredo at spacenet.tn.cornell.edu (Tom Loredo) Date: Fri, 14 Apr 2000 13:54:13 -0400 Subject: Need full example of C extension on Macintosh (CW) References: <120420000714412887%pecora@anvil.nrl.navy.mil> <38F62C97.FD5073B@spacenet.tn.cornell.edu> <140420000717194110%pecora@anvil.nrl.navy.mil> Message-ID: <38F75B45.B2B56BEC@spacenet.tn.cornell.edu> Hi folks- For those of you following this on c.l.p, this discussion is continuing on the Pythonmac-SIG, where I've posted some CodeWarrior Pro 5 project stationery for building extensions implementing simple math functions and accessing NumPy arrays. A web site with more documentation of these examples is forthcoming. -Tom Loredo From sbarron at ansic.net Thu Apr 6 11:39:09 2000 From: sbarron at ansic.net (Scott) Date: Thu, 6 Apr 2000 15:39:09 GMT Subject: Formatting Excel cells with PythonCOM Message-ID: <38ECAF9D.ECA74709@ansic.net> Hi, I am looking for information regarding how to set the Date/Time format for Excel cells. When I enter my dates/times I use the DateTime module and the COMDate member of my objects. When I open Excel it displays them as ###### until I manually set the date/time format. How can I do this from within my Python program? Thanks, Scott From PClaerhout at CREO.BE Thu Apr 13 04:04:33 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Thu, 13 Apr 2000 10:04:33 +0200 Subject: Python CGI running commands under NT Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA72AC@MSGEURO1> Hello, I made a Python CGI-script that executes a DOS-command and should return the result in a HTML page. The script looks as follows: import os pipe = os.popen("ipconfig", 'r') text = pipe.read() del pipe print "Content-type: text/html" print print "IPConfig on AV2700" print "
" print '

'
  print text
  print '
' If I run this script from the command line, it works fine, but when I open it using Internet Information Server, all is shown except the contents of the variable text. Any ideas what could be wrong? Is it maybe a setting in IIS or are these options not allowed in CGi-scripts? Kind regards, Pieter Pieter_Claerhout at creoscitex.com From fredrik at pythonware.com Wed Apr 26 05:26:11 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 26 Apr 2000 11:26:11 +0200 Subject: execl problem on linux References: <8e63b2$6v2$0@216.39.162.232> Message-ID: <00e201bfaf61$85bd56d0$0500a8c0@secret.pythonware.com> Michael Esveldt wrote: > This may be bordering on off topic but the following is happening with > all the exec() methods... > > Python 1.5.2 (#0, Apr 3 2000, 14:46:48) [GCC 2.95.2 20000313 (Debian > GNU/Linux > )] on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import os > >>> os.execl("/usr/bin/vim") in addition to the name of the executable, execl also expects you to give it some arguments to put into sys.argv. since argv[0] is supposed to contain the name of the program, this should work: os.execl("/usr/bin/vim", "vim") From embed at geocities.com Mon Apr 17 12:06:50 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 17 Apr 2000 12:06:50 -0400 Subject: How do I make a constant global variable in Python Please References: Message-ID: wrote in message news:vCj7OA2LfMfb=znR7yTHOvmiZAkd at 4ax.com... > How do I make a constant global variable in Python Please. > or just a constant. > or just a global. > > I bought a Python Book. however I can't find this info in it. > > Please e-mail me at cmfinlay at magnet.com.au A=1 Then don't change it! Warren From jhauser at ifm.uni-kiel.de Wed Apr 5 12:32:48 2000 From: jhauser at ifm.uni-kiel.de (Janko Hauser) Date: 05 Apr 2000 18:32:48 +0200 Subject: Clear screen? References: <38eb6a36@207.71.36.3> Message-ID: <87n1n87bkf.fsf@ifm.uni-kiel.de> os.system('cls') # :-) 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 shae at webwitches.com Mon Apr 17 06:53:59 2000 From: shae at webwitches.com (Shae Erisson) Date: Mon, 17 Apr 2000 10:53:59 GMT Subject: Was Re: [ANNOUNCE] Garbage collection for Python, now Stackless comments References: <20000407221750.A29279@acs.ucalgary.ca> <38F9F01B.57273052@tismer.com> <38FA05C9.442868E4@tismer.com> Message-ID: <38FAEEC9.B5CED499@webwitches.com> Christian Tismer wrote: > Right. One should perhaps not advertize continuations in the first > place, until people know them from school. > That's why we try to build really useful stuff from them, familiar > and understandable for many people, like threads. > This also means, after some stabilization phase and iterations, > most of these applications on top of co's will get optimized > back into C, dealing with the co stuff from there. > This doesn't mean to remove the co's Python interface, > but to improve and simplify it further. So when do we get to Pickle continuation objects and send them out across the network, or even better, to another VM running on a second processor? :) Personally, I think continuations and coroutines are beautiful, and easier and simpler than threads. Yay Christian! (and Yay Guido for writing Python!) PS. Can someone point me to example code for building smalltalk style closures easily with continuations? -- sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt 13:00pm up 1 season, 1 squirrel, load average: 1+1j 0.5+2j 0.2+0.5j From mwh21 at cam.ac.uk Sun Apr 2 19:24:01 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 03 Apr 2000 00:24:01 +0100 Subject: NameError when assigning dictionary values References: <20000402231757.6604.qmail@web2105.mail.yahoo.com> Message-ID: lewst writes: > Fredrik Lundh wrote: > > > if you want to create variables in the local namespace > > on the fly, you're obviously trying to emulate some other > > programming language (Tcl?) in Python. that's usually a > > rather bad idea. > > I was trying to build a dictionary and create lists corresponding to > the value names in the dictionary in one loop. I'm afraid that doesn't help (me, at least). It still sounds like you're trying to write tcl or perl in Python. What problem are you trying to solve (at a higher level)? It's likely that there is a reasonable elegant way of doing it in Python, but it's unlikely to look much like what a solution would look like in another langauge. > > Do I really have to type "one" and "two" twice? Once to make it a > variable and a second time to add to my dictionary? I.e, > > >>> one, two = [], [] > > >>> mydict = { ".": one, "+": two } > > This seems error prone if the the number of variables grows very large > as it will for me. I'd say so. Here you could type: mydict = { ".":[], "+":[] } but I'd guess that's of no help. Hoping to help, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From mhammond at skippinet.com.au Sat Apr 8 22:01:59 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 09 Apr 2000 02:01:59 GMT Subject: win32all-130 for Python 1.6 available References: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au> Message-ID: "Adrian Eyre" wrote in message news:Q4JH4.605$hh6.22805 at news2-win.server.ntlworld.com... > 3. I don't suppose it would be possible to make debugged scripts > run in a separate thread, to stop it blocking the program's event > loop? Ive thought about this. The only problem occurs when the script being debugged is itself a GUI script. Then the script is likely to screw up big time when running under the debugger, as we wont be following the win32 GUI threading rules. A better and more general solution would be for Python to grow "remote debugging" capabilities that would allow out-of-process (even across machine) debugging. Pythonwin could then have the ability to debug a script in a complete new process.... Mark. From ns566645 at swt.edu Sun Apr 23 23:37:01 2000 From: ns566645 at swt.edu (ABC) Date: Sun, 23 Apr 2000 22:37:01 -0500 Subject: Can there be scrollbar attached to group widget Message-ID: <3903C15D.E33126@swt.edu> Hi , I have a notebook and the group is embedded in the notebook. can the scrollbar can be attached to the group. Thanks From makarki.NOSPAM at news.hit.fi Wed Apr 5 03:50:00 2000 From: makarki.NOSPAM at news.hit.fi (Matti Johannes Kärki) Date: 5 Apr 2000 07:50:00 GMT Subject: Platf. indep. console lib. References: <8c03u1$igk$1@news.hit.fi> <38E8AF93.70F4CCF7@ansic.net> Message-ID: <8cer78$2cv$1@news.hit.fi> Scott (sbarron at ansic.net) wrote: : There is an slang module which wraps the slang library. It's available : for Unix and Win32 though I haven't had the time to actually use it : yet. Here is an ftp site for it: : ftp://quasar.ipa.nw.ru/pub/avv/Python/pyslang . If you give it a try, : let me know how it turns out! Well, I checked the wrapper. I didn't test it. I don't have slang under Windows and I don't want to compile/install one (I have Watcom compiler and Slang seems to require VC). Besides, based on documents, the library is a bit too complicated to be actually practical. I think I'll just write my own library. Now I have to learn how to write my own modules and native libraries under Python... Sincerely, Matti From peter at verecomm.com Sat Apr 8 18:00:40 2000 From: peter at verecomm.com (Peter Kropf) Date: Sat, 08 Apr 2000 15:00:40 -0700 Subject: Python Language Support for ArcView GIS References: Message-ID: <38EFAC08.2A10932D@verecomm.com> Just an FYI: You might want to consider moving AVPython to sourceforge.net. The entire environment is designed for various levels of open source development... Bruce Dodson wrote: > > Python Language Support for ArcView GIS (aka AVPython) is now available > online as a free download. I promised this several months ago but never > managed to find a home for it (too busy) so finally I decided to just slap > together a page for it on GeoCities: > www.geocities.com/brucedodson.rm/avpython.htm > > If you're an ArcView developer and want to be able to control COM-enabled > programs like Excel or ArcInfo, or if you want to be able to interoperate > with distributed systems through standards like XML and HTTP, you might want > to give it a try. The same goes for Python programmers who happen to be > working with ArcView GIS (hey, there must be a few!), and want to be able to > apply their Python skills (and use a better language) when developing > ArcView applications. > > Python is free and open source. I hope AVPython will eventually be the > same, but we haven't yet settled on an acceptable open source license, so > for now the best I can do is provide a binary that is freely > redistributable. > > If you use AVPython on any interesting projects, or if you have any positive > feedback or things that you'd like to change, feed my hubris: tell me about > it! Just take nospam out of my address, or use the one listed in the > documentation. > > Sincerely, > Bruce Dodson -- Peter Kropf Codesmith VEReCOMM Corp. 2475 Augustine Drive, Suite 102 Santa Clara, CA 95054 408-919-3107; Fax 408-969-0688 peter at verecomm.com From phil at geog.ubc.ca Sat Apr 29 12:33:04 2000 From: phil at geog.ubc.ca (Phil Austin) Date: 29 Apr 2000 09:33:04 -0700 Subject: Looking for example of embedded Python References: <8ecpi4$j9q$1@nnrp1.deja.com> Message-ID: chris_barker at my-deja.com writes: > Hi, > > I'm trying to persuade my co-workers that it would be extememly usefull > to imbed Python in some of our apps. I'm looking for example > applications wioth Python embedded. Ideally something fairly small with > source code available. > In addition to Demo/embed/demo.c, a nice example that tests Numpy array classes using CXX-4.2 (http://CXX.sourceforge.net) has been written by Paul Dubois. It works for me using KCC under solaris and linux, and should also compile with g++ 2.95.2. (I got segfaults under linux until I remember that the correct linker sequence needed -Xlinker -export-dynamic, e.g: gcc -Xlinker -export-dynamic demo.o -L/home/phil/lib/pythonmain/linux/lib/python1.5/config \ -lpython1.5 -lieee -ldl -lm -o mydemo Here's the output, followed by the source: arraytest Array facility test [ 0. 0.5 1. 1.5 2. 2.5 3. 3.5 4. 4.5 5. 5.5] Rank is 1 Species is 7 dimension(1) = 12 Pointers 125188, 1200b8, 125188 A list: [9.0, 4.0, 1.0] toArray: [ 9. 4. 1.] list+list: [ 18. 8. 2.] add 2: [ 11. 6. 3.] list[1]: 4.0 sorted: [ 1. 4. 9.] /* Minimal main program -- everything is loaded from the library */ #include "Python.h" #include #include "CXX_Array.h" #include using namespace Py; extern "C" int Py_Main(int argc, char** argv); extern "C" void Py_Initialize(); extern "C" void Py_Finalize(); //extern "C" void PyImport_ImportModule(char *name); int main(int argc, char** argv) { PyObject *ptype; PyObject *pvalue; PyObject *ptrace; std::cout << "Array facility test" << std::endl; Py_Initialize(); import_array(); PyImport_ImportModule("Numeric"); try { Array t(12); for(int i=0; i < t.length(); ++i) t[i] = Float(i / 2.0); std::cout << t << std::endl; std::cout << "Rank is " << t.rank() << std::endl; std::cout << "Species is " << t.species() << std::endl; std::cout << "dimension(1) = " << t.dimension(1) << std::endl; std::cout << "Pointers " << t.ptr() << ", " << (void *) t.to_C() << ", " << t.as_contiguous().ptr() << std::endl; List w(3); w[0] = Float(9.0); w[1] = Float(4.0); w[2] = Float(1.0); Array from_list = toArray(w); std::cout << "A list: " << w << std::endl; std::cout << "toArray: " << from_list << std::endl; std::cout << from_list.type() << std::endl; //return Py_Main(argc, argv); std::cout << "list+list: " << from_list + from_list << std::endl; std::cout << "add 2: " << from_list + Int(2) << std::endl; std::cout << "list[1]: " << from_list[1] << std::endl; std::sort(from_list.begin(), from_list.end()); std::cout << "sorted: " << from_list << std::endl; } catch(Exception&) { std::cout << "Test failed via Exception" << std::endl; PyErr_Fetch (&ptype, &pvalue, &ptrace); FromAPI p(pvalue); Object v(p); std::cout << v << std::endl; } Py_Finalize(); return 0; } From jepler.lnk at lnk.ispi.net Sat Apr 22 22:31:20 2000 From: jepler.lnk at lnk.ispi.net (jepler epler) Date: Sun, 23 Apr 2000 02:31:20 GMT Subject: Pickling Robustly References: <8dpk1i$7de$1@newshost.accu.uu.nl> Message-ID: On 21 Apr 2000 14:06:28 -0500, Glyph Lefkowitz wrote: >Perhaps I should ask this question in a different way. How does >Pickle tell if an object is pickleable or not? Is there some >pickle.ispicklable method I could refer to? If you have control over the object hierarchy, why not use this 'unpicklable mixin' and convenience functions I just tossed together: import pickle, UserList class Unpicklable: def __getinitargs__(self): raise Unpicklable def ispicklable(a): """This tests if a can be pickled (by actually trying to do so)""" try: pickle.dumps(a) except Unpicklable: return 0 return 1 def ispicklableinstance(a): """Note that this function does not tell whether a ultimately contains an unpicklable instance. But at least it's a simple test."" return isinstance(a, Unpicklable) def ispicklableclass(A): """Note that this function does not tell whether an instance might ultimately be unpicklable due to something nested inside it.""" return issubclass(a, Unpicklable) if __name__=='__main__': class UserListU(UserList.UserList, Unpicklable): pass x = UserList.UserList([1,2,3]) print pickle.dumps(x) y = UserListU([1,2,3]) print pickle.dumps(y) # This will cause an exception Jeff From pete at visionart.com Tue Apr 25 21:50:44 2000 From: pete at visionart.com (Pete Shinners) Date: Tue, 25 Apr 2000 18:50:44 -0700 Subject: new linereading standard (ThanksAll!) References: <3904D21B.333DD930@visionart.com> <390510C9.A744D22E@yahoo.com> <26042000.2@sanctum.jae.ddns.org> Message-ID: <39064B74.287DD3DE@visionart.com> i've seen all manner of input on the linereading stuff. i'm still in the learning phase and it was great to see all the alternatives. i think i'll still be writing my own line reading class that handles much more special cases. (comments, continued line with backslash, stripping off newlines, empty lines, etc) if anyone cares i'll post my module when it's ready. as nifty as that 'map' is, i still find a for loop is most asthetically pleasing. -- _____Pete Shinners______ pete at visionart.com From tismer at tismer.com Tue Apr 4 06:42:52 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 04 Apr 2000 12:42:52 +0200 Subject: Stackless Python on O'Reilly.de Homepage Message-ID: <38E9C72C.E9CD8AB2@tismer.com> Hi all, For those who can read German a little. O'Reilly (German department) takes notice of the Python of the future :-)) *) and microthreads. http://www.oreilly.de/ ciao - chris *) at least the future of the computation [ahem] -- Christian Tismer :^) Applied Biometrics GmbH : 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 we're tired of banana software - shipped green, ripens at home From daniels at mindspring.com Sat Apr 22 21:17:17 2000 From: daniels at mindspring.com (Alan Daniels) Date: 23 Apr 2000 01:17:17 GMT Subject: code not true? References: <8ds3ku$q0l$1@nnrp1.deja.com> <3901aa0f.0@news.proweb.co.uk> Message-ID: On Sat, 22 Apr 2000 14:02:21 GMT, Mark Hammond wrote: [snip...] >Of all the solutions to this problem, this does strike me as one of >the best - simply remove equality testing al together for floating >point. Are you sure of this? It would be awful confusing for a programming newbie to do: x = 5.0 y = 5.0 # Later on down in the code. x == y # And even further... And get an exception thrown. All the "why doesn't this work?" messages we've seen about floating point have to do with doing manipulation of the numbers and *then* having them not work. For 0.07 * 100 to not be the same as 7.0 is understandable, because that's just how floating point works on CPUs today: Not all numbers are representable in IEEE format. But to outlaw asking if 7.0 is equal to 7.0 definitely goes against the principle of least suprise. And learning that floating-point math sometimes leads to slight numerical errors is an important lesson that newbie programmers shouldn't be shielded from. I like Python 1.6's handling of it better: Showing floating point values in all their slightly-inaccurate glory seems like the better plan. -- ============================================================ Alan Daniels daniels at mindspring.com From ppi at searchy.net Sun Apr 2 16:07:04 2000 From: ppi at searchy.net (Penpal International) Date: Sun, 02 Apr 2000 22:07:04 +0200 Subject: GTK Referenc Message-ID: <38E7A868.A1C9BD7C@searchy.net> I couldn't find anywhere a reference for the GTK module for Python. Does anyone know one? On gtk's site I could only find some for C(++). -- Penpal International http://ppi.searchy.net/ ppi at searchy.net From hanche at math.ntnu.no Fri Apr 7 23:26:11 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 07 Apr 2000 23:26:11 -0400 Subject: Why should I switch to Python? - Infinity of Primes References: <000601bf9f8e$bd31e780$ea2d153f@tim> <38EE5A40.4557F4EA@seas.upenn.edu> Message-ID: + dave white : | Since we're on the subject of primes... I've heard that there's a | nice probabilistic algorithm for computing large primes using | Fermat's Little Theorem. Python seems like it would be well suited | for this since bignums are built into the language. Does anyone | know this algorithm? You're thinking of using FLT for primality *testing*, not for *computing* primes. The algorithm is trivial to explain: Assume p is an integer, suspected to be a prime. Pick an integer a such that 2 <= a < p and compute a**(p-1) mod p. If you get 1, then p *may* be a prime, but again it may not. Repeat to gain more confidence. On the other hand, if you don't get 1, p is definitely not a prime. To find large probable primes using this algorithm, pick large odd numbers at random and subject them to the test until you find one that passes the test for sufficiently many different a to give you that warm fuzzy feeling that surely, this must be a prime. Unfortunately, there are some composite numbers that will always pass this test. These are called pseudoprimes. On the other hand, there are other probabilistic primality tests that don't have this weakness. Perhaps the best known is the Miller-Rabin test, which just like the FLT test is applied with numbers a between 2 and p, and which always succeeds when p is a prime. Moreover, the Miller-Rabin test has the pleasant property that it fails for at least 3/4 of the available values a when p is composite, so that, e.g., 20 successful iterations of the test gives you roughly a billion to one confidence in the primality of p. I'd post some code, but all I have is some five year old Scheme code, and that is probably not all that appropriate in this group. The comments to that old code has two literature references, though: ;;; Monier: Evaluation and comparison of two efficient ;;; probabilistic primality testing algorithms, ;;; Theoretical Computer Science 12 (1980) 97-108 ;;; A.O.L. Atkin and R.G. Larson: On a primality test of Soloway ;;; and Strassen, SIAM J. Comput. 11 (1984), 789-791 If you go surfing the web you'll probably find lots of implementations in every language known to man, however. And-for-dessert-there-is-primality-*proving*-using-elliptical-curves-ly y'rs, -- * Harald Hanche-Olsen - "There arises from a bad and unapt formation of words a wonderful obstruction to the mind." - Francis Bacon From chuck.meyers at lmco.com Tue Apr 4 12:42:55 2000 From: chuck.meyers at lmco.com (Chuck Meyers) Date: Tue, 04 Apr 2000 09:42:55 -0700 Subject: What is python's language level? Message-ID: <38EA1B8F.A797A130@lmco.com> Does anyone know python's language level? I did not find it in the list at: http://www.spr.com/library/0langtbl.htm I would guess that it would be somewhere between 15 and 30. This is an important point, even if language levels are imprecise they can make it easier to convince people to look at or try a language like python. -Thanx chuck.meyers at LMCO.COM From thomas.heller at ion-tof.com Mon Apr 17 15:11:46 2000 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Mon, 17 Apr 2000 21:11:46 +0200 Subject: [Announce] autoreload.py Message-ID: <001601bfa8a0$c6d86f50$4500a8c0@thomasnb> This is a module which automatically takes care of reloading source modules into the running python interpreter from a background thread when the source has changed. An additional benefit is that top-level classes from the reloaded modules are automatically updated to contain the new class dictionary. The net-effect is that you can run a program in pythonwin (tested) or IDLE (untested), change the instance methods, save the file and automatically the running program uses the new methods. Warning: This is only sighly tested, but it may be usefull. Enjoy! Thomas Heller -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: autoreload.py URL: From gmcm at hypernet.com Thu Apr 27 14:22:01 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 27 Apr 2000 14:22:01 -0400 Subject: Schwartzian Transform in Python? In-Reply-To: Message-ID: <1255262762-67501940@hypernet.com> Art Haas wrote: > > I'm looking for the Python way to do this ... > > opendir(DIR,".") || die "Can't open '.'! $!\n" > @sorted = > map { $_->[0] } > sort { $a->[1] <=> $b->[1] } > map { [ $_ , -M ]} readdir(DIR) > closedir(DIR); > print "Files sorted by date ...\n"; > foreach (@times) { > print "$_\n"; > } > > (Yes, its that other 'P' language). > > I'm getting lost in the map/sort/map part for python. My python > psuedo code looks like (don't laugh too much) > > import os > sorted = map(???,(map(os.stat???,listdir(".").sort()))) > print "Files sorted by date ..." > for file in sorted: > print file >>> import os, stat >>> l = map(lambda f: (os.stat(f)[stat.ST_MTIME], f), os.listdir('.')) >>> l.sort() >>> for (t,f) in l: ... print f Don't speak that other language, so I'm taking what you said you want at face value... - Gordon From gbreed at cix.compulink.co.uk Tue Apr 18 05:07:47 2000 From: gbreed at cix.compulink.co.uk (gbreed at cix.compulink.co.uk) Date: 18 Apr 2000 09:07:47 GMT Subject: Microsoft ActiveX Scripting References: <7TNK4.3520$1D.25703@news-server.bigpond.net.au> Message-ID: <8dh8l3$c2p$1@plutonium.compulink.co.uk> In article <7TNK4.3520$1D.25703 at news-server.bigpond.net.au>, mhammond at skippinet.com.au (Mark Hammond) wrote: > All you need to do then is say 'LANGUAGE="Python"' :-) You also need to run something like win32comext\axscript\client\pyscript.py, and note that it isn't quite where the docs say it is. From jstok at bluedog.apana.org.au Tue Apr 18 12:46:45 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Wed, 19 Apr 2000 02:46:45 +1000 Subject: Lists References: Message-ID: Jason Stokes wrote in message ... >for i in range(0...len(a)): I don't know what came over me (actually, I do, some work in Haskell earlier. Anyone else get language leak through?) for i in range(0, len(a)): > From dave.rose at wcom.com Tue Apr 25 17:19:30 2000 From: dave.rose at wcom.com (Dave Rose) Date: Tue, 25 Apr 2000 21:19:30 GMT Subject: Memory Problems on AIX 4.2 Message-ID: I am using a C function to perform some shared memory tasks and every time the C function is called PS is showing the 4K is being reserved from the free list and the executible image is increasing 4K as well. Has anyone else seen this type of memory leak with the AIX Shared object calls. Any help would be greatly appreciated. Been searching for the leak for a couple of weeks now and can not find it. If anyone is interested, I can include the code Thanks in advance Dave Rose From aahz at netcom.com Tue Apr 11 16:16:27 2000 From: aahz at netcom.com (Aahz Maruch) Date: 11 Apr 2000 20:16:27 GMT Subject: Thread-safe atomic operation References: <1256659126-41087547@hypernet.com> Message-ID: <8d016r$jbf$1@nntp9.atl.mindspring.net> In article <1256659126-41087547 at hypernet.com>, Gordon McMillan wrote: >Dong-gweon Oh writes: >> >> Are these statements thread-safe? >> 1. import xxx >> 2. xxx = __import__('xxx') >> 3. reload(xxx) >> 4. dict['xxx'] = sys.modules['xxx'] >> 5. dict.has_key('xxx') > >Numbers 2 and 4 could be interrupted between evaluation of >the RHS and assigment to LHS. For #2 that would be of >concern only if xxx was a global. Are you absolutely certain about item 1? That implies that Python as a whole could block on importing a module that did something like for i in range(100): sleep(1) -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac, and Ritalin? --Aahz From alwagner at tcac.net Tue Apr 18 08:48:44 2000 From: alwagner at tcac.net (Albert Wagner) Date: Tue, 18 Apr 2000 07:48:44 -0500 Subject: How to write to printer in Windows? Message-ID: <38FC59AC.4B71492A@tcac.net> How can I write(aLine) to a printer in Windows? I tried this: from win32pipe import popen : self.printer = popen('lpt1' 'w') : self.printer.write(aLine) but get a general protection fault. Any help will be greatly appreciated. -- Small is Beautiful From gmcm at hypernet.com Sat Apr 8 20:24:14 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 8 Apr 2000 20:24:14 -0400 Subject: Tuples -- who needs 'em In-Reply-To: <8cofcf$hns$1@newshost.accu.uu.nl> Message-ID: <1256882636-27643467@hypernet.com> Martijn Faassen wrote: [discussing the need for tuples with Bob Alexander] > Okay, but it's generally practiced in idiom. [snip] > ... I think it's more > than just the dictionary key argument. Very true. There are 2 technical arguments for tuples (dictionary keys and efficiency); both are weak. The main difference is idiomatic. [Bob] > > There have been cases where I used tuples, to find out > > later that I wanted mutability, so went back and changed. > > Hm, I rarely if ever seem to run into this. If I need mutability of > a set of heterogenous objects I tend to use a class. There may be a > switch from tuples to classes, but not often from tuples to lists, I > think. That's because you understand the idiom, Martijn. Lists are collections. The competing choice to a list is a dictionary. Tuples are toy structs; the competing choice is a class. Experience tells me that trying to use a list where a tuple is needed will yield either unsafe or safe but bloated code. No technical reason; it's just that lists (as collections) will eventually be mutated in a way that's natural for collections, but disastrous where the purpose is struct-like. > > This sort of thing > > happens in exploratory programming, so when in that mode one might want to > > use lists unless one is really sure in advance that tuples are the right > > thing. By all means, use lists whenever you're unsure. You'll soon come to recognize when a tuple is more appropriate. It won't take long (it couldn't, Martijn's too young to have taken long to learn anything ). - Gordon From fredrik at pythonware.com Tue Apr 4 04:52:39 2000 From: fredrik at pythonware.com (fredrik at pythonware.com) Date: Tue, 04 Apr 2000 08:52:39 GMT Subject: Loading image from URL with PIL References: <8cau6t$pph$1@nnrp1.deja.com> Message-ID: <8ccagj$a1m$1@nnrp1.deja.com> rgb122 at my-deja.com wrote: > Is it possible to load an image (GIF or JPEG) > straight from a URL without saving it to a file > first. I tried this: > > u = urllib.urlopen > ("http://localhost/cache/test.jpg") > data = u.read() > s = array.array("b", data).tostring() fp = urllib.urlopen(myurl) im = Image.open(fp) > Also, how can I convert a GIF to a JPEG using PIL? see the documentation for the 'save' method. to do the conversion in memory, save to a StringIO object, and make sure you pass a second argument to 'save'. Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Tue Apr 11 10:30:18 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 14:30:18 GMT Subject: Getting an overview if all available driveletters on NT References: <2B1262E83448D211AE4B00A0C9D61B03BA7294@MSGEURO1> Message-ID: <_FGI4.1194$Za1.20497@newsc.telia.net> Pieter Claerhout wrote: > is there a module in Python, which can list all available driveletters, together with > their label. I'm using Windows NT? I already thought of iterating over all possible > driveletters, and see if the path exists or not, but I also want to separate the > network volumes from the other volumes. Any ideas? just guessing here (don't have win32api on this box), but this might do the trick: type = win32api.GetDriveType("%s:\\" % drive) where drive is 'A' through 'Z'. From donn at u.washington.edu Fri Apr 28 13:56:39 2000 From: donn at u.washington.edu (Donn Cave) Date: 28 Apr 2000 17:56:39 GMT Subject: ?sys.argv values more literally? References: <3909B1AF.32FC8BED@email.sps.mot.com> Message-ID: <8ecjcn$19ui$1@nntp6.u.washington.edu> Quoth Norman Shelley : | I need to write a frontend program that will call one of two other | programs (both of which are NOT binaries but are tcl programs therefore | they HAVE to be invoke with os.system() or "/bin/sh" has to be the first | argument to a os.execv() call). | | THe frontend program must detect a "-ver someversionname" options and | remove the two words and then call the appropriate tcl program with the | EXACT arguments given on the command line (less those two words). | Problem is words in sys.argv | that were quoted on the command line look like words that were not | quoted on the command, e.g. | | %frontend -ver 1.0 word1 word2 "word three" "word(three)" | argv looks like | ["frontend", "-ver", "1.0", "word1", "word2", "word three", | "word(three)"] | | but this fails when os.system or os.execv is called (with frontend, | -ver, and 1.0 replaced with the tcl program full pathname (/bin/sh added | at front for execv) as "word three" and "word(three)" are missing there | protective quotes (the /bin/sh needs to see those as one word not two | words or a word with parens). | | I need argv to look like this: | ["frontend", "-ver", "1.0", "word1", "word2", '"word three"', | '"word(three)"'] | where words that were quoted on the command line are strings with | beginning and ending quotes in the argv. | | Any way to do this or get around this problem? As another followup has noted, it's OK to quote all of them. The python interpreter never gets the quotes you want, they're for the benefit of the shell that invokes python. However, I think it solves the problem the wrong way, and I'm not convinced the problem is real either. What happens if an original argument includes a quoted quote? This extra run through the shell interpreter is not healthful. When we call system() to execute a command, as you surmised we're executing /bin/sh, specifically in effect it's like this: execv('/bin/sh', ('sh', '-c', command_line)) This shell parses the command line, locates its argv0 file and in turn execs it. We don't need to know how that file is implemented, because the shell can run any command. Not because it has any magic powers, but because UNIX can run any well-formed executable file including scripts. Python can do the same as the shell, and if you can figure out how to get that working, you can exec your command directly and omit the re-quoting. I can't say why Tcl scripts might need to be executed by /bin/sh, so I can't be much help there. If they were really shell scripts, I'd say they might need an appropriate #! line, the line at the top of the script file that specifies its interpreter. E.e.g., #!/bin/sh or #!/usr/bin/env python or #!/bin/awk -f etc. In the absence of this line, the UNIX exec fails and the shell will usually try to execute the script itself. If you want to have a rule like that when you invoke programs, you can make the default whatever you want for your implementation - the shell, Tcl, etc. - but it's much better to fix the file so the UNIX exec will work as intended. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu PS. The HTML and V-card didn't help much. From loewis at informatik.hu-berlin.de Mon Apr 10 09:33:02 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 10 Apr 2000 15:33:02 +0200 Subject: Extending built-in language (Win 95) References: <213CDEBFDDA7D3118081009027E40C56071113@SHEF-MS1> Message-ID: Mark Pope writes: > I would like to extend the objects available in python, however It is not > appropriate to build normal extension dll's. Why is it not appropriate? It works perfectly well to add new types in an extension module. Many extensions do. > Appears to be a template for defining new built in objects which will be > compiled into the Python static lib. However there must be other steps to > making the new object reachable from python script. The new type becomes only available by means of creation of values. Look at the file type. Do you write f = file('foo.txt','w') ? No, you use open() instead, which just returns an instance of a file object. In the xxmodule, xx_new is used to make new instances, which can be called from Python as xx.new(). Hope this helps, Martin From dworkin at ccs.neu.edu Mon Apr 24 22:40:33 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 24 Apr 2000 22:40:33 -0400 Subject: The Simple Economics of Open Source In-Reply-To: Raffael Cavallaro's message of "Mon, 24 Apr 2000 03:57:00 GMT" References: Message-ID: Raffael Cavallaro writes: > Fact is, only commodity items, that are known to many programmers, are > open sourced. If there were sufficient demand to support a closed source > business, then it would have happened that way. The proof of this is the > BSDs, which would allow a closed source, proprietary fork at any time. > Hasn't happened 'cause there's no demand for such a product. You mean like BSD/OS, from BSDI? It happened 9 years ago, and they've been selling it ever since. Interesting "proof" you have there. -Justin From godzilla at netmeg.net Tue Apr 11 11:24:20 2000 From: godzilla at netmeg.net (Les Schaffer) Date: Tue, 11 Apr 2000 15:24:20 GMT Subject: issubclass funny business Message-ID: I have the following class hierarchy: ------ in module FileScanner ----- class StandardArrayFileScanner(ArrayFileScanner): --------- in module cie ---------- from FileScanner import StandardArrayFileScanner class CIE_Standards(StandardArrayFileScanner): ... class Photopic(CIE_Standards): ... class CIE(CIE_Standards): ... but when i need to test whther an object is an instance of a subclass of StandardArrayFileScanner: # make sure std is of the correct type if not issubclass(std.__class__, StandardArrayFileScanner): import cie print std.__class__, cie.CIE.__bases__ raise NotStandardArrayError but it doesnt work, even though std is of type cie.CIE : (gustav)~/Engineering/dspring/stoplite/matlab/Jue-Data/: python FileScanner.py cie.CIE (,) <=== result of print stmt huh?????? les schaffer From scottrharris at earthlink.net Wed Apr 12 20:59:23 2000 From: scottrharris at earthlink.net (Scott Harris) Date: Thu, 13 Apr 2000 00:59:23 GMT Subject: Python and VTK and TK Message-ID: <38F51AB1.29FB4C1D@earthlink.net> Has anyone gotten VTK to work with the TkRenderWidget? I've got a simple code that draws two buttons and a vtkTkRenderWidget in a frame. It works under win98, but crashes my XServer on Linux. I'm using RH6.1 with XFree864.0 and a Voodoo3 card (so I have accelerated GL rendering) I've got VTK 3.1 Anyhow, I'm going to try wxPython and it's VTK widget in the next few days. If you had to start a new moderately sized project would you use wxPython or Tk? -Scott Harris scottrharris at earthlink.net From johngrayson at home.com Sun Apr 9 18:25:31 2000 From: johngrayson at home.com (John Grayson) Date: Sun, 09 Apr 2000 22:25:31 GMT Subject: Migrating Tcl system to Python References: <095cc48a.7e9b36dd@usw-ex0108-063.remarq.com> Message-ID: <38F1035B.9A893FC3@home.com> Hamish, I converted several of the examples in the Widgets tour for Tk when I was writing Python and Tkinter Programming. I tried to keep the basic structure of the original scripts but I could see that there were more compact ways of getting the same effect in Python. I'm sure that the same would be true for pure Tcl scripts. John Grayson Hamish Lawson wrote: > > I'd be interested in anyone's experience of migrating a (several- > thousand line) system written in Tcl to Python. And since we'll > have to deploy new functionality while we're in the process of > migrating, I'd particularly like to hear of experiences with > having Tcl code using Python code (and vice versa). I'm > considering XML-RPC/SOAP as a possible way to do that, but what > other approaches might there be? > > Hamish Lawson > > * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * > The fastest and easiest way to search and participate in Usenet - Free! From gmcm at hypernet.com Thu Apr 27 11:42:16 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 27 Apr 2000 11:42:16 -0400 Subject: The Simple Economics of Open Source In-Reply-To: Message-ID: <1255272357-66924550@hypernet.com> Raffael Cavallaro wrote: > In article , Justin > Sheehy wrote: > > >You mean like BSD/OS, from BSDI? > > > >It happened 9 years ago, and they've been selling it ever since. > > Yeah, and BSDI is just tearing up the software world. BSDI sells > *support* not software, because the software they sell is > essentially interchangable with the free BSD variants. BSDI have > *themselves* recognized this fact by merging with Walnut Creek. > In future, they'll be merging the code of FreeBSD and BSD/OS. I guess you missed ESR's talk at IPC7. Software company sells package for $500, street price is $400. Software company goes broke. What's the street price now? If software were a product, it would be, say $300. But the street price is $50. Software *is* a service, the price is a reflection of expected future support. Other counter-examples: you can pay thousands for your web server, or get it for free. You can pay hundreds for your office suite, or get it for free. You can pay hundreds to thousands for your compiler or get it for free. (You're stuck with Python - that only comes for free). Even where the closed source package has technical advantages, it does not support the price differential. Closed source protecting an original piece of intellectual property is actually quite rare (and where it exists, it's quite short-lived). Normally it "protects" an investment of money and effort. And actually it reflects what consumers are willing to pay for utility and (quite probably deluded notions of) future support, upgrades and porting. The closed source world is based on a diseased model (pretending software is a product). The open source world is currently in large part shaped by being a reaction to the closed source model. Thus, it too is deformed. One of those open source delusions is that being open source somehow makes a difference to the end consumer. Bunk. End users don't read code, and never will. Opening the source benefits other developers, who in turn will almost certainly benefit you by making the code better, or integrating with other software - thus indirectly benefitting users. Consumers benefit directly because the "product" price is based on the marginal costs of production (near $0), and support costs are based on reality. Back to your art world analogy - how much would still be true if you considered only the sub-market of unlimited production prints with trivial reproduction costs? Scarcity of an intellectual secret may make a software package containing that secret more valuable, but scarcity of a software package is likely to make it less valuable (since support will be hard to find, and upgrades unlikely). OTOH it's scarcity of a piece of artwork that makes it valuable. - Gordon From eviltofu at rocketmail.com Thu Apr 27 20:52:54 2000 From: eviltofu at rocketmail.com (Jerome Chan) Date: Fri, 28 Apr 2000 00:52:54 GMT Subject: Python does not let me format time. References: <8eakhq$797$1@nnrp1.deja.com> Message-ID: In article <8eakhq$797$1 at nnrp1.deja.com>, Sindh wrote: > Hi folks > > I have a file full of date, value pairs. Date is like MM/DD/YY. My > problem is I want to format this file since it contains a few thousand > lines of data , using python. I tried using string and time modules. I > want to format the time value to a float which is returned by > time.gmtime normally. I tried to split it and to use parts of it to make > a tuple and to use time.mktime but it says illegal operation for > builtin. > > Summary: > > data is: > 03/11/98 abcd > 03/12/98 efgh > > I split it to > x=string.split(n[0],' ') > which gave me x='03/11/98' > Now I split it again by > x=string.split(x,'/') > which gave a tuple of '03','11','98' > Now I tried to make time as > time.mktime(x[2],x[0],x[1],'','','','','','') use 0,0,0,0,0,0 for the rest of the tuple > The problem is it says illegal operation for builtin. I tried to use the > string val and int val as the arguments for mktime. > > Anyone with any helpful ideas!! > > If there is already a moduls to do the same , much helpful. > > Thanks > sreekant > > -- > A man needs to sleep for 36 hours a day atleast. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From chafik at nevrax.com Mon Apr 3 12:56:59 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Mon, 3 Apr 2000 18:56:59 +0200 Subject: Mail List Message-ID: <000a01bf9d8d$a05c0d00$1001a8c0@nevrax.net> Please, detach me from the mail list. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrer at stud.cs.uit.no Sun Apr 2 19:05:14 2000 From: andrer at stud.cs.uit.no (=?iso-8859-1?Q?Andr=E9?= Larsen Risnes) Date: Mon, 03 Apr 2000 01:05:14 +0200 Subject: Advice requested: GUI project beginning References: Message-ID: <38E7D22A.C81EA4@stud.cs.uit.no> > What is Squeak? > http://www.squeak.org/ "Squeak is an open, highly-portable Smalltalk-80 implementation whose virtual machine is written entirely in Smalltalk, ..." -- Andr? Larsen Risnes From scarblac-spamtrap at pino.selwerd.nl Mon Apr 10 18:54:58 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 10 Apr 2000 22:54:58 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> <8cfa75$fho$1@newshost.accu.uu.nl> <38ED4292.2EE8D3CA@cosc.canterbury.ac.nz> <38ED8EF2.B0835BE1@acm.org> Message-ID: Glenn Andreas wrote in comp.lang.python: > At the very least, this visually is jarring and you need to mentally > "reparse" when you get to the second ">". Another alternative is to > switch to multi-character brackets, perhaps: > > x = (* a, b *) > > or: > > x = <| a, b |> > > With two characters, there could be hundreds of possible "bracket" > pairs. Unfortunately, that makes your code look like it has been > infested with "smileys". I seem to remember that some other languages > using them though (besides old Pascal style comments, that is). LPC uses ({ "spam": "eggs" }) for dictionaries (called "mappings" in that world). I like that. But that gives problems with the current syntax, of course. -- Remco Gerlich, scarblac at pino.selwerd.nl Murphy's Rules, "Seat belt? What seat belt?": In Avalon Hill's Speed Circuit, a car which rear-ends another may spin out and crash, but the rammed vehicle is unaffected. From mwh21 at cam.ac.uk Fri Apr 28 09:02:45 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Apr 2000 14:02:45 +0100 Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> <8e4akc$p7o$1@newshost.accu.uu.nl> <3908E6EC.B9E6B2E8@cosc.canterbury.ac.nz> Message-ID: Greg Ewing writes: > Bernhard Herzog wrote: > > > > It would be a good idea IMO to find a > > good syntax for this case and ISTM that list comprehensions might be > > useful here: > > > > multi_list = [[] for i in range(10)] > > > > or whatever the precise syntax was. Hmm, the unused variable in there is > > a bit ugly though. > > Maybe the LC syntax should include something like > > [[] times 10] But wouldn't that make "times" a keyword? Not sure I'd want that... Cheers, M. -- If i don't understand lisp, it would be wise to not bray about how lisp is stupid or otherwise criticize, because my stupidity would be archived and open for all in the know to see. -- Xah, comp.lang.lisp From rnog2438 at mail.usyd.edu.au Sun Apr 16 11:13:35 2000 From: rnog2438 at mail.usyd.edu.au (Ricardo Nogueira) Date: Mon, 17 Apr 2000 01:13:35 +1000 Subject: Event triggering and weak references Message-ID: <8dbif3$hm0$1@metro.ucc.usyd.edu.au> First thanks for this beautiful language : ) I am Smalltalk addicted : ) and this means that I can't do with any other language, ex. C, C++, Java, : ( This was true until I found Python 2 weeks ago at Sydney Uni. I loved its modularity, pluggin behaviour and freedom. But I am missing Smalltalk event handling... Smalltalk (like Python) support the call-Back mechanism, but there is a more powerful inter-object interest registering that I haven't found in Python (so far). This is what I would like to do: Imagine I could have two or more Widgets open displaying a car speed value, say a numerical and a graphic display, if this car speed changes (ex. some one pushes the break), I would like to have any open widget on this value updated (on opening each window would register interest with this car speed). Smalltalk implements this with: The widget would register interest in one aspect of the car (on opening over aCar): aCar when:#speedChanged send: #updateSpeedDisplay to: self And the car would just notify who is interested, if any (when its speed changes): self trigger: #speedChanged But if any of this windows is not referenced anymore or crashes I would like the garbage collector clear it (the car would not be notified and his pointer to the window shouldn't keep the garbage collector form freeing the window memory). Again, Smalltalk implements this with weak references, that doesn't count for the garbage collector. Is there support for this in Python? Any suggestions? From mmiller3 at iupui.edu Thu Apr 6 18:03:46 2000 From: mmiller3 at iupui.edu (Michael A. Miller) Date: 06 Apr 2000 17:03:46 -0500 Subject: Beginning to be disapointed References: Message-ID: <87snwydgzh.fsf@lumen.med.iupui.edu> >>>>> "Johann" == Johann Hibschman writes: > [Yes, I know. I'm fouling up the reference chain. But > there's weirdness afoot, and I can't do any better.] > Hugues Demers writes: >>> 2. how are you reading them in? >> I use a module written by M. Miller called TableIO to read >> my data because it's fast. It read text file into Numeric >> array > Aha. > This might be it. IIRC, some of the innards of the > reference counting changed at some point in the NumPy > distribution. If you're using a different version of NumPy > than TableIO was designed for, there might be a memory > allocation problem. The innards of _tableio doesn't use NumPy at all. All it does is tokenize a file, run atof on it and return a list. The list is stuffed into a dictionary and there certainly could be some weirdness in my reference counting there, but I've never experienced the sort of problem that Demers reports. NumPy is used in a python wrapper to convert the list to an array. Maybe Hugues Demers would post the offending code for us to look at? Regards, Mike -- Michael A. Miller mmiller3 at iupui.edu Krannert Institute of Cardiology, IU School of Medicine From mwh21 at cam.ac.uk Fri Apr 14 10:17:35 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Apr 2000 15:17:35 +0100 Subject: starship.python.net References: Message-ID: Michal Bozon writes: > > What the hell is with the starship.python.net server? Today and yesterday > > I cannont connect (from Czech Republic). > > Someone knows? > > > > Michal Bozon > > > > Just after I posted this message I tried connection again, and it is OK. Really? Still seems to be wedged from here. I can ping it, but can't get it to play on any other port. Cheers, M. -- incidentally, asking why things are "left out of the language" is a good sign that the asker is fairly clueless. -- Erik Naggum, comp.lang.lisp From rcunning at acm.org Wed Apr 12 11:45:13 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Wed, 12 Apr 2000 15:45:13 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d1inu$nsq$1@newshost.accu.uu.nl> Message-ID: <38F4996F.E3BD2626@acm.org> Martijn Faassen wrote: > tom__98 at my-deja.com wrote: > > -- How can I browse the Python documentation without firing > > up a web browser? > > A text mode web browser can be useful for this. I've found w3m on > Linux to be very nice. I can just do: > > w3m file:///usr/doc/python-docs-1.5.2/html/lib/modindex.html > > And the documentation page is there instantly. The text-mode browser named "links" (look for it on Freshmeat) is also very fast, and supports (IMHO) a more complete HTML renderer. -BobC From hgg9140 at seanet.com Fri Apr 14 00:45:05 2000 From: hgg9140 at seanet.com (Harry George) Date: 13 Apr 2000 21:45:05 -0700 Subject: Ann: pdx, cgipm, pyperl now use distutils Message-ID: Also, mkpythonproj generates the basic setup.py See: http://www.seanet.com/~hgg9140/comp/index.html -- Harry George hgg9140 at seanet.com From shogan at iel.ie Tue Apr 25 08:56:44 2000 From: shogan at iel.ie (Shaun) Date: Tue, 25 Apr 2000 13:56:44 +0100 Subject: what does XDR stand for? and what is it? Message-ID: <002101bfaeb5$b57f5dc0$2801000a@iel.ie> im here looking and trying to figure out the xdrlib module, it says here - http://www.python.org/doc/current/lib/module-xdrlib.html "The xdrlib module defines two classes, one for packing variables into XDR representation, and another for unpacking from XDR representation. There are also two exception classes." my question is what is XDR? what does it stand for? thanks Shaun ===================== Shaun Hogan Interactive Enterprise Ltd. alt. E-mail : shaun_hogan at yahoo.com +353 86 8342529 From ivanlan at callware.com Wed Apr 5 13:11:18 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 05 Apr 2000 11:11:18 -0600 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> Message-ID: <38EB73B6.6C0913A7@callware.com> Hi All-- Bernhard Reiter wrote: > [snip] > And all in 24 hours? > This is as misleading as the dummy attribute. > I don't think so. You can go at your own speed. The book is broken up into 24 chapters, each taking more or less than an hour to read. If you pay attention and apply yourself, you could, I think, arrive at some degree of understanding in the overall 24-hour time frame--give or take a few hours. I don't think you could do this with Perl, unless you already had a programming language or two under your belt, or at least were already familiar with many of the Unix tools it's based upon. But Python is clear, elegant, easy-to-read and understand, and there are very, very few gotchas and surprises. And I'm assuming, as you yourself said in a separate post, "people who do Python are no dummies." I picked up the basics of Python in perhaps four hours. That's a tribute to the language, not me. Given an interested, attentive newbie, I think it's entirely possible to teach programming and expose the newbie to some of the finer things in life in 24 hours or so--with Python. > Ranting-about-dummy-booktitles-ly-yours, > -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From brockn at deskmedia.com Mon Apr 10 15:30:47 2000 From: brockn at deskmedia.com (Brock Noland) Date: Mon, 10 Apr 2000 14:30:47 -0500 Subject: Jpython?? Message-ID: <955394930.758181@newdm.deskmedia.com> Hello I am a web developer.. Well part time. I can 'program' in HTML and am interested in learning Java but I was told that I should learn Python first because it is a fairly newbie friendly language. To the point I saw a post about Jpython yesterday what is it?? I am completely in the dark can someone enlighten me?? Thanks Brock From tismer at tismer.com Fri Apr 21 15:20:08 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 21 Apr 2000 21:20:08 +0200 Subject: docstrings References: <00bufsonasp7bgkf86lfb6sv5np5v8mqlj@4ax.com> <8dnasp$iep$1@news.wrc.xerox.com> <6v61gs8b1op8esg3o7hf0hii97jlvma01r@4ax.com> Message-ID: <3900A9E8.3D16413F@tismer.com> Ben Wolfson wrote: > > On 20 Apr 2000 16:22:49 GMT, mjackson at wc.eso.mc.xerox.com (Mark > Jackson) wrote: > > >Ben Wolfson writes: > >> is there a way to use %c and %s within a docstring, or to add strings > >> together in a docstring, so that if some strings are used in all > >> docstrings, but might be changed, I can simply change one or two > >> variables? > > > >This might do what you want, although it's ugly (in the sense that it > >serves the code-documentation - as opposed to user-documentation - > >function less well): > > > > cat > spam.py > > """I am a docstring""" > > > > sharedoc = """ and I am a widely-reused docstring clause""" > > > > __doc__ = __doc__ + sharedoc > > > > del sharedoc > > ^D > > yngvi> python > > Python 1.5.2 (#7, May 6 1999, 14:39:45) [GCC 2.8.1] on sunos5 > > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > > >>> import spam > > >>> print spam.__doc__ > > I am a docstring and I am a widely-reused docstring clause > > >>> > > This approach doesn't work for function docstrings, unless I tried it > wrong. You cannot do this inside the function. But the __doc__ attribute is writable, so in your module you can do something like this sharedoc = """ (imported from module %s)""" % __name__ def somefunc(): """I am the useless function somefunc""" pass somefunc.__doc__ = somefunc.__doc__ + sharedoc ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 rupole at compaq.net Thu Apr 13 17:45:00 2000 From: rupole at compaq.net (Roger Upole) Date: Thu, 13 Apr 2000 21:45:00 GMT Subject: windows registry References: Message-ID: Use the win32 extensions, win32api.Reg... Roger Upole "A[r]TA" wrote in message news:era0iGYp$GA.273 at net003s... > Heyz.. > > How do I edit the windows registry with Python? > > Thnx, A[r]TA > > > -- > We shall not cease from exploration, and the end of all our exploring will > be to arrive where we started and know the place for the first time. > - T. S. Eliot > > > From richard_chamberlain at ntlworld.com Sun Apr 30 15:37:34 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Sun, 30 Apr 2000 20:37:34 +0100 Subject: xitami configuration? References: Message-ID: Steven, I don't really do anything to set Xitami up but just drop: #!c:\progra~1\python\python on to the top of my script. Richard Steven wrote in message news:wPZO4.13426$r6.69041 at stones... > I'm just starting out with python after programming php3 for the past 8 > months and i'm trying to set it up with xitami. > > could an xitami/python user please tell me what line to add to my filters > section in the setup file? I tried: > > .py=D:\progra~2\python\python.exe > > which will envoke python and run a simple script fine, but won't pass any > arguments (unless i'm doing it wrong). If this is correct, how do i pass > arguments to a script? > > From ivanlan at callware.com Fri Apr 21 22:17:57 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 21 Apr 2000 20:17:57 -0600 Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) References: <1255771354-36910521@hypernet.com> <8dqp6u$plm$1@newshost.accu.uu.nl> Message-ID: <39010BD5.3360C362@callware.com> Hola, Listeros-- Martijn Faassen wrote: > [snip] > Gordon McMillan stood in the desert, looking sadly at the remains of Guido's > time machine. > [more rabid snippery] > Decades passed while Gordon and the timbot did their work. The timbot sent > off some surreptitious messages to various people. John McCarthy got a > few hints on recursion. Bill Gates was funded by an anonymous investor. > (so, they needed the money! what?!) Larry Wall received a pamphlet > on postmodern linguistic analysis. And one christmas, Guido van Rossum > received a thick envelope containing the complete plans for a working time > machine. > > Do-you-have-to-kill-me-now?-ly yours, > > Martijn > *Only* if you give away the story of where the Mayans got their X terminals! -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From jmassung at magpiesystems.com Mon Apr 17 16:50:19 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Mon, 17 Apr 2000 14:50:19 -0600 Subject: else clauses in while and for loops References: <38DD2EE3.C7F3CB54@webamused.com> <8boe2k$gmh$1@inputplus.demon.co.uk> <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> Message-ID: <2JKK4.325$vr2.19414@news.uswest.net> I'm new to Python, so perhaps I'm miss reading something in these posts, but it appears as though the "else" statement (especially in while loops - unless infinite) always get executed regardless. i = 0 while i<=5: i = i + 1 print i else: print 10 should spit out "1 2 3 4 5 10" right? Now a use that I could definitely see for the "else" would be if the loop were never entered at all! Example: i = 6 while i<=5: i = i+1 print i else: print 10 would print "10", and if 'i' started at 0, would print "1 2 3 4 5". That could definitely be useful, because it would eliminate an "if" statement right before the "while" statement. Extremely useful for debugging purposes. Jeff Chuck Esterbrook wrote in message <38F79B93.B03F0A6B at mindspring.com>... >So did anyone present, in this thread, an example that shows a real need? From amphgobb at bjord.org Sat Apr 22 00:44:43 2000 From: amphgobb at bjord.org (amphgobb) Date: Sat, 22 Apr 2000 04:44:43 GMT Subject: Using python on the web References: <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> Message-ID: >We were wrong. >than CGI-based alternatives), let alone compete with CGI's >portability, ... >I recognize no one here is disputing the proposition. It's >just struck me recently how pervasive the propaganda on this >score is. CGI has an *abyssmal* popular reputation. There is a reason for that and I question whether the CGI naysayers were ever wrong. The arrival of mod_perl and mod_php provide two distinct development platforms which do not need to fork a new process for each instance of the script execution. I am not aware of many sysadmins who allow universal CGI access without mod_perl, and a cgi-wrapper. For my money, I will stick with these 'next-generation' web technologies. From embed at geocities.com Thu Apr 13 11:02:57 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 13 Apr 2000 11:02:57 -0400 Subject: How to Copy a Dictionary from a C Extension? Message-ID: I am embedding Python. I need to make a copy of the Globals dictionary when I start a new session in my embedded system, then delete it, and recreate it, so I can "drop" any changes to the globals after a remote session is completed. Problem: If you want to copy the existing Globals used by the interpreter, what is the way to do this? I found pydict_copy in dictobject.c, but it's static, so I can't invoke it directly. Warren From grisha at ispol.com Thu Apr 27 08:48:12 2000 From: grisha at ispol.com (Gregory Trubetskoy) Date: Thu, 27 Apr 2000 08:48:12 -0400 Subject: PyApache memory leak? In-Reply-To: References: Message-ID: On Fri, 21 Apr 2000, Oleg Broytmann wrote: > This don't help saving memory. Other way round - PyApache destroys > subinterpreter after processing a request, thus saving memory; but httpdapy > keeps the interpreter with all (unneccessary and superfluos) imported > modules, thus leaking memory. I wouldn't call this "leaking". "Leaking" means forgetting to free memory where you should be freeing it (like overlooking a Py_DECREF), loosing a pointer to memory, etc. To the best of my knowledge, httpdapy 1.7b does not leak memory. I've done a lot of work to make sure of this. Another note to consider - I am not 100% sure that Py_EndInterpreter() actually frees all memory. In fact I'm almost sure it doesn't, and you still need to watch your reference counts if you create object via the C-API. If that is the case, then PyApache has a higher likelyhood of actually leaking memory. BTW, if I remember it correctly, the decision by Lele (the author of PyApache) to recreate the interpreter was based not on memory usage, but because the CGI wouldn't work as expected otherwise and for security reasons. Grisha From mhammond at skippinet.com.au Mon Apr 3 19:37:07 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 03 Apr 2000 23:37:07 GMT Subject: Visual Interdev & Python References: Message-ID: "Arnaldo Riquelme" wrote in message news:sehlnm24eop139 at corp.supernews.com... > Is there any way to integrate Visual Interdev with python. Visual Interdev > seems to be a very popular tool > for ASPs and I think it could be a great way to attract Windows Developers > (VB) to use python. Sure - it should all work. Interdev has no specific knowledge about .py files, but that is OK. You can use Python's active scripting, including debugging it, using interdev. Install the latest win32all, and look for the Active Scripting documentation... Mark. From jmassung at magpiesystems.com Wed Apr 19 11:04:56 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Wed, 19 Apr 2000 09:04:56 -0600 Subject: Mac Python Questions Message-ID: Okay, I've been looking all over the net and the documentation that came with the MacPython distribution, but can't seem to find the answers to these questions. Hopefully someone else out there on a Mac can help me out? a) There is a file In $(PYTHON):Mac:Contrib:... called PyColorEdit.py. Good color editor. I would like to use that instead of PyEdit.py. Is there a way to install the color one? b) No matter what I do, I can't get Tkinter to work :(. Lately I'm led to believe that the Mac version of Python doesn't use it, but uses the Mac stuff instead. Is this the case? If not, how can I get Tkinter to work? Whenever I run something that imports it, it dies on the line with the comment "If this dies your computer might not be set up for tkinter". How can I set up my machine for it? Thanks :) c) Back to PyColorEdit.py: when I run it in Python IDE, it works perfect. But if I use BuildApplication it dies during compile with errors in macmodulefind.py. My question is just why this would happen? And it seems to happen on other files I've tried to compile, too. Thanks, everyone - you've been great! Good NG. Jeff From urner at alumni.princeton.edu Sun Apr 2 14:10:44 2000 From: urner at alumni.princeton.edu (Kirby Urner) Date: Sun, 02 Apr 2000 11:10:44 -0700 Subject: Learning in Stereo: Math + Python Message-ID: Re: "Learning in Stereo" by K. Urner (April 2, 2000) VHLLs (very high level languages) are human-readable -- not just computer-readable. VHLL programs = notations suitable for expressing high precision ops -- such as we find in math books. Yes, of course, we still need to learn the time-honored symbols, like SIGMA (<- capital greek letter goes here), accepted internationally and accessible to all with the proper training (and the right typesetting equipment) But why not "hit two targets with one throw" and learn a VHLL in tandem? Everyone should know some computer language or other, n'est pas? By learning a VHLL in tandem with math, you'll be able to translate back and forth between math symbols and a computer language -- using each to interpret the other (call it "learning in stereo"). Enter Python, a VHLL eminently suitable to this task: >>> def sigma(n,func): sum = 0 for i in range(1,n+1): sum = sum + func(i) return sum >>> def f(x): return 1.0/(x*x) >>> def pi(n): return (6 * sigma(n,f))**0.5 >>> pi(100) 3.04936163598 >>> pi(10000) 3.14149716395 Yes, we're converging to PI ( = 3.14159...) albiet very slowly. In other words (in more conventional math notation): PI^2 ---- = 1 + 1/4 + 1/9 + 1/25 + 1/36 ... 6 = SIGMA [ 1/i^2] i = 1 i.e. PI = [ 6 * SIGMA [1/i^2] ]^(1/2) i = 1 At my Oregon Curriculum network website, you'll find a 4-part essay entitled 'Numeracy + Computer Literacy' series. This will give you a clear idea of my approach. See: http://www.inetarena.com/~pdx4d/ocn/cp4e.html Is this a new idea? Not really -- people have used BASIC for the same purpose. But Python has a more up to date design, is the "new BASIC" for people just starting out today. Your kids get to start with something better than you had as a kid. Of course what you learn from Python you can adapt to other languages, such as Java, C/C++ and Perl. In the mean time, why not teach and/or learn object oriented programming and spatial geometry at the same time? The math might come in handy as well. This what we're cooking up at the Oregon Curriculum network website. Come on by and give us a try! Kirby Curriculum writer From aahz at netcom.com Mon Apr 10 00:52:58 2000 From: aahz at netcom.com (Aahz Maruch) Date: 10 Apr 2000 04:52:58 GMT Subject: Paid to work in Python? (was: Re: Choice Of Language) References: <8c7tt5$7dl$1@slb3.atl.mindspring.net> <38EBD8C0.86FD484D@pacbell.net> Message-ID: <8crmna$hj6$1@slb2.atl.mindspring.net> In article <38EBD8C0.86FD484D at pacbell.net>, Michael Naumann wrote: >Aahz Maruch wrote: >> In article , >> David Ascher wrote: >>>Grant Edwards >>>> >>>> Pointless tanget: Is it just me, or is Google really the last usable >>>> search engine? >>> >>>And it's _all_ due to their use of Python! Cool, eh? =) >> >> That doesn't explain why Infoseek is no longer particularly usable. > >Hmmmmm... It's actually a breeze to work with -- I have no idea >what problems you may be having... I find that the Infoseek web site (now reborn as infoseek.go.com) just doesn't return useful results the way it used to. For a while, when Google was in its infancy and hadn't indexed much of the web, I'd use Infoseek first and then switch to Google if I didn't get useful results out of Infoseek. As time passed, I reached the point where only half of my Infoseek searches returned useful results and I dropped Infoseek like a hot rock. -- --- Aahz (Copyright 2000 by aahz at netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac, and Ritalin? --Aahz From Wolfgang.Strobl at gmd.de Tue Apr 4 10:02:15 2000 From: Wolfgang.Strobl at gmd.de (Wolfgang Strobl) Date: Tue, 04 Apr 2000 16:02:15 +0200 Subject: win32all-130 for Python 1.6 available References: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au> Message-ID: "Mark Hammond" wrote: >Please let me know of any problems... Its a minor problem, and not related to Python 1.6, but anyway. While using the debugger, I've managed to move the floating breakpoint list window to a position where the title bar is outside (above) the desktop. Now these detachable windows can be moved by dragging them by their title bar, only, so I'm stuck. I've found the registry entry in question (or so I thougth), and fiddled with Software\Python 1.6\Python for Win32\ToolbarDebugging-Bar7, but in vain. I'm using Win2000 prof./US btw. -- o ( Wolfgang.Strobl at gmd.de (+49 2241) 14-2394 /\ * GMD Forschungszentrum Informationstechnik GmbH _`\ `_<=== Schloss Birlinghoven, | #include __(_)/_(_)___.-._ D-53754 Sankt Augustin, Germany | From echuck at mindspring.com Sat Apr 8 22:00:58 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Sat, 08 Apr 2000 22:00:58 -0400 Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> <8cocgb$iuk$1@pegasus.csx.cam.ac.uk> <8cokt5$opj$1@slb1.atl.mindspring.net> Message-ID: <38EFE45A.2E866C58@mindspring.com> Andrew Dalke wrote: > Me: > >>How about > >> x = getattr(a, "weeble", 0) + getattr(b, "wombat", 0) > > Nick Maclaren: > >Thank you, yes, that does deal with that specific example. But > >it does not extend to the general case. > > Ahh, I thought the general case was "test if something exists > and, if so, get data from it, otherwise use a given value." > > What is the general case you are interested in - that of C's > ternary ?: operator? I've rarely missed it, because most of > the subcases are handled by things like getattr. > > Andrew > dalke at acm.org I miss ?: and in fact, find myself writing extra if-else statements because of it. I think ?: is a pretty natural construct. Maybe Python 3K.... -Chuck From phd at phd.russ.ru Tue Apr 25 04:15:07 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 25 Apr 2000 08:15:07 +0000 (GMT) Subject: Trouble compiling PyGreSQL 2.4 on Linux In-Reply-To: <7ldngy6z.fsf@jumbo.skott.dk> Message-ID: On Mon, 24 Apr 2000, Martin Sk?tt wrote: > > Better, learn to write Distutil, and write one for PyGreSQL - that's a > > Real Challenge! > > I have allready thought about it and that seems a lot smarter, but > that should propably be left over to the more experienced Python installers. Today I saw Distutils-based solution in PyGreSQL mail list! Check it and report results. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From webmaster at nxinteractive.com Thu Apr 20 14:44:22 2000 From: webmaster at nxinteractive.com (webmaster at nxinteractive.com) Date: 20 Apr 2000 18:44:22 GMT Subject: Investing Message-ID: <38ff5006.0@news.cyberway.com.sg> Affiliate and associate programs have quietly swept Internet marketing. Discover how to set up you online sales channel now. http://www.nxinteractive.com/ActiveMarketPlace.htm You're about to discover some of the best insider tactics, techniques and strategies for building and promoting a high-income business on the Internet... http://www.nxinteractive.com/AISMedia1.htm Discover the pros' proven, "insider" strategies that reveal how you can quickly build your own high-income Internet business that you can operate in your spare time from any computer in the world. http://www.nxinteractive.com/AISMedia2.htm If you're interested in complete IPO information, you've come to the right place! With 3,846 IPO filings and 1,582 underwriters we have the most comprehensive database on the web. Utilize the free Alert-My-IPO! feature to keep track of up to twenty (20) IPOs from a single web page. http://www.nxinteractive.com/Alert-IPO.htm Why having your own associate program can explode your traffic and sales... One of the hottest ways of promoting your business online. Because you don't spend any money UNTIL you make money... the best way to do business. http://www.nxinteractive.com/AssocTRAC.htm Business For You-A fully diversified direct marketing company specializing in a wide range of products and services to enable individuals to start their Own Business. With this wide array to choose from, BusinessForYou.com is the ultimate opportunity for the beginning entrepreneur. http://www.nxinteractive.com/Business4U.htm Clicksure is the world's most comprehensive and reliable quality e-commerce certification program. We rigorously verify online merchants against the Quality Standard for Electronic Commerce before awarding our Quality Seal. http://www.nxinteractive.com/ClickSure.htm CreditNow is an industry leader in providing online consumer credit services. There are over 45 million people in the USA who have imperfect credit. These people are very receptive, and motivated to receive our services. http://www.nxinteractive.com/CreditNow.htm QuoteXpress - track the stocks you want to follow... alerting you with real-time information; SplitXpress - real-time notification of breaking market news; RelayXpress - financial markets, news, weather and lifestyle information; CompanyNewsX - alerts you of breaking news about the companies you want to track or invest in. http://www.nxinteractive.com/Datalink.htm The dot com directory is a revolutionary service that enables users to stop 'searching' and start finding business sites and data on the Web. In addition, it provides the latest stock information, revenue statistics, news reports... http://www.nxinteractive.com/DotCom.htm Exchange-it is a free banner exchange program enabling you to promote your service or product by advertising across a network of web sites. http://www.nxinteractive.com/ExchangeIt.htm Marketing Tips strategies for internet marketing, online advertising & website promotion increase profits for small offices & home based businesses. Entrepreneurs or home offices access free information & marketing tips to promote products & increase profits. http://www.nxinteractive.com/IMC.htm "How You Can Successfully Market Anything on the Internet With No Previous Experience and a $150 Budget" A step-by-step guide to building a profitable Internet business using free and low cost marketing concepts anyone can do from home in their spare time. http://www.nxinteractive.com/InternetMarketing.htm LendingTree is the online loan center that quickly connects you to a network of lenders who compete for your business. Find a mortgage, home equity loan, credit card, personal loan, auto loan or debt consolidation loan NOW. http://www.nxinteractive.com/LendingTree.htm MoneyCentral is the best source for all your personal finance needs. Get quotes, stock research, portfolio tracking, news, and online bill payment. Keep informed and plan for retirement, college, taxes, insurance, real estate, savings and more. http://www.nxinteractive.com/MoneyCentral.htm What separates you from a professional investor ? One little click between you and awardwinning MoneyMaximizer software. http://www.nxinteractive.com/MoneyMaximizer.htm Stock and Option investing advisory published daily. Free two week trial. For aggressive online traders, investors and daytraders. http://www.nxinteractive.com/NetPicks.htm Investing site targeting individual investors interested in learning more about trading stocks online. Infostock features stock quotes, and a fee-based newsletter with stock recommendations with a special focus on technical analysis. http://www.nxinteractive.com/Singles&Double.htm Systematic daily trading signals on the S&P 500 stock index for individual investors asset management and financial firms. http://www.nxinteractive.com/spTrading.htm Kevin C. Myers, best-selling author, presents real estate investment techniques using quick flip strategies and insider secrets to acquire, rehab, sell, fixer-uppers, handyman specials, foreclosures, tax lien certificate properties... http://www.nxinteractive.com/StreetSmart.htm Stock quotes to your pager, PCS phone. Todays current Business and Financial News. Don't miss an investment opportunity! Let Timely Quote alert you to your stocks every day! Searchable financial, investment and business site directory and search engine! http://www.nxinteractive.com/TimelyQuote.htm **************************************************************************** A FREE offline portal application providing FREE contents, such as World Time, PIM, Articles, News, Realtime Quotes, Horoscopes, Free/Sharewares, Internet Access/Call, Fax, Weather, Sweepstakes... http://www.nxinteractive.com **************************************************************************** From wware at world.std.com Fri Apr 21 10:55:47 2000 From: wware at world.std.com (Will Ware) Date: Fri, 21 Apr 2000 14:55:47 GMT Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> Message-ID: Ed (elb at cfdrc.com) wrote: > ... I didn't think much of the article... > ...they gave the impression that programmers behave > somewhat like monkeys, motivated primarily by concerns > about group status and dominance... They also mentioned, but immediately belittled, the possibility that altruism might be a real motivation. They may have been projecting their own thinking upon programmers in doing so. I'm not an open source purist, but I can easily see that a future world with a lot of free software will be a lot more pleasant for me to live in than one from which free software is absent. Benefits to the rest of society and to myself are not in conflict here. Maybe that's not really altruism, maybe it's just long-term thinking, a motivation they didn't mention at all. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From sabren at manifestation.com Thu Apr 27 04:28:36 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 27 Apr 2000 04:28:36 -0400 (EDT) Subject: mysqldb at sourceforge? Message-ID: Hey all, I've got a MySQL database set up at sourceforge, and I'm trying to set up MySQLdb.. I've done this on several other unix accounts, but I can't seem to find the mysql libraries on sourceforge, though the mysql is on the machine... If anyone else has gotten this working, I'd love to hear about it. Thanks, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From pinard at iro.umontreal.ca Tue Apr 4 08:46:05 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 04 Apr 2000 08:46:05 -0400 Subject: Unicode program representation In-Reply-To: fredrik@pythonware.com's message of "Tue, 04 Apr 2000 09:32:38 GMT" References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> <3xXF4.1060$n68.186533888@newsb.telia.net> <001201bf9d62$3e1ac1c0$36dd3fcb@neil> <%o3G4.1111$n68.191610880@newsb.telia.net> <8cccrm$cc3$1@nnrp1.deja.com> Message-ID: fredrik at pythonware.com writes: > what scares me is if we end up with multiple encodings in the > same source file. Oh, I agree with you that is not going to be usual, at least at first. I foresee it might happen quite naturally in Python scripts generating multilingual announcements, say. Or more generally, in Python scripts holding translation correspondences between languages, or anything in which we have substantial amount of editing to do in one language followed by a substantial amount in another language. Emacs Mule/MULE is likely able to do this, without resorting to UTF-8. Unicode on-the-fly combining is not well supported at the font rendering level (despite it is increasingly needed), and Unicode raises other disputes, like for the Han unification it imposed. As for the "simpler" cases like of a Vietnamese sentence quoting a German proverb, it is likely in the long run to see a common encoding like UTF-8. > (and no, it's not because we're developing a python development environment > -- supporting this in our python editor would be fairly trivial ;-) It would be? You should address the matter then. It is a worth goal. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From moshez at math.huji.ac.il Fri Apr 28 03:08:09 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 28 Apr 2000 10:08:09 +0300 (IDT) Subject: Using BaseHTTPServer In-Reply-To: <200004280649.IAA00894@kazul.rwth-aachen.de> Message-ID: On Fri, 28 Apr 2000, Lars von Wedel wrote: > my CGI project suffers from a lengthy delay for starting up > python and loading all required modules. I'm thinking about > setting up a small HTTP server in python itself so that the > interpreter and all the required modules have to be loaded only > once. > > >From the module documentation it is not clear to me, what I actually > have to do to catch the GET calls arriving at the server. > > I assume that I can use BaseHTTPServer as it is. I just need > to implement a working request handler, right? > > Now comes the more fuzzy part: > > Since I do not want to execute external files but internal methods, > I think I could modify CGIHTTPServer by subclassing it and overriding > its do_GET() method to decode the request directly? Or would I rather > use SimpleHTTPServer, here? > > Within any of the do_GET methods, how do I access data that has been > sent by the client (...&data1=val1?data2=val2?...)? Use the CGI module . Just copy the code from CGIHTTPServer to create the dictionary, (not as os.environ), and use the cgi module to parse that dictionary. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From poupaerte at my-deja.com Sun Apr 9 12:02:39 2000 From: poupaerte at my-deja.com (poupaerte at my-deja.com) Date: Sun, 09 Apr 2000 16:02:39 GMT Subject: tabular data References: <8co4l2$5r2$1@nnrp1.deja.com> Message-ID: <8cq9io$ca0$1@nnrp1.deja.com> Hi > def sortedby(list,*indices): I didn't know Python worked with pointers, or else what does *indices mean? The fine manuals do not explain the *var construct ... > nlist = map( lambda x,indices=indices: The expression "indices=indices" seems absolutely strange to me. I don't have a clue of what it could be doing, except for being true at all times. Is there some kind of lengthier tutorial on the lambda construct; it seems quite an advanced construct not easily to be found elsewhere in other programming languages, a bit like regexes ... Greetings Erik Sent via Deja.com http://www.deja.com/ Before you buy. From scarblac-spamtrap at pino.selwerd.nl Fri Apr 14 05:30:04 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 14 Apr 2000 09:30:04 GMT Subject: Need an enum type extension References: <38F52A7A.D8841724@gte.net> <38F68AF4.46DDA670@gte.net> Message-ID: sue wrote in comp.lang.python: > In Ada, I can do things like: > > type MyEnum is ( A, B, C ); > for MyEnum use ( A : 3; B : 7; C : 13 ); > > Ada uses "'string" to refer to attributes. > > MyEnum'len == 3. (number of items in list) > A'next == B (next item in list) > A'value == 3 (its low-level representation) > B'index = 1 (its position in the list) > > But A == 3 fails. only A == A passes. A'value == 3 is > true. This simple try seems to do that, at least. It needs some work (EnumVar needs to be immutable, I suppose), but maybe you can base it on this? class EnumVar: def __init__(self, value, index, enumlist): self.value = value self.index = index self.__enumlist = enumlist def next(self): return self.__enumlist.get_enum(self.index+1) class EnumList: def __init__(self, values): self.__list = [] self.len = len(values) for i in range(self.len): self.__list.append(EnumVar(values[i], i, self) def get_enum(self, i): return self.__list[i] def get_list(self): return self.__list Now use this like: >>> MyEnum = EnumList([3, 7, 13]) >>> A, B, C = MyEnum.get_list() >>> MyEnum.len 3 >>> A.next() is B 1 >>> A.value 3 >>> B.index 1 >>> A == 3 0 >>> A == A 1 -- Remco Gerlich, scarblac at pino.selwerd.nl 12:26pm up 38 days, 23:46, 8 users, load average: 1.49, 1.23, 1.18 From PClaerhout at CREO.BE Wed Apr 12 07:44:03 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 12 Apr 2000 13:44:03 +0200 Subject: Getting version information of .dll and .sys files under Windows NT Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA72A2@MSGEURO1> Hello, is there a way to access the version information that is included in .sys and .dll files from Python? I want an way to check for example driver versions unders Windows NT. Any idea? Kind regards, Pieter Pieter_Claerhout at creoscitex.com From adjih at crepuscule.com Sun Apr 30 13:43:05 2000 From: adjih at crepuscule.com (Cedric Adjih) Date: 30 Apr 2000 17:43:05 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8ecsgj$6lp$1@slb0.atl.mindspring.net> <300420001008012011%pecora@anvil.nrl.navy.mil> <20000430170952.A502@datapro.co.za> Message-ID: <8ehrb9$mm5$1@ites.inria.fr> Steve Crane wrote: > On Sun, Apr 30, 2000 at 02:08:00PM +0000, Louis M. Pecora wrote: >> Isn't this called something like "Hungarian" variable naming? > Hungarian Notation was introduced by Charles Simonyi (who happened to > work for Microsoft). In it's initial form it used a prefix to indicate > the data type of the variable but not the scope. Later people started > to add a scope prefix but I don't think that Microsoft uses this as a > standard. > While it may seem to make code harder to read it is in fact very useful > when working on large projects involving may programmers. Actually this is debatable. If you can read, you should be able to read the definition of any variable, and there are serious drawbacks. A flame of this notation is for instance in "Developing Windows NT Device Drivers": "The so-called `Hungarian Notation' (developped by a Hungarian programmer at Microsoft) is one of the worst ideas to have hit software development in many years" The main problem, is that when you change the type of a structure you _cannot_ change the name (because other people are using it), so the type specification becomes plain wrong. The 'wParam' is reported to be such an example (now unsigned 32 bits), there are other examples in Microsoft API (should be worse with Win64). Also each time you change the type of one variable/parameter, you have change all the variable names of all the code under your control. And finally, for multi-platform code, it makes less sense: what happens if you don't have 2-bytes integers and you have code with wXXXX variables (unsigned int 16 bits) ? -- Cedric From jmassung at magpiesystems.com Mon Apr 17 20:26:49 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Mon, 17 Apr 2000 18:26:49 -0600 Subject: else clauses in while and for loops References: <2JKK4.325$vr2.19414@news.uswest.net> <38DD2EE3.C7F3CB54@webamused.com> <8boe2k$gmh$1@inputplus.demon.co.uk> <8c7b29$37v$1@inputplus.demon.co.uk> <38F79B93.B03F0A6B@mindspring.com> <8dg14u$f08$1@nntp6.u.washington.edu> Message-ID: <%TNK4.430$vr2.32615@news.uswest.net> Donn Cave wrote in message <8dg14u$f08$1 at nntp6.u.washington.edu>... >Yes, but if you look at the examples, they also use "break". After a >loop, "else" basically means "if no iteration of the loop met the >conditions to break out." It's a common usage, where in C we'd compare >the final loop index with the maximum (or whatever) loop index to see >if the loop ran all the way through. I don't think that I'm following you, give me an example where the loop ends, but the else wouldn't be executed and I think I'll better understand. :) >| That could definitely be useful, because it would eliminate an "if" >| statement right before the "while" statement. useful for debugging >| purposes. > >I think I would go along with that if you took out "Extremely" - and then Consider it gone ;) >your paragraph would justify better on the right margin, too! Seriously, >"else" does invariably execute if the loop was never run once, but as >mentioned above it also executes in other circumstances. I think it would be better suited if it didn't execute under "other circumstances". It would be nice to know _exactly_ when it would execute, and only under 1 or 2 conditions (maybe that is the way it is now, I just don't see it). Jeff From chapman at bioreason.com Mon Apr 10 16:11:52 2000 From: chapman at bioreason.com (Mitch Chapman) Date: Mon, 10 Apr 2000 14:11:52 -0600 Subject: Problem running Python script as cron job References: <0004071555090M.01234@quadra.teleo.net> Message-ID: <38F23588.5C1C9E7@bioreason.com> There are a couple of ways to force your output to be immediately flushed. An ugly solution is a sys.stdout.flush() after every print statement. A less ugly solution is to reopen sys.stdout as soon as your script starts up, and to turn off output buffering: sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) I thought it used to be possible to do a setbuf on the file object, provided you hadn't already written to it. But this appears not to be the case. Another option is to change your cron job so it sets the PYTHONUNBUFFERED environment variable before starting your program. Something like this might work: /usr/bin/env PYTHONUNBUFFERED=1 /path/to/statsthing -r >/usr/local/tmp/.log For that matter you could write a shell script wrapper which set the environment variable, then invoke it from cron: #!/bin/sh PYTHONUNBUFFERED=1 export PYTHONUNBUFFERED /path/to/statsthing -r >/usr/local/tmp/.log Here's hoping this is more help than hindrance... -- Mitch Chapman chapman at bioreason.com "William R. Dickson" wrote: > > In article <0004071555090M.01234 at quadra.teleo.net>, Patrick Phalen > wrote: > > > [William R. Dickson, on Fri, 07 Apr 2000] > > :: Anybody know of any issues with running python scripts from Cron? > > > > No. I've had multiple Python scripts running every one, two, five and > > ten minutes around the clock for years on multiple servers without > > problems. [...] > > I think so too, but I can't find it, because the script runs flawlessly > every time I run it by hand, and the buffer never flushes the output to > the log when it's run by Cron. From lexberezhny at email.msn.com Tue Apr 4 20:00:21 2000 From: lexberezhny at email.msn.com (lexberezhny) Date: Tue, 4 Apr 2000 20:00:21 -0400 Subject: lightweight embedded database table object References: <1257258860-5013801@hypernet.com> Message-ID: gadfly? http://www.chordate.com/gadfly.html - Lex Gordon McMillan wrote in message news:1257258860-5013801 at hypernet.com... > Warren Postma wrote: > > > > > Hi Warren, > > > Have you looked at MetaKit? http://www.equi4.com/metakit/python.html > > > > It didn't look 'ready for prime time' -- too many disclaimers of the kind I > > usually put on something when I expect it's still quite buggy or unscalable. > > I suppose I should give it more of a try though, eh!? Is anyone using this > > in a 'production environment'? > > Yes. Metakit, extensively. Probably less so for Mk4py. > > The problems you'll find aren't stability problems. Some of the > advanced stuff (the relational algebra) can be tricky to get > working - it's not documented well, and you may find, for > example, that some operation returns a read-only view where > updates silently fail. It should all show up during development, > though. > > - Gordon > From dgreen at kryten.kitenet.net Wed Apr 5 00:51:52 2000 From: dgreen at kryten.kitenet.net (Dan Green) Date: Wed, 05 Apr 2000 04:51:52 GMT Subject: ASP web-type stuff References: Message-ID: My mistake ... slight error in my slrn setup. If you want to contact me about this, I can be gotten at dgreen at rewindtech.com In article , Dan Green wrote: >Ahoy, folks. > I was looking over things like Embperl and Apache::ASP and liked the >idea. I would like the idea more if I could do with python. So I had a >couple of questions: > >Is there such a thing? >Is there interest in such a thing? >Does anbody want to hear about my 75 lines of code hack that basically does >the trick, but needs a lot of work? > >If nobody cares at all, I'll just shut up and go home. :) > >For those of you who have no idea what I'm talking about, it's basically an >alternative to CGI that allows you to embed the code right into the HTML. > >something like this: > > > ><% for i in range(5): %> > Loop item <%= i %>
> > > >would look like this when called from a browser: > > > > Loop item 1
> Loop item 2
> Loop item 3
> Loop item 4
> Loop item 5
> > > >Let me know. If you're interested, please e-mail me. > >-- >Dan Green | "So What? It's your problem to learn to live with, >Developer | destroy us, or make us saints." >Rewind Technologies | -- Ministry, "So What?" -- Dan Green | "So What? It's your problem to learn to live with, Developer | destroy us, or make us saints." Rewind Technologies | -- Ministry, "So What?" From echuck at mindspring.com Sun Apr 9 22:29:53 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Sun, 09 Apr 2000 22:29:53 -0400 Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> <8covpn$4jq$1@slb6.atl.mindspring.net> <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk> Message-ID: <38F13CA1.1A91D85@mindspring.com> Nick Maclaren wrote: > To the several people who suggested: > > (a() and [b()] or [c()])[0] > > Thank you for the suggestion. I have occasionally used perversities > like that (such as '*(x ? &a : &b) = y;' in C to mimic the Algol 68 > facility), but I don't regard them as clarifying the code, either! OK, so what does the Algol 68 code look like for that C code and any other interesting cases? -Chuck From frankr at first-mind.de Wed Apr 5 03:53:17 2000 From: frankr at first-mind.de (Frank Rotermund) Date: Wed, 5 Apr 2000 09:53:17 +0200 Subject: building Extensions with compile.py Message-ID: <8cercu$7bb$1@newnews.ilk.de> Hello everybody, I have a problem building C extensions for Python. I tried it the way the Python Manuals describe it ( Using compile.py to get VC++ 6.0 started ... ) but VC gives my a linkage error which tells me, that VC got an unsolved extern symbol initxxx ( xxx is my source name ). Trying to solve this error I found '/libpath:"C:\programme\python\libs" /export:initxxx' in the project-properties of VC. I removed the export part. This resolved in linking without error, but the resolting pyd could not be imported in Python. Has anybody a solution for this problem? From dan at cgsoftware.com Thu Apr 6 00:20:21 2000 From: dan at cgsoftware.com (Daniel Berlin+list.python) Date: 06 Apr 2000 00:20:21 -0400 Subject: Imaginative solutions to connect. Was: Python 1.6 alpha 1 released In-Reply-To: James Logajan's message of "Wed, 05 Apr 2000 21:03:04 -0700" References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <5l7leern5v.fsf@eric.cnri.reston.va.us> <38EC0C78.C6170660@Lugoj.Com> Message-ID: >>>>> "James" == James Logajan writes: James> Guido van Rossum wrote: >> Repeat after me: SOCKETS ARE NOT JUST FOR IP CONNECTIONS. >> >> But I will fix the code -- it's the only practical thing to do. James> For alternatives 2 and 3 you need some incentive for people James> to change; cash might work but could get expensive. Rigging James> keyboards to deliver electrical shocks might work but might James> be too time consuming. Making the old interface much slower James> might help. Perhaps someone can think of a good James> incentive... (get some new and improved methods only if James> you use the new class, or something?) -- Why don't we introduce an official deprecation mechanism so that python will say "Warning, connect(arg1,arg2) is deprecated, use connect(arg1) instead" the first time it sees it or something. Simple lookup table for what's deprecated, and what to say about it. So code doesn't just break with no programmer visible warning from the interpreter. Hey, we could be really evil, and store the number of times we've warned you, and have the interpreter get more and more annoyed at the user, finally just refusing to interpret the code at all. Then again, i'm for the electrical shocks. --Dan From ljoramo.list at nickads.com Tue Apr 4 10:36:31 2000 From: ljoramo.list at nickads.com (Lee Joramo) Date: Tue, 4 Apr 2000 08:36:31 -0600 Subject: Starving for an Advanced Python Book In-Reply-To: <20000404040941.7766.qmail@web2106.mail.yahoo.com> References: <20000404040941.7766.qmail@web2106.mail.yahoo.com> Message-ID: Besides 'Learning Python', I have the following books: 'Python Essential Reference'; David Beazley; New Riders An excellent reworking of the online documentation. This is a reference book with out tutorial, but I have learned much from it. HIGHLY RECOMMENDED 'Python Annotated Archives'; Martin Brown; Osborne/McGraw Hill Looking for lots of sample code, this book has it. Following the code of each program is a detailed explanation of how the code works. I find this type of book very useful. The authors commentary on the code provides pointers that is often hard to get by reading code alone. 'Python Pocket Reference'; Mark Lutz; O'Reilly 75 pages, nice quick reference book. Only useful for looking up information with which you are already generally familiar. If you like the small size, get it. Otherwise, 'Python Essential Reference' will fill all your reference needs. -- Lee A. Joramo ljoramo at nickads.com The Nickel Want Ads www.nickads.com Internet Manager 970-242-5555 >Having finished "Learning Python", I'm now looking for an advanced >Python text. ORA's "Programming Python" is a natural choice, but I >can't bear buying this outdated book when the 2nd edition is due out >in a few months (I'm dying here Lutz, hurry it up already!). However, >I really need something in the interim period. The library reference >manual is fine but usage is difficult for me to figure out sometimes >because there are very few examples included. > >Does anyone have any suggestions? I suppose I'm looking for a text >that has examples of how to solve various kinds of programming >problems in Python and also examples of code showing how the library >and various modules actually work. How is the "Python Essential >Reference" on examples? Is it just a rebinding of the python.org >library reference From donn at u.washington.edu Wed Apr 19 12:01:59 2000 From: donn at u.washington.edu (Donn Cave) Date: 19 Apr 2000 16:01:59 GMT Subject: Very Horrible Question About Goto's References: Message-ID: <8dkl9n$f3a$1@nntp6.u.washington.edu> Quoth Gaetan Corneau : [quoting John Mitchell] |> 1) the only valid use of goto's in C I've seen looks like this: |>=20 |> if (bogus) |> goto cleanup |> do stuff; |> return(okay); |> cleanup: |> close file handles; |> do cleanup |> return(error) | | There are, at least, two other valid uses: | 1) the most important: goto's are used a lot by code generators (it | simplifies writing the generator alot in some cases) | | 2) in extreme cases, to improve performances. Now that we have a list of situations where goto is valid, we are on the road to realizing that it's just an inherently useful tool. Which it is. The cleanup idiom shown above is a common case, but there are an infinite variety of similar flow of control problems where goto works out well. | My own rules are: | - don't use goto's | | if you HAVE to use goto's: | - don't jump from one function to another (if your language supports = | it) | - don't jump backward | | I was surprised to learn that Python doesn't have a goto statement. | Would it be difficult to add? I wouldn't. In the abstract, goto is a good thing, but it would be out of place in Python, whose block constructs, exceptions and so forth already provide plenty of higher level flow control options. Here's an idea for a rewrite in Python (for the original poster): Take your routine and implement it as a class, with the routine local variables stored in the class instance so you can branch around to various methods without losing them. Each class method stores a final state before it returns, except one method which loops over the final state value and calls whatever method is appropriate for that state. This will be terribly verbose if you have a big mass of little goto branches that do trivial things, so it will help if you can cook that down a little first with if blocks etc., and also identify some block-local variables. Donn Cave, donn at u.washington.edu From nascheme at enme.ucalgary.ca Tue Apr 18 18:16:19 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: 18 Apr 2000 22:16:19 -0000 Subject: Distributing A Python Application In-Reply-To: <384449751.956092588323.JavaMail.root@web135-mc.mail.com> References: <384449751.956092588323.JavaMail.root@web135-mc.mail.com> Message-ID: <20000418221619.30185.qmail@cranky.arctrix.com> In comp.lang.python, you wrote: >I want to distribute a windows GUI application developed in Python/Tkinter. http://www.enme.ucalgary.ca/~nascheme/python/standalone.html Let me know how it goes. Neil -- "With a PC, I always felt limited by the software available. On Unix, I am limited only by my knowledge." --Peter J. Schoenster From rob at hooft.net Tue Apr 11 03:30:35 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 11 Apr 2000 09:30:35 +0200 Subject: sys.platform details... Message-ID: schol[51]:ccd>python Python 1.5.2b1 (#4, Jan 14 1999, 12:05:48) [GCC egcs-2.90.21 971202 (egc on irix5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import sys >>> sys.platform 'irix5' >>> ^D schol[52]:ccd>uname -a IRIX schol 6.3 12161207 IP32 This python was compiled on an irix5 box, but is running on an irix6 box. Hm. I'm off looking for a better way to find out what kind of box my program is running on.... Rob -- ===== rob at hooft.net http://www.xs4all.nl/~hooft/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! ========= From mhammond at skippinet.com.au Mon Apr 3 08:22:17 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 3 Apr 2000 22:22:17 +1000 Subject: [Python-Dev] Re: New Features in Python 1.6 In-Reply-To: <38E884F5.8F2FB271@lemburg.com> Message-ID: > > > On Sat, Apr 01, 2000 at 12:00:00PM -0500, Guido van > Rossum wrote: > > The above line has all the answers ;-) ... That was pretty sneaky tho! Had the added twist of being half-true... Mark. From musingattheruins at my-deja.com Fri Apr 7 15:45:10 2000 From: musingattheruins at my-deja.com (musingattheruins at my-deja.com) Date: Fri, 07 Apr 2000 19:45:10 GMT Subject: Palm OS Message-ID: <8clds2$c25$1@nnrp1.deja.com> Anyone know of a Python release for Palm? Sent via Deja.com http://www.deja.com/ Before you buy. From mhammond at skippinet.com.au Wed Apr 26 20:46:35 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 27 Apr 2000 00:46:35 GMT Subject: Python COM troubles References: <390a2f04.149999918@news.onlineisp.com> Message-ID: "William Wicker" wrote in message news:390a2f04.149999918 at news.onlineisp.com... > Is there a way around this appearance of typelessness? There is a type > library, and I've run make-py successfully. I just can't see an easy > way into it. You can try running "makepy.py -i", and select your type library. This will spit out some code, something like: gencache.EnsureModule(...) change this to: mod = gencache.EnsureModule(...) And you should be able to create any of the class objects in the makepy module - eg: ob = mod.TheClassName() If you search deja news, there should be lots of info about this - but generally relating to "Lotus Notes", which also has the same problem. [BTW - drop them a line, and tell them they should fix their objects :-] > COM dispatch methods that are documented to return SAFEARRAYS of > dispatch pointers fail with pythonwin v125 and 128 (the only ones I've > felt safe enough to try). The traceback is something like this: > SystemError: NULL result without error in call_object > >>> >From a CVS checkin message on 11th of Feb: Can you believe that we have never been able to recieve arrays of IDispatch or IUnknown objects?!?!? If you tried, you would have got "SystemError: NULL result without error in call_object" :-) This was fixed in 129. But 129 hasnt made it public yet - I will do this as soon as I can log back in to starship! Mark. From dalke at acm.org Mon Apr 24 04:58:55 2000 From: dalke at acm.org (Andrew Dalke) Date: Mon, 24 Apr 2000 02:58:55 -0600 Subject: partial parsing? References: <8dvilp$88s$1@slb6.atl.mindspring.net> Message-ID: <8e1265$imv$1@slb6.atl.mindspring.net> Dave Abrahams: >You might think about looking at chart parsing technology, sometimes >used in natural language processing. What I have about chart parsing is from Grune&Jacobs' "Parsing Techniques". They say that it's the same as CYK, but then elaborate that variations of CYK are identical to variations of chart parsing. Now if I only recall how CYK works. Well, that's why I printed out that document. :) >You can use a chart parser to extract all parseable sub-regions from a >sequence of tokens. Just turn off the grammar rules you're not interested in >and you should be all set (provided the grammar rules you care about don't >generate false positives due to the lack of contextual information that >would be neccessary for a complete parse). I don't quite follow that. I think there's too much "self similarity" in what I have because it's a large number of records in a row. Again, I've got to read more. >Just a caveat: in typical program parsers much more time is spent in lexical >analysis than in actual parsing. This tends to indicate that using YACC is >probably about as well as you'll do for speed and trying to optimize away >parsing time is misguided. I know in perl that my full parser code was about an order of magnitude slower than the parse-only-exactly-what-I-want parser. For a record like: ID BPT1_BOVIN STANDARD; PRT; 100 AA. AC P00974; [...] SQ SEQUENCE 100 AA; 10903 MW; 6A778A4AD763FB19 CRC64; MKMSRLCLSV ALLVLLGTLA ASTPGCDTSN QAKAQRPDFC LEPPYTGPCK ARIIRYFYNA KAGLCQTFVY GGCRAKRNNF KSAEDCMRTC GGAIGPWENL // where I'm interested in the first word of the ID line and the sequence lines, I should be able to have a (fake mxTools-like) implementation like: while not eof: skip 5 characters read until ' ' read until 'S' and send read text to callback "id" skip 46 characters (the start of the '[') while text != " " and text != "//": read up to '\n' while text != "//": while text == ' ': skip the ' ' read up to ' ' or '\n' and send read text to callback "sq" skip 3 characters (the // followed by the \n) So it seems what I want is better performance in the lexer part, which agrees with your point. Andrew dalke at acm.org From effbot at telia.com Tue Apr 25 12:28:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 25 Apr 2000 16:28:34 GMT Subject: Newbie Needs Help -- Name and Key errors References: Message-ID: Bob Langdon wrote: > New to Python, and moving a site for a client. The backend sas developed > by another developer in Python. I've i9nstalled Python1.5.2 in my home > direcpory and tested it. The interpreter seems to functioning properly. > > However, some paths seem to be defined incorrectly. > > When running a script "getresume.py" for example, > > >>try: > import sys > sys.stderr = sys.stdout > sys.path.insert(0,'.') > sys.path.append('/usr/local/lib/python1.5') > sys.path.append('/usr/local/lib/python1.5/site-packages') > import os > TEMPLATES=os.environ['DOCUMENT_ROOT'] > from calendar import month_name > from types import * > from formhandler import FormHandler > from string import strip, split, join, atol, atof, upper, lower, > capitalize > from refer import getReferer, addGetResume > from time import asctime, localtime, time, strftime > from urllib import quote_plus, unquote_plus > from fcsetup import LOCALHOSTNAME > from fcsetup import * > import Mail > except: > print '
\n'
>    import traceback
>    traceback.print_exc()
>    print sys.path
>
> resumeDIR = DEPOT

just guessing here, but it looks like

1) you need to the DOCUMENT_ROOT environment variable
before running the script

2) the fcsetup.py module should define a variable called DEPOT,
but doesn't.

> I think DEPOT might be a reference to the MySQL database, using the
> Berkley dbmodule (which I can't find). I certainly can't find a
> directory named DEPOT anywhere on the old host's server.

DEPT is a variable name, not a directory name.  the "from
fcsetup import *" line imports all variables from the fcsetup
module.

> Neither can I fathom where "DOCUMENT_ROOT" is defined, or find a file
> called "os.environ."

"os.environ" refers to a variable in the standard "os" module,
not a file.  see the library reference for more info.






From claird at starbase.neosoft.com  Thu Apr 20 09:37:15 2000
From: claird at starbase.neosoft.com (Cameron Laird)
Date: 20 Apr 2000 08:37:15 -0500
Subject: Dynamic web pages! not Dynamic HTML
References: <200004192223.IAA10606@envy.fulcrum.com.au>
Message-ID: <3E0EB84BC85217A9.75297C30B305575F.DF96EDF011E52E7D@lp.airnews.net>

In article <200004192223.IAA10606 at envy.fulcrum.com.au>,
Richard Jones  wrote:
			.
			.
			.
>   Phil has spent quite a lot of time developing that site (Tcl over a 
>relational database) - and you should expect to spend some time on it also. 
>That's assuming he won't just give you his code :)
As Brent Fulghum has already mentioned, PhilG
gives it all away.  All the software is freely
available.

Phil certainly has invested a LOT of time in
photo.net.  On the other hand, I suspect Mr.
Hadap will be able to implement in Python the
aspects that interest him quite quickly, and
he might feel more comfortable with the result.
>
>   I would suggest that you develop a Zope site - for three reasons:
>   . it'll make using a "real" database much simpler thanks to Zope's 
>easy-as-pie SQL methods. Remember, Zope comes with gadfly bundled in the box.
>   . you'll automatically get access to a bunch of public-contributioned prior 
>art: guestbooks, news pages, FAQ handlers and so on. See the member area on 
>www.zope.org for a taste.
>   . once you're done, you can make the Zope products you generate available to 
>others so they can put up their photos too!
>
>   What you describe with the @photo tag in a "sorta HTML" page is actually 
>going to be quite simple to do in Zope. Ask around on the zope mailing lists if 
>you're stuck - they're all quite helpful people over there :)
All true, and worth repeating.
			.
			.
			.
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


From scarblac-spamtrap at pino.selwerd.nl  Tue Apr 11 20:14:26 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 12 Apr 2000 00:14:26 GMT
Subject: I need Help
References: <38F3AD34.E6C88698@home.com>
Message-ID: 

HC2k wrote in comp.lang.python:
> Hello I am new to programming and someone said start with Python it's a
> great learning language and can be very useful what excactly does python
> program? And how long did it take anyone else to learn thanks !

Python can program a lot of things. It's very good at controlling Windows,
it works on a lot of other platforms, and it's a good language for the Web.
But that shouldn't matter to a beginner. Python has a very straight forward
design, and a consistent structure, so it's good to learn to program with.

There are several tutorials for beginner programmers on the web, see
http://www.python.org/doc/Intros.html (especially the What is Python? link
and all the links after 'Introductions to Python for non-programmers').

Try to work through those tutorials. If you have problems, just ask on the
newsgroup, or mail me personally, or subscribe to the python-tutors mailing
list, a list especially for people learning Python as their first language -
see http://www.python.org/mailman/listinfo/tutor .

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
  3:10am  up 36 days, 14:30,  8 users,  load average: 3.27, 2.75, 1.98


From amitp at Xenon.Stanford.EDU  Thu Apr 13 17:11:14 2000
From: amitp at Xenon.Stanford.EDU (Amit Patel)
Date: 13 Apr 2000 21:11:14 GMT
Subject: simple httplib and urllib timeout question
References: 
Message-ID: <8d5d5i$95k$1@nntp.Stanford.EDU>


   wrote:

| Just a quick question, im writing a small webbot for a python
| learning experience and it comes across some sites that will make it
| hang for a while, if the site is down or extremely slow etc, is
| there a way to set a faster timeout for httplib . Or is there a
| better way to handle it ?


You can set an alarm using signal.alarm, and then you can throw an
exception in the signal handler.  I used to do this, but then I
discovered asyncore.  If you want to crawl multiple pages at once, you
might want to switch to asyncore.  I believe the asyncore documentation page
has an example HTTP client.

    - Amit

--
Amit J Patel, Computer Science Department, Stanford University
http://www-cs-students.stanford.edu/~amitp/



From robin at jessikat.demon.co.uk  Mon Apr  3 03:04:56 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Mon, 3 Apr 2000 08:04:56 +0100
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us>
Message-ID: 

In article <200003312130.QAA04361 at eric.cnri.reston.va.us>, Guido van
Rossum  writes
>I've just released a source tarball and a Windows installer for Python
>1.6 alpha 1 to the Python website:
>
>  http://www.python.org/1.6/
>
>Probably the biggest news (if you hadn't heard the rumors) is Unicode
>support.  More news on the above webpage.
>
>Note: this is an alpha release.  Some of the code is very rough!
>Please give it a try with your favorite Python application, but don't
>trust it for production use yet.  I plan to release several more alpha
>and beta releases over the next two months, culminating in an 1.6
>final release around June first.
>
>We need your help to make the final 1.6 release as robust as possible
>-- please test this alpha release!!!
>
>--Guido van Rossum (home page: http://www.python.org/~guido/)
>
I see from the download info that python now seems to require
installation of it's own Tkinter. Can I inhibit this at install time and
continue to use my own version? I'm quite prepared for some problems of
getting it to work, but the whole point of having Tcl/Tk is that it is
extensible and I doubt very much whether an arbitrary version will work
with all the Tcl extensions I currently have. Blt for example is still
issued by the author in version specific form.
-- 
Robin Becker


From moshez at math.huji.ac.il  Sat Apr 22 00:48:19 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Sat, 22 Apr 2000 07:48:19 +0300 (IDT)
Subject: The Simple Economics of Open Source
In-Reply-To: <3dya67xga4.fsf@amarok.cnri.reston.va.us>
Message-ID: 

On 21 Apr 2000, Andrew M. Kuchling wrote:

> Also, ever had to debug a problem in a binary-only library through
> trial-and-error?  You can burn lots of time that way.  
> "Hmm... maybe that parameter can't be NULL."   "Maybe that
> struct field should be 1." .  I like the fact that, if I
> start seeing mysterious errors, I can dive down into the language
> interpreter, farther down into the C library, and even into the kernel
> if needed.  Though I've only followed a problem all the way into the
> Linux kernel once (to discover it was my error), it was reassuring to
> be able to do so.

Reminds me of the time I had to delve into Xt source to look for a way
to get out of the main loop without exiting the program. After 15 minutes
of looking at the docs to no use, it took 5 minutes of grepping through
the source, only to return to the docs and find out it was there -- 
only well hidden with an unlikely name and a surprising section.

x-sources-are-strange-and-wonderful-ly y'rs, Z.
--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From amitp at Xenon.Stanford.EDU  Tue Apr  4 22:55:08 2000
From: amitp at Xenon.Stanford.EDU (Amit Patel)
Date: 5 Apr 2000 02:55:08 GMT
Subject: [Bug?] Time utils lose DST information
Message-ID: <8ce9uc$hoi$1@nntp.Stanford.EDU>

First, my program:

from time import *

print strftime("%a %b %d %H:%M:%S %Y", 
               localtime(mktime(strptime("Mon Apr 3 05:06:07 2000"))))

I'd like this to return "Mon Apr 3 05:06:07 2000".

However, it doesn't.  It returns "Mon Apr 3 06:06:07 2000".

I found this odd, so I looked at the Python 1.6a1 source... strptime
leaves the daylight savings (DST) flag as 0 (known to NOT be DST)
instead of -1 (unknown status of DST).  (strptime (in timemodule.c)
fills in the structure with 0's, and C's strptime doesn't set this
flag unless you use a %Z in the time format.)

Given that strptime doesn't know the DST status, I think it should
initialize the `tm' structure to contain -1 in the DST field,
indicating "unknown", so that converting to and back from Unix time
doesn't give the wrong number.

Any thoughts on this?


   -i'd-rather-absolish-daylight-savings-completely-y'rs, Amit


From pinard at iro.umontreal.ca  Mon Apr  3 20:30:28 2000
From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=)
Date: 03 Apr 2000 20:30:28 -0400
Subject: Unicode program representation
In-Reply-To: Moshe Zadka's message of "Tue, 4 Apr 2000 00:15:53 +0200 (IST)"
References: 
Message-ID: 

Moshe Zadka  writes:

> FWIW, I believe that Python's (official) parser should be strictly UTF-8.

I would be very unhappy if I was loosing the capability of editing my files
directly in Latin-1.  I might come to use UTF-8 all over one of these days,
or maybe not.  Let it be my choice.

> it's trivial to write a script to convert between anything and UTF-8
> (in Python, of course ).

Granted.  But I do not feel like being forced into using such a script.

It is good that Python is able to process Unicode.  It would be wrong if it
was starting to impose Unicode on users, in so sharing the fanatic attitude
some people have about Unicode.  I like what Python 1.6 does currently, that
is, leaving me the choice about where is my own comfort while using Python.

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard





From culliton at clark.net  Sat Apr  1 14:00:28 2000
From: culliton at clark.net (Tom Culliton)
Date: Sat, 01 Apr 2000 19:00:28 GMT
Subject: New Features in Python 1.6
References: <200004011740.MAA04675@eric.cnri.reston.va.us>
Message-ID: 

OK, it's April 1st so maybe I'm just not getting the joke but...

In article <200004011740.MAA04675 at eric.cnri.reston.va.us>,
Guido van Rossum   wrote:
>New Features in Python 1.6
>==========================



>Note that use of any string method on a particular string renders it
>mutable.  This is for consistency with lists, which are mutable and have
>methods like 'append()' and 'sort()' that modify the list.  Thus,
>"foo.strip()" modifies the string 'foo' in-place.  "strip(foo)" retains
>its old behavior of returning a modified copy of 'foo'.

Violating immutablity like this seem like a misfeature and potential
source of nasty bugs unless there is some kind of copy on write going
on.  For example, imagine A is set to a string value, which is used as
a dictioanry key, and then passed to a fucntion, which passes it to
another function, which modifies it in place.  Suddenly the dictionary
keys aren't unique since the same value was shared by all.  Just the
thought scares me snotless.

>4. assignment to None now works

Huhn?  What exactly changed here?  You can assign to None in current
versions just like you can to any other name.  I thought the push was
to _prevent_ this.

Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> def xyz(a):
...     global None
...     None = a
...
>>> def abc(a):
...     if a == None:
...             print "None-sense!"
...
>>> xyz(42)
>>> abc(42)
None-sense!

>In previous version of Python, values assigned to None were lost.  For
>example, this code:
>
>    (username,None,None,None,realname,homedir,None) = getpwuid(uid)
>
>would only preserve the user name, real name, and home directory fields
>from a password file entry -- everything else of interest was lost.
>
>In Python 1.6, you can meaningfully assign to None.  In the above
>example, None would be replaced by a tuple containing the four values of
>interest.

This is either nasty unpythonic special case magic or a much broader
change.  The current behaviour is the same whether you use the name
"None", "X", "y", "junk", ...  The name ends up refering to the last
value in the list.  The whole point of this type of assignment to None
(or junk, or ...) is usually to discard elements you don't want.  As a
general change it could be useful but may break existing code in a way
thats VERY hard to spot.

>You can also use the variable argument list syntax here, for example:
>
>    (username,password,uid,uid,*None) = getpwuid(uid)
>
>would set None to a tuple containing the last three elements of the
>tuple returned by getpwuid.

I'm not one of the folks who howl at tightening up the behaviour of
list.append, socket.connect and the like but these changes, especially
viloating immutability, strike me as too bizarre and dangerous for
words.  Please tell us it's just and April Fools joke!



From lewst at yahoo.com  Tue Apr  4 00:09:41 2000
From: lewst at yahoo.com (lewst)
Date: Mon, 3 Apr 2000 21:09:41 -0700 (PDT)
Subject: Starving for an Advanced Python Book
Message-ID: <20000404040941.7766.qmail@web2106.mail.yahoo.com>

Having finished "Learning Python", I'm now looking for an advanced
Python text.  ORA's "Programming Python" is a natural choice, but I
can't bear buying this outdated book when the 2nd edition is due out
in a few months (I'm dying here Lutz, hurry it up already!).  However,
I really need something in the interim period.  The library reference
manual is fine but usage is difficult for me to figure out sometimes
because there are very few examples included.

Does anyone have any suggestions?  I suppose I'm looking for a text
that has examples of how to solve various kinds of programming
problems in Python and also examples of code showing how the library
and various modules actually work.  How is the "Python Essential
Reference" on examples?  Is it just a rebinding of the python.org
library reference

Thank-you.


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com



From ullrich at math.okstate.edu  Sat Apr  1 13:39:50 2000
From: ullrich at math.okstate.edu (David C. Ullrich)
Date: Sat, 01 Apr 2000 12:39:50 -0600
Subject: Function override?
References: <000101bf9b9b$312f8fe0$2f2d153f@tim>
Message-ID: <38E64275.CF8F97DC@math.okstate.edu>

Tim Peters wrote:

> [David C. Ullrich]
> > ...
> > This is certainly one of the things that _I_ find keen,
> > amyway - I hope the people who are talking about adding
> > stricter typing to Python make it optional somehow.
>
> Yup, not to worry.  All proposals to date make static typing declarations
> optional, and by default not needed.

    Fine, I can sleep tonight.

    Or I could if I hadn't just read the bit about how in 1.6 strings
have a split method, and if s1 and s2 are strings then

s1.split(s2)

either splits s1 using s2 as the delimiter or the other way around,
depending on which occurs more frequently in the other. I mean
surely it will happen that we want to split a bunch of strings
using 'delimiter' as a delimiter, and then it just happens that
the routine that does that gets passed 'lim' as an argument and
does the opposite of what we want?

> [...]
>
> > There are obvious advantages to stricter typing but you lose
> > something as well. (For example, I get a big kick out of
> > the fact that exactly the  same euclidean-algorithm code
> > works to find the GCD of two integers or the GCD of
> > two polynomials. Etc.)
>
> This isn't a problem with static typing per se, provided the system is rich
> enough to let you define a suitable EuclideanDomain type.  The system is not
> rich enough today,

    Not all that important, but I'm missing something here. Why can't
we make a EuclideanDomain type? I've made a VectorSpace type,
for example.
    Oh. You meant a EuclideanDomain type instances of which
would be euclidean domains? In the sort of thing I've done
a _subclass_ of EuclideanDomain would be a euclidean domain,
instances of which are the elements.

> but people throughout this industry hold a charming faith
> that tomorrow's solutions won't suffer today's problems .
>
> just-a-fan-of-the-illusion-of-progress-ly y'rs  - tim



From scarblac-spamtrap at pino.selwerd.nl  Thu Apr 27 21:14:46 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 28 Apr 2000 01:14:46 GMT
Subject: Python does not let me format time.
References: <8eakhq$797$1@nnrp1.deja.com>
Message-ID: 

Sindh wrote in comp.lang.python:
> If there is already a moduls to do the same , much helpful.

>>> import time
>>> time.strptime("00/04/28","%y/%m/%d")
(2000,04,17,0,0,0,6,1,0)

strptime is the inverse of strftime, in a way.

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl

   This is no way to be
     Man ought to be free      -- Ted Bundy
       That man should be me


From michael.stroeder at inka.de  Tue Apr 18 02:39:05 2000
From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Tue, 18 Apr 2000 08:39:05 +0200
Subject: May 27th PARTY!
References: <006201bfa756$896e5a80$da00a8c0@austin.rr.com>
Message-ID: <38FC0309.972C4781@inka.de>

> Rebecca Stidolph wrote:
> 
> ATTENTION FRIENDS AND FAMILY AROUND THE NATION!!
> 
> We (David and Rebecca Stidolph) are celebrating our 17th wedding
> anniversary

Wow! Why going to a Python conference when we have a chance to meet
at a wedding anniversary.

Ciao, Michael.


From eblosch at earthlink.net  Sun Apr 30 22:50:34 2000
From: eblosch at earthlink.net (Ed Blosch)
Date: Mon, 01 May 2000 02:50:34 GMT
Subject: CGI File Size Limit?
Message-ID: <_h6P4.14007$g4.347236@newsread2.prod.itd.earthlink.net>

I'm having trouble uploading an 18K file via CGI and saving it to a file from my Python script.  The file gets saved, but the file size is only 1k.  I'm assuming that the cgi module is only reading the first 1k bytes.  I'd like to know if this sounds reasonable and how to solve the problem....and if not reasonable, where else I might look for the problem.

Thanks....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From scarblac-spamtrap at pino.selwerd.nl  Thu Apr 27 09:53:03 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 27 Apr 2000 13:53:03 GMT
Subject: Concatening string and integer
References: <8e9gco$jlt$1@vg170.it.volvo.se>
Message-ID: 

JJ wrote in comp.lang.python:
> Hi!
> 
> I want to concatenate a string containing both strings and integers like:
> 
> strTemp = 'I make test number: ' + iMyNumber + ' once again'
> 
> It doesn't work, how should I do this?

1) You make a string of the integer:

strTemp = 'I make test number: ' + str(iMyNumber) + ' once again'

2) You use string formatting:

strTemp = 'I make test number: %d once again' % iMyNumber

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
Hi! I'm a .sig virus! Join the fun and copy me into yours!


From adjih at crepuscule.com  Fri Apr 28 11:23:18 2000
From: adjih at crepuscule.com (Cedric Adjih)
Date: 28 Apr 2000 15:23:18 GMT
Subject: MORE INFO
References: <8ea0ao$fro$1@nnrp1.deja.com> <8ea9uu$rh0$1@nnrp1.deja.com>
Message-ID: <8ecad6$bun$1@ites.inria.fr>

mdefreitas at sikorsky.com wrote:
> By the way... I finally tested the code I wrote and it evidently is
> incorrect. It works fine on the first nest level, but my application
> aborts on the second nest level.

> The error message is:
> Fatal Python Error: PyThreadState_Get: no current thread

> OK... I'm lost. Any ideas? Anybody? Buelher?

  Hmm... I can't answer because I'm not a Python threading expert,
but I didn't understand your thread model: do you want to run
several python scripts (and several ui.commands C code)
concurently (how would you synchronize?) ?
  Note that if all you want is to have C code that calls Python
code that calls C code (through a module) that calls Python code
without threads, PyRun_XXX functions are re-entrant
(these functions are even called reentrantly by the Python interpreter
itself for the "eval", "execfile" functions, check Python/bltinmodule.c).

If you want to pass arguments to your script, you could use the
other PyRun_File function with a dictionnary with args for locals, see
  http://www.python.org/doc/current/api/veryhigh.html
(the 'int start' should be Py_file_input)


Note that a more flexible way to implement a 'python'
command is:
- to initialize the python interpreter
- to load a fixed module ("pythonexec.py" for instance)
(PyImport_ImportModule)
- to call a function with a given name from this module
(PyModule_GetDict + PyDict_GetItemString + PyObject_CallFunction 
should do, maybe there is something shorter), with as
argument the whole command string.

I.e. do the equivalent of: 
import pythonexec
pythonexec.doEval()

Then you can start with 'pythonexec.py' being:
import string
def doEval(cmdLine):
  arg=string.split(cmdLine)
  execfile(arg[0],{'argv': cmdLine[1:]})


And then later change doEval to do more elaborate
parsing (for instance if an argument begins with '$',
first eval the argument as an ui command, or if
the filename is 'eval' just evaluate the string,
or don't do execfile, but an import+apply, ...)

-- Cedric



From thomas at xs4all.net  Thu Apr  6 12:35:09 2000
From: thomas at xs4all.net (Thomas Wouters)
Date: Thu, 6 Apr 2000 18:35:09 +0200
Subject: __builtin__.open on windows NT
In-Reply-To: <20000406182802.C13830@xs4all.nl>; from thomas@xs4all.net on Thu, Apr 06, 2000 at 06:28:02PM +0200
References: <8cicd6$1s0$1@nnrp1.deja.com> <20000406182802.C13830@xs4all.nl>
Message-ID: <20000406183509.D13830@xs4all.nl>

On Thu, Apr 06, 2000 at 06:28:02PM +0200, Thomas Wouters wrote:
> If you *really* want to use __builtins__, you can: you just have to import
> it first ! :-) Remember to do that with 'import __builtins__', or it might

Err, it's 'import __builtin__'. Sorry for that (consistent) typo. (Cant
claim it's a thinko because I dont recall thinking about it ;)

-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



From yawyi at gmx.de  Tue Apr  4 12:37:34 2000
From: yawyi at gmx.de (Johannes Stezenbach)
Date: Tue, 4 Apr 2000 18:37:34 +0200
Subject: Python 1.6 alpha 1 released
References:  <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <5l7leern5v.fsf@eric.cnri.reston.va.us>
Message-ID: <38ea1de0$0$17688@personalnews.de.uu.net>

Guido van Rossum  wrote:
>I don't want to break that much code, so I'll revert the decision in
>the
>next alpha release.
>
>However, I'll do so for purely backwards compatible reasons, and I
>will continue to press for the tuple address as the correct form.

Will python then support a -w switch to support people in writing
correct programs (i.e. compatible with likely furure language/library
changes), just like our-favourite-four-letter-P-language?

Seriously: Either accept the 2-arg form of connect() as *correct* for
all future versions of python or keep the change to make it illegal
*now*.
Just postponing the change is evil since it will only hurt more people
in the future, as the number of python users is growing. (CP4E?)

>But I will fix the code -- it's the only practical thing to do.

If it's not broken then don't fix it.



From mikael at isy.liu.se  Wed Apr 26 05:32:07 2000
From: mikael at isy.liu.se (Mikael Olofsson)
Date: Wed, 26 Apr 2000 11:32:07 +0200 (MET DST)
Subject: huh? Python says that AttributeError: 'string' object has no
In-Reply-To: <8e62qm$511$1@nnrp1.deja.com>
Message-ID: 

On 26-Apr-00 schmitthead at my-deja.com wrote:
 >  I received a whole folder full of files with MacOS type text files, with
 >  different newline characters.  I thought, a perfect job for python.
 >  Below is my attempt, but it generates the following error message:
 >  
 > >mac2dos tt_prvt.h
 >  Traceback (innermost last):
 >    File "C:\bin\mac2dos.py", line 33, in ?
 >      mac2dos( directory )
 >    File "C:\bin\mac2dos.py", line 24, in mac2dos
 >      os.path.walk( os.getcwd(), callbackfunc, '' )
 >    File "d:\python\Lib\ntpath.py", line 265, in walk
 >      func(arg, top, names)
 >    File "C:\bin\mac2dos.py", line 18, in callbackfunc
 >      mac2dosfile( file )
 >    File "C:\bin\mac2dos.py", line 9, in mac2dosfile
 >      lines = myline.split( myline, chr(10) )
 >  AttributeError: 'string' object has no attribute 'split'

The line should be

    lines = string.split( myline, chr(10) )
            ^^^^^^

split is a function in the module string.

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson 
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    26-Apr-00
Time:    11:29:45

This message was sent by XF-Mail.
-----------------------------------------------------------------------


From zorro at zipzap.ch  Wed Apr  5 05:45:52 2000
From: zorro at zipzap.ch (Boris Borcic)
Date: Wed, 05 Apr 2000 11:45:52 +0200
Subject: ANN: Stackless Python for MacOS
References: 
Message-ID: <38EB0B50.880ED056@zipzap.ch>

Just van Rossum wrote:
> 
> Even though I still hardly understand the implications of it all yet,
> Stackless is IHMO the most exciting new Python development at the time,
> together with Unicode support in 1.6. Stackless will most likely not be
> incorporated into Python 1.6, but *maybe* if we make enough noise we can
> convince Guido it should go into 1.7... More stackless killer apps please!

I'd argue for "Python 1.618" - the golden ratio.

BB
--
"C++ is a contradiction in terms" -- Einstein


From kaeber at gmd.de  Tue Apr 11 05:06:47 2000
From: kaeber at gmd.de (Joachim Kaeber)
Date: Tue, 11 Apr 2000 11:06:47 +0200
Subject: readline skips on line
References: <8culp8$23a$1@porthos.nl.uu.net>
Message-ID: <38F2EB27.751EFFDD@gmd.de>

Hi,

try this:

f=open('test.txt', 'r')

while 1:
  line=f.readline()
  if not line:
    break
  print line

print "ready"

(you program uses odd lines for the test, even lines for output...)

Soundwave wrote:
> 
> I got a part of a programm looking like this
> 
> f=open('test.txt', 'r')
> while f.readline()!='':
>     print f.readline()
> print 'ready'
> 
> but when it is runned, it wil print out the lines in the text file, but it
> skips all the the odd line, it only displays line 2,4,6,8,10 and further
> 
> How can I solve this problem ?

-- 
Joachim Kaeber (kaeber at gmd.de) (http://imk.gmd.de/~kaeber)
GMD - Forschungszentrum Informationstechnik GmbH
    - German National Research Center for Information Technology
Schloss Birlinghoven                    email: kaeber at gmd.de
D-53757 Sankt Augustin 1, Germany       phone: (+49 2241) 14-2546


From cut_me_out at hotmail.com  Thu Apr 20 19:27:41 2000
From: cut_me_out at hotmail.com (Alex)
Date: 20 Apr 2000 19:27:41 -0400
Subject: Where do I send a contribution for the Starship recovery ?
References:  
Message-ID: 

> Sorry about the repeats. 

No worries.  I was just trying to be funny.

Alex.


From jbenderl at olf.com  Fri Apr  7 10:14:27 2000
From: jbenderl at olf.com (Jason Benderly)
Date: Fri, 07 Apr 2000 10:14:27 -0400
Subject: PPython
References: <38ede548.353776233@news.oh.verio.com> <8ckptt$j8s$1@pegasus.csx.cam.ac.uk>
Message-ID: <38EDED43.78A97864@olf.com>

Hi Nick,

Could yo be more specific about those things that you wouldn't want to know.
I want to know...

Jason

Nick Maclaren wrote:

> If you want a really silly idea, it probably wouldn't be hard to
> convert Python's C source to Perl, because the former looks pretty
> clean and therefore could be translated semi-automatically without
> needing a full-blown C to Perl compiler.  That's the easy bit.
>
> When you put 130,000 lines of translated source into Perl, you
> would discover things about Perl that you didn't want to know and
> even its author had not suspected :-)
>
> And I suspect that those Web sites would disembowel you after their
> systems had melted down ....
>
> Regards,
> Nick Maclaren,
> University of Cambridge Computing Service,
> New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
> Email:  nmm1 at cam.ac.uk
> Tel.:  +44 1223 334761    Fax:  +44 1223 334679



From ivanlan at callware.com  Tue Apr 18 17:34:51 2000
From: ivanlan at callware.com (Ivan Van Laningham)
Date: Tue, 18 Apr 2000 15:34:51 -0600
Subject: PythonWin and Dialogs in DLLs
Message-ID: <38FCD4FB.6E07A632@callware.com>

Hi All--
OK, I followed the instructions in previous messages to this list to
build a resource-only DLL from which I wish to import custom dialogs. 
The build works, but using "import migrate1", where the dll is named
"migrate1.dll" gives me the error message

	dynamic module does not define init function (initmigrate1)

Digging around for that error message seems to indicate that it's
thinking I want an extension module with code in it, when all I want to
do is just have *resources only*.

What am I missing?  What's staring me in the face if only I would open
my eyes?

-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
http://www.pauahtun.org 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



From mhammond at skippinet.com.au  Fri Apr 28 19:31:44 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Fri, 28 Apr 2000 23:31:44 GMT
Subject: win32com: _NewEnum being cached
References: <8ecta7$nn5$1@nnrp1.deja.com>
Message-ID: 

"Tom Hines"  wrote in message
news:8ecta7$nn5$1 at nnrp1.deja.com...
> Hello.  As you know, to implement "for x in my_list" functionality in
> COM, you must code a get__NewEnum() function, which I have done and it
> works fine under Visual Basic.  But when called from Python, the call
> seems to get cached, as subsequent Python "for" blocks don't result in
> calls to get__NewEnum().

You should be able to say:

enum = ob._NewEnum()
for i in enum:
  ...

Mark.





From rhicks at nospam.rma.edu  Tue Apr 18 20:59:18 2000
From: rhicks at nospam.rma.edu (Robert Hicks)
Date: Wed, 19 Apr 2000 00:59:18 GMT
Subject: o'rielly python devcenter
References:  <38FCF25E.4D945D81@oreilly.com>
Message-ID: 

Do I write an article and then just email it to you?

Bob

"Stephen R. Figgins"  wrote in message
news:38FCF25E.4D945D81 at oreilly.com...
> It isn't old news, it just went public last night(Monday) Sort of a soft
> launch, as I don't have much in the way of content up yet.  But I am
> working on that problem!  I will have some original articles in a couple
> of weeks.
>
> The Network is actually a subsidiary of O'Reilly & Associates, and I am
> plenty happy to plug other's books.  (Actually I think the only book I
> have linked right now is the venerable Programming Python, and that is
> just because I mentioned it in me introduction.)
>
> The links I am building under topics are not links to other sites, but
> rather to documents on other sites.  I am looking for tutorials,
> articles, documentation, anything good and juicy with information.  I am
> open to suggestions.
>
> And I like criticism, particularly the constructive kind.  So send me
> plenty.
>
> And if any of you want to line up for writing some good articles for me,
> I am paying!
>
> Stephen R. Figgins
> Editor, O'Reilly Network




From lars.lundstedt at telia.com  Tue Apr 25 13:21:21 2000
From: lars.lundstedt at telia.com (Lars Lundstedt)
Date: Tue, 25 Apr 2000 17:21:21 GMT
Subject: Don't understand error message
Message-ID: 

I'm halfway through "Learning Python" and I'm stuck on the example on page
255.

It goes like this:

import sys, glob, operator
print sys.argv[1:]
sys.argv = reduce(operator.add, map(glob.glob, sys.argv))
print sys.argv[1:]

When called with "python glob.py *.py" on Win98 I'm supposed to get a list
of all .py files in the current directory but instead I get:

Traceback (innermost last):
  File "glob.py", line 1, in ?
    import sys, glob, operator
  File "glob.py", line 3, in ?
    list = reduce(operator.add, map(glob.glob, '*.py'))
TypeError: call of non-function (type module)

Anyone know why?

/LasseLu





From talon at coursen.ifu.net  Sat Apr 15 12:55:13 2000
From: talon at coursen.ifu.net (Stephen Coursen)
Date: Sat, 15 Apr 2000 16:55:13 GMT
Subject: (no subject)
References: <001f01bfa6f8$b05dc9e0$69ee85ce@default>
Message-ID: 

On Sat, 15 Apr 2000 09:35:41 -0700, Pepper-Emporium  
wrote:
>This is a multi-part message in MIME format.
>
>------=_NextPart_000_001C_01BFA6BD.F6F75FA0
>Content-Type: text/plain;
>	charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>PLEASE HELP:
>
>I'm getting irate e-mails from people on my list indicating that when =
>ever they send a message is bounces back to them instead of me. My list =
>is called "hotlist" and I have about 27,000 members.
>
>I want to REMOVE ALL the members and start with a clean slate.=20
>
>Whenever I try to login to MAILMAN I get the following error message:
>Bug in Mailman version 2.0beta2
>
>We're sorry, we hit a bug!
>If you would like to help us identify the problem, please email a copy =
>of this page to the webmaster for this site with a description of what =
>happened. Thanks!=20
>
>Traceback:
>
>Traceback (innermost last):
>  File "/usr/local/mailman/scripts/driver", line 89, in run_main
>    main()
>  File "/usr/local/mailman/Mailman/Cgi/admin.py", line 68, in main
>    mlist =3D MailList.MailList(listname)
>  File "/usr/local/mailman/Mailman/MailList.py", line 69, in __init__
>    self.Load()
>  File "/usr/local/mailman/Mailman/MailList.py", line 858, in Load
>    self.Lock()
>  File "/usr/local/mailman/Mailman/MailList.py", line 1300, in Lock
>    self.__lock.lock()
>  File "/usr/local/mailman/Mailman/LockFile.py", line 209, in lock
>    os.link(self.__lockfile, self.__tmpfname)
>OSError: [Errno 28] No space left on device
>
>
I'm gonna go out on a limb here and say that there's no space left on the
device (see the error message says so :) ).  Most likey, what every drive
mailman is using is filled up and you need to make some room (or move the
mailman installation to a different drive).

That would be the first thing to address and is probably the root of the
problem.

HTH,
Steve

[the rest snipped]


From moshez at math.huji.ac.il  Thu Apr 20 09:34:07 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Thu, 20 Apr 2000 16:34:07 +0300 (IDT)
Subject: Confused by List behavior
In-Reply-To: <8dmqsd$6m0$1@nnrp1.deja.com>
Message-ID: 

On Thu, 20 Apr 2000 ejbaker_seekonk at my-deja.com wrote:

> As a python newbie, I entered this script to explore list processing
> behaviours.
> 
> yy = dir()
> for element in yy:
>   print element
> 
> for element in yy:
>   print dir(element)
> 
> The first 'for' loop works as expected. It returns,
> ['__builtins__', '__doc__', '__name__'].
> 
> The second loop, however, returns three empty lists. For the life of
> me, I can't understand that. Becauese, if I type 'dir(__builtins__)',
> in a script, I get all of the elements of __builtins__.
> 
> Can anyone explain this?

Hint: what happens if you type dir('__builtins__')?

thank-god-this-isn't-tcl-ly y'rs, Z.
--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From johngrayson at home.com  Mon Apr 24 06:35:09 2000
From: johngrayson at home.com (johngrayson at home.com)
Date: Mon, 24 Apr 2000 10:35:09 GMT
Subject: Tkinter.Button error
References: <3903E8C1.39B3E3D7@swt.edu>
Message-ID: <8e180t$46d$1@nnrp1.deja.com>

In article <3903E8C1.39B3E3D7 at swt.edu>,
  ABC  wrote:
> I have two frames
> top frame and bottom frame.
> In the top frame I implemented a group.
> Now, when I try to add Tkinter.Buttomn widget in the group in the top
> frame it gives error . Can anyone help me and tell me what the error
is?
>
> Here is the code
>
> frame1=Frame(master, relief=sunken', borderwidth='2')
> frame2=Frame(master, relief='sunken', borderwidth='1')
>
> frame1.place(relx=0, rely=0, relwidth=1, relheight=0.50)
> frame2.place(relx=0. rely=0.50, relwidth=1, relheight=0.50)
>
> group1=Pmw.Group(frame1, tag_text="Hello")
> group1.pack(fill='both')
>
> button=Tkinter.Button(group1.interior(), text='8.00')
> button.pack()
>
> The above program gives an error in TKinter in the second last line.
> I have no clue of what the error is? Can anyone help me?
> Need futher information, please let me know.
>
>

You probably have:

from Tkinter import *

Since your Frame constructors do not use Tkinter.Frame,
I'd guess:

button=Button(group1.interior(), text='8.00')

will work.

    John


Sent via Deja.com http://www.deja.com/
Before you buy.


From M_Pope at shef.rage.co.uk  Mon Apr 10 11:19:42 2000
From: M_Pope at shef.rage.co.uk (Mark Pope)
Date: Mon, 10 Apr 2000 16:19:42 +0100
Subject: Extending built-in language (Win 95)
Message-ID: <213CDEBFDDA7D3118081009027E40C56071118@SHEF-MS1>

> From: Martin von Loewis [mailto:loewis at informatik.hu-berlin.de]
> 
> Mark Pope  writes:
> 
> > I would like to extend the objects available in python, 
> however It is not
> > appropriate to build normal extension dll's.
> 
> Why is it not appropriate? It works perfectly well to add new types in
> an extension module. Many extensions do.

Ah, didn't realise that modules built into the LIB. (I'm new to python)

> The new type becomes only available by means of creation of
> values. Look at the file type. Do you write
> 
> f = file('foo.txt','w')
> 
> ? No, you use open() instead, which just returns an instance of a file
> object. In the xxmodule, xx_new is used to make new instances, which
> can be called from Python as xx.new().

I've added xxmodule to the lib and recompiled. Entering:
a = xx.new()

just gives a name error on xx.

Have I missed something?


(thanks for helping)

mark.



From jbauer at rubic.com  Sat Apr  8 19:53:51 2000
From: jbauer at rubic.com (Jeff Bauer)
Date: Sat, 08 Apr 2000 18:53:51 -0500
Subject: ANN: Rio MP3 player interface
Message-ID: <38EFC68F.48B2449B@rubic.com>

I've written a Python interface to the Diamond Rio
MP3 player.  It works on Windows 95, 98, NT and
probably 2000.  The interface only works with the
parallel port versions of the Rio at present, but
will (probably) soon support the USB versions.

ftp://starship.python.net/pub/crew/jbauer/py_rio_latest.zip

I'll put up some web pages soon.  Any feedback 
is welcome.

The code is based on the work of the Snowblind
Alliance: http://www.world.co.uk/sba/rio.htm

If you own a portable MP3 player, you might want
to check them out, if for no other reason than
they appear to be irritating the Diamond droids:

http://www.wired.com/news/culture/0,1284,17529,00.html

"We're not happy," said Ken Wirt, vice president of
corporate marketing for Diamond Multimedia Systems.


Jeff Bauer
Rubicon Research



From gresham at mediavisual.com  Wed Apr 12 10:42:01 2000
From: gresham at mediavisual.com (Paul Gresham)
Date: Wed, 12 Apr 2000 22:42:01 +0800
Subject: XML-RPC and None objects
References: 
Message-ID: <8d21vt$hut1@imsp212.netvigator.com>

Excuse my ignorance Peter, but is this the package I should look at if I
want
to serve a Wap application?
Regards

"Peter Funk"  wrote in message
news:m12fNMH-000CnCC at artcom0.artcom-gmbh.de...
> Hi!
>
> XML-RPC  is a very nice vehicle to build
> distributed server/client systems.  Fredrik Lundhs xmlrpc package
> available at  provides
> everything you need to build clients and servers in Python.
>
> But the current XML-RPC specification has a serious problem, which
> was pointed out over a year ago by Skip Montanaro in the XML-RPC
> discussion forum:
>
> > Some time ago the subject of supporting discriminated null data in
> > XML-RPC was brought up and apparently dropped. I just checked the
> > spec and didn't see anything new. I scanned back through a couple
> > pages of topics but didn't see anything there either.
>
> > I'm busy using XML-RPC to communicate between front-end Python
> > and Perl stuff (CGI scripts, modules published through
> > ZopeHTTPServer or Mason components) and back-end Python stuff
> > (databases). The biggest problem I've encountered when converting
> > existing code to use XML-RPC is identifying and converting cases
> > where I use Python's None object. I have to figure out how it's used in
> > the caller and callee, then figure out a reasonable replacement. The end
> > result is usually that my code isn't as clear as it used to be and that
I
> > wind up adding the occasional extra bug to my code (as if I don't have
> > enough bugs to squash already).
>
> >  I would *really* like to see a  or  data type
> > added to XML-RPC. 
>
> I stumbled into the same problem and since I currently use XML-RPC only
> between my own server and clients I decided to ignore the official
> specification and added a 'None'-handler to my version of Fredrik Lundhs
> library.  The needed patch is indeed very very simple:  Add the following
> lines to the class 'Marshaller' in 'xmlrpclib.py' you are done:
>
>     def dump_None(self, none):
>         self.write("\n")
>     dispatch[NoneType] = dump_None
>
> Since the class 'Unmarshaller' already returns 'None' for all unknown
values
> a modification there is not required.  This works fine for me.  YMMV.
>
> Regards, Peter
> --
> Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49
4222950260
> office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)
>




From Richard.Jones at fulcrum.com.au  Wed Apr 19 18:23:19 2000
From: Richard.Jones at fulcrum.com.au (Richard Jones)
Date: Thu, 20 Apr 2000 08:23:19 +1000
Subject: Dynamic web pages! not Dynamic HTML 
In-Reply-To: Message from Sunil Hadap of 2000-Apr-19 20:52:2,
            <38FE0052.4BE78518@cui.unige.ch> 
Message-ID: <200004192223.IAA10606@envy.fulcrum.com.au>

[Sunil Hadap]
> I am really dumb in databases and perl. I am good at python and it's
> my scripting language for whatever I do in graphics. I want to start
> doing my homepage which is inspired from
> 
> http://www.photo.net/photo/
> 
[snip] 
> 
> I want to do this in Python. Is zope useful for this, I don't want to
> learn a big system as I only want few specific functions only. Which
> free database?

   What system are you running? If it's RedHat Linux (or similar) then you'll 
already have a relational database at your fingertips. You will need to figure 
out the basics of using it. If you have a reasonable number of photos (say < 
10,000) then you could even use gadfly, the Python RDBMS!

   Phil has spent quite a lot of time developing that site (Tcl over a 
relational database) - and you should expect to spend some time on it also. 
That's assuming he won't just give you his code :)

   I would suggest that you develop a Zope site - for three reasons:
   . it'll make using a "real" database much simpler thanks to Zope's 
easy-as-pie SQL methods. Remember, Zope comes with gadfly bundled in the box.
   . you'll automatically get access to a bunch of public-contributioned prior 
art: guestbooks, news pages, FAQ handlers and so on. See the member area on 
www.zope.org for a taste.
   . once you're done, you can make the Zope products you generate available to 
others so they can put up their photos too!

   What you describe with the @photo tag in a "sorta HTML" page is actually 
going to be quite simple to do in Zope. Ask around on the zope mailing lists if 
you're stuck - they're all quite helpful people over there :)


       Richard





From nmm1 at cus.cam.ac.uk  Tue Apr  4 15:25:57 2000
From: nmm1 at cus.cam.ac.uk (Nick Maclaren)
Date: 4 Apr 2000 19:25:57 GMT
Subject: What is python's language level?
References: <38EA1B8F.A797A130@lmco.com> 
Message-ID: <8cdfk5$58s$1@pegasus.csx.cam.ac.uk>

In article ,
Warren Postma  wrote:
>
>"Chuck Meyers"  wrote in message
>news:38EA1B8F.A797A130 at lmco.com...
>> Does anyone know python's language level? I did not find it in the list
>> at:
>
>Cheap guess; Perl is a 15, so we'll take the Perl number.

Well, considering that the whole thing smacks of a marketing
exercise, the level that you get may be what you pay for :-)

>Two things that make me laugh about this:

Only two?  I noticed three major factual errors and a host of known
lunatic classifications in just a quick glance.  Compare Algol 68,
Fortran 66, Basic and so on for a good giggle.

There was some serious work done in this area in the 1970s, and
the conclusions included the obvious one that a single level didn't
make a lot of sense.  If I remember correctly, other results
included:

    Higher is better if it doesn't stop you doing what you need to,
and is suited to the application domain.

    Very strong checking slows down time to the first demonstration
and speeds up time to the first stable version.

    Any language is bad if it is incomprehensible or too full of
"gotchas".

The expressions "motherhood and apple pie" and "so what else is
new?" spring to mind - though point 2 is very much out of fashion
at present, especially in the C and Java community.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679


From ns56645 at swt.edu  Mon Apr 24 11:56:00 2000
From: ns56645 at swt.edu (ABC)
Date: Mon, 24 Apr 2000 10:56:00 -0500
Subject: Tkinter.Button error
References: <3903E8C1.39B3E3D7@swt.edu> <8e180t$46d$1@nnrp1.deja.com>
Message-ID: <39046E90.4D4F89EF@swt.edu>

Yep,

That worked



From effbot at telia.com  Fri Apr 14 14:38:08 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Fri, 14 Apr 2000 18:38:08 GMT
Subject: No strides? (was Re: List mapping?)
References: <38f5d68e@news.xtml.co.uk> <38F75F7D.1C73D177@labs.agilent.com>
Message-ID: 

David Smith  wrote:
> Why aren't strides implemented for slices of lists and tuples?  I would
> have liked to suggest
>
> map( None, a[0::2], a[1::2] )

someone has to write the code...

feel free to send your favourite implementation to
patches at python.org (see python.org for more info
on how to submit patches).






From mwh21 at cam.ac.uk  Wed Apr 12 14:26:10 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 12 Apr 2000 19:26:10 +0100
Subject: Python paradigms
References: <000401bfa1dd$930fe500$172d153f@tim> <8d2ejs$jfr$1@nyheter.chalmers.se>
Message-ID: 

d98aron at dtek.chalmers.se (Fredrik Aronsson) writes:

> In article <000401bfa1dd$930fe500$172d153f at tim>,
> 	"Tim Peters"  writes:
> >    (a() and [b()] or [c()])[0]
> > 
> 
> Just a litte thougth, can't I just use (a() and b()) or c() ?

Not if b() returns false.

"(1 and 0 or 2)==2"-ly y'rs
M.

-- 
  On the other hand,  the following areas are subject to boycott
  in reaction to the rampant impurity of design or execution, as
  determined after a period of study, in no particular order: 
    ...                            http://www.naggum.no/profile.html


From alex at somewhere.round.here  Tue Apr 11 10:21:16 2000
From: alex at somewhere.round.here (Alex)
Date: 11 Apr 2000 10:21:16 -0400
Subject: Why should I switch to Python?
References:    
Message-ID: 

>> I always suspected perl programmers were from Mars.  Now if we could
>> figure out where python programmers are from, someone could write a
>> book and get rich.
> 
> Yorkshire.

"Perl Programmers are from Mars, Python Programmers are from Yorkshire?"
Catchy title.

Alex.


From nick at spam_me_notvideosystem.co.uk  Thu Apr 13 14:00:59 2000
From: nick at spam_me_notvideosystem.co.uk (Nick Trout)
Date: Thu, 13 Apr 2000 19:00:59 +0100
Subject: How do I execute a program ?
References: <20000413163828.28296.qmail@web4303.mail.yahoo.com>
Message-ID: <38f60cb6@news.xtml.co.uk>

import os
exit_status = os.system('blah.exe')


"Daniel Zapata"  wrote in message
news:20000413163828.28296.qmail at web4303.mail.yahoo.com...
> How do I execute a program or a batch file (under
> Windows) using python and get the return information
> ???
>
>
> Thanks,
>
> Daniel
>
> ____________________________________________________________________________
> YAHOO! BATE-PAPO
> Conhe?a gente nova, fa?a amigos e divirta-se! - http://www.yahoo.com.br
>




From soundhack at hotmail.com  Thu Apr 20 21:29:53 2000
From: soundhack at hotmail.com (Robert)
Date: Thu, 20 Apr 2000 21:29:53 -0400
Subject: Why MFC instead of Tkinter -- was Re: Pythonwin?
References:  <4QtL4.24$v85.41@news-server.bigpond.net.au>  <7LDL4.534$v85.2563@news-server.bigpond.net.au>  <38ff21b8$0$10972@senator-bedfellow.mit.edu> <38FF281E.5B2DCC71@tismer.com> <38ff823d$0$10971@senator-bedfellow.mit.edu> 
Message-ID: <38ffafc0$0$10979@senator-bedfellow.mit.edu>

Fredrik Lundh wrote in message ...
>Robert  wrote:
>> (and I assume) Delphi has similar and probably even easier editors, but
>the
>> fact remains that (to me) wysiwyg editing is better than layout managers.
>
>just like refrigerators are better than car stereos?


since I have the former and not the latter, yes :)

>
>not all wysiwyg tools restrict you to drawing things on a
>coordinate grid, you know...


yup, I havent seen any (tho i havent been looking too hard) but sure, there
is nothing about layout managers that precludes a graphical tool from
generating code.
If you know of any that are as polished as VC/VB's then I'ld be happy to try
them out.

On a more design issue, how can you guarantee that a UI looks exactly the
way you want to without using coordinates? I have some UIs that require lots
of different sized controls that do not fit a neat NSEW or table/matrix
spatial organization.

Robert




From mhammond at skippinet.com.au  Wed Apr 19 22:18:35 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Thu, 20 Apr 2000 02:18:35 GMT
Subject: COM and returning dates
References: <8dkj9b$lvr$1@gxsn.com>
Message-ID: <%NtL4.21$v85.112@news-server.bigpond.net.au>

Look up the documentation for pythoncom.MakeTime() - this will create a
time object from a time represented by the standard Python "time" module.
Create and pass one of these objects to COM as a date/time value.

mxDateTime objects can also be converted to COM date/times, so this is
another alternative.

Mark.

"Richard Chamberlain"  wrote in message
news:8dkj9b$lvr$1 at gxsn.com...
> Hi,
>
> I'm trying to use Python as a COM object (called from VB) basically
> returning values from a database, some of which are dates.
>
> The problem I'm getting is that the dbi date object obviously doesn't
> translate.
>
> So is there a way a can simply do this?
>
> I was thinking of running through the list and converting the dbi date
> objects into string representations and passing those. But I'm not sure
what
> I do with them on the VB side.
>
> Any better ideas?
>
> Thanks
>
> Richard
>
>




From mwh21 at cam.ac.uk  Wed Apr  5 12:18:46 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 05 Apr 2000 17:18:46 +0100
Subject: reload imported module
References: <05fd01bf9f18$6e5a33e0$01ffffc0@worldnet.att.net>
Message-ID: 

"Emile van Sebille"  writes:

> I'm testing a new class in its own module from within
> idle.  Is there a way to reload y after having done:
> 
>     from x import y

reload(sys.modules['x']); from x import y

I don't think there's any feasible way to automate this.
 
> or is it easiest to just import x and reload it?

Yes.  This works too:

import module_with_really_long_name

mwrln = module_with_really_long_name

... use mwrln ...

reload(mwrln)

... use updated version ...

Cheers,
M.

-- 
  well, take it from an old hand: the only reason it would be easier
  to program in C is that you can't easily express complex  problems
  in C, so you don't.                   -- Erik Naggum, comp.lang.lisp


From jorn at spekter.no  Thu Apr 27 06:31:31 2000
From: jorn at spekter.no (=?iso-8859-1?Q?J=F8rn?= Eilertsen)
Date: Thu, 27 Apr 2000 12:31:31 +0200
Subject: python + linux + cron = problem
Message-ID: <39081703.48B64D1A@spekter.no>

Hi,

I've posted this earlier but noone replied so I'm trying again

I have this small program which includes the following line og code:
 mounts = commands.getoutput('df | grep eggum | cut -d 1 -f 1 | cut -d /
-f 4')

this runs fine from the commandline but when run as a cronjob I get the
following error:

File "/usr/lib/python1.5/commands.py", line 42, in getoutput
    return getstatusoutput(cmd)[1]
  File "/usr/lib/python1.5/commands.py", line 53, in getstatusoutput
    sts = pipe.close()
IOError: (10, 'No child processes')

The use of pipes seems to be the trouble here.

Any help on how the get around this would be greatly appreciated.

Thanks,
Jorn





From kcazabon at home.com  Wed Apr 26 00:24:41 2000
From: kcazabon at home.com (Kevin Cazabon)
Date: Wed, 26 Apr 2000 04:24:41 GMT
Subject: Simple list.append() question
References:   <39046FA2.603EAFE5@roguewave.com>  <8e4akc$p7o$1@newshost.accu.uu.nl>
Message-ID: 

Aw, comon, I was having fun... q:]


"Martijn Faassen"  wrote in message
news:8e4akc$p7o$1 at newshost.accu.uu.nl...
> Kevin Cazabon  wrote:
> > well, if not prettier, why not obfuscate it?  q:]  Although this isn't
> > pretty, I'm sure we can make it a little less intelligable with some
work.
>
> > entire_list = [];for i in range(3):entire_list.append([])
>
> If you write it the normal way:
>
> entire_list = []
> for i in range(3):
>     entire_list.append([])
>
> It's pretty, readable, flexible, and it works. The only disadvantage is
> that it's less short. But I'm willing to pay that price in this situation.
>
> Generally it's a good idea to avoid * on sequences, unless that sequence
is
> immutable and contains immutable things; i.e. strings. I don't recall
> using * on tuples ever, but you can do so safely if the tuple contains
> immutable things only.
>
> Is there any useful way to use * on lists that I missed? Usually we want
> the copy semantics here, not the reference semantics. Perhaps it's a good
> idea to completely forbid * on lists in p3k? Tuples too for all I care.
> Then again I may be missing important uses, so enlighten me.
>
> Regards,
>
> Martijn
> --
> History of the 20th Century: WW1, WW2, WW3?
> No, WWW -- Could we be going in the right direction?




From gansevle at cs.utwente.nl  Thu Apr 13 10:23:19 2000
From: gansevle at cs.utwente.nl (Fred Gansevles)
Date: Thu, 13 Apr 2000 16:23:19 +0200
Subject: Redirecting the output from sys.stdout
References: <2B1262E83448D211AE4B00A0C9D61B03BA7296@MSGEURO1>
Message-ID: <38F5D857.F11B0B4A@cs.utwente.nl>

Pieter Claerhout wrote:

> Hello,
>
> I want to run a DOS command from Python, and I want to redirect the output of
> that command to a variable. Anyone a suggestion on how to accomplish this? The
> output of the command should not be shown on the screen.
>
> Kind regards,
>
> Pieter
>
> [ Pieter Claerhout :: CreoScitex Response Centre :: Applications support ]
> [ Pieter_Claerhout at creoscitex.com    ::    http://www.creoscitex.com/ ]
> [ CreoScitex Europe  ::   Excelsiorlaan 21   ::  1930 Zaventem  ::   Belgium ]

My favorite:

    def run (*args, **kw):
        import win32pipe
        command = string.join (args)
        i, o, e = win32pipe.popen3 (command)
        if kw.has_key ('send'):
            i.write (kw['send'])
        i.close ()
        out = o.read ()
        err = e.read ()
        return out    # discard stderr output

    ...

    bat_files = run ("dir /s *.bat")

___________________________________________________________________________
 Fred Gansevles  Phone: +31 53 489 4613
        >>> Your one-stop-shop for Linux/WinNT/NetWare <<<
 Org.: Twente University, Fac. of CS, Box 217, 7500 AE Enschede, Netherlands
            "Bill needs more time to learn Linux" - Steve B.



From rumjuggler at home.com  Fri Apr 14 18:19:26 2000
From: rumjuggler at home.com (Ben Wolfson)
Date: Fri, 14 Apr 2000 22:19:26 GMT
Subject: for item in some_class_object...
Message-ID: <4j6ffs0b6ins12qq559q07u28pc6o0mc9l@4ax.com>

What special methods should I define for a class if I want to support
a for item in ... syntax for it?

-- 
Barnabas T. Rumjuggler al-Mumit

Further-more, I have long since put the finishing touches on my own
official obituary, a 350-page tale of heart-rending loss which
details, among other things: my meteoric rise from Onion stringer to
editor to publisher; my assassination at the hands of lady-actress
Ethel Barrymore's jealous suitors; the thousand days of mourning which
followed my death, during which a cold rain fell constantly, no bird
sang, and children were born antlered and hooved; ...
 -- T. Herman Zweibel


From DOUGS at oceanic.com  Sat Apr 29 12:58:10 2000
From: DOUGS at oceanic.com (Doug Stanfield)
Date: Sat, 29 Apr 2000 06:58:10 -1000
Subject: newbie   dbase dataaccess
Message-ID: <8457258D741DD411BD3D0050DA62365907A12D@huina.oceanic.com>

You're starting on an ambitious project.  I find what works for me is to
simplify all the elements of such a project until they are done trivially.
If I've successfully modularized things I can then improve each piece after
I've got a working prototype.  For the data store the progression of
improvement might be a set of flat files, a db file using the 'shelve'
module, and then maybe start to learn Gadfly as a database backend.
Learning to use SQL in a new database package at the same time working out
program logic and learning Python would be enough to squelch my
motivation:-)

speaking-from-current-experience'ly yr's -Doug-

> -----Original Message-----
> From: Georg Hammerbacher [mailto:don.limpio at gmx.net]
> Sent: Friday, April 28, 2000 4:17 AM
> To: python-list at python.org
> Subject: Re: newbie dbase dataaccess
> 
> 
> Hello Anders,
> 
> thanks for your guess.
> 
> The thing inside my head is to write an adressmanager
> - which is the *central* adressbook
> - who works under Windows and Linux
> - has an GUI Interface
> this are the features for the beginning.
> 
> my dream is (under the GPL licence), to expand this piece of 
> software and
> integrate the good Features of MS-Outlook and Lotus 
> Organizer. (comments are
> welcome)
> 
> I?ve found "gadfly" for databasing. Is it really so good as it seems??
> 
> Thanks
> Georg
> 
> 
> Anders M Eriksson  
> schrieb in im
> Newsbeitrag: mtiigskn8uumhk94rklnr2fdealunasoot at 4ax.com...
> > On Thu, 27 Apr 2000 11:40:46 +0200, "Georg Hammerbacher"
> >  wrote:
> >
> > >Hello everybody,
> > >
> >
> > Hello Georg!
> >
> > >I?m just new in programming Python and now I want to make 
> my own personal
> > >adressmanager with a simple dBase-file.
> > >How can I get access to it or where can I find more info?s 
> about using
> > >dbase-files within Python?
> > >
> > First: Why do you want to use dBASE as the database format?
> >
> > I haven't found any good dBASE interface for Python. So if 
> you want to
> > use the dBASE format you need to use ODBC and then you hopefully are
> > on a computer that runs unders Windows NT/98.
> >
> > If you don't NEED to use dBASE then look at
> > http://www.python.org/topics/database/ here you will find 
> alot of info
> > about how to use Python for accessing databases....
> >
> > // Anders
> >
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 



From mwh21 at cam.ac.uk  Tue Apr 11 06:26:05 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 11 Apr 2000 11:26:05 +0100
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com>  <87r9cdhdb0.fsf@deneb.cygnus.argh.org>
Message-ID: 

Florian Weimer  writes:

> nascheme at enme.ucalgary.ca (Neil Schemenauer) writes:
> 
> > I would rather get the bugs stomped out of my patch and get it
> > included in 1.6 or 1.7.  We can then remove the FAQ entry.  :)
> 
> Is it possible to extend your GC in a way which would permit the
> execution of several bytecode interpreters in multiple threads?

Eh?

-- 
  please realize that the Common  Lisp community is more than 40 
  years old.  collectively, the community has already been where 
  every clueless newbie  will be going for the next three years.  
  so relax, please.                 -- Erik Naggum, comp.lang.lisp


From francesco.contini at tiscalinet.it  Sun Apr  9 20:44:04 2000
From: francesco.contini at tiscalinet.it (FrancescO)
Date: Mon, 10 Apr 2000 02:44:04 +0200
Subject: The gzip module... neverending story
Message-ID: <8cr7os$du3$1@lacerta.tiscalinet.it>

Hello!,
I have, another questions!!
How can I zip i list of files? (i have done it, but... the files can't be
readed from winzip and gunzip...)

Wich is the correct usage of the fileobj (4th parameters in the
gzip.GzipFile.. explain..:
GzipFile ([filename[, mode[, compresslevel[, fileobj]]]]) )?

Is the name of the zipfile? what kind of object is it?
i'have try in a lot of ways to call this object, but I'm not "good" to work
it with the 4th parameter please...

HELP ME...!!!!






From phd at phd.russ.ru  Mon Apr 10 09:12:41 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Mon, 10 Apr 2000 13:12:41 +0000 (GMT)
Subject: Python paradigms
In-Reply-To: <8csbab$1422@newton.cc.rl.ac.uk>
Message-ID: 

On Mon, 10 Apr 2000, Richard Brodie wrote:
> If this were always the case, why does Python have an interactive mode?

   This is for beginners - to try out few simple things :)

> The Fast
> Fourier Transform is one of the classic algorithmic optimisations but
> produces obscure code. Likewise most of the standard fast sorting
> algorithms.

   Yes. And you cannot comment every line of code - your code in that case
should be acomplished with math details (not programming details).

Oleg.
---- 
    Oleg Broytmann    http://members.xoom.com/phd2.1/    phd2 at earthling.net
           Programmers don't die, they just GOSUB without RETURN.




From greg at cosc.canterbury.ac.nz  Thu Apr 27 00:50:03 2000
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Thu, 27 Apr 2000 16:50:03 +1200
Subject: List comprehensions?
References: <000601bfae79$41485b00$152d153f@tim> 
Message-ID: <3907C6FB.A418A32D@cosc.canterbury.ac.nz>

Remco Gerlich wrote:
> 
> Tim Peters wrote in comp.lang.python:
> > [Remco Gerlich]
> > > I thought list comprehensions had been in CVS for quite a while, so I
> > > expected them to be in 1.6. ...
> >
> > Greg Ewing's patch (against 1.5.2) for list comprehensions is all there is,
> > and you'll have to get that from Greg (see DejaNews for his announcement,
> > and his URL).

Skip Montario (skip at mojam.com) has recently informed me that he has
updated
my patch to work with 1.6a2, and is going to try to get it included
officially.

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+


From neelk at brick.cswv.com  Tue Apr 18 19:37:06 2000
From: neelk at brick.cswv.com (Neel Krishnaswami)
Date: 18 Apr 2000 23:37:06 GMT
Subject: Project idea - python
References:  <38FC0E72.9AB025DB@webwitches.com>  
Message-ID: 

Bob Schmertz  wrote:
> 
> SPARK - sounds like a Python implementation of Yacc/Bison, though from
> what I can tell it doesn't handle complex grammars such as LR
> (http://www.csr.UVic.CA/~aycock/python/)
 
SPARK uses the Earley parsing algorithm, which can parse *any* context
free grammar, even if the grammar is ambiguous or otherwise wonky.

IIRC, Earley parsers have the neat property of being "adaptive" --
their performance is O(n) on LL/LR grammars, rising up to O(n**3) for
pathologically ambiguous grammars. This generality doesn't come for
free, though -- the extra overhead in data structures tends to reduce
their speed by roughly a factor of 10 versus the usual algorithms for
simple grammars.

But for this modest price you can specify the grammar that most
naturally generates your language, rather than going through weird
contortions needed to satisfy Yacc. :)


Neel


From tim.hochberg at ieee.org  Mon Apr 24 18:13:41 2000
From: tim.hochberg at ieee.org (Tim Hochberg)
Date: Mon, 24 Apr 2000 22:13:41 GMT
Subject: sys.exit
References: <3904C35C.B16BDE75@mindspring.com>
Message-ID: 

> The long story:
>
> I have a try..except like so:
>
> try:
>     execfile(filename, namespace)
> except:
>     # handle problems


Try something like

try:
   # whatever
except SystemExit, err:
    if err.args in  [(0,), ()]: # sys.exit called as sys.exit(0) or
sys.exit()
        # exit cleanly
    else:
        # log error
except:
    # handle any remaining errors.


Enjoy,

-tim






From effbot at telia.com  Wed Apr 12 12:25:32 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Wed, 12 Apr 2000 16:25:32 GMT
Subject: Python idiom: Multiple search-and-replace
References: <20000412100816.A2431031@vislab.epa.gov><5C%I4.645$rc9.190288896@newsb.telia.net> <20000412120012.D2446939@vislab.epa.gov>
Message-ID: <0s1J4.655$rc9.190631424@newsb.telia.net>

Randall Hopper  wrote:
> Thanks!  It's much more efficient.  The 140 seconds original running time
> was reduced to 11.6 seconds.  I can certainly live with that.

thought so ;-)

while you're at it, try replacing the original readline loop with:

    while 1:
        lines = fp.readlines(BUFFERSIZE)
        if not lines:
            break
        lines = string.join(lines, "")
        lines = re.sub(...)
        out_fp.write(lines)

where BUFFERSIZE is 1000000 or so...






From aa8vb at yahoo.com  Tue Apr 18 07:20:54 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Tue, 18 Apr 2000 07:20:54 -0400
Subject: Starship dead (again)?!
In-Reply-To: <38FC39F1.21DD2D75@darwin.in-berlin.de>
References: <38FC39F1.21DD2D75@darwin.in-berlin.de>
Message-ID: <20000418072054.A416925@vislab.epa.gov>

Dinu C. Gherman:
 |I can't get anything from http://starship.python.net or
 |http://starship.python.net:8080 for more than a day, now.
 |Is that some known problem?
 |
 |This seems to happen ever more frequently. Does somebody
 |simply pull the plug, or is there another, better, reason?

Reposted message:
==============================================================================

Subject: Re: Here is some starship.python.net news
Author:  Manus Hand 
Date:    2000/04/17
Forum:   comp.lang.python

Here is some more news.  Everyone cross your fingers for the starship's
disk.

Manus

Reply-To: "Paul Wolotsky" 
Date: Mon, 17 Apr 2000 05:04:22 -0400
Organization: Medical Computer Systems

...My understanding from my NOC technicians is that the primary disk has
crashed in that machine - so perhaps there is a delay in someone coming in
to fix it in terms of them getting a replacement disk, etc.  I will let you
know tomorrow when I return to the office - if there is something that you
can do I will advise at that time!!!  Thanks for the offer.

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

--
Randall Hopper
aa8vb at yahoo.com



From tuttledon at hotmail.com  Fri Apr 14 15:49:46 2000
From: tuttledon at hotmail.com (Don Tuttle)
Date: Fri, 14 Apr 2000 19:49:46 GMT
Subject: Getting file version information
References: <20000413163629.28006.qmail@web4303.mail.yahoo.com> <81wJ4.811$1D.5094@news-server.bigpond.net.au>
Message-ID: 

> You may be forced to using calldll (www.nightmare.com) to call the API
> functions directly.

Speaking of Nightmare.com, I've been trying for 4 days to grab calldll but
there's no response.  Anyone know what happened to it?

Don




From michaelc at flashcom.net  Fri Apr 21 02:35:53 2000
From: michaelc at flashcom.net (Michael A. Crawford)
Date: Thu, 20 Apr 2000 23:35:53 -0700
Subject: Why MFC instead of Tkinter -- was Re: Pythonwin?
References:  <4QtL4.24$v85.41@news-server.bigpond.net.au>  <7LDL4.534$v85.2563@news-server.bigpond.net.au>  <38ff21b8$0$10972@senator-bedfellow.mit.edu>
Message-ID: 

I'm sorry I asked.

-Michael

"Robert"  wrote in message
news:38ff21b8$0$10972 at senator-bedfellow.mit.edu...
> To each his own I guess. I work mostly on Windows platforms, and for me
> MFC is a lot better than Tk for a couple of reasons.
> 1) I can port MFC/C++ programs a lot easier
> 2) I may be mistaken, but MFC based guis are faster than Tk
> 3) I really do not like using layout managers, and using Visual C++'s
dialog
> editor
> is the best thing since sliced bread IMHO.
>
> One suggestion for learning MFC fresh: don't read books that basically
teach
> you how to use Visual C++'s AppWizard. AppWizard is really nice and easy
to
> use but it basically automates so much of creating MFC programs that it
was
> hard (at least for me) to make the transition to a non-wizard MFC
> environment in python.
>
> Robert
>
> Michael A. Crawford wrote in message ...
> >I'm curious.  Why did you not steer him in the Tkinter direction for his
> GUI
> >needs?  Is MFC better?  I learned (and forgot MFC) some time ago, years
in
> >fact.  Same with X-Windows programming.  Now I'm working my way throught
> >"Python and Tkinter Programming" by Grayson.  I thought Tkinter was the
> >preferred method for Pythong GUI programming.  Am I mistaken?
> >
> >-Michael
>
>
>




From mwh21 at cam.ac.uk  Fri Apr 14 10:13:58 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 14 Apr 2000 15:13:58 +0100
Subject: Complaint Dept: My shoes!
References: <8d4s4d$mvr$1@nnrp1.deja.com> <38F72CE2.CB7B7C5D@att.net>
Message-ID: 

aflinsch  writes:

> musingattheruins at my-deja.com wrote:
> > 
> > If shoe is None then len(shoe) raises an exception.  Would be nice if
> > len(None) was 0 and NOT raise an exeption.
> > 
> 
> I think I would prefer it if len(None) returned None. Makes a bit more
> sense to me having an unsized object return None, rather than zero.

I would prefer that len(ob) raised an exception whenever it was passed
an `ob' that didn't have a well defined length (like None).

Second guessing what would be most helpful to the programmer smacks of
another p-language.

Is "ob and len(ob) or 0" too hard to spell?

always-willing-to-back-the-status-quo-in-cases-like-these-ly y'rs
m.

-- 
  On the other hand,  the following areas are subject to boycott
  in reaction to the rampant impurity of design or execution, as
  determined after a period of study, in no particular order: 
    ...                            http://www.naggum.no/profile.html


From c.evans at clear.net.nz  Wed Apr 12 06:31:18 2000
From: c.evans at clear.net.nz (Carey Evans)
Date: Wed, 12 Apr 2000 10:31:18 GMT
Subject: Processing BCD and Signed Integer Fields with Python
References: <38f334ea@wwwproxy3.westgroup.com>
	<8cvdel$lb9$1@pegasus.csx.cam.ac.uk>
	<38f33dca@wwwproxy3.westgroup.com>
Message-ID: <878zyjpq4p.fsf@psyche.evansnet>

"Chris Lada"  writes:

>  Being a newbie in python, I have to ask these questions: what functions can
> I use to process these fields ?  What can I use to separate the number from
> the sign ?   Is there a conversion for this type of data to strings ? What
> data types would they be ?

Here's some code that works with the kind of data I can get from our
IBM AS/400.  It could probably be more efficient, and your mainframe
might not be generating the same data formats, but it should give you
the right idea.

For example:

>>> packed2num('\x12\x34\x5f')
12345L
>>> zoned2num('\xf1\xf2\xd3')
-123L

--------------------
import array

def zoned2num(z):
    a = array.array('B', z)
    v = 0L

    for i in a:
        v = (v * 10) + (i & 0xf)

    if (a[-1] & 0xf0) == 0xd0:
        v = -v

    return v

def packed2num(p):
    a = array.array('B', p)
    v = 0L

    for i in a[:-1]:
        v = (v * 100) + (((i & 0xf0) >> 4) * 10) + (i & 0xf)

    i = a[-1]
    v = (v * 10) + ((i & 0xf0) >> 4)
    if (i & 0xf) == 0xd:
        v = -v

    return v
--------------------

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

"Validate me!  Give me eternal digital life!  Quote me in your .sigs!"
                                                             - djc in asr


From python at rose164.wuh.wustl.edu  Tue Apr  4 17:54:21 2000
From: python at rose164.wuh.wustl.edu (David Fisher)
Date: Tue, 4 Apr 2000 16:54:21 -0500
Subject: Two questions
References: <38EA5FE8.853E9B75@callware.com>
Message-ID: <01f801bf9e80$5a522a80$29dc9f26@unitedelectric>

----- Original Message ----- 
From: Ivan Van Laningham 
To: Python Mailing List 
Sent: Tuesday, April 04, 2000 4:34 PM
Subject: Two questions

> 2)  What stuff do I need to use msaccess with Python?  Do I need to use
> Win32all, or can I use Tkinter for my (minimal) GUI, with msaccess?

What do you want to do with ms access?

dnf




From effbot at telia.com  Mon Apr 10 16:49:58 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Mon, 10 Apr 2000 20:49:58 GMT
Subject: Jpython??
References: <955394930.758181@newdm.deskmedia.com>
Message-ID: 

Brock Noland  wrote:
> Hello   I am a web developer.. Well part time.  I can 'program' in HTML
and
> am interested in learning Java but I was told that I should learn Python
> first because it is a fairly newbie friendly language.  To the point I saw
a
> post about Jpython yesterday what is it??

www.jpython.org






From jvickroy at sec.noaa.gov  Wed Apr 19 09:46:15 2000
From: jvickroy at sec.noaa.gov (j vickroy)
Date: Wed, 19 Apr 2000 07:46:15 -0600
Subject: Python in the future
Message-ID: <38FDB8A7.E701F81F@sec.noaa.gov>

Hello all,

I'm relatively new to Python and am trying to gain support for it at my
work place.  To that end, I'm giving a brief (overview) presentation.
One of the items I have been asked to consider is where will Python be
5-10 years from now.  I certainly don't know where C++ or Java will be
in that time frame!  Any ideas on where to research the future plans for
Python would be appreciated.

Thanks for your time,

- jv



From ns56645 at swt.edu  Sat Apr 29 13:19:09 2000
From: ns56645 at swt.edu (ns56645)
Date: Sat, 29 Apr 2000 12:19:09 -0500
Subject: problem in python function --Name-error
Message-ID: <390B198D.7AC26774@swt.edu>

Hi,

I am sending you the whole code of my program as an attachment.  But the
error lies in def drawCanvas( ): I have emphasized the error. The error
says nameError frame1. The output of my program looks similar to
http://www.swt.edu/~ns56645.
Could you please help me with the error.






-------------- next part --------------
import sys
sys.path[:0] = ['../']



from Tkinter import *
import Pmw

class Schedule:

       def __init__(self,master):
	global mycourses
	mycourses = [1000, 1203, 3224, 1244, 3453, 3342, 2232, 2131, 2342, 2342, 2222, 5544, 5232]
	time = [8.00, 9.30, 11.00, 12.30, 2.00, 3.30, 5.00, 6.30]

#def create_frames(master):
    # relief and borderwidth arguments make frames visible

##############   Create four frames ##############################################

   	frame1 = Frame(master, relief='sunken', borderwidth=2)
    	frame2 = Frame(master, relief='sunken', borderwidth=1)
    	frame3 = Frame(master, relief='sunken', borderwidth=1)
    	frame4 = Frame(master, relief='sunken', borderwidth=1)

    	frame1.place(relx=0, rely=0, relwidth=1, relheight=0.70)
	frame2.place(relx=0, rely=0.70, relwidth=0.40, relheight=0.30)
    	frame3.place(relx=0.40, rely=0.70, relwidth=0.30, relheight=0.30)
    	frame4.place(relx=0.70, rely=0.70, relwidth=0.30, relheight=0.30)
       	
############### Canvas for Days in Frame 1 ##########################################

	self.days=Canvas(frame1,width=50, height=430, bg='white')
	self.drawDays()
	self.days.grid(row=0, column=0, rowspan=7, sticky=W+N)
	

################# Canvas for Time in frame 1 #########################################

	self.time = Canvas(frame1, width=800, height=30, bg='white')
	self.time = Canvas(width=600, height=30, bg='white')
	self.drawTime()
	self.time.grid(row=0, column=1)

############## DRAW CANVASES IN FRAME 1  ###############################################

	self.drawCanvas()

###################   COMBOBOX FOR COURSES IN FRAME 2    ################################################


        group = Pmw.Group(frame2, tag_text = 'Selection Criteria')
        group.pack(fill = 'both', expand = 1, padx = 15, pady = 10)

	# Create and pack the dropdown ComboBox.
        courses = [' ',4310, 5389, 4328,3358, 5310, 7000]
	dropdown1 = Pmw.ComboBox(group.interior(),
                label_text = 'Courses      ',
	        labelpos = 'w',
		listheight = 150,
#		buttonaspect = 2.0,
                #selectioncommand = self.changeColour,
		scrolledlist_items = courses,
        )
#	dropdown1.grid(row=1)
        dropdown1.pack(pady=5)

	# Display the first colour.
	first = courses[0]
	dropdown1.selectitem(first)
	#self.changeText(first)


###############  COMBOBOX FOR ROOMS  IN FRAME 2      #######################################################


	# Create and pack the dropdown ComboBox.
        rooms = [' ','DH241', 'DH113', 'DH240','DH213']
	dropdown2 = Pmw.ComboBox(group.interior(),
                label_text = 'Rooms       ',
	        labelpos = 'w',
                #selectioncommand = self.changeColour,
		scrolledlist_items = rooms,
        )
#	dropdown2.grid(row=2)
	dropdown2.pack()
	# Display the first colour.
	first = rooms[0]
	dropdown2.selectitem(first)
	#self.changeColour(first)

#################       COMBOBOX FOR PROFESSORS IN FRAME2        ################################


	# Create and pack the dropdown ComboBox.
        instruc = [' ','Davis', 'Mccabe', 'Kaikhah', 'Peng', 'Hall']
	dropdown3 = Pmw.ComboBox(group.interior(),
                label_text = 'Instructors ',
	        labelpos = 'w',
		hull_width=5,
                #selectioncommand = self.changeColour,
		scrolledlist_items = instruc,
        )
#	dropdown2.grid(row=2)
	dropdown3.pack()
	# Display the first colour.
	first = instruc[0]
	dropdown3.selectitem(first)
	#self.changeColour(first)


######################COMBOBOX FOR LABS IN FRAME 2 ################################################


	# Create and pack the dropdown ComboBox.
        labs = [' ','DH231', 'DH235', 'DH231C', 'DH231B']
	dropdown4 = Pmw.ComboBox(group.interior(),
                label_text = 'Labs          ',
	        labelpos = 'w',
                #selectioncommand = self.changeColour,
		scrolledlist_items = labs,        )
#	dropdown2.grid(row=2)
	dropdown4.pack()
	# Display the first colour.
	first = labs[0]
	dropdown4.selectitem(first)
	#self.changeColour(first)



####         Frame 3  Radio Buttons        #####################################################

        # Create the "Location" contents of the page.
        group = Pmw.Group(frame3, tag_text = 'Location')
        group.pack(fill = 'both', expand = 1, padx = 15, pady = 10)

	v1 = IntVar()
	v1.set(3) # initialize
        rb1 = Radiobutton(group.interior(), text = 'SWT', variable=v1, value=1)
        rb1.grid(row = 0, column = 0)
        rb2 = Radiobutton(group.interior(), text = 'WHS', variable=v1, value=2)
        rb2.grid(row = 0, column = 1)
        rb3 = Radiobutton(group.interior(), text = 'BOTH', variable=v1, value=3)
        rb3.grid(row = 0, column = 2)
	

        # Create the "Level" contents of the page.
        group = Pmw.Group(frame3, tag_text = 'Level')
        group.pack(fill = 'both', expand = 1, padx = 15, pady = 10)

	v2 = IntVar()
	v2.set("13") # initialize
        rb11 = Radiobutton(group.interior(), text = 'Grad', variable=v2, value=11)
        rb11.grid(row = 0, column = 0)
        rb12 = Radiobutton(group.interior(), text = 'UnderGrad', variable=v2, value=12)
        rb12.grid(row = 0, column = 1)
        rb13 = Radiobutton(group.interior(), text = 'BOTH', variable=v2, value=13)
        rb13.grid(row = 0, column = 2)


############      Frame 4     ##########################################################


#################        Add Combobox         ##################


        add = [' ', 'Course', 'Instructor', 'Room', 'Time', 'Record']
	dropdown10 = Pmw.ComboBox(frame4,
                label_text = 'ADD    ',
	        labelpos = 'w',
		entry_width=4,
		listheight = 150,
#		buttonaspect = 2.0,
                #selectioncommand = self.changeColour,
		scrolledlist_items = add,
        )
#	dropdown1.grid(row=1)
        dropdown10.pack(pady=5)

	# Display the first colour.
	first = add[0]
	dropdown10.selectitem(first)
	#self.changeText(first)


################     Modify ComboBox In frame 4     ####################


	# Create and pack the dropdown ComboBox.
        modify = [' ', 'Course', 'Instructor', 'Room', 'Time', 'Record']
	dropdown11 = Pmw.ComboBox(frame4,
                label_text = 'MODIFY',
	        labelpos = 'w',
                #selectioncommand = self.changeColour,
		scrolledlist_items = modify,
        )
#	dropdown2.grid(row=2)
	dropdown11.pack(pady=5)
	# Display the first colour.
	first = modify[0]
	dropdown11.selectitem(first)
	#self.changeColour(first)


################      Delete  Combobox  in frame 4  ######################


	# Create and pack the dropdown ComboBox.
        delete = [' ', 'Course', 'Instructor', 'Room', 'Time', 'Record']
	dropdown12 = Pmw.ComboBox(frame4,
                label_text = 'DELETE',
	        labelpos = 'w',
                #selectioncommand = self.changeColour,
		scrolledlist_items = delete,
        )
	#dropdown12.component(delete).configure(width = 4)
#	dropdown2.grid(row=2)
	dropdown12.pack()
	# Display the first colour.
	first = delete[0]
	dropdown12.selectitem(first)
	#self.changeColour(first)


####################    Ok,help,quit  buttons  in farme 4   #######################

	# Create and pack the ButtonBox.
	self.buttonBox = Pmw.ButtonBox(frame4,
		labelpos = 'E',
#		label_text = 'ButtonBox:',
                frame_borderwidth = 2,
                frame_relief = 'groove')
	self.buttonBox.pack(fill = 'both', expand = 1, padx = 15, pady = 15)

	# Add some buttons to the ButtonBox.
	self.buttonBox.add('OK')#, command = self.ok)
	self.buttonBox.add('HELP')#, command = self.apply)
	self.buttonBox.add('QUIT')#, command = self.cancel)

	# Set the default button (the one executed when  is hit).
	self.buttonBox.setdefault('OK')
#	frame4.bind('', self._processReturnKey)
	frame4.focus_set()

	# Make all the buttons the same width.
	self.buttonBox.alignbuttons()



################## writing days on canvas  in frame1    ########################

       def drawDays(self):
     # Make a list of days of the week

        enumDays=['Mon', 'Tue', 'Wed', 'Thu', 'Fri']

     # Draw text for each of the days

	xpos=20
	ypos=65
	ydiff=80
	for day in enumDays:
	        self.days.create_text(xpos, ypos, text=day, font=("arial", 12, "bold"))
	        ypos=ypos+ydiff


###################       Drawing Time on canvas in frame 1   ##########################################


       def drawTime(self):
     # Make a list of days of the week
        enumTime=['8.00a', '9.00a', '10.00a', '11.00a', '12.00n', '1.00p', '2.00p', '3.00p','4.00p','5.00p','6.00p','7.00p','8.00p']

     	xpos=68
	ypos=15
	xdiff=54
	for time in enumTime:
	        self.time.create_text(xpos, ypos, text=time, font=("arial", 12, "bold"))
	        xpos=xpos+xdiff

	self.time.grid(row=0, column=1)



##############    List of other canvases in frame 1    ###########################################


     # Make a list of days of the week
       def drawCanvas(self):
        CanvasNameList=['MonCanvas', 'TueCanvas', 'WedCanvas', 'ThuCanvas', 'FriCanvas']
     	xpos=68
	ypos=15
	xdiff=54
	for canvas in CanvasNameList:
		self.canvas=Pmw.ScrolledCanvas(frame1,
		borderframe = 1,
		labelpos = 'wn',
		usehullsize = 5,
		hull_width = 800,
		hull_height = 80,
        	)
		i=1
		self.canvas.grid(frame1,row=1, column=i)
		i=i+1
        	self.canvas.resizescrollregion()
 		self.canvas.configure(hscrollmode = 'dynamic')
		self.canvas.configure(vscrollmode = 'static')	                	


#########################################################################################



      	
root = Tk()
app=Schedule(root)
root.mainloop()






From martinol at algonet.se  Sat Apr  1 08:55:18 2000
From: martinol at algonet.se (Martin Olsson)
Date: 1 Apr 2000 13:55:18 GMT
Subject: HP Bug
Message-ID: <8c4v46$1v5$1@zingo.tninet.se>

About a year ago I heard about a bug only on Windows CE HP devices.
Does someone know if it is fixed yet?

/Martin Olsson



From breiter at usf.Uni-Osnabrueck.DE  Tue Apr 11 05:32:09 2000
From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter)
Date: 11 Apr 2000 09:32:09 GMT
Subject: Installation Problem in Windows
References: <38F28E55.67280329@swt.edu>
Message-ID: <8curep$snq$2@newsserver.rrzn.uni-hannover.de>

Rakesh,
it is hard to tell what your problem are with just the
information you gave us.

There is not really a need to "compile" python program.
Try the following to run your python program:

	c:\programs\python\python.exe test.py
and send us the results.
(Of course you have to change the paths above to the paths matching
your setup.)

Cheers,
	Bernhard
ps.: Please stop do double postings in text and html. Switch of the
HTML or chances are high that most people will ignore you on
usenet.

Ie article <38F28E55.67280329 at swt.edu>,
	rakesh  writes:

> I am new in python. I have installed python 1.5 installer for Windows at
> home. I ran the setup. I need to use teh program for both, the
> compilation of python programs and to use Tk widgets. I wrote one
> test.py and tried to compile it inthe python.exe window. It gave an
> error "stdin". Can anybody help this newbie.

> --------------14F405F271273C11DA4321F5
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> 
> 
> Folks,

-- 
Professional Service around Free Software                (intevation.net)  
The FreeGIS Project				            (freegis.org)
Association for a Free Informational Infrastructure            (ffii.org)


From akuchlin at mems-exchange.org  Tue Apr 18 19:43:47 2000
From: akuchlin at mems-exchange.org (Andrew M. Kuchling)
Date: 18 Apr 2000 19:43:47 -0400
Subject: Starship update: April 18, #2
Message-ID: <3daeirht58.fsf@amarok.cnri.reston.va.us>

The current status of the Starship restoration effort is:

* A new disk is in the machine, and Red Hat 6.2 has been reinstalled
  from scratch.

* A temporary Web server has been put in place that explains what has
  happened.

* No e-mail server is running on the machine.

* We have found a backup of /home dating from February 1, 2000.  
  tar -ztvf reported no errors on the backup file, so it's probably 
  OK.  So, the worst case might now be that we've only lost 
  changes since February 1.  

* We haven't recreated user accounts or restored from the backup file
  yet, because we want to know the outcome of the data recovery effort
  first.  We'll decide what to do next once we know how much data can
  be recovered.  

* If you were a volunteer administrator on starship, please let me
  know; I'll add you to starship-fix at egroups.com, a mailing list for
  coordinating the resuscitation process.  Also, please send me your
  SSH public key.

Many thanks to Michael McLay for getting the new disk, reinstalling
Linux, and getting the system up again.

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
in-any-case-the-best-christmas-present-i-got-today!-ly y'rs - tim
  -- Tim Peters, 29 Dec 91 [First occurrence of Tim Peters's long-phrase-ly
       idiom.]



From tismer at trixie.triqs.com  Sun Apr 23 17:22:43 2000
From: tismer at trixie.triqs.com (Christian Tismer)
Date: Sun, 23 Apr 2000 23:22:43 +0200
Subject: 'database' search
References: <39036340.BE82BEAD@roguewave.com>
Message-ID: <390369A3.99971CA2@trixie.triqs.com>


Bjorn Pettersen wrote:
[database with 1500 to 5000 items]

> The smallest datastructure I've found so far, is a 'prefix dictionary',
> so if e.g. "aardwark" was in the database, the 'prefix dictionary' would
> contain:
> 
>  pfdict = {
>   'a':        ['aardwark', ...],
>   'aa':       ['aardwark', ...],
>   'aar':      ['aardwark'],
>   'aard':     ['aardwark'],
>   'aardw':    ['aardwark'],
>   'aardwa':   ['aardwark'],
>   'aardwar':  ['aardwark'],
>   'aardwark': ['aardwark']
>  }
> 
> The maximum size for this would be n * avg len of item, with the real
> size being much(?) smaller with sufficient prefix sharing...

Well, your database is small enough to stand this number
of generated dict items.
In the general (larger) case I'd suggest to use a "trie"
structure. This is dividing your key set into maximum
unique subkeys. This may be coded with nested dictionaries
quite nicely.

Example:
aardwark      1
aaron         2
advertizing   3
advantage     4
python        5

gives you the following structure:

trie = {
  "a" : {
          "a":  {
                  "rdwark" : 1
                  "ron"    : 2
                }
          "dv": {
                  "ertizing": 3
                  "antage"  : 4
                }
        }
  "p" : {
          "ython": 5
        }
}

This should tend to give you quite small dicts, and relatively
fast access. Whenever you end up in a unique subkey, you may
do the completion. Using keys() and then sorting out isn't
too slow. Preofix sharing is there, too.

ciao - chris

-- 
Christian Tismer             :^)   
Applied Biometrics GmbH      :     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 zorro at zipzap.ch  Fri Apr 28 04:50:51 2000
From: zorro at zipzap.ch (Boris Borcic)
Date: Fri, 28 Apr 2000 10:50:51 +0200
Subject: The Simple Economics of Open Source
References: 
Message-ID: <390950EB.8213862E@zipzap.ch>

Raffael Cavallaro wrote:
> 

> 
> If they produce software that:
> 
> 1. cannot be easily reverse engineered
> 
> 2. achievs sufficient market penetration that interoperability with others
> becomes a significant feature
> 
> then yes, they are effective monopolies. This is *precisely* how MS got
> where they are.

billing gates.

BB


From mdefreitas at sikorsky.com  Fri Apr 28 16:14:22 2000
From: mdefreitas at sikorsky.com (mdefreitas at sikorsky.com)
Date: Fri, 28 Apr 2000 20:14:22 GMT
Subject: MORE INFO
References: <8ea0ao$fro$1@nnrp1.deja.com> <8ea9uu$rh0$1@nnrp1.deja.com> <8ecad6$bun$1@ites.inria.fr>
Message-ID: <8ecref$lck$1@nnrp1.deja.com>


> Do you want to run several python scripts (and several ui.commands
> C code) concurently (how would you synchronize?) ?

I do not want to run concurrently, I just want to run in one thread of
execution, but recursively.

> Note that if all you want is to have C code that calls Python
> code that calls C code (through a module) that calls Python code
> without threads, PyRun_XXX functions are re-entrant.

Thanks! That's what I needed to know. I now modified (and simplified)
my code as follows:

void interp(char *script) {
   static int nest_level = 0;
   FILE *fd = fopen(script, "r");
   if (nest_level == 0) {
      Py_Initialize();
      PyRun_SimpleString("import ui\n"); // import my ui
   }
   nest_level++;
   PyRun_SimpleFile(fd, script);
   nest_level--;
   if (nest_level == 0) Py_Finalize();
}

The only problem is that the nested script that is run "remembers" the
variable settings from it's caller. Is there a way to give each nested
python script a fresh, clean environment? The nested script should not
effect the environment of it's caller either. Is that what the global
and local dictionaries for the API function PyRun_File are for? If so,
is there any examples on their usage. The C/API doc isn't all that
explicit.

Thanks for the help.



Sent via Deja.com http://www.deja.com/
Before you buy.


From chafik at nevrax.com  Tue Apr  4 04:12:08 2000
From: chafik at nevrax.com (Sameh chafik pro)
Date: Tue, 4 Apr 2000 10:12:08 +0200
Subject: Tr: builtding library .pyd file format
Message-ID: <010f01bf9e0d$78af96c0$1001a8c0@nevrax.net>

Hello evry body,
I want to know how to do to built a .pyd library file format form the windows .dll file format
thanks



-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From emile at fenx.com  Fri Apr 28 20:30:27 2000
From: emile at fenx.com (emile at fenx.com)
Date: Fri, 28 Apr 2000 17:30:27 -0700
Subject: Reading in strings -> numbers ??
Message-ID: <390A2D23.7029E557@fenx.com>

If you're trying to put the info on disk to read it
in again later, look at eval(repr()), eg:

>>> a,b,c = eval(repr((1.2, -3.5, 10)))
>>> a,b,c
(1.2, -3.5, 10)
>>> 

Emile van Sebille

Louis M. Pecora  wrote in message
news:<280420001700308281%pecora at anvil.nrl.navy.mil>...
> Is there a Python "read-partner" for the write(string) function, e.g., 
> 
> fileobject.write(" %e %e %d" % (1.2, -3.5, 10))  
> 
> in the sense that the C functions fprintf and fscanf are partners.
> 
> I've looked in 4 different Python books and in the pdf references, but
> I see nothing in read or readlines or strings that seems to make for an
> easy conversion from a string to a list or tuple of objects (numbers). 
> In other words, I want the opposite of the write above so I can read
> those numbers back into my Python code.  
> 
> Thanks for any help.
> -- 
> http://www.python.org/mailman/listinfo/python-list
>



From mjackson at wc.eso.mc.xerox.com  Wed Apr 26 14:39:34 2000
From: mjackson at wc.eso.mc.xerox.com (Mark Jackson)
Date: 26 Apr 2000 18:39:34 GMT
Subject: How can I get the name of an object???
References: <390731A2.12788170@freei.com>
Message-ID: <8e7d56$t01$1@news.wrc.xerox.com>

Sean Blakey  writes:
> Peter,
> Python objects do not have any way of finding out what name they are
> referenced by.  Names refer to objects, but objects do not have name.
> 
> This is reasonable, since it is simple for an object to have 0, 1, or
> more names.  Imagine what an imaginary __name__ attribute would be in
> the following cases:
> >>>class A:
> ....  pass
> ....
> >>>A().__name__		# What should this be? ''?
> >>>a = A()
> >>>b = a		# b and a are now two names for the same object
> >>>b.__name__		# Should this be 'a', 'b', or ['a', 'b']?
> 
> There are some clever hacks to attempt this (like iterating through all
> the names in globals() looking for a match with the object), but I have
> not seen any that are completely effective.

Right.  Consider also the following:

>>> a=999
>>> b=999
>>> c=b
>>> a is b
0
>>> b is c
1

All fine; c and b are the same, a just "happens" to be equal.  But

>>> c=1
>>> d=1
>>> c is d
1

Because of implementation details (driven by considerations of
efficiency), there will be instances of "accidental" identity.  Unless
the objective is tolerant of this, any scheme to find *the* name of an
object would seem to be doomed.

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
	An advertiser will happily make you feel bad about
	yourself if that will make you buy, say, a Bic pen.
				- George Meyer




From HighdesertmanREMOVE at yahoo.com  Sat Apr 22 01:57:20 2000
From: HighdesertmanREMOVE at yahoo.com (Highdesertman)
Date: Fri, 21 Apr 2000 22:57:20 -0700
Subject: Distribution
Message-ID: <39013f48@flexnet239.uunt.net>

Hi all

I am a newbie to python and haven't done any programming for some time. The
last time I did any amateur programming was back when MSDOS was (more or
less) king and Quick C was a popular version of that language.

Well things have changed and I am older. I have decided that after almost
ten years of programming inactivity, I would try my hand at it again. I
decided that I would be careful about the language I would learn (I would
have to relearn everything even if I used a language I used to be proficient
at such as compiled basic or C) and I also decided that I simply wasn't
interested (at this juncture) in getting back in the C saddle. For a variety
of reasons.

I wanted a language that was simple to use, powerful, portable and fast. I
also was looking to minimize the learning curve. I stumbled over Python
quite by accident (it was recommended in a rather obscure section of the
ZDTV website) and it seems to meet these initial requirements.

Now to my question:

If I use python to develop an application for the windows 9x environment,
 I have already downloaded the appropriate libraries and version) what form
does the finished program take? How does it get distributed? I remember in
the early days of BASIC programming, (before compiled basic) your program
was just raw code that could be (often accidentally) altered or otherwise
corrupted. In order for your basic program to be used, the user had to have
a basic compiler on board and they loaded your raw source from a text file
and executed it. Is this how Python is used? Forgive me for asking what must
be a terribly green question, but I am really curious about the final
product of a python program. In what way does the end user utilize your
code? If you should be writing to an unknown audience as in the case of
making a freeware utility (you discover that that little ditty you wrote to
solve a headache really is very useful to others) Is there any way to turn
your python code into an exe that can be easily utilized by others? If
Python is dependent on it's interpreter to run, and I am only programming
for my own needs, then that dosen't represent a weakness. But since Python
remains relatively unknown as yet, the average user isn't likely to have a
python interpreter handy. In addition, one of the real advantages of the
development of the compiler was that it gave your code a level of protection
against being tampered with and made it easily useable by a wide audience.
Python looks very elegant and seems to meet my needs with the exception of
this unknown. If anyone could help me answer this question, I would be very
much in thier debt. I am sure this need has been addressed, and I would just
like to know what the solution is.


Cheers,

Mathew




From kc5tja at garnet.armored.net  Sun Apr 30 09:03:12 2000
From: kc5tja at garnet.armored.net (Samuel A. Falvo II)
Date: 30 Apr 2000 13:03:12 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <8ecsgj$6lp$1@slb0.atl.mindspring.net>  <300420001008012011%pecora@anvil.nrl.navy.mil><20000430170952.A502@datapro.co.za> 
Message-ID: 

In article , Dave Abrahams wrote:
>Alternatively, if you're writing a large program with many abstractions and
>think lots of other people will have to read it steer clear of Hungarian
>Notation in either form ;)

I disagree.

>coding in Python. Who cares if it's a dict or a UserDict, or some other
>object which models the appropriate mapping semantics?

If it's a dict, or if it's a UserDict, or if it's anything else that exports
the dict interface, then it's perfectly valid to name a parameter
dictWhatever.  I fail to see what's wrong with this concept.

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA


From mal at lemburg.com  Tue Apr  4 05:42:08 2000
From: mal at lemburg.com (M.-A. Lemburg)
Date: Tue, 04 Apr 2000 11:42:08 +0200
Subject: VMware/Win4Lin/Wine + Linux... and Python?
References: <38E96834.B500B786@acm.org>
Message-ID: <38E9B8F0.6799A70F@lemburg.com>

"Robert W. Cunningham" wrote:
> 
> With at least three ways to run Windows applications simultaneously with
> Linux applications, it seems to me there may be a need and/or
> opportunity to improve the connectivity and interface between the two
> worlds.  And I suspect Python may be just the tool to do it.
> 
> ...
>
> But is there a way to get instances of Python on both platforms talking
> to each other?  Of course, a socket could be opened and data shuttled
> back and forth, but that will be fairly slow and demand a fair amount of
> overhead.  Has there been any work done on a higher-level
> Python-to-Python interface?

You could use shared memory for the task. What methods are
implementable really depends on the architecture used by the
different WinXX-emulators. I would suspect Unix domain sockets
to be a fairly portable and fast solution, but then WinXX only
supports TCP/IP sockets. Pipes might also work (I think OS/2
used these for the communication  OS/2<->DOS and OS/2<->Win3.1).

> ...
>
> I have already dangled the idea before Trelos, the makers of Win4Lin,
> and they are definitely excited by the possibilities.  Plus, with
> Win4Lin being a commercial product, an inter-OS Python interface would
> allow Trelos to expose interfaces without having to give away any of
> their code (or revenue).  And this is one group that sure seems to be
> earning their money, even given their unfortunate lack of support for
> Open Source.  Python may well be the wedge needed to open that door.

This idea seems to be getting common around commercial
vendors: they wrap their internal C API using SWIG or
something similar and then publish the Python API for others
to hook into. As a nice side-effect this also has the potential
of making their application scriptable.

In any case: the idea is well worth looking into.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





From mhammond at skippinet.com.au  Wed Apr 19 22:20:48 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Thu, 20 Apr 2000 02:20:48 GMT
Subject: Pythonwin?
References: 
Message-ID: <4QtL4.24$v85.41@news-server.bigpond.net.au>

"A[r]TA"  wrote in message
news:eMz2Nmiq$GA.73 at net025s...
> Hello,
> down here,
> it doesn't shows a Window or something and I don't get an error.
>
>     window.Wnd()

You have created a Window object, but not the Window.  You need something
like:

w = window.Wnd()
w.CreateWindow(...)

It is simpler to start with a dialog - d=win32ui.CreateFileDialog();
d.DoModal()

You are really going to need to go through an MFC tutorial or book before
you can make heads or tails of Pythonwin from that level...

Mark.





From bjorn at roguewave.com  Wed Apr  5 12:19:36 2000
From: bjorn at roguewave.com (Bjorn Pettersen)
Date: Wed, 05 Apr 2000 10:19:36 -0600
Subject: Pass by reference ?
References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38E8D449.FBC1E2AD@roguewave.com> <8caohp$j4v$1@pegasus.csx.cam.ac.uk>
Message-ID: <38EB6797.F03EEFB3@roguewave.com>

Nick Maclaren wrote:
> 
> In article <38E8D449.FBC1E2AD at roguewave.com>,
> Bjorn Pettersen   wrote:
> >Jacek Generowicz wrote:
> >>
> >> I'm just trying to familiarize myself with Python.
> >> In Magnus Lie Hatland's Instant Python, he
> >> mentions that `all parameters in Python are passed
> >> by reference'.
> >
> >The technically correct (although much less known) term is
> >pass-by-object-reference.  All this means is that you can change an
> >argument to a function by calling methods on the object, but you can't
> >change the identity of the object (ie. simply calling a function can't
> >change any name-bindings in your current scope).
> 
> Hang on.  Why is that technically correct?  Call by reference has
> never implied changing any bindings in the caller's scope in any
> work that I have seen - it certainly didn't back in the 1960s.
> Unless I am thoroughly confused, Python uses bog-standard call by
> reference, with the wrinkle that assignment is a rebinding rather
> than a copying operation.  AM I confused about that?

Call by reference is (at least now) generally used to refer to Pascal
VAR arguments or C++ & arguments, both of which has similar semantics
which allow rebinding in the caller's scope.  This is in contrast to
many OO languages where arguments can be mutated but not rebound...  I'm
not sure if call-by-reference has changed meaning since the 60s, but
pass/call-by-object-reference is the term consistently used when I was
doing my type theory work in 85-87...  

> The form of argument passing that DOES involve rebinding the
> caller's names certainly exists, but I have never seen an agreed
> name for it.  It was reckoned to be a bad idea (just like Fortran's
> equally deceptive argument passing of scalars) by 1970, but kept
> coming back in special-purpose languages.

Just because something is a bad idea doesn't mean you can't get a
research grant for it 

--bjorn



From pinard at iro.umontreal.ca  Wed Apr  5 12:35:42 2000
From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=)
Date: 05 Apr 2000 12:35:42 -0400
Subject: Pass by reference ?
In-Reply-To: "Robert W. Cunningham"'s message of "Wed, 05 Apr 2000 15:10:13 GMT"
References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38EAF8D8.4B7C43B4@ecs.soton.ac.uk> <38EB56AE.F938CE06@acm.org>
Message-ID: 

"Robert W. Cunningham"  writes:

> In my own mind, to escape the ambiguity of how "Pass By Reference" and
> "Pass By Value" are discussed in Computer Science, and how those same
> terms are (mis)used when discussing Python, I've been using the idea of
> "Pass By Clone".

Just a little story, popping into my mind while reading this.

Niklaus Wirth, whose name is attached to Pascal, was asked by a conference
attendee how his name should be pronounced.  He replied: "If you call me by
name, you should say Veert.  But if you call me by value, rather say Worth."

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard





From mikael at isy.liu.se  Wed Apr  5 03:00:08 2000
From: mikael at isy.liu.se (Mikael Olofsson)
Date: Wed, 05 Apr 2000 09:00:08 +0200 (MET DST)
Subject: Why should I switch to Python? - Infinity of Primes
In-Reply-To: <1257244378-5884705@hypernet.com>
Message-ID: 

On 04-Apr-00 Gordon McMillan wrote:
 >  Oh, come on. There are at least 3 well known constructive 
 >  proofs that all odd numbers are prime:
 >  
 >  The mathematician's:
 >   3 is prime,
 >   5 is prime,
 >   7 is prime
 >   as so on, by induction.
 >  
 >  The physicist's:
 >   3 is prime,
 >   5 is prime,
 >   7 is prime,
 >   9 is prime 
 >   11 is prime...
 >  
 >  The computer scientist's:
 >   3 is prime,
 >   3 is prime,
 >   3 is prime ....

The last one was new to me. But I miss the following one:

The engineer's:
 3 is prime,
 5 is prime,
 7 is prime,
 9 is prime ...

For-yers-ugo-I-coultnt-evun-spel-injunjeer-an-now-I-are-one-ly y'rs

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson 
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    05-Apr-00
Time:    08:55:41

This message was sent by XF-Mail.
-----------------------------------------------------------------------



From effbot at telia.com  Mon Apr 17 15:05:46 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Mon, 17 Apr 2000 19:05:46 GMT
Subject: import disappointment
References: <002b01bfa89d$834c49d0$4500a8c0@thomasnb>
Message-ID: 

Thomas Heller  wrote:
> Using imputil is out of question because most programs
> including pythonwin are only expecting strings in sys.path.

I suggest taking another look at imputil -- unless it
has changed a lot since I last downloaded it, it's per-
fectly possible to use it without stuffing non-strings
in sys.path...






From kens at sightreader.com  Thu Apr  6 16:34:46 2000
From: kens at sightreader.com (Ken Seehof)
Date: Thu, 06 Apr 2000 13:34:46 -0700
Subject: A Mountain of Perl Books + Python Advocacy
References: <000f01bf9eca$2eec8c60$3e2d153f@tim>
Message-ID: <38ECF4E6.B85C62D5@sightreader.com>

Indeed.  I've noticed that while just about everyone who I've known who
has tried python ends up liking it alot, there aren't many fanatics.  I define
a fanatic as someone who is absolutely certain that their language is by far
the best language for every possible application, and that other languages
don't even deserve to exist.  Python programmers tend to acknowledge
the positive qualities of other languages.

Perhaps this is partly because python borrows all the best stuff from many
other languages rather than being built around some wild, revolutionary idea.


Tim Peters wrote:

> [snip...]

> Python *is* astonishing for the tiny number of evangelists it's attracted!
> We sucked in Eric Raymond, for but for some reason he doesn't seem to
> consider promoting Python to be his Primary Mission from God -- the best
> hope for a PSA marketing campaign may be to hire a deprogrammer to
> straighten out Tom Christiansen's brain while there's still something left
> .
>
> not-mentioning-that-perl-is-a-better-language-for-some-tasks-and-
>     that-tells-you-how-effective-an-advocate-i-am-ly y'rs  - tim






From python-list at teleo.net  Fri Apr  7 18:45:29 2000
From: python-list at teleo.net (Patrick Phalen)
Date: Fri, 7 Apr 2000 15:45:29 -0700
Subject: calendar/scheduling app
In-Reply-To: <38EE332E.2954EA49@fizzylab.com>
References: <38EE332E.2954EA49@fizzylab.com>
Message-ID: <0004071547040L.01234@quadra.teleo.net>

[paul beard, on Fri, 07 Apr 2000]
:: I am interesting in having a meeting scheduler/calendar app that does
:: what something like Exchange purports to do without requiring me to use
:: a client that doesn't exist. In other words, it should be
:: platform-agnostic and use webforms/cookies to handle transactions and
:: display options. 
:: 
:: Possible in Zope? How hard? How long to do, given a baseline knowledge
:: store of zero?


Try http://www.worldpilot.com



From jepler.lnk at lnk.ispi.net  Sat Apr 22 22:31:23 2000
From: jepler.lnk at lnk.ispi.net (jepler epler)
Date: Sun, 23 Apr 2000 02:31:23 GMT
Subject: Python for drivers?
References: <3900EDBE.282BC85@dsuper.net>
Message-ID: 

On Sat, 22 Apr 2000 01:10:04 GMT, Dave
  wrote:
>Can Python be used for writing device drivers? I just got BeOS 5 and it
>doesn't support some video cards. I'd like to write one for the Cirrus
>Logic card and I want a language that's clear and concise- Python. I've
>never written device drivers. Any suggestions?
>THanks

If you can use a tool like SWIG (or a hand written C module) to provide
access to the necessary low-level features, you may be able to do this.

For instance, if the card needs the idea of 'store {8,16,32}-bit integer X at
index L of the video card's address space' and 'read {8,16,32}-bit
integer at index L of the video card's address space', then you'd just
need to write those following functions in a C module for Python to call.

It may be slow, as other posters suggest.

Jeff


From timehorse at unforgettable.com  Sat Apr 15 21:43:42 2000
From: timehorse at unforgettable.com (timehorse at unforgettable.com)
Date: Sun, 16 Apr 2000 01:43:42 GMT
Subject: Python Starship Grounded??
References: <38F6B2DF.940E7C23@concentric.net> 
Message-ID: <8db5sb$gsc$1@nnrp1.deja.com>

In article ,
  "Michael Appelmans"  wrote:
> Yes, I was hoping to get hold of win32all build 131 for Python 1.6a2
but to
> no avail. I fear it is lost in some freakish nebulae.

Not that I'm complaining as I only wish I was doing more to promote the
Starship's upkeep but it is rather annoying this as I route all my
personal e-mail through Starship because it's currently my only shell
a/c and thus the only place I can have a true, bona fide .forward which
will send a copy of my mail to @home and a copy to my work which runs
on a Micro$oft network.  I don't store my mail on Starship, only route
through it, but obviously with Starship down, I haven't received any e-
mail in days -- not necessarily a bad thing what with the advent of
Spam.  :)  Still, I average about 10 or at MOST 20 e-mails a day and
since I am only re-routing them, I seriously doubt I'm degrading the
system greatly (we could always install ORBS if it'll cut down on the
spam I receive -- no complaints from me about that at all! :)  :)  :)
Of course, Zope being down is a bit of a bug!

Anyway, the long and the sort of it is, I'm not asking for it's timely
recovery -- it can recover when it recovers -- but it would be nice if
we could receive some kind of status report on the situation, non?

Be Seeing You,

Jeffrey.


Sent via Deja.com http://www.deja.com/
Before you buy.


From wrd at awenet.com  Mon Apr 10 15:43:39 2000
From: wrd at awenet.com (William R. Dickson)
Date: Mon, 10 Apr 2000 12:43:39 -0700
Subject: Problem running Python script as cron job
References:  <0004071555090M.01234@quadra.teleo.net>
Message-ID: 

In article <0004071555090M.01234 at quadra.teleo.net>, Patrick Phalen 
 wrote:

> [William R. Dickson, on Fri, 07 Apr 2000]
> :: Anybody know of any issues with running python scripts from Cron?
> 
> No. I've had multiple Python scripts running every one, two, five and
> ten minutes around the clock for years on multiple servers without
> problems.
> 
> I'd suspect you might have a bug lurking.

I think so too, but I can't find it, because the script runs flawlessly 
every time I run it by hand, and the buffer never flushes the output to 
the log when it's run by Cron.

Blorg.

-Bill


From javanet at dynacap.com  Fri Apr 28 13:23:38 2000
From: javanet at dynacap.com (Arnaldo Riquelme)
Date: Fri, 28 Apr 2000 09:23:38 -0800
Subject: Great!!
Message-ID: 

Thanks a lot for all your help guys!!!

Python makes my life a lot easier


Arnaldo


later




From richard_chamberlain at ntlworld.com  Wed Apr  5 06:13:00 2000
From: richard_chamberlain at ntlworld.com (Richard Chamberlain)
Date: Wed, 5 Apr 2000 11:13:00 +0100
Subject: Remotely running a python script
Message-ID: <8cf452$pdv$1@gxsn.com>

Hi,

Does anyone know a way I can remotely trigger a python script on a Win95
machine?

What I want to do is trigger an event from a vb client and run a python
script on another PC in the business.

They are able to see each other via IP and the client has a drive mapped
that is a shared folder on the python side.

Because I'm using Win95 I'm not sure how good the DCOM support is.

Thanks

Richard






From mhammond at skippinet.com.au  Thu Apr 20 09:47:41 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Thu, 20 Apr 2000 13:47:41 GMT
Subject: win32all-131 at python.org
Message-ID: <1UDL4.539$v85.2477@news-server.bigpond.net.au>

Just a quick update.  win32all-131 for Python 1.6a2 can be found at
http://www.python.org/1.6/

Note that this version has 2 known (and semi-serious) bugs:
* The Pythonwin debugger simply doesnt work (but its such a simple bug!)
* A Unicode issue with Scintilla prevents calltips and multi-line commands
in the Pythonwin interactive window(!!) working correctly on NT/2000.

I expect to have 132 available soon with these fixes plus a few other
tweaks.  If starship is still not available, it will also be at
http://www.python.org/1.6/

Finally, once this win32all set stabilizes, I will also be releasing
another Python 1.5 build.  Depending on what happens, this may or may not
be the last 1.5 build, but most new builds are likely to target 1.6
(although "popular demand" is likely to have some influence ;-)

Mark.




From mwh21 at cam.ac.uk  Thu Apr 27 09:03:57 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 27 Apr 2000 14:03:57 +0100
Subject: when to use intern()
References: 
Message-ID: 

Gregory Trubetskoy  writes:

> It says in the manual that some things in Python get interned
> automatically. I'm not sure where intern() is necessary - 

Almost never.
 
> if I have a statement like:
> 
> if self.config.has_key("PythonOption"):
>    ...
> 
> that gets executed a lot - should I consider interning "PythonOption" or

Well, you can, but...

> is it done automatically?

Yes.

> 
> what about
> 
> PYTHON_OPTION = "PythonOption"
> if self.config.has_key(PYTHON_OPTION):
>    ...
> 
> is this interned?

Yes.

See Python/compile.c in the source distribution round about line 240
for the gory details...

HTH,
Michael

-- 
48. The best book on programming for the layman is "Alice in
    Wonderland";  but  that's because it's  the best book on 
    anything for the layman.
     -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html


From muzzetta at liotro.dipmat.unict.it  Wed Apr 12 12:39:02 2000
From: muzzetta at liotro.dipmat.unict.it (Alessandro Muzzetta)
Date: 12 Apr 2000 16:39:02 GMT
Subject: Looking for BoboHTTPServer.py
Message-ID: <8d28r6$9bs$2@news.cineca.it>

Hello,

I'm looking for BoboHTTPServer.py but cannot find it anywhere.
Can someone tell me where I can find it, or some other server
that integrates Bobo (not Medusa).

Thanks



From smalleys at gte.net  Sat Apr 15 14:38:05 2000
From: smalleys at gte.net (sue)
Date: Sat, 15 Apr 2000 18:38:05 GMT
Subject: need help just begining
References: <11822ca0.dd34a400@usw-ex0109-068.remarq.com> <38F41190.C0BB507B@sympatico.ca> <38F53E5A.977913FE@cosc.canterbury.ac.nz> <38F54D83.B0F620A8@callware.com> <38F69621.3B8F5B29@gte.net>
Message-ID: <38F8A912.B05575D4@gte.net>

My local Borders said "two weeks" but it is orderable.
Sue.


From jbauer at rubic.com  Mon Apr 17 16:37:56 2000
From: jbauer at rubic.com (Jeff Bauer)
Date: Mon, 17 Apr 2000 15:37:56 -0500
Subject: Playing wave files on Windows
References: <38FB6ED7.4C72773E@callware.com>
Message-ID: <38FB7624.943A8C35@rubic.com>

> Ivan Van Laningham wrote:
> How can I play a sound file on Windows. 

Ivan, use the built-in winsound module, e.g.:

>>> import winsound
>>> winsound.PlaySound(r'C:\WINNT\Media\tada.wav', winsound.SND_FILENAME)

> I don't want to do anything else, just play a 
> wave file. ...

Then I can't interest you in my Python interface to
the Diamond Rio MP3 player?  <0.5 wink>

Jeff Bauer
Rubicon Research



From pinard at iro.umontreal.ca  Fri Apr 28 16:37:12 2000
From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=)
Date: 28 Apr 2000 16:37:12 -0400
Subject: urllib redirect
In-Reply-To: Georg Mischler's message of "Wed, 19 Apr 2000 10:34:36 GMT"
References: <4.1.20000418125557.030592d0@202.95.1.37>
	
	<8dk23t$4c2$1@nnrp1.deja.com>
Message-ID: 

Georg Mischler  writes:

> Anthony J Wilkinson wrote:

> > If you just print out the following you can use the browser's own
> > redirection facility.
> >
> > 
> >     
> >         
> >          redirect page
> >     
> >     
> >         If your browser does not support redirection, click
> >         here to continue.
> >     
> > 

> This can be done in a much simpler way, whitout sending any
> actual page data to the client:

>   your_new_path = 'http://www.spam.com/'

>   print 'Status: 302 Redirected'
>   print 'Location: %s' your_new_path

> As soon as the browser (works with *every* browser!) sees the
> "Location:" header, it will stop and try fetching the new page.

The advantage of the HTML code is that it is mere HTML, so usable wherever
an HTML page was used.  Even if the second solution is simpler, it is only
usable through a CGI script, that is, from a location allowing execution
of CGI scripts.  It happened to me that this is exactly _because_ the
original is at a place forbidding CGI scripts, that I need page relocation.
So the original HTML solution is worth being noted, at least for some cases.

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard




From gslee111 at daisy.kwangwoon.ac.kr  Wed Apr 26 20:59:33 2000
From: gslee111 at daisy.kwangwoon.ac.kr (Gang Seong Lee)
Date: Thu, 27 Apr 2000 09:59:33 +0900
Subject: defining __getitem__
Message-ID: 

I'd like to have a method __getitem__ in a class which acts like other
sequence type.
For example,
------------------------
class data:
    def __init__(self, n):
        self.maxsize = n

    def __getitem__(self, k):
        if k >= self.maxsize:
              # I want to stop here
              # ????
        return get_data_from_some_where_else(k)

d = data(10)
for el in d:
    print el
------------------------
I want to make it stop at some point automatically, like range() does. I
don't want to use try: exception clause for this. Is there any way for this?

Thanks

Gang Seong





From hnowak at cuci.nl  Mon Apr 24 17:21:20 2000
From: hnowak at cuci.nl (Hans Nowak)
Date: Mon, 24 Apr 2000 23:21:20 +0200
Subject: Installing Python on NT
In-Reply-To: <8e2b92$9n6$1@nnrp1.deja.com>
Message-ID: <200004242122.e3OLMIG24743@hera.cuci.nl>


On 24 Apr 00, at 20:36, Lee Malatesta wrote:

> I'm interested in installing Python on a properly battened down NT
> workstation for which I do not have administrative priveledges.  This is
> my workstation at work.  Mostly I just want to play around with
> SGMLtools which is largely written in Python.  The installer told me
> that I have to install logged in as administrator.  This is the first
> program I've installed where this was necessary.  Unfortuntely for me to
> install this as admin, I'd have to put in a request to PC support, they
> would have to review to see if there is a need for me to have Python
> installed and then send one of the PC support personelle out to install
> for me.
> 
> Anyone know of anyway I can circumvent the need to be root to install?

I didn't test this, but methinx you should be able to just take the files 
(exe, standard library) and copy them somewhere on your computer. I don't 
know if everything will work this way, esp. the Tkinter stuff. If all else 
fails, you could install a DOS version, which lacks some stuff (GUI, 
sockets and such) but which is fully functional otherwise.

Blessed be,

--Hans Nowak (zephyrfalcon at hvision.nl)
Homepage: http://www.hvision.nl/~ivnowa/newsite/
Python questions? See http://tor.dhs.org/~zephyrfalcon/snippets
You call me a masterless man. You are wrong. I am my own master.



From gmcm at hypernet.com  Sat Apr 29 14:30:11 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Sat, 29 Apr 2000 14:30:11 -0400
Subject: The Simple Economics of Open Source
In-Reply-To: 
Message-ID: <1255089462-10343171@hypernet.com>

Richard Hale wrote:

> In article <1255108931-9171946 at hypernet.com>, gmcm at hypernet.com
> says... > If that were the model, we'd all be using Apples. MS
> got where > they are by outmanuvering IBM and DR. If Gary Kildall
> had > been willing to play hardball with a bunch of IBM suits,
> the > world would be quite different. 

> You must mean "play
> ball".

As Jeff Bauer forwarded to me:
http://www.forbes.com/forbes/97/0707/6001336a.htm

The point being (in this rather deranged thread) that it was all 
business, and IP had nothing to do with it.

> CP/M was the OS "monopoly" of its day.  A perfect illustration of
> how success breeds failure and how every trend has within it the
> seeds of its own destruction.
> 
> It must be Microsoft's turn now!?

Hmmm. Despite being fat, MS remains surprisingly hungry.

- Gordon



From just at letterror.com  Wed Apr 12 07:44:06 2000
From: just at letterror.com (Just van Rossum)
Date: Wed, 12 Apr 2000 12:44:06 +0100
Subject: Classes, Inheritance - Stupid lazy question
In-Reply-To: <8d1ihl$q244@imsp212.netvigator.com>
References: <8d1cfh$hme7@imsp212.netvigator.com>
 <874s9766r6.fsf@ifm.uni-kiel.de> 
Message-ID: 

"Michael Hudson"  wrote in message
> another option is:
>
> class paul(lazy):
>     super = lazy
>     def __init__(self, name):
>         self.super.__init__(self,name)
>         self.april_pay = 0
>
>     def fired(self):
>         print "Here's a box, collect the things from your desk"
>         self.super.fired(self)

At 6:18 PM +0800 12-04-2000, Paul Gresham wrote:
>I like this solution a lot, it makes a lot of sense. Thanks Michael.
>I guess somewhere in Python is a defined route back to the super class, on a
>better day I may just dig through the code.

Actually, the above is flawed, too:

class bob(paul):
    super = paul  # possibly needed for *other* method overrides...

b = bob()
b.fired()  # <-- kaboom!

It's really best to call the overridden method explicitly.

Just





From sabren at manifestation.com  Sun Apr 16 20:59:26 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Sun, 16 Apr 2000 20:59:26 -0400 (EDT)
Subject: module naming? 
In-Reply-To: <200004170054.KAA14097@piglet.dstc.edu.au>
Message-ID: 

On Mon, 17 Apr 2000, David Arnold wrote:

> -->"Michal" == sabren   writes:
> 
>   Michal> Is there a better way to do this?
> 
> what about something like
> 
>    from Record import Record
>    from Field import Field
>    from IdxDict import IdxDict
> 
> in your zdc/__init__.py ?
> 

Hey David,

  That's certainly a lot cleaner! But is there a way to do that and
not have it load each one of those files every time? There's actually
more than 3, and even though they're all fairly small, I'd rather not
have the overhead of loading them until they're needed.

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------




From drew.mcdowell at msfc.nasa.gov  Tue Apr 25 18:19:44 2000
From: drew.mcdowell at msfc.nasa.gov (Andrew McDowell)
Date: 25 Apr 2000 22:19:44 GMT
Subject: os.path.walk() question.
Message-ID: <8e55m0$pvl$1@hammer.msfc.nasa.gov>

I didn't see this question mentioned in any older posts so forgive me if I'm
dragging up and old topic...but:

I need to find out if a file exists under a directory hierarchy.
The hierarchy could be quite large so I don't want to continue recursing
through the hierarchy if the file is found one or two directories down.   Is
there a way that you can tell os.path.walk() to stop searching?

I suppose I could customize the code, but my first notion was that someone
on the group had probably addressed this before.

Any advice would be much appreciated :)

-Drew






From dgoodger at bigfoot.com  Sun Apr  9 17:42:25 2000
From: dgoodger at bigfoot.com (David Goodger)
Date: Sun, 09 Apr 2000 17:42:25 -0400
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> <8cocgb$iuk$1@pegasus.csx.cam.ac.uk> <8cokt5$opj$1@slb1.atl.mindspring.net> <38EFE45A.2E866C58@mindspring.com><0a9301bfa244$75afe200$01ffffc0@worldnet.att.net>
Message-ID: 

talking about C's "test ? true : false" operator,

on 2000-04-09 12:55, Emile van Sebille (emile at fenx.com) wrote:
> This construct has been occasionally suggested
> as one option:
> 
>>>> print ['falseresponse','truresponse'][1==2]
> falseresponse
>>>> print ['falseresponse','truresponse'][1==1]
> truresponse

There is a hidden pitfall here. You have to be careful with the test (used
as list index) at the end ("[1==2]" & "[1==1]" here). Whereas the comparison
operators (==, <, >=, etc.) will always return either 0 (false) or 1 (true),
more complex boolean operations involving "and" and/or "or" may not. For
example:

    print ['falseresponse','truresponse'][a and b]

The result depends on the values of a & b. If a is 0, fine, 'falseresponse'.
If a is an empty string, an empty list, etc. (all false-equivalent values),
you'll get an error. If a is non-zero or true-equivalent, the index will be
b's value, whatever that is. If b isn't either 0 or 1, you'll get an error
or unpredictable results.

You can of course avoid this by reversing the list and adding a "not" around
the boolean:

    print ['truresponse','falseresponse'][not(a and b)]

"not" always returns 0 or 1.

See section 5.10 of the Python Reference Manual, "Boolean operations".

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)



From bgue at my-deja.com  Thu Apr 20 22:24:13 2000
From: bgue at my-deja.com (bgue at my-deja.com)
Date: Fri, 21 Apr 2000 02:24:13 GMT
Subject: serial port and event loop question
Message-ID: <8doe40$h8$1@nnrp1.deja.com>

Hi everyone. This is mostly a general programming question, but since
I'm using Python for this project, I thought I'd ask here... I wrote
database written with Python and Gadfly, and I've got a nice little
Tkinter GUI for it. I need to make it monitor the serial port for
incoming data (from a barcode scanner). I'm using the Serial module,
but I don't know how to have my program watch for new data
constantly...any help?

Thanks in advance,

Brian Gue
bgue at my-deja.com


Sent via Deja.com http://www.deja.com/
Before you buy.


From soundhack at hotmail.com  Tue Apr 18 20:49:08 2000
From: soundhack at hotmail.com (Robert)
Date: Tue, 18 Apr 2000 20:49:08 -0400
Subject: win32all-128.exe availability?
Message-ID: <38fd01b2$0$10982@senator-bedfellow.mit.edu>

Now that starship has crashed, I was wondering if it was possible to
get the 128 build of Pythonwin extensions off the net? By an unfortunate
coincidence, my own hard drive chose to crash around the time starship
did.

Thanks
Robert




From tiddlerdeja at my-deja.com  Fri Apr 28 06:37:25 2000
From: tiddlerdeja at my-deja.com (tiddlerdeja at my-deja.com)
Date: Fri, 28 Apr 2000 10:37:25 GMT
Subject: command pattern/framework in python?
Message-ID: <8ebpl4$eq9$1@nnrp1.deja.com>

Anyone got an example of a Command pattern/framework that they have
used in python?

Any information appreciated.


Sent via Deja.com http://www.deja.com/
Before you buy.


From jon at dgs.monash.edu.au  Wed Apr  5 21:37:07 2000
From: jon at dgs.monash.edu.au (Jonathan Giddy)
Date: Thu, 6 Apr 2000 11:37:07 +1000 (EST)
Subject: Tuples -- who needs 'em
In-Reply-To:  from "Alexander, Bob" at Apr 05, 2000 12:22:28 PM
Message-ID: <200004060137.LAA27607@nexus.csse.monash.edu.au>

I nearly fell out of my tree when Alexander, Bob declared:

>I am wondering where the serious concern about mutable lists comes from, as
>it is a pattern in the responses I've gotten on this topic. For me, the
>immutable list is a relatively new concept, since I can't think of many
>other languages that have it. I'm a programming-language-design kind of
>person, and I never really saw mutable lists as a problem that needed
>solving. 

How about C?  Surely 'const' is an attempt to mark arrays as immutable.
Apparently, the ANSI C committee saw mutable arrays as a problem that
needed solving.

>I've used many Python-type languages that have mutable lists but
>not immutable ones, and if I don't want the elements to change they don't
>change -- I simply avoid the x[i] = y construct :-) 

Avoiding the x[i] = y construct is much harder in non-trivial programs, 
where assumptions about mutability need to be specified as part of the call
interface.  Hence the proliferation of const in the C string library.

>And I still haven't
>heard from anyone about why there isn't similar concern about immutable
>dictionaries.

I could express some concern, but dictionaries are used much less than
sequences, and of all the places in my code where I make possibly needless
copies of a dictionary, it is usually to modify the dictionary with a clear
conscience, not something that immutability would solve.

Jon.



From cgw at alum.mit.edu  Tue Apr 25 17:51:13 2000
From: cgw at alum.mit.edu (Charles G Waldman)
Date: Tue, 25 Apr 2000 15:51:13 -0600
Subject: SV: editor for win32
References: <7BD10B680501D411B9DF009027E06F32011A4E@Server.Exchange>
Message-ID: <8e50g2$i01$1@info3.fnal.gov>

> Fra: Scott Hathaway [mailto:slhath at flash.net]
> 
>> Can anyone recommend a python editor for Windows?

XEmacs is ported to Windows and has the best Python
support of any editor going (as well as being, IMO, one
of the finest pieces of software ever written).   See 

 http://www.xemacs.org



From pinard at iro.umontreal.ca  Tue Apr  4 13:04:15 2000
From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=)
Date: 04 Apr 2000 13:04:15 -0400
Subject: New Features in Python 1.6
In-Reply-To: Lloyd Zusman's message of "01 Apr 2000 23:10:47 -0500"
References: <200004011740.MAA04675@eric.cnri.reston.va.us> <_pyF4.25562$E85.640966@news1.rdc1.md.home.com>  
Message-ID: 

Lloyd Zusman  writes:

> I'll use the new compression algorithm I recently invented.  It's amazing!
> .. it compresses *anything* down to one bit.

Beware.  It might be patented already...  Let's see.  Does it work this way?

* If the file is empty, you're done.
* If the file holds a single bit, you're done.
* Split the whole file into pairs of sequences, the first part of the pair
  being an eager, but possibly empty sequence of consecutive zero-bits,
  the second part being an eager, but possibly empty sequence of consecutive
  one-bits.  Notice that there is only one way to do this split.
* Replace each sequence above by the count of bits it contains, expressed
  directly as a binary number for the first count of the pair, and as the
  one-complements of the binary number for the second count of the pair.
  Notice that given these counts, it is trivial to rebuild the contents
  of the previous step.
* Iterate.

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard





From robin at jessikat.demon.co.uk  Fri Apr 21 07:05:56 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Fri, 21 Apr 2000 12:05:56 +0100
Subject: finding real $0
In-Reply-To: <20000421124817.C11481@xs4all.nl>
References: 
 <20000421124817.C11481@xs4all.nl>
Message-ID: 

In message <20000421124817.C11481 at xs4all.nl>, Thomas Wouters
 writes

That's what I need :)
>On Fri, Apr 21, 2000 at 10:55:26AM +0100, Robin Becker wrote:
>
>> Is there any pythonic way to locate the original argument zero of the
>> process? I mean the location of python itself not the script. This would
>> allow me to launch subscripts without having to rely on the path being
>> set up correctly.
>
>Use 'sys.executable':
>
>centurion:~ > python
>>>> import sys 
>>>> sys.executable
>'/usr/bin/python'
>
>centurion:~ > ln -s /usr/bin/python penguin-on-the-telly
>centurion:~ > ./penguin-on-the-telly 
>>>> import sys
>>>> sys.executable
>'./penguin-on-the-telly'
>
>It behaves the same way in a script (it returns the python executable
>started, not the script.) Dont forget about relative paths though, if you
>are going to do stuff based on sys.executable. You probably want to get the
>cwd at the earliest possible moment, and translate sys.executable into an
>absolute path.
>

-- 
Robin Becker



From hamish_lawson at yahoo.co.uk  Thu Apr  6 05:28:24 2000
From: hamish_lawson at yahoo.co.uk (Hamish Lawson)
Date: Thu, 06 Apr 2000 02:28:24 -0700
Subject: UserDict's has_key() and get() should use __getitem__()
References: <0535db98.ec878f67@usw-ex0101-005.remarq.com>  <29328840.06b5b87b@usw-ex0101-005.remarq.com> <8cgdp3$nm5$1@slb6.atl.mindspring.net>
Message-ID: <0aa264d3.021266df@usw-ex0101-005.remarq.com>

Andrew Dalke wrote:

>I don't believe your estimate, that UserDicts are usually
>derived "for the purpose of providing new definitions of
>setting and getting items", is correct.

It may well not be. When I reread what I'd written I see that
I've made more of a claim that I meant to regarding the reasons
why UserDict is subclassed, when I was really just venturing a
guess on that.

>In addition, in a good OO design, you should be able to use
>an instance of a derived class anywhere you use an instance
>of a base class.  Your example (a caseless Dict), changes
>how/when lookup failures occur.

An instance of CaselessDict could still be used wherever an
instance of UserDict could be, in the sense that it supports the
same operations. However if it's considered part of UserDict's
contract that unique strings should be able to be used as
separate keys, then it's true that CaselessDict violates this.
Perhaps this wasn't my best example.

>Then Python's UserDict is just an implementation of the
>AbstractUserDict base class. ... And because this is Python,
>it's easy to implement.

I see where you and Michael are coming from. And if UserDict
*is* considered an implementation of a (possibly notional)
abstract class, then I suppose it is reasonable for it to use an
implementation that it is more efficient. I suppose what I was
after was to have UserDict still provide a useful default
implementation (albeit a bit less efficient one*), but make it
more abstract (semi-abstract?) to make it more easily subclassed
and to let aspects of the default implementation be more readily
replaced.

* Do we know how much less efficient?

But so far my proposal doesn't seem to have won favour. Ah
well :-)

Thanks for your thoughts.

Hamish



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From lenny at squiggie.com  Mon Apr 10 16:43:56 2000
From: lenny at squiggie.com (Lenny Self)
Date: Mon, 10 Apr 2000 13:43:56 -0700
Subject: using httpdlib with a proxy server
References: 
Message-ID: 

Ok.  I can use urllib to send a get request through a proxy server.  It will
return the page as well as the headers.  I am not, however, able to pull out
the error code (ie 200,404).  I need these codes as part of my logging .
Does anyone have any suggestions? Am I just not seeing where to pull them
from in the urllib module?

Thanks.

    -- Lenny Self
        lenny at squiggie.com


"Lenny Self"  wrote in message
news:ChoI4.844$g54.17363 at news.uswest.net...> I am attempting to write a
small script that sends a list of URLs though a
> proxy server and then records a bit of information on the respose.  I
though
> I could use the httplib module to help with this, however, I don't see
where
> it can send a request though a proxy server. Does anyone know of a module
> that will allow me to do this?
>
>
>     -- Lenny Self
>         lenny at squiggie.com
>
>




From tjreedy at udel.edu  Tue Apr  4 14:30:06 2000
From: tjreedy at udel.edu (Terry Reedy)
Date: Tue, 4 Apr 2000 14:30:06 -0400
Subject: New Features in Python 1.6
References: <200004011740.MAA04675@eric.cnri.reston.va.us> 
Message-ID: <8cdbvg$3vi$1@news.udel.edu>

> Python strings can now be stored as Unicode strings.  To make it easier
> to type Unicode strings, the single-quote character defaults to creating
> a Unicode string, while the double-quote character defaults to ASCII
> strings.

' = 1 byte/char, " = 2 bytes/ char is more straightforward.

El Gato Sonreyendo







From ullrich at math.okstate.edu  Sat Apr  1 13:45:49 2000
From: ullrich at math.okstate.edu (David C. Ullrich)
Date: Sat, 01 Apr 2000 12:45:49 -0600
Subject: Function override?
References: <8c0dtu$lr3$1@nnrp1.deja.com> <38E4D7A4.4C83CFF7@math.okstate.edu> <8c4mds$5p7$2@slb6.atl.mindspring.net>
Message-ID: <38E643DD.76C31FAE@math.okstate.edu>

Andrew Dalke wrote:

> David C. Ullrich wrote:
> >    This is certainly one of the things that _I_ find keen,
> >amyway - I hope the people who are talking about adding
> >stricter typing to Python make it optional somehow. There
> >are obvious advantages to stricter typing but you lose
> >something as well. (For example, I get a big kick out of
> >the fact that exactly the  same euclidean-algorithm code
> >works to find the GCD of two integers or the GCD of
> >two polynomials. Etc.)
>
> I went to a talk by Stepanov about the Standard Template
> Library in C++.  One of his examples was a geneic GCD
> algorithm which works on integers and polynomials.  Thus,
> stricter typing and generic programming don't have to
> be the same thing.

    Either I have the meaning of some of the terms backwards
or there was a typo in that last sentence. Did you really mean
something like "Thus, stricter typing and generic programming
need not be incompatible" or something?
    If you meant what you wrote I've got the meaning of at
least one of the words backwards. If you meant more or less
what I conjecture you meant: I didn't mean to say anything
about C++, I know nothing about it. Just meant to point
out that a person could do "generic" programming in
Python very easily.

>
> In Python, this could be done by a syntax requiring not
> that "i" and "j" are ints, but that type(i) == type(j).
>
>                     Andrew
>                     dalke at acm.org



From remove.me.wwicker at spectratechnologies.com  Fri Apr 28 13:53:53 2000
From: remove.me.wwicker at spectratechnologies.com (William Wicker)
Date: Fri, 28 Apr 2000 17:53:53 GMT
Subject: Python COM troubles
References: <390a2f04.149999918@news.onlineisp.com> 
Message-ID: <390acf5e.62946872@news.onlineisp.com>

On Thu, 27 Apr 2000 00:46:35 GMT, "Mark Hammond"
 wrote:

>"William Wicker"  wrote in
>message news:390a2f04.149999918 at news.onlineisp.com...
>
>> Is there a way around this appearance of typelessness? There is a type
>> library, and I've run make-py successfully. I just can't see an easy
>> way into it.
>
>You can try running "makepy.py -i", and select your type library.  This
>will spit out some code, something like:
>
>gencache.EnsureModule(...)
>
>change this to:
>
>mod = gencache.EnsureModule(...)
>
>And you should be able to create any of the class objects in the makepy
>module - eg:
>
>ob = mod.TheClassName()
>
>If you search deja news, there should be lots of info about this - but
>generally relating to "Lotus Notes", which also has the same problem.
>
>[BTW - drop them a line, and tell them they should fix their objects :-]
>

Can you fill me in with what in particular I should complain about?
Comments that RTTI was lacking brought the response that
QueryInterface was supported.

Also, (did I already ask this?) I'm guessing that using the
EnsureModule approach will make DispatchWithEvents unavailable.
Reading dynamic.py suggests that there is an alternate (more complex?)
way.

(I hate knowing what I want to do, but not how to do it.)

	William.



From thomas at cintra.no  Wed Apr 26 09:24:55 2000
From: thomas at cintra.no (‘5ÛHH575-UAZWKVVP-7H2H48V3)
Date: Wed, 26 Apr 2000 13:24:55 GMT
Subject: Best database to use with Python
Message-ID: <3906ea27.698463777@news.online.no>

Hi,

What database-system is easiest, fastest etc. to use with Python? I`ve
looked at MySQL, but it seems a little overkill just to get a little
more functionality than Berkley DB-functionality. What about Postgres?
mSQL? 

Postgres comes with my Linux distro and seem smaller than MySQL. How
does it compare to MySQL when it comes to administration and speed,
scalability etc. ?

I`m doing alot of index-lookups for a
Yahoo/Altavista/WhatEverSearchEngine-like web-app.


It have to be fast, capable of HUGE amounts of data, free and easy to
install and administer.



Hints???!

Thomas




From gmcm at hypernet.com  Tue Apr 11 10:54:48 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Tue, 11 Apr 2000 10:54:48 -0400
Subject: Processing BCD and Signed Integer Fields with Python
In-Reply-To: <38f334ea@wwwproxy3.westgroup.com>
Message-ID: <1256657606-41178742@hypernet.com>

Chris Lada wrote:

> We have been receiving record/field-based information from a data provider.
> Some of the fields are BCD (Binary Coded Decimal), and some are signed
> integer. The data originates from a mainframe/Cobol(?) system. The record
> layouts have definitions like "PIC S99999" (signed integer), and "PIC S99999
> Comp-3" (BCD). Has anyone had to process this sort of data with Python ?
> Can Python handle this sort of data type ?  Anyone have suggestions on how
> to approach this problem ?

You want the struct module.

- Gordon



From alex_c at mit.edu  Wed Apr 19 21:12:26 2000
From: alex_c at mit.edu (Alexander S Coventry)
Date: 19 Apr 2000 21:12:26 -0400
Subject: Where do I send a contribution for the Starship recovery ?
References: 
Message-ID: 

> I personally would consider it money well spent.
> (unlike most of the other things I spend money on)
> 		      Roger Upole

Please also send your donation four times. :)

Alex.


From michael.stroeder at inka.de  Sun Apr 16 08:03:08 2000
From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Sun, 16 Apr 2000 14:03:08 +0200
Subject: Python CGI
References: <38F852D9.E2144F17@flashmail.com>
Message-ID: <38F9ABFC.EDF7E70B@inka.de>

Jp Calderone wrote:
> 
> Whenever a form that uses
> the Python script as its ACTION, the python scripts seems to get 
> executed about 8 times.

 ?

Ciao, Michael.


From mwh21 at cam.ac.uk  Wed Apr  5 13:12:36 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 05 Apr 2000 18:12:36 +0100
Subject: Why should I switch to Python?
References: <000701bf9c5a$b806b420$752d153f@tim>    <050420000914595917%pecora@anvil.nrl.navy.mil> 
Message-ID: 

Johann Hibschman  writes:

> Louis M Pecora writes:
> 
> > In article , Michael Hudson
> >  wrote:
> 
> >> don't know it; I think it involves slinging Riemann zeta functions).
> >                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> > There's a good phrase.
> 
> Holy slinging Riemann zeta functions, Batman!
> 

 - mind you "Riemann zeta function" is a pretty cool name for
any function.  I also like "Weierstrass p-function", but mainly
because the p is usually drawn in an entertainly deranged way.

what-was-this-ng-about-again?-ly y'rs
Michael

-- 
  nonono,  while we're making wild  conjectures about the behavior 
  of completely  irrelevant tasks,  we must not  also make serious 
  mistakes, or the data might suddenly become statistically valid.
                                      -- Erik Naggum, comp.lang.lisp


From phd at phd.russ.ru  Mon Apr 24 07:26:09 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Mon, 24 Apr 2000 11:26:09 +0000 (GMT)
Subject: Installing PyApache
In-Reply-To: <3901CF0C.E9A722F6@myself.com>
Message-ID: 

On Sat, 22 Apr 2000, Wayne Izatt wrote:
> I tried to build Apache with PyApache. I already have Python 1.5.2
> installed (with tkinter).
> 
> The build dies when linking, complaining that a whole bunch of tk...
> references can't be resolved.
> 
> Now, since PyApache probably won't be needing tkinter ;-) is there any
> simple way to prevent this situation.
> 
> (I suspect that rebuilding Python without tkinter support might do the
> trick, but that seems like a long way round).

   I guess that you've built your Python static, or at least built  it with
static tkinter? Than there is no way to avoid rebuilding...

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.




From alwagner at tcac.net  Sun Apr 23 13:22:52 2000
From: alwagner at tcac.net (Albert Wagner)
Date: Sun, 23 Apr 2000 12:22:52 -0500
Subject: The Simple Economics of Open Source
References: 
Message-ID: <3903316C.5D6F1611@tcac.net>

Raffael Cavallaro wrote:
> 
> 
> Sarcasm aside, I think you miss the point. Those artists least willing to
> share, most jealous of their "secrets" have always been those who were most
> successful. Unsucessful young artists are, by and large, quite willing to
> share ideas, working techniques, etc. It's actually the more established,
> financially succesful ones, who are not.
> 

I think you confuse artifice and art.  Talent is not a "secret" that can
be hoarded or shared.  It is visible in the end product, yet no amount
of sharing how it was done will allow the process to be duplicated.  I
think you also are confused about what "successful" means to a talented
person.  The "commodification" (sorry, Marx) of anything and everything,
assigning it a dollar value, is at the very root of the mindset that is
destroying the world. 
-- 
Small is Beautiful


From aycock at csc.uvic.ca  Thu Apr 27 12:24:16 2000
From: aycock at csc.uvic.ca (John Aycock)
Date: 27 Apr 2000 16:24:16 GMT
Subject: [ANNOUNCE] SPARK 0.6.1
Message-ID: <8e9pjg$4cjm$1@uvaix7e1.comp.UVic.CA>

The latest release of SPARK, the Scanning, Parsing, and Rewriting Kit, is
available at

	http://csr.uvic.ca/~aycock/python

Version 0.6.1 fixes a bug in the parser; sorry if it inconvenienced anyone!

Also, if you'd be interested in testing SPARK pre-releases, please send
me some mail and I'll add you to the list.  (Well, first I'll *make* a
list, then I'll add you to it :-)

John


From slhath at flash.net  Fri Apr 21 09:10:08 2000
From: slhath at flash.net (Scott Hathaway)
Date: Fri, 21 Apr 2000 13:10:08 GMT
Subject: editor for win32
References: 
Message-ID: 

Thanks for all the good input!

I am new to python and excited about giving it a whirl.

Scott

"Scott Hathaway"  wrote in message
news:NpHL4.779$fK2.113609 at news.flash.net...
> Can anyone recommend a python editor for Windows?
>
> If there is an IDE for windows (other than IDLE), even better.
>
> Thanks,
> Scott
>
>




From phd at phd.russ.ru  Thu Apr  6 03:58:34 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Thu, 6 Apr 2000 07:58:34 +0000 (GMT)
Subject: looking for LL(1), LR(1), or LALR(1) syntaxic analysis in python.
In-Reply-To: <00bc01bf9f9e$240c53a0$1001a8c0@nevrax.net>
Message-ID: 

On Thu, 6 Apr 2000, Sameh chafik pro wrote:
> At present i develop an open source in agent IA, i write for you because
> i'm looking for any LL(1), LR(1), or LALR(1) syntaxic analysis in python
> implementation.

   http://csr.uvic.ca/~aycock/python/
   http://theory.stanford.edu/~amitp/Yapps/

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.




From tim.hochberg at ieee.org  Wed Apr 26 13:46:25 2000
From: tim.hochberg at ieee.org (Tim Hochberg)
Date: Wed, 26 Apr 2000 17:46:25 GMT
Subject: Simple del[] list question
References: 
Message-ID: 

"Matthew Hirsch"  wrote:
> Hi All,
>
> What is going on here?
>
> This leaves a intact.
>
> >>> a=[[1,2,3],[4,5,6]]
> >>> b=a[:]

This makes a _shallow_ copy of a. It's probably more obivous what's going on
if we name the sublists in a"

>>> x = [1,2,3]
>>> y = [4,5,6]
>>> a = [x,y]  # This is equivalent to a=[[1,2,3],[4,5,6]]
>>> b = a[:]

Since this makes a shallow copy, b is a new list containing x and y. In
other words, in this case, b = a[:] is equivalent to b = [x, y].

> >>> del b[0]
> >>> b
> [[4, 5, 6]]

This removes x from b, but since a is a copy of b it has no effect on a.

> >>> a
> [[1, 2, 3], [4, 5, 6]]
>
>
> This also changes a.
>
> >>> a=[[1,2,3],[4,5,6]]
> >>> b=a[:]
> >>> del b[0][0]

Here del b[0][0] is equivalent to del x[0]. Since a and b share x, this
effects both arrays.

> >>> b
> [[2, 3], [4, 5, 6]]
> >>> a
> [[2, 3], [4, 5, 6]]
>
> Why did a change?  Why suddenly when you go to two dimensions does the
> behavior change?

Hope the helps,

-tim





From nascheme at enme.ucalgary.ca  Mon Apr 17 18:17:50 2000
From: nascheme at enme.ucalgary.ca (Neil Schemenauer)
Date: Mon, 17 Apr 2000 22:17:50 GMT
Subject: Filtering web proxy
References:  
Message-ID: 

Erno Kuusela  wrote:
>a html parser would need to work incrementally, unless you want to
>wait for the whole document to be transferred over the network before
>seeing any of it rendered.

Yes and if your connection is fast enough that you don't need
incremental loading you probably don't care too much about ads.
In my experience, filtering ads greatly enhances your experience
if your browsing on a slow connection.

>i guess you could do it incrementally with sgmllib (iirc you feed it a
>file object?), but you run into the fact that a big part of
>the html documents on the web are malformed and rely on the
>error correcting heuristics of the major browsers to function...

Right and there seems to be a lot of bad HTML code out there.
Unfortunately, I don't think you can easily make sgmllib parse
incrementally.  Someone please correct me if I'm wrong.

Is the situation with XML the same as HTML?  Are XML documents
forced to adhere to the standard or are parsers supposed to try
to do something intelligent with whatever crap they get fed?

>one starting point could be the "gray proxy" (i forget what it was
>really called). that was written on top of medusa, i think there was
>an announcement here? probably a year or so ago.  it parsed the html
>and changed all the colors to grayscale, and did the same for
>images. medusa isn't free though.. (except the version in zope?)

You can try my "munchy" proxy.  Its at:

    http://www.enme.ucalgary.ca/~nascheme/python/

Saying that is parses HTML is a bit of a stretch however.  It
just uses a couple of regexs.  I'm sure Tim Peters would love
it. :)

In my experience, filtering ads at the HTML level is more
effective than filtering at the request level (like junkbuster).
My list of blocked URLs is very short but still catches ads on
almost all the sites I visit.  Also, when ads are filtered I
usually cannot tell by looking at the page.  Of course, YMMV.


    Neil

-- 
HTML needs a rant tag. --Alan Cox


From ullrich at math.okstate.edu  Tue Apr  4 14:38:21 2000
From: ullrich at math.okstate.edu (David C. Ullrich)
Date: Tue, 04 Apr 2000 13:38:21 -0500
Subject: Why should I switch to Python? - Infinity of Primes
References:  <8ccoug$f4o$1@pegasus.csx.cam.ac.uk> <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net>
Message-ID: <38EA369C.26A1C25@math.okstate.edu>

    Seeing your name here for a second I was confused
whether I'd hit the sci.math button...

    There's nothing non-constructive about the traditional
proof of the infinitude of the sequence of primes - given
a sequence of primes it _constructs_ a prime not on the
list. (Of course it doesn't actually return infinitely many
primes in one calculation, but neither does any other
algorithm.) Could be that there's a proof of the existence
of infinitely many primes using FTA that has some property
not shared by Euclid's proof, but "constructive" isn't it.

Cameron Laird wrote:

> In article <8ccoug$f4o$1 at pegasus.csx.cam.ac.uk>,
> Nick Maclaren  wrote:
> >
> >In article , "Dennis E. Hamilton"  writes:
> >|> The standard approach is a proof by contradiction starting from the
> >|> assumption that there is a largest prime.
> >
> >There is also a constructive proof based on the Fundamental
> >Theorem of Arithmetic, that is little more complex.
>                         .
>                         .
>                         .
> To what extent are constructive proofs supplanting *... ad
> absurdum* as standards?  At about the time I left academe
> I was working on my own arguments that our conventional
> view of the former as "more complex" is, as Brouwer et al.
> taught, essentially only convention.  Tilting at construc-
> tivist windmills is one of the half-dozen careers I'm
> considering for my retirement; I recognize, though, that
> I've quite lost touch with current practice.
> --
>
> Cameron Laird 
> Business:  http://www.Phaseit.net
> Personal:  http://starbase.neosoft.com/~claird/home.html



From mal at lemburg.com  Mon Apr  3 09:12:58 2000
From: mal at lemburg.com (M.-A. Lemburg)
Date: Mon, 03 Apr 2000 15:12:58 +0200
Subject: [Python-Dev] Re: New Features in Python 1.6
References: 
Message-ID: <38E898DA.B69D7ED6@lemburg.com>

Mark Hammond wrote:
> 
> >
> > > On Sat, Apr 01, 2000 at 12:00:00PM -0500, Guido van
> > Rossum wrote:
> >
> > The above line has all the answers ;-) ...
> 
> That was pretty sneaky tho!   Had the added twist of being
> half-true...

... and on time like a CRON-job ;-)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





From ngps at madcap.dyndns.org  Sat Apr  8 11:58:49 2000
From: ngps at madcap.dyndns.org (Ng Pheng Siong)
Date: 8 Apr 2000 15:58:49 GMT
Subject: Paid to work in Python? (was: Re: Choice Of Language)
References:  <38e5f8ed.29659873@news.nikoma.de> <8cl2mq$971$1@mawar.singnet.com.sg> <38ee674b.1229749@news.main-echo.net>
Message-ID: <8cnkvp$t89$1@violet.singnet.com.sg>

According to Arnold Weis :
> ngps at madcap.dyndns.org (Ng Pheng Siong) wrote:
> 
> >I once saw a German term that was translated to "improve-worse-ment."
> >
> >Can some one provide the German word, please?
> 
> Verschlimmbesserung?
> (Trying to make something better, but making it worse instead)

Thanks. That must be it, since so far all posters from .de say so. ;-)

I like that word very much. ;-)

Cheers.


-- 
Ng Pheng Siong  * http://www.post1.com/home/ngps



From embed at geocities.com  Tue Apr 11 09:10:58 2000
From: embed at geocities.com (Warren Postma)
Date: Tue, 11 Apr 2000 09:10:58 -0400
Subject: Why should I switch to Python?
References:   
Message-ID: 

> I always suspected perl programmers were from Mars.  Now if we could
figure
> out where python programmers are from, someone could write a book and get
> rich.

Yorkshire.







From mskott at image.dk  Sun Apr 23 15:18:30 2000
From: mskott at image.dk (Martin Skøtt)
Date: Sun, 23 Apr 2000 19:18:30 GMT
Subject: Trouble compiling PyGreSQL 2.4 on Linux
Message-ID: 

Hi 
I'm trying to compile the PyGreSQL 2.4 module on my Red Hat Linux 6.1
box. I use the following command:

gcc -fpic -shared -o _pg.so -I/usr/include/python1.5
-I/usr/local/pgsql/include pgmodule.c -lpq

With the following result:
pgmodule.c: In function `pgconnect':
pgmodule.c:694: warning: passing arg 4 of `PyArg_ParseTupleAndKeywords' from incompatible pointer type
/usr/bin/ld: cannot open -lpq: No such file or directory

I can't use the make command mentioned in the readme.linux file
because the simply isn't any make file in the archive. Can you help me
getting it compiled?

And a little addon queston:
How stable is the DB-API version of the PostgreSQL module? Can it
be used for production work (or semi serious)?

-- 
Martin Sk?tt
mskott at image.dk

'In a certain sense, all decent programming languages are equally powerfull'
Dr. Alan Turing


From gresham at mediavisual.com  Fri Apr  7 12:27:43 2000
From: gresham at mediavisual.com (Paul Gresham)
Date: Sat, 8 Apr 2000 00:27:43 +0800
Subject: CGI Help Needed
References: <8ck9uo$ga08@imsp212.netvigator.com> <38EDDA7B.47FC3FDE@mach.uni-karlsruhe.de>
Message-ID: <8cl2a2$kcn4@imsp212.netvigator.com>

Hi Andreas,
Thankyou for your suggestion, (and thanks to everyone else who responded).
Actually I have a book on PHP programming but never looked this up in there,
dispite spending hours searching the web for answers.

For anyone who is interested, Prentice Hall, Core PHP Programming, Atkinson,
ISBN 0-13-020787-X Pages 475-479 has an entire article on PHP session
tracking with a recommended approach and sample code. Exactly what I needed
for my Python project, very simple (as expected) but just one of those
things that looks like magic until you see the trick.

Regards
Paul Gresham

"Andreas Cardeneo"  wrote in message
news:38EDDA7B.47FC3FDE at mach.uni-karlsruhe.de...
>
> >
> > What is the normal and respected method of User authentication on a web
> > site, how should I present a login box when the user is not
authenticated
> > already, and how do I maintain a session with an authenticated user,
without
> > using cookies, allowing them to continue surfing around the web site ?
>
> Hi,
>
> well. I think you're right that this is not exactly Python specific, but
> you might
> use Python in a CGI-script to look up session-keys. If you have a look
> at PHP, then
> you will see that there is a function to generate a session key (some
> large number
> that can not be guessed easily and has some checksum in it) that you
> pass to your pages
> as a URL paramter in the form "?session=4242424242424242&nextpar=....".
> You then evaluate
> the key in your script looking it up in a database or file and checking
> if it is still
> valid.
> I would certainly not use JavaScipt to authenticate the user because the
> implementations
> have some security problems. If I remember correctly Microsoft had
> problems on their
> Hotmail-system with Javascript. One possibility would be to use the
> .htaccess file of
> a directory and let the browser/server check authorization. But that's
> probably a bad idea
> for larger sites. You could better use a form within a frame on your
> page so the URL is
> not being displayed in the browser location line (but in the HTML code
> it is).
>
> Hope this helps,
>
> Andreas




From rurban at x-ray.at  Sun Apr  9 11:21:11 2000
From: rurban at x-ray.at (Reini Urban)
Date: Sun, 09 Apr 2000 15:21:11 GMT
Subject: win32all-130 for Python 1.6 available
References: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au>   
Message-ID: <38f0a0c1.21524280@judy>

Wolfgang Strobl wrote:
>"Mark Hammond"  wrote:
>May I take the opportunity to suggest another feature? The Zope sources,
>like many others packages, have each and every file starting with a
>lengthy, boring copyright message, license, or something similar, which
>doesn't aid in understanding a programs structure in any way.  Wouldn't
>it be nice if "Toggle top-level" and "Collapse all" would collapse
>comment blocks, too?

you may want to look at the hide-copyleft.el emacs module.
A very recent version is at my site, for the string regexp's to fold at.

http://xarch.tu-graz.ac.at/autocad/lsp_tools/ntemacs/hide-copyleft.el
--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html


From weil at sireconnect.de  Tue Apr 18 11:07:34 2000
From: weil at sireconnect.de (Weil)
Date: Tue, 18 Apr 2000 17:07:34 +0200
Subject: Tkinter items question
Message-ID: <38fc7a7d@news2.sireco.de>

Hello,
I'm making a little drawing tool using Tkinter, where
the user can delete the last item by right-clicking with
the mouse (and by continuing to click clean the whole
canvas). The following method (of my canvas class)
does just what I want:

def DeleteLastItem(self,event):
    items = self.find_all()
    if items:
        self.delete(items[-1])

But, I was wondering, if there is a more direct way to
access the last item other than retrieving all items first.
I could of course keep a list of all created items myself,
but that seems a bit ugly, especially as my app couldn't
use this list for anything else.
It is also not possible to just hold the last item's  id and
just decrease it when deleting. There is no guarantee,
that the ids are consecutive integers, at least when
mixing creation and and deletion of items. (I know, I've tried).

So, did I just miss the right spot in the fine manuals (even tried
that of Tk) ?
I'd appreciate any suggestions that might help me cure my
uneasiness with the above code.
Thanks.




From boud at rempt.xs4all.nl  Sat Apr 15 13:44:32 2000
From: boud at rempt.xs4all.nl (Boudewijn Rempt)
Date: 15 Apr 2000 17:44:32 GMT
Subject: Scripting and Gnome and KDE
References:  <3dk8hzb90u.fsf@newcnri.cnri.reston.va.us>
Message-ID: <8da9q0$j0t$1@news1.xs4all.nl>

Andrew Kuchling  wrote:
> Moshe Zadka  writes:
>> Personally I chose Gtk+/GNOME, since (among other things), the Gtk+ type
>> system is specifically targetted to support bindings to other languages.

> I've played a bit (only a bit, though) with both PyGTk and PyQt.
> While I think I marginally prefer PyGTk, because James Henstridge has
> done a really nice job of writing the bindings, I use KDE on my
> desktop at home and at work, and therefore the PyQt/KDE bindings are
> of greater practical interest to me.  They're pretty good, too, though
> the extension module is utterly huge, around 4Mb last time I looked.

Depending on whether you also want KDE support, that's a bit better
now. The qt extension library is just 2Mb now. Of course, adding the
various KDE libraries adds a bit of weight, too - but the most
important, kdecore is just 300Kb. The days when doing an import qt
added 12Mb to you program are long gone!

> Every so often I go to some Linux conference and come within the range
> of Miguel de Icaza's reality distortion field, and I get all excited
> over some new GNOME feature, such as Bonobo's embedding, and try to
> compile GNOME when I get home.  Then reality sets in: GNOME uses
> patched versions of all sorts of things such as automake, but this is
> never clearly documented anywhere.  There's a large pile of libraries,
> and it's not clear which ones are needed and which ones are obsolete;
> oh, you need imlib, but wait, it's been replaced by gdk-pixbuf, and
> esound has been replaced by something else... Usually I never manage
> to get a fully working GNOME setup, and the reason for the failure is
> usually not apparent.

Just wait until PyKDE supports dCop and kParts... And for other fun things
I'm going to try and build a Unicode text editor with Python 1.6 and
PyQt 0.11 this week - should be possible, since both support Unicode now.
(That's one thing I thought really impressive in Idle - paste a bit
of unicode in the editor, run it, and it prints the correct Unicode
characters!)

> KDE, on the other hand, is pretty easy to compile, even from the CVS
> tree; compile Qt, compile kdesupport and kdelibs, and that's it --
> you're all set to compile chosen applications.  Much better
> structuring of the development environment -- KDE's setup shares some
> of Python's elegance.  (Maybe it's a European thing... :) ) So it's
> odd; while I prefer PyGTk, it's tied to a much less well-structured
> environment and hence loses out through no fault of its own.

I'd say that the general design of Qt is cleaner, too. At least, I'd
say that if I had spent enough time looking that the gtk design. Qt
_is_ very clean, though.

-- 

Boudewijn Rempt  | http://www.valdyas.org


From cut_me_out at hotmail.com  Tue Apr 18 17:57:53 2000
From: cut_me_out at hotmail.com (Alex)
Date: 18 Apr 2000 17:57:53 -0400
Subject: Date class?
References: <8dikk2$p4s@flatland.dimensional.com>
Message-ID: 

You could try normalDate.  I have found that fairly useful, once or
twice.

Alex.


From mwh21 at cam.ac.uk  Sun Apr 16 13:31:52 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 16 Apr 2000 18:31:52 +0100
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8dbdj3$dgt$1@slb2.atl.mindspring.net> <8dcpom$fbc$1@slb3.atl.mindspring.net>
Message-ID: 

"Andrew Dalke"  writes:

> def expression_if(test, true_string, false_string):
>   # some nasty code to get the locals of the calling function
>   if test:
>     return eval(true_string with the given locals)
>   else:
>     return eval(false_string with the given locals
> 
> x = expression_if(a is not None, "a[i].weeble", "0") + ...
> 
> but that's just too ugly.

bytecodehacks can do this (except that the relavent bits seem to have
suffered bit-rot; I'll do something about that presently).

I also can't remebmer how that bit of bytecodehacks works (! - just as
well I wrote docs ).

Cheers,
M.

-- 
  "declare"?  my bogometer indicates that you're really programming
  in some other language and trying  to force Common Lisp into your
  mindset.  this won't work.           -- Erik Naggum, comp.lang.lisp


From MSteed at altiris.com  Thu Apr 20 15:35:49 2000
From: MSteed at altiris.com (Mike Steed)
Date: Thu, 20 Apr 2000 13:35:49 -0600
Subject: editor for win32
Message-ID: <65118AEEFF5AD3118E8300508B1248774CB2AC@ALTNET>

I'm sure lots of people will recommend the Pythonwin IDE by Mark Hammond.
You can find links to it from the python.org site.

As a Vim addict, I have to mention it as well ( http://www.vim.org/ ).  It
comes with Python syntax highlighting.  There are suggestions for useful
mappings, etc., in the newsgroup archives.

Mike

> From: Scott Hathaway [mailto:slhath at flash.net]
> Sent: Thursday, April 20, 2000 11:48 AM
> To: python-list at python.org
> Subject: editor for win32
> 
> 
> Can anyone recommend a python editor for Windows?
> 
> If there is an IDE for windows (other than IDLE), even better.
> 
> Thanks,
> Scott



From mwh21 at cam.ac.uk  Tue Apr 25 13:48:15 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 25 Apr 2000 18:48:15 +0100
Subject: Don't understand error message
References: <65118AEEFF5AD3118E8300508B1248774CB2B4@ALTNET>
Message-ID: 

Mike Steed  writes:

> > Cheers,
> > M.
>   ^^
> (I thought that was my .sig)
> M.

Well, my other signoff is:

Cheers,
Michael

which isn't necessarily any more distinctive.

oh,-now-what-do-I-do?-ly y'rs
m.

-- 
39. Re graphics:  A picture is worth 10K  words - but only those 
    to describe the picture. Hardly any sets of 10K words can be 
    adequately described with pictures.
     -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html


From dworkin at ccs.neu.edu  Tue Apr 18 18:53:14 2000
From: dworkin at ccs.neu.edu (Justin Sheehy)
Date: 18 Apr 2000 18:53:14 -0400
Subject: Forward References?
In-Reply-To: "Jeff Massung"'s message of "Tue, 18 Apr 2000 14:12:13 -0600"
References:  
Message-ID: 

"Jeff Massung"  writes:

> >class a:
> >   def x(self):
> >      y(self)

> Should this be a.y(self)?

No, it should be self.y()

It could be a.y(self), and that would work for many cases, but that
isn't really what you want.

> Also, someone mentioned above having: self.y() (or self.y(self)), my
> question is what is the difference between a.y and self.y?

It's easy to find out in the interactive interpreter.

>>> class a:
...  def y(self):
...   print 1
... 
>>> b = a()
>>> a.y

>>> b.y

>>> b.y()
1
>>> a.y()
Traceback (innermost last):
  File "", line 1, in ?
TypeError: unbound method must be called with class instance 1st
argument
>>> a.y(b)
1

Or, of course, one could read the documentation or tutorial.  This is
pretty well explained, iirc.

-Justin

 



From fredrik at pythonware.com  Wed Apr  5 07:54:15 2000
From: fredrik at pythonware.com (fredrik at pythonware.com)
Date: Wed, 05 Apr 2000 11:54:15 GMT
Subject: Python 1.6 alpha 1 released
References:  <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <5l7leern5v.fsf@eric.cnri.reston.va.us> <8cdg92$j0m$1@nntp6.u.washington.edu> <8cdig3$s7f$1@slb6.atl.mindspring.net> 
Message-ID: <8cf9h2$ipa$1@nnrp1.deja.com>

Toby Dickenson wrote:
> Does the single-argument connect require a 2-tuple, or just a two
> element sequence?

sure.

class WebServer:
    def __init__(self, host, port=80):
        self.address = host, port
    def __len__(self):
        return len(self.address)
    def __getitem__(self, index):
        return self.address[index]

import socket

host = WebServer("www.pythonware.com")

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host)

# ...

> If a sequence will do, then you can use an address class today.

exactly.




Sent via Deja.com http://www.deja.com/
Before you buy.


From effbot at telia.com  Sun Apr  2 17:40:15 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Sun, 02 Apr 2000 21:40:15 GMT
Subject: NameError when assigning dictionary values
References: <20000402203338.21701.qmail@web2105.mail.yahoo.com>
Message-ID: <37PF4.4774$74.76551@newsc.telia.net>

lewst  wrote:
> This simple problem is driving my crazy.  I can't figure out why I get
> a NameError with this program.
>
>   # add each key-value pair to the dictionary and
>   # then for each value, create an empty list.
>   mydict = {}
>   for key,value in [ (".", "one"), ("+", "two") ]:
>       mydict[key] = value
>       value = []
>   print mydict
>   print one,two
>
> Whe I run this I get "NameError: one".  Why aren't my 2 empty lists
> named "one" and "two" being created?

I haven't the foggiest idea of what you expect Python
to do here (or why you expect it to work in that way),
but let's step through your code by hand:

>   mydict = {}

this creates an empty dictionary, named 'mydict'.

>   for key,value in [ (".", "one"), ("+", "two") ]:

this loops over a list, containing two 2-tuples.
the first time, it sets 'key' to ".", and 'value' to
"one".  the second time, it sets 'key' to "+" and
'value' to "two".

>       mydict[key] = value

this adds a member to the dictionary, with the
key "." and value "one"

>       value = []

this creates a new empty list, and changes 'value'
to point to the list instead of the original value.

not that it matters much -- the second time through
the loop, 'value' will be set to "two" by the for-in state-
ment.

>   print mydict

this prints the contents of the dictionary (which, in
this case, is something like {"+": "two", ".": "one"} )

>   print one,two

this attempts to print the variables 'one' and 'two.

there are no such variables -- you haven't assigned
them.  that's why

there are two *keys* in the dictionary, but that's a
completely different thing.  dictionaries are container
objects.  putting things is a dictionary doesn't make
it visible in the variable namespace.

I suggest reading the tutorial over again, and perhaps
signing up to the tutor mailing list.  you'll find pointers
at www.python.org.






From cut_me_out at hotmail.com  Mon Apr 17 17:54:13 2000
From: cut_me_out at hotmail.com (Alex)
Date: 17 Apr 2000 17:54:13 -0400
Subject: funny:  Re: May 27th PARTY!
References: 
Message-ID: 

> Sounds like a blast...What should I bring?

A time machine would be a good start.

Alex.


From robin at jessikat.demon.co.uk  Sat Apr 15 05:33:31 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Sat, 15 Apr 2000 10:33:31 +0100
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>
 
  <38F826CF.DBDC71EF@zipzap.ch>
Message-ID: 

In article <38F826CF.DBDC71EF at zipzap.ch>, Boris Borcic 
writes
>Just van Rossum wrote:
>> 
>> - Will Ware and I have worked hard on a complete rewrite of the
>>   uthread module. It is a *vast* improvement over the old one.
>>   It offers a very nice thread object and several handy threading
>>   widgets. It already can do stuff threading.py can only *dream*
>>   about, like pausing (blocking) a thread from another thread or
>>   posting an exception from another thread (!).
>
>Simple examples of useful new idioms that this permits ?
>
>BTW, I remember there exists a package for lisp, called
>"screamer", that turns it in a backtracking non-deterministic
>language in the style of prolog, through a device called
>CPS (continuation-passing style) transformation. While
>python lacks S-expressions and lisp-style macros that
>allow this for lisp, continuations are clearly the key
>component of this gimmick. It might be worth its while
>to have a better look.
>
>There is also Oz. http://www.mozart-oz.org/ - I've long
>dreamt of a language with some of the semantics of Oz
>and Python syntax and libs. continuations and uthreads
>seem to bring python somewhat closer to Oz.
>
...
I second this, while the ideas may be complex continuations provide some
really useful idioms eg iterators etc
-- 
Robin Becker


From tim.hochberg at ieee.org  Fri Apr  7 12:35:31 2000
From: tim.hochberg at ieee.org (Tim Hochberg)
Date: Fri, 07 Apr 2000 16:35:31 GMT
Subject: reduce versus recursion? what am I missing...
References: 
Message-ID: 

> # I am trying to figure out why function d (recursive) and e (reduce)
> # DON'T do the SAME thing:
>
> def d(*tup):
>     "why doesn't this work?"
>     if len(tup)>1:
>         return d(tup[1:])+abs(tup[0]-tup[1])
>     else:
>         return 0

There are two problems here. First, you need to call apply(d, x) here
instead of d(x), on the second call, the function sees a singleton tuple
that looks like (tup[1:],) where tup is the original tuple.

Second, the recursive problem is not doing the same thing as the reduce: the
first element of the tuple passed down the chain needs to be made equal to
the difference. I believe the following does what you want, although it's a
little akward.

def d(*tup):
    if len(tup)>1:
        l = list(tup[1:])
        l[0] = abs(tup[0]-tup[1])
        return apply(d,l)
    else:
        return tup[0]

> l = (1,3,5,7,9)
>
> def e(*tup):
>     "it works"
>     return reduce(lambda x,y:abs(x-y),tup,0)
>
> print "--- test:"
> print "recursion: ",apply(d,l)
> print "reduce:    ",apply(e,l)
>
> #---
> #Warren
> #
> # output:
> #--- test:
> #recursion:  2     ( appears not to actually be recursing more than 1
> level!!!???)
> #reduce:     5
>
>
>




From garabik at center.fmph.uniba.spam.sk  Tue Apr 25 07:05:20 2000
From: garabik at center.fmph.uniba.spam.sk (Radovan Garabik)
Date: 25 Apr 2000 11:05:20 GMT
Subject: new linereading standard?
References: <3904D21B.333DD930@visionart.com> <390510C9.A744D22E@yahoo.com>
Message-ID: <956660695.1945@cdwork.cvt.stuba.sk>

Al-Amerrho H. Amerin  wrote:
> Pete Shinners wrote:

>>
>> now i can code in a preferred style
>>
>> myfile = open('myfile.txt', 'r')
>> for line in filelines(myfile):
>>     print line
>> myfile.close()
>>
>> as opposed to
>>
>> myfile = open('myfile.txt', 'r')
>> while 1:
>>     line = myfile.readline()
>>     if not line: break
>>     print line
>> myfile.close()
>>
>>
>> _____Pete Shinners______
>>    pete at visionart.com

> A beginner myself, I would write it like this:

> inputlines = open('myfile.txt').readlines()
> for line in inputlines:
>     print line

> Instead of the 'while 1: ....break' thingy.

...with the disadvantage that this will read the whole 
file into memory, which can be a bit difficult to handle when it 
is several MB long...


-- 
 ----------------------------------------------------------
| Radovan Garabik       http://www.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__       garabik at center.fmph.uniba.sk       |
 ----------------------------------------------------------


From dalke at acm.org  Sat Apr  1 15:43:20 2000
From: dalke at acm.org (Andrew Dalke)
Date: Sat, 1 Apr 2000 13:43:20 -0700
Subject: why did string.py change in 1.6?
References: <8c4mdr$5p7$1@slb6.atl.mindspring.net> 
Message-ID: <8c5mvv$bn4$1@slb6.atl.mindspring.net>

Fredrik Lundh wrote:
> python 1.6 has two string types.  the 'strop' module
> only supports one of them.

Ah, I get it.  The new string library allows both string
and unicode list elements and seperator; returning string
only if both terms are string.

My concern about performance disappears because I can get
the join method of the seperator, as in this hypothetical
example:

  join = "\t".join
  for i in range(data.shape[0]):
    print join(data[i])

Thanks!

                        Andrew
                        dalke at acm.org





From zorro at zipzap.ch  Tue Apr 18 03:58:06 2000
From: zorro at zipzap.ch (Boris Borcic)
Date: Tue, 18 Apr 2000 09:58:06 +0200
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>   <38F9F01B.57273052@tismer.com> 
Message-ID: <38FC158E.9AC3AD79@zipzap.ch>

Michael Hudson wrote:
> 
>     Simplicity follows complexity, not the other way round.

A good illustration being given by the 10 years or so it took
*after* man's first step on the moon to devise personal delta
wings (not to speak of parachute wings).

BB


From phd at phd.russ.ru  Wed Apr 12 04:27:33 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Wed, 12 Apr 2000 08:27:33 +0000 (GMT)
Subject: simple httplib and urllib timeout question
In-Reply-To: 
Message-ID: 

Hi, there!

On Tue, 11 Apr 2000, Michal Wallace (sabren) wrote:
> meanwhile... HEY OLEG! -> have you done anything w/ this?

   I am about to release the third version of my "Bookmarks database and
Internet robot" project. It is 98% finished, I just need a bit more
testing. If you are interested, I can publish it in current beta state.

   The third version is a complete rewrite. All things had been revamped,
and rewriteen in OO manner, and made more modular and pluggable. I don't
value OO by itself, but this time the OO approach helped me to make the
code simpler, smaller, more readable and reusable.

   After releasing it, I'll continue to work on new modules and plugins.
There are thre areas for plugins - database managers, so called writers
(data dumpers that could dump data to different text formats) and robots.
   Currently I (re)implemented 2 robots - simple and forking, Forking robot
is fine, but slow - it checks one URL at a time.

   In the field of your interest - yes, I want to write more robots, at
least two - I want a threading robot, but much more than that I want an
asyncore-based robot. I haven't done anything yet; it seems I need to
rewrite the entire urllib to use asyncore, and it is hard work. Anyway I
need the work to be done, so if no one would help me - I will do it myself.
At least will TRY to do it :)

Oleg.
---- 
    Oleg Broytmann    http://members.xoom.com/phd2.1/    phd2 at earthling.net
           Programmers don't die, they just GOSUB without RETURN.




From breiter at usf.Uni-Osnabrueck.DE  Wed Apr  5 12:43:19 2000
From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter)
Date: 5 Apr 2000 16:43:19 GMT
Subject: Teaching the art of programming, in python
References: <20000405053920.20579.qmail@web2102.mail.yahoo.com>
    <8cfe42$o02$1@nnrp1.deja.com> 
Message-ID: <8cfqf7$4ml$4@newsserver.rrzn.uni-hannover.de>

In article ,
	"Warren Postma"  writes:

> The Python texts I've read are good References to Getting Stuff Done, but
> they Don't Teach the Art. Speaking of Dummies, was there/is there a LISP for
> Dummies, or Smalltalk for Dummies?  Can Python for Dummies be far off?

Yes, because people who do Python are no dummies.
At least I hope so.

Ranting-about-dummy-book-titles-ly-yours,
	Bernhard
-- 
Professional Service around Free Software                (intevation.net)  
The FreeGIS Project				            (freegis.org)
Association for a Free Informational Infrastructure            (ffii.org)


From deepak_marda at my-deja.com  Wed Apr 26 16:34:06 2000
From: deepak_marda at my-deja.com (deepak_marda at my-deja.com)
Date: Wed, 26 Apr 2000 20:34:06 GMT
Subject: Need help with COMObject for Zope
Message-ID: <8e7jrs$sk6$1@nnrp1.deja.com>

Hi,
I am trying to use COMObject with Zope. I have the latest versions of
Python and Zope installed on my Windows NT machine and have the Python
COM extensions installed as well. The following works fine from a
vanilla Python environment: -

python
>>>import win32com.client
>>>o=win32com.client.Dispatch('Word.Application')
>>>o.Visible = 1
>>>...
and so on...

However, when I created a COMObject in Zope with id = word and Dispatch
= Word.Application it raises the following exception: -
Error Type: com_error
Error Value: (-2147221008, 'CoInitialize has not been called.', None,
None)

I have replaced the Python installation that comes with Zope to the
latest version of Python with the COM extensions and I have also tried
restarting Zope.

Please help,
Deepak





Sent via Deja.com http://www.deja.com/
Before you buy.


From gmcm at hypernet.com  Sat Apr 22 22:04:28 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Sat, 22 Apr 2000 22:04:28 -0400
Subject: Overloading the = operator?
In-Reply-To: 
References: Jerome Chan's message of "Sun, 23 Apr 2000 00:14:02 GMT"
Message-ID: <1255667027-43185679@hypernet.com>

Justin Sheehy wrote:

> Nope.  `=' rebinds the name on the left hand side, and never even
> looks to see what that name was previously bound to.  

Except to decref it.

- Gordon



From neilh at hare.net.au  Mon Apr  3 08:12:13 2000
From: neilh at hare.net.au (Neil Hodgson)
Date: Mon, 3 Apr 2000 22:12:13 +1000
Subject: Unicode program representation
References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> 
Message-ID: <00ac01bf9d65$d988c460$36dd3fcb@neil>

    Fran?ois writes,

> Instead of writing:
>
>    u"hi ?"
>
> which is indeed a way to write Unicode strings using 7-bits, or even
8-bits
> in a Latin-1 environment, you might write:
>
>    unicode("hi ?")

   OK. That's not too painful.

   But then, what role do you see the u" form having?

   Neil




From tiddlerdeja at my-deja.com  Tue Apr 25 13:02:06 2000
From: tiddlerdeja at my-deja.com (tiddlerdeja at my-deja.com)
Date: Tue, 25 Apr 2000 17:02:06 GMT
Subject: VIM NT +python
Message-ID: <8e4j27$hgq$1@nnrp1.deja.com>

Does anyone here have a winNT build of the VIM editor that has python
support switched on?

I'd love to get my hands on a copy.


Sent via Deja.com http://www.deja.com/
Before you buy.


From redsand at dsuper.net  Fri Apr 21 21:10:04 2000
From: redsand at dsuper.net (Dave)
Date: Sat, 22 Apr 2000 01:10:04 GMT
Subject: Python for drivers?
Message-ID: <3900EDBE.282BC85@dsuper.net>

Can Python be used for writing device drivers? I just got BeOS 5 and it
doesn't support some video cards. I'd like to write one for the Cirrus
Logic card and I want a language that's clear and concise- Python. I've
never written device drivers. Any suggestions?
THanks



From shecter at darmstadt.gmd.de  Tue Apr 25 15:44:08 2000
From: shecter at darmstadt.gmd.de (Robb Shecter)
Date: Tue, 25 Apr 2000 21:44:08 +0200
Subject: XML Schemas and Python?
Message-ID: <3905F588.124AF24E@darmstadt.gmd.de>

Hi,

Has anyone done anything with schemas?  I have a research project
originally written in Java, but the more I work on it, the more it
mutates into a Python project... :)

Anyhow, if there's any sample code or articles out there, I'd like to
hear about it.

Thanks,
Robb


From parkw at better.net  Thu Apr 27 17:16:14 2000
From: parkw at better.net (William Park)
Date: Thu, 27 Apr 2000 17:16:14 -0400
Subject: Converting = to ==
In-Reply-To: ; from embed@geocities.com on Thu, Apr 27, 2000 at 03:57:55PM -0400
References: 
Message-ID: <20000427171614.B1788@better.net>

On Thu, Apr 27, 2000 at 03:57:55PM -0400, Warren Postma wrote:
> I have an "end user query tool" that uses Python expressions, but I want
> comparisons to be able to be written either as A=B or A==B then I want to
> compare them using Python's Eval function.
> 
> Problem is if you search and replace all = with == then users have to use
> the single-equals convention, and some of them will be python programmers,
> and will want to use the "non idiot mode" of the query tool.
> 
> So i did this, but is there a better way?
> 
>     >>> string.replace( string.replace("a=b a==b", "=", "=="), "====","==")
>     a==b a==b
> 
> Warren

You can use regular expression '([^=])=([^=])', but I think your
solution is cleaner.

--William



From apjewell at bigfoot.com  Fri Apr 14 19:50:54 2000
From: apjewell at bigfoot.com (Andrew P. Jewell)
Date: Fri, 14 Apr 2000 23:50:54 GMT
Subject: The Opposite of list(a,b,c)?
Message-ID: <38F7A07F.9B0F309C@bigfoot.com>

An HTML attachment was scrubbed...
URL: 

From cut_me_out at hotmail.com  Fri Apr 14 15:42:53 2000
From: cut_me_out at hotmail.com (Alex)
Date: 14 Apr 2000 15:42:53 -0400
Subject: Attributes (+Numerical Python)
References: 
Message-ID: 

> if the .imag attribute exists:
>    do something
> else
>    do something else
> 
> How should this be written?

if hasattr (object, 'imag'):
    do something
else:
    do something else

Alex.


From tjs at cs.monash.edu.au  Tue Apr 25 07:52:21 2000
From: tjs at cs.monash.edu.au (Toby J Sargeant)
Date: Tue, 25 Apr 2000 21:52:21 +1000
Subject: how to wrap c++ software to python?
In-Reply-To: <8e3ggq$2r1d$1@news.cz.js.cn>; from mrfx@263.net on Tue, Apr 25, 2000 at 03:09:17PM +0800
References: <8e3ggq$2r1d$1@news.cz.js.cn>
Message-ID: <20000425215220.A29950@fangorn.csse.monash.edu.au>

On Tue, Apr 25, 2000 at 03:09:17PM +0800, fmr wrote:
> I will call c++ routine in python,how to wrap
> c++ routine for python.
> 
> Is there any utils to work except SWIG.

sip, (http://www.river-bank.demon.co.uk/software) is very good. it will take
a c++ header (with a few modifications), and it will spit out a python module
that will provide a python type that mimics the c++ class. it also handles
(single) inheritance, which is a big win.

It's used as the basis of the PyQT bindings, which are also of a very high
standard.

Toby.



From gmcm at hypernet.com  Wed Apr 26 17:17:56 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 26 Apr 2000 17:17:56 -0400
Subject: global variables or inheritence
In-Reply-To: <28p8zy0irgc.fsf@lada.kom.auc.dk>
Message-ID: <1255338616-62939142@hypernet.com>

Thomas Rasmussen wrote:

> I have quite a big problem. I have two different files, where I
> in one file want to declare a variable and then in the other file
> be able to access and use this variable (no need to change it),
> but I just can't seem to get it to work... Is there any nice way
> of doing this easily? I have tried the global var but this
> doesn't seem to work.
> 
> Anyone got a good idea?

  import other
  print other.something

works just fine. Bet you used "from other import *", and then 
tried to change the value in other.

- Gordon



From donn at u.washington.edu  Tue Apr 18 12:58:36 2000
From: donn at u.washington.edu (Donn Cave)
Date: 18 Apr 2000 16:58:36 GMT
Subject: Running shell programs from Python
References: <38FC64DA.7D297563@ffi.no>
Message-ID: <8di47s$mkg$1@nntp6.u.washington.edu>

Quoth seh at ffi.no:
| I have just started with Python and have some questions.. I have some
| compiled c programs that I normally run from the shell. I can use | to
| pipe the output from one as input to the next. I would like to call the
| programs from Python. Could someone please indicate how this is done?
| Any references?

The references are mainly UNIX man pages pipe(2), fork(2), fcntl(2)
(look for dup2), exec(2) and wait(2).

Basically, the sequence is repeat ( open pipes, fork, close pipes )
After a fork, the parent and child both have both ends of each pipe
open, and it's important to close the unused "write" ends so the 
pipe will generate an EOF when its real writer exits.

Each of the forks will call execve() or a related function to invoke
the program, after forking if that's necessary.  Use dup2() to open
units 0 and 1 on the read and write pipes respectively, and close the
original units.  Trap any possible exceptions in the fork, so control
doesn't return to the caller in the fork.

While I do this with single commands, I personally don't ever do it
with a complex pipeline, because it's kind of hard to get right and
the UNIX shell just does a much better job.  If you just want to run
the shell from Python, as someone else already has mentioned, use
os.system(), os.popen() and various cool things in the popen2 module.

	Donn Cave, University Computing Services, University of Washington
	donn at u.washington.edu


From banderson at boi.hp.com  Fri Apr 14 15:37:59 2000
From: banderson at boi.hp.com (Bill Anderson)
Date: Fri, 14 Apr 2000 13:37:59 -0600
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>  <38F65501.665243F6@gmx.de>
Message-ID: <38F77397.45F26301@boi.hp.com>

Michael Scharf wrote:
> 
> Michael Hudson wrote:
> >
> > "Neil Schemenauer"  writes:
> >
> > > Garbage collection for Python:
> > >
> > >     http://www.enme.ucalgary.ca/~nascheme/python/gc.html
> > > The patch is against the current CVS version of Python.  If
> > > enough people ask for a patch against the stable version of
> > > Python I will make one.  Please send comments and bug reports.
> >
> > To someone who might know: what hope is there for this to go into 1.6?
> >
> > It would be, in my opinion, be a really really really good thing; for
> > one thing it would help in language wars...
> 
> I would *love* to see this in 1.6!!!!


I would love to see a patch for 1.5.2!
:)

-- 
Bill Anderson 			Linux/Unix Administrator, Security Analyst
ESBU (ARC)			bill_anderson at boi.hp.com
My opinions are just that; _my_ opinions.


From m.faassen at vet.uu.nl  Tue Apr 25 11:04:23 2000
From: m.faassen at vet.uu.nl (Martijn Faassen)
Date: 25 Apr 2000 15:04:23 GMT
Subject: Distribution
References: <39013f48@flexnet239.uunt.net>
Message-ID: <8e4c5n$p7q$1@newshost.accu.uu.nl>

Highdesertman  wrote:
[snip]
> If I use python to develop an application for the windows 9x environment,
>  I have already downloaded the appropriate libraries and version) what form
> does the finished program take? How does it get distributed?

Interesting to you may be Gordon McMillan's installer. See this Parnassus
link:

http://www.vex.net/parnassus/apyllo.py?i=22208368

Unfortunately the link referred to at Parnassus is currently down, as 
it's on the Python starship, which has crashed and its currently being
repeared (the warp^H^H^H^H hard drive gave up).

Also interesting may be the Python distutils:

http://www.python.org/sigs/distutils-sig/

> I remember in
> the early days of BASIC programming, (before compiled basic) your program
> was just raw code that could be (often accidentally) altered or otherwise
> corrupted.

Must be the alien whitespace eating nanoviruses accidentally altering and
corrupting the raw code. If you are in an environment where code can be
accidentally corrupted, choosing for source or binary code won't matter;
binary code can be corrupted as easily and is even harder to repair.

> In order for your basic program to be used, the user had to have
> a basic compiler on board and they loaded your raw source from a text file
> and executed it. Is this how Python is used?

Python is often used in a similar way. There is a Python interpreter on the
system, and you just execute some .py file by typing: python foo.py, or
on Windows, double-clicking on foo.py

Of course then the Python interpreter needs to be installed. There are
various installer solutions which install their own interpreters, Gordon's
being one of them. Perhaps others can add to this thread; I haven't worked
with any.

[snip]
> If Python is dependent on it's interpreter to run, and I am only programming
> for my own needs, then that dosen't represent a weakness.

It also doesn't represent a weakness if you're writing code for other Python
developers to use; for instance a reusable module that does something
interesting. It's also not a big deal if you're using Python to code CGI
scripts for a website; Python does need to be installed on the webserver
then, of course, but that's fairly easy to control.

Note that one idea behind open source is that easy access to the source
makes it easy for other developers to check out and improve your code. Please
keep that in mind when thinking of installation solutions; hiding the source
will make it harder for potentially helpful developers. Also such developers
may not 'trust' closed-source code as much.

> But since Python
> remains relatively unknown as yet, the average user isn't likely to have a
> python interpreter handy.

That's right. That's even a problem for Java, a well-known and well-hyped
language. I've been told that once a Java environment is installed, you can
run all the Java code in the world with it. Now only to install a 
proper Java. I heard there were various versions.. Oh, and on Linux, too! :)

> In addition, one of the real advantages of the
> development of the compiler was that it gave your code a level of protection
> against being tampered with and made it easily useable by a wide audience.

I don't see why you're so afraid people will be tampering with code. It's
been shown that allowing other people to tamper with your code gives you
the possibility to create rather important software -- Linux, Apache, 
Python, and so on. It doesn't have to happen, but it won't happen at all
if you don't open your source. Of course you may make a distinction between
a developer's edition and a user's edition of your program, but why make it
harder for developers to get at your code when you don't have to?

That said, the other argument; more easy to use for normal users, may
be true. It's a large step for the average user to install a Python
interpreter, while they usually don't mind running some installer to
get access to some program. So bundling Python with the program, as
various packaging tools do, may be a good idea in that case. Disadvantage
of this approach is that a user may end up with 20 versions of the Python
interpreter on his system. :)

It's interesting how philosophies about source code changed since the
days of MSDOS; I remember thinking about compilers in the same way.
"A way to make my code seem 'real'!" 

Regards and good luck!

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


From darcy at vex.net  Mon Apr 24 22:17:20 2000
From: darcy at vex.net (D'Arcy J.M. Cain)
Date: 25 Apr 2000 02:17:20 GMT
Subject: Trouble compiling PyGreSQL 2.4 on Linux
References:  
Message-ID: <8e2v7g$1so4$1@news.tht.net>

Martin Sk?tt  wrote:
> I know it works, but having a Linux README which didn't work bothered
> me immensly.

I have always depended on the kindness of strangers.

Context diffs to correct it always welcome.  I don't use Linux myself
so please send to the mailing list for peer review.

-- 
D'Arcy J.M. Cain            |  Democracy is three wolves
http://www.vex.net/                        |  and a sheep voting on         
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


From parkw at better.net  Tue Apr 25 16:50:50 2000
From: parkw at better.net (William Park)
Date: Tue, 25 Apr 2000 16:50:50 -0400
Subject: Need advice performing a search
In-Reply-To: <3905F795.A536CFA7@stsci.edu>; from karab@stsci.edu on Tue, Apr 25, 2000 at 07:58:38PM +0000
References: <3905F795.A536CFA7@stsci.edu>
Message-ID: <20000425165050.A222@better.net>

On Tue, Apr 25, 2000 at 07:58:38PM +0000, Kia Arab wrote:
> 
> I am trying to search a file for two strings. If *either* string is
> found, I need the line in which the string was found to be returned  (or
> somehow extract the line). It should keep searching and keep returning
> the lines where it finds either string, until the end of file is
> reached.
> 
> Any suggestions?

On Unix, 'grep' is what you want.  But, I guess you can read line by
line, and test for the 2 strings.

--William



From embed at geocities.com  Tue Apr  4 14:42:41 2000
From: embed at geocities.com (Warren Postma)
Date: Tue, 4 Apr 2000 13:42:41 -0500
Subject: blessed be Guido, for "5 <= X <= 10" does what it should...
Message-ID: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca>



I was just playing around today,and it occurred to me to test the
'transitive' properties of comparison operators. Ie, writing on a
chalkboard, you might say X is in the range 5..9 this way:

        5 <= X <= 9

(Actually I'd write the <= as '?' (Unicode U+2264) but using such things in
our code would seriously cramp portability.  Hey, is the APL symbol set
anywhere in Unicode!?)

In some programming languages, which reduce each comparison to a boolean
True or False, using the precedence rules, the result is:

        n = (5<=X)
        n <= 9

Since 'n' is probably 0 or 1 (commodore 64 basic used -1 for true, remember
that?) anywyas, 'n' is always <= 9, which means the whole expression is
always false.

If precedence rules were right to left:
        n = (X<=9)
        5 <= n

In that case, the statement is always false since n is always less than 5.

So, Us Really Smart C Programmers Who Have Been Burned By This Before
(hereafter, 'URSCPWHBBBTB') have long since taken to writing such things as:

    (5 <= X) && (X <= 9)

Anyways, that was C, so what about Python?

I decided to test if (a) Python could handle 'transitive' ways of writing
comparisons, and (b) if it emulated what most other languages do when you
explicity bracket the comparisons, and force sub-expression evaluation.

Here's a sample bit of code: It prints out the comparison, and the results


# test i<=j<=k behaviour, compare to (i<=j)<=k and i<=(j<=k)
for i in range(0,4):
 for j in range(0,4):
   for k in range(0,4):
     n = i <= j <= k # n = 1 if j between i and k
     x = ( i <= j) <= k # bug 1 ?
     y =  i <= (j <= k) # bug 2 ?
     print i,"<=",j,"<=",k," : ",n,"  ",x,y


Here's a Hack for the Mighty Pythonista to consider: Can you construct a
program that you can call like this:

    test_transitive( 0,100, '<=', 5 ) # generate a<=b<=c<=d<=e for range
0..100

Anyways, blessed be Guido, for near as I can figure it, he hath got it
right! :-)

Warren




From bryanNObrSPAM at dunsinane.net.invalid  Mon Apr  3 11:36:20 2000
From: bryanNObrSPAM at dunsinane.net.invalid (BryanBr)
Date: Mon, 03 Apr 2000 08:36:20 -0700
Subject: Python CGI based web game
Message-ID: <101a63d2.8b02be5a@usw-ex0109-069.remarq.com>

I am writing a python CGI based web game based on:

http://merchant.shareplay.com.

I am using a simple CGI framework and HTMLgen.

Anyone interested in helping out, email me.  After two days
of coding I have a workable game model.

I have a question: How do I redirect http requests with
python cgi?

Sending "Status 302" works from a directly requested python
cgi file.  However, I call all of my pages from a cgi
framework that actually calls my pages with the function
execfile.  When the page that has been called with execfile
output "Status 302" no redirect occurs.


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


From just at letterror.com  Sat Apr 29 14:12:04 2000
From: just at letterror.com (Just van Rossum)
Date: Sat, 29 Apr 2000 19:12:04 +0100
Subject: Where can I find NumPy
In-Reply-To: <8ef4pn$jge$1@kopp.stud.ntnu.no>
Message-ID: 

At 5:05 PM +0000 29-04-2000, Jan Erik Breimo wrote:
>The official site (ftp-icf.llnl.gov) hasn't been responding for more than
>a week, so are there any other sites where I can find the source
>files for NumPy?

numpy.sourceforge.net.

Just





From mikael at isy.liu.se  Wed Apr  5 03:05:31 2000
From: mikael at isy.liu.se (Mikael Olofsson)
Date: Wed, 05 Apr 2000 09:05:31 +0200 (MET DST)
Subject: Why should I switch to Python? - Infinity of Primes
In-Reply-To: <000d01bf9ec5$3fb90820$3e2d153f@tim>
Message-ID: 

On 05-Apr-00 Tim Peters wrote:
 >  [Greg Ewing]
 > > ...
 > > If someone actually came up with a formula for constructing
 > > primes, it would be rather large news -- isn't that one of
 > > the Big Unsolved Problems?
 >  
 >  Several such formulas were developed in the 70's, although they're
 >  strained.
 >  Paulo Ribenboim's accessible "The Little Book of Big Primes"
 >  (Springer-Verlag, 1991) gives a bunch of 'em in chapter 3, along with 6
 >  other proofs of the infinitude of the primes.

Yeah, like the one taking two integers as arguments, p and q, and then
generating p-1 if that happens to be a prime (for some, but not for all q), 
and generating 2 in all other cases...

It certainly is a function that generates primes for all inputs.

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson 
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    05-Apr-00
Time:    09:01:45

This message was sent by XF-Mail.
-----------------------------------------------------------------------



From nobody at nowhere.nohow  Sat Apr 22 09:47:24 2000
From: nobody at nowhere.nohow (Grant Edwards)
Date: Sat, 22 Apr 2000 13:47:24 GMT
Subject: code not true?
References: <8ds3ku$q0l$1@nnrp1.deja.com> <3901aa0f.0@news.proweb.co.uk>
Message-ID: 

On Sat, 22 Apr 2000 14:27:57 +0100, ng at hardlight.couk.com  wrote:
>interestingly enough on both Win32 and Linux

>>>> (0.7 * 10) == (0.07 * 100)
>0
>
>>>>  (0.07 * 10) == (0.007 * 100)
>1
>
>>>> (0.07 * 100) == (0.007 * 1000)
>0
>
>>>> (0.07 * 1000.0) == (0.007 * 10000.0)
>1

You've proven once again that testing floating point numbers
for equality is not a particularly useful operation.  ;)

This seems to be something that we were all told as freshmen
but stumble over later anyway.  One wonders if a safe language
intended for use by beginners should even have an equality
operator for floating point objects.

-- 
Grant Edwards                   grante             Yow!  Now KEN is having
                                  at               a MENTAL CRISIS beacuse
                               visi.com            his "R.V." PAYMENTS are
                                                   OVER-DUE!!


From jwbnews at scandaroon.com  Sun Apr  2 18:09:48 2000
From: jwbnews at scandaroon.com (John W. Baxter)
Date: Sun, 02 Apr 2000 15:09:48 -0700
Subject: New Features in Python 1.6
References: <200004011740.MAA04675@eric.cnri.reston.va.us> <8c84n9$pf0$3@newshost.accu.uu.nl>
Message-ID: 

In article <8c84n9$pf0$3 at newshost.accu.uu.nl>, m.faassen at vet.uu.nl 
(Martijn Faassen) wrote:

> You almost got me! I didn't read the rest of the thread, and I was already
> thinking about why all these would be bad ideas, and then I realized it
> was posted on April 1. Good one!

He did get me, but I saw the post when there was no "rest of the thread" 
yet on my news server.

Well done, Guido!

   --John

-- 
John W. Baxter   Port Ludlow, WA USA  jwbnews at scandaroon.com


From gregholmes at my-deja.com  Wed Apr 19 06:15:48 2000
From: gregholmes at my-deja.com (gregholmes at my-deja.com)
Date: Wed, 19 Apr 2000 10:15:48 GMT
Subject: How to write to printer in Windows?
References: <38FC43DF.78A38D5D@tcac.net>
Message-ID: <8dk10c$3e0$1@nnrp1.deja.com>

  Albert Wagner  wrote:
> How can I write(aLine) to a printer in Windows?  I tried this:
>
> from win32pipe import popen
> :
> self.printer = popen('lpt1' 'w')
> :
> self.printer.write(aLine)
>
> but get a general protection fault.  Any help will be greatly
> appreciated.
>
> --
> Small is Beautiful
>
Here is a snippet of how I did it:

import win32ui
import win32con
self.dc = win32ui.CreateDC()
self.dc.CreatePrinterDC()   # ties it to your default printer
horzres=self.dc.GetDeviceCaps(win32con.HORZRES)
vertres=self.dc.GetDeviceCaps(win32con.VERTRES)
self.printxscale=(horzres/300)*0.8
self.printyscale=(vertres/300)*0.8
self.redpen = win32ui.CreatePen(win32con.PS_SOLID, 5, self.red)
self.blackpen = win32ui.CreatePen(win32con.PS_SOLID, 5, self.black)
self.dc.StartDoc('Graph')
#self.dc.SetMapMode(win32con.MM_LOENGLISH)
self.dc.StartPage()
self.dc.SelectObject(self.blackpen)
self.dc.SetTextAlign(win32con.TA_CENTER|win32con.TA_BASELINE)
self.dc.MoveTo((0+self.xoffset)*self.printxscale,10*self.printyscale)
self.dc.LineTo((0+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.MoveTo((0+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.LineTo((200+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.MoveTo((100+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.LineTo((100+self.xoffset)*self.printxscale,220*self.printyscale)
self.dc.MoveTo((50+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.LineTo((50+self.xoffset)*self.printxscale,220*self.printyscale)
self.dc.MoveTo((150+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.LineTo((150+self.xoffset)*self.printxscale,220*self.printyscale)
self.dc.MoveTo((0+self.xoffset)*self.printxscale,110*self.printyscale)
self.dc.LineTo((0+self.xoffset-10*self.printxscale,110*self.printyscale)
self.dc.MoveTo((0+self.xoffset)*self.printxscale,10*self.printyscale)
self.dc.LineTo((0+self.xoffset-10)*self.printxscale,10*self.printyscale)
self.dc.MoveTo((200+self.xoffset)*self.printxscale,210*self.printyscale)
self.dc.LineTo((200+self.xoffset)*self.printxscale,220*self.printyscale)
self.dc.MoveTo((0+self.xoffset)*self.printxscale,160*self.printyscale)
self.dc.LineTo((0+self.xoffset-10*self.printxscale,160*self.printyscale)
self.dc.MoveTo((0+self.xoffset)*self.printxscale,60*self.printyscale)
self.dc.LineTo((0+self.xoffset-10)*self.printxscale,60*self.printyscale)
-------
That prints some lines (the axes of a graph).

To do text you can do:
--------------
self.dc.TextOut
((100+self.xoffset*self.printxscale,230*self.printyscale, "some text")
---------------

To end the page, the document, and clean up:
--------------
self.dc.EndPage()
self.dc.EndDoc()
print 'sent to printer'
del self.dc
-----------------

Hope this helps.


Sent via Deja.com http://www.deja.com/
Before you buy.


From vkolosov at unitedmedia.com  Mon Apr  3 09:48:10 2000
From: vkolosov at unitedmedia.com (Kolosov, Victor)
Date: Mon, 3 Apr 2000 09:48:10 -0400 
Subject: Python 1.6 alpha 1 released
Message-ID: <461182F0B9B7D111B4000008C7282ADC22B0FC@nynt04.umny.scripps.com>

	He became a god, gods do not talk to people - it is one way
relationship.
	:-)


> James Logajan wrote:
> > Any reason Guido doesn't post to this newsgroup like he used to?
> 
> well, what do *you* think is the reason?
> 



From jmg at ecs.soton.ac.uk  Wed Apr  5 12:49:53 2000
From: jmg at ecs.soton.ac.uk (Jacek Generowicz)
Date: Wed, 05 Apr 2000 17:49:53 +0100
Subject: Pass by reference ?
References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38EAF8D8.4B7C43B4@ecs.soton.ac.uk> <38EB56AE.F938CE06@acm.org>  <38EB63BC.FE03BA31@ecs.soton.ac.uk> 
Message-ID: <38EB6EB1.9759397C@ecs.soton.ac.uk>

Michael Hudson wrote:

> The code you posted only confuses if you have a flawed understanding of
> assignment in Python

That is exactly the point. My original confusion arose precisely because I had
made an incorrect assumption about assignment in Python (an assumption which, I
suspect, many newcomers to the language will make until they learn the truth).
Correcting this error is far more constructive than discussing what name should be
given to the semantics of argument passing.

Jacek






From andy at petdance.com  Tue Apr 25 09:08:51 2000
From: andy at petdance.com (Andy Lester)
Date: Tue, 25 Apr 2000 08:08:51 -0500 (CST)
Subject: Programming Python 2nd Edition?- Mark Lutz
In-Reply-To: <20000331113449.A2053@sirius.ftsm.ukm.my>
Message-ID: 

> If true, probably I could wait a while longer to spend my hard earned cash
> to buy ONE book to learn python proper.

Pick up "The Quick Python Book".  It's quite excellent.

xoxo,
andy

--
Andy Lester, andy at petdance.com, http://www.petdance.com
    "Inflammable material is planted in my head
     It's a suspect device that's left two thousand dead."
    "Hey, is this the new Green Day?"




From ngps at madcap.dyndns.org  Fri Apr  7 12:34:34 2000
From: ngps at madcap.dyndns.org (Ng Pheng Siong)
Date: 7 Apr 2000 16:34:34 GMT
Subject: Paid to work in Python? (was: Re: Choice Of Language)
References:  <8c3ats$b5f$1@nntp.Stanford.EDU>  <38e5f8ed.29659873@news.nikoma.de>
Message-ID: <8cl2mq$971$1@mawar.singnet.com.sg>

According to Philip 'Yes, that's my address' Newton :
> (The German term "eierlegende Wollmilchsau"[1] comes to mind.)
>
> [1] literally, "egg-laying wool-milk-sow [female pig]", i. e., something
> that tries to do too much at once.

I once saw a German term that was translated to "improve-worse-ment."

Can some one provide the German word, please?

TIA. Cheers.

-- 
Ng Pheng Siong  * http://www.post1.com/home/ngps



From mhammond at skippinet.com.au  Wed Apr 26 20:38:12 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Thu, 27 Apr 2000 00:38:12 GMT
Subject: [Win32] Retrieve icon for file type?
References: 
Message-ID: 

"Mike Fletcher"  wrote in message
news:CC59868A0A76D311B1F50090277B321C1F32B6 at VRTMAIL...

> Incidentally, the IShellFolder/IShellIcon stuff looks like the "right"
way
> to do this, I just don't see any way to touch it from Python (apparently
you
> need the functions "SHGetDesktopFolder" etceteras in shell32.dll to get
> anywhere with it.

These are in win32com.shell.shell.

Note that ExtractIcon/DestroyIcon will be in the next version of
win32gui...

Mark.





From rcc at nospamthanks_jennic.com  Tue Apr 25 09:53:28 2000
From: rcc at nospamthanks_jennic.com (Robert Cragie)
Date: Tue, 25 Apr 2000 13:53:28 GMT
Subject: Unsigned integer arithmetic
Message-ID: 

Hi all,

I'm having a lot of trouble with arithmetic manipulation of numbers above
0x7fffffff. Whilst an integer is represented in a 32 bit word, as you'd
expect, 0x80000000 - 0xffffffff are treated as negative numbers. However, I
want to treat a 32 bit number as an unsigned value, and be able to do i = i
+ 1 for an integer number above 0x7fffffff without getting an overflow.

I'm finding I have to use the inefficient longs for the arithmetic, and do
clumsy conversions using the struct module, e.g.

import struct

# integer to unsigned long
# in the strings, it's an upper case 'eye' and a lower case 'ell' in that
order
myUlong = struct.unpack('I', struct.pack('l',myInt))[0]

# unsigned long to integer
# in the strings, it's a lower case 'ell' and an upper case 'eye' in that
order
myInt = struct.unpack('l', struct.pack('I',myUlong))[0]

Also, I can't seem to print a long using

print '0x%08x' % myLong

if 'myLong' is greater than 0x7fffffff - I get the rather obscure 'long int
too long to convert'.

Is there a better way to do all this?

TIA

Robert Cragie





From claird at starbase.neosoft.com  Wed Apr  5 00:04:01 2000
From: claird at starbase.neosoft.com (Cameron Laird)
Date: 4 Apr 2000 23:04:01 -0500
Subject: What is python's language level?
References: <38EA1B8F.A797A130@lmco.com>  <38EA9CD4.3473B910@callware.com> 
Message-ID: 

In article ,
Roy Smith   wrote:
			.
			.
			.
>Have you ever looked at the output of a bib | tbl | eqn pipeline?

Are you kids still using that as a pick-up line?
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


From cmfinlay at magnet.com.au  Mon Apr 17 11:39:47 2000
From: cmfinlay at magnet.com.au (cmfinlay at magnet.com.au)
Date: Tue, 18 Apr 2000 01:39:47 +1000
Subject: How do I make a constant global variable in Python Please
Message-ID: 

How do I make a constant global variable in Python Please.
or just a constant.
or just a global.

I bought a Python Book. however I can't find this info in it.

Please e-mail me at cmfinlay at magnet.com.au


From mwh21 at cam.ac.uk  Wed Apr 19 05:10:15 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 19 Apr 2000 10:10:15 +0100
Subject: Forward References?
References:  
Message-ID: 

"Jeff Massung"  writes:

> Also, someone mentioned above having: self.y() (or self.y(self)), my
> question is what is the difference between a.y and self.y?

a.y(self) almost certainly doesn't do what you want in the presence of
inheritance.

Cheers,
M.

-- 
81. In computing, turning the obvious into the useful is a living
    definition of the word "frustration".
     -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html


From moshez at math.huji.ac.il  Wed Apr 26 04:21:07 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Wed, 26 Apr 2000 11:21:07 +0300 (IDT)
Subject: os.path.walk() question.
In-Reply-To: <8e55m0$pvl$1@hammer.msfc.nasa.gov>
Message-ID: 

On 25 Apr 2000, Andrew McDowell wrote:

> I need to find out if a file exists under a directory hierarchy.
> The hierarchy could be quite large so I don't want to continue recursing
> through the hierarchy if the file is found one or two directories down.   Is
> there a way that you can tell os.path.walk() to stop searching?

Here's a quick-n-dirty hack: throw an exception, containing the name
of the file you found.

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From gmcm at hypernet.com  Fri Apr 21 12:47:50 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Fri, 21 Apr 2000 12:47:50 -0400
Subject: The Simple Economics of Open Source
In-Reply-To: <3900611F.3B525BDA@cfdrc.com>
Message-ID: <1255786824-35980039@hypernet.com>

Why does everyone miss the main point?

I (and you) are literally 100s of times more productive because 
of open source. Imagine having to either invent it all yourself, 
or duct tape together expensive half-assed closed "solutions". 
Shudder.

Developers who share code are *enormously* more productive 
than those who don't. So the range of problems that can be 
attacked increases geometrically, so computers penetrate 
new areas, so geeks stand a better chance of making a living.

Win-win situations are rarely profitably analyzed by 
competitive models.


- Gordon



From phd at phd.russ.ru  Tue Apr 18 05:16:03 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Tue, 18 Apr 2000 09:16:03 +0000 (GMT)
Subject: Filtering web proxy
In-Reply-To: <20000417181037.B8191@bigskytel.com>
Message-ID: 

Hello!

   Thanks to all who replied. I'll look into all the code. Right now proxy3
(MURI) looks best, with "munchy" follows.

On Mon, 17 Apr 2000, David Porter wrote:
> If the junkbuster version I mentioned is not satisfactory to you I would be
> highly surprised, give it a go!

   It doesn't block Javascript.

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.





From gmcm at hypernet.com  Wed Apr  5 21:45:42 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 5 Apr 2000 21:45:42 -0400
Subject: Pass by reference ?
In-Reply-To: <38EBCD7D.7030602@acm.org>
Message-ID: <1257136951-12346320@hypernet.com>

Robert W. Cunningham wrote:

> Gordon McMillan wrote:
> 
> > Robert W. Cunningham wrote:
> > 
> > > The CS models of "Pass By Reference" and "Pass By Value" are fairly well understood,
> > > but they do not seem to map simply and directly to Python.  
> > 
> > Grrr. Pascal causes brain damage. Python is exactly like Java 
> > (with the exception of having no primitive types).
> >  
> > These notions should state *what* is being passed. In Pascal, 
> > that's "value of a slot" or "reference to a slot". To be precise, 
> > in Python it is *always* "value of a reference", (think "pointer 
> > value", not "value of that which is pointed to").
> 
>   Let's go back to CS101 and start with at least a MINIMAL set of 
> common words, definitions and concepts.
> 
> 1. Computers contain and operate upon REPRESENTATIONS only.

Nah. They operate on voltage levels represented by 1s and 0s. 
The fact that higher levels of representation are built on top of 
that is a useful fantasy.
 
> That is to say, there is no such thing as the "integer number five" in a 
> computer, only that which we CHOOSE to REPRESENT the VALUE of the purely 
> math-theoretical notion of "5".

See how you take the fantasy for reality? No way does any 
computer ever manipulate or represent an integer. The closest 
you'll come is an element of a finite algebraic group. But 
computer languages let us believe they are integers, for awhile 
at least.
 

>    def Nuke(w):
>      print w,
>      w=None
>      print w
>
> Let's call each of these functions:
> 
>    Nuke(a)
>    Nuke(b)
>    Nuke(c)
>    Nuke(d)
> 
> Look at the output:
> 
>    5 None
>    5 None
>    [5] None
>    {"five":5} None
> 
> And then look at the original values:
> 
>    print a,b,c,d
> 
>    5 5 [5] {"five":5}
> 
> None changed!  Therefore, representations the functions modified were 
> DIFFERENT from those passed, though it is clear that the correct VALUE 
> was passed.

And in each case the VALUE OF THE REFERENCE was 
nuked. You didn't modify any referent. You reassigned.
 
> This behavior meets the classical definition of "Pass By Value".

Yes, the value of the reference. When you say "a=5" in 
Python, a holds a reference to an object. The object holds a 
representation of something we take to be the number 5. 
Passing a to a function is done by copying the value of a (not 
the object a references). Therefor assigning to a in the called 
function has no effect on the caller. If the object is mutable, 
changes to the object will be visible in the caller.

This is NOT unique to Python. Technically, this is "call by 
value", but it's "value of the reference". However, because 
changes to mutable objects are visible to the caller, people 
often call it "call by reference", which, as you've observed, it's 
not.

The real problem is that "call by value" and "call by reference" 
have an unspoken assumption that variables are slots.
 
> What other tests have I omitted, and what do they yield?

You've missed a level of indirection. The label is not the object.

- Gordon



From donn at u.washington.edu  Wed Apr 26 13:43:31 2000
From: donn at u.washington.edu (Donn Cave)
Date: 26 Apr 2000 17:43:31 GMT
Subject: Unsigned integer arithmetic
References:   
Message-ID: <8e79s3$vv2$1@nntp6.u.washington.edu>

Quoth "Robert Cragie" :
...
| I guess I'm showing my C background here, but it would be nicer to have a
| notion of unsigned numbers and also to be able to print longs.
|
| I don't like this, as it implies that 'i' is a 32 bit signed integer, but
| you don't have any control. It blows up here because it won't extend the
| type to a long - as it's typeless, I don't see why it should be able to do
| this automatically.
|
| >>> i = 0x7fffffff
| >>> i = i + 1
| Traceback (innermost last):
|   File "", line 1, in ?
|     i = i + 1
| OverflowError: integer addition
|
| Typeless languages are all very well, but there are times when I really
| would like to say 'this is a 32 bit unsigned integer - treat it as such'
| instead of implied typing. The warning bells sounded a bit on p33 of
| 'Learning Python' when it suggested that "as a rule of thumb, if you find
| yourself wanting to flip bits in Python, you should think long and hard
| about which language you're really using". But there are more compelling
| reasons why I am using Python than C for my particular application. I don't
| particularly want to have to start writing C companion libraries if I can
| avoid it.

I guess there's a tension here between these somewhat exotic
applications and more general aspirations for Python, where
even the present reliance on machine numerical types is arguably
inappropriate.  I personally feel that Python's position on the
Very High Level scale here is just typical of its practicality,
but with the unsigned integer, in C we have an example to be
avoided.  I mean, its rules for operations on unsigned integers
make some sense insofar as I can see, but the ANSI library
standards are clearly on a different page about it with things
like strlen() returning unsigned integers.  If the arbiters of
ANSI C can't even keep it straight, how can Python users be
expected to sort these things out?

Anyway, rant over, it's not entirely clear which way you want to
go, but I think you want 0x7fffffff to roll over to 0x80000000
regardless of hardware integer size, without the overflow exception.
 Would it be reasonable, considering that this is an exotic and
not generally useful behavior, to do that kind of arithmetic with
a functional notation like c = uadd(a, b, 32), c = umul(a, b, 32)?

Ironically our high level language looks a little like assembly
language here, but then neither one has any notion of type declaration
so perhaps it's inevitable.

	Donn Cave, University Computing Services, University of Washington
	donn at u.washington.edu


From mak at mikroplan.com.pl  Wed Apr 12 12:43:21 2000
From: mak at mikroplan.com.pl (Grzegorz Makarewicz)
Date: Wed, 12 Apr 2000 18:43:21 +0200
Subject: Python and Curses under MS Windows
In-Reply-To: <8d25p8$7u9$1@uni00nw.unity.ncsu.edu>
Message-ID: 


> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of William Isaac Carroll
> Sent: Wednesday, April 12, 2000 5:47 PM
> To: python-list at python.org
> Subject: Python and Curses under MS Windows
> 
> 
> I'm interested in finding a curses package that works under Windows. I've
> searched the FAQ and archives with no results. Does such a thing 
> exist? And
> does it come in a pre-compiled form? (I have no decent Windows compiler
> available.)
> 

Curses module (compiled and source) for python15 you can find
on http://www.mikroplan.com.pl/~mak/python

Grzegorz Makarewicz




From phd at phd.russ.ru  Fri Apr 28 04:18:08 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Fri, 28 Apr 2000 08:18:08 +0000 (GMT)
Subject: HTML parser example, anybody?
In-Reply-To: 
Message-ID: 

On 27 Apr 2000, Gerhard Haering wrote:
> I want to transform my own HTML templates (with a few template tags,
> special comments, and so on) into final HTML for the browser. I would like

   I'd recommend you to use DocumentTemplate (ZTemplates from www.zope.org)
instead.

> to use Pyhton's htmllib, but from the docs I can get no clue on how to get
> it done. I seem to have to use a writer and a formatter class ... 

   Do not use HTMLLib, it is designed for formatting text representation of
HTML. Use SGMLLib instead.

> I would greatly appreciate an example of HTML -> HTML using
> htmllib/sgmllib. Can anybody provide pointers/code snippets?

   Cannot show HTML->HTML, but can show HTML parsing with SGMLLib. Look
into my project "Bookmarks database and Internet robot". There is a parser
for bookmarks.html - one of the parsers I wrote so many times.

   Master site: http://sun.med.ru/~phd/Software/Python/#bookmarks_db

   Faster mirrors: http://skyscraper.fortunecity.com/unix/797/Software/Python/#bookmarks_db
   http://members.xoom.com/_XMCM/phd2.1/Software/Python/index.html#bookmarks_db

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.




From ulf.engstrom at b2b-link.com  Fri Apr 28 07:54:39 2000
From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F8m?=)
Date: Fri, 28 Apr 2000 13:54:39 +0200
Subject: Reading user input
References: <39096d88.3112113532@news.ramk.fi>
Message-ID: <01d101bfb108$88862290$858647c1@DEVELOPMENT>

I guess what you're looking for is raw_input(). Works like this:
>>> text = raw_input('Enter text here->')
Enter text here->Anything I want
>>> text
'Anything I want'

Hope it helps :)
Regards
Ulf

> Hi.
> 
> I'm doing some studing about python and MySQL. I've done little test
> program where I use database from python. Now I need get user input to
> do some queries(and other stuff) to database. I've read Python manual
> but haven't found simple solution to do that. I can read something
> using curses but I don't like it. Is there other(and simpler) way to
> do that??
> 
> I've done only CGI programs with python and there haven't been any
> need to read chars from user input. Only stuff from stdin that httpd
> have put there.
> 
> At this case 'user input' is not arguments given when program starts
> but variables that are given when program is running. 
> 
> Of course I could do html-page and do my test program as CGI and use
> it that way but it's too much trouble when I'm only trying to learn
> databases and how to use them from python.
> 
> TK
> -- 
> http://www.python.org/mailman/listinfo/python-list




From fredrik at pythonware.com  Tue Apr  4 04:48:38 2000
From: fredrik at pythonware.com (fredrik at pythonware.com)
Date: Tue, 04 Apr 2000 08:48:38 GMT
Subject: Python 1.6 alpha 1 released
References:  <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net>
Message-ID: <8cca93$9oh$1@nnrp1.deja.com>

Tres Seaver wrote:
> > it *breaks existing applications coded to the published interface*,

not true.  the documented interface explicitly says that
there is one single argument.  it does not mention optional
arguments.

(the example was broken, but so were other examples in earlier
releases of the documentation.  see other messages in this
thread for details)

> Consider that *every one* of the protocol modules which offers
> a connect() method uses a two-argument signature for it:  ftplib,
> gopherlib, httplib, imaplib, nntplib, poplib, smtplib, telnetlib,
> urllib.  And they all *use* the two-argument connect when invoking
> their underlying socket!

not true.  look again (doesn't matter if you look in the 1.5.2
library or the 1.6 library -- what you just said is not correct
in either case).

> No Python module in the standard library uses the single-argument
> connect, period.

*all* python modules in the 1.6 standard library use
single-argument socket connect.

> This is *not* the same case as the list.append() one, where the
> published interface was itself consistent.

why not?  after all, there were many more uses of multi-argument
append in the 1.5.2 standard library than uses of multi-argument
socket calls.

see my other post in this thread for the list of questions
I ask myself for each change in Python.  if you use other
criteria, which make it obvious to you that "append" is a
good change, and "connect" is a bad one, please tell me what
they are.

(bogus facts or double standards doesn't count).

after all, with tons of code all over the Python universe,
I'm affected by *all* backwards incompatible changes in
Python 1.6.  but for some reason, the "append" change is
the only one that makes me worried.  what am I missing?




Sent via Deja.com http://www.deja.com/
Before you buy.


From petersc at stud.ntnu.no  Thu Apr 27 09:57:54 2000
From: petersc at stud.ntnu.no (Peter Schneider-Kamp)
Date: Thu, 27 Apr 2000 15:57:54 +0200
Subject: Concatening string and integer
References: <8e9gco$jlt$1@vg170.it.volvo.se>
Message-ID: <39084762.C074814E@stud.ntnu.no>

JJ wrote:
> 
> Hi!
> 
> I want to concatenate a string containing both strings and integers like:
> 
> strTemp = 'I make test number: ' + iMyNumber + ' once again'

Adapted from the FAQ:

strTemp = 'I make test number: ' + repr(iMyNumber) + ' once again'

bye
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de



From akuchlin at mems-exchange.org  Mon Apr 24 17:15:44 2000
From: akuchlin at mems-exchange.org (Andrew M. Kuchling)
Date: 24 Apr 2000 17:15:44 -0400
Subject: Gzip -> FTP w/o using a temporary file
References: <8e279b$2rf0$1@nnrp-corp.news.cais.net>
Message-ID: <3du2grxksf.fsf@amarok.cnri.reston.va.us>

"Joel Burton"  writes:
> I tried using os.pipe() to create an r/w pipe, but the 'w' part of the pipe
> isn't writable, according to gzip.GzipFile()

os.pipe() returns file descriptors, which are small integers, while
GzipFile expects a Python file object.  Wrap the file descriptor in
a file object using os.fdopen(), something like
output = os.fdopen( w, 'wb')

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
Sending a newgroup message without permission of Leader Kibo: Poster is forced
to adopt twelve wacky sitcom children.
  -- Kibo, in the Happynet Manifesto


From godzilla at netmeg.net  Mon Apr 24 10:39:28 2000
From: godzilla at netmeg.net (Les Schaffer)
Date: Mon, 24 Apr 2000 14:39:28 GMT
Subject: ANN: NJ Piggies welcome Andy Robinson
References: <39044E57.58467ED@reportlab.com>
Message-ID: 

> Please join us as the New Jersey Python interest group (NJ Piggies)
> welcome Andy Robinson, Chief Architect and CEO of ReportLab,
> visiting from London.

what is planned for this occasion? lecture? topics? ...

les schaffer


From tseaver at starbase.neosoft.com  Wed Apr 12 22:49:53 2000
From: tseaver at starbase.neosoft.com (Tres Seaver)
Date: 12 Apr 2000 21:49:53 -0500
Subject: Why should I switch to Python?
References:   <8d2aa8$n58$1@newshost.accu.uu.nl> <8d2blf$b1n$1@pegasus.csx.cam.ac.uk>
Message-ID: <0F8FA87D4E1A9FC3.175617597B7C89BA.B3FB1819189281D7@lp.airnews.net>

In article <8d2blf$b1n$1 at pegasus.csx.cam.ac.uk>,
Nick Maclaren  wrote:
>
>In article <8d2aa8$n58$1 at newshost.accu.uu.nl>, m.faassen at vet.uu.nl
>  (Martijn Faassen) writes:
>|> Blake Winton  wrote:
>|> > On Fri, 31 Mar 2000 19:43:58 -0800, Aaron Turner wrote:
>|> >>I've been coding Perl for over 3 years and really like it.  (Especially
>|> >>it's syntax and ability to grok my programming style.)
>|> 
>|> > Now, just as a side note, why is it that the sets of The Perl Hackers I
>|> > Know, and The People I Know Who Use The Word "Grok" are the same set?
>|> 
>|> It's in the hacker's dictionary:
>|> 
>|> http://www.tuxedo.org/~esr/jargon/html/entry/grok.html
>
>According to something I read, incorrectly attributed!  Apparently
>Heinlein got it from something he read, and forgot the fact - it
>was then pointed out to him and he said something equivalent to
>"Oops".  That doesn't stop the attribution to him circulating :-)

I don't buy "got it from something he read" unless the Marsport Times
was being delivered to Colorado Springs c. 1960 using Guido's TimeMachine.
You need *better* attribution to contest priority of existing, valid
attribution.

See RAH's _Grumbles from the Grave_ for more history on SIASL.

>The same thing has happened with the expression "To damn with
>faint praise", incidentally - it is attributed to Pope, but is
>actually Wycherley.

Hmm, maybe you'll argue that LeGuin's _Left Hand of Darkness_ should be
attributed there, too :)

Tres.
-- 
---------------------------------------------------------------
Tres Seaver        tseaver at digicool.com     http://www.zope.org
Digital Creations


From cut_me_out at hotmail.com  Sat Apr 29 13:24:15 2000
From: cut_me_out at hotmail.com (Alex)
Date: 29 Apr 2000 13:24:15 -0400
Subject: problem in python function --Name-error
References: <390B198D.7AC26774@swt.edu>
Message-ID: 

> The error says nameError frame1.

Perhaps you want to call this self.frame1 in the __init__ method.  Then
you will still be able to refer to it in the drawCanvas method by the
same name.  At the moment, you are getting an error because there is no
variable called frame1 in the namespace of the drawCanvas method.

Alex.


From mhammond at skippinet.com.au  Sat Apr  8 22:04:33 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Sun, 09 Apr 2000 02:04:33 GMT
Subject: Python on Google?
References: <8F0ED22EBjoshtinamecom@209.208.0.7> <8col53$m3o$1@nntp.Stanford.EDU>
Message-ID: 

"Amit Patel"  wrote in message
news:8col53$m3o$1 at nntp.Stanford.EDU...
> Josh Tompkins  wrote:

> Python has been used at Google since the very beginning, and it
> continues to be used, although some of the more performance critical
> stuff is in C++.  New code _is_ being written in Python (in fact, I
do
> all my work in Python) and it's being used exclusively to deal with
> some large sets of data.  Email me if you want more details.

It would be very cool if you could knock up a few paras of information
about this that we could put on the Python web site in the relevant
places.  Advocacy from high-profile Python users is always good.

Mark.





From effbot at telia.com  Mon Apr  3 12:11:39 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Mon, 03 Apr 2000 16:11:39 GMT
Subject: Unicode program representation
References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> <3xXF4.1060$n68.186533888@newsb.telia.net> <001201bf9d62$3e1ac1c0$36dd3fcb@neil>
Message-ID: <%o3G4.1111$n68.191610880@newsb.telia.net>

Neil Hodgson  wrote:
> > however, perfectly valid ISO Latin 1 strings (or any other standard
> > 8-bit encoding) are invalid UTF-8 strings.   changing the default to
> > UTF-8 this is likely to break many existing scripts.
>
>    But there are relatively few scripts currently using the u" form since
it
> has yet to appear in a release version of Python.

hmm.  wouldn't that mean that we end up using different encodings
in different parts of the script?  feels a little scary, to say the least...






From arnold at dstc.edu.au  Sun Apr 16 20:54:29 2000
From: arnold at dstc.edu.au (David Arnold)
Date: Mon, 17 Apr 2000 10:54:29 +1000
Subject: module naming? 
In-Reply-To: Your message of "Sun, 16 Apr 2000 20:39:00 -0400."
              
Message-ID: <200004170054.KAA14097@piglet.dstc.edu.au>

-->"Michal" == sabren   writes:

  Michal> Is there a better way to do this?

what about something like

   from Record import Record
   from Field import Field
   from IdxDict import IdxDict

in your zdc/__init__.py ?



d



From alex_thomas at cableinet.spam.co.uk  Fri Apr 14 16:46:13 2000
From: alex_thomas at cableinet.spam.co.uk (Alex Thomas)
Date: Fri, 14 Apr 2000 20:46:13 GMT
Subject: Scripting and Gnome and KDE
Message-ID: <7t0ffs8ncrrh3irgc52rbsb68ue48rfovf@4ax.com>

This might seem an odd way to choose a GUI, but if you had the choice
between scripting Gnome/Gtk or KDE/Qt-based components using Python, which
would you go for? 

Thanks peeps
Alex


From echuck at mindspring.com  Sun Apr 16 21:00:18 2000
From: echuck at mindspring.com (Chuck Esterbrook)
Date: Sun, 16 Apr 2000 21:00:18 -0400
Subject: else clauses in while and for loops
References: <200004170028.KAA07736@nexus.csse.monash.edu.au>
Message-ID: <38FA6222.E8BFE8B5@mindspring.com>

Jonathan Giddy wrote:

> Chuck Esterbrook declared:
> >
> >On another topic: With regards to the "try...except" technique above
> >(which I've seen quite a bit in Python) does the following code do the
> >same thing and if so, which do you find more readable?
>
> It does do the same thing with the extra line included below.  Now that
> I've looked at this code in more detail than usual, I would probably choose
> your form over my original, mainly on the grounds that it's quite likely
> for the test to fail, so it's not really "exceptional" behaviour.
>
> However, for code that is executed once over a limited number of
> iterations, I'm not losing sleep either way.

Agreed. I just wanted to know about the two styles in general.

Thanks,

-Chuck

From a.genkin at utoronto.ca  Sat Apr 29 16:17:40 2000
From: a.genkin at utoronto.ca (Arcady Genkin)
Date: Sat, 29 Apr 2000 20:17:40 GMT
Subject: Problem running NNTP example from docs.
Message-ID: <87hfckk6fv.fsf@tea.thpoon.com>

I'm very new to Python, and was trying to run the example from
documentation to nntplib library. I get an error when I try to
instantiate NNTP object.

,----
| >>> import nntplib
| >>> s = NNTP('news')
| Traceback (innermost last):
|   File "", line 1, in ?
| NameError: NNTP
`----

Could somebody point out what I am missing?

Thanks!
-- 
Arcady Genkin                                 http://www.thpoon.com
Nostalgia isn't what it used to be.


From smigowsky at dspace.de  Thu Apr 13 06:09:52 2000
From: smigowsky at dspace.de (Stefan Migowsky)
Date: Thu, 13 Apr 2000 11:09:52 +0100
Subject: Problems with PythonWin
Message-ID: <326536345498D311B3BC00105A39802A074686@newsintern.dspace.de>

>
>pywintypes.com_error: (-2147467262, 'No such interface 
>supported', None, None)
>

This error occurs if you have a special version of the comcat.dll
which resides in the system32 directory. Microsoft has updated 
this dll without supporting older interfaces. But now they solved 
the error.

To register the ActiveX Script Engine you have to have either version
4.71 or the new Version 5.0 from the Internet Explorer 5.0.

The faulty version is 5.0 (!) from Internet Explorer 4.01. 

Sometime I don't know what they are doing in Redmond.

Bye 

     Stefan



From lang at zid.tu-graz.ac.at  Thu Apr  6 07:46:08 2000
From: lang at zid.tu-graz.ac.at (Mario Lang)
Date: 06 Apr 2000 13:46:08 +0200
Subject: Python and Audio-input/output/processing/mixing
Message-ID: <8766tvqwov.fsf@fzidpc73.tu-graz.ac.at>

Hello.

I am quite new to python but I am very impressed by the
way it is designed.
I am planning to write a music-studio in python based
on a completely object oriented design.

As I searched for libs, I couldnt really find something useful to base
my work on.
Are there any major modules for python and audio processing?

-- 
Regards,
      Mario Lang

Technical University Graz           E-Mail: lang at zid.tu-graz.ac.at
Department Computing Services          ICQ: 69372257
Phone: +43-316-873-8508
  Fax: +43-316-873-7699



From nobody at nowhere.nohow  Sun Apr 23 22:58:57 2000
From: nobody at nowhere.nohow (Grant Edwards)
Date: Mon, 24 Apr 2000 02:58:57 GMT
Subject: Why doesn't O'Reilly use parrots on its python books?
References: 
Message-ID: 

On 23 Apr 2000 21:40:43 -0400, Alex  wrote:

>Given their venerable standing in Python lore, it surprises me that none
>of O'reilly's python books have a parrot on the cover.  There must be
>lots of types of parrots to go around, even if some O'reilly books
>already have them.

IIRC, the Python parrot would need to be a Norwegian Blue.
Lovely plumage...

>And the python book could be distinguished by the fact that its
>parrot is lying on its back with its feet curled up...
>
>A really agressive looking rabbit would work, too.

With sharp, pointy teeth?

-- 
Grant Edwards                   grante             Yow!  .. If I cover this
                                  at               entire WALL with MAZOLA,
                               visi.com            wdo I have to give my AGENT
                                                   ten per cent??


From Gareth.McCaughan at pobox.com  Wed Apr  5 15:05:44 2000
From: Gareth.McCaughan at pobox.com (Gareth McCaughan)
Date: 05 Apr 2000 20:05:44 +0100
Subject: Why should I switch to Python?
References: <000701bf9c5a$b806b420$752d153f@tim>
	
	
	
Message-ID: <864s9g74hj.fsf@g.local>

Michael Hudson wrote:

> It's also possible to show that if a and n have no common factor, then
> there are an infinte number of primes in the artihmetic progression
> a+dn as d=0,1,2,3,4,..., but the proof is, umm, somewhat harder (ie. I
> don't know it; I think it involves slinging Riemann zeta functions).

Dirichlet L-series, actually. Closely related to the Riemann
zeta function, but not quite the same thing. You look at
sum{1..oo} of a(k)/k^s where a is a "character mod n" (which
just means that a(k) depends only on k mod n and a(pq) = a(p)a(q)),
and the crux of the proof is showing that this thing is well
behaved at s=1 if a isn't the obvious thing that's always
equal to 1. Once you've got that the rest of the proof isn't
much harder than the following witty proof that there are
infinitely many primes: "sum{1..oo} of n^-s = product{primes}
of 1/(1-p^-s). As s->1, the former goes to infinity, so the
latter does too, therefore there must be infinitely many
factors in the product. QED."

Therefore you should switch to Python. QED. :-)

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction


From gherman at darwin.in-berlin.de  Tue Apr 11 04:06:11 2000
From: gherman at darwin.in-berlin.de (Dinu C. Gherman)
Date: Tue, 11 Apr 2000 10:06:11 +0200
Subject: Starship Python is down!?
Message-ID: <38F2DCF3.BA257022@darwin.in-berlin.de>

I can't get anything from http://starship.python.net or
http://starship.python.net:8080 for more than a day, now.
Is that some known problem?

Regards,

Dinu

-- 
Dinu C. Gherman
................................................................
"The thing about Linux or open software in general is that 
it actually tries to move software from being witchcraft to 
being a science," [...] "A lot of the programs you see today 
are actually put together by shamans, and you just take it and 
if the computer crashes you walk around it three times... and 
maybe it's OK." (Linus Thorvalds, LinuxWorld 2000, NYC)



From ivanlan at callware.com  Tue Apr  4 22:08:02 2000
From: ivanlan at callware.com (Ivan Van Laningham)
Date: Tue, 04 Apr 2000 20:08:02 -0600
Subject: Two questions
References: <1257223201-7158461@hypernet.com>
Message-ID: <38EAA002.D82AFAB8@callware.com>

Hi All--

Gordon McMillan wrote:
> 
[snippery]
> It's not widely known, but it blows chunks if you have Mayan
> glyphs on your machine. That's a feature.
> 

Ta' e' ku' yu'uch'ul.  (That's Yucatec Mayan, for those of you who need
a hint.)

> If you get creative (about a dozen lines of code) you can install
> a fully functional Python in 2 files. You can put Python and
> IDLE on a floppy with room left over.
> 

Yes, but will it fit under the seat?


> At the moment, you'll have a bit of trouble with my stuff and
> the fact that Marc-Andre puts his .pyds inside the packages.
> There are workarounds, and I have a patch from Thomas Heller
> which I haven't finished reconciling to some of my other
> changes.
> 

How nasty are the workarounds?  Do they make life annoying for the guy
who writes the installs?  (Acceptable--possibly even desirable.) 
Annoying for me?  (Irritating but acceptable.)  Or infuriating for our
customers?  (Unacceptable.)

Of course, if there is a way to make life unbearable for the salesmen
(and they are all men), that would be ideal.


> > -ly y'rs,
> > Ivan
> 
> Are you describing your hairline, your nervous twitch, or the
> effect of the latter on your former?
> 

C'mon, Gordon.  Get out your OED!  I _know_ you've got one.

-ly
y'rs,
Ivan;-)
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
http://www.pauahtun.org and
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



From akuchlin at mems-exchange.org  Fri Apr 21 18:04:03 2000
From: akuchlin at mems-exchange.org (Andrew M. Kuchling)
Date: 21 Apr 2000 18:04:03 -0400
Subject: The Simple Economics of Open Source
References: <1255771356-36910442@hypernet.com>
Message-ID: <3dya67xga4.fsf@amarok.cnri.reston.va.us>

> Robin Becker wrote:
> > I prefer not to worry about the exact electronics/chemistry behind my
> > computer. So in that sense my 'open sourceness' has limits. I guess this

That may be only partly true.  Python is the only free software I've
done serious hacking on.  But I've contributed minor patches to a
number of projects -- mod_java, PCRE, SANE.  They might be only fixes
for NULL pointer derefs or documentation typos, but those other
projects have gained a teensy bit more polish from the fact that I
used them.  Of such incremental improvements is great stability made.

Similarly, people who write software on top of Python, or Zope, or
Linux, can trust that *someone* will take care of the maintenance of
that substrate for them, and, in the unlikely event all the
maintainers go away, you could still do it yourself if needed.

"Gordon McMillan"  writes:
> internet technologies)? Remember when IBM truly believed the 
> world would communicate through SNA? Remember when 
> damn near any real app cost at least $10K?

Also, ever had to debug a problem in a binary-only library through
trial-and-error?  You can burn lots of time that way.  
"Hmm... maybe that parameter can't be NULL."   "Maybe that
struct field should be 1." .  I like the fact that, if I
start seeing mysterious errors, I can dive down into the language
interpreter, farther down into the C library, and even into the kernel
if needed.  Though I've only followed a problem all the way into the
Linux kernel once (to discover it was my error), it was reassuring to
be able to do so.

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
He spoke to the scar-dancers, to the straw-dust-women, to the old man with a
swan's arm who tends the back stairs, to the three children of the autopsy, to
the painters and the scriveners and the walls.
  -- From a week in Dream's life, in SANDMAN #64: "The Kindly Ones:8"



From mark at chem.uwa.edu.au  Sat Apr 22 20:29:09 2000
From: mark at chem.uwa.edu.au (Mark C Favas)
Date: 23 Apr 00 00:29:09 GMT
Subject: executable "wrapper" gui -- advice sought
References: 
Message-ID: 

"Grant Goodyear"  writes:

>I'm in the process of writing an exceedingly simple gui that will take an
>already existing binary executable and input text file (I don't want to
>break the
>working system!) and allow the user to modify the input arguments,
>if desired, and then start the executable.  That part is straightforward.
>What I'm not sure how to do is to capture the executable's std out as
>it's generated.  My goal is to echo that output to a seperate window, and
>also to use it to generate a periodically updated html "status report" so
>that the program's progress can be monitored remotely.  Working
>through the gui aspects isn't all that difficult, but I have _no_ idea how
>to grab the executable's std out _while it is running_ and then have the
>python gui do something (anything!) with that data.  Any advice?

Have a look at the on-line module documentation for "commands" (Unix only),
and "popen2" (also Unix, though Mark Hammond's win32 package contains a working
pipe implementation amongst other goodies). If your executable writes to
/dev/tty instead of stdout you'll need to play with the pseudo tty module,
"pty" (doco says available for IRIX & Linux, but it's pretty easy to get it
working for Solaris and Tru64 Unix (nee Digital Unix)). Watch out for buffering
of the output, also.

--
Email  - mark at chem.uwa.edu.au      ,-_|\                           Mark C Favas
Phone  - +61 9 380 3482           /     \               Department of Chemistry
Fax    - +61 9 380 1005      ---> *_,-._/   The University of Western Australia
                                       v                               Nedlands
Loc    - 31.97 S, 115.81 E                               Western Australia 6009


From adjih at crepuscule.com  Fri Apr 28 10:12:01 2000
From: adjih at crepuscule.com (Cedric Adjih)
Date: 28 Apr 2000 14:12:01 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <280420000746597329%pecora@anvil.nrl.navy.mil>
Message-ID: <8ec67h$b14$1@ites.inria.fr>

Louis M. Pecora  wrote:
> In article ,
> Remco Gerlich  wrote:

>> No. However, this seems to make code *more* readable. In fact, many C++
>> programmers use 'this.x' for all their instance variables, to be able to
>> see at a glance which are just local variables of the function and which are
>> instance variables. It's just more work to write, but that doesn't matter
>> much.

> I understand the potential for readability, but I do a lot of
> mathematical programming so the expressions can get pretty cluttered
> with variables and operators.  More self's only makes it worse for me. 
> Maybe that's my problem, but then that's my complaint.

Alternatively you could use 1-liners, if it is justified

class Polynom2:
	def __init__(self,a,b,c):
		self.a,self.b,self.c=a,b,c
	def delta(self):
		return self.b*self.b-4*self.a*self.c

Often, 1-liners will remove the need for one comment.

>> Python needs it to know which vars are instance variables, and which are
>> local variables.

> I'm sure some way of declaring variables 'local' could be done in the
> class defintion, but I doubt Guido would do that now.

>> Funny how people say that every aspect of Python they don't like make the
>> language less "clean". It is extremely consistent though.

> Funny, I guess.  Harder to read for me.

>> You *can* use another word for 'self' though, 's' or 'me' or something. But
>> it makes your code harder to read, of course...

> You mean by doing something like

> s=self
> at the beginning of each class method?

The name 'self' is just a convention.
But since some parsing software will rely on it, "s=self"
might be wiser.

class Polynom2:
	def delta(s): return s.b*s.b-4*s.a*s.c

or

class Polynom2:
	def delta(self):
		s=self
		return s*b*s.b-4*s.a*s.c

or the other suggestions for read-only attributes:


class Polynom2:
        def delta(self):
                a,b,c=self.a,self.b,self.c
                return b*b-4*a*c


-- Cedric



From wayne.izatt at myself.com  Wed Apr 26 23:34:25 2000
From: wayne.izatt at myself.com (Wayne Izatt)
Date: Thu, 27 Apr 2000 03:34:25 GMT
Subject: Python 2.0
Message-ID: <3907B52D.B01D5748@myself.com>

Hi all,

I'm evaluating the viability of developing a number of largish
applications over the next few months. However, I'm concerned about them
not being conformant with Python 2.0. I know that the interpreter could
simply be left at the 1.5.2 or 1.6 level, but this will probably not
satisfy my customer. I could go with that other scripting language, but
would rather not.

I guess what I'm wanting to know is how *much* the core language will
change. I've seen the overview slides describing the differences, but
they are very high-level. Given that my apps will span a number of areas
- text processing, networking, maybe even win32 (yuck) - I don't weant
to find myself with a huge maintenance task when 2.0 does come out.
(Although I admit anything written in that other language becomes a huge
maintenance task after a couple of weeks ;->

So, can anyone give me any advice? Is there any cause for alarm?

ta




From tismer at tismer.com  Tue Apr 25 12:38:38 2000
From: tismer at tismer.com (Christian Tismer)
Date: Tue, 25 Apr 2000 18:38:38 +0200
Subject: Princeton Instruments Python interface
References: <8e2i25$gou$1@nnrp1.deja.com>
Message-ID: <3905CA0E.E1BDF217@tismer.com>


Sam Schulenburg wrote:
> 
> I am developing a python library to access Princeton Instruments
> Spectroscopic WinX/32 COM objects. If anyone else has had done this I
> would like to get in touch with you to share ideas.
> 
> Sam Schulenburg

Do you know what PIPI means in Germany? :-))

-- 
Christian Tismer             :^)   
Applied Biometrics GmbH      :     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 samschul at pacbell.net  Mon Apr 24 21:30:19 2000
From: samschul at pacbell.net (Sam Schulenburg)
Date: Tue, 25 Apr 2000 01:30:19 GMT
Subject: Pythonwin com question
References: <8dqver$l4v$1@nnrp1.deja.com>
Message-ID: <8e2sfb$r6e$1@nnrp1.deja.com>

In Visual Basic I have the following:
'===============================================
Dim theFrame As Varient
Dim dx as DocFile
Dim ex as New ExpSetup
Dim bRes as Integer

if (ex.Start(dx)) then
   While ex.GetParam(EXP_RUNNING,bRes)
       DoEvents 'Wait for detector to finish
   Wend
   dx.GetFrame 1, theFrame 'Retreive one image
end if
'===============================================

In Python I have the equivalent:

from PrincetonInst import *  # Get the renamed Makepy file for the
                             # COM object

theFrame = []                # Set up the Varient
dx = DocFile()               # Get the DocFile class
ex = win32com.client.Dispatch(ExpSetup.CLSID)
bRes = 0

if (ex.Start(dx)) then       # Start detector scanning  for data
   While ex.GetParam(EXP_RUNNING,bRes):  # Detector is scanning
      ## DoEvents  # Wait for detector to finish, This has no
                   # equivalent in Pythonwin
         s = 1     # This gives the while loop something to do
   #### This is where everything falls apart
   #### theFrame is not the correct datatype
   dx.GetFrame(1,theFrame)  # Retreive one image

How do I define the correct Varient type in Python?

Sam Schulenburg





Sent via Deja.com http://www.deja.com/
Before you buy.


From ivanlan at callware.com  Wed Apr 19 23:18:11 2000
From: ivanlan at callware.com (Ivan Van Laningham)
Date: Wed, 19 Apr 2000 21:18:11 -0600
Subject: Browse dialog in PythonWin
References: <38FE32AB.520C1736@callware.com> <38fe3297.36998571@news-server.socal.rr.com> <38FE3998.1ED7FB24@callware.com> 
Message-ID: <38FE76F3.4E352DA6@callware.com>

Hi All--

Mark Hammond wrote:
> 

[bobbitry]

> An alternative to get the real Windows browser dialog:
> 
> >>> import win32com.shell.shell
> >>> win32com.shell.shell.SHBrowseForFolder(0, None, "Select it", 0, None,
> 0)
> ('\024\000\037P\340O\320 \352:i\020\242\330\010\000+00\235\024\000.w
> \354!\352:i\020\242\335\010\000+00\235\000\000', 'Control Panel', 21)
> >>>
> 
> I selected "Control Panel" - You will need to read the docs to see how to
> use that funky string (the PIDL)...
> 

Oh, Mark, this makes my eyes cross and my brain hurt.  And I'm bound to
try it, too.  I guess I really am a masochist.

> No news on starship yet - if its not available for me to re-upload in 24
> hours I will do it somewhere else...
> 

Not to put too fine a point on it, but good.

-ly y'rs,
Ivan;-)
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
http://www.pauahtun.org and
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



From parkw at better.net  Fri Apr 14 15:49:49 2000
From: parkw at better.net (William Park)
Date: Fri, 14 Apr 2000 15:49:49 -0400
Subject: Attributes (+Numerical Python)
In-Reply-To: ; from meh9@cornell.edu on Fri, Apr 14, 2000 at 03:15:58PM -0400
References: 
Message-ID: <20000414154949.A2643@better.net>

On Fri, Apr 14, 2000 at 03:15:58PM -0400, Matthew Hirsch wrote:
> Hi All,
> 
> In Numerical Python, you can say something like vector.imag and it will 
> return arrays of the imaginary parts of the elements in the array, 
> vector.  But this attribute only exists when the array is complex.  I'd 
> like to do something like the following, but I have no idea what the 
> syntax should be:
> 
> if the .imag attribute exists:
>    do something
> else
>    do something else
> 
> How should this be written?
> 
> Thanks for your help,
> Matt

How about
    try:
	
    except:	    # or except AttributeError:
	

--William



From arta at x-stream.nl  Fri Apr 14 10:05:53 2000
From: arta at x-stream.nl (A[r]TA)
Date: Fri, 14 Apr 2000 16:05:53 +0200
Subject: raw_input in loop
Message-ID: 

Heyz, I want to write a loop
in which there's something like raw_input but which
doesn't stop the loop until the enterbutton is hitten.
How do I do that???

A[r]TA

--
We shall not cease from exploration, and the end of all our exploring will
be to arrive where we started and know the place for the first time.
- T. S. Eliot





From helge.hess at mdlink.de  Tue Apr 11 08:25:08 2000
From: helge.hess at mdlink.de (Helge Hess)
Date: Tue, 11 Apr 2000 14:25:08 +0200
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com>  <87r9cdhdb0.fsf@deneb.cygnus.argh.org> 
Message-ID: <38F319A4.89621192@mdlink.de>

Will Ware wrote:
> Florian Weimer (fw at deneb.cygnus.argh.org) wrote:
> > Is it possible to extend your GC in a way which would permit the
> > execution of several bytecode interpreters in multiple threads?
> 
> It sounds like you might want to simply run several copies of the
> Python interpreter in separate processes, which isn't a GC issue.

I think what he wants to do (me too ;-) is to run several copies of the
interpreter in *one* process, possibly in multiple threads.
But I'm not sure whether this is a GC issue though (RC isn't thread-safe
anyway, right ?).

Helge
-- 
SKYRIX-OS  Web Operating System       - http://www.skyrix.com
SKYRIX-IAS IntraNet Application Suite - http://www.skyrix.com


From parkw at freewwweb.com  Wed Apr 26 22:25:43 2000
From: parkw at freewwweb.com (William Park)
Date: Wed, 26 Apr 2000 22:25:43 -0400
Subject: condense whitespace to single space?
In-Reply-To: <36NN4.31937$Xk2.119087@tor-nn1.netcom.ca>; from none@none.ca on Wed, Apr 26, 2000 at 10:57:15PM -0300
References: <36NN4.31937$Xk2.119087@tor-nn1.netcom.ca>
Message-ID: <20000426222543.A1377@freewwweb.com>

On Wed, Apr 26, 2000 at 10:57:15PM -0300, k wrote:
> How do I condense the sections of spaces in this string:
> 
> "abc              def         ghi"
> 
> into single spaces?
> 
> "abc def ghi"

1.  string.join(string.split("abc              def         ghi"))

2.  re.sub(' +', ' ', "abc              def         ghi")

--William



From tim.hochberg at ieee.org  Sat Apr 29 13:20:18 2000
From: tim.hochberg at ieee.org (Tim Hochberg)
Date: Sat, 29 Apr 2000 17:20:18 GMT
Subject: Where can I find NumPy
References: <8ef4pn$jge$1@kopp.stud.ntnu.no>
Message-ID: 



"Jan Erik Breimo"  wrote in message
news:8ef4pn$jge$1 at kopp.stud.ntnu.no...
> The official site (ftp-icf.llnl.gov) hasn't been responding for more than
> a week, so are there any other sites where I can find the source
> files for NumPy?

Yeah, go to sourceforge (www.sourceforge.com) and do a search for numpy --
you should be able to find it.

-tim


>
> --
> Jan Erik Breimo
> email: janeb at stud.ntnu.no




From python-list at teleo.net  Fri Apr 21 10:46:02 2000
From: python-list at teleo.net (Patrick Phalen)
Date: Fri, 21 Apr 2000 07:46:02 -0700
Subject: PyApache memory leak?
In-Reply-To: 
References: 
Message-ID: <00042107521900.02973@quadra.teleo.net>

[Oleg Broytmann, on Fri, 21 Apr 2000]
:: I don't see how httpdapy could help spawn less interpreters instances -
:: it is Apache job to fork and reap off children.

A clarification, from the Httpdapy README:

"""
2. PyApache creates a sub-interpreter (Py_NewInterpreter()) for every
request and destroys it when done. This means that if your script
begins with "import HTMLgen", HTMLgen is imported (bytecode read from
file) for every hit.

Httpdapy keeps the interpreter around from the first hit and until the
process dies. So only the first hit will actually read HTMLgen.py(c),
all the subsequent won't.
"""



From hamish_lawson at yahoo.co.uk  Mon Apr  3 18:29:23 2000
From: hamish_lawson at yahoo.co.uk (Hamish Lawson)
Date: Mon, 03 Apr 2000 15:29:23 -0700
Subject: For 1.6 make UserDict use __setitem__ and __getitem__ in other methods?
Message-ID: <07168ec0.10e4da64@usw-ex0101-006.remarq.com>

Consider the code below which defines a dictionary class whose
keys are case-insensitive.


    import UserDict, string

    class CaselessDict(UserDict):

        def __setitem__(self, key, value):
            self.data[string.lower(key)] = value

        def __getitem__(self, key):
            return self.data[string.lower(key)]

    d = CaselessDict()
    d['Joe'] = "Rhubarb"
    print d['JOE']                  # prints "Rhubarb"
    print d.has_key('JOE')          # prints 0 i.e.
    print d.get('JOE', None)        # prints None


An element set as 'Joe' can be fetched as 'JOE'. However as it
stands the semantics of has_key('JOE') and get('JOE') are
broken, since those methods don't think that a 'JOE' element
exists. This arises because in the parent UserDict class, these
methods access the self.data attribute.

Of course the author of CaselessDict could provide definitions
for has_key() and get(), but somehow this seems a bit inelegant
to me; I feel that the behaviour of has_key() and get() (and
maybe other methods) should follow on from whatever behaviour
has been defined for __getitem__ in the derived class. I propose
that for Python 1.6, UserDict's methods are rewritten to do
this. Is there any reason why this would be a bad idea? Below
I've provided rewritten versions of has_key() and get() to get
started.

    def has_key(self, key):
        try:
            self[key]
            return 1
        except KeyError:
            return 0

    def get(self, key, failobj=None):
        try:
            return self[key]
        except KeyError:
            return failobj


Hamish Lawson


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From gmcm at hypernet.com  Fri Apr 14 08:18:15 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Fri, 14 Apr 2000 08:18:15 -0400
Subject: what is pythonwin?
In-Reply-To: <38F6FDD8.DA2CC785@gmx.net>
Message-ID: <1256407800-56204710@hypernet.com>

Robert Kiendl wrote:

> i ve got embedded the normal pyhton (python15.dll) into a windows
> mfc-app.
> 
> now i want to use some of the win32ui stuff, but cannot load that
> mysterious *.pyd files, whereas normal python.exe from the winall
> distribution does it. are these dll's? 

Yup.

> is pythonwin not based on the
> normal python? 

Normal python.

> do i have to handle the pythonwin source-distribution?
> link another dll?
> i do not get the right track from the standard docs.

Are you by chance using a debug build? Then all the .pyd's 
need to built for debug too. Otherwise it's probably something 
silly, like your PYTHONPATH.


- Gordon



From robin at jessikat.demon.co.uk  Fri Apr  7 18:45:45 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Fri, 7 Apr 2000 23:45:45 +0100
Subject: anyone else wrap gd-1.8?
References: <65118AEEFF5AD3118E8300508B1248774CB282@ALTNET>
Message-ID: 

In article <65118AEEFF5AD3118E8300508B1248774CB282 at ALTNET>, Mike Steed
 writes
>On a semi-related note, I have wrapped (without SWIG) gdchart, a library for
>making charts and graphs, which uses gd.  I have a new version (to be posted
>Real Soon Now) that uses gd-1.8, with support via the Python interface for
>PNG and JPEG output.  There is an entry in the Vaults of Parnassus.
>
>Mike
>msteed at altiris.com
...
I have wrapped using the old gdmodule gd-1.8.1. Unfortunately it's a
hacked version of gd-1.8.1. I sent a patch to T. Boutell maybe it'll get
in sometime.
-- 
Robin Becker


From effbot at telia.com  Thu Apr 20 04:59:40 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Thu, 20 Apr 2000 08:59:40 GMT
Subject: Pythonware Website? (Update, Apr 20)
References: <20000419154202.B480@owl.rhein-zeitung.de> 
Message-ID: <0GzL4.3191$Za1.47063@newsc.telia.net>

quoting the daily python URL (http://hem.passagen.se/eff/url.htm):

    our ISP's file servers are down. this affects the web site as
    well as mail traffic to (but not from) the pythonware.com and
    secretlabs.com domains.

    our ISP is working on it, but the best they can say at this
    moment is "we'll get back to you when we know more"...

if the problem persists, we'll mirror the most important stuff on other
sites.  see the daily URL page for pointers and more status updates.

and as before, urgent mail can be sent to effbot at telia.com






From greg at cosc.canterbury.ac.nz  Thu Apr 20 01:28:53 2000
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Thu, 20 Apr 2000 17:28:53 +1200
Subject: Pliant?
References: <8di0lk$4h0$1@coco.singnet.com.sg>
Message-ID: <38FE9595.7E80B5D9@cosc.canterbury.ac.nz>

Ng Pheng Siong wrote:
> 
> What are your views on Pliant, as a Python programmer?
> 
> Pliant is here: http://pliant.cams.ehess.fr

I've had a brief look. Some observations, in no
particular order.

Personal opinion codes:
   :-) I like it
   :-( I don't like it
   :-! Not sure whether to like it or not
   :-] I think that's rather funny

* Indentation for structure: I approve, obviously! :-)
  Spaces are mandated, tabs forbidden - probably a
  wise move, judging by the Python community's painfully
  gained experience. :-)

* Not so sure about all the different syntactic sugars
  for grouping, though - Too Many Ways To Do It for my
  liking. :-(

* Different operators for integer and floating point division :-)

* Whether "-" is unary or binary depends on surrounding whitespace :-(

* Two different assignment operators, for value and reference
  assignment. :-( (Assignment seems to be quaintly referred to as
  "affectation" :-])

* Pliant introduces Yet Another Way To Spell Else-If: "eif". :-(

* There is a notion of types that can be compared for equality
  but not order (something lacking in Python at the moment). :-)

* There is a large and confusing set of argument passing and
  access modes, cryptically named. :-(

* The type system seems to include unsafe pointers. Refcounting is
  available, but you have to explicitly ask for it, so memory
  leaks and dangling pointers seem to be possible. :-(

* Not sure what to make of the OO stuff. It's based on the
  "generic function" idea, so you can add methods to an existing
  type. The docs don't say whether single or multiple dispatch
  is used. Also they say there is no "heritage" (which presumably
  means inheritance) but then go on to describe what looks a lot
  like an inheritance mechanism. So, I'm confused. :-(

  The author also tries to make a rather unconvincing argument
  that the generic-function approach makes programs easier to
  read than the class-oriented approach, but as far as I can
  see it only makes the problem worse!

* Globals live in modules, as in Python. Modules can have
  explicit "public" and "private" parts. :-)

* Something akin to Scheme macros can be written that operate
  on the parse tree, although it seems that they can go right
  down to the machine code level if desired. :-!

That's all I have time for now,

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+


From rupole at compaq.net  Thu Apr 27 17:57:40 2000
From: rupole at compaq.net (Roger Upole)
Date: Thu, 27 Apr 2000 21:57:40 GMT
Subject: win32net setting a account to expire
References: <8e9sub$v7h$1@tracy.nacs.net>
Message-ID: 

win32net.NetUserSetInfo(srvr,user,lvl,dict)
The dictionary contains varying info depending on the level.
You might have to play around with NetUserGetInfo to figure
out which level has the parameters you want to set by the
names of the keys in the dict returned.  There's more info in
the help file in the python\win32\help directory
       Roger Upole

"Aaron Hagan"  wrote in message
news:8e9sub$v7h$1 at tracy.nacs.net...
> Is there a function to set a user account to expire ..
> similar to the command NET USER  /EXPIRE:xx/xx/xx /DOMAIN ?
> thanks
>
>




From cnetzer at stanford.edu  Wed Apr 19 04:47:45 2000
From: cnetzer at stanford.edu (Chad Netzer)
Date: Wed, 19 Apr 2000 01:47:45 -0700
Subject: Python 1.6a2 crashes in test_fork1 on my Mandrake Linux 7 machine
References: <20000413010344.A13931@owl.rhein-zeitung.de> <38F658C6.66AD9CA5@clark.net> <20000414154718.A15664@xs4all.nl> <20000414190308.A30502@owl.rhein-zeitung.de> <38F91D1B.3D663B0C@stanford.edu>
Message-ID: <38FD72B1.DBB2F731@stanford.edu>

Well, as a followup to my last message, I recompiled my kernel for single-CPU
operation (I have a dual CPU machine), and was able to pass the "test_fork1.py" test
each time, so there appears to be a problem w/ threads on dual CPUs.  Whether it is
specific to Linux, Glibc, or Python's threadmodule, I have no idea.  But anyone else
with a dual CPU Linux (or other) setup would be a big help if they reported their
results. (Note, I tested this under Linux kernel 2.3.99pre5 and 2.2.15, with the
same results.  I'm using Glibc 2.1.3)

Neil Schemenauer sent me the following code, which demonstrates a problem quite
clearly.  It locks up on me in dual-CPU mode, but works fine in single-CPU mode.

I'll investigate more if I can, but learning about PDEs is keeping me very busy. :)

Chad Netzer
cnetzer at stanford.edu

--------------- [ cut here ] ----------------

import threading
import os, sys

class MyThread(threading.Thread):
    def start(self):
        threading.Thread.start(self)

    def run(self):
        while 1:
            if os.fork() == 0:
                print os.getpid()
                os._exit(0)
            os.wait()

MyThread().start()
MyThread().start()
MyThread().start()




From pup at pobox.com  Mon Apr 24 15:28:04 2000
From: pup at pobox.com (Joel Burton)
Date: Mon, 24 Apr 2000 15:28:04 -0400
Subject: Gzip -> FTP w/out using a temporary file?
Message-ID: <8e2733$2re8$1@nnrp-corp.news.cais.net>





From simpsons at kom.auc.dk  Wed Apr 26 16:09:22 2000
From: simpsons at kom.auc.dk (Thomas Rasmussen)
Date: Wed, 26 Apr 2000 20:09:22 GMT
Subject: global variables or inheritence
References: <28p8zy0irgc.fsf@lada.kom.auc.dk> 
Message-ID: <28p4s8oipzh.fsf@lada.kom.auc.dk>

>>>>> "Jeff" == Jeff Massung  writes:

  Jeff> Sorry if I get this wrong... but I thought you'd just import
  Jeff> your other file.

  Jeff> Example:

  Jeff> # File1.py myVar = 2


  Jeff> # File2.py import File1 print File1.myVar #should print 2

Well that was also what I thought, but the following program wont
execute:
testprog1.py:
import os, sys, string, testprog2
def main():
    print 'hello'
    myvar = 2
    testprog2.second()
if __name__ == '__main__':
    main()

testprog2.py:
import os, sys, string, testprog1
def second():
    print testprog1.myvar
if __name__ == '__main__':
    print 'nope'

    
and then I execute python testprog1.py and get the following error:

22:03 simpsons at lada% python testprog1.py                               ~/python
hejsa
Traceback (innermost last):
  File "testprog1.py", line 7, in ?
    main()
  File "testprog1.py", line 5, in main
    testprog2.second()
  File "testprog2.py", line 3, in second
    print testprog1.myvar
AttributeError: myvar

:-(

Thomas

-- 
KOM Network student helper

"To alcohol! The cause of - and solution to - all of life's problems!"
-- Homer Simpson


From ns566645 at swt.edu  Sun Apr 23 23:06:47 2000
From: ns566645 at swt.edu (Shah, Navneet)
Date: Sun, 23 Apr 2000 22:06:47 -0500
Subject: Scrollbar needed to get attached to Canvas
Message-ID: <3903BA47.A7CABC48@swt.edu>

I am using Pmw Mega widget. I  already  have canvas with buttons in it.
How can I attached scrollbar to the canvas. Any help will be
appreciated.

Shah

My code goes as follows:

class Demo:
    def __int__(self,parent)
        #Create the canvas
        self.sc=Pmw.ScrolledCanvas(parent,
                     borderframe=1,
                     labelpos ='n',
                     usehullsize = 1,
                     hull_width = 400,
                     hull_height = 300,
           )

          self.sc.pack()
          button=Tkinter.Button(self.sc.interior(), text='Hello')
          button.pack(side='left')






From erno at iki.fi  Mon Apr 17 17:41:13 2000
From: erno at iki.fi (Erno Kuusela)
Date: 18 Apr 2000 00:41:13 +0300
Subject: Filtering web proxy
References: 
Message-ID: 

>>>>> "Oleg" == Oleg Broytmann  writes:

    Oleg> Hello!  I want a filtering web proxy. I can write one
    Oleg> myself, but if there is a thing already... well, I don't
    Oleg> want to reinvent the wheel. If there is such thing (free and
    Oleg> opensourse, 'course), I'll extend it for my needs.

i am using junkbuster. it's simple, and works well.

it only does url blocking (so banners), but i never have javascript
turned on anyway. it can block cookies selectively (i have everything
but slashdot blocked), hide/spoof user-agent, and use other http
proxies.

it doesn't do html parsing, and it's not written in python though.
but i haven't missed anything from it so it being written
in c hasn't bothered me much. with javascript/java turned
off there's not so much need for html parsing...

    Oleg>    I wrote dozen HTML parsers in Python, so I can write one
    Oleg> more, and turn it into a proxy, but may be I can start with
    Oleg> some already debugged code?

a html parser would need to work incrementally, unless you want to
wait for the whole document to be transferred over the network before
seeing any of it rendered.

i guess you could do it incrementally with sgmllib (iirc you feed it a
file object?), but you run into the fact that a big part of
the html documents on the web are malformed and rely on the
error correcting heuristics of the major browsers to function...

one starting point could be the "gray proxy" (i forget what it was
really called). that was written on top of medusa, i think there was
an announcement here? probably a year or so ago.  it parsed the html
and changed all the colors to grayscale, and did the same for
images. medusa isn't free though.. (except the version in zope?)

mozilla allows you to block/allow javascript by domain, iirc.

  -- erno







From bjorn at roguewave.com  Mon Apr  3 13:26:33 2000
From: bjorn at roguewave.com (Bjorn Pettersen)
Date: Mon, 03 Apr 2000 11:26:33 -0600
Subject: Pass by reference ?
References: <38E864C9.E1EE94F7@ecs.soton.ac.uk>
Message-ID: <38E8D449.FBC1E2AD@roguewave.com>

Jacek Generowicz wrote:
> 
> Hi,
> 
> I'm just trying to familiarize myself with Python.
> In Magnus Lie Hatland's Instant Python, he
> mentions that `all parameters in Python are passed
> by reference'.

The technically correct (although much less known) term is
pass-by-object-reference.  All this means is that you can change an
argument to a function by calling methods on the object, but you can't
change the identity of the object (ie. simply calling a function can't
change any name-bindings in your current scope).

Std disclaimer that anything can happen if you are willing to mess with
frame objects apply...

-- bjorn



From thehaas at my-deja.com  Wed Apr  5 16:22:38 2000
From: thehaas at my-deja.com (thehaas at my-deja.com)
Date: Wed, 05 Apr 2000 20:22:38 GMT
Subject: A Mountain of Perl Books + Python Advocacy
References: <20000405053920.20579.qmail@web2102.mail.yahoo.com>
Message-ID: <8cg79s$luf$1@nnrp1.deja.com>

In article <20000405053920.20579.qmail at web2102.mail.yahoo.com>,
  lewst  wrote:
[snip]
> What is it about Perl that makes it so much more popular and have such
> a huge grassroots swell?  I personally find Perl an abomination and
> Python a breath of fresh air.  Perl has that first mover advantage I
> suppose, but should that really make such a hugh difference?

If you use Unix, Perl is easy to learn and you can write fairly powerful
scripts in a short amount of time.  Remember that Perl was basically
designed for system administration tasks, not necessarily for an
all-purpose language.  Sys Admins generally don't care how the
script/programs work, they just need something simple and need it
written fast.

One of my good friends is happens to be one of the biggest
language-bigots in the world.  I had been telling him for a long time
that he needed to try Python out, that he would like it (He was using
PHP and C++ before).  He refused, saying that he didn't want to be tied
down by the whitespace and that he didn't approve of how Python did
object-oriented stuff (I don't know why).  At this time, I wasn't that
serious about Python, but knew that he would like it (since he considers
Perl a freak of nature that should be avoided).  Well, he finally got
tired of PHP and C++ (I think the three days he spend trying to put in a
tree into PHP and failing did it) and bought Learning Python.  Now he
loves Python - I have never heard him say this many good things about
any programming language.  However, for the record, the whitespace
bothers him and he thinks how Python does object-oriented things is
weird, but he loves it and will not use anything else.  This got me more
serious about Python, so I bought Learning Python and am hooked (but I
haven't rewritten a lot of my Perl stuff yet, since most of the my Perl
things work well and I hate looking at Perl code).

The moral of the story: even if you are a language bigot, you will still
love Python.  So what isn't it more popular?  Who says it isn't popular?
 Perl has been out longer, but we are also seeing places move from Perl
to Python (or something else) because they don't want to maintain Perl
programs that are quickly becoming way too convolted.  Python is much,
much cleaner and is very easy to write programs in.  I predict that we
will see an expontential increase in Python use/awareness in the coming
months.  IMHO, it will be because of Perl and it's weaknesses.

- mikeh



Sent via Deja.com http://www.deja.com/
Before you buy.


From michael.stroeder at inka.de  Thu Apr 20 15:22:29 2000
From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Thu, 20 Apr 2000 21:22:29 +0200
Subject: socket.SO_REUSEADDR
References: <38FEEA44.6C05E2B0@inka.de> <8dn9o5$jsp$1@mawar.singnet.com.sg>
Message-ID: <38FF58F5.E1464322@inka.de>

Ng Pheng Siong wrote:
> 
> According to Michael Str?der  :
> >     self.socket.setsockopt(
> >       socket.getprotobyname('tcp'),
> >       socket.SO_REUSEADDR,1
> >     )
> 
> Michael,
> 
>     self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

And with M2Crypto? (AttributeError: setsockopt)

Ciao, Michael.


From ns566645 at swt.edu  Mon Apr 24 02:25:05 2000
From: ns566645 at swt.edu (ABC)
Date: Mon, 24 Apr 2000 01:25:05 -0500
Subject: Tkinter.Button error
Message-ID: <3903E8C1.39B3E3D7@swt.edu>

I have two frames
top frame and bottom frame.
In the top frame I implemented a group.
Now, when I try to add Tkinter.Buttomn widget in the group in the top
frame it gives error . Can anyone help me and tell me what the error is?

Here is the code

frame1=Frame(master, relief=sunken', borderwidth='2')
frame2=Frame(master, relief='sunken', borderwidth='1')

frame1.place(relx=0, rely=0, relwidth=1, relheight=0.50)
frame2.place(relx=0. rely=0.50, relwidth=1, relheight=0.50)

group1=Pmw.Group(frame1, tag_text="Hello")
group1.pack(fill='both')

button=Tkinter.Button(group1.interior(), text='8.00')
button.pack()

The above program gives an error in TKinter in the second last line.
I have no clue of what the error is? Can anyone help me?
Need futher information, please let me know.









From ivanlan at callware.com  Tue Apr  4 19:01:38 2000
From: ivanlan at callware.com (Ivan Van Laningham)
Date: Tue, 04 Apr 2000 17:01:38 -0600
Subject: Two questions
References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com>
Message-ID: <38EA7452.9BFDF37E@callware.com>

Hi All, Tim--

Timothy Grant wrote:
> 
[snip]
> Ivan,
> 
> mxODBC works beautifully, but I've never used it to access and access
> database, only SQL database. Perchance do you know how Windows
> advertises an Access database to an ODBC driver?
> 

Nope, not yet.  However, I'll have to find out, won't I?

-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
http://www.pauahtun.org 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



From banderson at boi.hp.com  Wed Apr 19 12:57:35 2000
From: banderson at boi.hp.com (Bill Anderson)
Date: Wed, 19 Apr 2000 10:57:35 -0600
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk>  <38F00890.3C98EBDB@acm.org>
Message-ID: <38FDE57F.65FF34CF@boi.hp.com>

"Robert W. Cunningham" wrote:
...
>  blah = (((test and [true]) or [false])[0])             # blah = (test ?
> true : false)
> 
> Works for me!  Only if I have a good reason to suspect a problem in this
> particular line of code will I have to look past the comment.  Which, I
> believe, is the entire purpose of in-line comments in the first place.  The
> best way to get someone to read every single line of your code is to fail to
> properly comment it.
> 
> Are there ANY Python programmers who don't also know at least this much C?

Given that Python is being used to teach programming to people who don't
know it, yes. And you can expect that number to increase.

-- 
Bill Anderson 			Linux/Unix Administrator, Security Analyst
ESBU (ARC)			bill_anderson at boi.hp.com
My opinions are just that; _my_ opinions.


From mfletch at tpresence.com  Sun Apr 16 13:03:36 2000
From: mfletch at tpresence.com (Mike Fletcher)
Date: Sun, 16 Apr 2000 13:03:36 -0400
Subject: [ANNOUNCE] Garbage collection for Python
Message-ID: 

Hmm...

Stackless
Continuations (exposed to Python programmers! please :) )
Garbage collection
List comprehensions

together in Python 1.7/1.6.x would get you approximately an 8-really rating
(1 point for the lc's, 2 bonus for having all working together).  Oh, and
heal that type-class split while you're at it ;) .  If you get any extra
time :o) , add optional static typing and native compilation...  might get
yourself a full ten-really rating... and we all know what that means!

The first step on the path to Guido-hood is a path unto itself.
The second is a lifetime wandering in the desert of code.
At the third step, your true journey begins.
Mike

-----Original Message-----
From: Christian Tismer [mailto:tismer at tismer.com]
Sent: Sunday, April 16, 2000 12:54 PM
To: Just van Rossum
Cc: Fredrik Lundh; python-list at python.org
Subject: Re: [ANNOUNCE] Garbage collection for Python




Just van Rossum wrote:
> 
> Michael Hudson  wrote:
> > To someone who might know: what hope is there for this to go
> > into 1.6?
> [ ... ]
> > It would be, in my opinion, be a really really really good thing; for
> > one thing it would help in language wars...
> 
> Fredrik Lundh wrote:
> > sorry, but stackless python is the only really really really good
> > thing that hasn't yet been added to the core.  this is just really
> > really good.

Hey! If Stackless goes with GC, can we get 5 times "really"? :-))

...



From jtc at dimensional.com  Tue Apr 18 17:38:10 2000
From: jtc at dimensional.com (Jim Cochrane)
Date: 18 Apr 2000 15:38:10 -0600
Subject: Date class?
Message-ID: <8dikk2$p4s@flatland.dimensional.com>

I just checked the python books I have and did a search of the standard
library and was suprised to find that Python has no standard date class.
Does anyone know if there is a good date class available?  I did come
across a module called mxDateTime in a web search that has a DateTime class
and it looks like this may be a defacto standard.  Is that the case?

Concidentally, I just read here that the starship server just died; and
that appears to be the only place where mxDateTime is available.  Does
anyone know of another site that has the mxDateTime package?

Thanks!
-- 
Jim Cochrane
jtc at dimensional.com


From vetler at ifi.uio.no  Sat Apr  1 05:24:38 2000
From: vetler at ifi.uio.no (Vetle Roeim)
Date: 01 Apr 2000 12:24:38 +0200
Subject: Emacs Python mode
Message-ID: 

I just had an idea. Using the Emacs python-mode, would it be possible
to somehow hide the function-bodies?

Sometimes it would be useful to get an overview of the functions
provided by a class.


vr


From philh at vision25.demon.co.uk  Wed Apr 26 12:12:17 2000
From: philh at vision25.demon.co.uk (phil hunt)
Date: Wed, 26 Apr 2000 17:12:17 +0100
Subject: Python Time classes
Message-ID: 

Is there a high-level Time class for Python?

I'm aware of the 'time' module in the standard library. But I'm
looking for something more high-level (I can't find anything
relevant on Parnassus or Freshmeat). What I want is roughly the
ability to say things like:

   t1 = Time.now()   
   # (t1) is an instance of Time containing the time now

   t2 = Time(2000, 4, 26, 17, 4, 0) 
   # (t2) is 2000-Apr-26 17:04:00

   sec = t1 - t2   
   # (sec) is the number of seconds between (t1) and (t2)

   str = t1.format("%H:%M:%S")
   # (str) is a string containing the hours minutes and seconds of (t1)
   # in a form like 23:59:06

It'd also be nice if there was a similar Date class which stored
a date (this would behave like a Time except that (i) the hh:mm:ss
would always be 00:00:00, and (ii) subtracting two dates would return
the number of days difference). Obviously times and dates would be
easily convertable to each other:

   aTime = Time(aDate)
   aDate = Date(aTime)

(or similar).


Does this exist, or shall I write one?

-- 
***** Phil Hunt ***** send email to phil at comuno.com *****
Moore's Law: hardware speed doubles every 18 months
Gates' Law: software speed halves every 18 months 


From tom__98 at my-deja.com  Wed Apr 12 02:15:34 2000
From: tom__98 at my-deja.com (tom__98 at my-deja.com)
Date: Wed, 12 Apr 2000 06:15:34 GMT
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> 
Message-ID: <8d149t$jo6$1@nnrp1.deja.com>

>     tom>  -- How can I browse the Python documentation without firing
>     tom> up a web browser?
>
> Convert it to text format. It's latex, you can make it into anything
> you want, and do anything you want with it.

Well, what I'm suggesting is that it might be a good idea
to make a command-line accessible version of the documentation,
together with a command line tool, available as part of the
standard distribution.

>     tom>  -- Is there a Python equivalent of CPAN and the Perl CPAN
>     tom> module?  The closest I know of is Parnassus.  But Parnassus
>     tom> is merely a collection of links, not an archive, and it
>     tom> doesn't have any facilities (AFAIK) for automatic
>     tom> installation.
>
> So, who gives a crap?
> I try not to be that lazy.

So, you are saying that you basically agree: compiling and
installing modules is more work on Python, but that really
shouldn't matter because expecting to install modules quickly
is just laziness.  Well, I admit it, I'm lazy.

perldoc and the Perl CPAN module are really nice and well done,
and as a user, I miss that functionality when I use Python.
Why not learn from Perl where they did something good? This
antagonism between the two camps, expressed in your and other
posts, just seems really silly to me as a user of both languages.

Tom.



Sent via Deja.com http://www.deja.com/
Before you buy.


From roy at popmail.med.nyu.edu  Wed Apr  5 09:32:47 2000
From: roy at popmail.med.nyu.edu (Roy Smith)
Date: Wed, 05 Apr 2000 09:32:47 -0400
Subject: What is python's language level?
References: <38EA1B8F.A797A130@lmco.com> <38E9DDD3.3313FF6@bioreason.com>   <38EA9CD4.3473B910@callware.com> 
Message-ID: 

dan at cgsoftware.com wrote:
> Reminds me of a neat little raytracer written in postscript someone
> posted many years ago.
> 
> I was just playing with it a few minutes ago.
> About 7k, raytraces 5 spheres by default.
> you have to set the max ray depth to about 3 or 4 or it'll take
> forever.

I remember running that on our original Apple LaserWriter many years ago.  I 
have no idea how long it took; I gave up waiting and went home for the night.  
The next morning, it had printed the image.

-- 
Roy Smith 
New York University School of Medicine



From thomas at xs4all.net  Fri Apr 28 16:57:28 2000
From: thomas at xs4all.net (Thomas Wouters)
Date: Fri, 28 Apr 2000 22:57:28 +0200
Subject: Python does not let me format time.
In-Reply-To: ; from scarblac-spamtrap@pino.selwerd.nl on Fri, Apr 28, 2000 at 01:14:46AM +0000
References: <8eakhq$797$1@nnrp1.deja.com> 
Message-ID: <20000428225727.K11481@xs4all.nl>

On Fri, Apr 28, 2000 at 01:14:46AM +0000, Remco Gerlich wrote:
> Sindh wrote in comp.lang.python:
> > If there is already a moduls to do the same , much helpful.

> >>> import time
> >>> time.strptime("00/04/28","%y/%m/%d")
> (2000,04,17,0,0,0,6,1,0)

> strptime is the inverse of strftime, in a way.

But unfortunately, not all operating systems supply it, and if they do not,
then the time module doesn't, either. If you expect your app to be portable,
dont rely on time.strptime ;) (Or write a replacement strptime, of course,
and get it included in the standard time module. I'd like that a lot, but
haven't the time to figure out all the gory strptime details.)

-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



From taashlo at sandia.gov  Thu Apr  6 08:54:46 2000
From: taashlo at sandia.gov (taashlo at sandia.gov)
Date: 06 Apr 2000 06:54:46 -0600
Subject: What/where is HTMLBuilder?
References: 
Message-ID: 

Ronald E Jeffries  writes:

> I've searched my docs and python.org for HTMLBuilder with no luck.
> Where, please?
> 
> Thanks!
> 
> Ron Jeffries
> http://www.XProgramming.com


Ron,

I found it by going to
 and following the
link to "Current working files for the XML-SIG" at the bottom of the
page and downloading PyXML-0.5.3.tar.gz.

Tad


From wtanksle at dolphin.openprojects.net  Sat Apr  1 22:30:28 2000
From: wtanksle at dolphin.openprojects.net (William Tanksley)
Date: Sun, 02 Apr 2000 03:30:28 GMT
Subject: New Features in Python 1.6
References: <200004011740.MAA04675@eric.cnri.reston.va.us> <_pyF4.25562$E85.640966@news1.rdc1.md.home.com>
Message-ID: 

On Sun, 02 Apr 2000 02:39:54 GMT, Eric Hagemann wrote:
>What are the options for users wanting 1.6 that may not have access to
>modules.python.org
>on a regular basis or at all.  I'd hate to be disconnected from the net and
>find I need that
>'one' function that used to be in the standard library ......... e.g. can I
>down load the
>entire library and forgo the net check ?  What happens if there is no net --
>will the import function
>get unhappy ?

It's actually not a problem -- all modern OSes support TCP/IP even when
you're disconnected from the net, and one particular address, 127.0.0.1,
is always live.  This happens to be the site from which Python loads its
modules (we have an agreement with the owner of that site, which also
hosts many other products of the same nature, including some marketing
apps).

>Also when you import like this does the code check the net for a newer
>version or only when you have no version of the particular sub-module ?

Only when you have no version.  That's not a bad idea, though.  I suspect
it would be best as a single, user-initiated command, though.

>"Guido van Rossum"  wrote in message

>> 2. Imputils

>> Complementary to the Distutils are the Imputils, or Import Utilities.
>> Python's import mechanism has been reworked to make it easy for Python
>> programmers to put "hooks" into the code that finds and loads modules.
>> The default import mechanism now includes hooks, written in Python, to
>> load modules via HTTP from a known URL.
>>
>> This has allowed us to drop most of the standard library from the
>> distribution.  Now, for example, when you import a less-commonly-needed
>> module from the standard library, Python fetches the code for you.  For
>> example, if you say
>>
>>     import tokenize
>>
>> then Python -- via the Imputils -- will fetch
>> http://modules.python.org/lib/tokenize.py for you and install it on your
>> system for future use.  (This is why the Python interpreter is now
>> installed as a setuid binary under Unix -- if you turn off this bit, you
>> will be unable to load modules from the standard library!)
>>
>> If you try to import a module that's not part of the standard library,
>> then the Imputils will find out -- again from modules.python.org --
>> where it can find this module.  It then downloads the entire relevant
>> module distribution, and uses the Distutils to build and install it on
>> your system.  It then loads the module you requested.  Simplicity
>> itself!

-- 
-William "Billy" Tanksley


From bobalex at home.com  Tue Apr  4 12:47:12 2000
From: bobalex at home.com (Bob Alexander)
Date: Tue, 4 Apr 2000 09:47:12 -0700
Subject: Tuples -- who needs 'em
References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> 
Message-ID: <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com>

"Fredrik Lundh"  wrote:

> -- http://www.python.org/doc/FAQ.html#6.15

Thanks for the pointer, but I'd already seen it. My post was not about lack
of understanding of tuples, it was simply intended to provoke some
interesting discussion. I realize tuples are probably a religious issue in
the Python community, so please don't take it the wrong way.

Let me repeat that I really like Python, I've written a lot of code with it,
I don't have any trouble understanding the concept of tuples vs. lists, and
I use both constructs at appropriate times. But I'm exploring the idea that
programming life might actually be somewhat better with lists and tuples
unified to a single datatype. Then there would be no need for FAQ # 6.15 :-)

I'm aware that this issue is not some great flash of insight. It is so
obvious that the Python in-group certainly have given it plenty of thought.
But that doesn't mean it's not worth talking about,

> -- things should be as simple as possible, but no simpler.

(Cool expression -- did you make that up?)

I completely agree, but several very good computer languages are
existence-proofs that lack of immutable lists is not "simpler than
possible".

> -- from a human perspective, using different syntax for
>    different things is good.

I agree with this, too (noting Lisp as possibly the worst example --
although a fine language with clear favorable influences on Python). But
my issue is not about syntax.

However, too bad about that nasty syntax irregularity that using parens for
tuples presents  (1,)  (Couldn't resist  ;-)

>    tuples are simple structures.
>    lists are collections of homogenous (in one sense or
>    another) values.  from a program design perspective,
>    that are two radically different things.

Well, this is a half-empty vs. half-full thing -- I view them as pretty
similar. As a programmer I can choose to not modify a list and voila, it's
basically a tuple. It's not really necessary to have the language enforce
this (although it can be helpful in a large project).

BTW, both tuples and lists are ordered collections of non-homogeneous values
(i.e. the elements can be if different types).

> -- tuples can be used as dictionary keys.  mutable
>    collections can not.

This is the most compelling justification I've seen so far.

> -- python's core types fall into two categories: the first
>    is simple types, like numbers, strings, and tuples. they
>    are all immutable.
>
>    the other category is container (or collection) objects.
>    they're far more powerful, and harder to use for beginners.

Yet the concept of array is pretty fundamental to programming. Arrays are
usually thought of as mutable. Anyone having trouble with that concept is
pre-beginner  :-)

Without tuples, there would be no need to explain to
beginners the difference between tuples and lists. The fact that this is a
recurring topic on this list says something about that.

> -- this has been discussed over and over again.  have you
>    studied earlier threads on this topic?

No.

> -- good designers know that hypergeneralization tends to be
>    a bad idea.

Yes -- there is a proper balance for everything. I've happily used languages
that don't have immutable lists, though, and was
never aware that they were lacking something.

By the way, if immutable lists are necessary, why are immutable dictionaries
not necessary? Seems that all the same arguments would apply.

> -- what would happen if we took them away?
>
> -- do we really need yet another "I don't fully understand this,
>    so it should go away" thread?  do you really think that tuples
>    are just an accidental feature?  (just asking...)

I'm sure tuples are not an acciental feature. And my issue comes from
understanding, not lack of understanding. I harbor a suspicion that the
motivation for tuples might have been more for implementation concerns
than for users' convenience. More on this below.

> > Suppose Python had only one sequence data type: list, and that we could
> use
> > it in all places where tuples are needed now. I would never have to
think
> > about whether to use tuple or list. I would never have to convert from
> tuple
> > to list or vice versa. Just one more thing I don't have to bother with.
>
> if you find that you end up doing this all the time, you're not
> following the "fixed structures vs. homogenous collections"
> design rule.
>
> (or you're using extension modules that haven't been upgraded
> to use the abstract sequence API.  most standard extensions do,
> these days).
>
> if you don't do this all the time, what's the big deal?

Well, okay, I don't do it all the time, and it's not a big deal. I'm just
exploring the opportunity for a small reduction in the "cognitive load" of
Python programming. In my opinion, it's the difference in cognitive load
that mainly differentiates ease of programming in languages like Python from
languages like C++. Thankfully we don't have to decide among 10 or so
different collection types. But even small choices to make when choices are
not necessary cause the mind to leave the problem that is being solved to
deal with a programming "bookkeeping" issue.

> > I suspect there will be several answers offered as to why we need both
> > types, but I also suspect most of the benefits are for the Python
> > implementor(s), not programmers.
>
> umm.  I thought having two similar types meant more work for
> the python implementors, not less?

I wish there was something like the C++ ARM for Python, where choices in
language design are discussed and justified. I don't particularly like C++,
but I like that book because of the insight it provides. If there is such a
book or paper on Python, I'd appreciate a pointer to it.

There is a design pattern (that is not in the book!) where some program
features exist more for for benefit of the program implementor(s) than for
the program user(s). Is there some element of this in the existence of
tuples as a source language construct? I'm aware the the feature has been
well-sold as a benefit to programmers.

My suspicion (lacking any real knowledge about this, and with deepest
respect for the designer(s) of Python) is that there was
already a need for an internal "tuple" datatype in the language's
implementation, and it was efficient for
things like function argument frames, and maybe for
multiple function return values, etc. Given that, maybe apply() could be
implemented
 more efficiently if tuples were exposed at the source language level and
the
user passed tuples to apply(). (Note that apply() will convert sequences to
tuples if they are not already, thus efficient use of apply requires that
tuples be passed, not lists.) Given this sort of justfication for tuples,
many more
reasons were then noticed why tuples are a Good Thing.

I'm all for efficient implementation, but Python usually opts for
programming ease over raw efficiency. I agree with that philosophy -- design
for ease of use and eventually techniques will be figured out for
making the underlying implementation more efficient.

-- Bob







From effbot at telia.com  Tue Apr 18 14:50:49 2000
From: effbot at telia.com (Fredrik Lundh)
Date: 18 Apr 2000 13:50:49 -0500
Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Apr 18)
Message-ID: 

>From the minor disaster department:
    starship.python.net is down.  It will be up again soon,
    but most of the contents have been lost in a major disk
    crash.  If you, for some reason, have mirrored portions
    of it, contact the maintainers.  More info here:
        http://www.deja.com/=dnc/getdoc.xp?AN=612763208
        http://www.deja.com/=dnc/getdoc.xp?AN=612100048

In other news:
    Software Carpentry: The Design Competition Entries
    are in:
        http://software-carpentry.codesourcery.com/entries/index.html

    Ng Pheng Siong: M2Crypto 0.04
        http://mars.post1.com/home/ngps/m2/
        http://www.deja.com/=dnc/getdoc.xp?AN=612311988

    John Aycock: SPARK 0.6
        http://csr.uvic.ca/~aycock/python
        http://www.deja.com/=dnc/getdoc.xp?AN=610996110

    CADScript: CAD data access from Python
        http://www.deja.com/=dnc/getdoc.xp?AN=610644248

    Mark Lutz: Python Training in Boulder, Colorado
        http://www.deja.com/=dnc/getdoc.xp?AN=610763192

    Cristian Echeverria: Theme support for Tkinter
        http://www.geocities.com/cristian_echeverria/Chevegui.html

    PyUnit - a unit testing framework for Python
        http://pyunit.sourceforge.net/


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

Everything you want is probably one or two clicks away in these pages:

      Python.org's Python Language Website is the center of Pythonia
          http://www.python.org

      eff-bot's complements this digest with his daily python url
          http://hem.passagen.se/eff/url.htm

      Much of Python's real work takes place on Special-Interest Group
          mailing lists http://www.python.org/sigs/

      Python Consortium emerges as an independent nexus of activity
          http://www.python.org/consortium

      The Vaults of Parnassus ambitiously collects Python resources
          http://www.vex.net/~x/parnassus/   

      Python To-Do List anticipates some of Python's future direction
          http://www.python.org/cgi-bin/todo.py

      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

      Archive probing trick of the trade:
          http://www.dejanews.com/dnquery.xp?QRY=&DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=threaded&showsort=date&maxhits=100&groups=comp.lang.python


Previous - (U)se the (R)esource, (L)uke! - messages are listed here:
  http://purl.org/thecliff/python/url.html
or
  http://www.dejanews.com/dnquery.xp?QRY=~g%20comp.lang.python%20Python-URL%21


Suggestions/corrections for next week's posting are always welcome.
  http://www.egroups.com/list/python-url-leads/

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 thehaas at binary.net  Fri Apr 21 14:59:48 2000
From: thehaas at binary.net (Mike Hostetler)
Date: Fri, 21 Apr 2000 13:59:48 -0500
Subject: compress_web.py
Message-ID: <3900A524.4A32674D@binary.net>

I have a web page that doesn't have many large pieces, but it has many
large ones.  When I added a page, I would have to update the index, etc.
It was hard to remember which pages I updated, so I just tar'ed them all
up.  This got old, because I had to upload a sort-of large tarball
(~100k gziped) when I only created one html file less then 3k.  I
thought, "You know, it would be really cool if I wrote a program that
would check the date of the files, then just compress the new files." 
So I did.  The original was written in Perl, and it sucked.  Then I
discovered Python.  The Python version was not only cleaner, but it's
even faster.

So here it is, submitted for your approval.  I'm including it here in
case it's useful for someone, either to use the script yourself or to
learn a bit more about Python (I know I learned a lot of Python writing
this).  The license is GPL'ed.  I also signed it with gpg, for those
interested/worried about such things.  My gpg signature is available at
http://www.binary.net/thehaas/mikeh.gpg 

Email me if you have questions, comments, or sympathies.

- mikeh

-- 
Mike Hostetler          
thehaas at binary.spam_must_die.net 
http://www.binary.net/thehaas 
GnuPG key: http://www.binary.net/thehaas/mikeh.gpg
-------------- next part --------------
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

#!/usr/local/bin/python
######################################
# compress_web.py
# (C) 2000  by Mike Hostetler
######################################
#    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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
######################################

import os,stat,time,string

#####################################
def compress_web(tar,days,webdir,bad_files):

	os.chdir(webdir)

	newfiles = []

	os.path.walk(webdir,find_time,newfiles)
	
	if (newfiles != []):
		for i in newfiles:
			tar = tar+ " " + i
		os.system(tar)
	else: 
		print "\n### no files found that needed archived\n"

#####################################
# this function is called by the os.path.walk for each file in webdir 
def find_time(newfiles, dirname, names):

	strlen = len(webdir)+1
	time_limit = time.time() - (86400 * days)

	for file in names:	
		filename= dirname+"/"+file

# Wow, this line sucks.  But it works.
# What it does:
#        1st condition - is it in list of files we don't want?
#        2nd condition - is it a regular file (i.e. not a directory)?
		if not(file in bad_files) and (stat.S_ISREG(os.stat(filename)[stat.ST_MODE])):

# This checks to see if the file meets the time requirement
			if os.stat(filename)[stat.ST_MTIME] > time_limit:

# It is important to strip "filename" by the strlen - this makes sure we
# grab the directory name of the file as well.  If we just used "file",
# then we wouldn't grab the directory.  That would be bad.
				newfiles.append(filename[strlen:])
	return newfiles
#####################################

if __name__ == '__main__':

	webdir = "/home/mikeh/public_html"
	bad_files = ("web.tar.gz","dan_o.dat")
	days = 2
	tar_command = "tar cvzf web.tar.gz"

	compress_web(tar_command,days,webdir,bad_files)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5AKFuaP33v4T41CURAkLwAKCmZEptU0rtPt05dT1qKhM25qDJSQCgi9ms
naDnMjhIo3Op0e4JAzKgw8w=
=qj24
-----END PGP SIGNATURE-----

From tim_one at email.msn.com  Sat Apr  1 23:20:03 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Sat, 1 Apr 2000 23:20:03 -0500
Subject: Why should I switch to Python?
In-Reply-To: 
Message-ID: <000701bf9c5a$b806b420$752d153f@tim>

[Tim]
> There aren't a lot of bilingual P programmers out there ...

[Moshe Zadka]
> I wonder what made you say that?

Why, measurement, of course!

> Actually, I know quite a few bi-lingual P'ers (my ex-girlfriend, her
> ex-boyfriend, and her current boyfriend.  Shows you what kind of crowd
> I mix in) and no highly-proficienct one-P programmers (sure, some Perl
> dabblers, but nothing serious).

See -- that's just anecdotal.  When in doubt, there's no substitute for
exhaustive enumeration.

> So from my prespective, most people know both P languages.

While from mine, people are fascinated by floating-point endcases, think
"Twin Peaks" is the greatest television show of all time, believe "Alien" is
the greatest horror movie all time, "Aliens" the greatest monster movie of
all time, and that the world would be a much better place if professional
wrestling were taught at the JFK School of Government instead of diplomacy.

no-arguments-about-the-rest-ly y'rs  - tim





From tiddlerdeja at my-deja.com  Thu Apr 27 13:52:35 2000
From: tiddlerdeja at my-deja.com (tiddlerdeja at my-deja.com)
Date: Thu, 27 Apr 2000 17:52:35 GMT
Subject: web site test framework? in python?
Message-ID: <8e9uor$eaa$1@nnrp1.deja.com>

I'm looking to build a test framework to use for websites that I may
build.

I'm looking for more than broken link checks. I'd like to post form
submissions to pages and check for correct/desired results to be
returned.

I know I could write specific scripts for each site, but I'd like a
generic solution. I was wondering if anyone else had been down this
path.

I was thinking about solutions along the lines of...

I was thinking of having JSP or ASP pages check for a testing variable
(registry or environment). If pages were called in test mode they would
return XML to be parsed which would can then be used as input data to
call the page again (this way you could store the test data with the
page you are testing). The XML would also contain the desired correct
data to check against to ensure the page is working correctly.

You could then have a script crawling a site, calling a page once to
get the test case, and calling it again to see if it has worked
correctly.

There are problems with this solution in that you can have dependencies
on pages. I.e. one page must be called before another if it is to work
correctly.

I'd also like to code the testing framework in Python.

Again, has anyone any experience in this testing websites arena?

Perhaps I'm trying to reinvent the wheel?

Any info greatly appreciated.


Sent via Deja.com http://www.deja.com/
Before you buy.


From scarblac-spamtrap at pino.selwerd.nl  Sun Apr 16 13:50:53 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 16 Apr 2000 17:50:53 GMT
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8dbdj3$dgt$1@slb2.atl.mindspring.net> <8dcpom$fbc$1@slb3.atl.mindspring.net>
Message-ID: 

Andrew Dalke wrote in comp.lang.python:
> Aahz Maruch wrote:
> >def expression_if( test, true, false ):
> >  if test: return true
> >  else: return false
> >
> >x = expression_if( a is not None,
> >   a[i].weeble, 0) + expression_if( b is not None, b[i].wombat, 0)
> 
> 
> Suppose a is None.  The a[i].weeble will give an exception.

Pass functions?

def exp_if(test, true, false):
  if test: return true()
  else: return false()
  
x = exp_if(a is not None, lambda a=a,i=i: a[i].weeble, lambda: 0)

Getting silly, though :)

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
  8:46pm  up 41 days,  8:07,  6 users,  load average: 1.19, 1.08, 1.07


From gherman at darwin.in-berlin.de  Tue Apr 18 06:33:21 2000
From: gherman at darwin.in-berlin.de (Dinu C. Gherman)
Date: Tue, 18 Apr 2000 12:33:21 +0200
Subject: Starship dead (again)?!
Message-ID: <38FC39F1.21DD2D75@darwin.in-berlin.de>

I can't get anything from http://starship.python.net or
http://starship.python.net:8080 for more than a day, now.
Is that some known problem?

This seems to happen ever more frequently. Does somebody
simply pull the plug, or is there another, better, reason?

Regards,

Dinu

-- 
Dinu C. Gherman
................................................................
"The thing about Linux or open software in general is that 
it actually tries to move software from being witchcraft to 
being a science," [...] "A lot of the programs you see today 
are actually put together by shamans, and you just take it and 
if the computer crashes you walk around it three times... and 
maybe it's OK." (Linus Thorvalds, LinuxWorld 2000, NYC)


From paul.magwene at yale.edu  Thu Apr 27 09:55:59 2000
From: paul.magwene at yale.edu (Paul Magwene)
Date: Thu, 27 Apr 2000 09:55:59 -0400
Subject: Concatening string and integer
References: <8e9gco$jlt$1@vg170.it.volvo.se>
Message-ID: <390846EF.79A67E02@yale.edu>

JJ wrote:
> 
> Hi!
> 
> I want to concatenate a string containing both strings and integers like:
> 
> strTemp = 'I make test number: ' + iMyNumber + ' once again'
> 
> It doesn't work, how should I do this?
> 
> BR
> Joacim


Use the str() function (one of the builtins), like so:

strTemp = "I make a test number: " + str(iMyNumber) + " once again"


--Paul


From z3penguin at penguinpowered.com  Sun Apr 23 19:43:19 2000
From: z3penguin at penguinpowered.com (Z 3 Penguin)
Date: Sun, 23 Apr 2000 19:43:19 -0400
Subject: Posting CGI
References: <8dv4j8$2bs$1@bob.news.rcn.net> 
Message-ID: <8e0234$rs9$1@bob.news.rcn.net>

F-
Got it, thanks
-Z




From mfletch at tpresence.com  Mon Apr  3 15:20:43 2000
From: mfletch at tpresence.com (Mike Fletcher)
Date: Mon, 3 Apr 2000 15:20:43 -0400 
Subject: Creating variables on the fly...
Message-ID: 

Here's a few ways...  Note the *args construct... also note that you could
use **namedargs to indicate arguments which are passed explicitly by name.
*args gets a tuple of values in the order passed, **namedargs would get a
dictionary mapping name:value.

PythonWin 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Portions Copyright 1994-1999 Mark Hammond (MHammond at skippinet.com.au)
>>> def add( *args ):
... 	return reduce( lambda x,y: x+y, args )
... 
>>> add( 2,3,4,5,6,7)
27
>>> import operator
>>> def add2( *args ):
... 	return reduce( operator.add, args )
... 
>>> add2( 2,3,4,5,6,7)
27
>>> import Numeric
>>> Numeric.sum( (2,3,4,5,6) )
20
>>> 

HTH,
Mike



From mwh21 at cam.ac.uk  Tue Apr 18 12:03:51 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 18 Apr 2000 17:03:51 +0100
Subject: Integer solutions to linear equation?
References: 
Message-ID: 

grant at nowhere. (Grant Edwards) writes:

> This isn't really a Python question, but my example is in
> Python, and there seem to be plenty of people who know a fair
> bit of math here....

I hope I count ...

> A friend of mine ran across a brain-teaser involving a bunch of
> flowers, some magic bowls and some other camoflage text.  What
> you end up with is having to solve the equation
> 
>      64x = 41y + 1
>      
> Where x and y are both integers.  After scratching our heads
> for a while, we used the brute force approach:
> 
> for x in range(1,100):
>     y = ((64*x)-1)/41
>     if 64*x == 41*y+1:
>         print (x,y)
>                 
> The results:
> 
>   (25, 39)
>   (66, 103)
> 
> 25 was the expected solution, so we got both the equation and
> the Python snippet correct.  Is there a non-iterative way to
> solve a linear equation when the results are contrained to be
> integers?  I don't remember anything from any of my math
> classes that seems relevent, but I didn't take any anything
> beyond what is required for all undergrad engineers.

Use Euclid's algorithm; here's some code that does that:

def find_hcf_as_lc(x0,y0):
    """ return h,q,r st h==q*x0+r*y0 """
    x=abs(x0); y=abs(y0)
    qn1=rn=1
    rn1=qn=0
    while y:
        (q,y),x=divmod(x,y),y
        qn,qn1=qn1-q*qn,qn
        rn,rn1=rn1-q*rn,rn
    if x0<0: qn1=-qn1
    if y0<0: rn1=-rn1
    return x,qn1,rn1

def solve(m,n,a):
    """ solve(m,n,a:Integer) -> (Integer,Integer)

find integers (x,y,r,s) such that (m+u*r)*x+(n+u*s)*y==a 
for all integers u."""
    h,x,y = find_hcf_as_lc(m,n)
    if a%h <> 0:
        raise "no solution"
    else:
        return (x*a/h,y*a/h,n/h,-m/h)

Then:

>>> solve(64,-41,1)
(-16, -25, -41, -64)

And your solution is:

(-16 - -41)*64 + (-25 - -64)*-41

I feel I must have neater code knocking about somewhere to do this,
but I can't find it right now.

Cheers,
M.

-- 
  it's not that perl programmers are idiots, it's that the language
  rewards idiotic behavior in a  way that no other language or tool 
  has ever done                        -- Erik Naggum, comp.lang.lisp


From bjorn at roguewave.com  Sat Apr  1 22:06:17 2000
From: bjorn at roguewave.com (Bjorn Pettersen)
Date: Sat, 01 Apr 2000 20:06:17 -0700
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com>  <38E58D2D.384F1546@Lugoj.Com> 
Message-ID: <38E6B929.28816494@roguewave.com>

Fredrik Lundh wrote:
> 
> James Logajan  wrote:
> > Also, how good are you at math? You seem to feel that 5 minutes of "Guido
> > the god's" time is of much more value than that of 1000 knuckle-dragging
> > Neanderthal programmers like myself spending a mere 10 minutes each to
> make
> > sure their code doesn't break. Of course, if we happen to take more than
> 10
> > minutes its our own damn fault I'm sure you'll agree.
> 
> the strange thing here is that there are changes listed on
> that page that are far more difficult to spot and fix, but for
> some reason, neither you or bjorn seem to care.

Surely you jest.  The crux of the matter here though, is that a
documented interface is being changed in backwards incompatible ways (I
haven't seen anyone claim that examples in the manual are not
documentation...)  Since there is almost no chance of changing Guido's
mind, it would just be futile to argue about e.g. multiargument append
where the manual says one thing and the implementation does another
(besides I was lucky enough not to get bit by that -- probably because I
read the manual...)

> instead, bjorn announced that he'd never upgrade to 1.6
> based on a single change in 1.6a1, despite the fact that
> there will be a 1.6a2, a3, b1, b2, rc1, etc. before it's time
> to really make that decision.

Well, to be correct, I said that this change in documented behavior
would force me to put upgrade plans on hold.  If this change remains, I
would still have to make the same decision no matter how many alpha and
beta releases we have in the next two months.

> others have politely asked for backwards compatibility on
> this one (which would mean *adding* extra code to handle
> multiple calling syntaxes).  someone will probably come up
> with a patch well before the next alpha, but probably not
> because you guys are flaming away on this newsgroup.

It would be very nice if "someone" could do that, but based on the
rethoric I've seen from you on this issue, and the absence of comment
from Guido, I certainly don't feel confident that it would be accepted. 
As far as flamage is going, you should probably go back and read through
your own posts one more time.  You might even want to read through some
of your other posts, if I remember correctly you were quite hefty in
your flamage of the poor JPython newbie from Volvo.

-b



From effbot at telia.com  Mon Apr 24 12:35:05 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Mon, 24 Apr 2000 16:35:05 GMT
Subject: ftplib sendcmd
References: <3904722D.12EE9927@bam.com>
Message-ID: 

Bill Scherer  wrote:
> I'm having trouble with ftplib's sendcmd method (Python 1.5.2 on RH
> linux 6.1):
>
> >>> ftp = ftplib.FTP(host, user, password)
> >>> ftp.sendcmd('umask 002')
> Traceback (innermost last):
>   File "", line 1, in ?
>   File "/usr/local/lib/python1.5/ftplib.py", line 228, in sendcmd
>     return self.getresp()
>   File "/usr/local/lib/python1.5/ftplib.py", line 201, in getresp
>     raise error_perm, resp
> ftplib.error_perm: 500 'UMASK 002': command not understood.
> >>>
>
> The umask command does, of course, work using a standard ftp client to
> the same host.
>
> Other commands, chmod, etc, suffer equal fate.
>
> Is this not what sendcmd is for? What am I doing wrong?  Thanks!

sendcmd is used to send FTP protocol commands, which
is not the same as the commands you type into your ftp
client...

to see what your client sends, try running the client in
debug mode (-d on my box.  ymmv).  or you can look it
up in the FTP specification (RFC 959).

(iirc, there is no umask command in the standard FTP
protocol, but I might be wrong...)






From effbot at telia.com  Tue Apr  4 15:15:15 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Tue, 04 Apr 2000 19:15:15 GMT
Subject: Python 1.6 alpha 1 released
References:  <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <8cca93$9oh$1@nnrp1.deja.com>  
Message-ID: <7brG4.5071$74.82114@newsc.telia.net>

Bjorn Pettersen  wrote:
> Your definition of broken seems very peculiar.  Correct me if I'm wrong,
> but it seems to go something like:

I've explained all this to you already.  lousy newsfeed? :-)

>   - you don't know if examples are binding documentation
>   - pair in the description of connect _must_ mean tuple
>     and _not_ a pair of arguments because ???

I've explained that in another post -- the library reference use
a special syntax for optional arguments.  the description of the
connect method doesn't use that syntax.  other method
descriptions do (this includes descriptions on the same page).

besides, "pair" is used quite extensively in the library reference,
usually with exactly the same meaning as here: a 2-tuple.  see,
for example, the description of "socket.error", "accept", and
"recvfrom".

>     (I would have thought it would have said tuple if it meant
>     tuple -- tuples being Python concept as opposed to pairs)

I've explained that in another post -- it tells you that the
address format is (host, port) -- which is perfectly valid tuple
syntax.

but alright, let's change "pair" to "2-tuple" everywhere.  will
fixing this make you accept the change?

>   - the example in question is broken because, even though
>     it works, and seems to follow the description from the
>     previous page, ...

I've explained that in another post -- it worked because the
connect implementation didn't handle its argument properly,
not because it was designed that way.  it stopped working
when Guido fixed the argument handling bug.

and yes, this is exactly the same reason why append, insert,
etc. did work in 1.5.2, and why they don't work in 1.6.

yet, you think there is a difference.

>   - ... other examples have been broken in the past...

I've explained that in another post -- broken examples are
obviously not formally binding.  You replied that broken
examples should be fixed.  Of course it should.  So should
all broken demo code and the broken examples, just like
all code that uses "append" etc must be fixed.

but will fixing this make you accept the change?

>
> I must say I'm confused...

yes, I think you're confused.

you would probably be less confused if you read my replies
to your own posts...

> The good news is that Guido realized how much code this would break, and
> will fix the code.

yeah, and he'll probably break it again in 1.7.

just like he'll break append and a few other things in 1.6,
and just like he broke stuff in 1.5.  and in 1.4.  etc.

you can keep on arguing until the end of c.l.py, but there's
nothing special about "connect".  except, maybe, that you
*know* that you're affected by this change, and you think
you're not affected by any of the others.

if so, that's not only a very egocentric view, it's also rather
naive.

(no, don't reply.  just read my other posts in this thread. or
if you think I don't have a clue, don't.  I don't really care)






From sverker.is at home.se  Sun Apr  2 20:05:38 2000
From: sverker.is at home.se (Sverker Nilsson)
Date: Mon, 03 Apr 2000 02:05:38 +0200
Subject: popen2 5-7 times faster (Was: Re: popen2 made >7 times faster!)
References: <38E7CEA5.4CECEE0D@home.se>
Message-ID: <38E7E051.637AC894@home.se>

Sverker Nilsson (me)wrote:
[snip]
> The time to call out 100 times to a hello world program dropped from
> 15 seconds to 2 seconds (*). 

To clarify, this was by removing some other stuff in popen2 that wasnt
needed for the simple hello world. With all that stuff in the time
became closer to 3 seconds after the fix. I think it should be
possible to get down to 2 seconds though by rewriting the rest of the
code for popen2 in C.

> The time for 100 calls to the actual
> program I wanted to run (PGP) dropped from 18 seconds to 6 seconds.

That is, 3 seconds more than the comparable hello world.

S.


From donn at oz.net  Fri Apr 14 00:01:16 2000
From: donn at oz.net (Donn Cave)
Date: 14 Apr 2000 04:01:16 GMT
Subject: 1st non-trivial program - gentle criticism requested
References:  <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> <8d4tgu$11qa$1@nntp6.u.washington.edu> <38F6193A.66284778@gte.com>
Message-ID: <8d656c$282$0@216.39.151.169>

Quoth "Fredrik Lundh" :
| Gary D. Duzan  wrote:
|> This potential stumbling block makes me wonder if allowing the
|> singleton case was really wise.
|
| stumbling block?
|
| what kind of programmer changes his code without thinking,
| reading what he just typed, or running the resulting program?
|
| if you want to optimize python for that kind of programmer,
| you have to change a whole lot more than the string formatting
| operator...

That sounds like me, if I understand you right.  I'm not sure
how ``reading what he just typed'' would save anyone here, but
``without thinking'' certainly seems to describe some of my work,
and ``running the resulting program'' is a frequently omitted
step if we require that the particular code in question must execute.

I don't have any suggestions for solving my problems, just wanted
to volunteer as an example of that kind of programmer.  I believe
I'm exceptional, though.

	Donn Cave, donn at u.washington.edu


From effbot at telia.com  Sun Apr  2 18:39:53 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Sun, 02 Apr 2000 22:39:53 GMT
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com>  <38E58D2D.384F1546@Lugoj.Com>  <38E6B929.28816494@roguewave.com>  <38E7BAC4.3B7AD0FF@uswest.net>
Message-ID: 

Bjorn Pettersen  wrote:
> > in earlier releases of the library reference, some examples
> > didn't even work.  you still think they're formally binding?
>
> Are you saying none of the examples are binding, formally or otherwise?

I have no idea -- I'm just pointing out that the library reference
has contained broken examples.  the problems I've reported have
all been fixed, but I haven't looked at all example...

> (Even in the C++ standard where examples are _explicitly_ not normative,
> they're usually fixed if conflicting with normative text.)

oh, I'm sure this will be fixed in the 1.6 documentation, in one way
or another.  currently, the example do conflict with the "normative"
text -- the method description talks about one argument:

    connect(address)

the address field is defined (in an earlier section) as either a string
or a (host, port) pair, depending on the protocol.

now, "pair" isn't formally defined ("tuple" would have been clearer),
but if you look at methods that are designed to take optional args,
you'll find that the library reference always spells that out.  as an
example, look at getsockopt a bit further down the page:

    getsockopt(level, optname[, buflen])

so in other words, either this change remains, and the example
should be fixed.  or someone adds backwards compatibility to the
socket module, in which case the method description should be
fixed:

    connect(address[, port])

/.../ If a port number is present, the first argument should be a
string containing the host name.  This is equivalent... /.../

> Your other arguments for a patch are good, but seems to reinforce the
feeling
> that changing this behavior was ill though out in the first place.

does it?  I didn't come to that conclusion for "connect" (still not
sure about "append", but that's another story).

and more importantly, I'm pretty sure the powers that be went
through the same list, decided that this is a real bug, and that
it would be far cheaper to fix this now, than at a time when
Python has twice as many users (and implementations...).

so what did we miss?

> (and remember that not all companies have enough Python expertise that a
> traceback leads to a fix ten minutes later)

well, if this is a mission critical system, you should use a staging
server, right?

if breaking the scripts would just cause a minor annoyance, most
organizations I've worked with can deal with a release note con-
taining something like:

    "if you stumble upon problems, let us know, and we'll
    fix it as soon as possible.  if you really need the old
    version, just type 'python1.5' instead of 'python'"

or you can do it the other way around:

    "we've installed a new version of the core environment.
    you can help us test this out by typing 'python1.6' instead
    of 'python'.  if we don't hear anything by the end of next
    week, we'll change the default environment"

if you don't expose the interpreter to the users, you can
rename the scripts ("just append -old"), provide an alternate
setup file, or whatever.  nothing new here.






From effbot at telia.com  Sat Apr  1 09:23:25 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Sat, 01 Apr 2000 14:23:25 GMT
Subject: new method for string objects
References: <8c44e8$5hj$1@slb6.atl.mindspring.net>
Message-ID: 

Andrew Dalke  wrote:
>   I know with 1.6 strings will have methods.  If it isn't
> already there, I would like to propose an additional method,
> "tostring()", which returns itself.
>
>   I'm working on a project which may use array.array of
> characters, Numeric.array, or a string, and I would like
> to have a way that's guaranteed to return the string
> value for the object.

assuming that "string value" means the "raw contents of the
sequence object", you should use a buffer objects instead.
you can use the 'buffer' builtin to turn most sequence objects
into buffers:

>>> s = u"123"
>>> b = buffer(s)
>>> b

>>> len(b)
6
>>> b[0]
'1'
>>> str(b)
'1\0002\0003\000'
>>> fp.write(b) # writes raw contents to file without extra copy

(if numeric python doesn't support the buffer interface,
it should be fixed).






From echuck at mindspring.com  Thu Apr 20 08:20:59 2000
From: echuck at mindspring.com (Chuck Esterbrook)
Date: Thu, 20 Apr 2000 08:20:59 -0400
Subject: [ANNOUNCE] Webware for Python 0.1
References: <5650A1190E4FD111BC7E0000F8034D26A0F40D@huina.oceanic.com>
Message-ID: <38FEF62B.2A4402CD@mindspring.com>

Thanks for the quick report. I did some testing before the announcement, but apparently
not enough. I quickly fixed the problem last night and according to my log there have
been no exceptions since I went to bed, despite dozens of visits and downloads. 

-Chuck 


Doug Stanfield wrote:
> 
> The following intrigues me but its not probably the best endorsement.  When
> I hit your published link I get:
> 
> ERROR
> 
> Traceback (innermost last):
>   File "MainPage.py", line 55, in main
>     _main()
>   File "MainPage.py", line 49, in _main
>     inc_counter()
>   File "MainPage.py", line 23, in inc_counter
>     f.write(repr(counter+1))
> NameError: counter
> 
> But I guess you're at V0.1 so proving the error reporting works is a good
> thing. :-)
> 
> This was from a redirect to http://writewithme.com/Webware/ by the way, so
> maybe therin lies the problem.  I am still interested in looking at the
> package.
> 
> -Doug-


From alwagner at tcac.net  Wed Apr 26 23:00:34 2000
From: alwagner at tcac.net (Albert Wagner)
Date: Wed, 26 Apr 2000 22:00:34 -0500
Subject: The Simple Economics of Open Source
References:  <390534BB.3D6CEBDF@libc.org> 
Message-ID: <3907AD52.FC0630FD@tcac.net>

Raffael Cavallaro wrote:
> 

> I think that many open source advocates have
> failed to apply simple logic to the economics of open source, believing
> that somehow, the internet, or software, is immune from simple laws of
> supply and demand. They are not.
> 
I am going to have to go back and reread all of your previous posts. 
You seem to be rebutting a point that was never made.  Of course, Open
Source software is not immune to the laws of supply and demand.  Who
said it was?  It is in response to those laws that it is free.  But free
only in the world of economics where dollar worth is all that matters.
It is this very world, where the only motivation taken into account is
money profit, that Open Source has escaped.  And the escape has been
dazzling.  
---
"But beware!  The time for all this is not yet.  For a least another
hundred years we must pretend that fair is foul and foul is fair;  for
foul is useful and fair is not.  Avarice and usury and precaution must
be our gods for a little longer still.  For only they can lead us out of
the tunnel of economic necessity into daylight."
-- Lord Keynes, 1930


From dworkin at ccs.neu.edu  Sat Apr 22 21:45:47 2000
From: dworkin at ccs.neu.edu (Justin Sheehy)
Date: 22 Apr 2000 21:45:47 -0400
Subject: Overloading the = operator?
In-Reply-To: Jerome Chan's message of "Sun, 23 Apr 2000 00:14:02 GMT"
References: 
Message-ID: 

Jerome Chan  writes:

> Is this possible?

> x = base([1,2])
> y = another([2,4,3])
> 
> z = other([])
> 
> z = x + y
> z.work()
> 
> where z now contains x.list + y.list???

Nope.  `=' rebinds the name on the left hand side, and never even
looks to see what that name was previously bound to.  

-Justin

 





From dalke at acm.org  Sun Apr 16 06:17:22 2000
From: dalke at acm.org (Andrew Dalke)
Date: Sun, 16 Apr 2000 04:17:22 -0600
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8dbdj3$dgt$1@slb2.atl.mindspring.net>
Message-ID: <8dcpom$fbc$1@slb3.atl.mindspring.net>

Aahz Maruch wrote:
>def expression_if( test, true, false ):
>  if test: return true
>  else: return false
>
>x = expression_if( a is not None,
>   a[i].weeble, 0) + expression_if( b is not None, b[i].wombat, 0)


Suppose a is None.  The a[i].weeble will give an exception.

You can imagine:

def expression_if(test, true_string, false_string):
  # some nasty code to get the locals of the calling function
  if test:
    return eval(true_string with the given locals)
  else:
    return eval(false_string with the given locals

x = expression_if(a is not None, "a[i].weeble", "0") + ...

but that's just too ugly.

                    Andrew
                    dalke at acm.org





From mwh21 at cam.ac.uk  Wed Apr  5 04:25:20 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 05 Apr 2000 09:25:20 +0100
Subject: Starving for an Advanced Python Book
References: <20000405045855.26682.qmail@web2101.mail.yahoo.com>
Message-ID: 

lewst  writes:

> This is off-topic, but what is with this funky way
> of signing articles?  I've now seen many people do 
> this on the Python list but am not quite getting it.

It's all Tim Peters' fault.

The first example of its use is preserved for future generations in
the Python quotations file:

  http://starship.python.net/crew/amk/quotations/python-quotes.html

which you should read anyway, it's a fine advert for this newsgroup.

Cheers,
M.

-- 
well, take it from an old hand: the only reason it would be easier
to program in C is that you can't easily express complex  problems
in C, so you don't.                 -- Erik Naggum, comp.lang.lisp


From moshez at math.huji.ac.il  Sat Apr 15 01:42:48 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Sat, 15 Apr 2000 07:42:48 +0200 (IST)
Subject: Scripting and Gnome and KDE
In-Reply-To: <7t0ffs8ncrrh3irgc52rbsb68ue48rfovf@4ax.com>
Message-ID: 

On Fri, 14 Apr 2000, Alex Thomas wrote:

> This might seem an odd way to choose a GUI, but if you had the choice
> between scripting Gnome/Gtk or KDE/Qt-based components using Python, which
> would you go for? 

Personally I chose Gtk+/GNOME, since (among other things), the Gtk+ type
system is specifically targetted to support bindings to other languages.

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From mhammond at skippinet.com.au  Tue Apr  4 20:02:45 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Wed, 05 Apr 2000 00:02:45 GMT
Subject: Passing array of doubles to COM object?
References: 
Message-ID: 

This definately _should_ work.  VB _may_ pass it as an array of
byref doubles tho?

Can you run makepy over the object?  If so, it definately should
work from there.

In the meantime, I will add arrays of doubles to the COM test
suite (specifically, to the VB test interfaces)

Mark.

"Martin Keefe"  wrote in message
news:memo.20000404125544.208A at martink.compulink.co.uk...
>
> I am trying to use an Automation server that has the following
method (among
> others):
>
>   VARIANT_BOOL LoadFeature(
>                             BSTR code,
>                             BSTR label,
>                             long size,
>                             VARIANT xArray,
>                             VARIANT yArray);
>
> Its documentation assumes that the client will be written in VB
and says that
> xArray and yArray are arrays of Doubles. And true enough,
passing arrays of
> Doubles from VB works fine.
>
> In Python, after creating the object with:
>
>  mx = win32com.client.Dispatch("Maplex.Application")
>
> I've tried the following:
>
>  xa = [100000.0, 600000.0, 600000.0, 100000.0]
>  ya = [100000.0, 100000.0, 900000.0, 900000.0]
>  mx.LoadFeature( 'AREA', 'Simple', 4, xa, ya )
>
> and:
>
>  xa = buffer( array('d',[100000.0, 600000.0, 600000.0,
100000.0]) )
>  ya = buffer( array('d',[100000.0, 100000.0, 900000.0,
900000.0]) )
>  mx.LoadFeature( 'AREA', 'Simple', 4, xa, ya )
>
> without success. Both ran without errors or exceptions but the
data didn't
> appear to get to the server intact. I've tried both dynamic and
static dispatch
> with the same results. Can anybody shed some light on this
please?
>
> The system is NT4 Server SP3, Python 1.5.2, win32all-128.
Thanks,
>
>   ]\/[artin Keefe ][ Dorking,Surrey,UK ][ martink at cix.co.uk
>




From pinard at iro.umontreal.ca  Mon Apr  3 14:28:08 2000
From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=)
Date: 03 Apr 2000 14:28:08 -0400
Subject: Unicode program representation
In-Reply-To: "Fredrik Lundh"'s message of "Mon, 03 Apr 2000 16:11:39 GMT"
References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> <3xXF4.1060$n68.186533888@newsb.telia.net> <001201bf9d62$3e1ac1c0$36dd3fcb@neil> <%o3G4.1111$n68.191610880@newsb.telia.net>
Message-ID: 

"Fredrik Lundh"  writes:

> hmm.  wouldn't that mean that we end up using different encodings in
> different parts of the script?  feels a little scary, to say the least...

This is very likely to happen, but this should not be seen as scary.

Modules handling linguistic or cultural matters might come from various
sources, which sources do not necessarily use the same encodings, but yet
be used simultaneously in a program building on them all.  It is fairly
evident to me that editing strings on a screen, while seeing them nicely
displayed, far overweight the little advantages of limiting sources to
7 bits.  It is nice that Python offers a 7-bits common denominator.  Yet,
making a rule of 7-bits, or just abusing of it, might be counter-productive.

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard





From akuchlin at mems-exchange.org  Wed Apr  5 10:12:47 2000
From: akuchlin at mems-exchange.org (Andrew M. Kuchling)
Date: 05 Apr 2000 10:12:47 -0400
Subject: Q: Status of SOAP (Simple Object Access Protocol)?
References: <38EA7EBD.BE75C460@gmx.de>
Message-ID: <3d66tw1vs0.fsf@amarok.cnri.reston.va.us>

Michael Scharf  writes:
> I am wondering, what the current python-SOAP status is?
> (about SOAP http://www.develop.com/soap/)

Ken McLeod announced a minimal implementation last week; it might be
downloadable from http://casbah.org/Scarab/ by now, or you can get it
through anonymous CVS: http://casbah.org/cgi-bin/cvsweb.cgi/Scarab/python/

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
Tourist, Rincewind decided, meant "idiot".
  -- Terry Pratchett, _The Colour of Magic_



From kc5tja at garnet.armored.net  Wed Apr 26 07:57:30 2000
From: kc5tja at garnet.armored.net (Samuel A. Falvo II)
Date: 26 Apr 2000 11:57:30 GMT
Subject: 
References: <8e4cc2$d5t@netnews.hinet.net>  
Message-ID: 

In article , Andy Lester
wrote:

>> The official language of usenet newsgroups is English,
>
>Oh?  And where's THAT defined?

If memory serves me correctly, I believe that it is a *recommendation* (not
necessarily a strict standard) that English be the `official' language of
Usenet newsgroups, in the RFCs.  I recall seeing a statement to the effect
of (paraphrased), "Newsgroups which are not in English should append their
two-character ISO country identifier to the newsgroup name." Thus, the
French-speaking comp.lang.python would appear as comp.lang.python.fr;
likewise, an Italian alt.rec.radio.amateur would be formed as
alt.rec.radio.amateur.it.

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA


From kelley at bioreason.com  Tue Apr  4 10:40:33 2000
From: kelley at bioreason.com (Brian Kelley)
Date: Tue, 04 Apr 2000 15:40:33 +0100
Subject: blessed be Guido, for "5 <= X <= 10" does what it should...
References: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca>
Message-ID: <38E9FEE1.B7DB83A7@bioreason.com>

> Here's a Hack for the Mighty Pythonista to consider: Can you construct a
> program that you can call like this:
>
>     test_transitive( 0,100, '<=', 5 ) # generate a<=b<=c<=d<=e for range
> 0..100
>

A fun one here's the short version( it doesn't use the 5 limit):

import string
def test_transitive(start, end, compareString):
  return eval( string.join( map(str, range(start,end)), compareString ) )

A little obtuse, eh?

range(0,5) == [0,1,2,3,4]
map(str, range(0,5)) == ['0', '1', '2', '3', '4']
string.join(map(str,range(0,5)), ">") == "0>1>2>3>4"
eval(string.join(map(str,range(0,5)), ">")) == 1

I like python...

>
> Anyways, blessed be Guido, for near as I can figure it, he hath got it
> right! :-)
>
> Warren

--
Brian Kelley          (505) 982-7884 ext 207
Bioreason, Inc        kelley at bioreason.com
105 Washington #303, Santa Fe NM, 87501




From quinn at lira.ugcs.caltech.edu  Tue Apr 25 13:40:59 2000
From: quinn at lira.ugcs.caltech.edu (Quinn Dunkan)
Date: 25 Apr 2000 17:40:59 GMT
Subject: Don't understand error message
References: 
Message-ID: 

On Tue, 25 Apr 2000 17:21:21 GMT, Lars Lundstedt 
wrote:
>I'm halfway through "Learning Python" and I'm stuck on the example on page
>255.
>
>It goes like this:
>
>import sys, glob, operator
>print sys.argv[1:]
>sys.argv = reduce(operator.add, map(glob.glob, sys.argv))
>print sys.argv[1:]
>
>When called with "python glob.py *.py" on Win98 I'm supposed to get a list
>of all .py files in the current directory but instead I get:
>
>Traceback (innermost last):
>  File "glob.py", line 1, in ?
>    import sys, glob, operator
>  File "glob.py", line 3, in ?
>    list = reduce(operator.add, map(glob.glob, '*.py'))
>TypeError: call of non-function (type module)
>
>Anyone know why?

Eh, this is a cute one.  You named your module glob.py, so when you import
glob, it imports itself, not the glob.py from the stdlib.  So glob.glob *is* a
module: itself (so is glob.glob.glob.glob.glob.glob...).  Try renaming your
module :)


From effbot at telia.com  Sat Apr  1 14:02:04 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Sat, 01 Apr 2000 19:02:04 GMT
Subject: Why should I switch to Python?
References: <00033120055300.03687@quadra.teleo.net> 
Message-ID: 

Aaron Turner wrote:
> Honestly the more I reasearch, the more it seems that it's purely
> a matter of taste.

exactly.

> If you like Perl, there's nothing inherient about Python that makes
> it better.

works both ways, you know...

> Basically if you know both languages, and were planning a mid-sized
> project, why would you choose Python?  It's hard to take my friend
> seriously in his evaluation when he says he'd rather do this project
> in C++  than in Perl (especially when he doesn't know Perl).

well, I know several highly experienced C++ programmers who've
tried to learn Perl, and failed (quoting them would be trolling, so I
won't do that here :-).

haven't heard any such stories about Python.

so assuming that you're be doing this as a team effort, and that
the team's overall throughput matters, maybe you should respect
his opinion, and see if *you* can adapt to Python's way of doing
things?






From tom__98 at my-deja.com  Wed Apr 12 18:36:14 2000
From: tom__98 at my-deja.com (tom__98 at my-deja.com)
Date: Wed, 12 Apr 2000 22:36:14 GMT
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <87og7fopvs.fsf@ifm.uni-kiel.de>
Message-ID: <8d2tot$k9s$1@nnrp1.deja.com>

In article <87og7fopvs.fsf at ifm.uni-kiel.de>,
  Janko Hauser  wrote:
> Use docindex.py!
>
> This module is definetly no substitute for perldoc but a start that
> answers your question. It gets the relevant information from the html
> tree which needs to be installed on your system.

Thanks, that's very helpful.  I'd suggest bundling something like
this with the distribution and making sure that it gets installed
(together with the documentation) by default.

I think it's really important for people to have
a simple, well-known way of getting to documentation no matter
where they are using Python or where it is installed.

> A benefit over docstrings is, that one does not need to import a
> module. This is a prototype, but shows that it is possible. Not that
> this will change your mind about Python :-)

Well, I don't think my mind needs to be changed about Python; I
have been using it since 1996 and already like the language.

Tom.


Sent via Deja.com http://www.deja.com/
Before you buy.


From tim_one at email.msn.com  Sun Apr 23 23:29:52 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Sun, 23 Apr 2000 23:29:52 -0400
Subject: 'database' search
In-Reply-To: <39036340.BE82BEAD@roguewave.com>
Message-ID: <000001bfad9d$5a129060$4a2d153f@tim>

[Bjorn Pettersen, wants to do word completion]
> ...
> The smallest datastructure I've found so far, is a 'prefix dictionary',
> so if e.g. "aardwark" was in the database, the 'prefix dictionary' would
> contain:
>
>  pfdict = {
>   'a':        ['aardwark', ...],
>   'aa':       ['aardwark', ...],
>   'aar':      ['aardwark'],
>   'aard':     ['aardwark'],
>   'aardw':    ['aardwark'],
>   'aardwa':   ['aardwark'],
>   'aardwar':  ['aardwark'],
>   'aardwark': ['aardwark']
>  }
>
> The maximum size for this would be n * avg len of item, with the real
> size being much(?) smaller with sufficient prefix sharing...

Before going nuts with variations on prefix trees, try the attached.  This
uses a sorted list of all words, and does a binary search to find the ones
starting with a given prefix -- dirt simple.  The advantage to that is that
it works .

BTW, the amount of compression you can get from a tree (or trie) approach
depends on the language and the set of words, but when coding in Python
you're almost certainly going to consume more storage with all the
supporting hair (ancillary dicts and lists) than you'll save by sharing a
few initial bytes in the words.  Trees are used for speed reasons instead,
in intense searching applications (which yours is not).

> I have a relatively stable database of between 1500 and 5000 items

So even if they average 10 letters/item, this won't consume more than 50Kb.

> new insertions are probably going to be less than 100 during the
> lifetime of the database)

In 1.5.2 and 1.6, appending a new word to a sorted list and then sorting
again takes time linear in the # of words -- it's recognized as a special
case (of another special case ), and doesn't do a full sort.  So the
method below is more efficient than you might think.

when-your-database-grows-100x-larger-ask-again-ly y'rs  - tim


from bisect import bisect

class Completer:
    def __init__(self, wordlist):
        """wordlist -> a Completer for the list of words."""
        wordlist.sort()
        self.words = wordlist

    def complete(self, prefix):
        """prefix -> alphabetical list of all words starting w/ prefix."""
        words = self.words
        # Find i, j s.t. all in words[i:j] start w/ prefix.
        i = bisect(words, prefix)
        # Subtle:  if prefix is in the list, i points *after* it.
        # Fiddle i to point before it.  The bisect module should
        # really have more functions to control what happens here.
        while i > 0 and words[i-1] == prefix:
            i = i-1
        j = i
        n = len(words)
        # note that .startswith() is a 1.6 feature
        while j < n and words[j].startswith(prefix):
            j = j+1
        return words[i:j]

    def addword(self, word):
        """Add a word to the list of words."""
        self.words.append(word)
        self.words.sort()





From r-stadhe at online.no  Mon Apr 17 07:55:00 2000
From: r-stadhe at online.no (RCS)
Date: Mon, 17 Apr 2000 13:55:00 +0200
Subject: Tkinter Look
References: <8d4qkq$l7s$1@nnrp1.deja.com>
Message-ID: 

Fantastic!
You have just saved me hours (days) of work!
If I come up with something that could add to this package, I will let you
know.

RCS

 wrote in message news:8d4qkq$l7s$1 at nnrp1.deja.com...
> I want to share this work related with a Look&Feel package
> for Tkinter.
>
> For info and download see :
> http://www.geocities.com/cristian_echeverria/Chevegui.html
>
> This has been very usefull to my and maybe somebody can do
> a better job with it.
>
> Bye.......Cristian Echeverria
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




From sadwolf at chollian.net  Tue Apr 11 02:02:28 2000
From: sadwolf at chollian.net (Dong-gweon Oh)
Date: Tue, 11 Apr 2000 15:02:28 +0900
Subject: Thread-safe atomic operation
Message-ID: <8cuf0o$p9a$1@news1.kornet.net>

Is there any documents which describe Python's atomic operation in
multithreaded environment. I guess Python virtual instruction is atomic.
But, without definitive documentation in high level Python statements, I
tend to over-lock my programs.

Are these statements thread-safe?
1. import xxx
2. xxx = __import__('xxx')
3. reload(xxx)
4. dict['xxx'] = sys.modules['xxx']
5. dict.has_key('xxx')

Thanks,

Dong-gweon Oh






From mwh21 at cam.ac.uk  Fri Apr 28 12:48:37 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 28 Apr 2000 17:48:37 +0100
Subject: parser and tokenize modules: sample code?
References: <3909B42D.2E564923@uab.edu>
Message-ID: 

Shae Erisson  writes:

> Can someone point me to sample code for the parser and tokenize modules?
> As Moshe Zadka says, the parser module doesn't seem easy to use. I've
> read through the example.py for the parser module, but I'd like to see
> more code if someone has some.

The file "transformer.py" from p2c takes the output of parser and
produces something easier to work with (allegedly; I've never used
it).  Start with one of these links:

http://lima.mudlib.org/~rassilon/p2c/
http://www.pythonpros.com/cgi-bin/viewcvs.cgi/p2c/

HTH,
Michael

-- 
31. Simplicity does not precede complexity, but follows it. 
     -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html


From richard_chamberlain at ntlworld.com  Fri Apr 28 11:57:11 2000
From: richard_chamberlain at ntlworld.com (Richard Chamberlain)
Date: Fri, 28 Apr 2000 16:57:11 +0100
Subject: file open() problem
References: <8ebcm3$lo$1@nnrp1.deja.com>
Message-ID: <8uiO4.1393$E44.27433@news6-win.server.ntlworld.com>

Just to let you know that I'm running win98se and it works fine.

Richard
 wrote in message news:8ebcm3$lo$1 at nnrp1.deja.com...
> I am using python1.5.2 on windows98se.  all of the following gives me
> an error.
>
> f = open('file.txt', 'r')
> f = open("file.txt", "r")
> f = open('c:/dir/file.txt', 'r')
> f = open('c:\dir\file.txt', 'r')
> f = open("c:/dir/file.txt", "r")
> f = open("c:\dir\file.txt", "r")
> f = open("c:\\dir\\file.txt", "r")
>
> The error from the python shell for any of the above is:
>
> Traceback (innermost last):
>   File "", line 1, in ?
>     f = open('file.txt', 'r')
> TypeError: illegal argument type for built-in operation
>
> Can anyone help me?  Thanks.
>
> ekw
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




From Michael.Scharf at gmx.de  Fri Apr 14 17:10:37 2000
From: Michael.Scharf at gmx.de (Michael Scharf)
Date: Fri, 14 Apr 2000 23:10:37 +0200
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca>  
Message-ID: <38F7894D.9997636A@gmx.de>

Fredrik Lundh wrote:
> 
> Michael Hudson  wrote:
> > It would be, in my opinion, be a really really really good thing; for
> > one thing it would help in language wars...
> 
> sorry, but stackless python is the only really really really good
> thing that hasn't yet been added to the core.  this is just really
> really good.

And what are the reasons for not adding the really really really good
stackless python??


Michael
-- 
     ''''\     Michael Scharf
    ` c-@@     TakeFive Software GmbH, a Wind River Company
    `    >     http://www.WindRiver.com
     \_ V      mailto:Michael.Scharf at gmx.de


From mhammond at skippinet.com.au  Wed Apr  5 20:25:59 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Thu, 06 Apr 2000 00:25:59 GMT
Subject: Remotely running a python script
References: <8cf452$pdv$1@gxsn.com> <7GOG4.2280$bh.22442@typhoon.nyroc.rr.com>
Message-ID: 

"Darrell"  wrote in message
news:7GOG4.2280$bh.22442 at typhoon.nyroc.rr.com...

> If you have Mark Hammond's Win32 stuff installed try naming
your script with
> .pyw
> It'll run nicely out of site without a console.

Actually, you dont need the win32 extensions for this to work -
Python itself installs this magic quite independently of
win32all.

Mark.





From mjhand at concentric.net  Fri Apr 14 01:57:42 2000
From: mjhand at concentric.net (Manus Hand)
Date: 14 Apr 2000 01:57:42 EDT
Subject: Python Starship Grounded??
Message-ID: <38F6B2DF.940E7C23@concentric.net>

Anyone here able to do anything about the illness that seems to have
come over starship.python.net?

It was out of commission all day Tuesday, and now all day today
(Thursday) without a visible light at the end of the tunnel.

It occasionally answers ping (well, it did earlier today, but....)
and sometimes a traceroute will crawl through to it, but http and
ftp and ssh, etc., etc. have failed to answer all day.  (And were
sluggish at best yesterday, and non-existent the day before.)

Manus


From Klaus-Gerd.Meyer at de.bosch.com  Tue Apr 18 11:13:21 2000
From: Klaus-Gerd.Meyer at de.bosch.com (Klaus-Gerd Meyer)
Date: Tue, 18 Apr 2000 17:13:21 +0200
Subject: Pointers
References: <38D00DCE.9740380F@be-research.ucsd.edu> <8bfsqo$kje$1@tribune.oar.net>   <4k5D4.7566$0o4.54442@iad-read.news.verio.net> <38FB98F1.239EC0FB@whetstonelogic.com> 
Message-ID: <8dhu2j$1gm$1@proxy2.fe.internet.bosch.de>

>Try playing around in the interpreter for a while, this is a key thing to
>understand about Python in my opinion. You can test objects to see if
>they're the same object with 'x is y', and test their values with 'x == y'.


A good idea. ;-)
Also nice: id(x), returns an objekt id (currently implemented as its
address).

Integers and strings with same value are identical, but tuples and list with
same value are not identical...

>>> x = 1
>>> y = 1
>>> id(x),id(y)
(7879224, 7879224)
>>> x is y            #x and y: same value and identical
1
>>>
>>> x = "a"
>>> y = "a"
>>> id(x),id(y)
(8041104, 8041104)
>>> x is y            #x and y: same value and identical
1
>>> x = ("a","b")
>>> y = ("a","b")
>>> id(x),id(y)
(8864080, 8919376)
>>> x is y            #x and y: same value and not identical
0
>>> x = ["a"]
>>> y = ["a"]
>>> id(x),id(y)
(9378096, 9394512)
>>> x is y            #x and y: same value and not identical
0






From chafik at nevrax.com  Wed Apr  5 04:31:12 2000
From: chafik at nevrax.com (Sameh chafik pro)
Date: Wed, 5 Apr 2000 10:31:12 +0200
Subject: Some problem with python 1.6
Message-ID: <001201bf9ed9$4cd6ca60$1001a8c0@nevrax.net>

I work with Visual C++ (6.0). When i build a project who have a python support i have the following error:
1) The library Python16_d.lid dos not  existe.
        I renamed in the config.h the pragama comment (lib,"python16_d.lib") to pragama comment (lib,"python16.lib"). But
        now i have the follow link error:
2) Linking...
        Creating library Debug/PYTHONLIB.lib and object Debug/PYTHONLIB.exp
    PyLib.obj : error LNK2001: unresolved external symbol __imp___Py_Dealloc
    PyLib.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal
    PyLib.obj : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs
    PythonMethode.obj : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs
    
    This link error happen only with the debug version, not that the difference between the debug and release comme from the         _DEBUG preprocessor.
    
.....................Thanks for answer.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From zorro at zipzap.ch  Wed Apr 12 09:24:36 2000
From: zorro at zipzap.ch (Boris Borcic)
Date: Wed, 12 Apr 2000 15:24:36 +0200
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com>  <8d1lgu$ga0$1@newshost.accu.uu.nl>
Message-ID: <38F47914.5F13F5C5@zipzap.ch>

Martijn Faassen wrote:

> Quick-someone-start-a-math-discussion!-ly yours,

I can propose my april's fool contribution that
was refused by sci.physics.research's moderation

--

1. Monstrous Moonshine Over Giordano Bruno

Giordano Bruno was burnt at the stake at the
Piaza dei Fiori on February 17th, 1600, in Rome, for
heresy.

On the 400th anniversary of the event, a few weeks
ago, the catholic church acknowledged that its
method of defending "the Truth" had not been
up to the standards that Jesus promoted. It
nevertheless reasserted that Bruno was *wrong*,
an opinion that is in practical agreement with that
of many of Bruno's post-mortem defenders, starting
with Diderot, who presented Bruno in his encyclopaedia
as an example of Church victim, but depicted his work
as obscure and not really interesting.

Bruno's specialty was mnemotechnics. Here it will
be shown that mnemotechnical methods, such as those
employed by Bruno, are actually sufficient to defend
his memory without need for the help of half-hearted
opportunistic defenders.

1.1 Truly Visual Basic

The first step in the method, in today's words, is
called "Truly Visual Basic". Shortly put, the method
consists in representing letters, names, objects,
beings, facts, using arithmetical or mathematical
symbols that best mimic them in an iconic manner.

So we start with the stake to which Bruno was bound,
and represent it with the digit that best represents
it : a 1.

Then we represent Giordano Bruno himself, by his
initials, G and B, and in turn represent these using
the digits that best mimic them : 6 and 3, respectively.

This takes a bit of training to *see* : there is no
digit that mimics a capital G better than does 6.
And none that mimics a B, better than does 3. (it takes
a bit of effort, but the reader should be reassured, though,
that Truly Visual Basic (tm) is much easier to use
than is its namesake by Mr Bill Gates).

The stake and Giordano Bruno together give us : 163.

They were bound together, which we represent by
surrounding the above expression with parenthesis : (163).

Witnesses say that a priest presented Bruno with
a cross, while he was turning his head away : T(163).

This was taking place on a square, which we mimic
with the abreviation SQR. So we get to : SQRT(163).

The square, being a former horseracing stadium, is
and was actually round. This contradicts the standard
expectations stemming from the noun "square". So
we rectify this expectation by (a) marking the above
expression with an asterisk : SQRT(163)*, (b) giving
archimedes constant, the natural symbol for all that's
round, PI, as an explanation for the asterisk : *PI,
and (c) gluing both together for economy : SQRT(163)*PI.

This last expression is thus a representation for the
square and the public in it. These were spellbound to
the scene, just as GB was himself bound to the stake :
(SQRT(163)*PI).

Bruno was then burnt in *expiation* his purported
blasphemies, just as we today, are concerned with having
the church *expiate* for what it did to him. We represent
this by (a) reordering the expression in conformance
to mathematical standards : (PI*SQRT(163)), and
(b) prepending it with EXP, which gives us :

[formula I] EXP(PI*SQRT(163)) !

[...]

1.3 The Monster Group and its 196884-dimensional Space

The above is the title of chapter 29 of the famous
Book by Conway and Sloane, "Sphere packings, Lattices,
and Groups", which I cite as a shortcut to get back to
Giordano Bruno after the above digressions.

Recall formula [I] that we derived, using Truly Visual
Basic (tm), from the sorry fate of Giordano Bruno in the
hands of the catholic church. We shall show below that
the above cited telltale number of the famous Monster
Group's Moonshine, e.g. 196884, lurks behind that formula
(a fact that many know already, I am sure). We urge the
reader, first, to note that there is something moral to see
the Monster Group occur in the trace of a victim of
religious dogmatism such as Mr. Giordano Bruno. Indeed,
the Monster Group may rightfully be called the central
room of the castle of exceptional algebraic structures,
and religious dogmatism is nothing else than generalizing
rules above any measures, thus denying exceptions.

Computing formula [I] EXP(PI*SQRT(163)), using an
infinite precision package, gives us the strange value :

v := 262537412640768743.999999999999250072597198185688879353856...

Dogmatics, seeing such a value, will undoubtetly conclude
to a computer arithmetic error, and round the number to
262537412640768744. Actually, there is no error, and since
we despise dogmatics - if only because we are currently
encouraging the memory of one of their victims - we decide
to turn our attention on what they would discard : the
fractional part of the number v, most naturally expressed
as the difference to the rounded number.

w := ceil(v)-v = 000000000000749927402801814311120646143662663...

This isn't very handy, but groping around, we find out
that :

v*w := 196883.999999999918130677895382415018280732177224...

Which, having already proved that we are not dogmatic
about it, we feel no shame to round to the integer, (noting
also that it starts with 1968, a most undogmatic year) :

196884 - to discover the telltale sign of Monstrous
Moonshine over Giordano Bruno.

1.4 The Holy Trinity and Mary's Virgin Birth

Giordano Bruno's condamnation was motivated by his rejection
of a variety of dogmas, most notably the Holy Trinity
and Mary's Virgin Birth. (The unknowing reader should
be made aware that, contrary to a popular misconception,
the dogma of Mary's Virgin Birth refers not to Jesus,
but to the notion that Mary herself was born free of the
sequel of the original sin that Eve and Adam commited.

What proves the power of GB's mnemotechnics, is that if
we take the 196884 above, that we have obtained from the
picture of his torture, EXP(PI*SQRT(163)), multiply it
by 3 as a reference to the dogma of the Holy Trinity,
and substract the result, as a number of days, from the
date of Giordano Bruno's execution, we obtain a date
that is likely to be that of Mary's Birth, some 17
years before our era.

[...]


From aa8vb at yahoo.com  Thu Apr 20 10:07:06 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Thu, 20 Apr 2000 10:07:06 -0400
Subject: how do i pack and unpack messages in python?
In-Reply-To: <008301bfaacb$42fe2c60$2801000a@iel.ie>
References: <008301bfaacb$42fe2c60$2801000a@iel.ie>
Message-ID: <20000420100706.A624577@vislab.epa.gov>

Shaun:
 |so i now have a message that looks like:
 |
 |id                       : 10
 |subid                  :13
 |NV sequence :   {14, "shaun"-string
 |                         {20, ["Anytown, Anywhere"]-list
 |                         {34, 1234567890-int
 |
 |
 |i want to pack the message to look like this:
 |
 |10 fs 13 fs 14 fs s shaun fs 20 fs l s anytown fs s anywhere fs i 1234567890
 |gs gs
 |
 |(NV=Name Value Pair, fs=field seperator, s=string, i=int, l=list, group
 |seperator)
 |
 |can anyone please tell me how id go about manipulating the strings so as i
 |can join them using field seperators, any ideas anyone, or even tell me
 |where i might find out how to do this problem.

I was going to mention the struct, array, or xdrlib modules to you, but
from your desired output format (all ASCII it appears), it looks like
a simple string.join would do the job:

   >>> import string
   >>> string.join( [ str(10), str(13), str(14), str("shaun") ], ";" )
   '10;13;14;shaun'

   etc.

-- 
Randall Hopper
aa8vb at yahoo.com



From mhammond at skippinet.com.au  Tue Apr 18 20:58:26 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Wed, 19 Apr 2000 00:58:26 GMT
Subject: PythonWin and Dialogs in DLLs
References: <38FCD4FB.6E07A632@callware.com> <38fcde9b.12797461@news-server.socal.rr.com>
Message-ID: 

"Roger Burnham"  wrote in message
news:38fcde9b.12797461 at news-server.socal.rr.com...
> On Tue, 18 Apr 2000 15:34:51 -0600, Ivan Van Laningham
>  wrote:
>
> In your pywin.mfc.dialog.Dialog derived class, call the parent init
> with the dll:
>
>            Dialog.__init__(self, dllid='pathToYourDll')

Or, in some module simply say:

dll = win32ui.LoadLibrary('pathToYourDll')

And magically your DLL should be searched for resources.  Just use the
existing dialog functions as normal, but you can specify resource IDs from
your DLL.

Mark.





From josht at iname.com  Thu Apr  6 21:58:51 2000
From: josht at iname.com (Josh Tompkins)
Date: Fri, 07 Apr 2000 01:58:51 GMT
Subject: Python on Google?
Message-ID: <8F0ED22EBjoshtinamecom@209.208.0.7>

Buenos Dias, everyone.

This is perhaps an off-topic question, but having just found google, I'm 
curious...

Does anyone know to what extent Python is used on www.google.com?  I 
noticed on thier "job offerings" (or whatever) page that they list python 
experience as "a plus".

Just wondering...

Josue

________________________________________________________________

"Destined For Great Things -- but pacing myself."
- From a t-shirt.

E-Mail:  josht at iname.com 
ICQ:  21219667
AIM:  JosueTheGreat
Web:  http://www.crosswinds.net/~josht
_________________________________________________________________


From rcc at nospamthanks_jennic.com  Thu Apr 20 10:16:24 2000
From: rcc at nospamthanks_jennic.com (Robert Cragie)
Date: Thu, 20 Apr 2000 14:16:24 GMT
Subject: Using popen in windows
References: <1255890154-29764960@hypernet.com>
Message-ID: 

Gordon McMillan  wrote in message
news:1255890154-29764960 at hypernet.com...
| Robert Cragie wrote:
|
| > I tried the following in Windows 98 as an experiment:
| >
| > from win32pipe import popen
| > p = popen('dir','r')
| > str = p.read()
| > print str
| >
| > It just hangs when trying to do the read, and I have to kill the shell
off.
| > I have tried IDLE 0.5 and PythonWin and the 'DOS' command line, both do
the
| > same. I am using Python 1.5.2, and the win32pipe.pyd DLL is dated 3rd
May
| > 1999.
| >
| > I have done the equivalent on Linux and it works fine:
| >
| > from os import popen
| > p = popen('ls','r')
| > str = p.read()
| > print str
| >
| > Anyone got any ideas?
|
| Ah, but it's not equivalent :-). 'dir' is a cmd.exe builtin, not an
| "external program". You can't (directly) popen any of the
| cmd.exe builtins (and the list changes with each OS release).

I tried this and it still hangs; cvs.exe is definitely not a built in:

from win32pipe import popen
p = popen('c:\\cygwin\\contrib\\bin\\cvs -v','r')
str = p.read()
print str

Again, the equivalent works fine on Linux. So how do I run a command in
Windows and capture the output? The following works, but is clumsy, and you
get the annoying DOS box while it runs - is there a better way?:

import os
os.system('dir >temp')
f = open('temp', 'r')
f.read()

TIA

Robert




From scarblac-spamtrap at pino.selwerd.nl  Wed Apr 26 09:17:35 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 26 Apr 2000 13:17:35 GMT
Subject: Need advice performing a search
References: <3905F795.A536CFA7@stsci.edu> <3906944F.F718FE91@teleatlas.com>  
Message-ID: 

Fran?ois Pinard wrote in comp.lang.python:
> scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) writes:
> 
> > from string import find
> > def testline(line):
> >   return find(line, "first_string") or find(line, "second_string")
> 
> Shouldn't we have:
> 
>    return find(line, "first_string") >= 0 or find(line, "second_string") >= 0

. Yes.

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl

   This is no way to be
     Man ought to be free      -- Ted Bundy
       That man should be me


From jimc at regnoc.com  Sun Apr  2 22:41:08 2000
From: jimc at regnoc.com (Jim Conger)
Date: Mon, 03 Apr 2000 02:41:08 GMT
Subject: Just doing local file testing
References: <38E796BC.23191B2@regnoc.com> <00040214141502.04535@quadra.teleo.net> <38E7D6DE.EA09C891@regnoc.com> <00040216504403.04535@quadra.teleo.net>
Message-ID: <38E7F616.48CF9284@regnoc.com>

An HTML attachment was scrubbed...
URL: 

From jamarijr at hotmail.com  Tue Apr 18 09:05:49 2000
From: jamarijr at hotmail.com (Arinté)
Date: Tue, 18 Apr 2000 13:05:49 GMT
Subject: Still trying to learn
Message-ID: <8dhmj2$f9m$1@nnrp1.deja.com>

I have this code here

	def IOCTL(self, comm, args):
		command1 = long(0)
		try:
			if type(comm)==type(2):
				poss.alert("Totally")
		except:
			command1 = comm
			print sys.exc_type
			print sys.exc_value
			return -1
		if type(comm)==type(long(2)):
			print "IOCTL was int"
			command1 = long(comm)
			print "IOCTL Set to Long"
		else:
			if type(comm) == type("  "):
				print "IOCTL was a string"
				command1 = comm
			else:
				if type(comm)!=type(2L):
					print "IOCTL fail"
					return -1
		poss.IOCtl(self.devname,command1,args)
		return 0

The poss object is going to my c\c++ app and I have traced thru it and
it seems to pass back valid values everytime.  The problem I am having
is on the 2nd call to this function the try..except fails with this
error:

exceptions.TypeError
len() of unsized object

Here is how I make the call
for i in range(10000):
	res = nex.IOCTL("POS_SYS_ACQUIRE_DEVICE",0)
	if res <0:
		break
	else:
		poss.alert("OK")

Thanx and sorry for the long post.




Sent via Deja.com http://www.deja.com/
Before you buy.


From michael_peck at my-deja.com  Thu Apr 13 14:29:12 2000
From: michael_peck at my-deja.com (Michael Peck)
Date: Thu, 13 Apr 2000 18:29:12 GMT
Subject: Embedded interp --> call back to embeddor?
References: <1256474779-52175680@hypernet.com>
Message-ID: <8d53l1$45$1@nnrp1.deja.com>

In article <1256474779-52175680 at hypernet.com>,
  gmcm at hypernet.com wrote:
> Michael Peck  wrote:

> There's a (moronically) simple example at
> http://www.mcmillan-inc.com/embed2.html

Wow. That is exactly what I was looking for. My undying gratitude,
Gordon.

MJP


Sent via Deja.com http://www.deja.com/
Before you buy.


From johann at physics.berkeley.edu  Thu Apr  6 14:37:18 2000
From: johann at physics.berkeley.edu (Johann Hibschman)
Date: 06 Apr 2000 11:37:18 -0700
Subject: Beginning to be disapointed
References: 
Message-ID: 

Hugues Demers writes:

> Can somebody help me on this? I'm using python to read big arrays
> (100x2000) of float. I manipulate those arrays, I do small
> operations on them. That is ok. I do others smalls calculations not
> involving the big arrays and then the interpreter hang ! The cpu
> percentage used by python goes up and there is nothing else to be
> done except to kill the interpreter. I have no idea what's going
> on. Do I need to free memory in some way ? Am I doing something
> wrong ? There is nothing special about the calculations involving
> the big arrays. The only thing special is that they are big.

Are you using the Numeric package?  I've never seen behaviour like that.

1. are you using Numeric or array?
2. how are you reading them in?
3. how are you calculating them?  Numeric math ops or explicit loops over
   raw arrays?
4. could something be keeping a reference to the arrays?
5. what OS are you on?
6. version of python?

Sorry, I think we all need a bit more information to answer you.

--Johann

-- 
Johann Hibschman                           johann at physics.berkeley.edu


From gmcm at hypernet.com  Thu Apr 13 13:41:54 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Thu, 13 Apr 2000 13:41:54 -0400
Subject: Embedded interp --> call back to embeddor?
In-Reply-To: <8d4vkv$r9p$1@nnrp1.deja.com>
Message-ID: <1256474779-52175680@hypernet.com>

Michael Peck  wrote:

> I can't tell from any of the references I've read whether my objective
> is possible. What I want to do is provide a C program that embeds a
> Python interpreter in such a way that the executed Python code can call
> back to C functions within my program.
> 
> Is this possible? Can someone provide information on the procedure?

There's a (moronically) simple example at
http://www.mcmillan-inc.com/embed2.html


- Gordon



From effbot at telia.com  Thu Apr 13 14:00:57 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Thu, 13 Apr 2000 18:00:57 GMT
Subject: Doesn't anybody write to paper anymore?
References: <38F5FDF3.EE2FBA01@tcac.net>
Message-ID: 

Albert Wagner  wrote:
> I've searched the docs and my "Learning Python" book and I can't find
> anything on printing to a real printer.  Through trial and error I
> finally made the following work:
>
> printer = open('/dev/lp0', 'w')
> printer.write("page 1\n\r\f")
> printer.write("page 2\n\r\f")
> printer.close

oh, you're on unix...

this might work:

    printer = os.popen("lpr", "w")
    printer.write("page 1\n\f")
    printer.close()

for more information, read the OS documentation for
lpr and friends.






From thomas.heller at ion-tof.com  Thu Apr 13 13:00:42 2000
From: thomas.heller at ion-tof.com (Thomas Heller)
Date: Thu, 13 Apr 2000 19:00:42 +0200
Subject: threading question
Message-ID: <018e01bfa569$cda0cd80$4500a8c0@thomasnotebook>

I want a thread to run in parallel with the interactive
interpreter.
Simple:

def do_work():
    import time
    while 1:
        time.sleep (1)
        ...

import threading
threading.Thread (target=do_work()).start()

But when I hit EOF, python waits until this thread is finished.
How can I avoid this? I want python to terminate the thread
and exit in this case.

Thomas Heller





From phd at phd.russ.ru  Mon Apr 24 08:16:23 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Mon, 24 Apr 2000 12:16:23 +0000 (GMT)
Subject: Trouble compiling PyGreSQL 2.4 on Linux
In-Reply-To: 
Message-ID: 

On Mon, 24 Apr 2000, Martin Sk?tt wrote:
> >    There is no Makefile 'cause the module is intended to use standard
> > Python Makefile.pre.in/Setup.in scheme.
> 
> That is onlu if you chose the standard Python module installation. Red
> Hat has made something special where modules are stored in a directory
> called lib-dyn/ some where. To me it seems like the modules then are
> loaded automaticly.

   I think even on RH you may do it "standard way" - install python-dev
RPM, and you've got Makefile.pre.in and Setup.in with them. Copy these
files to you work directory, modify Setup.in to your needs (to PyGreSQL
needs this time :) and make -f Makefile.pre.in && make.
   I didn't test my advice - I run only Debian systems and one Solaris; and
in any case I installed Python from sources - I need some more modules
(locale, most notable) and some less (no tkinter, please :)

> As I mention in my first posting the readme.linux file describes how
> to do an red hat install (make redhat) but it doesn't seem to work. An
> address is also mentioned for an RPM but the file doesn't exist on the server.

   D'Arcy would gladly accept any patch.

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.




From tuttledon at hotmail.com  Tue Apr  4 08:43:06 2000
From: tuttledon at hotmail.com (Don Tuttle)
Date: Tue, 04 Apr 2000 12:43:06 GMT
Subject: Starving for an Advanced Python Book
References: <20000404040941.7766.qmail@web2106.mail.yahoo.com>
Message-ID: 

"lewst"
>ORA's "Programming Python" is a natural choice, but I
> can't bear buying this outdated book when the 2nd edition is due out
> in a few months (I'm dying here Lutz, hurry it up already!).

I went ahead and bought it because Oreilly's cheif editor says, "We're
timing the new edition of Programming Python to follow shortly after the
release of Python 2.0."(aka Python 3K).  If that turns out to be the case,
it won't published until sometime in 2001.  See his complete (and somewhat
dated) remarks at  http://www.oreilly.com/frank/python.html

> Does anyone have any suggestions?  I suppose I'm looking for a text
> that has examples of how to solve various kinds of programming
> problems in Python and also examples of code showing how the library
> and various modules actually work.

Fredrick Lundh's "(the Eff-bot Guide To) The Standard Python Library"
 http://www1.mightywords.com/asp/bookinfo/bookinfo.asp?theisbn=EB00002582
has many short examples.

Also "The Python Annotated Achives" is pretty much just examples and
comments.
http://shop.barnesandnoble.com/booksearch/isbnInquiry.asp?userid=589TPW6Z1E&
mscssid=7T95UX3412S92K8S0017QRP4NV5DCFDD&srefer=&isbn=0072121041

>How is the "Python Essential
> Reference" on examples?  Is it just a rebinding of the python.org
> library reference

Excelent reference, but no examples.

Don





From just at letterror.com  Fri Apr 14 18:06:06 2000
From: just at letterror.com (Just van Rossum)
Date: Fri, 14 Apr 2000 23:06:06 +0100
Subject: [ANNOUNCE] Garbage collection for Python
In-Reply-To: 
References: <20000407221750.A29279@acs.ucalgary.ca>
 
Message-ID: 

Michael Hudson  wrote:
> To someone who might know: what hope is there for this to go
> into 1.6?
[ ... ]
> It would be, in my opinion, be a really really really good thing; for
> one thing it would help in language wars...

Fredrik Lundh wrote:
> sorry, but stackless python is the only really really really good
> thing that hasn't yet been added to the core.  this is just really
> really good.

Oh how I agree... (Now lets hope the new Python GC isn't
incompatible with Stackless... Project anyone? ;-)

While were at it, here's a little Stackless news:
- Christian is redesigning the continuation module, it already has
  improved quite a bit over the last two weeks.
- Even so, Chris and I agree that continuations should eventually
  be completely hidden from the user, since it's so incredibly
  obscure, hardly anyone will understand it. Not good for CP4E ;-)
- However, it's currently needed so microthreads and coroutines
  can be largely implemented in Python itself, which in itself is
  extremely cool.
- We're pretty far in fleshing out the microthreading needs;
  the microthread kernel will at some point be implemented in C,
  making it pretty darn efficient. (Although the current Python
  version is actually not so bad itself...)
- Dunno about coroutines: it appears they are much harder to get
  right, and the people on the python-coro at egroups.com list only
  seem to make slow progress. (But then again, I've only been
  there for a week or so, so who am I to say that...)
- Will Ware and I have worked hard on a complete rewrite of the
  uthread module. It is a *vast* improvement over the old one.
  It offers a very nice thread object and several handy threading
  widgets. It already can do stuff threading.py can only *dream*
  about, like pausing (blocking) a thread from another thread or
  posting an exception from another thread (!).
- It seems our new version of uthread.py is close to being
  system-thread safe, allowing each system thread to have its
  own set of microthreads...
- I'm playing with a uthreaded socket wrapper which uses select
  and non-blocking sockets under the hood, without the client
  even knowing it. If it turns out this works well, uthreads will be
  a good alternative for asyncore.py, being easier to use and all.

Just





From tuttledon at hotmail.com  Sat Apr  1 22:32:50 2000
From: tuttledon at hotmail.com (Don Tuttle)
Date: Sun, 02 Apr 2000 03:32:50 GMT
Subject: New Features in Python 1.6
References: <000301bf9c15$23a18f20$182d153f@tim> 
Message-ID: 

Ha Ha Ha!....shit fire and McDonalds Fries!....Oh, my side hurts!...Ha
Ha....oops, just wet myself....gotta go

"Fredrik Lundh"
> Tim,
>
> I think things are worse than this -- someone just sent me
> something that looks like a draft press release, announcing
> that O'Reilly had taken over Python development, with Jon
> Orwant as CTO, and Larry Wall as the Python 1.6 release
> manager.
>
> (it wasn't clear if it was intended for public consumption
> at this time, so please don't spread the word around just
> yet.  if I get permission, I'll post more info to the list).
>
> given this, Guido's post makes a lot more sense, in a slightly
> scary way -- the press release also talks about fusing Python
> 3000 and Perl's "Topaz" project, rewriting the whole thing in
> Scheme.
>
> note that this seems to have been in the work for quite a
> while; things like Perl companies hiring python talent, Tom
> Christiansen's Python courses [1], Guido schmoozing with
> Randal Schwartz on the SD2000 conference [2], the Casbah
> folks working on a unified Python/Perl engine, etc.
>
> still think it's kinda weird, though...
>
> 
>
> 1) http://training.perl.com/open-courses.html
> 2) http://www.ddj.com/articles/2000/0050/0050toc.htm
>
>




From karab at stsci.edu  Tue Apr 25 15:58:38 2000
From: karab at stsci.edu (Kia Arab)
Date: Tue, 25 Apr 2000 19:58:38 GMT
Subject: Need advice performing a search
Message-ID: <3905F795.A536CFA7@stsci.edu>

I am trying to search a file for two strings. If *either* string is
found, I need the line in which the string was found to be returned  (or
somehow extract the line). It should keep searching and keep returning
the lines where it finds either string, until the end of file is
reached.

Any suggestions?


From alwagner at tcac.net  Wed Apr 12 22:27:39 2000
From: alwagner at tcac.net (Albert Wagner)
Date: Wed, 12 Apr 2000 21:27:39 -0500
Subject: redirecting stdout to printer
Message-ID: <38F5309B.487B228B@tcac.net>

How do I specify my printer as stdout?  Know of a module that has basic
prettyprinting with headings and pagenumbers?

-- 
Small is Beautiful


From josht at iname.com  Thu Apr  6 22:05:26 2000
From: josht at iname.com (Josh Tompkins)
Date: Fri, 07 Apr 2000 02:05:26 GMT
Subject: Searching for Python Material...
Message-ID: <8F0ED18C1joshtinamecom@209.208.0.7>

Buenos Dias, everyone.

I'm fairly new to this whole python thing.  I think that I'm getting better 
at it, but I seem to be suffering from a lack of reference material.  None 
of the bookstores in my area carry any of the python books, and being 
woefully without a credit card, I must wait until the stores special order 
my requests...

So, anyway, I was wondering if anyone could point me to some websites that 
cover material that is more advanced than the stuff in most of the 
tutorials out there.  I'm actually looking for something along the list of:

to do (something cool in python) do this...

where something cool in python is a variable with values such as "Accessing 
webpages and/or e-mail", "Connecting to a database", etc, while still 
keeping the deep magic stuff to a relative minimum.

Thanks for any help you can give me!

Josue

________________________________________________________________

"Destined For Great Things -- but pacing myself."
- From a t-shirt.

E-Mail:  josht at iname.com 
ICQ:  21219667
AIM:  JosueTheGreat
Web:  http://www.crosswinds.net/~josht
_________________________________________________________________


From grant at nowhere.  Fri Apr 14 14:43:56 2000
From: grant at nowhere. (Grant Edwards)
Date: Fri, 14 Apr 2000 18:43:56 GMT
Subject: Authenticate with smtp
References: <018701bfa53b$f831f3e0$858647c1@DEVELOPMENT>
Message-ID: 

In article <018701bfa53b$f831f3e0$858647c1 at DEVELOPMENT>, Ulf Engstr?m wrote:

>How can I log into an smtp server that requires authentication and send a
>mail with smtplib, or is there any other package that helps? (Yes, I'm
>authorized)
>Regards
>Ulf

A friendly hint:  Your posting was 50+ lines long with 5 lines
of actual content.  Delete all the MIME and vcard stuff.

About SMTP authentication: what type of authentication is
required?  Some servers (MS-Exchange) do plaintext username and
password authentication.  Others require you to have an active
IMAP or POP connection.  Others have a more secure username
password scheme.

I've got C code that does the MS-Exchange username/password
authentication scheme (there may be other similar ones), and
you're welcome to that:   

 

-- 
Grant Edwards                   grante             Yow!  I'd like TRAINED
                                  at               SEALS and a CONVERTIBLE on
                               visi.com            my doorstep by NOON!!


From gregm at iname.com  Mon Apr 10 09:18:43 2000
From: gregm at iname.com (Greg McFarlane)
Date: Mon, 10 Apr 2000 23:18:43 +1000
Subject: Python Megawidgets - Pmw.Blt problem
In-Reply-To: <38EFC4DF.76F3C698@pacbell.net>; from Bruce Wolk on 08 Apr 2000 at 04:46:39PM
References: <38EFC4DF.76F3C698@pacbell.net>
Message-ID: <20000410231843.05124@nms.otc.telstra.com.au>

Yes.

You don't have Blt installed on your machine.  You will need to go to
the BLT home page at
    http://www.tcltk.com/blt/
and download it and install it into your Tcl.

On 8 Apr, Bruce Wolk wrote:
> Has anyone been able to use the Pmw.Blt megawidget on a Win98 system? 
> Pmw generally seems to work ok, but when I try the examples at
> 
> http://www.ifi.uio.no/~hpl/Pmw.Blt/doc/
> 
> they don't run.  I get errors like
> 
> Traceback (innermost last):
>   File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", line 131, in
> run_module_event
>     execfile(filename, mod.__dict__)
>   File "C:\Program Files\Python\Bruce\HelloWorld1.py", line 5, in ?
>     g = Pmw.Blt.Graph(master)       # make a new graph area
>   File "C:\PROGRA~1\PYTHON\Pmw\Pmw_0_~1\lib\PmwBlt.py", line 260, in
> __init__
>     Tkinter.Widget.__init__(self, master, _graphCommand, cnf, kw)
>   File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1084, in
> __init__
>     self.tk.call(
> TclError: invalid command name "::blt::graph"
> 
> Any ideas?
> 
> Bruce
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 

-- 
Greg McFarlane     INMS Telstra Australia     gregm at iname.com



From fw at deneb.cygnus.argh.org  Tue Apr 11 08:12:32 2000
From: fw at deneb.cygnus.argh.org (Florian Weimer)
Date: 11 Apr 2000 14:12:32 +0200
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com>  <87r9cdhdb0.fsf@deneb.cygnus.argh.org> 
Message-ID: <87bt3geszz.fsf@deneb.cygnus.argh.org>

Michael Hudson  writes:

> Florian Weimer  writes:
> 
> > nascheme at enme.ucalgary.ca (Neil Schemenauer) writes:
> > 
> > > I would rather get the bugs stomped out of my patch and get it
> > > included in 1.6 or 1.7.  We can then remove the FAQ entry.  :)
> > 
> > Is it possible to extend your GC in a way which would permit the
> > execution of several bytecode interpreters in multiple threads?
> 
> Eh?

With the reference counting scheme, you can't do that, because you
have to synchronize access to the reference count, which would result
in a major performance penalty.


From christian.bau at isltd.insignia.com  Mon Apr 10 05:56:18 2000
From: christian.bau at isltd.insignia.com (Christian Bau)
Date: Mon, 10 Apr 2000 10:56:18 +0100
Subject: Why should I switch to Python? - Infinity of Primes
References:  <8ccoug$f4o$1@pegasus.csx.cam.ac.uk> <7F51E902E09F3F60.8F612607812ED16B.82CB8B41435E14FD@lp.airnews.net> <38EA369C.26A1C25@math.okstate.edu> <38EAC8C4.ADC25640@cosc.canterbury.ac.nz>
Message-ID: 

In article <38EAC8C4.ADC25640 at cosc.canterbury.ac.nz>, Greg Ewing
 wrote:

> "David C. Ullrich" wrote:
> > 
> >     There's nothing non-constructive about the traditional
> > proof of the infinitude of the sequence of primes - given
> > a sequence of primes it _constructs_ a prime not on the
> > list.
> 
> Um, no it doesn't - it constructs a number which is
> *either* prime *or* divisible by some other prime bigger
> than the one you started with.
> 
> If someone actually came up with a formula for constructing
> primes, it would be rather large news -- isn't that one of
> the Big Unsolved Problems?

Take any non-empty set S of prime numbers, calculate their product, add
one, and take the smallest factor that is not equal to one. That factor is
a prime number that is not in the set S.


From phil at geog.ubc.ca  Sat Apr 29 00:17:37 2000
From: phil at geog.ubc.ca (Phil Austin)
Date: 28 Apr 2000 21:17:37 -0700
Subject: Reading in strings -> numbers ??
References: <280420001700308281%pecora@anvil.nrl.navy.mil>
Message-ID: 

"Louis M. Pecora"  writes:

> Is there a Python "read-partner" for the write(string) function, e.g., 
> 
> fileobject.write(" %e %e %d" % (1.2, -3.5, 10))

You might want to check out Konrad Hinsen's  FortanFormat package
in ScientificPython:

http://starship.python.net/crew/hinsen/scientific.html

from FortranFormat import *
input=open('lemout1.dat','r')
format=FortranFormat('(f15.6,1x,f20.6)')
x=[]
c=[]

line=1
while(line):
    line=input.readline()
    getit=FortranLine(line,format)
    x.append(getit[0])
    c.append(getit[1])

Regards, Phil


From jim at interet.com  Wed Apr 12 10:47:09 2000
From: jim at interet.com (James C. Ahlstrom)
Date: Wed, 12 Apr 2000 10:47:09 -0400
Subject: Python 4 DOS
References: 
Message-ID: <38F48C6D.FD671082@interet.com>

Arnaldo Riquelme wrote:
> 
> Can anyone tell me if I can get python binaries for DOS (16-bit).
> I heard of  Hans Nowak 's  Python-DX but the links to his website is broken?
> Where are you Hans?

www.python.org has a DOS Python running with a DOS extender.

Jim


From grant at nowhere.  Fri Apr 14 13:53:30 2000
From: grant at nowhere. (Grant Edwards)
Date: Fri, 14 Apr 2000 17:53:30 GMT
Subject: comparing strings and ints
References: <2YmI4.366$rc9.188014080@newsb.telia.net> <20000411134358.A2352304@vislab.epa.gov> <1256641282-42160637@hypernet.com> <20000412075812.A2449004@vislab.epa.gov>  <20000412112935.A2446939@vislab.epa.gov>  
Message-ID: 

In article , Michael Hudson wrote:
>grant at nowhere. (Grant Edwards) writes:
>
>> No, it said "_consistently_ but arbitrarily" [emph added].
>> That means that you don't which result you will get when a
>> string and an int are compared, but you know you will always
>> get the _same_ result.
>
>That's one reading; however I'd have thought a more likely one would
>be to specify that if x>y is true once for some x and y of differing
>types, then x>y is true each subsequent time it is evaluated.

That's a reasonable (and more conservative/safer)
interpretation.

>can-I-have-a-language-lawyer-brownie-point?-ly y'rs

Sure, take one out of stock.

-- 
Grant Edwards                   grante             Yow!  .. I'll make you
                                  at               an ASHTRAY!!
                               visi.com            


From me at nospam.edu  Fri Apr 28 16:18:56 2000
From: me at nospam.edu (Me)
Date: Fri, 28 Apr 2000 20:18:56 GMT
Subject: Help Needed-IDLE (Linux)Upgrading
References: <3909CC26.D684AD92@idirect.com>
Message-ID: 

It is there! I did the same thing...either do a search for "python" or
"idle" or look in (forgive me I am not on my box at the moment) /usr/share
????  IT IS THERE THOUGH! I would move the old (just in case) and then copy
it in. I am new too.

Bob

"Snoopy :-))"  wrote in message
news:3909CC26.D684AD92 at idirect.com...
> No Flames Please. I am a NEWBIE :-))
>
> Using Linux (RH-6.1) I have downloaded the Idle-0.5 Upgrade "tgz".
> package.But I don't know where and how to install the package.
>
> After unzipping the package I've read the README
> file which doesn't seem togive clear instructions regarding installation
> of the upgrade. On my system Idle is in /usr/bin
> but this is only the executable file without subdirectories where I
> would be able to put the untared and uzippedfiles.
>
> I would appreciate a helping hand
> Best regards
> Charles Takacs




From burnout at heathers.stdio.com  Tue Apr 18 14:17:01 2000
From: burnout at heathers.stdio.com (Eric H.)
Date: Tue, 18 Apr 2000 14:17:01 -0400
Subject: Implementing a Python process when PC is idle?
References: <38fc9694@wwwproxy3.westgroup.com>
Message-ID: <38FCA69D.85CC27DA@heathers.stdio.com>

I don't know if this will help but a fellow who helps with the
setiathome project created a program that will run processes once cpu
load gets below a certain user set point. The binaries he has are for
SGI and Sun but he also has source that might help.. The page to find
this program is..

http://www.pattosoft.com.au/jason/idleize/

I use it on my Indigo2 and love it..I can control anything like this..I
think I can even use some of my raytracers with this..haven't tried yet
though...prolly will be next.. Hope this helps...and L8a


MikeZ wrote:
> 
> Hello,
> 
>     I would like to execute a Python process that gets executed when my
> Windows PC is in screensaver mode (so my PC can work when it is idle).
> 
>     Has anyone ever implemented this, or have an idea how this could be done
> ? I prefer to do this all in Python, including any Windows commands
> necessary to register the process as a screensaver.
> 
> Thanks in advance,
> -Mike Z.

-- 
Parts of this message, including the email address, ? 2000-Eric Haddix. 
Use implies agreement to the terms and conditions made available on my 
homepage. Keep the Internet free, refuse to support the providers that
copyright YOUR email and messages. All rights reserved. U.C.C. 1-207

visit my homepage @ http://www.bounce.to/EyesCremeProductions



From dan at cgsoftware.com  Wed Apr 12 00:09:31 2000
From: dan at cgsoftware.com (Daniel Berlin+list.python)
Date: 12 Apr 2000 00:09:31 -0400
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
In-Reply-To: tom__98@my-deja.com's message of "Wed, 12 Apr 2000 03:09:26 GMT"
References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com>
Message-ID: 

>>>>> "tom" == tom 98  writes:


    tom> In article <200004102111.HAA03380 at envy.fulcrum.com.au>,
    tom> Richard.Jones at fulcrum.com.au wrote:

    tom> Maybe you can contribute more constructively:

    tom>  -- How can I browse the Python documentation without firing
    tom> up a web browser?

Convert it to text format. It's latex, you can make it into anything
you want, and do anything you want with it.
If you tell me your environment for programming, i'll tell you a nice
way to be able to get at it that doesn't involve firing up a web browser
    tom> Or,   How do I get information on a single
    tom> Python function or class quickly?
Personally, i read the docstrings.
I have a little utility function in my python startup file.
SO all i do is thus:
import socket 
>>> info(socket.htonl) 
Documentation: 
------------------------------------------------------------------------

Object  : 
    htonl(integer) -> integer  

    Convert a 32-bit integer from host to network byte order.  
 
 

    tom> Is there any equivalent of
    tom> "perldoc -f split" or "perldoc Net::POP3"?  What do you do in
    tom> that situation?

You fire up the interperter, which you probably already have running,
and just look at the docstring.
If they didn't provide one, well, you yell at them.


    tom>  -- Is there a Python equivalent of CPAN and the Perl CPAN
    tom> module?  The closest I know of is Parnassus.  But Parnassus
    tom> is merely a collection of links, not an archive, and it
    tom> doesn't have any facilities (AFAIK) for automatic
    tom> installation.

So, who gives a crap?
I try not to be that lazy.

    tom>  -- Several extensions I have wanted to install have required
    tom> access to the full Python source tree, not just the header
    tom> files and the library. 
Such as?
    tom>  Is that going to change?  Otherwise,
    tom> how can I install Python extensions that want access to the
    tom> source tree on, say, a standard RedHat system?
I have yet to see a single one that required access to the full source
tree.
If it doesn't have a damn good reason, the package is broken.
    tom> Having the
    tom> standard RPM-based installation in parallel with a /usr/local
    tom> installation from source is confusing, and removing the
    tom> RPM-based installation risks breaking things.


Why do i get the feeling you'll never be satisfied?

    tom> Tom.




From cut_me_out at hotmail.com  Wed Apr 26 11:42:03 2000
From: cut_me_out at hotmail.com (Alex)
Date: 26 Apr 2000 11:42:03 -0400
Subject: How can I get the name of an object???
References: <8e712k$65c$1@nnrp1.deja.com>
Message-ID: 

An object could be referred to by any number of names:

dd = zz ()
ee = dd

Which name for the object do you wish to know?  ee or dd?

Alex.


From warlock at eskimo.com  Tue Apr  4 22:08:39 2000
From: warlock at eskimo.com (Jim Richardson)
Date: Tue, 04 Apr 2000 19:08:39 -0700 (PDT)
Subject: opening a serial port at a given baudrate. How?
In-Reply-To: <200004041153.VAA15869@piglet.dstc.edu.au>
Message-ID: 

On 04-Apr-2000 David Arnold wrote:
> -->"Jim" == Jim Richardson  writes:
> 
>   Jim> I can't seem to find any info on opening a serial port in
>   Jim> python!. (I am using linux for developement, but would like to
>   Jim> be able to use the app on any python system, it is text only,
>   Jim> no gui, at least for now. )
> 
> there is no portable way to open a serial port.  this is not least
> because there is no portable way to name your serial ports, but goes
> further than that.
> 
> on unix (including linux), just open the device special file
> corresponding to the serial port of interest (ie. /dev/ttyS0) and you
> can then control it using fcntl.ioctl() function and otherwise read
> from and write to it like a normal file object.
>

I have been using open('/dev/ttyS0','r+')
but need to control baud rate. fcntl.ioctl() will do this? 
 I can't seem to find (on machine, haven't checked on-line yet
how to do this, but thanks for the pointer! Knowing where to look is at
least half the battle.



> on win32 there is a serial I/O module (serialmodule?) that a quick
> deja search will locate for you.
> 
> i'd recommend the POSIX serial programming guide (any search engine
> should find it) as a good primer for Unix serial programming ...
> 

OK, will do, thanks again.

Jim Richardson
        Anarchist, pagan and proud of it
WWW.eskimo.com/~warlock
        Linux, because life's too short for a buggy OS.




From jmassung at magpiesystems.com  Thu Apr 27 17:53:40 2000
From: jmassung at magpiesystems.com (Jeff Massung)
Date: Thu, 27 Apr 2000 15:53:40 -0600
Subject: Simple Modules Question
References: <8eaaul$16p@autodesk.autodesk.com>
Message-ID: <0A2O4.502$3j.5393@news.uswest.net>

Akira Kiyomiya wrote in message <8eaaul$16p at autodesk.autodesk.com>...

>from string import atoi    # imports 'string'
>                                     # places atoi in current namespace
>print atoi("12345")         # invokes 'atoi' without module name
>string.atoi("45")             # NameError: string

You didn't import "string", therefore "string" is not in namespace.

import string
print string.atoi("45") # prints 45
atoi("45") # NameError: atoi

A way around this:

import string
from string import *

Now you can use either string.atoi() or atoi() - but this is redundant.

Jeff




From bpetterson at uswest.net  Sun Apr  2 19:25:03 2000
From: bpetterson at uswest.net (Bjorn Pettersen)
Date: Sun, 02 Apr 2000 17:25:03 -0600
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E52716.A1C63B5D@roguewave.com>  <38E52D76.1820FC32@roguewave.com> <8c7tfd$k80$1@nntp9.atl.mindspring.net> <5gLF4.970$n68.190385152@newsb.telia.net>
Message-ID: <38E7D6CF.C6723ECD@uswest.net>

Fredrik Lundh wrote:

> Aahz Maruch wrote:
> > I'm sympathetic.  We only upgraded our production system from 1.5.1 to
> > 1.5.2 last week, because we'd made a number of 1.5.1-specific hacks and
> > had to back them out correctly for 1.5.2.
>
> we upgraded a customer site from 1.3 to 1.5.2 in november
> (distributed, mission critical, many gigabytes per day, custom
> interpreters, lots of C and C++ extensions, etc).
>
> catching up with changes in Python and its standard libraries
> was a very small part of the total effort.  getting it all to work
> on a new version of the operating system was much harder...

Very good points -- to upgrade a system there is a certain amount of
planning, and you have to carefully implement the result of your planning to
minimize any unavoidable downtime.  For some organizations this might not be
required, but I can't think of a comercial one where it isn't.  This takes
real time and costs real money, and sooner or later someone will have to do a
cost/benefit analysis of whether the cost of upgrading to Python 1.6 is worth
the benefits.  In my situation the cost would currently outweigh the
benefits, so I will hold off on transitioning until that changes.  For anyone
working in a software company, this should hardly be surprising (?)

-b





From mikael at isy.liu.se  Wed Apr 12 03:49:30 2000
From: mikael at isy.liu.se (Mikael Olofsson)
Date: Wed, 12 Apr 2000 09:49:30 +0200 (MET DST)
Subject: Huh? func_defaults, default values in function calls
In-Reply-To: <38F3EBBF.7B23@marshall.edu>
Message-ID: 

On 12-Apr-00 Mark Hathaway wrote:
 >  This way you'll never really know what the default is going to be.
 >  Ha ha ha ha. that's pathetic.

Actually, it's a feature. It makes it possible to have a local variable
that survives from one call of the function to another.

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson 
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    12-Apr-00
Time:    09:46:57

This message was sent by XF-Mail.
-----------------------------------------------------------------------


From warlock at eskimo.com  Tue Apr  4 02:10:40 2000
From: warlock at eskimo.com (Jim Richardson)
Date: Tue, 04 Apr 2000 06:10:40 GMT
Subject: opening a serial port at a given baudrate. How?
Message-ID: 

I am looking at using python for a simple app to control an embedded system
for testing, the system is controlled via a standard 3 wire serial port, 
at 9600baud, 8-N-1. The problem is, I can't seem to find any info on opening
a serial port in python!. (I am using linux for developement, but would
like to be able to use the app on any python system, it is text only, no
gui, at least for now. ) Am I just being dense? I mean there has got to be 
info on this out there, so please, flame away if you must, but point me 
to where to find it please...

(crouches behind hopefully flame-proof shield... :)

-- 
Jim Richardson
	Anarchist, pagan and proud of it
WWW.eskimo.com/~warlock
	Linux, because life's too short for a buggy OS.



From genehilton at my-deja.com  Fri Apr 21 15:11:47 2000
From: genehilton at my-deja.com (genehilton at my-deja.com)
Date: Fri, 21 Apr 2000 19:11:47 GMT
Subject: accessing BLT vectors from C
Message-ID: <8dq957$tc8$1@nnrp1.deja.com>

Has anyone out there written anything that will enable me to access
the BLT C api.  I am using BLT as a part of a data acquisition
system.  It works great, but filling the vectors is really slow in
python.  I wrote a python module in C to use the Blt c api, but it can't
find the vectors I created with Pmw.Blt.Vector().  I can access (in the
c module) vectors that I create in the c-module.  This must be some sort
of TCL thing I don't understand.  Here is a snippet from the C module


        if (!PyArg_ParseTuple(args, "OO",&master,&bltobj)) return NULL;

/* get the name of the vector - PMW stores it as the repr. */
        bltobjname=PyObject_Str(bltobj);
        if (!bltobjname) return NULL;
        bltname=PyString_AsString(bltobjname);
        if (!bltname) return NULL;
        printf("%s\n",bltname);
/* get the interpreter from an argument (for now) */
         interp=((TkappObject *)master)->interp;

/* this doesn't work (returns a 0) */
	printf("%d\n",Blt_VectorExists(interp,bltname));
        printf("%d\n",Blt_CreateVector(interp,"myvec",1,&vec));
/* this works (returns a 1) */
        printf("%d\n",Blt_VectorExists(interp,"myvec"));

I call it with the following python code

import Tkinter
import Pmw
import mymod
v=Pmw.Blt.Vector(1)
mymod.myroutine(master.tk,v)
v=Pmw.Blt.Vector(1)

I get an output like
0     (couldn't find it - v created in python)
0     (created ok in c)
1     (found the one created in c)

Any pointers would be real helpful

Gene Hilton
hilton at boulder.nist.gov


Sent via Deja.com http://www.deja.com/
Before you buy.


From wrd at awenet.com  Thu Apr 27 19:17:41 2000
From: wrd at awenet.com (William R. Dickson)
Date: Thu, 27 Apr 2000 16:17:41 -0700
Subject: Still problems running script from cron
Message-ID: 

Hi all,

I posted a while ago about a script that runs fine from the command 
line, but hangs when run from cron.  I've made progress, but am not all 
the way there yet.  Many people suggested helpful ways to redirect 
stdout into files, but they had no effect.  I eventually managed to get 
past the point where it was hanging by changing:

os.system("%s -c %s -n %s -o %s %s" % (webalizer, conffile, self.server, 
outputdir, self.currlog))

to:

rv = os.system("%s -c %s -n %s -o %s %s" % (webalizer, conffile, 
self.server, outputdir, self.currlog))

It then stopped hanging there.  Now it hangs when my forks are supposed 
to close, here:


children = 1

for server in servers:
  child = os.fork()
  if child == 0:            # Fork returns 0 in the child; if this is now
    break                   # a child, we want out of the loop.
  else:
    children = children+1   # Otherwise, we check to see if we're already
    if children > C:        # at the max number of processes; if not, we
      rv = os.wait()        # go to the top of the loop and fork another.
      children = children-1 # Otherwise, we wait until a fork closes.



The end of the child process looks like this:


# When both server stats and user stats are completed, we can finally get
# rid of the daily log and close the fork.
    
os.remove(nicelog)
      
print ("+ %s  %s %s: No problems detected; closing fork."
       % (strftime(T, localtime(time())), procdate, id))

sys.exit()  # I've also tried using return here with no change


When run from cron, the message "No problems detected; closing fork." 
prints as expected, but the child process never closes, according to ps.  
When run from the command line, it closes as expected.

Any idea why this might happen?

Thanks,

-Bill


From haering at informatik.tu-muenchen.de  Thu Apr 27 20:38:26 2000
From: haering at informatik.tu-muenchen.de (haering at informatik.tu-muenchen.de)
Date: Fri, 28 Apr 2000 00:38:26 +0000
Subject: HTML parser example, anybody?
In-Reply-To: <3908909D.4022A846@roguewave.com>
References:  <3908909D.4022A846@roguewave.com>
Message-ID: <20000427223825Z12160-466+9398@hpsystem14.informatik.tu-muenchen.de>

In comp.lang.python, you wrote:
>Why don't you just use Python's string syntax, e.g. if you have the
>following in a template file called foo.templ:
>
>   %(title)s
>   

%(heading)s

> >you can do something like: > > htmlfile = open('foo.html', 'w') > replacements = { > 'title': 'my title', > 'heading': 'A Heading', > } > htmlfile.write( open(foo.templ).read() % replacements ) > htmlfile.close() > >-- bjorn > Thanks for the info, but I'd rather transform HTML -> HTML. My current project uses special comments of the form . I'd like to parse for comments and filter out + process these. The prime reason for a real parser is that I need to rewrite all links in the HTML source tree and do some other checks. Gerhard From jstok at bluedog.apana.org.au Tue Apr 18 12:08:33 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Wed, 19 Apr 2000 02:08:33 +1000 Subject: Editors and books References: Message-ID: Jeff Massung wrote in message ... >First, I'd like to give my undying praise to PYTHON: Essential Reference, by >David M. Beazley. I'm an accomplished C/C++ programmer who wanted to learn >Python. This book was IT! Anyone whose reading this that is in my shoes - >get this book! It's some of the best $35 I've spent! I like the book a lot too. Sure, a lot of it is duplicated in the online material, but it's concise, better presented, and perfect for the accomplished programmer who can learn other languages fast. >Also, on another NG there's talk about Python, and how it does (and still >doesn't) do garbage collecting. Could someone here expand on it so I know >what it can and can't do? Memory is a big issue in my project and I need to >know how to structure my program so that garbage is collected. Thanks >again!! Python uses a reference counting scheme to collect unused objects. Each object stores a count of how many references refer to it. When this drops to zero, the object is deallocated. This scheme has the usual drawbacks of reference counting -- if there's a data structure whose object reference graph involves cycles (eg a doubly linked list) the reference counts of those objects will never reach zero because they refer to each other, even if the base of the list becomes unreachable. To deal with this you need to create specific destruction routines for your data structures that run through and break these references, eg by setting them to null. This is annoying, but since you're used to C++ you're used to it (it's the same scheme used by reference counting smart pointers.) There's no language-level reason why Python can't have true garbage collection, and in fact true garbage collection for Python has recently been implemented and with luck we'll see it become a standard part of Python implementations. >-- Jeff Massung (jmassung at magpiesystems.com) >-- Lead programmer for Magpie Systems >-- Bringing smart pigs to the pipeline industry! Oh wow! I bet that's more interesting than working on inventory databases or visual basic scripts.... From dgobbi at minime.irus.rri.on.ca Thu Apr 20 19:49:31 2000 From: dgobbi at minime.irus.rri.on.ca (David Gobbi) Date: 20 Apr 2000 23:49:31 GMT Subject: Python and VTK and TK References: <38F51AB1.29FB4C1D@earthlink.net> Message-ID: <8do52b$ina$1@panther.uwo.ca> Scott Harris wrote: > Has anyone gotten VTK to work with the TkRenderWidget? > I've got a simple code that draws two buttons and a vtkTkRenderWidget in > a frame. > It works under win98, but crashes my XServer on Linux. Hi Scott, I've used the vtkTkRenderWidget with XFree-3.9.18 and there weren't any problems -- not with hardware acceleration though. In order to make it work, you have to either copy it into /usr/lib or setenv the VTK_TK_WIDGET_PATH environment variable to /vtk/python. Oh, and you must also configure VTK using --with-shared. I have had problems with vtk and accelerated glx under XFree-3.3.*, though... the glx doesn't define glIsTexture() and calls to this function will crash the server. This happens whenever VTK tries to release a texture. The 'fix' is simple but inelegant -- comment out the glIsTexture() line in vtkOpenGLTexture.cxx. If you get wxPython's widget working under Linux I'd like to hear about it. We're doing all our stuff in Tk, but we're certainly not satisfied with Tk as a GUI toolkit. We do 95% of our interaction through picking and dragging, though, so the toolkit we use doesn't matter all that much. - David -- David Gobbi, MSc dgobbi at irus.rri.on.ca Advanced Imaging Research Group Robarts Research Institute, University of Western Ontario > I'm using RH6.1 with XFree864.0 and a Voodoo3 card (so I have > accelerated GL rendering) > I've got VTK 3.1 > Anyhow, I'm going to try wxPython and it's VTK widget in the next few > days. > If you had to start a new moderately sized project would you use > wxPython or Tk? > -Scott Harris > scottrharris at earthlink.net From effbot at telia.com Tue Apr 4 16:59:26 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 04 Apr 2000 20:59:26 GMT Subject: Debugging Python 1.3 -> 1.5.2 (was Re: Python 1.6 alpha 1 released) References: <8cca93$9oh$1@nnrp1.deja.com> <8cdiaa$44i$1@slb7.atl.mindspring.net> Message-ID: Aahz Maruch wrote: > >1) stumbled upon one today: it turned out that by changing from 1.3 > >to 1.5.2, large data transfers from a high-performance server to clients > >on an 10 Mbit Ethernet were unexpectedly terminated. the same trans- > >fers worked just fine with high-performance workstations, on an FDDI > >network. ten guru points to anyone who can explain why. > > Not without a bit more info about the data transfer mechanism and the > error reported by client & server. okay, I'll trade you some info for three guru points: non-blocking AF_INET sockets. client read via socket.makefile, and got an unexpected end of line. server reported error in write callback. all code had worked flawlessly under 1.2 and 1.3, for several years. From phd at phd.russ.ru Thu Apr 13 06:18:24 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 13 Apr 2000 10:18:24 +0000 (GMT) Subject: simple httplib and urllib timeout question In-Reply-To: <1WbJ4.86$9B.7202@news.bc.tac.net> Message-ID: Hi! On Wed, 12 Apr 2000, darrell wrote: > Yeah I would love to: > a) check out your Internet Robot Download it here: http://sun.med.ru/~phd/Software/Python/#bookmarks_db - below the table, after the words "third, new, much improved version". Faster mirrors: http://members.xoom.com/phd2.1/Software/Python/ http://skyscraper.fortunecity.com/unix/797/Software/Python/#bookmarks_db > b) help out with any code Any help will be greatly appreciated! Start with looking into the code. What do you think about it all? Can you understand it? I need more plugins, so choose the area you want to touch: 1) database (storage) managers 2) writers 3) robots. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From noreply at nospam.org Sun Apr 30 19:05:23 2000 From: noreply at nospam.org (Brian) Date: Sun, 30 Apr 2000 23:05:23 GMT Subject: Discrepency between JPython and CPython References: Message-ID: Here is a list of differences you might find useful: http://www.jpython.org/docs/differences.html "Venkatesh Prasad Ranganath" wrote in message news:m3k8hfjlex.fsf at boss.ksu.edu... > Hi, > > Consider the expression str(1.14 * 200). > In CPython it yields 228.0 > In JPython it yields 227.99999999999997 > > Shouldn't this result in consistent values across variuos implementation? > If so, which of the implementation is buggy? > I think it is JPython, may be I am wrong. > > -- > Venkatesh Prasad Ranganath > > e-mail: rvprasad at cis.ksu.edu, rvprasad at ksu.edu > > Address: Department of Computing and Information Science, > 234 Nichols Hall, > Kansas State University, > Manhattan, KS 66506 > > Phone: (785)-532-6350 Extn: 48 > From phd at phd.russ.ru Mon Apr 17 10:20:02 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 17 Apr 2000 14:20:02 +0000 (GMT) Subject: Filtering web proxy Message-ID: Hello! I want a filtering web proxy. I can write one myself, but if there is a thing already... well, I don't want to reinvent the wheel. If there is such thing (free and opensourse, 'course), I'll extend it for my needs. Well, what are my needs? I am braindamaged idiot, who do not want to see banners, pop-ups and all the crap, so I run Navigator with graphics/Java/ Javascript/cookies turned off 99% of the time. But for some sites I need to go to preference dialog and turn it on manually. Then turn it back off before visiting another site. (I need frames, tables and other features, so I am not using lynx; yes, I know there are "links" and "w3m", and yes, I use them from time to time; anyway I run Navigator). It is tiresome. I want to automate the task. So I want to turn graphics/script/cookies forever on, but filter the crap in the proxy. For 99% sites I'll just remove the junk. For some sites (a list of which I'll care manually) the proxy will pass HTML, graphics and cookies unchanged (or a bit modified, 'cause in any case I don't want to eat Doubleclick's cookies attached to their ads). Once I tried Junkbuster, but found it inadequate. My need is simple - just a short list of "white" sites. Never tried adzapper... I wrote dozen HTML parsers in Python, so I can write one more, and turn it into a proxy, but may be I can start with some already debugged code? Oleg. ---- Oleg Broytmann http://phd.russ.ru/~phd/ phd2 at mail.com Programmers don't die, they just GOSUB without RETURN. From lewst at yahoo.com Sun Apr 2 19:17:57 2000 From: lewst at yahoo.com (lewst) Date: Sun, 2 Apr 2000 16:17:57 -0700 (PDT) Subject: NameError when assigning dictionary values Message-ID: <20000402231757.6604.qmail@web2105.mail.yahoo.com> Fredrik Lundh wrote: > if you want to create variables in the local namespace > on the fly, you're obviously trying to emulate some other > programming language (Tcl?) in Python. that's usually a > rather bad idea. I was trying to build a dictionary and create lists corresponding to the value names in the dictionary in one loop. Do I really have to type "one" and "two" twice? Once to make it a variable and a second time to add to my dictionary? I.e, >>> one, two = [], [] >>> mydict = { ".": one, "+": two } This seems error prone if the the number of variables grows very large as it will for me. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From mwh21 at cam.ac.uk Wed Apr 5 04:43:42 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 05 Apr 2000 09:43:42 +0100 Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <38EAF7A0.E372EB2C@myself.com> Message-ID: Wayne Izatt writes: > Books are one thing, but a regular printed journal would be especially > useful. A journal is visible, creates a strong sense of community, and is > an easy way to combine advanced and general Python topics in one tight > package. I wonder what the minimum number of Pythoners it would take to > keep something like that afloat? Hmm. There's http://www.pythonjournal.com but it's dormant; however the Python community seems to be growing exponentially (at least to judge by the volume on the newsgroup), so it's might be worth having another go. Of course this means getting people to write stuff, organising things, and general effort. I could spare a few hours to such a cause, but perhaps not in any useful way (do you *really* want an article about bytecodehacks ?). > lewst wrote: > > > Now something I can't quite figure out is: why are there so many more > > books on Perl out there than on Python? It's been more popular for longer. As I understand it, perl was created to do be the gaffer tape of a unix system, so people knew it when the web took off; however it seems that people are realising that it might be a good idea to use a real programming language. > > Searching through Fatbrain.COM (which is where I order my books from), > > I found 68 books, 4 training manuals, and 2 eMatter documents on Perl. > > Compare this to Python's 13 books and 2 eMatter documents. This is changing *very* fast - Learning Python is only, what, a year old - and that was the third real Python book (I think; there's PP and IPwP - I'm not counting the little reference book). [schnipp] > > At this point I wondered if my brain was just different than all those > > Perl junkies out there. But now I really don't think so; I think it's > > a question of awareness. Perl is very publicized and well-known while > > the better language is sitting here a dark corner unnoticed. Sure > > there will always be some religious fanatics that won't even give > > Python a try, but I think Python's popularity could be vastly improved > > with some serious advocacy work. CNRI and/or PSA should seriously > > look into funding a Python "marketing" campaign of sorts. I think the > > result would be allot of converts and more understanding and respect > > for Python. A year ago, I might have agreed with you; now I'm more concerned how the Python community is going to evolve as it grows. > > "The verdict: Python is *waaaay* cool! I'm sold. It's clean, it's > > elegant, it's easy, and it's astonishingly powerful. I'm not going > > to program anything longer than one screenful of script in Perl > > anymore. I love Larry Wall dearly, but Guido van Rossum is the > > better designer -- I haven't had this much fun with a language since > > the glory days of LISP. Eric sez check it out." Python rocks. I think it took me about a day to learn - it just fit so well with my way of thinking. I've now since learnt scheme, eiffel, haskell, common lisp and bits of sundry other languages, but I keep coming back to Python. Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From mwh21 at cam.ac.uk Thu Apr 20 09:26:26 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 20 Apr 2000 14:26:26 +0100 Subject: how do i pack and unpack messages in python? References: <008301bfaacb$42fe2c60$2801000a@iel.ie> Message-ID: "Shaun" writes: > so i have 3 values that i want to pack into a message so as the info can be > sent (but dont worry about th3 sending bit for the mo) Hmm, what are you sending the message to? Email? Some kind of IPC? An HTML form? I guess I don't understand what you want. > can anyone please tell me how id go about manipulating the strings so as i > can join them using field seperators, any ideas anyone, or even tell me > where i might find out how to do this problem. Have you tried the struct module? Cheers, M. -- "declare"? my bogometer indicates that you're really programming in some other language and trying to force Common Lisp into your mindset. this won't work. -- Erik Naggum, comp.lang.lisp From donb at init.com Mon Apr 17 17:20:31 2000 From: donb at init.com (Donald Beaudry) Date: Mon, 17 Apr 2000 17:20:31 -0400 Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> Message-ID: <200004172120.RAA11102@zippy.init.com> jimsp wrote: > How about > > >>> import random > >>> x = [0]*1000000 > >>> y = map(lambda x: random.randint(1,10), x) Hmm.... believe it or not that one is much closer to what I meant to type as my 'or better' example, than the rubbish that I did type ;) But, this one beats it (and I tested it this time ;). import random y = map(lambda x, randint=random.randint: randint(1,10), xrange(100000)) and this one is better still (at least on my machine): def do_it(): from random import randint r = [0,] * 100000 for i in xrange(100000): r[i] = randint(1,10) do_it() -- Donald Beaudry Ab Initio Software Corp. 201 Spring Street donb at init.com Lexington, MA 02421 ...Will hack for sushi... From ajung at sz-sb.de Wed Apr 5 02:00:43 2000 From: ajung at sz-sb.de (Andreas Jung) Date: Wed, 5 Apr 2000 08:00:43 +0200 Subject: Getting the argument names passed to a function ? In-Reply-To: ; from quinn@riyal.ugcs.caltech.edu on Wed, Apr 05, 2000 at 01:30:10AM +0000 References: <20000404225810.A12156@sz-sb.de> Message-ID: <20000405080043.A4282@sz-sb.de> > import sys > def arghack(arg): > try: > 1/0 > except: > frame = sys.exc_info()[2].tb_frame.f_back > while frame: > for k, v in frame.f_locals.items(): > if arg is v: > return k > frame = frame.f_back > else: > return None That's the perfect solution I was looking for :-) Thanks ! Cheers, Andreas From embed at geocities.com Thu Apr 27 13:46:55 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 27 Apr 2000 13:46:55 -0400 Subject: Python Time classes References: Message-ID: "phil hunt" wrote in message news:slrn8ge5b0.1gu.philh at vision25.demon.co.uk... > Is there a high-level Time class for Python? > > I'm aware of the 'time' module in the standard library. But I'm > looking for something more high-level (I can't find anything > relevant on Parnassus or Freshmeat). What I want is roughly the > ability to say things like: > > t1 = Time.now() > # (t1) is an instance of Time containing the time now > > t2 = Time(2000, 4, 26, 17, 4, 0) mxDateTime does exactly this and more. It even comes with nifty code to synchronize you with an atomic clock, and a variety of wrapper classes designed for various purposes. It can handle historical dates (dates before the Unix epoch, Jan 1, 1970) and can handle the milliseconds component of Time values without problems, as well as handling day of week, leap-years, and even includes code for algorithms for moveable feasts (When is Easter Sunday in the year 2143, for instance.) The core date time object is written in C, and all the extraneous stuff is in Python modules (.py), which is pretty nice. I hope they rename mxDateTime to DateTime and roll it right into the stock Python distribution at some point. It just seems "right" to me that Python should include a powerful date and time handling object as a native type, along with lists, dictionaries, tuples, and other objects. Warren From hank at prosysplus.com Sat Apr 22 09:33:13 2000 From: hank at prosysplus.com (Hank Fay) Date: Sat, 22 Apr 2000 13:33:13 GMT Subject: Using python on the web References: Message-ID: Hi Ken, An article on Python Server Pages appeared in two parts recently in DDJ. The web site associated with the article is at http://www.ciobriefings.com/psp/. Chuck's announcement of WebWare in this group is just as exciting, since it gets rid of the overhead of the servlet engine; putting together "server pages" in Visual FoxPro on Wintel was a snap using a similar tool that only (of course) works on WinTel. I'm looking forward to doing the same with Python, using WebKit as the tool. Hank Fay -- http://www.prosysplus.com "Ken McCracken" wrote in message news:FtEE3B.Ar2.0.bloor at torfree.net... > Brent Fulgham (brent.fulgham at xpsystems.com) wrote: > : A couple of questions: > > : > : > We build medium-busy, CGI-intensive sites in Python. We were briefly > : > quite excited about Zope, but once we realized it locked us into Yet > : > Another Programming Language, we lost interest. DHTML is particularly > > I'm a bit of an armchair programmer, but it would seem that JSP nad > Jpython and a Db could be put together to end up with a zopelike result, > without language lockin. No? > > Ken McCracken > Toronto From sholden at bellatlantic.net Sat Apr 8 07:52:39 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sat, 08 Apr 2000 11:52:39 GMT Subject: Cacheing sys.path rather than building it each time? References: <2e070214.0e300ac8@usw-ex0108-063.remarq.com> Message-ID: <38EF1B53.D21A7514@bellatlantic.net> Hamish Lawson wrote: > > Some overhead in Python's startup time is caused by building > sys.path. Of course you could use the -S option, but then you > don't get a proper sys.path! What about cacheing the constructed > path and a command-line option to specify use of that rather > than building it each time? Presumably you'd also need a tool to > rebuild the path when necessary - perhaps it could be invoked > automatically by the distribution tools whenever a new module > gets installed. > > Hamish Lawson > > * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * > The fastest and easiest way to search and participate in Usenet - Free! Probably not an awfully good idea, given that "installation" of a new module often consists of just dropping a ".py" file into a library directory. Without an common"install" process the work of checking whether the cahced path is up to date would be almost as much as that of building the path from scratch as is now done. Unless, that is, someone else knows different... regards Steve -- "Bulding information systems just because it's fun." Steve Holden sholden at bellatlantic.net 703 716 7275 From herzog at online.de Mon Apr 3 08:57:47 2000 From: herzog at online.de (Bernhard Herzog) Date: 03 Apr 2000 14:57:47 +0200 Subject: List and Dicts as default args References: <326536345498D311B3BC00105A39802A074654@newsintern.dspace.de> Message-ID: "Fredrik Lundh" writes: > Stefan Migowsky wrote: [mutable default parameters] > > I could try the following but that doesn't look so nice: > > > > def f(Index,List = None, Dict = None): > > if not List: List = [] It's probably better to test whether List is None: if List is None: List = [] Otherwise, if you actually call f with an empty list as the second parameter, you'll still create a new list object and won't modify the list that was passed in. > > List.append(1) > > List.append(2) > > print List > > if not Dict: Dict = {} The same applies here. > > Dict[Index] = Index > > print Dict > > nice or not, that's the right way to do it. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From donn at u.washington.edu Thu Apr 13 12:44:14 2000 From: donn at u.washington.edu (Donn Cave) Date: 13 Apr 2000 16:44:14 GMT Subject: 1st non-trivial program - gentle criticism requested References: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> Message-ID: <8d4tgu$11qa$1@nntp6.u.washington.edu> Quoth p.agapow at ic.ac.uk (Paul-Michael Agapow): | I'm experimenting with Python for a number of purposes (an embedded | language for simulations, a tool for exploring experimental data, a good | first programming language) and so I've cobbled together my first | non-trivial program. With some trepidation, I post it here in the hopes | that experts will be able to coach me in "The Python Way". I realise it | looks like C++ (my usual langauge), but criticisms of style would be | useful too. OK: It looks too much like C++! You don't need to end lines with ;. You don't need to surround expressions with () in an if statement. It's not the worst of sins, but you might as well ditch this stuff. As for the data structures, like "Alex" I would think about more classes and fewer module globals. This is not a critical flaw, assuming your program works, but as a general rule the class is your most adaptable programming tool and to benefit from it, you have to use it. As an exercise, rewrite so the only module level statements are "import", "class" and "if" (i.e., if __main__...) That tends towards the other extreme of usage, inasmuch as it is really very common to use a few module level functions or global constants. It's just an exercise, not a religious mandate. In the course of the exercise, you may find yourself in territory where good usage is somewhat controversial. For example, objects other than methods are legal and fairly common in "class" scope, but there are some pitfalls to this that worry some people. Experiment, look for the properties of an object defined in class scope when seen through the class instance ("self"), vs. when accessed directly via the class. There's a builtin max() that I think can do the work of your findMax. I have plenty of these in my programs: print "The alphabet is '" + gAlphabet + "'" but today I prefer print "The alphabet is '%s'" % gAlphabet because of the greater tolerance for objects that are not really strings but have string representations. (OK, it's a string, but what will happen if you later change this object to something else?) Donn Cave, donn at u.washington.edu From rogerha at ifi.uio.no Mon Apr 17 08:11:29 2000 From: rogerha at ifi.uio.no (Roger Hansen) Date: 17 Apr 2000 14:11:29 +0200 Subject: Python tools for PDE and Linear algebra References: <38F75987.26AD3FEA@oreilly.com> Message-ID: * Me > > Does anyone know > > some PDE tools or are working on such projects? Support for different > > numerical methods as Finite Difference and Finite Element Methods > > would be nice. * Stephen R. Figgins > I don't know of any in Python, Roger, but there are some free > libraries available for C++. You can find them listed at: > > http://oonumerics.org/oon/ > > You might be able to adapt one of these, rewrite it in python or > maybe just call it from python. > > I expect these would be rather computationally expensive, and so you > might be better off with having them written in C or C++. Yes, there are several libraries for these things in C/C++. But since I find Python a much better programming language than C++ I'd like to use Python. I realize that I then might have to wrap an existing library. But that may be a rather big job, especially wrapping a C++ library, so if anyone has done this already I'd be very happy. :-) TTFN, Roger From mwh21 at cam.ac.uk Thu Apr 20 16:19:08 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 20 Apr 2000 21:19:08 +0100 Subject: can't find SWIG for Python References: <38FF5A56.F76794D8@sec.noaa.gov> Message-ID: j vickroy writes: > Hello all, > > I have been unable to locate SWIG for Python. My references list > www.swig.org but the server can not be found. Egad, you're right. This is getting a bit familiar... > Could someone point me to the site or provide some other Win 32 options > for easing the process of extending Python to use existing C libraries. My local mirror (www.mirror.ac.uk) has about a bazillion different copies of it; maybe you can get one of them to work? 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/~perlis-alan/quotes.html From bwinton at tor.dhs.org Mon Apr 10 16:02:40 2000 From: bwinton at tor.dhs.org (Blake Winton) Date: Mon, 10 Apr 2000 20:02:40 GMT Subject: Why should I switch to Python? References: Message-ID: On Fri, 31 Mar 2000 19:43:58 -0800, Aaron Turner wrote: >I've been coding Perl for over 3 years and really like it. (Especially >it's syntax and ability to grok my programming style.) Now, just as a side note, why is it that the sets of The Perl Hackers I Know, and The People I Know Who Use The Word "Grok" are the same set? Just wondering, Blake. -- 2:54pm up 12 days, 15:28, 1 user, load average: 1.08, 1.02, 1.01 From nickm at mit.edu Thu Apr 20 00:12:26 2000 From: nickm at mit.edu (Nick Mathewson) Date: Thu, 20 Apr 2000 04:12:26 GMT Subject: pattern-based string expansion References: <38F52C61.A5D72F89@gte.net> <8del87$5md$1@slb6.atl.mindspring.net> <38FE70DB.29A4B1A1@gte.net> Message-ID: On Thu, 20 Apr 2000 02:51:50 GMT, sue wrote: >I'm not looking for all possible strings with a wildcard, >just a pseudo-RE-based expansion. The RE would not support >open-ended arguments (* or +), but would have ?,[] and so >on. >The expansion needs to be ordered. > >I've thought about hacking the glob(3) code to work on an >input RE, but I was hoping this already existed somewhere. Well, the code below will probably only be useful to a hacker, but if you're prepared to hack glob(3), this should be a snap. It's a very very simplified version of (a subset of (a more general regex-manipulation module for (a project that I'm working on))). I didn't need an expansion function for my project, but it was pretty easy to hack one up. ============================================================ #!/usr/bin/python import string def expand_re(s): '''Given a regular expression, returns all a list of all possible expansions. It supports (), |, [], ?, \[dwsDWS], and '.'. The backslash character escapes any other character. Example: expand_re('spam( spam( spam[!?]?)?)?|Bloody Vikings!') => [ 'spam spam spam!', 'spam spam spam?', 'spam spam spam', 'spam spam', 'spam', 'Bloody Vikings!' ] BUG: Only mildly tested. BUG: Doesn't catch bad regular expressions, or give good error messages. BUG: Isn't very fast or efficient. BUG: Can't handle character escapes within []. BUG: Can't handle [^...]. BUG: Doesn't support unicode. BUG: Doesn't support case-insensitive matching. BUG: Always assumes that . should match newline. BUG: Doesn't support +, *, {n,m}. In order to do these, we'd need a function to only consider expansions up to a certain length, or to only return the first n expansions. ''' re, pos = _parseRE(s,0) return re.get_expansions() def _parseRE(s, pos): '''Does the dirty work of parsing a regular expression from string 's', starting at position 'pos'. Returns the Seq/Alt/Opt/Charset object corresponding to s, along with the position immediately following returns element, end tuple''' # First, we find all the elements in s. Elements are: # (groups) # [character sets] (also '.', \d, and friends.) # characters # optional-elements? # | elements = [] while pos < len(s): ch = s[pos] if ch == '(': group, pos = _parseRE(s, pos+1) pos = pos-1 elements.append(group) elif ch == ')': pos = pos + 1 break elif ch == '\\': next = _special.get(s[pos+1], None) if next: elements.append(next) else: elements.append(s[pos+1]) pos = pos + 1 elif ch == '[': chrs = [] while 1: pos = pos + 1 ch = s[pos] if ch == ']': break chrs.append(ch) elements.append(CharSet(string.join(chrs,''))) elif ch == '?': elements[-1] = Alt([elements[-1], '']) elif ch == '|': elements.append(None) #HACKHACK elif ch == '.': elements.append(_allChars) else: elements.append(ch) pos = pos + 1 # Now we compact all adjacent characters into strings. This will help # our efficiency in the end, I think. The revised list is stored in # 'els'. els = [] cur_str = None for el in elements: if type(el) == type(''): if cur_str is not None: cur_str = cur_str + el else: cur_str = el else: if cur_str is not None: els.append(cur_str) cur_str = None els.append(el) if cur_str: els.append(cur_str) # Now we go through the list to look for vertical bars -- encoded as # None. We find all alternatives within the current group. groups = [] cur_group = [] for el in els: if el is None: groups.append(cur_group) cur_group = [] else: cur_group.append(el) groups.append(cur_group) # If there's more than one alternative, return an Alt object. Otherwise, # a Seq. if len(groups) == 1: return Seq(groups[0]), pos else: return Alt(map(Seq,groups)), pos class Seq: '''This class represents a series of regular expression elements, one following another''' def __init__(self, members): self.members = members def get_expansions(self): member_expansions = map(_expand, self.members) return _joinings(member_expansions) class Alt: '''This class represents a choice between two or more elements.''' def __init__(self, alternatives): self.alternatives = alternatives def get_expansions(self): member_expansions = map(_expand, self.alternatives) ex = [] for el in member_expansions: # This is a hack; I'd rather say 'ex.extend(el)', but not # everyone is using Python >=1.5.2 ex[len(ex):len(ex)] = el return ex class CharSet: '''This class represents a group of possible characters, such as [abc] or \d' ''' def __init__(self, characters): self.characters = list(characters) def get_expansions(self): return self.characters def _expand(element): '''Returns the expansion of an element.''' if type(element) == type(''): return [ element ] else: return element.get_expansions() def _joinings(lst): ''' Takes a list of lists of strings, such as [ ['a1','a2'], ['b1, b2']]. Returns a new list consisting of the joins of one member from list1, one from list2, and so forth. (Such as ['a1b1','a1b2','a2b1','a1b2']) ''' prefixes = [''] for sublist in lst: next_prefixes = [] if len(sublist) == 0: return [] for prefix in prefixes: for el in sublist: next_prefixes.append(prefix + el) prefixes = next_prefixes return prefixes _allChars = CharSet(string.join(map(chr,range(0,255)),'')) _special = { 't' : '\t', 'n' : '\n', 'r' : '\r', 'f' : '\f', 'e' : '\e', 's' : CharSet(' \t\n\f\r'), 'd' : CharSet(string.digits), 'w' : CharSet(string.letters + string.digits + "_"), 'W': CharSet(map(chr, [32,96] + range(0,48) + range(58,65) + range(91,95) + range(123,256))), 'S': CharSet(map(chr, [65,11]+range(0,8)+range(14,32)+ range(33,92)+ range(93,256))), 'D': CharSet(map(chr, [32]+range(0,48)+range(58,256))) } if __name__ == '__main__': import sys expr = sys.argv[1] for el in expand_re(expr): print el ============================================================ Was that about what you had in mind? Delurkingly-yrs -- Nick Mathewson http://www.mit.edu/~nickm/ From m.faassen at vet.uu.nl Sun Apr 9 19:22:00 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 9 Apr 2000 23:22:00 GMT Subject: Tuples -- who needs 'em References: <1256882636-27643467@hypernet.com> Message-ID: <8cr3ao$j40$1@newshost.accu.uu.nl> [Bob] >> > This sort of thing >> > happens in exploratory programming, so when in that mode one might want to >> > use lists unless one is really sure in advance that tuples are the right >> > thing. [Gordon] > By all means, use lists whenever you're unsure. You'll soon > come to recognize when a tuple is more appropriate. It won't > take long (it couldn't, Martijn's too young to have taken long to > learn anything ). Heh. Hey, perhaps I'm just very bright? Nah, impossible. I didn't understand half of the 'Perl versus Python' math thread. :) Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From thomas.heller at ion-tof.com Mon Apr 17 14:48:25 2000 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Mon, 17 Apr 2000 20:48:25 +0200 Subject: import disappointment Message-ID: <002b01bfa89d$834c49d0$4500a8c0@thomasnb> After playing with 'import' and __import__ for quite some time I discovered that neither ihooks nor knee works correctly. Put import ihooks ihooks.install() into your sitecustomize.py and start Pythonwin: it will fail. There are several problems here: 1. reload does not what it should (I submitted a patch for ihooks to correct this problem, the same technique must be used for knee). 2. ihooks does not import modules via the registry: there is a bug report in the python bug list for this one, I will also submit a (partial) patch for that. 3. Another yet unfound problem Using imputil is out of question because most programs including pythonwin are only expecting strings in sys.path. Before I use more work on this: Has anybody a version which really works correctly? Thomas Heller From kern at caltech.edu Sat Apr 29 18:59:25 2000 From: kern at caltech.edu (Robert Kern) Date: 29 Apr 2000 22:59:25 GMT Subject: Where can I find NumPy References: <8ef4pn$jge$1@kopp.stud.ntnu.no> Message-ID: <8efpgd$c49@gap.cco.caltech.edu> In article <8ef4pn$jge$1 at kopp.stud.ntnu.no>, Jan Erik Breimo writes: > The official site (ftp-icf.llnl.gov) hasn't been responding for more than > a week, so are there any other sites where I can find the source > files for NumPy? http://numpy.sourceforge.net > -- > Jan Erik Breimo > email: janeb at stud.ntnu.no -- Robert Kern kern at caltech.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter From steven at nospam.trance.org Sun Apr 30 13:16:41 2000 From: steven at nospam.trance.org (Steven) Date: Sun, 30 Apr 2000 18:16:41 +0100 Subject: xitami configuration? Message-ID: I'm just starting out with python after programming php3 for the past 8 months and i'm trying to set it up with xitami. could an xitami/python user please tell me what line to add to my filters section in the setup file? I tried: .py=D:\progra~2\python\python.exe which will envoke python and run a simple script fine, but won't pass any arguments (unless i'm doing it wrong). If this is correct, how do i pass arguments to a script? From markx.daley at intel.com Mon Apr 24 19:19:23 2000 From: markx.daley at intel.com (Daley, MarkX) Date: Mon, 24 Apr 2000 16:19:23 -0700 Subject: Tkinter Message-ID: I am trying to use Tkinter for a GUI interface, but I am having a hard time finding manuals for it. Is there documentation comparable to Python's? Also, is there a demo script floating around anywhere that gives generic examples for common GUI functions or widgets? TIA - Mark From chaitin at watson.ibm.com Sat Apr 8 10:33:50 2000 From: chaitin at watson.ibm.com (chaitin at watson.ibm.com) Date: Sat, 08 Apr 2000 14:33:50 GMT Subject: math vs physics References: Message-ID: <8cng0e$gcu$1@nnrp1.deja.com> In article , neelk at alum.mit.edu wrote: > > I tend towards Chaitin's view: "Axioms are very cool -- make some > more up! After all, mathematics is basically arbitrary anyway!" I > guess this shows I am really a frustrated Hilbertist at heart. :) > You might enjoy my latest talk. You can find it at http://www.cs.umaine.edu/~chaitin/cmu.html Rgds, Greg Chaitin Sent via Deja.com http://www.deja.com/ Before you buy. From Michael.Scharf at gmx.de Tue Apr 4 19:46:05 2000 From: Michael.Scharf at gmx.de (Michael Scharf) Date: Wed, 05 Apr 2000 01:46:05 +0200 Subject: Q: Status of SOAP (Simple Object Access Protocol)? Message-ID: <38EA7EBD.BE75C460@gmx.de> I am wondering, what the current python-SOAP status is? (about SOAP http://www.develop.com/soap/) That's what I found on the net: - Digital Creations announced SOAP support (couldn't figure out, what the status is) - Fredrik Lundh said some time ago, he's working on it.... We are currently (happily) using XML-RPC (http://www.xmlrpc.com/), but the future seems to be SOAP.... On the other hand, SOAP seems more complicated than XML-RPC. Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software GmbH, a Wind River Company ` > http://www.WindRiver.com \_ V mailto:Michael.Scharf at gmx.de From wware at world.std.com Wed Apr 26 20:46:49 2000 From: wware at world.std.com (Will Ware) Date: Thu, 27 Apr 2000 00:46:49 GMT Subject: Python compiler ? (was Re: Python for drivers?) References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> <3906f804@nntp.server.uni-frankfurt.de> <015b01bfaf8b$9cd03930$0500a8c0@secret.pythonware.com> <39076316@nntp.server.uni-frankfurt.de> <8e7sop$5io$1@nnrp1.deja.com> Message-ID: gchiaramonte at my-deja.com wrote: > How about $100 each? Then we only need 600 users. If his compiler > really works, count me in. That's not a bad price per-person, but what are the chances that he'd be willing to open-source it? He seems to regard this as a revenue generator, so he'd likely consider the source code (or at least a large fraction of it) a trade secret. I'd also be willing to kick in $100 for an efficient Python compiler, but only if it were open source. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From moshez at math.huji.ac.il Sun Apr 23 02:47:00 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 23 Apr 2000 09:47:00 +0300 (IDT) Subject: code not true? In-Reply-To: Message-ID: On Sun, 23 Apr 2000, Kragen Sitaker wrote: > How many decimal digits are needed to make sure that 3 * (1/3) is > indistinguishable from 1? moshe-bombei:/home/moshe>python Python 1.5.2 (#1, Feb 21 2000, 14:52:33) [GCC 2.95.2 19991024 (release)] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> (1.0/3)*3 == 1 1 Less then 17 From sholden at bellatlantic.net Thu Apr 6 17:34:41 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 06 Apr 2000 21:34:41 GMT Subject: More about variables References: <3X3H4.16435$0o4.108310@iad-read.news.verio.net> Message-ID: <38ED017E.1E374737@bellatlantic.net> Matthew Hirsch wrote: > > Why create named variables? > > I always thought that having 20 lists saved more space than having one > list of 20 lists. Maybe I'm wrong. > > Thanks for your help, > Matt > First make it work. *Then* make it work better! If you have to be this concerned about optimization so early in your development you must be working in a VERY restricted environment... Python is great at all kinds of stuff. Let the language do what it's good at, and optimize only when performance or resource usage gets the better of you! regards Steve > In article <3X3H4.16435$0o4.108310 at iad-read.news.verio.net>, > culliton at clark.net (Tom Culliton) wrote: > > > What (or maybe what do you think) you are trying to do? Most likely > > you would be better off with just a list or tuple if you're dealing > > with and unknown number of data items. Not everything needs a name, > > and there isn't much difference between: > > > > v0, v1, v2, v3, v4, v5 > > > > and > > > > v[0], v[1], v[2], v[3], v[4], v[5] > > > > Why do you think this variable length collection of data needs > > individual names? > > > > Now, if after consideration there is still some compelling reason to > > generate names, you can use something like this with a dictionary > > (possibly the one returned by globals()): > > > > v = {} > > for i in range(number_of_variables): > > name = "variable%d" % i > > v[name] = [] > > > > But again, Why? > > > > In article , > > Matthew Hirsch wrote: > > >Hi All, > > > > > >Let's say I had something like: > > > > > >number_of_variables=int(raw_input('Enter number of variables: ')) > > > > > >if number_of_variables==1: > > > variable1=[] > > >elif number_of_variables==2: > > > variable1=[] > > > variable2=[] > > >elif number_of_variables==3: > > > variable1=[] > > > variable2=[] > > > variable3=[] > > >elif number_of_variables==4: > > > variable1=[] > > > variable2=[] > > > variable3=[] > > > variable4=[] > > >elif number_of_variables==5: > > > variable1=[] > > > variable2=[] > > > variable3=[] > > > variable4=[] > > > variable5=[] > > >else: > > > print 'else' > > > > > >Is there a more efficient way of doing this? What if I wanted to create > > >100 variables (lists). It doesn't make sense to write an if statement > > >for that many conditions. > > > > > >Thanks for your help, > > >Matt -- "Bulding information systems just because it's fun." Steve Holden sholden at bellatlantic.net 703 716 7275 From reic0024 at ub.d.umn.edu Fri Apr 21 01:16:48 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Fri, 21 Apr 2000 00:16:48 -0500 Subject: Mac Python Questions In-Reply-To: <956247497.216189@fezzik.endicor.com> References: <38FE8032.DE233C29@cosc.canterbury.ac.nz> <956247497.216189@fezzik.endicor.com> Message-ID: On 20 Apr 2000, Kent Polk wrote: > The standard Python installation program installed the wrong version > of the _tkinter shared library and(/or) didn't set the path to the > correct (ppc) version, so Python couldn't load _tkinter. If that > is the problem, there are several ways to solve it. If that isn't > the problem, I'm not sure what to tell you as it's working on I > think 3 or 4 different mac platforms here. That's my problem. I'm using OS 9, and I even added a path to where Tkinter appears to be, but it still cannot find _tkinter. This problem has been known for a while (I've heard of it since at least 1.5.1 as being just a screw up with the path), so why hasn't it been fixed? Aaron ----- "The best way to predict the future is to invent it." -- Alan Kay From wware at world.std.com Wed Apr 26 15:28:42 2000 From: wware at world.std.com (Will Ware) Date: Wed, 26 Apr 2000 19:28:42 GMT Subject: Simple Function Question References: <8e7dh3$1gc@autodesk.autodesk.com> Message-ID: Akira Kiyomiya (akira.kiyomiya at autodesk.com) wrote: > This function prints out '4' and I have a feeling that x=1 and n=3, so > add1(3) prints '4'. > However, I have a difficlut time trying to see how these two arguments > assigned to both x (especially x) and n. > def make_incrementer(n): > def increment(x, n=n): > return x+n > return increment > add1 = make_incrementer(1) > print add1(3) # This prints '4' When you run make_incrementer(1), let's see what happens. You've given it an argument of 1, which is given the name 'n' inside the body of make_incrementer. Within that body, you come to 'def increment...' which, as you know, defines a function. The notation 'n=n' means that increment can be called with either one argument or with two arguments, and if it's called with one argument, then its second argument will assume a default value. That value is 'n' (taken from its value within the body of make_incrementer), so when you later say 'make_incrementer(1)' that default value becomes 1. The next thing that happens is that make_incrementer returns this function; in Python, functions are objects that can be passed or returned, just like numbers, strings, lists, dictionaries, or class instances. So this function is given the name 'add1'. When you call 'add1(3)', the function (originally called incrementer, and with 1 as the default value for its second argument) takes 3 as the first argument, adds its two arguments, and returns the sum (4) which gets printed. The first tricky idea here is that functions can be passed like any other object. You'll be familiar with this if you've used Lisp or Scheme, or Postscript, and probably other languages that escape me now. In C, a function is pretty tightly connected to its original name; you can pass pointers to functions but not the function itself. And the only way to hide the name is to declare the function static, and then it's only hidden outside that particular source file. The second tricky idea is that functions' arguments can have default values, which are set when the 'def' happens and don't change after that. This allows you to hide all kinds of useful information in an anonymous function, or create multiple instances of the function with different default arguments. A default argument can be another function, possibly with its own default arguments. I hope this helps. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From amused at webamused.com Thu Apr 13 19:41:36 2000 From: amused at webamused.com (Joshua Macy) Date: Thu, 13 Apr 2000 23:41:36 GMT Subject: Help References: <38eddc38$0$17341@wodc7nh6.news.uu.net> Message-ID: <38F64DA3.ECB23626@webamused.com> T Zimmerman wrote: > > I have left several posts concerning Tkinter Meta keys, and yet to get a > response from anyone. If this doesnt work for anyone else than it is a bug. > Otherwise there is something wrong on my end. The following script should > allow the use of 'alt-f' to access the 'File' menu. This does not work on > any of the NT boxes in my office. If this does or does not work for someone > please let me know. > > Thanks, > T Zimmerman > tzman at bhmi.com > > ================================================================== > import Tkinter > > root = Tkinter.Tk() > > button = Tkinter.Menubutton(text = 'File', underline = 0) > button.pack() > menu = Tkinter.Menu(button) > button.configure(menu = menu) > menu.add_command(label = 'Hello World', underline = 0) > > root.mainloop() > ================================================================== It works for me on Linux. Hitting alt-F selects the File menu. Hitting alt-H doesn't do anything visible, I presume because the command isn't bound to anything. I'll try it on my NT box at work tomorrow if you'd like. Joshua From donb at init.com Thu Apr 20 10:26:49 2000 From: donb at init.com (Donald Beaudry) Date: Thu, 20 Apr 2000 10:26:49 -0400 Subject: globals: a dirty little secret? References: Message-ID: <200004201426.KAA16104@zippy.init.com> "Michal Wallace (sabren)" wrote, > > > Globals have come up a couple times recently.. If someone posted the > following approach, I missed it... > > > ### step 1: globals.py ####################### > > import __builtin__ > > def setGlobal(key, value): > __builtin__.__dict__[key] = value > > __builtin__.setGlobal = setGlobal # makes the above function global *If* I found that functionality useful, I'd prefer def setGlobal(**d): __builtin__.__dict__.update(d) so that it could be called like: setGlobal(x=5) which fits better with my sense of aesthetics. Sure it works, but what good does it do you? It only provides "convenient" read-only access to your globals. To write a global, you must use the setGlobal() function. Instead, consider this module: # # globals.py # pass Yup... that's it. Now inside your program: import globals globals.x = 5 print globals.x With this approach your intentions become very clear. -- Donald Beaudry Ab Initio Software Corp. 201 Spring Street donb at init.com Lexington, MA 02421 ...Will hack for sushi... From pickaxe22 at stny.rr.com Sun Apr 23 14:33:14 2000 From: pickaxe22 at stny.rr.com (Andy Mullen) Date: Sun, 23 Apr 2000 18:33:14 GMT Subject: setting up Tkinter Message-ID: As i understand from the website (www.python.com), this program doesn't run on windows 98. Since i was already thinking of putting linux on my machine under a partition of the HD, i was wondering if someone could point me in the right direction as to where to get linux online, how to go about install, and how to run the 2 separate OS's on one machine. any response would be appreciated From zorro at zipzap.ch Sat Apr 15 04:22:39 2000 From: zorro at zipzap.ch (Boris Borcic) Date: Sat, 15 Apr 2000 10:22:39 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> Message-ID: <38F826CF.DBDC71EF@zipzap.ch> Just van Rossum wrote: > > - Will Ware and I have worked hard on a complete rewrite of the > uthread module. It is a *vast* improvement over the old one. > It offers a very nice thread object and several handy threading > widgets. It already can do stuff threading.py can only *dream* > about, like pausing (blocking) a thread from another thread or > posting an exception from another thread (!). Simple examples of useful new idioms that this permits ? BTW, I remember there exists a package for lisp, called "screamer", that turns it in a backtracking non-deterministic language in the style of prolog, through a device called CPS (continuation-passing style) transformation. While python lacks S-expressions and lisp-style macros that allow this for lisp, continuations are clearly the key component of this gimmick. It might be worth its while to have a better look. There is also Oz. http://www.mozart-oz.org/ - I've long dreamt of a language with some of the semantics of Oz and Python syntax and libs. continuations and uthreads seem to bring python somewhat closer to Oz. BB -- "Hope achieves the square root of the impossible" From paulb at infercor.no Mon Apr 10 08:28:22 2000 From: paulb at infercor.no (Paul Boddie) Date: Mon, 10 Apr 2000 14:28:22 +0200 Subject: opening a serial port at a given baudrate. How? References: Message-ID: <38F1C8E6.73E527DB@infercor.no> Jim Richardson wrote: > [...] > I have been using open('/dev/ttyS0','r+') > but need to control baud rate. fcntl.ioctl() will do this? > I can't seem to find (on machine, haven't checked on-line yet > how to do this, but thanks for the pointer! Knowing where to look is at > least half the battle. Try the Linux Documentation Project at http://www.linuxdoc.org - the Serial-HOWTO is probably what you want. You may have this document somewhere in /usr/doc, depending on your Linux distribution. Paul From mikael at isy.liu.se Fri Apr 7 08:57:38 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Fri, 07 Apr 2000 14:57:38 +0200 (MET DST) Subject: [Python-Dev] Round Bug in Python 1.6? In-Reply-To: <20000407084914.A13606@mems-exchange.org> Message-ID: On 07-Apr-00 Greg Ward wrote: > Oh, joy! oh happiness! someday soon, I may be able to type > "blah.__doc__" at the interactive prompt and get a readable result! Just i case... I hope you haven't missed "print blah.__doc__". /Mikael ----------------------------------------------------------------------- E-Mail: Mikael Olofsson WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael Phone: +46 - (0)13 - 28 1343 Telefax: +46 - (0)13 - 28 1339 Date: 07-Apr-00 Time: 14:56:52 This message was sent by XF-Mail. ----------------------------------------------------------------------- From jamarijr at hotmail.com Wed Apr 5 09:37:28 2000 From: jamarijr at hotmail.com (Arinté) Date: Wed, 05 Apr 2000 13:37:28 GMT Subject: Exceptions, when and who? Message-ID: <8cffin$pl0$1@nnrp1.deja.com> When and why would python could throw an exception in an embedded app? I am not getting the exception on the c side but in the python code and I can't figure out why. If I set the Error String in the c code when and who should clear that error? How would you clear it in python, in c I know you use PyErr_Clear (right?). Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Wed Apr 19 11:46:36 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 19 Apr 2000 16:46:36 +0100 Subject: Very Horrible Question About Goto's References: Message-ID: Michael Hudson writes: > Gaetan Corneau writes: > > > I was surprised to learn that Python doesn't have a goto statement. > > Would it be difficult to add? > > No. The necessary opcodes are there (well, the one you need: > JUMP_ABSOLUTE). You could use bytecodehacks to implement it, if you > liked... Oh, hang on: the block stack would cause problems; how would you get def f(x): label: bob for i in x: if x: goto: bob to work? (by declaring it to be an error, I suppose). Cheers, M. -- 41. Some programming languages manage to absorb change, but withstand progress. -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From psl at mitre.org Wed Apr 12 15:27:56 2000 From: psl at mitre.org (Pete) Date: Wed, 12 Apr 2000 15:27:56 -0400 Subject: scrolledListBox problem Message-ID: <38F4CE3C.3D6E7A68@mitre.org> I am using makeing a GUI that contains 2 scrolledListBoxes, and I have come across something unfortunate. When I select an item in one list, the currently selected item in the other list becomes deselected, so only one list can have an item selected at any point in time. Is this a bug in PMW? Any ideas as to how to fix this? From jsaltiel at uiuc.edu Sat Apr 29 17:11:56 2000 From: jsaltiel at uiuc.edu (Joe Saltiel) Date: Sat, 29 Apr 2000 16:11:56 -0500 Subject: converting word documents to html Message-ID: <390B501C.1891CB80@uiuc.edu> Hey, I was wondering if anybody had done any work on converting word processors type documents to html. (word or word perfect, pdf or anything else). I am looking for a nice way to post documents online that are laden with footnotes/endnotes. Word2000 does an allright job, but adds a bunch of junk that makes the file 3-4 larger then it has to be. I was thinking of writing something to do that but just want to check before I reinvent the wheel..... thanks Joe From mak at imakhno.freeserve.co.uk Sun Apr 23 13:28:37 2000 From: mak at imakhno.freeserve.co.uk (Makhno) Date: Sun, 23 Apr 2000 18:28:37 +0100 Subject: Calling Python from C code with subs as strings Message-ID: <8dvc19$mun$1@news7.svr.pol.co.uk> Can somebody suggest why the following C/Python code does not work? It's supposed to call a C function with a string argument that describes what Python function to call. That C function then calls that Python function. C: void CallPythonSub(char *subname) { if (subname[0]==0) return; //do check this.... PyObject *moduleref=PyImport_ImportModule("__main__"); PyObject *thesub=PyObject_GetAttrString(moduleref,subname); if (thesub==NULL) {printf("Error\n");return;} PyObject_CallFunction(thesub); } Python: def thissub(): print 'im working!' CallPythonSub('thissub') No Nulls are returned from the Py... calls. It just does nothing. From rich.glazerman at synchrologic.com Wed Apr 12 15:24:51 2000 From: rich.glazerman at synchrologic.com (Rich Glazerman) Date: Wed, 12 Apr 2000 15:24:51 -0400 Subject: Config Parser Options Case Sensitivity Message-ID: I've been having a problem with ConfigParser and option names. From what I see, ConfigParser reads in optionnames from the file, and in an attempt to keep optionnames case insensitive, sets them to lowercase before using them as keys in a dictionary. The problem I have with this is that in the config file I'm using, we use some OptionNames that are case sensitive in terms of needing to remain in the same case as when they are read. What I've done to fix this is as follows: I've added self.__options dictionary to the ConfigParser Class. In the __read() function, before converting optionname to lowercase, I append the optionname to the list (self.__options[sectname]). Now, self.options(section) returns self.__options[section] instead of the keys inside of self.__sections[section]. This way, self.options(section) returns the options in the same case in which they are found in the file, while keeping case insensitivity for self.__get. Does anybody have any other ideas on this? Is this something anybody else has run into? Does this seem like a valid solution? Thanks for the feedback. Rich -- Rich Glazerman Test Engineer Synchrologic, Inc. rich.glazerman at synchrologic.com 770-754-5600x176 From sctheagn at kraken.itc.gu.edu.au Tue Apr 18 22:29:49 2000 From: sctheagn at kraken.itc.gu.edu.au (Joal Heagney) Date: Wed, 19 Apr 2000 12:29:49 +1000 Subject: module naming? References: Message-ID: <38FD1A1D.D59B594B@kraken.itc.gu.edu.au> "Michal Wallace (sabren)" wrote: > On Mon, 17 Apr 2000, David Arnold wrote: > > > -->"Michal" == sabren writes: > > > > Michal> Is there a better way to do this? > > > > what about something like > > > > from Record import Record > > from Field import Field > > from IdxDict import IdxDict > > > > in your zdc/__init__.py ? > > > > Hey David, > > That's certainly a lot cleaner! But is there a way to do that and > not have it load each one of those files every time? There's actually > more than 3, and even though they're all fairly small, I'd rather not > have the overhead of loading them until they're needed. > > Cheers, > > - Michal > ------------------------------------------------------------------------- > http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ > ------------------------------------------------------------------------- I'm new to the pythoning game, but is there a way to check to see if a file is loaded. I seem to remember that the from statement doesn't support that, but maybe you could make a call to a function that does a check on if the class already exists in program space, and if it doesn't imports it using the from ... import statement? Joal Heagney/AncientHart From python-list at teleo.net Mon Apr 17 12:59:59 2000 From: python-list at teleo.net (Patrick Phalen) Date: Mon, 17 Apr 2000 09:59:59 -0700 Subject: guestbook In-Reply-To: <20000417174349.71830.qmail@hotmail.com> References: <20000417174349.71830.qmail@hotmail.com> Message-ID: <00041710080906.00880@quadra.teleo.net> [sigma seitse, on Mon, 17 Apr 2000] :: i'm trying to write a guestbook in python. well, :: it should consist additional feature like this: :: it should enable the owner to change and response to visitors' comments and :: show it out. :: have you got anything like this or maybe you know an address or smth, where :: I could find something :: like this? An excellent tutorial on this can be found at: http://classic.zope.org:8080/Documentation/Reference/ObjectPublishingIntro The examples used there are based on integrating a Python guestbook module with the Zope ORB, Templates and Object Database, which has advantages over relying on low level CGI. From markus.oberhumer at jk.uni-linz.ac.at Thu Apr 27 20:46:05 2000 From: markus.oberhumer at jk.uni-linz.ac.at (Markus F.X.J. Oberhumer) Date: Fri, 28 Apr 2000 02:46:05 +0200 Subject: [ANNOUNCE] PySol 4.20 - a solitaire game collection Message-ID: <20000428024605.A31501@laetitia.oberhumer.com> -----BEGIN PGP SIGNED MESSAGE----- PySol - a Solitaire Game Collection Version 4.20 http://pysol.tsx.org Copyright (C) 1998, 1999, 2000 Markus F.X.J. Oberhumer What is PySol ? =============== PySol is an exciting collection of 287 solitaire games. Among the supported games are classics like Aces Up, Baker's Game, Canfield, FreeCell, Forty Thieves, Golf, Klondike, Monte Carlo, Osmosis, Pyramid, Scorpion, Spider, Yukon, and many more... PySol may be freely distributed under the terms of the GNU GPL. PySol aims to be Commercial Quality Freeware. Why yet another solitaire game ? ================================ Here are some highlights of PySol: - freely available - currently supports 287 (!) distinct solitaire variants - lots of classic games like Forty Thieves, FreeCell, Klondike and Spider - special games like Hanafuda, Mahjongg, Poker and Tarock type games - based upon an extensible solitaire engine - very nice look and feel including multiple cardsets and background table tiles - sound samples and background music - unlimited undo & redo - load & save games - player statistics and log files - hint system and demo games - support for user written plug-ins - add your own solitaire variants - integrated HTML help browser - lots of documentation - fully portable across Unix/X11, Windows 95/98/2000/NT and MacOS - distributed under the GNU GPL with full source code - written in 100% pure Python - just run it - no need to compile anything Nice. And what's new ? ====================== * 14 new games, including HexADeck and Memory type variants * some new great-looking cardsets * much improved statistics dialog * added a "Recent games" menubar entry * fixed the detection of Straights in Poker type games * fixed a problem when changing the card background Cool. Where can I get it ? ========================== Point your browser to http://pysol.tsx.org The PySol Gallery is awaiting your visit as well. What do I need to start playing ? ================================= PySol requires Python 1.5.2 and Tcl/Tk 8.0.5. Both packages are freely available for Unix, Windows 95/98/NT and Macintosh. BTW, there is no need to compile anything since the whole program is just a Python script. Just run it, and that's all. The Windows version ships as a completely self-contained setup file. License terms ============= PySol is Copyright (C) 1998, 1999, 2000 Markus Franz Xaver Johannes Oberhumer PySol is distributed under the terms of the GNU General Public License (GPL). See the file COPYING. Have fun, Markus http://pysol.tsx.org -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: noconv iQCVAwUBOQjO5G10fyLu8beJAQGN5AP/fSUT/67iJFnk3nz0Y0IbmmIl+/qzk8AL mIaGipsALcBaUsJZ5H0r+TR9YMEpSeIbx6FBNuKQyIuC29PoBKX8UJ8KH5bhe3Wp EfJxIXYihCdZtQooWs3y/fJhYu9JvPpqPlnlCC9cBpnV7eKdq2GUjleS3TJhUHdp T7I0DjFZQc0= =OfHV -----END PGP SIGNATURE----- From jae at ilk.de Mon Apr 24 17:57:47 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Mon, 24 Apr 2000 23:57:47 +0200 Subject: The Simple Economics of Open Source In-Reply-To: (message from Robin Becker on Mon, 24 Apr 2000 15:09:27 +0100) References: <3903316C.5D6F1611@tcac.net> <390451C0.4B5D3196@tcac.net> Message-ID: <24042000.3@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Robin" == Robin Becker writes: Robin> In article <390451C0.4B5D3196 at tcac.net>, Albert Wagner Robin> writes >> You STILL don't understand. Artifice can only copy. It cannot invent. >> An end product can be copied, even a style can be copied, but not the >> creative process itself. >> >> Raffael Cavallaro wrote: Robin> ... Robin> This position is like the weak AI position; you assert Robin> there's something magical about creation. I think A Turing Robin> was right; any human behaviour can be simulated and the Robin> best simulators (people) are around already. Fundamental question is: Are we just a complex arrangement of bio-chemical (and thus ultimately physical) processes... or is there more to being `human beings'? If we are just a collection of bio-chemical processes, it's simple to `simulate' or replicate us in machine form[1]. If we are more... than it will not be possible. Since I'm a christian, I guess it's obvious where I'll put my bets... Bye, J [1] I'm just reading Bill Joy's Wired essay `Why the future doesn't need us'... PS: For the record, I'm 100% with Albert (though maybe he's not 100% with me ;-) - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html "Ever wonder why the SAME PEOPLE make up ALL the conspiracy theories?" -- Michael K. Johnson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAjkEw1oACgkQN0B+CS56qs09zQCfTMfxscQZVhcLpqgIiSVYShoO vjwAn0G8CdZImNdfPk1s5mvgOjR7GxVu =W73r -----END PGP SIGNATURE----- From effbot at telia.com Wed Apr 12 10:08:15 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 12 Apr 2000 14:08:15 GMT Subject: comparing strings and ints References: <2YmI4.366$rc9.188014080@newsb.telia.net><20000411134358.A2352304@vislab.epa.gov> <1256641282-42160637@hypernet.com> <20000412075812.A2449004@vislab.epa.gov> Message-ID: Randall Hopper wrote > Gordon McMillan: > |Randall Hopper wrote: > |> Fredrik Lundh: > |> | > |> | Objects of different types always compare unequal, and are > |> | ordered consistently but arbitrarily. > |> > |> I can see 45 == '45' being false, and 45 != '45' being true. But it seems > |> to me that not throwing an exception for attempts at an ordered comparison > |> with logical ordering operators (<, <=, etc.) on objects of different > |> primitive types (e.g. 45 < '45', 45 > '45') only lets bugs pass through. > |> > |> Is there a case where this could be useful (with its undefined behavior)? > |> I believe that is the root of the question. > | > |I'd happily bet your wife and firstborn child that there's code that > |relies on it , if only because after sorting a list, all the ints > |will end up in a clump, and all the strings in another, etc. > > > Oh, I also have __no doubt__ that someone is using this unofficial, > undocumented behavior. But they don't have a leg to stand on if the > ordering breaks in a future Python version ;-) interestingly enough, you included my documentation quote in a post claiming that this is an undocumented feature... (if you want more background on *why* this design was chosen, consider that python has a single comparision primitive __cmp__, and that until a few versions ago, the interpreter happily ignored exceptions raised by that primitive. for more info on this topic, search the site/newsgroup for "rich comparisions"). From rcunning at acm.org Sun Apr 9 22:13:41 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Mon, 10 Apr 2000 02:13:41 GMT Subject: Python paradigms References: Message-ID: <38F138CD.38983629@acm.org> Oleg Broytmann wrote: > On Sun, 9 Apr 2000, Fredrik Lundh wrote: > > Oleg Broytmann wrote: > > > blah = ((foo() and [poo()]) or [boo()])[0] > > > > > > In C, "foo() ? poo() : boo()" will not call boo() if foo() returns > > true; > > > but in Python, you'll have a side-effect of calling boo() even if foo() > > > returns true - what is wrong, usually. > > > > did you try running the code? > > > > python's "and" and "or" operators doesn't evaluate the > > second argument unless they really have to... > > Yes, I missed that, sorry. So, it works just fine, right? > Anyway, it is strange (not to say "ugly") construct; I prefer not to see > it in a code... I remember a professor who had a mantra he'd repeat just before accepting programming assignments from his students: "All code without comments is UGLY code. And ugly code gets an 'F', even if it works perfectly." Which had an implicit corollary: "Nasty Code + Comments = Non-Ugly Code" Not all problems have "nice" solutions, but even the messiest solution can be made palatable with the addition of suitable comments. The best example of this I can recall was in an extremely obfuscated MD5 hash generator that fit in something like two or three lines of code. The comments required two pages (to explain both the MD5 algorithm and this implementation), and did their job quite well. The "self documenting" version of the code, on the other hand, required only one page, but even with maximum compiler optimizations it ran 4 times slower than the obfuscated version. I'm not saying either of these were ideal pieces of code. But when the emphasis is on performance AND maintainability, then nasty code combined with sufficient comments works extremely well. When the emphasis is on "readable" or "self documenting" code, it can be much harder to obtain suitable performance. It has also been my experience that performing structural optimizations to code is somewhat easier when the code is more compact and well documented, than when it is "self-documented" and spread over a greater area. In Python, performance quickly slows to a crawl unless a handful of trusty structural optimizations are used, such as assigning methods to variables before calling them repeatedly within a loop. This clearly makes the code less "self documenting", since it imposes a structural optimization to circumvent a basic behavior of the Python execution environment. Surely, someday the Python interpreter will be able to create such optimizations for us on the fly (just a little loop invariant migration, right?), but in the meantime these manual optimization constructs are so prevalent that they have almost become part of the Python language. Indeed, they are documented as "necessary" by GvR himself! I see each and every one of them as a wart on the basic elegance of the Python language, since they generally serve only to manually optimize (circumvent) access to namespaces (or other Python "features"), to "break" the most basic elements of OO implementation! It is getting to the point that these optimizations and constructs aren't even documented in most of the code I've looked at, and I'm still a Python newbie. To me, even some "guru" code is ugly, ugly, ugly. And such code is present in the documents that define the Python language and its use. So, when I hear Python gurus arguing about the "ugliness" of various coding constructs, it makes me laugh out loud. The common use of Python *demands* hand optimization (aka "uglification") of the code to gain decent performance. As the code becomes faster and more usable, it gets uglier and uglier. Maybe that's too strong a statement: IMHO, the "prettiest" "self documenting" Python code is often unusably slow, especially where loops are involved. The argument in this case should be about the degree of commenting needed, not the code itself! AFAIK, the code is FINE (though possibly not "perfect"). Has it been tested for performance and side effects against other forms? Until we know better, it may be the case that the code we've been discussing to create something equivalent to C's "?:" construct is OPTIMAL! Let's assume, for the moment, that this is indeed the case: Now, obviously, the only thing left to discuss is the comments! Right? Who would toss fast code merely because it was "ugly"? Certainly no Python programmer! And what IS the best way to comment such an obtuse line of code? I submit my example that's quoted at the top. If you understand the "?:" construct from C, it does the job perfectly (if minimally). No matter how "ugly" the related Python code is. Python is, for now, condemned to use "ugly" code constructs if it is to see maximum use and performance. Let's use them when we must, but also pay strict attention to thoroughly documenting them whenever they are used. Which brings me to a related thought: Has anyone looked at post-processing .pyc files to optimize them? Or are there plans to include a bytecode optimizer in the Python interpreter or runtime environment (as a JIT optimizer/compler)? Without, of course, bringing the entire JVM or JRE into the game... That might be overkill. Any such moves should serve to reduce or eliminate the *need* for much of the present ugly Python code. Oh-to-have-loop-invariant-migration-ly yours, -BobC From robin at jessikat.demon.co.uk Sun Apr 23 13:43:12 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sun, 23 Apr 2000 18:43:12 +0100 Subject: The Simple Economics of Open Source References: <3903316C.5D6F1611@tcac.net> Message-ID: In article <3903316C.5D6F1611 at tcac.net>, Albert Wagner writes >Raffael Cavallaro wrote: >> >> >> Sarcasm aside, I think you miss the point. Those artists least willing to >> share, most jealous of their "secrets" have always been those who were most >> successful. Unsucessful young artists are, by and large, quite willing to >> share ideas, working techniques, etc. It's actually the more established, >> financially succesful ones, who are not. >> > >I think you confuse artifice and art. Talent is not a "secret" that can >be hoarded or shared. It is visible in the end product, yet no amount >of sharing how it was done will allow the process to be duplicated. I >think you also are confused about what "successful" means to a talented >person. The "commodification" (sorry, Marx) of anything and everything, >assigning it a dollar value, is at the very root of the mindset that is >destroying the world. I concur wholeheartedly -- Robin Becker From tom_hines at my-deja.com Fri Apr 28 16:46:04 2000 From: tom_hines at my-deja.com (Tom Hines) Date: Fri, 28 Apr 2000 20:46:04 GMT Subject: win32com: _NewEnum being cached Message-ID: <8ecta7$nn5$1@nnrp1.deja.com> Hello. As you know, to implement "for x in my_list" functionality in COM, you must code a get__NewEnum() function, which I have done and it works fine under Visual Basic. But when called from Python, the call seems to get cached, as subsequent Python "for" blocks don't result in calls to get__NewEnum(). I have a COM class that implements a dynamic collection, so I need "for" blocks to result in calls to get__NewEnum() every time. Does anybody know how to force this? Thanks. -- Tom Hines Rockville, MD Sent via Deja.com http://www.deja.com/ Before you buy. From ivanlan at callware.com Thu Apr 6 08:48:01 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 06 Apr 2000 06:48:01 -0600 Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> <38EB73B6.6C0913A7@callware.com> <8chsij$k5r$1@newsserver.rrzn.uni-hannover.de> Message-ID: <38EC8781.60AA68F9@callware.com> Hi All-- Bernhard Reiter wrote: > [snip] > >> Ranting-about-dummy-booktitles-ly-yours, > Well I am just ranting about book title giving wrong impressions. > 24 times a one hours session can be quite a bit to teach people the > basics, I agree with that. But for all the philosophy I guess that > you need to spread the lectures about a larger time period. :) > Unfortunately, I had absolutely no choice about the book title. Given my druthers, I would have used what the book is *really* named, _Python Mind, Beginner's Mind_. Think of it that way, and it's a lot easier to take;-) -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From nmm1 at cus.cam.ac.uk Tue Apr 4 17:42:38 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 4 Apr 2000 21:42:38 GMT Subject: Warning switches (was: Python 1.6 alpha 1 released) References: <5l7leern5v.fsf@eric.cnri.reston.va.us> <38ea1de0$0$17688@personalnews.de.uu.net> Message-ID: <8cdnke$b05$1@pegasus.csx.cam.ac.uk> In article , Fredrik Lundh wrote: >Johannes Stezenbach wrote: >> >However, I'll do so for purely backwards compatible reasons, and I >> >will continue to press for the tuple address as the correct form. >> >> Will python then support a -w switch to support people in writing >> correct programs (i.e. compatible with likely furure language/library >> changes), just like our-favourite-four-letter-P-language? > >how about -v ? > >there has been talks about compatibility "modes" (probably an option, >but probably also a way to set options programmatically), as a way to >help people prepare for "Python 3000". I think we might expect some >of it in 1.7, and more of it in 1.8 (if that ever materializes). > >but hopefully, Python 3000 will be completely free from modes. It is important to distinguish modes from warning levels. The former imply that there are several subtly different languages, and are usually regarded as snares and delusions. The latter are best described by the following question: Do you want me to tell you when I think that you may be making a mistake, when you are doing something that is asking for trouble, or only when you have definitely got it wrong?" Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From ns56645 at swt.edu Sun Apr 30 13:50:35 2000 From: ns56645 at swt.edu (ns56645) Date: Sun, 30 Apr 2000 12:50:35 -0500 Subject: ScrollCanvas Help Needed? Message-ID: <390C726B.A01B6471@swt.edu> Hi Folks, I am trying to implement scrollcanvas widget of Pmw widget in the frames. I can create those canvas using grid but the scrollbar doesn't scroll the canvas instead it scrolls the button inside. I went through the sample code and they have used pack function instead of grid. Does that make any difference. Let me know how can I make the canvas scroll and not the buttons inside. I hope you understand me. If I use pack instead of grid the canvas widget doesn't show on the frame. Please let me know if I need to send the code to you guys. Shah -------------- next part -------------- An HTML attachment was scrubbed... URL: From dalke at acm.org Sun Apr 23 15:27:55 2000 From: dalke at acm.org (Andrew Dalke) Date: Sun, 23 Apr 2000 13:27:55 -0600 Subject: partial parsing? Message-ID: <8dvilp$88s$1@slb6.atl.mindspring.net> Hello, I'm interested in writing a parser generator which is somewhat different than yacc/flex, SPARK, Plex, etc. Those parsers generate code which verifies every byte in the file and expects that I'm interested in most of the data. In my case, I have a lot of data (>100MB) in a known good format of which I'm only interested in a few items, but the specific items can change. What people usually do is hand write a parser which extracts only the specified fields. I've written parsers which parse every field and use a callback event so clients can listen only to fields they want, but the performance suffers. Instead, I want to start with the full grammer and specify both which events I'm interested in getting and a stringency criterion. A low stringency could potentially skip 200 bytes, or read 5 lines, without actually checking to see if the data was correct. I've been looking for existing parser generators which work like this, to use as a basis for my understanding, but I can't seem to find anything this this. All the systems I've seen assume you want everything except whitespace. Can anyone here provide pointers to relevant programs or papers? Andrew dalke at acm.org From greg at cosc.canterbury.ac.nz Thu Apr 6 22:06:10 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Apr 2000 14:06:10 +1200 Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> <8cfa75$fho$1@newshost.accu.uu.nl> Message-ID: <38ED4292.2EE8D3CA@cosc.canterbury.ac.nz> Martijn Faassen wrote: > > def foo(): > return 1, 2, 3, 4 > > first, second, third, fourth = foo() > > I think this is nice syntax. It is very nice. Just a pity it loses its beauty in the case of 1-tuples. Haskell avoids this problem by simply not having any such thing as a 1-tuple. It works there because you never need a 1-tuple in Haskell -- a bare value always does just as well. Unfortunately, Python *does* need 1-tuples. If only ASCII had more kinds of brackets, Guido might have chosen differently. Maybe if Python 3000 uses Unicode for source files... -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+ From chalaoux at cybercable.fr Wed Apr 26 16:57:07 2000 From: chalaoux at cybercable.fr (FR Chalaoux) Date: Wed, 26 Apr 2000 22:57:07 +0200 Subject: Wanted Daniel Larsson Message-ID: <39075823.F3511829@cybercable.fr> Hi, I looking for the right e-mail adress of "Daniel Larsson", the creator of Pythondoc? "Daniel.Larsson at vasteras.mail.telia.com" seems to be incorrect. Bye, FR. From cut_me_out at hotmail.com Fri Apr 14 10:46:14 2000 From: cut_me_out at hotmail.com (Alex) Date: 14 Apr 2000 10:46:14 -0400 Subject: Choral Music for Holy Week - Chanticleer_Mysteria- Gregorian Chants_10_Holy Sunday- Hymn- Vexilla Regis.mp3 (07/11), exception problem References: <1pBJ4.29582$h6.134427@typhoon.jacksonville.mediaone.net> Message-ID: > from uu import * > decode(infile, outfile) > > raise Error, 'No valid begin line found in input file' > uu.Error: No valid begin line found in input file > > > how do i trap it > > i've tried > > try: > decode(infile, outfile) > except uu.error: > pass > > gives me > > NameError uu : I'm not sure, but I think you've bought all of uu into your current namespace. If that's the case, you probably want try: decode(infile, outfile) except error: pass ...except that 'error' should probably be 'Error' judging by the traceback. On the face of it, it seems like you would be better off keeping uu in its own namespace in this case: import uu try: uu.decode (infile, outfile) except: uu.Error pass Alex. From jimsp at ichips.intel.com Mon Apr 17 16:37:36 2000 From: jimsp at ichips.intel.com (jimsp) Date: Mon, 17 Apr 2000 13:37:36 -0700 Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> Message-ID: <38FB7610.80EAF965@ichips.intel.com> How about >>> import random >>> x = [0]*1000000 >>> y = map(lambda x: random.randint(1,10), x) >>> len(x) 1000000 >>> len(y) 1000000 >>> >>> >>> x[1:100] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >>> y[1:100] [6, 5, 6, 8, 2, 4, 10, 7, 10, 5, 6, 8, 4, 3, 9, 10, 7, 9, 9, 5, 6, 7, 1, 3, 7, 2 , 7, 4, 7, 2, 6, 3, 9, 5, 4, 9, 2, 7, 2, 6, 5, 8, 7, 8, 1, 6, 10, 4, 3, 7, 3, 3, 4, 8, 5, 1, 5, 7, 5, 9, 9, 5, 2, 3, 1, 8, 3, 5, 3, 4, 2, 9, 1, 6, 8, 8, 4, 6, 4 , 7, 2, 8, 5, 7, 2, 7, 9, 10, 7, 4, 8, 10, 6, 9, 4, 3, 3, 10, 8] >>> --james Donald Beaudry wrote: > Bill Scherer wrote, > > I just did a little test and found this to be substantially fatser than the > > other three: > > > > import random > > randint = random.randint > > > > r = [] > > > > for i in xrange(1,10000): > > r.append(randint(1,10)) > > > > for i in r: print i > > # > > ...then this one should be really impressive ;) > > def do_it(): > from random import randint > r = [] > append = r.append > for i in xrange(1,10000): > append(randint(i)) > for i in r: > print i > > do_it() > > or better yet: > > def do_it(): > from random import randint > r = [] > append = r.append > map(append, xrange(1,10000)) > for i in r: > print i > > do_it() > > -- > Donald Beaudry Ab Initio Software Corp. > 201 Spring Street > donb at init.com Lexington, MA 02421 > ...So much code, so little time... From jvickroy at sec.noaa.gov Tue Apr 11 11:40:14 2000 From: jvickroy at sec.noaa.gov (j vickroy) Date: Tue, 11 Apr 2000 09:40:14 -0600 Subject: PythonCOM: com_error: (-2147418113, 'Catastrophic failure', None, None) Message-ID: <38F3475E.C720D791@sec.noaa.gov> Hello all, I am attempting to drive the COM interface to RSI-IDL (Interactive Data Language) from Python as follows: >>> o = win32com.client.Dispatch("IDLDRAWX2.IDLDrawWidget.2") >>> o.IdlPath = "c:\\rsi\\idl53\\bin\\bin.x86" Traceback (innermost last): File "", line 1, in ? File "C:\Program Files\Python\win32com\client\dynamic.py", line 413, in __setattr__ self._oleobj_.Invoke(self._olerepr_.propMap[attr].dispid, 0, pythoncom.DISPATCH_PROPERTYPUT, 0, value) com_error: (-2147418113, 'Catastrophic failure', None, None) >>> The following variants were also tried with the same result. o.IdlPath = "c:\rsi\idl53\bin\bin.x86" o.IdlPath = "c:/rsi/idl53/bin/bin.x86" I have been working with the vendor (RSI) but they do not have Python expertise (and neither do I). I would appreciate any suggestions. Thanks. From tom.mcdavid at boeing.com Wed Apr 5 17:07:55 2000 From: tom.mcdavid at boeing.com (Tom McDavid) Date: Wed, 5 Apr 2000 21:07:55 GMT Subject: Python for QNX? Message-ID: <38EBAB2B.BDA6D20F@boeing.com> Has anyone ported python to qnx4? Tom McDavid Boeing - Phantom Works Kent, WA From akuchlin at mems-exchange.org Tue Apr 18 13:21:01 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 18 Apr 2000 13:21:01 -0400 Subject: Starship update: April 18 Message-ID: <3du2gzmiki.fsf@amarok.cnri.reston.va.us> This is an update on the current status of starship.python.net; here is bad news, very bad news, and a little bit of good news. First, the bad news: The hard drive on starship is toast; it makes nasty rattling noises when the power is turned on. The very bad news is that there do not seem to be any backups, because no one ever volunteered to set them up. The most recent data we have is the data that was on an older disk drive, which went out of service back in 1998. The good news: a new disk has been put into the machine, a clean install of Linux done, and the machine should be online again tomorrow. Creating user accounts will take longer, of course. These newly created accounts will all have empty directories, since the data hasn't been restored. Setting up the Web server again will take longer still. A data recovery firm has been contacted to reconstruct the data from the hard drive; their service costs around US$300-1000 if the data is recovered successfully, and is free if nothing is recovered. We'll probably wind up asking for donations to cover the cost, if they manage to recover the data. In the meantime... * If you can recover your starship data through other means (google.com's caching, your Web browser cache, copies on your own computer, etc.), please do so immediately, before the caches get expired. * If you had downloadable files on Starship (such as software) which you no longer have copies of, you might want to post to comp.lang.python or the appropriate mailing list and ask if anyone grabbed a copy recently. * If you downloaded someone else's software from Starship before the crash, DO NOT DELETE IT; your copy might be the only one left. This is particularly true for packages that are no longer under active development; you might consider e-mailing the author to check if they still have a copy. Further updates will be posted as events warrant. -- A.M. Kuchling http://starship.python.net/crew/amk/ Our sister died. But we never took revenge. We knew there'd be trouble one day, her being mortal. It's not as if we never said anything. We still miss her. We still mourn. -- Stheno, in SANDMAN #60: "The Kindly Ones:4" From rcunning at acm.org Tue Apr 4 11:40:33 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Tue, 04 Apr 2000 15:40:33 GMT Subject: From Python Newbie to Python Guru on the Fast Track: HOW? References: <38E9B48F.F1827543@acm.org> <38E9FD78.C740CF4E@gssec.bt.co.uk> Message-ID: <38EA0C49.DD9BD052@acm.org> Alan Gauld wrote: > Finally consider a web based approach to what you want, that > might be simpler albeit more retricted in the long term... > It all looks mightily ambitious to me. That's a fact! My real goal is a bit less glorified than making Linux newbies more comfortable with Windows apps on their Linux desktops, or grabbing some of Windows' unique functionality for Linux. No, what I really want to do is see how much extra "stuff" I can get from the combination of Win4Lin and Linux, with the hope of encouraging Trelos to include specialized Python interfaces in Win4Lin. I'd still like to do all the other stuff (one day), but I'm a realist: There is no way a Python newbie such as myself can pull this off (this year). But I do feel I can produce some "proof of concept" examples that may get a few of the *real* Python gurus interested in the project. If for no other reason than to clean up my code... -BobC From pj at sgi.com Thu Apr 6 22:02:48 2000 From: pj at sgi.com (Paul Jackson) Date: 7 Apr 2000 02:02:48 GMT Subject: Python on Google? References: <8F0ED22EBjoshtinamecom@209.208.0.7> Message-ID: <8cjfk8$qtlo$1@fido.engr.sgi.com> |> to what extent Python is used on www.google.com? My vague impression is that quite a bit of the original "interesting" code was done in Python, but that most of the serious stuff now is being done in C or C-like C++, due to the serious performance challenges handling their current large and growing load. Perhaps some of the non-critical path stuff is still in Python. -- ======================================================================= I won't rest till it's the best ... Software Production Engineer Paul Jackson (pj at sgi.com; pj at usa.net) 3x1373 http://sam.engr.sgi.com/pj From gmcm at hypernet.com Thu Apr 6 13:07:34 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 6 Apr 2000 13:07:34 -0400 Subject: Installer / mxDateTime problem In-Reply-To: <1257094563-14896354@hypernet.com> References: <8chm9o$qbv$1@gxsn.com> Message-ID: <1257081637-15673599@hypernet.com> I wrote: > Richard Chamberlain wrote: > > > I've got a simple script that uses mxDateTime that I want to run as an exe. > > I run it through simple.py and I get the following error: > > > > NameError: Case mismatch for module name feasts > > (filename C:\Program Files\Python\DateTime\Feasts.py) > > If I attempt to import DateTime.feasts interactively, I get the > same error. Do you have PYTHONCASEOK set? The exe isn't > going to do that for you. And then I played with mxDateTime and I see what you're talking about. Aargh. You've run into a bug in Installer, (Windows case preserving case insensitive file names again), but after that you'll run into a perversion in mxDateTime (the fact the mxDateTime is both the name of a package and the name of a module, so the "from mxDateTime import *" succeeds even when it fails.) (Actually he does this with DateTime, too, but that one works). All these "import *"s also include all the test code. I'm suprised that dependency tracking isn't fooled by LazyModule, considering what it does to "dir()". - Gordon From xaveer at dutetto.et.tudelft.nl Wed Apr 26 15:44:07 2000 From: xaveer at dutetto.et.tudelft.nl (Xaveer Leijtens) Date: 26 Apr 2000 19:44:07 GMT Subject: Building python on HPUX-10.2 References: <38FE1392.D1C01D64@wag.caltech.edu> Message-ID: <8e7gu7$ip$1@delphi.et.tudelft.nl> You might want to try the HP-UX porting and archive center, which has Python 1.5.2 prepackaged (and lots of other stuff): http://hpux.ced.tudelft.nl/hppd/hpux/Languages/python-1.5.2/ Good luck. Xaveer Richard P. Muller wrote: > I have successfully built python on a number of diffent platforms, but > I'm having serious problems on HPUX 10.2. I go through the normal > configure/make procedure, but the make crashes right away, when it is > trying to link the first object (pgen), because it can't find the > correct dl library (?). > Has anyone successfully compiled Python on HPUX-10.*? If so, what > configure string did you use? > Rick From pj at sgi.com Wed Apr 12 17:16:42 2000 From: pj at sgi.com (Paul Jackson) Date: 12 Apr 2000 21:16:42 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d1inu$nsq$1@newshost.accu.uu.nl> <38F4996F.E3BD2626@acm.org> Message-ID: <8d2p3q$2vj9o$1@fido.engr.sgi.com> BobC wrote: |> The text-mode browser named "links" I suspect that you meant "lynx" ?? -- ======================================================================= I won't rest till it's the best ... Software Production Engineer Paul Jackson (pj at sgi.com; pj at usa.net) 3x1373 http://sam.engr.sgi.com/pj From smalleys at gte.net Fri Apr 14 00:05:27 2000 From: smalleys at gte.net (sue) Date: Fri, 14 Apr 2000 04:05:27 GMT Subject: Need an enum type extension References: <38F52A7A.D8841724@gte.net> Message-ID: <38F68AF4.46DDA670@gte.net> Will, that idiom does generate integers. Frederic, I need some of the tuple/list functionality as well. I'm not sure what your code does. I haven't done lambdas except for number crunching. In Ada, I can do things like: type MyEnum is ( A, B, C ); for MyEnum use ( A : 3; B : 7; C : 13 ); Ada uses "'string" to refer to attributes. MyEnum'len == 3. (number of items in list) A'next == B (next item in list) A'value == 3 (its low-level representation) B'index = 1 (its position in the list) But A == 3 fails. only A == A passes. A'value == 3 is true. Strings don't work directly because I need _some_ of the list/tuple functionality. I started with the mess below, but it can't put the EnumLits in the current scope. And I could see it getting ugly real fast. class EnumLit: count = 0 def __init__( self, name ): self.name = name self.value = self.count self.repr = self.count self.count = self.count + 1 self.lock = 0 def set_repr( self, repr ): if not self.lock: self.repr = repr def finalize( self ): self.lock = 1 self.count = 0 def index( self ): return self.index # etc class Enum: def __init__( self, *args ): self.lock = 0 self.names = args self.data = map( EnumLit, args ) # or dict, or DictList? def set_repr( self, **args ): for (name, val) in args: if name in self.args: i = self.names.index(name) e = self.data[i] e.set_repr( val ) self.finalize() def finalize( self ): self.lock = 1 and maybe some get/setattr stuff to finalize on any other kind of access? Sue. From effbot at telia.com Mon Apr 3 05:51:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 03 Apr 2000 09:51:22 GMT Subject: Pass by reference ? References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> Message-ID: Jacek Generowicz wrote: > def increment(x): > x = x + 1 > return x > > a = 0 > print a > print increment(a) > print a > ==================== > > output: > > 0 > 1 > 0 > > Given my understanding of passing by reference, > the last number should be 1. > > What am I missing ? two things, at least: -- python variables are names that points to a value. -- python's assignment statement doesn't modify values, it modify names. "x = y" means "change 'x' so it points to the current value of 'y'", not "copy the value of 'y' into 'x'" so in this case, "x = x + 1" means "calculate the sum of 'x' plus one, and change 'x' to point to that sum", instead of "replace the value pointed to by 'x' with the sum" the only way to modify a value in place is to call a method on it (directly, or through syntactic sugar like member assignment) From philh at vision25.demon.co.uk Wed Apr 26 20:03:03 2000 From: philh at vision25.demon.co.uk (phil hunt) Date: Thu, 27 Apr 2000 01:03:03 +0100 Subject: SPARK / Earley Parser question References: <3907774d.32199072@news.btx.dtag.de> Message-ID: On Wed, 26 Apr 2000 23:26:21 GMT, Stefan Franke wrote: >I'm designing a grammar with John Aycock's SPARK toolkit. > >Earley's algorithm is said to be n^3 time bound in general, n^2 for >unambiguous grammars and linear for most practical programming >language grammars. > >Are there some rules of thumbs which kind of rules should be avoided >to retain linear complexity? > >In particular, I wonder if using empty right-hand sides for rules has >any disadvantages. > >Online references would be appreciated. The rule of thumb I use is: code it the simplest way possible, and only try to speed it up if it is too slow. I use SPARK to build the parser for my Parrot program[*]. I find it is fast enough for my purposes -- compiles c. 150 lines of source per second on an AMD K6-2 running at 300MHz. I'd suggest try it and see. If fast speed is really essential, you might try using C/C++ and yacc instead. (*) see for details. -- ***** Phil Hunt ***** send email to phil at comuno.com ***** Moore's Law: hardware speed doubles every 18 months Gates' Law: software speed halves every 18 months From ivanlan at callware.com Tue Apr 4 23:28:18 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 04 Apr 2000 21:28:18 -0600 Subject: Getting the argument names passed to a function ? References: <8ce6dm$4vp$1@news.wrc.xerox.com> Message-ID: <38EAB2D2.401FE437@callware.com> Hi All Mark Jackson wrote: > [wholesale snippery] > But you forget about: > > >>> a=1 > >>> b=a > >>> arghack(a) > 'a' > >>> arghack(b) > 'a' > >>> > > Your move. . . :-) > > You guys are sick. And getting sicker. You need professional help. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From donn at u.washington.edu Wed Apr 12 16:11:25 2000 From: donn at u.washington.edu (Donn Cave) Date: 12 Apr 2000 20:11:25 GMT Subject: global variables - how?? References: <8d2bne$qn7$1@news101.telia.com> Message-ID: <8d2l9d$8jg$1@nntp6.u.washington.edu> Quoth "Anders Eggers-Krag" : | how do I define a propper global variable that works in all functions in all | modules? A proper global variable is a bigger job in Python than in some other languages. You still have to import its home module, in each module that will use it, and if any but that home module will modify it, the context must refer to some mutable object. Here's one way to do it: # --- module main.py --- class Core: def __init__(self): self.debug = 0 core = Core() # --- module spud.py --- from main import core def debug(on): if core.debug: print 'debug', on core.debug = on You could eliminate the class instance and use the module directly, changing "from main import core" to "import core". But the class gives you more flexibility that you may wish for later. Donn Cave, donn at u.washington.edu From karab at stsci.edu Tue Apr 18 18:11:54 2000 From: karab at stsci.edu (Kia Arab) Date: Tue, 18 Apr 2000 22:11:54 GMT Subject: can someone tell me about... References: <38FCBB16.BF50EB03@stsci.edu> Message-ID: <38FCDC5D.56E0AD8C@stsci.edu> Robin, Thanks for clearing that up. From elb at cfdrc.com Wed Apr 19 12:22:31 2000 From: elb at cfdrc.com (Ed) Date: Wed, 19 Apr 2000 11:22:31 -0500 Subject: Python in the future References: <38FDB8A7.E701F81F@sec.noaa.gov> Message-ID: <38FDDD47.BAFDD041@cfdrc.com> Python will be there for NOAA 5 and 10 years from now. Why? Here's conventional answer --- it's free so you can get the source and maintain it yourslef if you want. The real scare for organizational commitment is not existence, but rather support --- will the number of Python users and level of user-to-user support be the same or bigger in 5 to 10 years?... I feel comfortable saying yes because Python is easy and it fills so many roles. j vickroy wrote: > Hello all, > > I'm relatively new to Python and am trying to gain support for it at my > work place. To that end, I'm giving a brief (overview) presentation. > One of the items I have been asked to consider is where will Python be > 5-10 years from now. I certainly don't know where C++ or Java will be > in that time frame! Any ideas on where to research the future plans for > Python would be appreciated. > > Thanks for your time, > > - jv From darrell at dorb.com Sun Apr 2 12:27:46 2000 From: darrell at dorb.com (Darrell) Date: Sun, 02 Apr 2000 16:27:46 GMT Subject: Debugging? References: <9JFz4.19$GJ3.1756@news7.onvoy.net> Message-ID: <6yKF4.16811$mV5.120823@typhoon.nyroc.rr.com> "chris davis" > Ok, I just need to know the best way to debug my python scripts? If this is > a stupid question, I apologize, but I currently use IDLE and it's completely > useless when it comes to debugging. It locks up on both my window and Linux > machines and doesn't set break points! Is there another way? another IDE? > anything? If there isn't that's fines, I can wait until IDLE is fully > developed, but I just don't want to waste my time searching. > Take a minute to look at pdb. At first the lack of a GUI seems a killer but give it a chance, you'll be glad. --Darrell From sblakey at freei.com Wed Apr 26 14:12:50 2000 From: sblakey at freei.com (Sean Blakey) Date: Wed, 26 Apr 2000 18:12:50 +0000 Subject: How can I get the name of an object??? References: <8e712k$65c$1@nnrp1.deja.com> Message-ID: <390731A2.12788170@freei.com> Peter, Python objects do not have any way of finding out what name they are referenced by. Names refer to objects, but objects do not have name. This is reasonable, since it is simple for an object to have 0, 1, or more names. Imagine what an imaginary __name__ attribute would be in the following cases: >>>class A: ... pass ... >>>A().__name__ # What should this be? ''? >>>a = A() >>>b = a # b and a are now two names for the same object >>>b.__name__ # Should this be 'a', 'b', or ['a', 'b']? There are some clever hacks to attempt this (like iterating through all the names in globals() looking for a match with the object), but I have not seen any that are completely effective. def lookupName(object): ''' Tries to find an object in the global dictionary. If the object is found, the name of that object is returned. Otherwise, the empty string is returned. ''' for name, value in globals.items(): if object is value: # pointer comparison return name else: # I know this "else" is unneeded, return '' #but it is what I mean spex66 at my-deja.com wrote: > > Hi again, > > other trivial (looking) question: > > >>> class zz: pass > >>> dd = zz() > > I cannot find the hook to get back the name of 'dd' as a string. > Why? Cause I need the names for code generation :-) > > like estimated > >>> dd.__name__ > >>> 'dd' #DON'T WORK > > any hacks available? > > Peter > (=PA=) > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list -- Sean Blakey FreeInternet.com sblakey at freei.com (253)796-6500x1025 From meh9 at cornell.edu Thu Apr 6 16:04:14 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Thu, 06 Apr 2000 16:04:14 -0400 Subject: Algorithm: combinations of (k) taken from (n) values Message-ID: Hi All, Onto the next question... Can anyone think of an algorithm to store as lists all possible combinations of k numbers taken from n possible numbers. For example, given 5 values, I want to choose 2. The number of possible combinations is given by 5!/(3!2!)=10. They are: [0,1], [1,2], [2,3], [3,4] [0,2], [1,3], [2,4] [0,3], [1,4] [0,4] I have something like: n=5 for first_choice in range(n): for second_choice in range(first_choice+1,n): for third_choice in range(second_choice+1,n): print first_choice, second_choice, third_choice The problem is that I'll be dealing with large combinations of numbers and it doesn't make sense to continue writing nested for loops. I'm trying to figure out something that generates all combinations, just based on values of k and n. Any ideas? Thanks for your help, Matt From gmcm at hypernet.com Tue Apr 11 12:23:22 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 11 Apr 2000 12:23:22 -0400 Subject: issubclass funny business In-Reply-To: Message-ID: <1256652290-41498655@hypernet.com> Les Schaffer wrote: > I have the following class hierarchy: > > ------ in module FileScanner ----- > > class StandardArrayFileScanner(ArrayFileScanner): > > --------- in module cie ---------- > > from FileScanner import StandardArrayFileScanner > > class CIE_Standards(StandardArrayFileScanner): > ... > > class Photopic(CIE_Standards): > ... > > class CIE(CIE_Standards): > ... > > > but when i need to test whther an object is an instance of a subclass > of StandardArrayFileScanner: > > # make sure std is of the correct type > if not issubclass(std.__class__, StandardArrayFileScanner): > import cie > print std.__class__, cie.CIE.__bases__ > raise NotStandardArrayError > > > but it doesnt work, even though std is of type cie.CIE : > > (gustav)~/Engineering/dspring/stoplite/matlab/Jue-Data/: python FileScanner.py You are running FileScanner. Therefore, in FileScanner, class StandardArrayFileScanner is defined in __main__. If you trickle up to the top of __bases__ above, you'll find FileScanner.StandardArrayFileScanner, which is not the same object. At least, that's my guess at what's going on. > cie.CIE (,) <=== result of print stmt > > huh?????? - Gordon From scarblac-spamtrap at pino.selwerd.nl Tue Apr 11 15:48:03 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 11 Apr 2000 19:48:03 GMT Subject: Functions and objects References: Message-ID: Matthew Hirsch wrote in comp.lang.python: > >>> a > [5] a is now a name for that list [5]. > >>> for x in range(5): # Case A > ... temp=a Now, temp is another name for the same object. a en temp are the same list. > ... print a > ... temp.append(1) This appends to that list in place. a and temp are still just different names for the same list, so they both point to the changed list. > ... > [5] > [5, 1] > [5, 1, 1] > [5, 1, 1, 1] > [5, 1, 1, 1, 1] > > >>> a=f(5) > >>> for x in range(5): # Case B > ... temp=a[:] Here, temp is a copy of a, so now temp and a are two distinct lists, with the same value ([5]). > ... print a > ... temp.append(1) Temp is changed, but since that was not the same object as a anyway, a isn't affected. > In case A, why doesn't temp reset itself to the value of a, [5], that > was predetermined before it entered the loop? Why do you need to copy > the list to get the behavior I'm looking for in Case B? Doesn't a > always equal [5]? No. Assignment in Python always works by reference. This is one of the key features of Python that you need to grok. -- Remco Gerlich, scarblac at pino.selwerd.nl 'Oook?' From mlauer at trollinger-fe.rz.uni-frankfurt.de Wed Apr 26 10:07:00 2000 From: mlauer at trollinger-fe.rz.uni-frankfurt.de (mlauer at trollinger-fe.rz.uni-frankfurt.de) Date: 26 Apr 2000 16:07:00 +0200 Subject: Python compiler ? (was Re: Python for drivers?) References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> Message-ID: <3906f804@nntp.server.uni-frankfurt.de> Martijn Faassen (m.faassen at vet.uu.nl) wrote: > Dave wrote: > > Can Python be used for writing device drivers? I just got BeOS 5 and it > > doesn't support some video cards. I'd like to write one for the Cirrus > > Logic card and I want a language that's clear and concise- Python. I've > > never written device drivers. Any suggestions? > Most probably: no. If you got it going, it'd be sloooooooooow. > Python is clear and concise, but it doesn't execute very quickly compared > to C. Python's also not as good as C at access to the bare metal > (the video card); you'd have to get significantly funky to be able to do > that (and you'd need some C in there). So in this case I think that even > prototyping in Python, then moving to C, isn't going to work. Sorry! > Wish I could've given you more positive suggestions. It's just one of those > cases where Python isn't fast or low-level enough. This is rare, but it > does happen. Speaking if this... there was a guy in this newsgroup claiming that he could write a Python compiler if there would be enough interest. What has become of this (guy | project) ? -- Regards & Gruesse from Mickey @ http://www.Vanille.de --------------------------------------------------------- How could anyone know me - when I don't even know myself ? From jacobs at darwin.epbi.cwru.edu Mon Apr 10 15:28:30 2000 From: jacobs at darwin.epbi.cwru.edu (Kevin Jacobs) Date: 10 Apr 2000 19:28:30 GMT Subject: indexed dictionaries? References: Message-ID: <8cta0u$2bg$2@eeyore.INS.CWRU.Edu> David Goodger wrote: > on 2000-04-09 22:30, Michal Wallace (sabren) (sabren at manifestation.com) > wrote: >> I'm looking for a cross between a dictionary and a list, >> such that keys() always returns keys in the order in which they were >> added, and that instance[0] refers to the first key... > ... >> Anyone got something like this? > I have implemented a list/dictionary hybrid in my SGF Parser Library (class > Node in http://gotools.sourceforge.net/sgflib/ ). It doesn't do ordered > keys(), but it does do indexing by integer (note that in this library, no > numeric dictionary keys will ever be used). It may give you a few ideas. > Please send me a copy of your final implementation of indexed dictionaries; > I'd be interested to see what you come up with. Here is my rough 3 minute attempt. ~Kevin # WARNING: Untested code class SequenceDict(UserDict): def __init__(self): UserDict.__init__(self) self._seq = [] def __setitem__(self,key,value): if not self.data.has_key(key): self._seq.append(key) self.data[key]=value def __delitem__(self,key): if self.data.has_key(key): self._seq.remove(key) del self.data[key] def seq_keys(self): return self._seq def seq_items(self): return map(None, self._seq, self.seq_values()) def seq_values(self): return map(operator.getitem, [self]*len(self._seq), self._seq) -- -----------> Kevin Jacobs <-----------|-------> (216) 778-8487 <-------- S.A.G.E. Project Technical Coordinator | Department of Epidemiology & System Administrator | & Biostatistics Internet E-mail: jacobs at darwin.cwru.edu | Case Western Reserve University ---------------------------------------------------------------------------- From exarkun at flashmail.com Sun Apr 23 02:23:33 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Sun, 23 Apr 2000 06:23:33 +0000 Subject: python-only crypt()? References: Message-ID: <390296E5.D75BB2B8@flashmail.com> "Michal Wallace (sabren)" wrote: > > Hey all, > > Is there a python-only implementation of the crypt() module? I'm > looking for users who don't have access to rebuild python with crypt > enabled... > > I could only find C modules... I'm taking a crack at porting > Crypt::UnixCrypt from perl, but I can't really tell what the code is > doing once it gets down into the DES algorithm, so it's a little > tedious. I dunno about the first part, but there's a very good (IMHO) explanation of the DES algorithm at http://www.aci.net/kalliste/des.htm if you choose to go that route. Jp -- Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes and weighs 30 tons, computers in the future may have only 1,000 vacuum tubes and weigh only 1.5 tons. -- Popular Mechanics, March 1949 -- 6:22am up 25 days, 11:29, 0 users, load average: 0.07, 0.04, 0.01 From cdaniel at xcom.net Thu Apr 6 00:27:32 2000 From: cdaniel at xcom.net (Cliff Daniel) Date: Thu, 6 Apr 2000 00:27:32 -0400 Subject: CLI over Sockets? Message-ID: <20000406002732.D1027@shell2.xcom.net> Any such module exist that might help in implementing a CLI over sockets? One such beast would preferrably operate in character mode and would would need to implement vt100 to provide the command line editing features (arrow keys, insert at cursor, etc). I'm know I'm asking for a lot but it's worth a shot in case someone has implemented this already. Thanks, Cliff From bparsia at email.unc.edu Fri Apr 7 10:09:12 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Fri, 7 Apr 2000 10:09:12 -0400 Subject: Refactoring browser for Python? References: <16d61288.5cc55c16@usw-ex0101-005.remarq.com> <19c2a6b4.30d6893e@usw-ex0103-019.remarq.com> Message-ID: <1e8pqj7.1pc3krx1gpiqleN%bparsia@email.unc.edu> wheineman wrote: > There seems to be some discussion of just this at WikiWiki. See > > http://c2.com/cgi-bin/wiki?PythonRefactoringBrowser > > and > > http://c2.com/cgi-bin/wiki?BicycleRepairMan > > BicycleRepairMan being the current name of the browser (highly > commendable choice). There's only talk at the moment but they are > looking for volunteers. I've been interested in Python refactoring for a while, at least, as a theoretical issue. It wouldn't be all that difficult to add automatic refactorings to, say, IDLE. A tricky bit is coming up with a list of suitible refactorings. But if one started with simple, intramodular refactorings (fucntion->method, method->function, moving things up and down a class heirarchy, fuction stored to local, etc.) I don't imagine it would take much time automate them at all and they would be immediately useful. Hmm. I imagine various attribute settings and gettings are ripe for refactorings, but I don't know, off hand, the details. -- Bijan Parsia http://monkeyfist.com/ ...among many things. From senn at maya.com Wed Apr 5 13:52:25 2000 From: senn at maya.com (Jeff Senn) Date: 05 Apr 2000 13:52:25 -0400 Subject: Tkinter: "Get root for a widget" is private? In-Reply-To: Randall Hopper's message of "Wed, 05 Apr 2000 12:42:58 -0400" References: <20000331112048.A1257432@vislab.epa.gov> <20000331112048.A1257432@vislab.epa.gov> <20000403064335.A1560771@vislab.epa.gov> <2Q_F4.1092$n68.187097600@newsb.telia.net> <20000405073526.A1760238@vislab.epa.gov> <20000405124258.A1747369@vislab.epa.gov> Message-ID: Randall Hopper writes: > Jeff Senn: > |Unless you're doing something wacky (creating multiple roots??), you > |could just do what Tkinter itself (generally) does and use > |Tkinter._default_root to get the instance of the root object.... > > Right. I'm using _root() now which works. My original point wasn't that I ... > If _root() was ripped out in the next version of Python, I wouldn't have a > leg to stand on. And by all rights it's protected so removing it should > not affect me (or any other external code), unless I (or it) was deriving > off this class. [...deriving from one of the widget class... this is a common practice, no? So, you're probably safe anyway...] > As Fredrik mentioned I could just snitch global Tk commands off > any_old_widget, but an event loop timer object that has nothing to do with > "any" widget shouldn't be keeping a handle to any_old_widget. That's not > clean code. Definitely. ... > So my request was for _root() to be declared public (e.g. as .root()) Sorry -- I missed the very beginning of the thread. Indeed a public Tkinter.root() (or .default_root()) seems like the best solution. For the short run you could duplicate _root() in your own code -- it relies only on "public" members after all ;-) Class Misc: ... def _root(self): w = self while w.master: w = w.master return w -- -Jas From lvw at lfpt.rwth-aachen.de Wed Apr 19 04:28:46 2000 From: lvw at lfpt.rwth-aachen.de (Lars von Wedel) Date: Wed, 19 Apr 2000 10:28:46 +0200 (MET DST) Subject: Using CGI module with 'canned queries' Message-ID: <200004190828.KAA03403@gromit.rwth-aachen.de> Hello, I want to use Python to implement some CGI scripts. I want these scripts to be callable from any link (not only via a form), e.g. the user shall be able to enter something like http://.../test.py?name=Bill into Netscape directly. I expected that such a URL could be processed using form = cgi.FieldStorage() print '
    ' for k in form.keys: print '
  • ' % k % ':' % form[k] % '
  • ' (after printing an html header of course). However, the dictionary seems to be empty when the http daemon starts my script. How do I access parameters within the script if not started via a form? Lars From g2boojum at hotmail.com Sat Apr 22 15:36:16 2000 From: g2boojum at hotmail.com (Grant Goodyear) Date: Sat, 22 Apr 2000 14:36:16 -0500 Subject: executable "wrapper" gui -- advice sought Message-ID: I'm in the process of writing an exceedingly simple gui that will take an already existing binary executable and input text file (I don't want to break the working system!) and allow the user to modify the input arguments, if desired, and then start the executable. That part is straightforward. What I'm not sure how to do is to capture the executable's std out as it's generated. My goal is to echo that output to a seperate window, and also to use it to generate a periodically updated html "status report" so that the program's progress can be monitored remotely. Working through the gui aspects isn't all that difficult, but I have _no_ idea how to grab the executable's std out _while it is running_ and then have the python gui do something (anything!) with that data. Any advice? Many thanks, Grant Goodyear From tismer at tismer.com Thu Apr 20 11:54:06 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 20 Apr 2000 17:54:06 +0200 Subject: Why MFC instead of Tkinter -- was Re: Pythonwin? References: <4QtL4.24$v85.41@news-server.bigpond.net.au> <7LDL4.534$v85.2563@news-server.bigpond.net.au> <38ff21b8$0$10972@senator-bedfellow.mit.edu> Message-ID: <38FF281E.5B2DCC71@tismer.com> Robert wrote: > > To each his own I guess. I work mostly on Windows platforms, and for me > MFC is a lot better than Tk for a couple of reasons. > 1) I can port MFC/C++ programs a lot easier > 2) I may be mistaken, but MFC based guis are faster than Tk > 3) I really do not like using layout managers, and using Visual C++'s dialog > editor > is the best thing since sliced bread IMHO. Really? Then you never used Delphi, I believe. If you have a chance to try that, try that, and you will most probably throw MFC far far away. For me, it is an order of magnitude easier to use. Unfortunately, I have no current info about the PyDelphi project. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 pf at artcom-gmbh.de Tue Apr 18 07:59:29 2000 From: pf at artcom-gmbh.de (Peter Funk) Date: Tue, 18 Apr 2000 13:59:29 +0200 (MEST) Subject: Lazy imports (was Re: module naming) In-Reply-To: from "Michal Wallace (sabren)" at "Apr 16, 2000 8:59:26 pm" Message-ID: Hi! > On Mon, 17 Apr 2000, David Arnold wrote: > > what about something like > > > > from Record import Record > > from Field import Field > > from IdxDict import IdxDict > > > > in your zdc/__init__.py ? [...] Michal Wallace (sabren) asks: > That's certainly a lot cleaner! But is there a way to do that and > not have it load each one of those files every time? There's actually > more than 3, and even though they're all fairly small, I'd rather not > have the overhead of loading them until they're needed. You could try to adopt the lazy loader concept implemented in the Pmw package. The idea is to use a small tool, that builds a dictionary of exported features (classes and more) by investigating all module files in the package and places this in a file called for example 'exports.def'. Than you can use the following __init__.py file to load features (classes, constants, functions, or modules, what you want) on demand. The idea is "stolen" from Greg McFarlanes wonderful Pmw package: Regards, Peter ---- 8< ---- 8< ---- cut here ---- 8< ---- schnipp ---- 8< ---- schnapp ---- #!/usr/bin/env python ## vim:ts=4:et:nowrap """__init__ : This file is executed when the package is imported. It creates a lazy importer/dynamic loader for the package and replaces the package module with it. This is a very simplified version of the loader supplied with Pmw. All the package version management has been stripped off.""" import sys, os, string, types _EXP_DEF = 'exports.def' # export definition file _BASEMODULE = 'base' # Name of Base module for the package class _Loader: """An instance of this class will replace the module in sys.modules""" def __init__(self, path, package): self._path, self._package = path, package self._initialised = 0 def _getmodule(self, modpath): __import__(modpath) mod = sys.modules[modpath] return mod def _initialise(self): # Create attributes for the Base classes and functions. basemodule = self._getmodule('_'+self._package+'.'+_BASEMODULE) for k,v in basemodule.__dict__.items(): if k[0] is not '_' and type(v) != types.ModuleType: self.__dict__[k] = v # Set the package definitions from the exports.def file. dict = { '_features' : {}, '_modules' : {}, } for name in dict.keys(): self.__dict__[name] = {} d = {} execfile(os.path.join(self._path, _EXP_DEF), d) for k,v in d.items(): if dict.has_key(k): if type(v) == types.TupleType: for item in v: ## modpath = self._package + item modpath = item dict[k][item] = modpath elif type(v) == types.DictionaryType: for k1, v1 in v.items(): ## modpath = '_'+self._package +'.'+ v1 modpath = v1 dict[k][k1] = modpath self.__dict__.update(dict) self._initialised = 1 def __getattr__(self, name): """This will solve references to not yet used features""" if not self._initialised: self._initialise() # Beware: _initialise may have defined 'name' if self.__dict__.has_key(name): return self.__dict__[name] # The requested feature is not yet set. Look it up in the # tables set by exports.def, import the appropriate module and # set the attribute so that it will be found next time. if self._features.has_key(name): # The attribute is a feature from one of the modules. modname = self._features[name] mod = self._getmodule('_'+self._package+'.'+modname) feature = getattr(mod, name) self.__dict__[name] = feature return feature elif self._modules.has_key(name): # The attribute is a module mod = self._getmodule('_'+self._package+'.'+name) self.__dict__[name] = mod return mod else: # The attribute is not known by the package, report an error. raise AttributeError, name # Retrieve the name of the package: _package = os.path.split(__path__[0])[1] # Rename (hide) the original package for later perusual: sys.modules['_'+_package] = sys.modules[_package] # Create the dynamic loader and install it into sys.modules: sys.modules[_package] = _Loader(__path__[0], _package) From mwh21 at cam.ac.uk Fri Apr 14 05:58:16 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Apr 2000 10:58:16 +0100 Subject: exception problem References: <38f6ebc3.0@news.proweb.co.uk> Message-ID: ".:|:." writes: > File "/pr0n/getGroup.py", line 58, in ? > ArticleToFile(s, `i`) > File "/pr0n/getGroup.py", line 26, in ArticleToFile > decode(uufn, binfh) > File "/usr/lib/python1.5/uu.py", line 95, in decode > raise Error, 'No valid begin line found in input file' > uu.Error: No valid begin line found in input file > > from uu import * > decode(infile, outfile) > > raise Error, 'No valid begin line found in input file' > uu.Error: No valid begin line found in input file > > > how do i trap it > > i've tried > > try: > decode(infile, outfile) > except uu.error: > pass > > gives me > > NameError uu : Well, that's 'cause you did from uu import * which does not put `uu' into the local namespace ... Two options: 1) don't do "from ... import *" (this is the right one ) 2) try this: try: decode(infile, outfile) except error: pass but that's fragile (see option 1). Cheers, M. -- "declare"? my bogometer indicates that you're really programming in some other language and trying to force Common Lisp into your mindset. this won't work. -- Erik Naggum, comp.lang.lisp From gmcm at hypernet.com Sat Apr 8 13:20:00 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 8 Apr 2000 13:20:00 -0400 Subject: Cacheing sys.path rather than building it each time? In-Reply-To: <0502b954.18a27ec8@usw-ex0103-023.remarq.com> Message-ID: <1256908084-26112509@hypernet.com> Hamish Lawson wrote: > Steve Holden wrote: > > > Probably not an awfully good idea, given that "installation" of > > a new module often consists of just dropping a ".py" file into > > a library directory. Without an common "install" process the > > work of checking whether the cahced path is up to date would > > be almost as much as that of building the path from scratch > > as is now done. > > Had you thought I was proposing that such a check be done > whenever Python was started? I'd agree that the work of checking > whether the cached path is up to date would be almost as much > work as building the path. However that wasn't part of my > proposal. > > Instead when a module is installed, the pathbuilder tool would be > run either by the module's install program (perhaps via the > distutils) or manually by the user. (You could even run it at > scheduled intervals if you thought that necessary to catch > omissions.) My goal is to avoid having the path built every time > Python starts. > > A command-line option for the Python interpreter could be used to > determine whether it uses the cached path or builds the path from > scratch; the decision as to which should be the default I'll > leave to others. There are 3 pieces to the puzzle. 1) How do you find those things that Python requires (bootstrap). 2) How do you build the list of places to look for Python modules. 3) What is the complete universe of importable Python modules. You are talking about #3, but the original question seems to have been about #2. Caching #3 would involve rewriting the entire import mechanism. It would yield enormous runtime speedups, since an import would take 1 I/O (vs something along the lines of 4 * len(sys.path)/2). This might be very cool in a CGI type situation, but it's very unlikely to ever become standard Python because it violates the "no surprises" rule. There are also other, simpler ways of speeding up imports (eg, archives). But the startup overhead is mostly in #1. There's a lot of code in getpath.c dealing with things like developer builds, strange installations and other sys admin hacks. For a general purpose Python installation, this code needs to be there (well, it needs to be someplace, not necesarily in getpath.c); but for a special purpose Python, it's relatively easy to hack getpath.c to your needs. Once you've done that, #2 is really a non-issue. Consolidate your .pth files and /or fine tune sitecustomize.py and sys.path will get filled out with minimal I/Os. - Gordon From aycock at csc.uvic.ca Mon Apr 24 10:59:12 2000 From: aycock at csc.uvic.ca (John Aycock) Date: 24 Apr 2000 14:59:12 GMT Subject: partial parsing? References: <8dvilp$88s$1@slb6.atl.mindspring.net> <8e10n7$rkl$1@slb3.atl.mindspring.net> Message-ID: <8e1ng0$4sao$1@uvaix7e1.comp.UVic.CA> Andrew Dalke wrote: > I've been looking at existing parser generation systems, such as > lex/yacc, SPARK and Plex. They all seem to be designed to verify > every character in the file, so I lose some of the performance > given the guarantee of having a valid format. Well, parsers operate on a token stream, which can be as abstract as you like. It sounds like what you want is "fuzzy parsing," a term coined in A Systematic Approach to Fuzzy Parsing RAINER KOPPLER Software: Practice and Experience Volume: 27, Issue: 6, Date: June 1997, Pages: 637-649 John From Norman_Shelley-RRDN60 at email.sps.mot.com Fri Apr 28 11:43:44 2000 From: Norman_Shelley-RRDN60 at email.sps.mot.com (Norman Shelley) Date: Fri, 28 Apr 2000 08:43:44 -0700 Subject: ?sys.argv values more literally? Message-ID: <3909B1AF.32FC8BED@email.sps.mot.com> I need to write a frontend program that will call one of two other programs (both of which are NOT binaries but are tcl programs therefore they HAVE to be invoke with os.system() or "/bin/sh" has to be the first argument to a os.execv() call). THe frontend program must detect a "-ver someversionname" options and remove the two words and then call the appropriate tcl program with the EXACT arguments given on the command line (less those two words). Problem is words in sys.argv that were quoted on the command line look like words that were not quoted on the command, e.g. %frontend -ver 1.0 word1 word2 "word three" "word(three)" argv looks like ["frontend", "-ver", "1.0", "word1", "word2", "word three", "word(three)"] but this fails when os.system or os.execv is called (with frontend, -ver, and 1.0 replaced with the tcl program full pathname (/bin/sh added at front for execv) as "word three" and "word(three)" are missing there protective quotes (the /bin/sh needs to see those as one word not two words or a word with parens). I need argv to look like this: ["frontend", "-ver", "1.0", "word1", "word2", '"word three"', '"word(three)"'] where words that were quoted on the command line are strings with beginning and ending quotes in the argv. Any way to do this or get around this problem? -- Best regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norman_Shelley-RRDN60.vcf Type: text/x-vcard Size: 281 bytes Desc: Card for Norman Shelley URL: From mskott at image.dk Mon Apr 24 14:18:23 2000 From: mskott at image.dk (Martin Skøtt) Date: Mon, 24 Apr 2000 18:18:23 GMT Subject: Trouble compiling PyGreSQL 2.4 on Linux References: Message-ID: <7ldngy6z.fsf@jumbo.skott.dk> Oleg Broytmann writes: > On Mon, 24 Apr 2000, Martin Sk?tt wrote: > > Seems like a great time for me to learn how to write a make file. I > > will post it to him one of the following days. > > You couldn't write a plain makefile - there are many different systems, > and installations, etc. As far as I know, this special situation only occurs on Red Hat systemts and not other Linux distributions (maybe on mandrake which is RH with some extra vanilla). > Better, learn to write Distutil, and write one for PyGreSQL - that's a > Real Challenge! I have allready thought about it and that seems a lot smarter, but that should propably be left over to the more experienced Python installers. -- Martin Sk?tt mskott at image.dk 'In a certain sense, all decent programming languages are equally powerfull' Dr. Alan Turing From mfletch at tpresence.com Wed Apr 26 11:21:20 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Wed, 26 Apr 2000 11:21:20 -0400 Subject: [Win32] Retrieve icon for file type? Message-ID: I'm attempting to use the Windows registry to retrieve (and convert to a PNG/JPEG) the Windows icons for given files (so that a Windows-based server can display file-type-specific icons). I do not seem to be able to find the function shellapi.ExtractIcon ( http://msdn.microsoft.com/library/psdk/winui/icons_7h2m.htm ) in the Win32 extensions. Is there an easy way to get at the Shell icons from Python? def query ( extension): ''' get icon for the given extension ''' try: path = win32api.RegQueryValue( HKEY_CLASSES_ROOT, extension, ) filedata = win32api.RegQueryValue( HKEY_CLASSES_ROOT, '%s\\DefaultIcon'%(path), ) # how do I load the icon data? # ExtractIcon? except win32api.error: return None __________________________________ Mike C. Fletcher Designer, VR Plumber http://members.home.com/mcfletch From chafik at nevrax.com Fri Apr 7 03:46:41 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Fri, 7 Apr 2000 09:46:41 +0200 Subject: runin a node table Message-ID: <022401bfa065$69b3df00$1001a8c0@nevrax.net> Hello evrybody, I find in the Python C API the folwing function: struct _node* PyParser_SimpleParseString (char *str, int start); struct _node* PyParser_SimpleParseFile (FILE *fp, char *filename, int start); but i do'nt fin a function like PyObject* PyRun_String (struct _node *str, int start); Are there any one, or how can i do to run a node table ? Thank for all. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Wed Apr 26 05:11:57 2000 From: fredrik at pythonware.com (fredrik at pythonware.com) Date: Wed, 26 Apr 2000 09:11:57 GMT Subject: Python 1.6a2 Unicode bug (was Re: comparing strings and ints) References: <1256565470-46720619@hypernet.com> <6M1J4.662$rc9.209708544@newsb.telia.net> <8daop0$8fk$1@slb6.atl.mindspring.net> Message-ID: <8e6bsl$f1a$1@nnrp1.deja.com> Fredrik Lundh wrote: > Aahz Maruch wrote: > > >Python 1.6a2 (#0, Apr 5 2000, 23:56:55) > > >Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > > >>>> u"abc" < "???" > > >Traceback (most recent call last): > > > File "", line 1, in ? > > >ValueError: UTF-8 decoding error: unexpected code byte > > > > That looks like a bug to me. > > as far as I can tell, it's supposed to be a feature. > > if you mix 8-bit strings with unicode strings, python 1.6a2 > attempts to interpret the 8-bit string as an utf-8 encoded > unicode string. > > but yes, I also think it's a bug. but this far, my attempts > to get someone else to fix it has failed. might have to do > it myself... ;-) postscript: the powers-that-be has decided that this is not a bug. if you thought that strings were just sequences of characters, just as in Perl and Tcl, you're in for one big surprise in Python 1.6... Sent via Deja.com http://www.deja.com/ Before you buy. From cmfinlay at SPAMmagnet.com.au Sun Apr 30 05:42:59 2000 From: cmfinlay at SPAMmagnet.com.au (cmfinlay at SPAMmagnet.com.au) Date: Sun, 30 Apr 2000 19:42:59 +1000 Subject: How do I make list global please? Message-ID: How do I make list global please? I have a list which comprise of mags[0] and mags[1] I want to pass and return it from a subroutine. my code is (in two text files) from inittest import InitTest mags = [333] mags.remove(333) mags.append(0) # (Big) array of magnets mags.append(1) # (Big) array of magnets print mags[0] print mags[1] InitTest() print mags[0] print mags[1] # file :inittest.py def InitTest(): global mags print "I am in the Sub" Print mags[0] Print mags[1] print "Leaving Sub" return I get the error message QUOTE Traceback (innermost last): File "inittest1.py", line 1, in ? from inittest import InitTest File "inittest.py", line 5 Print mags[0] ^ SyntaxError: invalid syntax UNQUOTE my code works when it is all in the main routine. Please post here or reply to cmfinlay at SPAMmagnet.com.au From mwh21 at cam.ac.uk Wed Apr 5 12:16:12 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 05 Apr 2000 17:16:12 +0100 Subject: Pass by reference ? References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38EAF8D8.4B7C43B4@ecs.soton.ac.uk> <38EB56AE.F938CE06@acm.org> <38EB63BC.FE03BA31@ecs.soton.ac.uk> Message-ID: Jacek Generowicz writes: > Michael Hudson wrote: > > > Python never ever copies anything when you pass it as an argument to a > > function - it's just that sometimes the things you pass are immutable > > - which is when it looks like call by value - and sometimes they're > > mutable - when it looks a bit like call by reference. > > Not necessarily; consider the following (and please excuse my Python-naive > coding style): [snip] > So whether the call resembles by-reference or by-value depends on what you do > with the mutable object. which is why I said: > Try to cast Python semantics in terms of what other langauges do is > confusing - I've just successfully confused myself trying (as you > could see if you could read my kill-ring) - and is hence to be > considered bogus, because Python's semantics are actually extremely > straightforward. but it still doesn't copy the argument. The code you posted only confuses if you have a flawed understanding of assignment in Python (which is the same problem, of course, as the semantics of argument passing and variable assigment are the same - for a very good reason). getting-bored-of-thie-yet-everyone?-ly y'rs 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 mike.zaharkin at westgroup.com Tue Apr 18 13:08:33 2000 From: mike.zaharkin at westgroup.com (MikeZ) Date: Tue, 18 Apr 2000 13:08:33 -0400 Subject: Implementing a Python process when PC is idle? Message-ID: <38fc9694@wwwproxy3.westgroup.com> Hello, I would like to execute a Python process that gets executed when my Windows PC is in screensaver mode (so my PC can work when it is idle). Has anyone ever implemented this, or have an idea how this could be done ? I prefer to do this all in Python, including any Windows commands necessary to register the process as a screensaver. Thanks in advance, -Mike Z. From michaelc at flashcom.net Thu Apr 20 10:55:52 2000 From: michaelc at flashcom.net (Michael A. Crawford) Date: Thu, 20 Apr 2000 07:55:52 -0700 Subject: Why MFC instead of Tkinter -- was Re: Pythonwin? References: <4QtL4.24$v85.41@news-server.bigpond.net.au> <7LDL4.534$v85.2563@news-server.bigpond.net.au> Message-ID: I'm curious. Why did you not steer him in the Tkinter direction for his GUI needs? Is MFC better? I learned (and forgot MFC) some time ago, years in fact. Same with X-Windows programming. Now I'm working my way throught "Python and Tkinter Programming" by Grayson. I thought Tkinter was the preferred method for Pythong GUI programming. Am I mistaken? -Michael "Mark Hammond" wrote in message news:7LDL4.534$v85.2563 at news-server.bigpond.net.au... > "Don Tuttle" wrote in message > news:chuL4.8483$O7.17315 at typhoon.southeast.rr.com... > > [Mark] > > > You are really going to need to go through an MFC tutorial or book > before > > > you can make heads or tails of Pythonwin from that level... > > > > Any recommendations? > > Afraid not. I already new MFC when I started Pythonwin. I learnt it from > the MFC "scribble" tutorial. I find I tend to learn best with a tutorial > and then playing - that is what I did with Python (back then there was no > other alternative, but even now that is my recommended strategy for > competant existing programmers learning Python...) > > So assuming some C++ knowledge, my suggestion for MFC would still be > scribble tutorial, then invent an app to write in MFC C++, then port that > app to Python. By then you will be a wiz :-) > > Mark. > > > From thomas.heller at ion-tof.com Tue Apr 18 14:05:34 2000 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Tue, 18 Apr 2000 20:05:34 +0200 Subject: [Announce] autoreload.py References: <001601bfa8a0$c6d86f50$4500a8c0@thomasnb> Message-ID: <012901bfa960$b1422580$4500a8c0@thomasnb> I just discovered that it is easier to monitor sys.modules instead of catching all imports. Will post a new version shortly. Thomas Heller From darrell at dorb.com Sun Apr 16 10:22:36 2000 From: darrell at dorb.com (Darrell) Date: Sun, 16 Apr 2000 14:22:36 GMT Subject: Event triggering and weak references References: <8dbif3$hm0$1@metro.ucc.usyd.edu.au> Message-ID: "Ricardo Nogueira" > This is what I would like to do: > Imagine I could have two or more Widgets open displaying a car speed value, > say a numerical and a graphic display, if this car speed changes (ex. some > one pushes the break), I would like to have any open widget on this value > updated (on opening each window would register interest with this car > speed). > Here's an approach that requires changes to the watched class. Maybe some of Robert's method wrappers would be nice. Being able to hook a method from the outside is a powerful way to decouple code. But wouldn't it be harder to understand? Sometimes I think C++ is difficult because only when you trace though it do you realize where it's going. Having the watched thing provide an explicit signal seems easier to understand. Don't know if you can call this weak references but they can't cause cycles. The use of strings to avoid cycles may not be required soon with the new GC stuff. uthreads.py might be cool for this sort of thing, somehow? Thanks for the Sunday morning puzzle. --Darrell Gallion class Watches: # Only strings are stored _Obs={} def regWatch(self, obs, watch): """ obs : observer name string watch : string name of thing to watch """ Watches._Obs[watch].append(obs) def unregWatch(self, obs, watch): l=Watches._Obs[watch] x=l.index(obs) del l[x] def regWatchAble(self, watch): Watches._Obs[watch]=[] def unregWatchAble(self, obs, watch): del Watches._Obs[watch] def signal(self,watch): l=Watches._Obs[watch] w=eval(watch) for i in l: i=eval(i) i(w) def clean(self): for k in Watches._Obs.keys(): try: w=eval(watch) except: del Watches._Obs[k] print 'Cleaned:',k watches=Watches() class W1: """Something to watch""" def __init__(self, watches,name): self._var1=0 self._watches=watches self._name=name watches.regWatchAble(name) def setVar(self,v): self._var1=v self._watches.signal(self._name) # 'w1' would be more like 'moduleName.w1' w1=W1(watches, 'w1') def obs1(w): print "Signaled:",w watches.regWatch('obs1','w1') w1.setVar(6) del w1 watches.clean() ############ Output Signaled: <__main__.W1 instance at 895b48> Cleaned: w1 From teemu.keskinarkaus at ramk.fi Fri Apr 28 06:59:41 2000 From: teemu.keskinarkaus at ramk.fi (Teemu Keskinarkaus) Date: Fri, 28 Apr 2000 10:59:41 GMT Subject: Reading user input Message-ID: <39096d88.3112113532@news.ramk.fi> Hi. I'm doing some studing about python and MySQL. I've done little test program where I use database from python. Now I need get user input to do some queries(and other stuff) to database. I've read Python manual but haven't found simple solution to do that. I can read something using curses but I don't like it. Is there other(and simpler) way to do that?? I've done only CGI programs with python and there haven't been any need to read chars from user input. Only stuff from stdin that httpd have put there. At this case 'user input' is not arguments given when program starts but variables that are given when program is running. Of course I could do html-page and do my test program as CGI and use it that way but it's too much trouble when I'm only trying to learn databases and how to use them from python. TK From dworkin at ccs.neu.edu Wed Apr 5 14:05:28 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 05 Apr 2000 14:05:28 -0400 Subject: Teaching the art of programming, in python In-Reply-To: "Warren Postma"'s message of "Wed, 5 Apr 2000 11:56:11 -0500" References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> Message-ID: "Warren Postma" writes: > Speaking of Dummies, was there/is there a LISP for Dummies ... ? Not exactly, but The Little Lisper is the closest thing I know of. -Justin From Marc.Poinot at onera.fr Tue Apr 25 05:33:36 2000 From: Marc.Poinot at onera.fr (Marc Poinot) Date: Tue, 25 Apr 2000 11:33:36 +0200 Subject: how to wrap c++ software to python? References: <8e3ggq$2r1d$1@news.cz.js.cn> Message-ID: <39056670.7DB4D09F@onera.fr> fmr wrote: > > I will call c++ routine in python,how to wrap > c++ routine for python. > > Is there any utils to work except SWIG. > Have a try with: http://sourceforge.net/project/?group_id=3180 Marcvs [alias But don't use add_keyword_method ;) ] From sp00fD at yahoo.com Tue Apr 18 05:00:48 2000 From: sp00fD at yahoo.com (sp00fD) Date: Tue, 18 Apr 2000 09:00:48 GMT Subject: Using python on the web References: Message-ID: <8dh87r$3b$1@nnrp1.deja.com> It's pretty easy really, to get the basics working at least. In general, this is about what you'd need # For receiving data... import cgi query = cgi.FieldStorage() # For each parameter we expect to be passed in we do if query.has_key("ourparam"): result = query["ourparam"].value # For printing pages, you could use the cgi module or just do it by hand print "Content-type: text/html\n" print "Foobar" print "" import os for k,v in os.environ.items(): print "%s => %s
    " % (k,v) print "" For the database interaction, if you were using MySQL for instance, you need to get the MySQLdb module (http://starship.python.net/crew/adustman), build it, and then: import MySQLdb c = MySQLdb.connect(host="myhost", db="mydb", port=3316, user="me", passwd="mypass") con = c.cursor() sql = "SELECT * FROM foo" con.execute(sql) rs = con.fetchall() # returns a tuple or list c.close() In article , Charley Horse wrote: > I've just started fooling with python. I've looked around the python > site and a number of the other sites referenced there and am a bit > puzzled. Umm... how does one go about using python for web applications, > especially database driven apps? Almost everything deals with python > just as a language, as C++ would be. Not much about the web > specifically. I was a bit shocked to find the only direct refs on about > this at python.org are entwined with CGI (unless I missed it). I have no > exposure to CGI, but rather to php, CF, and ASP, so python has gone from > looking very attractive to looking... well, like a puzzle. I know about > Zope, but am interested in how one uses python on the web just by > itself. > > Thanks > Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Wed Apr 19 14:05:16 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 19 Apr 2000 19:05:16 +0100 Subject: modifying os.environ References: <8di2il$10oq$1@nntp6.u.washington.edu> Message-ID: quinn at euro.ugcs.caltech.edu (Quinn Dunkan) writes: > I do need the shell's useful things, and the system() commands are > constants, so things should be pretty bulletproof as long as the > environment is also constant, right? But it *would* be useful to > have a spawn() or run() or something builtin which does a proper > vfork/exec with no subshell involved. I often find myself writing > one of those. The time machine's got that one too: os.spawnlp(os.P_WAIT,"ls","ls") This will be 1.6. No docstrings yet... mmm. HTH, Michael -- 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/~perlis-alan/quotes.html From basv at sara.nl Tue Apr 11 08:26:21 2000 From: basv at sara.nl (Bas van der Vlies) Date: 11 Apr 2000 12:26:21 GMT Subject: sys.platform details... References: Message-ID: <8cv5ld$8nm@mira.sara.nl> In article , rob at hooft.net (Rob W. W. Hooft) writes: > > schol[51]:ccd>python > Python 1.5.2b1 (#4, Jan 14 1999, 12:05:48) [GCC egcs-2.90.21 971202 (egc on irix5 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>>> import sys >>>> sys.platform > 'irix5' >>>> ^D > schol[52]:ccd>uname -a > IRIX schol 6.3 12161207 IP32 Rob, The following code works. import os platform = os.uname() print platform Hope This helps -- ******************************************************************** * * * Bas van der Vlies e-mail: basv at sara.nl * * SARA - Academic Computing Services phone: +31 20 592 8012 * * Kruislaan 415 fax: +31 20 6683167 * * 1098 SJ Amsterdam * * * ******************************************************************** From sabren at manifestation.com Wed Apr 19 15:55:48 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Wed, 19 Apr 2000 15:55:48 -0400 (EDT) Subject: python templating system In-Reply-To: <8dl0oc$7ct$1@nnrp1.deja.com> Message-ID: On Wed, 19 Apr 2000 pozman at my-deja.com wrote: > Does anyone know of a templating system (other than zope) that is > implemented with python [ comparisons would be embperl with perl] http://zebra.sourceforge.net/ Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From thomas at xs4all.net Mon Apr 17 12:48:33 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Mon, 17 Apr 2000 18:48:33 +0200 Subject: Editors and books In-Reply-To: ; from jmassung@magpiesystems.com on Mon, Apr 17, 2000 at 09:00:56AM -0600 References: Message-ID: <20000417184833.H15664@xs4all.nl> On Mon, Apr 17, 2000 at 09:00:56AM -0600, Jeff Massung wrote: > Also, on another NG there's talk about Python, and how it does (and still > doesn't) do garbage collecting. Could someone here expand on it so I know > what it can and can't do? Memory is a big issue in my project and I need to > know how to structure my program so that garbage is collected. Thanks > again!! Python doesn't do GC, it does RC, reference counting. That means that as long as there is a reference to an object, it will not be collected. When you delete a reference to an object, it's refcount goes done by one, and when the count has dropped to 0, it's eligible for collection. (Note that this doesn't mean it gets collected right away! It usually happens fairly soon, though.) The problem with RC is that you can create circular references: a = [some large list] b = [some other large list] a.append(b) b.append(a) del a del b Now you can never refer to a and b and their contents again, but as they are still referenced (by the other list) they can't be collected, either. So avoid recursive constructs ;) It's fairly easy to fall into this trap when, for instance, fiddling with tracebacks, though that isn't common practice last time I looked. There is work being done to cure this problem in a limited way -- not all-encompassing, but enough to cure all but the most pathological case, I gather. See the newsgroup archives ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From phd at phd.russ.ru Tue Apr 25 12:47:34 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 25 Apr 2000 16:47:34 +0000 (GMT) Subject: Bookmarks database and Internet robot Message-ID: Hello! I am happy to announce the third version of my project BOOKMARKS database and internet robot! WHAT IS IT This is a set of classes, libraries and programs I use to manipulate my bookmarks.html. I like Netscape Navigator, but I need more features, so I write these programs for my needs. I need to extend Navigator's "What's new" feature (Navigator 4 names it "Update bookmarks"). WHAT'S NEW Complete rewrite from scratch. Created mechanism for pluggable storage managers, writers and robots. This opens the possibility to invite more programmers to work on different plugins. Some people already expressed interest to use and extend these programs. All code had been rewritten in much more object-oriented fashion. I do not value object orientation by itself, but for this project I found a point of view where OO helped me to create much better code - simpler, smaller, a bit faster and much more reusable. WHERE TO GET Master site: http://sun.med.ru/~phd/Software/Python/#bookmarks_db Faster mirrors: http://skyscraper.fortunecity.com/unix/797/Software/Python/#bookmarks_db http://members.xoom.com/_XMCM/phd2.1/Software/Python/index.html#bookmarks_db AUTHOR Oleg Broytmann COPYRIGHT Copyright (C) 1997-2000 PhiloSoft Design LICENSE GPL STATUS Parser is Ok. Storage managers: pickle, FLAD (Flat ASCII Database). Writers: HTML, text, FLAD. Robots (URL checkers): simple, forking. TODO More storage managers: shelve, SQL, MetaKit. More robots: threading, async. Oleg. ---- Oleg Broytmann http://www.fortunecity.com/skyscraper/unix/797/ phd2 at email.com Programmers don't die, they just GOSUB without RETURN. From schorsch at schorsch.com Thu Apr 13 04:23:01 2000 From: schorsch at schorsch.com (Georg Mischler) Date: Thu, 13 Apr 2000 08:23:01 GMT Subject: simple httplib and urllib timeout question References: Message-ID: <8d404q$oee$1@nnrp1.deja.com> Michal Wallace wrote: > there's an example script called blogbot.py there, too.. it uses > timeout.py and another hack with signal.alarm(), but neither really > works all that well.. What exactly is your problem with signal.alarm() ? It works very fine with me. Of course, I haven't tried this on any M$ system, and it's not the right approach for concurrent connections. What I do is fairly simple: def alarm_handler(signum, frame): '''what to do when an alarm signal reaches us''' raise socket.error, 'connection timed out' USER_AGENT = 'DemoBot/0.0.7' FETCH_TIMEOUT = 60 # in seconds def fetch_request(req, host, path): '''fetch a page online with error handling and timeout, req is either 'GET' or 'POST' ''' path = urllib.quote(path) if req == 'POST': path, form = string.split(path, '?') signal.signal(signal.SIGALRM, alarm_handler) signal.alarm(FETCH_TIMEOUT) try: connection = httplib.HTTP(host) connection.putrequest(req, path) connection.putheader('Host', host) connection.putheader(USER_AGENT) connection.putheader('Accept', 'text/html') if req == 'POST': connection.putheader('Content-Type', 'application/x-www-form-urlencoded') connection.putheader('Content-Length', str(len(form))) connection.endheaders() if req == 'POST': connection.send(form) errcode, errmsg, headers = connection.getreply() finally: signal.alarm(0) # reset timeout return connection, errcode, errmsg, headers The calling function will then read from the connection and close it again. It will also catch any network related exceptions, including the timeout. All this assumes that there is only one connection in place at any time, and you just don't want to wait overly long for unresponsive hosts. If you need concurrent connections, then asyncore is more powerful. You will have to maintain a lot of state, but once you understand how all the different parts of ansyncore work together it should be fairly easy to get the individual timeouts to do the right thing. Have fun! -schorsch -- Georg Mischler -- simulations developer -- schorsch at schorsch.com +schorsch.com+ -- lighting design tools -- http://www.schorsch.com/ Sent via Deja.com http://www.deja.com/ Before you buy. From darcy at vex.net Thu Apr 27 06:00:04 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 27 Apr 2000 10:00:04 GMT Subject: Best database to use with Python References: <3906ea27.698463777@news.online.no> Message-ID: <8e9334$qba$1@news.tht.net> ?5?HH575-UAZWKVVP-7H2H48V3 wrote: > What database-system is easiest, fastest etc. to use with Python? I`ve > looked at MySQL, but it seems a little overkill just to get a little > more functionality than Berkley DB-functionality. What about Postgres? > mSQL? > Postgres comes with my Linux distro and seem smaller than MySQL. How Actually I think you will find PostgreSQL larger than MySQL. > does it compare to MySQL when it comes to administration and speed, > scalability etc. ? I don't use MySQL as I find that PostgreSQL has more features and works fast enough for my needs. Like most RDBMSs in its class the expensive part is updates and inserts but the retrievals are quite snappy. The one time I tried to administer a MySQL system I was a little horrified. PostgreSQL was easier to understand. That could just be me, of course. Doesn't mSQL have some funny licensing issues? > I`m doing alot of index-lookups for a > Yahoo/Altavista/WhatEverSearchEngine-like web-app. > > It have to be fast, capable of HUGE amounts of data, free and easy to > install and administer. > Since PostgreSQL comes with your system I would stick with it unless you find something in MySQL that you need that PostgreSQL doesn't have. And don't rule out Berkley DB-functionality if your requirements are simple enough. It can be extremely fast, it's small and there are some nice Python interfaces to it, particularly shelve. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.vex.net/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. From alwagner at tcac.net Thu Apr 13 07:40:32 2000 From: alwagner at tcac.net (Albert Wagner) Date: Thu, 13 Apr 2000 06:40:32 -0500 Subject: redirecting stdout to printer Message-ID: <38F5B230.2FEFB9BC@tcac.net> How do I specify my printer as stdout? Know of a module that has basic prettyprinting with headings and pagenumbers? -- Small is Beautiful From pf at artcom-gmbh.de Sun Apr 2 15:24:02 2000 From: pf at artcom-gmbh.de (Peter Funk) Date: Sun, 2 Apr 2000 21:24:02 +0200 (MEST) Subject: Who is this years winner? Message-ID: Today on April 2nd I began to wonder whether the PSA Steering Committee has already decided on the winner of the third Pythonic Award. Fortunately www.python.org is back online now but unfortunately the page seems to show up a file from two year old backup, and so does the Shrine of the of the winner of the first Python Award at May I kindly ask some member of the famous Steering Committee to publish this years decision here? ;-) Best regards, Peter. -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen) From banderson at boi.hp.com Mon Apr 17 15:07:50 2000 From: banderson at boi.hp.com (Bill Anderson) Date: Mon, 17 Apr 2000 13:07:50 -0600 Subject: Scripting and Gnome and KDE References: <7t0ffs8ncrrh3irgc52rbsb68ue48rfovf@4ax.com> Message-ID: <38FB6106.7E3BFC1D@boi.hp.com> Alex Thomas wrote: > > This might seem an odd way to choose a GUI, but if you had the choice > between scripting Gnome/Gtk or KDE/Qt-based components using Python, which > would you go for? > > Thanks peeps > Alex The biggest problem I have with the bindings I have seen (pyFLTK .. currently using this one, pyGTK/pyGNOME,pyQt) is that the documentation assumes you use the tookit's original documentation. Many pythoneers don't use C or C+fuss. In order to understand the bindings, you have to understand the original toolkit's native language. That alone has put off many aspiring pythoneers, I can attest to. -- Bill Anderson Linux/Unix Administrator, Security Analyst ESBU (ARC) bill_anderson at boi.hp.com My opinions are just that; _my_ opinions. From phd at phd.russ.ru Wed Apr 26 04:21:46 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Wed, 26 Apr 2000 08:21:46 +0000 (GMT) Subject: Working with data returned by PyGreSQL In-Reply-To: Message-ID: On Tue, 25 Apr 2000, Martin Sk?tt wrote: > do connects and querys). My problem is how do I get to anything other > than print my query results? What datatype does the query return? I http://sun.med.ru/~phd/Software/Python/#rgb_example There are source tarball and running demo. Welcome. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From neelk at brick.cswv.com Mon Apr 3 22:08:18 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 4 Apr 2000 02:08:18 GMT Subject: [Python-Dev] New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <200004031604.MAA05283@eric.cnri.reston.va.us> <20000403165621.A9955@cnri.reston.va.us> Message-ID: Greg Ward wrote: > > Hasn't anyone noticed that the largest amount of text in the joke > feature list was devoted to the Distutils? I thought *that* would give > it away "fer shure". You people are *so* gullible! ;-) Hey! You actually fooled me for a good long while. Until I started thinking, "M4? I didn't think distutils used a lot of M4." Then I checked the web page, then I checked the date, and then I went, "Oh. Duh." Neel From paulb at infercor.no Wed Apr 19 06:36:38 2000 From: paulb at infercor.no (Paul Boddie) Date: Wed, 19 Apr 2000 12:36:38 +0200 Subject: Using CGI module with 'canned queries' References: <200004190828.KAA03403@gromit.rwth-aachen.de> Message-ID: <38FD8C36.4242425F@infercor.no> Lars von Wedel wrote: > > Hello, > > I want to use Python to implement some CGI scripts. I want these > scripts to be callable from any link (not only via a form), > e.g. the user shall be able to enter something like > > http://.../test.py?name=Bill > > into Netscape directly. The parameter(s) should still be received correctly in the CGI script. > I expected that such a URL could be processed using > > form = cgi.FieldStorage() print '
      ' > for k in form.keys: > print '
    • ' % k % ':' % form[k] % '
    • ' Surely you mean... print '
    • ' + k + ':' + form[k].value + '
    • ' > (after printing an html header of course). > > However, the dictionary seems to be empty when the http daemon > starts my script. Are you sure that the problem doesn't lie in the fact that form[k] is not likely to be a string, but a FieldStorage object instead? Thus, you must refer to the value attribute of form[k]. > How do I access parameters within the script if not started via a form? You should be able to do just that with the 'cgi' module. Paul From jddst19 at pitt.edu Tue Apr 4 11:22:15 2000 From: jddst19 at pitt.edu (John Duncan) Date: Tue, 4 Apr 2000 11:22:15 -0400 Subject: Smalltalk on the small end (was: Advice requested: GUI project beginning) References: <8D79BC9E4960ED70.7B6609342D6EB723.7625773D14AD9140@lp.airnews.net> Message-ID: <8cd1c2$3ut$1@usenet01.srv.cis.pitt.edu> > The point is that there's little point to "scripting" in Smalltalk > when it doesn't really get powerful 'til you build up a rich set of > functionality in a "Smalltalk Environment." And *that* is something > you don't want to respawn repeatedly... Hmm... This brings up an interesting conflict to the term "general-purpose programming language." I have seen this term used quite often, usually meaning that a language is turing-complete and allows access to system structures. But when it comes down to it, there are no general-purpose languages. The market thinks so, but anyone who programs in Smalltalk knows better. As Squeak evolves, people often ask, "Can Squeak do this feature of some other system?" The Squeak team says, "No, but no-one's stopping you." If the person goes ahead and does it, something like implementing native widgets or scripting support for a certain OS, the response, even by the implementor, is usually, "Why did I care in the first place?" Simply put, it's much easier to let environments that are good at one thing do that thing, rather than trying to make a single environment do everything. For the same reason, I don't understand why people still write user interfaces in C++. Or even Java for that matter. The tools are simply not advanced enough to do it well. But, you do it in ST, and you have something quick and elegant. Similarly, you have people trying to make Smalltalk do hard realtime systems. Why? To me, this is kind of like implementing Linux on an Atari 800. It has geek value but there's still a much better tool for the job. -John From drew.csillag at starmedia.net Fri Apr 28 10:52:46 2000 From: drew.csillag at starmedia.net (Andrew Csillag) Date: Fri, 28 Apr 2000 10:52:46 -0400 Subject: How to use DCOracle and LOBs in Oracle 8i ???? References: <20000428124808.A21389@sz-sb.de> Message-ID: <3909A5BE.277160BC@starmedia.net> Andreas Jung wrote: > > After reading old postings concerning DCOracle and LOBs I > can not solve the following problem: > > I have a table under Oracle 8i with a NCLOB field. The base > character set for the complete database it UTF8. My first > problem with DCOracle was an ORA-12704 character set mismatch error when > I tried to insert an instance of DCOracle.dbi.dbiRaw() in to the database. > > My current code looks like this (the table contains the NCLOB field 'content'): > > lob = 'very long text .....' > raw = DCOracle.dbi.dbiRaw(lob) > > com = 'insert into tab (docnum,content) values(:x,translate(:y using nchar_cs))' > curs.execute(com,x='1234',y=raw) > > This works for LOBs with less than 4000 bytes. For longer LOBs I get the following error > message: ORA-01461 can bind a LONG value only for insert into a LONG column. > > Now...how can I store larger LOBs with more than 4000 bytes ? I have read something > about a dbms_lob package but I have really no idea how to use it. > > Has anyone a working solution or a code example ?! > What you have to do on insert or update is something like this: a table defined as such: create table foo_table (pkoid NUMBER, blobval BLOB) conn = DCOracle.connect('user/pw') cur = conn.cursor() cur.execute('insert into foo_table (pkoid, blobval) values (1, EMPTY_BLOB())') cur.execute('select blobval from foo_table where pkoid = 1 for update') blob = cur.fetchone()[0] #can't use fetchall or is blobval is converted to string! blob.write(stringToPutIntoBLOB) conn.commit() The weird INSERT/SELECT dance is just the way Oracle works, and not a problem so much with DCOracle. To do an UPDATE, you update the lob row with EMPTY_BLOB() and do the select for update dance again. Unfortunately, there seems to be an issue with dealing with more than one lob at a time in terms of read()ing and write()ing. So if you're only dealing with one, that's ok, but if you try to deal with more than one at a time, you need to play with it a bit to see if it will work. This may not normally be a problem, but there is a hidden issue: cursor.fetchall() won't work if there is more than one lob in the result set that isn't empty (it tries to stringify lobs on the result rows), so you have to use cursor.fetchone() to cycle through the result rows (which is probably what you'd do anyhow, so it's not such a big deal, but one to be aware of in any case). Hope this helps, Drew -- print(lambda(q,p):'pmt:$%0.2f'%(q*p/(p-1)))((lambda(a,r,n),t:(a*r/ t,pow(1+r/t,n*12)))(map(input,('amt:','%rate:','years:')),1200.0)) From dan at cgsoftware.com Wed Apr 12 17:31:11 2000 From: dan at cgsoftware.com (Daniel Berlin+list.python) Date: 12 Apr 2000 17:31:11 -0400 Subject: Python/Perl Popularity (Re: A Mountain of Perl...) In-Reply-To: pj@sgi.com's message of "12 Apr 2000 21:16:42 GMT" References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d1inu$nsq$1@newshost.accu.uu.nl> <38F4996F.E3BD2626@acm.org> <8d2p3q$2vj9o$1@fido.engr.sgi.com> Message-ID: >>>>> "Paul" == Paul Jackson writes: Nope, both lynx, and links, exist. Paul> BobC wrote: |> The text-mode browser named "links" Paul> I suspect that you meant "lynx" ?? Paul> -- From alwagner at tcac.net Thu Apr 27 09:20:11 2000 From: alwagner at tcac.net (Albert Wagner) Date: Thu, 27 Apr 2000 08:20:11 -0500 Subject: The Simple Economics of Open Source References: <390534BB.3D6CEBDF@libc.org> Message-ID: <39083E8B.25845D83@tcac.net> Raffael Cavallaro wrote: > > I think that many open source advocates have > failed to apply simple logic to the economics of open source, believing > that somehow, the internet, or software, is immune from simple laws of > supply and demand. They are not. > I am going to have to go back and reread all of your previous posts. You seem to be rebutting a point that was never made. Of course, Open Source software is not immune to the laws of supply and demand. Who said it was? It is in response to those laws that it is free. But free only in the world of economics where dollar worth is all that matters. It is this very world, where the only motivation taken into account is money profit, that Open Source has escaped. And the escape has been dazzling. --- "But beware! The time for all this is not yet. For a least another hundred years we must pretend that fair is foul and foul is fair; for foul is useful and fair is not. Avarice and usury and precaution must be our gods for a little longer still. For only they can lead us out of the tunnel of economic necessity into daylight." -- Lord Keynes, 1930 From kern at caltech.edu Thu Apr 13 15:34:49 2000 From: kern at caltech.edu (Robert Kern) Date: 13 Apr 2000 19:34:49 GMT Subject: Simple formatting string question References: Message-ID: <8d57gp$1om@gap.cco.caltech.edu> In article , Matthew Hirsch writes: > Hi All, > > I'm trying to print something like this: > >>>> print 6*'%2i' '%1i' % tuple([5,5,5,5,5,5,1]) > > but I'm getting an error. """ TypeError: not enough arguments for format string """ specifically. The problem is because of the following behavior: >>> 6*'%2i' '%1i' '%2i%1i%2i%1i%2i%1i%2i%1i%2i%1i%2i%1i' The implicit string concatenation happens before the multiplication. Add a + between the strings first, and the normal order of operations will do what you want. GuruQuestion: Should implicit string concatenation have a different precedence than explicit string concatenation? Perhaps only a mention in http://www.python.org/doc/current/ref/string-catenation.html ? > Do you know what the correct syntax should be? > > Thanks, > Matt -- Robert Kern kern at caltech.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter From hamish_lawson at yahoo.co.uk Thu Apr 13 11:09:29 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Thu, 13 Apr 2000 08:09:29 -0700 Subject: Building MySQLdb on Solaris gives PyTuple_New not found Message-ID: <0ef708b6.3904ad2d@usw-ex0108-063.remarq.com> When I try to build MySQLdb-0.2.0 on Solaris 2.6 I get the following relocation error about PyTuple_New: ------------------------------------------------------------ gcc -I/usr/local/mysql/include -g -O2 - I/usr/local/include/python1.5 -I/usr/lo cal/include/python1.5 -DHAVE_CONFIG_H -c ./_mysqlmodule.c ld -G _mysqlmodule.o -L/usr/local/mysql/lib -lmysqlclient -o _mysqlmodule.so Whoa, couldn't import _mysql: ld.so.1: python: fatal: relocation error: file ./_ mysqlmodule.so: symbol PyTuple_New: referenced symbol not found ------------------------------------------------------------ Any suggestions? Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From paul.magwene at yale.edu Wed Apr 12 11:51:26 2000 From: paul.magwene at yale.edu (Paul Magwene) Date: Wed, 12 Apr 2000 11:51:26 -0400 Subject: No method overloadin I suppose ? References: <38F4938E.8F245B68@altern.org> Message-ID: <38F49B7E.A68D91C1@yale.edu> Thomas SMETS wrote: > > ## Beginning of Python program ... > class Lister: > def __init__(self): > print 'In constructor ...' > __init__(1) > > def __init__(self, lValue): > print 'In constructor with parameter' > self.l = lValue > > def __repr__(self): > print '\n******\n\tValue is : ', l, '\n********' > > if __name__ == "__main__": > x = Lister() > y = Lister (2) > ## End of python program > > Trace of execution is : > Traceback (innermost last): > File "Minheritence.py", line 14, in ? > x = Lister() > TypeError: not enough arguments; expected 2, got 1 > End of trace ... > > I guess I can't do methods overloadin', as shown... WHY is that ? I'm > wrong ? You can't overload methods as you would in C++, but the following accomplishes the same thing. You could also test for the types of parameters using the function type() and the types module. --Paul class Lister: def __init__(self,lValue=None): if lvalue: print "Constructed with parameter" self.l = lValue else: print "Default construction" self.l = 1 def __repr__(self): print '\n******\n\tValue is : ', l, '\n********' From hdemers at venus.astro.umontreal.ca Thu Apr 6 14:17:04 2000 From: hdemers at venus.astro.umontreal.ca (Hugues Demers) Date: Thu, 06 Apr 2000 18:17:04 GMT Subject: Beginning to be disapointed Message-ID: Hi, Can somebody help me on this? I'm using python to read big arrays (100x2000) of float. I manipulate those arrays, I do small operations on them. That is ok. I do others smalls calculations not involving the big arrays and then the interpreter hang ! The cpu percentage used by python goes up and there is nothing else to be done except to kill the interpreter. I have no idea what's going on. Do I need to free memory in some way ? Am I doing something wrong ? There is nothing special about the calculations involving the big arrays. The only thing special is that they are big. Thank you Hugues From effbot at telia.com Mon Apr 3 11:56:11 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 03 Apr 2000 15:56:11 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> Message-ID: Bob Alexander wrote: > This is not an [intentional] flame bait, nor an April Fool's message, but > think about it: Python has two "sequence" data types, lists and tuples, > which from the Python programmer's perspective are only slightly different. > How does having both types significantly improve life for Python > programmers? some random remarks (please consider them all before responding): -- http://www.python.org/doc/FAQ.html#6.15 -- things should be as simple as possible, but no simpler. -- from a human perspective, using different syntax for different things is good. tuples are simple structures. lists are collections of homogenous (in one sense or another) values. from a program design perspective, that are two radically different things. -- adding a comment won't make an object immutable. -- tuples can be used as dictionary keys. mutable collections can not. -- python's core types fall into two categories: the first is simple types, like numbers, strings, and tuples. they are all immutable. the other category is container (or collection) objects. they're far more powerful, and harder to use for beginners. -- this has been discussed over and over again. have you studied earlier threads on this topic? -- good designers know that hypergeneralization tends to be a bad idea. -- what would happen if we took them away? -- do we really need yet another "I don't fully understand this, so it should go away" thread? do you really think that tuples are just an accidental feature? (just asking...) > Suppose Python had only one sequence data type: list, and that we could use > it in all places where tuples are needed now. I would never have to think > about whether to use tuple or list. I would never have to convert from tuple > to list or vice versa. Just one more thing I don't have to bother with. if you find that you end up doing this all the time, you're not following the "fixed structures vs. homogenous collections" design rule. (or you're using extension modules that haven't been upgraded to use the abstract sequence API. most standard extensions do, these days). if you don't do this all the time, what's the big deal? > I suspect there will be several answers offered as to why we need both > types, but I also suspect most of the benefits are for the Python > implementor(s), not programmers. umm. I thought having two similar types meant more work for the python implementors, not less? From phd at phd.russ.ru Thu Apr 27 10:11:52 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 27 Apr 2000 14:11:52 +0000 (GMT) Subject: About Zope`s FTP-server In-Reply-To: <39084411.13519730@news.online.no> Message-ID: On Thu, 27 Apr 2000, 5?HH575-UAZWKVVP-7H2H48V3 wrote: > found. But my database inside Zope was bigger. This is fine and nice > for small pics and html-stuff, but I want to upload pickled objects > that can be several megabytes in size, then have a Zope-like or > Zope-integrated method store them in some database, NOT gadfly, cuz Use external DB - BerkeleyDB or SQL. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From gmcm at hypernet.com Wed Apr 5 16:02:33 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 5 Apr 2000 16:02:33 -0400 Subject: Pass by reference ? In-Reply-To: <38EB838A.53122AF6@acm.org> Message-ID: <1257157531-11108477@hypernet.com> Robert W. Cunningham wrote: > The CS models of "Pass By Reference" and "Pass By Value" are fairly well understood, > but they do not seem to map simply and directly to Python. Grrr. Pascal causes brain damage. Python is exactly like Java (with the exception of having no primitive types). These notions should state *what* is being passed. In Pascal, that's "value of a slot" or "reference to a slot". To be precise, in Python it is *always* "value of a reference", (think "pointer value", not "value of that which is pointed to"). For all of Herr Werth's genius, he bamboozled millions with his little sleight of hand. - Gordon From parkw at better.net Wed Apr 12 13:41:15 2000 From: parkw at better.net (William Park) Date: Wed, 12 Apr 2000 13:41:15 -0400 Subject: global variables - how?? In-Reply-To: <8d2bne$qn7$1@news101.telia.com>; from aek@mail1.stofanet.dk on Wed, Apr 12, 2000 at 07:28:37PM +0200 References: <8d2bne$qn7$1@news101.telia.com> Message-ID: <20000412134115.A9193@better.net> On Wed, Apr 12, 2000 at 07:28:37PM +0200, Anders Eggers-Krag wrote: > how do I define a propper global variable that works in all functions in all > modules? As far as I know, you can't. You have to use 'global ...' inside all your functions. --William > > I have tried simply > defining one outside of any function in the main module, > I have tried using the global keyword under the same cicumstances, > but they are not even avialible inside of functions within the main > module... > > > -- > Anders Eggers - Krag > > > -- > http://www.python.org/mailman/listinfo/python-list From Ted.Horst at wdr.com Fri Apr 7 11:06:07 2000 From: Ted.Horst at wdr.com (Ted Horst) Date: Fri, 7 Apr 2000 10:06:07 -0500 Subject: [Python-Dev] Round Bug in Python 1.6? (str vs. repr) In-Reply-To: <8cknsa$1r4$1@slb6.atl.mindspring.net> References: <38ED0016.E1C4A26C@tismer.com> <200004062130.RAA26273@eric.cnri.reston.va.us> <20000407084914.A13606@mems-exchange.org> <8cknsa$1r4$1@slb6.atl.mindspring.net> Message-ID: <200004071506.AA18015@ch1d2833nwk> On Fri, 7 Apr 2000, Greg Ward wrote: > On 07 April 2000, Mikael Olofsson said: > > > > On 07-Apr-00 Greg Ward wrote: > > > Oh, joy! oh happiness! someday soon, I may be able to type > > > "blah.__doc__" at the interactive prompt and get a readable result! > > > > Just i case... I hope you haven't missed "print blah.__doc__". > > Yeah, I know: my usual mode of operation is this: > > >>> blah.__doc__ > ...repr of docstring... > ...sound of me cursing... > >>> print blah.__doc__ > > The real reason for using str() at the interactive prompt is not to save > me keystrokes, but because it just seems like the sensible thing to do. > People who understand the str/repr difference, and really want the repr > version, can slap backquotes around whatever they're printing. > > Greg > > -- > From anthony at interlink.com.au Sun Apr 16 23:49:49 2000 From: anthony at interlink.com.au (Anthony Baxter) Date: Mon, 17 Apr 2000 13:49:49 +1000 Subject: Python w/ SSL In-Reply-To: Message from Jp Calderone of "Sun, 16 Apr 2000 21:44:48 GMT." <38FA3450.1DD845B2@flashmail.com> Message-ID: <200004170349.NAA03160@mbuna.arbhome.com.au> Try http://mars.post1.com/home/ngps/m2/ >>> Jp Calderone wrote > > Can anyone point me to an *up to date* Python/SSL interface? I've > found about 4 w/ search engines, but the most recent is from 1996 and > has a link to Python 1.3 in case you are without an interpreter ;) > (It also doesn't help that starship is still down - again :( ) > > Thanks in advance > Jp > > > -- > If the automobile had followed the same development as the computer, a > Rolls-Royce would today cost $100, get a million miles per per gallon, > and explode once a year killing everyone inside. > -- Robert Cringely, InfoWorld > -- > 9:43pm up 19 days, 2:50, 0 users, load average: 0.02, 0.07, 0.09 > -- > http://www.python.org/mailman/listinfo/python-list > -- Anthony Baxter It's never too late to have a happy childhood. From ivanlan at callware.com Wed Apr 12 14:49:16 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 12 Apr 2000 12:49:16 -0600 Subject: Off-topic References: <38F4BE12.A0C73D1D@callware.com> Message-ID: <38F4C52C.450F611F@callware.com> Hi All-- Michael Hudson wrote: > > Ivan Van Laningham writes: > > > Hi All-- > > This is not precisely about Python, but it does affect my *usage* of > > Python on redhat 6.1. > > > > Why don't #! scripts seem to work anymore? #!/usr/bin/python and > > #!/usr/bin/perl scripts don't work. Error is > > Someone's taken /usr/bin/python away? Tried strace-ing it? > Perl and Python both work if I do 'perl h2n' or 'python hello.py'. Interactive mode works fine. > I presume /bin/sh scripts are still working (wouldn't like to think > what happened if they went away). > Sh scripts do work, as long as I remember to do ./script ;-). I'm running as root (but the same thing happens when I run as myself, too). However, this could be explained by the default behavour of exec(), which states that if the kernel can't run a program, it execs sh and hands it the program name in argv. > incidentally, asking why things are "left out of the language" is > a good sign that the asker is fairly clueless. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From mwh21 at cam.ac.uk Wed Apr 12 06:35:04 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 12 Apr 2000 11:35:04 +0100 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> <874s9766r6.fsf@ifm.uni-kiel.de> <8d1ihl$q244@imsp212.netvigator.com> Message-ID: "Paul Gresham" writes: > I like this solution a lot, it makes a lot of sense. Thanks Michael. > I guess somewhere in Python is a defined route back to the super > class, on a better day I may just dig through the code. For a variey of reasons, class heirachies in Python are usually pretty shallow, so this isn't often too much of a problem. I think the median depth of class heriachies in code I right is probably 1... Cheers, M. -- On the other hand, the following areas are subject to boycott in reaction to the rampant impurity of design or execution, as determined after a period of study, in no particular order: ... http://www.naggum.no/profile.html From gmcm at hypernet.com Thu Apr 20 08:05:39 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 20 Apr 2000 08:05:39 -0400 Subject: socket.SO_REUSEADDR In-Reply-To: <38FEEA44.6C05E2B0@inka.de> Message-ID: <1255890155-29764878@hypernet.com> Michael Str?der wrote: > For avoiding problems with errors like > > socket.error: (98, 'Address already in use.') > > during immediate restart of my web server I'm following the hint to > set the socket option SO_REUSEADDR. But I did not succeed. The > server starts and works. When I stop it and try to restart > immediately the above message appears again. I had a short look at > man 7 socket and man setsockopt but this was a little bit too much > for me... > My code looks like this: > > ------------------------ bite here ------------------------- > class MyHTTPServer(SocketServer.TCPServer): > > def server_bind(self): > """Override server_bind to set socket options.""" > self.socket.setsockopt( > socket.getprotobyname('tcp'), > socket.SO_REUSEADDR,1 > ) > SocketServer.TCPServer.server_bind(self) > ------------------------------------------------------------ You need socket.SOL_SOCKET, not socket.getprotobyname(). But there's still no substitute for a try / finally that closes the socket explicitly. - Gordon From andreas.krueger at uumail.de Tue Apr 18 13:34:03 2000 From: andreas.krueger at uumail.de (Andreas Krüger) Date: Tue, 18 Apr 2000 19:34:03 +0200 Subject: need a script to set IP-Adress an machine name Message-ID: <38fc9ce6$0$18302@personalnews.de.uu.net> i'm looking for a script (or parts) to set up an nt-client nic-parameters. it mus call for ip-adress and name, and set the network-parameter automatic after re-image. also it must set commandline-parameter and copy four files. later i will call for the mac-adress and call the parameters from a database (access or d-base) does anybody know how to do this? i'm an absolute beginner for programming. thanks, andreas please repost a copy to andreas.ad.krueger at bku.db.de From c.evans at clear.net.nz Wed Apr 26 05:13:08 2000 From: c.evans at clear.net.nz (Carey Evans) Date: Wed, 26 Apr 2000 09:13:08 GMT Subject: python-only crypt()? References: <39065A08.F776CBE1@home.com> Message-ID: <87d7nd444b.fsf@psyche.evansnet> bo Vandenberg writes: > "a pure Python implementation of the Unix crypt(3) algorithm" > > http://home.clear.net.nz/pages/c.evans/sw/ Wow. I finished writing that and uploaded it less than six hours before your post. Would you mind letting me know how you found it so quickly? > Post back if this is helpful Given that I ported it because I couldn't get Michal's port of UnixCrypt going, it probably is. -- Carey Evans http://home.clear.net.nz/pages/c.evans/ "For some of us, it's *always* Monday morning." - Simon Cozens in asr From gregm at iname.com Thu Apr 20 10:34:59 2000 From: gregm at iname.com (Greg McFarlane) Date: Fri, 21 Apr 2000 00:34:59 +1000 Subject: focus with PMW In-Reply-To: <38FCCAC0.8868ED95@mitre.org>; from Pete on 18 Apr 2000 at 04:51:12PM References: <38FC75F4.D4E01F19@mitre.org> <38FCCAC0.8868ED95@mitre.org> Message-ID: <20000421003459.01994@nms.otc.telstra.com.au> On 18 Apr, Pete wrote: > I am trying to determine which widget, the focus is currently on in my > code. When I make a call to get_focus() it gives me an instance of a > TKinter.Entry, but I am only creating PMW widgets (which are of course > extended from TKinter). Since I am not creating TKinter widgets > explicitly in my own code, how can I determine which PMW widget that > specific TKinter.Entry instance belongs to? You will need to maintain a list of all the Tkinter widgets in your application that can get focus and compare them against the one returned by focus.get(). You can get the component widgets of a Pmw megawidget by using the component() method. For example entryfield = Pmw.EntryField() entry = entryfield.component('entry') The Pmw documentation lists all the components of each megawidget, along with their types. However, would it not be better to use something like bind('') on all the widgets (or component widgets of megawidgets) you are interested in, then your application can be notified whenever focus changes, rather than having to ask for it. -- Greg McFarlane INMS Telstra Australia gregm at iname.com From m.faassen at vet.uu.nl Wed Apr 12 07:09:18 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 12 Apr 2000 11:09:18 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> Message-ID: <8d1lgu$ga0$1@newshost.accu.uu.nl> Daniel Berlin+list.python wrote: > tom> -- Is there a Python equivalent of CPAN and the Perl CPAN > tom> module? The closest I know of is Parnassus. But Parnassus > tom> is merely a collection of links, not an archive, and it > tom> doesn't have any facilities (AFAIK) for automatic > tom> installation. > So, who gives a crap? > I try not to be that lazy. I care, for instance. The distutils people care. Please don't assume nobody cares when there's a whole SIG about this issue. It's not only about laziness (though that's a good trait in a programmer :), it's about accessibility. Python modules should be very easy to get and install. This makes Python more useable by people who don't know Python, such as sysadmins, and users. It also is good for Computer Programming for Everybody. [snip] > Why do i get the feeling you'll never be satisfied? Why attacking Tom so much? What has Tom done to you in the past? Why does he get the bad reception he does? He isn't spreading misinformation, is he? He has reasonable requests, in my opinion. Quick-someone-start-a-math-discussion!-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From effbot at telia.com Thu Apr 6 12:59:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 06 Apr 2000 16:59:21 GMT Subject: __builtin__.open on windows NT References: <8cicd6$1s0$1@nnrp1.deja.com> <20000406182802.C13830@xs4all.nl> Message-ID: Thomas Wouters wrote: > > i'm new to python, so be prepared...i'm having trouble with open() on > > windows NT. my script uses the os library and it appears that open() > > in my script is conflicting with an open() function in the os lib. so > > i tried to use __builtin__.open(), but i get this error "NameError: > > __builtin__" > > Well, if you have that conflict, you are doing 'from os import *'. > The easy solution is 'dont do that then'. 'from import *' can be > very bad for your health, for exactly the reason you specify. My advice (and > probably that of most people here ;) would be to change the import into just > 'import os' and fix the places where you actually use os. > > If you *really* want to use __builtins__, you can: you just have to import > it first ! :-) Remember to do that with 'import __builtins__', or it might > overwrite some of os's variables... ehem. the module is called __builtin__, while __builtins__ is a magic attribute which may or may not exist. if you really need to refer to the module containing the standard builtins, do: import __builtin__ fp = __builtin__.open(...) the best solution is to only use "from import" if you know exactly if you're doing (or in other words, if you use "from import" and don't understand what happens, don't use it). also see: http://www.pythonware.com/people/fredrik/fyi/fyi06.htm From garry at sage.att.com Mon Apr 24 13:27:03 2000 From: garry at sage.att.com (Garry Hodgson) Date: Mon, 24 Apr 2000 17:27:03 GMT Subject: gaming and python References: <000c01bfa91c$f421d6a0$0f8d0b3f@oemcomputer> Message-ID: <390483E7.109E2EE1@sage.att.com> > mrnatch wrote: > > I told a friend of mine that I am learning to program using Python (I > chose Python as my first language on the advice of a Llama) and he > asked me an interesting question: Can Python be used for programming > video games? And does it work with Windows API? Just curious. i wrote a simple pacman game for my kids in python. piece o' cake. it uses tkinter for graphics, so should be win-portable. -- Garry Hodgson Every night garry at sage.att.com a child is born Software Innovation Services is a Holy Night. AT&T Labs - Sophia Lyon Fahs From johnm at magnet.com Fri Apr 14 19:01:09 2000 From: johnm at magnet.com (John Mitchell) Date: Fri, 14 Apr 2000 19:01:09 -0400 Subject: TCP/IP protocols In-Reply-To: <20000415004919.B15664@xs4all.nl> Message-ID: On Sat, 15 Apr 2000, Thomas Wouters wrote: > On Fri, Apr 14, 2000 at 04:28:03PM -0600, Jeff Massung wrote: > > > I'm new to Python programming, but am very experienced in C/C++. Could > > someone point me to a good reference for TCP/IP programming with Python > > (pdf, book, anything :]) thanks. > If you're looking for some higher-level programming, see libraries like > httplib, ftplib, telnetlib, urllib, SocketServer, *HTTPServer, etc. These are actually just two libraries: client-side (urllib handles FTP, HTTP, local files), plus server-side (Socket/HTTPServer). For example, to fetch a web page is this: import urllib data = urllib.urlopen('http://www.magnet.com/') To get some information out, it's much more complicated: 3 lines: import htmllib, formatter p.feed(data) p.title # => 'Magnet Interactive Communications' Show this to your local Java weenie. He'll whine like a stuck pig! > Documentation for all these modules comes with the python source (in the > Doc/lib/ directory) in TeX format, with most binary distributions in some > form or another, or can be downloaded or browsed online at > http://www.python.org/doc/lib/ (There's an entire chapter, 11, dedicated to > 'Internet Protocols and Support'.) oh yeah. But the above is your 60-second introduction. - j From avflinsch at att.net Fri Apr 14 10:36:18 2000 From: avflinsch at att.net (aflinsch) Date: Fri, 14 Apr 2000 09:36:18 -0500 Subject: Complaint Dept: My shoes! References: <8d4s4d$mvr$1@nnrp1.deja.com> Message-ID: <38F72CE2.CB7B7C5D@att.net> musingattheruins at my-deja.com wrote: > > If shoe is None then len(shoe) raises an exception. Would be nice if > len(None) was 0 and NOT raise an exeption. > I think I would prefer it if len(None) returned None. Makes a bit more sense to me having an unsized object return None, rather than zero. From psl at mitre.org Tue Apr 18 16:51:12 2000 From: psl at mitre.org (Pete) Date: Tue, 18 Apr 2000 16:51:12 -0400 Subject: focus with PMW References: <38FC75F4.D4E01F19@mitre.org> Message-ID: <38FCCAC0.8868ED95@mitre.org> I am trying to determine which widget, the focus is currently on in my code. When I make a call to get_focus() it gives me an instance of a TKinter.Entry, but I am only creating PMW widgets (which are of course extended from TKinter). Since I am not creating TKinter widgets explicitly in my own code, how can I determine which PMW widget that specific TKinter.Entry instance belongs to? From python at rose164.wuh.wustl.edu Sat Apr 1 00:09:24 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Fri, 31 Mar 2000 23:09:24 -0600 Subject: regular expressions questions References: <11A17AA2B9EAD111BCEA00A0C9B4179305321B0A@molach.origin.ea.com> <010001bf9acf$500cff00$d4c2043f@spkydomain> <%z8F4.15922$0o4.95443@iad-read.news.verio.net> Message-ID: <00b601bf9b98$742cf1a0$cbe9093f@spkydomain> Well, that'll teach me to jump into a thread without reading the previous posts. ;) In context I get it now. And it's nice to have my prejudices on the subject confirmed. Thanks, David ----- Original Message ----- From: "Tom Culliton" Newsgroups: comp.lang.python To: Sent: Friday, March 31, 2000 3:15 PM Subject: Re: regular expressions questions > In article <010001bf9acf$500cff00$d4c2043f at spkydomain>, > David Fisher wrote: > > This statement suprised me. I had gotten the impression from > > lurking in the newsgroup that the functions in the string module > > were as fast or faster for many operations. > > You misunderstood the statement. The string module is mainly a front > for the strop module written in C which is faster for the cases where > you can use it. > > >Is re really that much faster that string? > > No, of course not, unless it lets you do something in one go that > would take you many string operations and connecting logic in python. > > Doing string.find will generally be faster than doing re.search for > simple strings, because re.search is a more complex operation. On the > other hand doing a complex re.sub will be faster than emulating it > with several string operations. > From rcc at jennic.com Wed Apr 5 08:17:19 2000 From: rcc at jennic.com (Robert Cragie) Date: Wed, 05 Apr 2000 12:17:19 GMT Subject: Class type coercion Message-ID: (Apologies if this has been covered before, I'm a bit of a Python newbie) I posted a question to wxWindows list, and got an answer from Robin Dunn, but it raised a more general question... In C++, it is easy to use a pointer to a object declared as a super class of that object's class, and then coerce it to be the same class type as the object, e.g. // Declare instance of class 'MyClass', which is derived from class 'MySuperClass' MyClass MyClassObj; // Declare pointer to class 'MySuperClass' MySuperClass* pMySuperClass; pMySuperClass = &MyClassObj; // OK, class 'MyClass' is derived from class 'MySuperClass' // Coerce pointer to get to method which is only in class 'MyClass' ((MyClass*)pMySuperClass)->MyMethodOnlyInMyClass(); Can you do the equivalent in Python? I feel there must be some straightforward way to do this, I just haven't figured it out yet. Or is there...? As there is no type declaration in Python maybe this just isn't possible. There is a real-world need for this e.g. parent Window object contains various child control objects. All the control classes are subclassed from the Window class. All control objects have an ID. There often exists a Window method to get a child window by ID. However, it can only return a type of Window class. Therefore, to get to the actual control, this return type needs to be subclassed. From gdeering_telstra at my-deja.com Tue Apr 18 18:10:25 2000 From: gdeering_telstra at my-deja.com (gdeering_telstra at my-deja.com) Date: Tue, 18 Apr 2000 22:10:25 GMT Subject: Performance Issues When Using Python/ASP Message-ID: <8dimg4$kii$1@nnrp1.deja.com> What are the performance issues when using Python for ASP, as opposed to JScript (and dare I say VBScript). What are the other advantages/disadvantages Sent via Deja.com http://www.deja.com/ Before you buy. From rmuschall.fih at t-online.de Tue Apr 4 16:18:24 2000 From: rmuschall.fih at t-online.de (Ralf Muschall) Date: Tue, 04 Apr 2000 22:18:24 +0200 Subject: What is python's language level? References: <38EA1B8F.A797A130@lmco.com> <38E9DDD3.3313FF6@bioreason.com> Message-ID: <38EA4E10.4DC2A4FE@t-online.de> Michael Zawrotny schrieb: > Very arbitrary. I liked the fact that in their table: > common lisp = 5.00 ... > scheme = 6.00 They seem to have split Common Lisp into CLOS (level 15) and a CLOS-deprived rest (and probably did not look at #Z(series) at all). Scheme > Lisp might be due to the slightly diffrerent dominant style in the two communities (schemers seem to prefer a more functional style). OTOH, I'd guess that they did not look very hard at lispisch languages -- the dynamically scoped mulisp got the same level like the real (lexically scoped) lisps. The high value for HTML is funny, particularly if one looks at such nasty lines like (for the main text bodies above the level table), ...
... tag. This is incredible to me > because both Netscape and IE read can view the tables properly. Fredrik Lundh replied: > 's are optional -- if the browser stumbles upon
(the only purpose of which is to make the result look ugly and the rendering slower) in their code. Ralf From alwagner at tcac.net Thu Apr 20 20:22:43 2000 From: alwagner at tcac.net (Albert Wagner) Date: Thu, 20 Apr 2000 19:22:43 -0500 Subject: os.listdir & os.stat fail on windows zipdrive Message-ID: <38FF9F53.A4698EE6@tcac.net> What is peculiar about zipdrives on windows that would cause os.listdir(dir) and/or os.stat(dir) to fail? The following method works on Linux and on Windows with a harddrive dir, but fails on windows when dir is a zipdrive(e.g. D:\), resulting in no valid files or directories being found. -- Small is Beautiful From effbot at telia.com Tue Apr 4 18:45:52 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 04 Apr 2000 22:45:52 GMT Subject: Warning switches (was: Python 1.6 alpha 1 released) References: <5l7leern5v.fsf@eric.cnri.reston.va.us> <38ea1de0$0$17688@personalnews.de.uu.net> <8cdnke$b05$1@pegasus.csx.cam.ac.uk> Message-ID: Nick Maclaren wrote: > >but hopefully, Python 3000 will be completely free from modes. > > It is important to distinguish modes from warning levels. The > former imply that there are several subtly different languages, > and are usually regarded as snares and delusions. in this case, the goal is to help you migrate towards Python 3000, not to allow you to pick your favourite python dialect [1]. dunno if that's best done with warnings (and an option to switch them off) or modes (where the same option switches between warnings and exceptions), or some mixture of that... > The latter are best described by the following question: > > Do you want me to tell you when I think that you may be > making a mistake, when you are doing something that is asking > for trouble, or only when you have definitely got it wrong?" I think the current approach is to leave such warnings to the development environment (or to pluggable parsers/compilers). see the CP4E paper for more ideas in this direction. (after all, the interpreter's energy is better spent on other things...) 1) unless guido reads this, of course: http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm From darrell at dorb.com Wed Apr 12 17:20:49 2000 From: darrell at dorb.com (Darrell) Date: Wed, 12 Apr 2000 21:20:49 GMT Subject: How to know what re.sub took? References: <38F387AE.1010704@gmx.net> Message-ID: "Per Kistler" > How to know what has been substituted away, if one does something like: > > >>> import re > >>> rex = re.compile(r"(hans|fred|simon)") > >>> st = "max hans bill" > >>> st2 = rex.sub("",st) > >>> st2 > 'max bill' > > It took "hans" away, but how can I learn this automatically? > This won't work for stuff like \g<1> in the replacement string. import re def sub(pat, repl, string): areas=[] def detect(mo, repl=repl, areas=areas): areas.append(mo.groups()) return repl return re.sub(pat, detect, string), areas print sub(r"(hans|fred|simon)","","max hans bill") ('max bill', [('hans',)]) From ivanlan at callware.com Sat Apr 15 12:02:08 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Sat, 15 Apr 2000 10:02:08 -0600 Subject: Python CGI References: <38F852D9.E2144F17@flashmail.com> Message-ID: <38F89280.58B4ABC0@callware.com> Hi All-- Jp Calderone wrote: > > I recently converted one of my perl CGI's to Python, and came across an > bizarre and extremely undesirable side affect - Whenever a form that uses > the Python script as its ACTION, the python scripts seems to get executed > about 8 times. At first I thought there was some logic error in my program > making it octuple all the output, but I can't find anything that might do > this. Has anyone seen this before, or know how to fix it? > What's your webserver? I've run Apache on NT and Linux, and IIS on NT;-(, and have never ever seen this. You should also post a sample script, too. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From doughellmann at home.com Thu Apr 27 07:38:39 2000 From: doughellmann at home.com (Doug Hellmann) Date: Thu, 27 Apr 2000 11:38:39 GMT Subject: python + linux + cron = problem References: <39081703.48B64D1A@spekter.no> Message-ID: <3908265E.A3C21409@home.com> J?rn Eilertsen wrote: > > Hi, > > I've posted this earlier but noone replied so I'm trying again > > I have this small program which includes the following line og code: > mounts = commands.getoutput('df | grep eggum | cut -d 1 -f 1 | cut -d / > -f 4') > > this runs fine from the commandline but when run as a cronjob I get the > following error: > > File "/usr/lib/python1.5/commands.py", line 42, in getoutput > return getstatusoutput(cmd)[1] > File "/usr/lib/python1.5/commands.py", line 53, in getstatusoutput > sts = pipe.close() > IOError: (10, 'No child processes') > > The use of pipes seems to be the trouble here. > > Any help on how the get around this would be greatly appreciated. > > If the problem is really having pipes in the command, why not put your shell commands in a shell script, then run commands.getoutput() on that? If the program runs from the command line but not cron, the problem is more likely to be related to PATH problems within the cron environment. How do you set up the cron job? Doug From scarblac-spamtrap at pino.selwerd.nl Sat Apr 22 08:12:18 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 22 Apr 2000 12:12:18 GMT Subject: code not true? References: <8ds3ku$q0l$1@nnrp1.deja.com> Message-ID: jeff_islay at my-deja.com wrote in comp.lang.python: > Why does the second example return false? > > >>> print 7.0 == 7 > 1 > >>> print (.07 * 100) == 7 > 0 Floating point number on a binary computer are strange. They're not that accurate. 0.07 * 100 != 7.0. Try >>> 0.07*100 == 7.0 0 >>> 0.07*100 - 7.0 8.881784197e-16 In Python 1.6, the interpreter doesn't try to hide this: >>> 0.07*100 7.0000000000000009 For way too much info, look for old posts on this group by Tim Peters with the words "floating point". -- Remco Gerlich, scarblac at pino.selwerd.nl This is no way to be Man ought to be free -- Ted Bundy That man should be me From matthias_w at my-deja.com Wed Apr 12 05:59:36 2000 From: matthias_w at my-deja.com (matthias_w at my-deja.com) Date: Wed, 12 Apr 2000 09:59:36 GMT Subject: Embedding Python in Visual C++ 6.0 Message-ID: <8d1he4$26d$1@nnrp1.deja.com> Hy! :-) Maybe someone (Mark Hammond??) can help me. I tried to embedd the win32 extentions from Mark in a visual c++ project, but everytime the Win32uiInitInstance() is called (via glue.InitInstance()) I get an unhandled exception at 0xC0000005 Access Violation and the debugger jumps to 1E401F69 - the address of the Win32uiInitInstance() function. When i try create a break-point in this function this break-point is disabled %-( by the compiler. The same is true if i try to debug the original pythonwin project. Help please! Matthias Sent via Deja.com http://www.deja.com/ Before you buy. From warlock at eskimo.com Sun Apr 30 14:36:25 2000 From: warlock at eskimo.com (Jim Richardson) Date: Sun, 30 Apr 2000 18:36:25 GMT Subject: The Simple Economics of Open Source References: <1255089462-10343171@hypernet.com> Message-ID: On Sat, 29 Apr 2000 14:30:11 -0400, Gordon McMillan, in the persona of , brought forth the following words...: >Richard Hale wrote: > >> CP/M was the OS "monopoly" of its day. A perfect illustration of >> how success breeds failure and how every trend has within it the >> seeds of its own destruction. >> >> It must be Microsoft's turn now!? > >Hmmm. Despite being fat, MS remains surprisingly hungry. > Tapeworms will do that :) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From exarkun at flashmail.com Sat Apr 22 20:54:13 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Sun, 23 Apr 2000 00:54:13 +0000 Subject: SSL w/ urllib References: <3901D800.DB50D968@flashmail.com> <3ditx9v851.fsf@newcnri.cnri.reston.va.us> Message-ID: <390249B5.F5D545F7@flashmail.com> Andrew Kuchling wrote: > > Jp Calderone writes: > > f = urllib.urlopen('https://www.mudprovider.com/cgi-bin/printvars.cgi', > > params) > > TypeError: too many arguments; expected 2, got 3 > > You've found a bug. I've checked a fix into the CVS tree, so you can > either update, or just apply the patch below. Thanks for the bug > report! > > --amk > > [snip patch] Wow, cool :) And like 5 hours from report to solution. How I love open source :) Here's a follow up question. I applied the patch and it doesn't raise an exception anymore, but it sits there for about 3 or 4 minutes, then returns an "addinfourl" object that looks like this: >>> print f.headers None >>> print f.url http://www.mudprovider.com/cgi-bin/printvars.cgi >>> print f.read() >>> If I switch it over to a GET request, it works fine, but I really need POST to work. Is this another bug or am I doing something wrong? Also, if there's a page that explains all this somewhere, I'll happily take just a link to it and work this all out by myself :) Thanks, Jp -- "Pascal is Pascal is Pascal is dog meat." -- M. Devine and P. Larson, Computer Science 340 -- 12:35am up 25 days, 5:42, 0 users, load average: 0.02, 0.02, 0.00 From kc5tja at garnet.armored.net Fri Apr 28 07:58:00 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 28 Apr 2000 11:58:00 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <280420000746597329%pecora@anvil.nrl.navy.mil> Message-ID: In article <280420000746597329%pecora at anvil.nrl.navy.mil>, Louis M. Pecora wrote: >> You *can* use another word for 'self' though, 's' or 'me' or something. But >> it makes your code harder to read, of course... > >You mean by doing something like No. He means something like this: >>> class Foo: ... def MyMethod( m, arg1, arg2 ): ... m.field1 = arg1 ... m.field2 = arg2/arg1 `self' is just an argument, like any other on the list. It's distinguished *only* in that it's supplied by the Python environment automatically; what you choose to call it is entirely up to you. Use of the word `self' is entirely for conventional reasons. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From haering at sunhalle8.informatik.tu-muenchen.de Thu Apr 27 14:39:05 2000 From: haering at sunhalle8.informatik.tu-muenchen.de (Gerhard Haering) Date: 27 Apr 2000 18:39:05 GMT Subject: HTML parser example, anybody? Message-ID: Hi! I want to transform my own HTML templates (with a few template tags, special comments, and so on) into final HTML for the browser. I would like to use Pyhton's htmllib, but from the docs I can get no clue on how to get it done. I seem to have to use a writer and a formatter class ... I would greatly appreciate an example of HTML -> HTML using htmllib/sgmllib. Can anybody provide pointers/code snippets? Gerhard From mhammond at skippinet.com.au Thu Apr 20 22:22:19 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 21 Apr 2000 02:22:19 GMT Subject: Why MFC instead of Tkinter -- was Re: Pythonwin? References: <4QtL4.24$v85.41@news-server.bigpond.net.au> <7LDL4.534$v85.2563@news-server.bigpond.net.au> <38ff21b8$0$10972@senator-bedfellow.mit.edu> <38FF281E.5B2DCC71@tismer.com> <38ff823d$0$10971@senator-bedfellow.mit.edu> <2wML4.15897$O7.23504@typhoon.southeast.rr.com> Message-ID: "Don Tuttle" wrote in message news:2wML4.15897$O7.23504 at typhoon.southeast.rr.com... > Which brings up the question near and dear to a lazy man's heart like > myself.. Which is the eaiser Windows GUI builder for Python--VB or VC++ ? > > With VB, I've only seen Python mentioned as a COM object to be used by VB. > Are there other ways? Probably, but this is the best. Using this technique, you generally end up with all the UI logic (ie, this is selected, so I need to disable these controls, etc) written in VB. Only your "business logic" is done in Python. It probably is possible to do some of the GUI logic in Python, but that doesnt make as much sense given VBs IDE support for this. You can swap VB for Delphi in this sentence too... > With VC++, I gather you use the dialog editor to generate the MFC code that > you then plug into Python? Correct? Exactly. With MFC/Pythonwin, you get to create a DLL that contains UI resources, and use them. "Use them" means load them, display them, and hook all the messages and notifications for them - ie, your GUI logic ends up completely in Python, without the nice, trendy "double-click-on-an-object-to-edit-its-event-list" IDE that VB/Delphi give you. Mark. From jon at tryme.com Mon Apr 10 18:32:37 2000 From: jon at tryme.com (charlie) Date: Mon, 10 Apr 2000 15:32:37 -0700 Subject: Using ADO in IIS Message-ID: Can someone please help me use ADO from IIS. I just purchased Mark's new book on Win32 but his example on page #254 is for Pythonwin not for ASP/Python. The ASP context requires different object creation syntax. I've been asking this question for over six months and no one seems to know or care about finding a solution. The only reason I'm not using Python at work is over ADO:SQL accessibility. It's cool to loop and call cool functions, but without database connectivity Python is pretty much useless in this web world. Everything requires database connectivity this days. Please don't reply with: you can use ODBC. I've been hearing that for months. Besides, it's not supported. I can't sell Python to my boss if I can't use ADO. I've seen many others ask this same question over and over with no resolve. Can we work together to finally find an ASP/ADO/Python solution. The way I see it, solving this challenge could significantly boost Python adoption in the web developer realm. ed From mwh21 at cam.ac.uk Sun Apr 2 09:57:50 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 02 Apr 2000 14:57:50 +0100 Subject: Debugging confusion -- too many stacks! References: <000a01bf9c6b$3f80c2a0$752d153f@tim> <38E739A1.45F4B199@tismer.com> Message-ID: Christian Tismer writes: > This VM stack could also be replaced by a set of registers, since > the maximum stack size is always known at compile time. My gut tells me that making this work with exceptions would be a dog. It's the sort of thing that might be fun to play with if the compiler and eval loop were written in Python, but if I have to hack C to play with these things, it just becomes tedious. Still, maybe if I have a month or two with nothing else to do... Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From echuck at mindspring.com Wed Apr 19 23:52:06 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Wed, 19 Apr 2000 23:52:06 -0400 Subject: [ANNOUNCE] Webware for Python 0.1 Message-ID: <38FE7EE6.A3FDFEC9@mindspring.com> Webware for Python is a definitive suite of Python software components for use in web development. Each component has a focused purpose and can often be used on it's own. At the same time, the components are designed to work together where appropriate. As a user of Webware, you can bite off as much or as little as you want to chew. You can find more and download at: http://www.writers-webshop.com/Webware -Chuck From tony at lsl.co.uk Mon Apr 10 05:32:43 2000 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Mon, 10 Apr 2000 10:32:43 +0100 Subject: Regular Expression Help for Python Newbie. In-Reply-To: Message-ID: <005f01bfa2cf$b99b0ea0$f0c809c0@lslp7o.lsl.co.uk> Raoul-Sam Daruwala wrote: > My problem is that one of the sets of files that I'm trying to parse has > badly formatted tables. Now when I do a view source on the files I can > see the problem clearly. It's quite simple, the tables in these files > starts out properly formatted but after a standard header the script > than generates them leaves out the
> in a context, it should insert 's all by itself. Well, no... OK. As far as I can see, 's are not optional - given an (even vaguely) SGML based specification I don't understand how they could be. And looking at the HTML 3.2 Reference Specification, they clearly aren't (although the is). And that makes sense as the defines the start of the row "element". Of course, it's entirely possible to write a browser (or other HTML reader) that can cope with missing 's *if* the 's are present. And obviously that's what some browsers do. This way also lies madness - it's going to be impossible to guess which "mistakes" the browser will self-correct for, and which it won't (it'll have to be by some ad-hoc mixture of emulating what other browsers appear to do, noticing what mistakes one has actually seen, guessing which mistakes are likely to happen, and fixing some because they're easy to fix, even if unlikely). I always find it strange that otherwise intelligent people don't want their compilers to work like this, but do want their browsers to. As to the specific problem, it's clearly possible to write code that will trigger on the 's instead of on the 's. This is left as an excercise for the reader, especially if they want to make it harder by using regular expressions... Tibs (damn - it's Monday and I've already disagreed with /F, not something I'd normally do - let's hope the rest of the week settles down) -- Tony J Ibbs (Tibs) http://www.tibsnjoan.demon.co.uk/ Give a pedant an inch and they'll take 25.4mm (once they've established you're talking a post-1959 inch, of course) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From KingArthur at roundtable.dyndns.org Thu Apr 20 21:37:51 2000 From: KingArthur at roundtable.dyndns.org (news-server) Date: Fri, 21 Apr 2000 01:37:51 GMT Subject: editor for win32 References: Message-ID: Textpad is a great programming text-editor. It has Syntax highlighting for all the popular languages and various other languages. Even has syntax highlighting for SQL and IDL. You can get it at www.textpad.com (you can also add your python interpreter to the tools and run your programs from within textpad). Scott Hathaway wrote in message ... >Can anyone recommend a python editor for Windows? > >If there is an IDE for windows (other than IDLE), even better. > >Thanks, >Scott > > From mwalker at origin.ea.com Mon Apr 24 11:55:59 2000 From: mwalker at origin.ea.com (Matthew Walker) Date: Mon, 24 Apr 2000 10:55:59 -0500 Subject: pickle.py and cPickle.c - persistent_id() is always called - why? Message-ID: (Previously posted via Deja.com by matsaleh but I never saw the post on usenet - forgive me if this shows up more than once.) Hello fellow .py types... I am doing a bit of work using pickle/cpickle and am trying to optimize. I found that my user-defined persistent_id() function is being called for (just about) every attribute (name and value) in my object that is being pickled. My specific (somewhat ad-hoc) test case pickles ~100 objects in a containment hierarchy, using persistent_id to break the containment relationship and replace the references with a proprietary object id. Although I have only ~100 object references to resolve, persistent_id() is called ~6400 times. In tracing the code, it appears to be called for every attribute and value in my objects. This appears to be caused by the fact that pickle.py:save() is called with the default pers_save flag of 0 in all cases except for when it is called by save_pers(). This appears to indicate that all types: tuples, dicts, sequences, longs, strings, etc, cause my persistent_id() to be called, when all I want is for it to be called for object instances. I modified pickle.py to change the default of the pers_save flag to 1 in the save() method, and then call it with a 0 only from within the save_inst() method. This amounts to invoking my persistent_id() function only when a reference to an object instance is encountered as my objects are being pickled. My pickled objects do not appear to be adversely affected by this change, and the number of calls to persistent_id() was reduced from ~6400 to ~500, reducing the time spent in this method by an order of magnitude (0.37 sec to 0.03 sec). I have not yet tested this change in cPickle.c, but in my original tests, persistent_id() was a much more significant factor in my runs using cPickle, because all the pickling code is in C and is relatively much faster than my persistent_id() method, which is in Python. I expect the performance boost my making the change in cPickle to be even greater, relatively speaking. My question is, why is persistent_id() being invoked so often? I do not see the reason for calling it for basic python types and structures such as tuples, dicts, and the like. Is this a reasonable change to make to the python source, or is it not a safe change for the general pickling cases that the pickle/cPickle modules have to handle? I'm sure this code has been scruitinized by many folks much more experienced than I - I would be grateful for your insights. All timings and function counts done by profile.py and pstats.py. Regards. From wware at world.std.com Fri Apr 28 08:16:35 2000 From: wware at world.std.com (Will Ware) Date: Fri, 28 Apr 2000 12:16:35 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <280420000746597329%pecora@anvil.nrl.navy.mil> Message-ID: Louis M. Pecora (pecora at anvil.nrl.navy.mil) wrote: > I'm sure some way of declaring variables 'local' could be done in the > class defintion, but I doubt Guido would do that now. It wouldn't be too hard to write a preprocessor that would do this for you. You might put tags in your code such as #Locals: foo bar xyzzy and #Endlocals so that the translation process for foo, bar, and xyzzy would be limited to the method where they are used. If you promise yourself never to use a 'def' inside a method definition, you could omit the '#Endlocals' tag, and just look for the next line with the regular expression 'def ' in it. > You mean by doing something like > s=self > at the beginning of each class method? The choice to use the word 'self' is not imposed by Python, it's just a convention for readability. You can use 's' instead if you wish. def quadratic(self): det = self.b ** 2 - 4 * self.a * self.c return ((-self.b + math.sqrt(det)) / (2 * self.a), (-self.b - math.sqrt(det)) / (2 * self.a)) versus def quadratic(s): det = s.b ** 2 - 4 * s.a * s.c return ((-s.b + math.sqrt(det)) / (2 * s.a), (-s.b - math.sqrt(det)) / (2 * s.a)) -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From mwh21 at cam.ac.uk Tue Apr 11 06:35:20 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 11 Apr 2000 11:35:20 +0100 Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <38ED40B0.A48EC4CC@udel.edu> Message-ID: i_luv_fudge at I_HATE_SPAM.hotmail.com (.,.) writes: > It still doesn't change the fact that this is a VERY hard language > to learn as a layman without a guide or some sort of coding TLA > translator. Compared to what? perl? C++? Don't make us laugh... > When and if I get proficient I might write a page for people with > that in mind. Tried these? (found on http://www.python.org/doc/Intros.html) http://www.idi.ntnu.no/~mlh/python/programming.html http://www.honors.montana.edu/~jjc/easytut/easytut/ http://members.xoom.com/alan_gauld/tutor/tutindex.htm Not to discourage you from your literary efforts, more would always be good, but they may be of some use. Cheers, M. -- incidentally, asking why things are "left out of the language" is a good sign that the asker is fairly clueless. -- Erik Naggum, comp.lang.lisp From p.agapow at ic.ac.uk Thu Apr 13 04:10:16 2000 From: p.agapow at ic.ac.uk (Paul-Michael Agapow) Date: Thu, 13 Apr 2000 09:10:16 +0100 Subject: 1st non-trivial program - gentle criticism requested Message-ID: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> Hi y'all, I'm experimenting with Python for a number of purposes (an embedded language for simulations, a tool for exploring experimental data, a good first programming language) and so I've cobbled together my first non-trivial program. With some trepidation, I post it here in the hopes that experts will be able to coach me in "The Python Way". I realise it looks like C++ (my usual langauge), but criticisms of style would be useful too. Basically, it's a recreation of the "Methinks it is a weasel" simulation detailed by Richard Dawkins in "The Blind Watchmaker". A population of strings is compared vs. a target string and the "fittest" (the one that most resembles the target) is used to form the next generation, with a small chance. So it's a simple genetic algorithm. thanks p-m --- program follows """ weasel.py A simple program exploring the possibilities of using Python, esp. in simulations, modelling the 'methinks it is a weasel' problem from Richard Dawkins' "The Blind Watchmaker". The program flow is: 1. Init population of random individuals 2. Pick fittest individual 3. If the individual is the target: 3a. Return 3b. Else, breed new population from individual (mutation) 4. Goto 2. """ #--- Includes import whrandom import string #--- Module constants & variables kDefTarget = "METHINKS IT IS LIKE A WEASEL" kDefPopSize = 10; kDefStepSize = 50; gPopulation = []; # the weasels, as it were gRng = whrandom.whrandom() # random source gTarget # what fitness is measured against gNumGenerations # how many cycles did it take? gAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " # all possible symbols gMutationRate # chance of a symbol flipping gStepSize # how often to report stats #--- Module functions ----------------------------------------------- #--- Run # Setup the variables and run def run (size=kDefPopSize, target=kDefTarget, step=kDefStepSize): global gTarget, gNumGenerations, gStepSize, gMutationRate # initialise gTarget = target gNumGenerations = 0; gStepSize = step gMutationRate = 1.0/ (len(gTarget) + 1) initPop (size); # tell user the settings print "WEASEL in action:" print "-----------------" printStartParams(); print "-----------------" # evolve until the end is reached while (0 == evolvePop (gStepSize)): if (0 == (gNumGenerations % kDefStepSize)): print "At generation", gNumGenerations # print end results print "-----------------" print "Reached target after ", gNumGenerations, "generations" printPop(); return #--- Setup def initPop (popsize = 10): # Initialise the contents of the population # Note: do this or gPop is local and temporary! global gPopulation gPopulation = []; for i in range (popsize): theNewMember = MakeNewMember (len(gTarget)) gPopulation.append (theNewMember) return def MakeNewMember (chromsize = len(gTarget)): # For initing the population, generate a random string of symbols # Note: seems inefficient creating strings this way theNewString = ""; while (len(theNewString) < chromsize): theNewString = theNewString + GetRandomSymbol() return theNewString #--- Mutation def MutateIndividual (theTargetIndiv): """Iterates over symbols of individual changing their 'genes'""" # Must be a faster way of doing this theNewIndiv = "" for theSymbol in theTargetIndiv: if (gRng.random() < gMutationRate): theNewSymbol = GetRandomSymbol() else: theNewSymbol = theSymbol theNewIndiv = theNewIndiv + theNewSymbol return theNewIndiv def GetRandomSymbol (): """For the purposes of mutation, this selects a random symbol from the alphabet""" # The global declaration isn't necessary as we don't assign to these # vars, but I'm doing it as a reminder global gRng, gAlphabet theSymbolIndex = gRng.randint(0, len(gAlphabet) - 1) return gAlphabet[theSymbolIndex] #--- Evolve # Evolve for a given number of time steps def evolvePop (iNumSteps): global gNumGenerations for i in range (iNumSteps): if (evolveStep()): return 1 else: gNumGenerations = gNumGenerations + 1 return 0 # Evolve a single step def evolveStep (): global gPopulation if (gTarget in gPopulation): return 1 else: # calculate fitness theFitness = [] for theIndiv in gPopulation: theFitness.append (calcFitness (theIndiv)) # select winner theWinnerIndex = findMax (theFitness) theWinner = gPopulation[theWinnerIndex] assert (theWinnerIndex <> None) # breed from winner for i in range(len(gPopulation)): gPopulation[i] = MutateIndividual (theWinner) return 0 def calcFitness (anIndiv): theFitness = 0 for i in range (len(gTarget)): if (gTarget[i] == anIndiv[i]): theFitness = theFitness + 1; return theFitness def findMax (iCollection): # Returns the index of the largest member of collection # Just a little bullet-proofing if (len(iCollection) == 0): return # Setup initial sensible values theMaxIndex = 0 theMaxVal = iCollection[0]; # Iterate over remainder of container # Inefficient to look at the first element again, but it will do for i in range(len(iCollection)): if (theMaxVal < iCollection[i]): theMaxVal = iCollection[i] theMaxIndex = i return theMaxIndex #--- Output # Print out the contents of the population def printStartParams (): print "The target is", gTarget print "The mutation rate is", gMutationRate print "The alphabet is '" + gAlphabet + "'" print "The population size is", len(gPopulation) printPop() return # Print out the contents of the population def printPop (): print "The population is currently:" gPopulation.sort() theCount = 0; for theIndividual in gPopulation: if (theIndividual == gTarget): thePrefix = "*" else: thePrefix = "" theCount = theCount + 1 thePrefix = thePrefix + repr(theCount) + " :" print string.rjust(thePrefix,8), theIndividual #--- if this is called as a standalone script if (__name__ == "__main__"): run() -- Paul-Michael Agapow (p.agapow at ic.ac.uk), Biology, Silwood Park "The world is made of fire." From osuchw at my-deja.com Mon Apr 17 22:21:15 2000 From: osuchw at my-deja.com (osuchw at my-deja.com) Date: Tue, 18 Apr 2000 02:21:15 GMT Subject: Python CGI running commands under NT References: <2B1262E83448D211AE4B00A0C9D61B03BA72AC@MSGEURO1> Message-ID: <8dggqe$709$1@nnrp1.deja.com> In article <2B1262E83448D211AE4B00A0C9D61B03BA72AC at MSGEURO1>, Pieter Claerhout wrote: > I made a Python CGI-script that executes a DOS- command and > should return the result in a HTML page. The script looks > as follows: > > import os > > pipe = os.popen("ipconfig", 'r') > text = pipe.read() > del pipe > > print "Content-type: text/html" > print > print "IPConfig on AV2700" > print "
" > > print '
'
>   print text
>   print '
' > > If I run this script from the command line, it works fine, but > when I open it using Internet Information Server, all is shown > except the contents of the variable text. Any ideas what could > be wrong? Is it maybe a setting in IIS or are these options > not allowed in CGi-scripts? I used ASP and got results you wanted. Sample included. Waldemar Osuch 8<------------------------------------- <%@ LANGUAGE = Python %> <% import win32pipe from win32api import GetComputerName pipe = win32pipe.popen("ipconfig", 'r') txt = pipe.read() del pipe prn = Response.Write %> IPconfig Results

IPConfig on <%prn(GetComputerName())%>

<%prn(txt)%>
8<---------------------------------------- Sent via Deja.com http://www.deja.com/ Before you buy. From scarblac-spamtrap at pino.selwerd.nl Tue Apr 18 05:33:42 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 18 Apr 2000 09:33:42 GMT Subject: Pointers References: <38D00DCE.9740380F@be-research.ucsd.edu> <8bfsqo$kje$1@tribune.oar.net> <4k5D4.7566$0o4.54442@iad-read.news.verio.net> <38FB98F1.239EC0FB@whetstonelogic.com> Message-ID: Peter Halliday wrote in comp.lang.python: > I just started learning python. I just want to make sure that I understand the > object interaction you were discussion here. To use your statement. So x + 1 > is an object, x is an object, and y is an object. Y and x happen to both be > pointing to x + 1. Is this right? Sort of. x can never point to x+1 :). Rather, x = x+1 computes the result of the expression x+1, makes a new object with that value, and makes x point to it. > If you then did something to y would you be doing something to x + 1? No, not if this is about integers anyway. > I would say, no because it is a seperate object right! Actually, that's not the reason. y and x are both exactly the same object. Thing is, if it's an integer, then you can't change it! You can only make a new object and assign it to y. > > x = x + 1 > > y = x Now y and x are the same object. But the only way to change y, say with y=y+1, makes a new object (the result of y+1) and lets y refer to it. It's different with mutable objects like lists, they can be changed in place: >>> x = [1,2] >>> y = x # They're both the same list now >>> x [1, 2] >>> y.append(3) >>> y [1, 2, 3] >>> x [1, 2, 3] >>> y = y+[4] # This still creates a new object >>> y [1, 2, 3, 4] >>> x [1, 2, 3] Assignment never changes an object, except when it's an assignment to some internal of the object (like y[1] = 3). Try playing around in the interpreter for a while, this is a key thing to understand about Python in my opinion. You can test objects to see if they're the same object with 'x is y', and test their values with 'x == y'. -- Remco Gerlich, scarblac at pino.selwerd.nl Hi! I'm a .sig virus! Join the fun and copy me into yours! From moshez at math.huji.ac.il Sat Apr 29 10:53:04 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 29 Apr 2000 17:53:04 +0300 (IDT) Subject: How to get the python object from a variable name ? In-Reply-To: <20000429163158.A4091@yetix.sz-sb.de> Message-ID: On Sat, 29 Apr 2000, Andreas Jung wrote: > Inside a C program I need to get a pointer to the python object > for a object or variable by its variable name in the current > namespace of the interpreter. What I want to do ? My programs > gets names of variables and I need to get the str() representation > for given variable/object names as a C (char *). Maybe a stupid > question but I've no idea :) Try passing the name of the variable to Py_Eval*() functions. probably-some-nicer-solution-exists-ly y'rs, Z. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From mwh21 at cam.ac.uk Fri Apr 14 04:22:56 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Apr 2000 09:22:56 +0100 Subject: Questions on 1.6a2's string methods References: <38F6C904.76B538E5@concentric.net> Message-ID: I think weve had all these discussions recently. Manus Hand writes: > 1. I see that string objects now support (as methods) most of the > functions from the string module. Among these are: > upper, lower, split, strip, find > and surely others. My question is, why is capwords (which seems > to be in the same genre as upper and lower) not a method? Start here: http://x28.deja.com/[ST_rn=ps]/viewthread.xp?AN=586654400&recnum=%3cm3snysor7o.fsf at atrus.jesus.cam.ac.uk%3e%231/1 Conclusion: the "missing methods" might get implemented, if someone gets round to it. THe unicode string type has more methods (it has center, ljust, rjust). > 2. Along these same lines, since split() became a method of the > string type, wouldn't it make sense to make join() a method of > the list type? Start here: http://x29.deja.com/[ST_rn=ps]/viewthread.xp?AN=588318989 Conclusion: nothing obvious, but the status quo seems the most likely (& best - to me) winner. > 3. Are the classlike standard types (list, dictionary, and now > string) equipped with a __dict__ attribute? I can see the names > of all functions supported by a user-defined class by saying > className.__dict__.keys(), but I cannot see the list of methods > for the string type (at least not in the same way). Thus my > need to ask silly questions like #1 above (maybe capwords is > there by some other name??) No, but they ways that always worked still work : >>> dir('') ['capitalize', 'center', 'count', 'endswith', 'expandtabs', 'find', 'index', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper'] >>> dir(u'') ['capitalize', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isdecimal', 'isdigit', 'islower', 'isnumeric', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper'] >>> ''.__methods__ ['capitalize', 'center', 'count', 'endswith', 'expandtabs', 'find', 'index', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper'] No, no capwords. HTH, M. -- languages shape the way we think, or don't. -- Erik Naggum, comp.lang.lisp From raffael at mediaone.net Sun Apr 23 23:17:35 2000 From: raffael at mediaone.net (Raffael Cavallaro) Date: Sun, 23 Apr 2000 23:17:35 -0400 Subject: The Simple Economics of Open Source In-Reply-To: <200004230436.AAA12178@kirk.dnaco.net> Message-ID: > Correlation doesn't imply causality, and when it does, it's easy to get > causality backwards if you're not careful. You could get misled into > spending lots of money to get rich if you just look at the > correlations. In the case of cash cows, we don't need a causal argument at all. It's simply enough to note that people don't share them. Whether they became cash cows because they weren't shared (possible, though not likely), or they are not now shared because they have become cash cows doesn't really matter. The lesson for open source is the same - expect only commodity items, known to many, to be open sourced. Expect lucrative cash cows to remain closed. Ralph -- Raffael Cavallaro, Ph.D. raffael at mediaone.net From python-list at teleo.net Sun Apr 2 17:05:10 2000 From: python-list at teleo.net (Patrick Phalen) Date: Sun, 2 Apr 2000 14:05:10 -0700 Subject: HTML Form to Python Script Problem In-Reply-To: <38E796BC.23191B2@regnoc.com> References: <38E796BC.23191B2@regnoc.com> Message-ID: <00040214141502.04535@quadra.teleo.net> [Jim Conger, on Sun, 02 Apr 2000] :: :: I'm having trouble getting a simple form to launch a python script on my :: RH6.1 system. Python runs fine alone, but I don't get any action when I :: launch a script. Here is the HTML form: Your form and CGI script are in the same directory? Your script isn't in /cgi-bin? :: The script is set to be executable by all and runs fine alone. However, :: nothing happens when I click the submit button on the HTML form. Any :: clues? (Having a CGI script executable by all is not a good idea.) Since this is RH6.1, presumably you're running Apache. Sounds like you might want to visit http://www.apache.org and read the docs, particularly the docs for ScriptAlias. From richard_chamberlain at ntlworld.com Wed Apr 19 11:27:42 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Wed, 19 Apr 2000 16:27:42 +0100 Subject: COM and returning dates Message-ID: <8dkj9b$lvr$1@gxsn.com> Hi, I'm trying to use Python as a COM object (called from VB) basically returning values from a database, some of which are dates. The problem I'm getting is that the dbi date object obviously doesn't translate. So is there a way a can simply do this? I was thinking of running through the list and converting the dbi date objects into string representations and passing those. But I'm not sure what I do with them on the VB side. Any better ideas? Thanks Richard From guido at python.org Fri Apr 7 15:18:40 2000 From: guido at python.org (Guido van Rossum) Date: Fri, 07 Apr 2000 15:18:40 -0400 Subject: [Python-Dev] Round Bug in Python 1.6? In-Reply-To: Your message of "Fri, 07 Apr 2000 20:45:41 +0200." References: Message-ID: <200004071918.PAA27474@eric.cnri.reston.va.us> > Just checking my newly bought "Guido Channeling" kit -- you mean str() > but special case the snot out of strings(TM), don't you Except I'm not sure what kind of special-casing should be happening. Put quotes around it without worrying if that makes it a valid string literal is one thought that comes to mind. Another approach might be what Tk's text widget does -- pass through certain control characters (LF, TAB) and all (even non-ASCII) printing characters, but display other control characters as \x.. escapes rather than risk putting the terminal in a weird mode. No quotes though. Hm, I kind of like this: when used as intended, it will just display the text, with newlines and umlauts etc.; but when printing binary gibberish, it will do something friendly. There's also the issue of what to do with lists (or tuples, or dicts) containing strings. If we agree on this: >>> "hello\nworld\n\347" # octal 347 is a cedilla hello world ? >>> Then what should ("hello\nworld", "\347") show? I've got enough serious complaints that I don't want to propose that it use repr(): >>> ("hello\nworld", "\347") ('hello\nworld', '\347') >>> Other possibilities: >>> ("hello\nworld", "\347") ('hello world', '?') >>> or maybe >>> ("hello\nworld", "\347") ('''hello world''', '?') >>> Of course there's also the Unicode issue -- the above all assumes Latin-1 for stdout. Still no closure, I think... --Guido van Rossum (home page: http://www.python.org/~guido/) From hamish_lawson at yahoo.co.uk Thu Apr 6 11:16:06 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Thu, 06 Apr 2000 08:16:06 -0700 Subject: Refactoring browser for Python? Message-ID: <16d61288.5cc55c16@usw-ex0101-005.remarq.com> Is anyone working on a refactoring browser for Python? See http://st-www.cs.uiuc.edu/~droberts/tapos/TAPOS.htm for a paper on the Smalltalk original. Unfortunately I don't think they have any plans to produce a Python (or any other language) version. Hamish Lawson * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free! From dsavitsk at e-coli.net Sun Apr 23 15:01:27 2000 From: dsavitsk at e-coli.net (dsavitsk) Date: Sun, 23 Apr 2000 19:01:27 GMT Subject: Using DAO and Python Message-ID: I am jumping in in the middle here... I have a VB program that needs to be more dynamic than VB wants to be. So I use vb to generate a python script that the user can then modify. The primary purpose of the script is to use DAO or ADO to connect to a ms access db (it also connects to an NCS OpScan OMR Scanner, but that is a different story). my problem thus far, and there will be more, is just getting python to use dao correctly. here is what i have tried (esentially following the example on pg 252 of python programming on win32) 1. ran makepy and selected microsoft dao 3.6 from the list 2. in PythonWin typed >>> import win32com.client >>> daoengine = win32com.client.Dispatch('DAO.DBEngine') at this point there is an error esentially i know i oversimplified this way too much, but any suggestions as to what i left out will be greatly appreciated. --------------------------------------------------------------------- dsavitsk at e-coli.net http://www.e-coli.net --------------------------------------------------------------------- From pauldubois at home.com Thu Apr 13 18:02:19 2000 From: pauldubois at home.com (Paul F. Dubois) Date: Thu, 13 Apr 2000 22:02:19 GMT Subject: Hey, the expression parser must be working! Message-ID: Just in case anybody was nervous about whether Python arithmetic expressions have been adequately tested, the following works. Cool, huh? (Composed using Maple 6 via Fortran codegeneration and a text editor) from math import sqrt def cmplx (x, y): return x + 1.0j * y def cubic_roots (a, b, c, d): "Roots of a*x**3+b*x**2+c*x+d" t0 = 1/a*(36*c*b*a-108*d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*a-c\ **2*b**2-18*c*b*a*d+27*d**2*a**2+4*d*b**3)*a)**(1.0/3.0)/6-2.0/\ 3.0*(3*c*a-b**2)/a/(36*c*b*a-108*d*a**2-8*b**3+12*sqrt(3.0)*sqrt\ (4*c**3*a-c**2*b**2-18*c*b*a*d+27*d**2*a**2+4*d*b**3)*a)**(1.0/3.0)-b/a/3 t1 = -1/a*(36*c*b*a-108*d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*a-\ c**2*b**2-18*c*b*a*d+27*d**2*a**2+4*d*b**3)*a)**(1.0/3.0)/12+(3*\ c*a-b**2)/a/(36*c*b*a-108*d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*\ a-c**2*b**2-18*c*b*a*d+27*d**2*a**2+4*d*b**3)*a)**(1.0/3.0)/3-b/\ a/3+cmplx(0.0,1.0/2.0)*sqrt(3.0)*(1/a*(36*c*b*a-108*d*a**2-8*b\ **3+12*sqrt(3.0)*sqrt(4*c**3*a-c**2*b**2-18*c*b*a*d+27*d**2*a**2+\ 4*d*b**3)*a)**(1.0/3.0)/6+2.0/3.0*(3*c*a-b**2)/a/(36*c*b*a-108\ *d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*a-c**2*b**2-18*c*b*a*d+27\ *d**2*a**2+4*d*b**3)*a)**(1.0/3.0)) t2 = -1/a*(36*c*b*a-108*d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*a-\ c**2*b**2-18*c*b*a*d+27*d**2*a**2+4*d*b**3)*a)**(1.0/3.0)/12+(3*\ c*a-b**2)/a/(36*c*b*a-108*d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*\ a-c**2*b**2-18*c*b*a*d+27*d**2*a**2+4*d*b**3)*a)**(1.0/3.0)/3-b/\ a/3+cmplx(0.0,-1.0/2.0)*sqrt(3.0)*(1/a*(36*c*b*a-108*d*a**2-8*\ b**3+12*sqrt(3.0)*sqrt(4*c**3*a-c**2*b**2-18*c*b*a*d+27*d**2*a**2\ +4*d*b**3)*a)**(1.0/3.0)/6+2.0/3.0*(3*c*a-b**2)/a/(36*c*b*a-108\ *d*a**2-8*b**3+12*sqrt(3.0)*sqrt(4*c**3*a-c**2*b**2-18*c*b*a*d+27\ *d**2*a**2+4*d*b**3)*a)**(1.0/3.0)) return [t0, t1, t2] if __name__ == "__main__": print cubic_roots(1.0, -1.0, 1.0, -1.0) From m.faassen at vet.uu.nl Tue Apr 4 11:40:07 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 4 Apr 2000 15:40:07 GMT Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <5l7leern5v.fsf@eric.cnri.reston.va.us> Message-ID: <8cd2cn$bg8$1@newshost.accu.uu.nl> Guido van Rossum wrote: [snip] > The argument that gopherlib c.s. define a 2-arg connect() doesn't mean > that socket should, to: those are all Internet specific protocols, > where host+port is the norm; the lower-level socket API must support > other address families. Okay, makes sense. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From elb at cfdrc.com Fri Apr 21 10:09:35 2000 From: elb at cfdrc.com (Ed) Date: Fri, 21 Apr 2000 09:09:35 -0500 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> Message-ID: <3900611F.3B525BDA@cfdrc.com> On the other hand, I didn't think much of the article. If felt the authors were snobbish because they gave the impression that programmers behave somewhat like monkeys, motivated primarily by concerns about group status and dominance. The abstract's mention of "career concerns" as a motivating factor was not explored in any depth; it simply made the abstract more pallatable. I thought they left out two important motivations for support/involvement in open-source software: (1) frustration (with pointy-haired bosses who don't know what you're talking about until you show them; with dysfunctional software tools; with commercial-software "documentation" that is really advertisement); and (2) risk reduction (concern over the potential money pit that a commitment to Microsoft and commercialized software might bring). Of course, even though I didn't like it, I'm glad they wrote it. Misinformation, delivered to economists and marketing agencies whose interests are to profit from emerging markets by finding influence points, is a good thing. Neel Krishnaswami wrote: > Jeremy Hylton wrote: > > > > The Simple Economics of Open Source > > > > The paper itself is available from one of the authors -- > > http://www.people.hbs.edu/jlerner/simple.pdf > > > > [...] The authors are Josh Lerner -- > > http://www.people.hbs.edu/jlerner/ > > and Jean Tirole -- > > http://www.elsevier.nl/hes/homepage/cvs/tirole.htm > > > > I haven't read the paper yet, but the abstract and the discussion in > > the Times make it sound like a worthwhile read. Thought I'd share the > > pointer to the paper and see if anyone else has read the paper or has > > comments on it. > > The paper is quite good and very readable, as one might expect -- Jean > Tirole literally wrote the book on market structure and imperfect > competition[*]. There's nothing much in the way of new economics in > the paper; it's more like a case study than a theoretical research > paper. > > However, there are a number of excellent insights, among them an > explanation (in a footnote!) of why the BSDs have been able to keep up > with Linux technically, even though the Linux community is much > larger. (Or for that matter, Python and Perl.) > > [*] _The Theory of Industrial Organization_: This is a wonderful book; > it put in my mind the idea that the word "lucid" might have been > invented just to describe it. Only a few other texts (notably SICP) > have impressed me this much. If you are at all familiar with > microeconomics, then you really owe it to yourself to dig this up and > dig into it. > > Neel From thomas at madeforchina.com Sun Apr 23 10:06:57 2000 From: thomas at madeforchina.com (Thomas) Date: Sun, 23 Apr 2000 22:06:57 +0800 Subject: getting the current URL Message-ID: <4.1.20000423220537.02bd5850@202.95.1.37> Hi everyone, I think this is a real easy question, but I can't get it to work. I have a form on a page. After posting, I am trying to get the url of the page which it just posted from (the same form will be on many pages) Ultimately, I want my page to reload itself after submitting the request .... ie. def reloadpage(): url= * the page I just submitted from" print "Status: 302 Found" print "Uri: %s" % url Thanks!, Thomas Thomas Duterme - IT manager Madeforchina.com Technology based marketing tools made for China. ___________________________ Direct Line - (8610) 6417 2665 (ext) 224 Fax - (8610) 6415 1086 Business email: thomas at madeforchina.com Company URL: www.madeforchina.com Get a life at www.51go.com From m.faassen at vet.uu.nl Wed Apr 5 08:05:57 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 5 Apr 2000 12:05:57 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> Message-ID: <8cfa75$fho$1@newshost.accu.uu.nl> Bob Alexander wrote: > I agree with this, too (noting Lisp as possibly the worst example -- > although a fine language with clear favorable influences on Python). But > my issue is not about syntax. > However, too bad about that nasty syntax irregularity that using parens for > tuples presents (1,) (Couldn't resist ;-) But tuples are nice in particular for their *syntax*. With tuples, you can do: def foo(): return 1, 2, 3, 4 first, second, third, fourth = foo() I think this is nice syntax. Without tuples it'd not be as nice. It's not so much about efficiency. This pattern occurs all over Python. [snip] > Yet the concept of array is pretty fundamental to programming. Arrays are > usually thought of as mutable. Anyone having trouble with that concept is > pre-beginner :-) Anyone having trouble with the concept of immutable lists must have never heard of functional programming? [snip] > I'm sure tuples are not an acciental feature. And my issue comes from > understanding, not lack of understanding. Given the above two items, I don't think you understand tuples yet. I consider tuples to be mostly nice syntax (with one nit, the single element tuple). You could almost see the immutability semantics being there to support the syntax, not the other way around. It might be possible to preserve the nice syntax and still get rid of tuples, if you still allow this: foo, bar, baz = [1, 2, 3] But this is less symmetrical, and since lists are mutable, this may go wrong far more easily. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From fig at oreilly.com Thu Apr 20 10:28:37 2000 From: fig at oreilly.com (Stephen R. Figgins) Date: Thu, 20 Apr 2000 14:28:37 GMT Subject: Gtkinter documentation References: <8F1C7387Elminutieidit@192.6.1.10> Message-ID: <38FF13D3.BCB79F69@oreilly.com> Luca wrote: > Where can I find documentation about Gtkinter? > > Luca. With the PyGTK documentation. You can find the PyGTK home page at: http://www.daa.com.au/~james/pygtk/ Gtkinter.py has been replaced with gtk.py (since about 11/98). So unless you are maintaining legacy code, you probably want to look at the gtk.py documentation. Stephen Figgins http://www.oreillynet.com/python From lminuti at eid.it Thu Apr 20 05:36:28 2000 From: lminuti at eid.it (Luca) Date: Thu, 20 Apr 2000 11:36:28 +0200 Subject: Gtkinter documentation Message-ID: <8F1C7387Elminutieidit@192.6.1.10> Where can I find documentation about Gtkinter? Luca. From mwh21 at cam.ac.uk Sun Apr 16 13:24:12 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 16 Apr 2000 18:24:12 +0100 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F9F01B.57273052@tismer.com> Message-ID: Christian Tismer writes: > It will become simpler, simpler and simpler. I cam across a great quote the other day; I think it was attributed to Alan Perlis, and it was: Simplicity follows complexity, not the other way round. I think (and in fact have always thought, even before I read the quote) Stackless Python is an almost perfect example of this. Cheers, M. -- On the other hand, the following areas are subject to boycott in reaction to the rampant impurity of design or execution, as determined after a period of study, in no particular order: ... http://www.naggum.no/profile.html From echuck at mindspring.com Sat Apr 15 19:25:50 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Sat, 15 Apr 2000 19:25:50 -0400 Subject: CGI support question References: Message-ID: <38F8FA7E.8901E6C4@mindspring.com> Richard Chamberlain wrote: > Can anyone tell me of an ISP who supports python in the UK? Or even better > would be a site that would give me free space who supports Python. > > Thanks > > Richard Go to "Python-Friendly ISPs" and search for "UK". http://www.corrt.com/info/pyisp-list.html -Chuck From m.faassen at vet.uu.nl Fri Apr 21 22:29:11 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 22 Apr 2000 02:29:11 GMT Subject: Python for drivers? References: <3900EDBE.282BC85@dsuper.net> Message-ID: <8dr2pn$ec8$1@newshost.accu.uu.nl> Dave wrote: > Can Python be used for writing device drivers? I just got BeOS 5 and it > doesn't support some video cards. I'd like to write one for the Cirrus > Logic card and I want a language that's clear and concise- Python. I've > never written device drivers. Any suggestions? Most probably: no. If you got it going, it'd be sloooooooooow. Python is clear and concise, but it doesn't execute very quickly compared to C. Python's also not as good as C at access to the bare metal (the video card); you'd have to get significantly funky to be able to do that (and you'd need some C in there). So in this case I think that even prototyping in Python, then moving to C, isn't going to work. Sorry! Wish I could've given you more positive suggestions. It's just one of those cases where Python isn't fast or low-level enough. This is rare, but it does happen. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From breiter at usf.Uni-Osnabrueck.DE Mon Apr 3 05:21:07 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 3 Apr 2000 09:21:07 GMT Subject: Python 1.6 alpha 1 released References: <200004010159.LAA00403@piglet.dstc.edu.au> Message-ID: <8c9nq3$ghk$4@newsserver.rrzn.uni-hannover.de> In article <200004010159.LAA00403 at piglet.dstc.edu.au>, David Arnold writes: > -->"Bjorn" == Bjorn Pettersen writes: > > Bjorn> The more time I spend on fixing > Bjorn> compatibility issues in Python scripts, the less time I spend > Bjorn> on "real" work. > > you have been using incorrect arguments. the fact that they worked > was unfortunate because it leads to circumstances like this. but the > time you have spent on these emails would have been enough to run a > simple script over your code to fix the problem ... ;-) Hmm how simple would a script be to get all occurences of: socket.connect(what, \ else \ ) sc=socket.connect sc(what,else) sc(what, \ else) just a thought. Bernhard -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) From moshez at math.huji.ac.il Wed Apr 5 05:23:42 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 5 Apr 2000 11:23:42 +0200 (IST) Subject: Why should I switch to Python? - Infinity of Primes In-Reply-To: <38EAC8C4.ADC25640@cosc.canterbury.ac.nz> Message-ID: On Wed, 5 Apr 2000, Greg Ewing wrote: > Um, no it doesn't - it constructs a number which is > *either* prime *or* divisible by some other prime bigger > than the one you started with. The second case includes the first one, and that is still constructive, since there is an algorithm to find a prime factor of a number. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From neilh at hare.net.au Sat Apr 8 21:37:29 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Sun, 9 Apr 2000 11:37:29 +1000 Subject: win32all-130 for Python 1.6 available References: <_ziF4.1488$1b4.6926@news-server.bigpond.net.au> Message-ID: <00bc01bfa1c4$2b8a2940$46dd3fcb@neil> > 1. The following does not fold correctly: > > def spam(): > return """spam > is > good""" OK. The folding rules will require tweaking for a while to approach correctness. This one looks fairly easy: Lines that start in triple quote style may not be fold headers. > 2. Similarly, the following should perhaps not fold: > > # A comment ending with a colon: > # more comment here The colon isn't used in the folding rules so there is some more context causing this. Neil From tom-main at REMOVEME.home.com Fri Apr 14 16:06:48 2000 From: tom-main at REMOVEME.home.com (Tom) Date: Fri, 14 Apr 2000 20:06:48 GMT Subject: How do I undo an import?? References: <7QrJ4.185421$Hq3.4353581@news2.rdc1.on.home.com> Message-ID: Uh... no, I didn't. Sorry, I'm quite new to Python. Tom. "Grant Edwards" wrote in message news:slrn8festb.8ld.grant at grante.comtrol.com... > In article , Tom wrote: > > >After importing NetCfg I type: > > > >>>> del sys.modules['NetCfg'] > > > >Python responds as follows: > > > >Traceback (innermost last): > > File "", line 1, in ? > >NameError: sys > > > >Any ideas?? > > Did you do an "import sys"? > > -- > Grant Edwards grante Yow! You mean you don't > at want to watch WRESTLING > visi.com from ATLANTA? From tom__98 at my-deja.com Wed Apr 12 18:35:31 2000 From: tom__98 at my-deja.com (tom__98 at my-deja.com) Date: Wed, 12 Apr 2000 22:35:31 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> <8d1lgu$ga0$1@newshost.accu.uu.nl> Message-ID: <8d2tnj$k9m$1@nnrp1.deja.com> In article , dan at cgsoftware.com wrote: > I also don't see why Tom praises the CPAN module so much. > My main problem with it is > " > 203 installed modules have no parseable version number > " > Yet i haven't installed any modules for PERL on my own. I have only used CPAN, not looked into how it is implemented, but versioning seems to work pretty well: the CPAN tool will actually check for updated modules and recommend upgrades. BTW, modules also all come with documentation in a standard format, as well as a standard set of regression tests. There is also some MD5 checksum test, although I'm not sure how much security against Trojan horses that actually provides. I recommend giving it a try; it's an important, widely used example of a software distribution system. Just to reiterate: I think CPAN accounts significantly for the popularity of Perl. It works pretty well, it's useful, and I'd like to have something similar for Python. With something like CPAN, it's much easier to use non-standard modules and shared one's scripts and programs with others. I realize that there is a SIG and that some work has been done on this for Python; I think that's great, and the sooner it comes out, the better. Tom. Sent via Deja.com http://www.deja.com/ Before you buy. From gsez020 at kryten.bedford.waii.com Wed Apr 5 03:59:53 2000 From: gsez020 at kryten.bedford.waii.com (Pete Forman) Date: 05 Apr 2000 08:59:53 +0100 Subject: blessed be Guido, for "5 <= X <= 10" does what it should... References: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca> Message-ID: >>>>> "Samuel" == Samuel A Falvo writes: Samuel> In article <3TpG4.3349$HG1.98231 at nnrp1.uunet.ca>, Warren Samuel> Postma wrote: >> (Actually I'd write the <= as '?' (Unicode U+2264) but using >> such things in our code would seriously cramp portability. >> Hey, is the APL symbol set anywhere in Unicode!?) Samuel> Astonishingly enough, it is. Or so I've been told. Not Samuel> sure where or how to verify this, though, as I've never Samuel> used APL. It's part of their 32-bit character set. APL runs from U+2336 to U+237A. It additionally reuses some other characters. BTW Unicode is 16 bit; it is aligned with the BMP subset of the 31 bit ISO 10646. -- Pete Forman | Disclaimer: This posting is originated by Western Geophysical | myself and does not represent the opinion pete.forman at westgeo.com | of Baker Hughes or its divisions. From ivanlan at callware.com Tue Apr 18 13:15:57 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 18 Apr 2000 11:15:57 -0600 Subject: o'reilly python devcenter References: Message-ID: <38FC984D.59407BCB@callware.com> Hi All-- "Michal Wallace (sabren)" wrote: > > I didn't see this posted already, but sorry if its old news. > O'Reilly started a new python site: > > http://www.oreillynet.com/python/ > Hmmm. I looked it over, admittedly not in great depth, but: 1) There seems to be no mention of www.python.org 2) There seems to be no mention of the python mailing lists 3) The only books mentioned are O'Reilly books 4) There seem to be no links to other websites Maybe I'm very wrong here, but I think this sort of attempt to control the vertical and horizontal is a bit foreign to Python. I like (make that love) O'Reilly books, but I'll say the same thing I said back when the Honda Civic made its debut: "There's no reason to apply hard-sell arm-twisting techniques here. The car sells itself, the engineering is that good." Of course, that didn't prevent me from getting enough arm-twisting FUD phone calls from the salesman I made the mistake of giving my name to that I ended up not buying a Honda. "Open Source" is a philosophy that applies to more than source. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From Jhlee at Brooks.com Mon Apr 3 15:26:11 2000 From: Jhlee at Brooks.com (Lee, Jaeho) Date: Mon, 3 Apr 2000 15:26:11 -0400 Subject: Creating variables on the fly... Message-ID: <857F15D7E3D8D3118D290008C7CF058627070F@mail-naeast1.brooks.com> I think that this is the place you should use list. What about this. def add(listVar) r = 0 for something in listVar r = r + something return r I'm still learning python. So please forgive any syntax or naming convetion problem. Jaeho >Hi All, > >Let's say I have four variables: > >a=1 >b=2 >c=3 >d=4 > >And I have a function that adds these variables together: > >def add(a,b,c,d): > return a+b+c+d > >But now let's say I have twenty variables that I want to add >together. >This function will no longer work. I would have to rewrite it as >a+b+c+d+e+f+g+...+(20th letter). Is there a way to >dynamically create a >variable name? So that my add function can automatically >determine how >many variable names to create and then add the values together. In >other words, I'd ideally like something like: > > >def add(number_of_variables): > return a+b+c+...+(letter corresponding to number_of_variables) > >Thanks for your help, > >Matt From samschul at pacbell.net Mon Apr 24 18:32:37 2000 From: samschul at pacbell.net (Sam Schulenburg) Date: Mon, 24 Apr 2000 22:32:37 GMT Subject: Princeton Instruments Python interface Message-ID: <8e2i25$gou$1@nnrp1.deja.com> I am developing a python library to access Princeton Instruments Spectroscopic WinX/32 COM objects. If anyone else has had done this I would like to get in touch with you to share ideas. Sam Schulenburg Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Wed Apr 5 07:36:19 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 05 Apr 2000 12:36:19 +0100 Subject: UserDict's has_key() and get() should use __getitem__() References: <0535db98.ec878f67@usw-ex0101-005.remarq.com> Message-ID: Hamish Lawson writes: > However, under the current implementation of UserDict, if you > redefine __getitem__() in your own UserDict-derived class, you > will probably also have to redefine has_key() and get() (and > maybe others) in order to have them behave as expected. This > wholescale redefining is caused by the fact that UserDict's > has_key() and get() methods don't make use of the class's own > __getitem__() method in determining whether a key exists, as > shown in the extract below: > > def __getitem__(self, key): > return self.data[key] > def has_key(self, key): > return self.data.has_key(key) > def get(self, key, failobj=None): > return self.data.get(key, failobj) > > My contention is that the behaviour we expect from get() and > has_key() is intimately bound up with how __getitem__() behaves, > and this should be reflected in get() and has_key() making use > of __getitem__(): > > def has_key(self, key): > try: > self[key] > return 1 > except KeyError: > return 0 > def get(self, key, failobj=None): > try: > return self[key] > except KeyError: > return failobj Hmm. These are likely to be rather less efficient than the current implementation, so you want to penalise those who use UserDict for the sake of those who don't subclass it thoroughly - do you really want to do this? Let's face it, you're unlikely to make this mistake again. Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From embed at geocities.com Mon Apr 3 16:17:38 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 3 Apr 2000 15:17:38 -0500 Subject: lightweight embedded database table object References: Message-ID: <5a6G4.2924$HG1.87456@nnrp1.uunet.ca> > Hi Warren, > Have you looked at MetaKit? http://www.equi4.com/metakit/python.html It didn't look 'ready for prime time' -- too many disclaimers of the kind I usually put on something when I expect it's still quite buggy or unscalable. I suppose I should give it more of a try though, eh!? Is anyone using this in a 'production environment'? Warren From brent.fulgham at xpsystems.com Mon Apr 10 13:15:57 2000 From: brent.fulgham at xpsystems.com (Brent Fulgham) Date: Mon, 10 Apr 2000 10:15:57 -0700 Subject: Python 1.6 -- Any hope for new threading core? Message-ID: With the 1.6 Alpha release, I was wondering if any changes had been made to the implementation's threading core. While 1.5 is a definite improvement over 1.4, it's still necessary to grab the global interpreter lock, etc., when writing code for a multi-threaded C extension. Just curious if any of this behavior is changed with 1.6? Thanks, -Brent From wpeloqui at ismi.net Tue Apr 4 13:01:29 2000 From: wpeloqui at ismi.net (Willie Peloquin) Date: Tue, 04 Apr 2000 17:01:29 GMT Subject: Starving for an Advanced Python Book References: <20000404040941.7766.qmail@web2106.mail.yahoo.com> Message-ID: <8cd74u$9fi$1@nnrp1.deja.com> Try "Python and Tkinter Programming" by John E. Grayson. It is an excellent book, full of useful information on using Python in the real world. Willie Peloquin In article <20000404040941.7766.qmail at web2106.mail.yahoo.com>, lewst wrote: > Having finished "Learning Python", I'm now looking for an advanced > Python text. ORA's "Programming Python" is a natural choice, but I > can't bear buying this outdated book when the 2nd edition is due out > in a few months (I'm dying here Lutz, hurry it up already!). However, > I really need something in the interim period. The library reference > manual is fine but usage is difficult for me to figure out sometimes > because there are very few examples included. > > Does anyone have any suggestions? I suppose I'm looking for a text > that has examples of how to solve various kinds of programming > problems in Python and also examples of code showing how the library > and various modules actually work. How is the "Python Essential > Reference" on examples? Is it just a rebinding of the python.org > library reference > > Thank-you. > > __________________________________________________ > Do You Yahoo!? > Talk to your friends online with Yahoo! Messenger. > http://im.yahoo.com > > -- Willie Peloquin Senior Software Engineer - Contract http://www.ismi.net/~wpeloqui Sent via Deja.com http://www.deja.com/ Before you buy. From billtut at microsoft.com Thu Apr 20 11:40:19 2000 From: billtut at microsoft.com (Bill Tutt) Date: Thu, 20 Apr 2000 08:40:19 -0700 Subject: Using popen in windows Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCF7D@RED-MSG-50> > From: Gordon McMillan [mailto:gmcm at hypernet.com] > > Robert Cragie > > > I tried this and it still hangs; cvs.exe is definitely not > a built in: > > > > from win32pipe import popen > > p = popen('c:\\cygwin\\contrib\\bin\\cvs -v','r') > > str = p.read() > > print str > > > > Again, the equivalent works fine on Linux. > > Works fine on NT, too. Bill Tutt put out something that works > around the Win9x bug. Searching dejanews on popen and > Win95 should find it. Indeed, the 128 build of the Win32 extensions includes the fix (hack) for Win9x for this cheesy and lame bug. Bill From aa8vb at yahoo.com Wed Apr 12 07:58:12 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 12 Apr 2000 07:58:12 -0400 Subject: comparing strings and ints In-Reply-To: <1256641282-42160637@hypernet.com> References: <2YmI4.366$rc9.188014080@newsb.telia.net> <20000411134358.A2352304@vislab.epa.gov> <1256641282-42160637@hypernet.com> Message-ID: <20000412075812.A2449004@vislab.epa.gov> Gordon McMillan: |Randall Hopper wrote: |> Fredrik Lundh: |> | |> | Objects of different types always compare unequal, and are |> | ordered consistently but arbitrarily. |> |> I can see 45 == '45' being false, and 45 != '45' being true. But it seems |> to me that not throwing an exception for attempts at an ordered comparison |> with logical ordering operators (<, <=, etc.) on objects of different |> primitive types (e.g. 45 < '45', 45 > '45') only lets bugs pass through. |> |> Is there a case where this could be useful (with its undefined behavior)? |> I believe that is the root of the question. | |I'd happily bet your wife and firstborn child that there's code that |relies on it , if only because after sorting a list, all the ints |will end up in a clump, and all the strings in another, etc. Oh, I also have __no doubt__ that someone is using this unofficial, undocumented behavior. But they don't have a leg to stand on if the ordering breaks in a future Python version ;-) Capitalize-on-Python's-undefined-behavior-while-you-can'-ly yours, Randall -- Randall Hopper aa8vb at yahoo.com From vespe at cs.tut.fi Mon Apr 3 12:11:51 2000 From: vespe at cs.tut.fi (Vespe Savikko) Date: 03 Apr 2000 19:11:51 +0300 Subject: Python and COM without Automation (Dispatch) Message-ID: PythonCOM works very well with COM objects that implement IDispatch interface. However, I have a number of COM objects that do not implement IDispatch and I would like to use them from Python as well. >From the book _Python Programming on Win32_ I gather that I would have to create a PythonCOM extension DLL and that might even be quite a simple and possibly automated process (with the help of SWIG and other tools), but I haven't been able to find any detailed instructions on the subject. I haven't walked through the win32com source code yet so if the necessary information is located somewhere among the source files, you can ignore this message. Any help is appreciated. ++Vespe -- ------------------------------------------------------------------ Vespe Savikko vespe at cs.tut.fi - to doom de doomsday - From pecora at anvil.nrl.navy.mil Fri Apr 28 07:51:34 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Fri, 28 Apr 2000 11:51:34 GMT Subject: Do I always have to write "self." ? References: <270420001706386648%pecora@anvil.nrl.navy.mil> <8eacdf$nnm$1@newshost.accu.uu.nl> Message-ID: <280420000751353947%pecora@anvil.nrl.navy.mil> In article <8eacdf$nnm$1 at newshost.accu.uu.nl>, Martijn Faassen wrote: > There's a way, but stuff can also become more cluttered. In some > cases it'll also be a bit faster, as local variable access is > faster than access through self. In lots of other cases it can be slower. > I'll demonstrate: > > class Foo: > def __init__(self): > self.data = [] > self.more = 10 > self.interesting = "foo" > > def involved_method(self, something): > data, more, interesting = self.data, self.more, self.interesting > > if more > 15: > data.append(something) > data.append(interesting) > > But note this! > > def uhoh_method(self): > data, more, interesting = self.data, self.more, self.interesting > # this changes self.data, neat > data.append('foo') > # this won't change self.more! > more = more + 1 > # and this won't change self.interesting > interesting = interesting[10:] > > So, beware when you want to change attributes that refer to immutable > objects. You do have to use self in that case. I think that you'll > find that eventually you'll get used to 'self', and you may even > be grateful for its presence. At least you can see instantly where > your variable are coming from. The local variable trick, used in moderation, > can help some as well. Martijn, Thanks for the very nice tutorial. Your example brings up some typical stumbling blocks for us beginners. Namely, references to mutable and immutable objects. In the above I would describe things as follows (am I right or wrong?): (1) data and self.data point to the same object, a list, so when a method is called it is the method that works on that instance of a list and either data or self.data will append 'foo' to the same list object. (2) when you do more=more+1 an new object (the more+1 value) is created and more then points to it and no longer to the old value of self.more. The latter still exists and points to the original 10 object. (3) Similar story here for interesting where a new object interesting[10:] is created and interesting is "switched" to point to it. self.interesting still points tohe "foo" object. I hope I got that right, because they have tripped me up a few times. Thanks, again. From aaron_watters at my-deja.com Mon Apr 24 11:48:02 2000 From: aaron_watters at my-deja.com (aaron_watters at my-deja.com) Date: Mon, 24 Apr 2000 15:48:02 GMT Subject: ANN: NJ Piggies welcome Andy Robinson References: <39044E57.58467ED@reportlab.com> Message-ID: <8e1qbb$nit$1@nnrp1.deja.com> In article , Les Schaffer wrote: > > Please join us as the New Jersey Python interest group (NJ Piggies) > > welcome Andy Robinson, Chief Architect and CEO of ReportLab, > > visiting from London. > > what is planned for this occasion? lecture? topics? This is strickly a social/networking event. Modest consumption of alcoholic beverages will be permitted. ;c) FWIW: If anyone is interested a number of the attendees may be in a hiring mood, although I promise nothing. Aaron Watters (http://www.chordate.com/map.pdf) Sent via Deja.com http://www.deja.com/ Before you buy. From johann at physics.berkeley.edu Tue Apr 4 14:21:34 2000 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 04 Apr 2000 11:21:34 -0700 Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> Message-ID: Bob Alexander writes: > I'm aware that this issue is not some great flash of insight. It is so > obvious that the Python in-group certainly have given it plenty of thought. > But that doesn't mean it's not worth talking about, Like so many things... In any case, I'll throw in my two cents. Tuples and lists seem conceptually much different to me, and I expect that they feel much different to a lot of people, but I don't expect they feel that way to everyone. ;-) Tuples are mathematical. They have fixed lengths. If python variables are a space V, an N-tuple is V^N. Tensor products, and all that. Lists are, well, lists. I put things in them. I take things out. They've got nothing to do with tuples. Tuples can be used to let functions return more than one value, without the conceptual overhead of making a class.(1) Lists are just the wrong thing for that, they send the wrong message. Tuples wrap up elements from larger spaces, like points, (name, address) pairs, and so on. Ooh. I think I hit my big reason. Ignore the actual details of typing, and so on. I see lists as being mostly homogeneous, regardless of their implementation. They contain a list of names, or numbers, or widgets. I see tuples as combining different types into one conceptual whole. (name, age) pairs. (x, y) points. (place, time). They mentally bind tighter than lists, turning other objects into new composite objects. Lists just string them together. Now python doesn't enforce this typing, but that's the way I think of them. And in that mindset, tuples are a completely natural thing. Most applications could use lists instead of tuples, but there wouldn't then be any way to write the more elementary concept of "tuple-ness". And I like having that concept around. I like being able to write (x, y) = calculate_point(foo) a, b = b, a name, sex, birthdate = unpack_info_string(str) and so on. [x, y] = calculate_point(foo) [a, b] = [b, a] [name, sex, birthdate] = unpack_info_string(str) just seem wrong. Those aren't really technical arguments. They're "expressiveness" arguments. And, to be honest, I have no idea if they convey the point. You may be right; it may be a religious issue. (And I may be crazy. But it just might be a lunatic you're looking for.) But, IMHO, it's religion with style! Cheers, --Johann 1. By the way, C++ would be a much nicer language if it had a good way to return tuples without all the template cruft. ML is your friend. 2. Also, the lisps make this distinction. Common Lisp has values and multiple-value-bind, while R5RS Scheme now has values and, well, complicated macros to write multiple-value-bind. -- Johann Hibschman johann at physics.berkeley.edu From rcunning at acm.org Wed Apr 5 14:21:36 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Wed, 05 Apr 2000 18:21:36 GMT Subject: Pass by reference ? References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38EAF8D8.4B7C43B4@ecs.soton.ac.uk> <38EB56AE.F938CE06@acm.org> <38EB63BC.FE03BA31@ecs.soton.ac.uk> <38EB6EB1.9759397C@ecs.soton.ac.uk> Message-ID: <38EB838A.53122AF6@acm.org> Jacek Generowicz wrote: > Michael Hudson wrote: > > > The code you posted only confuses if you have a flawed understanding of > > assignment in Python > > That is exactly the point. My original confusion arose precisely because I had > made an incorrect assumption about assignment in Python (an assumption which, I > suspect, many newcomers to the language will make until they learn the truth). > Correcting this error is far more constructive than discussing what name should be > given to the semantics of argument passing. IMHO, they are, ultimately, one and the same. It is useful to be able to discuss Python assignment and passing semantics and syntax with those who know nothing about, or have no interest in, Python itself, or are so new to the language that the only common frame of reference is either academic (formal, theoretical) or via analogies to other languages (informal, practical). The abstractions are important, and thus, so is the nomenclature (if the abstractions are to be understood and shared). The notion of "side effects" in general, as related to passing and assignment, is a fairly high-level issue with very low-level implications. So clearing up the terminology gets us all on the same page, so to speak, and thus allows us to discuss Python specifics in the context of theory AND in comparison to other languages. In particular, living under "an assumption which, I suspect, many newcomers to the language will make until they learn the truth" is EXACTLY the attitude I wish to avoid. If it is true, it should not require learning the entire language to UNDERSTAND it. It does, however, require learning the language to USE it. It seems obvious to me that allowing understanding to PRECEDE use is not a bad way to go, since it allows you to build on existing knowledge (all that theory from college), rather than be forced to start from zero. The CS models of "Pass By Reference" and "Pass By Value" are fairly well understood, but they do not seem to map simply and directly to Python. Rather than say "Give up on theory, just learn Python", I'd rather EXTEND (or clarify) the theory to account for Python! Then, I'm certain, I will learn Python better and faster. It is the ability to make generalizations that distinguishes those who learn quickly ("I get the general idea, now lets focus on the details") from those who can't ("Just give me enough examples and a good interpreter and debugger, and I'll get it eventually"). The abstractions matter, especially when they can be mapped to accepted theory. If for no other reason, theory is important simply because it allows us to form generalizations that permit previously learned knowledge to be employed (remapped) in the effort to learn a new language. There is not the "World Of All Other Computing Languages" and "Python" off by itself. It is a continuum that has a large and powerful body of theory and practice behind it. It makes sense to show how Python is part of that continuum before just saying something self-limiting, like "Python is Different - Get used it". Or that newcomers should wait "until they learn the truth". Those sentiments may apply to Perl , but certainly not to Python! Looking-for-how-Python-fits-into-the-grand-scheme-of-things-ly Yours, -BobC From richard_chamberlain at ntlworld.com Wed Apr 19 05:37:35 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Wed, 19 Apr 2000 10:37:35 +0100 Subject: win32all-128.exe availability? References: <38fd01b2$0$10982@senator-bedfellow.mit.edu> Message-ID: <8djuos$5oh$1@gxsn.com> I have a copy as well, so if you have difficulties mail me and I'll forward it to you. Richard "Robert" wrote in message news:38fd01b2$0$10982 at senator-bedfellow.mit.edu... > Now that starship has crashed, I was wondering if it was possible to > get the 128 build of Pythonwin extensions off the net? By an unfortunate > coincidence, my own hard drive chose to crash around the time starship > did. > > Thanks > Robert > > From johngrayson at home.com Sat Apr 15 20:09:13 2000 From: johngrayson at home.com (johngrayson at home.com) Date: Sun, 16 Apr 2000 00:09:13 GMT Subject: Combobox in Tkinter References: <38F8F133.54FCC64B@swt.edu> Message-ID: <8db0b1$b3o$1@nnrp1.deja.com> In article <38F8F133.54FCC64B at swt.edu>, "Shah, Navneet" wrote: > How to decrease the width of the combobox in Tkinter? Do we have any > option for that > > Shah > > set the width of the entryfield component: assuming the combobox id is 'xxx': xxx.component('entryfield').configure(width=4) Sent via Deja.com http://www.deja.com/ Before you buy. From junkster at nospam.rochester.rr.com Mon Apr 17 18:47:47 2000 From: junkster at nospam.rochester.rr.com (Benjamin Schollnick) Date: Mon, 17 Apr 2000 22:47:47 GMT Subject: TKMessageBox, and TKINTER console? Message-ID: Folks, Crazy Question..... I'm starting to mess around with Tkinter, and for now at least, just trying to display "pop-up" dialogs. I found the TKMESSAGEBOX unit, in the lib-tk directory, and that works great for my purposes. Except, for a small "appearance" problem. I call the TKmessagebox routines, and their are TWO windows. One is the pop-up I've called, and the other is the Tkinter "Console" (??). Or at least that's the nickname, I've given it. I've tried a variety of different things to get rid of it...For example, calling junk= TK.tk() to a variable, and passing it as "master=junk", or as "parent=junk" in the code... I'm not sure if there is anyway to get rid of that darn console. Anyone got some suggestions for a really confused first time Tkinter'er? - Benjamin ==================================================== (Remove "NoSpam" to Email me) ==================================================== Please feel free to copy any and or all of this sig. A little something for spam bots: root at localhost postmaster at localhost admin at localhost abuse at localhost postmaster at 127.0.0.1 Chairman William Kennard: bkennard at fcc.gov Commissioner Susan Ness: sness at fcc.gov Commissioner Harold Furchtgott-Roth: hfurchtg at fcc.gov Commissioner Michael Powell: mpowell at fcc.gov Commissioner Gloria Tristani: gtristan at fcc.gov consumerline at ftc.gov fccinfo at fcc.gov ssegal at fcc.gov From bellman at lysator.liu.se Tue Apr 4 18:18:42 2000 From: bellman at lysator.liu.se (Thomas Bellman) Date: 4 Apr 2000 22:18:42 GMT Subject: Python 1.6 alpha 1 released References: <5E877FD7637AB46E.DABBED9CF3C1D64B.CDDDC05AE7374A78@lp.airnews.net> <8cca93$9oh$1@nnrp1.deja.com> Message-ID: <8cdpo2$l99$1@newsy.ifm.liu.se> "Fredrik Lundh" wrote: > 1) stumbled upon one today: it turned out that by changing from 1.3 > to 1.5.2, large data transfers from a high-performance server to clients > on an 10 Mbit Ethernet were unexpectedly terminated. the same trans- > fers worked just fine with high-performance workstations, on an FDDI > network. ten guru points to anyone who can explain why. Sounds like problem with segmentation on the different frame sizes of Ethernet and FDDI. Probably you were using TCP, and switching to Python 1.5.2 made you send data that didn't fit inside an Ethernet frame (1500 octets, including IP and TCP headers). The sending TCP stack thus split the stream into several TCP segments. The program that received the data wasn't prepared for the fact that TCP can segment data any which way it wants to, and broke when the socket didn't return the entire record in one read(2). The data didn't grow to overflow the 4352 octet MTU for FDDI frames, thus the TCP stack still used only a single segment then. Classic bug. I have seen it in several programs. The latest example is from the IP masquerading code in Linux kernels, at least of 2.0 and 2.2 vintage. (Of course, *I* have never made that mistake. That I know of, at least...) Of course, that is only my first guess. There could be other reasons. One possibility could be that your programs were timing sensitive, and the lower speed of 10 Mbit/s Ethernet triggered the bug. And I could probably think up other explanations that fit the information you have given us. But I believe TCP segmentation is the most probable. soon-to-be-neighbours-again'ly yours, -- Thomas Bellman, Lysator Computer Club, Link?ping University, Sweden "Beware of bugs in the above code; I have ! bellman @ lysator.liu.se only proved it correct, not tried it." ! Make Love -- Nicht Wahr! From thomas.heller at ion-tof.com Wed Apr 26 12:22:29 2000 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Wed, 26 Apr 2000 18:22:29 +0200 Subject: [Win32] Retrieve icon for file type? References: Message-ID: <004b01bfaf9b$9e3f1830$4500a8c0@thomasnb> > I'm attempting to use the Windows registry to retrieve (and convert to a > PNG/JPEG) the Windows icons for given files (so that a Windows-based server > can display file-type-specific icons). I do not seem to be able to find the > function shellapi.ExtractIcon ( > http://msdn.microsoft.com/library/psdk/winui/icons_7h2m.htm ) in the Win32 > extensions. You might want to look at MEInc/Dist/icon.py in Gordon's win32 installer package. This file uses LoadResource to extract icons from executable files. (Note however that you get the raw data, and not an HICON). Thomas From andymac at bullseye.apana.org.au Wed Apr 5 09:06:31 2000 From: andymac at bullseye.apana.org.au (Andrew MacIntyre) Date: Wed, 5 Apr 2000 23:06:31 +1000 (EST) Subject: Tkinter and C extensions Message-ID: I am looking at writing a C extension for python which links to a C library (which is commercial and I don't have access to source), with a python wrapper to tidy up a couple of rough edges. This library can make use of an X "canvas", the details of which are passed through an API function in terms of its X[lib|t] Display pointer and Window handle. As I would like to direct the library to use a Tkinter canvas widget for its display, I'm looking for a way to get these details about the target widget. My research has turned up ways of determining these via Tk's API (Tk_Display(), Tk_Window() in tk.h) provided I can extract the tkwin handle from Tkinter's canvas widget - something I've yet to figure out how to do from within a C extension. I'm wondering whether its possible to get at this information via Tkinter, which would simplify the interactions between the various components. I've perused the Fredrik's Tkinter docs, but I didn't find anything that appeared to get close to what I think I'm looking for :-(. I have downloaded the "Life preserver" stuff, but have yet to make much headway with it. I went looking for the GD module, which I thought might possibly have done something like this, but following the link from the Vaults of Parnassus yielded nothing. Any hints on additional sources of enlightment, such as other modules which have similarities, would be appreciated. -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andrew.macintyre at aba.gov.au (work) | Snail: PO Box 370 andymac at bullseye.apana.org.au (play) | Belconnen ACT 2616 andymac at pcug.org.au (play2) | Australia From anders.eriksson at morateknikutveckling.se Fri Apr 28 04:49:18 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Fri, 28 Apr 2000 10:49:18 +0200 Subject: newbie dbase dataaccess References: Message-ID: On Thu, 27 Apr 2000 11:40:46 +0200, "Georg Hammerbacher" wrote: >Hello everybody, > Hello Georg! >I?m just new in programming Python and now I want to make my own personal >adressmanager with a simple dBase-file. >How can I get access to it or where can I find more info?s about using >dbase-files within Python? > First: Why do you want to use dBASE as the database format? I haven't found any good dBASE interface for Python. So if you want to use the dBASE format you need to use ODBC and then you hopefully are on a computer that runs unders Windows NT/98. If you don't NEED to use dBASE then look at http://www.python.org/topics/database/ here you will find alot of info about how to use Python for accessing databases.... // Anders From mwh21 at cam.ac.uk Wed Apr 5 04:13:12 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 05 Apr 2000 09:13:12 +0100 Subject: Getting the argument names passed to a function ? References: <20000404225810.A12156@sz-sb.de> Message-ID: quinn at riyal.ugcs.caltech.edu (Quinn Dunkan) writes: > import sys > def arghack(arg): > try: > 1/0 > except: > frame = sys.exc_info()[2].tb_frame.f_back > while frame: > for k, v in frame.f_locals.items(): > if arg is v: > return k > frame = frame.f_back > else: > return None You don't need to scan back through the frames do you? I mean the argument has to be visible just one up for it to be passed to the function... Anyway, it says in my contract that I have to answer questions like this - so we'd better have: import sys from bytecodehacks.code_editor import EditableCode from bytecodehacks.ops import * def argHack(var): try: raise TypeError except TypeError: frame = sys.exc_traceback.tb_frame.f_back code = EditableCode(frame.f_code) op = code.co_code[code.co_code.byte2op[frame.f_lasti] - 1] if op.__class__ is LOAD_FAST: return code.co_varnames[op.arg] elif op.__class__ in [LOAD_NAME,LOAD_GLOBAL]: return code.co_names[op.arg] else: return None There are various problems with extending this to being "useful", mainly to do with working out the layout of the stack. Tedious. It seems to work, though: >>> x=1 >>> def test(s): return argHack(s), argHack(x) ... >>> test(1) ('s', 'x') Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From wayne.izatt at myself.com Sat Apr 22 12:10:56 2000 From: wayne.izatt at myself.com (Wayne Izatt) Date: Sat, 22 Apr 2000 16:10:56 GMT Subject: Installing PyApache Message-ID: <3901CF0C.E9A722F6@myself.com> Hello, I tried to build Apache with PyApache. I already have Python 1.5.2 installed (with tkinter). The build dies when linking, complaining that a whole bunch of tk... references can't be resolved. Now, since PyApache probably won't be needing tkinter ;-) is there any simple way to prevent this situation. (I suspect that rebuilding Python without tkinter support might do the trick, but that seems like a long way round). cheers From webmaster at python.org Sun Apr 2 15:22:28 2000 From: webmaster at python.org (Python.Org Webmaster) Date: Sun, 2 Apr 2000 15:22:28 -0400 (EDT) Subject: www.python.org back up Message-ID: <14567.40436.305264.573689@anthem.cnri.reston.va.us> Sorry folks, I'm not sure why www.python.org was down, but I suspect it had something to do with the monthly rotation of log files. I've restarted the web server so everything should be hunky dory again. -Barry From mnaumann at pacbell.net Wed Apr 5 20:22:25 2000 From: mnaumann at pacbell.net (Michael Naumann) Date: Wed, 05 Apr 2000 17:22:25 -0700 Subject: Paid to work in Python? (was: Re: Choice Of Language) References: <8c7tt5$7dl$1@slb3.atl.mindspring.net> Message-ID: <38EBD8C0.86FD484D@pacbell.net> Hmmmmm... It's actually a breeze to work with -- I have no idea what problems you may be having... Aahz Maruch wrote: > In article , > David Ascher wrote: > >Grant Edwards > >> > >> Pointless tanget: Is it just me, or is Google really the last usable > >> search engine? > > > >And it's _all_ due to their use of Python! Cool, eh? =) > > That doesn't explain why Infoseek is no longer particularly usable. > -- > --- Aahz (Copyright 2000 by aahz at netcom.com) > > Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ > Hugs and backrubs -- I break Rule 6 > > "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of > cigarettes, it's dark, and we're wearing sunglasses." "Hit it." From rupole at compaq.net Sun Apr 9 23:34:56 2000 From: rupole at compaq.net (Roger Upole) Date: Mon, 10 Apr 2000 03:34:56 GMT Subject: win32com and Reflection2 References: Message-ID: I had tried that already, but the Reflection2 object did not show up on the list when I ran the makepy utility. I assumed at the time that this meant that this library was not in a format that makepy could map. However, after a look at the docs in makepy, I noticed that it would also take the name of the .TLB file, so I passed it c:\rwin\r2510e.tlb instead of the library name. It worked like a charm ! Conjecture: Couldn't find it by the library name because the RWIN directory is not on the system path ? Now I can go back and replace all those hardcoded integer parms :) If Guido was god, Mark Hammond would be the high saint of win32! (or the devil's advocate, according to the Unix guys ...) Many Thanks, Roger Upole "Mark Hammond" wrote in message news:s8aI4.48$UB.261 at news-server.bigpond.net.au... > You should be able to run "makepy" over the reflection object (makepy will > present a list of objects). You can find "makepy" on the Pythonwin > "tools" menu. > > Once you have done that and created the Reflection object, the constants > should be available in win32com.client.constants > > eg, > > win32com.client.constants.SomeConstantName > > Note that the Reflection constants wont appear until you have created the > reflection object using win32com.client.Dispatch() > > Mark. > > "Roger Upole" wrote in message > news:WE8I4.100257$ra.2387838 at news.easynews.com... > > I'm scripting Reflection2 sessions with win32com.client.Dispatch. > > However, there are some constants (error codes, transmission modes, > > etc) in a typelib that I can't seem to get at from the Dispatch object. > > Anybody know of a way to access these from Python ? > > If not, is there any way to get to them from C++ ? > > I have very little experience with C, but if it is simple I can > > probably blunder my way through it. > > Roger Upole > > > > > > > > From ivanlan at callware.com Wed Apr 5 01:31:31 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 04 Apr 2000 23:31:31 -0600 Subject: APL Characters in Unicode References: Message-ID: <38EACFB3.4C37E8D8@callware.com> Hi All-- "Dennis E. Hamilton" wrote: > [bobbitry] > (This > is like getting lost in a dictionary. What does quincuncial mean anyhow?) > [use monospaced font] . . . . . -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From mmiller3 at iupui.edu Tue Apr 18 16:29:09 2000 From: mmiller3 at iupui.edu (Michael A. Miller) Date: 18 Apr 2000 15:29:09 -0500 Subject: Split References: <38FCC20D.624AB2F6@searchy.net> Message-ID: <87k8hvywyy.fsf@lumen.med.iupui.edu> >>>>> "Penpal" == Penpal International writes: > I've already managed to split a string with this: > split = regsub.split(line,'\s+') [...] > But how can I print only the 5th for example? You can also use the string module to split: >>> import string >>> line = 'This is a test, short and sweet, of split.' >>> string.split(line) ['This', 'is', 'a', 'test,', 'short', 'and', 'sweet,', 'of', 'split.'] >>> string.split(line)[4] 'short' >>> string.split(line,'a test') ['This is ', ', short and sweet, of split.'] From aa8vb at yahoo.com Wed Apr 19 06:47:29 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 19 Apr 2000 06:47:29 -0400 Subject: How to write to printer in Windows? In-Reply-To: <38FC43DF.78A38D5D@tcac.net> References: <38FC43DF.78A38D5D@tcac.net> Message-ID: <20000419064729.A517358@vislab.epa.gov> Albert Wagner: |How can I write(aLine) to a printer in Windows? I tried this: | |from win32pipe import popen |: |self.printer = popen('lpt1' 'w') |: |self.printer.write(aLine) | |but get a general protection fault. Any help will be greatly |appreciated. I see you have a pointer to the win32 printer modules in another reply. The problem with your above code may be something simple though. From my DOS days, I seem to recall that 'lpt1:' was the correct name for the printer device. lpt1 may be trying to write to a file in a directory for which you don't have permission. In a DOS box, try 'copy c:\config.sys lpt1:'. That'll make sure you're printer is attached to that device. If so, you should be able to run your Python program there with (I would think) the same results. -- Randall Hopper aa8vb at yahoo.com From echuck at mindspring.com Mon Apr 24 17:57:48 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Mon, 24 Apr 2000 17:57:48 -0400 Subject: sys.exit Message-ID: <3904C35C.B16BDE75@mindspring.com> The short question: If I catch a SystemExit exception (because of an invocation of sys.exit(code)), how do I examine the argument to sys.exit()? The long story: I have a try..except like so: try: execfile(filename, namespace) except: # handle problems I'd like to treat the case of "sys.exit(0)" as a special case in the exception handler because I'm executing another script. If that script calls sys.exit(0), that's OK. If it throws any other kind of exception, I need to log it and report it. My attempt in the "except:" is this: self._errorOccurred = 1 excInfo = sys.exc_info() if excInfo[0]==SystemExit: data = excInfo[1] if data==0 or data==None: self._errorOccurred = 0 But "_errorOccured" is never set to 0, because 'data' isn't what I expected. Upon printing the "excInfo" tuple I get: (, , ) And the attributes of the SystemExit instance are: ['__doc__', '__init__', '__module__'] I don't know how to get my hands on the exit code. -Chuck From M_Pope at shef.rage.co.uk Tue Apr 11 06:13:42 2000 From: M_Pope at shef.rage.co.uk (Mark Pope) Date: Tue, 11 Apr 2000 11:13:42 +0100 Subject: Solution: Extending built-in language (Win 95) Message-ID: <213CDEBFDDA7D3118081009027E40C5607111D@SHEF-MS1> > Mark Pope wrote: > > I've added xxmodule to the lib and recompiled. Entering: > > a = xx.new() > > just gives a name error on xx. > > > > Have I missed something? > > 1) the Modules/Setup file is used to add modules > to the standard library. > > 2) you forgot to *import* the xx module. Thanks for the help all, On Win95 there is no Modules/Setup file. Instead one needs to manually edit config.sys then recompile all and importing and running works... thanks, m. From M_Pope at shef.rage.co.uk Fri Apr 14 11:09:57 2000 From: M_Pope at shef.rage.co.uk (Mark Pope) Date: Fri, 14 Apr 2000 16:09:57 +0100 Subject: Building Core Python Message-ID: <213CDEBFDDA7D3118081009027E40C56071139@SHEF-MS1> Hi, Does anyone have a list of what all the files in the 'Objects' and 'Modules' directories do? I'm trying to reduce my (Win95) build to be the minimum 'core' python, to reduce Exe size. It's difficult to work out what they all do, and whether it is core, due to a lack of comments at the top of source files. Thanks, mark. From effbot at telia.com Tue Apr 11 03:02:05 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 07:02:05 GMT Subject: Regular Expression Help for Python Newbie. References: <005f01bfa2cf$b99b0ea0$f0c809c0@lslp7o.lsl.co.uk> Message-ID: Tony J Ibbs wrote: > Fredrik Lundh replied: > >
's are optional -- if the browser stumbles upon
> > in a context, it should insert 's all by itself. > > Well, no... you're right -- but only in theory ;-) > Of course, it's entirely possible to write a browser (or other HTML reader) > that can cope with missing 's *if* the 's are present. it's easier than that, in fact -- according to the data model, a
contains a which contains one or more 's, which in turn contains
's and/or 's. so when the browser stumbles upon a followed by a
, it can easily figure the rest out itself, based on the DTD. > And obviously that's what some browsers do. This way also lies > madness. some? I suspect 99.99% of browsers used for serious surfing do things like this -- and *much* more... (if you want to see some real madness, go browse the original navigator sources ;-) > I always find it strange that otherwise intelligent people don't want > their compilers to work like this, but do want their browsers to. well, if the early web had been restricted to people who can read DTD's and map cryptic error messages to typos in their sources, I doubt we'd have the rich web we have today... nsgmls:mypage.htm:38:3:E: start tag for "TR" omitted, but its declaration does not permit this huh? there's no frigging TR in there? and it looks good in my browser, so who cares about the "declaration"... (the real design mistake is of course to do the fixes in the browser, instead of doing them in the authoring system or the server, but that's another story). From johann at physics.berkeley.edu Thu Apr 6 16:17:24 2000 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 06 Apr 2000 13:17:24 -0700 Subject: Beginning to be disapointed References: Message-ID: [Yes, I know. I'm fouling up the reference chain. But there's weirdness afoot, and I can't do any better.] Hugues Demers writes: >> 2. how are you reading them in? > I use a module written by M. Miller called TableIO to read my data because > it's fast. It read text file into Numeric array Aha. This might be it. IIRC, some of the innards of the reference counting changed at some point in the NumPy distribution. If you're using a different version of NumPy than TableIO was designed for, there might be a memory allocation problem. Double-check that, since (to me) the errors you get sound like what happens to me when I try to free something that I shouldn't. It runs for a bit, after the mistake, then dies mysteriously. I bet that's it. I bet TableIO fails to set a bit like OWN_DATA or some such on the inputted arrays, and then something bad happens. I don't know for sure, though. As an experiment, try using Konrad Hinsen's ArrayIO module to read the arrays instead. That's pure python, so it will be a bit slow, but it might help you track down the problem. (It's what I use, and I don't find it to be too terribly slow.) Good luck, --Johann -- Johann Hibschman johann at physics.berkeley.edu From effbot at telia.com Tue Apr 11 10:30:18 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 14:30:18 GMT Subject: Huh? func_defaults, default values in function calls References: <8cv5qj$35p$1@zinc.intern.netconnect.no> Message-ID: <_FGI4.1193$Za1.20497@newsc.telia.net> Roger Baklund wrote: > I don't get it. Why isn't the dictionary reset to {'x':'a'} when i call > the function the last time? > > >>> a.func_defaults > ('', '', {'x': 'a', 'y': 'c'}) > > Why is not {} the default for the z parameter? read the fine manual: http://www.python.org/doc/current/ref/function.html Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that that same "pre-computed" value is used for each call. (reading the entire page might help you understand why this is by design, not by accident) From gmcm at hypernet.com Wed Apr 26 08:29:03 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 26 Apr 2000 08:29:03 -0400 Subject: Metaclasses? In-Reply-To: <200004261201.IAA05678@zippy.init.com> Message-ID: <1255370352-61030244@hypernet.com> Donald Beaudry wrote: > quinn at hedono.ugcs.caltech.edu (Quinn Dunkan) wrote, > > Anyway, even if you could figure out the ambiguity problem, I > > don't think metaclasses would help you, bytecodehacks might. > > *If* bytecodehacks could help, metaclasses could be used to make > calling them neat and clean. The idea is that during class > instantiation the metaclass would, using bytecodehacks, rewrite > all of the class's methods. This might confuse the poor guy who > comes along and tries to derive a new class from one of these > 'self less'. And then we could argue about whether being 'self less' makes them "altrustic" [cf long-lived, contentless splinter of the Economics of Open Source thread]. - Gordon From snorri at ensim.com Sun Apr 2 03:11:54 2000 From: snorri at ensim.com (Snorri Gylfason) Date: Sat, 01 Apr 2000 23:11:54 -0800 Subject: Python or OS forking/threading problem? References: <001301bf9616$c2a4f260$752d153f@tim> <20000325131427.A13074@acs.ucalgary.ca> <87k8iqu2mt.fsf@deneb.cygnus.argh.org> Message-ID: <38E6F2BA.E66CAC90@ensim.com> Thanks everybody for looking into this problem. I was working with Naris on this (Naris posted the original question). I have a few comments to your discussion that might be helpful. 1) According to Posix when doing fork inside a thread only that thread is cloned in the new process. a) Thats exactly why in the code below none of the threads are cloned (only the main thread). b) This is known problem for the child process. If the cloned thread needs to acquire a lock that at the time of the fork some other thread had, it will deadlock (since in the child process there is no thread to release that lock). pthread_atfork is there to help the child process to handle this problem. 2) The strange thing in our case is that it is the parent thread that starts behaving badly. And as I will soon point out, it depends on what the child process is doing. 3) We ran into this problem because we were using popen in a thread. Popen is basically only doing fork and exec plus some filehandling stuff. The popen module is implemented in python. I replaced that module with one in C and the problem went away (so I have a workaround:) I did some more experiments and it seems that if the child process leaves an atomic operation (enters Python again) our problem may occur. I don't know the implementation of Python but everything I have seen indicates that the child process is still sharing some lock with the parent process. Hope this will help Snorri Florian Weimer wrote: > > "Neil Schemenauer" writes: > > > Not for my problem on Linux. My code didn't call sleep(). It > > may be a bug with the pthreads in libc6 for Linux. I can't > > reproduce it with C code though. > > I think I can explain what happens. Look at the following code: > > #include > #include > > #include > #include > > void * > thread(void * v) > { > for (;;) { > char buf[40]; > int len = sprintf(buf, "%lu\n", (unsigned long) getpid()); > write(1, buf, len); > sleep(1); > } > } > > main() > { > pthread_t t; > pthread_create (&t, NULL, &thread, NULL); > fork(); > sleep(3600); > } > > This clearly shows that the thread is not duplicated on fork(). > > Now look at the Python source code: > > static PyObject * > posix_fork(self, args) > PyObject *self; > PyObject *args; > { > int pid; > if (!PyArg_ParseTuple(args, ":fork")) > return NULL; > pid = fork(); > if (pid == -1) > return posix_error(); > PyOS_AfterFork(); > return PyInt_FromLong((long)pid); > } > > void > PyOS_AfterFork() > { > #ifdef WITH_THREAD > main_thread = PyThread_get_thread_ident(); > main_pid = getpid(); > #endif > } > > long PyThread_get_thread_ident _P0() > { > volatile pthread_t threadid; > if (!initialized) > PyThread_init_thread(); > /* Jump through some hoops for Alpha OSF/1 */ > threadid = pthread_self(); > return (long) *(long *) &threadid; > } > > In the child process, all threads have disappeared, but the code doesn't > seem to be prepared to handle this. From yawyi at gmx.de Thu Apr 27 09:04:43 2000 From: yawyi at gmx.de (Johannes Stezenbach) Date: Thu, 27 Apr 2000 15:04:43 +0200 Subject: Best database to use with Python References: <3906ea27.698463777@news.online.no> <8e9334$qba$1@news.tht.net> Message-ID: <39084a70$0$22983@personalnews.de.uu.net> D'Arcy J.M. Cain wrote: >?5?HH575-UAZWKVVP-7H2H48V3 wrote: >> What database-system is easiest, fastest etc. to use with Python? I`ve >> looked at MySQL, but it seems a little overkill just to get a little >> more functionality than Berkley DB-functionality. What about Postgres? >> mSQL? > >> Postgres comes with my Linux distro and seem smaller than MySQL. How > >Actually I think you will find PostgreSQL larger than MySQL. > >> does it compare to MySQL when it comes to administration and speed, >> scalability etc. ? > >I don't use MySQL as I find that PostgreSQL has more features and works >fast enough for my needs. Like most RDBMSs in its class the expensive >part is updates and inserts but the retrievals are quite snappy. The >one time I tried to administer a MySQL system I was a little horrified. >PostgreSQL was easier to understand. That could just be me, of course. The one fundamential difference between MySQL and PostgreSQL (apart from the license) is that PostgreSQL has a focus on preserving data integrity and dealing with concurrency issues (using transactions, triggers, etc.) while MySQL omits these features in favor of raw speed. The MySQL folks claim to be 10 times faster for UPDATEs. Johannes From nobody at nowhere.nohow Sat Apr 8 12:16:48 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Sat, 08 Apr 2000 16:16:48 GMT Subject: read _and_ write from/to commandline program References: <8cnjnt$k7o$1@nnrp1.deja.com> Message-ID: On Sat, 08 Apr 2000 15:37:34 GMT, lamzak8642 at my-deja.com wrote: >Is it possible to read from _and_ write to a commandline program (Linux >+ Python)? Apparantly I can't do this with os.popen() because it is >unidirectional. yes. The popen2 module will give you file objects for the child process stdin, stdout, and stderr. -- Grant Edwards grante Yow! Mr and Mrs PED, can at I borrow 26.7 visi.com From m.faassen at vet.uu.nl Wed Apr 12 06:21:50 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 12 Apr 2000 10:21:50 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> <8d0pcq$7ti$1@nnrp1.deja.com> Message-ID: <8d1inu$nsq$1@newshost.accu.uu.nl> tom__98 at my-deja.com wrote: > In article <200004102111.HAA03380 at envy.fulcrum.com.au>, > Richard.Jones at fulcrum.com.au wrote: >> Tom you little troll-meister. Half those arguments >> you cite are bollocks if you _really_ knew and >> "greatly prefer" Python. Try again. > Maybe you can contribute more constructively: I'm not him, but I'll be constructive. :) > -- How can I browse the Python documentation without firing > up a web browser? A text mode web browser can be useful for this. I've found w3m on Linux to be very nice. I can just do: w3m file:///usr/doc/python-docs-1.5.2/html/lib/modindex.html And the documentation page is there instantly. > How do I get information on a single Python > function or class quickly? The docstring situation in the library is pretty good: >>> import string >>> dir(string) >>> print string.split.__doc__ >>> import BaseHTTPServer >>> print BaseHTTPServer.SocketServer.__doc__ > Is there any equivalent of > "perldoc -f split" or "perldoc Net::POP3"? What do you > do in that situation? Perhaps there are more easy tools to query docstrings; I'm sure there should be done out there. Since I'm a web developer I usually have a browser going somewhere, so I use the HTML documentation. :) > -- Is there a Python equivalent of CPAN and the Perl CPAN > module? The closest I know of is Parnassus. But Parnassus > is merely a collection of links, not an archive, and it > doesn't have any facilities (AFAIK) for automatic installation. Parnassus is way cool, but it can't do this yet. There have been talks in the past between the Distutils people and the Parnassus folks (um, individual). Once distutils matures it should provide for automatic installation, and it'll probably be integrated with Parnassus. > -- Several extensions I have wanted to install have required access > to the full Python source tree, not just the header files and > the library. Is that going to change? Otherwise, how can > I install Python extensions that want access to the source > tree on, say, a standard RedHat system? Having the standard > RPM-based installation in parallel with a /usr/local installation > from source is confusing, and removing the RPM-based installation > risks breaking things. Hm, haven't seen these yet myself. That does sound tricky. We're just all rooting for distutils to save the day. :) Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From darrell at dorb.com Sun Apr 2 15:30:35 2000 From: darrell at dorb.com (Darrell) Date: Sun, 2 Apr 2000 12:30:35 -0700 Subject: Debugging confusion -- too many stacks! References: <000a01bf9c6b$3f80c2a0$752d153f@tim> <38E739A1.45F4B199@tismer.com> Message-ID: <030301bf9cd9$eb6786d0$6401a8c0@dorb> From: "Christian Tismer" > The following watches are always active when I'm debuging: > (are there similar ways to do this with PDB?) > > (char*)(f->f_code->co_name)+20 # current function name > (char*)(f->f_code->co_filename)+20 # current file name > f->f_lineno # line number > > In order to see which frame is calling you, do the same, but > replace "f" by "f->f_back". pdb works pretty good. I use it all the time. You can get the call stack or what ever you want to look at. > > What I really wished were a way to extend a given debugger > with your own support code, to make PyObjects more visible. > On a really bad day you could use both pdb and a 'C' level debugger. If you have a lot of bad days, I could imagine there must be ways to enhance the interplay of these two debuggers. --Darrell From dan at cgsoftware.com Tue Apr 4 23:38:11 2000 From: dan at cgsoftware.com (Daniel Berlin+list.python) Date: 04 Apr 2000 23:38:11 -0400 Subject: What is python's language level? In-Reply-To: Ivan Van Laningham's message of "Tue, 04 Apr 2000 19:54:28 -0600" References: <38EA1B8F.A797A130@lmco.com> <38E9DDD3.3313FF6@bioreason.com> <38EA9CD4.3473B910@callware.com> Message-ID: >>>>> "Ivan" == Ivan Van Laningham writes: Ivan> It's most certainly Turing-complete. It ain't what you call Ivan> convenient or readable, but once you understand what you're Ivan> doing you can write anything you want in it. Including Ivan> calculators and prime-number sieves. Reminds me of a neat little raytracer written in postscript someone posted many years ago. I was just playing with it a few minutes ago. About 7k, raytraces 5 spheres by default. you have to set the max ray depth to about 3 or 4 or it'll take forever. Ghostscript can use it to raytrace a 128x128 image in about 70 seconds. sphere col get aload vec copy /VU exch store'ly y'rs, Dan From hnowak at cuci.nl Sun Apr 30 15:21:40 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Sun, 30 Apr 2000 21:21:40 +0200 Subject: Python & clipboard Message-ID: <200004301922.e3UJMtG25451@hera.cuci.nl> Howdy y'all, I am trying to find a function which gets clipboard data (on Win98). I have been looking at the win32clipboard module, but it seems that the best I can get is a handle to an object containing clipboard data. I also looked into Tkinter, and I found clipboard_append and clipboard_clear methods, but no such thing as clipboard_get. Does anyone know how to do this? Blessed be, --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://www.hvision.nl/~ivnowa/newsite/ Python questions? See http://tor.dhs.org/~zephyrfalcon/snippets You call me a masterless man. You are wrong. I am my own master. From fredrik at pythonware.com Wed Apr 5 06:40:49 2000 From: fredrik at pythonware.com (fredrik at pythonware.com) Date: Wed, 05 Apr 2000 10:40:49 GMT Subject: Starving for an Advanced Python Book References: <20000405044154.10369.qmail@web2103.mail.yahoo.com> Message-ID: <8cf57f$e96$1@nnrp1.deja.com> "lewst" wrote: > Those remarks are misleading and should probably be removed. I won't > disclose my source, but I'll you bet dollars to donuts that the 2nd > edition of PP will be out this summer -- much closer to the release of > Python 1.6 than P3K. heh. you really are Tim O'Reilly, aren't you? (first you dis my eBook using the usual publisher arguments, and now you have inside information on when PP2E will be out ;-) Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Mon Apr 17 11:26:39 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 17 Apr 2000 16:26:39 +0100 Subject: Another question References: Message-ID: "Jeff Massung" writes: > Why would I not do "from import *" with every module I load? Because being able to predict what name lookups resolve to is more important to some people than micro-optimisation? 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 rcc at nospamthanks_jennic.com Thu Apr 13 13:25:28 2000 From: rcc at nospamthanks_jennic.com (Robert Cragie) Date: Thu, 13 Apr 2000 17:25:28 GMT Subject: List mapping? References: Message-ID: > Howcome you use reduce at all? > > Works fine with just doing > > tuplist = map(lambda x: (mylist[x], mylist[x+1]), range(0, len(mylist), 2)) Yep, that's neater. My excuse is that I've only been learning Python for a couple of weeks... Robert Cragie From gmcm at hypernet.com Tue Apr 4 21:48:12 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 4 Apr 2000 21:48:12 -0400 Subject: Two questions In-Reply-To: <38EA6E87.40EDB542@callware.com> Message-ID: <1257223201-7158461@hypernet.com> Ivan Van Laningham wrote: > > Bjorn Pettersen wrote: > > > [bobbit] > > > > If you want to package up your program into an exe and execute it, > > Installer from Gordon's starship pages can do this > > (http://starship.python.net/crew/gmcm/distribute.html). It's actually > > _much_ easier than it looks ;-) > > It's not widely known, but it blows chunks if you have Mayan glyphs on your machine. That's a feature. > This sounds like the right course to me. I'd like to force > customers to install Python on their machines, but my boss doesn't think > that's all that great an idea (dunno why). My only concern is > size--just how big are the executables produced by Gordon's > flummery^H^H^H^H^H^H^H^Hmagic? If you get creative (about a dozen lines of code) you can install a fully functional Python in 2 files. You can put Python and IDLE on a floppy with room left over. [mxODBC] > Well, that's two recommendations. And judging from previous Marc-Andre > packages I've used, it'll be a snap. At the moment, you'll have a bit of trouble with my stuff and the fact that Marc-Andre puts his .pyds inside the packages. There are workarounds, and I have a patch from Thomas Heller which I haven't finished reconciling to some of my other changes. > Steve Holden, in another post, said that Tkinter should work fine along > with mxODBC. That's a relief, but does anyone have direct personal > experience with doing so? > > -ly y'rs, > Ivan Are you describing your hairline, your nervous twitch, or the effect of the latter on your former? - Gordon From tim_one at email.msn.com Mon Apr 3 01:30:25 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 3 Apr 2000 01:30:25 -0400 Subject: Who is this years winner? In-Reply-To: Message-ID: <000101bf9d2d$b724e1c0$e02d153f@tim> [Peter Funk, seeking justice] > Today on April 2nd I began to wonder whether the PSA Steering > Committee has already decided on the winner of the third Pythonic > Award. Yes, they have. It's ME!!! And nobody can prove it's not. > Fortunately www.python.org is back online now but unfortunately > the page > > seems to show up a file from two year old backup, and so does the > Shrine of the of the winner of the first Python Award at > Yes too, that's from the First Pythonic Award. Which remains the most recent. On 1-Apr-99, I unilaterally changed MY title to The Only Living Pythonic Award Winner, and announced this would be MY honorific for life -- by any means necessary. Since then, potential winners other than ME have, umm, gracefully withdrawn. I'm sure it's just coincidence that the PSA Steering Committee has never been heard from again. > May I kindly ask some member of the famous Steering Committee to publish > this years decision here? Sure! Ask all you like . don't-ever-mess-with-an-insecure-bot-ly y'rs - tim From gidi_avrahami at my-deja.com Mon Apr 3 11:46:24 2000 From: gidi_avrahami at my-deja.com (gidi_avrahami at my-deja.com) Date: Mon, 03 Apr 2000 15:46:24 GMT Subject: errors in _del__ during python shutdown Message-ID: <8caec9$6v9$1@nnrp1.deja.com> I have a large Python system with wrappers to some SWIG'ed C code. Some objects need to do some cleanup in their __del__ , e.g.: from myBasics import Object import myCToolkit kit = myCToolkit class SomeObject(Object): def __init__(self, *args): Object.__init__(self, *args) self._vec = kit.float_array(6) def __del__(self): kit.float_destroy(self._vec) Object.__del__(self) My problem is that when I shut python down (by typing EOF to the prompt), the SomeObject.__del__ method gets called in a funny state, where 'kit' and even 'Object' are None! It would appear that Python is "winding down" and starts killing off modules, even though some objects that refer to these modules are still alive. Any ideas? Sent via Deja.com http://www.deja.com/ Before you buy. From lbear11 at my-deja.com Sun Apr 16 22:37:44 2000 From: lbear11 at my-deja.com (lbear11 at my-deja.com) Date: Mon, 17 Apr 2000 02:37:44 GMT Subject: Tkinter Canvas -- help? Message-ID: <8ddtdm$b2s$1@nnrp1.deja.com> I'm just starting to learn Python/tkinter, and I have found that there is virtually _no_ documentation for the tkinter canvas. Could anybody help? I'm specifically looking for stuff like creating an image by a grid in canvas on "mouseDown", and how to read the items in the canvas, and write them to a text file, in their proper positions. I would _really_ appreciate it if anybody could help me with this. P.S. The only tkinter canvas documentation that I have is the "Introduction to Tkinter" from pythonware.com Thanks, jkior Sent via Deja.com http://www.deja.com/ Before you buy. From cut_me_out at hotmail.com Wed Apr 19 08:30:23 2000 From: cut_me_out at hotmail.com (Alex) Date: 19 Apr 2000 08:30:23 -0400 Subject: Very Horrible Question About Goto's References: <6325E90C8B6ED21189080001FA7E2ADA0D4051@IBA1> Message-ID: Probably not, is my guess. It would help if you posted some examples of your language, though. Alex. From claird at starbase.neosoft.com Sat Apr 22 00:43:48 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 21 Apr 2000 23:43:48 -0500 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> Message-ID: In article , Neel Krishnaswami wrote: . . . >One of the interesting things about this thread is that it has given >me a bit of insight into what economics looks like to people who >haven't internalized its assumptions. I'm afraid that I'm tainted . . . >the effort. Most people don't even bother digging up evidence to >support their prejudices, let alone try to come to a careful decision. >And searching the Census and BLS websites is *easier* than hacking on >the Python core. My wife says it reinforces her prejudices about economists (or "dart-throwers", as she calls us) that we would think the "Census and BLS websites" have anything to do with "a careful decision." . . . >snobbery. I read an article last year where two economists developed a >model predicting that a disproportionate fraction of groundbreaking >academic papers should be wrong. Basically, they assumed that since >funding stems from status, and status stems from writing ground >breaking papers, there's an incentive to draw flashy, counterintuitive >conclusions rather than confirming prior work. (They did observe that >their work implied their paper was probably wrong, since it was >advancing a flashy, counterintuitive proposition. :) > > >Neel This has been part of academic folklore for a long, LONG time--oh!; that means I should describe the "flashy, counterintuitive, but already widely-known- without-being-well-marketed" category. Wrestling this back toward the neighborhood of Python looks like a challenge; all I can think to say is that economics has no monopoly on generation of a comfortable explanation for open-source community process. Anthropology, sociology, rhetoric, theology, architecture, ... all recognize familiar elements in what we do. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From invalid.address at 127.0.0.1 Wed Apr 19 14:31:52 2000 From: invalid.address at 127.0.0.1 (David) Date: Wed, 19 Apr 2000 18:31:52 GMT Subject: EricH-Copyright Messages References: <38fc9694@wwwproxy3.westgroup.com> <38FCA69D.85CC27DA@heathers.stdio.com> Message-ID: <38fdfa72.42533156@news.telus.net> If an ISP copyrights postings that its users make, then isn't it also completely liable for those postings? That seems awful dangerous. Also, is it even possible for them to copyright one's own postings? AFAIK, you possess copyright the instance you write something, and I find it difficult to believe that ownership can be implicitly and irrevocably transfered. Care to enlighten me? On Tue, 18 Apr 2000 14:17:01 -0400, "Eric H." wrote: Parts of this message, including the email address, ? 2000-Eric Haddix. Use implies agreement to the terms and conditions made available on my homepage. Keep the Internet free, refuse to support the providers that copyright YOUR email and messages. All rights reserved. U.C.C. 1-207 visit my homepage @ http://www.bounce.to/EyesCremeProductions From effbot at telia.com Tue Apr 11 15:06:07 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 11 Apr 2000 19:06:07 GMT Subject: AF_INET error References: <8cvero$g8k$1@porthos.nl.uu.net> <8cvnve$l40$1@porthos.nl.uu.net> Message-ID: Soundwave wrote: > import socket > #create an INET, STREAMing socket > s = socket.socket( > socket.AF_INET, socket.SOCK_STREAM) > #now connect to the web server on port 80 > # - the normal http port > s.connect("www.mcmillan-inc.com", 80) > > when I run this code, I get the following output > > Traceback (innermost last): > File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", line 131, in > run_module_event > execfile(filename, mod.__dict__) > File "C:/Program Files/Python/socket.py", line 3, in ? > s = socket.socket( > AttributeError: AF_INET hmm. this example works just fine on my windows 95 box, running it from the command line prompt. maybe IDLE is interfering with your code in some strange way? here are a few things you might wish to try: -- restart IDLE, and try running the script again -- try running it from an MS-DOS window -- try adding the following two statements just after the import statement: print socket print dir(socket) this should print something like: >>> print dir(socket) ['AF_INET', 'INADDR_ALLHOSTS_GROUP', 'INADDR_ANY', ...lots of other stuff... 'htons', 'ntohl', 'ntohs', 'socket'] From PClaerhout at CREO.BE Tue Apr 11 05:36:09 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Tue, 11 Apr 2000 11:36:09 +0200 Subject: Getting an overview if all available driveletters on NT Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7294@MSGEURO1> Hello, is there a module in Python, which can list all available driveletters, together with their label. I'm using Windows NT? I already thought of iterating over all possible driveletters, and see if the path exists or not, but I also want to separate the network volumes from the other volumes. Any ideas? Kind regards. Pieter [ Pieter Claerhout :: CreoScitex Response Centre :: Applications support ] [ Pieter_Claerhout at creoscitex.com :: http://www.creoscitex.com/ ] [ CreoScitex Europe :: Excelsiorlaan 21 :: 1930 Zaventem :: Belgium ] From herzog at online.de Mon Apr 17 21:19:01 2000 From: herzog at online.de (Bernhard Herzog) Date: 18 Apr 2000 03:19:01 +0200 Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> <200004172120.RAA11102@zippy.init.com> Message-ID: Michael Hudson writes: > For that last dreg of performance you might try: > > import random > def do_it(randint=random.randint,xrange=xrange): > r = [0,] * 100000 > for i in xrange(100000): > r[i] = randint(1,10) > do_it() > > But really, this is getting silly; if performance is this much of an > obsession you aren't going to have that much fun with Python. A much better optimization would be to use choice with a constant list instead of randint. The implementation of choice is much more efficient that randints: def do_it(length): from random import choice r = [0,] * length ints = range(1, 11) for i in xrange(length): r[i] = choice(ints) even better would be to inline choice or a custom version of randint. Of course, this takes us away from the question originally asked... -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From mwh21 at cam.ac.uk Mon Apr 3 12:25:47 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 03 Apr 2000 17:25:47 +0100 Subject: errors in _del__ during python shutdown References: <8caec9$6v9$1@nnrp1.deja.com> Message-ID: gidi_avrahami at my-deja.com writes: > I have a large Python system with wrappers to some SWIG'ed C code. > Some objects need to do some cleanup in their __del__ , e.g.: > > from myBasics import Object > import myCToolkit > kit = myCToolkit > > class SomeObject(Object): > def __init__(self, *args): > Object.__init__(self, *args) > self._vec = kit.float_array(6) > def __del__(self): > kit.float_destroy(self._vec) > Object.__del__(self) > > My problem is that when I shut python down (by typing EOF to the prompt), the > SomeObject.__del__ method gets called in a funny state, where 'kit' and even > 'Object' are None! It would appear that Python is "winding down" and starts > killing off modules, even though some objects that refer to these modules > are still alive. > > Any ideas? Do this: def __del__(self,kit=kit,Object=Object): kit.float_destroy(self._vec) Object.__del__(self) must be a FAQ, but I can't be bothered to track the entry down just now, sorry. Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From rupole at compaq.net Wed Apr 19 19:36:41 2000 From: rupole at compaq.net (Roger Upole) Date: Wed, 19 Apr 2000 23:36:41 GMT Subject: Where do I send a contribution for the Starship recovery ? Message-ID: I personally would consider it money well spent. (unlike most of the other things I spend money on) Roger Upole From ns56645 at swt.edu Sat Apr 29 13:24:00 2000 From: ns56645 at swt.edu (ns56645) Date: Sat, 29 Apr 2000 12:24:00 -0500 Subject: here is the emphasization of teh error Message-ID: <390B1AB0.330C904B@swt.edu> ############## List of other canvases in frame 1 ########################################### # Make a list of days of the week def drawCanvas(self): CanvasNameList=['MonCanvas', 'TueCanvas', 'WedCanvas', 'ThuCanvas', 'FriCanvas'] xpos=68 ypos=15 xdiff=54 for canvas in CanvasNameList: self.canvas=Pmw.ScrolledCanvas(frame1, borderframe = 1, labelpos = 'wn', usehullsize = 5, hull_width = 800, hull_height = 80, ) i=1 self.canvas.grid(frame1,row=1, column=i) i=i+1 self.canvas.resizescrollregion() self.canvas.configure(hscrollmode = 'dynamic') self.canvas.configure(vscrollmode = 'static') ######################################################################################### -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwiserREMOVEthis at mindspring.com Tue Apr 11 13:48:11 2000 From: rwiserREMOVEthis at mindspring.com (Randy Wiser) Date: Tue, 11 Apr 2000 17:48:11 GMT Subject: Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20? Message-ID: <38f363e5.2931715373@news> (Apologies if this is a duplicate, it's been awhile since I've posted anything :-) I've written a small python program that spawns one child process from its main thread, and then creates a second thread. The sole purpose of the second thread (at this point) is to call os.waitpid(processID, 0) to wait for the child that the main thread created. This works fine under Solaris when I call os.waitpid() from the second thread. But, under Linux 2.2.12-20 I get the following OSError exception: [Errno 10] No child processes However, if (under Linux still) I call waitpid() from the main thread (as a test), the call does indeed wait until the child process terminates. After scouring some of the Linux newsgroups, I've gathered that threads spawned under Linux may have SIGCHLD signals (and other signals) blocked, and that this _may_ be the reason I get the error, even though the processID I pass is for a valid process. Unfortunately there seems to be no easy way to set the signal mask for the second thread. Has anyone else run into this situation, and if so can you advise how you solved it? Thanks in advance, - Randy From scherbi at bam.com Mon Apr 17 11:56:43 2000 From: scherbi at bam.com (Bill Scherer) Date: Mon, 17 Apr 2000 11:56:43 -0400 Subject: How do I make a constant global variable in Python Please References: Message-ID: <38FB343B.90F0133E@bam.com> declare the variable as global inside the function you wish to use the global variable, else you just create a new local variable of the same name. eg: foo = 1 def spam(): #use the global foo global foo ... def eggs(): #this function has it's own foo foo = 2 ... OK? -Bill cmfinlay at magnet.com.au wrote: > How do I make a constant global variable in Python Please. > or just a constant. > or just a global. > > I bought a Python Book. however I can't find this info in it. > > Please e-mail me at cmfinlay at magnet.com.au > -- > http://www.python.org/mailman/listinfo/python-list From gmcm at hypernet.com Fri Apr 7 14:05:44 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 7 Apr 2000 14:05:44 -0400 Subject: Embedding Python: How To Hardwire Module Search Path In-Reply-To: <38EDDB40.FC715534@gmx.net> Message-ID: <1256991739-21081117@hypernet.com> Robert Kiendl wrote: > > I've embedded python into a C++ - windows app by a > PyImport_AppendInittab() + Py_Initialize() method. > > Py_Initialize() calculates a module search path from the > windows-registry settings. > > I want to prevent Python from doing that and want to hardwire the search > path to a app. relative path ("/pythonmod") which points to a > minimal python bunch to avoid the need for installing python. > > Does anybody know what to do prior to Py_Initialize(). Or am I > completely wrong? > PySys_SetPath() crashes when called before Py_Initialize(). I suggest you just rewrite getpath.c to do what you want. It runs during Py_Initialize. Otherwise, you can undo what getpath.c does after Py_Initialize, but there's a hole there. - Gordon From emile at fenx.com Thu Apr 13 08:53:56 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 13 Apr 2000 05:53:56 -0700 Subject: 1st non-trivial program - gentle criticism requested References: <1e90r16.1sd2ts41e7ur6kN@gershwin.bio.ic.ac.uk> Message-ID: <005701bfa547$561d8720$01ffffc0@worldnet.att.net> Paul, Just a few observations I have along the lines of 'oh!, you mean this' as I read your code. >>> a = [0,0,0,0,0,0] >>> for i in xrange(10000): j = int(whrandom.choice('012345')) a[j]=a[j]+1 >>> print max(a) 1719 >>> a.index(max(a)) 3 >>> HTH, Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Paul-Michael Agapow Newsgroups: comp.lang.python To: Sent: Thursday, April 13, 2000 1:10 AM Subject: 1st non-trivial program - gentle criticism requested > > Hi y'all, > > I'm experimenting with Python for a number of purposes (an embedded > language for simulations, a tool for exploring experimental data, a good > first programming language) and so I've cobbled together my first > non-trivial program. With some trepidation, I post it here in the hopes > that experts will be able to coach me in "The Python Way". I realise it > looks like C++ (my usual langauge), but criticisms of style would be > useful too. > > Basically, it's a recreation of the "Methinks it is a weasel" simulation > detailed by Richard Dawkins in "The Blind Watchmaker". A population of > strings is compared vs. a target string and the "fittest" (the one that > most resembles the target) is used to form the next generation, with a > small chance. So it's a simple genetic algorithm. > > thanks > > p-m > > > --- program follows From gmcm at hypernet.com Fri Apr 21 17:05:37 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 21 Apr 2000 17:05:37 -0400 Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) In-Reply-To: <8dqa6o$pjg$4@newshost.accu.uu.nl> Message-ID: <1255771354-36910521@hypernet.com> Martijn Faassen wrote: > .... Also, since the PSU has access to > Guido's time machine and didn't prevent this, the PSU must be in on this. > Perhaps they're testing those samples of whitespace-eating nanoviruses that > they got from that UFO crash near Roswell back in the 50s. Oh you silly boy. They're not alien. They simply used the time machine to bring back samples from the future. if-i-told-you-how-i-knew-i'd-have-to-kill-you-ly y'rs - Gordon From mrnatch at gateway.net Tue Apr 18 06:00:39 2000 From: mrnatch at gateway.net (mrnatch) Date: Tue, 18 Apr 2000 03:00:39 -0700 Subject: gaming and python Message-ID: <000c01bfa91c$f421d6a0$0f8d0b3f@oemcomputer> I told a friend of mine that I am learning to program using Python (I chose Python as my first language on the advice of a Llama) and he asked me an interesting question: Can Python be used for programming video games? And does it work with Windows API? Just curious. Thanks, Josh (And friend Tony) -------------- next part -------------- An HTML attachment was scrubbed... URL: From pecora at anvil.nrl.navy.mil Sun Apr 30 10:17:30 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Sun, 30 Apr 2000 14:17:30 GMT Subject: Reading in strings -> numbers ?? References: <390A2D23.7029E557@fenx.com> Message-ID: <300420001017316294%pecora@anvil.nrl.navy.mil> In article <390A2D23.7029E557 at fenx.com>, wrote: > If you're trying to put the info on disk to read it > in again later, look at eval(repr()), eg: > > >>> a,b,c = eval(repr((1.2, -3.5, 10))) > >>> a,b,c > (1.2, -3.5, 10) Problem is I'm often reading in data generated by another program or another person, e.g. ANSII or binary float values in "table form". From mwh21 at cam.ac.uk Tue Apr 4 02:56:59 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 04 Apr 2000 07:56:59 +0100 Subject: Why should I switch to Python? References: <000701bf9c5a$b806b420$752d153f@tim> Message-ID: warlock at eskimo.com (Jim Richardson) writes: > Out of curiousity, how does one (mathematically) prove that? > (if this turns out to be one of those 12' blackboards full of greek > letters and funny squiggles, Ok, I cry uncle...) It's not all that hard. Write the prime numbers as p1,p2,p3,etc. Suppose that this series stops at pn. Then let P=p1*p2*...*pn+1. This number is not a multiple of any of the pm, so either it is prime, or it has a prime factor that is not in the list p1,p2,...,pn. Either way, pn cannot have been the highest prime number. It's also possible to show that if a and n have no common factor, then there are an infinte number of primes in the artihmetic progression a+dn as d=0,1,2,3,4,..., but the proof is, umm, somewhat harder (ie. I don't know it; I think it involves slinging Riemann zeta functions). Cheers, M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From alwagner at tcac.net Wed Apr 12 11:13:27 2000 From: alwagner at tcac.net (Albert Wagner) Date: Wed, 12 Apr 2000 10:13:27 -0500 Subject: confused about path Message-ID: <38F49297.274ABBAE@tcac.net> Assuming I am set up correctly, shouldn't I be able to invoke idle like this: $ python idle.py from any directory? My setup: PYTHONPATH=.:/usr/local/lib/python1.5:/usr/local/lib/python1.5/site-packages In /usr/local/lib/python1.5/site-packages the file idle.pth which contains 1 line: idle-0.5 In /usr/local/lib/python1.5/site-packages/idle-0.5/idle.py In fact, I can only start idle like this: $ cd /usr/local/lib/python1.5/site-packages/idle-0.5 $ python idle.py OR $ python /usr/local/lib/python1.5/site-packages/idle-0.5/idle.py OR interactively $ python >>>import idle What am I missing? -- Small is Beautiful From karab at stsci.edu Tue Apr 18 15:49:56 2000 From: karab at stsci.edu (Kia Arab) Date: Tue, 18 Apr 2000 19:49:56 GMT Subject: can someone tell me about... Message-ID: <38FCBB16.BF50EB03@stsci.edu> variable names that start an underscore "_". Interactively, python will recognize a variable name that begins with one underscore (_myVar). The variable naming rules even say that is acceptable. However, when I try to use it in a module, it bombs. What's the deal? From mcg at halcyon.com Thu Apr 6 16:46:06 2000 From: mcg at halcyon.com (Michael C. Gilbert) Date: Thu, 6 Apr 2000 13:46:06 -0700 Subject: Seattle area scripter needed Message-ID: We're offering both stock options AND social change. I work for a company developing ASP services for nonprofit organizations. I'm looking for a talented web application scripter to join our team. Feel free to check out the company and its current offerings at our web site: http://www.socialecology.com Send email ASAP to mailto:jobs at socialecology.com if you are interested! Give us some idea of your experience and past projects. Other details: - rapid web application development experience - a desire to deploy applications to nonprofits - a proven ability to pick up new tools - short contract based trial followed by permanent (W-2) employment - modest salaries (we work with nonprofits), excellent stock options & benefits - located in Seattle (Capitol Hill) with supplemental telecommuting Thanks! -- Michael Gilbert From darrell at dorb.com Wed Apr 5 17:58:27 2000 From: darrell at dorb.com (Darrell) Date: Wed, 05 Apr 2000 21:58:27 GMT Subject: Remotely running a python script References: <8cf452$pdv$1@gxsn.com> Message-ID: <7GOG4.2280$bh.22442@typhoon.nyroc.rr.com> None of this is your solution but should provide some ideas. Win32 approach. win32file.FindFirstChangeNotification See http://www.dorb.com/darrell/win32WorkSvr/makeThumbsDG.py There's lots of socket examples on deja.com. Here's an example that might help you get started if sockets are your cup of tea. http://www.dorb.com/darrell/network/sproxy.py It waits for a connection on one port then forwards it to another port. In your case it would just launch a .py file and return the stdout. If you have Mark Hammond's Win32 stuff installed try naming your script with .pyw It'll run nicely out of site without a console. --Darrell "Richard Chamberlain" > Does anyone know a way I can remotely trigger a python script on a Win95 > machine? > > What I want to do is trigger an event from a vb client and run a python > script on another PC in the business. > > They are able to see each other via IP and the client has a drive mapped > that is a shared folder on the python side. > From PClaerhout at CREO.BE Tue Apr 11 06:02:40 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Tue, 11 Apr 2000 12:02:40 +0200 Subject: Redirecting the output from sys.stdout Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7297@MSGEURO1> Any examples on how to use the popen of the os module? Never used it before. Kind regards, Pieter [ Pieter Claerhout :: CreoScitex Response Centre :: Applications support ] [ Pieter_Claerhout at creoscitex.com :: http://www.creoscitex.com/ ] [ CreoScitex Europe :: Excelsiorlaan 21 :: 1930 Zaventem :: Belgium ] -----Original Message----- From: Oleg Broytmann [mailto:phd at phd.russ.ru] Sent: Tuesday, April 11, 2000 11:54 AM To: Pieter Claerhout Cc: 'python-list at python.org' Subject: Re: Redirecting the output from sys.stdout On Tue, 11 Apr 2000, Pieter Claerhout wrote: > I want to run a DOS command from Python, and I want to redirect the output of > that command to a variable. Anyone a suggestion on how to accomplish this? The > output of the command should not be shown on the screen. Long time ago I wrote a version of popen for DOS. If popen is not available in your version of module os - download it here: http://sun.med.ru/~phd/Software/Python/ Look for dospopen. These patches are now obsolete, I don't know how well it'd fitted you. Faster mirrors: http://members.xoom.com/phd2.1/Software/Python/ http://www.fortunecity.com/skyscraper/unix/797/Software/Python/ Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2.1/ phd2 at earthling.net Programmers don't die, they just GOSUB without RETURN. -- http://www.python.org/mailman/listinfo/python-list From nmm1 at cus.cam.ac.uk Mon Apr 3 14:39:53 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 3 Apr 2000 18:39:53 GMT Subject: Pass by reference ? References: <38E864C9.E1EE94F7@ecs.soton.ac.uk> <38E8D449.FBC1E2AD@roguewave.com> Message-ID: <8caohp$j4v$1@pegasus.csx.cam.ac.uk> In article <38E8D449.FBC1E2AD at roguewave.com>, Bjorn Pettersen wrote: >Jacek Generowicz wrote: >> >> I'm just trying to familiarize myself with Python. >> In Magnus Lie Hatland's Instant Python, he >> mentions that `all parameters in Python are passed >> by reference'. > >The technically correct (although much less known) term is >pass-by-object-reference. All this means is that you can change an >argument to a function by calling methods on the object, but you can't >change the identity of the object (ie. simply calling a function can't >change any name-bindings in your current scope). Hang on. Why is that technically correct? Call by reference has never implied changing any bindings in the caller's scope in any work that I have seen - it certainly didn't back in the 1960s. Unless I am thoroughly confused, Python uses bog-standard call by reference, with the wrinkle that assignment is a rebinding rather than a copying operation. AM I confused about that? The form of argument passing that DOES involve rebinding the caller's names certainly exists, but I have never seen an agreed name for it. It was reckoned to be a bad idea (just like Fortran's equally deceptive argument passing of scalars) by 1970, but kept coming back in special-purpose languages. Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From kc5tja at garnet.armored.net Sun Apr 30 20:23:29 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 1 May 2000 00:23:29 GMT Subject: What does "first class" mean? References: <3909F2F5.A6F91256@spacenet.tn.cornell.edu> <390c5db6.17614800@news.nikoma.de> Message-ID: >You can't return functions in C, or have arrays of functions, etc. >Pointers to functions, yes. But semantically, they are complete equivalent. If I call: NoOp *pNOPFunction; pNOPFunction = Foo(); pNOPFunction(); /* <-- legal ANSI C! */ -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From donb at init.com Mon Apr 17 12:05:25 2000 From: donb at init.com (Donald Beaudry) Date: Mon, 17 Apr 2000 12:05:25 -0400 Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> Message-ID: <200004171605.MAA04929@zippy.init.com> Bill Scherer wrote, > I just did a little test and found this to be substantially fatser than the > other three: > > import random > randint = random.randint > > r = [] > > for i in xrange(1,10000): > r.append(randint(1,10)) > > for i in r: print i > # ...then this one should be really impressive ;) def do_it(): from random import randint r = [] append = r.append for i in xrange(1,10000): append(randint(i)) for i in r: print i do_it() or better yet: def do_it(): from random import randint r = [] append = r.append map(append, xrange(1,10000)) for i in r: print i do_it() -- Donald Beaudry Ab Initio Software Corp. 201 Spring Street donb at init.com Lexington, MA 02421 ...So much code, so little time... From sp00fD at yahoo.com Tue Apr 18 05:43:35 2000 From: sp00fD at yahoo.com (sp00fD) Date: Tue, 18 Apr 2000 09:43:35 GMT Subject: urllib redirect References: <4.1.20000418125557.030592d0@202.95.1.37> Message-ID: <8dhao4$2qk$1@nnrp1.deja.com> You haven't really given a description of your problem, but I'll go ahead and take a stab anyway...maybe you need another newline character like so 'print "Content-type: text/html\n"'. Otherwise, I think what you have should work, although I haven't played with urllib too much (just enough to verify that what you're doing will print out a web- page). Here's a tip, anytime you're having trouble, take it to the interactive python prompt and try it there. In article <4.1.20000418125557.030592d0 at 202.95.1.37>, Thomas wrote: > I've got a pretty tame question. > > I want one of my functions to redirect the URL. > (ie I call the script and off I go to www.spam.com) > > So, here's what I get, and have not overcome yet: > > import urllib > def simpleredirect() : > ############ > print "Content-type: text/html" > print urllib.urlopen('http://www.spam.com').read() > > simpleredirect() > > TIA, > Tom > > Sent via Deja.com http://www.deja.com/ Before you buy. From dworkin at ccs.neu.edu Thu Apr 27 16:15:12 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 27 Apr 2000 16:15:12 -0400 Subject: Scripting and Gnome and KDE In-Reply-To: Karl EICHWALDER's message of "27 Apr 2000 18:51:03 +0200" References: <3dk8hzb90u.fsf@newcnri.cnri.reston.va.us> Message-ID: Karl EICHWALDER writes: > Sure, but sooner or later, Linux will run on all architecure and you'll > be free to choose the OS that fits your needs best :) Quite a non-sequitur you have there, sir. ;-) -Justin From thomas at madeforchina.com Tue Apr 18 00:59:31 2000 From: thomas at madeforchina.com (Thomas) Date: Tue, 18 Apr 2000 12:59:31 +0800 Subject: urllib redirect Message-ID: <4.1.20000418125557.030592d0@202.95.1.37> I've got a pretty tame question. I want one of my functions to redirect the URL. (ie I call the script and off I go to www.spam.com) So, here's what I get, and have not overcome yet: import urllib def simpleredirect() : ############ print "Content-type: text/html" print urllib.urlopen('http://www.spam.com').read() simpleredirect() TIA, Tom From g2boojum at hotmail.com Sun Apr 23 13:57:53 2000 From: g2boojum at hotmail.com (Grant Goodyear) Date: Sun, 23 Apr 2000 12:57:53 -0500 Subject: executable "wrapper" gui -- advice sought References: <8dtsp7$e7h$0@216.39.151.169> Message-ID: My thanks to those who replied. I'm using linux (mandrake 7 to be specific), and this seemed to work reasonably well: #!/usr/bin/env python # htmlout.py from popen2 import Popen3 cmd = "./a.out" htmlfile = "/home/grant/public_html/test.html" htmlout = open(htmlfile, 'w') htmlout.write("
\n") #hack so that I don't have to format the html

process = Popen3(cmd)
stdout = process.fromchild
print stdout
while (process.poll() == -1):  #while still running
    line = stdout.readline()
    if (line):
        htmlout.write(line)
        htmlout.flush()





From jwbnews at scandaroon.com  Sun Apr 30 21:50:18 2000
From: jwbnews at scandaroon.com (John W. Baxter)
Date: Sun, 30 Apr 2000 18:50:18 -0700
Subject: Discrepency between JPython and CPython
References:  
Message-ID: 

In article , Alex 
 wrote:

> > Consider the expression str(1.14 * 200).
> > In CPython it yields 228.0
> > In JPython it yields 227.99999999999997
> > 
> > Shouldn't this result in consistent values across variuos 
> > implementation?  
> > If so, which of the implementation is buggy?  
> > I think it is JPython, may be I am wrong.
> 
> Both implementations just reach down to a lower level routine -- for
> CPython, it's multiplication in C, for JPython, it's multiplication in
> Java.  So probably the discrepency is between the C compiler used to
> build your CPython (or maybe your CPU, if it does floating point
> operations.  I understand they do, these days.  [The only CPU I ever
> learnt anything about in detail was the 6809.] :) and the JVM your
> JPython is running on.
> 
> Alex

No...this is just yet another instance of CPython (less than 1.6) lying 
about the value of floats.  Since 1.14 is not precise, 1.14 * 200 can't 
be...yet the interpreter lies (by rounding off) and pretends that it is.

   --John

-- 
John W. Baxter   Port Ludlow, WA USA  jwbnews at scandaroon.com


From chris_barker at my-deja.com  Fri Apr 28 21:32:22 2000
From: chris_barker at my-deja.com (chris_barker at my-deja.com)
Date: Sat, 29 Apr 2000 01:32:22 GMT
Subject: Reading in strings -> numbers ??
References: <390A2D23.7029E557@fenx.com>
Message-ID: <8ede36$9r6$1@nnrp1.deja.com>

Well, the partner to file.write is file.read. What you are really
looking for is a partner to '%f %f'%(3,4), which is essentially an
sprintf(). So, what you want is an sscanf() or fscanf(). I've been
looking for that for a while. What I would like is a version like the
one in MATLAB, that gives you a whole matrix in one swipe.

Unfortunatly, it doesn't exist for python. Someone did make a Python
sscanf module, but I never got around to compiling it. there is also a
tablio (or something like that) module around. In the mean time, you can
always use something like:


list = map(float,string.split(file.readline)))

or, to use your example:

>>> map(float,string.split((" %e %e %d" % (1.2, -3.5, 10))))
[1.2, -3.5, 10.0]

it doesn't work if you want mixed types, but it gets you by.

-Chris

> Louis M. Pecora  wrote in message
> news:<280420001700308281%pecora at anvil.nrl.navy.mil>...
> > Is there a Python "read-partner" for the write(string) function,
e.g.,
> >
> > fileobject.write(" %e %e %d" % (1.2, -3.5, 10))
> >
> > in the sense that the C functions fprintf and fscanf are partners.
> >
> > I've looked in 4 different Python books and in the pdf references,
but
> > I see nothing in read or readlines or strings that seems to make for
an
> > easy conversion from a string to a list or tuple of objects
(numbers).
> > In other words, I want the opposite of the write above so I can read
> > those numbers back into my Python code.



Sent via Deja.com http://www.deja.com/
Before you buy.


From joacim at home.se  Fri Apr 28 02:11:32 2000
From: joacim at home.se (JJ)
Date: Fri, 28 Apr 2000 08:11:32 +0200
Subject: Wanted Daniel Larsson
References: <39075823.F3511829@cybercable.fr>
Message-ID: <8eba3r$km0$1@vg170.it.volvo.se>

According to a search in:
http://epostkatalog.telia.com/public/english/pmain.menu
Following information shows up:

E-mail            daniel.larsson at vasteras.mail.telia.com
Name              Daniel Larsson
Street Address    Knotav?gen 17
Postal Code       723 52
City              V?ster?s
Country           Sweden
Phone             021-84 00 87
Home Page         http://hem.passagen.se/dlarsson
Last modified     1997-04-11

I hope this would help.

BR
Joacim





"FR Chalaoux"  wrote in message
news:39075823.F3511829 at cybercable.fr...
> Hi,
>
> I looking for the right e-mail adress of "Daniel Larsson", the creator
> of Pythondoc?
> "Daniel.Larsson at vasteras.mail.telia.com" seems to be incorrect.
>
> Bye, FR.
>
>
>
>
>




From phd at phd.russ.ru  Fri Apr  7 08:23:34 2000
From: phd at phd.russ.ru (Oleg Broytmann)
Date: Fri, 7 Apr 2000 12:23:34 +0000 (GMT)
Subject: Newbie: How to do an exit ?
In-Reply-To: <38EDC1DA.62CBFCF3@sxb.bsf.alcatel.fr>
Message-ID: 

On Fri, 7 Apr 2000, Pascal Fremaux wrote:
> How to exit from a program ?
> I don't find a command such as exit(0) in C

import sys
sys.exit(0)

   Or

raise SystemExit, 0

   If you need _exit(1) it is

import os
os._exit(1)

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.




From jbekesi at my-deja.com  Thu Apr 13 18:20:39 2000
From: jbekesi at my-deja.com (Janos BEKESI)
Date: Thu, 13 Apr 2000 22:20:39 GMT
Subject: windows registry
References: 
Message-ID: <8d5h78$fpq$1@nnrp1.deja.com>

The pythonwin package contains some interesting sources:

win32/scripts/regsetup.py

which uses (I think) win32/lib/regutil.py (the main module for handling
the registry). With a little effort one can figure out how things work.
Additionally there is some documentation included in the
win32/Help/Python Win32 Extensions.hlp-File, but looking at the sources
should show how all is put together. I used regutil.py for checking
whether there is python installed on a win32 system and if not, setting
the appropriate registry keys.

Hope it helps,

Janos.


> How do I edit the windows registry with Python?


Sent via Deja.com http://www.deja.com/
Before you buy.


From mfletch at tpresence.com  Tue Apr 25 12:55:57 2000
From: mfletch at tpresence.com (Mike Fletcher)
Date: Tue, 25 Apr 2000 12:55:57 -0400
Subject: new linereading standard?
Message-ID: 

Or, if you prefer...

import fileinput # standard module
f = fileinput.FileInput( filename )
for line in f:
	print line

Enjoy,
Mike

-----Original Message-----
From: dyoo [mailto:dyoo at uclink4.berkeley.edu]
Sent: Tuesday, April 25, 2000 1:04 PM
To: python-list at python.org
Subject: Re: new linereading standard?


In article <3904D21B.333DD930 at visionart.com>, 
Pete Shinners  wrote:
> i've come to the point where i can't get by even the simplest python
> project without dumping this code into my files. it is a simple class
> that handles the "while 1: .... break" carnival for reading files.
> now i can code in a preferred style

> myfile = open('myfile.txt', 'r')
> for line in filelines(myfile):
>     print line
> myfile.close()

> as a person trying to introduce his friends to python, i repeatedly find
> this is the ugliest wart while doing basic stuff with python.

Python does allow you to read the whole file at a time.  
readlines() will give you a list of all the lines in the file, so 
your code can look like:

  myfile = open('myfile.txt', 'r')
  for line in myfile.readlines():
    print line
  myfile.close()

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



From effbot at telia.com  Sun Apr  9 15:28:29 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Sun, 09 Apr 2000 19:28:29 GMT
Subject: Tkinter:  centering windows on screen
References:  <38F0C6A7.10878609@dkfz-heidelberg.de> <38F0C95D.1F7E853@dkfz-heidelberg.de>
Message-ID: 

Kilian Lorenz  wrote:
> >> that works but doesn't help me much because I'm interested in the
> >> return value. So I would really like to know how to call Tk commands
> >> from within Python because .... blah blah
>
> Now I also found out how this works ... pretty easy with
> .tk.call(, ,  ...)
>
> You just have to browse Tkinter.py and get the answers to all your
> questions !  :)

if you browsed the source, how come you didn't find the
corresponding Tkinter methods?

windows geometry:
http://w1.132.telia.com/~u13208596/tkintrobook/x9867-window-geometry-methods
.htm

file dialogues:
http://w1.132.telia.com/~u13208596/tkintrobook/x1164-data-entry.htm

(direct pointers to the current draft; official version at
www.pythonware.com will be synchronized next week).






From PClaerhout at CREO.BE  Thu Apr 27 11:07:48 2000
From: PClaerhout at CREO.BE (Pieter Claerhout)
Date: Thu, 27 Apr 2000 17:07:48 +0200
Subject: pythoncom / Installer on Win32
Message-ID: <2B1262E83448D211AE4B00A0C9D61B030111537F@MSGEURO1>

Look into your windows system folder. You'll see that there's only a file
which is called pythoncom15.dll. Duplicate this file and rename it to 
pythoncom.dll. Should solve the problem.

Kind regards,


Pieter

Pieter Claerhout
Application Support - CreoScitex Europe


-----Original Message-----
From: Richard Chamberlain [mailto:richard_chamberlain at ntlworld.com]
Sent: Thursday, April 27, 2000 1:21 AM
To: python-list at python.org
Subject: pythoncom / Installer on Win32


i,

I am trying to create a distribution using Gordon's Standalone.

I'm asking a fair amount because I'm using COM, ODBC etc.

any help would be appreciated,

Richard

bindepend cannot analyze %s - file not found!
analyzing odbc
 found python15.dll
 found ODBC32.dll
 found dbi.dll
 lib not found: dbi.dll dependency of  found MSVCRT.dll
 found KERNEL32.dll
 added filter 
Creating COMServer.exe
Traceback (innermost last):
  File "Builder.py", line 502, in ?
    main(opts, args)
  File "Builder.py", line 484, in main
    target.build()
  File "Builder.py", line 87, in build
    self.assemble()
  File "Builder.py", line 300, in assemble
    arch = ArchiveTarget.assemble(self, pkgname)
  File "Builder.py", line 275, in assemble
    arch.build(pkgnm, toc)
  File "C:\WINDOWS\DESKTOP\INSTAL~1\MEInc\Dist\archive.py", line 146, in
build
  File "C:\WINDOWS\DESKTOP\INSTAL~1\MEInc\Dist\carchive.py", line 167, in
add
IOError: [Errno 2] No such file or directory:
'c:\\windows\\system\\pythoncom.dll'



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



From tseaver at starbase.neosoft.com  Tue Apr  4 19:10:38 2000
From: tseaver at starbase.neosoft.com (Tres Seaver)
Date: 4 Apr 2000 18:10:38 -0500
Subject: Python 1.6 alpha 1 released
References:  <5l7leern5v.fsf@eric.cnri.reston.va.us> <8cdg92$j0m$1@nntp6.u.washington.edu> <8cdig3$s7f$1@slb6.atl.mindspring.net>
Message-ID: 

In article <8cdig3$s7f$1 at slb6.atl.mindspring.net>,
Aahz Maruch  wrote:
>In article <8cdg92$j0m$1 at nntp6.u.washington.edu>,
>Russell E. Owen  wrote:
>>
>>But tuples seem a less than wonderful choice to me. Protocol flexibility 
>>presumably requires each protocol to have its own tuple with its own 
>>numer of fields in its own order. That's a lot to remember and try not 
>>to get mixed up.
>
>I second this.  I'd be happy with either dict or class, with a *slight*
>preference for a class.

I'd be quite happy with a set of address classes -- they could *add value*
in lots of ways that the tuple can't.  For instance, consider IPv6 dual-
mode issues -- an IPAddress object could know how to render itself
appropriately in either mode.  

Hmm, new proposal (for the Py3K timeframe):

Make class socket.socket into an abstract interface, and socket.socket()
into a factory which produces an appropriate derived instance, based on
family, type, and proto.  The derived type would then automatically know
how to interpret the *args to connect(), bind(), etc., and Do the Right
Thing [TM].

Such a scheme would make adding new families/types/protocols a matter of
plugging callables into the lookup table used by socket.socket(), and could
be therefore done in entirely separate modules (SOCK_RAW, anyone? or
AF_INET6/AF_IRDA?)

Why-propose-a-small-incompatible-change-when-BIG-ones-abound?'ly

Tres.
-- 
---------------------------------------------------------------
Tres Seaver        tseaver at digicool.com     http://www.zope.org
Digital Creations


From mappel at 123ibm.net  Fri Apr 14 22:25:50 2000
From: mappel at 123ibm.net (Michael Appelmans)
Date: Sat, 15 Apr 2000 02:25:50 GMT
Subject: Python Starship Grounded??
References: <38F6B2DF.940E7C23@concentric.net>
Message-ID: 

Yes, I was hoping to get hold of win32all build 131 for Python 1.6a2 but to
no avail. I fear it is lost in some freakish nebulae.

--
Michael Appelmans
// remove 123 to mail
mappel at ibm123.net

"Manus Hand"  wrote in message
news:38F6B2DF.940E7C23 at concentric.net...
Anyone here able to do anything about the illness that seems to have
come over starship.python.net?

It was out of commission all day Tuesday, and now all day today
(Thursday) without a visible light at the end of the tunnel.

It occasionally answers ping (well, it did earlier today, but....)
and sometimes a traceroute will crawl through to it, but http and
ftp and ssh, etc., etc. have failed to answer all day.  (And were
sluggish at best yesterday, and non-existent the day before.)

Manus




From effbot at pythonware.com  Thu Apr 13 06:28:43 2000
From: effbot at pythonware.com (effbot at pythonware.com)
Date: Thu, 13 Apr 2000 10:28:43 GMT
Subject: Compiling Python Imaging under LinuxPPC
References:  <20000412144842.06030.00002524@ng-ch1.aol.com>
Message-ID: <8d47gh$vuo$1@nnrp1.deja.com>

William F. Adams wrote:
> When I attempt to compile the Sketch .src.rpm, the compilation
> fails because Imaging.h is not where it's supposed to be.
>
> I ddin't see much in the way of documentation with the
> .src.rpm for PIL, sorry.

RPM?  the official PIL distribution is a .tar.gz file, available
from www.pythonware.com.  last time I checked, it definitely came
with both a README and an Imaging.h file.  if you have a source
RPM that doesn't include those files, complain to whoever pre-
pared that file, and get the original distribution.

...

but it sounds like your real problem is with the Sketch application.
did you see the PIL-specific notes in the Sketch installation guide?
it says:

  Tne point not mentioned in the PIL installation instructions are the
  headerfiles (.h files). For easier configuration of Sketch I recommend
  to install the files the following files found the libImaging
  subdirectory into a directory under the Python include directory:

     ImConfig.h  ImPlatform.h  Imaging.h

  (e.g. if your Python include directory is /usr/include/python1.5, put
  them into /usr/include/python1.5/Extensions)

e.g.

  $ cd Imaging-1.0
  $ mkdir /usr/include/python1.5/Extensions
  $ cp libImaging/Im*.h /usr/include/python1.5/Extensions

it's likely that PIL 1.1 will do this for you, but as of 1.0,
you have to copy the files yourself.




Sent via Deja.com http://www.deja.com/
Before you buy.


From johngrayson at home.com  Sun Apr  9 18:35:14 2000
From: johngrayson at home.com (John Grayson)
Date: Sun, 09 Apr 2000 22:35:14 GMT
Subject: tkinter - changing the mouse pointer?
References: <38E91666.D3B87B4C@parlant.com>
Message-ID: <38F105A2.176B2C38@home.com>

Try page 369...

You might want to look at Pmw's BLT busy cursor 
for a full busy cursor implementation.

  Grayson

Thomas Lane wrote:
> 
> Does anyone out there know how to change the mouse pointer in tkinter? I'd like
> to change the mouse pointer to an hourglass (or the default 'wait' icon for the
> os) and back to normal after a short operation. How do I go about doing this?
> I've hunted through the Grayson book without success.
> 
> Thomas Lane
> Parlant Technology
> tom at parlant.com


From paul at fizzylab.com  Fri Apr  7 19:51:27 2000
From: paul at fizzylab.com (paul beard)
Date: Fri, 07 Apr 2000 16:51:27 -0700
Subject: calendar/scheduling app
References: <38EE332E.2954EA49@fizzylab.com> <0004071547040L.01234@quadra.teleo.net>
Message-ID: <38EE747F.3BD26F7@fizzylab.com>

Patrick Phalen wrote:
> 
> [paul beard, on Fri, 07 Apr 2000]
> :: I am interesting in having a meeting scheduler/calendar app that does
> :: what something like Exchange purports to do without requiring me to use
> :: a client that doesn't exist. In other words, it should be
> :: platform-agnostic and use webforms/cookies to handle transactions and
> :: display options.
> ::
> :: Possible in Zope? How hard? How long to do, given a baseline knowledge
> :: store of zero?
> 
> Try http://www.worldpilot.com

--
Paul Beard / 206 728 4282 x138
Fizzylab / 2025 First Ave, Suite 1150
Seattle WA 98121



From maxm at maxmcorp.dk  Mon Apr  3 16:25:02 2000
From: maxm at maxmcorp.dk (Max M)
Date: Mon, 03 Apr 2000 20:25:02 GMT
Subject: Building and Transvering multi-level dictionaries
References:  
Message-ID: 

"Justin Sheehy"  wrote in message
news:vnd1z4rtcdv.fsf at camelot-new.ccs.neu.edu...
> "maxm"  writes:
>
> > I'm in recursion hell here and have been trying to wring out the keys
for
> > almost two days now and can no longer think straight.
>
> You could certainly write a recursive function to gather all of the
> keys, and I was about to do so... but I decided that it wasn't worth
> the work.  Instead, just make a couple of small changes to the class.

Hi Justin

Thanks for the code, but actually I think that I have found a much simpler
method for faking tree functionality in Python. I just use a tuple as a key
in a Dictionary:

#################################

theTree = {}

theTree[(1,)] = 'Max'
theTree[(2,)] = 'Gitte'
theTree[(2,4)] = 'Caroline'
theTree[(2,5)] = 'Clara'
theTree[(1,3)] = 'Magnus'
theTree[(1,3,6)] = 'unborn'

treeKeys= theTree.keys()
treeKeys.sort()

#print treeKeys

for key in treeKeys:
    print (len(key)-1)*3*' ',theTree[key]

#################################




From M_Pope at shef.rage.co.uk  Wed Apr 26 05:41:56 2000
From: M_Pope at shef.rage.co.uk (Mark Pope)
Date: Wed, 26 Apr 2000 10:41:56 +0100
Subject: C API - Creating Python Classes
Message-ID: <213CDEBFDDA7D3118081009027E40C5607116E@SHEF-MS1>

Hi,

Using the python C API I can, for example, create an Integer Python object
with the call:

	PyObject *pMyInt = PyInt_FromLong( 123 );

I have a python class which I need to create an instance of. How is this
done?

I assume I need something like:

	PyObject *pModule = PyImport_ImportModule( "MyClassScript" );

	PyObject *pInstance = NEW_INSTANCE( pModule, args );


thanks for any help,

mark.



From aaron at mancala.semo.net  Thu Apr 27 16:08:39 2000
From: aaron at mancala.semo.net (Aaron Malone)
Date: 27 Apr 2000 15:08:39 -0500
Subject: Newbie Question
References:  <39089928.47B55E1B@tismer.com>
Message-ID: <87n1mfi9x4.fsf@mancala.semo.net>

Christian Tismer  writes:

> But if you want to be sure only to loose \n, and also might
> want to solve the problem that the list line might have no \n,
> you are better off with a loop, like so: (after reading)
> 
> for i in range(len(mylist)):
>     if mylist[i][-1:] == "\n":
>         mylist = mylist[:-1]

Correction:

for i in range(len(mylist)):
     if mylist[i][-1:] == "\n":
         mylist[i] = mylist[i][:-1]

-- 
Aaron Malone (aaron at semo.net)
System Administrator                     I can bend minds with my spoon.
Poplar Bluff Internet, Inc.
http://www.semo.net


From jimserac at mindspring.com  Sun Apr  2 00:41:51 2000
From: jimserac at mindspring.com (James Pannozzi)
Date: Sun, 2 Apr 2000 00:41:51 -0500
Subject: New Features in Python 1.6
References: <200004011740.MAA04675@eric.cnri.reston.va.us>
Message-ID: <8c6mkg$8i$1@slb2.atl.mindspring.net>

... mouth watering description of new Python 1.6 features...

"Note that the Python installer for Windows now installs GNU m4, the bash
shell, and Autoconf, so that Windows users will be able to use the
Distutils just like on Unix."


Excellent, wonderful, yes, yes, ... ah whoops!!!  What's this about it
installing a bash shell, I've already got my NT Xemacs configured to use the
Cygwin 20 Bash shell.

(Oh Oh! reconfigure, incompatabilities... confusion, chaos...)

Also, I notice that links to Python2c have quietly become non-functional or
non-existent.

Thanks
Jim


"Guido van Rossum"  wrote in message
news:200004011740.MAA04675 at eric.cnri.reston.va.us...
> New Features in Python 1.6
> ==========================
>
> With the recent release of Python 1.6 alpha 1, a lot of people have
> been wondering what's new.  This short note aims to explain the major
> changes in Python 1.6.
>
>
> Core Language
> -------------
>





From mwh21 at cam.ac.uk  Thu Apr 13 19:06:05 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 14 Apr 2000 00:06:05 +0100
Subject: Module Loading Issues
References: 
Message-ID: 

Brent Fulgham  writes:

> Is there any disadvantage to having many modules loaded
> at the same time?  I.e., is it possible for badly-written
> modules to write entries into the "__main__" namespace
> that might clash with other entries?

So long as you don't do to many "from ... import *"s you should be
fine.  I mean it's possible that a module will stomp on __main__, but
in practice they don't (if you find one that does, find the author and
slap him/her until he/she agrees it's a bad idea).
 
> Or is the only concern memory use?

I've never had any problem with that either, but then I've never used
Python in a memory tight situation.

Cheers,
M.

-- 
  nonono,  while we're making wild  conjectures about the behavior 
  of completely  irrelevant tasks,  we must not  also make serious 
  mistakes, or the data might suddenly become statistically valid.
                                      -- Erik Naggum, comp.lang.lisp


From effbot at telia.com  Tue Apr 18 17:50:59 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Tue, 18 Apr 2000 21:50:59 GMT
Subject: module __call__
References: 
Message-ID: <7N4L4.497$wYl.191816704@newsb.telia.net>

Dirck Blaskey  wrote:
> Just a little GWIBNI....
>
> ...Gee-Wouldn't-It-Be-Nice-If...
>
> modules could def __call__():
>
> so you could call a module, i.e.
>
>     import StringIO
>     f = StringIO()

and

class myStringIO(StringIO):
    ...

would explode in your face.  lousy idea.






From parkw at better.net  Wed Apr 12 15:36:37 2000
From: parkw at better.net (William Park)
Date: Wed, 12 Apr 2000 15:36:37 -0400
Subject: Off-topic
In-Reply-To: <38F4C52C.450F611F@callware.com>; from ivanlan@callware.com on Wed, Apr 12, 2000 at 12:49:16PM -0600
References: <38F4BE12.A0C73D1D@callware.com>  <38F4C52C.450F611F@callware.com>
Message-ID: <20000412153637.A9859@better.net>

On Wed, Apr 12, 2000 at 12:49:16PM -0600, Ivan Van Laningham wrote:
> Sh scripts do work, as long as I remember to do ./script ;-).  I'm
> running as root (but the same thing happens when I run as myself, too). 
> However, this could be explained by the default behavour of exec(),
> which states that if the kernel can't run a program, it execs sh and
> hands it the program name in argv.

What is your PATH?  Is your problem related to that fact that '.' is not
in part of PATH environment variable?

--William



From bruce_dodson.nospam at bigfoot.com  Sat Apr  8 15:43:23 2000
From: bruce_dodson.nospam at bigfoot.com (Bruce Dodson)
Date: Sat, 8 Apr 2000 16:43:23 -0300
Subject: Python Language Support for ArcView GIS
Message-ID: 

Python Language Support for ArcView GIS (aka AVPython) is now available
online as a free download.  I promised this several months ago but never
managed to find a home for it (too busy) so finally I decided to just slap
together a page for it on GeoCities:
www.geocities.com/brucedodson.rm/avpython.htm

If you're an ArcView developer and want to be able to control COM-enabled
programs like Excel or ArcInfo, or if you want to be able to interoperate
with distributed systems through standards like XML and HTTP, you might want
to give it a try.  The same goes for Python programmers who happen to be
working with ArcView GIS (hey, there must be a few!), and want to be able to
apply their Python skills (and use a better language) when developing
ArcView applications.

Python is free and open source.  I hope AVPython will eventually be the
same, but we haven't yet settled on an acceptable open source license, so
for now the best I can do is provide a binary that is freely
redistributable.

If you use AVPython on any interesting projects, or if you have any positive
feedback or things that you'd like to change, feed my hubris: tell me about
it!  Just take nospam out of my address, or use the one listed in the
documentation.

Sincerely,
Bruce Dodson



From glyph at twistedmatrix.com  Sat Apr 22 01:31:18 2000
From: glyph at twistedmatrix.com (Glyph Lefkowitz)
Date: 22 Apr 2000 00:31:18 -0500
Subject: The Simple Economics of Open Source
In-Reply-To: "Juergen A. Erhard"'s message of "Sat, 22 Apr 2000 05:43:13 +0200"
References: <14591.15630.192472.440375@goon.cnri.reston.va.us>  <3900611F.3B525BDA@cfdrc.com>   <22042000.2@sanctum.jae.ddns.org>
Message-ID: 

I was too tempted by the philosophical sounding thread.  Forgive me
for jumping in =)

"Juergen A. Erhard"  writes:

> Egoism is often equated with the profit motive these days (little
> wonder in our money-based society...[2])

Yes, and THIS is where the mistake is from ... there are a LARGE
number of reasons to do something for personal gain that decidedly do
NOT involve gaining money.  This is where economic models fall short,
IMHO -- the fact that they are so largely successful seems to me to be
a cynical statement on our society.  I suppose it comes from the fact
that the distinction between a corporation (whose only reason for
existance is money) and an individual (whose reason for existance I
will withhold judgement on for the time being) become somewhat
confused in that context.

For example, if I buy flowers for my lady-friend, and she is happy,
the fact that she is happy makes *me* happy, and does nothing to
improve my financial standing.  I lose money, the flowers are dead
after a month, and likely by then she's forgotten about them ... but
I'll buy them anyway.  Flowers are important.

If a corporation buys flowers for its employees, those have to be
"justified", as an "investment" in "human resources".  Happiness
doesn't matter, unless it can somehow increase productivity.

>   Xyzzy (for lack of a name[3]) is "I get *rid* of something".  Or "I
>   get something of my chest".

As I'm not doing anything altruistic when I buy flowers for a lady in
the previous example (her happiness makes me happy, for reasons having
to do with psychology too complicated to get into here) and so I'm
buying them to make myself happy, if I'm doing something to "get
something off my chest" (which I think is a horrible way of looking at
creative endeavors -- I prefer to think of them as a personal *gain*,
not a zero-sum necessity) then I'm doing it to get something off *my*
chest.  So you could express that as an egoistic motivation.

In fact, any altruistic (or xyzzyistic ^_^) motivation could be
reduced to an egoistic one -- obviously, you think that it stands to
gain you *something* by doing that thing, otherwise YOU wouldn't do
it.  Even the most self-avowedly altruistic person must be making
decisions as to what sort of altruism to engage in for themselves, and
therefore acting on some sort of self-based motivation.  The purer the
altruism, the less governance the altruist allowed over those
decisions.

The ultimate altruist is a mind-controlled zombie.

That said, the other interesting thing about open-source software is
that unlike other apparently altruistic endeavors, it requires very
little maintenance -- progress made in OSS is archived, and
effectively, anyone who wishes to follow the rules (I.E. adhere to the
license) can build upon it without wasting or duplicating any effort.

For example, if you run across some dusty two-year-old python code
that (f'rinstance) facilitates time-travel, and you hack on it for a
while, bring it up to date, but get bored or disinterested because of
more pressing concerns, like the upcoming alien invasion, you can put
your code out there and somebody else with a like mind might come
along and pick up where you left off.  Keeping the code archived in a
couple hundred places on the internet in case someone else becomes
interested is remarkably cheap.  The lower the "barrier to entry", the
more likely a random passerby is to contribute.

A soup-kitchen on the other hand, despite its more immediate (and IMHO
more deeply gratifying) effect of diminishing the horrors of poverty,
will collapse because of infrastructure expenses if the volunteers
gradually stop showing up, and won't be around for the next set of
volunteers to pick up at the point at which it left off, so it
requires more investment on their part, and more momentum to get going
again.  Real world brick-and-mortar type stuff requires significantly
more upkeep than bits, and is much harder to reproduce.

> Ranting-is-my-middle-name-(Chorus:-"Obviously!")-ly y'rs, J

Is signing with an adjective some sort of initiation rite on this list? ;-)

life-is-a-game-we-play-in-first-person-perspective-ly y'rs, Glyph

-- 
                  __________________________________________
                 |    ______      __   __  _____  _     _   |
                 |   |  ____ |      \_/   |_____] |_____|   |
                 |   |_____| |_____  |    |       |     |   |
                 |   @ t w i s t e d m a t r i x  . c o m   |
                 |   http://www.twistedmatrix.com/~glyph/   |
                 `__________________________________________'



From sbarron at ansic.net  Fri Apr  7 10:23:58 2000
From: sbarron at ansic.net (Scott)
Date: Fri, 7 Apr 2000 14:23:58 GMT
Subject: Formatting Excel cells with PythonCOM
References: <38ECAF9D.ECA74709@ansic.net> <1k9H4.28$4v.151@news-server.bigpond.net.au>
Message-ID: <38EDEF7E.E13977AC@ansic.net>

Hi Mark,

Wouldn't you know not 5 minutes after I posted the messag I figured it
out using the Excel VBA help.  Anyway, thanks for the information.  Btw,
I bought and read your PPW over my spring break and it helped me
tremendously, thanks!

Scott

Mark Hammond wrote:
> 
> This code is from the win32com test suite (in testMSOffice.py)
> 
>  # test dates out with Excel
>  xl.Cells(5,1).Value = "Excel time"
>  xl.Cells(5,2).Formula = "=Now()"
> 
>  import time
>  xl.Cells(6,1).Value = "Python time"
>  xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
>  xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
>  xl.Columns("A:B").EntireColumn.AutoFit()
>


From moshez at math.huji.ac.il  Sat Apr 22 08:25:38 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Sat, 22 Apr 2000 15:25:38 +0300 (IDT)
Subject: code not true?
In-Reply-To: <8ds3ku$q0l$1@nnrp1.deja.com>
Message-ID: 

On Sat, 22 Apr 2000 jeff_islay at my-deja.com wrote:

> Why does the second example return false?
> 
> >>> print 7.0 == 7
> 1
> >>> print (.07 * 100) == 7
> 0

Because computers represent floats with too little bits.
Never ever compare two floats for equality!

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From moshez at math.huji.ac.il  Tue Apr  4 11:40:09 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Tue, 4 Apr 2000 17:40:09 +0200 (IST)
Subject: Python 1.6 alpha 1 released
In-Reply-To: <8ccie0$7fs$1@newshost.accu.uu.nl>
Message-ID: 

On 4 Apr 2000, Martijn Faassen wrote:

> And what Tres also mentioned was the external interfaces of ftplib,
> etc. A quick glance at the 1.6 alpha shows that they also have separate
> host/port arguments. It would seem inconsistent to change 'connect' to use
> tuples in one case, but 'connect' in ftplib a host and port argument..

This is a compelling argument, but a wrong one. You see, FTP is an
internet level protocol -- it always uses network sockets, and so can
expose a simpler interface. The socket module should support all kinds of
sockets (like UNIX domain sockets), so its interface must remain general.

--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From helge.hess at mdlink.de  Mon Apr  3 05:48:55 2000
From: helge.hess at mdlink.de (Helge Hess)
Date: Mon, 03 Apr 2000 11:48:55 +0200
Subject: multiple interpreter sessions
References: <000b01bf9c6b$413cca80$752d153f@tim>
Message-ID: <38E86907.9C52EBD0@mdlink.de>

Tim Peters wrote:
> [Helge Hess]
> > I would like to have separate Python runtimes in a single server, so
> > that they don't affect each other (eg for security and state reasons).
> > ...
> 
> See the description of Py_NewInterpreter() in the "Initialization,
> Finalization, and Threads" section of the Python/C API manual.  You can
> create sub-interpreters from a C extension this way, but there's no
> Python-level interface to this at present.  Haven't used it myself, and,
> indeed, have yet to see any use of it.

Do you have another suggestion on how to implement 'multi-user Python'
in a single process ? I have some kind of application server which is
written mostly in C and I want to let the user write extensions in
Python. Since multiple users (and scripts) can be active in one process
I need to separate them from each other. I can't see how I can
accomplish that in another way if the user chooses to import something
(since the import [at least the module init] is global).

Besides that Py_NewInterpreter() seems to be what I want. I'm somewhat
confused that I get back a thread-state, do I switch between different
interpreters by doing some kind of manual context switch of Python
threads [that is, by calling save and restore thread] ?

thanks
  Helge


From darrell at dorb.com  Sun Apr  9 15:17:19 2000
From: darrell at dorb.com (Darrell)
Date: Sun, 09 Apr 2000 19:17:19 GMT
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8cntqp$upi$1@slb0.atl.mindspring.net> <8covpn$4jq$1@slb6.atl.mindspring.net> <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk>
Message-ID: <3H4I4.709$4w1.17557@typhoon.nyroc.rr.com>

> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0)

x=0
if a != NULL:
    x=a[i].weeble

if b != NULL:
    x=x+b[i].wombat

Isn't this more clear?
In fact isn't not much if any longer than the "C" version when you count the
parens used.

--Darrell







From neilh at hare.net.au  Mon Apr  3 07:46:24 2000
From: neilh at hare.net.au (Neil Hodgson)
Date: Mon, 3 Apr 2000 21:46:24 +1000
Subject: Unicode program representation
References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> <3xXF4.1060$n68.186533888@newsb.telia.net>
Message-ID: <001201bf9d62$3e1ac1c0$36dd3fcb@neil>

> >    I think this should be changed to interpreting the literal as a UTF-8
> > literal. The advantage here is that non-roman string literals become a
> > natural part of the language.
>
> however, perfectly valid ISO Latin 1 strings (or any other standard
> 8-bit encoding) are invalid UTF-8 strings.   changing the default to
> UTF-8 this is likely to break many existing scripts.

   But there are relatively few scripts currently using the u" form since it
has yet to appear in a release version of Python.

   Neil





From dalke at acm.org  Mon Apr 17 05:27:31 2000
From: dalke at acm.org (Andrew Dalke)
Date: Mon, 17 Apr 2000 03:27:31 -0600
Subject: pattern-based string expansion
References: <38F52C61.A5D72F89@gte.net> 
Message-ID: <8del87$5md$1@slb6.atl.mindspring.net>

Justin Sheehy wrote:
>In fact, if you retain the expressivity of glob, the function you
>describe is not practically possible.  What should it return if given
>the glob "*"?


A generator for all possible strings?

Here's an outline for a very inefficient solution, assuming the
input is an re instead of a glob.  And, um, if there are only
a finite number of strings, this will still never terminate
until the integer counts overflow or you run out of memory.  :)

class MatchGenerator:
  def __init__(self, pattern):
    self.pattern = pattern
    self.size = 0
    self.letters = []
    self.offset = 0
    self._n = 0
  def __getitem__(self, i):
    assert self._n == i, "forward iteration only"
    x = self.next()
    if x is None:
      raise IndexError, i
    return x
  def next(self):
    self._n = self._n + 1
    while 1:
      s = string.join(self.letters)
      if self.pattern.match(s):
        break
        # advance the value of the current offset letter one character
        # if it's the end, advance the offset character
        # if *that's* at the end, try the next larger size string
    return s

That was only in jest, but it's a reasonable result.  If the
glob has an infinite number of matches, __len__ could raise some
sort of exception.  For a finite number, the getitem might even
be random access.

Finally, as an exercise for the student, it should take an optional
list of finite strings in the constructor, for backward compatibility
to glob :)

                    Andrew
                    dalke at acm.org





From ullrich at math.okstate.edu  Tue Apr  4 19:40:37 2000
From: ullrich at math.okstate.edu (David C. Ullrich)
Date: 4 Apr 2000 23:40:37 GMT
Subject: Why should I switch to Python? - Infinity of Primes
References: <1257244378-5884705@hypernet.com>
Message-ID: <01bf9e90$a57d6140$6296cdcf@daves-dell>


Gordon McMillan  wrote in article
<1257244378-5884705 at hypernet.com>...
> David C. Ullrich wrote:
> 
> > ... Could be that there's a proof of the existence
> > of infinitely many primes using FTA that has some property
> > not shared by Euclid's proof, but "constructive" isn't it.
> 
> Oh, come on. There are at least 3 well known constructive 
> proofs that all odd numbers are prime:

	Of course there are. And it follows that there are infinitely
many primes - so this gives several _more_ constructive proofs
of that fact.

	(I didn't say the proof wasn't constructive - of course it is.
I said "constructive" was not a property that this proof did not
share with the hypothetical FTA proof.)

DU


From effbot at telia.com  Tue Apr  4 16:05:47 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Tue, 04 Apr 2000 20:05:47 GMT
Subject: New Features in Python 1.6
References: <200004011740.MAA04675@eric.cnri.reston.va.us> <_pyF4.25562$E85.640966@news1.rdc1.md.home.com>     <38ea40a1.47458347@news.nikoma.de>
Message-ID: 

Philip Newton wrote:
> >why not just use two different compression algorithms repeatedly,
> >until you've squeezed the file down to a suitable size?  it takes a
> >little work, but you can design them so that one of them can always
>                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >strip away at least one bit from the input stream.
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Yes? I challenge you to provide any algorithm that will strip away one
> bit from the four sequences 11, 10, 01, and 00, while still being able
> to restore the previous state.

okay, okay, I shouldn't have posted that several days after
april 1st...  but hey, this group is (indirectly) named after a
infamous comedy troupe, so what did you expect?

anyway, here's the code:

    n = number_of_bits
    while n > minsize:
        if skip_false_bit():
            print "used algorithm 1"
        elif skip_true_bit():
            print "used algorithm 2"
        else:
            raise IOError, "deranged data"
        n = n - 1

where skip_false_bit() and skip_true_bit() returns true if
the succeed to actually compress the data.

to decode, just call insert_false_bit() and insert_true_bit()
repeatedly, in the *right* order ;-)






From smalleys at gte.net  Fri Apr 14 00:29:48 2000
From: smalleys at gte.net (sue)
Date: Fri, 14 Apr 2000 04:29:48 GMT
Subject: Call by Reference / Value
References: <8d4rr7$t8k$1@newnews.ilk.de>
Message-ID: <38F690BF.735CA9AF@gte.net>

I haven't had this problem with SWIG/TCL.  Are you sure
python can see the real data from the wrapper, and not just
the data types?  I always put
	typedef { stuff } TYPE; extern TYPE data;
in the .h file I feed to SWIG (unless I use custom accessor
fns).

Both python and tcl will create a variable if they can't
find it, and silently continue on.  This can give you good
separately tested C and python code which fails when you
hook the two together.

Sue.


From tjreedy at udel.edu  Tue Apr  4 15:31:42 2000
From: tjreedy at udel.edu (Terry Reedy)
Date: Tue, 4 Apr 2000 15:31:42 -0400
Subject: Python 1.6 alpha 1 released
References: 
Message-ID: <8ce387$dfr$1@news.udel.edu>

"Moshe Zadka"  wrote in message
news:Pine.GSO.4.10.10004040035420.21084-100000 at sundial...
...
> I beg to differ: it's not highly relevant. What Guido did was correct
> a *bug* in the implementation.

But *where* is the bug?  That is the question!
OK, there is currently a discrepency between
A. one sentence in the documentation
B. the implementation, another sentence in the documentation, and the books
written
by gurus Lutz, Watters, Rossum, and Ahlstrom.

> That people depended on it is sad,

Please excuse me and others for believing the cumulative evidence of B.

> and just goes to show it should be corrected ASAP before more people
depend on it.

There are two possible remedies to the conflict, not just one.
A. add 7 chars, '[, port]' , to the one sentence and leave everything else
alone [1 minute?].
B. change the implementation and break bits of code all over [days to fix
and test]

Seems reasonable to me to at least consider option A instead of B.

Terry J. Reedy






From abrahams at mediaone.net  Sat Apr 29 19:52:47 2000
From: abrahams at mediaone.net (Dave Abrahams)
Date: Sat, 29 Apr 2000 23:52:47 GMT
Subject: converting word documents to html
References: <390B501C.1891CB80@uiuc.edu>
Message-ID: 

in article 390B501C.1891CB80 at uiuc.edu, Joe Saltiel at jsaltiel at uiuc.edu
wrote on 4/29/00 4:11 PM:

> Hey,
> 
> I was wondering if anybody had done any work on converting
> word processors type documents to html.

Check out this freeware:

http://www.xwebware.com/products/rtf2html/



From aa8vb at yahoo.com  Thu Apr 20 09:39:45 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Thu, 20 Apr 2000 09:39:45 -0400
Subject: Python Parsers Comparison
Message-ID: <20000420093945.A624723@vislab.epa.gov>

I'm again faced with the "regexes not powerful enough for nested grammar"
problem, and need to chose an extension.

Does someone know of a web page or paper which compares the various Python
parser engines on a simple example grammar (or on features)?

For example, a comma-separated list of nested vectors would be a good example:

    [ 1, 2 ], [ 3, 4 ]
    [ [ 1,2 ],[ 3,4 ] ], [ 5.6 ]
    etc.

mxTextTools, metalanguage, SimpleParse, SPARK, YAPPS, PyLR, kwParsing,
PyBison.  A comparison of any subset would be useful.

Thanks,

Randall


-- 
Randall Hopper
aa8vb at yahoo.com



From sbarron at ansic.net  Fri Apr  7 10:25:13 2000
From: sbarron at ansic.net (Scott)
Date: Fri, 7 Apr 2000 14:25:13 GMT
Subject: Formatting Excel cells with PythonCOM
References: <38ECAF9D.ECA74709@ansic.net> <1k9H4.28$4v.151@news-server.bigpond.net.au>
Message-ID: <38EDEFC9.8222AEB2@ansic.net>

Hi Mark,

Wouldn't you know not 5 minutes after I posted the messag I figured it
out using the Excel VBA help.  Anyway, thanks for the information.  Btw,
I bought and read your PPW over my spring break and it helped me
tremendously, thanks!

Scott

Mark Hammond wrote:
> 
> This code is from the win32com test suite (in testMSOffice.py)
> 
>  # test dates out with Excel
>  xl.Cells(5,1).Value = "Excel time"
>  xl.Cells(5,2).Formula = "=Now()"
> 
>  import time
>  xl.Cells(6,1).Value = "Python time"
>  xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
>  xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
>  xl.Columns("A:B").EntireColumn.AutoFit()
>


From PClaerhout at CREO.BE  Tue Apr 11 05:41:13 2000
From: PClaerhout at CREO.BE (Pieter Claerhout)
Date: Tue, 11 Apr 2000 11:41:13 +0200
Subject: Redirecting the output from sys.stdout
Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7296@MSGEURO1>

Hello,

I want to run a DOS command from Python, and I want to redirect the output of
that command to a variable. Anyone a suggestion on how to accomplish this? The
output of the command should not be shown on the screen.

Kind regards,


Pieter

[ Pieter Claerhout :: CreoScitex Response Centre :: Applications support ]
[ Pieter_Claerhout at creoscitex.com    ::    http://www.creoscitex.com/ ]
[ CreoScitex Europe  ::   Excelsiorlaan 21   ::  1930 Zaventem  ::   Belgium ]




From m.faassen at vet.uu.nl  Tue Apr 18 15:49:11 2000
From: m.faassen at vet.uu.nl (Martijn Faassen)
Date: 18 Apr 2000 19:49:11 GMT
Subject: Pliant?
References: <8di0lk$4h0$1@coco.singnet.com.sg>
Message-ID: <8die7n$p4m$2@newshost.accu.uu.nl>

Ng Pheng Siong  wrote:
> Saw a reference to the language Pliant on Freshmeat today.
> Looks pretty interesting. What are your views on Pliant,
> as a Python programmer?

>From the little I've read about Pliant, cool idea, but it's just a 
bit too pliant for my software engineering taste. It'll have the same
problems Perl does -- too many ways to do it, so you can't easily
read someone else's code (or your own code some days or weeks later). 
>From that perspective something like Python's clear but fairly rigid
syntax is nice.

>From a designer's point of view, a language which can morphed into
various things is definitely cool, though.

Note that I'm talking through my hat mostly, I haven't studied Pliant
in any detail. :)

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


From wheinemanNOwhSPAM at uconect.net.invalid  Thu Apr  6 11:25:33 2000
From: wheinemanNOwhSPAM at uconect.net.invalid (wheineman)
Date: Thu, 06 Apr 2000 08:25:33 -0700
Subject: Refactoring browser for Python?
References: <16d61288.5cc55c16@usw-ex0101-005.remarq.com>
Message-ID: <19c2a6b4.30d6893e@usw-ex0103-019.remarq.com>

There seems to be some discussion of just this at WikiWiki. See

http://c2.com/cgi-bin/wiki?PythonRefactoringBrowser

and

http://c2.com/cgi-bin/wiki?BicycleRepairMan

BicycleRepairMan being the current name of the browser (highly
commendable choice). There's only talk at the moment but they are
looking for volunteers.

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From kc5tja at garnet.armored.net  Sun Apr 30 08:44:51 2000
From: kc5tja at garnet.armored.net (Samuel A. Falvo II)
Date: 30 Apr 2000 12:44:51 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <8ecsgj$6lp$1@slb0.atl.mindspring.net>  <300420001008012011%pecora@anvil.nrl.navy.mil>
Message-ID: 

In article <300420001008012011%pecora at anvil.nrl.navy.mil>, Louis M. Pecora
wrote:
>Isn't this called something like "Hungarian" variable naming?  It has

Hungarian Notation is what it's called.

>use g for global variables:  gChannel, gSocket1, etc.  I thought it was
>an aberration. Ugly!  A suffix would be much more readable:  Channelg,
>Socket1g etc.  But even then...

Suffixes are infinitely HARDER to read, because the type moniker merges into
the name of the object itself.  To use your example above, "Channelg."  Is
Channelg the English word "Channel" followed by a 'g', or is it a word in
some other language?  I can't tell.  Also, you wouldn't say things like
"Channel global" would you?  In most English speaking countries, people
would tend to say "Global Channel" instead.  Hence, gChannel.

It also defeats the whole purpose of Hungarian notation to begin with.  The
idea of Hungarian notation is to allow the programmer to determine the type
of object the symbol refers to immediately.  And since we tend to read from
left to right, it makes sense to place such information left-most (e.g., to
prepend).

The place where suffixes are best applied are in actual data types (versus
variable names).  For example, "size_t" in ANSI C.  It's the Size Type.
However, having a variable that represents the count of the bytes in an
object would be cbObject, not Object_cb.

I always use Hungarian notation when it makes sense to.  For example, if I
have a function in C that accepts a string and an explicit length argument,
I would write something like this:

	uint32 WriteData( void *buffer, char *pString, uint32 cbString )

This tells me that WriteData() takes as parameters a buffer, a pointer to a
string, and the number of bytes in the said string.  I fail to see how this
is somehow hard to read.  :)

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA


From jmg at ecs.soton.ac.uk  Mon Apr 17 13:55:23 2000
From: jmg at ecs.soton.ac.uk (Jacek Generowicz)
Date: Mon, 17 Apr 2000 18:55:23 +0100
Subject: Handling errors in open
References: <38FB4D0A.489FF50F@ecs.soton.ac.uk>
Message-ID: <38FB500B.E004558F@ecs.soton.ac.uk>

Jacek Generowicz wrote before checking his spelling:

> Hi,
>
> Is there a way to prevent a Python script from
> terminating when `open' fails, and have it handle
> the error more helpfully . . . I was thinking
> along these lines:
>
> from sys import argv
>
> try:
>     file = open(argv[1],"r")
> except IOerror:

IOError does the trick !

>
>     print "You lied about that file."
>
> Jacek



From robin at jessikat.demon.co.uk  Fri Apr 21 14:50:12 2000
From: robin at jessikat.demon.co.uk (Robin Becker)
Date: Fri, 21 Apr 2000 19:50:12 +0100
Subject: The Simple Economics of Open Source
References: <3900611F.3B525BDA@cfdrc.com> <1255786824-35980039@hypernet.com>
Message-ID: 

In article <1255786824-35980039 at hypernet.com>, Gordon McMillan
 writes
>Why does everyone miss the main point?
>
>I (and you) are literally 100s of times more productive because 
>of open source. Imagine having to either invent it all yourself, 
>or duct tape together expensive half-assed closed "solutions". 
>Shudder.

Developers who share code may actually do so for other than friendly
reasons. If M$ released win2000 source into the world it might actually
slow down Linux development.

I prefer not to worry about the exact electronics/chemistry behind my
computer. So in that sense my 'open sourceness' has limits. I guess this
argument has to do with the relative value 'developers' put on the
tools. On win32 VC++ is valuable; while gcc/egcs is really useful on
unices.
 
>
>Developers who share code are *enormously* more productive 
>than those who don't. So the range of problems that can be 
>attacked increases geometrically, so computers penetrate 
>new areas, so geeks stand a better chance of making a living.

This is a competitive position to take. Geeks presumably compete with
non-geeks for resources.

In addition the inter geek co-operation may actually be a form of
competition for other things like 'mindset' 'noosphere' etc. Painters
exchange ideas, concepts and criticism freely, but compete for
customers.

>
>Win-win situations are rarely profitably analyzed by 
>competitive models.
>
>
>- Gordon
>

Wrong! Non-zero sum games are widely studied in many areas of
mathematics, economics and control theory. Just because we can both win
doesn't mean we're not in competition. Win-Win games tend not to be so
stable as minimal-loss minimal-loss (Nash) games and for that reason are
of less interest. It requires a constant flow of information (co-
operation) to achieve best-best so that is rarely achieved or sustained.

Win-Win for the group of geeks is a sub-game in the wider community. As
a group the geeks strive to turn their knowledge into something useful
to get income. It may be that inter geek co-operation aids the group as
a whole; certainly that cannot be simply asserted as there exists a
large number of geeks who work only for $/? and who co-operate with the
prince of darkness in Seattle. I don't believe any comparative study of
commercial vs opensourcerer geeks has yet been carried out to see which
group does better.
-not to be take too serious-ly yrs- 
Robin Becker


From tim_one at email.msn.com  Thu Apr  6 22:19:00 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Thu, 6 Apr 2000 22:19:00 -0400
Subject: [Python-Dev] Round Bug in Python 1.6?
In-Reply-To: <38ED0016.E1C4A26C@tismer.com>
Message-ID: <000601bfa037$a2c18460$6c2d153f@tim>

[posted & mailed]

[Christian Tismer]
> as a side effect, I happened to observe the following rounding bug.
> It happens in Stackless Python, which is built against the
> pre-unicode CVS branch.
>
> Is this changed for 1.6, or might it be my bug?

It's a 1.6 thing, and is not a bug.

> D:\python\spc>python
> Python 1.5.42+ (#0, Mar 29 2000, 20:23:26) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> round(3.1415926585, 4)
> 3.1415999999999999
> >>> ^Z

The best possible IEEE-754 double approximation to 3.1416 is (exactly)

3.141599999999999948130380289512686431407928466796875

so the output you got is correctly rounded to 17 significant digits.  IOW,
it's a feature.

1.6 boosted the number of decimal digits repr(float) produces so that

    eval(repr(x)) == x

for every finite float on every platform with an IEEE-754-conforming libc.
It was actually rare for that equality to hold pre-1.6.  repr() cannot
produce fewer digits than this without allowing the equality to fail in some
cases.

The 1.6 str() still produces the *illusion* that the result is 3.1416 (as
repr() also did pre-1.6).

IMO it would be better if Python stopped using repr() (at least by default)
for formatting expressions at the interactive prompt (for much more on this,
see DejaNews).

the-two-things-you-can-do-about-it-are-nothing-and-love-it-ly
    y'rs  - tim





From sblakey at freei.com  Fri Apr 14 18:51:39 2000
From: sblakey at freei.com (Sean Blakey)
Date: Fri, 14 Apr 2000 15:51:39 -0700 (PDT)
Subject: for item in some_class_object...
In-Reply-To: <4j6ffs0b6ins12qq559q07u28pc6o0mc9l@4ax.com>
Message-ID: <20000414224718.D42301CD5F@dinsdale.python.org>

On 14 Apr, Ben Wolfson wrote:
> 
> What special methods should I define for a class if I want to support
> a for item in ... syntax for it?
> 
All you need to do is implement __getitem__.

>>>class Seq:
...    def __getitem__(self, i):
...        if i < 10:
...            return i
...        else:
...            raise IndexError
...
>>>s = Seq()
>>>for i in s:
>>>    print i

-- 

Sean Blakey
FreeInternet.com
sblakey at freei.com
(253)796-6500x1025




From gmcm at hypernet.com  Sun Apr  9 09:14:41 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Sun, 9 Apr 2000 09:14:41 -0400
Subject: Windows quotes (was Re: Installer Problem Finding Modules)
In-Reply-To: <8cp5d5$qcu$1@slb6.atl.mindspring.net>
Message-ID: <1256836409-30423792@hypernet.com>

Aahz Maruch wrote:

> In article <1257176798-9949680 at hypernet.com>,
> Gordon McMillan  wrote:
> >
> >Grrr. The fact that Windows allows spaces in directory names doesn't
> >mean the "feature" should be used.
> >
> >A better fix, I think, is to quote all the %s's.
> 
> I re-discovered recently that you need to use "-style quotes on Windows;
> '-style quotes don't work.

When I went to implement my proposed fix, I found it's even 
worse. Windows complains (when using os.system) if you 
quote an arg that *doesn't* contain a space. Using, of course, 
a suitably obtuse error message.

>>> os.system('"D:\\Programs\\Python\\python.exe" 
"d:\\programs\\python\\test.py"')
The filename, directory name, or volume label syntax is 
incorrect.

(Actually, it will accept quotes around the arg, but not around 
the program, unless there's a space in it.)


- Gordon



From JGRAVES3 at austin.rr.com  Fri Apr  7 08:38:44 2000
From: JGRAVES3 at austin.rr.com (Jay Graves)
Date: Fri, 07 Apr 2000 12:38:44 GMT
Subject: Searching for Python Material...
References: <8F0ED18C1joshtinamecom@209.208.0.7>
Message-ID: 

Josh Tompkins wrote in message <8F0ED18C1joshtinamecom at 209.208.0.7>...
>Buenos Dias, everyone.

Hello...

>I'm fairly new to this whole python thing.  I think that I'm getting better

If you already know some programming, Learning Python is a great book.  I
read it almost straight through, switching over to a Python interepreter
when I wanted to try something out.  Good introductory book, IMO.

>So, anyway, I was wondering if anyone could point me to some websites that
>cover material that is more advanced than the stuff in most of the
>tutorials out there.  I'm actually looking for something along the list of:
>
>to do (something cool in python) do this...
>
>where something cool in python is a variable with values such as "Accessing
>webpages and/or e-mail", "Connecting to a database", etc, while still
>keeping the deep magic stuff to a relative minimum.

Maybe the Vaults of Parnassus would be of some help.

http://www.vex.net/parnassus/

Welcome to Python...
Jay




From m.faassen at vet.uu.nl  Mon Apr 10 18:37:18 2000
From: m.faassen at vet.uu.nl (Martijn Faassen)
Date: 10 Apr 2000 22:37:18 GMT
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au>
Message-ID: <8ctl2u$bko$3@newshost.accu.uu.nl>

Richard Jones  wrote:

> [tom__98 at my-deja.com]
>> I don't know about others, but I frequently end up using
>> Perl instead of Python, even though I greatly prefer Python
>> as a language.

>    Tom you little troll-meister. Half those arguments you cite are bollocks
> if you _really_ knew and "greatly prefer" Python. Try again.

It's considered good Usenet style to include at least an attempt at
refuting arguments, instead of just saying they're bollocks. :)

Is this an example of a flaming Python advocacy as talked about earlier
in the thread? :)

PHYTON-RULZEZ!!!-ly yours,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


From michael.stroeder at inka.de  Mon Apr 17 02:22:06 2000
From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Mon, 17 Apr 2000 08:22:06 +0200
Subject: Python w/ SSL
References: <38FA3450.1DD845B2@flashmail.com>
Message-ID: <38FAAD8E.A84D6601@inka.de>

Jp Calderone wrote:
> 
>  Can anyone point me to an *up to date* Python/SSL interface?

M2Crypto on http://www.post1.com/home/ngps/m2/

Ciao, Michael.


From sholden at bellatlantic.net  Tue Apr  4 17:47:03 2000
From: sholden at bellatlantic.net (Steve Holden)
Date: Tue, 04 Apr 2000 21:47:03 GMT
Subject: complete novice question
References: <38EA5995.F7B9815D@newbridge.com>
Message-ID: <38EA6230.C6DFD7B2@bellatlantic.net>

Paul Madsen wrote:
> 
> Downloaded Python-1.5.2.
> 
> I've run 'configure' and it seems to have worked. Now, according to the
> Python package's README, I should be able to type 'make' for the rest of
> the install. If I don't have a 'make' file, did the configure portion
> not work?
> 
> thanks

Hopefully, "make" is in /usr/bin or some other path component.  It uses
"Makefile" or "makefile" in the local directory to decide what and how to
build.  Just hold your breath and type "make" at the comnmand line!

Good luck.

regards
 Steve
--
"Bulding information systems just because it's fun."
Steve Holden  sholden at bellatlantic.net  703 716 7275


From paulb at infercor.no  Mon Apr  3 08:28:15 2000
From: paulb at infercor.no (Paul Boddie)
Date: Mon, 03 Apr 2000 14:28:15 +0200
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com>  <38E52716.A1C63B5D@roguewave.com>
Message-ID: <38E88E5F.324CFB99@infercor.no>

Bjorn Pettersen wrote:
> 
> Fredrik Lundh wrote:
> >
> > Bjorn Pettersen  wrote:
> > > Just read the announcement page, and found that socket.connect() no
> > > longer takes two arguments as was previously documented.
> >
> > note that the actual reference page says that connect takes
> > just one argument, and it has done so since at least 1.4.
> 
> The reference page says connect takes address (in italics), and goes
> onto explain what it _can_ be.  I took the example to be part of the
> documentation, and specifically explaining how to use connect with the
> example's socket type.

We work in an industry where documentation often lags behind the code -
something which frequently irritates me, but then I probably do my own bit to
uphold this dubious tradition. So, when documentation is available, as it is in
this case, the developer will often breathe a sigh of relief that they will not
be obliged to read the source code, and then rely on such documentation more
than they should (as it turns out).

Socket programming, especially for anyone who tried it in C, can be daunting to
those new to the subject and it is only natural that people will make the most
out of the examples provided in order to get started. Given that the example in
the library reference (even as recently as the one provided for 1.5.2)
contradicts the supposedly correct way of calling 'connect', we can seemingly
infer that either the intention was always to support this usage of the method
in question, or that the documentation is not to be relied upon. In my
experience, systems with inadequate or inaccurate documentation suffer from a
lack of acceptance as developers fight with the "real" behaviour of the code. I
can hardly believe, though, that the purpose of the documentation is to trick
people into using the Python libraries incorrectly.

Whether or not anyone believes that examples constitute definitive
documentation, the reactions of other contributors in this thread give a useful
insight into the way people (including myself in this case) pick up assumptions
about the way things work. Personally, I tend to test my assumptions in the
interpreter and then, if they behave as anticipated, I believe my assumptions to
be valid. Perhaps this approach is quite common in the Python community, but due
to a reliance on the behaviour of possibly only one implementation of the Python
"standard" it can also be dangerous. However, it is interesting to note that
JPython 1.0.3 seems to permit multiple argument 'connect' calls as well,
although I know that JPython 1.0.3 is not exactly "current".

Paul


From raffael at mediaone.net  Thu Apr 27 22:22:06 2000
From: raffael at mediaone.net (Raffael Cavallaro)
Date: Thu, 27 Apr 2000 22:22:06 -0400
Subject: The Simple Economics of Open Source
In-Reply-To: <1255272357-66924550@hypernet.com>
Message-ID: 

> The closed source world is based on a diseased model
> (pretending software is a product).

This "diseased model" has made billions for a number of firms, so, from an
economic standpoint, your argument rings rather hollow, especially when
compared to numerous open source ventures which have yet to post a cent of
profit.


> Scarcity of an intellectual secret may make a software
> package containing that secret more valuable, but scarcity of
> a software package is likely to make it less valuable (since
> support will be hard to find, and upgrades unlikely). OTOH it's
> scarcity of a piece of artwork that makes it valuable.

You're conflating separate markets. Unique artworks (paintings, for example)
have no real equivalent in the software world, because software sales are
based on essentially unlimited identical copies.

My example referred to IP in the art world - secret working methods that
allowed artists to produce works their contemporaries could not - methods of
bronze casting, for example, or formulas for oil painting media. These IPs
are like closed source in that, without them, competitors are shut out of a
lucrative market.

My point was, and is, that it makes no economic sense to open source an IP
that could be used to create a monopoly. MS understands this, and works
ceaslessly to create such monopolies. Note that this has *nothing
whatsoever* to do with what is best for consumers. Obviously, the consumer
is better off in an open source world for two main reasons:

1. Open source leads to commodity pricing, and hence, lower costs for
consumers. Closed source leads to monopoly pricing, and higher costs for
consumers.

2. Open source leads to more robust code, and hence more reliable products,
benefiting consumers. Closed source leads to slipshod QA due to the desire
to be first to market in order to establish the monopoly. This poor QA
obviously does not benefit the consumer.

I think part of the open source community's problem is this naive belief
that just because a certain model (open source) leads to products that
benefit consumers more, markets will allow consumers to choose this
production model. This belief is naive because it fails to consider that the
producers' interests are in no way congruent with the consumer's. The
producer has every reason to go closed source and attempt to secure a quick
monopoly. We live in this world now, and there's no reason to believe that
it's going to go away any time soon. I think open source advocates grossly
underestimate the power of monopolies, and the unwillingness of consumers to
break ranks even though it *may* provide long term benefits, because
breaking ranks entails large short term costs, especially in network utility
- i.e., the loss of interoperability with the rest of the monopolist's
customers.

BTW, all software is *not* support. This is another open source community
bias which comes from living in the server room. Lots of software is
*client* software, which requires little or no support from the vendor.
Instead, these support services are provided by full time IT people, who may
be certified by the vendor, but who are paid by the enterprise. In other
words, MS makes their money on enterprise licences for Office, not for
troubleshooting the enterprise's problems with Office. For the most
lucrative software businesses, software *is* a product, not a service.

Ralph
-- 

Raffael Cavallaro, Ph.D.
raffael at mediaone.net





From gherman at darwin.in-berlin.de  Tue Apr 18 07:01:07 2000
From: gherman at darwin.in-berlin.de (Dinu C. Gherman)
Date: Tue, 18 Apr 2000 13:01:07 +0200
Subject: Beginner: string to long
References: <8dgakr$2i$1@nnrp1.deja.com>
Message-ID: <38FC4073.B272F20F@darwin.in-berlin.de>

hudson_melville at my-deja.com wrote:
> 
> I'm a very beginner, and I have a program with
> nested loops that put numeric operators (+,-) in
> a string of numbers ('3564752617') The outputs
> are similar to '3564-752+617' How do I convert it
> so it can evaluate into a long integer? Is there
> a built-in that I don't know about that would do
> this?

eval('long(3564-752+617)')
3429L

Is this what you mean?

Dinu

-- 
Dinu C. Gherman
................................................................
"The thing about Linux or open software in general is that 
it actually tries to move software from being witchcraft to 
being a science," [...] "A lot of the programs you see today 
are actually put together by shamans, and you just take it and 
if the computer crashes you walk around it three times... and 
maybe it's OK." (Linus Thorvalds, LinuxWorld 2000, NYC)


From gmcm at hypernet.com  Tue Apr 11 16:10:02 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Tue, 11 Apr 2000 16:10:02 -0400
Subject: [ANNOUNCE] Garbage collection for Python
In-Reply-To: <38F3836A.5F9A7C6F@roguewave.com>
Message-ID: <1256638692-42316420@hypernet.com>

Bjorn Pettersen wrote:

> Helge Hess wrote:

> > Also note that not only the ++ or -- needs to be protected, but the
> > '==0' check as well. Eg:
> > 
> >    [task1]            [task2]
> >    dec(obj);          inc(obj);
> 
> Note that both task 1 and task two must have a reference to the object
> for this to be possible, so the ref count must at least be two. (unless
> you're thinking of sharing names between tasks without locking -- that
> would make rc much more resource intensive...)
> 
> > could be
> >    [task1]            [task2]
> >    obj->rc--;
> >    if (obj->rc==0)
> >          obj->rc++;
> >      free(obj);       
> >    object-freed       assumes to have a valid obj
> 
> If the reference count was one, adding mutexes wouldn't help:
> 
>     aquire(obj->mutex)
>     obj->rc--;
>     if (obj->rc==0)
>       free(obj);   
>     release(obj->mutex)
> 
>                          aquire(obj->mutex)  // does it crash here
>                          obj->rc++           // or here?

The release would, except the entire scenario is hopelessly 
flawed (how does task2 get ahold of "obj" without either 
holding the lock or having the ref count already increased?).

[interlocked increment & friends]
> The api calls are direct wrappers around the processors
> increment-and-test or test-and-set instructions, and are extremely fast
> compared to a mutex solution (which makes it interesting to see other
> people on this thread claim that it would be _way_ to slow without even
> testing it...).  Our tests showed an order of magnitude difference on
> some tests...

The lightest weight synchronization primitives known to man. 
But a still a whole lot bulkier than a simple increment.

- Gordon



From arcege at shore.net  Fri Apr 21 08:31:17 2000
From: arcege at shore.net (Michael P. Reilly)
Date: Fri, 21 Apr 2000 12:31:17 GMT
Subject: How to convert GIF file(s) to MIME to be mail?
References: <38FF812F.2F34ACA1@nrlssc.navy.mil>
Message-ID: 

Paul Martinolich  wrote:
: I need to run a shell script that will convert a single or multiple
: GIF files into something I can mail to another user.

: How can python do it?

Yup, pretty easily too.  There are some nice standard modules to help
you with this.  I do it by hand often enough.

>>> import MimeWriter, base64
>>> infile = open('/tmp/world.gif', 'rb')
>>> outfile = open('/tmp/world.gif.b64', 'w')
>>> base64.encode(infile, outfile)
>>> outfile.close()
>>> infile.close()
>>> imagesize = os.path.getsize('/tmp/world.gif.b64')
>>> outmime = open('/tmp/outmail.txt', 'w')
>>> mw = MimeWriter.MimeWriter(outmime)
>>> mw.addheader('content-length', imagesize)
>>> f = mw.startbody('image/gif', [('name', 'world.gif')])
>>> outfile = open('/tmp/world.gif.b64', 'r')
>>> f.write(outfile.read())
>>> outmime.close()
>>>

Myself, I always thought the MimeWriter module was overly complicated
(especially linking it with the mimetools module) and I wrote another
module for my own uses called mimecntl.

>>> import mimecntl
>>> imagefname = '/tmp/world.gif'
>>> imagedata = open(imagefname, 'rb')
>>> md = mimecntl.MIME_recoder(image, ctype='image/jpeg')
>>> encoded = md.encode('base64')
>>> encoded['content-length'] = len(encoded) # encoded data size
>>> outmime = open('/tmp/outmail.txt', 'w')
>>> outmime.write( str(encoded) )
>>> outmime.close()
>>>

Making multipart MIME messages instead is as easy as making a list of
them:
>>> second_encoded = mimecntl.MIME_recoder(
...   image2, ctype='image/jpeg').encode('base64')
>>> second_encoded['content-length'] = len(second_encoded)
>>> msg = mimecntl.MIME_document( [encoded, second_encoded] )
>>> outmime = open('/tmp/outmime.txt', 'w')
>>> outmime.write( str(msg) )
>>> outmime.close()

You can find the mimecntl module at
.

  -Arcege



From johngrayson at home.com  Mon Apr 24 11:02:59 2000
From: johngrayson at home.com (johngrayson at home.com)
Date: Mon, 24 Apr 2000 15:02:59 GMT
Subject: Tkinter bind of class -- help
References: <39027BE6.8DF89328@flash.net>
Message-ID: <8e1nmq$ki2$1@nnrp1.deja.com>

In article <39027BE6.8DF89328 at flash.net>,
  Cindy Huyser  wrote:
> I've created a class that contains a number of Canvas widgets inside
> frames.  When I import this class and instantiate it in my main
program
> I put it inside a frame.
>
> What I would like to do is to get x,y coordinate information on events
> (either  or ) that occur in the area occupied by the
> class instance so that I can display detail information in another
area
> of the main window.  At first, I tried to use bind() on the class
> instance, but received an error.  I have tried callbacks from the
frame
> in which the object resides, but find I only get event information for
> that area unoccupied by the object; I have tried looking at
information
> stored in a member variable of the class, but have found the response
> unacceptably slow.
>
> Any suggestions for solving this problem would be greatly appreciated
by
> this newbie Tkinter programmer.
>

Without seeing your code, it is a little difficult to
see what you're trying to achieve. However, here is
some sample code that does something along the lines
of your explanation:

from Tkinter import *

root = Tk()
root.title('Canvas Info')

class MakeWindows:
    def __init__(self, parent):

	f1 = Frame(root)
	Label(f1, text='x,y: ').pack(side=LEFT, padx=10)
	self.coord = StringVar()
	Entry(f1, textvariable=self.coord).pack(side=LEFT, anchor=W)
	f1.pack(padx=10, pady=10)

	self.subWin = Toplevel(root, width=500, height=500)
	self.grid = Frame(self.subWin)

	for row in range(5):
	    for col in range(5):
		f = Frame(self.grid, borderwidth=2, relief=GROOVE)
		item = Canvas(f, width=90, height=90)
		item.bind('', lambda e, s=self, i=item:
                           s.info(e, i))
		item.pack(fill=BOTH, expand=YES)
		f.grid(row=row, col=col, sticky=NSEW)
        self.grid.pack()

    def info(self, event, item):
	print 'Canvas ID =', item
	self.coord.set('%d:%d' % (event.x, event.y))

c=MakeWindows(root)

root.mainloop()


Sent via Deja.com http://www.deja.com/
Before you buy.


From rcc at nospamthanks_jennic.com  Fri Apr 14 12:07:46 2000
From: rcc at nospamthanks_jennic.com (Robert Cragie)
Date: Fri, 14 Apr 2000 16:07:46 GMT
Subject: List mapping?
References:   
Message-ID: 

Remco Gerlich  wrote in message
news:slrn8fc4eu.1d0.scarblac-spamtrap at flits104-37.flits.rug.nl...
| Robert Cragie wrote in comp.lang.python:
| > > Howcome you use reduce at all?
| > >
| > > Works fine with just doing
| > >
| > > tuplist = map(lambda x: (mylist[x], mylist[x+1]), range(0,
len(mylist),
| > 2))
| >
| > Yep, that's neater. My excuse is that I've only been learning Python for
a
| > couple of weeks...
|
| In that case, forget you ever read something about map, lambda and reduce.
| Save it for later and code nice for loops now. 95% of the time, those
things
| only obfuscate code anyway.

'map' and 'reduce', perhaps. I think 'map' is syntactically neat for some
things, and not too confusing.
'lambda' is very useful, but, I think, quite confusing in its use, which is
partly why I did not see the simpler solution.

Robert Cragie





From tim_one at email.msn.com  Sun Apr  2 01:18:21 2000
From: tim_one at email.msn.com (Tim Peters)
Date: Sun, 2 Apr 2000 01:18:21 -0500
Subject: Debugging confusion -- too many stacks!
In-Reply-To: <7cjF4.60441$3b6.236709@ozemail.com.au>
Message-ID: <000a01bf9c6b$3f80c2a0$752d153f@tim>

[Jason Stokes]
> I'm confused about the difference between the C stack, the Frame
> stack, and the stack *inside* each execution frame.

The difference between the first two is an artifact of the current
implementation; indeed, getting rid of the distinction is the major point of
Christian Tismer's "Stackless" Python variant (where "less" refers to
getting rid of the C-stack component).

> From reading the source, I believe that each new code object gets a new
> frame allocated on the frame stack,

Each *invocation* of a code object, yes; and, e.g., if a function calls
itself recursively, there's only one code object but a separate frame for
each call level.

Note that in CT's Stackless Python, the frames actually form a tree
(although at any leaf, the path back to the root is unique and can be viewed
as a stack).

> within which is stored all kinds of useful information about the
> context the code is executing in -- the global and local environment,
> a tuple of constants, a tuple of arguments etc.  *Within* each frame
> is *another* stack, upon which the Python virtual machine loads and
> manipulates intermediate values.

This is another artifact of the current implementation, and is best viewed
as an internal detail of no visible consequence.

> However, I'm not sure what the terminology is to refer to this
> third stack.

"The frame's eval stack" works for me .

> Understanding the distinction seems to be vital to using pdb, though.

I don't use pdb much, but don't see why this would be true.  The frame's
eval stack is invisible, and the C and frame stacks happen to be intertwined
one-for-one today because a Python call happens to invoke the interpreter
recursively (at the C level) today.  Conceptually, there's only one stack
involved in calls.

Perhaps you could be specific about what in pdb is confusing you, and
someone who uses it could straighten it out.

or-maybe-not-ly y'rs  - tim





From jvickroy at sec.noaa.gov  Mon Apr 17 09:36:53 2000
From: jvickroy at sec.noaa.gov (j vickroy)
Date: Mon, 17 Apr 2000 07:36:53 -0600
Subject: read/write file problem
Message-ID: <38FB1375.2FF65B96@sec.noaa.gov>

Hello all,

I am attempting to read and, subsequently, write a jpeg file.
The following interactive session illustrates the problem I am having
(i.e., if the source file is read byte-by-byte into memory and
subsequently
rewritten using the file.write() method, only the initial portion of the

file appears to be written).
How should I be doing this in Python 1.5.2.

Thanks for your time.


>>> import os.path
>>> file_name = 'd:/p1010001.jpg'
>>> source_byte_cnt = os.path.getsize (file_name)
>>> print source_byte_cnt
381965
>>> buf = []
>>> file = open (file_name, 'r')
>>> for i in xrange (0,source_byte_cnt):
...  buf .append (file .read(1))
...
>>> file .close()
>>> print len (buf) == source_byte_cnt
1
>>> file_name = 'd:/test.jpg'
>>> file = open (file_name, 'w')
>>> for i in xrange (0,source_byte_cnt):
...  file .write (buf[i])
...
>>> file .close()
>>> target_byte_cnt = os.path.getsize (file_name)
>>> print target_byte_cnt
70
>>> file = open (file_name, 'w')
>>> for i in xrange (0,source_byte_cnt):
...  file .write (str(buf[i]))
...
>>> file .close()
>>> target_byte_cnt = os.path.getsize (file_name)
>>> print target_byte_cnt
70
>>>




From paul.magwene at yale.edu  Mon Apr 17 16:23:12 2000
From: paul.magwene at yale.edu (Paul Magwene)
Date: Mon, 17 Apr 2000 16:23:12 -0400
Subject: Handling errors in open
References: <38FB4D0A.489FF50F@ecs.soton.ac.uk>
Message-ID: <38FB72B0.D929B73F@yale.edu>

Jacek Generowicz wrote:
> 
> Hi,
> 
> Is there a way to prevent a Python script from
> terminating when `open' fails, and have it handle
> the error more helpfully . . . I was thinking
> along these lines:
> 
> from sys import argv
> 
> try:
>     file = open(argv[1],"r")
> except IOerror:
>     print "You lied about that file."
> 
> Jacek


Yes, that works...? (slightly confused because you seem to have found
your own answer, yet you still posted the question.  Are you looking for
alternative ways to do this?)

--Paul


From amused at webamused.com  Tue Apr 25 22:00:08 2000
From: amused at webamused.com (Joshua Macy)
Date: Wed, 26 Apr 2000 02:00:08 GMT
Subject: mxODBC error trapping
References: 
Message-ID: <390640A8.F1392B0F@webamused.com>

"Daley, MarkX" wrote:
> 
>
> Traceback (innermost last):
>   File "", line 1, in ?
>     collect.collect()
>   File "C:\PROGRA~1\Python\collect.py", line 50, in collect
>     except dbi.OperationalError:
> AttributeError: OperationalError
> 
> Here is the printout of the dbi module:
> 
> ['DATE', 'NUMBER', 'RAW', 'ROWID', 'STRING', 'TYPES', '__doc__', '__file__',
> '__name__', 'dataError', 'dbDate', 'dbRaw', 'dbiDate', 'dbiRaw',
> 'integrityError', 'internalError', 'noError', 'opError', 'progError']
> 
>


  According to the dbi module dictionary (which you've printed), it
looks like it should be opError, not OperationalError.  Or you could
just use an unqualified except, and be sure of catching any error that
the dbi can raise.

 Joshua


From lf11 at deletethistomailme.andonet.com  Tue Apr  4 16:39:41 2000
From: lf11 at deletethistomailme.andonet.com (lf11 at deletethistomailme.andonet.com)
Date: Tue, 04 Apr 2000 15:39:41 -0500
Subject: GTK Referenc
References: <38E7A868.A1C9BD7C@searchy.net>
Message-ID: <8cdjcb$g8h$1@news.kersur.net>

In article , 
bhoel at starship.python.net (Berthold H?llmann) wrote:
> Penpal International  writes:
> 
>> I couldn't find anywhere a reference for the GTK module for Python. Does
>> anyone know one?
>> On gtk's site I could only find some for C(++).
> 
I don't know how experienced you are with Python.  I started playing 
with PyGTK, having absolutely no previous experience with Python.  
That method of learned is Not Recommended.

If you 'import gtk' instead of 'from gtk import *', you will import the 
complete function names.  The syntax of this is _very_similar_ to C GTK.  
In fact, it's almost identical.

Example with 'import gtk' (looks like C)
button = gtk_button_new_with_label('Button')

Example with 'from gtk import *' (faster to type, more Python-ish)
button = GtkButton('Button')

Both do the same thing.  I would recommend using 'import gtk' until you 
know more about it.  Since the syntax is so similar between Python and C, 
I simply use the C GTK reference from www.gtk.org.

A bunch of examples come with PyGTK, notably "testgtk.py".  I learned 
a lot (and am learning a lot) from that script.

Hope this helps,

 -lf


From sblakey at freei.com  Thu Apr 27 19:03:24 2000
From: sblakey at freei.com (Sean Blakey)
Date: Thu, 27 Apr 2000 23:03:24 +0000
Subject: run detached
References: <3908B8CB.97A0755D@inka.de>
Message-ID: <3908C73C.420BF3B7@freei.com>

Michael Str?der wrote:
> 
> HI!
> 
> How can I automatically detach from console after starting up with
> SocketServer? (E.g. web server with access and error logging to
> files.)
> 
> Ciao, Michael.
> --
> http://www.python.org/mailman/listinfo/python-list
I think what you want is a daemon process (I assume you are looking for
the Unix answer since you are posting from a linux email client).

Starting a daemon requires the same steps in any language:
1. Fork from the parent tty.
2. Exit the parent process (all further steps occur in the child
process).
3. Call setsid() to put your child process in a new process group.
4. Redirect stdin, stdout, and stderr to /dev/null (or a file of your
choice)
5. chdir to / (not strictly necessarry, but polite).
In python , it looks like this (assuming main() is your code):

import os
import sys
if os.fork():
	sys.exit(0)	# In parent process
else:
	os.setsid()
	sys.stdin = open('/dev/null')
	sys.stdout = open('/dev/null', 'w')
	sys.stderr = open('/dev/null', 'w')
	os.chdir('/')
	main()

I have been playing with creating an object wrapper for daemon
processes, and this may be useful to you (it's still pretty raw).  If
you want, you can check it out at http://members.home.com/seanb/python/
-- 
Sean Blakey
FreeInternet.com
sblakey at freei.com
(253)796-6500x1025



From infotechsys at pivot.net  Sun Apr 23 11:00:51 2000
From: infotechsys at pivot.net (Wayne)
Date: Sun, 23 Apr 2000 11:00:51 -0400
Subject: Off topic - But would like tour advice.
Message-ID: <39031023.B12ABF56@pivot.net>

Hi,
I'm using Python with Tkinter  to gather information pertaining to a
invoice.
I learnt groff/troff with tbl, pic and eqn to print said invoice. I will
be going to XML
and dsssl using jade but time is against me right now. My plan for
printing
the invoice is to take the groff file, which is a template with lots of
tags in the invoice ,
 and pass it thru re, substuting  the values I gather from the GUI
interface
into the template replacing the tags. Then use the os module to print
the invoice. Is this
a method that would be used to print the invoice? Or is there a standard
way of doing
something like this?
TIA
Wayne

P.S.   I'm using pic to design my invoice.




From MSteed at altiris.com  Fri Apr  7 15:14:45 2000
From: MSteed at altiris.com (Mike Steed)
Date: Fri, 7 Apr 2000 13:14:45 -0600 
Subject: anyone else wrap gd-1.8?
Message-ID: <65118AEEFF5AD3118E8300508B1248774CB282@ALTNET>

On a semi-related note, I have wrapped (without SWIG) gdchart, a library for
making charts and graphs, which uses gd.  I have a new version (to be posted
Real Soon Now) that uses gd-1.8, with support via the Python interface for
PNG and JPEG output.  There is an entry in the Vaults of Parnassus.

Mike
msteed at altiris.com

> From: musingattheruins at my-deja.com 
> [mailto:musingattheruins at my-deja.com]
> Sent: Friday, April 07, 2000 12:57 PM
> To: python-list at python.org
> Subject: Re: anyone else wrap gd-1.8?
> 
> 
> Yeah, I wrapped it but did not use SWIG so it took longer than 1.25
> hours.  It's available with source for Win32 at
> http://musingattheruins.homepage.com/PythonGD.html
> 
[...]
> 
> 
> In article ,
>   Les Schaffer  wrote:
> > I just wrapped the latest gd module -- version 1.8 which now handles
> > both png and jpeg file formats -- into python. It was quite 
> easy with
> > SWIG.
> >
> > I noticed the gdmodule link on
> >
> > http://www.python.org/topics/scicomp/plotting.html
> >
> > is dead. has anyone else wrapped gd up lately? otherwise i 
> am happy to
> > distribute (all 1.25 hours of my accumulated time :-)
[...]



From gmcm at hypernet.com  Sun Apr 23 09:11:20 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Sun, 23 Apr 2000 09:11:20 -0400
Subject: code not true?
In-Reply-To: 
References: 
Message-ID: <1255627015-45592331@hypernet.com>

Michal Wallace wrote:

> On Sun, 23 Apr 2000, Kragen Sitaker wrote:
> > That said, it *is* just a speed issue --- there are representations
> > other than floating point, like the ordered-pair rational-number
> > representation, that give the right answer but are slower to work
> > with.
> 
> But... Python is a scripting language.. It's okay to be slow.  

It's not just a scripting language. Because numbers are 
objects (not primitives), Python is already slow in doing math, 
and the cumulative complaints about that are voluminous.

> From
> what I'm hearing, many people on this list shy away from floats simply
> because of the innacuracy.. Why don't we use the way that gets the
> right answer?

Some tech magazine columnist observed that there are 3 
types of float users: 
 1) those who think it's easy, 'cause they're just like ints
 2) those who think it's hard, 'cause they're nothing like ints
 3) those who really know.

We've got exactly one 3 (and he's busy - having just bought a 
CDROM with 660M of one-time pad ). The transition 
from 1 to 2 is hard (as witnessed by this thread). But once 
you're a 2, it's not that hard to learn to use floats sanely.

The theoretically correct alternative is rationals. But they're 
slow and use unpredictable amounts of memory. I think 
Python should have BCD as an alternative. While slow, they're 
predictable in memory use, and the mathematical 
shortcomings they have are exactly those that a naive user 
expects.

But I, despite being in category 2 for close to 20 years, 
definitely don't want to be without floats.



- Gordon



From mwh21 at cam.ac.uk  Tue Apr 11 07:22:00 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 11 Apr 2000 12:22:00 +0100
Subject: Modifying "traceback" objects
References: <20000406075124.A1848828@vislab.epa.gov>
Message-ID: 

Randall Hopper  writes:

>      Is it possible to add frames to the current traceback object from
> inside a C extension?

I'd say it would be difficult.  What would you put in the "f_code" field?

Would

PyThreadState *tstate = PyThreadState_GET();
PyFrameObject* f = PyFrame_New(
		tstate,			/*back*/
		co,			/*code*/
		globals,		/*globals*/
		locals);		/*locals*/
if (f == NULL)
	return NULL;

tstate->frame = f;

be sufficient? (If you can cook up values for co, globals & locals).

Maybe:

int
PushFrame(char* func_name,char* filename,int lineno)
{
    PyThreadState *tstate = PyThreadState_GET();
    PyFrameObject* f;
    PyObject *emptytuple;
    PyObject *emptydict;
    PyObject *co;

    emptydict = PyDict_New();
    emptytuple = PyTuple_New(0);

    co = PyCode_New(0,0,0,0,"",
                    emptytuple,emptytuple,emptytuple,
                    filename,func_name,lineno,"");

    if (co == NULL) return 0;

    f = PyFrame_New(
                tstate,                 /*back*/
                co,                     /*code*/
                emptydict,              /*globals*/
                emptydict);             /*locals*/

    Py_DECREF(emptydict);
    Py_DECREF(emptytuple);
    Py_DECREF(emptytuple);

    if (f == NULL) return 0;

    tstate->frame = f;

    return 0;
}

to be used like:

    ...
    if (!PushFrame("frob",__FILE__,__LINE__)) return NULL;
    ...

though the above is monumentally untested (does it compile? I don't
know!).

Cheers,
M.

-- 
  On the other hand,  the following areas are subject to boycott
  in reaction to the rampant impurity of design or execution, as
  determined after a period of study, in no particular order: 
    ...                            http://www.naggum.no/profile.html


From effbot at telia.com  Wed Apr 26 13:42:41 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Wed, 26 Apr 2000 17:42:41 GMT
Subject: Simple del[] list question
References: 
Message-ID: 

Matthew Hirsch  wrote:
> What is going on here?
>
> This leaves a intact.
>
> >>> a=[[1,2,3],[4,5,6]]
> >>> b=a[:]
> >>> del b[0]
> >>> b
> [[4, 5, 6]]
> >>> a
> [[1, 2, 3], [4, 5, 6]]
>
>
> This also changes a.
>
> >>> a=[[1,2,3],[4,5,6]]
> >>> b=a[:]
> >>> del b[0][0]
> >>> b
> [[2, 3], [4, 5, 6]]
> >>> a
> [[2, 3], [4, 5, 6]]
>
> Why did a change?  Why suddenly when you go to two dimensions does the
> behavior change?

[:] makes a *shallow* copy.  it doesn't copy the sublists.






From aa8vb at yahoo.com  Fri Apr 14 08:40:23 2000
From: aa8vb at yahoo.com (Randall Hopper)
Date: Fri, 14 Apr 2000 08:40:23 -0400
Subject: Python idiom: Multiple search-and-replace
In-Reply-To: <0s1J4.655$rc9.190631424@newsb.telia.net>
References: <20000412100816.A2431031@vislab.epa.gov>
 <5C%I4.645$rc9.190288896@newsb.telia.net>
 <20000412120012.D2446939@vislab.epa.gov>
 <0s1J4.655$rc9.190631424@newsb.telia.net>
Message-ID: <20000414084023.A2012@vislab.epa.gov>

Fredrik Lundh:
 |Randall Hopper  wrote:
 |> Thanks!  It's much more efficient.  The 140 seconds original running time
 |> was reduced to 11.6 seconds.  I can certainly live with that.
 |
 |thought so ;-)
 |
 |while you're at it, try replacing the original readline loop with:
 |
 |    while 1:
 |        lines = fp.readlines(BUFFERSIZE)
 |        if not lines:
 |            break
 |        lines = string.join(lines, "")
 |        lines = re.sub(...)
 |        out_fp.write(lines)
 |
 |where BUFFERSIZE is 1000000 or so...

Elapsed: 2.7118 sec.  76% speedup.  98% speedup overall.

Thanks again Fredrik!

It's hard to believe we're burning 8.9 sec out of 11.6 seconds (77%) just
in the simple loop overhead of iterating over lines.  Where's that JIT
Python interpreter when you need it ;-)  

Seriously, it would be pretty spiffy if Python could compile the inner loop
to machine code on the Nth iteration (N is some bite-the-bullet threshold),
and reuse it for all subsequent iterations.  I know the dynamic nature of
the language complicates the analysis, but if it detects no strange
rebinding (string.join being redefined, etc.), seems like it'd be a real
win.

-- 
Randall Hopper
aa8vb at yahoo.com



From jbauer at rubic.com  Tue Apr  4 20:16:39 2000
From: jbauer at rubic.com (Jeff Bauer)
Date: Tue, 04 Apr 2000 19:16:39 -0500
Subject: Starving for an Advanced Python Book
References: <20000404231358.17447.qmail@web2105.mail.yahoo.com> <38EA7EE1.457A5533@roguewave.com>
Message-ID: <38EA85E7.38C7BACE@rubic.com>

Bjorn writes a glowing recommendation of eff-bot's book:
> At $12.00 I would say the book is a steal and 
> contains a wealth of information no serious Python 
> programmer should be without :-)  And if you're 
> like me, you'll print it out, bind it at Kinko's,
> and place it half way between your Linux and win2k
> boxes .

I would second Bjorn's recommendation.  It's a useful
book for anyone who writes Python code and wants quick 
access to library examples.

That said, the electronic distribution mechanism
will try your patience.  When you get it to work, 
the first thing you'll want to do is follow Bjorn's
advice and print it.

purchasing-the-book-is-like-taking-a-test-but-it's-
  all-downhill-from-there-ly y'rs,

Jeff Bauer
Rubicon



From wware at world.std.com  Sat Apr 15 08:32:17 2000
From: wware at world.std.com (Will Ware)
Date: Sat, 15 Apr 2000 12:32:17 GMT
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <38F826CF.DBDC71EF@zipzap.ch>
Message-ID: 

Boris Borcic (zorro at zipzap.ch) wrote:
> Just van Rossum wrote:
> > 
> > - Will Ware and I have worked hard on a complete rewrite of the
> >   uthread module. It is a *vast* improvement over the old one.
> >   It offers a very nice thread object and several handy threading
> >   widgets. It already can do stuff threading.py can only *dream*
> >   about, like pausing (blocking) a thread from another thread or
> >   posting an exception from another thread (!).

> Simple examples of useful new idioms that this permits ?

As far as programming idioms, you can get a sense of some of them
from the manual for the previous version of microthreads:
http://world.std.com/~wware/uthread.html

The examples in the manual run with almost no changes in the new
version. The timer has changed a bit, it now counts real milliseconds
rather than the fairly arbitrary context switches. There are also a
few new widgets that aren't in the manual yet.

As far as real applications, Just's MacPython IDE is the only real
one thusfar. I've been thinking about doing a Pacman game (one
microthread for each moving monster, and one for the Pacman) but I
haven't found the time yet. My original interest in microthreads was
to support simulations with large numbers of simultaneously interacting
agents (without having to write each agent's behavior in some ugly
form with explicit context switching).
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com


From rumjuggler at home.com  Wed Apr 26 18:39:10 2000
From: rumjuggler at home.com (Ben Wolfson)
Date: Wed, 26 Apr 2000 22:39:10 GMT
Subject: first non-trivial python program
Message-ID: 

Is a translation and expansion of a C++ program I wrote to learn about
the STL and generally expand my C++-ish knowledge.  Anyway, the Python
version is 700+ lines long; would it be considered rude to post it
here for helpful advice?

-- 
Barnabas T. Rumjuggler

A cucumber should be well sliced, and dressed with pepper and vinegar,
and then thrown out, as good for nothing.
 -- Samuel Johnson


From aahz at netcom.com  Sat Apr 15 17:55:53 2000
From: aahz at netcom.com (Aahz Maruch)
Date: 15 Apr 2000 21:55:53 GMT
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <87em8ccywq.fsf@deneb.cygnus.argh.org> <8d01iu$ca0$1@slb2.atl.mindspring.net> 
Message-ID: <8daoh9$kt8$1@slb7.atl.mindspring.net>

In article , Erno Kuusela   wrote:
>>>>>> "Aahz" == Aahz Maruch  writes:
>
>    >>  Yes.  AFAIK, Python doesn't perform well in a SMP environment,
>    >> because the interpreter only runs on one CPU at a given time,
>    >> even if you create multiple Python threads.
>
>    Aahz> That is true if you stick to pure Python code and extensions
>    Aahz> that don't release the global interpreter lock.  For
>    Aahz> example, if you're using HTTP, the socket library releases
>    Aahz> the global lock and threads are extremely effective.
>
>this won't help much if you would like your code to run on multiple
>cpu:s at once, since socket and file io are not cpu intensive.
>
>i bet switching to another cpu for doing the socket call while letting
>other python threads execute pyth code would decrease performance,
>as moving the thread to another cpu probably costs more than a
>socket syscall.

You don't "move" the thread to a different CPU; the OS handles the
thread scheduling.  And while what you say is true for a single socket
call, it's much less true for a group of fifty or a hundred threads each
doing intensive socket calls.

Also, while I'm talking about the easiest way to get useful threading
out of Python, do keep in mind that *any* extension that releases the
global lock can process in parallel.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac,
and Ritalin?  --Aahz


From greg at cosc.canterbury.ac.nz  Wed Apr 19 23:57:38 2000
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Thu, 20 Apr 2000 15:57:38 +1200
Subject: Mac Python Questions
References: 
Message-ID: <38FE8032.DE233C29@cosc.canterbury.ac.nz>

Jeff Massung wrote:
> 
> b) No matter what I do, I can't get Tkinter to work :(.

Neither can I, and from what I've seen here, neither
can anyone else. Tkinter just seems to be broken on
the Mac at present.

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+


From quinn at groat.ugcs.caltech.edu  Mon Apr  3 06:02:06 2000
From: quinn at groat.ugcs.caltech.edu (Quinn Dunkan)
Date: 3 Apr 2000 10:02:06 GMT
Subject: Pass by reference ?
References: <38E864C9.E1EE94F7@ecs.soton.ac.uk>
Message-ID: 

On Mon, 03 Apr 2000 10:30:49 +0100, Jacek Generowicz 
wrote:
>Hi,
>
>I'm just trying to familiarize myself with Python.
>In Magnus Lie Hatland's Instant Python, he
>mentions that `all parameters in Python are passed
>by reference'.
>
>So I tried the following code:
>
>#!/usr/bin/python
>
>def increment(x):
>    x = x + 1
>    return x

This makes a *new* local x, which disappears when it goes out of scope.
Whenever you write " = " python *always* makes a new local binding
of blah to var, unless you've got a "global " up there somewhere.

You can't modify numbers in python anyway (they're immutable, just like
strings).  Try it with a mutable object like a list to see 'pass by reference'
behaviour:

>>> def addelt(lst, x):
...     lst.append(x)
...
>>> a = [0, 1]
>>> addelt(a, 5)
>>> a
[0, 1, 5]


From gmcm at hypernet.com  Wed Apr 26 15:27:23 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 26 Apr 2000 15:27:23 -0400
Subject: Simple Function Question
In-Reply-To: <8e7dh3$1gc@autodesk.autodesk.com>
Message-ID: <1255345248-62540224@hypernet.com>

Akira Kiyomiya wrote:

> Hi,  Could you explain this in dummy's language?
[snip]
> # Return a function that returns its argument incremented by 'n'
> def make_incrementer(n):
>     def increment(x, n=n):
>         return x+n
>     return increment
> 
> add1 = make_incrementer(1)
> print add1(3)  # This prints '4'

When you call make_increment, the inner "def" is executed; 
(the "def" for make_increment was executed once, when the 
module / script was first loaded). The inner "def" uses a 
default argument (evaluated when make_increment is called) 
to store the value of n in the newly created function object.

If you execute add2 = make_increment(2), you'll find that 
add1.__name__ and add2.__name__ are both "increment", 
but they are different function objects, and the name 
"increment" is actually a local name to make_increment, (it 
doesn't make it to the global namespace).

- Gordon



From garabik at melkor.dnp.fmph.uniba.sk.spam  Mon Apr  3 07:43:44 2000
From: garabik at melkor.dnp.fmph.uniba.sk.spam (Radovan Garabik)
Date: 3 Apr 2000 11:43:44 GMT
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com>  <38E58D2D.384F1546@Lugoj.Com>  <38E6B929.28816494@roguewave.com> 
Message-ID: <954762216.922508@cdwork.cvt.stuba.sk>

Fredrik Lundh  wrote:
 : Bjorn Pettersen wrote:
 :> I haven't seen anyone claim that examples in the manual are not
 :> documentation...

 : in earlier releases of the library reference, some examples
 : didn't even work.  you still think they're formally binding?

 :> It would be very nice if "someone" could do that, but based on the
 :> rethoric I've seen from you on this issue, and the absence of comment
 :> from Guido, I certainly don't feel confident that it would be accepted.

 : you don't know that until you've tried it...

 : you may have to work on your presentation, though. thinking
 : about the following may help you come up with a stronger case:

 : -- how does typical socket.connect code look?

s.connect(addr, port)

 : -- what exception do you get after this change?  how
 :    does the error message look?  can anyone else figure
 :    out what's wrong?

 : -- is there any chance that people might be expecting
 :    the resulting exception from socket.connect (or the
 :    code invoking it)?  or in other words, is it likely that
 :    there will be a try/except clause around the call, that
 :    will misbehave (thus hiding the actual error message)?

well, I am bitten by this....
I use try/except around socket.connect, and this change would break some of
my scripts (but fixin them takes about 2 minutes, so I am not complaining
much)


 : -- can anyone but the original author fix the problem
 :    without breaking the program?

write a wrapper function around socket.socket.... not too difficult

 : when you've done this, replace "socket.connect" with
 : "list.append", and try again.

I never used multiple arguments in list.append...



-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!


From sheacouture at hotmail.com  Mon Apr 10 00:17:02 2000
From: sheacouture at hotmail.com (SheaMon)
Date: Sun, 09 Apr 2000 21:17:02 -0700
Subject: need help just begining
Message-ID: <11822ca0.dd34a400@usw-ex0109-068.remarq.com>

Hi everyone,
My name is Shea and I am just starting out on programming.
I know not one thing about it, and a person told me to try
Python programming. But I have not idea what to do to start
making a program.

I main question is this. If i got a copy of this tutor can
I just leave the numbers and stuff like that and just edit
the rest? I get so lost in the number part of the
programming. If anyone here has some time can you please
help me and email me at my address here.

thanks.
Shea
SheaCouture at hotmail.com


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


From scarblac-spamtrap at pino.selwerd.nl  Fri Apr 28 07:58:56 2000
From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich)
Date: 28 Apr 2000 11:58:56 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <280420000746597329%pecora@anvil.nrl.navy.mil>
Message-ID: 

Louis M. Pecora wrote in comp.lang.python:
> > You *can* use another word for 'self' though, 's' or 'me' or something. But
> > it makes your code harder to read, of course...
> 
> You mean by doing something like
> 
> s=self

No, you can just declare methods like

class Foo:
   def Method(s,x):
      s.y = x

The name 'self' is just a convention.

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
This space intentionally left blank.


From cbwles at hotmail.com  Mon Apr 17 13:36:22 2000
From: cbwles at hotmail.com (cbwles at hotmail.com)
Date: Mon, 17 Apr 2000 17:36:22 GMT
Subject: BLUEMOUNTAIN SUCKS!!!!  7474
Message-ID: 

Bluemountains cards are all the same.  Boring.  I like www.cardgirl.com.   I think the cards are much better.  I dont get how cardgirl.com keeps it totally free.  They dont even have those annoying banners.  
   If anyone knows any other cool greeting card sites, please list them in a reply.  I will start the list with www.cardgirl.com
btlfdtvdfewplvydvytlqgbgourrqwzmczkiqkffvtnfvwzqjzwgue



From sabren at manifestation.com  Wed Apr 12 12:48:40 2000
From: sabren at manifestation.com (Michal Wallace (sabren))
Date: Wed, 12 Apr 2000 12:48:40 -0400 (EDT)
Subject: ANN: botlib 0.1 !
In-Reply-To: 
Message-ID: 

On Wed, 12 Apr 2000, Oleg Broytmann wrote:

> least two - I want a threading robot, but much more than that I want an
> asyncore-based robot. I haven't done anything yet; it seems I need to
> rewrite the entire urllib to use asyncore, and it is hard work. Anyway I

Yes, I came to the same conclusion.. You have to rewrite just about
everything.. Though I'm thinking urllib2 can make the job it easier.
Anyway, I decided to take a stab at it, and used the example in the
asyncore docs to create something that does a good chunk of the job:

-----------------------------
announcing botlib 0.1!!!!!!!!
-----------------------------

The botlib module contains two classes: UniBot and MultiBot.

UniBot fetches a single URL.  It's http only, no authentication, no
redirects, etc, BUT: it allows you to specify a timeout down to
fractions of a second.

MultiBot fetches multiple URLS at once. You tell it which urls to
get, and which functions to call for each one once the content is
fetched.

Here's two quick examples:

    #####################

    import botlib

    bot = botlib.UniBot()
    content = bot.fetch('http://www.python.org/')

    #####################


and:

    #########################

    import botlib

    def callback(url, contents, extras):
        print url, 'is this big:', len(contents)

    queen = botlib.MultiBot()
    queen.fetch('http://www.python.org/', callback)
    queen.fetch('http://www.linkwatcher.com/', callback)
    queen.fetch('http://www.sabren.com/', callback)
    queen.loop()
    
    #########################


Anyway, it's far from perfect... The methods and stuff might change
completely, especially once more of the urllib2 features get worked
in... but it is a start.

check it out at: http://www.linkwatcher.com/src/botlib.py

Feedback welcome!

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------






From cut_me_out at hotmail.com  Wed Apr 26 18:53:12 2000
From: cut_me_out at hotmail.com (Alex)
Date: 26 Apr 2000 18:53:12 -0400
Subject: plugins for browsers?
References: <3904ccb0.32134281@news.demon.co.uk>
Message-ID: 

> Are there any plugins or other means of running Python in Web
> browsers?

I guess if you're using Netscape, you can specify the command yourself.
Go to Edit -> Preferences, then in the dialogue that brings up, go to
Navigator -> Applications.  Then go to New, and in the dialogue that
brings up, enter .py as the suffix, and python %s as the command.

Don't know if that helps at all.

Alex.


From moshez at math.huji.ac.il  Mon Apr 10 01:11:54 2000
From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Mon, 10 Apr 2000 07:11:54 +0200 (IST)
Subject: Migrating Tcl system to Python
In-Reply-To: <248819a8.00d5228e@usw-ex0106-045.remarq.com>
Message-ID: 

On Sun, 9 Apr 2000, Hamish Lawson wrote:

> The systems will be on Linux so COM is out but the rest are
> possibilities. As far as I can see, one of the main issues in
> communicating between Tcl and Python will be how to handle
> passing lists and dictionaries (arrays in Tcl). XML-RPC manages
> this automatically and although I don't have any experience with
> either CORBA or ILU, I imagine they do too. If I were to use a
> pipe approach, there would presumably be a need for a layer to
> translate between Tcl's and Python's representations of data
> structures; though I think this might be reasonably simple, are
> there solutions already available, or issues I'd need to be
> aware of?

Tcl has exactly two types: strings, and arrays mapping strings to
strings. The problem is that those are often used to create
data-structures in strange and unpredictable ways. Hence, no good
general solution will probably be available. For simple enough cases,
two Tcl commands "marshal_string" and "marshal_array" which will
create Python expression for strings and dicts will suffice. Just send
these over a socket, and have a Python "eval" at the other side.
--
Moshe Zadka . 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




From neelk at brick.cswv.com  Thu Apr 20 18:51:10 2000
From: neelk at brick.cswv.com (Neel Krishnaswami)
Date: 20 Apr 2000 22:51:10 GMT
Subject: __del__ problem - would adopting Garbage Collection fix this?
References:  <7ojL4.9424$HG1.254543@nnrp1.uunet.ca>   
Message-ID: 

Just van Rossum  wrote:
> 
> I'm not sure if I understood it correctly, but I think the newly
> proposed garbage collector does *not* call __del__ if the object in
> question is part of a cycle. It seems indeed impossible to do so
> correctly. I think the site explained quite well why this is, but I
> can't seem to repeat it off the top of my head.

The natural order of calling finalizers -- the one that reference
countin automatically induces -- is the topological sort of the
references graph, and there can only be a well-defined topological
sort if there are no cycles in the reference graph. So if there are
object cycles there is no obvious order of calling the finalizers
within each cycle (which algorithm junkies will note are the
strongly-connected components of the reference graph). Note also that
reference-counting *never* calls the finalizers in a cycle.

So not calling the finalizers and giving the programmer access to the
list to break the cycle manually seems like a sensible idea. An even
more sensible idea would be to drop __del__ methods altogether, since
IMO you deserve to lose if you try to use the same deallocator for
arbitrary resources that you use for memory, but that idea is probably
not going to fly. ;)


Neel


From boud at rempt.xs4all.nl  Thu Apr 27 14:14:29 2000
From: boud at rempt.xs4all.nl (Boudewijn Rempt)
Date: 27 Apr 2000 18:14:29 GMT
Subject: Best database to use with Python
References: <3906ea27.698463777@news.online.no> <8e9334$qba$1@news.tht.net> <39084a70$0$22983@personalnews.de.uu.net>
Message-ID: <8ea025$s2c$1@news1.xs4all.nl>

Johannes Stezenbach  wrote:

> The one fundamential difference between MySQL and PostgreSQL (apart
> from the license) is that PostgreSQL has a focus on preserving
> data integrity and dealing with concurrency issues (using transactions,
> triggers, etc.) while MySQL omits these features in favor of raw speed.
> The MySQL folks claim to be 10 times faster for UPDATEs.

Last time I looked (five minutes ago, that is), there still wasn't
a DB-API II compliant Python interface to PostgreSQL, which means
that you've got to muck about with ODBC if you want to keep
your code reasonably database-independent.

-- 

Boudewijn Rempt  | http://www.valdyas.org


From ppi at searchy.net  Mon Apr  3 14:38:32 2000
From: ppi at searchy.net (Penpal International)
Date: Mon, 03 Apr 2000 20:38:32 +0200
Subject: Upload
Message-ID: <38E8E528.8C757DA4@searchy.net>

Does anyone has a script to upload files from a form?



-- 
Penpal International
http://ppi.searchy.net/
ppi at searchy.net


From ez4glNOezSPAM at hotmail.com.invalid  Thu Apr  6 14:54:56 2000
From: ez4glNOezSPAM at hotmail.com.invalid (ez4gl)
Date: Thu, 06 Apr 2000 11:54:56 -0700
Subject: Newbie: urllib.urlretrieve()
Message-ID: <221ee89a.3bf4ca4b@usw-ex0102-016.remarq.com>

I'm trying to clone some Intranet pages for a contract
assignment and thought Python would be a good tool because of
it's urllib module.  However, when trying to use
urllib.urlretrieve(), I have found that if you specify the
second argument, the file for writing to has to already exist.
What I want to do instead is create the name of the file on the
fly, based on the name of the URL I'm retrieving.  I guess what
I need to do is to create an empty file ahead of time?!  But how
would I go about doing this under Windows? (Unix I could handle)

Thanks in advance

George



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



From pecora at anvil.nrl.navy.mil  Fri Apr  7 08:40:10 2000
From: pecora at anvil.nrl.navy.mil (Louis M. Pecora)
Date: Fri, 07 Apr 2000 12:40:10 GMT
Subject: Why should I switch to Python?
References: <000701bf9c5a$b806b420$752d153f@tim>    <050420000914595917%pecora@anvil.nrl.navy.mil>  
Message-ID: <070420000840091838%pecora@anvil.nrl.navy.mil>

In article , Michael Hudson
 wrote:

>  - mind you "Riemann zeta function" is a pretty cool name for
> any function.  I also like "Weierstrass p-function", but mainly
> because the p is usually drawn in an entertainly deranged way.

Well, you've got something there.  Let's get some good names for
functions.  My first thought:


Hypergeometric Functions

 
> what-was-this-ng-about-again?-ly y'rs

Ah, who cares? This is more fun.  Just kidding Python guys.  :-)


From prestonlanders at my-deja.com  Mon Apr 10 11:14:10 2000
From: prestonlanders at my-deja.com (Preston Landers)
Date: Mon, 10 Apr 2000 15:14:10 GMT
Subject: Newbie: White space
References: <8bc1oo$qjc$1@yeppa.connect.com.au>
Message-ID: <8csr3s$2ks$1@nnrp1.deja.com>

Unlike most programming languages, whitespace is crucial to Python.  You
will not understand anything in Python until you run and go read the
tutorial:

http://www.python.org/doc/current/tut/tut.html

It's an easy read!

---Preston

In article <8bc1oo$qjc$1 at yeppa.connect.com.au>,
  "Ryan Abrahams"  wrote:
> I am new to python, I am actualy using it for rendering (via the
Lightflow
> Python Module, at www.lightflowtech.com (and no I don't work for
them)) and
> what I wanted to know was does Python check white space, because I had
some
> code like this:
>
> s.lightBegin()
>     s.lightOn( Sunlight )
>     Surface2 = s.newMaterial("standard", [ "ka", vector3( 0.5, 0.5,
0.0 ),
> "kc", vector3( 0.4, 0.2, 0.0 ), "kd", 0.5, "km", 0.1 ] )
> s.lightEnd()
>
> and Python chucks a spit at the s.lightOn( Sunlight ) line. Now I have
been
> trying to figure it out, maybe python does not support whitespace,
because
> changing the code to
>
> s.lightBegin()
> s.lightOn( Sunlight )
> Surface2 = s.newMaterial("standard", [ "ka", vector3( 0.5, 0.5, 0.0 ),
"kc",
> vector3( 0.4, 0.2, 0.0 ), "kd", 0.5, "km", 0.1 ] )
> s.lightEnd()
>
> and compiling it works perfectly. So is it Python that does not
support hte
> white space, or perhaps the module I am including.
>
> Thanks
> Ryan
>
>

--
|| Preston Landers  ||


Sent via Deja.com http://www.deja.com/
Before you buy.


From mjhand at concentric.net  Mon Apr 17 13:58:31 2000
From: mjhand at concentric.net (Manus Hand)
Date: Mon, 17 Apr 2000 11:58:31 -0600
Subject: Upgrading IIS to 1.6 problem....
Message-ID: <38FB50C7.C7E891E4@concentric.net>

I run CGI scripts on a real machine, but I also run some on IIS on an NT
machine.

To configure IIS to know that .cgi files should run Python, I (long ago)
followed Aaron Watters' instructions, and added a "ScriptMap" parameter
in the Windows registry:
    HKEY_LOCAL_MACHINE
        System
            CurrentControlSet
                W3SVC
                    Parameters
                        ScriptMap
                            .cgi -> C:\Program Files\Python\Python.exe
%s %s

Worked just fine for a good long time.

The other day, I downloaded 1.6a2 and installed it on the PC.  BUT...not
at the
same location -- I installed it in the directory D:\Python16

I figured that changing the above registry entry to
"D:\Python16\\python.exe %s %s"
would be all I needed to do and my Python .cgi code would run using 1.6.

Long story short(er), it didn't work.  My .cgi code still runs using the
1.5.2 version
that is in C:\Program Files\Python.  Honest.  I made the registry change
(I promise) and even rebooted.  Twice to be sure.

Anyone know why my registry change hasn't affected IIS yet?

(Oh, I also -- though this shouldn't matter -- made sure to update my
%PATH%
in my autoexec.bat -- now when I type Python at an MS-DOS prompt, I get
1.6a2.)

Let me know.  Thanks,
Manus



From eviltofu at rocketmail.com  Tue Apr 11 08:16:55 2000
From: eviltofu at rocketmail.com (Jerome Chan)
Date: Tue, 11 Apr 2000 12:16:55 GMT
Subject: WinNT and TCL/TK
Message-ID: 

Have installed Python 1.5.2 on a WinNT Server but it says it can't find 
a TCL lib when I start it up. Do I have to add something?

Thanks!


From mhammond at skippinet.com.au  Fri Apr  7 19:16:08 2000
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Fri, 07 Apr 2000 23:16:08 GMT
Subject: freeze not working (win)
References: 
Message-ID: 

"Warren Postma"  wrote in message
news:memH4.4438$HG1.127494 at nnrp1.uunet.ca...
> No definition of module win32api in any specified map file.
> Warning: unknown modules remain: win32api
>

This simply means that win32api was not frozen.  The resulting
program will still run if you provide win32api.pyd.  Note that
you must also provide pywintypes1x.dll - this can not be frozen.

> What do I do?  If i had to guess I'd say that the *.dsp is a
Visual C++
> Project file.
> What does Freeze want with the source code to the Win32
extensions?

Freeze is capable of freezing these modules into the same .exe -
its needs the source to do so.

It shouldnt surprise you that freeze needs C sources - most of
freeze's time is spent compiling C code!

>  Do I
> have to get this file from somewhere? I looked on Mark Hammonds
page and my
> only option is to grab source from CVS. {Haven't done that
before. don't
> know how.} What do I do!?

I'd suggest you ignore the error and simply ship win32api.pyd.

Mark.





From claird at starbase.neosoft.com  Sat Apr  8 23:27:07 2000
From: claird at starbase.neosoft.com (Cameron Laird)
Date: 8 Apr 2000 22:27:07 -0500
Subject: Migrating Tcl system to Python
References: <095cc48a.7e9b36dd@usw-ex0108-063.remarq.com>
Message-ID: <000C48B993BF96DA.95DEBE4215A79896.7F63D15FB99EE88D@lp.airnews.net>

In article <095cc48a.7e9b36dd at usw-ex0108-063.remarq.com>,
Hamish Lawson   wrote:
>I'd be interested in anyone's experience of migrating a (several-
>thousand line) system written in Tcl to Python. And since we'll
>have to deploy new functionality while we're in the process of
>migrating, I'd particularly like to hear of experiences with
>having Tcl code using Python code (and vice versa). I'm
>considering XML-RPC/SOAP as a possible way to do that, but what
>other approaches might there be?
			.
			.
			.
Minotaur.  CORBA.  ILU.  COM, maybe.  Pipes.  Named pipes.
'Depends on your situation--like many things.
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


From meh9 at cornell.edu  Mon Apr 24 11:19:24 2000
From: meh9 at cornell.edu (Matthew Hirsch)
Date: Mon, 24 Apr 2000 11:19:24 -0400
Subject: Simple list.append() question
Message-ID: 

Hi All,

I have this:
>>> entire_list=[[]]*3
>>> entire_list
[[], [], []]
>>> entire_list[0].append(1.23)
>>> entire_list
[[1.23], [1.23], [1.23]]

I only want to append 1.23 to entire_list[0].  Why did it also append it 
to entire_list[1] and entire_list[2]?

Thanks for your help,
Matt


From garabik at melkor.dnp.fmph.uniba.sk.spam  Thu Apr  6 13:22:58 2000
From: garabik at melkor.dnp.fmph.uniba.sk.spam (Radovan Garabik)
Date: 6 Apr 2000 17:22:58 GMT
Subject: encoding type in a2ps to pretty-print
References: <8chtbq$ohg$1@news.net.uni-c.dk>
Message-ID: <955041768.638594@cdwork.cvt.stuba.sk>

Henrik Berg Nielsen  wrote:
 : Hi, I am complete newbie and just starting to learn Python. I have just
 : installed a2ps for dos so I can pretty-print all my small programs. I have
 : one problem though. When I pretty-print my code via a2ps all places where I
 : have a '<=' are turned into the similar mathematical sign, that only takes
 : up one space on the line, likewise all '==' are converted to the
 : mathematical "by definition" sign (that is 3 lines on top of eachother). Why
 : is this so? It is really annoying and I would really like a2ps to
 : pretty-print my code the way it looks on my monitor. I think it has
 : something todowith the encoding that a2ps uses,but I'm not sure.

try --highlight-level=normal



-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!


From nascheme at enme.ucalgary.ca  Tue Apr 25 13:55:56 2000
From: nascheme at enme.ucalgary.ca (Neil Schemenauer)
Date: Tue, 25 Apr 2000 17:55:56 GMT
Subject: VIM NT +python
References: <8e4j27$hgq$1@nnrp1.deja.com>
Message-ID: 

tiddlerdeja at my-deja.com  wrote:
>Does anyone here have a winNT build of the VIM editor that has python
>support switched on?

    http://www.vim.org/

Vim on Win32 has highlighted Python for ages.  Perhaps you don't
have syntax highlighting turned on.

    Neil

-- 
"God, root, what is difference?" - Pitr| nascheme at enme.ucalgary.ca
"God is more forgiving." - Dave Aronson| http://www.ucalgary.ca/~nascheme


From sylvieb at icestormfx.com  Thu Apr 20 09:11:19 2000
From: sylvieb at icestormfx.com (Sylvie Bruneau)
Date: Thu, 20 Apr 2000 09:11:19 -0400
Subject: A tkMessageBox question!
References: <38FDC335.B9FDCFE4@icestormfx.com> <38FE8AF6.2A4CDBDA@gte.net>
Message-ID: <38FF01F6.898DA84F@icestormfx.com>

Hi Sue.

    Thank you for giving a try, but it doesn't work.  The tkMessageBox must be used
in that way :

tkMessageBox.function( title, message [, options] )

    where function can be showinfo, showwarning, showerror, askquestion, askokcancel,
askyesno, or askretryignore and options can be default, icon, message, parent, title
and type.  And as soon as you call one of these functions, the dialog is popped up,
ie, it is too late to try anything on the look.

    I really think there is no way to do this !

Sly


sue wrote:

> I don't remember the exact syntax, but try:
>
> msg = TkMessageBox("text")
> msg.configure( font = "something_decent" ).
>
> You might have to check that the font exists.
>
> Sue.

--
/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/=-/
Sylvie Bruneau ( sylvieb at icestormfx.com ) Tel: (514) 527-3963
Software Developer, IceStorm Digital.     Fax: (514) 527-5165
2595 Place Chasse, Montreal, Quebec, H1Y 2C3.

La vie est un cadeau parfois difficile a deballer. (P. Brassard)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From nmm1 at cus.cam.ac.uk  Wed Apr 12 11:08:34 2000
From: nmm1 at cus.cam.ac.uk (Nick Maclaren)
Date: 12 Apr 2000 15:08:34 GMT
Subject: Python/Perl Popularity (Re: A Mountain of Perl...)
References: <200004102111.HAA03380@envy.fulcrum.com.au>     <8d0pcq$7ti$1@nnrp1.deja.com>      <8d149t$jo6$1@nnrp1.deja.com> <8d22qg$oai$1@newsserver.rrzn.uni-hannover.de>
Message-ID: <8d23hi$3p8$1@pegasus.csx.cam.ac.uk>

In article <8d22qg$oai$1 at newsserver.rrzn.uni-hannover.de>, breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) writes:
|> In article <8d149t$jo6$1 at nnrp1.deja.com>,
|> 	tom__98 at my-deja.com writes:
|> 
|> >>     tom>  -- How can I browse the Python documentation without firing
|> >>     tom> up a web browser?
|> >>
|> >> Convert it to text format. It's latex, you can make it into anything
|> >> you want, and do anything you want with it.
|> > 
|> > Well, what I'm suggesting is that it might be a good idea
|> > to make a command-line accessible version of the documentation,
|> > together with a command line tool, available as part of the
|> > standard distribution.
|> 
|> lynx is a command line tool and will work fine and fast.

Not really.  It is a 'full-screen" browser.  In particular, it
doesn't work together with scrollback, and you can't easily use
it to produce text for automatic scan.  The original CERN www
browser IS a command-line browser, but it has a pretty revolting
user interface.  Well, so has lynx, for that matter.

However, I do find this whole debate bizarre ....


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679


From mike.zaharkin at westgroup.com  Tue Apr 25 14:03:29 2000
From: mike.zaharkin at westgroup.com (MikeZ)
Date: Tue, 25 Apr 2000 14:03:29 -0400
Subject: Newbie Question
References: 
Message-ID: <3905ddf2@wwwproxy3.westgroup.com>

Luke,

    Try:

    http://www.mcmillan-inc.com/install1.html

    It works quite well.

Regards,
-Mike Z.

Luke macken wrote in message ...
>Hello, i just started teaching myself Python the other day, and I have been
>getting very into it. I have both the Linux version of it and the Windows
>version. I just want to know how i make executable files with it.
>Thanks
>
>




From gmcm at hypernet.com  Wed Apr 26 15:48:25 2000
From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 26 Apr 2000 15:48:25 -0400
Subject: Namespace Problem with global declaration in module
In-Reply-To: <8e6vv9$4n8$1@nnrp1.deja.com>
Message-ID: <1255343982-62616670@hypernet.com>

spex66 at my-deja.com wrote:

> Hi,
> it seemed very simple but don't worked like expected:
> 
> #FILE: test.py
> dd = None #INIT a shadow instance for automated access
> class zz:
>     #ONLY one class will be instantiated
>     def __init__(self):
>         self.name = 'hallo'
>         global dd
>         dd = self
> #END OF FILE
> 
> >>> from test import *

There's your problem. "from test import *" copies names from 
test to your namespace. Now dd is another name for None. 
yy() affects the dd in test's namespace, not yours.

> >>> yy = zz()
> >>> dd.name
>     ...
>     AttributeError
>     ...


- Gordon



From quinn at riyal.ugcs.caltech.edu  Tue Apr  4 21:30:10 2000
From: quinn at riyal.ugcs.caltech.edu (Quinn Dunkan)
Date: 5 Apr 2000 01:30:10 GMT
Subject: Getting the argument names passed to a function ?
References: <20000404225810.A12156@sz-sb.de>  
Message-ID: 

> > Hmm, could you say:
> > 
> > def arghack(arg):
> >     for k, v in globals().items():
> >         if arg is v:
> >             return k
> >     else:
> >         return None
> > 
> > Seems to work ok...
> This only works if the argument passed in is a global.  For example:
> >>> def hackSpoiler():
> ...     a = 2
> ...     print arghack(a)
> ...
> >>> hackSpoiler()
> None

Ok, Mr. Spoilsport :)

import sys
def arghack(arg):
    try:
        1/0
    except:
        frame = sys.exc_info()[2].tb_frame.f_back
    while frame:
        for k, v in frame.f_locals.items():
            if arg is v:
                return k
        frame = frame.f_back
    else:
        return None


From bwinton at tor.dhs.org  Mon Apr 17 15:08:53 2000
From: bwinton at tor.dhs.org (Blake Winton)
Date: Mon, 17 Apr 2000 19:08:53 GMT
Subject: else clauses in while and for loops
References: <200004142351.JAA02824@nexus.csse.monash.edu.au> <38F7B350.5D6548E1@mindspring.com>
Message-ID: 

On Fri, 14 Apr 2000 20:09:52 -0400, Chuck Esterbrook wrote:
>Jonathan Giddy wrote:
>> Just like there's no "real need" for tuples (use lists), for loops (use
>> while), or elif (use else: if).
>>
>> All of these concepts are redundant in the sense that they can be mimicked
>> using an alternative sequence of code.  But they're nice because they
>> express higher-level concepts about the algorithm.
>
>I'm aware of all of this. In fact, I think we could all get our work
>done with ADD, NEG, JMP and JMPZ.   :-) But no thank you.

Heck, didn't someone prove it was possible to write a single-instruction
computer?  Decrement and Jump If Not Zero, was the instruction, IIRC.

Later,
Blake.
-- 
2:51pm up 19 days, 15:25, 1 user, load average: 1.00, 1.00, 1.00


From cut_me_out at hotmail.com  Thu Apr 13 13:58:01 2000
From: cut_me_out at hotmail.com (Alex)
Date: 13 Apr 2000 13:58:01 -0400
Subject: Doesn't anybody write to paper anymore?
References: <38F5FDF3.EE2FBA01@tcac.net>
Message-ID: 

> I would like to pass it into the queue.  IO redirection in the shell
> is ugly and awkward.

I don't know whether this counts as ugly and awkward IO redirection, but
perhaps you could do something like this:

from os import popen
printer = popen ('lpr')
printer.write("page 1\n\r\f")
printer.write("page 2\n\r\f")
printer.close ()

I actually tried "echo 'test' | lpr -" on a hunch before I read the man
page.  You might try that instead if 'lpr' by itself doesn't work.

Alex.


From olafb at pvv.org  Tue Apr 18 07:37:47 2000
From: olafb at pvv.org (Olaf Trygve Berglihn)
Date: 18 Apr 2000 13:37:47 +0200
Subject: Can COM-objects be used in a thread?
Message-ID: 

I'd like to make a thread work on a COM-object created by the main
thread. Is this possible? Can the COM-object be passed to the thread
and function properly there?

I vaguely remember that somebody posted a message about this, saying
it is not possible for a thread to host a COM-object as the main
thread is not dispatching Windows messages to it.
-- 
* Olaf Trygve Berglihn 


From mikael at isy.liu.se  Wed Apr  5 05:15:31 2000
From: mikael at isy.liu.se (Mikael Olofsson)
Date: Wed, 05 Apr 2000 11:15:31 +0200 (MET DST)
Subject: map.yahoo.com uses Python?
In-Reply-To: <38eb00af.8905516@news.mel.aone.net.au>
Message-ID: 

On 05-Apr-00 Geoff Deering wrote:
 >  I've heard all of Yahoo is Python based.

"All of" is probably an exaggeration, but Python is listed on

  http://docs.yahoo.com/info/misc/contributors.html

See far down on the page under "Public Domain Software".

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson 
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    05-Apr-00
Time:    11:13:25

This message was sent by XF-Mail.
-----------------------------------------------------------------------


From walter at data.franken.de  Thu Apr 27 04:46:28 2000
From: walter at data.franken.de (Walter Doerwald)
Date: Thu, 27 Apr 2000 10:46:28 +0200
Subject: Sourceforge and Python
References:  <007b01bfaf14$f33114b0$3cdd3fcb@neil>  <8e6v3r$3ss$1@nnrp1.deja.com>
Message-ID: <45919985@data.franken.de>

On Wed, 26 Apr 2000 14:39:58 GMT aaron_watters wrote:

> [...]
> cvs -z6
> -d :ext:aaron_watters at cvs.reportlab.sourceforge.net:/cvsroot/reportlab
> commit pdfdoc.py
>
> [...]
>
> SET
> CVSROOT=aaron_watters at cvs.reportlab.sourceforge.net:/cvsroot/reportlab

If you change this to

SET CVSROOT=:ext:aaron_watters at cvs.reportlab.sourceforge.net:/cvsroot/reportlab

you won't have to type the
"-d :ext:aaron_watters at cvs.reportlab.sourceforge.net:/cvsroot/reportlab"
part in the command above.

Bye...
	Walter Doerwald



From jnw22 at cam.ac.uk  Tue Apr 11 08:55:40 2000
From: jnw22 at cam.ac.uk (James "Wez" Weatherall)
Date: Tue, 11 Apr 2000 13:55:40 +0100
Subject: Python port to Psion
Message-ID: <8cv7cc$g3h$1@pegasus.csx.cam.ac.uk>

The Python port to the Psion 5(mx) is missing some features, in particular
threads and serial IO.  I need both features for a project I'm doing, so I'd
like to add them in to the Psion port.

Unfortunately, searches on Deja and on the web pages for the two flavours of
the port fail to throw up anywhere I can get the patches or patched source
code from.

Does anyone know where I could find it?

Cheers,

--
James "Wez" Weatherall





From aahz at netcom.com  Sun Apr  2 12:52:53 2000
From: aahz at netcom.com (Aahz Maruch)
Date: 2 Apr 2000 16:52:53 GMT
Subject: Paid to work in Python? (was: Re: Choice Of Language)
References: 
Message-ID: <8c7tt5$7dl$1@slb3.atl.mindspring.net>

In article ,
David Ascher  wrote:
>Grant Edwards
>>
>> Pointless tanget: Is it just me, or is Google really the last usable
>> search engine?
>
>And it's _all_ due to their use of Python!  Cool, eh? =)

That doesn't explain why Infoseek is no longer particularly usable.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."


From claird at starbase.neosoft.com  Thu Apr 20 10:18:19 2000
From: claird at starbase.neosoft.com (Cameron Laird)
Date: 20 Apr 2000 09:18:19 -0500
Subject: Removing circular references (was Re: Editors and books)
References:  <20000417184833.H15664@xs4all.nl> <8dgbu7$k10$1@slb6.atl.mindspring.net>
Message-ID: <1DCCE06693F01F93.B5A70EEF90EE3111.B0E354CFF4C183AE@lp.airnews.net>

In article <8dgbu7$k10$1 at slb6.atl.mindspring.net>,
Aahz Maruch  wrote:
>In article <20000417184833.H15664 at xs4all.nl>,
>Thomas Wouters   wrote:
>>
>>The problem with RC is that you can create circular references:
>>
>>a = [some large list]
>>b = [some other large list]
>>a.append(b)
>>b.append(a)
>>
>>del a
>>del b
>
>Note that you can break the circular reference if you do this between
>the append and the del:
>
>del a[-1]
>del b[-1]
>
>Similar tricks work in most other cases where circular references get
>created.
			.
			.
			.
And, for completeness, I'll note that dangling circular
references are innocuous in many (most?) cases.  It's
only long-running processes with systematic memory leaks
which are generally worth concern.
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


From ben at co.and.co  Sun Apr 30 17:27:35 2000
From: ben at co.and.co (ben at co.and.co)
Date: Sun, 30 Apr 2000 21:27:35 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <8ecsgj$6lp$1@slb0.atl.mindspring.net>  <300420001008012011%pecora@anvil.nrl.navy.mil> 
Message-ID: 

Samuel A. Falvo II  wrote:
 
> I always use Hungarian notation when it makes sense to.  For example, if I
> have a function in C that accepts a string and an explicit length argument,
> I would write something like this:
> 
> 	uint32 WriteData( void *buffer, char *pString, uint32 cbString )
> 
> This tells me that WriteData() takes as parameters a buffer, a pointer to a
> string, and the number of bytes in the said string.  I fail to see how this
> is somehow hard to read.  :)

OK, let's bite :-)

    int WriteData(void *buffer, char *str, int len)

I fail to see how this is somehow hard to read :-)

Greetings,
-- 
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora



From godzilla at netmeg.net  Sat Apr  8 07:21:09 2000
From: godzilla at netmeg.net (Les Schaffer)
Date: Sat, 08 Apr 2000 11:21:09 GMT
Subject: anyone else wrap gd-1.8?
References: <65118AEEFF5AD3118E8300508B1248774CB282@ALTNET> 
Message-ID: 

> I have wrapped using the old gdmodule gd-1.8.1. Unfortunately it's a
> hacked version of gd-1.8.1

i've managed to wrap it without any hacks. i have most of the demos
and examples working, but it still needs a bit more work.

les schaffer


From nmm1 at cus.cam.ac.uk  Tue Apr 11 05:24:50 2000
From: nmm1 at cus.cam.ac.uk (Nick Maclaren)
Date: 11 Apr 2000 09:24:50 GMT
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk>  <8ctc9m$sp2$1@pegasus.csx.cam.ac.uk> <8ctkm5$bko$2@newshost.accu.uu.nl>
Message-ID: <8cur12$5pf$1@pegasus.csx.cam.ac.uk>

In article <8ctkm5$bko$2 at newshost.accu.uu.nl>,
Martijn Faassen  wrote:
>Nick Maclaren  wrote:
>[if your function gets longer than a screenfull, it's time to start
>thinking about splitting it up]
>
>> It really is quite amusing to see these same old myths coming back
>> every few decades :-)
>
>You think splitting a function up is a myth? I find it helps 
>me and my code. It becomes more readable and writeable. I'm genuinely
>surprised by your assertion this is an 'old myth'.

The myth is that splitting functions up necessarily improves clarity.
Sometimes it does; sometimes it doesn't.

>> That particular dogma was very popular back in the late 1960s and
>> early 1970s, when practical programmers pointed out that it was a
>> virtually impossibility for a normal person to keep track of 50
>> trivial functions in their head, but it was quite easy to look
>> at 60 lines of sequential code.  That didn't get listened to
>> then, either!
>
>Of course if you go about randomly chopping up your function into
>multiple ones, that's not going to improve matters. The idea is
>to conceptually split your function into multiple smaller ones
>that make more sense, are more easy to adapt, are coherent by 
>themselves, and make the original big function more readable, as
>by writing all the smaller functions you've hopefully also given
>them names. It's called refactoring, of course. :)

The dogma is that there is a maximum size of function that should
ever be written, and that complex functions necessarily split up
cleanly into smaller sections.  Sometimes they do; sometimes they
don't.  I have seen codes where the median size of functions was
below 5 lines, and you had to keep the specification of over 50 in
your head just to read the simplest function!

>My guidelines are:
>
>If your function is long and complicated, too many concepts
>and abstractions are mingling in the same place. Do a better job
>of abstracting stuff, and you'll end up with shorter, clearer
>functions.

Sometimes.  I have very often done that and backed off, because the
complex function was clearer.  Another good rule is, if auxiliary
functions need to access more arguments and artificial global
variables than they have lines of code, consider whether they would
be better written inline.

>If your function is long and repetitive, you're not being a lazy
>enough programmer. Write some smaller functions that generate the
>stuff, read it from a file or database, whatever.

If the repetitiveness is not quite regular enough to make that easy,
you are making unnecessary work for yourself.  Sometimes that is the
right solution; sometimes it isn't.

>Are you saying these guidelines are based on a myth?

No - the myth is that they invariably improve things.  Life is not
that simple.

>> My current infliction is a accounting file format, and the the
>> function to check the input (you DO check your input, don't you?)
>> needs to perform 100 tests in series.  Yes, I am inventing
>> trivial functions, but it would be clearer to put more of the
>> tests inline.
>
>Why not split this up into a bunch of validation objects or 
>something, and then check the input that way? And aren't at least
>some of these tests similar enough to abstract into a function
>(such as tests for maximum various lengths of strings). Of course
>the accounting file format may be so baroque your function just
>has to be baroque, but that sort of thing *ought* to be rare. :)

That is, of course, what I am doing.  But designing in enough
commonality takes a lot longer (and is more complex) than simply
repeating the very simple tests.  After all, it gains you nothing
by calling an auxiliary that then has a massive switch statement
with special code for each of its calls - and some people do write
code like that!

In this particular case, there are 50-60 entries, which need
40-50 separate test conditions.  By thinking, I can common up
quite a lot of that code, but there is some which is not amenable
to that.


If you remember, I asked whether there were any equivalent to a
couple of very common paradigms, that have been used to clarify
code for over 30 years.  The answer appears to be "no", so I have
to use somewhat less satisfactory ones.  This is not a major
problem - been there, done that, in dozens of languages.

What isn't acceptable, however, is putting up with people saying
that it is heretical to admit that such requirements exist!  Fads
are one thing, but dogma is harmful.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679


From algaba at my-deja.com  Fri Apr 14 20:03:49 2000
From: algaba at my-deja.com (Manuel Gutierrez Algaba)
Date: Sat, 15 Apr 2000 00:03:49 GMT
Subject: Crosswords for Linux Backtracking recursive crossword generator
References: <8d59hk$6to$1@nnrp1.deja.com>  <8d7gnd$l4a$1@nnrp1.deja.com> <38F74B6C.966EB04F@codeit.com>
Message-ID: <8d8bku$jsl$1@nnrp1.deja.com>

In article <38F74B6C.966EB04F at codeit.com>,
  Grakka  wrote:
> What does "hlio" means in spanish also?

Being jflores ( Jose Flores, Juan Flores, Javier Flores), you'd
know that it's lio ( mess ) and not hlio, anyway, when you run the
script you got "lio", so it's clear.


Sent via Deja.com http://www.deja.com/
Before you buy.


From nascheme at enme.ucalgary.ca  Sun Apr  9 23:24:14 2000
From: nascheme at enme.ucalgary.ca (Neil Schemenauer)
Date: Mon, 10 Apr 2000 03:24:14 GMT
Subject: [ANNOUNCE] Garbage collection for Python
References: <20000407221750.A29279@acs.ucalgary.ca> <38F13FB9.D1D16AF@mindspring.com>
Message-ID: 

Chuck Esterbrook  wrote:
>Looking at Python FAQ 6.14 on GC, I see another one as well:
>
>http://starship.python.net/crew/gandalf/gc-ss.html

I can't tell too much from that page.  I think it modifies Python
to use the Boehm-Demers garbage collector.  It also seems to be a
bit out of date.

The Boehm-Demers GC works fine when it works but it is not as
portable as Python.  It also requires modifying existing
extension modules.  The chance of Guido accepting such a patch
for Python is about zero.

If you really want to use the Boehm-Demers GC, I have a patch on
my page for Python 1.5.2.

>Also, you might want to get yours mentioned in the FAQ.

I would rather get the bugs stomped out of my patch and get it
included in 1.6 or 1.7.  We can then remove the FAQ entry.  :)


    Neil

-- 
Real programmers don't make mistrakes


From cut_me_out at hotmail.com  Sun Apr 30 18:24:54 2000
From: cut_me_out at hotmail.com (Alex)
Date: 30 Apr 2000 18:24:54 -0400
Subject: Discrepency between JPython and CPython
References: 
Message-ID: 

> Consider the expression str(1.14 * 200).
> In CPython it yields 228.0
> In JPython it yields 227.99999999999997
> 
> Shouldn't this result in consistent values across variuos implementation?  
> If so, which of the implementation is buggy?  
> I think it is JPython, may be I am wrong.

Both implementations just reach down to a lower level routine -- for
CPython, it's multiplication in C, for JPython, it's multiplication in
Java.  So probably the discrepency is between the C compiler used to
build your CPython (or maybe your CPU, if it does floating point
operations.  I understand they do, these days.  [The only CPU I ever
learnt anything about in detail was the 6809.] :) and the JVM your
JPython is running on.

Alex.


From mwh21 at cam.ac.uk  Fri Apr 28 09:14:38 2000
From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 28 Apr 2000 14:14:38 +0100
Subject: Another question
References:  <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> <200004172120.RAA11102@zippy.init.com>    <20000418234932.L15664@xs4all.nl> <3909543E.C775CAD6@uab.edu>
Message-ID: 

Shae Erisson  writes:

> Thomas Wouters wrote:
> 
> > Of course not all Python code can be boiled down to these two
> > things (they aren't really 'rules', by the way, merely descriptions
> > of the Python view of the world) but understanding these subtle
> > differences can really make you grok Python ;) Tim Peters once
> > wrote down the Python Philosophy (or zen):
> 
> Can you tell me where you found the python philosophy quote? I'd
> like to read more along these lines.  thanks,

http://starship.python.net/crew/amk/quotations/python-quotes.html

Good stuff.  One of my favourites:

 Python is a truly wonderful language. When somebody comes up with a
 good idea it takes about 1 minute and five lines to program something
 that almost does what you want. Then it takes only an hour to extend
 the script to 300 lines, after which it still does almost what you
 want.
                                              Jack Jansen, 8 Jul 1992 

Cheers,
M.

-- 
  it's not that perl programmers are idiots, it's that the language
  rewards idiotic behavior in a  way that no other language or tool 
  has ever done                        -- Erik Naggum, comp.lang.lisp


From pmadsen at newbridge.com  Tue Apr  4 17:07:33 2000
From: pmadsen at newbridge.com (Paul Madsen)
Date: Tue, 04 Apr 2000 17:07:33 -0400
Subject: complete novice question
Message-ID: <38EA5995.F7B9815D@newbridge.com>

Downloaded Python-1.5.2.

I've run 'configure' and it seems to have worked. Now, according to the
Python package's README, I should be able to type 'make' for the rest of
the install. If I don't have a 'make' file, did the configure portion
not work?

thanks






From effbot at telia.com  Mon Apr  3 10:40:07 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Mon, 03 Apr 2000 14:40:07 GMT
Subject: Unicode program representation
References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil>  <00ac01bf9d65$d988c460$36dd3fcb@neil> 
Message-ID: 

Fran?ois Pinard  wrote:
> Until `sre' definitely replaces `re', you'll have to specify which one you
> want, forcing you as a programmer to a better tracking of narrow vs.
> wide string types: but this is only temporary, the goal seems to be that
> the programmer should not worry about these things.

footnote: 'sre' handles both ordinary strings and unicode
strings.

the reason we're shipping it separately at this time is that's
still very rough -- but if your regular expressions happen to
work under 'sre', you can feed it ordinary strings or unicode
strings.  it's figures the rest out all by itself.

for more information on the current status of 'sre', see the
'sre' homepage:

    http://w1.132.telia.com/~u13208596/sre






From embed at geocities.com  Wed Apr  5 12:25:03 2000
From: embed at geocities.com (Warren Postma)
Date: Wed, 5 Apr 2000 11:25:03 -0500
Subject: python16_d.lib, python16_d.dll python15_d.dll
References: <013101bf9edb$a76984c0$1001a8c0@nevrax.net>
Message-ID: <1YIG4.3731$HG1.106994@nnrp1.uunet.ca>

>Are there any way to have the python16_d.lib and .dll, or the
python15_d.dll ?????

If you have Visual C++, download the source code and build them. If not, beg
someone else who does have Visual C++.







From jbauer at rubic.com  Thu Apr 27 15:40:19 2000
From: jbauer at rubic.com (Jeff Bauer)
Date: Thu, 27 Apr 2000 14:40:19 -0500
Subject: xmlrpc: remote methods on attributes
Message-ID: <390897A3.D0BF0717@rubic.com>

Hi all. I've been playing around with PythonWare's 
xmlrpclib module.

It's pretty neat, but I want to remotely invoke methods 
on attributes.  After diddling around and trying to
fool the library, I opted for a more straightforward
approach: a RemoteMethod mixin.

### WARNING: Code for discussion purposes only. ###
from types import FunctionType

class RemoteMethod:
    def __init__(self):
        self.__methods__ = {}
        for n, m in get_members(self.__class__).items():
            if n[:2] != '__' and \
               type(m) is FunctionType:
                self.__methods__[n] = m
    def __rcall__(self, method, params):
        if self.__methods__.has_key(method):
            return apply(self.__methods__[method], (self,)+params)
        try:
            pos = string.index(method, '.')
        except ValueError:
            pass
        else:
            head = method[:pos]
            tail = method[pos+1:]
            if hasattr(self, head):
                return self.__dict__[head].__rcall__(tail, params)
        return None

def get_members(_class, members=None):
    if members is None:
        members = {}
    for k in _class.__bases__:
        get_members(k, members)
    for n, m in vars(_class).items():
        if not members.has_key(n):
            members[n] = m
    return members

########################################################

An example of how an xmlrpc server could be implemented:

class Blarg(RemoteMethod):
    def __init__(self):
        apply(RemoteMethod.__init__, (self,))
    def blarg_method(self, x):
        return "blarg_method(%s)" % x

class Server(RemoteMethod, xmlrpc_handler):
    def __init__(self):
        apply(RemoteMethod.__init__, (self,))
        self.blarg = Blarg()

########################################################

In a separate module, the server is remotely invoked.
I map 'call' to '__rcall__' in the top level connection
object, derived from xmlrpclib.

    server = Server("http://yadda-yadda")
    print server.blarg.blarg_method("Aieee!")

########################################################

I'd be interested in anyone's comments about this
approach, especially from other xmlrpc users.  Thanks.

Jeff Bauer
Rubicon Research



From effbot at telia.com  Mon Apr  3 12:03:47 2000
From: effbot at telia.com (Fredrik Lundh)
Date: 3 Apr 2000 11:03:47 -0500
Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Apr  3)
Message-ID: <42FC2C22B9F94665.58B059EC6AF1AB7B.326AADF624B2C732@lp.airnews.net>

The Software Development conference in San Jose turned out to be a major
Python event.
    The conference site:
        http://www.sdexpo.com/

    Guido's keynote covered the CP4E project.  The slides haven't
    been posted yet, but they were based on this classic talk:
        http://www.python.org/doc/essays/ppt/acm-cp4e/index.htm

    Some media coverage.  Like it or not, but Python is hot! :-)
        http://www.ddj.com/articles/2000/0050/0050toc.htm
        http://www.oreillynet.com/pub/a/network/2000/03/30/softwaredev.html

    Lots of great talks about Python.  Among others, David Ascher
    talked about JPython and popular tools and extensions:
        http://www.activestate.com/sd2000.htm

Activities:
    Colorado Linux Info Quest 2000: Python and Zope BOF Sessions
        http://www.thecliq.org/bofs.html

    UCSC Extension: Python Programming Course [corrected link]
        http://www.ucsc-extension.edu/knowledge_is_timeless/qd/softlist.taf?function=detail&X_Number=X444.3

Releases:
    Python 1.6 alpha 1 is here! (first alpha, very rough in places)
        http://www.python.org/1.6/

    Guido tells us what's in the new release, sort of.  Note the
    posting date (for the true story, see the above site):
        http://www.deja.com/=dnc/getdoc.xp?AN=605330122

    Christian Tismer: Stackless Python 1.1 and Continuations 0.8
        http://www.deja.com/=dnc/getdoc.xp?AN=603584578

    Fred Drake: Updated Python 1.5.2 Documentation
        http://www.python.org/doc/

    Andrew Kuchling: Perfect Minimal Hash Generator
        http://starship.python.net/crew/amk/python/code/perfect-hash.html

    Ka-Ping Yee: Roundup - a simple and effective bug-tracking system
         http://www.lfw.org/python/

    Phil Thompson: PyQt/PyKDE v0.11 (python bindings for Qt and KDE)
        http://www.deja.com/=dnc/getdoc.xp?AN=603477664

    William Park: Simple Numerical Recipes in Python
        http://www.python.org/topics/scicomp/recipes_in_python.html

    ReportLab Inc: ReportLab Release 0.90 (PDF generator library)
        http://www.deja.com/=dnc/getdoc.xp?AN=603415004

    Digital Creations: Zope 2.1.6
        http://www.zope.com/Products/Zope/2.1.6/Zope_216_release

Bits and pieces from the newsgroup:
    Mark Hammond: How to determine the Ethernet HW Address (on
    Windows, requires PythonWin 130):
        http://www.deja.com/=dnc/getdoc.xp?AN=603363272

    Michael Hudson: How to use continuations in Stackless
    Python:
        http://www.deja.com/=dnc/getdoc.xp?AN=600190793

    Gordon McMillan: On Python's startup performance:
        http://www.deja.com/=dnc/getdoc.xp?AN=599756252


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

Everything you want is probably one or two clicks away in these pages:

      Python.org's Python Language Website is the center of Pythonia
          http://www.python.org

      eff-bot's complements this digest with his daily python url
          http://hem.passagen.se/eff/url.htm

      Much of Python's real work takes place on Special-Interest Group
          mailing lists http://www.python.org/sigs/

      Python Consortium emerges as an independent nexus of activity
          http://www.python.org/consortium

      The Vaults of Parnassus ambitiously collects Python resources
          http://www.vex.net/~x/parnassus/   

      Python To-Do List anticipates some of Python's future direction
          http://www.python.org/cgi-bin/todo.py

      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

      Archive probing trick of the trade:
          http://www.dejanews.com/dnquery.xp?QRY=&DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=threaded&showsort=date&maxhits=100&groups=comp.lang.python


Previous - (U)se the (R)esource, (L)uke! - messages are listed here:
  http://purl.org/thecliff/python/url.html
or
  http://www.dejanews.com/dnquery.xp?QRY=~g%20comp.lang.python%20Python-URL%21


Suggestions/corrections for next week's posting are always welcome.
  http://www.egroups.com/list/python-url-leads/

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 markx.daley at intel.com  Wed Apr 19 10:32:09 2000
From: markx.daley at intel.com (Daley, MarkX)
Date: Wed, 19 Apr 2000 07:32:09 -0700
Subject: Very Horrible Question About Goto's
Message-ID: 

It depends on what the GOTOs are doing.  If they are providing a GOSUB-like
feature, you can do the same thing in Python by defining the task and then
invoking it in other functions.  If they are providing flow control, it may
be a little trickier.  I'm not an expert, but you should be able to work
around just about anything you've done in a previous language if you know
the right Python commands.
 
-Mark

-----Original Message-----
From: Richard Jones [mailto:richard.jones at ibahealthcare.com]
Sent: Wednesday, April 19, 2000 12:09 AM
To: 'python-list at python.org'
Subject: Very Horrible Question About Goto's


I'm trying to create a converter from our own internal language (horrid)
into python.  My only problem so far is that the original language uses
*LOTS* of goto's.  Is there any way that this can be replicated within
python ?
 
Thanks for any help.
 
Richard Jones
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From effbot at telia.com  Wed Apr 12 09:27:50 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Wed, 12 Apr 2000 13:27:50 GMT
Subject: How to know what re.sub took?
References: <38F387AE.1010704@gmx.net>
Message-ID: 

Per Kistler  wrote:
> How to know what has been substituted away, if one does something like:
>
> >>> import re
> >>> rex = re.compile(r"(hans|fred|simon)")
> >>> st = "max hans bill"
> >>> st2 = rex.sub("",st)
> >>> st2
> 'max bill'
>
> It took "hans" away, but how can I learn this automatically?

>>> st2 = rex.subn("",st)
>>> st2
('max  bill', 1)

the second tuple value is the number of substitutions made.






From smalleys at gte.net  Sat Apr 15 13:57:45 2000
From: smalleys at gte.net (sue)
Date: Sat, 15 Apr 2000 17:57:45 GMT
Subject: Need an enum type extension
References: <38F52A7A.D8841724@gte.net>  <38F68AF4.46DDA670@gte.net> 
Message-ID: <38F89F9D.6B4162DE@gte.net>

Aargh!  I never thought of a _separate_ get_list() function
to pass the literals back out.  Thank you, thank you.  That
should suffice for now.  I knew there had to be an easier
way...

Sue.


From brent.fulgham at xpsystems.com  Thu Apr 20 19:34:45 2000
From: brent.fulgham at xpsystems.com (Brent Fulgham)
Date: Thu, 20 Apr 2000 16:34:45 -0700
Subject: Using python on the web
Message-ID: 

A couple of questions:

 
> We build medium-busy, CGI-intensive sites in Python. We were briefly
> quite excited about Zope, but once we realized it locked us into Yet
> Another Programming Language, we lost interest. DHTML is particularly
> problematic,
1.  I'm not familiar with Zope.  Is DHTML specific to Zope?  It seems
to be proudly advertised on a lot of "webware" brochures I see these
days.

 
> The biggest hassle for us has been the weak MySQL support in 
> Python. The spec keeps changing and the interface is raw.

2.  Have you tried using PostgreSQL?  MySQL may be fast, but it's
really little more than a filesystem represented as a database.
It has no transaction support whatsoever which tends to lead to
problems when you have a community-style site that has multiple
parties trying to add messages, etc.  Have you had much success
using it in a production environment?  I realize Slashdot and I
think Sourceforge do, but they have their share of troubles.

Of course, the Postgres Python bindings may be just as bad from your
perspective.  :-)

Thanks,

-Brent



From x_mst at propack-data.com  Fri Apr 28 11:50:05 2000
From: x_mst at propack-data.com (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Fri, 28 Apr 2000 17:50:05 +0200
Subject: Using BaseHTTPServer
References: 
Message-ID: <3909B32D.734E1F0F@propack-data.com>

Moshe Zadka wrote:
> 
> On Fri, 28 Apr 2000, Lars von Wedel wrote:
> 
> > I assume that I can use BaseHTTPServer as it is. I just need
> > to implement a working request handler, right?
> >
> > Now comes the more fuzzy part:
> >
> > Since I do not want to execute external files but internal methods,
> > I think I could modify CGIHTTPServer by subclassing it and overriding
> > its do_GET() method to decode the request directly? Or would I rather
> > use SimpleHTTPServer, here?

I also started with CGIHTTPServer which does forking. But I wanted to be
able to let it run under Windows => forking is not an option. I modified
all my code to be thread-safe, derived my own handler from
SimpleHTTPServer.SimpleHTTPRequestHandler and used the
SocketServer.ThreadingMixIn for running multi-threaded.

> > Within any of the do_GET methods, how do I access data that has been
> > sent by the client (...&data1=val1?data2=val2?...)?
> 
> Use the CGI module . Just copy the code from CGIHTTPServer to create
> the dictionary, (not as os.environ), and use the cgi module to parse
> that dictionary.

Note: IMHO module cgi is NOT thread-safe (reads sys.stdin and use
os.environ). I'm using my own module cgiforms.py anyway.

See http://web2ldap.de for all of this stuff, especially module
pylib/w2lserver.py for starting the server. Currently I'm working on
letting it run with SSL support with the help of the great M2Crypto
module. Let me know if you want to have a (already working) snapshot of
this...

Ciao, Michael.


From rcc at nospamthanks_jennic.com  Thu Apr 13 11:01:49 2000
From: rcc at nospamthanks_jennic.com (Robert Cragie)
Date: Thu, 13 Apr 2000 15:01:49 GMT
Subject: List mapping?
References: <38f5d68e@news.xtml.co.uk>
Message-ID: 

Nick Trout  wrote in message
news:38f5d68e at news.xtml.co.uk...
> Is there a nice way of pairing up the members to form tuple pairs in
another
> list? ie. like you might to processing input args.
>
> ie. changing ['/a','1','/b','2','/c','3'] into [ ('/a','1'), ('/b','2'),
> ('/c','3') ]
>
> eg:
>
> args = '/a 1 /b 2 /c 3'
> listargs= string.split(args)
> tuplist = []
> i=0
> while i < len(listargs):
>     tuplist.append( (listargs[i],listargs[i+1]) )
>     i = i+2
> for i in tuplist:
>     processargs(i)
>
> or:
>
> args = '/a 1 /b 2 /c 3'
> for i in string.split(args):
>     i = argflag
>     # i want next arg now as a parameter!!!
>
> Can I (you!) get rid of the long winded while loop cleverly?!!  :-)

Try this:
mylist = ['/a','1','/b','2','/c','3']
map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0,
len(mylist), 2))

Robert Cragie




From effbot at telia.com  Wed Apr 26 15:22:09 2000
From: effbot at telia.com (Fredrik Lundh)
Date: Wed, 26 Apr 2000 19:22:09 GMT
Subject: [Python-Dev] Re: Python 1.6a2 Unicode bug (was Re: comparing strings and ints)
References:  <39072F0C.5214E339@lemburg.com>
Message-ID: 

M.-A. Lemburg  wrote:
> Please note that the support for mixing strings and Unicode
> objects is really only there to aid porting applications
> to Unicode.
>
> New code should use Unicode directly and apply all needed
> conversions explicitly using one of the many ways to
> encode or decode Unicode data. The auto-conversions are
> only there to help out and provide some convenience.

does this mean that the 8-bit string type is deprecated ???






From greg at cosc.canterbury.ac.nz  Wed Apr 12 21:25:20 2000
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Thu, 13 Apr 2000 13:25:20 +1200
Subject: issubclass funny business
References:    
Message-ID: <38F52200.A93110A7@cosc.canterbury.ac.nz>

Michael Hudson wrote:
> 
> It'd be nice if when you `reload'ed
> modules that contain classes you could "smash" extant instances of
> those classes so that they were instances of the new class, but I
> can't for the life of me see how you might do this.

I can: when reloading a module containing a class
definition, and there is an existing definition of the
class, replace the contents of the existing class
object instead of making a new one.

Also, it seems to me that the "importing the main
module" problem could be solved by implementing the
running of a script from a file by means of importing
it.

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+


From tuttledon at hotmail.com  Thu Apr 20 22:48:26 2000
From: tuttledon at hotmail.com (Don Tuttle)
Date: Fri, 21 Apr 2000 02:48:26 GMT
Subject: Why MFC instead of Tkinter -- was Re: Pythonwin?
References:  <4QtL4.24$v85.41@news-server.bigpond.net.au>  <7LDL4.534$v85.2563@news-server.bigpond.net.au>  <38ff21b8$0$10972@senator-bedfellow.mit.edu> <38FF281E.5B2DCC71@tismer.com> <38ff823d$0$10971@senator-bedfellow.mit.edu> <2wML4.15897$O7.23504@typhoon.southeast.rr.com> 
Message-ID: <_jPL4.33312$cZ.42202@typhoon.southeast.rr.com>

Thanks again Mark.  I quess I need to learn to "scribble"  and then check
out the Prosise book Brett recommended.

Don


> > With VB,  I've only seen Python mentioned as a COM object to be used by
> VB.
> > Are there other ways?
>
> Probably, but this is the best.  Using this technique, you generally end
> up with all the UI logic (ie, this is selected, so I need to disable these
> controls, etc) written in VB.  Only your "business logic" is done in
> Python.  It probably is possible to do some of the GUI logic in Python,
> but that doesnt make as much sense given VBs IDE support for this.  You
> can swap VB for Delphi in this sentence too...
>
> > With VC++,  I gather you use the dialog editor to generate the MFC code
> that
> > you then plug into Python?  Correct?
>
> Exactly.  With MFC/Pythonwin, you get to create a DLL that contains UI
> resources, and use them.  "Use them" means load them, display them, and
> hook all the messages and notifications for them - ie, your GUI logic ends
> up completely in Python, without the nice, trendy
> "double-click-on-an-object-to-edit-its-event-list" IDE that VB/Delphi give
> you.
>
> Mark.
>
>
>




From rcunning at acm.org  Mon Apr  3 23:57:35 2000
From: rcunning at acm.org (Robert W. Cunningham)
Date: Tue, 04 Apr 2000 03:57:35 GMT
Subject: VMware/Win4Lin/Wine + Linux... and Python?
Message-ID: <38E96834.B500B786@acm.org>

With at least three ways to run Windows applications simultaneously with
Linux applications, it seems to me there may be a need and/or
opportunity to improve the connectivity and interface between the two
worlds.  And I suspect Python may be just the tool to do it.

1. Python has excellent ports on both Win9x and Linux.

2. Python is well able to handle "tricky" UI issues on both platforms,
such as Drag & Drop.

Taking Drag & Drop as an example, there is a need for interoperability
at that level, especially for the huge wave of "newbie" Linux users who
can't abandon their Windows investment all at once.  Making the Windows
and Linux worlds play together a bit better should certainly improve the
acceptance of Linux.

Another example:  Make the Windows Media player available to Linux apps.

But is there a way to get instances of Python on both platforms talking
to each other?  Of course, a socket could be opened and data shuttled
back and forth, but that will be fairly slow and demand a fair amount of
overhead.  Has there been any work done on a higher-level
Python-to-Python interface?

While it is common for Java applets to talk to one another on a
cross-platform basis, the performance is low and the cost is high,
especially when the goal is to expose services available on one system
to applets running on another.  Can Python do this (to quote NASA's Dan
Goldin) "Faster, Better, Cheaper"?

The commercial efforts put forth by VMware and Win4Lin are very
significant, but I feel that Wine will be the way to go in the long run
(I want source).  But that run is a *very* long run, and I feel the
commercial approaches have lots to offer today (especially at the $50
Win4Lin price) that can take some of the intense pressure off of the
Wine developers.

In fact, some form of scriptable interface between Windows and Linux
should have immediate benefits for the Wine community as well, since it
should allow them to displace Windows functionality one piece at a time,
without having to build all the pieces above and below at the same time
(a development and debugging nightmare).

At the bottom level, I feel it should be possible to establish a common
"Python space" between the two OS's, possibly running a single Python
engine, that delivers services to both.  Or, more simply, a Python
package for each OS that establishes an interface and provides services
to independent Python instances running under each OS.  Either way, it
seems to me there is great potential for some very fast gains to be
made.

On a related tangent:  Could such an interface be added to a remote
control product (VNC?) to better integrate remote Windows systems and
applications into the Linux desktop?  Is it just a matter of scale, or
more?  What about those curious Windows Terminal Servers and Citrix
products, and the applications they serve up?  While it would probably
require lots of network bandwidth, the underlying idea seems to be the
same, IMHO.

I have already dangled the idea before Trelos, the makers of Win4Lin,
and they are definitely excited by the possibilities.  Plus, with
Win4Lin being a commercial product, an inter-OS Python interface would
allow Trelos to expose interfaces without having to give away any of
their code (or revenue).  And this is one group that sure seems to be
earning their money, even given their unfortunate lack of support for
Open Source.  Python may well be the wedge needed to open that door.

What do you all think?  Insane?  Worthless?  Useless?  Or the greatest
thing since vi and edlin?

And, even if it is a good idea, can it be made to work?  If so, then
how?


Regards,

-BobC




From aycock at csc.uvic.ca  Mon Apr  3 16:04:28 2000
From: aycock at csc.uvic.ca (John Aycock)
Date: 3 Apr 2000 20:04:28 GMT
Subject: Python 1.6 alpha 1 released
References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E52716.A1C63B5D@roguewave.com>  <38E52D76.1820FC32@roguewave.com> <8c7tfd$k80$1@nntp9.atl.mindspring.net>
Message-ID: <8catgc$5i84$1@uvaix7e1.comp.UVic.CA>

Aahz Maruch  wrote:
> 
> I'm sympathetic.  We only upgraded our production system from 1.5.1 to
> 1.5.2 last week, because we'd made a number of 1.5.1-specific hacks and
> had to back them out correctly for 1.5.2.  Now we'll have to do the same
> for 1.6, but as with the 1.5.2 upgrade, we don't have to follow Guido's
> timeline.

I'm not going to take sides here, but I coincidentally just finished
reading something highly relevant:

	`I'd like to insist that if they [the programming languages
	 people] add something to a language, or change something in
	 a language, they also provide us with the algorithm which will
	 make the transfer in our programs so that we can automatically
	 translate our programs...'

That's part of the keynote address made by (the late) Grace Murray Hopper
to the 1978 ACM History of Programming Languages Conference.  Excellent
reading.

Although I don't have time to volunteer, it wouldn't be too difficult
to write a program which would look through existing Python code and
warn of potential uses of these changed constructs.

John


From pecora at anvil.nrl.navy.mil  Sun Apr 30 09:53:34 2000
From: pecora at anvil.nrl.navy.mil (Louis M. Pecora)
Date: Sun, 30 Apr 2000 13:53:34 GMT
Subject: Do I always have to write "self." ?
References: <270420001706386648%pecora@anvil.nrl.navy.mil>  <280420000746597329%pecora@anvil.nrl.navy.mil> 
Message-ID: <300420000953359862%pecora@anvil.nrl.navy.mil>

In article ,
Remco Gerlich  wrote:

> 
> No, you can just declare methods like
> 
> class Foo:
>    def Method(s,x):
>       s.y = x
> 
> The name 'self' is just a convention.

Ahhhh...gotcha.  I keep forgetting how type-lose Python is.  And how
flexible.  Thank you.


From spin at fastlink.com.au  Sat Apr 15 00:27:42 2000
From: spin at fastlink.com.au (Malcolm Valentine)
Date: Sat, 15 Apr 2000 04:27:42 GMT
Subject: Python paradigms
References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk>  <8ctc9m$sp2$1@pegasus.csx.cam.ac.uk> <8ctkm5$bko$2@newshost.accu.uu.nl> <8cur12$5pf$1@pegasus.csx.cam.ac.uk> <8cv91s$q2i$1@newshost.accu.uu.nl>
Message-ID: 

m.faassen at vet.uu.nl aka Martijn Faassen posted:

>Nick Maclaren  wrote:
>> Sometimes they do; sometimes they
>> don't.  I have seen codes where the median size of functions was
>> below 5 lines, and you had to keep the specification of over 50 in
>> your head just to read the simplest function!
>
>Didn't the functions have readable names then? Of course it's silly
>to take all this to ridiculous extremes, but if the naming was
>done well you have a lot of contextual information when you're reading
>a function which you wouldn't have otherwise.

  I think the murkiness is introduced when one has to remember what
exactly each of the smaller functions returns, and what each of them
does in the way of handling erroneos input,etc.

>> If you remember, I asked whether there were any equivalent to a
>> couple of very common paradigms, that have been used to clarify
>> code for over 30 years.
>
>Obfuscate code at least as often as clarify.

  The ?: operator is quite neat and easily parsed by a human reader
when it is one a single line, or two. When someone uses them in a 
huge multi-line construct filled with ->*||&&"'\ you know there is a
publican and an optomotrist in their family.


>in your first post, but I disagree that your ?: construction makes the
>code more easy to read than than various alternatives. I can grok C's
>(?:), but its main advantage is that it makes code more writeable, not
>more readable, in my opinion. Likewise any replacement to enable the

I'd say it ranks the same as the following;

    a,b,c,e,f,g = tupple_ware

  Note, I'm not knocking the above, but it isn't as simple as it looks.


>In general, the pattern in Python is that it avoids several handy but
>easy to convolute constructs; for instance we have no C style 
>for(;;) loop either, while it's clearly the general case. Instead in
                        1: Is not really any different.
                        
>No 'heretical'. Just trade-offs. Python's idioms for writing Python. The
>strategy does have a pay-off: Python code tends to be fairly readable.

  The great advantage I think is that despites ones particular methods
of coding practise, everyone can read everyone else's Python with a lot
more ease then is common in a language like C.

Cheers,
  Malcolm Valentine.


From python at rose164.wuh.wustl.edu  Thu Apr 13 07:25:32 2000
From: python at rose164.wuh.wustl.edu (David Fisher)
Date: Thu, 13 Apr 2000 06:25:32 -0500
Subject: Deadlocking IDLE under Win32
References: <8cuudo$8pj$1@pegasus.csx.cam.ac.uk> 
Message-ID: <00aa01bfa53b$2fe73bc0$0201a8c0@spkydomain>

----- Original Message -----
From: "Mark Hammond" 


> My guess is that the "print" under IDLE is not thread-safe.  Change the
> program to not print (or to append items to a queue, which the main thread
> then prints) and see if this is the problem.

You are correct sir.  Of course, your guess is a bit more educated that most
.  I ran into the problem printing from multiple threads in IDLE a
while ago, and just assumed it was something that everybody new about
already.  I'm pretty new to python.

While I'm here, I want to say thanks for win32com.  It totally kicks booty.
I have never done anything with COM before and in the last three days I
wrote a COM server to read data from several meters on a testing maching and
load them real-time into an Excel workbook.  Now the users who can't program
can edit the spreadsheet to change formulas and change how the report looks
on their own.

I still don't understand what's going on when I register the server, or how
the VBA object calls get to python, but I works great.

And while I'm at it, thanks for the win32 threads too.  I needed to change
thread priority, and there the solution was.  Too bad I had already hacked
thread_nt.h to allow me to do the same thing before I thought to check the
newsgroup.  I use your version though.  In case I ever want someone else to
run my code .

I could go on but you get the point.
David





From just at letterror.com  Thu Apr 20 02:45:54 2000
From: just at letterror.com (Just van Rossum)
Date: Thu, 20 Apr 2000 07:45:54 +0100
Subject: __del__ problem - would adopting Garbage Collection fix this?
In-Reply-To: 
References: 
 <7ojL4.9424$HG1.254543@nnrp1.uunet.ca>
 
 
 <38FE7F1E.168E914A@cosc.canterbury.ac.nz>
Message-ID: 

At 4:50 AM +0000 20-04-2000, Neil Schemenauer wrote:
>When garbage is found by the collector (ie. reference cycles not
>reachable from Python), all objects reachable from __del__
>methods are moved into a separate set.  This is what I call
>uncollectable garbage.  Uncollectable instances are currently
>added to a global list of uncollectable objects reachable from
>within Python.  If the programmer creates such garbage it is up
>to them to deal with it.
>
>The bottom line is don't add __del__ methods to objects that form
>cycles.  It is, however, okay to reference objects with __del__
>methods from objects involved in reference cycles.

Hm, wouldn't it be better to collect cyclic objects with __del__ anyway,
and just not call __del__? Possibly printing something to stderr, similarly
to when an exception occurs within a __del__ method.

Just





From sp00fD at yahoo.com  Tue Apr 18 07:55:27 2000
From: sp00fD at yahoo.com (sp00fD)
Date: Tue, 18 Apr 2000 11:55:27 GMT
Subject: gaming and python
References: <000c01bfa91c$f421d6a0$0f8d0b3f@oemcomputer>
Message-ID: <8dhifa$aom$1@nnrp1.deja.com>

Well, I'd have a hard time believing that you could program something
like quake, but you could probably do a decent job with tetris or the
like.  Check out PySDL http://pysdl.sourceforge.net/, I haven't used
it, but it's probably exactly what you need, SDL is apparently a cross
platform library for game programming.  Also, check out PySol
http://wildsau.idv.uni-linz.ac.at/mfx/pysol.html, an excellent and very
well done game of solitare + 156 (or so).

Mike

In article <000c01bfa91c$f421d6a0$0f8d0b3f at oemcomputer>,
  "mrnatch"  wrote:
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0009_01BFA8E2.46AECF80
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> I told a friend of mine that I am learning to program using Python (I
=
> chose Python as my first language on the advice of a Llama) and he
asked =
> me an interesting question: Can Python be used for programming video =
> games? And does it work with Windows API? Just curious.
> Thanks,=20
> Josh (And friend Tony)
>
> ------=_NextPart_000_0009_01BFA8E2.46AECF80
> Content-Type: text/html;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> 
> 
>  http-equiv=3DContent-Type>
> 
> 
> 
> 
> 
I told a friend of mine that I am = > learning to=20 > program using Python (I chose Python as my first language on the advice = > of a=20 > Llama) and he asked me an interesting question: Can Python be used for=20 > programming video games? And does it work with Windows API? Just=20 > curious.
>
Thanks,
>
Josh (And friend = > Tony)
> > ------=_NextPart_000_0009_01BFA8E2.46AECF80-- > > Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Sun Apr 2 09:42:38 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 02 Apr 2000 14:42:38 +0100 Subject: Emacs Python mode References: Message-ID: Vetle Roeim writes: > ..once python.org gets back up, of course. There are mirrors all over; my usual one is http://sunsite.doc.ic.ac.uk/Mirrors/ftp.python.org/pub/www.python.org/ (but they don't carry the pipermail arhives, grr.) M. -- well, take it from an old hand: the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -- Erik Naggum, comp.lang.lisp From mfletch at tpresence.com Thu Apr 20 10:13:34 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 20 Apr 2000 10:13:34 -0400 Subject: Python Parsers Comparison Message-ID: Here's part of it :) Note: for heavy-lifting applications you'd likely want to define a custom mxTextTools tuple tree to just appending the interpreted numbers to the parse tree (instead of the 4-tuples) (likely also want to make the grammar distinguish between hex, float and int). from simpleparse import generator from TextTools import TextTools import string class Parser: def __init__( self, string ): self.data = string self.position = 0 def parse( self, parseonly = 0 ): success, tags, next = TextTools.tag( self.data, ROOTITEMPARSER) if parseonly: return success, tags, next ## import pprint ## pprint.pprint( tags ) return success, map( self._dispatch, tags ), next def _dispatch( self, (tag, start, stop, children)): return getattr( self, tag)( (tag, start, stop, children) ) # tag handlers def element( self, (tag, start, stop, (child,) )): '''Always has a single child, either vector or number''' return self._dispatch( child ) def vector( self, (tag, start, stop, elements)): '''Some arbitrary number of elements, return as list''' return map( self._dispatch, elements ) def number( self, (tag, start, stop, children)): '''Could be either int or float, check first, then second''' try: return string.atoi( self.data[start:stop], 0 ) except ValueError: return string.atof( self.data[start:stop] ) PARSERDECLARATION = r'''root := ts, element* vector := '[', ts, element*, ']' element := (vector/number), ts number := [-+]*, ( ('0',[xX],[0-9]+) / ([0-9.]+,([eE],[-+0-9.]+)?)) := ( [ \011-\015,]+ / ('#',-'\012'*,'\n')+ )* ''' PARSERTABLE = generator.buildParser( PARSERDECLARATION ) ROOTITEMPARSER = PARSERTABLE.parserbyname( "root" ) if __name__ == "__main__": for testString in [ '''2''', '''[2]''', '''[ 2 ]''', '''[]''', '''[ 2 ]''', '''[ []]''', '''[ 1,2 ]''', '''[ [ 1,2 ],[ 3,4 ] ], [ 5.6 ]''', ]: print Parser( testString).parse() speedtest = '''[ [ 1,2 ],[ 3,4 ] ], [ 5.6 ]'''* 5000 import time print 'starting speed test, string length', len(speedtest) t = time.time() elements = len( Parser( speedtest).parse()[1]) print elements, "elements parsed in", time.time()-t, "seconds" print 'starting parse-only speed test' t = time.time() elements = len( Parser( speedtest).parse(parseonly=1)[1]) print elements, "elements parsed in", time.time()-t, "seconds" -----Original Message----- From: Randall Hopper [mailto:aa8vb at yahoo.com] Sent: Thursday, April 20, 2000 9:40 AM To: python-list at python.org Subject: Python Parsers Comparison I'm again faced with the "regexes not powerful enough for nested grammar" problem, and need to chose an extension. Does someone know of a web page or paper which compares the various Python parser engines on a simple example grammar (or on features)? For example, a comma-separated list of nested vectors would be a good example: [ 1, 2 ], [ 3, 4 ] [ [ 1,2 ],[ 3,4 ] ], [ 5.6 ] etc. mxTextTools, metalanguage, SimpleParse, SPARK, YAPPS, PyLR, kwParsing, PyBison. A comparison of any subset would be useful. Thanks, Randall -- Randall Hopper aa8vb at yahoo.com -- http://www.python.org/mailman/listinfo/python-list From Jhlee at Brooks.com Wed Apr 12 17:06:31 2000 From: Jhlee at Brooks.com (Lee, Jaeho) Date: Wed, 12 Apr 2000 17:06:31 -0400 Subject: running python script on ksh on NT Message-ID: <857F15D7E3D8D3118D290008C7CF0586270761@mail-naeast1.brooks.com> Hi all. I am using MKS ksh on NT 4.0. I could run on NT cmd. But not on ksh. I tried several option such as the first line #!D:/progra~1/python/python. How can I run .py file on ksh. python directory is in my path. Thanks, Jaeho Lee From bjorn at roguewave.com Thu Apr 27 20:40:48 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Thu, 27 Apr 2000 18:40:48 -0600 Subject: Python does not let me format time. References: <8eakhq$797$1@nnrp1.deja.com> Message-ID: <3908DE10.2BBAB862@roguewave.com> Sindh wrote: > > Hi folks > > I have a file full of date, value pairs. Date is like MM/DD/YY. My > problem is I want to format this file since it contains a few thousand > lines of data , using python. I tried using string and time modules. I > want to format the time value to a float which is returned by > time.gmtime normally. I tried to split it and to use parts of it to make > a tuple and to use time.mktime but it says illegal operation for > builtin. > > Summary: > > data is: > 03/11/98 abcd > 03/12/98 efgh > > I split it to > x=string.split(n[0],' ') > which gave me x='03/11/98' > Now I split it again by > x=string.split(x,'/') > which gave a tuple of '03','11','98' > Now I tried to make time as > time.mktime(x[2],x[0],x[1],'','','','','','') > The problem is it says illegal operation for builtin. I tried to use the > string val and int val as the arguments for mktime. > > Anyone with any helpful ideas!! > > If there is already a moduls to do the same , much helpful. time.mktime() needs integer arguments, and the result of string.split is a list of strings. Changing it to: time.mktime(int(x[2]),int(x[0]),int(x[1]),0,0,0,0,0,0) should probably work (I didn't check how many arguments it requires ;-) -- bjorn From gonter at zechine.wu-wien.ac.at Thu Apr 27 13:12:16 2000 From: gonter at zechine.wu-wien.ac.at (Gerhard Gonter) Date: Thu, 27 Apr 2000 19:12:16 +0200 Subject: Using python on the web References: <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> <8ds81f$qne$1@mozo.cc.purdue.edu> Message-ID: <390874F0.E23C67FF@zechine.wu-wien.ac.at> Kyler Laird wrote: > Hmmm...cgi-wrapper doesn't work with mod_perl (or > mod_php, or ...), right? > > (This is why I built my own system to do the job.) Could you expand on this issue, e.g. post an url? +gg From embed at geocities.com Thu Apr 13 09:18:23 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 13 Apr 2000 09:18:23 -0400 Subject: Comparing PythonWin and IDLE? Message-ID: On Win32 I have noticed the following two things about IDLE and PythonWin: - When running a script with a lot of PRINT statements, IDLE is much nicer, in that the output window is updated during the run of the program, whereas the output window appears "frozen" and does not repaint in PythonWin until program execution halts (program completes normally, or an exception occurs). This makes IDLE more useable. - PythonWin's Editor window is much faster and more crisp on my machine (Pentium-II 400). I suspect this is because Tcl/Tk doesn't use native widgets, and the Tcl/Tk editor widget is therefore somewhat more 'inefficient', in the name of greater portability. Something I have noticed on BOTH IDLE and PythonWin, is that once a module appears loaded into memory there is no "soft reset" feature in either one. I used to use a language called CA-Realizer from Computer Associates. It was an interpreter, and you could hit Ctrl-Z to restore the state of the interpreter to what it was when it started up. That is, you could hit Ctrl-Z instead of shutting down the IDE and restarting it. I find once a module has been imported once, it often will not import again, even if I have changed the source (.py) file, the .pyc file does not appear to be regenerated, and any errors in the .py file can only be fixed by editing and saving the .py file, quitting the IDE and restarting. This appears to happen for both IDLE and Python. Anybody else seen this? Warren Postma From smalleys at gte.net Fri Apr 14 00:52:54 2000 From: smalleys at gte.net (sue) Date: Fri, 14 Apr 2000 04:52:54 GMT Subject: need help just begining References: <11822ca0.dd34a400@usw-ex0109-068.remarq.com> <38F41190.C0BB507B@sympatico.ca> <38F53E5A.977913FE@cosc.canterbury.ac.nz> <38F54D83.B0F620A8@callware.com> Message-ID: <38F69621.3B8F5B29@gte.net> Goody! Another Python book! I'll try to get one Saturday. I think Learning Python is the best intro to a modern programming language that I've seen to date. I'll be interested to see how 24 Hours compares. I have recommended Learning Python to four people, including a manager and a teenager, neither of whom had much programming experience. Three of the four now like and use python. (The fourth thinks TCL is great. Oh well.) When I showed them Perl, TCL, C, C++, Java, they said "What's all this weird stuff? Semi-colons, braces, types? I have to type pages of code to duplicate ten lines of Python!" You need to start them off right. Guido's educational project is dead on. Try explaining why C++ implicit type conversions are evil to a new programmer who thinks they're "neat". Sue. From timehorse at unforgettable.com Thu Apr 27 19:01:01 2000 From: timehorse at unforgettable.com (timehorse at unforgettable.com) Date: Thu, 27 Apr 2000 23:01:01 GMT Subject: mail forwarding not working on the starship? References: <3908538A.E74456A5@GermanLloyd.org> Message-ID: <8eagr4$30h$1@nnrp1.deja.com> In article <3908538A.E74456A5 at GermanLloyd.org>, Berthold Hoellmann wrote: > Now that my .starship_info is set up to forward my mail, any test mail > send to my starship account still seems to be lost somwhere without any > error message. My starship address is "bhoel at starship.python.net" and > mail should be forwarded to "se6y095 at public.uni-hamburg.de". > > Is anyone out there who can help me? Hi Berthold, I have been doing a lot of research on this issue as Andrew installed an SSH key for me yesterday and now I have access to my A/C [Thanks again Andrew! :) ]. Anyway, one thing that everyone on Starship should know is that we are no longer using SENDMAIL as our transport agent. We have been moved to qmail as it is LEAPS AND BOUNDS easier to maintain. This is obvious simply from the REAMS of man pages associated with QMail installed on every possible mail topic from where to store your mailbox to how to detect, trace and prevent forged mail. Now, one thing I have observed is that QMail no longer uses the Sendmail .forward scripts directly, and thus your mail will not be forwarded using the old method I used to use. Instead, you have a .qmail file in your home directory and that can act as your .forward file. The format is simple: # for a comment | for a pipe [&]
for a forwarding address, the Ampersand (&) is only required when the e- mail address does not start with an alphanumeric character. The address must be a valid internet address with a fully-qualified domain name. // ./ Store the mail in with path . // ./ Use the path specified as the mail storage folder. Now, if you still want to use your old .forward file from before, you can do this too. Basically you put a line in your .qmail file something like: |dot-forward [-nN] .forward -N: Read and forward the message [default] -n: Parse the file and print out the instructions it contains, usually used for debugging on the command line. Again, please read the man page to check the exact syntax. So, for you Bertold, I would suggest setting up a .qmail file with: &se6y095 at public.uni-hamburg.de As its only entry. That SHOULD in THEORY get things to where they ought to be. I can verify that when I send mail on starship to my starship account, the forwarding works. HOWEVER, I still can't receive mail from outside the ship! I have a friend who told me there was an infinite hop count with one of his mails, but that was before I set up the .qmail file and all the test mails I send seem to disappear into oblivion like yours. It is very distressing as I have had to deal with the same thing when posting to the mailing lists I maintain on eGroups using the Web interface. As it is, deja.com may be my only way of communicating with people. :( Anyway, that you and I are both experiencing the evil mail void, I don't have any idea what could be wrong. Originally I though it may be that the .forwarding was set by a super-user account so I was searching Starship for occurrences of my official e-mail address in case it may be forwarding to the wrong address, but so far I have found naught. Does anyone else know more about QMail to explain why e-mail is not being delivered? Berthold and I would appreciate any help greatly! Thanks and hope my little man-page summary will help others. Remember: .qmail, NOT .forward. :) Be Seeing You, Jeffrey. Sent via Deja.com http://www.deja.com/ Before you buy. From bpetterson at uswest.net Sun Apr 2 17:25:24 2000 From: bpetterson at uswest.net (Bjorn Pettersen) Date: Sun, 02 Apr 2000 15:25:24 -0600 Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E5205F.DE811F61@roguewave.com> <38E58D2D.384F1546@Lugoj.Com> <38E6B929.28816494@roguewave.com> Message-ID: <38E7BAC4.3B7AD0FF@uswest.net> Fredrik Lundh wrote: > Bjorn Pettersen wrote: > > I haven't seen anyone claim that examples in the manual are not > > documentation... > > in earlier releases of the library reference, some examples > didn't even work. you still think they're formally binding? Are you saying none of the examples are binding, formally or otherwise? I certainly expect that when code in the documentation works as presented that I can rely on it -- I don't think that's a particularily surprising position to have. (Even in the C++ standard where examples are _explicitly_ not normative, they're usually fixed if conflicting with normative text.) > > It would be very nice if "someone" could do that, but based on the > > rethoric I've seen from you on this issue, and the absence of comment > > from Guido, I certainly don't feel confident that it would be accepted. > > you don't know that until you've tried it... I usually try to limit my excercises in futility. Your other arguments for a patch are good, but seems to reinforce the feeling that changing this behavior was ill though out in the first place. (and remember that not all companies have enough Python expertise that a traceback leads to a fix ten minutes later) -b From alvaro at ocse.infonegocio.com Wed Apr 26 08:03:16 2000 From: alvaro at ocse.infonegocio.com (AMR) Date: Wed, 26 Apr 2000 14:03:16 +0200 Subject: Closing Excel 97 with Python Message-ID: <8e6lhb$8h93@esiami.tsai.es> Hello, I'm using COM to exchange information with Excel and my problem is the next. This is my way to open Excel: self.o = win32com.client.dynamic.Dispatch("Excel.Application") self.o.Visible = Visible self.o.Workbooks.Open(self.MyFile) And this is my way to close Excel: self.o.Visible = 0 self.o.Workbooks(1).Close(0) self.o.Workbooks.Close() self.o.Quit ## For try something After this Excel is still opened in the task administrator, and when I try to open Excel again from python i only see the menu , status bar and the tool bar. I have to open the full view of excel to see the worksheet. If you have a clue to close Excel 97... Thank you anyway, From tom__98 at my-deja.com Tue Apr 11 23:09:26 2000 From: tom__98 at my-deja.com (tom__98 at my-deja.com) Date: Wed, 12 Apr 2000 03:09:26 GMT Subject: Python/Perl Popularity (Re: A Mountain of Perl...) References: <200004102111.HAA03380@envy.fulcrum.com.au> Message-ID: <8d0pcq$7ti$1@nnrp1.deja.com> In article <200004102111.HAA03380 at envy.fulcrum.com.au>, Richard.Jones at fulcrum.com.au wrote: > Tom you little troll-meister. Half those arguments > you cite are bollocks if you _really_ knew and > "greatly prefer" Python. Try again. Maybe you can contribute more constructively: -- How can I browse the Python documentation without firing up a web browser? How do I get information on a single Python function or class quickly? Is there any equivalent of "perldoc -f split" or "perldoc Net::POP3"? What do you do in that situation? -- Is there a Python equivalent of CPAN and the Perl CPAN module? The closest I know of is Parnassus. But Parnassus is merely a collection of links, not an archive, and it doesn't have any facilities (AFAIK) for automatic installation. -- Several extensions I have wanted to install have required access to the full Python source tree, not just the header files and the library. Is that going to change? Otherwise, how can I install Python extensions that want access to the source tree on, say, a standard RedHat system? Having the standard RPM-based installation in parallel with a /usr/local installation from source is confusing, and removing the RPM-based installation risks breaking things. Tom. Sent via Deja.com http://www.deja.com/ Before you buy. From kilian.lorenz at dkfz-heidelberg.de Sun Apr 9 15:52:34 2000 From: kilian.lorenz at dkfz-heidelberg.de (Kilian Lorenz) Date: Sun, 09 Apr 2000 21:52:34 +0200 Subject: Cascading menus References: <8cko46$j2i$1@nnrp1.deja.com> Message-ID: <38F0DF82.EEAB208D@dkfz-heidelberg.de> Perhaps you can solve your problem by using the postcommand option. When the menu is posted this function/method is called and probably you can change your sub menu there. I don't expect that anyone estimates code to be run anytime a menu item is selected a very clever idea since with an indecisive user this could happen quite frequently and I can't think of a good reason why there should be done something else in the second call than in the first call (except perhaps making a statistic about menu usage). But I don't speak for the whole Python/Tkinter/Tk-community and who knows ... nobody expects the Spanish Inquisition either ... Regards, Kilian From effbot at telia.com Thu Apr 13 02:58:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 13 Apr 2000 06:58:42 GMT Subject: Python idiom: Multiple search-and-replace References: <20000412100816.A2431031@vislab.epa.gov><5C%I4.645$rc9.190288896@newsb.telia.net> <20000412120012.D2446939@vislab.epa.gov><0s1J4.655$rc9.190631424@newsb.telia.net> Message-ID: David Goodger wrote: > on 2000-04-12 12:25, Fredrik Lundh (effbot at telia.com) wrote: > > while you're at it, try replacing the original readline loop with: > > > > while 1: > > lines = fp.readlines(BUFFERSIZE) > > if not lines: > > break > > lines = string.join(lines, "") > > lines = re.sub(...) > > out_fp.write(lines) > > > > where BUFFERSIZE is 1000000 or so... > > why not just, > > while 1: > lines = fp.read(BUFFERSIZE) > if not lines: > break > lines = re.sub(...) > out_fp.write(lines) > > ? Saves the string.join() step. Or am I missing something? (I await > enlightenment...) set BUFFERSIZE to 1 try replacing "foo" with "bar" await enlightenment (not that it cannot be fixed, of course. just add code to strip off the last incomplete line and prepend it to the next read. make sure you don't mess up if the last character in the file is not a newline) From warlock at eskimo.com Tue Apr 4 22:55:51 2000 From: warlock at eskimo.com (Jim Richardson) Date: Wed, 05 Apr 2000 02:55:51 GMT Subject: opening a serial port at a given baudrate. How? References: <200004041153.VAA15869@piglet.dstc.edu.au> Message-ID: On 04 Apr 2000 22:20:25 +0300, Erno Kuusela, in the persona of , brought forth the following words...: >>>>>> "davida" == David Arnold writes: > davida> on unix (including linux), just open the device special > davida> file corresponding to the serial port of interest > davida> (ie. /dev/ttyS0) and you can then control it using > davida> fcntl.ioctl() function and otherwise read from and write > davida> to it like a normal file object. > >i believe the termios module is for ftwiddling with serial >ports on unix. see for example ftp://ftp.tummy.com/pub/tummy/cid/ >for example code. Thanks -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From robin at jessikat.demon.co.uk Fri Apr 14 18:41:32 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 14 Apr 2000 23:41:32 +0100 Subject: ANN: Python training in Boulder References: <000101bfa571$e31a43a0$71d95da6@lutz> <38F78406.2032D7AB@boi.hp.com> Message-ID: In article <38F78406.2032D7AB at boi.hp.com>, Bill Anderson writes >Mark Lutz wrote: >> >> This is to announce that the second Python training session >> to be held at Tom Christiansen's site in Boulder, Colorado, >> will be held May 24-26. >> >> These classes are equivalent to the on-site Python training I >> offer, and are open to individuals on a first-come first-served >> basis. I am the instructor, but all registration details are >> handled by Tom's company. For more information, please visit >> these pages: >> >> http://home.rmi.net/~lutz/boulder-classes.html (my page) >> http://training.perl.com/open-courses.html (tom's page) > ^^^^^^^^^ > >Maybe it's me, but something seems fundamentally wrong here. ;^) > > > I already saw something a bit blien about the idea Of TC + Python, but his comparison perl-->Python was very good. -- Robin Becker From chafik at nevrax.com Wed Apr 5 04:35:15 2000 From: chafik at nevrax.com (Sameh chafik pro) Date: Wed, 5 Apr 2000 10:35:15 +0200 Subject: (no subject) Message-ID: <006b01bf9ed9$dd9b5660$1001a8c0@nevrax.net> Hello evry body, Are there any way to have the python16_d.lib and .dll, or the python15_d.dll ????? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjg at avalongroup.net Tue Apr 11 15:24:41 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Tue, 11 Apr 2000 12:24:41 -0700 Subject: Trouble with Tkinter under IDLE References: <8F139460Canthonylander@47.80.11.122> Message-ID: <38F37BF9.DCAB3570@exceptionalminds.com> Anthony Lander wrote: > All of this works just fine from the command line, though, so I'm pretty > convinced it's a problem related to running Idle. > > I'm running Python 1.5.2, idle 0.6 and tcl/tk 8.0 all under NT. > > Anyone have any guesses? > > Thanks much, I believe that the solution is *not* to call mainloop() from your programme as it is conflicting with the mainloop() of IDLE. Though I don't use IDLE, I do believe that the mainloop in IDLE will allow your code to run correctly without you calling it. -- Stand Fast, tjg. Timothy Grant tjg at exceptionalminds.com Chief Technology Officer www.exceptionalminds.com Red Hat Certified Engineer (503) 246-3630 Avalon Technology Group, Inc. fax (503) 246-3124 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From sblakey at freei.com Thu Apr 27 19:30:48 2000 From: sblakey at freei.com (Sean Blakey) Date: Thu, 27 Apr 2000 23:30:48 +0000 Subject: Simple Modules Question References: <8eaaul$16p@autodesk.autodesk.com> Message-ID: <3908CDA8.25428F36@freei.com> Akira Kiyomiya wrote: > > I see NameError when I try to do string.atoi("45"). > > Is it because 'string' is at a different location?? > > Thanks > > Akira > > from string import atoi # imports 'string' > # places atoi in current namespace > print atoi("12345") # invokes 'atoi' without module name > > string.atoi("45") # NameError: string > > -- > http://www.python.org/mailman/listinfo/python-list When you run "from string import atoi" python remembers the name "atoi", but does not remember where it got atoi from (string). Python only keeps access to the string module long enough to get the names you selected. This confusing weirdness is one of the many reasons I prefer to use a simple "import string". You seem to expect "from string import atoi" to be essentially like the following code: >>>import string >>>atoi = string.atoi The more accurate equivalent of "from string import atoi" is >>>import string >>>atoi = string.atoi >>>del string I could be wrong about this (haven't looked at the source in a while), but thinking about it this way has worked for me so far. -- Sean Blakey FreeInternet.com sblakey at freei.com (253)796-6500x1025 From markx.daley at intel.com Tue Apr 25 17:02:46 2000 From: markx.daley at intel.com (Daley, MarkX) Date: Tue, 25 Apr 2000 14:02:46 -0700 Subject: mxODBC error trapping Message-ID: >>Daley, MarkX wrote: >> I am accessing databases using the notes by John Dell'Aquila for ODBC using >> Python Database API. It works fine, but now I am trying to set up error >> trapping in the event that a connection fails to be made. Here is the basic >> code structure: >> >> def collect(): >> "Routine to query all servers for all names for time period defined >> in timer." >> # Define some variables >> for index in servername: >> try: >> # Big routine to collect data and write to file >> except dbi.operation-error: >> servername.append(index) >"operation-error" is not a valid name (it's interpreted >as "operation" minus "error"). >> I guess I don't know enough about exceptions to trap them properly. Any >> hints? >according to the DB specification [1], OperationalError is the >correct name. you still have to qualify it with the module name, >though: > try: > ... > except dbi.OperationalError: > ... >if that doesn't work, try printing the contents of the "dbi" module: >print dir(dbi) > >1) http://www.python.org/topics/database/DatabaseAPI-2.0.html When I use dbi.OperationalError, I get this result: Traceback (innermost last): File "", line 1, in ? collect.collect() File "C:\PROGRA~1\Python\collect.py", line 50, in collect except dbi.OperationalError: AttributeError: OperationalError Here is the printout of the dbi module: ['DATE', 'NUMBER', 'RAW', 'ROWID', 'STRING', 'TYPES', '__doc__', '__file__', '__name__', 'dataError', 'dbDate', 'dbRaw', 'dbiDate', 'dbiRaw', 'integrityError', 'internalError', 'noError', 'opError', 'progError'] I am way out of my depth here. Any and all help is appreciated. - Mark From tuttledon at hotmail.com Thu Apr 20 18:59:17 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Thu, 20 Apr 2000 22:59:17 GMT Subject: Why MFC instead of Tkinter -- was Re: Pythonwin? References: <4QtL4.24$v85.41@news-server.bigpond.net.au> <7LDL4.534$v85.2563@news-server.bigpond.net.au> Message-ID: <9ZLL4.15615$O7.23007@typhoon.southeast.rr.com> "Michael A. Crawford" > I'm curious. Why did you not steer him in the Tkinter direction for his GUI > needs? Er...maybe it was because A[r]TA's question was about MFC and not Tkinter! ;-) Don From tismer at tismer.com Mon Apr 17 10:48:42 2000 From: tismer at tismer.com (Christian Tismer) Date: Mon, 17 Apr 2000 16:48:42 +0200 Subject: Was Re: [ANNOUNCE] Garbage collection for Python, now Stackless comments References: <20000407221750.A29279@acs.ucalgary.ca> <38F9F01B.57273052@tismer.com> <38FA05C9.442868E4@tismer.com> <38FAEEC9.B5CED499@webwitches.com> Message-ID: <38FB244A.77BB7196@tismer.com> Shae Erisson wrote: > > Christian Tismer wrote: [stuff about continuations, whether to hide them or not] > So when do we get to Pickle continuation objects and send them out > across the network, or even better, to another VM running on a second > processor? :) This is on my task list for 1.3 or 1.4, but it isn't trivial. It is also quite different, since its relation to continuation is much less than you might think. ontinuations and frames are quite simple to pickle, but this doesn't solve the whole problem. I must figure out what to pickle at all, and I have to catch the state of the current interpreter and restore it. This is hard, since I might be in an import or in a C extension that calls an interpreter, and so on. Unless Stackless isn't completely stackless, the pickling problem is not any simpler than before. > Personally, I think continuations and coroutines are beautiful, and > easier and simpler than threads. Yay Christian! (and Yay Guido for > writing Python!) Please let me take 10000 clones from you :-) > PS. Can someone point me to example code for building smalltalk style > closures easily with continuations? Can you point me to a paper about smalltalk closures? I don't have a blank idea at all. ciao - the clueless implementor -- Christian Tismer :^) Applied Biometrics GmbH : 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 gward at mems-exchange.org Fri Apr 7 09:15:46 2000 From: gward at mems-exchange.org (Greg Ward) Date: Fri, 7 Apr 2000 09:15:46 -0400 Subject: [Python-Dev] Round Bug in Python 1.6? In-Reply-To: ; from mikael@isy.liu.se on Fri, Apr 07, 2000 at 02:57:38PM +0200 References: <20000407084914.A13606@mems-exchange.org> Message-ID: <20000407091545.B13606@mems-exchange.org> On 07 April 2000, Mikael Olofsson said: > > On 07-Apr-00 Greg Ward wrote: > > Oh, joy! oh happiness! someday soon, I may be able to type > > "blah.__doc__" at the interactive prompt and get a readable result! > > Just i case... I hope you haven't missed "print blah.__doc__". Yeah, I know: my usual mode of operation is this: >>> blah.__doc__ ...repr of docstring... ...sound of me cursing... >>> print blah.__doc__ The real reason for using str() at the interactive prompt is not to save me keystrokes, but because it just seems like the sensible thing to do. People who understand the str/repr difference, and really want the repr version, can slap backquotes around whatever they're printing. Greg From gchiaramonte at mail.com Tue Apr 18 17:16:28 2000 From: gchiaramonte at mail.com (Gene Chiaramonte) Date: Tue, 18 Apr 2000 17:16:28 -0400 (EDT) Subject: Distributing A Python Application Message-ID: <384449751.956092588323.JavaMail.root@web135-mc.mail.com> I want to distribute a windows GUI application developed in Python/Tkinter. How can I distribute the python enviromnent and my application into a directory such as c:\program files\myapp\bin, ...\lib, ...\dlls etc. I want my installation of python to be insulated from any versions of python the user may have or install in the future. (ie. I don't want the user breaking my app by upgrading to python 1.6 or something like that) Thanks, Gene ______________________________________________ FREE Personalized Email at Mail.com Sign up at http://www.mail.com/?sr=signup From none at none Mon Apr 17 19:44:09 2000 From: none at none (Eric Jacobs) Date: Mon, 17 Apr 2000 18:44:09 -0500 Subject: newbie question References: <8dfdfk$uum$1@nnrp1.deja.com> Message-ID: In article , "Fredrik Lundh" wrote: > Arint? wrote: >> If i PyErr_SetString(PyExc_TypeError,"Invalid command value for IOCTL"); >> in my c/c++ program, how would python script get that error string? > > return NULL to the interpreter. do *not* return > a python value. That, and then do something like try: ... except TypeError, exc msg = exc.args[0] in Python. I think that's what you were looking for? From pcolsen at draper.com Fri Apr 7 21:13:07 2000 From: pcolsen at draper.com (Peter Olsen) Date: Fri, 07 Apr 2000 21:13:07 -0400 Subject: Actually Running a function from a DLL Message-ID: <38EE87A3.4080802@draper.com> I'm writing ask for a quick explanation of how to load and use dll files from Python running under MS Windows. I have installed PythonWin and win32all, but I seem to be completely unable to run a function from a dll.? I'm loading the dll with win32api.LoadLibrary, but I can't figure out how to access the functions.? I've made some statements about how fast we can learn Python and the start development, but if I don't find an answer quickly,? I may have to eat my words.? If the best answer is "RTFM," please give me a hint as to where in TFM I should R. I would greatly appreciate receiving answers by email because my company makes it hard to read news. Thanks! Peter From m.faassen at vet.uu.nl Tue Apr 25 10:38:04 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 25 Apr 2000 14:38:04 GMT Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> Message-ID: <8e4akc$p7o$1@newshost.accu.uu.nl> Kevin Cazabon wrote: > well, if not prettier, why not obfuscate it? q:] Although this isn't > pretty, I'm sure we can make it a little less intelligable with some work. > entire_list = [];for i in range(3):entire_list.append([]) If you write it the normal way: entire_list = [] for i in range(3): entire_list.append([]) It's pretty, readable, flexible, and it works. The only disadvantage is that it's less short. But I'm willing to pay that price in this situation. Generally it's a good idea to avoid * on sequences, unless that sequence is immutable and contains immutable things; i.e. strings. I don't recall using * on tuples ever, but you can do so safely if the tuple contains immutable things only. Is there any useful way to use * on lists that I missed? Usually we want the copy semantics here, not the reference semantics. Perhaps it's a good idea to completely forbid * on lists in p3k? Tuples too for all I care. Then again I may be missing important uses, so enlighten me. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From mindlace at imeme.net Wed Apr 26 18:09:38 2000 From: mindlace at imeme.net (mindlace) Date: Wed, 26 Apr 2000 16:09:38 -0600 Subject: newbie regexp question References: <39075648.CA622A7D@imeme.net> Message-ID: <39076922.CF83C53D@imeme.net> Fredrik Lundh wrote: > > mindlace wrote: > > I've got a re.compile('\W') that I can use to search for non-alphanumeric > > characters in a variable. However, if the variable has ( in it, for > example, > > the search breaks. > > breaks? Er, yes, like if there's a ( it gives me an error. > have no idea what you're talking about here, but maybe > re.escape does what you wants? Yes, it does. Thanks very much. I should have looked at Module Contents in the documentation on python.org -- ethan mindlace fremen mindlace at imeme.net zope -&- imap email -&- mailing list weave your web with the web at http://imeme.net From mwh21 at cam.ac.uk Sun Apr 16 21:40:12 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 17 Apr 2000 02:40:12 +0100 Subject: building on linux w/o threads? References: <8ddokt$65t$1@nnrp1.deja.com> Message-ID: firefly64 at my-deja.com writes: > Hi, > I'm trying to build python 1.5.2 on a linux box > but without thread support. I'm using gcc 2.9.5, > on Mandrak Linux 6.1 kernel version 2.2.14 > > Even though my system has threads, I don't want > any thread support in python (no linkage to libpthreads). > I just can't seem to convince the build process > to proceed without threads. > > I've done everything I can think of, including > ./configure --without-thread and editing the > Makefiles to include -DWITH_THREAD=0. The build > process still always either produces a python > linked to libpthreads or dies complaining about > not being able to find various thread functions. > (Yes, I've done make clean). That's odd. Have you tried running configure with no arguments at all? Reading through config.log? Not much use I know, but "it works here". My system is RedHat 6.1, but in other respects is the same. HTH (but I doubt it), Michael -- 41. Some programming languages manage to absorb change, but withstand progress. -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html From tismer at tismer.com Fri Apr 7 16:06:42 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 07 Apr 2000 22:06:42 +0200 Subject: Palm OS References: <8clds2$c25$1@nnrp1.deja.com> Message-ID: <38EE3FD2.4A3AE50F@tismer.com> musingattheruins at my-deja.com wrote: > > Anyone know of a Python release for Palm? Please do a search on recent c.l.py. postings. It is in progress. -- Christian Tismer :^) Applied Biometrics GmbH : 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 bjorn at roguewave.com Tue Apr 4 19:53:26 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Tue, 04 Apr 2000 17:53:26 -0600 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> <38EA7452.9BFDF37E@callware.com> <8cdt7c$cl1$1@news101.telia.com> <38EA7D9C.7024CF0B@roguewave.com> <0 Message-ID: <38EA8076.D8385E18@roguewave.com> Anders Eggers-Krag wrote: > > > > > > > an alternative solution is to call an ADO (ActiveX Data Object) object and > > > use it through > > > there which is quite simple. > > > > If you do this, make sure you get Mark's programming win32 book. It's > > an excellent book for many reasons, but it goes into special detail on > > COM programming (and is so far the only resource I've seen of how COM > > can be simple and useful -- instead of the normal > > add-on-later-because-we-need-the-buzzword I normally associate with COM > > ). > > > it is not like ADO is a complex system, it is extremely easy to use, I use it alle time > writing database systems for ASP. Oh, I completely agree... However, if you don't know COM, or only know it through C++, I would still recomend getting the win32 book. it-also-explains-all-the-GBFLAs-in-ms'-db-libraries'ly y'rs -- bjorn From scarblac-spamtrap at pino.selwerd.nl Tue Apr 25 11:02:33 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 25 Apr 2000 15:02:33 GMT Subject: List comprehensions? References: <000601bfae79$41485b00$152d153f@tim> Message-ID: Tim Peters wrote in comp.lang.python: > [Remco Gerlich] > > I thought list comprehensions had been in CVS for quite a while, so I > > expected them to be in 1.6. ... > > Greg Ewing's patch (against 1.5.2) for list comprehensions is all there is, > and you'll have to get that from Greg (see DejaNews for his announcement, > and his URL). Boggle. Brain didn't return correctly from that alternate reality, then. Or maybe I'm just confused. -- Remco Gerlich, scarblac at pino.selwerd.nl 'Oook?' From mjhand at concentric.net Tue Apr 18 11:54:18 2000 From: mjhand at concentric.net (Manus Hand) Date: Tue, 18 Apr 2000 09:54:18 -0600 Subject: BAD starship.python.net news! Message-ID: <38FC852A.9B11F458@concentric.net> This from Mike McLay. Everyone, let's pony up what it takes to recover our starship! Manus (who will backup more and more often than he has until now) > From: Mike McLay (mclay at nist.gov) > Subject: Re: starship.python.net?? > > The prognosis isn't good. The old drive is toast and backup software > was never installed. I've located a data recovery company that will > provide a quote on the chances of recovery for $125. The cost of > recovery, if it is possible, will be between $300-$1000. They can > turn around the recovery in a few days time. Someone will need > to fund the recovery. So far I have a $200 pledge. > > I bought a new drive and installed it in the server last night. The > system will be back online tomorrow by noon. From garry at sage.att.com Fri Apr 14 11:42:56 2000 From: garry at sage.att.com (Garry Hodgson) Date: Fri, 14 Apr 2000 15:42:56 GMT Subject: Doesn't anybody write to paper anymore? References: <38F5FDF3.EE2FBA01@tcac.net> Message-ID: <38F73C80.E1432809@sage.att.com> "Daddy, what's "paper"?" well, maybe not yet... -- Garry Hodgson Every night garry at sage.att.com a child is born Software Innovation Services is a Holy Night. AT&T Labs - Sophia Lyon Fahs From richard_chamberlain at ntlworld.com Thu Apr 27 04:21:08 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Thu, 27 Apr 2000 09:21:08 +0100 Subject: pythoncom / Installer on Win32 Message-ID: i, I am trying to create a distribution using Gordon's Standalone. I'm asking a fair amount because I'm using COM, ODBC etc. any help would be appreciated, Richard bindepend cannot analyze %s - file not found! analyzing odbc found python15.dll found ODBC32.dll found dbi.dll lib not found: dbi.dll dependency of found MSVCRT.dll found KERNEL32.dll added filter Creating COMServer.exe Traceback (innermost last): File "Builder.py", line 502, in ? main(opts, args) File "Builder.py", line 484, in main target.build() File "Builder.py", line 87, in build self.assemble() File "Builder.py", line 300, in assemble arch = ArchiveTarget.assemble(self, pkgname) File "Builder.py", line 275, in assemble arch.build(pkgnm, toc) File "C:\WINDOWS\DESKTOP\INSTAL~1\MEInc\Dist\archive.py", line 146, in build File "C:\WINDOWS\DESKTOP\INSTAL~1\MEInc\Dist\carchive.py", line 167, in add IOError: [Errno 2] No such file or directory: 'c:\\windows\\system\\pythoncom.dll' From mrfx at 263.net Tue Apr 25 03:09:17 2000 From: mrfx at 263.net (fmr) Date: Tue, 25 Apr 2000 15:09:17 +0800 Subject: how to wrap c++ software to python? Message-ID: <8e3ggq$2r1d$1@news.cz.js.cn> I will call c++ routine in python,how to wrap c++ routine for python. Is there any utils to work except SWIG. From pf at artcom-gmbh.de Thu Apr 20 13:04:48 2000 From: pf at artcom-gmbh.de (Peter Funk) Date: Thu, 20 Apr 2000 19:04:48 +0200 (MEST) Subject: Lazy imports (was Re: module naming) (now hopefully correct) Message-ID: Hi! Sorry if you see this twice. :-( Two days ago I posted a followup to a question by Michal Wallace, which included some Python code, which was BUGGY! But see below. > Michal Wallace (sabren) asks: > > That's certainly a lot cleaner! But is there a way to do that and > > not have it load each one of those files every time? There's actually > > more than 3, and even though they're all fairly small, I'd rather not > > have the overhead of loading them until they're needed. > > You could try to adopt the lazy loader concept implemented in > the Pmw package. The idea is to use a small tool, that builds a > dictionary of exported features (classes and more) by investigating > all module files in the package and places this in a file called > for example 'exports.def'. Than you can use the following > __init__.py file to load features (classes, constants, functions, > or modules, what you want) on demand. The idea is "stolen" from > Greg McFarlanes wonderful Pmw package: As Greg McFarlane pointed out to me, a block of my program got the wrong indentation, so it will not work as I intended it to. Here is an updated (and hopefully more correct version). Many thanks to Greg McFarlane for his original work and the time he spent to review my code. This time I also included a little helper script used to automatically generate the 'exports.def' file used by the lazy importer. Regards, Peter ---- 8< ---- 8< ---- cut here ---- 8< ---- schnipp ---- 8< ---- schnapp ---- #!/usr/bin/env python ## vim:ts=4:et:nowrap """__init__ : This file is executed when the package is imported. It creates a lazy importer/dynamic loader for the package and replaces the package module with it. This is a very simplified version of the loader supplied with Pmw. All the package version management has been stripped off.""" import sys, os, string, types _EXP_DEF = 'exports.def' # export definition file _BASEMODULE = 'base' # Name of Base module for the package class _Loader: """An instance of this class will replace the module in sys.modules""" def __init__(self, path, package): self._path, self._package = path, package self._initialised = 0 def _getmodule(self, modpath): __import__(modpath) mod = sys.modules[modpath] return mod def _initialise(self): # Create attributes for the Base classes and functions. basemodule = self._getmodule('_'+self._package+'.'+_BASEMODULE) for k,v in basemodule.__dict__.items(): if k[0] is not '_' and type(v) != types.ModuleType: self.__dict__[k] = v # Set the package definitions from the exports.def file. dict = { '_features' : {}, '_modules' : {}, } for name in dict.keys(): self.__dict__[name] = {} d = {} execfile(os.path.join(self._path, _EXP_DEF), d) for k,v in d.items(): if dict.has_key(k): if type(v) == types.TupleType: for item in v: ## modpath = self._package + item modpath = item dict[k][item] = modpath elif type(v) == types.DictionaryType: for k1, v1 in v.items(): ## modpath = '_'+self._package +'.'+ v1 modpath = v1 dict[k][k1] = modpath self.__dict__.update(dict) self._initialised = 1 def __getattr__(self, name): """This will solve references to not yet used features""" if not self._initialised: self._initialise() # Beware: _initialise may have defined 'name' if self.__dict__.has_key(name): return self.__dict__[name] # The requested feature is not yet set. Look it up in the # tables set by exports.def, import the appropriate module and # set the attribute so that it will be found next time. if self._features.has_key(name): # The attribute is a feature from one of the modules. modname = self._features[name] mod = self._getmodule('_'+self._package+'.'+modname) feature = getattr(mod, name) self.__dict__[name] = feature return feature elif self._modules.has_key(name): # The attribute is a module mod = self._getmodule('_'+self._package+'.'+name) self.__dict__[name] = mod return mod else: # The attribute is not known by the package, report an error. raise AttributeError, name # Retrieve the name of the package: _package = os.path.split(__path__[0])[1] # Rename (hide) the original package for later perusual: sys.modules['_'+_package] = sys.modules[_package] # Create the dynamic loader and install it into sys.modules: sys.modules[_package] = _Loader(__path__[0], _package) ---- 8< ---- 8< ---- cut here ---- 8< ---- schnipp ---- 8< ---- schnapp ---- #!/usr/bin/env python ## vim:ts=4:et:nowrap """build_exports.py -- create 'exports.def' helper file for lazy importer This is a hack to aid changing the substructure of a ggui package quickly and painless. """ import sys, types, pprint modules = [] features = {} multiple_defined = {} template = '''## vim:ts=4:et:nowrap # [Emacs: -*- python -*-] """export.def --- This is an exports definition file --- this was automatically created by %(prog)s It is invoked by a dynamic import loader in __init__. features : dictionary from feature names to modules names. modules : tuple of module names """ # _features = %(features)s _modules = %(modules)s ''' def spewout(stream=sys.stdout, modules=(), features={}): pp = pprint.PrettyPrinter(indent=4) d = { 'prog': sys.argv[0], 'modules': pp.pformat(tuple(modules)), 'features': pp.pformat(features), } stream.write(template % d) def inspect(modulename, modules, features, multiple_defined): if modulename[-3:] == ".py": modulename = modulename[:-3] __import__(modulename) mod = sys.modules[modulename] for symbol in dir(mod): if symbol[:1] != '_' or (symbol == '_' and modulename == 'base'): obj = mod.__dict__[symbol] if type(obj) == types.ModuleType or symbol == "Pmw": if not symbol in modules: modules.append(symbol) else: if features.has_key(symbol): if multiple_defined.has_key(symbol): multiple_defined[symbol] = multiple_defined[symbol] + \ " " + features[symbol] else: multiple_defined[symbol] = features[symbol] features[symbol] = modulename if __name__ == "__main__": sys.path.insert(0, '.') if len(sys.argv) > 1: for arg in sys.argv[1:]: inspect(arg, modules, features, multiple_defined) outfile = sys.stdout else: import glob l = glob.glob("[a-z]*.py") print l for module in l: inspect(module, modules, features, multiple_defined) if multiple_defined == {}: outfile = open("exports.def", "w") if multiple_defined == {}: spewout(outfile, modules, features) else: for k, v in multiple_defined.items(): print k, "has multiple definitions in:", v, features[k] Gru?, Peter -- Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 Wer sich zu wichtig f?r kleine Arbeiten h?lt, ist meist zu klein f?r wichtige Arbeiten. -- Jacques Tati From Sunil.Hadap at cui.unige.ch Wed Apr 19 14:52:02 2000 From: Sunil.Hadap at cui.unige.ch (Sunil Hadap) Date: Wed, 19 Apr 2000 20:52:02 +0200 Subject: Dynamic web pages! not Dynamic HTML Message-ID: <38FE0052.4BE78518@cui.unige.ch> Hello, I am really dumb in databases and perl. I am good at python and it's my scripting language for whatever I do in graphics. I want to start doing my homepage which is inspired from http://www.photo.net/photo/ I want to implement the following features a) As I too do lots of photography, I want to put my photographs all over the web pages, may be randomly or depending upon context. b) I don't want to hardcode any of the hyperlinks, so that I can move my pages and still keep the links intact. Idea is, the link will be always to a single page with a tag, which will take you to right page. c) User will be able to add his comment to any page like this (bottom of the page) http://www.photo.net/photo/nikon/n90s.html d) There will be lots of tags associated with pages. I just refer to the tag and I should get automatic hyperlink to the appropriate point. In short, I will be writing a page, not exactly a html page but rather a template with special tags say @photo(location=geneva, choice=random, qulity=best, addkey=lake). It will search the database to narrow down and finally select a random photo. Another tag will be just @"good exposure" or @"particle system". From these template files, the system will generate html document replacing all tags with appropriate hyperlink or image etc, on the fly. I want to do this in Python. Is zope useful for this, I don't want to learn a big system as I only want few specific functions only. Which free database? Thanks a lot Sunil -- "Live as if you would die tomorrow, learn as if you would live forever." --Mahatma Gandhi From vmarkwart at my-deja.com Sun Apr 2 20:05:53 2000 From: vmarkwart at my-deja.com (vmarkwart at my-deja.com) Date: Mon, 03 Apr 2000 00:05:53 GMT Subject: pytools - console and other facilities Message-ID: <8c8n8p$bq0$1@nnrp1.deja.com> Hi, I've written a python extension for WIN32. At the moment it's not finished, nor is it particularly well documented, but it can be examined at http://www.pcug.org.au/~markwart/python/index.html Any assistance in progressing this project would be greatly appreciated. Cheers Victor Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Tue Apr 11 12:00:40 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 11 Apr 2000 12:00:40 -0400 Subject: [ANNOUNCE] Garbage collection for Python In-Reply-To: Message-ID: <000a01bfa3cf$159c8440$7f2d153f@tim> [Hrvoje Niksic] > This is still different from being able to embed multiple Python > instances in threads. [Will Ware] > Are we talking about multiple Python instances running in a single > thread? That sounds like a very big challenge. ... Perhaps, but it's already been done . See Py_NewInterpreter() in the "Initialization, Finalization, and Threads" section of the Python/C API manual. There isn't a Python-level interface to this yet; if you want multiple interpreters in a single thread, for now you need to call Py_NewInterpreter() from a C extension. > The Python VM would need to be rewritten to be reentrant so that > multiple VMs could simultaneously coexist, with distinct copies of > the entire computing environment (globals, locals, which modules had > been imported, etc). Then you'd need to arrange context switches; ... Right, that's all there already, but (again) only from C. See the manual for a description of subtleties. have-yet-to-see-anyone-use-it!-ly y'rs - tim From chapmanb at arches.uga.edu Mon Apr 3 07:21:23 2000 From: chapmanb at arches.uga.edu (Brad Chapman) Date: Mon, 03 Apr 2000 11:21:23 GMT Subject: Methods for password storage Message-ID: <38E87E13.A10A1168@arches.uga.edu> Hello! I'm working on a program which stores passwords (for database access) that a user enters in a GUI. The program is targetted for unix machines. I'm not very experienced with security issues like this and am trying to store them in as secure a manner as possible. Does anyone have any advice/examples for how to securely store sensitive information like this using python? Are there other security issues I should worry about when dealing with passwords? Thank in advance much for any advice! Brad From kc5tja at garnet.armored.net Tue Apr 4 09:09:37 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 4 Apr 2000 13:09:37 GMT Subject: blessed be Guido, for "5 <= X <= 10" does what it should... References: <3TpG4.3349$HG1.98231@nnrp1.uunet.ca> Message-ID: In article <3TpG4.3349$HG1.98231 at nnrp1.uunet.ca>, Warren Postma wrote: >(Actually I'd write the <= as '?' (Unicode U+2264) but using such things in >our code would seriously cramp portability. Hey, is the APL symbol set >anywhere in Unicode!?) Astonishingly enough, it is. Or so I've been told. Not sure where or how to verify this, though, as I've never used APL. It's part of their 32-bit character set. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From aa8vb at yahoo.com Sat Apr 15 11:11:05 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Sat, 15 Apr 2000 11:11:05 -0400 Subject: Doesn't anybody write to paper anymore? In-Reply-To: <38F7A309.F1242F00@direcpc.com> References: <38F5FDF3.EE2FBA01@tcac.net> <38F73C80.E1432809@sage.att.com> <38F7A309.F1242F00@direcpc.com> Message-ID: <20000415111105.A8802@vislab.epa.gov> Jay Freeman: |Subject: Doesn't anybody write to paper anymore? | |Garry Hodgson wrote: | |> "Daddy, what's "paper"?" | |Let's see: | |C:\WINDOWS>ping www.fcc.gov |Reply from 192.104.54.12: bytes=32 time=510ms TTL=246 | |Yep, still have a government, so we must still have paper too, QED :). You guys are cruel. ;-) Don't you remember being a newbie? But seriously, looking back Albert did post related questions about this before (several times) as "redirecting stdout to printer". You gotta admit; the subject "Doesn't anybody write to paper anymore?" is more likely to catch someone's eye. 8^) Mission accomplished. -- Randall Hopper aa8vb at yahoo.com From python-list at teleo.net Fri Apr 7 18:51:41 2000 From: python-list at teleo.net (Patrick Phalen) Date: Fri, 7 Apr 2000 15:51:41 -0700 Subject: Problem running Python script as cron job In-Reply-To: References: Message-ID: <0004071555090M.01234@quadra.teleo.net> [William R. Dickson, on Fri, 07 Apr 2000] :: Anybody know of any issues with running python scripts from Cron? No. I've had multiple Python scripts running every one, two, five and ten minutes around the clock for years on multiple servers without problems. I'd suspect you might have a bug lurking. From zsoltman at my-deja.com Sun Apr 2 18:28:44 2000 From: zsoltman at my-deja.com (zsoltman at my-deja.com) Date: Sun, 02 Apr 2000 22:28:44 GMT Subject: Web hosting python CGI and or Zope Message-ID: <8c8hie$5lo$1@nnrp1.deja.com> I am advising a volunteer organization that gets some funding. I am the only technical person they have right now. They desire to not only have a Web Site, but have in mind two applications that they will need immediately. I am volunteering to hammer out basic functionality for these applications to get them up and running. If I recommend they purchase an NT machine (don't yell at me, they're non-technical)and go DSL, I could make their applications very quickly with either Zope, or Python CGI, but I cannot ignore the fact that there are Web Hosting companies that have fault tolerance and would be much cheaper. Question: Does anyone know of Web Hosting companies that support python or Zope? Alternate Question: Are there other ways to approach this? Thanks for any feedback. -Zsolt zsoltman at hotmail.com Sent via Deja.com http://www.deja.com/ Before you buy. From yemartin at garage.co.jp Wed Apr 12 22:44:31 2000 From: yemartin at garage.co.jp (Yves-Eric Martin) Date: Thu, 13 Apr 2000 11:44:31 +0900 Subject: Seg fault in Python/C API: PyString_FromString(NULL) In-Reply-To: References: <38F422C5293.A67BYEMARTIN@smtp.garage.co.jp> Message-ID: <38F5348F25.C638YEMARTIN@smtp.garage.co.jp> On Wed, 12 Apr 2000 10:15:36 GMT "Mark Hammond" wrote: > > First, I am new to the Python/C API, so correct me if I am wrong: > > shouldn't PyString_FromString(NULL) return Py_None? Or am I out to > > lunch? > > Nope - you must check for NULL before making the call. Ok, that makes sense now. Thanks. -- Yves-Eric Martin Digital Garage Inc. yemartin at garage.co.jp From jp at NOSPAMdemonseed.net Fri Apr 21 15:17:47 2000 From: jp at NOSPAMdemonseed.net (jason petrone) Date: Fri, 21 Apr 2000 14:17:47 -0500 Subject: can't find SWIG for Python References: <38FF5A56.F76794D8@sec.noaa.gov> Message-ID: j vickroy wrote: > I have been unable to locate SWIG for Python. My references list > www.swig.org but the server can not be found. > Could someone point me to the site or provide some other Win 32 options > for easing the process of extending Python to use existing C libraries. ~> grep ftp /usr/ports/devel/swig/Makefile MASTER_SITES= ftp://ftp.cs.utah.edu/pub/beazley/SWIG/ -jlp From dirck at pacbell.net Mon Apr 10 13:57:41 2000 From: dirck at pacbell.net (Dirck Blaskey) Date: Mon, 10 Apr 2000 10:57:41 -0700 Subject: Redirecting stdin/stdout on Windows with '>'and '<' References: <8csvff$7pn$1@nnrp1.deja.com> Message-ID: Mark wrote in message news:8csvff$7pn$1 at nnrp1.deja.com... > ... > I would like to redirect output of my script with '>' or '<' > > If I try to redirect out then the file is created but has no contents. > > If I try to redirect in eg... > "test.py < autoexec.bat" > > I get the following traceback > > Traceback (most recent call last): > File "C:\test.py", line 4, in ? > s = sys.stdin.read() > IOError: [Errno 9] Bad file descriptor > > (Windows nt 4 sp 6, python 1.52) Windows cmd.exe has a bug in file redirection when handling scripts. The 'simple' fix is to use python on the command line: python test.py < infile > outfile (requires python in the path) Attached is a Python script that uses an alternative syntax to fix the problem: test.py @infile !outfile The script is also available from: http://www.danbala.com/python/cmdfix (currently down??) Good luck d =========================== Dirck Blaskey Danbala Software dirck at danbala.com http://www.danbala.com begin 666 cmdfix.py M(B(B#0H@(" @8VUD9FEX+G!Y("T at 9FEX('!I<&EN9R!P&4@#0H-"F-O;G1A8W0Z(&1I6YT87 at Z#0H@(" @2! :6YP=70@(6]U='!U=" C97)R;W(-"F]R M#0H@(" @2! :6YP=70@(2-B;W1H;W5T<'5T#0H-"D%D9&EN9R N M<'DO+G!Y8R!T;R!T:&4 at 96YV:7)O;FUE;G0 at 4$%42$585#T at 8VAA;F=E3H-"B @("!S;VUE($!I;G!U=" A(V)O=&AO=71P=70- M"@T*5&\@:6YS=&%L;"P at 8VAA;F=E('1H92!R96=I2!E;G1R>2!F;W(@ M4'ET:&]N+D9I;&4O71H;VXN97AE($0Z7'!Y=&AO;EQC;61F:7 at N<'D at 1#I<<'ET:&]N M7'!Y=&AO;BYE>&4@(B4Q(B E*@T*4VEM:6QA"YP>2!Y;W4 at 8V%N('5S92!C;61F M:7 at N<'EC(&EN(&ET)W,@<&QA8V4 at 9F]R( T*;&EK96QY('5N;F]T:6-E86)L M92!P97)F;W)M86YC92!I;7!R;W9E;65N=',N#0H-"E1H:7,@"!I6EN9R!T;R!U7!E2!B=69F97)I;F<@9&EF M9F5R96YC97,-"B @(" @(" @:68@;T9I;&5.86UE6S!=/3TG(R7=I;G1Y<&5S+E-%0U5225197T%45%))0E5415,H*0T*(" @('-A M+F));FAE&5C=71E(&%N9"!W86ET#0H-"F1E M9B!E>&5C=71E*&-O;6UA;F0I. at T*(" @('-T87)T=7!);F9O(#T@=VEN,S)P M7,N :87)G=BDM,2P@ <8d1od2$9fl$1@nnrp1.deja.com> <8d3qvu$hud$1@nnrp1.deja.com> Message-ID: It appears that 2 win32ui.pyd files are being loaded. This is almost certainly my fault. It is possible that in the registry you already have a "Modules" subkey that specifies the location of win32ui.pyd? Also, FYI, in the CVS version of Pythonwin, this implementation has changed. It now doesnt attempt to find registered modules or any of the other funky stuff that it does now. The new code is simpler and more robust - but does insist that win32ui.pyd is either on your PYTHONPATH, or in the same directory as pythonwin.exe - no a burden IMO! The new code also magically works with either 1.5 or 1.6. Anyway, whatever the reason, the clues are: ... > Loaded symbols for 'C: > \Programme\Python\Pythonwin\src\work\Pythonwin\Build\win32ui_d.pyd' That is fine: ... > Extension module C: > \Programme\Python\Pythonwin\src\work\Pythonwin\Build\win32ui_d.pyd > initialising. Still looking good! > LDR: Dll win32ui_d.pyd base 1e400000 relocated due to collision with C: > \Programme\Python\Pythonwin\src\work\Pythonwin\Build\win32ui_d.pyd > Preloaded symbols may not match 'C: > \Programme\Python\Pythonwin\win32ui_d.pyd'. Did you cut any messages? This message appears to imply another win32ui_d.pyd has been loaded, and its symbols have been relocated due to a clash with another win32ui_d.pyd. Can you ensure you system has no others win32ui*.pyd. Also, I highly recommend getting the CVS version of Pythonwin - just for the new startup code if nothing else. Mark. From jrayson at mitre.org Fri Apr 7 17:30:53 2000 From: jrayson at mitre.org (Jim Rayson) Date: Fri, 07 Apr 2000 17:30:53 -0400 Subject: PyOpenGL install problem on windows Message-ID: <38EE538D.68D829BA@mitre.org> Hi, I'm trying to get PyOpenGL running on Windows 98. I have lots of C/Unix experience and very little Python, Tk, or Windows experience. Running Python 1.5.2, Tcl/TK 8.0.5, and PyOpenGl (couldn't find a version number but copied from it's main site, as a windows binary w/ installer, a few weeks ago). I first installed disutils, numpy, and pil as directed. By playing with paths and things I got it to the point where I could at least import modules from each package. I got at least one demo program to work from numpy and pil, but not all of them. When I installed PyOpenGL I managed to get opengl\demo\da\dots.py to run properly. Other demos failed because I seemed to be missing Togl. ? Found out on http://starship.python.net:9673/crew/da/Code/PyOpenGL/Togl that sometimes installer doesn't do togl properly, and gave instructions on downloading some files to fix it. However, it made no mention of the togl file (appears to be some kind of index) that already exists in C:\Program Files\Tcl\lib\tk8.0 Then again, maybe the installer stuck that there. ? Just to be safe, I renamed that file as togl.old ? Based on those instructions I created the directory C:\ProgramFiles\Tdl\lib\tk8.0\Togl then downloaded and copied Togl.dll andpkgIndex.tcl ? Then ran samples, with no real success. Got the message:? TclError: error while autoloading "togl": couldn't load file"C:\PROGRA~1\TCL\lib\tk8.0\Togl\Togl.dll": invalid argument? But I checked that path and that file was at that location. Since it's already there, I'm not sure why it can't find it. pkgIndex.tcl says something about setting $dir but my experiments playing with that also failed. Any help would be appreciated. Thanks, Jim jrayson at mitre.org From chris_barker at my-deja.com Fri Apr 28 15:42:00 2000 From: chris_barker at my-deja.com (chris_barker at my-deja.com) Date: Fri, 28 Apr 2000 19:42:00 GMT Subject: Looking for example of embedded Python Message-ID: <8ecpi4$j9q$1@nnrp1.deja.com> Hi, I'm trying to persuade my co-workers that it would be extememly usefull to imbed Python in some of our apps. I'm looking for example applications wioth Python embedded. Ideally something fairly small with source code available. Please sent me links to any examples you might have. Platforms (in order of preference): Macintosh Linux Windows -Thanks, -Chris cbarker at jps.net Sent via Deja.com http://www.deja.com/ Before you buy. From pecora at anvil.nrl.navy.mil Fri Apr 28 17:00:30 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Fri, 28 Apr 2000 17:00:30 -0400 Subject: Reading in strings -> numbers ?? Message-ID: <280420001700308281%pecora@anvil.nrl.navy.mil> Is there a Python "read-partner" for the write(string) function, e.g., fileobject.write(" %e %e %d" % (1.2, -3.5, 10)) in the sense that the C functions fprintf and fscanf are partners. I've looked in 4 different Python books and in the pdf references, but I see nothing in read or readlines or strings that seems to make for an easy conversion from a string to a list or tuple of objects (numbers). In other words, I want the opposite of the write above so I can read those numbers back into my Python code. Thanks for any help. From hanche at math.ntnu.no Thu Apr 6 23:12:48 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 06 Apr 2000 23:12:48 -0400 Subject: time-module questions References: Message-ID: + "Warren Postma" : | First, it appears that time.localtime returns fractions of a second | in it's values, but that time.mktime does not add this millisecond | component back in, nor does it appear to be part of the time-tuple | returned by time.localtime, and time.gmtime: The time module is little more than an interface to the standard C library, which does not make provisions for fractions of a second. If you wish to preserve that information, you'll have to hack it yourself, or perhaps Marc-Andr? Lemburg's mxDateTime module has the answers. In fact, ``use mxDateTime'' appears to be the suggested solution to every time/date-related problem in python. I downloaded it but still haven't had the time to check it out carefully, so I can't say for sure whether it solves your problem. | Secondly, mktime accepts localtimes only, how to I take y/m/d/h/m/s | in GMT instead of the current timezone, and convert back to a | time.time() type value (float). Yes, mktime is the inverse of localtime. You need the inverse of gmtime, which is not in the standard C library, and hence not in the time module. Again, you have to hack it yourself, with a *large* probability of getting it wrong, or use the mxDateTime module, which seems to have functions for converting between UTC and localtime. I once looked at the code in the GNU date program to see how it coped with the situation, and it's not pretty. After staring at the code for half an hour, I found myself unable to prove its correctness, though it performed correctly on all times that I threw at it (using date -d ' UTC'), even around the times when DST starts or stops. Normally I am kind of a peaceful guy, but if I ever meet the designers of the standard C time conversion functions, I am not sure what I'll do. Fortunately I am not very big and strong, and I don't carry any weapons -- so I'll probably settle for some choice verbal abuse, which is unlikely to land me in jail. 8-) -- * Harald Hanche-Olsen - "There arises from a bad and unapt formation of words a wonderful obstruction to the mind." - Francis Bacon From darrell at rubina.funkomite.com Tue Apr 11 14:24:56 2000 From: darrell at rubina.funkomite.com (darrell at rubina.funkomite.com) Date: Tue, 11 Apr 2000 18:24:56 GMT Subject: simple httplib and urllib timeout question References: Message-ID: "Michal Wallace (sabren)" wrote: > On Tue, 11 Apr 2000 darrell at rubina.funkomite.com wrote: >> Just a quick question, im writing a small webbot for a python >> learning experience and it comes across some sites that will make it >> hang for a while, if the site is down or extremely slow etc, is >> there a way to set a faster timeout for httplib . Or is there a >> better way to handle it ? > Yes. The better way is to use asyncore whenever httplib/urllib uses a > normal socket. Unfortunately, this requires breaking urllib into > smaller pieces, and nobody seems to have done it yet. I'm actually > working on the exact same problem (and posting regular updates > at http://www.linkwatcher.com/ ) > I sent an email to Jeremy Hylton, who's working on urllib2. He's > swamped, but willing to accept a patch that would add this feature > to urllib2.. I think I'll wind up taking a crack at it tonight. > There's also a partial solution using a different method if you look > at... http://www.linkwatcher.com/src/blogbot/timeout.py > there's an example script called blogbot.py there, too.. it uses > timeout.py and another hack with signal.alarm(), but neither really > works all that well.. > hope that helps. > meanwhile... HEY OLEG! -> have you done anything w/ this? > Cheers, > - Michal > ------------------------------------------------------------------------- > http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ > ------------------------------------------------------------------------- Thanks Michal , this helps alot :> From rich at anna.UUCP Mon Apr 3 01:22:53 2000 From: rich at anna.UUCP (Rich James) Date: Mon, 03 Apr 2000 05:22:53 GMT Subject: Just doing local file testing References: <38E796BC.23191B2@regnoc.com> <38E7D6DE.EA09C891@regnoc.com> <00040216504403.04535@quadra.teleo.net> <38E7F616.48CF9284@regnoc.com> Message-ID: Client-side scripts, yes. Server-side scripts (i.e. cgi-scripts), no. According to Jim Conger : > You can initiate a local application from within your browser without having a "server" in place. For example, you > can test Perl scripts, Java applets, and Active X components locally without needing a server. That is what I am > trying to do with the Python scripts. -- War is the health of the State. -- Randolph Bourne (1917) --- Rich James From gregm at iname.com Wed Apr 12 09:46:30 2000 From: gregm at iname.com (Greg McFarlane) Date: Wed, 12 Apr 2000 23:46:30 +1000 Subject: Compiling Python Imaging under LinuxPPC In-Reply-To: <20000411173904.18637.00002261@ng-cg1.aol.com>; from William F. Adams on 11 Apr 2000 at 09:39:04PM References: <20000411173904.18637.00002261@ng-cg1.aol.com> Message-ID: <20000412234630.21095@nms.otc.telstra.com.au> On 11 Apr, William F. Adams wrote: > I'm trying to do this, and not getting far. > > Here's what I get: > .0 -L/usr/X11R6/lib -lX11 -lXext -lXmu -ltiff -ljpeg -lz -lXpm -0 _tkinter.so > /usr/bin/ld: cannot find -lBLT > collect2: ld returned 1 exit status > make: *** [_tkinter.so] Error 1 > Bad exit status from /var/tmp/rpm-tmp.39884 (%build) > > What's BLT? A graphics extension to Tk: http://www.tcltk.com/blt/ -- Greg McFarlane INMS Telstra Australia gregm at iname.com From tjreedy at udel.edu Sun Apr 2 22:32:14 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 2 Apr 2000 22:32:14 -0400 Subject: Python 1.6 alpha 1 released References: Message-ID: <8c8vfj$5n6$1@news.udel.edu> Guido is quoted as writing: > """where you used to write sock.connect(host, port) you must now write > sock.connect((host, port))""" Since the de facto standard has been to use two parameters, I find this change baffling. Evidence of claim: the first two Python books ... 1. Internet Programming with Python by Watters, *van Rossum*, and Ahlstrom. p335: s.connect(machine, port) # api definition, middle of page p342: sock.connect(self.machine, self.port) # connect() method of class GETRequest 2. Programming Python, Mark Lutz. p728: s.connect(HOST, PORT) # sockclient.py (Note: these are the only three uses I found in the two books. The GETRequest class, with its now-declared-to-be-an-error, is used in several examples in the following pages.) 3. my memory impression of every other usage of connect that I have read (I've never had cause yet to use it) Additional reasons for opinion. 1. Adding the extra pair of parens is extra work for no gain. 2. The result strikes me as visually ugly. Without countervailing philosophical justification, this code-breaking change strikes me as contrary to both the spirit and practice of python. The confusion-elimination reason for the list.append(item) API does not apply here. Is there any arguement (other than whatever the reference states) for tuple-bundling the params of connect() that would not apply to every other library function? If the connect() code currently also accepts the new form, then the API could be tightened just as well by eliminating the one-tuple variant. How much code would that break? Terry J. Reedy From claird at starbase.neosoft.com Sun Apr 9 17:26:25 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 9 Apr 2000 16:26:25 -0500 Subject: Migrating Tcl system to Python References: <095cc48a.7e9b36dd@usw-ex0108-063.remarq.com> <000C48B993BF96DA.95DEBE4215A79896.7F63D15FB99EE88D@lp.airnews.net> <248819a8.00d5228e@usw-ex0106-045.remarq.com> Message-ID: <8EDD15EFCAC9A6DF.7A5207F9F5767B8C.D17A9FDF542DC3C4@lp.airnews.net> In article <248819a8.00d5228e at usw-ex0106-045.remarq.com>, Hamish Lawson wrote: >Cameron Laird wrote: > >[Stuff about communicating between Tcl and Python.] > >> Minotaur. CORBA. ILU. COM, maybe. Pipes. Named pipes. > >The systems will be on Linux so COM is out but the rest are >possibilities. As far as I can see, one of the main issues in >communicating between Tcl and Python will be how to handle >passing lists and dictionaries (arrays in Tcl). XML-RPC manages >this automatically and although I don't have any experience with >either CORBA or ILU, I imagine they do too. If I were to use a >pipe approach, there would presumably be a need for a layer to >translate between Tcl's and Python's representations of data >structures; though I think this might be reasonably simple, are >there solutions already available, or issues I'd need to be >aware of? . . . You're right in everything you say; XML-RPC, ILU, and CORBA handle things nicely, but I can think of no effective semantic translator specifically for the case of exchanging lists and dictionaries through pipes. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From nascheme at enme.ucalgary.ca Wed Apr 26 21:21:11 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Thu, 27 Apr 2000 01:21:11 GMT Subject: Python compiler ? (was Re: Python for drivers?) References: <3900EDBE.282BC85@dsuper.net> <8dr2pn$ec8$1@newshost.accu.uu.nl> <3906f804@nntp.server.uni-frankfurt.de> <015b01bfaf8b$9cd03930$0500a8c0@secret.pythonware.com> <39076316@nntp.server.uni-frankfurt.de> <8e7sop$5io$1@nnrp1.deja.com> Message-ID: Will Ware wrote: >I'd also be willing to kick in $100 for an efficient Python >compiler, but only if it were open source. I don't think this guy is making native code compilers. The "compiled" TkDiff demo is still implemented using Tcl. Unlike my grandfather, I can't read German so I can't figure out what his "compiler" is supposed to do from the "whitepaper". Babelfish does not seem to help. Making Python more efficient is not an easy task. If you are looking for an easy solution you are out of luck. It is probably more useful to put effort into something like into Gwydion Dylan. Neil -- "Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers" -- Alan Perlis From mal at lemburg.com Mon Apr 3 09:28:13 2000 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon, 03 Apr 2000 15:28:13 +0200 Subject: Unicode program representation References: <015c01bf9d0b$76f9b2a0$59dd3fcb@neil> Message-ID: <38E89C6D.E515DE8@lemburg.com> Neil Hodgson wrote: > > This leads to the question of what the use of the u" form is. The current > answer is that u" takes the ASCII string and makes a Unicode string object > by extending each byte with another zero byte. Because its a Unicode string > object it behaves appropriately with Unicode aware functions. > > I think this should be changed to interpreting the literal as a UTF-8 > literal. The advantage here is that non-roman string literals become a > natural part of the language. There was some discussion about this when the Unicode integration was designed late last year. We finally decided to use a fixed internal default encoding and have the user apply all necessary conversions at his/her own will. As you might have guessed, the default encoding is UTF-8. However, since Python scripts are intended to be writable in plain 7-bit ASCII, there had to be a painless form for encoding Unicode in 7-bit ASCII. This is what the 'unicode-escape' encoding does. Here's a quote from the Misc/unicode.txt file which currently is the main documentation source: """ Python should provide a built-in constructor for Unicode strings which is available through __builtins__: u = unicode(encoded_string[,encoding=][,errors="strict"]) u = u'' u = ur'' With the 'unicode-escape' encoding being defined as: ? all non-escape characters represent themselves as Unicode ordinal (e.g. 'a' -> U+0061). ? all existing defined Python escape sequences are interpreted as Unicode ordinals; note that \xXXXX can represent all Unicode ordinals, and \OOO (octal) can represent Unicode ordinals up to U+01FF. ? a new escape sequence, \uXXXX, represents U+XXXX; it is a syntax error to have fewer than 4 digits after \u. For an explanation of possible values for errors see the Codec section below. Examples: u'abc' -> U+0061 U+0062 U+0063 u'\u1234' -> U+1234 u'abc\u1234\n' -> U+0061 U+0062 U+0063 U+1234 U+005c The 'raw-unicode-escape' encoding is defined as follows: ? \uXXXX sequence represent the U+XXXX Unicode character if and only if the number of leading backslashes is odd ? all other characters represent themselves as Unicode ordinal (e.g. 'b' -> U+0062) Note that you should provide some hint to the encoding you used to write your programs as pragma line in one the first few comment lines of the source file (e.g. '# source file encoding: latin-1'). If you only use 7-bit ASCII then everything is fine and no such notice is needed, but if you include Latin-1 characters not defined in ASCII, it may well be worthwhile including a hint since people in other countries will want to be able to read you source strings too. """ BTW, if you prefer a different "default" encoding, simply write a wrapper for unicode() which uses the modified default: def u(text,encoding='latin-1'): return unicode(text, encoding) You can also have stdout write Latin-1 for Unicode strings, by wrapping it using the StreamCodecs in codecs.py. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From dworkin at ccs.neu.edu Sat Apr 22 14:10:48 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 22 Apr 2000 14:10:48 -0400 Subject: LAmbda calculus evaluator (interactive) In-Reply-To: Andrew Cooke's message of "Sat, 22 Apr 2000 08:33:42 GMT" References: <8dro55$eq6$1@nnrp1.deja.com> Message-ID: Andrew Cooke writes: > I know where I can get various (Oca)ML programs, but I'm not sure > they're interactive % ocaml Objective Caml version 2.04 # 1 + 1;; - : int = 2 # -Justin From philh at vision25.demon.co.uk Sun Apr 30 16:12:04 2000 From: philh at vision25.demon.co.uk (phil hunt) Date: Sun, 30 Apr 2000 21:12:04 +0100 Subject: The Simple Economics of Open Source References: <8e140f$cco$1@slb0.atl.mindspring.net> Message-ID: On Mon, 24 Apr 2000 03:29:29 -0600, Andrew Dalke wrote: > >Raffael Cavallaro wrote: >>Fact is, only commodity items, that are known to many programmers, are >>open sourced. If there were sufficient demand to support a closed source >>business, then it would have happened that way. The proof of this is the >>BSDs, which would allow a closed source, proprietary fork at any time. >>Hasn't happened 'cause there's no demand for such a product. > > >Not quite fact. There are counter-examples. What's the major >competitor to TeX? From my understanding, when it was first released >there was nothing like it, proprietary or otherwise, so it wasn't >a commodity. > >The first few web servers and browsers weren't commodities, but they >were open source. > >But I do agree that most open-source projects seem to be years behind >their closed-source equivalents. How much more advanced is the closed-source equivalent of Leafwa? -- ***** Phil Hunt ***** send email to phil at comuno.com ***** Moore's Law: hardware speed doubles every 18 months Gates' Law: software speed halves every 18 months From robin at jessikat.demon.co.uk Wed Apr 26 09:30:52 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Wed, 26 Apr 2000 14:30:52 +0100 Subject: The Simple Economics of Open Source References: <14591.15630.192472.440375@goon.cnri.reston.va.us> <3900611F.3B525BDA@cfdrc.com> <3906D242.EB68BFED@zipzap.ch> Message-ID: In article <3906D242.EB68BFED at zipzap.ch>, Boris Borcic writes >Robin Becker wrote: >> >> I'm afraid your desire for a better world reduces your altruism >> quotient. >> Doing it because it helps others is altruism, doing it to help your self >> and or relatives isn't really. > >This comment can be made irrefutable, provided you *define* "self >and relatives" as the beneficiaries of ("pseudo") altruism. > >Reciprocally, altruism may be defined as the action of paradoxical >definitions of self. Paradoxical - means it conflicts with the >choices that follow from other, more common, definitions of self, >that make the term "selfish" determinate. > >Language that postulates a unique applicable definition of self >from the start, is thus inadequate to an enlightened discussion >of altruism, imho. > >BB >-- >"I think as I think, therefore I am who I am" wow :) -- Robin Becker From gmcm at hypernet.com Fri Apr 14 12:39:22 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 14 Apr 2000 12:39:22 -0400 Subject: problem with os.system calls under win32 In-Reply-To: <8d7c0k$fjr$1@nnrp1.deja.com> Message-ID: <1256392132-57146878@hypernet.com> william_93402 at my-deja.com wrote: > I am attempting to do a system call in a directory with spaces in the > name. For example: > > >>>import os > >>>os.system('c:\\f o o\\bar.exe') > 1 > > when I place the executable in a dir such as c:\\foo I can successfully > execute the system call. Is there something special I have to do when > directory names contain spaces? Just for notes I am running by example > in build 125 of pythonwin. Follow MS's rules: os.system('"c:\\f o o\\bar.exe"') (must be double-quotes). - Gordon From stevep at inkontact.com.au Mon Apr 17 20:24:12 2000 From: stevep at inkontact.com.au (Stephen Purcell) Date: Tue, 18 Apr 2000 10:24:12 +1000 Subject: [Module] PyUnit 1.0.1 - Unit testing framework Message-ID: <38FBAB2B.F41415AA@yahoo.com> PyUnit 1.0.1 ------------ Unit testing framework for Python. The Python unit testing framework, dubbed 'PyUnit' by convention, is a Python language version of JUnit and XUnit, the de facto standard unit testing frameworks for Java and Smalltalk respectively. PyUnit provides a standard, proven, simple and elegant way to write unit tests for Python software. PyUnit has been widely used for a number of months, and this new packaging is therefore considered a stable release. URL: http://pyunit.sourceforge.net/ Download: http://download.sourceforge.net/pyunit/pyunit-1.0.1.tar.gz Licence: Python Categories: Testing Steve Purcell, Technical Director Inkontact, http://www.inkontact.com/ -- PyUnit 1.0.1 -- Unit testing framework for Python From PClaerhout at CREO.BE Wed Apr 12 07:38:41 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 12 Apr 2000 13:38:41 +0200 Subject: Using xmllib Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA72A1@MSGEURO1> Hello, does anyone has an example on how to use the xmllib to parse an xmlfile? I have an xml-file, which looks a bit like this: Item 1 description. Thu Dec 16 16:35:05 1999 Item 2 description. Wed Mar 15 11:54:27 2000 I want to convert it to something like this: Collection from path s:\ - Item 1 (Thu Dec 16 16:35:05 1999) Item 1 description. - Item 2 (Wed Mar 15 11:54:27 2000) Item 2 description. Anyone an idea on how to do that with XMLlib? Kind regards, Pieter Pieter_Claerhout at creoscitex.com From parker at gol.com Thu Apr 6 18:32:36 2000 From: parker at gol.com (Ian Parker) Date: Thu, 06 Apr 2000 22:32:36 GMT Subject: Odp: Python on Alpha OpenVMS References: <_KCD4.2797$a01.54385@news.tpnet.pl> Message-ID: In article <_KCD4.2797$a01.54385 at news.tpnet.pl>, Tomek Lisowski writes >U?ytkownik Ian Parker w wiadomo?ci do grup dyskusyjnych >napisa?:hDlBpKAS7T34Ew1e at gol.com... >> In article , Tomek Lisowski >> writes >> >Hi! >> > >> >I have tried to compile Python sources on my VAX OpenVMS system, but soon >I >> >realized, that instead of my trusty DEC C++ compiler I need a native C >> >compiler. Unfortunately my C++ compiler cannot be reverted to a native C >> >language mode. Has anyone succeeded to create VAX OpenVMS Python >binaries? >> > >> >Note: Apart from VAX OpenVMS I have also an Alpha OpenVMS server, but >here I >> >don't have any C/C++ compiler available. If anyone has created Alpha >OpenVMS >> >Python binaries, please contact me too. >> > >> >Thanks in advance >> > >> >Tomasz Lisowski >> > >> >> Tomasz >> >> If you aren't planning changes to the source, why not just download and >> link the object modules from: >> http://decus.decus.de/~zessin/python/obj.html >> >> I'm so inspired by this solution, I'm at last downloading them myself. > >I am just not sure, for which platform were these modules compiled, and for >which version of OpenVMS system. I suppose, there could be some differences >between the OpenVMS versions. At least you can see them in the source code, >where there are some #ifdef and #if directives concerning the OpenVMS >version string. > >Please report, if you succeeded in making your Python running properly, >including the platform and OS info. > >Regards > >Tomasz Lisowski > Tomasz I'm glad to say that the VMS objects worked perfectly on both Alpha and VAX VMS systems. They're both V7.x - I didn't bother to check specific version numbers. I'm planning to deploy to about 20 VMS Alpha and VAX boxes. I even built a backup saveset of the resultant directory tree and a have a DCL script that does the VAX or Alpha assembly and linking on the target box - this keeps it very simple. I may even go all the way and make a VMSINSTALL/PCSI kit. I'm really impressed with the OpenVMS port (Uwe, please keep up the good work!). Only one qualification, at the moment I think the objects don't support threading, but haven't really investigated yet. Regards Ian Parker From ralph at inputplus.demon.co.uk Sun Apr 2 07:31:21 2000 From: ralph at inputplus.demon.co.uk (Ralph Corderoy) Date: 2 Apr 2000 12:31:21 +0100 Subject: else clauses in while and for loops References: <38DD2EE3.C7F3CB54@webamused.com> <8boe2k$gmh$1@inputplus.demon.co.uk> Message-ID: <8c7b29$37v$1@inputplus.demon.co.uk> Hi, > > I don't think that is a real need. > > so? do you suggest that we should remove it, and force people to > rewrite their perfectly working pro- grams, just to make you happy? > or maybe we could use all that energy to work on something more > important? I suggest you go back and read my post properly. In particular, the original poster's request. > > Please give some examples showing the real need for else clauses in > > this context. Someone replied giving a pointless use of else. I said out that this was a pointless use of else and therefore didn't match the original poster's request of an example `showing the real need'. I didn't say there wasn't a real need for else, I said `I don't think that is a real need' immediately after quoting the pointless example. Ralph. -------- Original post follows > > Please give some examples showing the real need for else clauses in > > this context. > > def lookup(stringList, word): > """Finds the first instance of word in stringList. Returns -1 if not > found""" > i = 0 > while i < len(stringList): > if stringList[i] == word: > break > i = i + 1 > else: > # is only executed if we never hit that break > return -1 > return i I don't think that is a real need. Wouldn't it normally be written to return ASAP rather than jump through hoops. def lookup(stringList, word): i = 0 while i < len(stringList): if stringList[i] == word: return i i = i + 1 return -1 Ralph. From moshez at math.huji.ac.il Wed Apr 5 18:00:07 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 6 Apr 2000 00:00:07 +0200 (IST) Subject: Extending Python with C-Libs In-Reply-To: <8cfpl8$9b2$1@newnews.ilk.de> Message-ID: On Wed, 5 Apr 2000, Frank Rotermund wrote: > Hello > > I have a Library written in C with its Headerfiles but without the > Sourcecode. > Does anybody know an easy way to extend Python with this Library? Use SWIG (http://www.swig.org). It only needs headers anyway. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From thomas at cintra.no Thu Apr 27 09:57:01 2000 From: thomas at cintra.no (‘5ÛHH575-UAZWKVVP-7H2H48V3) Date: Thu, 27 Apr 2000 13:57:01 GMT Subject: About Zope`s FTP-server Message-ID: <39084411.13519730@news.online.no> Hi, Just logged into the running ftp-server running with Zope. Am I inside a database suddenly? I tried to locate the "control_panel" folder listed in the ftp-client I used inside the Zope-installation dir, but no. Then I tried to create a folder and look for it, nowhere to be found. But my database inside Zope was bigger. This is fine and nice for small pics and html-stuff, but I want to upload pickled objects that can be several megabytes in size, then have a Zope-like or Zope-integrated method store them in some database, NOT gadfly, cuz the info is so huge. What then? If all I upload end up inside a database my question is; can that database, I guess it`s gadfly, handle it? If not, can I store uploaded stuff someother way, outside the database? I`d like to have users connect to the zope ftp-server, logging into a area set up especially for that user, similar to ordinary ftp-servers. This area would have to be available to other python-methods, either thru that darn database-thingy or some other way. The access-control has to be maintained too. Each user has one user-area that user can access and not, at least no write/delete etc. access, to other areas. Am I making any sense??! The bottom line is; can the built-in stuff handle huge amounts of data, spew it out quickly and in case of disaster, can the data be restored easily? Thanks. I`ll go take my medication now. ;-> Thomas From nmm1 at cus.cam.ac.uk Mon Apr 10 09:52:56 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 10 Apr 2000 13:52:56 GMT Subject: Python paradigms References: <8cs70f$ojf$1@pegasus.csx.cam.ac.uk> <38F1C600.3FD9878B@acm.org> Message-ID: <8csmbo$99t$1@pegasus.csx.cam.ac.uk> "Robert W. Cunningham" wrote: > > > At best, confusing code wastes effort. At worst, it causes mistakes > > to be introduced. I have seen the latter effect many times. > > > > That is why I was talking about the benefits of those paradigms for > > code clarification, and neither efficiency nor compactness. Python > > has some very useful facilities, but is a bit tedious for some kinds > > of scripting. > > Again, comments in the code can cover all these bases. A good > "paradigm" is a good thing to have, but it is no Holy Grail. It is but > one step in the creation of a good program. ... Your second sentences are correct, but your first is most definitely false. Dangerously so. I would be the last person to agree with that nonsense that any languages or programming styles are "self commenting", but the converse is equally wrong. Using unclear paradigms (whether out of 'cleverness' or because the language forces you to) has the following major problems: 1) It makes it very hard to see when your code does not match your intent. I have frequently had arguments with people who have taken your viewpoint, when I have pointed out that the code that they wrote only SEEMS to match their comments! Typically, the error is that it does so, except for a few, nasty boundary cases. 2) Code rot. In the days of punched cards, only a few programmers maintained their comments. Nowadays, most do, but a large number tend to cut corners when adding a 'simple' modification to trap a previously unthought-of boundary condition (see above.) And have you every tried to get a large vendor to accept a bug report on a COMMENT when the code works correctly? 3) It is very hard to express the sort of details that cause trouble in English - comments are good at saying WHAT should be done but not so good at saying EXACTLY HOW. This is best done in a pseudo mathematical language, such as a programming language - which is, after all, precisely what ALGOL 60 was designed for! > Have any of you ever had to port a product written in a "dead" computer > language? I have, more than once. The comments were the ONLY thing to > make the task possible, since even texts adequately documenting the old > languages (especially the libraries) were extremely difficult to find. Not often - probably only a few dozen times on sizeable codes. In the cases that I had too look at in detail, things broke down something like the following (all figures being wildly incorrect): 75% comments and code matched, and either was clear enough 15% comments and code matched, but both were inadequate 5% comments and code didn't match, and the code was correct 2.5% comments and code didn't match, and the comments were 2.5% I gave up, and reimplemented from my own algorithm! > Human language, written well, is far more expressive than computer > languages. That's why computer hardware and software is documented with > books, and not in their "own" languages. ... Not so. They are written that way 'for simplicity' (i.e. because it is quite hard to get most people to read mathematics as a specification) and because there are no standardised languages for expressing the semi-mathematical concepts. However, when specifying things like library functions, they very often ARE specified in terms of an 'example implementation' - i.e. in their own languages. > At best, sound paradigms can simplify code and reduce the level of > commenting needed, but can in no way eliminate the need for thorough > commenting and other documentation. And conversely. > And if you can't write good comments, how can you POSSIBLY believe you > can write good code? And, if you can't say what you mean in a semi-precise language like a programming language, how are you going to do it in English? Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From moshez at math.huji.ac.il Wed Apr 5 02:57:53 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 5 Apr 2000 08:57:53 +0200 (IST) Subject: Why should I switch to Python? - Infinity of Primes In-Reply-To: <1257244378-5884705@hypernet.com> Message-ID: On Tue, 4 Apr 2000, Gordon McMillan wrote: > Oh, come on. There are at least 3 well known constructive > proofs that all odd numbers are prime: > > The mathematician's: > 3 is prime, > 5 is prime, > 7 is prime > as so on, by induction. > > The physicist's: > 3 is prime, > 5 is prime, > 7 is prime, > 9 is prime > 11 is prime... > > The computer scientist's: > 3 is prime, > 3 is prime, > 3 is prime .... the biologist's: 3 is prime, 5 is prime, 7 is prime, 9 is prime, 11 is prime, -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From loredo at spacenet.tn.cornell.edu Fri Apr 28 16:22:13 2000 From: loredo at spacenet.tn.cornell.edu (Tom Loredo) Date: Fri, 28 Apr 2000 16:22:13 -0400 Subject: What does "first class" mean? Message-ID: <3909F2F5.A6F91256@spacenet.tn.cornell.edu> Hi folks- I've often seen reference here (and on the Ruby page) to Python's treatment of functions and methods as "first class objects." What does this mean? I thought I had most of the OO lingo in hand after a year of EE/CS courses at MIT in the early 80s (back then most it fell under the rubric of "data abstraction"). But "first class" in this context must have been in one of the lectures I missed. (There were quite a few of those, actually!) Thanks, Tom Loredo From effbot at telia.com Sun Apr 2 19:44:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 02 Apr 2000 23:44:23 GMT Subject: NameError when assigning dictionary values References: <20000402231757.6604.qmail@web2105.mail.yahoo.com> Message-ID: lewst wrote: > I was trying to build a dictionary and create lists corresponding to > the value names in the dictionary in one loop. unlike Tcl, you don't need to create *variables* to be able to store *values* to your dictionary. > Do I really have to type "one" and "two" twice? Once to make it a > variable and a second time to add to my dictionary? I.e, no. reset your brain. forget about variables. just put new *values* (aka objects) in the dictionary. > This seems error prone if the the number of variables grows very large > as it will for me. let me guess: what you really want to do is to have a number of lists, each of which are identified by a string? mydict = {} for k in ("one", "two"): mydict[k] = [] and then you want to update one of them: mydict["one"].append("1") and then you want to print them all: for k, v in mydict.items(): print k, v did I successfully read your mind this time? From dan at cgsoftware.com Wed Apr 5 19:48:27 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Wed, 5 Apr 2000 16:48:27 -0700 (PDT) Subject: Pass by reference ? In-Reply-To: <38EBCD7D.7030602@acm.org> Message-ID: > > def Nuke(w): > print w, > w=None > print w Sorry, this function is not a good demonstration. w is a reference to whatever is passed in. Then you are making w a reference to None. What you should try is w.append(5), or something Try thusly: def Appender(w): print w w.append(5) print w Now, let's call this: x=[] Appender(x) You'll see: [] [5] Then, if you print x, you'll see: [5] Thus, we passed it by reference, because it modified the original. HTH, Dan > This behavior meets the classical definition of "Pass By Value". Bad example. > > What other tests have I omitted, and what do they yield? See above. > > > -BobC > > -- > http://www.python.org/mailman/listinfo/python-list > From MSteed at altiris.com Tue Apr 25 14:01:00 2000 From: MSteed at altiris.com (Mike Steed) Date: Tue, 25 Apr 2000 12:01:00 -0600 Subject: VIM NT +python Message-ID: <65118AEEFF5AD3118E8300508B1248774CB2B6@ALTNET> Hi, I just built the latest version (5.6.69) with the default feature set, plus the Python interface. I have not tested it beyond :python print 'hi' which passed with flying colors. http://athani.pair.com/msteed/vim/gvim56py.zip M. > From: Me [mailto:me at nospam.edu] > Sent: Tuesday, April 25, 2000 11:27 AM > To: python-list at python.org > Subject: Re: VIM NT +python > > > So would I! > > wrote in message > news:8e4j27$hgq$1 at nnrp1.deja.com... > > Does anyone here have a winNT build of the VIM editor that > has python > > support switched on? > > > > I'd love to get my hands on a copy. > > > > > > Sent via Deja.com http://www.deja.com/ > > Before you buy. From dalke at acm.org Sat Apr 1 05:25:22 2000 From: dalke at acm.org (Andrew Dalke) Date: Sat, 1 Apr 2000 03:25:22 -0700 Subject: arraymodule questions Message-ID: <8c4iqv$2na$1@nntp9.atl.mindspring.net> Hello, (the questions are at the end; but first, discussion) I'm working on a project to store and analyze protein and nucleotide sequences with Python. These are often stored as character strings. I'm trying to find out the best storage container for the data. I've been experimenting with array.array of characters instead of string because of its in-place mutability. For example, suppose I use a string as my primary data type, then a function might be written as (given in another recent post of mine) def translate(dna, table = Translation.standard_table): protein = [] for i in range(0, len(dna), 3): protein.append(table[dna[i:i+3]]) return string.join(x, "") This stores the temporary data in an [], and I don't like that. I would rather not have the additional conversion back to a string. With a character array: def translate(dna, table = Translation.standard_table): dna = dna.tostring() protein = array.array( ("c", "") ) for i in range(0, len(dna), 3): protein.append(table[dna[i:i+3]]) return protein This also requires a conversion, but conversion to a string uses about 1/4th the memory as using a list, and the string conversion is trivial since the array stores its data as a block of characters. (It's only 1/4 since Python special cases single letter strings to reuse the same object.) However, the performance of array.array is about 30% slower than appending to a list followed by conversion to string. Tracking it down, about 20% of the time is spent because ins1 in arraymodule.c calls c_setitem twice. The first checks if the input object is a character, but with an index meaning "don't acually set the item." The second time occurs after the array was resized, to actually set the item. What I did was add special code for append rather than calling the generic insert function. This always increases the size by 1 item - optimistically assuming the setitem will work. Then it calls setitem and, if that fails, decrement the size count by 1 without resizing the array back down. (My assumption is working code most likely won't fail, so the amortized cost of the infrequent extra realloc and few bytes will be low.) I got another 20% performance by preallocating an additional 64 items when the array size is increased, which reduces the number of realloc calls. With these changes, the two versions (string and array) of my timing test come out rougly the same. (I know, 30%-20%-20% doesn't come out to be 0% - the percents aren't all based on the same initial timings.) I started thinking seriously about using an array for the base character storage, but then noticed that arraymodule doesn't expose the array object C level API. There structure is only defined in arraymodule.c, and not in any header file. There will be C extensions which need access to the character data, so I can't use an array. So my questions are about changes for Python 1.6: 1) would it be okay to make the arrayobject C API available? 2) could I add the .append optimizations mentioned above? 3) should I also add the code to preallocated space? Some of the Python methods are commented out, such as "count". Why is this so? There are comments implying that if someone needs them, they can be added. I could do this. I notice "extend" doesn't exist. I could also add that. Andrew Dalke dalke at acm.org From cnetzer at stanford.edu Sat Apr 15 21:53:31 2000 From: cnetzer at stanford.edu (Chad Netzer) Date: Sat, 15 Apr 2000 18:53:31 -0700 Subject: Python 1.6a2 crashes in test_fork1 on my Mandrake Linux 7 machine References: <20000413010344.A13931@owl.rhein-zeitung.de> <38F658C6.66AD9CA5@clark.net> <20000414154718.A15664@xs4all.nl> <20000414190308.A30502@owl.rhein-zeitung.de> Message-ID: <38F91D1B.3D663B0C@stanford.edu> Oliver Andrich wrote: > On Fri, Apr 14, 2000 at 03:47:18PM +0200, Thomas Wouters wrote: > > I dont know enough about threads to say anything useful about this, but it > > is kind of strange that you dont see the same problem under Python 1.5.2. Well, I've been fooling around trying to figure this one out. It doesn't appear to be related to GCC. I tried the exact same GCC's on both a Redhat 6.2 and my Mandrake 7 (w/ cooker) and it worked fine on Redhat, but failed on Mandrake. I also downloaded a recent (4/10/2000) GCC from cvs, and had the same results on both systems. Also, test_fork1.py fails for me on Mandrake even with Python 1.5.2. I also tried it w/ Linux kernel 2.3.pre99-5 and 2.2.14; same results. And finally, I installed the Mandrake glibc on Redhat and *still* had the same results. However, my Mandrake machine is 2 CPU SMP, while the redhat was one CPU, which leads me to the next phase of testing... I traced the error, using strategic printf's, to the posixmodule posix_waitpid() function, and I think it is a bug in the Py_END_ALLOW_THREADS or Py_BEGIN_ALLOW_THREADS macros. Basically, when the problem occurs, which is not always (and the frequency of occurence seems to change depending on how many print statements I use in test_fork1.py), the code seems to go into an infinite loop in either of these two macros (using "top" shows python at 99% cpu). Here is an example of the "top" output when the test_fork1.py program locks up. 54 processes: 49 sleeping, 4 running, 1 zombie, 0 stopped CPU states: 54.5% user, 2.8% system, 0.0% nice, 42.5% idle Mem: 127780K av, 124460K used, 3320K free, 80140K shrd, 2472K buff Swap: 265032K av, 836K used, 264196K free 44804K cached PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 14133 chad 18 0 1172 1172 804 R 0 98.2 0.9 11:15 python 521 root 0 0 28712 28M 2260 S 0 7.7 22.4 3:36 X This indicates to me (naive as I am about threads) that there is spinlock going nuts waiting forever for threads to block or unblock. Try putting a fprintf() just before and after these macros in posixmodule.c:posix_waitpid(). The actual kernel waitpid() call itself, and thus the forking, seems to be fine. > May be we have a again a code generation problem on > Mandrake 7. I hope not... Because of school, work, and taxes, I'm probably too busy to track this one down further. I forgot to test my Mandrake compiled binary on a Redhat 6.2 system, so I would suggest that as another test. But it appears, from where I'm sitting, to be a problem with threading, and not necessarily w/ code generation (for once). If I discover more, I'll post it here. Chad Netzer cnetzer at stanford.edu From bgdarnel at my-deja.com Sat Apr 15 21:44:37 2000 From: bgdarnel at my-deja.com (Ben Darnell) Date: 16 Apr 2000 01:44:37 GMT Subject: PyApache and mxDateTime Message-ID: When I use the following trivial script under PyApache, it fails: #!/usr/bin/python print "Content-type: text/plain" print try: import DateTime except: import traceback import sys sys.stderr=sys.stdout traceback.print_exc() Output: Traceback (innermost last): File "/usr/lib/cgi-bin/foo.py", line 7, in ? import DateTime File "/usr/lib/python1.5/site-packages/DateTime/__init__.py", line 20, in ? from DateTime import * File "/usr/lib/python1.5/site-packages/DateTime/DateTime.py", line 817, in ? def add_century(year, TypeError: call of non-function (type None) Going without the DateTime module is not an option, as it is required for MySQLdb. At this time, I can get by without PyApache, but I would like to have the option of switching to a more efficient processing model when the need arises. Is there any workaround for this problem? -Ben -- Ben Darnell bgdarnel at unity.nc su.edu http://thoughtstream.org From tjdukes at my-deja.com Tue Apr 4 12:23:52 2000 From: tjdukes at my-deja.com (tjdukes at my-deja.com) Date: Tue, 04 Apr 2000 16:23:52 GMT Subject: bug in build on Solaris? Message-ID: <8cd4u5$6tu$1@nnrp1.deja.com> I posted a message yesterday about not being able to perform the demo in Demo/extend. This morning I tried the following. - I erased Python-1.5.2/python and typed 'make'. - The command used to link python was gcc python.o \ ../libpython1.5.a -lsocket -lnsl -ldl -lthread -lm -o python - I erased python again and typed the following commands in by hand. cd Modules gcc -export-dynamic python.o ../libpython1.5.a \ -lsocket -lnsl -ldl -lthread -lm -o python mv python .. This makes the example work correctly. Is this a bug in the makefile shipped with Python 1.5.2 or is there a configuration option for this? thanks, Todd. Sent via Deja.com http://www.deja.com/ Before you buy. From embed at geocities.com Thu Apr 20 11:15:38 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 20 Apr 2000 11:15:38 -0400 Subject: __del__ problem - would adopting Garbage Collection fix this? References: <000801bfaa9c$c9957aa0$d62d153f@tim> Message-ID: > BTW, this was all discussed at extreme length on Python-Dev -- check it out! > I doubt anyone wants to repeat all of that whlie struggling to pretend it's > new & interesting . Is there an archive on the web somewhere of Python-Dev discussions?! Sorry if that's a FAQ. Warren From richard_chamberlain at ntlworld.com Wed Apr 5 09:18:04 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Wed, 5 Apr 2000 14:18:04 +0100 Subject: ASP web-type stuff References: Message-ID: <8cfea6$71$1@gxsn.com> Hi Dan, ASP is not language dependent, most of the stuff you'll see is written in VBScript or JScript but you can actually configure it to use other languages. See http://starship.python.net/crew/pirx/asp/py_asp.html to show you how to use Python with ASP. Richard "Dan Green" wrote in message news:RZyG4.3061$9o.5812531 at news.magma.ca... > Ahoy, folks. > I was looking over things like Embperl and Apache::ASP and liked the > idea. I would like the idea more if I could do with python. So I had a > couple of questions: > > Is there such a thing? > Is there interest in such a thing? > Does anbody want to hear about my 75 lines of code hack that basically does > the trick, but needs a lot of work? > > If nobody cares at all, I'll just shut up and go home. :) > > For those of you who have no idea what I'm talking about, it's basically an > alternative to CGI that allows you to embed the code right into the HTML. > > something like this: > > > > <% for i in range(5): %> > Loop item <%= i %>
> > > > would look like this when called from a browser: > > > > Loop item 1
> Loop item 2
> Loop item 3
> Loop item 4
> Loop item 5
> > > > Let me know. If you're interested, please e-mail me. > > -- > Dan Green | "So What? It's your problem to learn to live with, > Developer | destroy us, or make us saints." > Rewind Technologies | -- Ministry, "So What?" From rayvd at nospam.firetail.org Fri Apr 7 01:01:58 2000 From: rayvd at nospam.firetail.org (Ray Van Dolson) Date: Fri, 07 Apr 2000 05:01:58 GMT Subject: Socket Programming Question Message-ID: I'm trying to write a simple chat server w/ Python sockets that supports multiple connections and am having a little trouble... here's my server code so far: #!/usr/bin/python from socket import * from threading import * serversocket = socket(AF_INET,SOCK_STREAM) serversocket.setsockopt(SOL_SOCKET,SO_REUSEADDR,1) serversocket.bind((gethostname(), 9001)) serversocket.listen(5) def client_thread(clientsocket): clientsocket.send("Welcome to the chat server...\r\n") while 1: data = clientsocket.recv(1024) if data: clientsocket.send(data) else: pass def main_server_thread(): while 1: (clientsocket, address) = serversocket.accept() ct = Thread(target=client_thread,args=((clientsocket),)) ct.run() mainThread = Thread(target=main_server_thread,args=()) mainThread.start() while 1: pass However, this code only allows one connection at a time... the other can connect to the socket but is simply queued. I would think the main_server_thread() therad would create a new thread for each connection? What do I need to do to support multiple, simultaneous connections with this code? Thanks, Ray Van Dolson From JamesL at Lugoj.Com Tue Apr 4 00:28:08 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Mon, 03 Apr 2000 21:28:08 -0700 Subject: Python 1.6 alpha 1 released References: <200003312130.QAA04361@eric.cnri.reston.va.us> <38E52716.A1C63B5D@roguewave.com> <38E52D76.1820FC32@roguewave.com> <8c7tfd$k80$1@nntp9.atl.mindspring.net> <8catgc$5i84$1@uvaix7e1.comp.UVic.CA> <9i8G4.1196$n68.192123904@newsb.telia.net> Message-ID: <38E96F58.96FCF3C5@Lugoj.Com> Fredrik Lundh wrote: > > John Aycock wrote: > > Although I don't have time to volunteer, it wouldn't be too difficult > > to write a program which would look through existing Python code and > > warn of potential uses of these changed constructs. > > after reading your post, tim peters used barry's new "post > via the time machine" facility: > > http://www.deja.com/=dnc/getdoc.xp?AN=591243549 > > changing it to look for "connect" should be trivial (he's probably > done that by now). > > fwiw, while it may miss many real appends (see comments in > script), I'm pretty the number of missed connect calls are very > close to zero. > > And just when you think you've nailed all the connect()s in your client code (which one must admit will in general probably occur in only one or two locations for most network applications) and hope you've blessed all appends, you find your server code is throwing exceptions in the bind() calls.... P.S. Still waiting for a new release of the Unix standard so that the spelling of the creat() system call can be corrected. From mikael at isy.liu.se Tue Apr 11 07:14:15 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 11 Apr 2000 13:14:15 +0200 (MET DST) Subject: Redirecting the output from sys.stdout In-Reply-To: Message-ID: On 11-Apr-00 Oleg Broytmann wrote: > import os, string > pipe = os.popen("dir /w", 'r') # Open pipe for reading > > lines = [] > while 1: > line = pipe.readline() > if not line: break # EOF > > lines.append(line) Why not the following? import os, string pipe = os.popen("dir /w", 'r') # Open pipe for reading lines = pipe.readlines() Or even the following to throw away the pipe when you are done with it. import os, string lines = os.popen("dir /w", 'r').readlines() /Mikael ----------------------------------------------------------------------- E-Mail: Mikael Olofsson WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael Phone: +46 - (0)13 - 28 1343 Telefax: +46 - (0)13 - 28 1339 Date: 11-Apr-00 Time: 13:09:36 This message was sent by XF-Mail. ----------------------------------------------------------------------- From nmm1 at cus.cam.ac.uk Mon Apr 10 04:31:52 2000 From: nmm1 at cus.cam.ac.uk (Nick Maclaren) Date: 10 Apr 2000 08:31:52 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> <8covpn$4jq$1@slb6.atl.mindspring.net> <8cqk7u$dmc$1@pegasus.csx.cam.ac.uk> <3H4I4.709$4w1.17557@typhoon.nyroc.rr.com> Message-ID: <8cs3ho$l06$1@pegasus.csx.cam.ac.uk> In article <3H4I4.709$4w1.17557 at typhoon.nyroc.rr.com>, Darrell wrote: >> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0) > >x=0 >if a != NULL: > x=a[i].weeble > >if b != NULL: > x=x+b[i].wombat > >Isn't this more clear? >In fact isn't not much if any longer than the "C" version when you count the >parens used. No. Firstly, it relies on an artifact of my example (i.e. that it is in an assignment, rather than a test condition or function call) and, secondly, the more lines that code takes the harder it is to see the function in its entirety. Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QG, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679 From jmassung at magpiesystems.com Mon Apr 17 20:29:19 2000 From: jmassung at magpiesystems.com (Jeff Massung) Date: Mon, 17 Apr 2000 18:29:19 -0600 Subject: Another question References: <38FB2EEB.A32AF88C@bam.com> <38FB339F.604364AD@bam.com> <200004171605.MAA04929@zippy.init.com> <38FB7610.80EAF965@ichips.intel.com> <200004172120.RAA11102@zippy.init.com> Message-ID: Donald Beaudry wrote in message <200004172120.RAA11102 at zippy.init.com>... >and this one is better still (at least on my machine): > > def do_it(): > from random import randint > r = [0,] * 100000 > for i in xrange(100000): > r[i] = randint(1,10) > do_it() > With the "from/import" being local, does the namespace go away after the function is done? How fast is importing (say I called do_it() 10000 times - then how efficient is your function?) Jeff From godzilla at netmeg.net Sat Apr 1 07:49:06 2000 From: godzilla at netmeg.net (Les Schaffer) Date: Sat, 01 Apr 2000 12:49:06 GMT Subject: Emacs Python mode References: Message-ID: > I just had an idea. Using the Emacs python-mode, would it be > possible to somehow hide the function-bodies? check out the emacs folding-mode. all you have to do is put the function bodies inside fold marks and you can hide their definitions. les schaffer From rcunning at acm.org Sun Apr 9 00:38:22 2000 From: rcunning at acm.org (Robert W. Cunningham) Date: Sun, 09 Apr 2000 04:38:22 GMT Subject: Python paradigms References: <8cmr70$b0e$1@pegasus.csx.cam.ac.uk> Message-ID: <38F00890.3C98EBDB@acm.org> David Goodger wrote: > C's ?: operator, ie: > > test ? true : false > > can be done in Python, with: > > ((test and [true]) or [false])[0] > > Note that I said *can* be done, not *should* be done! It is very ugly and > counter-intuitive and naughty. But sometimes necessary. Use sparingly, > especially if your code will ever be read (even by you!). As another Python newbie, I just came across this usage in some random Python code I downloaded (so I could get a look at some "real world" Python programming). All the author did was something like this: blah = (((test and [true]) or [false])[0]) # blah = (test ? true : false) Works for me! Only if I have a good reason to suspect a problem in this particular line of code will I have to look past the comment. Which, I believe, is the entire purpose of in-line comments in the first place. The best way to get someone to read every single line of your code is to fail to properly comment it. Are there ANY Python programmers who don't also know at least this much C? You ALL use in-line comments, don't you? Though, in this particular case, I suspect an apology should be added as well. But all this can be avoided, of course, with judicious use of m4 or sed. After all, shouldn't Python have a pre-processor too? A pre-interpreter interpreter? Or, maybe, I should just stop learning Python and use C2Py instead. If, of course, such a beast were to exist. All for the love of a nice big juicy side effect... Lacking-words-for-a-better-closing-ly y'rs, -BobC From embed at geocities.com Tue Apr 4 15:07:37 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 4 Apr 2000 14:07:37 -0500 Subject: What is python's language level? References: <38EA1B8F.A797A130@lmco.com> Message-ID: "Chuck Meyers" wrote in message news:38EA1B8F.A797A130 at lmco.com... > Does anyone know python's language level? I did not find it in the list > at: > > http://www.spr.com/library/0langtbl.htm > > I would guess that it would be somewhere between 15 and 30. This is an > important point, even if language levels are imprecise they can make it > easier to convince people to look at or try a language like python. > Cheap guess; Perl is a 15, so we'll take the Perl number. Two things that make me laugh about this: 1. One of the highest 'level' tools is Lotus 1-2-3 for DOS? So why isn't Linux or Windows 2000 written entirely in "lotus 1-2-3 for DOS"? That's rich. Go ahead and try to convince people to use Lotus 1-2-3 for DOS for their new development efforts! 2. What's a function point? Who decides what a "function point" is, and says that it applies across all the various kinds of people who write software as part of their professional duties? How many lines of COBOL does it take to create a python-like Dictionary object? ;-) Warren From stevey at polgar.cnd.hp.com Sat Apr 22 18:16:19 2000 From: stevey at polgar.cnd.hp.com (Steve Yonkatits) Date: 22 Apr 2000 22:16:19 GMT Subject: SWIG Message-ID: The directory that I found for SWIG was: ftp://ftp.cs.utah.edu/pub/dept/OLD/pub/beazley/SWIG/ Steve From pf at sxb.bsf.alcatel.fr Fri Apr 7 07:09:15 2000 From: pf at sxb.bsf.alcatel.fr (Pascal Fremaux) Date: Fri, 07 Apr 2000 13:09:15 +0200 Subject: Newbie: How to do an exit ? Message-ID: <38EDC1DA.62CBFCF3@sxb.bsf.alcatel.fr> How to exit from a program ? I don't find a command such as exit(0) in C -- Pascal Fremaux, SSII Alten Study Engineer at Alcatel Telecom R&D, Illkirch, France From dalke at acm.org Mon Apr 3 02:00:00 2000 From: dalke at acm.org (Andrew Dalke) Date: Mon, 3 Apr 2000 00:00:00 -0600 Subject: new method for string objects References: <8c44e8$5hj$1@slb6.atl.mindspring.net> Message-ID: <8c9bru$9ut$1@slb0.atl.mindspring.net> Fredrik Lundh wrote: >>>> s = u"123" >>>> b = buffer(s) >>>> b > >>>> len(b) >6 >>>> b[0] >'1' >>>> str(b) >'1\0002\0003\000' >>>> fp.write(b) # writes raw contents to file without extra copy BTW, what I'm really surprised about is that the following works: a = "GAATAAC" b = buffer(a) import string string.count(b, "A") I guess that's what it means when the string code wants a "read-only character buffer". There's something fundamental I'm missing on how strings and buffers work in Python. Looks like it's time to look at source code. Andrew dalke at acm.org From tim_one at email.msn.com Sat Apr 1 16:49:41 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 1 Apr 2000 16:49:41 -0500 Subject: Confusion about re lookahead assertions In-Reply-To: <8c5n76$9le$1@nnrp1.deja.com> Message-ID: <000201bf9c24$2f91c020$482d153f@tim> [posted & mailed] [Skip Montanaro] > I'm trying to use re's lookahead assertion constructs for the first time > and am more than a bit confused. If I understand them correctly, the > regular expression r'(?![.])([0-9]+)\s+' should only match digits if they > are not preceeded by a dot, yet the example below clearly contradicts > that. It's your understanding that needs adjustment here. An "assertion" never consumes a character. So, e.g., (?!E1)(E2) matches at a point p iff E1 does not match at p and E2 does match at p. In your case, a digit is not a decimal point, so (?![.])\d+ will match any string of (one or more) digits. More generally, if the set of strings E1 and E2 can match are disjoint, sticking (?!E1) in front of E2 does nothing for you. Think of it as "all the strings that can match E2, *except for* the strings that match E1". In your case, the set of strings composed of digits minus the set of strings that begin with a decimal point is simply the set you started with (because they have nothing in common). > >>> pat = re.compile(r'(?![.])([0-9]+)\s+') By the above, this is effectively the same as pat = re.compile(r'([0-9]+)\s+') and everything you saw follows from that. What you really want is a negative look*behind* assertion, to say "match a string of digits, but not if looking backward from the start I see a decimal point". Presumably you can get the effect you want without this assertion stuff, via e.g. pat = re.compile(r'(?:^|[^.])(\d+)\s+') > pat = re.compile(r'(?![-A-Za-z0-9:._])([0-9]+)\s+') In this case, every string that can match E2 also matches E1, so E2-E1 is empty: this can't match anything. An interface that expressed this stuff as set operations on regular languages instead would make it all obvious; try to *think* of it that way anyway . easy-to-do-if-you-don't-need-to-ly y'rs - tim From a.d.stribblehill at dur.ac.uk Fri Apr 7 12:25:48 2000 From: a.d.stribblehill at dur.ac.uk (Andrew Stribblehill) Date: 07 Apr 2000 17:25:48 +0100 Subject: Member function names Message-ID: <87vh1t6foz.fsf@womble.dur.ac.uk> For some things, such as XML parsers, based on xmllib, I have to do stuff like this: class foo(XMLParser): start_h1: print "start_h1", end_h1: print "end_h1", (etc) Is there any way I can do something like this? class foo(XMLParser): generic: print __member_function_name__, start_h1=generic end_h1=generic (etc) Note: this is an example which I've managed to solve neatly a different way but I still want to know if such a trick is possible, for other less tractible problems! Thanks, Andrew Stribblehill From javanet at dynacap.com Mon Apr 3 13:41:15 2000 From: javanet at dynacap.com (Arnaldo Riquelme) Date: Mon, 3 Apr 2000 09:41:15 -0800 Subject: Visual Interdev & Python Message-ID: I'm getting ready to build a web based app using ASP. Since I'm totally new in this arena, I was kindly provided with ASP books, a VBScript reference book and Visual Interdev by management. Most of the staff I've done in past had to deal with in the unix world, using perl, bash, php, some c , etc. I was a little disgusted by the VB syntax and I rather not spend anytime learning it if could use another language, preferably python, since I have been using it for a couple month and I'm totally in love with it. Is there any way to integrate Visual Interdev with python. Visual Interdev seems to be a very popular tool for ASPs and I think it could be a great way to attract Windows Developers (VB) to use python. Has anyone attempted to do this before? Can anyone help with some suggestions or point me to the right direction? Best regards Arnaldo Riquelme From godzilla at netmeg.net Tue Apr 11 20:48:47 2000 From: godzilla at netmeg.net (Les Schaffer) Date: Wed, 12 Apr 2000 00:48:47 GMT Subject: issubclass funny business References: <1256652290-41498655@hypernet.com> Message-ID: GMcM said: > You are running FileScanner. Therefore, in FileScanner, class > StandardArrayFileScanner is defined in __main__. If you trickle up > to the top of __bases__ above, you'll find > FileScanner.StandardArrayFileScanner, which is not the same object. sigh... yep: > if not isinstance(std, StandardArrayFileScanner): > import cie > print std.__class__, cie.CIE.__bases__, cie.CIE_Standards.__bases__ gustav)~/Engineering/dspring/stoplite/matlab/Jue-Data/: python FileScanner.py prints: cie.CIE (,) (,) same problem with issubclass..... whilst: print self.__class__.__bases__ (self is a subclass of ArrayFileScanner) gives: (,) les schaffer From amitp at Xenon.Stanford.EDU Sat Apr 8 20:52:19 2000 From: amitp at Xenon.Stanford.EDU (Amit Patel) Date: 9 Apr 2000 00:52:19 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <3FAG4.62951$3b6.243372@ozemail.com.au> Message-ID: <8cok83$lpr$1@nntp.Stanford.EDU> Justin Sheehy wrote: | "Jason Stokes" writes: | | > The market for Perl is 10-100 times bigger than Python. | | The "market", as defined how? | The market for P* books is all the people who think P* isn't obvious. In that context, the market for Perl is 10-100 times bigger than for Python. ;-) -I-learned-Python-without-any-stinkin-book-ly y'rs, Amit From carlg at world.uucp Tue Apr 4 12:53:59 2000 From: carlg at world.uucp (Carl E Gundel) Date: Tue, 4 Apr 2000 16:53:59 GMT Subject: Smalltalk on the small end (was: Advice requested: GUI project beginning) References: <8D79BC9E4960ED70.7B6609342D6EB723.7625773D14AD9140@lp.airnews.net> Message-ID: Christopher Browne (cbbrowne at news.hex.net) wrote: : Centuries ago, Nostradamus foresaw a time when Cameron Laird would say: : >Actually, there's another thread here asking to : >be launched. Python (and Tcl, too, in a somewhat : >different fashion is (are) really quite extraor- : >dinary for shell-level scripting and operation. : >I find myself wondering more and more how people : >get along without such (*particularly* on the : >conventional desktops--Win* and MacOS). I do : >think Python is clearly superior to Smalltalk : >for those one-page scripts that most people do : >with /bin/sh; still, I'm willing to consider that : >Smalltalk is more capable in this regard than I : >yet realize, and, in any case, I can well imagine : >Smalltalk proponents favoring it over /bin/sh. : The "power" of Smalltalk comes not when you're writing one page shell : scripts, but when you have a bunch of "objects that do useful things" : that can all run in a single Smalltalk environment. Smalltalk was the operating system on the machines it was originally created to run on, and in that case scripting made lots of sense. :-) -Carl -- ------------------------------------------------------------------ Carl Gundel carlg at world.std.com Shoptalk Systems 508-872-5315 author of Liberty BASIC, a 1996 PC Magazine Awards Finalist! http://world.std.com/~carlg/basic.html ------------------------------------------------------------------ From exarkun at flashmail.com Mon Apr 17 17:14:09 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Mon, 17 Apr 2000 21:14:09 +0000 Subject: Python CGI References: <38F852D9.E2144F17@flashmail.com> Message-ID: <38FB7EA1.17F251A2@flashmail.com> Harry George wrote: > > I run python cgi's on RS6000 (AIX 4.3.2), using Netscape Enterprise > Server. No problem. Can you post the code, or at least a skeleton > which exhibits the behavior (leaving out sensitive content)? > *Arg* I found the problem.. I slipped back into the C mentality for a bit there. Worst part is, I saw the problem every time I tried to fix the program, it just never registered as a problem ;) The problem: I screwed up indentation underneath a for loop ;P Jp > > [snip] -- A sad spectacle. If they be inhabited, what a scope for misery and folly. If they be not inhabited, what a waste of space. -- Thomas Carlyle, looking at the stars -- 9:09pm up 20 days, 2:16, 2 users, load average: 0.32, 0.10, 0.03 From mwh21 at cam.ac.uk Wed Apr 12 07:00:05 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 12 Apr 2000 12:00:05 +0100 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> <874s9766r6.fsf@ifm.uni-kiel.de> <8d1ihl$q244@imsp212.netvigator.com> Message-ID: "Paul Gresham" writes: > I like this solution a lot, it makes a lot of sense. Thanks Michael. > I guess somewhere in Python is a defined route back to the super > class, on a better day I may just dig through the code. For a variey of reasons, class heirachies in Python are usually pretty shallow, so this isn't often too much of a problem. I think the median depth of class heriachies in code I write is probably 1... Cheers, M. -- On the other hand, the following areas are subject to boycott in reaction to the rampant impurity of design or execution, as determined after a period of study, in no particular order: ... http://www.naggum.no/profile.html From cut_me_out at hotmail.com Sun Apr 30 18:19:37 2000 From: cut_me_out at hotmail.com (Alex) Date: 30 Apr 2000 18:19:37 -0400 Subject: How to make compile work for strings that contain ^M's? Message-ID: Hi. I just noticed that the command compile(file, 'test', 'exec') can fail if 'file' contains '^M^J' at the end of each line. Specifically, if file is WDhandler.py, in the webdebug package (http://www.cyberclip.com/webdebug/webdebug-1.15.tar.gz), then I get the error compile(file, 'test', 'exec') Traceback (innermost last): File "", line 1, in ? File "", line 29 """ ^ SyntaxError: invalid syntax ... and sys.exc_info()[1].offset == 1043. Is there any way that I can get compile to work properly in this case? Neither python nor emacs seem to have a problem with '^M^J' line-endings otherwise, but I use the compile(file, 'test', 'exec') command in a script called by emacs to systematically test my scripts for syntax errors before I save them. It just occurred to me to strip out the ^M's in the script that does the syntax checking. I guess that'll do, but I'd still be interested in whether there's a nicer way. Alex. From m.faassen at vet.uu.nl Sun Apr 9 19:39:03 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 9 Apr 2000 23:39:03 GMT Subject: A Mountain of Perl Books + Python Advocacy References: <000f01bf9eca$2eec8c60$3e2d153f@tim> <38ECF4E6.B85C62D5@sightreader.com> Message-ID: <8cr4an$j40$2@newshost.accu.uu.nl> Ken Seehof wrote: > Indeed. I've noticed that while just about everyone who I've known who > has tried python ends up liking it alot, there aren't many fanatics. I define > a fanatic as someone who is absolutely certain that their language is by far > the best language for every possible application, and that other languages > don't even deserve to exist. Python programmers tend to acknowledge > the positive qualities of other languages. WRONGO! ALL UTHER LANGUZEZ SUCKZ!! PHYTHON IS THE BESTEST!!!!!1 FOR EVERYTHING AND I HATEZ M$ TUU!! NOBUDDY ECSPEXTS THE SPANNISH ENQIUSITOAN HAHAHAHH! PHYTHON JOKE SPAM SPAM! <.75 WINK WINK NUDGE>!!!!!!!1 :) Anyway, yeah, that's what I noticed in this newsgroup. Whenever someone asks if Python is a good language Tim Peters tells them to check out Haskell, or someone mentions Smalltalk or Scheme or Lisp or whatnot. It's rare that people are being sent to C or C++ (unless it's for Python extensions) or Perl though (but it does always get the 'good for fast text processing' mention). It's nice to see so many comparisons between languages here. > Perhaps this is partly because python borrows all the best stuff from many > other languages rather than being built around some wild, revolutionary idea. Well, but Perl isn't based on a wild, revolutionary idea either. It seems to have borrowed from other languages far more, or at least it didn't cover it up so nicely. Python is good in the way that it borrows stuff in a fairly orthogonal way, so that it's easy to reason about its syntax and semantics. Then again, I don't know if there are that many raging Perl advocates. AN-EVERYBODY-SHUD-SING-OF-LIKE-THIS-LLY YR'S!!!! Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From infonuovo at email.com Tue Apr 4 08:49:32 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Tue, 4 Apr 2000 05:49:32 -0700 Subject: Why should I switch to Python? - Infinity of Primes In-Reply-To: Message-ID: The standard approach is a proof by contradiction starting from the assumption that there is a largest prime. It's usually one of the earliest proofs in books on Number Theory. Euclid provided a proof and a version is given in section 4.2 of "Concrete Mathematics: A Foundation for Computer Science" by Ronald L. Graham, Donald E. Knuth, and Oren Patashnik. Addison-Wesley (Reading, MA: 1989). ISBN 0-201-14236-8. It goes something like this (matching the one that was already posted for you): 1. Assume P is the largest prime. 2. Let Q be the product of all of the primes up to P: 2*3*5* ... *P 3. The number Q+1 is not divisible by any of the primes that divide Q (they each leave a remainder of 1). Therefore Q+1 is a prime or there is some other prime, larger than P (i.e., not among 2, 3, 5, ..., P), that divides Q+1. So P is not the largest prime. QED. This all stands on the fundamental theorem of arithmetic: that every integer number is a product of primes in exactly one way. That is, there is no other factorization of Q into primes than the one shown in its definition, and Q+1 must have a factorization into primes, even if only Q+1 itself and 1. That is Exercise 1.2.4-21 in "The Art of Computer Programming, v.1: Fundamental Algorithms," ed.3 by Donald E. Knuth. Addison-Wesley (Reading, MA: 1997). ISBN 0-201-89683-4. Perhaps an interesting, indirect quality of Python is that it is supported in a community of interest where one can discuss topics like the one you just raised. -- Dennis -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Jim Richardson Sent: Monday, April 03, 2000 23:15 To: python-list at python.org Subject: Re: Why should I switch to Python? On 02 Apr 2000 08:16:57 -0400, Fran?ois Pinard, in the persona of , brought forth the following words...: >"Tim Peters" writes: > >> When in doubt, there's no substitute for exhaustive enumeration. > >Hmph! Hope you do not doubt there is an infinite number of primes! :-) Out of curiousity, how does one (mathematically) prove that? (if this turns out to be one of those 12' blackboards full of greek letters and funny squiggles, Ok, I cry uncle...) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. -- http://www.python.org/mailman/listinfo/python-list From dgoodger at bigfoot.com Sun Apr 23 00:28:45 2000 From: dgoodger at bigfoot.com (David Goodger) Date: Sun, 23 Apr 2000 00:28:45 -0400 Subject: code not true? References: Message-ID: on 2000-04-23 00:14, Michal Wallace (sabren) (sabren at manifestation.com) wrote: >> Floating point number on a binary computer are strange. They're not that >> accurate. 0.07 * 100 != 7.0. > > Why is this the case? I mean.. I understand why decimals are hard to > show in binary... But why can't we use variably long strings, or > something? Is it just a speed issue? Try writing 1/3 in decimal. How many digits do you need to represent it *exactly*? Same issue for 0.07 in binary floating point. -- David Goodger dgoodger at bigfoot.com Open-source projects: - The Go Tools Project: http://gotools.sourceforge.net (more to come!) From none at none.ca Wed Apr 26 21:57:15 2000 From: none at none.ca (k) Date: Wed, 26 Apr 2000 22:57:15 -0300 Subject: condense whitespace to single space? Message-ID: <36NN4.31937$Xk2.119087@tor-nn1.netcom.ca> How do I condense the sections of spaces in this string: "abc def ghi" into single spaces? "abc def ghi" kh From ivanlan at callware.com Wed Apr 19 14:11:22 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 19 Apr 2000 12:11:22 -0600 Subject: Pythonware Website???? Gone on vacation with Starship? ;-)) References: <20000419154202.B480@owl.rhein-zeitung.de> <3d4s8yotiy.fsf@amarok.cnri.reston.va.us> Message-ID: <38FDF6CA.C9A7AF28@callware.com> Hi All-- "Andrew M. Kuchling" wrote: > > "Fredrik Lundh" writes: > > www.pythonware.com is down > > the reason appears to be hardware problems on > > the ISP site. ... > > First Zope.org (down because an Ethernet cable got pulled out), then > Starship (disk crash), now pythonware.com. Has someone released evil > whitespace-eating nanobots that also attack computer hardware? > This version eats dots ("."). It makes nameservers forget things, like my domain, pauahtun.org;-( -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From gmcm at hypernet.com Thu Apr 27 09:23:51 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 27 Apr 2000 09:23:51 -0400 Subject: Best database to use with Python In-Reply-To: <8e93j5$qba$2@news.tht.net> Message-ID: <1255280638-66426487@hypernet.com> D'Arcy J.M. Cain wrote: > Kevin McDermott > wrote: > Depends on what you want to use it for...if it's to > connect CGI programs > to, then I'd recommend MySQL. > > Please don't take this as argumentative but I am curious why you > think that being used with CGI programs per se makes one database > better than the other. It seems to me that there are a lot more > issues to consider such as what kind of data, what kind of data > relationships, how the data needs to be accessed, etc. I use > PostgreSQL for all my database work, CGI accessed or not, except > for where the data sets are simple enough to use shelve. Sometime ago linuxplanet did a comparison (sorry I can't check the link - my ISP is hosed right now): http://www.linuxplanet.com/linuxplanet/tutorials/1224/1/ As I recall, Postgres was the most complete DB; MySQL the least complete. MySQL was very fast at some operations (probably related to lack of transaction support), but the most startlingly fast one was bulk load, which does you no good in a CGI situation. Again, from memory, MySQL was fast at very simple queries, but had a very limited SQL dialect and fell apart with fancier queries. - Gordon From moshez at math.huji.ac.il Wed Apr 19 00:27:34 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 19 Apr 2000 07:27:34 +0300 (IDT) Subject: dir(..) vs. PyList_GetItem In-Reply-To: <213CDEBFDDA7D3118081009027E40C56071155@SHEF-MS1> Message-ID: On Tue, 18 Apr 2000, Mark Pope wrote: > pModule = PyModule_New( "myScript" ); ^^^^^^^^^^^^ That function does not import a module, it creates a new empty module. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From rupole at compaq.net Wed Apr 19 23:43:51 2000 From: rupole at compaq.net (Roger Upole) Date: Thu, 20 Apr 2000 03:43:51 GMT Subject: Where do I send a contribution for the Starship recovery ? Message-ID: I personally would consider it money well spent. (unlike most of the other things I spend money on) Roger Upole From akuchlin at mems-exchange.org Wed Apr 26 17:10:21 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 26 Apr 2000 17:10:21 -0400 Subject: ungreedy regular expressions References: Message-ID: <3d3do8efgi.fsf@amarok.cnri.reston.va.us> Michael Hudson writes: > ckotso at cs.ntua.gr (Constantinos A. Kotsokalis) writes: > > I recently added two lines of code to the python distribution, in order > > to support ungreedy regular expressions (which are supported by pcre > > Aren't the *?,+? patterns "ungreedy"? Yes, but the PCRE_UNGREEDY flag turns the syntax around, so * is ungreedy and *? is greedy. It's useful for applications where a naive user might be entering regexes, since naive expectations usually don't match the default greedy behaviour. Unfortunately, the PCRE module is probably not going to be used in Python 1.6, so applying the patch isn't likely to be very useful. I'll think about it a bit. -- A.M. Kuchling http://starship.python.net/crew/amk/ When one has stopped loving somebody, one feels that he has become someone else, even though he is still the same person. -- Sei Shonagon, _The Pillow Book_ From tim_one at email.msn.com Wed Apr 5 02:42:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 5 Apr 2000 02:42:59 -0400 Subject: A Mountain of Perl Books + Python Advocacy In-Reply-To: <20000405053920.20579.qmail@web2102.mail.yahoo.com> Message-ID: <000f01bf9eca$2eec8c60$3e2d153f@tim> [lewst] > ... > What is it about Perl that makes it so much more popular and have such > a huge grassroots swell? 1. It was in the right place at the right time twice (first as an eagerly embraced alternative to mounds of half-assed incompatible Unix tools pushed beyond their limits; and second, where it got its major growth, from legions of new CGI programmers (or "script kiddies", as they're derisively called over on c.l.p.m.)). 2. Larry and Perl's early adopters are unarguably better salespeople than Guido and Python's early adopters. > ... > Perl is very publicized and well-known while the better language is > sitting here a dark corner unnoticed. I don't grant that Python is unnoticed; to the contrary, its growth curve is still exponential. To the extent that it is true, though, the same has been true of the Lisp family for decades -- this isn't a new phenomenon in computer languages. But unlike Lisp, Python hasn't splintered, so its chances are still good. Four years ago I wondered whether it would survive, but no longer -- it's reached critical mass since then. > Sure there will always be some religious fanatics that won't even give > Python a try, but I think Python's popularity could be vastly improved > with some serious advocacy work. CNRI and/or PSA should seriously > look into funding a Python "marketing" campaign of sorts. I think the > result would be allot of converts and more understanding and respect > for Python. Python *is* astonishing for the tiny number of evangelists it's attracted! We sucked in Eric Raymond, for but for some reason he doesn't seem to consider promoting Python to be his Primary Mission from God -- the best hope for a PSA marketing campaign may be to hire a deprogrammer to straighten out Tom Christiansen's brain while there's still something left . not-mentioning-that-perl-is-a-better-language-for-some-tasks-and- that-tells-you-how-effective-an-advocate-i-am-ly y'rs - tim From richard_chamberlain at ntlworld.com Wed Apr 26 18:09:50 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Wed, 26 Apr 2000 23:09:50 +0100 Subject: Saving pieces of the registry References: <2B1262E83448D211AE4B00A0C9D61B03011152B9@MSGEURO1> Message-ID: Hi Pieter There are several things in the win32api which may do what you want: win32api.RegSaveKey and win32api.RegRestoreKey Richard Pieter Claerhout wrote in message news:2B1262E83448D211AE4B00A0C9D61B03011152B9 at MSGEURO1... > Hi, > > does anyone know is there is a command in Python to save a part from the registry > to a .reg file, like you can do with regedit.exe? I would like for example like to save > all keys under HKEY_LOCAL_MACHINE\Software to a file. Anyone know if this is > possible or not? > > Kind regards, > > > Pieter > > From tim_one at email.msn.com Tue Apr 4 00:28:48 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 4 Apr 2000 00:28:48 -0400 Subject: [Python-Dev] New Features in Python 1.6 In-Reply-To: <20000403165621.A9955@cnri.reston.va.us> Message-ID: <000001bf9dee$45f318c0$162d153f@tim> [Greg Ward, fesses up] > Hasn't anyone noticed that the largest amount of text in the joke > feature list was devoted to the Distutils? I thought *that* would > give it away "fer shure". You people are *so* gullible! ;-) Me too! My first suspect was me, but for the life of me, me couldn't remember writing that. You were only second on me list (it had to be one of us, as nobody else could have described legitimate Python features as if they had been implemented in Perl <0.9 wink>). > And for my next trick... *poof*! Nice try. You're not only not invisible, I've posted your credit card info to a hacker list. crushing-guido's-enemies-cuz-he's-too-much-of-a-wuss-ly y'rs - tim From moshez at math.huji.ac.il Wed Apr 26 12:49:14 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 26 Apr 2000 19:49:14 +0300 (IDT) Subject: Metaclasses? In-Reply-To: Message-ID: On 26 Apr 2000, Michael Hudson wrote: I'm shocked! I can see Python in tears! Ouch! who-said-you-can't-obfuscate-python-ly y'rs, Z. -- Moshe Zadka . http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com From owen at astroNOJNK.washington.edu.invalid Fri Apr 21 19:00:28 2000 From: owen at astroNOJNK.washington.edu.invalid (Russell E. Owen) Date: Fri, 21 Apr 2000 16:00:28 -0700 Subject: Tkinter -- does Canvas.find_closest work? Message-ID: <8dqmib$1ar0$1@nntp6.u.washington.edu> I am using Mac Python 1.5.2c1 (current) with Tkinter (based on Tk 8.0). I have a canvas called "cnv" with the following objects on it: - 10 stars: tiny filled ovals tagged 'star' - 9 grid markings: large unfilled ovals that are not tagged at all I am trying to use the canvas method "find_closest" to find the closest star, ignoring the grid markings. Supposedly all I have to do is specify the start keyword with the value of a tag and it will find the closest object with that tag. Here's a code snippen and some of the output: ----- code snippet ----- nearestStar = self.cnv.find_closest (x=event.x, y=event.y, halo=0, start='star') print "found star ", nearestStar[0] objList = self.cnv.find_withtag('star') print "star list = ", objList ----- portion of resulting output ------ found star 23 star list = (23, 24, 25, 26, 27, 28, 29, 30, 31, 32) found star 20 star list = (23, 24, 25, 26, 27, 28, 29, 30, 31, 32) find_withtag is acting as if I never specified the tag at all. By moving the mouse pointer around I can get find_withtag to find objects 14 - 32. 23-32 are clearly the stars. 14-22 are presumably the grid circles. The output above shows it finding one star and one grid circle. I also tried supplying a numeric values (object IDs) to the "start" keyword. In this mode find_closest is supposed to find objects with IDs smaller than the value of "start". However, again it doesn't seem to have any effect. find_closest still will find any object on the canvas as I move the mouse pointer around. Can anybody see an obvious mistake? Has anybody gotten the start keyword to work in Canvas method "find_closest"? -- Russell From gmcm at hypernet.com Thu Apr 20 07:51:21 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 20 Apr 2000 07:51:21 -0400 Subject: __del__ problem - would adopting Garbage Collection fix this? In-Reply-To: <000701bfaa9b$e729eac0$d62d153f@tim> References: Message-ID: <1255891014-29713226@hypernet.com> I think Neil has the correct approach: gc.garbage is a development aid. If anything shows up in there, fix the classes. Silently ignoring __del__ methods is a great way to leak resources, which is worse than leaking memory. [Tim] > even-five-year-olds-understand-they're-supposed-to-clean-up-their- > own-mess-ly y'rs - tim -five-year-old-bots-maybe-ly y'rs - Gordon From g_will at cyberus.ca Tue Apr 4 08:50:34 2000 From: g_will at cyberus.ca (Gordon Williams) Date: Tue, 04 Apr 2000 12:50:34 GMT Subject: What happened to Python.announce? Message-ID: <01bf9e34$08050d20$4842c3d1@Cyberus> Hello all, Is it just my service provider, or is python.announce really dead? Regards, Gordon Williams From emile at fenx.com Thu Apr 13 09:54:05 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 13 Apr 2000 06:54:05 -0700 Subject: Authenticate with smtp References: <018701bfa53b$f831f3e0$858647c1@DEVELOPMENT> Message-ID: <006101bfa54f$bc6ca760$01ffffc0@worldnet.att.net> Ulf, Are you trying to use that second mail server as a relay host? What error are you getting? What happens when you try using the relay addressing structure? (<@host:user at host>) Here I get 'unable to relay' errors when I try to bounce off the NT, but not when I bounce off the linux system. As far as I can tell from the RFC, authentication on the receiver-SMTP process appears to be limited to ensuring delivery to the recipient. Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Ulf Engstr?m To: Sent: Thursday, April 13, 2000 4:32 AM Subject: Authenticate with smtp > How can I log into an smtp server that requires authentication and send a > mail with smtplib, or is there any other package that helps? (Yes, I'm > authorized) > Regards > Ulf > From effbot at telia.com Mon Apr 10 11:51:16 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 10 Apr 2000 15:51:16 GMT Subject: check EOF References: <8cs6g4$rje$1@porthos.nl.uu.net> Message-ID: Soundwave wrote: > how can I check EOF in python ??? read/readline returns an empty string when you reach the end of the file. for more info, read the fine manual: http://www.python.org/doc/current/lib/typesother.html => file objects From bill at libc.org Thu Apr 27 20:20:35 2000 From: bill at libc.org (Bill Anderson) Date: Thu, 27 Apr 2000 18:20:35 -0600 Subject: The Simple Economics of Open Source References: Message-ID: <3908D953.29F8078@libc.org> Raffael Cavallaro wrote: > > In article , Justin Sheehy > wrote: > > >You mean like BSD/OS, from BSDI? > > > >It happened 9 years ago, and they've been selling it ever since. > > Yeah, and BSDI is just tearing up the software world. BSDI sells > *support* not software, because the software they sell is essentially > interchangable with the free BSD variants. BSDI have *themselves* > recognized this fact by merging with Walnut Creek. In future, they'll be > merging the code of FreeBSD and BSD/OS. > > In other words, the history of BSDI is a perfect example why you can't > succeed at a closed source business when your product is a software > commodity. BSDI tried, and have, essentially, failed. In a market where Surely you don't expect us to believe that the fact that the product was a 'commodity' (for some definition of commodity) was the cause of their 'failure'. Of course, that also presumes that the merger is indiciative of a failure. Something else not shown. I would expect that you would understand that correlation is not causality, and that merger is not failure. -- In flying I have learned that carelessness and overconfidence are usually far more dangerous than deliberately accepted risks. -- Wilbur Wright in a letter to his father, September 1900 From tjg at avalongroup.net Tue Apr 4 20:25:01 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Tue, 04 Apr 2000 17:25:01 -0700 Subject: Two questions References: <38EA5FE8.853E9B75@callware.com> <38EA6508.90BF630C@roguewave.com> <38EA6E87.40EDB542@callware.com> <38EA6422.61054B11@exceptionalminds.com> <38EA7C18.8F3150D1@roguewave.com> Message-ID: <38EA87DD.3F24BEBF@exceptionalminds.com> Bjorn Pettersen wrote: > In the control panel there should be a Odbc 32 control (should be > installed with ms access). It has a simple point-and-click interface > where you have to choose the ms access driver, give the filename for the > database, and choose a DSN (Data Source Name?). The DSN is what you use > to connect with. OK, So I've created a system level DSN named TestDB and pointed it at an MDB file my server. When I do the following in the interactive window... import ODBC.Windows db = ODBC.Windows.Connect('TestDB') ...I get the following error... NotSupportedError: ('IM001', 0, '[Microsoft][ODBC Driver Manager] Driver does not support this function', 4226) What am I doing wrong? -- Stand Fast, tjg. Timothy Grant tjg at exceptionalminds.com Chief Technology Officer www.exceptionalminds.com Red Hat Certified Engineer (503) 246-3630 Avalon Technology Group, Inc. fax (503) 246-3124 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From sabren at manifestation.com Tue Apr 11 13:46:02 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Tue, 11 Apr 2000 13:46:02 -0400 (EDT) Subject: simple httplib and urllib timeout question In-Reply-To: Message-ID: On Tue, 11 Apr 2000 darrell at rubina.funkomite.com wrote: > Just a quick question, im writing a small webbot for a python > learning experience and it comes across some sites that will make it > hang for a while, if the site is down or extremely slow etc, is > there a way to set a faster timeout for httplib . Or is there a > better way to handle it ? Yes. The better way is to use asyncore whenever httplib/urllib uses a normal socket. Unfortunately, this requires breaking urllib into smaller pieces, and nobody seems to have done it yet. I'm actually working on the exact same problem (and posting regular updates at http://www.linkwatcher.com/ ) I sent an email to Jeremy Hylton, who's working on urllib2. He's swamped, but willing to accept a patch that would add this feature to urllib2.. I think I'll wind up taking a crack at it tonight. There's also a partial solution using a different method if you look at... http://www.linkwatcher.com/src/blogbot/timeout.py there's an example script called blogbot.py there, too.. it uses timeout.py and another hack with signal.alarm(), but neither really works all that well.. hope that helps. meanwhile... HEY OLEG! -> have you done anything w/ this? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From spenrose at my-deja.com Thu Apr 20 14:26:24 2000 From: spenrose at my-deja.com (spenrose at my-deja.com) Date: Thu, 20 Apr 2000 18:26:24 GMT Subject: PyApache memory leak? References: <8dimg4$kii$1@nnrp1.deja.com> Message-ID: <8dni3s$1o1$1@nnrp1.deja.com> [[I tried sending the following to PyApache's author; the email bounced with "too many hops." I tried subscribing to py-apache-devel, which has not seen a post in four months, and never got a reply. I post here in the hopes that someone will get it in the right hands.]] We just went live with a large, Python-driven web site (RedHat 6.1, Apache 1.3.9 Red-Hat-Secure/3.1 mod_ssl/2.4.10 OpenSSL/0.9.4). We don't have our log analysis software up and running yet, but we are getting thousands of cgi page views a day (maybe low tens of thousands, not hundreds of thousands). Each page view in turn involves a suite of Python modules, both standard and written by us. All of ours are plain Python (no C or Java). We rolled in PyApache; the guy who did it is gone but the tar ball is labelled 4.19 so I assume that's the version. Our beta testing was very light; orders of magnitude lighter than the hits the site has gotten since going live. About two days and six hours after going live, the server froze. Behavior was consistent with memory filling up--it was fine, then suddenly it was slow, then within seconds you couldn't even ping it. We restarted the machine, apologized to our clients, and tried to figure out what was happening. There was some garbage written to one of the Apache custom logs (we're running three virtual domains that share a suite of Python cgis), but we couldn't tell what the problem was. A little more than two days later, it crashed again with the same behavior: everything fine--hey, my term window is sluggish--frozen. Still no clue. Two days and roughly six hours after that, it froze a third time. Then we started looking more carefully at the logs. They read: [many normal requests] Normal request @@@@line of garbage@@@@ Normal request Normal request Normal request Normal request [blank line] [restart] Our theory is this: since only Apache writes to the Apache log, one Apache process was generating garbage seconds before the crash. A few other processes had time to make an entry, then the machine froze. Ergo, it was probably the garbage-writing process that took the machine out. Apache 1.3.9 is used by millions of computers and RedHat Secure server is used by tens of thousands (?), so it probably wasn't a bug in them. The only other thing we've done to the standard distribution is add PyApache. We commented out PyApache in httpd.conf. Two days and six hours later...the server did not freeze. We've been up for 11 days and counting and that was the only change we made. I freely acknowledge that this is not definitive proof of a showstopper in PyApache, but I am not up to reading thousands of lines of C to pursue other theories. I apologize for not giving more details, but we didn't know what else to look at and as this is a production server I can't exactly turn PyApache back on so I can gather better bug tracking info. I can be reached at sam at ddmweb dot com if anyone has questions. Cheers, Sam Sent via Deja.com http://www.deja.com/ Before you buy. From montague at maravu.cs.dartmouth.edu Mon Apr 10 11:32:13 2000 From: montague at maravu.cs.dartmouth.edu (Mark H.H. Montague) Date: 10 Apr 2000 15:32:13 GMT Subject: comparing strings and ints Message-ID: <8css5t$tti$1@merrimack.Dartmouth.EDU> Does anyone know why it is not a type error to compare a string and an int with '>' ? For example, I just spent over an hour debugging code that essentially did this: >>> 45 > '0' 0 Of course, the '0' was a variable read in from a file, which I forgot to convert to a string. Bad old perl habits. But I'm having a hard time imagining a situation where someone would be intentionally and meaningfully comparing a string and an int. Any ideas? -mm From effbot at telia.com Tue Apr 4 13:40:54 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 04 Apr 2000 17:40:54 GMT Subject: New Features in Python 1.6 References: <200004011740.MAA04675@eric.cnri.reston.va.us> <_pyF4.25562$E85.640966@news1.rdc1.md.home.com> Message-ID: Fran?ois Pinard wrote: > Beware. It might be patented already... Let's see. Does it work this way? > > * If the file is empty, you're done. > * If the file holds a single bit, you're done. > * Split the whole file into pairs of sequences, the first part of the pair > being an eager, but possibly empty sequence of consecutive zero-bits, > the second part being an eager, but possibly empty sequence of consecutive > one-bits. Notice that there is only one way to do this split. > * Replace each sequence above by the count of bits it contains, expressed > directly as a binary number for the first count of the pair, and as the > one-complements of the binary number for the second count of the pair. > Notice that given these counts, it is trivial to rebuild the contents > of the previous step. > * Iterate. why not just use two different compression algorithms repeatedly, until you've squeezed the file down to a suitable size? it takes a little work, but you can design them so that one of them can always strip away at least one bit from the input stream. by reversing this process in the right order, you can easily reconstruct the original data stream. a much faster version, known as "blom compression" after it's inventor, uses 256 algorithms... From rcc at nospamthanks_jennic.com Thu Apr 13 11:36:03 2000 From: rcc at nospamthanks_jennic.com (Robert Cragie) Date: Thu, 13 Apr 2000 15:36:03 GMT Subject: List mapping? Message-ID: > Try this: > mylist = ['/a','1','/b','2','/c','3'] > map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0, > len(mylist), 2)) Sorry, forgot to assign... mylist = ['/a','1','/b','2','/c','3'] tuplist = map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0, len(mylist), 2)) Robert Cragie From thomas at xs4all.net Sat Apr 15 13:37:34 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sat, 15 Apr 2000 19:37:34 +0200 Subject: BSDi and PIL In-Reply-To: ; from dreid@jetnet.co.uk on Sat, Apr 15, 2000 at 04:22:48PM +0000 References: Message-ID: <20000415193734.D15664@xs4all.nl> On Sat, Apr 15, 2000 at 04:22:48PM +0000, David Reid wrote: > Has anyone had any joy in getting Python 1.5.2 and PIL 1.0 to build together > on BSDi 4.0.1? Is your problem python or PIL ? Compiling stock 1.5.2 on BSDI 4.x can be a challenge: If you enable shared libraries (which is a good thing) you have to convince configure that you are running on an ELF system (BSDI 4.x is ELF, 3.x and lower isn't) or change the resulting Makefiles to reflect this. You know when you hit this problem when you get errors about undefined symbols in shared modules, and those undefined symbols are python-internal symbols. (Like PyErr* or PyNone) If you enable threads, you're in for more treats: threading on BSDI 4.x is screwed in many subtle ways, resulting in for instance a pause() call that never bothers to return, even if you do get a signal. The linkflags problem is relatively easy to fix: After configure, edit the toplevel Makefile, and Modules/Makefile.pre (not the Makefile itself, for it will be overwritten after you change Modules/Setup) Look for this block: # Symbols used for using shared libraries SO= .so LDSHARED= ld CCSHARED= LINKFORSHARED= DESTSHARED= $(BINLIBDEST)/lib-dynload And change the middle three entries so it reads like this: # Symbols used for using shared libraries SO= .so LDSHARED= gcc -shared CCSHARED= -fpic LINKFORSHARED= -Xlinker -export-dynamic DESTSHARED= $(BINLIBDEST)/lib-dynload (If you ever lose this mail and forget what it was, steal those flags from any system using ELF, like linux ;) This problem has been fixed, by the way, in the CVS tree, so 1.6 wont require this patching. The threading business is harder... The bugs are subtle, but unfortunately not restricted to python code that uses threads: when you enable threads, pause() will always hang your process indefinately. (I started python under gdb once, to see what was happening... In thread-enabled code, the libc pause() is a special with-threads version, and on receiving the signal, there is some internal rumbling underneath pause(), but it never delivers the signal to the calling function.) So, my advice would be 'do not enable threads'. If you *have* to have threads, or you would really like to have them, upgrade to BSDI 4.1, which does handle threads OK (at least, the test that i threw at it.) Besides, most BSDI patches are freely available, last time I looked, and fairly easy to install. As for PIL, well, I haven't bothered with installing it on our BSDI servers, just on my linux workstations, but if you're still having trouble, I could give it a go. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From drew.mcdowell at msfc.nasa.gov Fri Apr 7 10:52:46 2000 From: drew.mcdowell at msfc.nasa.gov (Andrew McDowell) Date: 7 Apr 2000 14:52:46 GMT Subject: Was Re: need wrapper for ssh/scp References: <8civ14$rm7$1@hammer.msfc.nasa.gov> <20000407130942.E13830@xs4all.nl> Message-ID: <8cksnu$in2$1@hammer.msfc.nasa.gov> Thomas Wouters wrote > Help is easiest if you also explain what the problem is ;) I'm trying to implement a script where I can enter my passphrase once, and fire up identical processes on multiple hosts. It's not quite as easy as I thought... Oh, and I'm not allowed to use ssh-agent either. :( > I already see one > problem though: you read the password with 'string.strip(raw_input())', > which means the terminating newline gets stripped off the password, but you > dont supply it with os.write(), *doh* how'd that get in there? Ok, I added the newline and sshd is showing that the script is logging in...but no commands are being executed. Any further advice? >which means ssh thinks there is more > password to come, and patiently sits waiting for it, untill you brutally > kill it ;) Hehe..I was getting a bit flustrated :) > In your real app you probably want to use select(), by the way, before > attempting to read something. Doing a read() when there's no data to be read > makes a blocking read, which can lead to deadlocks. See telnetlib for some > examples on how to use it. Thanks for the pointer...I'll look into it! From algaba at my-deja.com Fri Apr 14 12:24:32 2000 From: algaba at my-deja.com (Manuel Gutierrez Algaba) Date: Fri, 14 Apr 2000 16:24:32 GMT Subject: Crosswords for Linux Backtracking recursive crossword generator References: <8d59hk$6to$1@nnrp1.deja.com> Message-ID: <8d7gnd$l4a$1@nnrp1.deja.com> In article , Michael Hudson wrote: > Manuel Gutierrez Algaba writes: > > > Comments/improvements are welcome! > > I'm just looking at it, but in playing around I got this output: > > - - - - - - - - - - - - - - - > - - - - - - - - - - c - - c - > - - - - - - - - - s o l f a - > - - - - - - - - - - n - - r - > - - - - - - - - - - f - - a - > - - - - - - - - - - u - - n - > - - - - - - - - - - s - - t - > - - - z a l a m e r i a - o - > - - - - - - - - - - o - m ? - > - - - - c o h e r e n c i a - > - - - - a - l - - - - - m - - > - - - - p - i n s u l t o - - > - - - m a n o - - - - - - - - > - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - > > That's not right is it? The `m' and `?' being next to each other. It's not a "bug". It's that way, of course, the algorithm may be modified for avoiding such things, but then it's much slower. -- ------------- Manolo Sent via Deja.com http://www.deja.com/ Before you buy. From breiter at usf.Uni-Osnabrueck.DE Fri Apr 7 07:19:55 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 7 Apr 2000 11:19:55 GMT Subject: Teaching the art of programming, in python References: <20000405053920.20579.qmail@web2102.mail.yahoo.com> <8cfe42$o02$1@nnrp1.deja.com> <38EB68A3.B1B5809F@callware.com> <8cfqa7$4ml$3@newsserver.rrzn.uni-hannover.de> <38EB73B6.6C0913A7@callware.com> <8chsij$k5r$1@newsserver.rrzn.uni-hannover.de> Message-ID: <8ckg8r$a7j$1@newsserver.rrzn.uni-hannover.de> In article , r2d2 at shaka.acc.umu.se (Niklas Frykholm) writes: >>>> And all in 24 hours? >>>> This is as misleading as the dummy attribute. >> >>> I don't think so. You can go at your own speed. The book is broken up >>> into 24 chapters, each taking more or less than an hour to read. >> >>Well I guess that a good speed would be 14 days, then. :) >>With two hour lections plus time to exercise. > > As an interesting side note, a publisher here in Sweden has > recently started a 10-minute series, with titles such as > "Teach your self Internet in 10 minutes". Seems there is > inflation (or perhaps deflation) in these things. Just discovered that Peter Novig wrote some nice chapters about it http://www.norvig.com/21-days.html Excerpt: | Why is everyone in such a rush? | | Walk into any bookstore, and you'll see how to Teach Yourself Java | in 7 Days alongside endless variations offering to teach Visual | Basic, Windows, the Internet, and so on in a few days or hours. | I did a search [..] | The conclusion is that either people are in a big rush to learn | about computers, or that computers are somehow fabulously easier to | learn than anything else. There are no books on how to learn | Beethoven, or Quantum Physics, or even Dog Grooming in a few days or | hours. > And it _is_ a silly practice. But then again, corporate > silliness doesn't surprise me that much anymore. :) Bernhard -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) From pecora at anvil.nrl.navy.mil Sun Apr 9 08:38:55 2000 From: pecora at anvil.nrl.navy.mil (Louis M. Pecora) Date: Sun, 09 Apr 2000 12:38:55 GMT Subject: I need MacPython screenshots! References: <20000408162815.50658.qmail@hotmail.com> Message-ID: <090420000838551912%pecora@anvil.nrl.navy.mil> In article <20000408162815.50658.qmail at hotmail.com>, Matheus Rodrigues wrote: > Hello everybody > > I need some screenshots of a Macintosh running > MacPython. If possible I would like to receive one > screenshot of the MacPython Installation too. The > faster you can provide some material to me the more I > thank you. > > Please send the files (zipped) to my email as we dont > want to create huge traffic in the list. It's not > necessary to crop the images. > > btw, where is the Macintosh discussion list ? Check on the python web site: http://www.python.org Here are some archives: http://www.python.org/pipermail/pythonmac-sig/ Post a message by emailing: pythonmac-sig at python.org People are very quick to answer and very helpful. I speak from experience. From deepak_marda at my-deja.com Wed Apr 26 16:27:26 2000 From: deepak_marda at my-deja.com (deepak_marda at my-deja.com) Date: Wed, 26 Apr 2000 20:27:26 GMT Subject: Need help with COMObject for Zope Message-ID: <8e7jeo$s8c$1@nnrp1.deja.com> Hi, I am trying to use the COMObject for Zope. I have the latest versions of Python and Zope and from what I see working, COMObject is installed in the right place. I created a COMObject with id = word and Dispatch = "Word.Application". WHen I try to connect this COM object, it raises the following exception Error Type: com_error Error Value: (-2147221008, 'CoInitialize has not been called.', None, None) Can you please help me how I can make it work? I have Word (from Office 2000) installed and the following works from a vanilla python code: - >>>import win32com.client >>>o = win32com.client.Dispatch ('Word.Application') >>>o.Visible = 1 >>> ... and so on Please help, Deepak Sent via Deja.com http://www.deja.com/ Before you buy. From corg at copernic.com Tue Apr 18 08:45:40 2000 From: corg at copernic.com (Gaetan Corneau) Date: Tue, 18 Apr 2000 08:45:40 -0400 Subject: Microsoft ActiveX Scripting Message-ID: > [Actually, Ive never personally used the scripting control, > but I believe it works!] It does. Last time I have used it, it worked very well. I only had a couple of little problems, but maybe they were caused by my application. ______________________________________________________ Gaetan Corneau Software Developer Copernic.com http://www.copernic.com E-mail: corg at copernic.com ______________________________________________________ "Tu l'as trop ?cras?, C?sar, ce Port Salut" > From tismer at tismer.com Mon Apr 17 10:31:31 2000 From: tismer at tismer.com (Christian Tismer) Date: Mon, 17 Apr 2000 16:31:31 +0200 Subject: [ANNOUNCE] Garbage collection for Python References: <20000407221750.A29279@acs.ucalgary.ca> <38F9F01B.57273052@tismer.com> <38FA05FA.B0526CAB@tismer.com> Message-ID: <38FB2043.76F75B98@tismer.com> Michael Hudson wrote: > > Christian Tismer writes: > > > > I cam across a great quote the other day; I think it was attributed to > > > Alan Perlis, and it was: > > > > > > Simplicity follows complexity, not the other way round. > > > > Thank you a lot, it was exactly the quote I was trying > > to look up, but I didn't find it again. It is very true. > > Actually from > > http://www.cs.yale.edu/~perlis-alan/quotes.html > > we find: > > 31. Simplicity does not precede complexity, but follows it. > > so I got the wording slightly wrong. The intent's clear though. > > now-wait-while-I-add-most-of-those-to-my-sig-file-ly y'rs > Michael Thanks a lot, this is a goldmine! A-programming-language-is-low-level-when-its-programs- require-attention-to-the-irrelevant-ly y'rs - chris -- Christian Tismer :^) Applied Biometrics GmbH : 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 aa8vb at yahoo.com Thu Apr 20 08:05:34 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Thu, 20 Apr 2000 08:05:34 -0400 Subject: print a pixel In-Reply-To: <8dmcvb$r6n$1@wanadoo.fr> References: <8dmcvb$r6n$1@wanadoo.fr> Message-ID: <20000420080534.A623423@vislab.epa.gov> BLAISE BONNEVILLE: |I am a beginner in Python and I would like to know how to print a pixel in |Python with Windows 98, given its coordinates. I think you'll need to give more details. For example "print a pixel". Pixel in particular: a pixel in an image file? or off of the frame buffer? if the former, what type of image file? where does this pixel come from? And "print": print it how? as R,G,B coordinatees? Or do you mean print it on a hardcopy printer? More details. -- Randall Hopper aa8vb at yahoo.com From ns56645 at swt.edu Sun Apr 23 00:40:10 2000 From: ns56645 at swt.edu (ns56645) Date: Sat, 22 Apr 2000 23:40:10 -0500 Subject: Combobox in Tkinter References: <38F8F133.54FCC64B@swt.edu> <8db0b1$b3o$1@nnrp1.deja.com> <20000421005845.36765@nms.otc.telstra.com.au> Message-ID: <39027EAA.E19AABE9@swt.edu> Yep, This worked fine for me. Thanks Shah, -------------- next part -------------- An HTML attachment was scrubbed... URL: From amitp at Xenon.Stanford.EDU Sat Apr 8 21:07:47 2000 From: amitp at Xenon.Stanford.EDU (Amit Patel) Date: 9 Apr 2000 01:07:47 GMT Subject: Python on Google? References: <8F0ED22EBjoshtinamecom@209.208.0.7> Message-ID: <8col53$m3o$1@nntp.Stanford.EDU> Josh Tompkins wrote: | Buenos Dias, everyone. | | This is perhaps an off-topic question, but having just found google, I'm | curious... | | Does anyone know to what extent Python is used on www.google.com? I | noticed on thier "job offerings" (or whatever) page that they list python | experience as "a plus". | Python has been used at Google since the very beginning, and it continues to be used, although some of the more performance critical stuff is in C++. New code _is_ being written in Python (in fact, I do all my work in Python) and it's being used exclusively to deal with some large sets of data. Email me if you want more details. - Amit, Google, Inc. From smalleys at gte.net Sun Apr 30 17:48:36 2000 From: smalleys at gte.net (sue) Date: Sun, 30 Apr 2000 21:48:36 GMT Subject: problem building Python in MachTen Unix References: <01HW.B531E90F0013E3A1037B464C@news.pond.com> Message-ID: <390CAA4D.6C554E23@gte.net> I suspect you are not seeing all of the message from the configure dyld step. Does ../Include/mach-o/dyld.h or ../mach-o/dyld.h exist? If not, the include path is wrong. I have found it's futile to argue with configure. Edit the makefile directly and save a copy elsewhere. Get the binary built, and then backtrack. You may need to check config.h. Sue. From claird at starbase.neosoft.com Thu Apr 20 15:37:37 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 20 Apr 2000 14:37:37 -0500 Subject: Good style for multi-valued returns Message-ID: <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7@lp.airnews.net> Examples of multi-valued returns: (head, tail); (quotient, remainder); (left, right); (prologue, body, epilogue); (data, code); (CAR, CDR); (count, size); (handle, status); (decomposition; remainder); ... Let me guess: folks generally pass tuples for small and determinate-in-number multi-values, and dictionaries other- wise, 'cept some do it all with tuples. Accurate? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From richard_chamberlain at ntlworld.com Tue Apr 18 15:47:15 2000 From: richard_chamberlain at ntlworld.com (Richard Chamberlain) Date: Tue, 18 Apr 2000 20:47:15 +0100 Subject: Using python on the web References: <8di2bk$l1s$1@newshost.accu.uu.nl> Message-ID: <_W2L4.986$GK5.20898@news2-win.server.ntlworld.com> I'm curious why you would be put off using cgi? having used python and cgi, plus java servlets/jsp and asp at various different times I cannot say I see your point. In many ways my preferred method would be python because I can get something working in such a short space of time, and there's no significant speed difference between, for instance, java and python. cgi has to be about the most common way of construction on the fly web pages, and I don't think it's going away just yet. Richard Charley Horse wrote in message news:MPG.136631472f892a119896ac at news... > Thanks to all of those pointers. Finding out that CGI plays an important > role in the python world was a shock to me as I only started working > with web stuff in the last couple of years. I've just never touched a > CGI script, shockingly I suppose . ASP/CF and PHP are what I've > worked with and CGI was just the "old world" technology for > interactivity that I read about but never had to work with. > > So coming at this as a newbie, and for years hearing about python's > elegance and oo-ness, it just seemed a strange pairing, python and CGI. > Puzzling in fact! I see why it makes sense, but it's just not what I > expected. > > I'll fool with CGi and perhaps it won't be enough of a turn off to > affect my interest. > > In article <8di2bk$l1s$1 at newshost.accu.uu.nl>, m.faassen at vet.uu.nl > says... > > Charley Horse wrote: > > > I've just started fooling with python. I've looked around the python > > > site and a number of the other sites referenced there and am a bit > > > puzzled. Umm... how does one go about using python for web applications, > > > especially database driven apps? Almost everything deals with python > > > just as a language, as C++ would be. > > > > That's because Python is a language. Python isn't a web-specific language, > > after all. > > > > > Not much about the web specifically. > > > I was a bit shocked to find the only direct refs on about > > > this at python.org are entwined with CGI (unless I missed it). > > > > Why is CGI so shocking? It's used quite a bit, after all? You can write > > a database driven web application using Python with CGI. CGI from Python > > isn't hard either. > > > > > I have no exposure to CGI, but rather to php, CF, and ASP, so python has > > > gone from looking very attractive to looking... well, like a puzzle. > > > > I'm not sure why your exposure to PHP, ColdFusion or ASP instead of CGI > > would turn Python into a puzzle. > > > > There _is_ ASP support for Python, enabling you to use Python as a > > ASP language. Others will have to explain to you how and where to look > > for information, as I've never used it. > > > > > I know about Zope, but am interested in how one uses python on the web just > > > by itself. > > > > Zope would be the equivalent of ColdFusion for Python, as it's a web > > application server. > > > > Besides using Python with CGI or ASP, you can use Zope's ZPublisher > > (formerly Bobo) independently to publish arbitrary Python objects to the > > web. I've never used this, and the documentation may be scarce, but it > > looks quite neat. You may want to look that up. > > > > Database integration in Python isn't bad either, look at the database > > topic guide: > > > > http://www.python.org/topics/database/ > > > > And look at the web topic guide if you haven't seen it: > > > > http://www.python.org/topics/web/ > > > > The vaults of Parnassus are also a good resource, here is for > > instance a link to its web category: From shayman at uniserve.com Tue Apr 11 00:25:26 2000 From: shayman at uniserve.com (Matthew) Date: Mon, 10 Apr 2000 21:25:26 -0700 Subject: Filter Message-ID: <955427129.619305@neptune.uniserve.ca> I need to write a filter that inserts tabs between Log values . So that lines 1 to 3 come out looking something like lines 4 to 6. I can then open it in Excel as a dat file with the values in different cells, where i can then use formulas and macros. The first 9 lines are constants in the header ,but there could be serveral headers with data in the whole file . I'm totaly at square one here. I have to figure out how to open the file for modification - as a string ? write a for loop for each line beginning with L11 ? And a function to insert the white space's between the values. I imagine this to be an ideal task for a small script , but untill i get there any advice or help appreciated. VER1.5A "H0:1,45" "H1:9085,*.* " "H2:71G,NORTHVIEW DLS, ,MITSUI" "H3:VANCOUVER,CHILLIWACK" "H4:00100S,100,SB4,01, , , " "H5:000330, AH00-93-,SPRUCE, ,N" "H6:45,126825" H7:220000 L11SSSP 503438G 1627 # 1 L11SSSP 563338G 1826 L11SSSP 573036G 1924 L11 SS SP 55 36 40 G 18 28 # 4 L11 SS SP 51 40 46 G 17 31 L11 SS SP 57 30 37 H 19 24 etcXXXXXXXXXXXXXXXXXXXXXXX "H9:1,45" From gresham at mediavisual.com Wed Apr 12 06:18:24 2000 From: gresham at mediavisual.com (Paul Gresham) Date: Wed, 12 Apr 2000 18:18:24 +0800 Subject: Classes, Inheritance - Stupid lazy question References: <8d1cfh$hme7@imsp212.netvigator.com> <874s9766r6.fsf@ifm.uni-kiel.de> Message-ID: <8d1ihl$q244@imsp212.netvigator.com> "Michael Hudson" wrote in message news:m3itxnis32.fsf at atrus.jesus.cam.ac.uk... > Janko Hauser writes: > > > I think this will do it > > > > class lazy: > > def __init__(self, name): > > self.name = name > > > > def fired(self): > > print 'You are fired %s' % self.name > > > > class paul(lazy): > > def __init__(self, name): > > self.name = name # <---- ????? > > self.april_pay = 0 > > > > def fired(self): > > print "Here's a box, collect the things from your desk" > > self.__class__.__bases__[0].fired(self) > > Nononono; think about what happens if you do this: > > class bob(paul): > pass > > bob("adam").fired() > > What *I* think you want is: > > class paul(lazy): > def __init__(self, name): > lazy.__init__(self,name) > self.april_pay = 0 > > def fired(self): > print "Here's a box, collect the things from your desk" > lazy.fired(self) > > After all, if you're going to inherit from a class, you must have > access to it, right? > > another option is: > > class paul(lazy): > super = lazy > def __init__(self, name): > self.super.__init__(self,name) > self.april_pay = 0 > > def fired(self): > print "Here's a box, collect the things from your desk" > self.super.fired(self) > I like this solution a lot, it makes a lot of sense. Thanks Michael. I guess somewhere in Python is a defined route back to the super class, on a better day I may just dig through the code. Thanks again > > Though this has problems with repeated & multiple inheritance. > > Cheers, > M. > > -- > "declare"? my bogometer indicates that you're really programming > in some other language and trying to force Common Lisp into your > mindset. this won't work. -- Erik Naggum, comp.lang.lisp From godzilla at netmeg.net Sat Apr 22 09:54:20 2000 From: godzilla at netmeg.net (Les Schaffer) Date: Sat, 22 Apr 2000 13:54:20 GMT Subject: using PyArg_ParseTuple with a list References: <3900B1B0.1CFD748A@sec.noaa.gov> Message-ID: > I wish to pass a Python list [] to a C extension module, but I am > unsure of the proper format to specify in PyArg_ParseTuple here is a bit of code i wrote to pass a list of strings in to a C extension: ... char * tok; /* delimiter tokens for strtok */ int cols; /* number of cols to parse, from the left */ int numLines; /* how many lines we passed for parsing */ char * line; /* pointer to the line as a string */ char * token; /* token parsed by strtok */ PyObject * listObj; /* the list of strings */ PyObject * strObj; /* one string in the list */ /* the O! parses for a Python object (listObj) checked to be of type PyList_Type */ if (! PyArg_ParseTuple( args, "O!is", &PyList_Type, &listObj, &cols, &tok )) return NULL; /* get the number of lines passed to us */ numLines = PyList_Size(listObj); /* should raise an error here. */ if (numLines < 0) return NULL; /* Not a list */ ... /* iterate over items of the list, grabbing strings, and parsing for numbers */ for (i=0; i Message-ID: Paul Madsen wrote: > Downloaded Python-1.5.2. > > I've run 'configure' and it seems to have worked. Now, according to the > Python package's README, I should be able to type 'make' for the rest of > the install. If I don't have a 'make' file, did the configure portion > not work? did you try typing "make" ? ("make" is a unix command that should be available on any decent unix machine. afaik, it doesn't work on win95, but neither do configure, so I suppose you're not posting from the machine you're building on ;-) (and yes, the configure command should create a file called "Makefile", which tells "make" how to build python for you). From herzog at online.de Sat Apr 1 17:25:43 2000 From: herzog at online.de (Bernhard Herzog) Date: 02 Apr 2000 00:25:43 +0200 Subject: Function override? References: <000101bf9b9b$312f8fe0$2f2d153f@tim> <38E64275.CF8F97DC@math.okstate.edu> Message-ID: "David C. Ullrich" writes: > Or I could if I hadn't just read the bit about how in 1.6 strings > have a split method, and if s1 and s2 are strings then > > s1.split(s2) > > either splits s1 using s2 as the delimiter or the other way around, > depending on which occurs more frequently in the other. I mean > surely it will happen that we want to split a bunch of strings > using 'delimiter' as a delimiter, and then it just happens that > the routine that does that gets passed 'lim' as an argument and > does the opposite of what we want? Oh, that's easy to work around. I'm sure we'll all get used to the following new idiom: (text + delim).split(delim)[:-1] Surely, this is not harder to learn than: while 1: line = file.readline() if not line: break # do something or while 1: # loop body if some_condition: break -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From chris.lada at westgroup.com Tue Apr 11 10:24:08 2000 From: chris.lada at westgroup.com (Chris Lada) Date: Tue, 11 Apr 2000 10:24:08 -0400 Subject: Processing BCD and Signed Integer Fields with Python Message-ID: <38f334ea@wwwproxy3.westgroup.com> We have been receiving record/field-based information from a data provider. Some of the fields are BCD (Binary Coded Decimal), and some are signed integer. The data originates from a mainframe/Cobol(?) system. The record layouts have definitions like "PIC S99999" (signed integer), and "PIC S99999 Comp-3" (BCD). Has anyone had to process this sort of data with Python ? Can Python handle this sort of data type ? Anyone have suggestions on how to approach this problem ? Thanks, Chris From scherbi at bam.com Mon Apr 3 07:46:04 2000 From: scherbi at bam.com (Bill Scherer) Date: Mon, 03 Apr 2000 07:46:04 -0400 Subject: Methods for password storage References: <38E87E13.A10A1168@arches.uga.edu> Message-ID: <38E8847C.50A33083@bam.com> Brad - Don't store the password. Use crypt (unix only) or maybe MD5, and store the encrypted password. This way no one can view the user's real pasword. When authenticating the user, you must encrypt the password provided (in the same manner, obviously), and compare it to the stored version. If they match, the user knows the password. crypt and md5 are one way ciphers, that is there is no way, other than brute force, to get the original text out of the ciphertext. The crypt algorithm is what many unix systems use to encrypt users passwords. The encrypted password can be viewed by most users in the file /etc/password. You may choose to make your store of encrypted passwords unaccesible to the average user. That would make brute force attackes more difficult ;-). If I've gotten any of this wrong, someone will point that out soon, but this is basically the method I'm using. -Bill Scherer Brad Chapman wrote: > Hello! > I'm working on a program which stores passwords (for database > access) that a user enters in a GUI. The program is targetted for unix > machines. I'm not very experienced with security issues like this and am > trying to store them in as secure a manner as possible. > Does anyone have any advice/examples for how to securely store > sensitive information like this using python? Are there other security > issues I should worry about when dealing with passwords? Thank in > advance much for any advice! > > Brad > > -- > http://www.python.org/mailman/listinfo/python-list -- William K. Scherer Sr. Member of Applications Staff Bell Atlantic Mobile http://ampeg.corp.bam.com From herzog at online.de Tue Apr 25 13:29:42 2000 From: herzog at online.de (Bernhard Herzog) Date: 25 Apr 2000 19:29:42 +0200 Subject: Simple list.append() question References: <39046FA2.603EAFE5@roguewave.com> <8e4akc$p7o$1@newshost.accu.uu.nl> Message-ID: m.faassen at vet.uu.nl (Martijn Faassen) writes: > Generally it's a good idea to avoid * on sequences, unless that sequence is > immutable and contains immutable things; i.e. strings. It seems to me that the important criterion is whether the elements are immutable. The mutability of the sequence itself doesn't really matter here. > Is there any useful way to use * on lists that I missed? Something like [None] * 1000 is very useful IMO. > Usually we want the copy semantics here, not the reference semantics. If the elements are mutable. But then the question is how deeply do you copy them? > Perhaps it's a good idea to completely forbid * on lists in p3k? > Tuples too for all I care. Then again I may be missing important uses, > so enlighten me. AFAICT, I use * with lists most often to create a new list of n identical immutable elements, most often None or '' or somesuch and I find that really useful. What seems to cause the most problems is that newbies try to use it to create empty multi-dimensional arrays and that fails. I think they try it because they see it more as a declaration similar to C's 'int[10][20]' than an expression. It would be a good idea IMO to find a good syntax for this case and ISTM that list comprehensions might be useful here: multi_list = [[] for i in range(10)] or whatever the precise syntax was. Hmm, the unused variable in there is a bit ugly though. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From embed at geocities.com Wed Apr 5 11:56:51 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 5 Apr 2000 10:56:51 -0500 Subject: time-module questions Message-ID: I have a few questions on python time code (import time). First, it appears that time.localtime returns fractions of a second in it's values, but that time.mktime does not add this millisecond component back in, nor does it appear to be part of the time-tuple returned by time.localtime, and time.gmtime: for i in range(0,10): x = time.time() tup=time.localtime(x) x2 = time.mktime(tup) print x2,' ',x time.sleep(0.1) 954949853.0 954949853.238 954949853.0 954949853.379 954949853.0 954949853.509 954949853.0 954949853.639 954949853.0 954949853.769 954949853.0 954949853.899 954949854.0 954949854.03 954949854.0 954949854.16 954949854.0 954949854.29 954949854.0 954949854.42 Secondly, mktime accepts localtimes only, how to I take y/m/d/h/m/s in GMT instead of the current timezone, and convert back to a time.time() type value (float). What to do? Is Python 1.6 any more 'robust' in it's handling of times/dates? Warren From thomas at xs4all.net Wed Apr 19 04:27:00 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Wed, 19 Apr 2000 10:27:00 +0200 Subject: module __call__ In-Reply-To: <286L4.1328$B43.118787@news.pacbell.net>; from dirck@pacbell.net on Tue, Apr 18, 2000 at 04:23:43PM -0700 References: <7N4L4.497$wYl.191816704@newsb.telia.net> <286L4.1328$B43.118787@news.pacbell.net> Message-ID: <20000419102700.M15664@xs4all.nl> On Tue, Apr 18, 2000 at 04:23:43PM -0700, Dirck Blaskey wrote: > Fredrik Lundh wrote in message > news:7N4L4.497$wYl.191816704 at newsb.telia.net... > > Dirck Blaskey wrote: > > > ...Gee-Wouldn't-It-Be-Nice-If... > > > > > > modules could def __call__(): > > > > > > so you could call a module, i.e. > > > > > > import StringIO > > > f = StringIO() > > > > and > > > > class myStringIO(StringIO): > > ... > > > > would explode in your face. lousy idea. > > Hmm... > > class myStringIO(StringIO): > > already doesn't work; > you have to > > class myStringIO(StringIO.StringIO): > > as currently implemented. Yes, but 'f = StringIO()' doesn't work either, in that case. Fredrik's point, though a bit blunt, is that it would be confusing and thus unwise to functionally separate f = StringIO() and class myStringIO(StringIO) If you really dislike typing StringIO twice, do what (nearly) everyone else does: from StringIO import StringIO And if you dont subclass StringIO (haven't seen that happen a lot) you can even go nifty and do: try: from cStringIO import StringIO except ImportError: from StringIO import StringIO giving you the power of cStringIO when it's available. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From neelk at brick.cswv.com Wed Apr 5 19:01:12 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 5 Apr 2000 23:01:12 GMT Subject: Tuples -- who needs 'em References: <00e101bf9d80$a8384d20$74eb0b18@stcla1.sfba.home.com> <037f01bf9e55$6d328760$74eb0b18@stcla1.sfba.home.com> <38EAC102.7D5DF504@cosc.canterbury.ac.nz> Message-ID: Greg Ewing wrote: > > In Haskell, a statically-typed language which also has > both tuples and lists, the two types play distinctly > different roles, and both are needed. A tuple is a > fixed-size structure whose elements may be of different > types, whereas a list is a variable-size structure whose > elements must be of the *same* type. > > This is the way I tend to use them in Python as well -- > lists for homogeneous collections, tuples for "records". Heh. I don't mind having lists and tuples; it's classes and tuples that are the "same thing", in that both of these are record types. I think the only reason to get rid of tuples would be if be nicer to have a simple destructuring/pattern-matching syntax for classes and instances than currently. It's hard to overstate how convenient being able to do pattern matching on tuples is -- it's one of the things that makes Python so expressive. > If static typing is introduced into Python, a more rigid > distinction may have to be made, in which case we may be > glad that we already have the two kinds of structure. Indeed. And then I think people would complain about having tuples and classes. :) Neel From thomas at cintra.no Thu Apr 27 16:14:18 2000 From: thomas at cintra.no (thomas at cintra.no) Date: Thu, 27 Apr 2000 20:14:18 GMT Subject: Example search-engine/indexer Message-ID: <39089992.10423684@news.c2i.net> Hello, I was wondering if anybody has an example on how to index lots of files or/and documents for fast searching. I`m doing sort of a Yahoo/Altavista-thing and need an example that`s fast and doesn`t rely on an external database-system. Berkley DB is ok, and all stuff that comes with a standard Python distro. For now I got a function that extracts words from files/folders and words from documents. For now I`ve done something like this : 1. recursive process all files and folders in a given folder and its subfolders. Documents found will be opened and words extracted. Words ends up in a dictionary, the word acting as key, pointing to a list of ids, ex. (1, 23), where 1 is the folder id and 23 is the file-id. Words are handled seperatly but in a similar manner. 2. What I end up with are a dictionary like this : >>print words['python'] >>[ (1,23), (21.45), (432, 21) ] >>print words['linux'] >>[ (12,32), (30.90), (4, 42) ] Using shelve and db_hash to store the keys and lists of ids works fine for small amounts of data, but when the list of ids, actually tuples like ( 32, 43 ), get huge, into several thousands, the thing takes up lots of space and gets slower. Has anybody done anything similar? Dr. Dobbs Journal #295, Jan 1999 has an example using Perl. Could anybody translate the article, the code is short and sweet, like most Perl-code, but not that easy to understand, like most Perl-code. Any hints on how to do something like this, a different method or whatever would be appreciated, example code most of all. Tudelidu!! Thanks, Thomas