From grant at nowhere. Fri Feb 18 11:17:42 2000 From: grant at nowhere. (Grant Edwards) Date: Fri, 18 Feb 2000 16:17:42 GMT Subject: Python self-executable? References: <88jilo$un0$1@nnrp1.deja.com> Message-ID: In article <88jilo$un0$1 at nnrp1.deja.com>, dplynch at my-deja.com wrote: >I >am building a GUI program that I would like to >make self-executable (i.e. not run through a >python interpreter). Can this be done? Technically, no: you have to use the byte-code interpreter to run programs. Non-technically, yes: you can make your program into a single .exe file. You can bundle up the interpreter with your program and associated libraries/modules into a single .exe file. You can then distribute this file, and the user doesn't know that he's actually running the python interpreter. -- Grant Edwards grante Yow! Did I say I was a at sardine? Or a bus??? visi.com From tim_one at email.msn.com Sun Feb 27 05:06:04 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 05:06:04 -0500 Subject: Blowfish in Python? In-Reply-To: Message-ID: <000a01bf810a$422a7cc0$172d153f@tim> [Markus Stenberg] > ... > speed was horrendous. > > I think the main reason was the fact that I had to use _long ints_ for > calculations, as the normal ints are signed, and apparently the bitwise > operators do not work as advertised when bit32 is set (=number is > negative). Or that's my theory anyway - my implementation worked with > long's and did not work with ints. Try to whittle this down. Negative ints are nothing special to the bitwise ops, so if they "don't work as advertised" it would be a (very surprising!) bug in the implementation. For example, here's the implementation of int &: static PyObject * int_and(v, w) PyIntObject *v; PyIntObject *w; { register long a, b; a = v->ob_ival; b = w->ob_ival; return PyInt_FromLong(a & b); They're all like that -- they can't screw up unless C screws up. > ... > C implementations [of Blowfish] routinely go to megabytes/second level; And are routinely highly optimized too. Once you get "&" to work , one machine instruction in C is going to turn into a couple of function calls in Python. > my Python-with-longs implementation was kilobytes/second, to be precise, > 2-10k/s depending on the machine. Using ints will get you the biggest bang for the buck at this point, but it's never going to be *fast* in pure Python 1.5.2. not-implying-it-will-be-faster-in-later-versions-either-ly y'rs - tim From brian.pedersen at mail.danbbs.dk Wed Feb 2 03:54:10 2000 From: brian.pedersen at mail.danbbs.dk (Brian Dam Pedersen) Date: Wed, 2 Feb 2000 09:54:10 +0100 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> Message-ID: <%wYl4.369$%35.3920043048@news.euroconnect.net> Jason Stokes wrote in message news:04Sl4.16542$3b6.68582 at ozemail.com.au... > Well, my adventures with the Python language are moving along. One thing > that worries me is the lack of garbage collection in Python; the application > I'm thinking of using Python for demands many data structures that use > circular references, but Python only implements a reference counting scheme > in the way of memory management. How do I use such data structures in > Python? > You can use circular references just as in any other language, you just has to do some manual cleanup on your lists. See the following a=[] b=[] a.append(b) b.append(a) Now the lists are circular referenced, and dereferencing them will not garbage- collect them. To break up the chain just do a[0]=None or del(a[0]) which will allow the garbage collection to work. -- Brian Dam Pedersen Software Engineer From tbryan at python.net Sun Feb 13 11:12:14 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sun, 13 Feb 2000 11:12:14 -0500 Subject: Py-Mode on GNU Emacs? References: <38A68FEC.3AC0AF86@earthlink.net> Message-ID: <38A6D7DE.2699FDDC@python.net> J Donald wrote: > > Has anyone successfully gotten py-mode to work in GNU Emacs? If so, can > you share the recipe? > > It appears to be written for X-Emacs and I get error messages when I try > to use it with the GNU version > (running on Red Hat Linux 6.0). > > Thanks, > > -jd I have no problems in Emacs 20.3.1 (on Red Hat Linux 6.0). Python mode is on my system (version 3.28): $ locate python-mode.el /usr/share/emacs/site-lisp/python-mode.el /usr/share/emacs/site-lisp/python-mode.elc Here are the relevant lines from my .emacs file. ;;; For Python mode (setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist)) (setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist)) (autoload 'python-mode "python-mode" "Python hacking mode." t) (defun my-python-mode-hook () ;; make sure that emacs uses only spaces for indentation (setq-default indent-tabs-mode nil) ) (add-hook 'python-mode-hook 'my-python-mode-hook) (global-font-lock-mode t) (setq font-lock-maximum-decoration t) From evan at 4-am.com Sun Feb 6 21:38:55 2000 From: evan at 4-am.com (Evan Simpson) Date: Sun, 6 Feb 2000 20:38:55 -0600 Subject: Worldpilot References: <389DAD6F.100404A4@fourthought.com> <66qn4.20006$3b6.85615@ozemail.com.au> Message-ID: Jason Stokes wrote in message news:66qn4.20006$3b6.85615 at ozemail.com.au... > > Where can I find Wordpilot? Is it a commercial application? http://www.worldpilot.org is where you can find this fine open-source Zope application. Cheers, Evan @ digicool From jbauer at rubic.com Mon Feb 28 16:16:05 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Mon, 28 Feb 2000 15:16:05 -0600 Subject: HTML template for database report References: <38BAE18C.82AA6543@gtri.gatech.edu> Message-ID: <38BAE595.9D70DF91@rubic.com> Andrew Henshaw wrote: > Has anyone developed a system for generating a > database report (I'm thinking of an MS Access-type > report) using a template made from an HTML file. > If not it would seem like a nice Python project for me. Zope provides a document template class in its distribution, which can be used independently of the Zope product. I use it occasionally to create static HTML reports. http://www.zope.org Jeff Bauer Rubicon Research From dworkin at ccs.neu.edu Thu Feb 10 15:46:13 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 15:46:13 -0500 Subject: perl chomp equivalent in python? In-Reply-To: Gerrit Holl's message of "Thu, 10 Feb 2000 21:21:21 +0100" References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> <20000210212121.B8912@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > > >>> for line in lines: > > print line[:-1] > > Incorrect :( > > >>> import os > >>> lines = open("path-to-file", 'r').readlines() > >>> for line in lines: > ... print line[:len(os.linesep)] Also incorrect. Change 'len(os.linesep)' to '-len(os.linesep)' and it will do what I think you meant. Even with that correction, this solution will also not work in the case where the last line does not have a trailing newline. To see what I mean, try that solution on a file created like this: >>> open("path-to-file", 'w').write('spam%seggs' % os.linesep) You then have a file with two lines, but the second does not have a terminating newline. Stripping off the end of the line indiscriminately will destroy some of the information in that second line. The need for this is also somewhat doubtful. I have yet to see a real (not contrived) example where string.rstrip() wasn't the right choice for this sort of thing. -Justin From tiarno at unx.sas.com Thu Feb 17 14:44:57 2000 From: tiarno at unx.sas.com (Tim Arnold) Date: 17 Feb 2000 19:44:57 GMT Subject: zope search on external html tree Message-ID: <88hj3p$mru$1@license1.unx.sas.com> Hi, If there's a way to configure zope to include an external HTML tree in its 'search'able domain, I haven't found it. I am missing something or is this a pretty tricky thing to implement? tia, --Tim From tseaver at starbase.neosoft.com Tue Feb 15 17:57:22 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 15 Feb 2000 16:57:22 -0600 Subject: Modules implicitly exposing exceptions from other modules References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> Message-ID: <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> In article <20000215085250.A2423951 at vislab.epa.gov>, Randall Hopper wrote: >Fred L. Drake, Jr.: > |Jason Stokes writes: > | > I notice that the nntplib.NNTP class can throw exceptions from the > | > underlying socket module without documenting them. What's good practice > | > when your module involves exposing exceptions from an implementation module > | > that client code might not necessarily be aware of? > | > | Document them if they would not be expected by an experienced > |programmer. In general, all network access can throw socket.error, > |and that seems a reasonable expectation. > >I'd be stronger with this. That is, replace "experienced programmer" with >"any programmer". > >A user calling Module A shouldn't have to know what other modules Module A >uses to catch and handle any error exception that might be thrown. > >My perspective: > > There are program bug exceptions and error condition exceptions. > Considering the latter: > > All error exceptions potentially thrown in a method should be documented > for that method. > > Module-specific error exceptions should be transformed as they propogate up. > >The latter is so if you call Module B which calls Module A, you're only >expected to catch generic exceptions or Module B exceptions to handle any >error exceptions that may arise). > >For example, I don't think tossing broken socket Socket exceptions across >the NNTP boundary is a good idea. How does the NNTP client catch these (or >know to catch these)? A wildcard except clause, which catches bugs and >errors. While your main point is fairly strong, your example is weak. Anybody writing an NNTP client who *doesn't* expect to handle socket errors is asking for trouble. There is nothing useful to be done about them at the "mechanism level" (in nntplib); they need to be dealt with at the "policy level" (the client). Any munging of the exception in nntllib is going to be lossy, which is intolerable for many applications. Leaving the handling of such errors to the client also simplifies the mechanism library (nntplib), making it less likely to be buggy. This simplfi- cation is one of the chief benefits of exceptions over return codes: intermediate layers, which have no reasonable means to handle an error, simply ignore it. Ignorance-is-bliss'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From pinard at iro.umontreal.ca Tue Feb 22 10:12:36 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 10:12:36 -0500 Subject: functional programming In-Reply-To: Moshe Zadka's message of "Tue, 22 Feb 2000 16:02:15 +0200 (IST)" References: Message-ID: Moshe Zadka ?crit: > > using Python.My guess is that I would have no problem naming my lambda's > > (using `def'), and approximating lexical closures (using `class'). > > > > Maybe we should not get distracted that much by syntactical sugar! :-) > You can't do serious functional programming without tail recursion. I could iterate explicitly and easily, which is not a bad thing anyway. Tail recursion is good for many things, it can be used to hint optimising compilers, yet past a certain point, we start loosing legibility. For me, functional programming is a way of writing algorithms in which you have an important stress on functions as primary objects, dynamically building functions from more elementary ones, inter-relating functions, and often using them to represent partial solutions. It is not defined as abusing of function calls, or avoiding assignment or iteration. I may be all wrong, but I think functional programming is more an approach to solving problems, than a code writing style. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tomh at po.crl.go.jp Mon Feb 28 05:46:14 2000 From: tomh at po.crl.go.jp (Tom Holroyd) Date: Mon, 28 Feb 2000 19:46:14 +0900 Subject: array constructor In-Reply-To: <0Tou4.831$y3.189558784@newsb.telia.net> References: <0Tou4.831$y3.189558784@newsb.telia.net> Message-ID: On Mon, 28 Feb 2000, Fredrik Lundh wrote: > Tom Holroyd wrote: > > m = [[0]*4]*4 doesn't work: > > http://www.python.org/doc/FAQ.html#4.50 Yea, and I read that once, too. That's how I knew why it didn't work. I just wondered if there was some other idiom than the one I mentioned, which is the *same one* that's in the FAQ... Eh; >>> from Numeric import * >>> m = zeros((4, 4), PyObject) I'll have my cake and eat it too, thanks. Dr. Tom From tomh at po.crl.go.jp Sun Feb 27 20:55:19 2000 From: tomh at po.crl.go.jp (Tom Holroyd) Date: Mon, 28 Feb 2000 10:55:19 +0900 Subject: array constructor Message-ID: Monday hits -- more -- I want a 4x4 array of zeros. I can do from Numeric import * m = zeros((4,4), Float) but I'd like to do it with ordinary lists. m = [[0]*4]*4 doesn't work: >>> m = [[0]*4]*4 >>> m[2][2] = 5 >>> m [[0, 0, 5, 0], [0, 0, 5, 0], [0, 0, 5, 0], [0, 0, 5, 0]] because * doesn't make copies. Do I have to do >>> m = [[0]*4] >>> for x in range(3): ... m.append([0]*4) ... >>> m[2][2] = 5 >>> m [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 5, 0], [0, 0, 0, 0]] While I'm here, string.atof() and float() both barf on "123.45," while the C atof() doesn't. A quick check of the code (stropmodule.c) shows that there is an explicit check for junk at the end of the string. Is there some reason for this besides just being annoying? :-) I vote to remove it. Dr. Tom Holroyd "I am, as I said, inspired by the biological phenomena in which chemical forces are used in repetitious fashion to produce all kinds of weird effects (one of which is the author)." -- Richard Feynman, _There's Plenty of Room at the Bottom_ From tim_one at email.msn.com Fri Feb 4 02:12:09 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 4 Feb 2000 02:12:09 -0500 Subject: Haskell or Python! In-Reply-To: <20000204133958.A1245@buzzword.cc.monash.edu.au> Message-ID: <000f01bf6edf$26ad09a0$a2a0143f@tim> [Paul Prescod] >> The coolest thing about functional programming languages is the >> totally inscrutable terminology. Monads, gonads and lambda -- oh my! [Andrew J Bromage] > As opposed to perfectly clear terminology like "xrange", "DEDENT" > and "pickle", you mean? :-) Paul *likes* functional languages, btw -- don't get him wrong here. >> (one of these things is not like the others, one of these things just >> does not belong, if you....) > Wait... don't tell me... I know! "Lambda" is supported in Python and > the others aren't, right? What do I win? Paul's gonads . The one that actually doesn't belong is "monads", because it's the only one of the three unlikely ever to be heard in a Monty Python skit. that-lambda-isn't-dead-it's-simply-...-resting-ly y'rs - tim From tim_one at email.msn.com Sun Feb 27 04:20:36 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 04:20:36 -0500 Subject: map, filter, lambda, list comprehensions (was RE: parameter undefined in procedure) In-Reply-To: Message-ID: <000701bf8103$e87c2bc0$172d153f@tim> [Don Tuttle] > Are there any plans to upgrade lambda, map, reduce and filter to become > "major conveniences"? P3K may introduce lexical closures (addressing one common gripe about lambda) -- or may throw away lambda entirely. Nobody knows yet. As for the rest, from Guido in a recent Types-SIG msg: I'm not a functional programmer, and Python is not a functional programming language; and as far as I'm concerned it never will be one. Of course, that's open to a wide variety of conflicting interpretations . > Or are there already better ways to accomplish the same things? "better" is impossible to address without a metric. Python classes and modules are very flexible. Things done with closures in other languages were intended to be done with explicit instance state in Python. reduce is almost always better (clearer & faster) done with an explicit loop. map and filter are often better done with an explicit loop. map and filter are most useful when you can pass a builtin function (e.g., str), or None (a very special case for each -- see the docs). > 1) I couldn't find any 50,000 ft overview of "list comprehensions". > If one exists, would someone point me to it? Hmm! DejaNews doesn't seem able to find anything before 1999 on the subject today, but the best discussion took place in the last half of '98. I'll attach one old intro msg of mine from 6 Aug 98. It was later decided to spell ":" as "if". > 2) And without trying to re-kindle any passionate dialog, was there > ever any general consenous reached about whether "list comprehensions" > where likely to be included in Python? The biggest attraction for Guido was in allowing to replace map and filter, and many uses of lambda, with a much clearer ("more Pythonic") construct. Quoth Guido: Better yet, it fixes the problems that Python's lambda has! He means there that the proposed gimmick doesn't require lexical closures, or artificial function calls. But multi-argument uses of "map" require iterating over sequences in parallel (lockstep, not nested), and Python's "for" can't express that (directly) today. Since "for" should act much the same whether in a loop or a comprehension, it was decided that Python should first grow "parallel iteration 'for'" syntax. That was scheduled for 1.6, but looks like it's getting delayed in the crunch to get Unicode support out the door. That's as much consensus as there ever is . In the meantime, Greg Ewing released a patch that implements a large subset of the full list comprehensions proposal (which you can find in DejaNews). every-end-is-the-deep-end<0.5-wink>-ly y'rs - tim Subject: RE: Idea - alternative to lambda Date: Thu, 6 Aug 1998 02:08:20 -0400 [Greg Ewing] > It suddenly occurred to me this morning what > Python wants to replace many of the uses of > lambda in list-mapping operations: > > List comprehensions! > > def zip(L1, L2): > return [(x, y) for x in L1, y in L2] [Paul Prescod] > I don't understand the wider implications of your proposal. Can > it do more than just tupleize multiple lists? List comprehensions are a std feature of modern functional languages, to which you can look for more examples. You generally want an expression that computes each element of the final list ("(x, y)" in the above), a collection of iterators to bind names for use in the expression (the rest of the above -- although I tend to read it as the cross product of L1 and L2 rather than a lockstep parallel iteration -- the syntax needs work), and an optional filtering expression to further limit which elements get generated. Some made-up examples: [x**2 for x in range(10)] == [0, 1, 4, 9, ..., 81] [f(x) for x in L] == map(f, L) [sqrt(x) for x in range(-1,2) : x >= 0] == [0., 1.] (reading ":" as "such that") [x for x in L] == list(L) [x for x in L : predicate(x)] == filter(predicate, L) [42 for x in range(N)] = [42] * max(N, 0) [(x, y**3) for x in range(3), for y in range(3): x < y] == [(0, 1), (0, 8), (1, 8)] == [(x, y**3) for x in range(3), for y in range(x+1, 3)] M = [(len(s), s) for s in stringList] M.sort() stringList = [x[1] for x in M] sorts a list of strings by length [f(pi) for f in (sin, cos, tan)] == [sin(pi), cos(pi), tan(pi)] [f(x, y) for x in L, for y in M(x): g(x, y)] == X after <> X = [] try: for x in L: for y in M(x): if g(x, y): X.append(f(x, y)) finally: <> Note: I avoided "the usual" transformation into nested lambdas, because this much more efficient (in Python) flavor of implementation seems *possible*: given Guido's overwhelming fondness for the functional features that snuck into Python while he was snoozing , efficiency may be the only grounds on which it could be sold. ... [and other stuff] ... From tjg at avalongroup.net Tue Feb 22 16:55:48 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Tue, 22 Feb 2000 13:55:48 -0800 Subject: Formatting a numerical string w/commas References: <200002221225.HAA00397@csa.bu.edu> <200002221312.OAA04666@pandora> Message-ID: <38B305E4.E74833C2@exceptionalminds.com> I've seen some traffic on this formatting numbers, and recently had to format and deformat some number for a Tkinter app I was writing, so I wrote to fairly generic functions for doing so. This is the first time I've ever posted *real* code on the list so please be gentle, but constructive criticism, especially about style, is always welcome. ############################################################ # # Name: commanumber() # # Purpose: To format a number with commas and possibly a # dollar sign. # # Arguments: n = the number to be converted # dp = number of decimal places (defaults to 2) # ds = dollar sign (1|0) (defaults to $) # def commanumber(n, dp=2, ds=1): if not n: return '' # If None then bail out here if type(n) == type('x'): if n == '': return '' # If an empty string then bail out here. n = string.atof(n) m = '%0.*f' % (dp, n) d = string.split(m, '.') # Split at the decimal point r = list(d[0]) # It looks ugly but it really isn't. A couple of really nice Pythonisms # make it work right. The first is list insertion, and the second is integer # division. # # the insertion point is calculated based on the counter item, plus the a left # shift for each ',' already inserted the ((x/3)-1) # for x in range(3, len(r), 3): r[(x+((x/3)-1))*(-1):(x+((x/3)-1))*(-1)] = [','] if ds: s = '$' else: s = '' # Rebuild the string from the list for i in r: s = s + i if len(d) == 2: # Check to see if we have a decimal portion to add return s + '.' + d[1] else: return s ############################################################ # # Name: stripfmt() # # Purpose: Strip all formatting from a prettified number # # Arguments: n = the number to strip # def stripfmt(n): n = string.replace(n, ',', '') #remove commas n = string.replace(n, '$', '') #remove dollar signs. return n -- Stand Fast, tjg. Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From robin at jessikat.demon.co.uk Sun Feb 6 14:37:10 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sun, 6 Feb 2000 19:37:10 +0000 Subject: Excel Question References: Message-ID: In article , Bill Wilkinson writes >Hello > >I use Excel in a Python application I have written. It works wonderfully >most of the time. But from time to time my user will have two copies of >Excel open. So when I run the code: > >>>> import win32com.client >>>> e = win32com.client.Dispatch("Excel.Application") > >I never know which running version of Excel I am going to connect to. Does >anyone know of a way to assure that I am connecting to the running version >that the user is currently working with? > >fyi.. my program is called by a button on the open Excel spread sheet. > >Many thanks for any suggestions. > > Why don't you make the python a server instead of a client. Then your excel could call a small vba routine to open up a python com object. -- Robin Becker From mikael at isy.liu.se Mon Feb 28 09:22:23 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 28 Feb 2000 15:22:23 +0100 (MET) Subject: (no subject) In-Reply-To: Message-ID: On 28-Feb-00 Gregoire Welraeds wrote: > This question is related to OOP approach. > Why do I have to : > def __init__(self, name): > self.__name = name > > def getname(self): > return self.__name > and > x= MyObject.getname() > > instead of > def __init__(self, name): > name= name > and then > x= MyObject.name What's wrong with the following? def __init__(self, name): self.name = name and then: x = MyObject.name /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: 28-Feb-00 Time: 15:20:02 This message was sent by XF-Mail. ----------------------------------------------------------------------- From effbot at telia.com Fri Feb 25 03:13:13 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 25 Feb 2000 08:13:13 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: Milos Prudek wrote: > The following excerpt works. It reads lines from config file. But I > would like to ask if it is 'right' in the Pythonian way. Since I'm just > beginning in Python I do not want to twist Python into 'my' way of > thinking. > > There is no eof() function for high level readline(), so I use '' to > discover end of file. > > A=[] > Line=H.readline() > while Line<>'': > if Line<>'' and Line<>'\n': > A.append(Line) > Line=H.readline() if all you want is to load all lines from the file into a list, use: A = H.readlines() the standard pydiom for reading from a text file is this: while 1: s = fp.readline() if not s: break # do something to s (it's used everywhere, so you better get used to it! "while 1" should be read as "forever") also see the "fileinput" module. From pehr at pehr.net Wed Feb 23 00:42:34 2000 From: pehr at pehr.net (pehr anderson) Date: Wed, 23 Feb 2000 05:42:34 GMT Subject: Is there any Tkinter telnet client? References: Message-ID: <38B3B998.D0DF05E0@pehr.net> I'm assuming you want a terminal emulator, somthing that knows how to interpret and display all the ANSI/vt100 escape codes. I needed the same thing a few days ago and after a bit of flailing, relized the best terminal widget in the world was zvt widget in the Gnome/GTK libraries. I quickly re-coded my app from Tkinter to pygnome and pygtk, and much to my pleasure I got it working with a real high-quality terminal widget, allowing a genuine re-sizeable terminal emulator window with all the bells & whistles. To see my code, download morseall-0.1.1.tar.gz from http://pehr.net/morseall pygnome and pygtk: ftp://ftp.daa.com.au/pub/james/python/ Documentation: (also look in /usr/doc/pygtk-xxx/examples/) http://developer.gnome.org/doc/API/zvtterm/zvtterm.html Georges KO wrote: > > Hi folks, > > Is there any Tkinter telnet client code available? > > Thanks! > -- > Georges KO Alcatel Telecom Taiwan gko at alcatel.com.tw / gko at gko.net > Mardi 22 f?vrier 2000 From cgw at alum.mit.edu Tue Feb 1 15:22:31 2000 From: cgw at alum.mit.edu (Charles G Waldman) Date: Tue, 01 Feb 2000 14:22:31 -0600 Subject: ioctl References: <8771k4$2o1c$1@noao.edu> Message-ID: <877fa8$5m2$1@info3.fnal.gov> In article <8771k4$2o1c$1 at noao.edu>, cheselka at tucana.noao.edu (Matt Cheselka) wrote: > I'm talking to a device driver that wants the address of a pointer to an array > as it's input. In C, it looks like this: > > > char linearray[NUM], *subarr; > > > > subarr = linearry > > ioctl (fd, DO_SOMETHING, &subarr); > I would use SWIG to make a little extension module. Create the file "my_ioctl.i" with the following contents: %module my_ioctl %{ #include int do_something(int fd, char *string){ return ioctl(fd, DO_SOMETHING, &string); } %} int do_something(int fd, char *string); Then do "swig -python my_ioctl.i" Compile the resulting my_ioctl_wrap.c as a dynamic Python extension module and load it with "import my_ioctl" You should then be able to, in Python code, do my_ioctl.do_something(file_object.fileno(), "Some string"); From neelk at cswcasa.com Wed Feb 9 13:56:11 2000 From: neelk at cswcasa.com (neelk at cswcasa.com) Date: Wed, 9 Feb 2000 13:56:11 -0500 Subject: Real Problems with Python Message-ID: Python isn't perfect, and I enjoy thoughtful criticism. But I am sick to death of the -stupid- whitespace flamewar, since it's a) not a problem, and b) not thoughtful. So in effort to throttle that monster, here's a list of half-a-dozen *real* problems with Python, along with what the current workarounds are, and my subjective assessment of the prospects of them being solved in the long term. Enjoy, argue, whatever. 1. Reference counting memory management If you need to do anything with any sort of sophisticated cyclic data structures, then reference-counting is deeply annoying. This is not something that someone in a high-level language should have to worry about! In the long run, the solution is to use a conservative garbage collection algorithm (such as the Boehm collector), and to use reference counts to make sure that finalizers are called in topological order. (Cyclic references with finalizers have no good solution, period, so it's not worth worrying about them imo.) Workarounds: o Use JPython. It hijacks Java's garbage collection, so there are no problems with cyclic data structures. It doesn't ever call __del__ methods, though I don't think this is a problem in practice. o Use John Max Skaller's Viper Viper is an interpreter written in OCaml, so like JPythn it uses the host language's garbage collection. It's still an alpha, though worth looking at if only to learn OCaml. :) o Use Neil Schemenauer's gc patch. Neil Schemenauer has added support for using the Boehm garbage collector in Python. It uses reference counts in addition to the gc for handling finalization, so things like file objects get closes at the expected times, while still collecting cyclic objects. Prognosis: Excellent. It looks quite likely that Python 3K will have gc, and in the meantime Neil Schemenauer's patch is entirely usable. 2. Lack of lexical scoping Tim Peters disagrees, but I miss it a lot, even after using Python for years. It makes writing callbacks harder, especially when dealing with Tkinter and re.sub, os.path.walk, and basically every time a higher-order function is the natural solution to a problem. (Classes with __call__ methods are too cumbersome, and lambdas too weak, when you need a small function closure that's basically an if statement.) There's another, more subtle problem -- much of the work that's been done on optimizing and analyzing highly dynamic languages has been from on the Scheme/ML/Lisp world, and almost of that work assumes lexically-scoped environments. So using well-understood optimization techniques is made harder by the difference. Workarounds: o Greg Ewing has a closure patch, that makes functions and lambdas work without creating too much cyclic garbage. Prognosis: Pretty good. It looks like the consensus is gelling around adding it eventually, if only to shut up complainers like me. :) 3. Multiple inheritance is unsound By 'unsound' I mean that a method call to a method inherited by a subclass of two other classes can fail, even if that method call would work on an instance of the base class. So inheritance isn't a type-safe operation in Python. This is the result of using depth-first search for name resolution in MI. (Other languages, like Dylan, do support sound versions of MI at the price of more involved rules for name resolution.) This makes formal analysis of program properties (for example, value flow analyses for IDEs) somewhere between 'harder' to 'impossible'. Workarounds: o Don't use multiple inheritance in Python. Prognosis: I don't think there's any hope of this ever being fixed. It's just too much a part of Python, and there isn't much pressure to fix it. Just avoid using MI in most circumstances. 4. Lack of support for highly declarative styles of programming It's often Python claimed that Python reads like pseudocode, but very often when people are describing algorithms the natural description is "find the solution that satisfies the following conditions" rather than "nest for loops five deep". If you've done any Prolog (or even SQL) programming you know how powerful the constraint-solving mindset is. When a problem can be represented as a set of constraints, then writing out the solution manually feels very tedious, compared to telling the computer to solve the problem for you. :) Workarounds: o Greg Ewing has implemented list comprehensions for Python. This is a big increase in expressive power, since it starts to permit the use of a constraint solving-style. o Christian Tismer's Stackless Python patch enables the use of first-class continuations in regular Python code. This lets people easily and in pure Python create and experiment with all sorts of funky control structures, like coroutines, generators, and nondeterministic evaluation. Prognosis: Pretty good, if Stackless Python makes it in, along with list comprehensions. (Personally, I suspect that this is the single most important improvement possible to Python, since it opens up a whole new category of expressiveness to the language.) 5. The type/class dichotomy, and the lack of a metaobject system. C types and Python classes are both types, but they don't really understand each other. C types are (kind of) primitive objects, in that they can't be subclassed, and this is of course frustrating for the usual over-discussed reasons. Also, if everything is an object, then subclassing Class becomes possible, which is basically all you need for a fully functional metaobject protocol. This allows for some extremely neat things. Workarounds: o Use Jim Fulton's ExtensionClasses to write C extensions that can be subclassed in Python code. o Read GvR's paper "Metaclasses in Python 1.5" to write metaclasses using the Don Beaudry hook. It's not as nice as just subclassing Class, though. Prognosis: Good. The current workarounds are messy, but workable, and long-term there's a real determination to solve the problem once and for all. 6. The iteration protocol The iteration protocol is kind of hacky. This is partly a function of the interface, and partly due to the way the type-class dichotomy prevents arranging the collection classes into a nice hierarchy. The design of the iteration protocol also makes looping over recursive data structures (like trees) either slow, if done in the obvious way and comprehensible way, or clumsy and weird-looking, if you try to define iterator objects. An example: Try writing a linked list class that you can iterate over using a for loop. Then try to write a tree class that you can iterate over in preorder, inorder, and postorderdirection. Then make them efficient, taking no more than O(n) time and O(1) space to iterate over all elements. Then try to reuse duplicated code. Is the result beautiful? Workarounds: o Implement iterator objects and just eat the ugliness of implementation for clean interface. o Don't use trees or graphs, or at least don't expect to use them with the standard loop constructs. :) o Wait for Guido to invent a better way: Tim Peters has said on the newsgroup that GvR is working on a better design, Prognosis: Good. There aren't any good short-term fixes, but the long term outlook is probably fine. We aren't likely to ST blocks, though. Neel From sholden at bellatlantic.net Tue Feb 15 17:25:55 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 15 Feb 2000 22:25:55 GMT Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> <950526527.787246@news.adtranzsig.de> Message-ID: <38A9D225.C4FF0CCF@bellatlantic.net> Fran?ois Pinard wrote: > I was sure Tim wrote some bigger text, > and I was arguing and I hope you > agree that I should be more careful > > -- > Fran?ois Pinard http://www.iro.umontreal.ca/~pinard Well, OK, maybe I've missed out all the ellipses where I snipped bits of the original message &^). One thing I *can* be sure of: if Tim was offended, you'd be likely to hear about it! regards Steve -- "If a tree is walked when no-one is watching, has any node been visited?" From tolot at utolot.toppoint.de Thu Feb 10 19:27:44 2000 From: tolot at utolot.toppoint.de (Marc Christiansen) Date: Fri, 11 Feb 00 01:27:44 +0100 Subject: How to do this? - newbie References: <38a2e958$0$1403@news.voyager.net> Message-ID: Ronald L. wrote: > Hi, > I am new to python and am quite excited about it. I spent much of last night > writing my fist code snippet and I came across 1 thing which I could not > figure out how to do. > > Suppose > >>>> a=('x',1) > then how can I create an x of numerical type such that >>>> print x > 1 > > - just using manipulations of a = ('x',1) If I got you right, then exec is what you want: 'exec a[0]+"="+str(a[1])' (or 'exec "%s=%d"%(a[0],a[1])' ) will execute 'x=1'. Ciao Marc From tim_one at email.msn.com Tue Feb 29 00:11:20 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 29 Feb 2000 00:11:20 -0500 Subject: thread problem In-Reply-To: Message-ID: <000101bf8273$6a9590e0$732d153f@tim> [Greg Wilson] > *sigh* Thanks --- here's me thinking complicated, and it's simple. > Don't suppose there'll be a warning option in 1.6 for this kind of thing? Python is awfully smart, but I think we'll have to wait for P3K before it can successfully guess how overly complicated your thoughts are . nobody-wants-to-be-falsely-accused-of-thinking-too-simply-ly y'rs - tim From effbot at telia.com Sat Feb 5 18:14:47 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 05 Feb 2000 23:14:47 GMT Subject: Overprinting References: <%LTm4.776$gM3.27309@news.chello.be> Message-ID: Thierry Lalinne wrote: > I use an LPD daemon on my NT 4 box to receive spool jobs coming from an IBM > AS/400. I need to parse the incoming file and generate a report in RTF. > Unfortunately, the AS/400 uses overprinting on some lines, I get CR without > LF. What I would like to do is to use a little Python to get rid of the CR > and merge the lines together. > > Example: > Bla Bla Bla..........Bla Bla Bla............12345.......... > Which after processing would give me: > Bla Bla Bla...12345.....Bla Bla Bla here's one way to do it. cannot think of something more efficient right now, but I'm sure Tim or Christian will come up with something... import array, string # character that may be overwritten BLANKS = " ." def fixup(line): # merge overlapping pieces pieces = string.split(line, "\r") if not pieces: return "" a = array.array("c", pieces[0]) for s in pieces[1:]: n = len(a) if len(s) > n: a[n:] = s[n:] # tail # handle overlapping part n = min(n, len(s)) for i in range(n): if s[i] not in BLANKS: a[i] = s[i] return a.tostring() # # try it out text = "Bla Bla Bla..........Bla Bla Bla\r............12345..........\r\n" for line in string.split(text, "\n"): print repr(fixup(line)) From aahz at netcom.com Wed Feb 2 12:29:36 2000 From: aahz at netcom.com (Aahz Maruch) Date: 2 Feb 2000 17:29:36 GMT Subject: Newbie: OverflowError: integer addition - Python data types?? References: <879o21$lu2$1@nnrp1.deja.com> Message-ID: <879pi0$4ib$1@nntp2.atl.mindspring.net> In article <879o21$lu2$1 at nnrp1.deja.com>, wrote: > >I can't get a Python version of my VBScript Fibonacci series script to >work. I get an OverflowError: integer addition error at series 46. You need use long numbers, e.g. 999999999999999L -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From jbauer at rubic.com Thu Feb 3 14:20:04 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Thu, 03 Feb 2000 13:20:04 -0600 Subject: Python cookbook Message-ID: <3899D4E4.B797EB62@rubic.com> In response to several list members requesting a Python cookbook, I offer my favorite recipe. Python can be prepared in many ways (smoked, fried, broiled, etc.) with countless methods of seasoning. I prefer the simple approach. 1. Cut the meat into desired serving sizes. 2. Dip in baking soda saturated water. 3. Roll in flour. 4. Add salt and whatever seasonings you prefer. 5. Deep fry until tender throughout. Crispy and delicious. Yum! Jeff Bauer Rubicon Research From sholden at bellatlantic.net Tue Feb 15 18:03:08 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 15 Feb 2000 23:03:08 GMT Subject: OT: Celebrating Python References: <38A5AAB4.5F56B3A0@digicool.com> <884dhj$l0a$1@nntp6.atl.mindspring.net> <14504.12483.890085.354771@weyr.cnri.reston.va.us> Message-ID: <38A9DAE0.6F01262B@bellatlantic.net> "Fred L. Drake, Jr." wrote: > > Aahz Maruch writes: > > Time's fun when you're having flies. > > Reminds me of a book my in-laws gave my kids. I understand they're > nice in pies. ;) > > -Fred > > -- > Fred L. Drake, Jr. > Corporation for National Research Initiatives \ "Time flies like a banana": description or imperative? regards Steve -- "If computing ever stops being fun, I'll stop doing it" From granicz at yahoo.com Thu Feb 3 09:43:02 2000 From: granicz at yahoo.com (dzsieji) Date: Thu, 3 Feb 2000 14:43:02 -0000 Subject: delphi2python Message-ID: <3899e7a3$1_3@127.0.0.1> anyone knows about a tool that converts delphi to python? if you did, you would save a few weeks of my life...... adam. -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==---------- http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- From greg at cosc.canterbury.ac.nz Mon Feb 21 23:06:54 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 22 Feb 2000 17:06:54 +1300 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <001c01bf771d$399d72c0$3acbd9c2@peridot.optichrome.com> Message-ID: <38B20B5E.B5DF949@cosc.canterbury.ac.nz> Oh, no, nooo, nooooooo... Is there time to stop this madness? Adrian Eyre wrote: > > It doesn't feel like join is an instance method of a string. I agree wholeheartedly: "".join(x) is just awfully horribly awful! PLEASE don't implement it that way! If you want to make join() easier to get at, make it a built-in function. If you do that you'll probably want to generalise the types it works on somewhat, though. Convert them to strings, or concatenate them using whatever '+' does on that type, or something. Whatever you do, don't stuff it onto some arbitrary type just for the sake of making it a method. Not everything has to be a method... the world will not end if there are some non-method functions left in Python 1.6... -- 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 def-p at usa.net Thu Feb 24 14:25:38 2000 From: def-p at usa.net (Def P) Date: 24 Feb 00 12:25:38 MST Subject: Strings & methods Message-ID: <20000224192538.13101.qmail@nwcst316.netaddress.usa.net> OK, here's a stupid question... Why do strings have methods in 1.6? Before everybody flames me, let me explain the reasons of my confusion. My trusty old OOP textbooks say, that object orientation is about encapsulating data in objects, to access them through methods. The methods (should) ensure that the data are changed correctly. This makes sense for Python classes and mutable objects like lists and dicts. However, since strings are immutable (I'm assuming they still are in 1.6), those methods won't change the string itself at all; they will rather act like functions glued to the object. To the uninitiated, this may look like the old string functions have been changed to methods in unnatural ways, and indeed it sometimes leads to peculiar constructs like " ".join(list_of_strings). (I know this construct has been explained in the newsgroup, and while the reasons for choosing this way are understandable, intuitive it is not.) Don't get me wrong, I'm not saying string methods are a bad idea, I'm just wondering. There is probably a good reason for this, but I haven't managed to find it so far. My next question is, why have strings grown methods, but integers, floats, tuples haven't? <-- Def P --> ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 From michael at camelot-it.com Mon Feb 28 07:33:04 2000 From: michael at camelot-it.com (Michael Tiomkin) Date: Mon, 28 Feb 2000 14:33:04 +0200 Subject: array constructor References: Message-ID: <38BA6AFF.5CBD8B75@camelot-it.com> Tom Holroyd wrote: > Monday hits -- more -- > > I want a 4x4 array of zeros. I can do > > from Numeric import * > m = zeros((4,4), Float) > > but I'd like to do it with ordinary lists. > > m = [[0]*4]*4 doesn't work: > > >>> m = [[0]*4]*4 > >>> m[2][2] = 5 > >>> m > [[0, 0, 5, 0], [0, 0, 5, 0], [0, 0, 5, 0], [0, 0, 5, 0]] > > because * doesn't make copies. Do I have to do > > >>> m = [[0]*4] > >>> for x in range(3): > ... m.append([0]*4) > ... > >>> m[2][2] = 5 > >>> m > [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 5, 0], [0, 0, 0, 0]] Well, the following worked for me (forcing list copy): >>> a=[[0]*4]*4 >>> a [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] >>> b=map(lambda x: x+[],a) >>> b [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] >>> b[2][3]=5 >>> b [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 5], [0, 0, 0, 0]] >>> > While I'm here, string.atof() and float() both barf on "123.45," while the > C atof() doesn't. A quick check of the code (stropmodule.c) shows that > there is an explicit check for junk at the end of the string. Is there > some reason for this besides just being annoying? :-) I vote to remove > it. In some countries, 123,456 means 1.23456e5, so you'd better avoid returning 123 on atof('123,456'), otherwise you just let people insert more bugs in their code. If you use a delimiter on a list of numbers, you can use splitfields from string module. BTW, Python could have a better split function, like that in awk, or at least with a string of possible delimiters, and the meaning of choosing the maximal string of a type [a1...an]*. Michael From anders.eriksson at morateknikutveckling.se Mon Feb 7 11:21:03 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 07 Feb 2000 17:21:03 +0100 Subject: PIL for 1.5.1 References: Message-ID: On Mon, 07 Feb 2000 15:22:12 GMT, "Fredrik Lundh" wrote: >afaik, the standard 1.0 source distribution should >work just fine under 1.5.1 (I'm pretty sure it still >works with 1.4) Great! I thought I ask before I install it on my ISP ;-) // Anders From skip at mojam.com Thu Feb 10 09:24:10 2000 From: skip at mojam.com (Skip Montanaro) Date: Thu, 10 Feb 2000 08:24:10 -0600 (CST) Subject: A = X > Y ? X : Y In-Reply-To: <87tli4$s50$1@nntp1.atl.mindspring.net> References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> Message-ID: <14498.51722.920344.225574@beluga.mojam.com> >> It can't be encapsulated into something that looks like a function >> call Michal> I betcha it can!... How about this? Michal> def cStyleIIF(condition, iftrue, iffalse): ... This will only work if the variables being evaluated in the argument strings are in the same module as the definition of cStyleIIF. Otherwise they won't be found. To demonstrate this, place the following code in iif.py: def cStyleIIF(condition, iftrue, iffalse): if eval(condition): return eval(iftrue) else: return eval(iffalse) x = 5 y = 20 a = cStyleIIF("x", line 0, in ? NameError: q nice-try-though-ly y'rs, Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From embed at geocities.com Wed Feb 16 13:50:57 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 16 Feb 2000 13:50:57 -0500 Subject: shelve->dbhash->bsddb bugs on Python 1.5.2 for Win32 Message-ID: I've been running little test scripts so far on all the database and persistence code provided with Python. Thus far I've found: 1. The bsddb 1.8 module included with Python on Windows appears to be stable in btree mode, and very unstable in hash mode. 2. The shelve module provided with the system appears to only use bsddb on Win32. Therefore shelve appears unstable. 3. The alternative bsddb 2.7.x modules provided by Robin Dunn appear to be much more stable than the shelve routines provided with Python. The same test code below tested directly on stock bsddb (using btopen) or Robin's upgraded bsddb appears stable. - - - Here is an example of how to make shelve die horribly. Be sure to delete the old file from c:\temp before you run or you'll get new and even more spectacular errors on the second time you run. whichdb reports the file created by this script is a dbhash file. # DBTEST3.PY # # Stress-test 'shelve'(which in turns uses dbhash which uses bsddb) # # note: I'm aware that by using shelve to store a mere string # rather than something more exotic, I'm not demonstrating a proper # use of shelve, nevertheless I think I've demonstrated a bit of # instability here. import shelve import bsddb filename = "c:/temp/TestShelve.db" import random import time import string # full test range #start,end = 4,17 # medium test start,end = 4,13 # quick test #start,end = 4,8 print "Database Stress Test in Python (Shelve/Pickle/DbHash)" print descriptions = [ "Add Rows", "Read Keys", "Shuffle", "Read Rows", "Delete 75%", "Close" ] List1 = [ "Abc", "Def", "Ghi", "Jkl", "Mno", "Pqr", "Stu", "Vwx", "Yz" ] List2 = [ "X123", "Y456", "Z789", "Y012", "Z345", "X678", "Y901", "Z234", "X567" ] # Shuffle an array like you might shuffle cards # Note: This is intended to be Good Enough, Not Perfect. # We limit shuffle operations to 100 per data set! def Shuffle(ar): sz = len(ar) th = sz/2 lp = sz/4 if (lp > 100): lp = 100 # now move a bunch of cards up or down: x1 = random.randrange(0,sz/2) x2 = random.randrange(0,sz/2)+(sz/2) c = random.randrange(0,sz/4) ar[x1:x1+c], ar[x2:x2-c] = ar[x2:x2-c], ar[x1:x1+c] for k in range(0,lp): # do a little random substitution to kick things off for i in range(0,lp): x = random.randrange(0,th) y = random.randrange(th,sz) ar[x],ar[y] = ar[y], ar[x] # rough scramble of sections: def testset(testindex,RowCount,db): times=[] starttime = time.clock() bytesread=0 print "---- Storing "+`RowCount`+" rows in the database "+`testindex`+" ) ----" for n in range(0,RowCount): r = random.randrange(0,8) V = List1[r]*200 K = List2[r]+"-"+`n`+`testindex` # avoid inorder insertion of keys #try: S = K+':'+V db[K] = S # DB Btree-lookup Key 'K' has value 'V' #except bsddb.error: # what row number did we fail on? # print "info: bsddb.error inserting db[",`K`,"] = <"+`len(S)`+" bytes of junk >" # raise bsddb.error times.append(time.clock()-starttime) # Get Keys #print "Read Keys" Keys = db.keys() N = len(Keys) times.append(time.clock()-starttime) print "Shuffling Key array... (slow!)" # Scramble Keys But Good... Shuffle(Keys) # print Keys[0:10] # taste and see times.append(time.clock()-starttime) print "After inserting ",RowCount," rows the Key Count is now ", len(Keys) bytesread = 0 #print "Reading Rows, in Random Order" for r in Keys: x = db[r] bytesread = bytesread + len(x) print "Bytes read = ", `bytesread` times.append(time.clock()-starttime) # Delete 75% of the data in the database: delcount = len(Keys) - ( len(Keys)/4 ) for k in Keys[0:delcount]: del db[k] db.sync() Keys = db.keys(); print "After deleting, the key count is ", len(Keys) times.append(time.clock()-starttime) #print "Closing" #print "Done" #times.append(time.clock()-starttime) print "Elapsed Times:" for i in range(0,5): print string.ljust(descriptions[i],20), ": ", times[i] print "-----------------" print def testloop(): db1 = shelve.open(filename) for i in range(start,end): testset(i,long(20**(i/4.0)),db1) db1.close() testloop() - - - Example output and traceback: [.... previous page and half of output deleted ....] ---- Storing 1788L rows in the database ( 10 ) ---- Shuffling Key array... (slow!) After inserting 1788L rows the Key Count is now 2027 Bytes read = 1238901 After deleting, the key count is 506 Elapsed Times: Add Rows : 1.50382422799 Read Keys : 1.7653140929 Shuffle : 2.72998586972 Read Rows : 3.49537455309 Delete 75% : 3.93048420107 ----------------- ---- Storing 3782L rows in the database ( 11 ) ---- Traceback (innermost last): File "DBTEST3.py", line 155, in ? testloop() File "DBTEST3.py", line 144, in testloop testset(i,long(20**(i/4.0)),db1) File "DBTEST3.py", line 82, in testset db[K] = S # DB Btree-lookup Key 'K' has value 'V' File "c:\Python\Lib\shelve.py", line 71, in __setitem__ self.dict[key] = f.getvalue() bsddb.error: (0, 'Error') From rockjock at cyberjunkie.com Thu Feb 24 15:19:31 2000 From: rockjock at cyberjunkie.com (rockjock) Date: Thu, 24 Feb 2000 20:19:31 GMT Subject: win32 IDE Message-ID: Are there any Win32 IDEs out there a la M$ Visual Studio? It's quite difficult counting pixels for every widget. Any help? -- Free audio & video emails, greeting cards and forums Talkway - http://www.talkway.com - Talk more ways (sm) From gherman at darwin.in-berlin.de Tue Feb 1 08:53:51 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Tue, 01 Feb 2000 14:53:51 +0100 Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <3896E56F.BEAA47CD@darwin.in-berlin.de> Fritz Heinrichmeyer wrote: > > My son is 11 years and wants to learn programming. He heared about java at > school (cool like nike or adidas ...) but in my opinion this is very hard > stuff for a beginner to bring anything to play. Most likely, you're absolutely right. Java was not designed for 11 year old kids. > I thought of a nice python environment under windows ... > It would be best to have german documentation too. For the time being, the only entry-level Python documenta- tion in German is Guido's Python Tutorial that I translated some months ago into German. See "publications" on: http://starship.python.net/crew/gherman/ For an 11-year old this might well be to abstract, though. There is another nice entry-level (online) book that you might want to consider, although in English: Allen Downey's "Think- ing" like a computer scientist" of which there should be a C++ and a Java version: http://www.cs.colby.edu/~downey/ost/thinkCS/ Jeffrey Elkner is preparing a Python version of it in HTML only. And I am in the process of evaluating if I can make an effort to join some forces with him to provide aversion of that in PS and PDF. > What do you think? I'm not sure there will be anything soon like a "Python for Elementary School Pupils" tutorial or the like, but you never know, what Guido's CP4E project will be able to produce on the long run... IPC8 showed that Python is very suitable for initial non-programmers at least. So, watch this space for further announcements! Regards, Dinu -- Dinu C. Gherman ................................................................ Je me revolte, donc je suis. (Albert Camus) From jpc at informatics.jax.org Mon Feb 14 12:31:05 2000 From: jpc at informatics.jax.org (John Corradi) Date: Mon, 14 Feb 2000 12:31:05 -0500 Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> Message-ID: <140220001231053577%jpc@informatics.jax.org> You should also look at PAOS (Python Active Object Server). Check Parnassus. I'm not sure if it's been updated (written in Python 1.4, I think), but it sounds like what you want to do. John -- John Corradi jpc at informatics.jax.org From rhicks at rma.edu Fri Feb 18 18:05:59 2000 From: rhicks at rma.edu (Robert Hicks) Date: Fri, 18 Feb 2000 23:05:59 GMT Subject: wxPython book??? References: Message-ID: cool...very cool! Bob "Robin Dunn" wrote in message news:oa2r4.43$5l7.852910 at news.randori.com... > "Robert Hicks" wrote in message news:h6_q4.2$UB1.412 at news... > > A "Learning wxPython" or "Programming wxPython" book would be an > outstanding > > edition to the Python community. I think a book of this type "could" push > > wxPython into the Python limelight. Plus as a Python neophyte...I need to > > read! > > > > What do you think? > > > > Actually, I've been asked by a publisher's rep to put an outline together, so > there may be a book in the works soon... > > -- > Robin Dunn > Software Craftsman > robin at AllDunn.com > http://AllDunn.com/robin/ > http://AllDunn.com/wxPython/ Check it out! > > > From c_cazabon at hotmail.com Thu Feb 24 20:35:54 2000 From: c_cazabon at hotmail.com (Charles Cazabon) Date: Fri, 25 Feb 2000 01:35:54 GMT Subject: Style, readability and docstrings References: <38B5BDA9.4B12EC57@exceptionalminds.com> Message-ID: <8EE4C7D44hdjsdhdfh75738@news.sshe1.sk.wave.home.com> Timothy Grant claimed in <38B5BDA9.4B12EC57 at exceptionalminds.com>: >I posted a little code sample the other day and got a couple of comments >back on my "python style". One of those comments suggested that I move >my function comment headers blocks into docstrings. > >I have done so, and now I can barely read my code, I don't know what it >is about those comment blocks at the top of a function that my eyes >like, but without my function header comment blocks, my eyes don't >immediately pick up each function as I scroll through my code. > >Is this a "You need to retrain your eyes" type thing? Have other's >noticed the same thing, and does anyone have a nice coding style that >works for them that I can borrow? Sure. I put the comments in the doc string, so they're available to users, automated doc extracters, etc. But, like you, I find the comment delimiter helps my eye find the start/end of functions/methods. That and the fact that my editor can colourize the comments easily enough. So I use contentless comments to mark the function starts: #!/usr/bin/python import qux, quux, quuux # Globals PI = 3.14159 FILE = 'output.txt' ############################## def main (): '''Program to do foo.''' a = foo () b = bar (a) ############################## def foo (): '''Doc string here.''' blah blah return baz ############################## def baz (): '''Doc string here.''' blah blah return qux ############################## if __name__ == '__main__': main () Works for me. Charles From stidolph at origin.ea.com Wed Feb 9 08:41:31 2000 From: stidolph at origin.ea.com (Stidolph, David) Date: Wed, 9 Feb 2000 07:41:31 -0600 Subject: A = X > Y ? X : Y Message-ID: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> Why not just use the max method? a = max(x,y) It is more obvious what the idea is, and has the advantage of allowing for more than two variables: a = max(x,y,z) The opposite function min is also available. I realize that the intent may be to use the test for something different than less than / greater than, but for readability I would suggest a multi-line if..else statement. We have to maintain the code we write and most of us have to remember about the ? operation in C and take extra time. David Stidolph -----Original Message----- From: Justin Sheehy [mailto:dworkin at ccs.neu.edu] Sent: Tuesday, February 08, 2000 6:25 PM To: python-list at python.org Subject: Re: A = X > Y ? X : Y Curtis Jensen writes: > I fear that this question has already been asked, but is there and > equivalant one line command that is equivalant to the C command: > > a = x > y ? x : y cjc26 at nospam.cornell.edu (Cliff Crawford) writes: > a = (x > y and [x] or [y])[0] Brad Howes writes: > Its in the FAQ -- and its not as pretty: > > a = ( ( x > y ) and x ) or y Fran?ois Pinard writes: > > a = ( ( x > y ) and x ) or y > > If really in the FAQ, it should not be. It surely does not work when x > is 0, and y is less than 0. Brad's example is incorrect, and is not in the FAQ. Cliff's example is the correct one, although I agree with him that it is not to be recommended. People ought to look at the FAQ when they talk about it. They also ought to look in it if they fear that their questions have already been asked. ;-) The entry at http://www.python.org/doc/FAQ.html#4.16 explains this quite well, and gives the correct expression. -Justin -- http://www.python.org/mailman/listinfo/python-list From kc5tja at garnet.armored.net Sat Feb 12 05:17:21 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 12 Feb 2000 10:17:21 GMT Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> <9t9hffh31mp.fsf@mraz.iskon.hr> Message-ID: In article <9t9hffh31mp.fsf at mraz.iskon.hr>, Hrvoje Niksic wrote: >> You may remove the test for line if you know that it is not empty. > >Or: > > if line[-1:] == '\n': > line = line[:-1] > >That works with both empty and non-empty lines. Why not just use string.strip()? -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From gerrit.holl at pobox.com Tue Feb 22 17:01:16 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 23:01:16 +0100 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: ; from effbot@telia.com on Tue, Feb 22, 2000 at 09:30:24PM +0000 References: <000401bf7d07$59acc080$e82d153f@tim> <38B2D49C.F18B47CC@roguewave.com> <6SAs4.640$mYj.190014976@newsa.telia.net> <20000222211326.B4549@stopcontact.palga.uucp> Message-ID: <20000222230116.A6016@stopcontact.palga.uucp> > Gerrit Holl wrote: > > > -- python 1.6 will have *two* different string types. > > > > > > -- python 1.6 will have lots of sequence types (at > > > least one more than 1.5.2!) > > > > If types will eventually be classes, I think it would not be hard to > > add one method to all SequenceTypes. > > bzzt. how the heck do *you* know if any given class > in *my* program is used as a sequence? It's not a sequence type, it's used as a sequence. I meant to add one methos to all types inherited from SequenceType. > or did you mean that *I* have to do that? > > "btw, now that you've installed 1.7, your old sequence > classes no longer work. you have to make sure they all > inherit from AbstractSequence. if you're using old C > types, you're SOL" Do sequence classes even exists before 1.7? > hello? Maybe I misses something, but As I Understand It, Python does not yet support type/class integration. I must have missed something. I was in Aachen today. I seem to have missed a lot! sorry, I slept, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From paul at prescod.net Thu Feb 17 20:21:26 2000 From: paul at prescod.net (Paul Prescod) Date: Thu, 17 Feb 2000 17:21:26 -0800 Subject: Help needed writing GUI comparison References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> Message-ID: <38AC9E96.FDAE287C@prescod.net> Ivan Van Laningham wrote: > > > Addtionally, the last 8 chapters of _Teach Yourself Python in 24 Hours_ So the idea is you walk around reading the book for one day (no sleep, no breaks) and by the end you're a Python expert. I could see that being valuable for people who pad their resumes and then need to cram before their first day of work. Compare: http://www.itknowledge.com/reference/0672313057.html I-knew-Python-was-20-times-easier 'ly yrs -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From sanderson at ttm.com Wed Feb 9 08:34:35 2000 From: sanderson at ttm.com (Scott Anderson) Date: Wed, 09 Feb 2000 08:34:35 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> Message-ID: <38A16CEB.CC63475B@ttm.com> Absolutely. There is something to be learned from every language, and the more there are the more fun I get to have learning them. :-) The very fact that there are intelligent people who swear by one language or the other should indicate that there is no One True Way. I used to like Java; now I like Python more. However, I learned a number of nifty things from my exposure to Java that I hadn't seen elsewhere, and which I can now *use* elsewhere. Knowledge is a big associative web. The more one is exposed to, the more associations one has. Eventually, learning something new becomes a simple matter of figuring out which old thing the new stuff looks like, and fitting it in (and hopefuly enhancing!) with the old stuff. y'rs, -scott tim_one at email.msn.com wrote: > > [Neel Krishnaswami] [...] > > PS. I like Haskell, and Mercury, and Cecil, too. :) > > Good for you, Neel! The common assumption that languages are a zero-sum > game, where one can't prosper unless others fail, has never been true and > shows no sign of, umm, getting truer . Applications for computers > (and so also the means of porgramming them) are exploding, not static. The > world would be a much poorer place without Lisp and Haskell and Icon and > many dozens of others -- yes, even Fortran, even COBOL, even Visual Basic. > Any language that survives for a decade has something essential going for > it that its detractors would be wise to seek out. From bob at horvath.com Thu Feb 24 08:38:13 2000 From: bob at horvath.com (Bob Horvath) Date: Thu, 24 Feb 2000 13:38:13 +0000 Subject: identity of the caller? References: <38B4EDE0.1DB1B55F@horvath.com> Message-ID: <38B53445.AE517D15@horvath.com> Michael Hudson wrote: > Bob Horvath writes: > > > Is there any way to find out the identity of who called you? I am > > mainly thinking of method calls, but in general if there is a way > > for regular function calls, I would be interested in that too. > > Well, you can (or at least I can). I'm not going to tell you how > though, as it sounds a really bad idea for this problem. Well, somebody already emailed me how to do it. I realize that it is normally a bad idea. And I am always open to better way of doing it. > > > > I suppose I should give some context. We have a tool that draws > > message flow diagrams for communications systems. These flows are > > similar to use case flows, or ITU Z.120 MSC charts if you know > > what those are. The tools takes simple ascii text which has the > > sender, the receiver, and the message name, as in... > > > > SENDER RECEIVER MessageName > > > > We tend to have to enumerate a lot of these, and I had the thought > > that if I could prototype the functionality of the nodes, they > > could generate the text used to generate the drawings. > > > > What I was thinking is that the receivers of the message would > > define methods that handle them. To get the picture right, > > I would need to print out method name, the receiver, and who sent > > it. It is the "who sent it" bit that I can't visualize a solution > > for. > > What's preventing you making method calls like: > > def sendMessage(self,msg): > self.listener.recvMessage(message=msg,sender=self) > > ? I guess I'm not understanding your problem... I'm not sure I understand your suggestion. > HTH, but I doubt it... > Michael I'm doubt it too. I suspect there is a more clever way to do it, just that I am not clever enough to at the moment to think of it. From tbryan at python.net Sat Feb 26 10:06:58 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 26 Feb 2000 10:06:58 -0500 Subject: os.path.walk (was: Re: Optimizing code) References: <20000224161930.A4922@stopcontact.palga.uucp> <20000225074854.A1014@stopcontact.palga.uucp> <5lu2ixbaec.fsf@eric.cnri.reston.va.us> Message-ID: <38B7EC12.EDDEA595@python.net> Fran?ois Pinard wrote: > Or course, I could reprogram os.path.walk for my things. I thought it > would have been nice if the standard walk in Python was behaving the best > it could, depending on the system it runs on. When a Python script walks > the structure of a disk, this is often where most of the time is spent, > and for big file hierarchies, this time can become quite significant. I'm sure that a lot of us would be interested in any optimizations in os.path.walk or os.stat. If you're interested enough to develop a patch, then we could pound on it until all the bugs are gone. Then you could propse the feature to Guido again with a patch in hand. :) it's-easier-to-add-a-patch-than-an-idea-ly yours ---Tom From moshez at math.huji.ac.il Sun Feb 13 01:08:38 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 13 Feb 2000 08:08:38 +0200 (IST) Subject: delays in python In-Reply-To: <38A5E385.83F33D90@stat.ubc.ca> Message-ID: On Sat, 12 Feb 2000, Jean Meloche wrote: > How can I insert delays shorter than time.sleep(1) > in python (other than keeping busy)? > > Please answer by email to jean at stat.ubc.ca The easy way. time.sleep(0.5)-ly y'rs, Z -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sholden at bellatlantic.net Wed Feb 23 11:11:27 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 16:11:27 GMT Subject: run pythonwin scripts remotely from unix -- how? References: Message-ID: <38B406B2.2678EDBC@bellatlantic.net> George Planansky wrote: > > Pythonwin looks like a godsend for > sysadmins. But how do I run > a python script on an NT machine, > remotely, from unix (solaris say)? That is, > how do I achieve the equivalent of rsh, > going from solaris to NT, using pythonwin ? > > George Planansky > Earth & Planetary Sciences > Harvard University Since it's fairly easy to run Python scripts as CGI routines, as long as you're behind a firewall you might consider just using IIS to give access to the Python functionality on the NT boxes. Not necessarily the cleanest way, but a browser is a good (if limited) UI tool for that kind of stuff. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From effbot at telia.com Fri Feb 4 15:24:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 04 Feb 2000 20:24:34 GMT Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> <87f8ko$qah$1@news.tht.net> Message-ID: <6AGm4.2674$dT4.201832448@newsb.telia.net> D'Arcy J.M. Cain wrote: > I just received an advance copy of Martin C. Lawrence's "Python the > Annotated Archives." (He uses one of my scripts - page 42.) Martin > also did "Perl the Annotated Archives" and "Perl: The Complete > Reference" for Osborne. While I haven't studied each section yet, > it looks like a nice way to teach the subject. Sort of builds on > the idea of looking for a script that does what you want by going > further and explaining the program step by step. you mean "Martin C. Brown", right? iirc, the book was published in november, so it should be out there. From hweaver at pinetel.com Fri Feb 25 05:47:06 2000 From: hweaver at pinetel.com (Harold L. Weaver) Date: Fri, 25 Feb 2000 10:47:06 -0000 Subject: No way to reach CXX again ? References: <38B676D7.28C44F56@onera.fr> <896hhq$fsl@caribe.pdx.oneworld.com> Message-ID: <896igt$gbq@caribe.pdx.oneworld.com> Harold L. Weaver wrote in message <896hhq$fsl at caribe.pdx.oneworld.com>... > >Marc POINOT wrote in message <38B676D7.28C44F56 at onera.fr>... >> >>I'm trying to dowload CXX (LLNL/ P.Dubois). >>I've unsuccessfuly tried all the links >>I had: no way... >> >>Any idea? Is CXX dead? Is CXX now private? >> > >Moved to sourceforge.net: http://sourceforge.net/project/?group_id=1369 > Better yet: http://numpy.sourceforge.net/ From jeremiah at widomaker.com Mon Feb 7 10:46:25 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:46:25 GMT Subject: nonlinear programs? Message-ID: <389DF99D.5D899C5D@widomaker.com> Is there a way for me to make python start a process(such as mpg123) and then continue on in the program before mpg123 stops? I want to be able to start the song playing, and then still solicit user input about skipping on to the next mp3, or quitting the program. If someone could explain this to me, or point me in the direction of an explanation I would be very greatful. From fdrake at acm.org Mon Feb 21 13:53:34 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 21 Feb 2000 13:53:34 -0500 (EST) Subject: None & Ellipsis In-Reply-To: <20000219101220.A2136@stopcontact.palga.uucp> References: <20000218225110.A9409@stopcontact.palga.uucp> <20000219101220.A2136@stopcontact.palga.uucp> Message-ID: <14513.35246.991911.601020@weyr.cnri.reston.va.us> Gerrit Holl writes: > Moshe Zadka wrote on 950937018: > > On Fri, 18 Feb 2000, Gerrit Holl wrote: > > > > > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > > > >>> t1, t2, None, t4, t5, None, None, t8, None = t > > > >>> None > > > 'i' > > > > >>> del None > > >>> None > > >>> > > Ah...! Is this behaviour documented! > Thanks! Is there anything special about this behavior to document? -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From moshez at math.huji.ac.il Fri Feb 18 23:13:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 06:13:52 +0200 (IST) Subject: Which GUI? In-Reply-To: <20000218230239.C9457@stopcontact.palga.uucp> Message-ID: On Fri, 18 Feb 2000, Gerrit Holl wrote: > I can't understand this. AIX must be strange - wxWindows just talks > to X! And X is portable. Gerrit, have you ever tried to write a program which is portable to AIX and Solaris? Sure, X is portable, sockets are portable, but each UN*X has its own quirks. Why do you think ./configure spends so much time poking and proding your system? Not to mention the wonderful world of ANSI C++, which no compiler on earth fully supports, so another whole section of #ifdef's is used. > > Because it's much easier to steal Tk then reinvent Tk for Python. That's > > the good thing about free software: you can build on other people's work > > instead of doing it yourself. > > ....and slow down the whole process a fewhundred times. Yes. Almost as bad as using Python instead of C (which slows down computations several hundred times too) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sabren at manifestation.com Fri Feb 18 21:19:49 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Fri, 18 Feb 2000 21:19:49 -0500 (EST) Subject: static class methods in Python? In-Reply-To: Message-ID: On 19 Feb 2000, Neel Krishnaswami wrote: > I'd agree that the self.__class__.bar you'd have to do in real Python > is a little bit ugly. One thing I looked at doing was changing Python > so the syntax "class.foo" would expand to "self.__class__.foo" (or > whatever "self" actually is). This would solve the problem without > adding a new keyword. neat idea! would "class" be a magic word that expanded to "self.__class__" ? or would, for example, the class "Puppydog" use: class Puppydog: def __init__(self): Puppydog.count = Puppydog.count + 1 ??? > However, I was scared away by the following comment in Parser/pgen.c: > > /* This algorithm is from a book written before > the invention of structured programming... */ :) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From gerrit.holl at pobox.com Sun Feb 20 13:40:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 20 Feb 2000 19:40:12 +0100 Subject: Which GUI? In-Reply-To: ; from effbot@telia.com on Fri, Feb 18, 2000 at 02:15:42PM +0000 References: Message-ID: <20000220194012.A2069@stopcontact.palga.uucp> Fredrik Lundh wrote on 950879742: > btw, I just looked at the wxPython tutorial. > > every single example in that tutorial can be written in > Tkinter, using about 50% as much Python code. and > things like layout management and event handling looks > embarrasingly primitive compared to Tkinter. Maybe. But for me, the show-stopper for Tkinter is that it calls Tcl, not an underlying C++ library. Almost all other Python GUI's have classes wrapped to C++ classes. That has two consequenses: * It's MUCH easier to translate C++ calls to Python calls than translate Tcl/Tk calls to Python calls. So everything needs to be double documented in Tkinter (okay, if you want to take the time to document *everything*...) * It's up to 1000 times slower. > methinks wxPython is superior to Tkinter in pretty much > the same way as languages with braces are superior to > languages using indentation... The reason you named is the only valid reason I heared for keeping Tkinter so far. > Why the hell hasn't wxPython become the standard Python GUI yet? > No it is not. It [wxPython] doesn't work on AIX. I truly fail to see how > come Python, Tcl/Tk, Perl, bash, GNU grep manage to compile cleanly on AIX, > yet wxWindows doesn't, but until it does, it is not an option for many > people, including me. > You can download wxWindows snapshots for Aix and other systems from: > http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/daily/ > I've also compiled older release versions on Aix myself with g++ compiler. > This was not trivial process though. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From gerrit.holl at pobox.com Tue Feb 22 15:35:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 21:35:39 +0100 Subject: Life's better without braces In-Reply-To: <3dhff29onh.fsf@amarok.cnri.reston.va.us>; from akuchlin@mems-exchange.org on Mon, Feb 21, 2000 at 05:28:02PM -0500 References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> Message-ID: <20000222213539.C4549@stopcontact.palga.uucp> > [2] I occasionally think about this problem. The setup: GvR was far > too profligate in adding functions to bltinmodule.c that could have > been written in pure Python instead. So, how many built-in functions > can you re-implement in pure Python? These are possible: abs, callable, chr, delattr, divmod, execfile, filter, getattr, hex, input, int, isinstance, issubclass, len, list, long, map, max, min, oct, range, raw_input, reduce, reload, repr, setattr, tuple, vars. These aren't: apply, buffer, coerce, compile, complex, dir, eval, exit, globals, hash, id, intern, locals, round, slice, type, xrange lets-rewrite-re.py-in-100%-pure-Python-ly y'rs - Gerrit From aya at waena.edu Sun Feb 13 23:39:19 2000 From: aya at waena.edu (aya) Date: Sun, 13 Feb 2000 23:39:19 -0500 Subject: _opengl mystery References: <38992034@9.242.61.10> <389A41A6.BC43539B@python.net> Message-ID: <38a78804@9.242.61.10> Thanks for all the great advise. I think this will solve my problem (if not, I'll be back ;) > since-when-did-newbies-START-with-opengl?-ly yours 'newbie' is a relative term :) -aya From claird at starbase.neosoft.com Fri Feb 18 21:26:04 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 18 Feb 2000 20:26:04 -0600 Subject: Which GUI? References: Message-ID: In article , Vadim Zeitlin wrote: . . . > you may be surprized to hear this, but wxWindows is developped by a team of >volunteers which means that we don't get paid for it and, more importantly, >that we don't have access to every platform from Win3.1 to super computers on >daily basis. > > So unless our users report us the compilation problems on the platforms we >don't use ourselves (Win32/Linux/Solaris for the main developpers), we don't >have many chances to fix them. . . . I've come to believe that the opposition between volunteers and paid labor is perhaps neither a well-founded nor in- formative one. In any case, the Tk maintainers say *exactly* the same things--they have trouble with AIX, they only know about problems with many platforms if someone tells them, much work only gets done on individuals' own time, Win32/Solaris/ Linux are best supported, ... I think the wxWindows team does wonderful work. Sometimes, employees also do meritorious things. We all have constraints on our ambitions. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From fdrake at acm.org Mon Feb 28 16:04:03 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 28 Feb 2000 16:04:03 -0500 (EST) Subject: ConfigParser and .ini files In-Reply-To: <3888B360.EAE0A804@callware.com> References: <86a1s2$7ha$1@nnrp1.deja.com> <14472.39533.223900.313932@weyr.cnri.reston.va.us> <38889FB1.F692A45D@callware.com> <14472.44829.865615.286152@weyr.cnri.reston.va.us> <3888B360.EAE0A804@callware.com> Message-ID: <14522.58051.965464.191973@weyr.cnri.reston.va.us> I've finally checked in some changes to make ConfigParser more .ini-friendly; the new code is attached below. I did *not* make ConfigParser conform to any of the specs that people kindly provided pointers to, for a couple of reasons. First, there are a number to choose from. ;) Second, I think the "right" approach is to add a new module to the distribution that specifically handles .ini files exactly right, and doesn't do any of the extra stuff that ConfigParser does; that can be done through subclasses (some possibly provided as part of the module). Please CC comments to me since I'm no longer reading c.l.py. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives -------------- next part -------------- A non-text attachment was scrubbed... Name: ConfigParser.py Type: text/x-python Size: 14306 bytes Desc: revised ConfigParser URL: From effbot at telia.com Sat Feb 12 14:41:11 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 19:41:11 GMT Subject: Pike seems good. A Q though. References: <200002112329.SAA01742@seanb.sttln1.wa.home.com> <50ip4.6464$UP1.149900@bgtnsc05-news.ops.worldnet.att.net> Message-ID: Forget it wrote: > Q: Is there a mirror somewhere closer you know of. yes. From alex at netconnect.no Tue Feb 29 09:17:24 2000 From: alex at netconnect.no (Alexander Staubo) Date: Tue, 29 Feb 2000 15:17:24 +0100 Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> Message-ID: In article <20000222211406.41743.qmail at hotmail.com>, wrlddomprod at hotmail.com gawked pleasuredly... > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior. This would allow the level/content designers > to concentrate more on the game design side of things, since > behaviors would be outside of the main game engine. Scripted game logic is an excellent idea, and a proven one (albeit not with Python, that I know). >Is it > possible to have multiple scripts running at the same time? > Would this involve creating multiple interpreter objects? According > to the docs, this is possible but it isn't totally safe to do. > What would be a good strategy for this? Python's problem is with its global interpreter lock. Only one piece of Python code can execute "at the same time" (on a single processor this means within the same time slice). Multi-threaded performance of Python definitely suffers, and depending on the code, you'll usually find almost no discernible improvement on SMP systems. > My other question was one of performance. Is it crazy to have > ~10 different objects with each an individual script and hoping > the game will be running at 30 frames per second? The question might not be > valid, since I'm not sure how to implement it in the first > place. Crazy it isn't, but perhaps a tad ambitious -- it certainly depends on the system requirements of your game. I've been down the same path of research as you have, and my conclusion was that for now, I cannot recommend Python for game-scripting purposes. Instead, you might want to take a look at EiC, the free, open-source, embeddable C interpreter. (Although this borders on heresy, I mention this openely in this newsgroup because I know the Python crowd is generally pragmatic and will buy any solution as long as it works, even one that isn't Python.) It's a very impressive engine that compiles to (and optimizes) bytecode on the fly, and supports an excellent API for mixing native code -- even non-C -- with scripted code. It supports most of the C language, runs on most platforms including Win32, supports multithreading (afaik), and is also darn fast -- much faster than Python, partly because it interprets a statically-typed, early-bound language. Otoh, it is not object-oriented, nor is it Python. ;-) -- A. From robin at jessikat.demon.co.uk Thu Feb 3 08:51:34 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 3 Feb 2000 13:51:34 +0000 Subject: Which Tcl with 1.6 Message-ID: Just started having a look again at the CVS and noticed that _tkinter is still being built against Tcl8.0. Surely we should be moving to making Tcl8.2 standard especially as it can do unicode which we are informed will be in 1.6. -- Robin Becker From rupole at compaq.net Fri Feb 18 18:30:00 2000 From: rupole at compaq.net (Roger Upole) Date: Fri, 18 Feb 2000 23:30:00 GMT Subject: Compiled code question References: <38ADAC1C.5A1D3388@exceptionalminds.com> Message-ID: I ran into a similar problem writing code on a machine whose date had been set back due to Y2K issues. If you _can't_ synchronize the clocks, just delete the .pyc when you implement the new code. Roger Upole "Ask the ToeCutter - HE knows who I am !" "Fredrik Lundh" wrote in message news:EMir4.304$mYj.170810880 at newsa.telia.net... > Timothy Grant wrote: > > When I copy a new version of the .py to the server I kinda thought that > > the next time my users double-clicked their icons they would be running > > the new code, this didn't happen. On the windows boxes, I must load the > > .py into PythonWin, select the Run button, then exit my programme. Now > > if the icon is double-clicked, the new code is executed. I'm sure this > > has something to do with the byte code compiler and windows file > > associations, but I have no idea what. > > tried synchronizing the clocks? > > > > From culliton at clark.net Thu Feb 24 00:06:23 2000 From: culliton at clark.net (Tom Culliton) Date: Thu, 24 Feb 2000 05:06:23 GMT Subject: Reference Counting Documentation (longish) Message-ID: Earlier today somebody came to me for help with a simple application which embeds python and which was leaking memory. The application gets a message using an API, converts the list of key/value pairs into a python dictionary and runs a python function with the dictionary as it's argument. It was immediately obvious that the problem was going to be botched reference counts and it was just a matter of looking up the behaviour of each Python API function in the lovely new C API Reference Manual and and doing a little trivial mental math. After all, I've done this before, extended python, embedded it, avoided leaking memory, and several times to boot. It ought to be easy ... Right? Wrong. I dug into the "Python/C API Reference Manual", and found no mention of the ref-counting behaviour of the functions in the Abstract and Concrete Object Layer sections (6 and 7). Checked the Refrence Counting section (3) with the same results. Checked the Objects, Types and Reference Counts section (1.2), again no dice. So I scratched my head some and checked the "Extending and Embedding" tutorial. The section on Reference Counts (1.10) actually managed to confused me, despite the fact that I understood the topic and got it right on the first try back around version 1.2 or so. (BTW - It even seemed to contradict the code when I fell back on that.) Thank heavens that the code is so darned readable. When I finally gave up on the documentation and just remembered to "use the source" it was all figured out and fixed in about 10 minutes. And now for the point of this whole story: I think we need a reference counting cheat sheet in the C API Reference Manual rather badly. I'm not talking about anything elaborate, just a simple table showing each function in the API, and what it does to the reference counts of its arguments and return value. (It could even be part of the current entries for each function.) This would be an absolutely priceless resource for anyone doing embedding and extending. PyList_New return value - refcount set to one Py_BuildValue return value - refcount set to one parameters - unchanged (?) PyList_Append first parameter unchanged second parameter INCREFed PyString_FromString return value - refcount set to one parameters - unchanged (?) PyDict_SetItem first parameter unchanged second parameter INCREFed third parameter INCREFed . . . Does something like this exist? I sure couldn't find it, despite long familiarity with the docs and the web sites. It would certainly be an easy enough project for anyone with some spare time on their hands. If nobody else can step up, I'll even volunteer to provide the content if someone else can incorporate it ... Thanks for your patience. From aahz at netcom.com Fri Feb 11 00:26:45 2000 From: aahz at netcom.com (Aahz Maruch) Date: 11 Feb 2000 05:26:45 GMT Subject: Remove duplicates in a sequence? References: <38a39011.603799531@news1.on.sympatico.ca> Message-ID: <8806il$147$1@nntp6.atl.mindspring.net> In article <38a39011.603799531 at news1.on.sympatico.ca>, Robert Roy wrote: > >There is a recent thread on this subject. If I recall, what seemed >fastest was >mydict={} >for item in mylist: > mydict[item]=None >mylist = mydict.keys() Actually, the Timbot corrected me to point out that mydict[item]=1 is slightly 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 Nostalgia just ain't what it used to be From robin at jessikat.demon.co.uk Sun Feb 6 19:00:13 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Mon, 7 Feb 2000 00:00:13 +0000 Subject: Excel Question References: Message-ID: In article , Bill Wilkinson writes >[Robin Becker] >> Why don't you make the python a server instead of a client. Then your >> excel could call a small vba routine to open up a python com object. > >Two reasons really. > >1. This is a simulation model. There are many different versions of the >model. I don't really want to have to register an object per model version. >2. There is a performance decrease when I run the model as a server.(almost >twice as slow.) > >It just works really well the way I have it, if I can just get around this >one problem. Now, having said that. I might have to go with the server >object anyway if > > there ought to be some way to distinguish the excel. so the button can pass a handle to the client. Then the client can open up the correct instance. -- Robin Becker From arnaud at crao.net Mon Feb 28 03:27:33 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Mon, 28 Feb 2000 09:27:33 +0100 Subject: Phython as In-Game scripting language References: <20000224155917.81782.qmail@hotmail.com> <38B9A3C6.9CFA5FF8@sightreader.com> Message-ID: > > Besides Crystal Space and Alice, has Python been used in any > > commercial games? I don't know about commercial games but ... have a look at the WorldForge project at http://www.worldforge.org/ (massive multi-players role playing game). They are using Python in many parts of the project. I also heard about a commercial game company (a big one ... but I can't remember which one) recruiting python programmers to code games. So ... it seems Python can be a nice choice for fancy stuff ;-) Regards, Arnaud From sholden at bellatlantic.net Fri Feb 11 21:09:23 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sat, 12 Feb 2000 02:09:23 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <38A4B22C.EDFCB2A3@be-research.ucsd.edu> Message-ID: <38A4C0EF.285BB349@bellatlantic.net> Curtis Jensen wrote: > > Steve Holden wrote: > > > > I declare this thread closed. > > Unilaterally. NOW. > > Like that'll happen. :-} herding cats would be easier -- "If computing ever stops being fun, I'll stop doing it" From gvwilson at nevex.com Mon Feb 28 15:47:21 2000 From: gvwilson at nevex.com (Greg Wilson) Date: Mon, 28 Feb 2000 15:47:21 -0500 Subject: thread problem Message-ID: I'm trying to implement futures in Python using threads. When a future is created, it (internally) spawns a thread to calculate its value. When another thread tries to get the future's value (by calling the future object as if it were a function), the read blocks until the value is available. My implementation is included below. The problem is that I'm setting 'self.result' in the child thread, but when the __call()__ returns, the value has gone back to 'None'. There's nothing in the docs about objects being cloned during thread creation --- I'd be grateful if anyone could tell me what's up. Thanks, Greg ----------------------- #!/usr/bin/python from thread import * import time """Simple future class for Python""" class Future: # Create the future. def __init__(self): # Setup code executed in creator's thread. # Important that lock is locked before thread spawned. self.result = None self.lock = allocate_lock() self.lock.acquire() start_new_thread(Future._run, (self,)) # Run the thread evaluator. def _run(self): # Do the work defined by the derived class. print `get_ident()` + \ " about to self.evaluate()" self.result = self.evaluate() print `get_ident()` + \ " returned from self.evaluate()" + \ " releasing lock" + \ " result is " + \ `self.result` # Report. self.lock.release() print `get_ident()` + \ " released lock" + \ " result is " + \ `self.result` # Fetch the future's value. def __call__(self): print `get_ident()` + \ " in __call__()" + \ " lock state is " + \ `self.lock.locked()` # If the lock is still held... if self.lock.locked(): # ...wait for evaluation to complete... self.lock.acquire() # ...then signal to others that the value is available self.lock.release() # Result must have been calculated by here. print `get_ident()` + \ " returning self.result == " + \ `self.result` return self.result # Default version of 'evaluate()' does nothing def evaluate(self): pass # Derive a future class that sleeps for a while, then returns a constant class FutureTest(Future): # Create the future def __init__(self, constant): self.constant = constant Future.__init__(self) # Calculate a value def evaluate(self): print `get_ident()` + \ " in derived evaluate()" + \ " constant is " + \ `self.constant` + \ " and result before call is " + \ `self.result` print `get_ident()` + \ " passed sleep()" + \ " setting result in derived evaluate()" self.result = self.constant print `get_ident()` + \ " self.result is now " + \ `self.result` # Test if __name__ == "__main__": # simple test function print "\n\n" + `get_ident()` + ": creating future" f = FutureTest(2) print `get_ident()` + ": fetching value" val = f() print `get_ident()` + ": value is " + `val` + "\n\n" From jjlucsy at concentric.net Thu Feb 24 18:49:00 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Thu, 24 Feb 2000 18:49:00 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: Message-ID: Try my python15.dll at http://www.concentric.net/~Jjlucsy/python15.dll and see if it helps. Basica1ly it uses delay loading of some of the dlls to speed load time. -- - Joel Lucsy (jjlucsy at concentric.net) From jjlucsy at concentric.net Fri Feb 4 15:59:20 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Fri, 4 Feb 2000 15:59:20 -0500 Subject: Lisp 2 Python? References: Message-ID: > Surely you jest. Oh no, I jest not! =) > Python is LISP-like in various respects, but LISP and Python share > vastly different ancestry. I realize. > Even that aside, the synteaxes are HUGELY different. A say, Python to > Pascal converter is one thing, a Python to LISP converter is another > entirely. Um, you're going to wrong direction. I want a lisp-to-python, not a python-to-lisp. > Also, which LISP? Common LISP I presume? You'd almost need something > as complex as common lisp itself to convert that to PYthon :) Well, the idea to go from AutoLisp (which is built into AutoCAD), to python. This is a rather simplistic version of lisp, not even remotely close to Common Lisp. > Good luck, > -Chris -- - Joel Lucsy (jjlucsy at concentric.net) From effbot at telia.com Mon Feb 28 08:23:57 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 13:23:57 GMT Subject: Introspection References: <38BA7310.C6968E6E@mindspring.com> Message-ID: Chuck Esterbrook wrote: > In Objective-C I can say: > [someObject class] > > Which in Python would be: > someObject.class() someObject.__class__ for more info, see: http://www.python.org/doc/current/ref/types.html http://www.python.org/doc/current/lib/specialattrs.html > How does Python get the __name__ then? through the getattr hook? From peter.sommerfeld at gmx.de Fri Feb 25 13:56:53 2000 From: peter.sommerfeld at gmx.de (Peter Sommerfeld) Date: Fri, 25 Feb 2000 19:56:53 +0100 Subject: Phython as In-Game scripting language Message-ID: Shawn LeBlanc wrote: > As a slightly off topic question, which other languages like > Python could be embedded efficently in a game project? I've > seen that several games use Lua (Grim Fandango), and there's > got to be other games that use embedded languages. What > would be the advantages and disadvantages of using Python > in a game? I think Lua is a good choice if you don't need Pythons broad library support or prototyping abilities. It is somewhat like a Python-Light with a simplified object model (prototype based) and a smaller footprint (If memory serves well < 256 kb). The next version will support multiple states regularly. It compiles out of the box (strict ANSI-C). Compared to Python: [1] designed for embedding only (no concept of main program), [2] true mark&sweep garbage collector, [3] not that much language support (libraries, debugging etc), [4] more restricted set of datatypes. Well readable but I miss identitation :-) (Lua uses "end" marker). Peter From aahz at netcom.com Sat Feb 19 18:34:45 2000 From: aahz at netcom.com (Aahz Maruch) Date: 19 Feb 2000 23:34:45 GMT Subject: Zope References: <38AEB3B2.28137ECB@home.com> Message-ID: <88n9al$qnq$1@nntp6.atl.mindspring.net> In article <38AEB3B2.28137ECB at home.com>, Lucas Vogel wrote: > >Is there a newsgroup for Zope? Or can you ask zope-related questions in >here? The general opinion seems to be that you should use the Zope mailing lists. See http://www.zope.org/ for more info. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From tim_one at email.msn.com Wed Feb 23 03:05:23 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 23 Feb 2000 03:05:23 -0500 Subject: functional programming In-Reply-To: <88vt3u$e0h$1@nntp6.atl.mindspring.net> Message-ID: <000501bf7dd4$bc7b5000$ad2d153f@tim> [Tim] > ... > Optimize intermediate frames away, and tracebacks would become much > harder to decipher. [Aahz Maruch] > Say! Couldn't you use continuations to store those intermediate frames > in case you ever throw an exception? Yes. > Bet-you-can't-tell-if-I'm-joking-ly y'rs Well, the idea is so off the wall I can't call it correct or incorrect with a straight face, and the idea is useless regardless (it's no more space-efficient than Python 1.5.2, and the major point of tail-call opts is to allow tail recursion in bounded space). So, joking or not, this is one of the only ideas on c.l.py this week I truly love . now-if-only-we-had-rational-arithmetic-we-could-add-1-to-2-without- losing-precision-ly y'rs - tim From daryl_stultz at my-deja.com Wed Feb 23 09:39:53 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Wed, 23 Feb 2000 14:39:53 GMT Subject: win32security References: <87pu3o$23i$1@nnrp1.deja.com> <88joeo$32s$1@nnrp1.deja.com> <88ukc0$aeq$1@nnrp1.deja.com> Message-ID: <890rfo$s36$1@nnrp1.deja.com> In article , "Mark Hammond" wrote: > Check out the documentation for these functions from Microsoft. Eg, a > search for "GetFileSecurity" will yield some good hits, including: > > HOWTO: Add an Access-Allowed ACE to a File (ID: Q102102) > HOWTO: Obtain the Owner of a File on Windows NT (ID: Q218965) > Whether in C or Visual Basic, all of these examples on msdn are a bazillion lines long. I really can't wade through it all... I think I'm just going to use a pipe to cacls.exe and parse the results. Thanks for the help... Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Tue Feb 1 13:46:40 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 1 Feb 2000 13:46:40 -0500 Subject: Dynamic class construction? In-Reply-To: <38970CA2.5CC3149B@math.okstate.edu> Message-ID: <1262691707-4436418@hypernet.com> David C. Ullrich writes: > If the docs are going to change more often than the program > (which is a good thing) the docs should have separate version > numbers. I could download the revised docs, but I don't see the > point, since I have no way of knowing tommorow whether > they're still current. You watch the list. Fred announces these things. There's often a couple soon after a new release, but unless you're paying long distance for a 300 baud connection, it's usually worth the download. - Gordon From be at et.dtu.dk Fri Feb 4 03:52:29 2000 From: be at et.dtu.dk (Brian Elmegaard) Date: Fri, 04 Feb 2000 09:52:29 +0100 Subject: In search of code for reuse Message-ID: <389A934D.E9AD141D@et.dtu.dk> Hi, I saw someone had had great success in asking for a place to get some code to reuse for his own needs. I have a similar problem: Does anyone have or know python code for a graphical interface to flowsheet/electric circuit layout or similar? I would like to put a flowsheet of a thermal system on a canvas, generate input to a simulator and read the results of the simulation in and present them. Any pointers? -- Brian Elmegaard Dept. of Energy Engineering, Technical University of Denmark, DK-2800 Lyngby be at et.dtu.dk http://130.225.70.76/staff/be/be.html Phone +45 4525 4152 Fax +45 4593 0663 From boud at rempt.xs4all.nl Thu Feb 3 01:49:44 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 3 Feb 2000 06:49:44 GMT Subject: Python MySQL.connect() question References: <3893CD31.B17E8B84@regnoc.com> <870tjf$514$1@news1.xs4all.nl> <3894737C.A676BC16@regnoc.com> <381BAA74.863A8048@cs.rmit.edu.au> <874ejr$35o$1@news1.xs4all.nl> <381ED7A5.DF5C510D@cs.rmit.edu.au> Message-ID: <87b8e8$cpv$1@news1.xs4all.nl> Hafeez Bana wrote: <...> > Mysql can be told what kind of communication it uses. In your case Mysql > maybe listening on a unix socket and so localhost works - this was not > the case with my configuration of Mysql. I hope you get what I am > saying. That's interesting - I didn't know that at all. -- Boudewijn Rempt | http://www.valdyas.org From steve.mnard at sympatico.ca Tue Feb 15 09:13:14 2000 From: steve.mnard at sympatico.ca (Steve Menard) Date: Tue, 15 Feb 2000 09:13:14 -0500 Subject: Python on the Palm References: <38A8D6E6.A18DBCE5@pehr.net> Message-ID: <5ddq4.2279$CC3.73704@wagner.videotron.net> I understand your frustration. I have recently gotten a nice PalmV, but I really simply cannot stand to program it in C, nor any of the other non-commercial languages I've tried. But do not despair. If you can patient, there is currently a project, called Stackless Python, that can help you. I am in no way related to that project. However, after have chatted a little with the authors, they assure me that a version (base on CPython 1.5.1) will be available soon for the palm. I do not know what level of functionality will be available, but that's certainly a step in the right direction. Af for possibility, I can definitely tell you it's possible. I have looked at porting myself, and while it's not a simple job (there's not even the concept of a file on palm!), it is doable. The URL for stackless is http://www.tismer.com/research/stackless/ pehr anderson wrote in message news:38A8D6E6.A18DBCE5 at pehr.net... > Dear Palmist Pythoneers, > > Ever wanted python on your palm pilot? > So have I, unfortunately I haven't the foggiest idea > if it is even possible. > > Anywy, to kick off the concept I have posted a > ridiculous $500 bounty on cosource. > (ridiculously small for the insane amount of work) > So far I've had skeptecism, humor, but no hard evidence > that it is impossible. > > PLEASE DON'T FORCE ME TO SUFFER THE AUTROCITIES OF LISP! > I just to use a decent scripting language in my palm. > Is that too much to ask? If so, please shoot me now. > > The full extent of my pathetic pleadings are at this URL: > http://www.cosource.com/cgi-bin/cos.pl/wish/info/237 > > -pehr From gerrit.holl at pobox.com Tue Feb 15 09:13:18 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 15 Feb 2000 15:13:18 +0100 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <001c01bf771d$399d72c0$3acbd9c2@peridot.optichrome.com>; from a.eyre@optichrome.com on Mon, Feb 14, 2000 at 06:56:39PM -0000 References: <1261569578-40112683@hypernet.com> <001c01bf771d$399d72c0$3acbd9c2@peridot.optichrome.com> Message-ID: <20000215151318.A1508@stopcontact.palga.uucp> Adrian Eyre wrote on 950550999: > > And what should ['a',3,None,[Tim(1),Tim(2)]].join(';') return? > > The same as string.join(['a',3,None,[Tim(1),Tim(2)]], ';') or > ";".join(['a',3,None,[Tim(1),Tim(2)]]) >>> def Tim(i): ... return i ** i ** i ... >>> import string >>> string.join(['a',3,None,[Tim(1),Tim(2)]], ';') Traceback (innermost last): File "", line 1, in ? TypeError: first argument must be sequence of strings regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From trentm at ActiveState.com Mon Feb 21 05:13:56 2000 From: trentm at ActiveState.com (Trent Mick) Date: Mon, 21 Feb 2000 10:13:56 -0000 Subject: Interactive programs through Popen3 In-Reply-To: <14513.21990.187292.675184@weyr.cnri.reston.va.us> Message-ID: > Joe Smith writes: > > I take it that you must be running on UNIX. If I remember > correctly, 1.5.2 > > says something about can't fork on Windows NT 4.0. If I > remember correctly, > > popen2() and popen3() also have the same problem. The doc > should probably > > state that the popen2 module/library does not work on NT. It > would probably > Fred writes: > Joe, > The current version of the documentation notes that this module is > available for Unix on the HTML page for the module. It is also > located in the chapter on "Unix Specific Services," so an NT user > should be able to determine the lack of availability easily. > Perhaps Joe was referring to the Windows compiled help file for Python 1.5.2. The page for the popen2 module in this help file states popen2 availability for UNIX and Windows. Which is incorrect. A little inconsistency. Trent From al_amerin at yahoo.com Fri Feb 18 22:51:14 2000 From: al_amerin at yahoo.com (Al-Amerrho H. Amerin) Date: Fri, 18 Feb 2000 21:51:14 -0600 Subject: timemodule.c Message-ID: <38AE1332.7671BFF1@yahoo.com> I notice that these lines in 'mktime' don't seem to be used. tt = time(&tt); buf = *localtime(&tt); Can anyone enlighten me? Thanks. Al- From tim_one at email.msn.com Sun Feb 27 04:29:07 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 04:29:07 -0500 Subject: Q about tail recursion In-Reply-To: Message-ID: <000801bf8105$18b99ba0$172d153f@tim> [Tim] > And if a def is sometimes meant to return a value and > sometimes not, redesign the code before you drive yourself > insane . [Moshe Zadka] > I've thought about writing a small utility to warn me about such > functions, which should be easy enough: either all or none of > "RETURN_VALUE" opcodes should be preceded by LOAD_CONST of None. > > Would such a scheme work? Seems so, except in a function that explicitly does "return None" as well as, e.g., "return 42". That's rare in my experience. However, I've detected subtle evidence that our experiences sometimes differ . Doing none = None return none would be an adequate workaround. If you write such a utility, I bet PythonWin and IDLE would like to adopt it! I expect "do some sanity checks" to become an increasingly popular feature of the Python IDEs, and I'd hate to think that tabnanny.py is the best sanity-checker the community can come up with . encouragingly y'rs - tim From pinard at iro.umontreal.ca Tue Feb 22 16:55:34 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 16:55:34 -0500 Subject: Python mode - `C-c |' feature suggestion In-Reply-To: Alex's message of "22 Feb 2000 16:03:51 -0500" References: <14514.45176.931019.526625@anthem.cnri.reston.va.us> Message-ID: Alex writes: > Must-be-an-anti-XEmacs-conspiracy'ly I sometimes wonder, yes. (Even if I don't use XEmacs much myself :-). > > The `-no-properties' functions are less portable. > It just popped up when I hit complete. Just to be complete, it does happen that properties get in the way. In some portable code, I use this: ;; Protect string comparisons from text properties if possible. (eval-and-compile (fset 'po-buffer-substring (symbol-function (if (fboundp 'buffer-substring-no-properties) 'buffer-substring-no-properties 'buffer-substring))) (if (fboundp 'match-string-no-properties) (fset 'po-match-string (symbol-function 'match-string-no-properties)) (defun po-match-string (number) "Return string of text matched by last search." (po-buffer-substring (match-beginning number) (match-end number))))) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From wware at world.std.com Thu Feb 10 10:27:21 2000 From: wware at world.std.com (Will Ware) Date: Thu, 10 Feb 2000 15:27:21 GMT Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: Alex (alex at somewhere.round.here) wrote: : > It'd be kinda cool if readlines() could take an argument that meant to : > strip away any trailing whitespace. : Below are some classes I often use for that sort of thing. Thanks! Those are very pretty, particularly the use of __getitem__. I haven't yet managed to train myself to exploit that idiom well. Maybe Basic as a first programming language really does break your brain. -- -- I can picture in my mind a world without war, a world without hate. And -- -- I can picture us attacking that world, because they'd never expect it. -- Will Ware - N1IBT - wware at world.std.com From moshez at math.huji.ac.il Tue Feb 22 01:39:55 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 08:39:55 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On Fri, 18 Feb 2000, Michal Wallace (sabren) wrote: > That Software Development Magazine article had a sidebar which > mentions that python supports functional programming. I know what > functional programming IS, and I can see how python supports it, but > I'm wondering if anyone has any examples of actually putting this > to use? At a guess, nobody does anything seriously functional with Python. Lack of lexical scoping and the weakness of lambdas discourage it. Whoever wrote this article must have seen "lambda" and concluded Python has a strong functional basis. From gerrit.holl at pobox.com Wed Feb 23 14:19:42 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 20:19:42 +0100 Subject: Tkinter installation problems In-Reply-To: <_WTs4.7648$al3.101350@newsc.telia.net>; from effbot@telia.com on Wed, Feb 23, 2000 at 04:30:50PM +0000 References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> Message-ID: <20000223201942.A4980@stopcontact.palga.uucp> > Mladen Bestvina wrote: > > mladen at drava:/home/mladen/projects/grayson > python > > Python 1.5.2 (#4, Feb 14 2000, 16:39:33) [GCC pgcc-2.91.57 19980901 > > (egcs-1.1 re on linux2 > > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > > >>> import _tkinter > > >>> import Tkinter > > >>> Tkinter._test() > > File "", line 1 > > Tkinter._test() > > ^ > > SyntaxError: invalid syntax > > umm. that's no Tkinter installation problems (but I'm > sure Gerrit will pop up and say it is ;-) I consider this as a public insultation only because your opinion on something differs from mine and my English lacks here to explain how FURIOUS I am! No smiley can help you! I did not say Tkinter sucks. I explained why _I_ did not want to use it. That's a personal opinion and I find this attack ABSOLUTLY RIDICULOUS. From Sven.Drescher at dlr.de Tue Feb 29 05:55:52 2000 From: Sven.Drescher at dlr.de (Sven Drescher) Date: Tue, 29 Feb 2000 11:55:52 +0100 Subject: Q: Tk's X errors Message-ID: <89g8ko$pvk$1@news.go.dlr.de> Hallo! I've written a programm to spawn a child and to kill this again. To do this I use fork() and execv(). Before I start the child I check with os.path.isfile(), wether the file exists. If the file exists, it will be started and all works fine. But if the file not exists, I do not the exec()-command and an error occured. e.g. X Error of failed request: BadIDChoice (invalid resource ID chosen for this connection) Major opcode of failed request: ... (X_CreatePixmap) Resource id in failed request: ... Serial number of failed request: ... Current serial number in output stream: ... What did I wrong? Thanks for help and hints! Sven ______________________________________ German Aerospace Research Establishment From gerrit.holl at pobox.com Thu Feb 24 10:01:29 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 24 Feb 2000 16:01:29 +0100 Subject: Best way to find unique items in a list In-Reply-To: <20000224.10515678@sparky.spkydomain>; from aiki108@netscape.net on Thu, Feb 24, 2000 at 10:51:56AM +0000 References: <20000224.10515678@sparky.spkydomain> Message-ID: <20000224160129.A4593@stopcontact.palga.uucp> > Here's a quickie. > > Def Unique(thelist): ~ Hmm... unless you changed the source to The Future, this won't work. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From aweis at gmx.de Tue Feb 22 19:23:32 2000 From: aweis at gmx.de (Arnold Weis) Date: Wed, 23 Feb 2000 01:23:32 +0100 Subject: Can't reopen eMatter book Message-ID: <38B32884.32FF5A17@gmx.de> ame at swipnet.se (Anders Eriksson) wrote: Hi Anders, > Everything worked fine except when I tried to open the book for >the second time. You're lucky! I bought mine by end of last year and still haven't seen a single line of it :-(( > >I have contacted Fatbrain but they haven't answered. I sent the email >on Sunday the 13:th. So I thougth maybe someone in this group has an >idea on how to get it to work again. Be patient. They need 1 - 2 weeks to answer e-mails. They answered me 3 or 4 times how to download the file - but this has never been my problem, it worked at the first try... If I try to open it, I'm prompted for a password - but I have none, I only have the license key. Does anbody have an idea where to get the password from? I've tried several times to register at their web site, but no success. Today I have downloaded and installed the current english version of Acrobat - now I get an error message like "You already have registered too often" or something like that when trying to register. If I only could buy it as a book or in any other form that works, I would give up to register that *@#?% e-matter... Regards, Arnold From phd at phd.russ.ru Fri Feb 11 10:16:20 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 11 Feb 2000 15:16:20 +0000 (GMT) Subject: PyApache, couldn't geta hold of author, willing to donate sometime In-Reply-To: <38A3DFA2.C1428AF8@columbus.rr.com> Message-ID: On Fri, 11 Feb 2000, Mark Nielsen wrote: > Now, I am new to PyApache, so maybe some of this stuff can be implmented > rather easily (persistent database and SSI), I would just need to be pointed > in the right direction so that I can do it! Some primitive and incomplete persistent mechanics already built in PyApache - look into README. But to make it more like mod_perl PyApache need to be rewritten more like mod_perl. I already mentioned httpdapy, check it out, may be you'll find something there. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From moshez at math.huji.ac.il Fri Feb 18 00:25:05 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 07:25:05 +0200 (IST) Subject: Which GUI? In-Reply-To: <20000217214601.B2438@stopcontact.palga.uucp> Message-ID: On Thu, 17 Feb 2000, Gerrit Holl wrote: > I disagree. The latest gui war was over half a year ago, and > wxPython was abandoned than. But it growed. I'd like to see > an answer to ESR's question: > > Why the hell hasn't wxPython become the standard GUI for Python yet? Here's an easy one: Python is portable. Tkinter is portable. I could code a Python GUI on an AIX machine with a brain dead C++ compiler in half an hour. I couldn't get wxWindows (the basis for wxPython) to compile on that C++ compiler for 2 weeks. Sure, AIX machines are crap. But the beauty of portablility, is that you can still code in the language of your choice on crappy machine. tkinter-forever-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jeremy at cnri.reston.va.us Wed Feb 9 13:16:02 2000 From: jeremy at cnri.reston.va.us (Jeremy Hylton) Date: Wed, 9 Feb 2000 13:16:02 -0500 (EST) Subject: Compiler SIG Message-ID: <14497.44770.245509.906042@goon.cnri.reston.va.us> You are invited to join the Compiler SIG: http://www.python.org/sigs/compiler-sig/ The Web pages about the SIG still need a lot of work, but they provide some indication of the SIG's purpose: This SIG provides a forum for discussing compilation and program analysis issues. Unlike most SIGs, it does not have a specific mandate or deliverable. There are several independent projects to develop compilers, type checkers, and related tools. Ka-Ping Yee took notes on the Dev Day session on compilers. It provides more background about the SIG: http://www.python.org/sigs/compiler-sig/dev-day-notes.txt I am putting together a list of Python compiler and program analysis projects. If you are responsible for such a project, I'd appreciate it if you could send me a URL and a brief description. I'll post the final list on the compiler-sig Web page. Jeremy From gerrit.holl at pobox.com Mon Feb 14 09:19:19 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 15:19:19 +0100 Subject: When to compile regex? In-Reply-To: ; from hildeb@stahlw06.stahl.bau.tu-bs.de on Sun, Feb 13, 2000 at 12:36:38PM +0000 References: <38A69D62.5A68F54D@chelmsford.com> Message-ID: <20000214151918.D658@stopcontact.palga.uucp> Ralf Hildebrandt wrote on 950441798: > On Sun, 13 Feb 2000 07:02:42 -0500, David Shochat wrote: > >In section 4.2.3 of the Python Library Reference (1.5.2) it says that > >using compile is more efficient "when the expresion will be used several > >times in a single program". I'm trying to figure out the intended > >meaning of this. Does that mean "executed more than once", or "occurs > >more than once in the program text"? Specifically, if it only occurs > >once, but that is in a loop, is there an advantage to compiling before > >entering the loop? > > Of course! It's a loop, and a loop may be traversed multiple times. Not necisarryly: >>> for i in range(0): ... print "do something" ... Compiling *in* the loop would be more efficient than compiling outsite the loop :) writing-an-empty-program-is-always-the-fastest-solution-ly y'rs - gerrit From kc5tja at armored.net Fri Feb 18 15:47:01 2000 From: kc5tja at armored.net (Samuel A. Falvo II) Date: Fri, 18 Feb 2000 12:47:01 -0800 (PST) Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: Message-ID: On Fri, 18 Feb 2000, Moshe Zadka wrote: > with the value "x". On the other hand, if the function which was given to > call/cc returns with the value "x", the function which called call/cc also > thinks call/cc returned with value "x". OK, so it's _exactly_ like setjmp/longjmp then -- a threads package. :) -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From pinard at iro.umontreal.ca Mon Feb 7 20:38:58 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 07 Feb 2000 20:38:58 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: Patrick Phalen's message of "Mon, 7 Feb 2000 16:42:15 -0800" References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <00020717051900.00606@quadra.teleo.net> Message-ID: Patrick Phalen writes: > You do have a bit of a nerve coming on this newsgroup and suggesting > that the thousands of serious programmers (many of them former Perl > hackers) who use Python daily do so for the sole reason of a slight edge > in maintainability. Or that Python's popularity is the result of some > unexplainable initial condition. Even if I agree with most of your statements, Patrick, I would hardly say that the majority of users necessarily makes something right. It improves the feeling that it might be, of course, but it is no proof in itself. It surely takes a "bit of nerve", as you say. I respect that, also given that the intent was not to flame nor create any kind of crisis. A bit lost in the discussion, was the call of the original poster for more redundancy in the language. This is a very legitimate concern. My feeling is that, even if Python has less redundancy than some other languages, far enough is still left for Python to be very workable. But yet, developing such feeling and confidence takes time, and taming. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From skip at mojam.com Fri Feb 18 11:42:52 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 18 Feb 2000 10:42:52 -0600 (CST) Subject: shelve broken on redhat 6.1 In-Reply-To: References: Message-ID: <14509.30348.497476.963635@beluga.mojam.com> Wolf> Shelve seems to be broken in Win98 as well, although here it's the Wolf> keys() method that causes an error: Wolf> Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Wolf> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>>> import shelve >>>> SavedGame = shelve.open("Test.psg") >>>> SavedGame.keys Wolf> >>>> SavedGame.keys() Wolf> Traceback (innermost last): Wolf> File "", line 1, in ? Wolf> File "C:\Program Files\Python\Lib\shelve.py", line 55, in keys Wolf> return self.dict.keys() Wolf> bsddb.error: (22, 'Invalid argument') Folks, There was a problem with whichdb.py in the 1.5.2 distribution that would cause anydbm, shelve and other packages that rely on anydbm to fail if anydbm tried to use bsddb and the libdb implementation underlying bsddb was version 2.x. whichdb.py did not correctly detect version 2.x hash files. This has been fixed in the CVS repository. Please try updating whichdb.py before reporting a bug. You can pick up the latest version from http://www.musi-cal.com/~skip/python/Python/Lib/whichdb.py Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From prudek at nembv.cz Thu Feb 24 08:51:28 2000 From: prudek at nembv.cz (Milos Prudek) Date: Thu, 24 Feb 2000 14:51:28 +0100 Subject: system return status on Windows Message-ID: <38B53760.22753DE0@nembv.cz> I cannot get nonzero status from os.system() call in MS Windows. Like this: print os.system('arj a test nonexistent_file') I have verified that errorlevel is raised, but it's never passed back to os.system()... Python 1.5.2, Pythonwin, Win98. -- Milos Prudek From wtanksle at hawking.armored.net Wed Feb 23 15:45:06 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 23 Feb 2000 20:45:06 GMT Subject: Killer Apps References: <88rvhm$efe$1@nntp6.atl.mindspring.net> Message-ID: On 21 Feb 2000 18:18:30 GMT, Aahz Maruch wrote: >Hirsch, John wrote: >>I've always thought that Tim Peters was Pythons killer app.. >No, the Timbot is Python's app killer. Not at all! Tabnanny is Tim's timbot killer. > --- Aahz (Copyright 2000 by aahz at netcom.com) -- -William "Billy" Tanksley, in hoc signo hack From michael.stroeder at inka.de Thu Feb 17 20:21:22 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Fri, 18 Feb 2000 02:21:22 +0100 Subject: derived from CGIHTTPServer.py Message-ID: <38AC9E92.C1CEFEB7@inka.de> HI! I have sub-classed my own CGI-handler from CGIHTTPServer.CGIHTTPRequestHandler and have overriden the method run_cgi to write a persistent stand-alone web gateway. I copied some code from CGIHTTPServer.py and modified it for my needs for method run_cgi. The script (the function HandleHTTPRequest()) runs just fine and outputs everything to the browser without error. But the browser does not stop loading, the connection is not closed. Can somebody figure out what I have to do? Code of sub-class below. Thanks a lot. Ciao, Michael. -------------------- snip --------------------- # Sub-class CGIHTTPServer class MyHTTPHandler(CGIHTTPServer.CGIHTTPRequestHandler): def do_POST(self): self.run_cgi() def send_head(self): return self.run_cgi() def run_cgi(self): dir, rest = '', self.path[1:] i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) content_length_str = self.headers.getheader('content-length') if content_length_str: content_length = int(content_length_str) else: content_length = -1 uqrest = urllib.unquote(rest) HandleHTTPRequest( self.command, self.server.server_name, self.server.server_port, scriptname, uqrest, query, content_length, self.headers.getheader('user-agent'), string.split(self.headers.getheader('accept-charset'),',')[0], self.client_address[0] ) sys.stdout.flush() self.wfile.flush() return  -------------------- snip --------------------- From gmcm at hypernet.com Fri Feb 4 14:05:45 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 4 Feb 2000 14:05:45 -0500 Subject: Special Interest Group: Import redesign In-Reply-To: <87f544$6jo$1@nntp9.atl.mindspring.net> Message-ID: <1262431355-954315@hypernet.com> (posted & mailed) Aahz asks: > In article <1262439853-442703 at hypernet.com>, > Gordon McMillan wrote: > > > >As a result of the Developer's Day session on Import Uitilities, > >a new SIG (the import-SIG) has been formed. The goal is a > >new architecture for the import facility in Python. > > To what extent is this SIG intended to cover the topics of packages and > using a central codestore with DLLs on multiple platforms? (The latter > topic is more what I'm personally interested in.) Packages are certainly central to the discussion (the complexity of multi-level packages are a good part of the reason the current system is groaning). This morning I posed the question of which of the following are in scope: - heterogeneous network installations - homogeneous network installations - multiple (conflicting) installations I think the latter two are good candidates (mainly because they're fairly easily handled). The first is a much harder problem which, I suspect, most *normal* people would prefer to sweep under the rug . louder-Aahz-you're-sounding-very-muffled-ly y'rs - Gordon From Roberto.Lupi at ascu.unian.it Tue Feb 8 05:19:55 2000 From: Roberto.Lupi at ascu.unian.it (Roberto Lupi) Date: Tue, 8 Feb 2000 11:19:55 +0100 Subject: Database for storing heterogeneous "message" objects References: Message-ID: In article , jstok at bluedog.apana.org.au says... > I want to use a database to store sets of heterogeneous "message" objects, > which currently cover email and news messages, but will be extended more > generally to include messages in web-accessible archives and other > "email-like" things. Queries can be made on a message database based on > their header properties. You can use ZODB, the OODBMS that is the basis of Zope - IMHO it fits your requirements nicely. > defined for all messages. I want to allow queries on optional headers -- if > a header is defined for a message, any selection rule based on that message > will be applied to it, otherwise the test automatically fails. You can use ZCatalog. -- Roberto Lupi From Gaetan_Corneau at baan.com Mon Feb 7 10:27:38 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Mon, 7 Feb 2000 10:27:38 -0500 Subject: Insecure string pickle? Message-ID: <816010E2456BD111A48700805FBBE2EE01C6047B@ex-quebec-u1.baan.com> Hello, I have put objects (magazine routing lists) in a shelf. I can list all the keys, and I can load all objects except one. When I try to load a particular list (using it's name), I get the following error message: ValueError: insecure string pickle What does that mean? TIA, ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a+ C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From effbot at telia.com Thu Feb 17 03:35:15 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 08:35:15 GMT Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <14507.16040.591126.119029@anthem.cnri.reston.va.us> Message-ID: <7pOq4.121$mYj.170920448@newsa.telia.net> Barry A. Warsaw wrote: > FL> lazyness? > > Exactly right. They weren't coded as C in stropmodule.c so they > didn't make it in the first go 'round of string methods. I think we > later decided that they weren't used enough to care about. Note that > JPython's string objects don't have these methods either. well, string.expandtabs is implemented in C these days (for performance reasons). and center/ljust/rjust are really trivial to implement. (so is capwords, but I'm not really sure about that one). anyway, you don't have to implement them yourself. just nick the code from the unicode string type, and change the character type to "char". From hnourigat at wsg.fr Thu Feb 17 06:07:10 2000 From: hnourigat at wsg.fr (hnourigat at wsg.fr) Date: Thu, 17 Feb 2000 11:07:10 +0000 Subject: Questions about Python Message-ID: <38ABD65E.D73344F3@wsg.fr> Hi, I am a new user of Python and I have some questions : - What is the memory usage of the Python core (and the memory fragmentation) ? - What is the speed performance for standard use ? - When I use the multi-thread, is there possible to avoid platform (windows or unix) thread ? Thank You. Hubert. From ullrich at math.okstate.edu Sat Feb 12 13:32:28 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Sat, 12 Feb 2000 12:32:28 -0600 Subject: Docstrings References: <20000212143634.A3241@stopcontact.palga.uucp> Message-ID: <38A5A73C.AD90F44A@math.okstate.edu> Gerrit Holl wrote: > Hello, > > I wrote a function help() which prints the docstring of an object > to stdout, and prints a notice otherwise. But I want to distinguish > between types without docstrings or objects without docstrings > which could have a docstring. > > I found some documentation in the language reference: > > http://www.python.org/doc/current/ref/types.html#l2h-97 > > Callable types > These are the types to which the function call operation (see > section 5.3.4, ``Calls'') can be applied: > > User-defined functions > [stuff about user-defined functions, including __doc__.] > > So this applies to all callable objects, I thought. The indentation would seem to suggest it applies to user-defined functions. In any case, I don't see what you're confused about - the part you quote says that various things _do_ have __doc__ attributes, it says nothing to the effect that these are the _only_ things with __doc__ attributes. Various other things do - nothing in the docs says otherwise. > > But now, I noticed this: > >>> t = type('') > >>> callable(t) > 0 > >>> t.__doc__ # strange, no error > >>> None.__doc__ > Traceback (innermost last): > File "", line 1, in ? > AttributeError: 'None' object has no attribute '__doc__' > >>> open('/dev/null').__doc__ > Traceback (innermost last): > File "", line 1, in ? > AttributeError: __doc__ > >>> [].__doc__ > Traceback (innermost last): > File "", line 1, in ? > AttributeError: __doc__ > >>> f = Foo() > >>> callable(f) > 0 > >>> f.__doc__ # not callable but does have a docstring > 'docstring' > > Am I confused, is it an implementation bug or is it a documentation bug? Suppose you read somewhere that a horse had four legs. Now suppose you noticed that cats have four legs. Would that be a bug in the reference where you read about the quadripeditude of horses? > > regards, > Gerrit. > > -- > Homepage: http://www.nl.linux.org/~gerrit > -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com > Version: 3.12 > GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O > !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y > -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From pinard at iro.umontreal.ca Thu Feb 17 10:09:54 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 17 Feb 2000 10:09:54 -0500 Subject: Which GUI? In-Reply-To: "J.C.Travers"'s message of "Thu, 17 Feb 2000 14:14:28 +0000" References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: "J.C.Travers" writes: > Anders M Eriksson wrote: > > I would like pro and cons for the different GUI's > This is a hot topic, and you will get as many different answers as > people you ask, so all I can give is my personal opinion. > Firstly, I would advise against Tkinter. [...] The best GUI in my opinion > is pyQT. [...] Alternatively there is wxPython. [...] I notice that you forgot to mention `pygtk'. Couldn't we say that it is comparable to pyQT, more or less? -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From moshez at math.huji.ac.il Mon Feb 14 03:21:49 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 10:21:49 +0200 (IST) Subject: range(start,stop) In-Reply-To: Message-ID: On Mon, 14 Feb 2000, Mikael Olofsson wrote: > On 11-Feb-00 Moshe Zadka wrote: > > range(0, n) is a list with n elements, so > > > > for i in range(0, n): # equivalent to range(n) > > print "hello" > > > > will print "hello" exactly n times. > > This behavour of range doesn't bother me (any more), but your example > isn't really that good. It would be just as readable and logical to > let range stop at stop as the original poster wanted, i.e. range(1,n) > could be a list of n elements and > > for i in range(1, n): > print "hello" Oh, I thought it was clear range has to start at 0 for the following pydiom to work for i in range(len(l)): l[i] = l[i] + 1 Of course, if you decide lists start at 1, then range should stop at n, but FORTRAN is (almost) dead and buried ;-) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sabren at manifestation.com Sun Feb 6 22:01:23 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 6 Feb 2000 22:01:23 -0500 Subject: Database for storing heterogeneous "message" objects References: Message-ID: <87lcir$dpt$1@nntp5.atl.mindspring.net> Jason Stokes wrote in message ... >The Python standard relational database API doesn't quite fit this domain >because the structure of such a database isn't quite tabular. Although the >messages will have certain mandatory headers like from, subject etc. in >common, individual messages will also have optional headers that aren't >defined for all messages. I want to allow queries on optional headers -- if >a header is defined for a message, any selection rule based on that message >will be applied to it, otherwise the test automatically fails. Hey Jason, Sounds like you want an object oriented database... dunno how to talk to any of those from python.. but you can sort of simulate this without abandoning the RDBMS model by using 1:1 joins.. for example: create table message ( ID int not null auto_increment primary key, messagetype : varchar(32) -- (or whatever) whoFrom varchar(50), whoTo varchar(255), subject varchar(255) content text ) create table special_message1 ( ID int not null auto_increment primary key, messageID int not null unique, specialfield1 varchar(255) ) create table special_message2 ( ID int not null auto_increment primary key, messageID int not null unique, specialfield1 varchar(255) ) ######### or... if you have a bunch of different fields you could do this: create table message ( ... same as above ... ) create table specialfield ( ID ... specialfield varchar ) crate table message_specialfield ( ID ... messageID ... specialfieldID ... value varchar ) .... depending on how smart your RDBMS is, finding a message might take several queries, but you could encapsulate all of it in a generic class... -Michal Wallace sabren at manifestation.com From tuttledon at hotmail.com Wed Feb 23 21:24:53 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Thu, 24 Feb 2000 02:24:53 GMT Subject: Pythonwin (Version 2 beta 3) References: Message-ID: Calishar wrote in message news:fi39bsorbi6ctatr23r4ondoj0bh3nttj7 at 4ax.com... > Hi Folks, > > I think I have run across a bug in Pythonwin (from win32all-128), > and am posting a message in here to see if others have run across it, > or if Mark is already aware of it. > > When printing a python source file using pythonwin (I like the > shades of grey) it prints out all but the last page. Ran into the same problem earlier today and email Mark about it. > Also, I think I have a bug when the interactive window is docked. I > think that if it is the active window (and maybe one or two other > criteria) pressing ctrl-W will cause the whole pythonwin app to > freeze. I tried right-clicking the icon in the system tray and > selected 'Break into Running code' but it didn't help either. Had a similar lockup but never figured out the reason. > By the way, I just want to say thank you to Mark for all the work he > has put in making Python programming on Win32 an easier task, win32all > is a great package, and the book looks pretty great too. Couldn't agree with you more. I just hope the rampant capitalism at ActiveState doesn't corrupt him. ;-) Don Tuttle (newbie lurking in the shadows for the past month...) From btang at pacific.jpl.nasa.gov Fri Feb 18 15:26:02 2000 From: btang at pacific.jpl.nasa.gov (Benyang Tang) Date: Fri, 18 Feb 2000 12:26:02 -0800 Subject: python online help? Message-ID: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov> Is there a online help in python? Say something like help print would give document of the print command. From effbot at telia.com Wed Feb 16 16:40:16 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 21:40:16 GMT Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> <88f1lr$ola$1@nntp4.atl.mindspring.net> Message-ID: <4PEq4.89$mYj.181656576@newsa.telia.net> Michal Wallace wrote: > Fredrik Lundh wrote in message ... > >the problem here is that you'll evaluate the > >expression in the function's own namespace, > >not the callers. > > > >(you can use trickery or guile to get around > >that, but I won't post that solution...) > > Okay, I give up... How do you: > > a) know what the caller's namespace even IS > b) evaluate something in that namespace? look carefully: import sys def magic_eval(s): try: raise None except: frame = sys.exc_traceback.tb_frame.f_back return eval(s, frame.f_globals, frame.f_locals) > Wouldn't that be useful in general for > experimenting with language enhancements, > even if the code were a little hairy? sure. if you know what you're doing ;-) def run_me(): a = "it " b = "works!" print magic_eval("a+b") From skip at mojam.com Thu Feb 17 15:22:35 2000 From: skip at mojam.com (Skip Montanaro) Date: Thu, 17 Feb 2000 14:22:35 -0600 (CST) Subject: zope search on external html tree In-Reply-To: <88hj3p$mru$1@license1.unx.sas.com> References: <88hj3p$mru$1@license1.unx.sas.com> Message-ID: <14508.22667.68390.475873@beluga.mojam.com> Tim> If there's a way to configure zope to include an external HTML tree Tim> in its 'search'able domain, I haven't found it. As I recall from a similar thread recently, you need to write an external method to grab files from the filesystems. Once you read the file I have no idea how you'd feed its contents to the internal zope machinery for indexing. You might want to browse the copious numbers of HowTo documents on the Zope web site for details about writing external methods. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From scherbi at bam.com Fri Feb 4 07:00:21 2000 From: scherbi at bam.com (Bill Scherer) Date: Fri, 04 Feb 2000 07:00:21 -0500 Subject: Python on S/390 Message-ID: <389ABF55.CFD3A800@bam.com> I was at LinuxWorld Expo yesterday and saw Linux running on an S/390 (200 mips, 180GB dasd, 4GB RAM). On a whim I typed 'python', and lo and behold, I got a python prompt. (after a delay of about .0000000000000000001 seconds!) Hurray for Python! -- William K. Scherer Sr. Member of Applications Staff Bell Atlantic Mobile From dgrisby at uk.research.att.com Wed Feb 2 05:46:01 2000 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 2 Feb 2000 10:46:01 -0000 Subject: Porting omniORB python to OpenVMS References: <877rom$akl$1@nnrp1.deja.com> Message-ID: <8791t9$f19$1@pineapple.uk.research.att.com> In article <877rom$akl$1 at nnrp1.deja.com>, wrote: >I have been attempting to port the omniORB python CORBA mapping >(omniORBpy) to OpenVMS and I think I need some help. I don't know anything about VMS, but I wrote omniORBpy. [...] >import _omnipy # builtin >Fatal Python error: PyThreadState_Get: no current thread Is the Python interpreter built with thread support? If it isn't, omniORBpy should complain in a friendly way, but maybe the detection doesn't work on VMS for some reason. (Alternatively, you're trying to import _omnipy directly, rather than importing the omniORB module which emits the complaint.) Can you successfully import the threading module? Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From gmcm at hypernet.com Fri Feb 25 08:45:10 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 25 Feb 2000 08:45:10 -0500 Subject: os.path.walk (was: Re: Optimizing code) In-Reply-To: References: Gerrit Holl's message of "Fri, 25 Feb 2000 07:48:54 +0100" Message-ID: <1260636186-9134394@hypernet.com> Fran?ois Pinard writes: > This has bothered me several times already, in Python. Perl has a device > caching the last `stat' result, quite easy to use, for allowing users to > precisely optimise such cases. In many cases, the user has no reason > to think the file system changed enough, recently, to be worth calling > `stat' again. Of course, one might call `stat' in his code and use the > resulting info block, and this is what I do. But does not interface well > with os.path.walk. Python has the statcache module. os.path.walk does not use it. > It would be nice if the Python library was maintaining a little cache for > `stat', and if there was a way for users to interface with it as wanted. > > By the way, the `find' program has some optimisations to avoid calling > `stat', which yield a very significant speed-up on Unix (I do not know > that these optimisations can be translated to other OS-es, however). > Could os.path.walk use them, if not already? The main trick is to save > the number of links on the `.' entry, knowing that it we have one link > in the including directory, one link for the `.' entry itself, and one > `..' link per sub-directory. Each time we `stat' a sub-directory in the > current one, we decrease the saved count. When it reaches 2, we know > that no directories remain, and so, can spare all remaining `stat' calls. > It even works for the root directory, because the fact that there is no > including directory is compensated by the fact that `..' points to `/'. > > I surely often use `os.path.walk' in my own things, so any speed improvement > in that area would be welcome for me. There's also a dircache module, which caches os.listdir output, and stats the directory to see if the cache is still valid. These tricks get wildly platform specific though. In my experience on Windows, to get a valid stat on a directory, you need to stat some file in that directory. Also, the resolution on WIndows is 2 secs - so if the cache is less than 2 seconds old, you can't assume it is valid. - Gordon From Roberto.Lupi at ascu.unian.it Sat Feb 19 18:06:24 2000 From: Roberto.Lupi at ascu.unian.it (Roberto Lupi) Date: Sun, 20 Feb 2000 00:06:24 +0100 Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> <887osh$1rv$1@nntp6.atl.mindspring.net> Message-ID: In article <887osh$1rv$1 at nntp6.atl.mindspring.net>, aahz at netcom.com says... [binary tree traversal implemented with Icon-like suspend] > >I'm sorry, but I can't follow this code at all. What are the precise > >semantics of suspend here? How does it return? > > suspend *is* a return. It also -- at the same time -- stores the > program counter for b.traverse_post(), so that the next call to > b.traverse_post() starts at the line of execution immediately following > the suspend. This means that, should someone be foolish enough to call > b.traverse_post() inside the loop "for leaf...", the loop will probably > return incorrect results, just like modifying a list while you iterate > over it. No it can and should have different semantics (IIRC in Icon the semantic of suspend is different from what you have described). What Tim calls "the next call" is better expressed as "the next activation": every call to a function that suspends can return multiple values as results, the first result is computed (up to the suspend statement) and this result is returned, when that specifica call to the function is reactivated the code restart as if there was no suspend statement until suspend is executed again or the function exists. A new call to the "resumable function" do _not_ share the stack saved with a different call to the same function. -- Roberto Lupi IT Consultant Software Developer From bobNOSPAM at NOSPAMzippyhelp.com Sat Feb 5 21:11:53 2000 From: bobNOSPAM at NOSPAMzippyhelp.com (Robert Rutkowski) Date: Sun, 06 Feb 2000 02:11:53 GMT Subject: CGI Scripts References: Message-ID: The aforementioned file exists and the permissions are set to 777, so that's not it. Thanks anyway... "Brad Howes" wrote in message news:m3d7qbt8zw.fsf at h0050047c4794.ne.mediaone.net... > "Robert Rutkowski" writes: > > > count = open('counter.log', 'r+') > > When the web server runs your script, you may not have permissions to this > file. Check that. > > Brad > > -- > "Were people this stupid before TV?" -- _White Noise_ by Don DeLillo > From jimc at regnoc.com Fri Feb 4 13:44:03 2000 From: jimc at regnoc.com (Jim Conger) Date: Fri, 04 Feb 2000 18:44:03 GMT Subject: Python MySQL.connect() [resolved] References: <3893CD31.B17E8B84@regnoc.com> <870tjf$514$1@news1.xs4all.nl> <3894737C.A676BC16@regnoc.com> <381BAA74.863A8048@cs.rmit.edu.au> <874ejr$35o$1@news1.xs4all.nl> <381ED7A5.DF5C510D@cs.rmit.edu.au> <87b8e8$cpv$1@news1.xs4all.nl> Message-ID: <389B1DA8.B659F64A@regnoc.com> I finally figured out the problem. It turns out that old libc library versions interfere with the mySQL security logic. The result is that logical names for devices, such as "localhost" and the machine name are not recognized. Simply upgrading to the latest libc library solved the whole problem. Thank you to everyone for help on this. Jim C. Boudewijn Rempt wrote: > Hafeez Bana wrote: > <...> > > Mysql can be told what kind of communication it uses. In your case Mysql > > maybe listening on a unix socket and so localhost works - this was not > > the case with my configuration of Mysql. I hope you get what I am > > saying. > > That's interesting - I didn't know that at all. > > -- > > Boudewijn Rempt | http://www.valdyas.org -- Jim Conger Project Manager Silicon Valley Oil Co. jimc at regnoc.com, 925-842-6729 -------------- next part -------------- An HTML attachment was scrubbed... URL: From newsbunny at noether.freeserve.co.uk Sat Feb 12 06:07:52 2000 From: newsbunny at noether.freeserve.co.uk (Martin P Holland) Date: Sat, 12 Feb 2000 11:07:52 +0000 Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: <883cm6$mud$1@news1.xs4all.nl> Message-ID: On 12 Feb 2000 10:29:26 GMT, Boudewijn Rempt wrote: >Hardcoded for now, though the documentation tells you where to change >it to your editor of choice... It took all of four hours to do that. >Oh, my version of the classbrowser-that-opens-my-preferred-editor >is at http://www.valdyas.org/python/kpybrowser.html. It only works >with KDE, since that's my preferred development environment. There >are a few bugs, but it works well enough to use daily. It looks good (and it was easy to swap to my preferred editor). atb Martin -- http://www.noether.freeserve.co.uk http://www.kppp-archive.freeserve.co.uk From kens at sightreader.com Sun Feb 27 17:23:02 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 14:23:02 -0800 Subject: Phython as In-Game scripting language References: <20000224155917.81782.qmail@hotmail.com> Message-ID: <38B9A3C6.9CFA5FF8@sightreader.com> Yes. Threads work fine in regular python. I don't know much about MT and SP except that MT is good if you want a large number of threads and you don't want to pay a lot of overhead for creating and destroying them. Shawn LeBlanc wrote: > Greetings! > > Just so I understand (and because my programmer teammates are > asking me questions) is plain vanilla Python (no stackless or > microthread) unable to run multiple scripts simultaneously? > > I'm thinking no because if Python did support running multiple > scripts at the same time, there wouldn't be any need for > SP or MT's. I just wanted a clear answer on that. > > Besides Crystal Space and Alice, has Python been used in any > commercial games? > > I checked out Alice and it's pretty nice, but I wasn't able to > get any information on how they implemented Python. It is neat > in the way that my nephew could go and build 3D scenes, though. > > with milk and cookies, > Shawn > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com From gerrit at nl.linux.org Tue Feb 29 08:49:57 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Tue, 29 Feb 2000 14:49:57 +0100 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) In-Reply-To: ; from effbot@telia.com on Tue, Feb 29, 2000 at 10:35:29AM +0000 References: <3326DD1EE2F0A189.8CE210DACA89D440.29CA859F010483DB@lp.airnews.net> <20000229110221.A2042@nl.linux.org> Message-ID: <20000229144957.A22616@nl.linux.org> > Gerrit wrote: > > > http://www.deja.com/=dnc/getdoc.xp?AN=589175052 > > > > http://www.python.org/pipermail/python-list/2000-February/046654.html > > > > Why do you link the pipermail archive sometimes but not always? > > does it matter? you're supposed to click on the link if > you find something that might interest you, not decipher > the link itself. Not everybody uses a browser for their mail, I don't. I find the pipermail link far more readable so much easier to type over in my browser (yes, cut 'n' paste from console to X doesn't work by me, unfortunately). > (due to the intricate design of usenet, some messages don't > make it through to the deja.com archive. in other cases, the > link collector stumbles upon something in a different context, > and doesn't bother to look for it in deja.com) > > > > Suggestions/corrections for next week's posting are always welcome. > > > http://www.egroups.com/list/python-url-leads/ > > > > Can't this list be hosted at one of python.org/starship.python.net? > > It looks a bit [I-don't-know-how-to-say-it-in-English] to me... > > afaik, that link is obsolete. if you want to submit something > to the URL, post something interesting to comp.lang.python > (or mail it to python-list at python.org), and hope that the link > gathering bot picks it up. the bot reserves the right to (yada > yada). I see. > (besides, egroups is python powered. even python zealots can > use it and still sleep well at night) Yes, I know. But many people disdain free services like egroups, (and hotmail). I don't, but many people do. (is 'disdain' used right here, by the way?) regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From PClaerhout at CREO.BE Wed Feb 9 11:26:59 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 9 Feb 2000 17:26:59 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70EA@MSGEURO1> Where you we get it? P. -----Original Message----- From: bparsia at email.unc.edu [mailto:bparsia at email.unc.edu] Sent: Wednesday, February 09, 2000 5:15 PM To: python-list at python.org Subject: Re: Whitespace as syntax (was Re: Python Rocks!) Thomas Hamelryck wrote: [snip] > I never seriously tried out smalltalk because I could not get a good free > smalltalk implementation, not because of its weird syntax. I still miss a > lot of functionality in Squeak, but if that is added I will certainly give > it a go. Just FYI, there is a non-commercial (though not open source) version of VisualWorks 5i. Very cool environment. They've added rather nice XML/XSL support. It's certainly worth playing with. Cheers, Bijan Parsia. -- http://www.python.org/mailman/listinfo/python-list From j.spies at hccnet.nl Wed Feb 2 17:55:49 2000 From: j.spies at hccnet.nl (Jaap Spies) Date: Wed, 02 Feb 2000 23:55:49 +0100 Subject: Python Poetry (why indentation?) Message-ID: <3898B5F5.B08DCBD2@hccnet.nl> # Contribution to the forever lasting discussion on indentation! # After Petrarca, Shakespeare, Milton, Drs. P and many, many others, # a sonnet has 14 lines and a certain rhyme scheme. # Jacques Bens presented in 1965 in Paris the pi-sonnet with # 3,1,4,1 and 5 lines, but the ultimate pi-poem I found in # Brown's Python Annotated Archives p. 12: # Based on a algorithm of Lambert Meertens (remember those days of the # B -> ABC-programming language!!!) import sys def main(): k, a, b, a1, b1 = 2L, 4L, 1L, 12L, 4L while 1: p, q, k = k*k, 2L*k+1L, k+1L a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 d, d1 = a/b, a1/b1 while d == d1: output(d) a, a1 = 10L*(a%b), 10L*(a1%b1) d, d1 = a/b, a1/b1 def output(d): sys.stdout.write(`int(d)`) sys.stdout.flush() main() # Reading/writing Python source often gives me the impression of # reading/writing a poem! # Layout, indentation, rythm, I like the look and feel! # What does this tiny program do? It is not a sonnet, even not a # pi-sonnet, but it surely produces Pi! # The poem ( sorry, the program) needs some explanation. # As a mathematician I recognize the continued fraction, odd/even, # squares and all that matters. # But it is a miracle! A few lines of Python code producing # a infinity of pi-digits! # Jaap Spies # Hogeschool Drenthe # Keep Peace in Mind From fdrake at acm.org Fri Feb 11 13:09:33 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 11 Feb 2000 13:09:33 -0500 (EST) Subject: Comparing file objects: what is compared? In-Reply-To: <20000211165155.A4849@stopcontact.palga.uucp> References: <20000211165155.A4849@stopcontact.palga.uucp> Message-ID: <14500.20573.885719.892991@weyr.cnri.reston.va.us> Gerrit Holl writes: > >>> fp1=open('/tmp/file_one', 'w') > >>> fp2=open('/tmp/file_two', 'w') > >>> cmp(fp1, fp2) > -1 > >>> cmp(fp2, fp1) > 1 > > What is compared? The date of creation? The filename? The contents? The ID is used for when nothing else is meaningful (and clear). It's arbitrary & consistent. ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From mikael at isy.liu.se Fri Feb 11 07:24:06 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Fri, 11 Feb 2000 13:24:06 +0100 (MET) Subject: Find word In-Reply-To: <000801bf7489$4ed22640$6c00a8c0@ruidovisual.pt> Message-ID: On 11-Feb-00 Pedro Silva wrote: > I have a file, that is a text file that is in teh filesystem. I need to > get some lines in that file, and for that I need to find some words. For > example, in that file I know that I have the words: From, Subject, Date > and Xref and I need the text that is after this words. > How can I find these words? string.find(s,sub[,start[,end]]) is your friend. /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-Feb-00 Time: 13:22:10 This message was sent by XF-Mail. ----------------------------------------------------------------------- From embed at geocities.com Thu Feb 10 14:02:45 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 10 Feb 2000 14:02:45 -0500 Subject: Python on Phar Lap ETS (RTOS) - Success! Message-ID: Is anyone on this list interested in Python running on a realtime embedded operating system from www.pharlap.com called the "Phar Lap TNT Embedded Tool Suite (ETS) Realtime Edition". I have recently completed a recompile from the Win32 sources and run some tests to see if Python survived. It took about a day to get it working, and compile static libraries. If anyone else is interested in working on this, or even on another Win32 subset operating system. (Windows CE is much more involved to port due to the pervasive use of Unicode throughout Windows CE.). Next step is to build some extensions that access the internals of Pharlap, excercise the multithreading libraries to make sure they work well, and so on. If my boss approves, I am going to be using Python in our embedded monitoring products. If I can get permission from the Big Cheeze, I will join PSA and put up a page on Python/PharLap. (Hmm... I think WHOPHARTED.lib would be a good name for it, don't you?) Warren Postma ZTR Control Systems From newsgroup at 1mactod.com Wed Feb 16 20:29:06 2000 From: newsgroup at 1mactod.com (wes) Date: Wed, 16 Feb 2000 15:29:06 -1000 Subject: Troubleshooting installing Python 1.5.2 on BSDI 3.1 virtual server account Message-ID: <88fium091h@enews4.newsguy.com> Greetings, Trying to get Python 1.5.2 to make and install on a BSDI 3.1-based virtual server account at an IPP for the past two weeks and no luck! And Zope was installed and running on my Win98 PC in less than 5 minutes! Yeow! Currently getting the following error on BSDI 3.1: gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ ./importdl.c ./importdl.c:269: mach-o/dyld.h: No such file or directory *** Error code 1 Administrator assisted me in installing 'gmake', 'gcc', and 'install' locally and using 'virtual sh' command but still no luck. End up with a different error: gmake[1]: Entering directory `/usr/local/Python-1.5.2/Python' gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ ./importdl.c /usr/libexec/cpp: Cannot fork gmake[1]: *** [importdl.o] Error 1 gmake[1]: Leaving directory `/usr/local/Python-1.5.2/Python' gmake: *** [Python] Error 2 $ Tried following the HOWTO for BSDI 4.X but doesn't seem to work unless I'm following it wrong: http://yyy.zope.org/Members/BitDancer/bsdi4_x_install How-To: Installing Zope under BSDI 4.x Created by BitDancer. Last modified on 1999/11/08. Apparently between BSDI 3.x and BSDI 4.x the way shared libraries are done was improved. Python as of 1.5.2 is not aware of this change. This means that the compilation of the Zope dynamic modules fails. The fix is simple, and has been reported to the Python newsgroup, so hopefully this HOWTO will be obsolete in the near future. To compile Zope under BSDI 4.x, you have to get your Python installation done right. After that Zope compiles without a hitch. Not being a Configure guru, I'm not sure where the neccessary changes go to make the fix correctly. So I'll just tell you how I did it: Run configure with the --with-threads option. Make sure you have edited Modules/Setup to uncomment the line specifying that modules be built for dynamic loading. Try to make Python. It fails. Edit Modules/Makefile and change the following three lines to appear as indicated here:: LDSHARED= gcc -shared CCSHARED= -fpic LINKFORSHARED= -Xlinker -export-dynamic Make python. It should work, and the corrected version of the Makefile should get copied to the [pythonlib]/config directory. At this point, Zope should build correctly. Note that there is a bug somewhere (probably in BSDI) that causes the Python make test to hang in the signal test. This does not appear to impact Zope. Tried python.org and zope.org and weblogs.userland.com/zopeNewbies/ but no luck on BSDI information. Help! Thanks! From wlfraed at ix.netcom.com Wed Feb 2 22:45:19 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Wed, 02 Feb 2000 19:45:19 -0800 Subject: Case Sensitivity and Learnability References: <878j9k$vpe$2@thoth.cts.com> <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> <879phb$13i0$1@nntp6.u.washington.edu> Message-ID: <+=WYOCONuPIaOTkVPs+1rT6yM5sy@4ax.com> On 2 Feb 2000 17:29:15 GMT, Donn Cave declaimed the following in comp.lang.python: > will Python 2.0 have for them? Wouldn't it be nice if it could > accept MessageRecieved as a valid spelling for MessageReceived, > for example? > What if it was (unwise, but...) deliberate? I recall a FORTRAN porting job nearly 20 years ago. Program went from a decent FORTRAN IV to a system with minimum F-IV (or, as I referred to it, FORTRAN minus-2; Microsoft F-80 on CP/M was more powerful). The target system could not compile statements of the form: call xyz(a, a+1, b(a), b(a+2)) which had to be converted to: jinx = a+1 linx = a+1 call xyz(a, jinx, b(a), b(linx)) Some calls made use of four or five junk temporaries -- imagine every spelling of {j|l|m| }{i|y}nx appearing in a file... Imagine the mayhem if the compiler attempts to "correct" these to a common set. -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From david at essi.fr Thu Feb 24 07:44:48 2000 From: david at essi.fr (Pierre-Charles David) Date: 24 Feb 2000 13:44:48 +0100 Subject: Argo / Python / UML design tools References: Message-ID: ebecker at software-manufaktur.de (Edelhard Becker) writes: > Hi Greg, > > On Mon, 14 Feb 2000 13:11:23 -0500, Greg Wilson wrote: > > Is anyone working on UML design tools that are Python-friendly? > > More specifically, has anyone taken a look at Argo > > (http://www.ics.uci.edu/pub/arch/uml/) with an eye to making it > > understand Python? If so, I'd be grateful for a ping... > > "Together" (http://www.togethersoft.com/index.htm) is implemented in > Java and comes with JPython. Unfortunately it's not cheap ... Same for ObjectDomain (http://www.objectdomain.com). -- Pierre-Charles David (david at essi.fr) From skip at mojam.com Wed Feb 9 20:30:55 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 9 Feb 2000 19:30:55 -0600 (CST) Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87st5i$7hd$1@bob.news.rcn.net> References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87np2g$kc8$1@nntp1.atl.mindspring.net> <87st5i$7hd$1@bob.news.rcn.net> Message-ID: <14498.5327.802950.656207@beluga.mojam.com> David> ... but as someone who in the past has occasionally wasted an David> hour trying to fix a broken makefile because of some tab/space David> mixup, I'm staying vigilent. That's a somewhat different problem. In make tabs and spaces are indeed treated differently. Where a tab is needed, a space won't do at all. David> So my point is that what is needed is not religious wars but David> advice from the experienced on how they avoid the pitfalls and David> continuing refinement in the programming tools that keep us David> programmers from having to worry about these things. Two suggestions: 1. Use CVS, sccs, RCS or some similar tool to manage your source code. That gives you a benchmark against which to check your code. In the six years I've been using Python, I've only needed to correct indentation botches a couple of times. If you use Emacs, I recommend you look at ediff-revision as an excellent way to compare a file's current version with earlier revisions. 2. Use python-mode (in Emacs/XEmacs) if you don't already. Other text editors (vim, BBedit, Alpha, etc.) have support for indenting blocks of code automatically. Search the archives for your favorites. I assume Emacs+python-mode in what follows. Select the block you want to reindent, then use C-c > or C-c < to rigidly change the indentation of the selected block. This works well with pasted blocks as well. When you paste a block of text into the midst of another block, simply hit C-x C-x to reselect the region (I use XEmacs, which doesn't automatically select yanked text - GNU Emacs may not require this), then hit C-c > or C-c < as required to get that block of text to line up properly with the surrounding code. (Internally, it should already be correct unless there was a problem with it before the cut.) Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From skip at mojam.com Sat Feb 12 06:21:56 2000 From: skip at mojam.com (Skip Montanaro) Date: Sat, 12 Feb 2000 05:21:56 -0600 (CST) Subject: data structure design question In-Reply-To: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> Message-ID: <14501.16980.66698.125788@beluga.mojam.com> Felix> I'm thinking of trying to do some chemistry stuff in Python, and Felix> one of the things I was thinking of was to define a Chemical (or Felix> Molecule) object. Before you go too far, you might want to investigate Konrad Hinsen's Molecular Modelling Toolkit: http://starship.python.net/crew/hinsen/MMTK/ I think you'll find Konrad has advanced well beyond the "thinking" stage of the project... ;-) Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From python at channel21.com Fri Feb 25 10:27:17 2000 From: python at channel21.com (Channel21 Python Team) Date: Fri, 25 Feb 2000 10:27:17 -0500 Subject: More IIS crashing and blank .asp pages Message-ID: <81DD38F43381D111BA3E00A076A0998A459F5E@XENON> I tried once deleting all the .pyc files, but that only made the server keep crashing, so I had to reinstall python (guess I was overaggressive in my deletions... > ---------- > From: Guido van Rossum[SMTP:guido at cnri.reston.va.us] > Sent: Friday, February 25, 2000 9:59 AM > To: python-list at python.org > Subject: Re: More IIS crashing and blank .asp pages > > Jason Nadler writes: > > > OK, I thought I fixed the crashing bug by stepping up to the newest > Python > > language version (as well as the win32 extensions). > > Now, my server is spitting out blank .asp pages for those which use > python. > > I wonder if this could be related to a bug that was recently discussed > on the win32 registered users list? > > It turned out that some process generating .py and .pyc files for COM > usage was so fast that the second time the .py file was written, it > has the same timestamp as the first time; this caused the .pyc file > not to be written. Since the first .py version didn't have any code > in it, the .pyc file was pretty minimal. Solution was to delete the > .pyc files... > > --Guido van Rossum (home page: http://www.python.org/~guido/) > -- > http://www.python.org/mailman/listinfo/python-list > From bpr at shell5.ba.best.com Thu Feb 3 12:08:11 2000 From: bpr at shell5.ba.best.com (Brian Rogoff) Date: Thu, 3 Feb 2000 09:08:11 -0800 Subject: Readable Functional Languages In-Reply-To: References: <87aerv$2d6$1@vvs.superst.iae.nl> Message-ID: On Thu, 3 Feb 2000, Alexander Williams wrote: > On 3 Feb 2000 00:33:19 +0100, Carel Fellinger wrote: > >Admittedly off topic, I would like some advice on what language to choose > >to explore the realm of functional languages given that I can't cope with > >'impure' languages like C, C++ and Perl and that I love Python mostly for > >its readability and its adherence to the principle of least surprise that > >lures me into thinking that it has no dark corners. > > You really have two /good/ choices: More than two, really. > If you're a traditionalist and parens don't scare you, Scheme is a > really good platform for exploring functional programming. Its not a > 'pure' language, as such, but it can be programmed in a very pure > style. Given this, Dylan is also a good choice. Not pure functional, but it has higher order functions which are the sine qua non of FP. > If you're more daring, you can give Haskell a shake. It /is/ a pure > functional language and, as such, has some wackiness around state and > external IO, but it /definitely/ can do some interesting things if you > start wrapping your head around it. If you (Carel) don't mind shelling out some guilders and are feeling nationalistic ;-), point your browser at http://www.cs.kun.nl/~clean/ Clean is like Haskell, a lazy pure FP with layout sensitive syntax. Unlike typical Haskell implementations, Clean is actually pretty fast. Haskell implementations I've used (GHC, Hugs) have incredibly bad performance, not so with Clean! > Skaller, another member of our little coterie, has an affinity for > OCaml, whose syntax is somewhat like Haskell, but I prefer Haskell for > asthetic and other interface reasons. Thankfully, tastes differ. :) OCaml syntax is nothing like Haskell, there is no offside rule. Semantically, Haskell, Clean, and OCaml are all "typeful" languages, but that ain't syntax. Oh, OCaml is fast too, like Clean, and unlike Haskell. I do like the fact that Haskell has a form of overloading, but OCaml will get that too one day. In case you can't guess, OCaml is my first choice for real work. I admit that readability is one of its weaker points :-( -- Brian From rasumner at iname.com Wed Feb 23 11:59:04 2000 From: rasumner at iname.com (Reuben Sumner) Date: Wed, 23 Feb 2000 18:59:04 +0200 Subject: Which GUI? References: Message-ID: <8913lj$7mu$1@news.netvision.net.il> My guess is that you do indeed get the prize. Just to insert a somewhat more specific comparison between Tkinter and wxPython (then the debate can continue on more subjective matters), from what I can tell you can print from wxPython and you cannot from Tkinter. If that happens to be an issue for a specific application, that would be an advantage for wxPython. How do all the other PyQt, PyGTK, PyFOX, Py... do here? Reuben Moshe Zadka wrote in message ... >On Mon, 21 Feb 2000, Fredrik Lundh wrote: > >> Tkinter is a component oriented UI library, which >> is carefully designed to work well with Python. >> and vice versa -- a certain Python feature was >> in fact added in part to make Tkinter a bit easier >> to use (can you name this feature?) > >def f(**kw): > pass > >do-i-get-the-effbotic-prize-or-what-ly y'rs, Z. From BKossmann at dthr.ab.ca Wed Feb 16 18:22:09 2000 From: BKossmann at dthr.ab.ca (Kossmann, Bill) Date: Wed, 16 Feb 2000 16:22:09 -0700 Subject: Newbie question: Dictionary of lists Message-ID: <2F1A38DC0413D311A7310090273AD5278A03AA@dthrexch01> Carel, I'll have "guaranteed-unique" account codes because we don't have synonyms in our Chart of Accounts, and the individual account segments must be in the same domain/format. Good point about using a tuple as the key--as you say, it adds a bit of insurance to the script. Thanks for the tip, and thanks again to Remco for the slap-to-the-side-of-the-head reminder about references. Bill -----Original Message----- From: Carel Fellinger [mailto:cfelling at iae.nl] Sent: Wednesday, February 16, 2000 14:51 To: python-list at python.org Subject: Re: Newbie question: Dictionary of lists Hai Bill, Remco already pointed out how to fix your code, so I wil only add some noice:) Maybe you are not aware of the fact that in python dictionary keys could wel be tuples? Quite likely that someday you will be bitten by non uniquely conca- tenatable account codes like 00,1 and 0,01:) Kossmann, Bill wrote: ... > period names, and amounts; the dictionary's key is a concatenation of the > account codes, and the values are 12-element lists (one for each month). I > want a sample dictionary entry to look like this: > {'00006101071115000000': [10, 20, 30 ... 120]} as bit-prevention you could change the key you use from > # Key is our cost centre code > dictionaryKey = histRcd[0]+histRcd[1]+histRcd[2]+histRcd[3] to dictionaryKey = (histRcd[0], histRcd[1], histRcd[2], histRcd[3]) -- groetjes, carel -- http://www.python.org/mailman/listinfo/python-list From tim_one at email.msn.com Fri Feb 4 03:26:22 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 4 Feb 2000 03:26:22 -0500 Subject: Circular references and python In-Reply-To: <20000204074438.6110.qmail@adler.dynodns.net> Message-ID: <001201bf6ee9$84b12360$a2a0143f@tim> [posted & mailed] [nascheme at enme.ucalgary.ca] > I have been looking at Toby Kelsey's code [a gc patch posted to > c.l.py a while ago]. It seems quite interesting. Do you think > something like it would have a chance to be accepted by Guido? Yes. I've studied the code (at Guido's suggestion, actually), and corresponded with Toby about it. Toby probably invented this approach on his own, but Rafael Lins has published a great deal about it under the name "lazy cyclic reference counting". It has many attractions! Like it's (well, can be made) 100% portable in strictly std C, builds on the current rc (which many people like) rather than replacing it, is theoretically sound, and extension modules that don't play along can't cause incorrect behavior (this is a real problem for Python! any scheme has to work well with what's already out in the field). Also one nasty drawback, alas: despite all the effort Lins and colleagues have put into refining "this kind of" scheme, they're (at least not as of 1996) sanguine about getting it to run really fast except in special situations. Toby actually has a nice twist on the idea that may be a real help there. > Perhaps you can also explain why splay trees are used. There > doesn't seem to be any need to keep things sorted. I don't fully > understand the code yet so perhaps I am missing something. I dislike the splay trees myself -- it's just a way of representing a set of objects (the ordering property of splay trees in particular is never used, so all those hairy rotations don't really buy anything in return). And the pointer-chasing code needs to be distributed across object implementations and dispatched to via a new slot in type objects. And the patch as it was posted doesn't actually find the most common cases of Python cycles, because it never considers instance objects to be "suspicious". Toby broadly agreed with all that, but it appears the son of a bitch went and got himself a job , and dropped this. I haven't been able to make time to pursue it myself, and don't expect to be able to in the foreseeable future. I believe it would take about two weeks of work (mostly to slash space and time use) to say for sure whether it's "good enough" for production use. Did you just volunteer ? BTW, in my eyes (and Guido's too, to the extent that he can't tell us apart), it's the most promising approach currently on the table, and Toby gets a lot of thanks for that! > Thanks for your always entertaining posts in c.l.p. stop-sucking-up-you're-embarrassing-us-both-ly y'rs - tim From peter.sommerfeld at gmx.de Thu Feb 24 00:24:37 2000 From: peter.sommerfeld at gmx.de (Peter Sommerfeld) Date: Thu, 24 Feb 2000 06:24:37 +0100 Subject: Which GUI? Message-ID: Tom Loredo wrote: >Pieter Claerhout wrote: >> >> What about toolkits for the Mac. The MacOS toolbox is nowhere >> mentioned, and also the problems we have with running Tcl/Tk >> on the Mac are mentioned nowhere. Any suggestions on what else >> will work with a Mac? > > I'm working mostly on Solaris now, but my Python work will also > have to run on a Mac and perhaps Win also. I've heard a few > mentions now of problems with Tcl/Tk on the Mac (here and in > regard to IDLE). I've yet to give it a try, but before I do, > what are the problems on the Mac side with Tcl/Tk? And with > Tkinter? Is it just the mediocre Tk look-and-feel? Does > Tkinter not work at all on the Mac? Are there particular > widgets that must be avoided? I gave TKinter on Mac a short shot about 2 years ago. It worked well so far but the result didn't satisfy. There where some little Look & Feel differences and Mac-User are pretty sensitive for that :-). May be you can work out some work arounds but I prefere using the Mac-Toolbox directly as (I think) most MacPython users do. I think Toolkits like TKinter are ok on Mac if you use it for yourself or as prototype only but its questionable if you want to distribute it as a regular Mac-Application. I would like to see wxWindows as well as OpenAmulet on Mac but it will take some time until the Mac-Ports are available. And OpenAmulet hasn't matured enough yet (I think OpenAmulet and TK are the most Pythonic Toolkits of all). Consider joining the MacPython List for more detailed infos by others. GUI's and portability, a never ending story :-) regards -- Peter From dalke at acm.org Sun Feb 20 07:33:43 2000 From: dalke at acm.org (Andrew Dalke) Date: Sun, 20 Feb 2000 05:33:43 -0700 Subject: data structure design question References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> Message-ID: <88plbb$bth$1@nntp2.atl.mindspring.net> My, a thread I can really get into! (albeit, late) This isn't very Python related, but I'll gab on the newsgroup anyway - better that than re.compile(r'\s') :) Felix asked: > I'm thinking of trying to do some chemistry stuff in > Python, and one of the things I was thinking of was > to define a Chemical (or Molecule) object. There are a couple of things in your request. The first is how to represent the compound in Python, and the second is how to store the data. I'll start with the second, since it's tied into what you were thinking about. There are two very common ways to store a molecular structure, one is with a matrix, where the element at (i,j) is the bond connecting atom i and j. In the simpliest case, where you are interested in only bond order, this is an integer. This approach takes order N*N memory, and is only used in small molecules, say, a few hundred atoms. You end up with a very sparse matrix - since most organic systems only have at most 4 bonds the number of bonds grows linearly. (BTW, some organo- metallic sytems can have over 10 bonds, but then, as I understand it, the concept of bond isn't really appropriate for those cases). So most people use a list of atoms and something to describe the bonds inbetween. There are two "somethings" in this case, depending on where you want to put the bond information. You consider bonds as single, double, triple. Then you want a list of atoms and a list of bonds. The atoms will have a name or atomic number field and a list of the bonds used. (Atom name is better since that also works with atom types, later). The bonds will have the bond type and the two atoms used. There are variations, like (also) storing atom connections directly so you don't need the double dereference to get to the other atom in a bond. This viewpoint is more like how a chemist thinks about chemisty. However, many programs, like XPLOR, mentioned elsewhere in this thread, ignore bonds other than to say two atoms are connected. Instead, the information about the bond is made part of the atom type. Consider the cases O-C=C and C=C, where - is a single bond and = is a double bond. You can rewrite the carbons as O-[C;sp]-[C;sp2] and [C;sp2]-[C;sp2] (I'm not a chemist, so my sp's might be wrong here). That is, you introduce atom types. This is useful because the dynamics of the two carbons are not dependent on just the two carbons, but on the other atoms bonded to the carbon. The C=C of the first molecule is different than the C=C of the second one (examples in introductory chemistry classes, which say "the energy of a double bonded carbon- carbon is ..." not withstanding). It's people like me (ex-physicist) and biologists who use this model. I worked on several successful projects (VMD and NAMD from http://www.ks.uiuc.edu/Research/) which never even mention bond types. I don't have MMTK handy, but it is definitely atom type-based, and I don't think it has a definition for bond type. The most common file format for large-molecule chemistry (meaning protein sized) is the PDB format, and it doesn't have bond types either. So the model you use is going to depend on your needs. It sounds like you are just starting on computational chemisty, so you probably want the chemist's way. Here's something like my standard data structure for that case: class Molecule: def __init__(self, atoms = None, bonds = None): self.atoms = atoms self.bonds = bonds class Atom: def __init__(self, type): self.bonds = [] self.type = type # type is name or atomic number def add_bond(self, bond): self.bonds.append(bond) class Bond: def __init__(self, bondtype, atom1, atom2): self.bondtype = bondtype self.atoms = (atom1, atom2) atom1.add_bond(self) atom2.add_bond(self) This is useful for molecules which are not being modified. To use it, you do something like: O = Atom("O") C = Atom("C") H1 = Atom("H") H2 = Atom("H") bonds = [Bond(1, C, H1), Bond(1, C,H2), Bond(2, C1, O)] mol = Molecule([O, C, H1, H1], bonds) You won't be doing molecular editing any time soon, so this should get you most of what you need. Oh, and BTW, this is highly cyclical, which means you really don't want a pointer back from the atoms or bonds to the molecule, since otherwise you'll leak memory unless you explictly free things up. The other part of your question is about how to make the data structure in the first place. You mentioned two ways, a dictionary and a connection table. Dictionary: > formaldehyde = Chemical({h1:[c], h2:[c], > c:[h1, h2, o, o], o:[c, c]}) Connection table: > formaldehyde = Chemical([H, H, C, O], > [[None, 0, 1, 0], > [0, None, 1, 0], > [1, 1, None, 2], > [0, 0, 2, None]]) The problem with both of these approaches is you need the run-time check to make sure that of X is bonded to Y then Y is bonded to X. That's why I have the connections done in the Bond constructor. The dictionary way is clever in how you repeat occurances to mean the bond type. I mentioned the PDB format earlier. It doesn't have bond types, but there is a similar hack to add it by counting how many times two atoms are CONECT'ed. But it doesn't work for at least two reasons. First, some bonds have partial bond order. Aromatic bonds are sometimes said to have a bond order of 1.5. To support this, you'll end up having to encode it as, say, "4 repeats means aromatic bond". Second, you can only store one data type. But bonds can have other properties, like chirality - is the bond a wedge into or out of the page? More useful for what you're doing, you could have a second parameter called "hcount" which is the number of hydrogens bonded to the given atom. That would reduce the number of atoms you dealt with by about 1/2. The second doesn't work for the same reason you don't usually want to use a matrix for the internal data structure - you end up with a very large matrix filled with mostly zeros. (Though if you do quantum chemisty, which deals with small molecules, you'll often see these sorts of matrix formats.) There is another solution you should look at. There are so-called "line notations" which represent the molecule as a string. To make the data structure, you write a parser for notation language. The two most common of these are SMILES and SLN. I think SMILES is the prettier of the two, so I'll point you to www.daylight.com/smiles for the description and just say SLN is described at www.tripos.com. In that case, your formaldehyde is represented as "C=O" (the hydrogens are implicit). Benzene is "c1ccccc1". These are much easier to read, and take smaller space. The problem with line notations is it's harder to write parser for them since not only is the language more complicated than file formats like mdli.com's "mol" format, but they often need more chemical knowledge, such as knowing that the "C" in "C=O" really needs two other hydrogens. It's also hard to store other information with the atoms or bonds, like 3D coordinates. I've been working on a Python interface to the Daylight toolkit. This exposes their C-based API into an object-oriented form. If you really want to get into molecular editing, you should take a look at it. It's called PyDaylight and more info is at starship.python.net/crew/dalke/PyDaylight/ . It won't tell you how to write the data structure, but it does explicitly describe how I think you should interface to such a structure. I've also got a partial Python parser for SMILES, umm, somewhere. I can't seem to find it now. It won't be finished any time soon since I'm working on other projects. There's at least one project, Klotho from wustl.edu, which uses a Prolog description of a molecule. As I recall, they build up the molecule not from scratch but from smaller parts. But you have to be a chemist for those parts to make intuitive sense. Also of likely interest for you is their database of small molecules, like aspirin and caffeine. Interestingly, this is similar to the approach MMTK uses for describing an animo acid residue. Those parts mades sense to me because I worked on proteins, and because there's only 20 some-odd parts to know. Going farther afield, most of the academic and commercial software uses a covalent bond model, where atoms are connected by bonds. When you get into more bizarre chemistry, this breaks down. For example, you can have bonds between an atom and a ring system as a whole. I don't know much about this sort of chemistry. And then there's quantum chemists who have rather different views on the subject, since bonds are only an approximation of wave function densities. If you want to look at existing code, you should look at JMol from .. I know Christoph Steinbeck(?) in Germany is working on it. Don't have the URL handy and I'm not connected, but it's described in freshmeat.net. It's a GPL set of chemical software for Java. Rasmol also store bond types, and is in C. There are a few people working with chemical compounds in Python, but most of the ones I know of deal with large molecule modeling, and either don't do bond types or don't have source code they can make available. This, by the way, was my description of data structures of generic molecules. When you have proteins and DNA, you have much higher levels of structure, such as chains. Often people will use a hierarchical data structure for these "oh, atoms are in residues are in chains", but this doesn't work. I can leave that discussion for another time. :) Good luck! Andrew Dalke dalke at acm.org From neilh at hare.net.au Wed Feb 9 19:01:44 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Thu, 10 Feb 2000 11:01:44 +1100 Subject: small python implementation or python subset ? References: <613145F79272D211914B0020AFF6401914DE29@gandalf.digicool.com> Message-ID: <012c01bf735a$055a5440$01646464@computer> > On Windows, Python15.dll contains everything you need to embed Python in > another C program, and that DLL on on my system is quite small enough > already, 558K. Why not statically link the equivalent of that to your > program? The Python.exe on my system appears to merely call Python15.dll, > and is 5k in size. Depending on where you have the size problem (storing, downloading, in memory...) you might want to try an executable compressor such as UPX. This gets python15.dll down to 220K and seems to work for me. Downside is that more time (and memory ?) will be required to expand before running but it seems quite fast enough to me. UPX is free and can be found at: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html Neil From trentm at ActiveState.com Wed Feb 16 07:32:32 2000 From: trentm at ActiveState.com (Trent Mick) Date: Wed, 16 Feb 2000 12:32:32 -0000 Subject: String question In-Reply-To: <816010E2456BD111A48700805FBBE2EE01C60514@ex-quebec-u1.baan.com> Message-ID: > I used "str" instead of "string" because "string" is the name of a module. And 'str' is a builtin function that you just clobbered. :) Trent From anthonydelorenzo at my-deja.com Fri Feb 4 14:45:12 2000 From: anthonydelorenzo at my-deja.com (anthonydelorenzo at my-deja.com) Date: Fri, 04 Feb 2000 19:45:12 GMT Subject: PMZ - Apache AddHandler definition References: Message-ID: <87fa87$lmh$1@nnrp1.deja.com> PMZ requires configuring the httpd.conf file for the Apache webserver. However, someone with normal user priveledges (ie using a web hosting service) cannot normally change this file. My imperfect understanding is that I can override my local settings using an .htaccess file. Do I put this in my user directory, or in my user/www directory? Tony Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Fri Feb 18 01:20:32 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 18 Feb 2000 01:20:32 -0500 Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: <38AC5FCA.75F4EA42@prescod.net> Message-ID: <000a01bf79d8$426b7a60$e62d153f@tim> [Paul Prescod] > I'm not sure if I believe what Tim said about implementing threads with > continuations or vice versa. This is going to turn into another Vladimir "locality of reference" three-msg gloss on a toss-away parenthetical comment . Like I said, this stuff gets very involved very fast, and without a precise model of computation to build on is just going to thrash (another parallel to LOR ...). I really should *not* have said that continuations can be implemented via threads. My apologies for that. They can be , but not with the flavor of threads most people are most likely to think of (the other thing needed is hinted at below). > A continuation is, in my mind, only vaguely related to a thread. Threads can certainly be implemented via continuations, so far as the formal denotational semantics go. But those formal semantics don't cover the pragmatics of parallel execution, so in some practical contexts it's a worthless observation. It's of real value in Python, though, because Python's flavor of threads are currently constrained, by the global lock, to act much more like coroutines than "real threads" (the co-transfers are implicit instead of explicit, but other than that they *are* just coroutines). A great deal of the potential practical value of Christian's Stackless approach lies exactly here. Sam Rushing has written eloquently about this, so visit his site and read his papers on Medusa & friends. Short course: whenever you find yourself building a hairy state machine to implement a protocol, suspect that there's an *elegant* approach straining to break free of that cruft. > Okay, imagine you are going through a Python program and you could all > of a sudden say to the interpreter: "remember this stack frame and all > variables in scope. Give it to me as a Python object. I'll do something > with it later." It's like groundhog day. You can *go back in time* to > somewhere you were before. Actually its the opposite of groundhog day > because what will have changed is globals and things relating to I/O. So > its like the little town in groundhog day is stuck in time but you can > tell that time is progressing because you can see news from the outside > world on television. So its more like the Truman show. Only in reverse. > :) That clears things up, right? No , but it goes part of the way in a helpful direction. What you described there is no more than what C's setjmp/longjmp accomplishes, and that isn't enough. *If* setjmp captured not only the current stack frame, but *all* stack frames on the entire call stack-- and longjmp resumed execution via a copy of the whole banana --then you'd be within spitting distance of a real continuation implementation (albeit not a reasonably *practical* one). And that's probably the clearest "operational model" for C programmers. In theory, it's much simpler, and *so* much simpler that it's very hard to explain! "Continuations in theory" are more basic even than ordinary subroutine calls. In fact, they were discovered during attempts to rigorously define the semantics of "goto" stmts, and in an odd but real sense continuations are "more basic" than gotos. In the theoretical framework, it's pretty much a trivial (in retrospect) fiddling of functions modeling "program state". If you take continuations as primitive, everything else follows easily; the difficulty here is that "everyone already knows" how subroutine calls work, so try to build continuations on *top* of that assumed model. It's backwards, and the need to invert your brain in order to "get it" is much of what Christian means when he said he had to "redefine truth". > ... > Sigh-need-to-go-back-to-school-or-get-Tim-Peter's-job-ly 'yrs You'll have to borrow Guido's time machine, then -- I stopped writing compilers in '94, and am still writing c.l.py msgs based on the little I haven't yet forgotten. luckily-nothing-new-has-been-discovered-since-'39-ly y'rs - tim From gmcm at hypernet.com Fri Feb 25 08:28:16 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 25 Feb 2000 08:28:16 -0500 Subject: Bring value from walk() In-Reply-To: <38B663AF.EDF3622E@nembv.cz> Message-ID: <1260637200-9073387@hypernet.com> Milos Prudek wrote: > I need a function that walks the dir tree and adds up occupied space. > This is the source. "print Dirn", "print '-',X,Fs" and "print End of > walk..." lines are for debugging only. > > The problem is that Filespace is Zero at the end. Fs is reset to Zero > every time walk gets called, so I thought I would add Total variable > (lines with Total are currently commented out), but I got NameError: > Total. > > Is there (an object oriented) way to bring Total from Estimatespace thru > EstDirSpace right back into main program? You need a mutable object. Making Fs a list with one element, (initialized to 0), and then totalling into Fs[0] will do the trick. > def Estimatespace(Fs, Dirn, Nams): > print Dirn > for X in Nams: > Fs=Fs+os.stat(Dirn+'/'+X)[stat.ST_SIZE] > print '-',X,Fs > # Total=Total+Fs > return > > def EstDirSpace(RootDir): > Filespace=0 > # Total=0 > os.path.walk(RootDir, Estimatespace, Filespace) > print "end of walk, Filespace=",Filespace > return Filespace > > EstSpace=EstDirSpace('c:/DL/ati') If you're going to print details, os.path.walk is not really appropriate, because it's a pre-order walk. If you're going to print totals for the branches, you need a post-order walk, (process the leaves first, then the parent node). - Gordon From shippy at cs.nmt.edu Mon Feb 21 12:06:16 2000 From: shippy at cs.nmt.edu (Jeff Shipman) Date: Mon, 21 Feb 2000 17:06:16 +0000 Subject: Win 95, PWS, Unable to run python References: <88qkup$gk8$1@nnrp1.deja.com> Message-ID: <38B17087.2EEAE841@cs.nmt.edu> rchowd1 at my-deja.com wrote: > > PWS (Personal Web Server) is running on my Windows 95 OS. > But whenever I am trying to execute the Test.asp file I get > entire Test.py file as is instead of getting executed. Could > you please let me know what I am doing wrong. The following > files work when I use APACHE WEB SERVER. > #!c:/Program Files/Python/Python.exe Try turning your slashes around, so it looks like: #!c:\Program Files\Python\Python.exe Don't know if that will solve your problem, but it's worth a try. -- +-----------------------------------------------------+ | Jeff "Shippy" Shipman E-Mail: shippy at cs.nmt.edu | | Computer Science Major ICQ: 1786493 | | New Mexico Institute of Mining and Technology | | Homepage: http://www.nmt.edu/~shippy | +-----------------------------------------------------+ From robin at jessikat.demon.co.uk Wed Feb 16 19:11:22 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 17 Feb 2000 00:11:22 +0000 Subject: python .bat wrapper References: <88dmhe$fe4$1@nntp4.atl.mindspring.net> Message-ID: In article , Dennis E. Hamilton writes >Very fun! I am stealing that at once. > >Try > > python -x %0 > >and make life even easier! > >-- orcmid ... it would do, but if I leave off the .bat it don't work -- Robin Becker From kcazabon at home.com Sun Feb 20 20:02:56 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Mon, 21 Feb 2000 01:02:56 GMT Subject: Tkinter: creating a scrolling canvas that contains widows (Frame widgets) Message-ID: <490s4.103351$A5.1984558@news1.rdc1.bc.home.com> I've been trying to create a class that I can use to place Frame() widgets into a scrolling 'container'. Basically, I want a master "Frame" that has a Y scroll bar (and maybe X as well). In this frame, I want to be able to add sub-frames (any number). If all of these frames won't fit, I want to be able to scroll the master Frame as necessary. The only suitable Tkinter class for the Master I can find is the Canvas widget. I have no problem creating this, and adding windows to it using canvas.create_window(x,y, window=mywidget), but have had a heck of a time getting it to scroll properly, especially when the user resizes the overall master frame. This may sound complicated, but it really isn't... just the implementation might be! Any suggestions, or if you can point me to an exapmle that might help (like the ScrolledText widget, which is very similar to what I need, kindof...), I would greatly appreciate it. Kevin Cazabon kcazabon at home.com From garry at sage.att.com Wed Feb 23 14:21:34 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Wed, 23 Feb 2000 19:21:34 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu><38A5E3F0.B3DCEC8E@callware.com> <88qc9j$oo0$1@news.kersur.net> Message-ID: <38B4333E.5BA3D119@sage.att.com> Quinn Dunkan wrote: > So why do so many languages require ';'s? :) noise characters make the parser easy to write. -- 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 darrell at dorb.com Thu Feb 24 19:58:37 2000 From: darrell at dorb.com (Darrell) Date: Thu, 24 Feb 2000 16:58:37 -0800 Subject: Bug in win32all-128 with multiprocessor NT References: <8947n9$c5k$1@nnrp1.deja.com> Message-ID: <055f01bf7f2b$7328acb0$6401a8c0@dorb> Couldn't get this line to work after two minutes of trying. pid = win32pdhutil.FindPerformanceAttributesByName("pname") So I plugged in a pid and yes it worked but caused the exception you mentioned. I'm running Win2K also. wrote in message news:8947n9$c5k$1 at nnrp1.deja.com... > The process affinity actually does get set correctly, so the error is > more an annoyance than anything, but since I noticed that the > SetProcessAffinityMask function is mentioned in the new Win32 Python > book, I thought I'd report this problem. If anybody else has a > multiprocessor machine they could try this out on, I'd be very > interested to hear the results. You can email me at > krodgers at ryanaero.com. Thanks! > From S.I.Reynolds at cs.bham.ac.uk Wed Feb 2 13:10:48 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Wed, 02 Feb 2000 18:10:48 +0000 Subject: Charts References: <3890C74D.786411BC@acm.org> Message-ID: <38987328.2B4@cs.bham.ac.uk> Jeff Blaine wrote: > > On Thu, 27 Jan 2000 15:31:41 -0700, Thierry Thelliez wrote: > >Is there any packages for creating charts (histograms, scattered plots, > >line charts,...) in Python ? > > I had this very same need recently. I got all excited about the Gnuplot > module until I found out that it requires the Numeric C extension to Python. > Was immediately disinterested, as I saw no reason for a pipe-based wrapper > to require a C extension. > I have a Gnuplot module that doesn't need Numeric: http://www.cs.bham.ac.uk/~sir/pub/ However I've stopped maintaining it now and use Michael Haggerty's instead. (for everyone else, its at:) http://monsoon.harvard.edu/~mhagger/Gnuplot/Gnuplot.html You should definately install Numeric. Its a top quality package for all sorts of stuff - it should definately be part of the standard distribution. Stuart From wking at sheltonbbs.com Fri Feb 4 04:29:12 2000 From: wking at sheltonbbs.com (Mike Partin) Date: Fri, 4 Feb 2000 03:29:12 -0600 Subject: Executing external programs with vars Message-ID: <949656797.2089988259@news.sheltonbbs.com> Hi, I'm relativly new to python as a language, I started trying to pick it up to implement a shell script I have done for helping with CVS use. I'm not having problems executing external programs per say, it's that I'm having problems executing them and including variables. For example, when updating a cvs module I set my variable TempVar with raw_input() then when I exec cvs I need it to be in the form "cvs -z3 co TempVar" but can't seem to get this to work. Any help would be appreciated. Mike Partin From quinn at zloty.ugcs.caltech.edu Tue Feb 8 22:55:35 2000 From: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) Date: 9 Feb 2000 03:55:35 GMT Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: On Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen wrote: >I fear that this question has already been asked, but is there and >equivalant one line command that is equivalant to the C command: > >a = x > y ? x : y uh, how about a = max(x, y) ? This isn't equivalent because both x and y are evaluated, but it is a lot clearer. If you're looking for a general equivalent to ?:, the short answer is that there isn't one. There are some ugly hacks, and an almost-equivalent (a and b or c), all of which are in the faq. Generally, though, you need to do if else. Yes it's more typing. But most of the time it will be more readable too. From boud at rempt.xs4all.nl Thu Feb 17 15:02:44 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 17 Feb 2000 20:02:44 GMT Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: <88hk54$7p8$2@news1.xs4all.nl> J.C.Travers wrote: <...> > The best GUI in my opinion is pyQT. It is a fully supported > widget/application set written in C++, so it is natural for python > (object-orientated). The python wrappers for it are brilliant and the > documentation is massive (unlike Tk). It is available on your platform > (as well as Unix and Mac) and has every conceivable widget you could > want. (Particular tables and multicolumn list boxes). It is simple and > logical to code in. When I had to choose a gui a year ago, I also evaluated the lot - PyQt/KDE, tkInter, CGI forms, pyGtk, pyGnome, the Python bindings to wxWindows, even those old mfc-like Windows bindings. One aspect that was quite important to me was desktop integration. I like session management, configuration management, standard look & feel and things like that. That meant that tkInter, PyGtk and wxWindows were out of the race. Besides, a year ago pyGtk was a pig to install and wxWindows was worse. PyGnome was uninstallable too, at the time I evaluated my options, so I picked PyQt/KDE (actually, I first tried the old, unsupported Qt bindings that are still somewhere around on the KDE webserver). It's good that I like the feel of the Qt widgets. Besides, the class structure is very good, a joy to work with, and the development rapid. However, there's no Qt for the Mac, Qt for Windows costs a serious amount of money, and the author of PyQt isn't able to check whether it works on Windows - he merely states that it 'compiles'... But with support for Qt 2.0 and KDE 2 coming things are getting exciting. Kparts and DCOP interfaces would be exceedingly interesting and fun to use! Boudewijn Rempt | http://www.valdyas.org From wlfraed at ix.netcom.com Fri Feb 25 01:25:28 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Thu, 24 Feb 2000 22:25:28 -0800 Subject: PythonWin -- print option? References: <98g9bs8e1ugl1r7k0t8j0jdb441251ak51@4ax.com> <02e301bf7f33$97dc2570$01646464@computer> Message-ID: On Fri, 25 Feb 2000 12:56:53 +1100, "Neil Hodgson" declaimed the following in comp.lang.python: > > However, PythonWin has a print button, along with print entries > > on the File menu. All of these are ghosted out in my installation. > > Which version of PythonWin? Printing didn't turn up until 128 (or maybe > 127?). > Ah... I think the recent one I pulled down shows as 125 (which is still a great change from the previous installed version). -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From aahz at netcom.com Thu Feb 10 02:00:36 2000 From: aahz at netcom.com (Aahz Maruch) Date: 10 Feb 2000 07:00:36 GMT Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> Message-ID: <87tnmk$2uo$1@nntp6.atl.mindspring.net> In article <87tkoi$hql$1 at nntp1.atl.mindspring.net>, Michal Wallace wrote: > >Anyone know what, specifically, will not be compatible, and compared to >what? :) Nope. I get the feeling that it will be similar to moving from Perl 4 to Perl 5. -- --- 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 Nostalgia just ain't what it used to be From mjoyce at xilonen.co.uk Mon Feb 21 18:08:28 2000 From: mjoyce at xilonen.co.uk (Matthew Joyce) Date: Mon, 21 Feb 2000 23:08:28 GMT Subject: Baffling unpack() or read() problem...... Message-ID: <38b1c09a.24413312@news.globalnet.co.uk> The code below runs perfectly on Linux on very large files of binary data. However it believes it's got to the end of the file prematurely in Windows after reading a variable number of sequences of 16 bytes. Why should it work in Linux and not Windows? What am I missing? matt ------------------------------------------ from struct import * import sys import string import os.path rawinfile=open(os.path.abspath("nt.raw"),"r") rawstring = rawinfile.read(16) while rawstring != "": unpack("4L",rawstring) rawstring = rawinfile.read(16) rawinfile.close() From jstok at bluedog.apana.org.au Sun Feb 13 13:47:56 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 14 Feb 2000 05:47:56 +1100 Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> <882fld$6t08$1@node17.cwnet.frontiernet.net> <38A6F986.F3F29C95@durham.ac.uk> Message-ID: J.C.Travers wrote in message <38A6F986.F3F29C95 at durham.ac.uk>... >RPM1 wrote: >> >> Try, >> http://www.pythonware.com/downloads.htm >> >> It's an EXE but it extracts even if you don't have privileges. > >No it doesn't. Well it didn't for me. > >I don't see the reason for not issueing a normal zip archive. Making a >self-extracting binary doesn't make it much easier, (esp with winzip >etc...) but causes lots of trouble for people like me. At least both >should be offered... It's not just a self-extractor, it's a self-installer that registers itself on the add/remove programs list. If you don't have install priveliges, it's not going to work no matter how it's packaged. From alex at somewhere.round.here Mon Feb 21 14:16:54 2000 From: alex at somewhere.round.here (Alex) Date: 21 Feb 2000 14:16:54 -0500 Subject: where can i download python for free? References: Message-ID: > i ma very interested in python but i cant really find where t get it, > could anyone help me out? http://python.org/download Alex From tjg at avalongroup.net Wed Feb 23 19:11:58 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Wed, 23 Feb 2000 16:11:58 -0800 Subject: TK and PhotoImage: Problem getting image to display Message-ID: <38B4774E.9BE01006@exceptionalminds.com> Hi all, Just started playing with some of the image aspects of Tkinter, and I immediately ran into a roadblock. I found a similar problem in the archives, but I can't get the resolution to work for me. Given the code below, I successfully create the canvas, but can't for the life of me figure out how to get my gif to display inside the canvas. All suggestions greatfully accepted... from Tkinter import * class Quoter: def __init__(self, master): qFrame = Frame(master) qFrame.pack(side=TOP) #qCompanyLogoCanvas = Canvas(qFrame, width=275, height=50) #qCompanyLogoCanvas.pack(side=LEFT) img = PhotoImage(file='amos3.gif') qAMOSLogoCanvas = Canvas(qFrame, width=300, height=300) qAMOSLogoCanvas.create_image(0, 0, anchor=NW, image=img) qAMOSLogoCanvas.pack() if __name__ == '__main__': root = Tk() Pmw.initialise(root) root.title('AMOSoft Quoting') quoter = Quoter(root) root.mainloop() -- Stand Fast, tjg. Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From claird at starbase.neosoft.com Mon Feb 7 15:33:09 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 7 Feb 2000 14:33:09 -0600 Subject: mail filter in python? References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207170156.A3609@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> Message-ID: In article <20000207175222.J19265 at xs4all.nl>, Thomas Wouters wrote: . . . >mail-gid permissions, for instance. All in all, i think you're better off >with a frontend to procmail, which creates a procmailrc to your liking. Or >perhaps you can use the powers of procmail to make it start a python script >to do the filtering, and accepts the action from it -- it would then take >care of locking, security and the mailbox format itself. . . . Or is that a "backend"? In any case, I agree with Mr. Wouters: use procmail, and just invoke your Python work as an external process. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From robin at jessikat.demon.co.uk Mon Feb 7 09:13:36 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Mon, 7 Feb 2000 14:13:36 +0000 Subject: Excel Question References: <$yOJ$DAiQrn4EwUD@jessikat.demon.co.uk> Message-ID: In article <$yOJ$DAiQrn4EwUD at jessikat.demon.co.uk>, Robin Becker writes ... >>> >> there ought to be some way to distinguish the excel. so the button can >>pass a handle to the client. Then the client can open up the correct >>instance. >Why not create an intermediate com object to do the spawn for you. The >intermediate can be given the workbook to operate on and can pass this >as a parameter (integer value) to the spawned python. > >The spawned python then enumerates all running excels and connects to >each one in turn until it can complete the handshake. Now I find out that win32api doesn't seem to have the enumerate processes/windows etc api's. -- Robin Becker From ahopkins at ahopkins.dynacare.com Tue Feb 1 12:47:44 2000 From: ahopkins at ahopkins.dynacare.com (Albert Hopkins) Date: 01 Feb 2000 12:47:44 EST Subject: file modes References: <8772sg$fdb$1@news6.svr.pol.co.uk> Message-ID: On Tue, 1 Feb 2000 16:06:41 -0000, Dave Berkeley wrote: >Hi All > >I'm trying to write a CGI script that returns image data instead of HTML. >The problem is that sys.stdout is opened in text mode, and I need to write >in binary. As a result each embedded "\n" in the image data gets expanded >into "\r\n", corrupting the image. I have tried the following: > >out = os.fdopen(sys.stdout.fileno(), "wb") >out.write("Content-Type: application/octet-stream\r\n\r\n") >out.write(data) > Are you sure? I've successfully done this on Apache and IIS with the following code fragment: sys.stdout.write("Content-type: image/jpeg\n\n") sys.stdout.write(data) sys.stdout.flush() I'm not sure why you are [re]opening sys.stdout but it should be open when your CGI is called. >But the "wb" mode does not seem to override the underlying mode of stdout. >I'm using Python 1.5.2 on Win 98 SE, talking to Apache 1.3.9. > >How can I write to stdout in binary mode? > >Dave Berkeley > > > -- -- Albert Hopkins Sr. Systems Specialist Dynacare, Inc ahopkins at dynacare.com From tim_one at email.msn.com Tue Feb 8 02:26:50 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 8 Feb 2000 02:26:50 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87ocad$to2$1@nnrp1.deja.com> Message-ID: <000901bf7205$dd51ed00$d92d153f@tim> [Gordon points out that the interpreter assumes tab=8 unconditionally & unalterably] [fcahoon at my-deja.com] > I think this should be in the Python FAQ. Or is it, and I missed it > somehow? If so, please excuse my oversight. Well, since it rarely comes up, it's not really FAQ material. Join the PSA, though, and you can add your own entries to the FAQ . can't-force-myself-to-pretend-to-worry-about-the-rest-ly y'rs - tim From mjackson at wc.eso.mc.xerox.com Wed Feb 16 15:11:20 2000 From: mjackson at wc.eso.mc.xerox.com (Mark Jackson) Date: 16 Feb 2000 20:11:20 GMT Subject: String question References: <88ev6m$cun$1@news.uit.no> Message-ID: <88f098$frq$1@news.wrc.xerox.com> "Runar Olsen" writes: > I want the variable 'string' to be a string and not a list.. > >>> n =10 > >>> string = "n = ", n > >>> print string > ('n = ', 10) That's a tuple, not a list (but also not what you want). > I want string to be "n = 10". How? String concatenation, for which you want the string representation of n. One technique: >>> n = 10 >>> string = "n = " + `n` >>> print string n = 10 A few minutes with the tutorial would probably pay dividends. . . -- Mark Jackson - http://www.alumni.caltech.edu/~mjackson Some years ago I was struck by the large number of falsehoods that I had accepted as true in my childhood, and by the highly doubtful nature of the whole edifice that I had subsequently based on them. - Ren? Descartes From DOUGS at oceanic.com Mon Feb 28 14:24:44 2000 From: DOUGS at oceanic.com (Doug Stanfield) Date: Mon, 28 Feb 2000 09:24:44 -1000 Subject: name of object inside it's methods? Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F326@huina.oceanic.com> [Michal Wallace (sabren) wrote:] > > > B) you could give the object a .Name attribute and just > > > use that instead. :) [Moshe Zadka said:] > > class foo(): > > pass > > b = foo() > > b.Name = "b" > > a = b > > print a [Gerrit Holl said:] > > File "", line 1 > class foo(): > ^ > SyntaxError: invalid syntax > What seems to work is: class foo(): pass b = foo() b.Name = "b" print b.Name # Presuming the original poster didn't want the behaviour # implied by Moshe's post, the following is more appropriate: a = foo() a.Name = "a" print a.Name # Isn't this the kind of thing one would normally do? Perhaps # what was wanted? c = foo() c.Type = "WIDGETTHINGY" c.Name = "ThisOne" d = [] d.append(c) for wdgt in d: print "%s is type %s" % (wdgt.Name,wdgt.Type) -Doug- From pinard at iro.umontreal.ca Thu Feb 17 20:54:53 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 17 Feb 2000 20:54:53 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: Alex's message of "17 Feb 2000 11:39:13 -0500" References: Message-ID: Alex writes: > Hi, Francois. Adding something like the following code to your .emacs > file might go some way to solving your problem. Actually, it's been a bit > of a pain for me, too, but I didn't realize it until I read your post. :) > (add-hook 'python-mode-hook '(lambda () > (save-window-excursion > (py-shell) > (local-unset-key "\C-c\C-c") > (local-set-key "\C-c\C-s" > 'comint-interrupt-subjob)))) Thanks a lot. I put this in `.emacs', and things are already nicer! :-) > [...] You will still have to switch to the python shell in order see > the results of executing your code, though. Good idea. I made it automatic this way: (defadvice py-execute-buffer (before display-py-shell-for-buffer activate) (let ((buffer (get-buffer "*Python*"))) (when buffer (save-excursion (pop-to-buffer buffer))))) (defadvice py-execute-region (before display-py-shell-for-region activate) (let ((buffer (get-buffer "*Python*"))) (when buffer (save-excursion (pop-to-buffer buffer))))) To be complete, I guess I should also learn how to test if the Python process is active, and avoid popping its buffer when it is not. Better might be to find a way for re-activating the Python process on the fly. Why would Python die, now that `C-c C-c' has been rebound to `C-c C-s'? Hmph! It still happens, whenever I execute `sys.exit(N)' in a script. Nevertheless, the light is brighter already. Thanks for having helped me! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From skip at mojam.com Sat Feb 12 06:51:57 2000 From: skip at mojam.com (Skip Montanaro) Date: Sat, 12 Feb 2000 05:51:57 -0600 (CST) Subject: perl chomp equivalent in python? In-Reply-To: References: <87snvk$f2i$1@news.hccnet.nl> <9t9hffh31mp.fsf@mraz.iskon.hr> Message-ID: <14501.18781.248856.752846@beluga.mojam.com> Samuel> Why not just use string.strip()? As was mentioned earlier in this thread, string.[lr]?strip all remove any whitespace from the respective end(s) of the line, not just newlines. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From mikael at isy.liu.se Wed Feb 23 02:24:25 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 23 Feb 2000 08:24:25 +0100 (MET) Subject: Killer Apps In-Reply-To: <20000222215610.E4549@stopcontact.palga.uucp> Message-ID: On 22-Feb-00 Gerrit Holl wrote: > ROFL! I know they say "It's better to remain silent and seem stupid, than opening your mouth and thus revealing the truth", but I still have to ask. I have seen this ROFL a number of times, especially written by you, Gerrit. What exactly is it supposed to mean? /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: 23-Feb-00 Time: 08:19:17 This message was sent by XF-Mail. ----------------------------------------------------------------------- From effbot at telia.com Fri Feb 18 16:49:49 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 21:49:49 GMT Subject: Coding problems with ftplib and uploading a file References: <88k890$fa2$1@nnrp1.deja.com> Message-ID: <18jr4.323$mYj.187884544@newsa.telia.net> pem at my-deja.com wrote: > I am new to python and have my first program near completion, however > the last step has caused me great troubles. What I need to do is > upload a file to a server via ftp. Very simple. My code looks like > this: > > ftp = FTP('servername') > ftp.login('uname', 'passwd') > ftp.sendcmd('cdup') > ftp.sendcmd('cdup') > ftp.cwd('/web') > fini = open('/myfile.html').readlines() > ftp.storlines('STOR ' fini) "storlines" takes a file object, not a list of lines. try this one instead: file = open("/myfile.html") ftp.storlines("STOR myfile.html", file) > All of the commands work just fine except for the storlines command. I > have read all of the documentation available to me at work (Programming > in Python and Learning Python, and web docs on ftplib) but none are > clear about the syntax of the storlines command. hey, you should have looked in the eff-bot guide ;-) btw, the library reference says: storlines (command, file) ... Store a file in ASCII transfer mode. "command" should be an appropriate "STOR" command (see storbinary()). Lines are read until EOF from the open file object "file" using its readline() method to privide the data to be stored. ... which does explain how it works, although you might have to read it a couple of times to sort it all out ("privide"? ;-) From mwh21 at cam.ac.uk Fri Feb 18 11:42:06 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 18 Feb 2000 16:42:06 +0000 Subject: Python misconceptions in IBM Ruby article... References: <38AC9D57.5CC8066C@mincom.com> Message-ID: Robin Becker writes: > I guess the objection is to not having a standard name for the instance > in class functions. If we had the standard set at self you could > presumably write > > class dingo: > def normal_func(a1,a2,....): > ..... > > classdef instance_func(a1,a2,...): > self.a=1 > ........ > > ie you could distinguish in the class definition between the kinds of > functions. Presumably normal_func cannot refer to self and instance_func > can. Also I assume that normal_func would live while the class does > which is more difficult in python. One wonders in this case you (not you Robin, the general "you" - probably should be "one", but that sounds odd in English...) intend to create instance variables, or alternatively have locals that are not instance variables. I don't really see that there is any viable alternative to the `self' approach in Python, for a variety of reasons. The status quo is simple, explicit, consistent and has as about as much chance of changing as the whitespace issue so there isn't a lot of point debating it, I'd have thought. pointless-ly y'rs Michael From grant at nowhere. Mon Feb 14 12:45:35 2000 From: grant at nowhere. (Grant Edwards) Date: Mon, 14 Feb 2000 17:45:35 GMT Subject: Python sucks loud References: Message-ID: In article , Forget it wrote: >x-no-archive: yes >You people are funny here, all excited about Python. >Following one guy's recommendation, for two days already I'm looking at >Python as a potential plug-in language, and it DISGUSTS me. [...] That's one of the lamest, most transparent flame-bait postings I've seen in a long time. -- Grant Edwards grante Yow! I am having a at CONCEPTION-- visi.com From neelk at brick.cswv.com Thu Feb 3 19:11:47 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 4 Feb 2000 00:11:47 GMT Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: James Logajan wrote: > Neel Krishnaswami wrote: > > Apply Neil Schemenauer's patches that convinces Python to use the > > Boehm garbage collector, or just live with the garbage, if your > > program is relatively short-lived. You can find his patch at: > > > > http://www.acs.ucalgary.ca/~nascheme/python/gc.html > > > > Manually freeing memory is ugly and error-prone. Don't do it. :) > > The vast majority of code (and programming languages) in the world > require explicit memory de-allocation. I don't believe that a GC > scheme has yet been invented that will work well for all problem > domains. I'm sure if it had, we'd all be using it by now. ;) Shrug. Then you can allocate a hunk of memory and manually collect the pieces of it, and just let the gc handle the whole hunk. You still win on the whole. I think a lot of people are working with severely outdated notions of the performance of of garbage collectors. Even 16 or 17 years ago garbage collection was expensive enough that Lisp Machiness made it something you ran manually every few days. But the state of the art has improved hugely: in _Compiling with Continuations_, Andrew Appel claims that a well-tuned generational garbage collector is competative with stack allocation in terms of speed, for functional and OO languages. (IIRC, SML/NJ allocates even activation records on the heap, and wins doubly because this simplifies the runtime.) Neel From grant at nowhere. Mon Feb 21 12:16:53 2000 From: grant at nowhere. (Grant Edwards) Date: Mon, 21 Feb 2000 17:16:53 GMT Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> <88lv9g$sfd$1@news2.isdnet.net> Message-ID: In article , Fredrik Lundh wrote: >Florent Rami?re wrote: >> well, i thinked about this method, it can be suitable for my project, >> but in one only way: it has to be set one time for all ... > >you still haven't explained why you're totally uncapable >of changing "print x" to e.g. "pr(x)" in your project, but >alright: > >import sys > >class florentStdout: > def write(self, str): > sys.__stdout__.write(str) > def __setattr__(self, attr, value): > pass > def __getattr__(self, attr): > return 0 > ># use non-standard print semantics >sys.stdout = florentStdout() > >print "a", >print "b" I can't say exactly when or why, but my gut feeling is that should you take this path, you'll regret it. Or, more likely, somebody else who ends up with your code will regret it. -- Grant Edwards grante Yow! You should all JUMP at UP AND DOWN for TWO HOURS visi.com while I decide on a NEW CAREER!! From effbot at telia.com Thu Feb 17 13:28:57 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 18:28:57 GMT Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC150E.FA51B9E3@durham.ac.uk> <38AC3968.39E53E20@durham.ac.uk> Message-ID: J.C.Travers wrote: > No, I've tried Tkinter, PyQT, wxPython, some pyGTK. What I really meant > was that in terms of the usual quality of interfaces to python modules, > > Tkinter is the worst I have seen. you mean widget = WidgetFactory(master, options...) widget.manager(geometry options) is the worst GUI interface you've seen? that's a rather unusual attitude. please elaborate. From jimc at regnoc.com Fri Feb 4 11:26:33 2000 From: jimc at regnoc.com (Jim Conger) Date: Fri, 04 Feb 2000 16:26:33 GMT Subject: Python MySQL.connect() question References: <3893CD31.B17E8B84@regnoc.com> Message-ID: <389AFD6F.F1DD7EC5@regnoc.com> (Answering my own question: It turns out that this error message is missleading. mySQL is actually connecting, but then refusing to attach to any database due to the mySQL security table settings. I'm hopefull that I can find some settings in mySQL that allow python to connect. If anyone has been through this before, let me know. Jim C.) Jim Conger wrote: > I have mySQL running on a RH Linux 6.1 box, and have added the > MySQLmodule.so to my python library. I can't figure out how to connect > within python. My attempts look like: > > >>> import MySQL; > >>> db = MySQL.connect(); > Traceback (innermost last): > File "", line 1, in ? > MySQL.error: Can't connect to local MySQL server > >>> > > I know the mySQL server is running in the background during this test, > so I'm noplussed. Any examples of working code would be appreciated. > > Jim C. -- Jim Conger Project Manager Silicon Valley Oil Co. jimc at regnoc.com, 925-842-6729 From mark at chem.uwa.edu.au Wed Feb 16 19:17:42 2000 From: mark at chem.uwa.edu.au (Mark C Favas) Date: 17 Feb 00 00:17:42 GMT Subject: Inter process communication using Tk/send hangs on suspended processes References: <20000216225453.06891@nms.otc.telstra.com.au> Message-ID: Another approach entirely: Why not have an xmlrpcserver started right at the beginning, and have each subsequent program register their details with the server when they start up, and get the details they require from the server about the other programs? This server could maintain all sorts of state, and act as a central messaging service if need be... Cheers, Mark >On 15 Feb, Rob W. W. Hooft wrote: >> I have a group of python programs. Whenever any new program is started, >> it will try to establish connections to each of the other ones >> using Tk/send (it is asking each for their background color, and will >> choose a new one for itself). This is done using "root=setup.setup()", >> the setup module is appended to this message. >> >> The problem occurs when any pre-existing program has been suspended: >> in such a case the Tk/send does not return. I also can not seem to set >> a timeout on the communications (my attempts are in commented >> code). Are there any better suggestions? >> -- 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 jlp at apti.com Mon Feb 21 10:53:33 2000 From: jlp at apti.com (James L. Preston) Date: Mon, 21 Feb 2000 15:53:33 GMT Subject: Installing Numeric linkage problems Message-ID: <38B16283.235DDB74@apti.com> I am trying to build a clean, new python installation on a new UltraSPARC with Solaris 2.6, gcc-2.95.1 and I have run into problems with installing Numeric. I have installed distutils, etc, and removed all of the old python installation and I don't seem to be getting the right linkage going between the Numeric modules and the python core. After I build and install Numeric, I get the following error message: Python 1.5.2 (#6, Feb 21 2000, 14:56:44) [GCC 2.95.1 19990816 (release)] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import Numeric Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python1.5/site-packages/Numeric/Numeric.py", line 76, in ? import multiarray ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/lib/python1.5/site-packages/Numeric/multiarray.so: symbol PySequence_Length: referenced symbol not found >>> libpython was built statically, which seems to be what is expected on this platform. Has anyone else had a similar situation? later, jlp From effbot at telia.com Wed Feb 16 16:40:14 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 21:40:14 GMT Subject: list iteration question References: <38AB0876.B816FE18@austin.ibm.com> Message-ID: <2PEq4.88$mYj.181656576@newsa.telia.net> David R. Favor wrote: > In the attached code, would someone point out why the function > chomp4() throws an exception? well, didn't your python interpreter just do that: Traceback (innermost last): File "bzzt.py", line 52, in ? File "bzzt.py", line 45, in chomp4 NameError: string which is python's way of telling you that you used a name that Python hasn't seen before. (adding an "import string" will help) From bhoel at server.python.net Wed Feb 23 03:30:10 2000 From: bhoel at server.python.net (Berthold=?iso-8859-1?q?_H=F6llmann?=) Date: 23 Feb 2000 09:30:10 +0100 Subject: Formatting a numerical string w/commas In-Reply-To: Timothy Grant's message of "Tue, 22 Feb 2000 13:55:48 -0800" References: <200002221225.HAA00397@csa.bu.edu> <200002221312.OAA04666@pandora> <38B305E4.E74833C2@exceptionalminds.com> Message-ID: Timothy Grant writes: > I've seen some traffic on this formatting numbers, and recently had to > format and deformat some number for a Tkinter app I was writing, so I > wrote to fairly generic functions for doing so. > > This is the first time I've ever posted *real* code on the list so > please be gentle, but constructive criticism, especially about style, is > always welcome. Maybe you also like to take a look at my "UnitPrint.py". It is hidden in my PyLaTeX module on starship (http://starship.python.net/crew/bhoel/). It is primaly written to print PhysicalUnits from Konrad Hinsens ScientificPython. Here's a sample session (using german locale settings): >>> from Scientific.Physics import PhysicalQuantities >>> p = PhysicalQuantities.PhysicalQuantity >>> import UnitPrint >>> from UnitPrint import * >>> print "got: ->%s<-" % formatInt(1) got: ->1<- >>> print "got: ->%s<-" % formatInt(12) got: ->12<- >>> print "got: ->%s<-" % formatInt(123) got: ->123<- >>> print "got: ->%s<-" % formatInt(1234) got: ->1234<- >>> print "got: ->%s<-" % formatInt(12345) got: ->12345<- >>> print "got: ->%s<-" % formatInt(123456) got: ->123456<- >>> print "got: ->%s<-" % formatInt(1234567) got: ->1234567<- >>> print "got: ->%s<-" % formatInt(12345678) got: ->12345678<- >>> print "got: ->%s<-" % formatInt(123456789) got: ->123456789<- >>> UnitPrint.thousand_sep = r"\," >>> print "got: ->%s<-" % formatInt(1234567890) got: ->1\,234\,567\,890<- >>> UnitPrint.thousand_sep = r"" >>> print "got: ->%s<-" % formatInt(1234567890, ... {'thousand_sep': '-'}) got: ->1-234-567-890<- >>> print "got: ->%s<-" % formatInt(1.) got: ->1<- >>> print "got: ->%s<-" % formatInt(12.) got: ->12<- >>> print "got: ->%s<-" % formatInt(123.) got: ->123<- >>> print "got: ->%s<-" % formatInt(1234.) got: ->1234<- >>> print "got: ->%s<-" % formatInt(12345.) got: ->12345<- >>> print "got: ->%s<-" % formatInt(123456.) got: ->123456<- >>> print "got: ->%s<-" % formatInt(1234567.) got: ->1234567<- >>> print "got: ->%s<-" % formatInt(12345678.) got: ->12345678<- >>> print "got: ->%s<-" % formatInt(123456789.) got: ->123456789<- >>> print "got: ->%s<-" % formatInt(1234567890.) got: ->1234567890<- >>> value = 1234.567891234 >>> print "got: ->%s<-" % formatFloat(value, 1) got: ->1234.6<- >>> print "got: ->%s<-" % formatFloat(value, format=2) got: ->1234.57<- >>> print "got: ->%s<-" % formatFloat(value, 3) got: ->1234.568<- >>> print "got: ->%s<-" % formatFloat(value, 4) got: ->1234.5679<- >>> print "got: ->%s<-" % formatFloat(value, 5) got: ->1234.56789<- >>> print "got: ->%s<-" % formatFloat(value, 6) got: ->1234.567891<- >>> UnitPrint.thousand_sep = r"\," >>> print "got: ->%s<-" % UnitPrint.formatFloat(value, 7) got: ->1\,234.567\,891\,2<- >>> print "got: ->%s<-" % formatFloat(value, 7) got: ->1\,234.567\,891\,2<- >>> print "got: ->%s<-" % formatFloat(value, 8, ... {'thousand_sep': '-', ... 'decimal_point': '#'}) got: ->1-234#567-891-23<- >>> print generateUnitList(1) ('1.0',) >>> print generateUnitList(p("1 m/m")) ('1.0',) >>> print generateUnitList(1, formatInt) ('1',) >>> print generateUnitList(1, formatFloat) ('1.000',) >>> print generateUnitList(p("1m")) ('1.0', 'm') >>> print generateUnitList(p("1m/s")) ('1.0', 'm', 's') >>> print generateUnitList(p("1kg*m/s**2")) ('1.0', 'kgm', 's2') >>> print generateUnitList(1/p("1kg*m/s**2")) ('1.0', 's2', 'mkg') >>> print generateUnitList(p(1, "1/kg/m/s**2")) ('1.0', '1', 'kgms2') >>> print generateUnitList(p("1m"), formatInt) ('1', 'm') >>> print generateUnitList(p("1m"), formatFloat, 2) ('1.00', 'm') >>> print generateUnitList(p("1m"), formatFloat, 3) ('1.000', 'm') >>> print generateUnitList(p("12345.678901m"), formatFloat, 5) ('12\\,345.678\\,90', 'm') >>> print generateUnitList(p("1m/s"), formatInt) ('1', 'm', 's') >>> print generateUnitList(p("1kg*m/s**2"), formatInt) ('1', 'kgm', 's2') >>> print generateUnitList(1/p("1kg*m/s**2"), formatInt) ('1', 's2', 'mkg') >>> print generateUnitList(p(1, "1/kg/m/s**2"), formatInt) ('1', '1', 'kgms2') >>> print LaTeXGenerateUnit(1) {1.0} >>> print LaTeXGenerateUnit(1, formatInt) {1} >>> print LaTeXGenerateUnit(1, formatFloat) {1.000} >>> print LaTeXGenerateUnit(p("1m")) \unit[{1.0}]{{m}} >>> print LaTeXGenerateUnit(p("1m/s")) \unitfrac[{1.0}]{{m}}{{s}} >>> print LaTeXGenerateUnit(p("1kg*m/s**2")) \unitfrac[{1.0}]{{kg}\,{m}}{{s}^{2}} >>> print LaTeXGenerateUnit(1/p("1kg*m/s**2")) \unitfrac[{1.0}]{{s}^{2}}{{m}\,{kg}} >>> print LaTeXGenerateUnit(p(1, "1/kg/m/s**2")) \unitfrac[{1.0}]{{1}}{{kg}\,{m}\,{s}^{2}} >>> print LaTeXGenerateUnit(p("1m"), formatInt) \unit[{1}]{{m}} >>> print LaTeXGenerateUnit(p("1m"), formatFloat, 2) \unit[{1.00}]{{m}} >>> print LaTeXGenerateUnit(p("1m"), formatFloat, 3) \unit[{1.000}]{{m}} >>> print LaTeXGenerateUnit(p("12345.6789012m"), formatFloat, 5) \unit[{12\,345.678\,90}]{{m}} >>> print LaTeXGenerateUnit(p("1m/s"), formatInt) \unitfrac[{1}]{{m}}{{s}} >>> print LaTeXGenerateUnit(p("1kg*m/s**2"), formatInt) \unitfrac[{1}]{{kg}\,{m}}{{s}^{2}} >>> print LaTeXGenerateUnit(1/p("1kg*m/s**2"), formatInt) \unitfrac[{1}]{{s}^{2}}{{m}\,{kg}} >>> print LaTeXGenerateUnit(p(1, "1/kg/m/s**2"), formatInt) \unitfrac[{1}]{{1}}{{kg}\,{m}\,{s}^{2}} >>> (this is the test session from UnitPrint). Cheers 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 tbryan at python.net Tue Feb 29 22:25:37 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Tue, 29 Feb 2000 22:25:37 -0500 Subject: Strange Python problem on Linux. References: <38BBB8EF.9306991C@python.net> Message-ID: <38BC8DB1.F3F26298@python.net> Michael Hudson wrote: > > "Thomas A. Bryan" writes: > [snip] > > I've never had this problem before in over a year of Python work. > > Basically, I have a Python program that I can run by typing > > python filename.py > > but not by typing > > ./filename.py > [snip] > > The only thing I can think of is that the hash-bang line has some > control characters or other gunk in it - have you tried `cat -v'-ing > it? No. Thanks, that solved the problem. $ cat -v mdef.py #!/usr/bin/python^M .... At work, Xemacs shows the ^M in the file. I must have copied the files onto a floppy over samba at work and gotten the \r before the \n at the end of the line. I had been editing the file in Emacs here at home, and I didn't even think of the possibility of their being hidden carriage returns in the file. I suppose Emacs hides them from me so that I don't have to see them. :-/ In this case, the result was less than ideal...but it was a fun puzzle, no? Thanks for the help. ---Tom From greg at cosc.canterbury.ac.nz Mon Feb 21 22:32:02 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 22 Feb 2000 16:32:02 +1300 Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216073900.B2508775@vislab.epa.gov> <14506.62171.965245.972734@anthem.cnri.reston.va.us> Message-ID: <38B20332.226A4CF0@cosc.canterbury.ac.nz> Bernhard Herzog wrote: > > *Warning:* assigning the TRACEBACK return value to a local > variable in a function that is handling an exception will cause a > circular reference... > > So, a better way to reraise the exception is > > def baz(): > try: > bar() > except NameError: > raise AttributeError, None, sys.exc_info()[-1] This is a lot of tricky stuff to remember and get right, which discourages one from using this technique as often as one should. It would be nice if there were a simple variation on the "raise" statement which meant "raise this exception using the previous traceback". -- 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 alex at somewhere.round.here Tue Feb 1 23:53:51 2000 From: alex at somewhere.round.here (Alex) Date: 01 Feb 2000 23:53:51 -0500 Subject: Problem with system calls Message-ID: Hi, everyone. I am having a problem using os.system. I have a command which executes through os.system without mishap on RedHat 5, or from the command line on RedHat 6, but which segfaults when I try to run it through os.system on RedHat 6. Has anyone else seen something like this? Some more info: I started up gdb using os.system, and ran the program that way. It segfaulted at the beginning of a procedure (no commands in the procedure were executed) In the frame above the procedure, just before the procedure call, all the variables passed to the procedure seemed valid to gdb. After the segfault, the variables still seemed valid in the procedure's frame, but in the frame above, one of the variables seems invalid to gdb. I don't get this problem if I call the command from a simple C program with nothing but the system call. And I don't get it when I do the system call from perl. I tried it with a build from the python CVS tree, and got the same problem. Alex. From quinn at krone.ugcs.caltech.edu Thu Feb 3 15:53:04 2000 From: quinn at krone.ugcs.caltech.edu (Quinn Dunkan) Date: 3 Feb 2000 20:53:04 GMT Subject: re AMTE thread re DrScheme & Python References: <002401bf6e2c$5f1bb150$f0c809c0@lslp7o.lsl.co.uk> <3899C9D4.F8002223@earthlink.net> Message-ID: On Thu, 03 Feb 2000 18:31:43 GMT, Nathaniel Gray wrote: >I can hear it now: >"Thanks to Dr. Scheme, we're all up against the WALL OF SCIENCE." BN read, MACNAM, PNP MACNAM password! Maximum output resource yield. Illegal entry. Try again. Hmm, doesn't sound like scheme *or* python to me... class Something: def push(self, hard_enough): if hard_enough: self.fall_over() Perhaps Teslicle's Deviant is better expressed with an assertion. Doctor. Question. Evaluate. [Print. Loop.] But that sounds rather lispish. We'll just have to ask Dr. Scheme about that. Would Tim be insulted if we called him a rich compost? and-why-*does*-the-porridge-bird-lazy-leg-in-the-ire?-ly y'rs, Just a Clone From schorsch at schorsch.com Sun Feb 6 09:07:06 2000 From: schorsch at schorsch.com (Georg Mischler) Date: Sun, 06 Feb 2000 14:07:06 GMT Subject: Lisp 2 Python? References: <87h33i$t1l$1@nnrp1.deja.com> <1U_m4.464$oU5.2693459@news4.usenetserver.com> Message-ID: <87jv69$p9f$1@nnrp1.deja.com> Joel Lucsy wrote: > Georg Mischler wrote: > > Once we are here, the more interesting thing (and precondition > > to the above for any useful applications) would be a Python > > wrapper to ADS, and ultimately ARX. Yes, the latter looks like > > gargantuan task, but some day someone will have to do it... ;) > > To start off just wrap the AutoLisp specific functions that deal > with AutoCAD. Then throw in ARX wrappings. > I'm just doing this(the conversion) as a side project. I'm am doing a > project with Python, but would like to see the other programmers to > use it as well. It would be easier to have to automatically converted > to see a side by side comparison. I'd suspect it would still be > rewritten once they'd get into, but it would be a starting point. Joel, if you start writing ADS/ARX wrappers, please tell me, so we can share some of the work. I know of other people who would be interested in such a thing as well, and who'd also be capable of contributing. I believe that we could get a core group of programmers together that know enough about the matters involved to be helpful and would all profit from the result. I will have to implement a very basic connection between Autocad and Python myself in the very near future, and the broader foundation that gets the better. I always prefer general solutions to fast hacks, but of course, it's all a matter of the effort involved to solve a specific problem. If my needs can be solved better with a combined attack, then that would definitively be the preferred solution! -schorsch -- Georg Mischler -- simulation developper -- 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 greg at perceval.be Fri Feb 25 09:28:06 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Fri, 25 Feb 2000 15:28:06 +0100 (CET) Subject: Newbie Newbie, we are all Newbie to something In-Reply-To: <1260635201-9193570@hypernet.com> Message-ID: In reply to the message of Gordon McMillan sent on Feb 25 (see below) : > If you code a __del__, it's to release some resource > that won't be automatically reclaimed. Can someone give me an example of resource that won't be automatically reclaimed. -- 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 Fri, 25 Feb 2000, Gordon McMillan wrote: > Date: Fri, 25 Feb 2000 09:01:34 -0500 > From: Gordon McMillan > To: Gregoire Welraeds , python-list at python.org > Subject: Re: Newbie Newbie, we are all Newbie to something > > Gregoire Welraeds wrote: > > > I'm currently reading the Python Reference Manual and I got a small > > question regarding the __del__() statement in a class definition. > > I understand his utility when you don't have a garbage collector and > > memory management. In this case, it is important to have del statement to > > free object properly. > > No, the __del__ method (if it exists) is called when Python is > about to dealloc the object because the refcount has dropped > to zero. If you code a __del__, it's to release some resource > that won't be automatically reclaimed. > > But what if you have ? > > In the same topic, do we have to explicitly close an open file before > > exiting: > > No. File objects close themselves when dealloc'ed. So this is > a common idiom in Python: > > text = open(filenm, 'r').read() > > With both GC (at least, most implementations) and refounting > you have problems with circular references. In (most) GC, > when a unreachable cycle of objects is reclaimed, the > finalizers are not called, but the memory is reclaimed. With > refcounting, unreachable cycles live forever. > > But, with refcounting, when a refcount reaches 0, the object is > deallocated then and there, so it is safe to release resources > in the dealloc (or __del__). In GC, there are any number of > factors that can influence when the finalizer is run, so you > normally code an explicit close method if you need the > resource released in a timely manner. > > - Gordon > > -- > http://www.python.org/mailman/listinfo/python-list > > From Vladimir.Marangozov at inrialpes.fr Wed Feb 2 05:58:06 2000 From: Vladimir.Marangozov at inrialpes.fr (Vladimir Marangozov) Date: Wed, 02 Feb 2000 11:58:06 +0100 Subject: SNOWSPAM2000 References: <875p47$p9r$1@nnrp1.deja.com> Message-ID: <38980DBE.E918C765@inrialpes.fr> Robin.Friedrich at pdq.net wrote: > > http://freeweb.pdq.net/robinf1/spam8pix/ > (FTP to the starship isn't working so I put them up here.) > These are some of the photos taken last week at SNOWSPAM2000 Robin, who's who? I remember there was some speculation about Tim Peters' presence at IPC8, but since the PSA decided not to pay for bodyguards to protect him, his venue at IPC8 may have been judged "high-risk" and therefore, chances are that it has been cancelled. (BTW, we arranged somehow for a snowstorm in Arlignton, in case a good exlanation of his missing was needed). So which plan succeeded? Has somebody had the privilege to flash him? ;-) -- Vladimir MARANGOZOV | Vladimir.Marangozov at inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252 From ray at commsecure.com.au Sun Feb 27 04:30:46 2000 From: ray at commsecure.com.au (Ray Loyzaga) Date: Sun, 27 Feb 2000 20:30:46 +1100 Subject: so how do I run this thing?!!!! References: Message-ID: <38B8EEC6.358B80B9@commsecure.com.au> Collin Greene wrote: > > thanks for all you help everyone, I know how to basicially use Python now > but I don't really understand it seems as if there should be a way to run > what you have written. I have tried the run command but it just showns me > what i just wrote. Is there a place to actuially see waht you have witten? > thanks greene at hctc.com Use Unix. Your windows machine thinks that it should open the file in one of the "text" displaying applications. From see_plus_plus at my-deja.com Fri Feb 18 12:42:03 2000 From: see_plus_plus at my-deja.com (see_plus_plus at my-deja.com) Date: Fri, 18 Feb 2000 17:42:03 GMT Subject: Python misconceptions in IBM Ruby article... References: <38AC9D57.5CC8066C@mincom.com> Message-ID: <88k09b$96f$1@nnrp1.deja.com> This is just a display that you haven't mastered C++. In your C++ code sample, you on purpose introduced two variables integer i. The one is the private data member, and the other is the formal parameter of function member foo. Just because of that you need to use 'this' to be explicit. Learn C++ seriously before you try to take on C++. cpp In article , Moshe Zadka wrote: > On Fri, 18 Feb 2000, John Farrell wrote: > > > I agree that Python's OO features feel added on. Consider: > > > > * You have to pass self to each member function. There's no obvious > > requirement that self need actually be the bound instance. > > Huh? ``self'' is passed automagically to each member function. > > consider > > class Spam: > > def eggs(self): > self.x = 1 > > a = Spam() > a.eggs() > > Where did you see me passing ``self'' to a.eggs() explicitly? > > > * In a method, fields of the bound instance need to be referenced > > through the self parameter, because the scoping rules do not understand > > about instance variables. > > That's because Python doesn't have declerations. And consider the > following C++ snippet: > > class C { > int i; > void foo(int i) {this->i = i} > } > > So even in C++ (and Java) you might have to reference member variables via > this. Python simply has fewer special cases. > > -- > Moshe Zadka . > INTERNET: Learn what you know. > Share what you don't. > > Sent via Deja.com http://www.deja.com/ Before you buy. From sholden at bellatlantic.net Mon Feb 21 15:48:43 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 21 Feb 2000 20:48:43 GMT Subject: Which GUI? References: <38B04C8C.45F96A76@bellatlantic.net> Message-ID: <38B1A4AC.E1872B50@bellatlantic.net> Grant Edwards wrote: > > In article <38B04C8C.45F96A76 at bellatlantic.net>, Steve Holden wrote: > > [disparaging remarks about Windoze huge bulk and general code bloat] > > I don't. ;) [use Windows] > > One could argue that X11 is hardly a minimalist solution > either... > > -- > Grant Edwards grante Yow! Isn't this my STOP?! > at > visi.com Well, arguing that way wouldn't find me in disagreement. Interestingly, both these windowing platforms were designed (IMLTHO) primarily with world domination in mind. Gates was aiming to wipe Macintosh out with an inferior interface, and the X effort represented the results of the combined hysteria of H-P, IBM et al when Sun introduced the Network Extensible Windowing System (NeWS). NeWS was interesting, since it used a PostScript imaging model and real-world coordinates rather than pixel graphics. It was designed for client-server systems from the get-go. Although it did take a few liberties with PostScript to implement an event-handling system. But this is irrelevant, since NeWS was pushed out of existence when Sun found they didn't have enough marketing muscle to resist the trend toward X Window. And, of course, GUIs are handling enough complexity that smallness is not a usual feature. Both Bill Joy and Ken Thompson argued back in the days of the 3Ms (one megabyte, one megapixel, one MIPS) that a good responsive user interface would need more than 10 MIPS. They were right. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From A.Weis at t-online.de Mon Feb 14 19:24:19 2000 From: A.Weis at t-online.de (Arnold Weis) Date: Tue, 15 Feb 2000 00:24:19 GMT Subject: PyApache, couldn't geta hold of author, willing to donate sometime References: Message-ID: <38a5fa58.11062714@news.main-echo.net> hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) wrote: >On Fri, 11 Feb 2000 14:48:48 +0000 (GMT), Oleg Broytmann wrote: > >> No, there is no "better", but there is different module - httpdapy. I >>personnaly use PyApche, slowly moving from CGIs to Zope, or at least PCGI. PCGI? What's that? I know FCGI (fast-CGI), which BTW would solve your problems (better performance, less load, persistent DB-connections ... Regards Arnold From fatjim at home.com Sat Feb 19 02:56:24 2000 From: fatjim at home.com (Jim Meier) Date: Sat, 19 Feb 2000 07:56:24 GMT Subject: Rudimentary dict (RFC 2229) client library Message-ID: Hi all; I needed to use some dict servers and wanted to do it in python. Since there's no standard library module for this, I wrote a simple one myself. It's missing some of the bells and whistles of the dict protocol, and isn't exactly an illustration of the best way to do it; but it gets the job done. I'm posting it here in the hopes that someone else will find it useful. If you have any corrections (or nitpicks), please let me know! --Jim Meier BillyGrahamBot: the dissotiaton of choice. The road to our Armageddon will be required to run on both Linux and Microsoft Windows NT. We might be seeing you in heaven. And God told him to be extensible or to accomodate other UI paradigms than text terminals. From breiter at usf.Uni-Osnabrueck.DE Fri Feb 11 05:51:16 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 11 Feb 2000 10:51:16 GMT Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> Message-ID: <880pj4$mc6$1@newsserver.rrzn.uni-hannover.de> In article <87umih$egk$1 at nnrp1.deja.com>, thucdat1143 at my-deja.com writes: Dear Dat, > You are not happy with Borland's products? Neither am I! Well we agree on that one. :) > But being a 'Free Software Projects and Consulting', you should be more > Linux-oriented than MSWin-oriented. Actually I am. But Linux and free software is not exactly the same identity. First there are is a lot of free software for proprietory platforms (like most Unixs) and secondly there are other free operating kernels/systems (like freedos,Hurd,openbsd). As much as I want that software should be completely free, we should start replacing proprietory software were we can. Python replaces various proprietory script and programming languages on the Win32 platform. Why should I recommend something different for people you are fixed on Win32? This is why I objected. Python is very well suited for programming and scripting tasks on Win32. And it might even help to replace more propietory software. > All these stuffs (Perl, Tcl, Python) are more home on Unix than MSWin, > Cheers (Oh sure: Viele Gruesse aus Minnesota/USA). Thanks, I was nearby last year. In Milwaukee. Bernhard [Short excursion into German soccer:] > Did Osnabrueck finally make it to the Erste Fussball Bundesliga? No way, they are third division and still struggeling to get back in the second. > Ich bin so lange weg vom Deutschland und habe keine Ahnung mehr. > Spielen Gerd Muehler und Franz Beckenbauer immer noch fuer Bayern > Muenchen? Nein, schon sehr lange nicht mehr. Beckenbauer war zwischendurch erfolgreich Nationaltrainer und sitzt bei Bayern M?nchen im Vorstand. -- Free Software Projects and Consulting (intevation.net) Association for a Free Informational Infrastructure (ffii.org) From skip at mojam.com Tue Feb 15 09:47:09 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 15 Feb 2000 08:47:09 -0600 (CST) Subject: Help with Python Grammar change In-Reply-To: References: Message-ID: <14505.26349.2844.326035@beluga.mojam.com> Travis> How difficult would it be and what are the problems with Travis> altering the grammar (and compile.c code) so that one can enter Travis> slice-syntax as an argument to a function call: Why not just use the slice builtin: g(slice(1,10,2),3) ? Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From a.serier at hccnet.nl Thu Feb 10 15:02:00 2000 From: a.serier at hccnet.nl (a.c.a. serier) Date: Thu, 10 Feb 2000 21:02:00 +0100 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: <87v5gg$heo$1@news.hccnet.nl> Thanks to all who responded. Allthough I tried strip, I used is as chomp(), i.e. expecting it to change the argument, offcourse that doesn't work, because the stripped string is returned (it now works also for me too ;-) The string[:-1] solution works also very well, after looking at it is, I remembered seeing something like it in Guido's tutorial :-( Kees From gerrit.holl at pobox.com Mon Feb 7 09:46:41 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 7 Feb 2000 15:46:41 +0100 Subject: mail filter in python? In-Reply-To: ; from scarblac-spamtrap@pino.selwerd.nl on Mon, Feb 07, 2000 at 01:16:07PM +0000 References: <20000208000902.31713@nms.otc.telstra.com.au> Message-ID: <20000207154641.A2817@stopcontact.palga.uucp> Remco Gerlich wrote on 949925767: > Greg McFarlane wrote in comp.lang.python: > > I am looking for a replacement for the "filter" program that comes > > with elm - something that I do not have to compile and something that > > is easy to hack on. Does anyone know of a python version? > > The best program out there for this sort of thing is Procmail. It does > everything. It's not Python, it is compiled C. But the config files are easy > to make. > > http://www.procmail.org The procmail syntax is really obfuscated. What about creating a mail filter with a Python syntax? Shouldn't be too difficult, just create some functions (drop, match_header) and execfile() a file with the rexec module... regards, Gerrit. -- homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From JamesL at Lugoj.Com Fri Feb 4 00:47:57 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Thu, 03 Feb 2000 21:47:57 -0800 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: <389A680D.7502D66F@Lugoj.Com> Neel Krishnaswami wrote: > > James Logajan wrote: > > Neel Krishnaswami wrote: > > > Apply Neil Schemenauer's patches that convinces Python to use the > > > Boehm garbage collector, or just live with the garbage, if your > > > program is relatively short-lived. You can find his patch at: > > > > > > http://www.acs.ucalgary.ca/~nascheme/python/gc.html > > > > > > Manually freeing memory is ugly and error-prone. Don't do it. :) > > > > The vast majority of code (and programming languages) in the world > > require explicit memory de-allocation. I don't believe that a GC > > scheme has yet been invented that will work well for all problem > > domains. I'm sure if it had, we'd all be using it by now. ;) > > Shrug. Then you can allocate a hunk of memory and manually collect the > pieces of it, and just let the gc handle the whole hunk. You still win > on the whole. Sorry, not sure I understand that. > I think a lot of people are working with severely outdated notions of > the performance of of garbage collectors. Even 16 or 17 years ago > garbage collection was expensive enough that Lisp Machiness made it > something you ran manually every few days. Have the algorithms improved, or have clock speeds gotten high enough that the problem has been submerged? Aren't there important pathological problem domains (data structures) which limit most all GC schemes? I know in sorting, I have a choice of quick-sort which is generally faster than most other sorting schemes, but there exist orderings which reduce it to N^2 complexity (pathological cases). On the other hand, if I'm willing to run just a tad slower than quick-sort, I can use heap-sort and be assured of N*log(N) complexity for all orderings. I'll admit I'm not sure what the situation is with GC these days; any good (and relatively current) books on the subject? Web searches come up with too damn many schemes, which suggests to an old fart like me that the no single good GC scheme has been worked out. > But the state of the art has improved hugely: in _Compiling with > Continuations_, Andrew Appel claims that a well-tuned generational > garbage collector is competative with stack allocation in terms of > speed, for functional and OO languages. (IIRC, SML/NJ allocates even > activation records on the heap, and wins doubly because this > simplifies the runtime.) I'll look into Appel's book, but suggestions from others are appreciated. From c_cazabon at hotmail.com Wed Feb 9 21:31:28 2000 From: c_cazabon at hotmail.com (Charles Cazabon) Date: Thu, 10 Feb 2000 02:31:28 GMT Subject: HP Ini file module References: Message-ID: <8ED5D0C77hdjsdhdfh75738@news.sshe1.sk.wave.home.com> Gene Chiaramonte claimed in : >At frozenspam 8 someone from HP mentioned they had a python module >available to work with ini files on windows. Anyone know where I might >find that? It wasn't me, but I wrote a GPL'ed .ini parser. It's at: http://www.qcc.sk.ca/~charlesc/software/ConfParser/ Charles From rhicks at rma.edu Thu Feb 17 17:48:34 2000 From: rhicks at rma.edu (Robert Hicks) Date: Thu, 17 Feb 2000 22:48:34 GMT Subject: Module/Directory cleanup Message-ID: <6V_q4.4$UB1.531@news> I have Python, wxPython, and PythonWin loaded on my system and I have PY files all over the place. How about all modules going into one directory. This would cleanup not only the many subdirectories that are prevalant but would also create a cleaner import path. Upgrade and installs would be easier and cleaner also. Bob From gavrilov at iname.com Fri Feb 11 13:03:26 2000 From: gavrilov at iname.com (Alexander Gavrilov) Date: Fri, 11 Feb 2000 18:03:26 GMT Subject: Using gzip with multiple file References: <88018q$erp$1@nnrp1.deja.com> Message-ID: Take a look on zipfile.py in ftp://ftp.interet.com/pub/pylib.html wrote in message news:88018q$erp$1 at nnrp1.deja.com... > Hi, > Could someone please point me to an example of using gzip to store > multiple files in the one archive, or failing that any examples using > gzip reliably. > TIA > Victor > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From tim_one at email.msn.com Sat Feb 26 20:10:32 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 20:10:32 -0500 Subject: Fun w/ lazy streams (was RE: functional programming) In-Reply-To: <8L2e1BAcs$s4EwOP@jessikat.demon.co.uk> Message-ID: <000001bf80bf$72946560$7da2143f@tim> Thought a fair # of people might enjoy playing with the attached. I've likely posted all of it before over the years, but in scattered pieces and spelled different ways. premature-spring-cleaning-ly y'rs - tim PS: If this kind of thing really appeals to you, check out a language in which it's *natural*. I recommend Haskell (http://www.haskell.org/), in which this kind of thing is as natural as breathing (and requires about a tenth the lines of code; or maybe a third if you don't take advantage of Haskell's std libraries). class Stream: def __init__(self, first, restf): """Construct an unbounded stream s from 'first' & 'restf'. 'first' is the first element of s, and is returned by s.head(). 'restf' is a no-argument function that, when invoked, produces a Stream that is the rest of s. s.tail() invokes restf. """ self.first = first self.restf = restf def head(self): """Return first element of stream.""" return self.first def tail(self): """Return the stream from the 2nd element onward.""" return self.restf() # Generally useful stream functions. def sget(s, n): """s, n -> a list of the first 'n' elements of stream 's'.""" result = [] for i in xrange(n): result.append(s.head()) s = s.tail() return result def szip(s, binop, t): """s, binop, t -> stream 's' zipped w/ stream 't' via 'binop'. The result is the Stream binop(s[0], t[0]), binop(s[1], t[1]), ... """ return Stream(binop(s.head(), t.head()), lambda s=s, binop=binop, t=t: szip(s.tail(), binop, t.tail()) ) def srange(i, inc=1): """i, inc=1 -> the stream i, i+inc, i+2*inc, ...""" return Stream(i, lambda i=i, inc=inc: srange(i+inc, inc)) def sfilter(s, pred): """s, pred -> the substream of 's' elements satisfying 'pred'. Caution: this will get into an infinite loop if you try to materialize enough of s so that no elements satisfying pred remain in the rest of s. """ while not pred(s.head()): s = s.tail() return Stream(s.head(), lambda s=s, pred=pred: sfilter(s.tail(), pred)) def smap(s, f): """Return stream f(s[0]), f(s[1]), ...""" return Stream(f(s.head()), lambda s=s, f=f: smap(s.tail(), f)) def sunion2(s, t): """s, t -> stream union. s and t are increasing streams. Return the increasing stream that is the union of s and t without duplicates. """ s1, t1 = s.head(), t.head() if s1 == t1: return Stream(s1, lambda s=s, t=t: sunion2(s.tail(), t.tail())) elif s1 < t1: return Stream(s1, lambda s=s, t=t: sunion2(s.tail(), t)) else: return Stream(t1, lambda s=s, t=t: sunion2(s, t.tail())) def sunion(s, *streams): """Stream union of one or more increasing streams.""" result = s for stream in streams: result = sunion2(result, stream) return result def sintersect2(s, t): """s, t -> stream intersection. s and t are increasing streams. Return the increasing stream containing the elements they have in common. """ while 1: s1, t1 = s.head(), t.head() if s1 == t1: break elif s1 < t1: s = s.tail() else: t = t.tail() return Stream(s1, lambda s=s, t=t: sintersect2(s.tail(), t.tail())) def sintersect(s, *streams): """Stream intersection of one or more increasing streams.""" result = s for stream in streams: result = sintersect2(result, stream) return result def sdifference(s, t): """s, t -> stream difference. s and t are increasing streams. Return the increasing stream containing the elements of s not in t. """ while 1: s1, t1 = s.head(), t.head() if s1 < t1: break elif s1 == t1: s = s.tail() t = t.tail() else: t = t.tail() return Stream(s1, lambda s=s, t=t: sdifference(s.tail(), t)) # Fun examples. ones = Stream(1, lambda: ones) print "ones:", sget(ones, 10) # infinite stream of 1's ints = srange(1) print "ints:", sget(ints, 10) # guess def sadd(s, t): return szip(s, (lambda i, j: i+j), t) print "ones + ints:", sget(sadd(ones, ints), 10) fibs = Stream(1, lambda: Stream(1, lambda: sadd(fibs, fibs.tail()))) print "fibs:", sget(fibs, 10) # i.e., the Fibonacci numbers # Stream of all primes. def removemults(s, n): # s but without any multiples of n def notdivisible(i, n=n): return i % n return filter(s, notdivisible) def sieve(s): return Stream(s.head(), lambda s=s: sieve(removemults(s.tail(), s.head()))) primes = sieve(srange(2)) print "primes:", sget(primes, 15) # Increasing stream of all ints divisible by at least one of # 3, 5 and 7. multiples_of_3 = srange(3, 3) multiples_of_5 = srange(5, 5) multiples_of_7 = srange(7, 7) divany357 = sunion(multiples_of_3, multiples_of_5, multiples_of_7) print "divany357:", sget(divany357, 40) # Increasing stream of all ints divisible by all of # 3, 5 and 7. divall357 = sintersect(multiples_of_3, multiples_of_5, multiples_of_7) print "divall357:", sget(divall357, 20) # detect a pattern? print "hmm :", sget(srange(105, 105), 20) # Increasing stream of all ints divisible by nothing other # than 3, 5 or 7 (i.e., of the form 3**i * 5**j * 7**k for # i, j, k >= 0). Note: this is a famous problem. Try # doing it efficiently without lazy streams! If you do, # be very sure your program is correct too . def timesn(s, n): # multiply stream by int return smap(s, (lambda i, n=n: i*n)) divonly357 = Stream(1, lambda: sunion(timesn(divonly357, 3), timesn(divonly357, 5), timesn(divonly357, 7))) print "divonly357:", sget(divonly357, 20) # Increasing stream of ints *not* of the form 3**i*5**j*7**k. print "divnotonly357:", sget(sdifference(ints, divonly357), 20) From fredp at mygale.org.nospam Fri Feb 4 09:33:55 2000 From: fredp at mygale.org.nospam (Fred Pacquier) Date: 4 Feb 2000 14:33:55 GMT Subject: Ann: PMZ - Poor Man's Zope References: <1262508367-6369026@hypernet.com> Message-ID: <8ED094475PaCmAnRDLM@194.2.0.33> gmcm at hypernet.com (Gordon McMillan) said : >Paul Prescod wrote: > >> Does it makes sense for there to be PMZ, DTML (two variants!), Python in >> ASP and Python Server Pages? Is there a need for a new >> python-in-html-sig to standardize this stuff? > >Hmm. Looks to me like PMZ runs anywhere, DTML in Zope, >ASP under IIS and PSP under a servlet style web server. This sums it up really nicely -- meaning that there is somethig for everyone, depending on what you can or cannot build on... I must say that it can get really depressing sometimes, finding some ready-made stuff that neatly solves a problem you were having, only to find out that actually implementing that stuff depends on so many layers upon layers that you don't already have, that it sometimes makes the solution impractical. -- YAFAP : http://www.multimania.com/fredp/ From hafhat at cs.rmit.edu.au Wed Feb 2 18:26:39 2000 From: hafhat at cs.rmit.edu.au (Hafeez Bana) Date: Wed, 02 Feb 2000 23:26:39 GMT Subject: Python MySQL.connect() question References: <3893CD31.B17E8B84@regnoc.com> <870tjf$514$1@news1.xs4all.nl> <3894737C.A676BC16@regnoc.com> <381BAA74.863A8048@cs.rmit.edu.au> <874ejr$35o$1@news1.xs4all.nl> Message-ID: <381ED7A5.DF5C510D@cs.rmit.edu.au> I am sorry. I should have explained my reason for saying so. The MySQL interface uses "localhost" as the default value (when you supply a null hostname) - and when localhost is used it uses a unix socket. If you want to use TCP/IP sockets (which is more platform independent but slower) you need to specify something other then "localhost". Mysql can be told what kind of communication it uses. In your case Mysql maybe listening on a unix socket and so localhost works - this was not the case with my configuration of Mysql. I hope you get what I am saying. Further information can be found in the README for the MySQL driver. I think Jim would be the best person to confirm if it worked - it did for me. Hafeez Boudewijn Rempt wrote: > > Hafeez Bana wrote: > > > Try using "127.0.0.1" instead of localhost. > > Well, that shouldn't make a difference - especially since localhost > does work on my box. I wonder what the results would be if Jim used > another MySQL binding, like MySQLdb? > > -- > > Boudewijn Rempt | http://www.valdyas.org From neelk at brick.cswv.com Wed Feb 9 19:40:45 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 10 Feb 2000 00:40:45 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> Message-ID: Paul Prescod wrote: > > I admit that Smalltalk and Lisp have annoyed me for a while. I would > apologize for taking it out on you but actually I didn't. The question > was asked whether languages succeed or fail for a reason. I strongly > believe that they do. If you spend 10 minutes reading www.python.org and > then 10 minutes on www.smalltalk.org you will see the difference > yourself. If it is an attack against the Smalltalk community to point > out that they have surpressed widespread knowledge of a great > programming language for nigh twenty years? There are multiple high-quality open-source Common Lisps available (CMUCL and clisp); just about every commercial Lisp vendor offers a full product with hefty libraries for evaluation by interested parties; the language spec is freely available, hyperlinked, and integrated into Emacs; there are code repositories and websites (the CMU AI repository and www.alu.org); there are freely available large, powerful, and industrial-strength apps for people to study (eg, CL-HTTP and Screamer); there are many superbly written textbooks and tutorials (_Paradigms of AI Programming_, _On Lisp_, _ANSI Common Lisp_, _The Art of the Metaobject Protocol_); *and* if you go on the newsgroups you can find master Lisp hackers (such as Kent Pitman, the editor of the CL spec) explaining the hows and even the whys of good Lisp practice to anyone who asks. If this is "suppressing widespread knowledge of a programming language," I think Java is the only case of a language that wasn't suppressed. :) > Smalltalk and Lisp should be a hundred times more popular today than > they are. The state of programming language deployment should be five > years ahead of where it is. People should not think that Java is cool > and modern. It's all very disappointing. Nowadays when people are giving away 500 MHz P3's in cereal boxes, this may be hard to believe, but remember that until around 1992 or 93, personal computers simply weren't powerful enough to run a full Common Lisp or Smalltalk. People in the PC world were writing spreadsheets in assembly language, for heaven's sake! > Maybe there is still someone around to listen: When I download a new > programming language, I don't want a new development environment. > [...] This annoys me not only because it holds the ideas in Smalltalk > back from popularity but because it strikes me as arrogant. Just give > me a programming language please! Er, it's not obvious to me where 'programming language' ends and 'development environment' begins. A programming language is an interface between the programmer and the computer, and so is the IDE. The line between the two is necessarily somewhat artificial. Consider, for example, the language's type system: this is in the common understanding a fundamental piece of what a language is. If you suggested that it's separable from the language, you would get strange looks. But then go look at Cecil, or Rice's DrScheme. In both of these languages, the type-checker is a separate tool run over a program, and it's certainly reasonable to write multiple type-checkers to analyze different aspects of a program. Or more directly, start messing with the the Class metaclass in a Smalltalk IDE, and see that you can change the language's semantics at runtime. If we haven't invented the one true language yet, why do you think that we have already found the one true way of interacting with languages? Experimentation is a good thing, IMO. Neel From glen at electricorb.com Sun Feb 13 07:18:05 2000 From: glen at electricorb.com (Glen Starchman) Date: 13 Feb 2000 06:18:05 -0600 Subject: Problem : using ADO in ASP References: <86vjhe$grb$1@nnrp1.deja.com> <38998BC0.2760828B@bellatlantic.net> <73Jm4.1202$k6.2820@news-server.bigpond.net.au> <389ED9A0.62DB5D5A@bellatlantic.net> Message-ID: <38A69FE0.FA9C9814@electricorb.com> not sure if this has anything to do with it, but GetRows() returns a VB Variant of type Array. Steve Holden wrote: > Mark Hammond wrote: > > > > "Steve Holden" wrote in message > > news:38998BC0.2760828B at bellatlantic.net... > > > Aaarrrggghhh ... > > > > > (, -1) > > > > It appears the "Execute" method returns 2 values - the recordset > > object and some integer. The integer is almost certainly due to one > > of the params to Execute() being specified as a BYREF. > > Thanks. The opacity of the COM object is bugging me, but I'll get > there in time (I hope)... > > > > > >

(L'gphone', L'ussi', L'ussi') > > > > > > I'm now having difficulty understanding why the GetRows method > > > seems to return COLUMNS! Note also that the script output is > > > not "inline" as you would expect from its position in the code. > > > > GetRows() returns a sequence of rows. Each row contains columns. In > > the example above, you are looping over each row, and when you print > > each row you get a tuple of objects - one for each column in the > > recordset. > > I understand that's how it's SUPPOSED to work. I just changed my data, > so the queried table contains four rows and three columns. And look > what I now see: > > (, -1) >

(L'row3col1', L'row1col1', L'row2col1', L'row4col1') >

(L'row3col2', L'row1col2', L'row2col2', L'row4col2') >

(L'row3col3', L'row1col3', L'row3col3', L'row4col3') > > which is why I said GetRows appears to be returning COLUMNS: as I > iterate over the result of GetRows, it would seem logical (captain) > for the tuple to be the columns of that row. But this is very > definitely NOT what I am seeing. Which makes me confused. > > > > > Hope this helps... > > > > Mark. > > Well, any further light on this would be useful. In case it matters, > this is Python 1.5.2 on Windows NT4.0, service pack 4, and the ODBC > data source is an Access 97 database. > > The code I used is copied below for completeness. > > regards > Steve > > > <% @LANGUAGE=Python %> > > From phd at phd.russ.ru Tue Feb 15 06:07:36 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 15 Feb 2000 11:07:36 +0000 (GMT) Subject: PyApache, couldn't geta hold of author, willing to donate sometime In-Reply-To: <38a5fa58.11062714@news.main-echo.net> Message-ID: On Tue, 15 Feb 2000, Arnold Weis wrote: > PCGI? What's that? I know FCGI (fast-CGI), which BTW would solve your > problems (better performance, less load, persistent DB-connections ... PCGI is very similar to FastCGI. It is PersistentCGI - a protocol to communicate between httpd and a special CGI, that starts and lives in memory, exactly like in FastCGI. http://starship.python.net/crew/jbauer/persistcgi/index.html Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From effbot at telia.com Sat Feb 19 07:06:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 19 Feb 2000 12:06:23 GMT Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> <88lukr$2cfj$1@news5.isdnet.net> Message-ID: <3Hvr4.354$mYj.171039744@newsa.telia.net> Florent Rami?re wrote: > sorry for replying this message, but is what you say means that there is > absolutely no way to print excatly what i want to print ??? > > I will never be able to display "ab" in two print ??? you're not listening. "print" is a convenience statement which inserts a space under certain circumstances (see the language reference). if that's not what you want, use a function instead: def pr(*args): for item in args: sys.stdout.write(str(item)) pr("a") pr("b") or use formatting operators: print "%s%s" % ("a", "b") or use a string or list to collect the output, and print it all in one go. > That make me nervous about python ! well, as usual, Python works best if you use it to write Python programs :-) From aahz at netcom.com Tue Feb 15 13:57:02 2000 From: aahz at netcom.com (Aahz Maruch) Date: 15 Feb 2000 18:57:02 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <001e01bf7790$8bd74480$66a2143f@tim> Message-ID: <88c7hu$209$1@nntp5.atl.mindspring.net> In article <001e01bf7790$8bd74480$66a2143f at tim>, Tim Peters wrote: >[and Aahz sez about Python's lack of "functional expression"] >> >> but adding generators should make up much of the balance. > >Unsure it would help here, at least in the flavor I've been selling them. Not directly, no, but it would extend the power of Python-style iteration sufficiently to combat many of the complaints about the lack of functional expression. It's essentially a completely different path to many of the same ends, but one that fits into Python. IMO As a side note, I'm thinking that implicit generator creation is a Bad Idea. We should force people to do things like b = BinTree() g = generator b.traverse() for i in g(): .... but I'm not at all certain of the syntax. Another option would be to make "generator" a keyword on the same level as "def", so the "function call" to a generator always creates a generator frame, and you then need to call the generator reference (as above) for each value. (As you've probably guessed, I strongly prefer "generator" to "iterator", but I won't whine if you or Guido have the opposite preference.) -- --- 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 Have you coined a word today? From paul at prescod.net Tue Feb 8 14:19:13 2000 From: paul at prescod.net (Paul Prescod) Date: Tue, 08 Feb 2000 11:19:13 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> Message-ID: <38A06C31.70753311@prescod.net> Thomas Hamelryck wrote: > > Python is certainly a very powerfull language with many virtues, but I > also think that its popularity at least partly is due to the "butterly > flapping its wing effect". I tried literally dozens of languages before trying Python. When I found Python the experience was: "ahhh. This is the language I've been looking for." Almost every programmer I introduce Python to has the same experience once they get over the whitespace eating nanovirus phobia. There are no butterflies here. There is just good design. > This is true for almost any language for that > matter (take e.g. C++ and objective C). C++ had many advantages over objective C including a type system that more directly extended C's and the backing of AT&T. > You mention Squeak. If Squeak > continues to mature I think it will be a formidable competitor for python. Not a chance. Smalltalk is doomed for the same reason Lisp is doomed. Smalltalk programmers think that their way of doing things is so much better than everybody else's that the whole world should reorganize themselves around the language. Tim Berners-Lee was once late for a keynote speech because he was arguing with Alan Kay about how the web "should" work. In contrast: Guido says, "this is the Web, this is Python. Let's make them work together" > At the moment, it lacks the huge amount of modules that are available for > python (which is one the most attractive features of the language). So we have a thirty year old language (Smalltalk) with a poor set of libraries and you want to attribute that to chaos theory? Give me a break. The smalltalk community squandered a 15 year "head start" on Python. The Lisp community's head start was even larger. They must take responsibility for that. Languages (or operating systems, or word processors) achieve popularity or obscurity for *reasons*. Not all reasons are technical, but there are always reasons. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From tim_one at email.msn.com Tue Feb 8 01:42:48 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 8 Feb 2000 01:42:48 -0500 Subject: 64-bit port of Python (was: Circular references and python) In-Reply-To: <87n811$2r5$1@nnrp1.deja.com> Message-ID: <000701bf71ff$b6b6dda0$d92d153f@tim> [posted & mailed] [Tim, on the early 90's port of Python to KSR's 64-bit OSF-based Unix] > IIRC, it turned up two spots where the code implicitly assumed > sizeof(int) == sizeof(long), and that was it (some subtler stuff > turned up later, but it was by far the easiest port of *any* > large C program to the Kendall Square architecture; [ptmick at mail.com] > Tim, I presume that this was a port to the UNIX 64-bit data model > LP64 Beats me: KSR did a 64-bit Unix before Official Buzzwords were invented to classify the approaches. char, short, int & long were 1, 2, 4 & 8 bytes respectively; pointers were 8 bytes. > and not the Windows LLP64 data model where you can no longer implicitly > assume that sizeof(long) == sizeof(void *). Right, definitely not that. However, the vast bulk of our porting problems were due to the even lamer <0.1 wink> assumption that sizeof(int) == sizeof(void *). Python never assumed that. > Do you know of anyone, other that myself, that is interested in > looking at these issues in the Python source? As well, I would be > interested to know what the "subtler stuff" was. It's not what you suspect . Almost everything boiled down to mistaken and unintended assumptions that sizeof(int) == sizeof(long), in and around the implementations of (unbounded) long arithmetic, and overflow-checking of int arithmetic. All that stuff was fixed then. AFAIK, core Python code *never* casts a pointer to any sort of int, or vice versa, either explicitly or implicitly. Since then, the biggest "sizeof" problems have centered around specific OS interfaces, especially "large file" support on systems with 64-bit flavors of seek etc. This is still a bit of an #ifdef'ed mess, as vendors still tend to do this in different ways (when they do it at all). I don't expect MS's variant of 64-bit C to cause any significant problems in the Python core -- the only areas worth worrying about a priori are the interfaces to MS's variant of libc. There's one subtlety that's always been theoretically broken: Python uses (C) ints to hold refcounts, but never checks refcounts for overflow. The justification for the latter is that you can't possibly have more references than there are pointers in the address space, so, in effect, this is a very subtle assumption that sizeof(void*) <= sizeof(int). You would need to accumulate gigareferences to a single object before this could break, though. And *that's* the level of the bugs that remain . sleep-easy-this-won't-be-hard-ly y'rs - tim From jeddak at earthlink.net Sun Feb 13 17:24:08 2000 From: jeddak at earthlink.net (J Donald) Date: Sun, 13 Feb 2000 22:24:08 GMT Subject: Py-Mode on GNU Emacs? References: <38A68FEC.3AC0AF86@earthlink.net> <38A6D7DE.2699FDDC@python.net> Message-ID: <38A6F88D.4CCDE15F@earthlink.net> Hmmmmm.....works for me. The only thing had been doing differently was to try to use a different site-lisp directory. "Thomas A. Bryan" wrote: > > > I have no problems in Emacs 20.3.1 (on Red Hat Linux 6.0). > > Python mode is on my system (version 3.28): > > $ locate python-mode.el > /usr/share/emacs/site-lisp/python-mode.el > /usr/share/emacs/site-lisp/python-mode.elc > > Here are the relevant lines from my .emacs file. > > ;;; For Python mode > (setq auto-mode-alist > (cons '("\\.py$" . python-mode) auto-mode-alist)) > (setq interpreter-mode-alist > (cons '("python" . python-mode) > interpreter-mode-alist)) > (autoload 'python-mode "python-mode" "Python hacking mode." t) > (defun my-python-mode-hook () > ;; make sure that emacs uses only spaces for indentation > (setq-default indent-tabs-mode nil) > ) > (add-hook 'python-mode-hook 'my-python-mode-hook) > > (global-font-lock-mode t) > (setq font-lock-maximum-decoration t) From gerrit.holl at pobox.com Wed Feb 23 15:13:17 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 21:13:17 +0100 Subject: PyQT,PyKDE failure: In-Reply-To: ; from embed@geocities.com on Wed, Feb 23, 2000 at 01:27:00PM -0500 References: Message-ID: <20000223211317.D4980@stopcontact.palga.uucp> > I tried to install some RPMs for PyQT and PyKDE and got the following error > on my system. I had to install PyKDE using the following command because it > didn't recognize PyQT as being installed on my system: I don't know the solution, but you probably make more chance in the mailinglist on this subject. http://mats.gmd.de/mailman/listinfo/pykde Note that I just added this to my GUI comparison: http://www.nl.linux.org/~gerrit/gui.html regards, Gerrit. -- *********************************** ***** IN MY HUMBLE OPINION!!! ***** *********************************** From xyzmats at laplaza.org Tue Feb 8 11:32:22 2000 From: xyzmats at laplaza.org (Mats Wichmann) Date: Tue, 08 Feb 2000 16:32:22 GMT Subject: 64-bit port of Python (was: Circular references and python) References: <000701bf71ff$b6b6dda0$d92d153f@tim> Message-ID: <38a044a6.12054373@news.laplaza.org> > >[ptmick at mail.com] >> Tim, I presume that this was a port to the UNIX 64-bit data model >> LP64 > >Beats me: KSR did a 64-bit Unix before Official Buzzwords were invented to >classify the approaches. char, short, int & long were 1, 2, 4 & 8 bytes >respectively; pointers were 8 bytes. That's LP64. longs and pointers 8 bytes, ints remain 4. LLP64 means other than for pointers, you have to say "long long" to get an 8-byte entity. ILP64 means all of int, long, pointer are 8-byte. Mats Wichmann (Anti-spam stuff: to reply remove the "xyz" from the address xyzmats at laplaza.org. Not that it helps much...) From jeremiahrogers at my-deja.com Sun Feb 6 18:56:59 2000 From: jeremiahrogers at my-deja.com (jeremiahrogers at my-deja.com) Date: Sun, 06 Feb 2000 23:56:59 GMT Subject: nonlinear programming? Message-ID: <87l1oa$g88$1@nnrp1.deja.com> is there a way for me to start on a function, then move onto another function before that function ends? I am working on an mpg123 frontend, and i want to start a song playing, then allow the user to either skip that song, or perform other essential tasks during the time when a song is playing. is this possible? Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Wed Feb 23 01:25:57 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 23 Feb 2000 08:25:57 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On Tue, 22 Feb 2000, Michal Wallace (sabren) wrote: > I guess my original question had to do with what functional > programming looks like in the wild, and what it might look like in > python. Aahz posted a recursive version of a fib() routine. Is this > not what you'd want? What would fib() look like in one of the > functional languages you're used to? Exactly like Aahz's, I guess, except it would consume O(1) space. > Part of the reason I'm asking about this is that I have an idea for a > preprocessor that would allow different kinds of syntactic sugar for > things that are possible, but not necessarily pretty, in python. If > python could do what you really want, how would it look? I'm not sure I *want* Python to be functional. And besides, tail recursion would be hard to do as pre-processing: post processing the byte codes or changing the byte code interpreter seems a more promising route. to-a-desolate-future-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From edcjones at erols.com Sat Feb 19 11:34:59 2000 From: edcjones at erols.com (Edward C. Jones) Date: Sat, 19 Feb 2000 11:34:59 -0500 Subject: Replacing "\"s using re.sub Message-ID: <38AEC633.C0FA6EC@erols.com> I need to replace all instances of "\" in a string with "\\". The function "re.sub" looks like the way to do it. "re.sub" is called by "re.sub(pattern, repl, string)". For my problem what should "pattern" and "repl" be? Thanks, Edward C. Jones From greg at cosc.canterbury.ac.nz Wed Feb 9 18:37:01 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 10 Feb 2000 12:37:01 +1300 (NZDT) Subject: Plex 0.1 - A Lexical Analysis Module In-Reply-To: <000801bf72bb$bd4798a0$372d153f@tim> Message-ID: <200002092337.MAA02899@purau.cosc.canterbury.ac.nz> > 2. More conventional (regexp) syntax (although I wouldn't give up the > "functional" notation you have now either! Yep, the conventional regexp parser will be a layer on top of the regexp constructors. > a set of overly general Python > FSM classes that support direct computation of regular language > intersection, complement, difference, and reversal, as well as regexpy > unions and catenations. Tell me more about how to implement these, and I'll see what I can do. If it's just a matter of gluing NFAs together, it should be quite easy. Thanks for the encouragement, Greg From wware at world.std.com Tue Feb 1 11:38:38 2000 From: wware at world.std.com (Will Ware) Date: Tue, 1 Feb 2000 16:38:38 GMT Subject: Removing objects of a superclass? References: <20000201161336.A1785@stopcontact.palga.uucp> Message-ID: Gerrit Holl (gerrit.holl at pobox.com) wrote: : is it possible to _remove_ objects of a superclass? : ...I need to remove some methods like .append and .pop. If the purpose is to simply prevent the user from calling those methods, you could overload them with methods that raise exceptions. -- People say that everyone has a few skeletons in their closet. Not me. Well, not yet anyway. I mean, the bodies are still decomposing. Will Ware email: wware[at]world[dot]std[dot]com From mikael at isy.liu.se Wed Feb 16 10:45:24 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 16 Feb 2000 16:45:24 +0100 (MET) Subject: Moving from perl to python: questions In-Reply-To: Message-ID: Hmm. Your indentation ended up corrupted here. I guess you meant: def slurp(filename): "Slurp all the lines of a file into an array" print filename try: f = open(filename) except IOError: print "IOError: ", sys.exc_value return None return f.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: 16-Feb-00 Time: 16:42:29 This message was sent by XF-Mail. ----------------------------------------------------------------------- From pinard at iro.umontreal.ca Wed Feb 16 13:53:23 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 16 Feb 2000 13:53:23 -0500 Subject: Real Problems with Python In-Reply-To: "Tim Peters"'s message of "Sun, 13 Feb 2000 16:23:07 -0500" References: <000e01bf7668$850d9740$572d153f@tim> Message-ID: "Tim Peters" ?crit: > I suspect that, like me, you're not doing any GUI programming in > Python yet. But I much leer in that direction, should I confess. :-) > The press for fancier lambdas and lexical closures is much stronger from > people who do [...] I've begun to see that lambda's are an attractive pole, indeed. Yet, lambdas returning None, and called only for side-effects, are against some good taste. I wonder which part of me will win over the other, but there is some discomfort. Python would help me much better at picking the best solution, if only it was not offering lambdas :-). As for lexical closures, you probably mean packaging widgets into classes? This looks sterling to me! But given you add: > they want to attach small & simple procedures to oodles & oodles of > widgets (your "common and frequent" indeed), and out-of-line class > solutions are legitimately viewed as clumsier and more obscure. I have the impression I did not understand what you meant by lexical closures. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From kelly at poverty.bloomington.in.us Sun Feb 13 15:33:19 2000 From: kelly at poverty.bloomington.in.us (Kelly Lynn Martin) Date: Sun, 13 Feb 2000 15:33:19 -0500 Subject: TCL has Tk... In-Reply-To: Your message of "Sat, 12 Feb 2000 22:58:56 GMT." Message-ID: <200002132033.PAA13878@poverty.bloomington.in.us> On Sat, 12 Feb 2000 22:58:56 GMT, "Robert Hicks" said: >Why can't Python have its own widget set instead of using Tk or >wxPython? Why reinvent the wheel? (FYI, I use Python with GTK. Works quite nicely.) Kelly From emile at fenx.com Thu Feb 10 22:39:29 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 10 Feb 2000 19:39:29 -0800 Subject: Bit arrays. References: <87vvao$di4$1@nnrp1.deja.com> Message-ID: <06c201bf7441$9b05ad40$01ffffc0@worldnet.att.net> I often set 'bit' style flags in integers, but leave them as integers. e.g., add 2^5+2^3+2^2 to an int to turn on bits 5,3,2 (or 4,2,1) What will you be doing? -- Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Newsgroups: comp.lang.python To: Sent: Thursday, February 10, 2000 7:23 PM Subject: Bit arrays. > Hello, > > Just wondering if there is an efficient way in python to represent > arrays or lists of bits? > > > > > > The way that I am thinking of doing it is to make a class in python and > do the following: > > > Have set and get methods for arbitary places in the array. > > It would store the data in an array of ints ( not sure what size yet ). > The best size would depend on how you change/read the array. > > The set method would be implemented in the following way: > > *Find which element in the array of ints that the bit is in. > *Convert that int into a tupple/list/array of 1s and 0s. > *Find which place in the new list of 1s, and 0s the bit which needs > changing. > *Change that bit. > *Convert the list back into a number. > > > Get would be similar. > > > > I know this would be quite slow if you are doing lots of changes all > over the array, but I am changing large ranges of bits at a time so it > should be possible to cut out lots of conversions. > > Anyone think of better ways to do this? It would probably be worth > doing this as a module in c/c++ no? > > > Thanks in advance for any help. > > Rene. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list > > From gerrit.holl at pobox.com Sat Feb 12 04:30:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 10:30:39 +0100 Subject: Except an exception AND all its subclasses? In-Reply-To: ; from moshez@math.huji.ac.il on Sat, Feb 12, 2000 at 12:02:23AM +0200 References: <20000211220612.A7720@stopcontact.palga.uucp> Message-ID: <20000212103039.A755@stopcontact.palga.uucp> Moshe Zadka wrote on 950310143: > On Fri, 11 Feb 2000, Gerrit Holl wrote: > > > Hello, > > > > it's not possible to catch an exception and all its subclasses as > > of python 1.5.2, is it? > > > > I think this would be a nice feature for a future version of Python. > > What do you think? > > Why, yes, Gerrit. > > -- Hey Barry! Stop trying to be your own father and let me use the time > machine for a second. Huh? > class A: > pass > > class B(A): > pass > > try: > raise B > except A: > print "caught it" > > Ouch! Barry, why didn't you want me about that step? Cool! This isn't mentioned in any book I read, neither in the tutorial. It is mentoined in the library reference, OK. For class exceptions, in a try statement with an except clause that mentions a particular class, that clause also handles any exception classes derived from that class (but not exception classes from which it is derived). Two exception classes that are not related via subclassing are never equivalent, even if they have the same name. But I think it should really be mentoined in the tutorial, since I did not feel the need to read this in detail after I read the tutorial. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From bwilk_97 at yahoo.com Sun Feb 6 12:11:11 2000 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Sun, 06 Feb 2000 17:11:11 GMT Subject: Excel Question Message-ID: Hello I use Excel in a Python application I have written. It works wonderfully most of the time. But from time to time my user will have two copies of Excel open. So when I run the code: >>> import win32com.client >>> e = win32com.client.Dispatch("Excel.Application") I never know which running version of Excel I am going to connect to. Does anyone know of a way to assure that I am connecting to the running version that the user is currently working with? fyi.. my program is called by a button on the open Excel spread sheet. Many thanks for any suggestions. From mikael at isy.liu.se Wed Feb 23 13:35:25 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 23 Feb 2000 19:35:25 +0100 (MET) Subject: PYTHONPATH on PC In-Reply-To: <38B424DC.276A4795@hpl.hp.com> Message-ID: On 23-Feb-00 David Smith wrote: > and it still can't find fibo. There wasn't a PYTHONPATH environment > variable, so I set it locally: > > os.environ['PYTHONPATH'] = r'.;C:\David;C:\Program Files\Python\Lib' > > and that didn't work. I have found two ways to get Python to find my > module. One is to put the module directly into C:\Program > Files\Python\Lib, but that is pretty sick. The other is to modify > Idle's shortcut to have it start up in C:\David. But what if I or > someone else wanted to work in a different directory? I thought you were supposed to do import sys sys.path.append('whateverpath') import yourmodule At least that's what I do on Unix. /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: 23-Feb-00 Time: 19:31:11 This message was sent by XF-Mail. ----------------------------------------------------------------------- From london999 at my-deja.com Sat Feb 26 04:00:07 2000 From: london999 at my-deja.com (london999 at my-deja.com) Date: Sat, 26 Feb 2000 09:00:07 GMT Subject: self argument Message-ID: <8984mm$5pi$1@nnrp1.deja.com> I am very new to Python, but it appears that every function defined in a class must have self as a first variable name. Assuming that is the case, it would be nice if there was an error message given when the interpreter encounters a function that is defined without self (rather than giving the error message "TypeError: no arguments expected" when the function is called. Even better, it would be nice (probably too late I know), if self was defined implicitly as the "this" pointer is in C++. Sent via Deja.com http://www.deja.com/ Before you buy. From gerrit.holl at pobox.com Sat Feb 12 11:30:38 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 17:30:38 +0100 Subject: Fully Bracketed Syntax In-Reply-To: <882j3g$dse$1@news.udel.edu>; from tjreedy@udel.edu on Fri, Feb 11, 2000 at 10:12:29PM -0500 References: <38A337F7.9059B943@americasm01.nt.com> <20000211073300.A711@stopcontact.palga.uucp> <882j3g$dse$1@news.udel.edu> Message-ID: <20000212173038.A4326@stopcontact.palga.uucp> Terry Reedy wrote on 950303549: > > "Gerrit Holl" > > Eaglestone, Robert NGC:B918:EXCH" wrote on 950195591: > > ... > > > if ( foo > bar ) > > > do_something(); > > > do_something_else(); > > > done(); > > > endif > > > > Let me add two characters, and it's totally valid. > > > > if ( foo > bar ): > > do_something(); > > do_something_else(); > > done(); > > #endif > > To 'make up' for the two added chars, we can delete the two parens. > Also, ;\n is redundant if \n is used as a terminator rather than whitespace. I know, read the original mail please. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From phd at phd.russ.ru Wed Feb 16 11:20:55 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Wed, 16 Feb 2000 16:20:55 +0000 (GMT) Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: <1261405634-3407526@hypernet.com> Message-ID: Evening! On Wed, 16 Feb 2000, Gordon McMillan wrote: > > And what's wrong with using Berkeley DB 2.0+ ? > > The only complaint was about the license, (although I think I am not a lawer, but I don't see any problem here. SleepyCat's FAQ has clear statement (http://www.sleepycat.com/faq.html#A22): 22.Do I have to license Berkeley DB to use it in Perl or Python? No. The Berkeley DB license requires that software that uses Berkeley DB be freely redistributable. In the case of Perl or Python, that software is Perl or Python, and not your scripts. Any scripts you write are your property, including scripts that make use of Berkeley DB. None of the Perl, Python or Berkeley DB licenses place any restrictions on what you may do with them. > the use of the name "DB" is presumptuous). :) > In a test of bsddb functions, Metakit will be much slower in > adding, roughly the same speed in retreiving, much smaller > and use less system resources. In a test of Metakit functions > (select, join, nested views) bsddb will be a non-starter. Good analysis. Thanks. That exactly what I want to see. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From effbot at telia.com Mon Feb 21 19:18:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 00:18:21 GMT Subject: Tkinter - how to make a "Toplevel" window non-sizeable? References: <38B1CBB6.7C85AF61@parlant.com> Message-ID: Thomas Lane wrote: > Does anyone out there know how to make a Toplevel window non-sizeable? > I'm trying to make a custom dialog box, but I don't want the user to be > able to resize it. Is there some other widget that is more appropriate > than a Toplevel widget for creating a dialog window, or is there some > attribute I can set that turns off the ability to resize it? As usual, > any help would be greatly appreciated. top.resizeable(0, 0) for more info, see: http://www.pythonware.com/library/tkinter/introduction/toplevel-window-metho ds.htm => geometry methods From hanche at math.ntnu.no Tue Feb 1 10:32:57 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 01 Feb 2000 10:32:57 -0500 Subject: time module & ISO dates References: <949385408.356246722@news.intergate.bc.ca> Message-ID: + Gerald Gutierrez : | Is there any way to get the standard Python time module to properly | parse full ISO-8601 dates, such as "2000-01-31T22:07:43-0800"? | strptime() ALMOST does what is needed but it does not provide for | parsing the UTC offset at the end (the "-0800"). Apparently not, but mxDateTime contains a module ISO which seems to do what you want. If you don't want the whole module, you may be able to extract the parts you do want. | Also, does anyone know where I can get a list of standard timezone | names as is understood by Python? As far as I can tell, that depends on the underlying C implementation. Relying on standard time zone names is in general not to be recommended anyway, since there *is* no generally recognized standard, except for UTC and its aliases GMT and Z. (Beware of military single-letter time zone names other than Z, as RFC 822 got them backwards, rendering them useless for mail purposes.) True, the time zones of the continental US are standard for mail, but even for those confusion is possible, as some take EDT to mean European daylight time! You are better off sticking to numerical time zone designators. In particular, the time zone names on various Unix boxes are not to be trusted. They should be used merely as local conventions used to manage local time zone information. Sometimes I wonder if time zones are worth the bother. Why not stick to UTC for all purposes? In my current time zone (-0400), I could get up at 12:00 and go to bed at 04:00 and not feel guilty about it. but-the-Japanase-might-see-it-differently-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 tbryan at python.net Sun Feb 6 08:16:15 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sun, 06 Feb 2000 08:16:15 -0500 Subject: chdir questions References: Message-ID: <389D741F.421DA0DD@python.net> Patrick K Moorman wrote: > I know this is must be an easy one but how do I use os.chdir? >>> os.chdir('C:\\temp') or >>> os.chdir(r'C:\temp') You need the two backslashes (or the "raw string") simply because the a single backslash followed by the letter t will expand to a tab in a normal string. >>> print 'C:\temp' C: emp >>> print 'C:\\temp' C:\temp >>> print r'C:\temp' C:\temp I would normally recommend that you look at the docstring or the source, but the docstring says >>> print os.chdir.__doc__ chdir(path) -> None Change the current working directory to the specified path. which wouldn't have helped, and I can't seem to find any definition for os.chdir in the Python libraries. It's defined *somewhere*, and I'm sure that someone will show me where. One of the greatest things about open source is that you're never really stuck. For example, if you can't figure out how to use glob, you can always look at glob.py to see what it does. ---Tom From morse at harborcom.net Wed Feb 23 08:25:34 2000 From: morse at harborcom.net (Kevin Dahlhausen) Date: Wed, 23 Feb 2000 13:25:34 GMT Subject: Which GUI? References: <88jg9f$ssd$1@nnrp1.deja.com> Message-ID: <38b3df23.76266295@news.oh.verio.com> ndev42 at yahoo.com wrote: >Is there any GUI toolkit that supports the following >requirements? > >- As portable as Python. >- Does not need ANY extra library to compile, i.e. knows > how to talk to the underlying windowing library underneath, > whether it is X11, Motif, Windows or Mac. >- Clean design, if possible OO. >- Easy to use, to learn, and well-documented. >- Free software license. >- Offers the standard widget toolkit plus some fancy stuff > like grids or plots. Fast-Light Toolkit meets these. As pointed out, the wrapper doesn't allow you to subclass arbritary widgets yet. The grid widget is an add-on, and the wrapper for it is started but not complete. The Python wrappers are over on: http://fltk.netpedia.net From moshez at math.huji.ac.il Fri Feb 18 09:48:21 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 16:48:21 +0200 (IST) Subject: Which GUI? In-Reply-To: Message-ID: [Gerrit Holl] > I think I'll make another point 'can be subclassed' in my comparison. [Moshe Zadka, claiming it isn't an important issue] [Joel Lucsy] > The idea for subclassability is for creating custom controls with custom > looks. For instance, if I wanted a grid control which allowed for spacings > between the grids, or better yet, custom grid objects, how would I do this > without subclassing? Callbacks I suppose. Well, the GUI toolkit has to offer > them, which some don't. In Tkinter you can wrap a bunch of stuff into a > metawidget so one doesn't need to subclass. wxPython doesn't need > subclassing because it uses events (but you can also subclass as well). In > (py)FLTK you need to subclass in order to get these custom objects. And > because (py)FLTK doesn't have a lot of controls, it becomes paramount to be > able to do this. It just depends of the toolkit. So what we should be comparing is customizablity, not subclassibility, which is one way (suboptimal, IMHO) to implement customizablity. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From effbot at telia.com Tue Feb 29 12:31:52 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 17:31:52 GMT Subject: re.compile question References: Message-ID: Gregoire Welraeds wrote: > How can I test that a re.compile has failed, Eg: If i simply forget a ( > in my regular expression why not just compile a bad expression and see what happens? ;-) >>> re.compile("(") Traceback (innermost last): File "", line 1, in ? File "C:\py152\lib\re.py", line 79, in compile code=pcre_compile(pattern, flags, groupindex) pcre.error: ('missing )', 1) (to catch the exception, use try/except re.error) From gerrit.holl at pobox.com Fri Feb 18 16:51:10 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 22:51:10 +0100 Subject: None & Ellipsis In-Reply-To: ; from moshez@math.huji.ac.il on Fri, Feb 18, 2000 at 10:58:17PM +0200 References: <20000218214032.A8179@stopcontact.palga.uucp> Message-ID: <20000218225110.A9409@stopcontact.palga.uucp> Moshe Zadka wrote on 950911097: > On Fri, 18 Feb 2000, Gerrit Holl wrote: > > > Hello, > > > > why aren't None and Ellipsis keywords? > > Why should they be? For sequence unpacking: >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') >>> t1, t2, None, t4, t5, None, None, t8, None = t >>> None 'i' I want to use None to say "ignore this". regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From thantos at chancel.org Fri Feb 25 04:26:33 2000 From: thantos at chancel.org (Alexander Williams) Date: Fri, 25 Feb 2000 09:26:33 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> <38B6420B.6A9D66DE@nembv.cz> Message-ID: On Fri, 25 Feb 2000 09:49:15 +0100, Milos Prudek wrote: >> A = H.readlines() > >Yeah, but I need to remove empty lines as well... Try: >>> A = filter(None, H.readlines()) filter() with None as the function to use as the test for elements removes any that test as False intrinsically; since the empty line is always False, it returns a list with only strings with length. Bingo. -- Alexander Williams (thantos at gw.total-web.net) | In the End, "Join the secret struggle for the soul of the world." | Oblivion Nobilis, a new Kind of RPG | Always http://www.chancel.org | Wins From gerrit.holl at pobox.com Thu Feb 17 16:14:52 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 22:14:52 +0100 Subject: Help needed writing GUI comparison Message-ID: <20000217221452.A2943@stopcontact.palga.uucp> Hallo, I'm writing a GUI comparison, and I really need help. I don't want to take the time to learn all GUI's. What I have so far is attached (HTML), and also available at the following URL: http://www.nl.linux.org/~gerrit/gui.html Please help and contribute! regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From psilva at ruido-visual.pt Thu Feb 10 10:45:27 2000 From: psilva at ruido-visual.pt (Pedro Silva) Date: Thu, 10 Feb 2000 15:45:27 -0000 Subject: (no subject) Message-ID: <002001bf73dd$da4b5540$6c00a8c0@ruidovisual.pt> I would like to make me sorry for my questions had appear in html text, I think that now it is better -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Thu Feb 24 20:54:29 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 20:54:29 -0500 Subject: pythonware.com - cannot access References: <894iuc$qi1$1@news.udel.edu> <20000224195150.A3588@quark.internal> Message-ID: <894mtr$s5l$1@news.udel.edu> "Jeff" wrote in message news:20000224195150.A3588 at quark.internal... > On Thu, Feb 24, 2000 at 07:46:29PM -0500, Terry Reedy wrote: > > For a couple of weeks, at least, I have been unable to access > > http://www.pythonware.com/ > > or pages beneath from Delaware USA, with Win98 IE5.01. > > This is the only presumed-to-be-good site that I am having problems with. > > Anyone else having a similar blockage? > > Terry J. Reedy > > I am not currently having a problem reaching www.pythonware.com, nor am I > having trouble reaching your dialup host.. my guess would be a network > problem, which you should escalate to your ISP, are you about to > 'traceroute' to the site? can you access other sites like python.org? or > slashdot.org, or freshmeat.net? yes, yes, yes, and so on for numerous other sites I've recently visited. >do you know anyone else that also has a dialup account with udel that might be able to help you out? Like to see if they have the same problem? Good idea. Will try to call someone when I hang up. Or have wife try from on-campus direct-connect machine. Thanks for suggestion. From jblaine at shell2.shore.net Sat Feb 19 20:23:04 2000 From: jblaine at shell2.shore.net (Jeff Blaine) Date: Sun, 20 Feb 2000 01:23:04 GMT Subject: Review of the new TK book from Manning? References: <38AD953A.F89C5515@exceptionalminds.com> Message-ID: If you're not already aware, you can read several sample chapters online at http://www.manning.com/Grayson/ I've got it, but have not had a chance to open it yet. On Fri, 18 Feb 2000 10:53:46 -0800, Timothy Grant wrote: >Is there anyone out there who can provide a review of the new Tkinter >book that was just published by--I believe Manning? From moshez at math.huji.ac.il Fri Feb 18 08:09:07 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 15:09:07 +0200 (IST) Subject: CGI/HTML forms in a standalone application. In-Reply-To: <38AD2DB0.6877BD72@inka.de> Message-ID: On Fri, 18 Feb 2000, Michael [iso-8859-1] Str?der wrote: > > You can derive a class from SimpleHTTPRequestHandler, copy some code from > > CGIHTTPRequestHandler and come up with a class > > CGILikePythonFunctionHTTPRequestHandler > > I did this and it works as expected except that the browser does not > stop loading. Do I have to close a socket or associated file? Yes: you have to close the associated file object, which you get as an attribute of the class in the .handle() method. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From alex at somewhere.round.here Wed Feb 9 11:04:34 2000 From: alex at somewhere.round.here (Alex) Date: 09 Feb 2000 11:04:34 -0500 Subject: Why doesn't cStringIO.StringIO () have write methods? References: Message-ID: Ah, OK. Thanks, Fredrik. Is there some advantage to having different types returned by StringIO, one of which doesn't have write methods? Alex. From Szilveszter.Juhos at durham.ac.uk Wed Feb 16 10:51:31 2000 From: Szilveszter.Juhos at durham.ac.uk (Szilveszter Juhos) Date: Wed, 16 Feb 2000 15:51:31 +0000 Subject: Plugin into a server Message-ID: I want to install new executable objects into a server (running on a remote machine) with a client like: class Printer: """ This class should run on the SERVER side """ def Run(self): print 'dummy message' theClient = Connector() theClient.SendObject(Printer(),'cmd') del theClient The idea is that the Connector class implements the interface between the server and the client. When I send an object with attribute 'cmd', the server side will accept it as an executable object at the server side. I can easily trasfer data, but not executable. It is obvious from the documentation that pickling/marshaling will not work (at least I could not find a way), but what is the way than to send executable objects across network? Szilva http://elvira.dur.ac.uk/~ndgy/ From rdudfield at my-deja.com Fri Feb 11 01:54:18 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Fri, 11 Feb 2000 06:54:18 GMT Subject: Bit arrays. References: <87vvao$di4$1@nnrp1.deja.com> <06c201bf7441$9b05ad40$01ffffc0@worldnet.att.net> Message-ID: <880bmq$lqm$1@nnrp1.deja.com> In article <06c201bf7441$9b05ad40$01ffffc0 at worldnet.att.net>, "Emile van Sebille" wrote: > I often set 'bit' style flags in integers, but leave them as > integers. e.g., add 2^5+2^3+2^2 to an int to turn on bits > 5,3,2 (or 4,2,1) > > What will you be doing? > > -- > > Emile van Sebille > emile at fenx.com > ------------------- > Thanks for that, I forgot how to do it and couldn't work it out. I found another way which I'm scared to mention... it involved splitting the 8 bits up into two halves getting their hex values and lots more weirdness. This way is much nicer, and faster too if you put the results of pow in a dictionary. Thanks again :) Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From reic0024 at ub.d.umn.edu Mon Feb 14 00:35:05 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Sun, 13 Feb 2000 23:35:05 -0600 Subject: map.yahoo.com uses Python? Message-ID: I went to maps.yahoo.com to look something up, and lo and behold, it looks like they use Python for their map CGI -- http://maps.yahoo.com redirects you to http://maps.yahoo.com/py/maps.py. Just an interesting note, I suppose. Aaron From nospam at bitbucket.com Sat Feb 19 02:05:49 2000 From: nospam at bitbucket.com (Phil Mayes) Date: Fri, 18 Feb 2000 23:05:49 -0800 Subject: Which GUI? References: <88jg9f$ssd$1@nnrp1.deja.com> <90041EE28E4B778A.B7E5C38CAFBFC6FD.1FE0A06FDC52F8CF@lp.airnews.net> Message-ID: Cameron Laird wrote in message <90041EE28E4B778A.B7E5C38CAFBFC6FD.1FE0A06FDC52F8CF at lp.airnews.net>... >In article <88jg9f$ssd$1 at nnrp1.deja.com>, wrote: >> >>> I would like pro and cons for the different GUI's >> >>I would like to add: >> >>Is there any GUI toolkit that supports the following >>requirements? >> >>- As portable as Python. > . > . > . >No. 'Never will be. Python is magnificently portable. It's >really, *really* good in this regard. I propose that there >will NEVER be a GUI toolkit that handles WinCE, QNX, MacOS, >NeXT, BeOS, ... with comparable comfort. And that is because Python sits on top of C, which has had 25 years to learn how to be portable. If the GUI portion of a program is 75% of its complexity, that means the GUI portion of an OS is 3x the complexity of the files/ sockets/threads/processes core. ndev42 also wanted the toolkit: >- Does not need ANY extra library to compile, i.e. knows > how to talk to the underlying windowing library underneath, > whether it is X11, Motif, Windows or Mac. Because abstracting the GUI is such a huge task, I think a monolithic approach would be a waste of effort. Adopting a toolkit and automagically installing it is the way to go, and Python has done that with tcl/tk (at least, the Windows install gives that option; maybe other installs don't). -- Phil Mayes pmayes AT olivebr DOT com From gmcm at hypernet.com Sat Feb 19 16:02:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 19 Feb 2000 16:02:18 -0500 Subject: ODBC, mxODBC problem In-Reply-To: <88mr8f$482$1@nnrp1.deja.com> Message-ID: <1261128356-5833570@hypernet.com> rockjock810 at my-deja wrote: > I didn't have any problems making it work on the same WinNT machine > using Perl. And yes, the DSN was defined in the ODBC manager. I suspect > that Python seems to treat WinNT network shares rather odd. Maybe a > little enlightenment on how it interacts with other servers would do > the trick. I tried this script: > > n=open(r"\\www\c$\cgi-bin\test.dat","r+") > > and I've been getting "Permission denied" messages. I can open files that way, so the "Permission denied" probably means just what it says. Earlier you wrote: > odbc.odbc("express/Admin/") > odbc.odbc("express/Admin") > Not one works. And with mxODBC: > ODBC.Windows.DriverConnect("DSN=express;UID=Admin;PW D=;") > ODBC.Windows.ODBC("express","Admin","") > Not much luck here either. I tried running said statement(s) in > Pythonwin's interactive mode, and it works. What does it fail with as a script? Are you trying to run this as a CGI (where you are almost certainly running under a different account)? Earlier still you wrote: > Traceback (innermost last): File "d:\the-cafe\cgi- bin\express.py", line > 25, in ? db=odbc.odbc("express") dbi.operation-error: > [Microsoft][ODBCMicrosoft Access 97 Driver] The Microsoft Jet database engine cannot > open the file '(unknown)'. It is already opened exclusively by another > user, or you need permission to view its data. in LOGIN Hmm. Yup. Running as a CGI, and the web server is almost certainly not running you in an account that has permission. - Gordon From cbbrowne at news.hex.net Tue Feb 8 20:14:34 2000 From: cbbrowne at news.hex.net (Christopher Browne) Date: Wed, 09 Feb 2000 01:14:34 GMT Subject: mail filter in python? References: <20000208000902.31713@nms.otc.telstra.com.au> <20000207154641.A2817@stopcontact.palga.uucp> <38A06C98.9B2ECA2A@sage.att.com> Message-ID: <_b3o4.18107$my1.548144@news4.giganews.com> Centuries ago, Nostradamus foresaw a time when Garrett G. Hodgson would say: >Fran?ois Pinard wrote: >> > What about creating a mail filter with a Python syntax? >> > Shouldn't be too difficult, just create some functions (drop, >> > match_header) and execfile() a file with the rexec module... >> >> Do not underestimate what `procmail' does. It has a _lot_ of >> features, and was debugged over many years, by a rather careful >> programmer. Of course, one may try and do better, this is often >> how programs evolve. But the overall problem might much, much more >> obfuscated than procmail syntax :-). > >that's two people who've pointed out the difficulty in getting it >right. Perhaps a better approach is to build yourself a python >syntax to generate the crufty procmail syntax. How Lisp-like... Yes, that is probably a really good answer: a) It means that you're using the "standard" tool, procmail, and can benefit from whatever bug fixes take place with it, b) It means that you're not introducing new locking errors, c) It means you don't need any customized software. No need for a special "procmail-python" package; all you need is a script. -- "If you give someone Fortran, he has Fortran. If you give someone Lisp, he has any language he pleases." -- Guy L. Steele Jr. cbbrowne at ntlug.org- From sabren at manifestation.com Tue Feb 22 18:49:29 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Tue, 22 Feb 2000 18:49:29 -0500 (EST) Subject: Win 95, PWS, Unable to run python In-Reply-To: <88qkup$gk8$1@nnrp1.deja.com> Message-ID: On Mon, 21 Feb 2000 rchowd1 at my-deja.com wrote: > PWS (Personal Web Server) is running on my Windows 95 OS. > But whenever I am trying to execute the Test.asp file I get > entire Test.py file as is instead of getting executed. Could > you please let me know what I am doing wrong. The following > files work when I use APACHE WEB SERVER. Unless your PWS is a lot cooler than mine, you simply can't do CGI with it. :) Stick with Apache, or turn your python into an ASP file. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From KRodgers at ryanaero.com Fri Feb 25 11:10:31 2000 From: KRodgers at ryanaero.com (Rodgers, Kevin) Date: Fri, 25 Feb 2000 08:10:31 -0800 Subject: Bug in win32all-128 with multiprocessor NT Message-ID: <0D8C1A50C283D311ABB800508B612E5354B39C@ryanaero.com> How strange! Maybe this is a difference between NT 4.0 and Win2K. I've never had a problem with the FindPerformanceAttributesByName function . . . > -----Original Message----- > From: Darrell [SMTP:darrell at dorb.com] > Sent: Thursday, February 24, 2000 8:44 PM > To: Rodgers, Kevin > Cc: python-list at python.org > Subject: Re: Bug in win32all-128 with multiprocessor NT > > > > > The "pname" is to be replaced by whatever process name you want to try > this > > on. For example, if you have the NT version of XEmacs running, the line > > would look like: > > pid = win32pdhutil.FindPerformanceAttributesByName("xemacs") > > > Yelp that's what I did. Tried with and without the ".exe". It just sits > there for about 15sec > ,chewing up CPU then returns []. > > --Darrell > From lizzie at cc.gatech.edu Thu Feb 17 11:37:11 2000 From: lizzie at cc.gatech.edu (lizzie) Date: Thu, 17 Feb 2000 11:37:11 -0500 Subject: Multiple copies being sent via UDP? Message-ID: <38AC23B7.F5D882F@cc.gatech.edu> Hi-- I've got a nifty issue which someone might be able to shed some light on. I'm running on an NT machine, Python 1.5.2. Each time I send a UDP packet, it actually appears on the network multiple times (used NetworkSpy to sniff) Debugging information shows that for each time the code is called, 4 UDP packets are sent - it first sends 1, and then milliseconds later sends 3 at the same time. (If it's any help, this isn't happening with TCP) While this is not a tragedy, it is stuffing the network with more info than I want. Does anyone have any ideas? ---code snippet--- def SendUDP(self, ip, msg): try: UDPSocket = socket(AF_INET, SOCK_DGRAM) UDPSocket.sendto(msg, (ip, PORT)) if DEBUG: print 'sending UDP', msg,'to', ip, 'of length', len(msg) except SendUDPFailure: print 'Failed to send', msg, 'to', ip, 'via UDP' --------- ~lizzie lizzie at cc.gatech.edu From gonzo at vex.net Mon Feb 28 18:10:28 2000 From: gonzo at vex.net (Anthony DeLorenzo) Date: 28 Feb 2000 23:10:28 GMT Subject: Module import problem Message-ID: <89ev94$1sfi$1@news.tht.net> I'm having the dumbest problem trying to import a module. I can't figure it out at all. Basically, I'm on a win32 system. The directory \py152\lib is on my python path, and I'm trying to import the module \py152\lib\gadfly\gadfly.py. So, I use this: import gadfly.gadfly And for some incomprehensible reason it doens't work. I've used this statement to import other modules in sub-folders, but it just won't work for this particular one. Any ideas, because I'm stumped. The only way I can get it to import is by running python from the gadfly directory, so I do at least know that the module exists. Tony -- # Anthony DeLorenzo # http://www.vex.net/~gonzo/ # mojo wire: 209-391-8932 From m.faassen at vet.uu.nl Wed Feb 9 00:32:28 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 9 Feb 2000 05:32:28 GMT Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> <87plr8$qig$1@news.tht.net> Message-ID: <87qu5c$inu$1@newshost.accu.uu.nl> tim wrote: [snip] > I'm not advocating not uploading to ftp's, and I'm not saying a central FTP > based archive (CPAN-like, or otherwise) would not be helpful or useful, and > appealing to many! (After all, it's a fairly frequently recurring thread > here---Deja search for CPAN in this newsgroup reports about 300 hits.) I > wish you all good fortune imaginable in your pursuit of a central python > FTP archive. I here merely muse over the curiously ironic case which this > thread has spawned out of. > Just ignore me. (-: Let's not ignore you. :) Am I the only one who thinks that this 'archive of Python modules' could be constructed pretty easily now that you gave us Parnassus? We can write a script that translates Parnassus's structure into directory structure, and then downloads everything through any download link given. Add an extra link to Parnassus download pages ('cached'), and open an FTP site if you like. Run this script once every while, or continuously in the background of something. And there we have our archive. Am I missing something? I'm not saying *Tim* should do this all this hard work (he's doing more than enough already), but am I the only one who considers this quite doable given Parnassus? Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From herzog at online.de Fri Feb 25 12:19:24 2000 From: herzog at online.de (Bernhard Herzog) Date: 25 Feb 2000 18:19:24 +0100 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <38B69CE2.516D99B@tismer.com> Message-ID: Christian Tismer writes: > Gerrit Holl wrote: > > > > Hello all, > > > > I have a problem. In my Python enthuishasm, I ripped off the braces > > from my keyboard because I thought I didn't need them. > > Unfortunately, I have a problem now. I can't create dictionairies any > > more! And because braces aren't the only keys on the brace key, > > I can't create lists either. The solution for the latter is list(()), > > but how do I create an empty dictionairy without braces? > > > > I know I can do: > > >>> import os > > >>> d=os.environ.data > > >>> for k in d.keys(): > > ... del d[k] > > ... > > >>> d > > {} > > > > But is there a more efficient way to do it? Does the 'new' modules has > > something I want? > > >>> class braces: > ... def __call__(self): return self.__dict__ > ... shouldn't this return a copy of the dictionary? > >>> dic = braces()() > >>> dic > {} > >>> > Well, the lack of [] doesn't make this too useful. you could always use the get method. [...] > > HELP! > > > > If I'll rip off the ';' too, I won't be able to type blocks any more, > > since I won't be able to type a ':' either. Hmm, is it safe to rip > > off the '$'? I don't need a '4'! > > I just successfully ripped out my ";", and it still works fine. > Hint : use a German keyboard. > Well, I'm missing the comma a little now. > No problem, since I can always change tuples to lists, modify > them and tuple them back. How do you call functions with more than one argument now? apply() isn't very helpful in this case. The only thing I can come up with is to use exec or eval and encode the comma in the string with \054. Of course, you could always use cut and paste... -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From prudek at nembv.cz Mon Feb 28 04:03:49 2000 From: prudek at nembv.cz (Milos Prudek) Date: Mon, 28 Feb 2000 10:03:49 +0100 Subject: Bring value from walk() References: <1260637200-9073387@hypernet.com> <38B68FE6.35EABD1B@nembv.cz> <38B69A71.CA1546BF@bellatlantic.net> Message-ID: <38BA39F5.79160953@nembv.cz> > I would love to know if you've found some way to account for the space > occupied by directories, and if you know of some automated way to grab > the clustersize of the partition. I will calculate one cluster for each directory. I will use win32api.GetDiskFreeSpace to learn about cluster size. This is a MS Win only project... I would love to use portable system call but I do not know if there is one. -- Milos Prudek From XoseLuis at retemail.es Sun Feb 6 13:41:51 2000 From: XoseLuis at retemail.es (Xose L. Gonzalez) Date: Sun, 06 Feb 2000 19:41:51 +0100 Subject: modules documentation Message-ID: <389DC06F.52BA60AB@retemail.es> Hi Being new in Python, I got impressed by its easiness for learning it and using it, but IMO there is a lack of documentation, namely: Where (web page) can I get a modules' documentation more complete than the one supplied in the Python delivery, specially regarding the text files processing?? (normally there are no examples in the modules tutorial) As a general comment: really Python is fantastic, but the documentation is very importatn to demosntrate it. I think it is a common problem in softawre (my problem also): we do very good applications but we do not like at all doing documentation. PS: email copy of the answer would be appretiated. Thanx in add-vans -------------- next part -------------- An HTML attachment was scrubbed... URL: From sholden at bellatlantic.net Sun Feb 20 15:12:11 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sun, 20 Feb 2000 20:12:11 GMT Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <20000216073317.A579@stopcontact.palga.uucp> <88eojc$jed$1@nnrp1.deja.com> <8pOq4.122$mYj.170920448@newsa.telia.net> <88ikiq$ajp$1@nnrp1.deja.com> Message-ID: <38B04A2D.40B5890E@bellatlantic.net> Forrest Cahoon wrote: > > [Justifications of original post's tone] > > Are you suggesting that my initial posts were immature, or my public > mention of the noxious private e-mails I received from Moshe Zadka? > > If the former, I believe I have addressed this above. As for the > latter, it is difficult to know what to do when someone, who > participates civally in public discussion, sends private e-mail that is > very much less than civil. (He got the "Oh YEAH!?!?" part down really > good, but there was nothing remotely resembling an 'X' in what he had to > say.) Moshe Zadka is the only person who sent me mail from this > discussion that wasn't also posted. Netiquette dictates that I not post > his private e-mail publically (although I wonder about that), but > mentioning this private behavior to the public audience seems the only > reasonable response. How else could I discourage his behavior? > Responding to him directly would only have encouraged him. Generally, experience teaches that it is difficult to DO anything public which will moderate the tone of something happening in private. Since you were wise enough not to repost the private mail, we can have no real insight into the behavior that inflamed you, and since I don't know you any better than I know the other protagonist I continue to fall back on the default assumption for newsgroups: take people as you find them, and form your opinions form their public posts and direct private mails. It's annoying, but in fact, the best action in circumstances like this is usually to turn the other cheek and just do nothing. Otherwise you run the risk of becoming embroiled in endless (public or private) flame wars which are pretty much just a useless waste of energy. We all sometimes say and do things we'd rather not have, and I' always grateful if someone is kind enough to ignore my less honorable outbursts ... :-) > > > until then, hope you'll enjoy sitting in my killfile. > > > > *plonk* > > Somehow, I couldn't come up with a response to this "threat" that didn't > sound as silly as you sound. Maybe a little bit of silliness is OK, > though. I hope this reinforces my contention that no response is actually the most appropriate response. This is a NEWSGROUP, which is (sometimes) only marginally connected with real life. And there's certainly nothing wrong with a little bit of silliness. Does the phrase "... and now for something completely different ..." ring any bells? > > f > > Sent via Deja.com http://www.deja.com/ > Before you buy. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From loewis at informatik.hu-berlin.de Mon Feb 21 09:17:44 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Feb 2000 15:17:44 +0100 Subject: None & Ellipsis References: <20000218214032.A8179@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > why aren't None and Ellipsis keywords? They are values, and that would be a precedent of keywords in Python indicating values. The strings and numbers are, strictly speaking, not 'keywords', because they aren't even words. To the user, it normally should make no difference. For the Python implementation, it would enable slight optimizations, e.g. to enable the famous 'ret None' bytecode instruction. It is very possible that such optimizations are performed in future Python versions; so you can treat None and Ellipsis today as if they were keywords. Of course, following the Python style, they should be lowercase if they were keywords. Regards, Martin From embed at geocities.com Wed Feb 23 13:27:00 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 23 Feb 2000 13:27:00 -0500 Subject: PyQT,PyKDE failure: Message-ID: I tried to install some RPMs for PyQT and PyKDE and got the following error on my system. I had to install PyKDE using the following command because it didn't recognize PyQT as being installed on my system: rpm --upgrade --force --nodeps PyKDE* It was saying PyKDE requird PyQT but when I typed "rpm -q PyQT" it returned the correct version of PyQT as installed. Has anyone else got PyQT working, and what RPMs did you install? [i am using Red Hat Linux 6.1] Warren --- The traceback error when I attempt to run a demo of PyQT is: Traceback (innermost last): File "/usr/lib/python1.5/site-packages/idle/ScriptBinding.py", line 131, in run_module_event execfile(filename, mod.__dict__) File "/usr/doc/PyQt/examples/aclock.py", line 4, in ? from qt import * File "/tmp/PyQt-0.10.1-root/usr/lib/python1.5/qt.py", line 16, in ? import libqtc ImportError: /usr/lib/libsip.so.1: undefined symbol: __pure_virtual From hanche at math.ntnu.no Thu Feb 24 17:09:53 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 24 Feb 2000 17:09:53 -0500 Subject: Optimizing code References: <20000224161930.A4922@stopcontact.palga.uucp> Message-ID: + Gerrit Holl : | class DiskUsage: | __size = 0 | def add(self, filename): | self.__size = self.__size + os.path.getsize(filename) | def __call__(self, arg, d, files): | for file in files: | filename = os.path.join(d, file) | if os.path.isfile(filename): self.add(filename) | | def __len__(self): | return self.__size | | def du(dir): | disk = DiskUsage() | os.path.walk(dir, disk, ()) | return len(disk) [...] | Timing turns out that the 'os.path.walk' part takes about 2.7 | seconds, for a 400 MB dir with 1096 dirs and 9082 files. 'du -s ~' | takes 0.2 seconds. What makes this slow? The special methods? The | redefinition of an integer? os.path.walk? With longs, it even takes | 12 seconds... One thing that slows your code down, is that it calls stat() three times on every regular file in the tree: First, in os.path.isfile, second, in os.path.getsize, and third, in os.path.walk, which needs to find out if a filename corresponds to a directory or not. | Can I optimize it? If so how? Here is my best effort so far. It is nearly three times as fast as yours (but less portable perhaps). Well, actually yours didn't work at all on my system, because the length of a file is a long integer: File "du.py", line 21, in du return len(disk) TypeError: __len__() should return an int #! /usr/bin/env python import sys import os import stat class DiskUsage: def __init__(self): self.__size = 0 def __call__(self, dir): # Importing these names is possibly a useless optimization: from stat import S_ISDIR, S_ISREG, ST_MODE, ST_SIZE files = os.listdir(dir) dirs = [] for file in files: filename = os.path.join(dir, file) s = os.lstat(filename) mode = s[ST_MODE] if S_ISDIR(mode): dirs.append(filename) elif S_ISREG(mode): self.__size = self.__size + s[ST_SIZE] for dir in dirs: self(dir) def len(self): return self.__size def du(dir): disk = DiskUsage() disk(dir) return disk.len() def main(): if len(sys.argv) != 2: sys.stderr.write("usage: %s " % sys.argv[0]) sys.exit(1) print du(sys.argv[1]) if __name__ == '__main__': main() -- * Harald Hanche-Olsen - "There arises from a bad and unapt formation of words a wonderful obstruction to the mind." - Francis Bacon From effbot at telia.com Sun Feb 27 05:50:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 10:50:39 GMT Subject: so how do I run this thing?!!!! References: Message-ID: <3k7u4.8157$al3.108001@newsc.telia.net> Collin Greene wrote: > thanks for all you help everyone, I know how to basicially use Python now > but I don't really understand it seems as if there should be a way to run > what you have written. I have tried the run command but it just showns me > what i just wrote. Is there a place to actuially see waht you have witten? (assuming you mean "run" instead of "see" in the last sentence, right?) what environment are you using? most IDE's (including IDLE, PythonWin, emacs, etc) have commands that run your Python program and displays the output. otherwise, if you're using Windows with any non-Python aware editor, fire up a command window (aka MS-DOS prompt) and run the script from there. e.g: c:\mydir> python myscript.py hope this helps! From gmcm at hypernet.com Tue Feb 29 21:27:02 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 29 Feb 2000 21:27:02 -0500 Subject: Is mxDateTime compatible with Installer In-Reply-To: Message-ID: <1260244873-32671355@hypernet.com> [Calishar solves his problem with Installer & mxDateTime] > The mxDateTime package is constructed as follows > > (libdir)[1]/DateTime/mxDateTime > > the DateTime package contains some other utilities (feasts, ISO, ARPA, > lazyimport), and the mxDateTime package. the mxDateDtime package > contains the mxDateTime.pyd file. > > The __init__.py file in DateTime imports the DateTime.py file, which > imports the mxDateTime package. The __init__.py file in the mxDateTime > directory just imports the mxDateTime.pyd file. > > It looks as if either Installer was getting confused, or the final app > was getting confused by having two levels of mxDateTime it could > import. My head hurts just thinking about it ;-(. I'll experiment with mxDateTime one of these days soon. > The way I ended up solving it was renaming the mxDateTime directory to > something else, and copying the mxDateTime.pyd file to the dlls > directory under (pythonroot)[2]. ...or if my skull starts popping rivets, I'll just put the above in the FAQ. > Since you know how Installer works a lot better than I do (or could > hope to figure out during an insanity packed day) does my solution > make logical sense? (I know it works, just wondering if you can > explain why) If it works, it must make sense :-). wxPython puts the .pyds in the package directory, and it is compatible with Installer. So, no, I don't understand why mxDateTime is a problem. Yet. > Once again, thanks for all the help on this (and if you can figure out > how to let us change icons on win9x machines, I promise to try to > setup the first shrine to Gordon Macmillan in this city, can't do it > someone else has beaten me to it) I'm as anxious for public adulation as any geek, but it's Thomas Heller who contributed that code (and some other very choice bits as well). I'll try to look at that problem, as well. - Gordon From gmcm at hypernet.com Mon Feb 14 10:59:51 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 10:59:51 -0500 Subject: Threads in Python In-Reply-To: Message-ID: <1261578505-39575348@hypernet.com> Warren Postma wrote: [Aahz] > > As Fredrik said, yes and no. Threads are incredibly easy to use in > > Python; the biggest drawback is the Python global interpreter lock, > > which means that only one thread can run Python code at any time. > > That's usually not a big drawback, because threading is usually used to > > optimize I/O, and extension libraries (including I/O) can release the > > global lock. > > What about pre-emption? Can the Python interpreter pre-emptively switch > threads > between any two lines of Python code? Is there a "Schedule()" call to force > a thread to > give up it's timeslice? Python threads get sliced every N Python instructions (default 10). time.sleep(0.001) will force a yield. - Gordon From ross at sphinx.com Fri Feb 4 13:41:46 2000 From: ross at sphinx.com (Ross Boylan) Date: 04 Feb 2000 13:41:46 EST Subject: Building python on HP--please update Message-ID: <389B1D62.CA929E4E@sphinx.com> I just built Python 1.5.2c on an HP-UX 11 system. The current build scripts are not right. They contain a mix of static and dynamic library building. The object files are not built with +z, which is mandatory for shared library code. But the load step attempts to build a shared library. Static Libraries These were my focus. I needed to edit the link target in Modules/Makefile to remove the $(LINKFORSHARED). Threads -lcma is not correct, at least for this version of HP-UX. -lpthread is required. I set -D_REENTRANT also. The installation README has a Platform note about _REENTRANT, but no entries for the HP "Compiler Switches for threads." It would be good to fill that in--as well as correcting the scripts themselves. Additionally, the C++ compiler may require -DRWSTD_MULTI_THREAD -DRW_MULTI_THREAD (needed only for the Tools.h++ Library) according to HP's manuals. I didn't use them, and seem to be OK so far. Shared Libraries http://hpux.cae.wisc.edu/hppd/hpux/Languages/python-1.5.2/ has a complete source and build for the HP. Here is the file HP-UX.Install, from that site. HP Porting Changes: =================== Configuration Files changed ---------------------------- configure - added a test for HPUX, if true we set OPT to "-Ae +Z" Makefile.in - Added a line to each add2lib rule to build the HP shared lib: ld -b -s -o ../libpython1.5.sl $(OBJS) Top level Makefile.in - Added "mkdirhier" to create the install dirs. - Added "bsdinst" to install HP shared lib. - Modified "clean" rule to remove HP shared lib. - Added BINLIBDEST to dir list - python gets confused if this doesnt exist - even if its empty. Building: ========= Run "configure" || "xmkmf" to re-generate the Makefiles. Run "make" in the top level dir. Use "make -n install" to check the defaults, then "make install" Installed: ========== By -- [steff at csc.liv.ac.uk] On -- [Tue 26 May 1998] version 1.5.2 on HP 11.0 G. E. Doyle 26/10/99 HPUX Porting and Archive Centre, Connect, Liverpool University. __/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger at netconnect.no Thu Feb 24 08:40:41 2000 From: roger at netconnect.no (Roger Baklund) Date: Thu, 24 Feb 2000 14:40:41 +0100 Subject: msvcrt, open_osfhandle, locking References: <38B3D3EA.C2BB4846@endea.demon.nl> Message-ID: <893c9r$mr2$1@zinc.intern.netconnect.no> Niels Diepeveen wrote in message news:38B3D3EA.C2BB4846 at endea.demon.nl... > > > Mark Hammond schreef: > > > file handle. The locking module works directly with file object - no > > need to deal woth OS handles at all. > > Is this a 1.6 feature? In 1.5.2 locking() takes a file descriptor > (f.fileno()), I think. Ah! Thanx. -- Roger From mikael at isy.liu.se Fri Feb 25 07:03:44 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Fri, 25 Feb 2000 13:03:44 +0100 (MET) Subject: ANNOUNCE: Python Compiler (No spell errors) In-Reply-To: Message-ID: On 25-Feb-00 piet at cs.uu.nl wrote: > >>>>> see_plus_plus at my-deja.com (spp) writes: > Like the Mercedes A-model that flipped over when you took a curve too fast. Now that's completely wrong. It flipped over when a reporter took the curve too slow. The test was made in 70km/h, while the car had successfully passed such a test in 120km/h. I guess the German engineers thought that noone ever drives a car that slow, except during accelleration to a reasonable autobahn speed. After all, there are no other roads, are there? And there are no mooses on German autobahns! And-I'm-the-queen-of-Saba-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-Feb-00 Time: 12:55:09 This message was sent by XF-Mail. ----------------------------------------------------------------------- From bobNOSPAM at NOSPAMzippyhelp.com Mon Feb 7 22:07:54 2000 From: bobNOSPAM at NOSPAMzippyhelp.com (Robert Rutkowski) Date: Mon, 7 Feb 2000 22:07:54 -0500 Subject: CGI Scripts References: Message-ID: Is it possible the server does not have the cgi or string modules installed? How would I find out what is there? "Robert Rutkowski" wrote in message news:gT3n4.4938$563.203215 at newsread1.prod.itd.earthlink.net... > I'm new to programing and in an effort to learn python, I'm trying to write > a simple text counter. The script is called with an SSI exec command. The > path on my server is correct and the script appears to work. I receive no > errors, and the script runs just fine locally on my machine. > My problem is that the script returns a result via the print command. {print > `count()`}, but when I try to run the script on my server, I get no results, > just a blank page. > Am I missing something? Is there a module that I need to pass the result to > to see it in my web browser. > > ----------------------------------------------------- > #!/usr/contrib/bin/python > > #Python Counter Script > > import cgi > import string > > def count(): > count = open('counter.log', 'r+') > strhits = count.read() > hits = string.atoi(strhits) > hits = hits+1 > count.seek(0, 0) > count.write(`hits`) > count.close() > return hits > > print "Content-type: text/html" > print > print `count()` > ------------------------------------------------ > > From shippy at cs.nmt.edu Thu Feb 24 11:40:28 2000 From: shippy at cs.nmt.edu (Jeff Shipman) Date: Thu, 24 Feb 2000 09:40:28 -0700 Subject: regular expression References: <38B55D55.EFF16F5E@cs.nmt.edu> Message-ID: <38B55EFC.801252AA@cs.nmt.edu> I never gave you a very good example for my advice! Instead of: result = pattern.search(data) which will match the whole line (not just the stuff in the parens), you could use result = pattern.sub('\g<1>', data) and then result will equal everything that's in (.*?) assuming your regular expression has been written properly. (sub() is a substitution function). Hope that helps! -- +-----------------------------------------------------+ | Jeff "Shippy" Shipman E-Mail: shippy at cs.nmt.edu | | Computer Science Major ICQ: 1786493 | | New Mexico Institute of Mining and Technology | | Homepage: http://www.nmt.edu/~shippy | +-----------------------------------------------------+ From arnaud at crao.net Sat Feb 5 07:52:15 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Sat, 05 Feb 2000 13:52:15 +0100 Subject: newbie 2, back with a revenge. asyncore Message-ID: Hi ! As I use asyncore sockets with no problem for servers, there is something I don't get in 'client' mode. Can someone explain me how to use, for exemple, the httpclient exemple provided in the lib documentation ? Regards, Arnaud From tjreedy at udel.edu Fri Feb 11 22:12:29 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Fri, 11 Feb 2000 22:12:29 -0500 Subject: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> <20000211073300.A711@stopcontact.palga.uucp> Message-ID: <882j3g$dse$1@news.udel.edu> "Gerrit Holl" > Eaglestone, Robert NGC:B918:EXCH" wrote on 950195591: > ... > > if ( foo > bar ) > > do_something(); > > do_something_else(); > > done(); > > endif > > Let me add two characters, and it's totally valid. > > if ( foo > bar ): > do_something(); > do_something_else(); > done(); > #endif To 'make up' for the two added chars, we can delete the two parens. Also, ;\n is redundant if \n is used as a terminator rather than whitespace. Terry J. Reedy From claird at starbase.neosoft.com Mon Feb 28 08:02:32 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Feb 2000 07:02:32 -0600 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: <0742B938A78BCAFC.AB0DB1F0C0E47B85.C6975C7C6DCB99B2@lp.airnews.net> In article , Arnaud Fontaine wrote: >Hi all ! > >Maybe u know about MetaKit, a way to store objects using a relational >model in tcl, C++, python, etc ... For some people, MetaKit's model specifically is *not* the relational one. My guess is that you're simply focusing attention on a particular aspect of "relationalness". While you certainly have that freedom, progress in the domain of small/embedded/... data managers is sufficiently rapid that you're probably going to need to give more details before readers conclude, "Ah! *That*'s his point." > >It's not all that good (not a real strong multi-users ORDBMS) but, in >some cases, it's really nice and provides features I haven't found yet >in the various python way to persistence. > >Fine ... if I was able to use it with python on my Mac :( . [description of situation that's about Python and the MacOS, and not specific to MetaKit] . . >PS: And if u know anything similar (means using a relational model) to >store objects ... please tell me ! While my current connections to the MacOS world are tenuous, I believe there are a growing mul- titude of possibilities. It'll help to specify your interest more precisely; I don't think there are cheap answers in this domain. Do you care about multi-user operation? What do you mean by object-relational? What are your scale and performance requirements? In what way does Gad- fly, for example, not meet your needs (assuming that the versioning situation blocks you from using MetaKit)? If you're lucky, Gordon will jump in and shine light all around. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From bestvina at math.utah.edu Wed Feb 16 12:30:04 2000 From: bestvina at math.utah.edu (Mladen Bestvina) Date: Wed, 16 Feb 2000 10:30:04 -0700 Subject: Tcl (Tkinter) problems Message-ID: <38AADE9C.AD26CD80@math.utah.edu> I can't get python to see the file init.tcl. Traceback (innermost last): File "SnapPeaGUI.py", line 1118, in ? root = Tk() File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 886, in __init__ self.tk = _tkinter.create(screenName, baseName, className) TclError: Can't find a usable init.tcl in the following directories: This probably means that Tcl wasn't installed properly. Now, I do have init.tcl in /usr/local/lib/tcl8.3/init.tcl and furthermore tcl is supposed to see it there: mladen at drava:/home/mladen/snappea/SnapPeaPython > wish % info library /usr/local/lib/tcl8.3 Any ideas? I also tried this with tcl/tk8.0.5 and I get the same result. Mladen Bestvina From robin at jessikat.demon.co.uk Fri Feb 18 12:48:08 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 18 Feb 2000 17:48:08 +0000 Subject: Python misconceptions in IBM Ruby article... References: <38AC9D57.5CC8066C@mincom.com> Message-ID: <4h84bDAYXYr4EwkH@jessikat.demon.co.uk> In article , Michael Hudson writes >Robin Becker writes: > ... >instance variables. I don't really see that there is any viable >alternative to the `self' approach in Python, for a variety of >reasons. The status quo is simple, explicit, consistent and has as >about as much chance of changing as the whitespace issue so there >isn't a lot of point debating it, I'd have thought. > >pointless-ly y'rs >Michael I heartily agree. -- Robin Becker From hildeb at www.stahl.bau.tu-bs.de Tue Feb 1 11:47:41 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 1 Feb 2000 16:47:41 GMT Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> <20000201154723.A1704@stopcontact.palga.uucp> Message-ID: On Tue, 1 Feb 2000 15:47:23 +0100, Gerrit Holl wrote: >There is a German book, isn't there? Yup. >There is a Germen list, isn't there? Dunno. >> I always thought LOGO would be the way to go. > >Nonsense. I started with LOGO and I wish I never did. I tinkered with it on my trusty old C64... It was fun. From moshez at math.huji.ac.il Sat Feb 26 05:51:55 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 12:51:55 +0200 (IST) Subject: 1000 GUI toolkits In-Reply-To: <8986b5$7kn$1@news1.xs4all.nl> Message-ID: [me] > I meant that the Python code would be in the HTML page, and would be > compiled to a (say) wxPython (or ...) module which displays a GUI. > After all, HTML has this fancy layout capabilities: all you would need to > do is bind some callbacks... [Boudewijn Rempt] > I don't think so - you'd probably have to write an interpreter plugin > or something yourself. Robin's idea is sound, though. When I needed a > really complex grid layout for Kura, I decided not to try to bend PyQt's > grid class to my wishes, but to use a HTML table that was displayed by > the khtmlw HTML widget. Of course, when Qt 2 is bound, I'd use the > canvas class. Well, I don't want an "interpreter plugin". What I want is a "HTML+Python to Python+GUI toolkit" compiler. Kind of like JSP, but the code is executed client side. Think of a page with embedded JavaScript. It could probably be compiled to pure (much more verbose) JavaScript: "

ffff

" would be (pseudo-code) "switch to large font, print ffff, switch to normal font". '

ffff

' would be, in addition, "bind to the text just printed to the event , the function dosomething()" I'm not sure how feasable that is, but it's a cute idea. (Think of it as automatic interface generation) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From andres at hidalgo.cnchost.com Sun Feb 27 00:44:52 2000 From: andres at hidalgo.cnchost.com (Andres M. Hidalgo) Date: 27 Feb 2000 00:44:52 EST Subject: Installing on Win 2K? References: <89129k$1iv$1@nnrp1.deja.com> Message-ID: <89adkk$jqc@journal.concentric.net> Instead of copying .dll's to other directories, the best approach is to add the directory path where the dll's live to the PATH environment variable. "Mark C Favas" wrote in message news:mark.951352594 at declan... > Preston Landers writes: > > >Has anyone succesfully installed Python on W2K? Is there something I'm > >missing? > > Yes - I've successfully installed the standard 1.5.2 distribution, the > wun32all extensions and built the current CVS distribution on Win2K. The only > glitch (which I also had on NT4) was that I had to copy the Tcl/Tk dlls to > the DLL subdirectory of the Python folder to get Tkinter to work without > error. > > 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 rich.glazerman at synchrologic.com Wed Feb 9 17:52:13 2000 From: rich.glazerman at synchrologic.com (Rich Glazerman) Date: Wed, 9 Feb 2000 17:52:13 -0500 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: Assuming that you know that the line has been read, and the newline is the last character of the line, you can simply do line = line[:-1]. This will chop the last character. Works for any character you're trying to chop... so it's not limited to just the newline, so be careful. Hope this helps. Rich -- Rich Glazerman Test Engineer Synchrologic, Inc. rich.glazerman at synchrologic.com 770-754-5600x176 "a.c.a. serier" wrote in message news:87snvk$f2i$1 at news.hccnet.nl... > Hello, > > I have the following problem with lines read with readline. > How to remove the newline at the end? > Perl has chomp() to do this. > In this case use split to split up the line, but the last item has a > newline at the end. > I tried both split and replace(line, '\n', '') without result. > Can't find anything in tutorial, lib ref and FAQ. > > Thank in advance, > > Kees > > From sorry at spam.invalid Wed Feb 23 07:51:42 2000 From: sorry at spam.invalid (sorry at spam.invalid) Date: Wed, 23 Feb 2000 12:51:42 GMT Subject: Misunderstanding classes (newbie) References: <88v4lu$ags$1@wanadoo.fr> Message-ID: Thanks for replying. You've written part (b), which I was also able to do. But how do I get (a) the modified UserList and (b) the list of class elements into a single instance? I want a[whatever_I_decide_is_the_start_of_the_list].lastname to return a[0].lastname automatically, and have whatever_I_decide_is_the_start _of_the_list default to 1 when I create an instance of the class. Jerry <2jerry at writeme.com> wrote: > This is just a list of class elements ? no ? > class lm: > def __init__(self, last=None,first=None,age=0): > self.lastname=last > self.firstname=first > self.age=age > then .. > list_lm=[] > a=lm('jerome','VACHER',29) > list_lm.append(a) > list_lm.append(lm('paul','DUBOIS',45)) > a[0].lastname='jerome' > Is that you want ? > sorry at spam.invalid wrote: >>Hi, >> >>I'm a Python newbie (and an OOP newbie) trying to >>construct a class that: >> >> (a) behaves like a list but has a FORTRAN-like variable >> starting index, >> (b) has per-index attributes. >> >>i.e. Each element of the list has two (or more) attributes, >> and, by default, the first element is at x[1]. >> >>e.g. x[1].lastname, x[1].firstname, x[1].age >> x[2].lastname, x[2].firstname, x[2].age >> >>I seem to be able to get each part of the solution >>independently (the first part by using UserList and >>__getitem__), but when I attempt to combine them, I >>clearly don't understand what I'm doing. >> >>Suggestions? >> >>Thanx. >> >>P.S. Please respond to the list. From eugene.kelly at computer.org Mon Feb 28 19:34:19 2000 From: eugene.kelly at computer.org (Eugene Kelly) Date: Tue, 29 Feb 2000 00:34:19 +0000 Subject: Python program examples References: <20000228193411.49C5E1CD0C@dinsdale.python.org> Message-ID: <38BB140B.6FCC452D@computer.org> I found the relevant directories eventually. The most relevant location for examples seems to be /python/source/Python-1.5.2/demo/scripts. The snippets site mentioned by Chris looks useful too. Thanks to Gerrit, Chris and Fredrik for their responses. Eugene. From gmcm at hypernet.com Fri Feb 25 12:10:56 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 25 Feb 2000 12:10:56 -0500 Subject: Win2k and Python access violation - please help me out here! In-Reply-To: Message-ID: <1260623840-9876921@hypernet.com> Jason wrote: > Oops, I missed 3 lines at the top of the call stack: > > NTDLL! 77f8ed61() > NTDLL! 77f8ecf1() > MSVCRTD! 10238575() Are you using python15.dll or python15_d.dll? Mixing run time libraries is a great way to crash. - Gordon From sanderson at ttm.com Fri Feb 11 10:36:59 2000 From: sanderson at ttm.com (Scott Anderson) Date: Fri, 11 Feb 2000 10:36:59 -0500 Subject: Question concerning makepy.py for COM (long, code included) References: <2BB61D79860D1D3A85256881003AC7A0.003AC7DD85256881@ttm.com> Message-ID: <38A42C9B.268AF5D6@ttm.com> mhammond at skippinet.com.au wrote: [...] > Nope - once makepy is run, it is early-bound dispatch. Gotcha. Thanks. Next question then, since I'm getting the same error from static dispatch as I am from dynamic: are OCX controls treated differently than "normal" COM objects? "ApplicationName" is a defined property of the control that I have makepy'd, but I am unable to set it. Here's what I'm getting: >>> x = Dispatch('API.APICtrl.1') >>> x >>> x.ApplicationName = 'foo' Traceback (innermost last): File "", line 1, in ? File "C:\dev\python\win32com\gen_py\DBD89B20-C44F-11CF-8C05-0004AC77A721x0x1x0.py", line 50, in __setattr__ pywintypes.com_error: (-2147418113, 'Unexpected failure', None, None) Thanks, -scott From ns56645 at swt.edu Wed Feb 23 08:35:13 2000 From: ns56645 at swt.edu (ns56645) Date: Wed, 23 Feb 2000 07:35:13 -0600 Subject: Python window.destroy()? References: <38B1D2EB.FE88C9DC@swt.edu> <88sn2f$i1j$1@wanadoo.fr> <38B1F028.7A2036C2@swt.edu> <88vam1$9f0$1@wanadoo.fr> Message-ID: <38B3E210.5679BE69@swt.edu> Thanks Jerry, You were very helpful. Bye and see you later. I will be having more questions in future. Shah From S.I.Reynolds at cs.bham.ac.uk Tue Feb 22 14:01:11 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Tue, 22 Feb 2000 19:01:11 +0000 Subject: Problem with Emacs mode, at start only References: <38AD6958.19C3@cs.bham.ac.uk> Message-ID: <38B2DCF7.148C@cs.bham.ac.uk> Fran?ois Pinard wrote: > > Stuart Reynolds ?crit: > > > Save yourself from RSI [...] > > Hello, Stuart. > > RSI? What does this acronym stands for? > Repetitive Strain Injury. Emacs' heavy use of C^ and M^ can take its toll on your hands. Stuart From gerrit.holl at pobox.com Fri Feb 25 01:48:54 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 25 Feb 2000 07:48:54 +0100 Subject: Optimizing code In-Reply-To: ; from hanche@math.ntnu.no on Thu, Feb 24, 2000 at 05:09:53PM -0500 References: <20000224161930.A4922@stopcontact.palga.uucp> Message-ID: <20000225074854.A1014@stopcontact.palga.uucp> > + Gerrit Holl : > > | class DiskUsage: > | __size = 0 > | def add(self, filename): > | self.__size = self.__size + os.path.getsize(filename) ... > | def __len__(self): > | return self.__size > | Timing turns out that the 'os.path.walk' part takes about 2.7 > | seconds, for a 400 MB dir with 1096 dirs and 9082 files. 'du -s ~' > | takes 0.2 seconds. What makes this slow? The special methods? The > | redefinition of an integer? os.path.walk? With longs, it even takes > | 12 seconds... > > One thing that slows your code down, is that it calls stat() three > times on every regular file in the tree: First, in os.path.isfile, > second, in os.path.getsize, and third, in os.path.walk, which needs to > find out if a filename corresponds to a directory or not. I see. > | Can I optimize it? If so how? > > Here is my best effort so far. It is nearly three times as fast as > yours (but less portable perhaps). Well, actually yours didn't work > at all on my system, because the length of a file is a long integer: > > File "du.py", line 21, in du > return len(disk) > TypeError: __len__() should return an int A long? I don't see any long? Perhaps you are running a "future" version of Python silently converting ints to longs? And, by the way, why can't len() return a long integer? > class DiskUsage: ... > def __call__(self, dir): > # Importing these names is possibly a useless optimization: > from stat import S_ISDIR, S_ISREG, ST_MODE, ST_SIZE > files = os.listdir(dir) > dirs = [] > for file in files: > filename = os.path.join(dir, file) > s = os.lstat(filename) > mode = s[ST_MODE] > if S_ISDIR(mode): > dirs.append(filename) > elif S_ISREG(mode): > self.__size = self.__size + s[ST_SIZE] > for dir in dirs: > self(dir) > def len(self): > return self.__size ... Interesting, thanks! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From tbryan at python.net Tue Feb 29 22:20:41 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Tue, 29 Feb 2000 22:20:41 -0500 Subject: Strange Python problem on Linux. References: <38BBB8EF.9306991C@python.net> <89gsc6$871sk@fido.engr.sgi.com> Message-ID: <38BC8C89.22DC3CE2@python.net> Paul Jackson wrote: > Along the lines of the previous suggestion that the "#! ..." line > might have odd chars, in addition to trying 'cat -v', also try: > > head -1 mdef.py > silly.py > echo 'print "What's wrong?"' >> silly.py > chmod u+x silly.py > ./silly.py Yep. I tried them both for thoroughness. There was a ^M (hex(13)) at the end of the #! line. Linux was picking it up as part of the command to run. I would have expected it to show up as extra whitespace or control characters when I traced the program, but it didn't. I should have thought of cat -v (or Emacs hexl-mode) much earlier. $ strace -o out.trace mdef.py strace: exec: No such file or directory $ cat out.trace execve("./mdef.py", ["mdef.py"], [/* 28 vars */]) = 0 One reason I never looked for the ^M was that I use Xemacs at work. It shows the ^M. Emacs seems to do the translation on the fly for me, so I didn't realize that the file had MS-corrupted line endings. > That or just edit 'mdef.py', deleting the first line and rekeying > it from scratch, if you are more interested in cures than in > a diagnosis. No. I hate it when I fix something but don't know what was originally wrong. If I know a problem's symptoms, cause, and solution, then I'll be more effective the next time I encounter it. > ======================================================================= > I won't rest till it's the best ... Software Production Engineer afraid-of-professionals-who-rhyme--ly yours ---Tom From tseaver at starbase.neosoft.com Tue Feb 22 11:22:00 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 22 Feb 2000 10:22:00 -0600 Subject: Call for Patch for Borland compiler References: <000a01bf7c92$a208fa30$c355cfc0@ski.org> <46xs4.10497$Jz3.75868@nnrp1.uunet.ca> Message-ID: <84537BF50B76EAC5.8AC19F53C6018D8F.9759A9AB7F25D62B@lp.airnews.net> In article <46xs4.10497$Jz3.75868 at nnrp1.uunet.ca>, Warren Postma wrote: > >"David Ascher" wrote in message >news:000a01bf7c92$a208fa30$c355cfc0 at ski.org... >> Inprise/Borland has made their C++ compiler on Windows free (as in beer). >> Guido has expressed that it would be nice to have makefiles which allowed >> one to build Python with this compiler by the next release. If someone is >> interested in providing this patch, that'd be great. >> >> See compiler download info at: >> http://www.borland.com/bcppbuilder/freecompiler/ >> >> See instructions for patch submissions at http://www.python.org/patches/ >> >> --david ascher >> >> >I could try this. > >How does one create the unix "patch" files while running on Windows? Would I >need to download cygwin to get the make and tar and other unixish toolsets? >I already have BC++ 5.5 installed on my hard drive. I think what you really want is CVS: 1. DL the source and unzip into scratch space. 2. Use WinCVS to import the scratch tree as a new module. 3. Delete the scratch tree and use CVS to check out the newly-imported module. 4. Hack in the checked-out sandbox until BCB is happy. 5. Diff the whole tree using WinCVS and submit the diff as your patch (you may need to use the WinCVS command line for this -- I don't remember if they let you specify the diff type). 6. Check in and label the hacked tree. Dis-stinks-without-a-diff'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From wolf at one.net Thu Feb 17 19:09:21 2000 From: wolf at one.net (wolf at one.net) Date: Thu, 17 Feb 2000 19:09:21 -0500 Subject: shelve broken on redhat 6.1 References: Message-ID: Hi Patricia, On 16 Feb 2000 13:13:55 -0500, you wrote: >Has anyone else noticed? Shelve is broken on the RedHat 6.1 >distribution -- python-1.5.2-7.i386.rpm Shelve seems to be broken in Win98 as well, although here it's the keys() method that causes an error: 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 shelve >>> SavedGame = shelve.open("Test.psg") >>> SavedGame.keys >>> SavedGame.keys() Traceback (innermost last): File "", line 1, in ? File "C:\Program Files\Python\Lib\shelve.py", line 55, in keys return self.dict.keys() bsddb.error: (22, 'Invalid argument') Respectfully, Wolf "The world is my home, it's just that some rooms are draftier than others". -- Wolf From pinard at iro.umontreal.ca Sun Feb 13 10:05:06 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 13 Feb 2000 10:05:06 -0500 Subject: Real Problems with Python In-Reply-To: "Tim Peters"'s message of "Sun, 13 Feb 2000 04:30:47 -0500" References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: "Tim Peters" writes: > > In the long run, the solution is to use a conservative garbage > > collection algorithm (such as the Boehm collector), > "No chance" in CPython [...] I'm not sure of the implications of the above, but one sure thing is that I very much like the current implications of reference counting. When I write: for line in open(FILE).readlines(): I rely on the fact FILE will automatically get closed, and very soon since no other references remain. I could of course use another Python line for opening FILE, and yet another for explicitely closing it, as I was doing in my first Python days, but I learned to like terse writings like above, and I do not think there is any loss in legibility in this terseness. I'm not even sure I would much attracted by an implementation of Python in which implied __del__ actions are much delayed, as this would force me to add some more clutter to my Python code, which I prefer short and clear. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From nobooze4u at BLAM!worldnet.att.net Fri Feb 11 23:42:39 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 04:42:39 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <38A4B22C.EDFCB2A3@be-research.ucsd.edu> Message-ID: <3x5p4.6678$%M5.134764@bgtnsc06-news.ops.worldnet.att.net> x-no-archive: yes Curtis Jensen wrote: > > Steve Holden wrote: > > > > I declare this thread closed. > > Unilaterally. NOW. > > Like that'll happen. [gleefully] he he he... From gales at gmx.net Thu Feb 24 11:32:27 2000 From: gales at gmx.net (Frank Gales) Date: Thu, 24 Feb 2000 17:32:27 +0100 Subject: Comparison: Python vs. Javascript Message-ID: <893mei$o88$1@mailusr.wdf.sap-ag.de> Hi, Can anybody give me a link to a comparison between Python and Javascript. There are several papers comparing Python and Java but I found nothing about Python versus Javascript. Thanks a lot, Frank Gales From thomas at xs4all.net Wed Feb 16 09:31:14 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Wed, 16 Feb 2000 15:31:14 +0100 Subject: Proposal: Official whitespace response In-Reply-To: <88cclv$u62$1@nnrp1.deja.com>; from fcahoon@my-deja.com on Tue, Feb 15, 2000 at 08:24:36PM +0000 References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> Message-ID: <20000216153114.S477@xs4all.nl> On Tue, Feb 15, 2000 at 08:24:36PM +0000, Forrest Cahoon wrote: > As python's popularity increases, you will probably see more of my type > -- real programmers Oh yeah, it would be good to have more of those around. [ about 'tabs are 8 spaces' ] > I don't know why this is so hidden. It's probably because it is very, very obvious to everyone. Well, everyone who thought about FAQs and docs and such. I, for one, am a god-forsaken dutch atheist (and damned proud of it) but there is one thing I have a holy belief in... Tabs are 8 spaces. I still fail to see why anyone would think differently. (Granted, though, the FAQ and the tutorial should be suitably indoctrinating to convert all those unholy sinners up front;) Asbestosly-y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From ray at commsecure.com.au Sun Feb 27 04:21:46 2000 From: ray at commsecure.com.au (Ray Loyzaga) Date: Sun, 27 Feb 2000 20:21:46 +1100 Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: <38B8ECAA.37C023D1@commsecure.com.au> Alan Daniels wrote: > > On Fri, 25 Feb 2000 08:33:15 +0100, the infinitely wise Milos Prudek > (prudek at nembv.cz) spoke forth to us, saying... > > [snip...] > >The following excerpt works. It reads lines from config file. But I > >would like to ask if it is 'right' in the Pythonian way. > > >A=[] > >Line=H.readline() > >while Line<>'': > > if Line<>'' and Line<>'\n': > > A.append(Line) > > Line=H.readline() > > I myself would use: > > A = [] > for Line in H.readlines(): > if Line not in ("", "\n"): > A.append(Line) the test for "" is redundant for both implementations. For the first the "while" test catches this, and for the second the readlines() routine terminates on "", i.e. end of file, and hence does not return a list with "" components. I personally don't see the point to spotting '\n', if a config file is being scanned, you either can live with empty lines, or you want to nuke "empty" lines, i.e. lines where string.strip would return "". If the latter is the case then: #!/usr/local/bin/python import sys import string H = sys.stdin A=[] for i in H.readlines(): if string.strip(i): # works for the unreliable family of OS's from MS A.append(i) or if speed is to be sought in preference to clarity: #!/usr/local/bin/python import sys import string H=sys.stdin A=filter(string.split, H.readlines()) From aa8vb at yahoo.com Wed Feb 16 07:05:45 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 16 Feb 2000 07:05:45 -0500 Subject: Modules implicitly exposing exceptions from other modules In-Reply-To: <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> Message-ID: <20000216070545.A2508775@vislab.epa.gov> Tres Seaver: |Randall Hopper: |>For example, I don't think tossing broken socket Socket exceptions across |>the NNTP boundary is a good idea. How does the NNTP client catch these (or |>know to catch these)? A wildcard except clause, which catches bugs and |>errors. | |While your main point is fairly strong, your example is weak. Anybody |writing an NNTP client who *doesn't* expect to handle socket errors is asking |for trouble. No, you miss the point of my example. I didn't say "socket", I said "Socket". NNTP could be built on Socket, or FastSockets, or TLI, or MasGreatestSocketModule, all of which could have a different exception structure. For example, someone may decide later to switch NNTP over from Socket to FastSockets. NNTP would be revised in the process. Clients which call NNTP and handle all exceptions passed up from NNTP shouldn't have to break because of this internal dependency change. If the exceptions are transformed at the module boundary by NNTP, clients needn't break. My whole point is that error exceptions are part of the function signature, just like arguments and return values. |There is nothing useful to be done about them at the "mechanism |level" (in nntplib); they need to be dealt with at the "policy level" (the |client). Except in cases where the mechanism level needs to do cleanup, I agree (assuming we regard abstraction as "not useful"). The situation is no different than say, in C, returning an instance of a private class by value through a public interface. By doing so we've just made it public. It's now part of the function signature, so clients may break if we change it. -- Randall Hopper aa8vb at yahoo.com From tim_one at email.msn.com Tue Feb 1 17:26:10 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 1 Feb 2000 17:26:10 -0500 Subject: Removing objects of a superclass? In-Reply-To: <20000201161336.A1785@stopcontact.palga.uucp> Message-ID: <000501bf6d03$576db400$4b2d153f@tim> [Gerrit Holl] > is it possible to _remove_ objects of a superclass? > I'm interested in creating a sort of UserString, and because it > shares many methods with UserList I want to subclass it. But > then, I need to remove some methods like .append and .pop. Can > I do that? By deriving UserString from UserList, you're announcing to the world that a UserString "is a" UserList. But if UserString doesn't support a superset of the methods provided by UserList, it's not really a UserList at all, so you're lying . Really, in most circles this would be considered a sure sign of confused design. Some languages cater to this kind of lying anyway, but Python does not. You would need to override the unwanted methods in UserString, as in class UserString(UserList): def pop(self): raise IWasLyingError("despite that I told you a string" " is a list, you can't pop it") More principled approaches include: + Move the functionality the classes have in common into a third class, and derive from that instead. This is clean. In the case of UserList, it also means rewriting part of the std Python library . This kind of thing is called "refactoring", and is depressingly (or delighfully ) common as OO designs get larger and larger. + Use a "has a" relationship (as opposed to "is a") instead. That is, a UserString object simply contains a UserList object as a member. No subclassing. Then the only methods that are visible are those you explicitly provide. If there are a great many UserString methods that could be passed on to the UserList method directly, you can play __getattr__ tricks to avoid writing a great many individual "forwarding" methods. + Rethink the whole problem: maybe .pop and .append etc really would be useful in a UserString! They're sure useful for lists, and it's not insane to picture a string as a list of characters. + Study the std array module, to see whether an array of characters already does everything you want a UserString to do. cheating-is-much-better-than-lying-ly y'rs - tim From bjorn at roguewave.com Thu Feb 17 13:40:18 2000 From: bjorn at roguewave.com (bjorn) Date: Thu, 17 Feb 2000 11:40:18 -0700 Subject: two questions References: Message-ID: <38AC4092.57B477CA@roguewave.com> Fredrik Lundh wrote: > Brett Tribble wrote: > > 1. Is anyone working on a version of Python for Mac OS X? > > according to people who've tried, Python 1.5.2 > builds right out of the box. > > that probably doesn't include X window stuff like > Tkinter, though... > > Isn't Mac OS X just NeXTStep (ie. Mach 3 + BSD) with some Macintosh bits thrown in? Mac-didn't-use-to-be-Mach'ly y'rs --bjorn From gmcm at hypernet.com Mon Feb 28 19:22:52 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 28 Feb 2000 19:22:52 -0500 Subject: Is mxDateTime compatible with Installer In-Reply-To: Message-ID: <1260338722-27026465@hypernet.com> Calishar wrote: > > I'm asking this question because I just added mxDateTime support to > an application which was already working, but needed much better date > handling. Since then, any time I try to use the Installer Package > (most recent version as of monday last week) the final application > fails with import errors. There is a bug in beta3f. Line 168 of MEInc.Dist.resource.py reads: if string.find(name, '.') == -1: It should read: if string.find(name, '.') != -1: I don't know if that will fix your problem. If the __init__.py file is playing with __path__, you may have some more tweaking to do. (Basically, you'll have to figure out how those manipulations of __path__ are extending the search path, and then put those extensions into the pathprefix option in your config file.) > At first it was failing saying it "couldn't import name __version__" > in the __init__.py files in the DateTime directory and the mxDateTime > subdirectories. I modified the __init__ files to set the version > (1.3.0) rather than importing it, okay, got past that point. Now I am > getting the following message. > > File "C:\Program Files\Python\Lib\DateTime\DateTime.py", line 12, in ? > NameError: DateTimeDelta > > Line 12 in the DateTime.py file sets the value oneSecond. > > I am currently using Python 1.5.2 (downloaded maybe 2 months ago at > the most), win32all-128, mxDateTime 1.3.0 on a windows 95 development > system at the office, Win98 at home, and a Win95 test system. > > Any ideas on what is happening or how to fix it? > > Calishar > > > > -- > http://www.python.org/mailman/listinfo/python-list - Gordon From jjsa at gvtc.com Thu Feb 3 23:28:37 2000 From: jjsa at gvtc.com (Jim Johannsen) Date: Thu, 03 Feb 2000 22:28:37 -0600 Subject: ODBC and mxODBC References: <387B9540.BE617781@exceptionalminds.com> Message-ID: <389A5575.C5EA3110@gvtc.com> Timothy Grant wrote: > Hi, > > Has anyone got any tips on configuring mxODBC, or ODBC in general on a > Linux box? > > I have a Linux box running PostgreSQL with the ODBC system installed. > > I can access it just fine from a Windows machine running mxODBC, but I > have yet to be able to figure out how to get it to work from my own > development machine which is a Linux notebook running RH6.1 > > I can access the database just fine using the PyGreSQL module, but I > really want to use mxODBC so that I can do cross platform development. > > This is probably more of a ODBC question than a Python question, but any > help would be appreciated. > > -- > Stand Fast, > tjg. > > Chief Technology Officer tjg at exceptionalminds.com > Red Hat Certified Engineer www.exceptionalminds.com > Avalon Technology Group, Inc. (503) 246-3630 > >>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<< Tim, I'm having trouble using the PyGreSQL module, mainly in the "insert" area. Could you post some of your code as examples so I could see the trees. Right now the forest is in the way. Thanks Jim From alex at somewhere.round.here Wed Feb 16 22:50:37 2000 From: alex at somewhere.round.here (Alex) Date: 16 Feb 2000 22:50:37 -0500 Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <88f53h$em2$1@nntp6.atl.mindspring.net> <14507.17447.857827.44321@anthem.cnri.reston.va.us> Message-ID: > Actually, he's talking about the builtin int(), float(), and long() > functions. We decided that those subsumed all the functionality of > string.atoi(), etc. so it didn't add anything to make string methods > of atoi, etc. Oh. Thanks for letting me know. Alex. From gregm at iname.com Tue Feb 29 08:04:29 2000 From: gregm at iname.com (Greg McFarlane) Date: Wed, 1 Mar 2000 00:04:29 +1100 Subject: Q: Tk's X errors In-Reply-To: <89g8ko$pvk$1@news.go.dlr.de>; from Sven Drescher on 29 Feb 2000 at 11:55:52AM References: <89g8ko$pvk$1@news.go.dlr.de> Message-ID: <20000301000429.40543@nms.otc.telstra.com.au> After you fork (but before you exec) the child must not communicate with the X server. What you are probably doing is give the user an error message using a Tk widget. A quick workaround is to do the check and error message before the fork. On 29 Feb, Sven Drescher wrote: > Hallo! > > I've written a programm to spawn a child and to kill this again. To do this > I use fork() and execv(). Before I start the child I check with > os.path.isfile(), wether the file exists. If the file exists, it will be > started and all works fine. But if the file not exists, I do not the > exec()-command and an error occured. > > e.g. > X Error of failed request: BadIDChoice (invalid resource ID chosen for > this connection) > Major opcode of failed request: ... (X_CreatePixmap) > Resource id in failed request: ... > Serial number of failed request: ... > Current serial number in output stream: ... > > What did I wrong? > > Thanks for help and hints! > > Sven > ______________________________________ > German Aerospace Research Establishment > > > > -- > http://www.python.org/mailman/listinfo/python-list > -- Greg McFarlane INMS Telstra Australia gregm at iname.com From paul at svensson.org Sat Feb 26 15:55:33 2000 From: paul at svensson.org (Paul Svensson) Date: 26 Feb 2000 20:55:33 GMT Subject: functional programming References: <000701bf8030$a72a0e40$3c2d153f@tim> Message-ID: <899ek5$4c0$1@newsy.ifm.liu.se> "Tim Peters" writes: >[Moshe Zadka] > >> And I don't mind at all having Python do no optimization as long as I >> do not give the flag -believe-me-I-really-do-want-tail-call- >> optimization <0.5 wink> > >I'm afraid it's not that simple (but what is ?). If Python has a mode >that guarantees to optimize tail calls, some people will use it, some of >those will write code that *relies* on it to avoid blowing the stack, some >of those will distribute modules so relying, and then users get sucked into >either (a) running code that uses those modules with the magic switch too, >or (b) not using the switch and suffering "mysterious data-dependent >failures". Both complicate Python's story and so Python users' lives too. >It's a tradeoff in practice: perhaps *you* wouldn't do this to users, but >others will. A language is doomed to support everything it permits, and >usually forever. I see only one obvious solution here we must allow the programmer to make the choise of dropping or keeping the stack frame, not once for the whole interpreter run, but rather individually for each return. This can easily be done by adding an alternate spelling of the return statement, something it appears that Guoido have already forethought, by not using the spelling 'goto' anywhere else in the language. This is such a simple and beautiful change, that even those who are vehemently opposed to adding new keywords to tha language can not resist it, for surely, no sane python program would have been using such a word already ? /Paul From moshez at math.huji.ac.il Thu Feb 24 02:06:41 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 24 Feb 2000 09:06:41 +0200 (IST) Subject: functional programming In-Reply-To: <89140u$7l5$1@nntp6.atl.mindspring.net> Message-ID: On 23 Feb 2000, Aahz Maruch wrote: > >> What do you call this: [I said] > >Um.....the most inefficienct version of fibonacci I've ever seen? [Aahz] > Well, sure, but it meets your definition of functional programming. You > claimed that functional programming is impossible in Python; I've > provided a counter-example. Do you now retract your claim? Assuming we're still in "search of truth" mode, rather then "proving I'm right" mode, I want to clarify my claim: *efficienct* functional programming is, in general, impossible without tail-recursion. I don't agree with the timbot that tail-recursion is contrary to the "Python Way", but it's not in Python right now, anyway. Are we in agreement now? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From boncelet at ee.adfa.edu.au Sun Feb 13 18:44:23 2000 From: boncelet at ee.adfa.edu.au (Boncelet Charles) Date: Mon, 14 Feb 2000 10:44:23 +1100 Subject: [Tutor] Weighted Random numbers References: <200002121116.DAA20152@alpha.ece.ucsb.edu> <38A5E16B.71DCA169@libc.org> Message-ID: <38A741D6.3E933B5B@ee.adfa.edu.au> (Bill wants weighted random numbers for a banner ad system) Bill Anderson wrote: > (x-posted to comp.lang.python in the hopes of reaching a wider audience > [esp re: NumPY]... hope nobody minds) > > "Wesley J. Chun" wrote: > > > > the best way to do this is to choose from a weighted > > list of 1 to 100 say, with each number representing a > > percentage or proportion of the time an ad should be > > chosen. each ad would get a "range" based on the %age > > of the time it should show. the "odds" of all the > > individual ads summed together should be 100. > > > > That's a lot like what I was thinking. I as considering building a list > of banners, with the weight being the number of times the ad was in the > list. Then using whrandom, I'd select one. These two methods are the same, differing only in an unimportant normalization factor. To see this, imagine the weights were 1,2,2,5. The second method would create a list of 10 items, [a,b,b,c,c,d,d,d,d,d]. The first, in effect, creates a list of 100 items (e.g., "a" is replicated 10 times). The real differences are in implementation. The first can be implemented with real numbers and is usually done with a sequence of "if" statements. The second is simpler if the weights are simple integers. In your application the speed differences are probably irrelevant. -- ------ Charles Boncelet, University of Delaware, On sabbatical at ADFA, Canberra Australia, Home Page: http://www.ece.udel.edu/~boncelet/ From effbot at telia.com Mon Feb 28 08:15:20 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 13:15:20 GMT Subject: Traling junk in string.atof (RE: array constructor) References: <000f01bf8197$0c473020$f0a2143f@tim> Message-ID: Tom Holroyd wrote: > I just thought it would make sense for a function _called_ atof() to > _behave_like_ the POSIX function atof(), which converts the initial > portion of a string only -- a behavior which most programmers that use > atof() are well aware of (and even (gosh) use). arguing that Python's standard functions should silently ignore errors won't get you anywhere ;-) (besides, atof is not a POSIX function, it's an ANSI C function, and Python's not ANSI C). rolling your own atof isn't that hard, though: import re def atof(s, p=re.compile(r"\s*(\d*(.\d*)?)")): try: return float(p.search(s).group(1)) except (ValueError, AttributeError): return 0.0 >>> atof("123.456,789") 123.456 >>> atof(" 123.456 ") 123.456 >>> atof("glurk") 0.0 From indiana at ev1.net Sat Feb 19 11:47:18 2000 From: indiana at ev1.net (JimM) Date: Sat, 19 Feb 2000 16:47:18 GMT Subject: PIL - still ill (newbie) Message-ID: Fredrik or anybody, I'm still having trouble using PIL. I downloaded pil-win32-991101 from pythonware and unzipped it with winzip. I unzipped it to c:\program files\python\tools. Here's a sample error: >>> import Image >>> im = Image.open("E:/images/sts93.jpg") >>> im.size (1038, 768) >>> im.thumbnail((128,128)) Traceback (innermost last): File "", line 0, in ? File "C:\PROGRA~1\PYTHON\PY152\PIL\Image.py", line 724, in thumbnail self.load() File "ImageFile.py", line 125, in load self.load_prepare() File "ImageFile.py", line 175, in load_prepare self.im = Image.core.new(self.mode, self.size) File "C:\PROGRA~1\PYTHON\PY152\PIL\Image.py", line 40, in __getattr__ raise ImportError, "The _imaging C module is not installed" ImportError: The _imaging C module is not installed As you can see, it finds Image.py but not the _imaging C module (_imaging.dll ?) I'm not sure if this is part of the problem but I originally placed the files in : c:\program files\python\py152\ I had some trouble so I removed them and unzipped in c:\program files\python\tools as I mentioned above. Why is it still finding Image.py in \python\py152\pil\ when that directory no longer exists (see traceback above)? I'm new to python in the windows environment so explicit help will be appreciated. Thanks, Jim From R.Brodie at rl.ac.uk Thu Feb 17 08:46:13 2000 From: R.Brodie at rl.ac.uk (Richard Brodie) Date: Thu, 17 Feb 2000 13:46:13 -0000 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262152524-5049647@hypernet.com> <38A33AD9.3F4EA190@americasm01.nt.com> Message-ID: <88gu3a$o8s@newton.cc.rl.ac.uk> "Eaglestone, Robert [NGC:B918:EXCH]" wrote in message news:38A33AD9.3F4EA190 at americasm01.nt.com... > There must be a reason or rationale between 1) the ubiquity > of bracketed syntax If you think of the languages in common use today they are mostly in some sense descended from 'C': C++, Java, Perl for example. Languages with other ancestry, even procedural ones like Fortran, Pascal or BASIC don't. So its seems to me that the compelling reason is inertia. From rasumner at iname.com Tue Feb 29 11:36:31 2000 From: rasumner at iname.com (Reuben Sumner) Date: Tue, 29 Feb 2000 18:36:31 +0200 Subject: Using IDLE or PythonWin and TkInter Message-ID: <89gsic$faj$1@news.netvision.net.il> (I appologize that this isn't referenced properly to the original message. It isn't on my news server anymore. In article <1260876475-6142791 at hypernet.com>, gmcm at hypernet.com wrote: > Anders M Eriksson writes: > > > > I have copied example 2 from Fredrik Lundh's "An Introduction to > > Tkinter". when I run it this happens: > > > > Using PythonWin: PythonWin hangs or crashes! > > > > Using IDLE: The hello2 app runs but when I click on the QUIT button is > > also closes IDLE.. > Every GUI has an app message queue and a mainloop. Trying > to have more than one of each in one process is similar to > letting one 3 year old work the steering wheel while his friend > works the pedals. I recently got around this problem as follows Easy solution: If the Tkinter app doesn't need any special code run when the window is closed do nothing and DO NOT call mainloop() from your Tkinter app (while in IDLE, outside of IDLE you will need to add the call again). Solution B: Write a close() method and have it be called by any cancel buttons as well as doing a master.protocol("WM_DELETE_MESSAGE",self.closeit). Then def closeit(self): self.master.quit() #exit out of this mainloop() self.master.destroy() # actually close the window In the first solution IDLE will actually be fully functional while your app is running. In the second case idle will not be fully interactive until you close your app down. Reuben From fdrake at acm.org Fri Feb 18 10:42:31 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 18 Feb 2000 10:42:31 -0500 (EST) Subject: wxPython book??? In-Reply-To: <38AC8385.16DD9A0E@callware.com> References: <14508.33324.45637.954517@weyr.cnri.reston.va.us> <38AC8385.16DD9A0E@callware.com> Message-ID: <14509.26727.677099.483772@weyr.cnri.reston.va.us> Ivan Van Laningham writes: > --He says, relentlessly pushing "volunteers" to the edge of the > precipice. Some things just have to be done, but others... are done for fun! ;) > -ly I didn't that (the peace part, that is); true, or Ivanism? -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From moshez at math.huji.ac.il Wed Feb 23 01:44:21 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 23 Feb 2000 08:44:21 +0200 (IST) Subject: functional programming In-Reply-To: <88uglk$1nh$1@nntp6.atl.mindspring.net> Message-ID: On 22 Feb 2000, Aahz Maruch wrote: > >Functional programming has a very clear definition: no side > >effects. Iterating explicitly means "with side effects." I'm not saying > >one style is better then the other, but you *can't* program functionally > >in Python. I had to get over it, and learn to write fibonaci with a while > >loop, when I first got to Python. > > What do you call this: > > def fib(x): > if x != int(x): > raise "Must use an integer" > if x < 0: > raise "Must be > 0" > if x == 0 or x == 1: > return 1L > else: > return fib(x-1) + fib(x-2) Um.....the most inefficienct version of fibonacci I've ever seen? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From effbot at telia.com Sat Feb 12 12:11:15 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 17:11:15 GMT Subject: urlopen through firewall References: <389B22DD.41FBC8F1@retemail.es> <38A47679.7E4A337B@retemail.es> Message-ID: Xose L. Gonzalez wrote: > Unfortunately the enviroment variable setting (with the right port number > and right proxi address) did not work :( ok, given that urllib is known to work with proxies, once you configure things correctly, the problem is probably on the proxy side. so what, exactly, does "does not work" mean here? what errors do you get? what proxy server are you using? From nobooze4u at BLAM!worldnet.att.net Fri Feb 11 11:31:08 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Fri, 11 Feb 2000 16:31:08 GMT Subject: Python sucks loud Message-ID: x-no-archive: yes You people are funny here, all excited about Python. Following one guy's recommendation, for two days already I'm looking at Python as a potential plug-in language, and it DISGUSTS me. What's so good about this yet another funny-ass language? I wonder if anyone can say something coherent that wouldn't be laughable. Even perl is less repulsive, although since it's all about text search it's not good for a built-in language. Now this Python. How come they don't put semicolons at the end of the line and the comments start with the number sign? Phoooey. Can't anyone write some Tiny C with classes and make it available on the net? From gerrit.holl at pobox.com Sun Feb 20 16:11:09 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 20 Feb 2000 22:11:09 +0100 Subject: Which GUI? In-Reply-To: <38B04C8C.45F96A76@bellatlantic.net>; from sholden@bellatlantic.net on Sun, Feb 20, 2000 at 08:22:21PM +0000 References: <38B04C8C.45F96A76@bellatlantic.net> Message-ID: <20000220221109.A7472@stopcontact.palga.uucp> > > > Grant Edwards wrote: > > > > [That Tcl/Tk is a more stable interface than Tk alone] > > > > Leaving Tcl in is a pragmatic solution, even though it doesn't > > appeal to the minimalist in me. > > > > -- > > Grant Edwards grante Yow! I'm wearing PAMPERS!! > > at > > visi.com > > If we wanted a minimalist solution we would hardly be using Windows > as an operating system, would we? And Tcl/Tk certainly works OK, though > it would be nice if its Win implementations made it easier to conform > to the platform's look and feel. OK, so distribute Tkinter with the Windows Python and wxPython with the Unix Python ;)) just-joking-ly y'rs - gerrit From edcjones at erols.com Sat Feb 19 23:52:25 2000 From: edcjones at erols.com (Edward C. Jones) Date: Sat, 19 Feb 2000 23:52:25 -0500 Subject: Bug in os.path.getatime (3rd try) Message-ID: <38AF7308.8A933364@erols.com> My ISP seems to have lost my first two attempts to post. Here is a bug in the python library program "posixpath.py" (Python 1.5.2 Linux). "os.path.getatime" returns the mtime. def getmtime(filename): """Return the last modification time of a file, reported by os.stat().""" st = os.stat(filename) return st[stat.ST_MTIME] def getatime(filename): """Return the last access time of a file, reported by os.stat().""" st = os.stat(filename) return st[stat.ST_MTIME] From michelorengo at netscape.com Tue Feb 1 13:33:21 2000 From: michelorengo at netscape.com (Michel Orengo) Date: Tue, 01 Feb 2000 18:33:21 GMT Subject: MAPI and NT Service References: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC73@RED-MSG-50> <388F1893.879D0550@netscape.com> Message-ID: <389727D6.747E4561@netscape.com> Mark Hammond wrote: > MAPI defers alot of security stuff until actually needed. What user > is the service logged on as? I would guess that it is NT/Exchange > security related rather than your script... > I don't think it is related to the security stuff, because I logged fine with MAPILogonEX. As I answer to Bill - who helped me previously: With: import mapi mapi.MAPIInitialize((mapi.MAPI_INIT_VERSION, mapi.MAPI_NT_SERVICE)) rawSession = mapi.MAPILogonEx(0, , , mapi.MAPI_EXPLICIT_PROFILE | mapi.MAPI_NEW_SESSION | mapi.MAPI_NO_MAIL | mapi.MAPI_NT_SERVICE) session = win32com.client.Dispatch("MAPI.Session") session.Logon(profileName=, profilePassword=, showDialog=0, newSession = 0, NoMail=1) The latest line fails (same as I had before) But then I realized that with that code I was logging twice: - first with mapi.MAPILogonEX - then with session.Logon I figured out that it might have a way to map a MAPI object with a CDO Object since CDO is built on top of MAPI. Looking at the the CDO doc, I found the MAPIOBJECT property that hold the MAPI handle. I gave it a try with: session.MAPIOBJECT = rawSession then: outbox = session.Outbox and it worked! However, since I was in a trial mode, I did that using the interactive session. I tried with my NT Service but it failed on: outbox = session.Outbox Unfortunately, I didn't have time to look into it very seriously. I plan to spend more time on this in the near future, but other projects deadlines force me to hold on this project. The project is still on hold, I hope to work on it very soon. In the meantime, if you have any suggestion... Thanks for your help Michel From skip at mojam.com Tue Feb 8 16:27:46 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 8 Feb 2000 15:27:46 -0600 (CST) Subject: Coverage Analysis In-Reply-To: <11A17AA2B9EAD111BCEA00A0C9B41793034AB143@molach.origin.ea.com> References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB143@molach.origin.ea.com> Message-ID: <14496.35410.540653.714924@beluga.mojam.com> David> Is there any way to do coverage analysis in Python? ... David> What would be cool is a debug mode that would have an integer David> associated with every line of every file executed. All counts David> are initialized to zero. As a line is executed the count is David> bumped up by one. At some point you can dump a module's couts to David> a file or as a tuple of integers. Sure. Search for "coverage" at http://www.musi-cal.com/~skip/python/ I have in my inbox a patch I've yet to look at from a fellow that improves the display of continuation lines. I haven't had a chance to look at it yet. If anyone's interested, let me know. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From moshez at math.huji.ac.il Fri Feb 18 23:10:18 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 06:10:18 +0200 (IST) Subject: None & Ellipsis In-Reply-To: <20000218225110.A9409@stopcontact.palga.uucp> Message-ID: On Fri, 18 Feb 2000, Gerrit Holl wrote: > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > >>> t1, t2, None, t4, t5, None, None, t8, None = t > >>> None > 'i' >>> del None >>> None >>> -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jfarrell at mincom.com Wed Feb 16 20:44:36 2000 From: jfarrell at mincom.com (John Farrell) Date: Thu, 17 Feb 2000 11:44:36 +1000 Subject: How holy-wars start References: Message-ID: <38AB5284.B7992B5F@mincom.com> Mark Hammond wrote: > Pearl: "But what of tailoring the Quest to the individual? Be flexible > like water, and in time, even stone will fall before it." Serpent: "One drop of water will not move stone. Many drops moving together are needed." -- Dr John Farrell - Research Architect - Mincom Limited I don't suffer from stress. I am a carrier. -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d- s++:+ a C+++ U+ 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------ This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this E-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. From aahz at netcom.com Thu Feb 10 13:22:22 2000 From: aahz at netcom.com (Aahz Maruch) Date: 10 Feb 2000 18:22:22 GMT Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <87tnmk$2uo$1@nntp6.atl.mindspring.net> Message-ID: <87uvku$p7a$1@nntp6.atl.mindspring.net> In article , chris patti wrote: >aahz at netcom.com (Aahz Maruch) writes: >> In article <87tkoi$hql$1 at nntp1.atl.mindspring.net>, >> Michal Wallace wrote: >>> >>>Anyone know what, specifically, will not be compatible, and compared to >>>what? :) >> >> Nope. I get the feeling that it will be similar to moving from Perl 4 >> to Perl 5. > >E-gads. I _fear_ for that particular comparison :) >(Perl's 'object system' introduced in Perl5 is one of the > things that made me switch to Python! :) Well, I wasn't talking about the relative degree of improvements made in moving from one major version to another. My point was that most basic functionality should remain the same (or close enough that simple scripts will continue to run correctly), but that anyone exploiting quirks of the language will almost certainly face problems. -- --- 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 Nostalgia just ain't what it used to be From kc5tja at garnet.armored.net Tue Feb 15 17:08:00 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 15 Feb 2000 22:08:00 GMT Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> <38A810A0.DB9ED318@bibsyst.no> Message-ID: In article , Jeff Kunce wrote: >> > > I`d like to make a client/server application exchanging objects of >> > > different type, sizes etc. Are there any simple tutorials or docs >> > > available on this, and what are my options on how to implement this ?? >> Yeah, that`s what I thought, but the serialize-bit isn`t the problem. >> The server/client-part is. How do I set up a server listening to a port, >> waiting for clients to connect and upload objects?? CORBA was designed specifically for this. Check out the omniORBpy, FNORB, and ILU packages for Python. The author of omniORBpy is right on this newsgroup too. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From alex at somewhere.round.here Tue Feb 22 12:14:42 2000 From: alex at somewhere.round.here (Alex) Date: 22 Feb 2000 12:14:42 -0500 Subject: Python mode - `C-c |' feature suggestion References: <14514.45176.931019.526625@anthem.cnri.reston.va.us> Message-ID: > >>>>> "I" == ISO writes: > > I> My suggestion is that `C-c |' be made clever enough to discover > I> the left margin of the region under consideration, and that it > I> removes that margin while transmitting the region to the Python > I> interpreter. That would allow for using that command in a much > I> wider variety of (smaller :-) contexts. > > I've also wanted this for a while, but never had the time to add it. > I'd accept a patch that implemented this feature. This is very cursorily tested, but it seems to do the job. I'll post again if I find any flaws (I will probably use it a lot, too.) By the way, what are all the control-L's for? Alex. pot% diff --context python-mode.el python-mode.el.1 *** python-mode.el Tue Feb 22 12:04:13 2000 --- python-mode.el.1 Fri Aug 13 11:59:54 1999 *************** *** 1239,1255 **** (setq py-file-queue nil) (message "%d pending files de-queued." n))) - - (defun py-remove-common-indentation () - ;; py-region-shift-* (start end) doesn't move the line end is on, so - ;; add a newline to the end of the file for end to refer to. - (goto-char (point-max)) - (insert "\n") - (while (progn - (goto-char (point-min)) - (not (re-search-forward "^\\S-" nil t))) - (py-shift-region-left (point-min) (point-max)))) - (defun py-execute-region (start end &optional async) "Execute the region in a Python interpreter. --- 1239,1244 ---- *************** *** 1289,1300 **** (format "python-%d-%d" sn pid) (format "python-%d" sn))) (make-temp-name "python-"))) ! (file (expand-file-name temp py-temp-directory)) ! (code-for-execution (buffer-substring-no-properties start end))) ! (set-buffer (get-buffer-create file)) ! (insert code-for-execution) ! (py-remove-common-indentation) ! (write-region (point-min) (point-max) file nil 'nomsg) (cond ;; always run the code in its own asynchronous subprocess (async --- 1278,1285 ---- (format "python-%d-%d" sn pid) (format "python-%d" sn))) (make-temp-name "python-"))) ! (file (expand-file-name temp py-temp-directory))) ! (write-region start end file nil 'nomsg) (cond ;; always run the code in its own asynchronous subprocess (async From themantis at trojanslair.zzn.com Thu Feb 24 20:50:33 2000 From: themantis at trojanslair.zzn.com (The Mantis) Date: Thu, 24 Feb 2000 17:50:33 -0800 Subject: python's screne. how wide is it? Message-ID: <38B5DFE9.CF87A673@trojanslair.zzn.com> could anyone tell me what the dimensions (in pixels) is of the python screne? also, is there a command to fill just one pixel (turn it white)? thanks From J.C.Travers at durham.ac.uk Tue Feb 15 08:58:25 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Tue, 15 Feb 2000 13:58:25 +0000 Subject: erasing and writing test on console. Message-ID: <38A95B81.DCFC4C25@durham.ac.uk> I need to write an interactive application to help download files from the internet. At one point, I need the output to display the status of the download (like apt-get in debian) i.e. it would be one line saying: file: dddddd.ddd size: xxx bytes zzzz bytes downloaded where the 'zzzz bytes downloaded' is updated. Do I need to use curses to do this, or is there a simpler way just using the standard print and an erase function that I haven't heard of? Thanks for any help, John Travers From dweber1 at austin.rr.com Sun Feb 6 20:59:49 2000 From: dweber1 at austin.rr.com (Daniel Weber) Date: Mon, 07 Feb 2000 01:59:49 GMT Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> Message-ID: <389E35EE.F8383238@austin.rr.com> Fredrik Lundh wrote: > Chadha, Saurabh wrote: > > Can anybody mail be a postscript of the Tkinter manual, the one on > > the python.org site, i am not able to print it because of some CS8 missing > > error from acroread. > > get acrobat 4.0 and those problems will go away: > http://www.adobe.com/products/acrobat/readstep.html > > > > I've got 4.0 and it still won't print. Bummer.... I ordered the new Tkinter book, hope it comes soon.... From pinard at iro.umontreal.ca Thu Feb 24 21:06:15 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 24 Feb 2000 21:06:15 -0500 Subject: nested functions In-Reply-To: "Terry Reedy"'s message of "Thu, 24 Feb 2000 18:47:19 -0500" References: <38B5B649.B0DFB374@quasar.ipa.nw.ru> <894ffe$ovd$1@news.udel.edu> Message-ID: "Terry Reedy" writes: > "Alexander V. Voinov" wrote: > > Please remind me, if there are any performance penalties in nesting > > functions like this: > [snip] > The definition of a nested function is re-executed everytime the outer > function is called. I would guess that the penalty is quite insignificant. The function has been compiled once and for all with the rest, and the `def' "execution" is nothing a mere assignment of the function to a local variable. Isn't it? -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From shendry at usa.capgemini.com Mon Feb 28 14:26:22 2000 From: shendry at usa.capgemini.com (sh) Date: Mon, 28 Feb 2000 14:26:22 -0500 Subject: HTML parser documentation Message-ID: <38badaa2_2@news1.prserv.net> I want to write program to extract info out of web sites, process the info, and then republish it on my web page. I heard that Python is the best language to do this, and it is an ideal language to learn programming (i.e. I'm not much of a programmer). The online info on Python.org is too difficult for me to understand. Can anyone please suggest a well written web page or book that can help a newbie like me learn this subject matter? I've researched Python books online, but none of the descriptions mention coverage of HTML parsing. Any tool that can help me write my program better? Thanks in advance. - sh From bajndin at ci.nsu.ru Thu Feb 24 00:42:32 2000 From: bajndin at ci.nsu.ru (åÇÏÒ âÁÑÎÄÉÎ) Date: Thu, 24 Feb 2000 11:42:32 +0600 Subject: Where can I take a Win32all-128 Message-ID: <892ge9$66n$1@news.nsu.ru> Who knows where can I get a PythonWin (Win32all-128)? Thanks... From nobody at nowhere.nohow Sat Feb 26 15:15:12 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Sat, 26 Feb 2000 20:15:12 GMT Subject: self argument References: <8984mm$5pi$1@nnrp1.deja.com> Message-ID: In article , Jason Stokes wrote: >> Even better, it would be nice (probably too late I know), if self >> was defined implicitly as the "this" pointer is in C++. > >I'm not sure why Python's way was chosen, but you get used to it. Gee, I always though C++ was the "odd" language and that it sure would be nice if the "this" pointer was passed as a parameter to methods and had to be used to access instance variables. -- Grant Edwards grante Yow! I want to dress you at up as TALLULAH BANKHEAD and visi.com cover you with VASELINE and WHEAT THINS... From tim_one at email.msn.com Sat Feb 12 23:51:54 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 12 Feb 2000 23:51:54 -0500 Subject: breaking the ; habit In-Reply-To: <38a5d928@news.isc.rit.edu> Message-ID: <000101bf75de$0d12f940$962d153f@tim> [osorronophris osorronophris] > I'm a die-hard C++ programmer With a pronounced stutter, to judge from the name . > that recently took up Python for a change of scenery and am > enjoying it greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've tried chewing > gum but it just doesn't seem to work, and I'd like to avoid > the patch. Any ideas? Take heart! Admitting you have a problem is the very first step of a very short journey. The next & final step is stopping. Unfortunately, Python itself doesn't mind if you add trailing semicolons, so you're really on your own here. Luckily, we'll ridicule you if you ever post code that uses them. Frequent and earnest public confession is one good remedial measure. Hard to say about a support group: you're the first to report this disease, and I'm not sure starting semicolon-abusers at python.org wouldn't simply attract mean-spirited mockers secretly encouraging you in your vice. Perhaps image therapy would help: stare hard at your semicolon key. Try to see it as half a human colon, bloody and oozing a little twist of waste material. Ewww! You really want to put *that* in your code?! let-us-know-how-it-goes-ly y'rs - tim From amused at webamused.com Wed Feb 9 20:39:36 2000 From: amused at webamused.com (Joshua Macy) Date: Thu, 10 Feb 2000 01:39:36 GMT Subject: Which Python book? References: <85035b$1sb$1@bignews.shef.ac.uk> <850pt8$qv9$1@nnrp1.deja.com> <852g8h$75@gap.cco.caltech.edu> <86fl0m$gmj$1@inputplus.demon.co.uk> <86kqtq$6kq$1@jaffa.itower.net> <38A0B834.DF6BBAC6@netscape.com> <38A0C9EF.F81FAC8E@webamused.com> <20000209151143.A265@better.net> Message-ID: <38A21479.DD7C00E3@webamused.com> William Park wrote: > > > If you take computer with you, then why don't you try online HTML docs? > I read them using 'lynx'. Given the limited screen real-estate on my laptop I honestly find the printed form more convenient. I have the html docs and look at them when I need something deeper than the Python Pocket Reference goes, but for the memory-jog that's all I usually need the low-tech solution suits me better. Although now you have me thinking that if I could put the online docs on my Palm Pilot.... Joshua From herzog at online.de Wed Feb 16 16:36:56 2000 From: herzog at online.de (Bernhard Herzog) Date: 16 Feb 2000 22:36:56 +0100 Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216073900.B2508775@vislab.epa.gov> <14506.62171.965245.972734@anthem.cnri.reston.va.us> Message-ID: "Barry A. Warsaw" writes: > >>>>> "RH" == Randall Hopper writes: > > RH> Maybe a "reraise " statement in Python 2.0? > > TMSA (Time Machine Strikes Again): > > -------------------- snip snip -------------------- > import sys > > def foo(): > raise NameError > > def bar(): > foo() > > def baz(): > try: > bar() > except NameError: > tpe, val, tb = sys.exc_info() > raise AttributeError, None, tb Binding the traceback to a local variable creates a cyclic reference, as the library documentation clearly warns: *Warning:* assigning the TRACEBACK return value to a local variable in a function that is handling an exception will cause a circular reference. This will prevent anything referenced by a local variable in the same function or by the traceback from being garbage collected. Since most functions don't need access to the traceback, the best solution is to use something like `type, value = sys.exc_info()[:2]' to extract only the exception type and value. If you do need the traceback, make sure to delete it after use (best done with a `try' ... `finally' statement) or to call `exc_info()' in a function that does not itself handle an exception. So, a better way to reraise the exception is def baz(): try: bar() except NameError: raise AttributeError, None, sys.exc_info()[-1] -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:24:48 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:24:48 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: Message-ID: Joel: In an article posted Thu, 24 Feb 2000 18:49:00 -0500, Joel Lucsy (jjlucsy at concentric.net) said: > Try my python15.dll at http://www.concentric.net/~Jjlucsy/python15.dll and > see if it helps. Basica1ly it uses delay loading of some of the dlls to > speed load time. I'll keep this in mind. However, getting this done would take an act of Congress. My ISP is supporting Python as a kind of trial, and I don't want to rock the boat with too many "special requests." Besides, they're slow-slow-slow at getting anything done. It'd take forever. However, thank you for the offer. -- -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From phd at phd.russ.ru Fri Feb 4 07:16:55 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 4 Feb 2000 12:16:55 +0000 (GMT) Subject: parsing text In-Reply-To: <949666439.1009585074@news.sheltonbbs.com> Message-ID: On Fri, 4 Feb 2000, Mike Partin wrote: > Hi again, I'm currently having a problem parsing text, reading it actually. I'm > trying to read a config file in the form of name=value I'd need to search for > name, and return value. If anyone has any code snippets that do nething like > this I would appreciate it. There is ConfigParser standard module. Don't know about docs for it. Once i wrote a collection of modules to handle "databases" in text files, including config files... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From warlock at eskimo.com Fri Feb 25 13:54:43 2000 From: warlock at eskimo.com (Jim Richardson) Date: Fri, 25 Feb 2000 10:54:43 -0800 Subject: Best way to find unique items in a list References: Message-ID: On Thu, 24 Feb 2000 11:31:32 +0100, maxm, in the persona of , brought forth the following words...: >I have written the following snippet to return a list of unique items in >another list. I just wondered if there was a smarter/faster way of doing it? > >Anyone for a little brain gym? > >------------------------------------------ > >def Unique(theList): > uniqueList = [] > OldValue = '' > theList.sort() > for value in theList: > if OldValue != value: > uniqueList.append(value) > OldValue = value > return uniqueList > > >print Unique(['Max','Gitte','Magnus','Caroline','Clara','Max','Gitte']) > >>>>['Caroline', 'Clara', 'Gitte', 'Magnus', 'Max'] > >------------------------------------------ > This works also, seems to be no slower, if not a little bit faster, at least for the list example given, I haven't tried it with other lists. This works because dict assignment overwrites any previous key. Of course, a downside is that the result is in no particular order, if that matters, you can sort the result. def uneek(list): val_dict={} for val in list: val_dict[val]='' return val_dict print uneek(['Max','Gitte','Magnus','Caroline','Clara','Max','Gitte']).keys() -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From sholden at bellatlantic.net Fri Feb 25 09:48:51 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 14:48:51 GMT Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: <894ea9$h33$1@nnrp1.deja.com> Message-ID: <38B69655.DD9980F9@bellatlantic.net> As a matter of interest, is there any functional difference between <%@LANGUAGE=Python%> as used by John, and expected according to all ASP materials I have seen, and <#@Language=Python#> as used by tom in his original post? regards Steve John Nielsen wrote: > > Maybe it is a version issue? > > What version of python are they running? > > I get sub 1 second responses with ASP and python using the > <%@ LANGUAGE = Python%> directive. > > john > > In article , > Tom Funk wrote: > > > > A similar thread started here a few weeks ago, then seemed to die. > There > > was no definitive answer, though. > > > > I've noticed a *definite* performance hit from my ISP when their IIS > > server delivers pages containing <#@Language=Python#>. There seems to > be > > a consistent 7-8 second delay while serving such pages. Pages that > don't > > use this directive, or that specify VBScript or JavaScript, don't > suffer > > the same fate. > > > > I tested with an ASP page that looks like this: > > > > <#@Language=Python#> > > > > > > > > > > > >

This is a test > > > > > > > > > > This page should load nearly instantaneously. However, using Python > with > > @Language causes a consistent 7-8 second delay. There's no > *discernable* > > delay for VBScript, JavaScript or when the Language directive is > skipped > > completely. > > > > A previous suggestion was to change the default language for the site > > from VBScript (or JavaScript) to Python. Did anyone try this? Does > this > > actually work? If not, does anyone have any other suggestions? Could > > some portion of the Python run-time be recompiling on each call (i.e., > > IUSR_COMPUTERNAME doesn't have write access to a directory on > PYTHONPATH > > and the .pyc files are never created)? > > > > My ISP tends to be slow to respond to requests, so before I ask them > to > > monkey around with my site's IIS settings, I'd like to know if what > I'm > > asking for will actually work. > > > > Thanks in advance. > > > > -=< tom >=- > > Thomas D. Funk | "Software is the > lever > > (no_spam_tdfunk at asd-web.com_no_spam) |Archimedes was searching > for." > > Software Engineering Consultant | > > Advanced Systems Design, Tallahassee FL. | > > > > -- > nielsenjf at my-Deja.com > > Sent via Deja.com http://www.deja.com/ > Before you buy. -- "If computing ever stops being fun, I'll stop doing it" From gerrit.holl at pobox.com Mon Feb 21 02:42:11 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 08:42:11 +0100 Subject: Int methods (was RE: string.py) In-Reply-To: ; from tim_one@email.msn.com on Sun, Feb 20, 2000 at 05:54:55PM -0500 References: Message-ID: <20000221084211.B872@stopcontact.palga.uucp> > > I see there might be parser problems, but maybe (5).radix? Python seems > > willing to check for it: > > > > >>> a = (5).radix(2) > > Traceback (innermost last): > > File "", line 1, in ? > > AttributeError: 'int' object has no attribute 'radix' > > The parser has trouble with 5.radix because "maximal munch" lexing sucks up > "5." as a float. I can't understand why this won't work, either: >>> aaa=4 >>> 1.aaa File "", line 1 1.aaa ^ SyntaxError: invalid syntax And: >>> 1.(aaa) Traceback (innermost last): File "", line 1, in ? TypeError: call of non-function (type float) :) > Note this cute one, though: > > >>> 5..radix > Traceback (innermost last): > File "", line 1, in ? > 5..radix > AttributeError: 'float' object has no attribute 'radix' > >>> > > That is, that's already parsed as (5.).float. > > There's little reason to apply methods to numeric literals, though, and > wrapping in parens is always sufficient. Note too: > > >>> (sys).stdin > > >>> > > That may look strange at first, but the LHS of an attribute fetch can > already be any expression whatsoever. >>> (1,2).aaa Traceback (innermost last): File "", line 1, in ? AttributeError: 'tuple' object has no attribute 'aaa' >>> (1,2).(aaa) File "", line 1 (1,2).(aaa) ^ SyntaxError: invalid syntax regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From jpaish at freenet.edmonton.ab.ca Wed Feb 16 16:13:52 2000 From: jpaish at freenet.edmonton.ab.ca (Joseph Paish) Date: Wed, 16 Feb 2000 14:13:52 -0700 Subject: tkinter manual wanted Message-ID: <38AB1310.B97A982@freenet.edmonton.ab.ca> i am looking for a downloadable tkinter manual/tutorial. i have found one or two on the web (on pythonware.com, i think) but would like something that can be read without going online. pdf format would be ideal, if such a thing exists. thanks joe From fdrake at acm.org Mon Feb 7 14:43:35 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 7 Feb 2000 14:43:35 -0500 (EST) Subject: PyExpat update In-Reply-To: <389F1CD5.102E6757@prescod.net> References: <389F1CD5.102E6757@prescod.net> Message-ID: <14495.8295.588575.301610@weyr.cnri.reston.va.us> Paul Prescod writes: > 1. Attributes would be returned as a mapping {key:value, key:value} and > not a list [key,value,key,value] . Obviously this will break code that > expected the former. This is good. > 2. Errors will be returned as strings, not integers. You can check for > string equality using "==" The intention is not that you would hard-code > strings into your code, but would rather use pre-defined string > constants: Please explain *why* you need this change; could the constants not still be numbers? (I'm not saying they *should* be numbers, just trying to understand the rationale for the change.)they're just IDs, > foo = parser.Parse( data ) > if foo is pyexpat.unclosed_token: > print "Oops:"+pyexpat.unclosed_token Are the strings the error messages or some sort of identifier? If they're IDs, this code fragment doesn't make sense. If they're messages, you tie the C component to a specific (human) language. My inclination is to stick with IDs (numeric or string) and map that to natural language in the application. > IIRC, Python is smart about checking for pointer equality before string > equality, right?) Yes. > 3. There will be no list of exceptions in the modules interface. Here's > what it looks like now: ... > I would rather move all of these to an "errors" dictionary so they don't > clutter up the main module namespace (after converting them to strings > instead of integers). So what's the dictionary look like? I imagine something like: errors = { "XML_ERROR_SYNTAX": "Syntax error!", ... } or are the integers still there? > ----------------- > > Here are the new features I have already added. Cool! > * new error handling: > > setjmp/longjmp is gone ... > * bug fixes: > > setattr throws an proper exeption when you do a bad assignment > setjmp/longjmp works on Windows So is setjmp/longjmp still used, or not? -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From bfulgham at debian.org Mon Feb 28 23:15:25 2000 From: bfulgham at debian.org (Brent Fulgham) Date: Mon, 28 Feb 2000 20:15:25 -0800 Subject: Further help with Object Caching Message-ID: <20000228201525.A1412@earthlink.net> I must be missing something obvious. I seem to be able to throw objects into strings without a problem, but they don't come out of the Cache alive :-) I whittled it further, to the point where it doesn't seem that the Cache is the issue, but rather the way I am storing objects. The following pseudo-code snippet shows the problem (taken from my program with the logging methods removed for clarity) (Note that the variable 'code' is a valid PyCodeObject*) ============================================================ // Create a cacheable code object by writing it to a string, // then converting the string to a char* PyObject* codeString; PyObject* test; PyObject* test2; char* cacheable; char* store2; int length; codeString = PyMarshal_WriteObjectToString((PyObject*)code); cacheable = PyString_AsString(codeString); length = PyObject_Length(codeString); // Test 1 -- Works test = PyMarshal_ReadObjectFromString((char*)cacheable, length); if (test == NULL) { // Log error message } // Test 2 -- Fails store2 = (char*)malloc(length * sizeof(char)) strncpy(store2, cacheable, length); // Use copy to build object test2 = PyMarshal_ReadObjectFromString((char*)store2, length); if (test2 == NULL) { // Throw tantrum } ===================================================== The 'test2' case fails. The first thing that comes to mind is that the "length" I am getting from PyObject_Length is wrong. Perhaps there is header or trailer data that is being included that should not, or information that is missing. Can anyone help shed some light on this? Thanks, -Brent From lenny at squiggie.com Tue Feb 22 18:06:36 2000 From: lenny at squiggie.com (Lenny Self) Date: Tue, 22 Feb 2000 15:06:36 -0800 Subject: Converting Strings to Integers in Python References: <88v1pk$l42$1@nntp6.atl.mindspring.net> Message-ID: <4EEs4.416$u37.25993@news.uswest.net> Thanks for the help. -- Lenny "Aahz Maruch" wrote in message news:88v1pk$l42$1 at nntp6.atl.mindspring.net... > In article , > Lenny Self wrote: > > > >I am new to Python and programming in general. I was wondering if someone > >might help me with the proper syntax for converting a string or a portion of > >a string into an integer. > > i = int(s) > -- > --- 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 > > Love does not conquer all. Humans are extremely flexible, usually more > flexible than we're willing to admit. But some flexibility comes at a > cost, and sometimes that cost is more than we can bear. From mdvorak at ninell.cz Sat Feb 5 11:06:26 2000 From: mdvorak at ninell.cz (mdvorak at ninell.cz) Date: Sat, 05 Feb 2000 16:06:26 GMT Subject: class objects in dictionaries Message-ID: <87hhq0$69k$1@nnrp1.deja.com> Hi all, I would like to put all my class definitions in a dictionary __objects__ in main global namespace. I know I can do it by putting the class objects into module called __objects__ and import this module, but that way classes would have different global namespace and I need them to have the same global namespace as the main script. I need to do something like: from class_objects import * to __objects__ Is there any way in Python how to do this? Thank you for help. Martin Sent via Deja.com http://www.deja.com/ Before you buy. From greg at perceval.be Tue Feb 29 12:43:51 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Tue, 29 Feb 2000 18:43:51 +0100 (CET) Subject: re.compile question In-Reply-To: <1260277030-30737176@hypernet.com> Message-ID: In reply to the message of Gordon McMillan sent on Feb 29 (see below) : Ok but what if I run re.compile in a CGI script and since it always return an object. can I do >>> import re >>> try: ... x = re.compile("(") ... except: ... [generate a beautifull error page] ? -- 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, 29 Feb 2000, Gordon McMillan wrote: > Date: Tue, 29 Feb 2000 12:31:05 -0500 > From: Gordon McMillan > To: Gregoire Welraeds , python-list at python.org > Subject: Re: re.compile question > > Gregoire Welraeds writes: > > > > Yes it's me again ;) > > How can I test that a re.compile has failed, Eg: If i simply forget a ( > > in my regular expression > > > > -- > > Life is not fair > > But the root password helps > > The interpreter does, too. > > >>> import re > >>> x = re.compile("(") > Traceback (innermost last): > File "", line 1, in ? > File "D:\Programs\Python\Lib\re.py", line 79, in compile > code=pcre_compile(pattern, flags, groupindex) > pcre.error: ('missing )', 1) > >>> > > - Gordon > > From gerrit.holl at pobox.com Sat Feb 12 15:31:33 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 21:31:33 +0100 Subject: range(start,stop) In-Reply-To: <38A5A2A7.C429BF61@math.okstate.edu>; from ullrich@math.okstate.edu on Sat, Feb 12, 2000 at 12:12:55PM -0600 References: <38A478A4.532D73F5@mail.dotcom.fr> <38A5A2A7.C429BF61@math.okstate.edu> Message-ID: <20000212213133.B5932@stopcontact.palga.uucp> David C. Ullrich wrote on 950353975: > You ask for replies from experts. I think the point is that those > darned experts are gonna get the stuff right regardless - for non-experts Paragraph starts with indentation... > like me it fits in with everything else very nicely. In my limited > experience I find that in Python I avoid off-by-one errors by not > worrying about them. This one doesn't... > Now if I could just get the whitespace issues straight... I understand. You do not seem to use it properly in your post ;) let's-add-an-email-feature-to-tabnanny-ly y'rs - gerrit From moshez at math.huji.ac.il Fri Feb 25 05:16:57 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 12:16:57 +0200 (IST) Subject: pythonian way In-Reply-To: Message-ID: On Fri, 25 Feb 2000, Alexander Williams wrote: > >Yeah, but I need to remove empty lines as well... > > Try: > > >>> A = filter(None, H.readlines()) > > filter() with None as the function to use as the test for elements > removes any that test as False intrinsically; since the empty line is > always False, it returns a list with only strings with length.Bingo. H.readlines() will never contain *truly* empty lines. The original poster meant "lines with nothing but the newline". Here's a version that works: A = filter(lambda x: x != '\n', H.readlines()) Or, to keep the style of the original post: A = filter(lambda x: x <> '\n', H.readlines()) now-skip-will-say-<>-is-deprecated-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From cjensen at be-research.ucsd.edu Fri Feb 11 20:32:27 2000 From: cjensen at be-research.ucsd.edu (Curtis Jensen) Date: Fri, 11 Feb 2000 17:32:27 -0800 Subject: Python sucks loud References: Message-ID: <38A4B82B.5C0A3D5F@be-research.ucsd.edu> Forget it wrote: > How come they don't put semicolons > at the end of the line and the comments start with the number sign? The semicolon is replaced with a new line character. If it's too hard to press the enter key instead of the semicolon and the enter key, then that's your problem. If you just want to make realy long one line code that no one will be able to read and is bad form, then that's your problem too. Comments starting with the number sign: I believe that was started much before Python, and perhaps before C. It's what is used in UNIX shell scripts. -- Curtis Jensen From mwh21 at cam.ac.uk Sat Feb 19 03:50:04 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 19 Feb 2000 08:50:04 +0000 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> Message-ID: "Florent Rami?re" writes: > Thanks for your answers, > > in fact as Moshe Zadka told me, it is a documented feature ... (sorry) > Well, i should have read more carefully the doc (re-sorry) > And is there a solution to my problem ? > And sys.stdout.write is not a good solution for me (i need to keep > printing with print) > > Is there an easy way to override the print statement (i saw it one time > in the news, but i can not find it) > You want sys.stdout.softspace: >>> print 1,;print 2 1 2 >>> print 1,;sys.stdout.softspace=0;print 2 12 It's a bit tedious to actually use, as it keeps getting reset; you could try this: >>> class SF: ... def __init__(self,string): self.string = string ... def __str__(self): sys.stdout.softspace = 0; return self.string ... >>> print SF("2"),1 21 HTH, Michael From evan at 4-am.com Thu Feb 24 16:55:22 2000 From: evan at 4-am.com (Evan Simpson) Date: Thu, 24 Feb 2000 15:55:22 -0600 Subject: Phyththon misspelling contest References: <38b6518c.14504847@news1.mysolution.com> <893u78$46n$1@nnrp1.deja.com> Message-ID: > > >Get Chaucerian, win valuable prizes! Extra points if none of > > >your posts spells it the same way as any other. Pie-a-thon? Bork, bork, bork!-ly y'rs Evan @ 4-am From pinard at iro.umontreal.ca Tue Feb 15 21:46:44 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 15 Feb 2000 21:46:44 -0500 Subject: Formalizing PO utilities Message-ID: Hi, people. Some while ago, I announced the packaging of `xpot' within a distribution named `po-utils'. `xpot' is a POT file extractor which works for C, C++, Python, and other PO files. In case you wonder, a POT file holds the translatable program messages from a given package, a PO file also contains the translation of those messages to a particular national language. I took a few hours today (taking a rest from other things :-) for removing a bit of dust from the mailing lists I take care of, and used that opportunity to set up mailing lists for `po-utils'. So, I should not bother you again here about PO utilities, please subscribe if you would like to stay informed. The Web address for PO utilities is (or should be): http://www.iro.umontreal.ca/contrib/po-utils/HTML The latest copy is: http://www.iro.umontreal.ca/contrib/po-utils/po-utils-0.5.tar.gz You can subscribe to mailing lists by sending either: subscribe po-utils-announce subscribe po-utils-forum in the body of a message sent to mailto:majordomo at iro.umontreal.ca . These lists are brand new, and I presume these will stay rather quiet, yet one never knows for sure. :-) Keep happy, all! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From movits at lockstar.com Wed Feb 2 10:29:38 2000 From: movits at lockstar.com (Mordy Ovits) Date: 02 Feb 2000 10:29:38 EST Subject: Am I programming in Python mode? References: <4TCYOB7LsZetOVPsMbGsNhmZpfcB@4ax.com> Message-ID: <38984D06.7A44BF90@lockstar.com> Michael Hudson wrote: > > Anders M Eriksson writes: > > > Hello! > > > > Being new to Python I would like your comments on this function. Is it > > written in Pytnon mode? > > Only you can tell if it was written in Python mode ('round here Python > mode usually refers to the emacs major mode for Python). I can try and > help with style, which is what I'm fairly sure you meant. > > > The function returns a random string, and have 3 params the lenght of > > the string, lowercase/Uppercase and dublicates > > > > Any comments and/or suggestions are welcome!! > > > > // Anders > > > > > > > > def randStr(n, lower=1, dublicates=1): > > # returns a random string with characters > > # lower if true only lowercase letters > > # dublicates if true then the same letter can be repeated > > This bit could (should) be in a docstring, not a comment. > > > if lower: > > l = ord('a') > > h = ord('z') > > else: > > l = ord('A') > > h = ord('z') > > Hmm, does this actually work? ASCII goes like: > > .... STUVWXYZ[\]^_`abcdefghijk ... > > so the above will get strings containing [\]^_` characters. > > > str = "" > > generator = whrandom.whrandom() > > Why do you want your on generator? > > > for i in range (n): > > ch = generator.randint(l,h) > > if dublicates: > > str = str + chr(ch) > > It's probably better to accumulate substrings into a list and use > string.join to stick them together. This is particularly true in the > single character case, 'cause they're cached. > > > else: > > bRepeat = 1 > > while bRepeat: > > if not chr(ch) in str: > > str = str + chr(ch) > > bRepeat = 0 > > else: > > ch = generator.randint(l,h) > > > > > > return str > > You do know about random.choice don't you? It selects a random item > from a sequnce - and strings are sequences. > > So if I were doing this I'd do it like this: > > import random,string > > def randStr(n,lower=1,duplicates=1): > """ randStr(n:Integer[,lower,duplicates]) -> String > > Generate a random string of length n. > If |lower| is true (the default), only lowercase letters will be used. > If |duplicates| is true (the default), the string may contain duplicates. """ > if lower: > choices = 'abcdefghijklmnopqrstuvwxyz' > else: > choices = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' > result = [] > if not duplicates and n > len(choices): > raise ValueError, "n too large" > for i in range(n): > while 1: > ch = random.choice(choices) > if duplicates or ch not in result: > result.append( ch ) > break > return string.join(result,'') > > This probably isn't perfect, but I hope in helps. > > Cheers, > Michael See string.lowercase, string.uppercase and string.letters As in: for i in range(0, n): string.append(random.choice(string.letters)) Mordy -- o Mordy Ovits o Cryptographic Engineer o LockStar, Inc. -- There are two kinds of fool; One who says "This is old and therefore bad," and one who says "This is new and therefore better." -- John Brunner From aiki108 at netscape.net Thu Feb 24 05:51:56 2000 From: aiki108 at netscape.net (David Fisher) Date: Thu, 24 Feb 2000 10:51:56 GMT Subject: Best way to find unique items in a list In-Reply-To: References: Message-ID: <20000224.10515678@sparky.spkydomain> Here's a quickie. Def Unique(thelist): uniquedict = {} for i in thelist: uniquedict[i] = 0 return uniquedict.keys() Whether it's any faster i don't know. david >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/24/00, 4:31:32 AM, "maxm" wrote regarding Best way to find unique items in a list: > I have written the following snippet to return a list of unique items in > another list. I just wondered if there was a smarter/faster way of doing it? > Anyone for a little brain gym? > ------------------------------------------ > def Unique(theList): > uniqueList = [] > OldValue = '' > theList.sort() > for value in theList: > if OldValue != value: > uniqueList.append(value) > OldValue = value > return uniqueList From gerrit.holl at pobox.com Thu Feb 17 01:42:38 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 07:42:38 +0100 Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <38AB8445.DF945829@webone.com.au>; from stuart.hungerford@webone.com.au on Thu, Feb 17, 2000 at 04:16:53PM +1100 References: <38AB8445.DF945829@webone.com.au> Message-ID: <20000217074238.A1675@stopcontact.palga.uucp> http://www-4.ibm.com/software/developer/library/ruby.html: > Ruby has been gaining popularity over the past few years, especially > in Japan, where it was born and conceived. Its features, like Perl's, > are designed to process text files and complete systems management > tasks. Ruby is highly portable and easily customized, but primarily > draws users because of its purity and readability. In particular, > CGI code scripters are increasingly frustrated with Perl's occasionally > enigmatic code and Python's inelegant and difficult syntax that requires > "too much typing." Neither Python nor Perl were designed as object-oriented > languages. Consequently, the OO features often feel "added on" and are > not fully integrated into the language core, making for cryptic code. Although I don't know about Pythons history, I'm almost certainly that Python _was_ designed to be object-oriented. I can't see any facts about Python in the rest of the article. "Python's inelegant and difficult syntax" is the opinion of the writer... regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From aahz at netcom.com Wed Feb 23 12:05:34 2000 From: aahz at netcom.com (Aahz Maruch) Date: 23 Feb 2000 17:05:34 GMT Subject: functional programming References: Message-ID: <89140u$7l5$1@nntp6.atl.mindspring.net> In article , Moshe Zadka wrote: >On 22 Feb 2000, Aahz Maruch wrote: > >>>Functional programming has a very clear definition: no side >>>effects. Iterating explicitly means "with side effects." I'm not saying >>>one style is better then the other, but you *can't* program functionally >>>in Python. I had to get over it, and learn to write fibonaci with a while >>>loop, when I first got to Python. >> >> What do you call this: >> >> def fib(x): >> if x != int(x): >> raise "Must use an integer" >> if x < 0: >> raise "Must be > 0" >> if x == 0 or x == 1: >> return 1L >> else: >> return fib(x-1) + fib(x-2) > >Um.....the most inefficienct version of fibonacci I've ever seen? Well, sure, but it meets your definition of functional programming. You claimed that functional programming is impossible in Python; I've provided a counter-example. Do you now retract your claim? -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From tim_one at email.msn.com Mon Feb 14 22:22:17 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 14 Feb 2000 22:22:17 -0500 Subject: Real Problems with Python In-Reply-To: <1e5zn0z.12jgb2flo8zz6N%bparsia@email.unc.edu> Message-ID: <000e01bf7763$dc8a9300$66a2143f@tim> [Tim] > ... > More formally, you can certainly *model* Python's scoping in Scheme, [Bijan Parsia] > Er..Just out of curiosity, what *can't* you model in Scheme? :) Smalltalk . > And-not-in-the-trivial-turing-machine-sense-ly y'rs, > Bijan Parsia > > P.S. Hey! Where's my wallet? at-the-door-just-waiting-for-you-to-find-the-exit-ly y'rs - tim From dworkin at ccs.neu.edu Mon Feb 28 10:03:28 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 28 Feb 2000 10:03:28 -0500 Subject: Killin' Newbie question In-Reply-To: Gregoire Welraeds's message of "Mon, 28 Feb 2000 14:50:34 +0100 (CET)" References: Message-ID: Gregoire Welraeds writes: > I can't access the __init__ method outside of the object, so the > following is disallowed : > ---- > class huh(): > def __init(self): > [some initialisation] > > ough= huh() > > [some code] > > ough.__init__() > ---- If you fix the two minor errors in your code, the above works fine: >>> class huh: ... def __init__(self): ... print 'spam' ... >>> ough = huh() spam >>> ough.__init__() spam > Other little question, what about the following (regarding another remark > posted before) : > > def __init__(this): Sure, that's fine. There is nothing special about 'self', it is merely a convention. The instance is passed as the first argument to methods; the position matters, not the name. -Justin From harold.taylor.remove-this at delete-this.uni-tuebingen.de Wed Feb 23 07:21:01 2000 From: harold.taylor.remove-this at delete-this.uni-tuebingen.de (H.V.Taylor) Date: Wed, 23 Feb 2000 13:21:01 +0100 Subject: Font in tkinter / idle References: <87putpfssr.fsf@parus.parus.no> Message-ID: "Robert Hicks" wrote: >you want to edit EditorWindow.py: > >if sys.platform[:3] == 'win': > text['font'] = ("verdana", 10) ># text['font'] = ("courier new", 10) snip.... Thanks, that had been bugging me for a couple of weeks now :-) You've just saved me the trouble of rebooting into Linux or BeOS for my scripting. Harold From moshez at math.huji.ac.il Fri Feb 11 04:13:48 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 11:13:48 +0200 (IST) Subject: Corel + Borland = The End of MS Win In-Reply-To: Message-ID: On Thu, 10 Feb 2000, Robin Becker wrote: > Isn't mentioning Tom C enough to ensure a visit? I don't know, he isn't Kibo. (I don't think we ever had a visit from Kibo, did we?) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From cfelling at iae.nl Fri Feb 4 11:44:42 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 4 Feb 2000 17:44:42 +0100 Subject: [Doc-SIG] Monty: A structured text syntax idea References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> <20000203160900.A1029@stopcontact.palga.uucp> Message-ID: <87evlq$vu$1@vvs.superst.iae.nl> Dear Gerrit, I think it's about time that you start to use procmail and a better mailer. I'm getting frustrated by all those glimpses of interesting discussions that take place in some other universe I'm no part of:) Unless it's your objective to get more people involved in the SIG's. That could be an interesting approach: keeps us all informed. Even better would be to get summaries now and again. Any volunteers? -- groetjes, carel From etienne at alias.it Thu Feb 17 12:59:43 2000 From: etienne at alias.it (Etienne Antoniutti Di Muro) Date: Thu, 17 Feb 2000 18:59:43 +0100 Subject: tricky cPickling Message-ID: <38AC370D.D4713C69@alias.it> This is my first message posted, so hi everybody !! :-) Recently I have experienced some problems using cPickle.load function. Here it comes: code is pretty simple: class MyStuff: def save(filename): obj = (GlobalVar1, GlobalVar2, GlobalVar3) #GlobalVar are instances of classes f = open(filename, "w") cPickle.dump(f, obj) f.close() def load(filename): f = open(filename, "r") (globalVar1, globalVar2, globalVar3) = cPickle.load(f) f.close() return obj I experiece errors in unpickling only (MyStuff.load("MyFileName")), they are listed as follows: 1_ NameErrors of some objects from modules used by the "GlobalVar" cPickled. (but please note that those modules are properly imported before cPickling); 2_ MemoryErrors in cPickling; 3_ Different behaviours (raised exceptions) of the script which uses MyStuff.load("MyFileName") method, according how i call it. Is it due to different exception managment of MacPython IDE instead of MacPython AppletBuilder ?? 4_ Cause of those errors I can't embed MyClass in a C function, that is where i need it to work. Any Suggestion ?? Thanks for support etienne From sjoerd at oratrix.nl Fri Feb 25 12:02:12 2000 From: sjoerd at oratrix.nl (Sjoerd Mullender) Date: Fri, 25 Feb 2000 18:02:12 +0100 Subject: Windows freeze up Python/Motif In-Reply-To: Your message of Fri, 25 Feb 2000 02:21:11 +0000. <894ouk$q8l$1@nnrp1.deja.com> References: <894ouk$q8l$1@nnrp1.deja.com> Message-ID: <20000225170213.54F45301CF9@bireme.oratrix.nl> I assume you start the program with os.popen and read from a pipe. Something like f = os.popen('long-running-perl-program', 'r') while 1: line = f.readline() if not line: break updatedialog(line) I'll also assume that you use the python X extension. If not, the basics of what I say still apply. You'll have to redo this using callbacks. Something like: f = os.popen('long-running-perl-program', 'r') Xt.AddInput(f.fileno(), Xtdefs.XtInputReadMask, read_callback, f) # now make sure that you return to the X mainloop, since that's what # will cause the callback to be called def read_callback(f, fd, id): # f is the last argument to Xt.AddInput, fd and id are provided by # the X library and are the file descriptor used and the ID which # was returned by Xt.AddInput fcntl(fd, FCNTL.F_SETFL, FCNTL.O_NDELAY) # put in no-delay mode while 1: data = os.read(fd, 128) if not data: break updatedialog(data) # not necessarily a whole line fcntl(fd, FCNTL.F_SETFL, 0) # back to normal mode What this does is tell the Xt library to look at the given file (f.fileno()) to see if there is data to read, and if there is to call the callback function. The callback function reads the data and updates the dialog. The callback function should make sure not to hang in the call to read. If any other X event come along (such as expose events), the normal expose callback gets called behind the scenes. The calls to fcntl don't have to be in the callback. The call to set the file descriptor in no-delay mode should be done before returning to the X mainloop. I hope this helps. On Fri, Feb 25 2000 bragib at my-deja.com wrote: > I have a dialog shell set up that when a certain button is pressed > it fires off a perl script which is really lengthy in execution. > I am reading each line from stdout and printing it to a message > are in my dialog. So the dialog only gets updated when I get a new > line. Well the time between new lines can take awhile and > in the meantime the gui freezes up (i.e. if I drag another > window over the dialog does not get updated). > > I do not have the option of splitting up the execution of this > perl script. Does anyone know how I can submit the process > in 'parallel' and have the dialog wait for the process to > complete? > > I am using Motif through a Python binding if that helps? > > Thanks in advance > > > Sent via Deja.com http://www.deja.com/ > Before you buy. -- Sjoerd Mullender From landauer at apple.com Tue Feb 15 19:09:19 2000 From: landauer at apple.com (Doug Landauer) Date: Tue, 15 Feb 2000 16:09:19 -0800 Subject: Guido's not in; leave your number at the tone... References: <001001bf7763$e37ab280$66a2143f@tim> <38A979D2.71CD8FB3@inrialpes.fr> Message-ID: In article , wtanksle at hawking.armored.net (William Tanksley) wrote: Hey, he started it. > "Lord Of the Rings." Tolkien's work was allegorical on many levels. Ring > Counting (or RC), as in the books, helps to determine ... ... which messages to ignore, and which to return. ... a relevant tidbit from a mailing list I'm on: >>> > ash nazg durbatuluk >>> > ash nazg gimbatul >>> > ash nazg thrakatuluk agh burzum-ishi krimpatul > > Whatsat mean? One ring to...? One ring to wake them One ring to screen them One ring to erase them all as if you'd never seen them > I'll stop now. Me too. -- Doug Landauer landauer at apple.com (work) landauer at scruznet.com (not-work) From dworkin at ccs.neu.edu Wed Feb 16 10:19:59 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 16 Feb 2000 10:19:59 -0500 Subject: Valid Python Code? In-Reply-To: Anders M Eriksson's message of "Wed, 16 Feb 2000 16:05:02 +0100" References: Message-ID: Anders M Eriksson writes: > I'm just wondering is this a valid Python code snippet? > > import os > for k,v in os.environ.values(): > print k,v No, but if you change os.environ.values to os.environ.items, it will make a lot more sense. -Justin From hildeb at www.stahl.bau.tu-bs.de Mon Feb 7 10:30:27 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 7 Feb 2000 15:30:27 GMT Subject: mail filter in python? References: <20000208000902.31713@nms.otc.telstra.com.au> <20000207154641.A2817@stopcontact.palga.uucp> Message-ID: On Mon, 7 Feb 2000 15:46:41 +0100, Gerrit Holl wrote: >The procmail syntax is really obfuscated. What about creating a mail >filter with a Python syntax? Shouldn't be too difficult, just create >some functions (drop, match_header) and execfile() a file with the >rexec module... As long as you do correct locking, maildir delivery and all that other stuff CORRECTLY, go ahead. From jfarrell at mincom.com Mon Feb 21 18:36:42 2000 From: jfarrell at mincom.com (John Farrell) Date: Tue, 22 Feb 2000 09:36:42 +1000 Subject: None & Ellipsis References: Message-ID: <38B1CC0A.A5932132@mincom.com> Fredrik Lundh wrote: > Moshe Zadka wrote > > Yes. It's called the "Python 3 namespace rule". > > exactly. and combined with the "local variables > are detected by static analysis" rule, things get > really weird. consider this: > > def mylongfunction(): > a = None > # ... > # a few hundred lines of computation > # ... > a = 1, 2, 3 > None, None, b = a > > this results in an exception. on what line? Ooh, nasty. My guess is on the a = None line, because None has been determined to be a local variable by static analysis. Trying to evaluate the local variable before it is assigned to causes the error. of-course-you-can't-run-it-that-would-be-cheating-ly yours John -- Dr John Farrell - Research Architect - Mincom Limited I don't suffer from stress. I am a carrier. -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d- s++:+ a C+++ U+ 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------ This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this E-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. From jody at sccsi.com Thu Feb 3 09:54:56 2000 From: jody at sccsi.com (Jody Winston) Date: 03 Feb 2000 08:54:56 -0600 Subject: embeding python in C++ ?? References: <20000203085900.02304.00000899@ng-da1.aol.com> Message-ID: jerryjerry at aol.com (JerryJerry) writes: > I would like to embed python within a C++ application. I want to call python > scripts from C++ objects and call C++ object methods from python scripts. > > Does anyone have experience with this? > > I am new to Python, so I don't know how involved this is, or if it is even > possible. > > Thanks in advance. > Jerry It's basically very easy to do. For an overview look at the extending and embedding documentation and the files in Demo/embed. One approach would be to down load SWIG (www.swig.org) and use it to wrap your code. This is a good approach if your code doesn't use templates. Anther approach is to use the work of the C++ sig. This approach is more friendly to templated code. -- Jody Winston From sabren at manifestation.com Fri Feb 11 15:02:23 2000 From: sabren at manifestation.com (Michal Wallace) Date: Fri, 11 Feb 2000 15:02:23 -0500 Subject: const for bytecode optimization... Message-ID: <881psn$tbp$1@nntp6.atl.mindspring.net> hey all, you know... I was just thinking... someone posted about the const operator a day or two ago... and the response was generally that you don't need it because you can do THIS_KINDA_THING or even const.this .... But there's another thing that const gets you... Java, for example, can use static final variables (constants) as a sort of bytecode optimizer, in place of c style #IFDEF 's for example, say you had: DEBUG = 0 # call various functions any one of which might change DEBUG if DEBUG: # nothing in here needs to be compiled into the .pyc pass from what I understand, the optimizing compiler doesn't do anything yet, maybe this could be a start.. of course, you could also just enforce the ALL_CAPS as being constant, and not allow them to be redefined, but this could break someone's code if they didn't follow that convention... thoughts? -michal http://www.sabren.com/ From effbot at telia.com Tue Feb 8 13:34:52 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 18:34:52 GMT Subject: PIL & Tk8.2 References: Message-ID: Robin Becker wrote: > has anyone got a Tk8.2 compatible version of PIL? afaik, PIL 1.0 works just fine with Tk 8.2. http://www.pythonware.com/products/pil (no, we don't have a prebuilt version available right now. we downgraded to 8.0.5 after getting way too many inexplicable crashes. maybe some- one else have had more luck?) From olafb at pvv.org Wed Feb 23 08:41:32 2000 From: olafb at pvv.org (Olaf Trygve Berglihn) Date: 23 Feb 2000 14:41:32 +0100 Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> <89382q$djb$1@nntp6.atl.mindspring.net> Message-ID: * aahz at netcom.com > Take a look at this example I posted a while back: > http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=570016307&fmt=text Nice example. But I have a slightly different problem. I'd like to have threads that can return a value upon completion to the scope in which the threads were started. Any suggestions on how to do that in a simple way? -- * Olaf Trygve Berglihn From phd at phd.russ.ru Mon Feb 28 05:31:40 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 28 Feb 2000 10:31:40 +0000 (GMT) Subject: [smtplib]: How to send binary file attachement ? In-Reply-To: <89dgc8$1ul$1@horn.hk.diyixian.com> Message-ID: On Mon, 28 Feb 2000, Roger Lam wrote: > anyone got a working sample code? #! /usr/local/bin/python -O import sys, os, string from mimetools import choose_boundary from MimeWriter import MimeWriter import base64 try: from cStringIO import StringIO except ImportError: from StringIO import StringIO def gen_mime(zip_file): email_from = "Oleg Broytmann " email_to = "you at your.some.host" #sendmail = open("sendmail", 'w') sendmail = os.popen("/usr/sbin/sendmail '%s'" % email_to, 'w') sendmail.write("""From: %s To: %s Subject: %s Precedence: bulk MIME-Version: 1.0 """ % (email_from, email_to, zip_file)) mime = MimeWriter(sendmail) firstpart = mime.startmultipartbody("related") firstpart.write("""\ Your mailer does not support MIME encoding. Please upgarde to MIME-enabled mailer (almost every modern mailer is MIME-capable). """) subwriter = mime.nextpart() subwriter.addheader("Content-Transfer-Encoding", "base64") subwriter.addheader("Content-Disposition", "inline; filename=\"%s\"" % zip_file) subwriter.startbody("application/zip") zip_file = open(zip_file, 'r') base64.encode(StringIO(zip_file.read()), sendmail) zip_file.close() mime.lastpart() sendmail.close() def run(): zip_file = sys.argv[1] gen_mime(zip_file) if __name__ == '__main__': run() Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From BKossmann at dthr.ab.ca Wed Feb 16 11:50:55 2000 From: BKossmann at dthr.ab.ca (Kossmann, Bill) Date: Wed, 16 Feb 2000 09:50:55 -0700 Subject: Newbie question: Dictionary of lists Message-ID: <2F1A38DC0413D311A7310090273AD5278A03A0@dthrexch01> Hello, Python gurus! As part of my first Python effort, I need to implement a dictionary of lists. Basically, I need to read a history file containing account codes, period names, and amounts; the dictionary's key is a concatenation of the account codes, and the values are 12-element lists (one for each month). I want a sample dictionary entry to look like this: {'00006101071115000000': [10, 20, 30 ... 120]} so that when I need to access March data for cost centre '00006101071115000000', all I have to do something like: history['00006101071115000000'][2] Trouble is, when I implement my FOR loop as below, *all* of the dictionary's January elements are updated to the value of the last January item in the history file. I've searched high and low for a solution, but I'm stumped. I've put the relevant code and the input file inline below my signature; does anyone see what I'm doing wrong here? Thanks very much for any hints or pointers you can offer! Yours in gratitude, Bill p.s. I'm running Python 1.5.2 on NT 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bill Kossmann, CGA Business Analyst David Thompson Health Region Red Deer, Alberta, Canada ph 403 343 4463 fx 403 343 4697 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # TEST.PY ============================================================ import string history = {} history['DEFAULT'] = [31,29,31,30,31,30,31,31,30,31,30,31] # Null elements - one for each month of the year (Jan ... Dec) nullList = ['', '', '', '', '', '', '', '', '', '', '', ''] # Short test file (16000 lines in production) histFile = open("2000.txt", "r") for histLine in histFile.readlines(): histRcd = string.split(histLine, ",") # Key is our cost centre code dictionaryKey = histRcd[0]+histRcd[1]+histRcd[2]+histRcd[3] # Null list required to add an element if it's not the first element if not history.has_key(dictionaryKey): history[dictionaryKey] = nullList # Obviously must evaluate for other months, but January will do for testing if (histRcd[4][:3] == 'JAN'): history[dictionaryKey][0] = float(string.strip(histRcd[5])) # Print out stuff for debugging as data is read into dictionary print history, '\n' # Check the results print '\n' for data in history.keys(): print data, '\t', history[data], '\n' histFile.close() # 2000.TXT =========================================================== 00,006,1010,71115000000,APR-00,116086.78 00,006,1010,71115000000,AUG-00,609247.99 00,006,1010,71115000000,DEC-00,1137682.76 00,006,1010,71115000000,FEB-00,1061321.95 00,006,1010,71115000000,JAN-00,1060712.34 00,006,1010,71115000000,JUL-00,503767.58 00,006,1010,71115000000,JUN-00,377198.08 00,006,1010,71115000000,MAY-00,264693.16 00,006,1010,71115000000,NOV-00,1004264.5 00,006,1010,71115000000,OCT-00,868372.67 00,006,1010,71115000000,SEP-00,739740.11 00,006,1010,71115900000,APR-00,17508.32 00,006,1010,71115900000,AUG-00,-328862.2 00,006,1010,71115900000,DEC-00,-199854.91 00,006,1010,71115900000,FEB-00,-138890.05 00,006,1010,71115900000,JAN-00,-138890.05 00,006,1010,71115900000,JUL-00,285846 00,006,1010,71115900000,JUN-00,257857.71 00,006,1010,71115900000,MAY-00,227246.56 00,006,1010,71115900000,NOV-00,-293133.9 00,006,1010,71115900000,OCT-00,-364361.44 00,006,1010,71115900000,SEP-00,-431565.48 00,006,1010,71115950000,APR-00,-2751.23 00,006,1010,71115950000,AUG-00,56302.45 00,006,1010,71115950000,DEC-00,87618.3 00,006,1010,71115950000,FEB-00,87618.3 00,006,1010,71115950000,JAN-00,87618.3 00,006,1010,71115950000,JUL-00,-3098.64 00,006,1010,71115950000,JUN-00,-13041.97 00,006,1010,71115950000,MAY-00,29.51 00,006,1010,71115950000,NOV-00,76108.28 From effbot at telia.com Sat Feb 12 07:18:18 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 12:18:18 GMT Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> <20000212113935.C1007@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > I think it should be published in the original Docbook format too, since > people can generate their favorite format AND contribute to the manual > than. given that I hear far more complaints than thank you's, it's more likely that I will stop distributing the acrobat version. "this is what you want, this is what you get" From effbot at telia.com Wed Feb 23 12:44:36 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 17:44:36 GMT Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <38B40EBD.13EC1C1E@math.utah.edu> <38B417B2.C03EEC3B@math.utah.edu> Message-ID: <80Vs4.7659$al3.101405@newsc.telia.net> Mladen Bestvina wrote: > Fredrik Lundh wrote: > > > > Tkinter as distributed with Python 1.5.2 does *not* work with > > Tk 8.1 and later. either use 8.0.5, or get patches from here: > > I have Tk 8.0.5: > > mladen at drava:/home/mladen/projects/grayson > wish > % info library > /usr/local/lib/tcl8.0 > % well, that only means that wish was linked against 8.0, not that _tkinter.so is linked against it... but alright, try setting TK_LIBRARY and TCL_LIBRARY to point to the configuration files, e.g: % export TCL_LIBRARY=/usr/local/lib/tcl8.0/library % export TK_LIBRARY=/usr/local/lib/tk8.0/library From dwsauder at mailexcite.com Sat Feb 5 20:53:13 2000 From: dwsauder at mailexcite.com (Doug Sauder) Date: Sat, 05 Feb 2000 20:53:13 -0500 Subject: How do I wrap text? Message-ID: <389CD409.C6A884BE@mailexcite.com> It seems like there should be some very easy way to wrap long lines of text. What I am looking for is something like the Unix fmt utility, or the Perl text module (which I can't remember the name of right now). I spent several hours today browsing the Python library reference, but didn't seem to find the right module, if there is one. Thanks in advance for your help. -- dws From robin at jessikat.demon.co.uk Thu Feb 3 18:52:36 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 3 Feb 2000 23:52:36 +0000 Subject: Which Tcl with 1.6 References: <87d2vq$s4l$1@news.vanderbilt.edu> Message-ID: In article <87d2vq$s4l$1 at news.vanderbilt.edu>, Jonathan Gilligan writes >Under WinNT 4.0 (SP5), with VC++ 6.0 (SP3) I have had good success building >_tkinter with tcl 8.1 and 8.2, doing nothing more than applying Dieter >Saurer's patches to _tkinter.c and tkappinit.c (they have been merged into >the Python anonymous cvs repository, or you can search under tkinter and >Dieter Saurer on deja news). Then you need to manually edit >Lib/lib-tk/FixTk.py to replace references to tcl80.dll, tclpip80.dll and >tk80.dll with your local equivalents.The CVS log claims that the patch to >tkappinit does not work under Tcl 8.2, but I have had no problem so far >running a number of the demos and running PIL with it. > >Has anyone tried tkinter with 8.2 on other platforms? > >Jonathan Gilligan > I certainly have used the patches (or slight variations thereof) with no problems under win95/linux 2.2 Python-1.5.2 I thought about using stubs with Tcl8.2 to allow for future changes, but as _tkinter embeds Tcl/Tk it seems that stubs are the wrong way round. It could almost be done with a little dynamic loading technology. >"Robin Becker" wrote in message >news:eNIa+DAmfYm4EwL0 at jessikat.demon.co.uk... >> Just started having a look again at the CVS and noticed that _tkinter is >> still being built against Tcl8.0. Surely we should be moving to making >> Tcl8.2 standard especially as it can do unicode which we are informed >> will be in 1.6. >> -- >> Robin Becker > > -- Robin Becker From alex at somewhere.round.here Mon Feb 28 12:23:25 2000 From: alex at somewhere.round.here (Alex) Date: 28 Feb 2000 12:23:25 -0500 Subject: Multi-argument append() is illegal References: <200002281541.KAA23255@eric.cnri.reston.va.us> Message-ID: It would be a lot easier to write code to fix instances of this if the parser module could be coaxed into giving the column- as well as the line- numbers of tokens. Is this possible? Alex. From positron2u at gmx.de Sun Feb 27 09:29:40 2000 From: positron2u at gmx.de (Dominik Friedrich) Date: Sun, 27 Feb 2000 14:29:40 -0000 Subject: MySQLdb compiling problems Message-ID: <89b8o9$pu2$2@news03.btx.dtag.de> did anybody successfully compiled the mysqldb module on a win32 system? when i compile it python can't load the module. i'm not an experient programer so it would be great to get the compiled version of this module from somewhere else. thanks in advance Dominik Friedrich --------------------------------------------------------------- www : www.scene.de/positron mp3 : http://www.mp3.com/positron2 mail : positron2u at gmx.de icq : 30557629 From embed at geocities.com Thu Feb 24 09:17:15 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 24 Feb 2000 09:17:15 -0500 Subject: identity of the caller? References: <38B4EDE0.1DB1B55F@horvath.com> <38B53445.AE517D15@horvath.com> Message-ID: > I'm doubt it too. I suspect there is a more clever way to do it, just that > I am not clever enough to at the moment to think of it. Sometimes the obvious is just too obvious. Senders call receivers, and pass a reference to themselves as a PARAMETER to the function, called Sender. Who called me? Well, I'll just look at the parameter 'Sender'. Warren From effbot at telia.com Wed Feb 9 14:47:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 19:47:35 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> <87sbgq$nga$1@nnrp1.deja.com> Message-ID: stevie_deja at my-deja.com wrote:> > > who's behind this secret conspiracy? > Typically you are dealing with people coming from other languages. I am > sorry that you cannot handle people asking if something is in Python. > what is the fear of you say 'no, we don't have that either' a problem > for you. I'm sorry, but I completely failed to parse that message. But you seem to be implying that 1) people who've used other languages tend to have my-deja.com accounts and like to post without revealing their real names, and that 2) I don't like to help newcomers? that's cool. not true at all, of course, but hey, if thinking that makes you happy... From ivanlan at callware.com Thu Feb 24 22:46:11 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 24 Feb 2000 20:46:11 -0700 Subject: Comparing perl and python References: <000f01bf7f41$fae9eea0$b62d153f@tim> Message-ID: <38B5FB03.19D53276@callware.com> Hi All-- Tim Peters wrote: > [bobbit] > c.l.py-is-c.l.p.m-on-quaaludes-ly y'rs - tim > -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 neelk at alum.mit.edu Thu Feb 24 11:39:17 2000 From: neelk at alum.mit.edu (neelk at alum.mit.edu) Date: Thu, 24 Feb 2000 08:39:17 -0800 Subject: functional programming References: <000801bf7daa$80dde000$51a0143f@tim> Message-ID: <0ac76d2a.e325df6e@usw-ex0104-031.remarq.com> In article , Dan Schmidt wrote: >neelk at brick.cswv.com (Neel Krishnaswami) writes: >| >| [Joy language] >| >| IMO, it's the endpoint of the strongly-typed FP mafia's approach, >| carried to its logical limit -- every Joy progam will terminate, at >| the cost of the language's Turing-completeness. I *was* shocked by >| just how much Joy *can* do: it pretty much sold me on the idea that >| embedding Joy-style "extremely-pure" sublanguages in bigger ones is a >| Good Idea. > >I looked it up and here's the Joy URL: > Augh! I just realized I screwed up the names. Joy, while an excellent and cool language (it's a functional Forth, more or less), is fully and totally 100% Turing-complete. The language that I was /actually/ talking about is Charity, which is a categorical programming language invented at the University of Calgary: http://www.cpsc.ucalgary.ca/projects/charity/home.html Sigh -- my apologies for any confusion I've caused. :( Neel * 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 tseaver at starbase.neosoft.com Thu Feb 3 10:13:18 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 3 Feb 2000 09:13:18 -0600 Subject: re AMTE thread re DrScheme & Python References: <1262576128-2292072@hypernet.com> Message-ID: <73BD666B8B0196AB.1AF26399FCBBB6AD.501B5E4C2B5C17BB@lp.airnews.net> In article <1262576128-2292072 at hypernet.com>, Gordon McMillan wrote: >Ivan Van Laningham wrote: >> >> Kirby Urner wrote: >> > >> ]snip[ >> > I, in turn, sincerely apologize for writing an emotional evaluation about >> > Python and its users. I should not have given permission to post my first >> > reaction to a newsgroup about which I knew nothing. I particularly regret >> > using the word "cult" for Python users. >> > >> > -- Matthias Felleisen >> > >> >> Hmmph. It's not enough. He should grovel more, and he should be forced >> to use Python for a month. > >Well, I'm glad it's over. I was running low on candles and bat's >wings, and couldn't find a virgin anywhere... I gave up on THAT recipe some time back. My wife has been complaining pretty bitterly about the wax and chicken bones strewn about the back porch, though. Who-says-Python-lacks-a-cookbook?-ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From sholden at bellatlantic.net Tue Feb 8 11:18:19 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 08 Feb 2000 16:18:19 GMT Subject: Redundant elements in sys.path References: Message-ID: <38A041E6.BE93E93C@bellatlantic.net> Thanks for the response. I guess I'll just have to be a little less neurotic about sys.path! More below. "Dennis E. Hamilton" wrote: > > I have noticed the same thing with the python 1.5.2 for Win32 distribution, > without PythonWin installed. This shows up on Windows 98 and Windows 98 SE, > although I thought I noticed more capitalization variations. It appears to > be an artifact of the installation process that appears harmless although a > bit distracting when I look at it. > My hypothesis is that it may also be a redundancy resulting from capturing > the Fat32 long file names as well as the underlying DOS forms of the file > names, with no filtering for duplicates. (Do those even make sense on NT? > Does PROGRA~1 correspond to anything on your system?) Windows NT does indeed use the name mangling process when it has to deal with FAT filesystems, and this particular NT system did have a FAT filesystem on drive C: when the messages were generated. So PROGRA~1 is a plausible representation of "Program Files". But that doesn't explain why only Idle has those entries. I suspect Idle is adjusting sys.path according to its own ideas of what the install directory is, and to pick up its own components. And perhaps not doing quite as good a job as it might: it looks a bit 16-bitsy. > > Related install question: Do you have Tcl-Tk installed as part of python > 1.5.2 for Win32? I noticed that on WIn98 there is a registry error (bad > path to a Tcl-Tk library module) in that install. I reported it to the > Tcl-Tk folk and they said it doesn't show up in the Win32 installer for > Tck-Tk versions later than the one packaged inside python 1.5.2. I mention > it now here before I forget one more time. Yes, I had three Tcl-Tk related DLLs not get found when Idle started up, for example. Rather than fix the registry entries I copied the DLLs into the %systemroot%\System32 directory, thereby leaving a bug for me to trip over when I upgrade :-) Is that what you mean? This is the vanilla Windows binary 1.5.2 distribution. And jolly nice it is, too. I really like the way Python takes the Windows platform seriously. I'd rather not have to use it, but since clients insist, at least I can have good tools without having to Telnet to my Linux machine. > > -- orcmid > > -----Original Message----- [snipped] regards Steve -- "If computing ever stops being fun, I'll stop doing it" From andy at robanal.demon.co.uk Tue Feb 15 07:39:08 2000 From: andy at robanal.demon.co.uk (Andy Robinson) Date: Tue, 15 Feb 2000 12:39:08 GMT Subject: Off Topic Posts References: Message-ID: <38b01f76.4257932@news.demon.co.uk> "Gene Chiaramonte" wrote: >All good points. I have several filters in place already, but many messages >still slip through. > >I am suggesting that python-list be split into 2 lists. One for specific >python programming questions, and another list for python language opinions >and comments. > >Anyone agree with me? > >Gene Years back, I subscribed to comp.sys.next.programming, comp.sys.next./software, and comp.sys.next.advocacy. It worked really well. The 'advocacy' group was the place for flame wars, defending the honor of our superior engineering solutions, and general chat.; the 'programming' and 'software' groups had specific enough titles to be unlikely to atrract flames. I've suggested this split a few times in the last five years and don't know why people want to keep it in one group. But there's no point starting the official newsgroups creation procedure if only two of us feel this way. Thanks, Andy From gchiaramonte at ibl.bm Fri Feb 11 12:55:04 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Fri, 11 Feb 2000 13:55:04 -0400 Subject: Fully Bracketed Syntax In-Reply-To: <38A44B79.5A441154@roguewave.com> Message-ID: I like indentation so much I now write my Delphi code like this: with SaveDialog1 do begin DefaultExt := 'prt'; Filter := 'Portfolios (*.prt)|*.prt'; InitialDir := flvPortfolios.Directory; if Execute = True then begin id := GetNextId; fname := FileName; frmMain.New(id, fname); end; end; Now if Borland will just get rid of the begin ... end and switch to python from Pascal, they'd really have something. It might even save them from bankruptcy. Gene From crypt at ihug.co.nz Tue Feb 29 20:06:05 2000 From: crypt at ihug.co.nz (crypt at ihug.co.nz) Date: Wed, 1 Mar 2000 14:06:05 +1300 Subject: possible problem with the mysqldb interface Message-ID: <20000301140605.A7378@python.localnet> hi I am converting code written for the old mysql interface that makes extensive use of the fetchdict() method. I would like to continue using this as it makes reduces code errors for many case. The problem that I have is that there does not seem to be enough information provided by the api to implement this is a reliable manner. Any suggestions n how to do this. I had intended to use the information provided in cursor.description but for some reason this does not provide the name of the table therefore can not be used. Joe. -- ======================================================================= in real life: Joseph Skinner |There's no such thing as a wizard email: crypt at ihug.co.nz |who minds his own business Analyst/Programmer | - Berengis the Black | Court Mage to the Earls Caeline ======================================================================== From J.C.Travers at durham.ac.uk Mon Feb 14 08:09:36 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Mon, 14 Feb 2000 13:09:36 +0000 Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> <882fld$6t08$1@node17.cwnet.frontiernet.net> <38A6F986.F3F29C95@durham.ac.uk> Message-ID: <38A7FE90.4DF5A04@durham.ac.uk> > demands, demands, demands. how about a simple "please"? > > http://w1.132.telia.com/~u13208596/temp/py15-980706.zip Sorry, I was very rude (frustrated). I apologise, and thank you for the link. John Travers From hakan at pythonware.com Wed Feb 9 06:36:20 2000 From: hakan at pythonware.com (=?iso-8859-1?Q?H=E5kan_Karlsson?=) Date: Wed, 9 Feb 2000 12:36:20 +0100 Subject: ANN: Secret Labs/PythonWare is hiring! Message-ID: <03ba01bf72f1$e2940720$f19b12c2@secret.pythonware.com> Secret Labs AB is a company located in Link?ping/Sweden that uses Python aggressively for all its product developments. Backed by venture funding, Secret Labs is currently focusing its business on development tools for the Python community, under the PythonWare label. The most important products right now are PythonWorks and uiToolkit. Secret Labs also develops things like the Python Imaging Library (PIL), PythonWare Sound Toolkit (PST), XML-RPC for Python, and other more or less well known software products. We are looking for developers for our core development team in Link?ping, to help us take our products onto the global market and to lead the future development of Python tools and utilities. for more info: http://www.pythonware.com/jobs/ send your resumes or questions to jobs at pythonware.com or directly to me at hakan at pythonware.com (H?kan Karlsson). or call +46 13 210 215 (office) or 0708 - 490 235 (mobile). From yishai at platonix.com Sun Feb 6 12:52:39 2000 From: yishai at platonix.com (Yishai Beeri) Date: Sun, 06 Feb 2000 19:52:39 +0200 Subject: embeding python in C++ ?? References: <20000203085900.02304.00000899@ng-da1.aol.com> Message-ID: <389DB4E7.3C0058E3@platonix.com> Hi, Sure, both ways are possible, and pretty straightforward. Actually, the python docs (www.python.org) explain it quite well. The only catch is that you cannot call object methods directly, but rather use global scope to call c++ funcs (just like calling them from C). If you have any specific questions, go ahead. Yishai JerryJerry wrote: > I would like to embed python within a C++ application. I want to call python > scripts from C++ objects and call C++ object methods from python scripts. > > Does anyone have experience with this? > > I am new to Python, so I don't know how involved this is, or if it is even > possible. > > Thanks in advance. > Jerry From mwh21 at cam.ac.uk Mon Feb 14 12:50:46 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Feb 2000 17:50:46 +0000 Subject: Python sucks loud References: Message-ID: grant at nowhere. (Grant Edwards) writes: > In article , Forget it wrote: > >x-no-archive: yes > >You people are funny here, all excited about Python. > >Following one guy's recommendation, for two days already I'm looking at > >Python as a potential plug-in language, and it DISGUSTS me. > > [...] > > That's one of the lamest, most transparent flame-bait postings > I've seen in a long time. And I'm only seeing it because you've replied to it. What are killfiles (or scorefiles, to be pedantic in my case) for? Cheers, M. From steve at durge.org Tue Feb 22 17:54:47 2000 From: steve at durge.org (Stephen Quinney) Date: 22 Feb 2000 22:54:47 +0000 Subject: dialog Message-ID: <87900c97bc.fsf@jupiter.pigeon-st> Can anyone either point me in the direction of the full documentation on Dialog or solve this trivial problem which is bugging me please? I have an error dialog box which pops up when something goes wrong, i nicked the code from one of Guido's Tkinter demos. I want to bind a function to each of the two available buttons, i.e. when the retry button is pressed it calls a function retry() and when quit is pressed the program quits. def errordialog(self): Dialog.Dialog(self.root, text = 'This shouldn't happen', title = "Something horrible happened", bitmap = 'error', default = 0, strings = ('Retry','Quit')) Thanks for any suggestions, Stephen From gmcm at hypernet.com Mon Feb 28 21:36:12 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 28 Feb 2000 21:36:12 -0500 Subject: Multi-argument append() is illegal In-Reply-To: Message-ID: <1260330723-27507635@hypernet.com> Alexander Williams wrote: > On Mon, 28 Feb 2000 10:41:02 -0500, Guido van Rossum wrote: > >I am going to rectify this in Python 1.6 -- people coming from other > >languages might well expect list.append(a, b, c) to mean the same as > >list.append(a); list.append(b); list.append(c), and it's always been > >my philosophy to make ambiguous syntax illegal rather than to pick one > >interpretation randomly. > > This would seem to violate the Principal of Least Surprise, at least > when considering the rest of the language. Unless you also start > requiring the presence of parens on every other construction of a > tuple (as in: > > >>> a, b, c = string.split("1 2 3") > > ) you're introducing inconsistancy with Python in general. Hardly. The only way to make f(a,b,...) identical to f((a,b,...)) for an arbitrary number of args is to play games with *args in f. The fact that it happens to work with append right now is the inconsistancy. - Gordon From tim_one at email.msn.com Sun Feb 13 16:23:07 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 13 Feb 2000 16:23:07 -0500 Subject: Real Problems with Python In-Reply-To: Message-ID: <000e01bf7668$850d9740$572d153f@tim> [Fran?ois Pinard] > ... > Couldn't we approximate lexical scoping with classes? Certainly: the things Scheme does with lexical closures were *intended* to be done with classes and explicit instance state in Python. Every now & again someone comes along and insists the latter aren't sufficient, but they are -- in Python. Python's flavor of classes are more powerful than most realize at first. > For the few times I needed it, I was fairly satisfied with this > solution. Me too, but after s/fairly/very/ after many times needing it. The class approach is more flexible in practice, thanks to the explictly manipulable state (e.g., conceptually small changes don't require juggling six levels of nested closure -- it's often enough to just add a simple new method to fiddle an aggregate closure state maintained in a vanilla class instance). > Surely more verbose than in Scheme, but yet, given I do not use > it often, I did not care the extra-verbosity. > > P.S. - If you see a contradiction with my previous message where > I praise terseness, please consider that common and frequent idioms > are better terse, while some verbosity is acceptable for things > like lexical scoping, that we do less often, and for which some > extra documentation is welcome. I suspect that, like me, you're not doing any GUI programming in Python yet. The press for fancier lambdas and lexical closures is much stronger from people who do: they want to attach small & simple procedures to oodles & oodles of widgets (your "common and frequent" indeed), and out-of-line class solutions are legitimately viewed as clumsier and more obscure. "one-obvious-way"-vs-"one-pleasant-obvious-way-depending"-ly y'rs - tim From gmcm at hypernet.com Tue Feb 8 08:05:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 8 Feb 2000 08:05:18 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87ocad$to2$1@nnrp1.deja.com> Message-ID: <1262107411-7763595@hypernet.com> fcahoon at my-deja.com writes: > > Suppose that I'm one of those set-tabs-to-logical-indentation sorts of > guys, so I set my tab width to 4, then look at this code in my editor. > Gee, it sure _looks_ like statement4 belongs to "if condition1"! And, > if I convert tabs to spaces when I save, statement4 _will_ belong to "if > condtion1". I've just unwittingly changed the logic of the code! > > You may, of course, argue that this is unlikely, but it is still > plausible enough to make me _very_ nervous. Notice that it is *only* the last line in a block where this misunderstanding can still yield syntactically valid code, and only when the new interpretation of tab is smaller than the old. - Gordon From robin at jessikat.demon.co.uk Fri Feb 25 02:50:35 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 25 Feb 2000 07:50:35 +0000 Subject: Tkinter: changing colour of scrollbars on Windows References: Message-ID: <+qeJ5DALRjt4EwlZ@jessikat.demon.co.uk> In article , Mark C Favas writes > >On Unix, it is possible to change the colours of Tkinter scrollbars using >the standard configure methods. However, on Windows (Tcl/Tk 8.05), the >colours remain unchanged from the defaults. (Same thing happens using Tcl/Tk, >so it's not just a Tkinter thing.) I've looked for the reasons for this or work- >arounds on the Python, Tcl newsgroups to no avail (but I could have missed >something). Can anyone enlighten me on what is going on here, and whether >there is any workaround? > >Thanks, > 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 I think Tk now uses scrollbars and they aren't aren't colourable the same way as they used to be. -- Robin Becker From pinard at iro.umontreal.ca Tue Feb 15 19:09:46 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 15 Feb 2000 19:09:46 -0500 Subject: Real Problems with Python In-Reply-To: neelk@brick.cswv.com's message of "15 Feb 2000 23:12:54 GMT" References: <000e01bf7763$dc8a9300$66a2143f@tim> Message-ID: neelk at brick.cswv.com (Neel Krishnaswami) writes: > I thought that the Smalltalk and Scheme designers were in regular > communication. Great minds and good people stay in regular communication. Aren't we all often reading (and writing to) this mailing list? :-) :-) Keep happy! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tbryan at python.net Sat Feb 12 07:52:46 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 12 Feb 2000 07:52:46 -0500 Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <880l7l$i6k$1@mach.vub.ac.be> Message-ID: <38A5579E.EAA08F7B@python.net> Thomas Hamelryck wrote: > Otherwise I will be forced to keep on being the "ennemy within" > of this newsgroup :-). Not if we kill you first. ;-) what-cult?-ly yours ---Tom From jblake at stamp-coin.com Fri Feb 4 22:19:27 2000 From: jblake at stamp-coin.com (jonathon) Date: Sat, 5 Feb 2000 03:19:27 +0000 (UTC) Subject: An FTP based Python Module repository (was Re: Imagemagick) In-Reply-To: Message-ID: On 4 Feb 2000, chris patti wrote: >Skip Montanaro writes: >> Why couldn't a CPAN-like thing be a web site? Web sites can (and are) >> mirrored all the time. >There's no reason why it couldn't be, actually. ncftp ftp.python.org get * would grab everything on ftp.python.org, that was publically readable --- and could do it without me being present. http doesn't have quite that same functionality. xan jonathon From gerrit.holl at pobox.com Mon Feb 14 09:09:59 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 15:09:59 +0100 Subject: Changes to urlparse.py: urljoin In-Reply-To: <38A73982.AAA65E9C@graburn.com>; from ron@graburn.com on Sun, Feb 13, 2000 at 11:09:47PM +0000 References: <38A73982.AAA65E9C@graburn.com> Message-ID: <20000214150959.A658@stopcontact.palga.uucp> Ronald Hiller wrote on 950479787: > I've been having some problems with the urljoin function. When I try > and join URLs that have '..' components that make the path above the > root, they aren't joined properly. > > For example: > > goof> python > Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import urlparse > >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") > 'http://www.xyz.com/../x/y/z.gif' > >>> > > # Now with the changes: > > python > Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import urlparse > >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") > 'http://www.xyz.com/x/y/z.gif' > >>> > > My patches for urlparse are included below...do they look reasonable? > What is the process for getting these into the "real" source tree? Have a look at: http://www.python.org/patches/ regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From bparsia at email.unc.edu Wed Feb 9 20:51:06 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 20:51:06 -0500 Subject: Readable Functional Languages References: <000401bf6dfc$0ee5f180$822d153f@tim> <87fq9n$1sn$1@vvs.superst.iae.nl> <87okkg$42u$1@nnrp1.deja.com> <87op9v$2eo$1@sun.rhrk.uni-kl.de> Message-ID: <1e5r2gm.7rgjjb15vazurN%bparsia@email.unc.edu> Markus Kohler wrote: > Try smalltalk (www.squeak.org for example). > It's a pure OOPL but it also comes with complete support for closures. > > Markus Small correction. Squeak's blocks are not (yet) full closures, but go most of the way for most uses and can be, with a little effort, used as such. ANSI Smalltalk, and almost every other Smalltalk implmentation (indeed, I can't think of any other exceptions), blocks are closures. Cheers, Bijan Parsia. From ajung at starship.skyport.net Wed Feb 2 13:29:05 2000 From: ajung at starship.skyport.net (Andreas Jung) Date: Wed, 2 Feb 2000 13:29:05 -0500 (EST) Subject: Ann: PMZ - Poor Man's Zope Message-ID: Dear all, I am happy to announce the availability of POOR MAN'S ZOPE 0.1. PMZ is very similar to Active Server Pages or PHP3/4 and allows you to include Python code into your HTML pages. Example:

just a test

',i,'this sux' print '

' ?>

Noch ein Test

The functionalty is implemented as an external handler for the Apache web server. For further informations: http://www.suxers.de/pmz.htm Any comments go to ajung at suxers.de From jstok at bluedog.apana.org.au Sat Feb 12 08:45:59 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Sun, 13 Feb 2000 00:45:59 +1100 Subject: Two question from a newbie References: Message-ID: <%zep4.24612$3b6.103195@ozemail.com.au> Moshe Zadka wrote in message ... >On Fri, 11 Feb 2000, Fred L. Drake, Jr. wrote: > >> > 1.) How do I implement ORs and ANDs in an if-statment? >> > >> > - e.g. I'd like to have this C-code in Python: >> > >> > if (x.mode == "view" || x.mode == "modify") >> > myMode = x.mode; >> >> if (x.mode == "view" or x.mode == "modify"): >> myMode = x.mode > >Apparently Fred is hacking too much C these days, otherwise he'd >encourage you to use Python (rather then C-in-Python): > >if x.mode in ("view", "modify"): > myMode = x.mode I don't see that this idiom has that much to recommend it. Mr Drake's version is clear in that we're comparing x.mode with two modes -- "view" and "modify". Your version attempts to *find* x.mode in the tuple ("view", "modify") and executes the sub-bock if successful. The intention of the first example is immediately apparent. The intention of the second is not so immediate, so it must lose out if you want to write maximally comprehendable code. From mwh21 at cam.ac.uk Fri Feb 25 09:30:24 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Feb 2000 14:30:24 +0000 Subject: nested functions References: <001301bf7f47$821e69a0$b62d153f@tim> Message-ID: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= writes: > "Tim Peters" ?crit: > > > [Alexander V. Voinov] > > > Please remind me, if there are any performance penalties in nesting > > > functions ... > > > [...] a function object has to be allocated [...each time through...], > > a pointer to the global namespace needs to be installed, and current > > bindings for optional arguments (if any) need to be captured. > > It looks more powerful than I imagined! Isn't this one more step towards > lexical closures? :-) Oh yes. If you've read SICP, then you'll probably remember the running example along the lines of: (define (make-balance amount) (define (enquire) amount) (define (deposit a) (set! amount (+ amount a))) (define (withdraw a) (set! amount (- amount a))) (list enquire deposit withdraw)) (let* ((l (make-balance 100)) (e (car l)) (d (cadr l)) (w (caddr l))) (display (e)) (newline) (d 30) (display (e)) (newline)) which should print 100 130 This can be done in Python: def make_balance(n): a = [n] def enquire(a=a): return a[0] def deposit(x,a=a): a[0] = a[0] + x def withdraw(x,a=a): a[0] = a[0] - x return enquire,deposit,withdraw e1,d1,w1=make_balance(100) e2,d2,w2=make_balance(100) print e1(),e2() d1(30) print e1(),e2() which should print: 100 100 130 100 Thing is, while this is a (vaguely) sensible way to behave in scheme, it's demented in Python. Use a class. just-because-you-can-don't-think-you-should-ly y'rs Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From gerrit.holl at pobox.com Thu Feb 24 14:06:11 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 24 Feb 2000 20:06:11 +0100 Subject: Phyththon misspelling contest In-Reply-To: ; from wware@world.std.com on Thu, Feb 24, 2000 at 05:03:41AM +0000 References: Message-ID: <20000224200611.A6705@stopcontact.palga.uucp> > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. spam -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From gward at cnri.reston.va.us Thu Feb 17 14:17:53 2000 From: gward at cnri.reston.va.us (Greg Ward) Date: Thu, 17 Feb 2000 14:17:53 -0500 Subject: Where is Imaging.h? In-Reply-To: <14508.11387.761765.788240@weyr.cnri.reston.va.us>; from fdrake@acm.org on Thu, Feb 17, 2000 at 12:14:35PM -0500 References: <14508.11387.761765.788240@weyr.cnri.reston.va.us> Message-ID: <20000217141753.C10739@cnri.reston.va.us> On 17 February 2000, Fred L. Drake, Jr. said: > I think this would be a good idea. There are actually two Python > include directories, one for $prefix and one for $exec_prefix; > extensions would have to "do the right thing" here. > Greg Ward, I presume you've already thought of this and distutils > supports it? ;-) Nope, I blew it and had to hack the NumPy setup script to install the C header files. Both Paul Dubois and I totally forgot about this need until a NumPy user pointed it out. Oops. You're right though, Distutils will need to be fixed to do this properly for other module distributions than NumPy. For the record, NumPy installs its headers to $prefix/include/python1.5/Numeric which I guess makes sense. C headers aren't normally platform-specific, except for those of the config.h variety -- and in fact I believe that most of Python's own headers are installed to $prefix, but config.h goes to $exec_prefix. Wouldn't it be nice if we could just say "Extensions with platform-specific headers are EVIL". Doubt it though. ;-( Greg From tim_one at email.msn.com Tue Feb 22 02:35:13 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 22 Feb 2000 02:35:13 -0500 Subject: Cool things about Ruby on the way out of Python? In-Reply-To: <874sb1j2vm.fsf@ev.netlab.co.jp> Message-ID: <000501bf7d07$5ad1b880$e82d153f@tim> [Yukihiro "Matz" Matsumoto, Ruby's dad] > Some points in Python which I don't like are too essential to remove > from the language (e.g. block by indentation), Ya, we all hate that . > but I think the following can be solved in the future version > (P3K maybe?). > > * type, class distinction Definitely to be fixed in P3K. > * statemant, expression distinction I doubt Guido will ever want to blur this distinction -- Python discourages "doing too much on one line" in many ways, although I don't know how deliberate a design goal that was. As is, most experienced Pythoneers will even write if test: do_it instead of if test: do_it because the former is easier to read and easier to modify. OTOH, Python may grow more powerful kinds of expressions (e.g., list comprehensions are widely regarded as natural for Python, and Greg Ewing already implemented a version of them). > * restricted iteration by `for', using index and `__getitem__' Many msgs about that here recently (generators, iterators, coroutines, continuations). Unclear whether any of that will happen, though. Regardless, I agree Python's iteration protocol currently suffers in all but the simplest of cases. BTW, has Ruby developed its own version of "block by indentation" yet? That is, some feature you *really* like in Ruby that a minority of Ruby users (or prospective Ruby users, or just random trolls) flame about endlessly? If so, I think Python would like to adopt all such features <0.9 wink>. good-taste-is-offensive-ly y'rs - tim From effbot at telia.com Tue Feb 8 05:39:09 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 10:39:09 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <00020717051900.00606@quadra.teleo.net> <87o4ge$od9$1@nnrp1.deja.com> Message-ID: wrote: > You know, Patrick, when viewed from deja.com, the way you've quoted me > is seriously mis-formatted. I think the problem stems from your use of > tabs as indentation. nope. it stems from your use of a crappy newsreader. > Good thing it's not python code, eh? so what? dejanews has a view source mechanism, which is there for anyone to use. or you can use dejanews classic: http://www.deja.com/=dnc/threadmsg_ct.xp?AN=582911827.1 so in other words, once you learn to use your tools, this is a non-issue. "Now, imagine that your friend kept complaining that she didn't want to visit you since she found it too hard to climb up the drain pipe, and you kept telling her to use the friggin' stairs like everyone else..." -- seen on comp.lang.python, june 1998 From piet at cs.uu.nl Fri Feb 18 11:17:12 2000 From: piet at cs.uu.nl (piet at cs.uu.nl) Date: 18 Feb 2000 17:17:12 +0100 Subject: PIL photocd loading Message-ID: Has anybody succeeded in loading photocd files with PIL? When I trie this, Python crashes with a memory access violation. This is on Windows NT with PIL 1.0 (Nov 99). import Image im = Image.open("yose05.pcd") im.show() -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: Piet.van.Oostrum at gironet.nl From tjreedy at udel.edu Sun Feb 20 17:12:41 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 20 Feb 2000 17:12:41 -0500 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> Message-ID: <88poj8$h05$1@news.udel.edu> > Does a requirement exist for a Python compiler and are your ready to pay > for it ?? > > We are grateful for suggestions and business models in above area Second suggestion: go to WWW.PYTHON.ORG and from thence to dejanews archive of our newsgroup and search on 'compiler'. You should get at least a couple of hundred hits to peruse. Terry J. Reedy From gmcm at hypernet.com Thu Feb 24 18:45:45 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 24 Feb 2000 18:45:45 -0500 Subject: Threads and classes In-Reply-To: <38B57744.21491DBA@flashmail.com> Message-ID: <1260686549-6105097@hypernet.com> Jp Calderone asks: > Which of the following is better/prefered, or is the absolutely no difference? > > thread.start_new_thread(SomeClass.someMethod, (someInstance,)) > > or > > thread.start_new_thread(SomeInstance.someMethod, ()) The threading module would be much better than the thread module. As for the styles, I'd vote for #2. - Gordon From tbryan at python.net Sat Feb 12 08:31:17 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 12 Feb 2000 08:31:17 -0500 Subject: range(start,stop) References: <38A478A4.532D73F5@mail.dotcom.fr> Message-ID: <38A560A5.376CDB49@python.net> Stephane BAUSSON wrote: > > Hello > > Just a question for a Python expert ... > What the interest for the range function to stop at stop-1 and not at > stop ? In addition to the other things already mentioned, I happen to like the fact that for element in range(a,b): do_something for element in range(b,c): do_something is the same as for element in range(a,c): do_something ---Tom From pinard at iro.umontreal.ca Mon Feb 7 17:03:14 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 07 Feb 2000 17:03:14 -0500 Subject: [Doc-SIG] Monty: A structured text syntax idea In-Reply-To: sharris@nospam.primus.com's message of "Mon, 07 Feb 2000 21:14:51 GMT" References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> <20000203160900.A1029@stopcontact.palga.uucp> <87le41$fms$1@nntp5.atl.mindspring.net> Message-ID: sharris at nospam.primus.com (Steven E. Harris) writes: > I have a similar translator (Emacs Outline to and XML vocabulary) > written in Perl. I can share it if you're interested. Strange coincidence... I did a small overhaul in `recode' internals, yesterday, to make room for "structural surfaces", besides "data surfaces". Here is a related fragment from the documentation. ----------------------------------------------------------------------> @cindex structural surfaces @cindex surfaces, structural @cindex surfaces, trees The @code{recode} library distinguishes between mere data surfaces, and structural surfaces, also called tree surfaces for short. Structural surfaces might allow, in the long run, transformations between a few specialised representations of structural information like MIME parts, Perl or Python initialisers, LISP S-expressions, XML, Emacs outlines, etc. We are still experimenting with surfaces in @code{recode}. The concept opens the doors to many avenues; it is not clear yet which ones are worth pursuing, and which should be abandoned. In particular, implementation of structural surfaces is barely starting, there is not even a commitment that tree surfaces will stay in @code{recode}, if they do prove to be more cumbersome than useful. This chapter presents all surfaces currently available. ----------------------------------------------------------------------< So, yes. I'm interested! Not necessarily in the code, but at least in the ideas conveyed in that code. If easy for you, please send me directly at `pinard at iro.umontreal.ca'. I quite like `allout' mode in Emacs (which gives cleaner outlines), and once wrote `allout' to Texinfo converters, and vice-versa. I also have written converters for SGML to Scheme internal, SGML to Perl internal, as well as SGML to Python internal, and vice-versa for specialised cases. The idea behind structural surfaces is to use a common holder (`recode') in which I could pour and mold such tools. One might consider it adds too much of magic to `recode' as a text recoder, but why not! I much like the magic which sometimes pops out of ImageMagick, when I handle images :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From paul at prescod.net Wed Feb 9 15:56:15 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 12:56:15 -0800 Subject: Optimizing C module Message-ID: <38A1D46F.86322DF1@prescod.net> The slowest thing in both PyExpat and Perl's equivalent is the "cross over" between C and Python. I can think of a couple of ways to speed that up but I want to know if they are feasible. The basic pattern of the code I need to speed up is: sometype Foo( somearg1, somearg2, ... ){ sometype real_rc; pyargs = Py_BuildVale( someformat, somearg1, somearg2, ... ); rc = PyEval_CallObject( callback, pyargs ); Py_XDECREF( pyargs ); real_rc = SomeConversion( rc ); Py_XDECREF( rc ); return real_rc; } The Py_BuildValue can't be so fast because it is parsing strings and creating new heap objects. I'm wondering if I could keep a fixed-length args tuple in my back pocket and just fill in the details for each callback. I would really love to hang on to the string and int objects in the array too. How about I could check the refcount after the function call and only generate a "new one" if the refcount is >1. If the refcount is 1, I would mutate the string and int objects under the covers. The next question is whether I can go even farther. Is there something I can safely cache that is created in PyEval_CallObject and/or eval_code2() (e.g. frame objects) so that the whole thing is just a matter of setting a couple of values and jumping? I'm sure stackless Python has something to do with all of this but I missed the talk at IPC8. It looks to me like eval_code2 would need to be broken up to allow me to set up and reuse my own frame object. That's probably part of what stackless does (the part I want!). -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From guido at python.org Mon Feb 28 10:41:02 2000 From: guido at python.org (Guido van Rossum) Date: Mon, 28 Feb 2000 10:41:02 -0500 Subject: Multi-argument append() is illegal Message-ID: <200002281541.KAA23255@eric.cnri.reston.va.us> I've noticed that there is some code out there that creates a list of tuples and uses code like list.append(a,b,c) to add the tuple (a,b,c) to the list. According to the documentation, this is illegal: append() only takes a single argument, and one should write list.append((a,b,c)). However, the actual append() implementation didn't mind, and implemented list.append(a,b,c) as list.append((a,b,c)). Many people are using this even though it's never been documented. I am going to rectify this in Python 1.6 -- people coming from other languages might well expect list.append(a, b, c) to mean the same as list.append(a); list.append(b); list.append(c), and it's always been my philosophy to make ambiguous syntax illegal rather than to pick one interpretation randomly. This message is simply a heads-up that you should be aware of this change (when 1.6 comes out, which should be before the summer). You can test your programs using the current CVS version (see www.python.org/download/cvs.html). You can also grep through your sources for a pattern like "\. *append *\(.*," -- which doesn't find every occurrence, but is a good starting point. If you have a smarter grep-like tool you may be able to write a tighter matching expression. Watch out for false hits though: some classes define their own multi-argument append()... --Guido van Rossum (home page: http://www.python.org/~guido/) From Alessandro.Bottoni at think3.com Mon Feb 21 04:05:42 2000 From: Alessandro.Bottoni at think3.com (Alessandro Bottoni) Date: Mon, 21 Feb 2000 10:05:42 +0100 Subject: Review of the new TK book from Manning? Message-ID: <6D8A17398E28D3119F860090274DD7DB4984DA@pces.cadlab.it> I received "Python and TKinter programming", by John Grayson, from Manning publisher a few days ago and I was surprised by the very high quality level of this book. It is an exhaustive, well designed and clearly written book. It contains a lot of well written code (also available in digital format from www.manning.com. 14Mb of code in zipped format!) and a lot of real world examples. You can read it sequentially, to make your own idea of TKinter, or use it as a reference book to keep on your desk. In both cases, you cannot be disappointed by this book. The author devotes just the first few pages to Python and starts immediately to write about TKinter. (Should you need a more exhaustive book on Python, buy "Learning Python" by Lutz and Ascher, published by O'Reilly.). The first two or three chapters describe Tkinter and its widget in detail (and pmw Megawidgets, too). Most likely, you can start coding just after having read these initial chapters. The following chapters shows you a lot of examples of real world applications. Grayson starts with quite simple applications, that just demonstrate the use of specific widgets, and go on with more and more sophisticated examples that show you how to build up sophisticated, well-designed, commercial-level applications. Grayson describes in detail all the required programming techniques: screen layouts, events, binding, callbacks, composite widgets, canvas, debugging, optimization...everything (see the ToC at Manning's). From this book you get a real, well-organised understanding of TKinter and the related programming techniques, not only a lot of information. It is clear that the author has a deep knowledge of the matter and a real-world, vast experience of Tkinter programming. Despite this bent for technique, Grayson has an extremely clear and well-organised prose. Reading this book is very easy and it is also a gratifing experience in itself. The book is well organised and lend itself to many different reading habits. It does not impose you a specific way to read it. Have a look at these URLs for other reviews and a description of the book: http://www.amazon.com/exec/obidos/ASIN/1884777813/qid%3D951121390/102-767201 7-9413662 http://www.manning.com/Grayson/index.html The Table of Contents of the book is here: http://www.manning.com/Grayson/Contents.html You can download a pair of sample chapters from this URL: http://www.manning.com/Grayson/Chapters.html Bye -------------------------------- Alessandro Bottoni (Alessandro.Bottoni at Think3.com) (alessandro.bottoni at libero.it) Web Programmer Think3 inc. (www.think3.com) > -----Original Message----- > From: Timothy Grant [SMTP:tjg at avalongroup.net] > Sent: Friday, February 18, 2000 7:54 PM > To: Python People > Subject: Review of the new TK book from Manning? > > Is there anyone out there who can provide a review of the new Tkinter > book that was just published by--I believe Manning? > > Thanks. > -- > Stand Fast, > tjg. > > Chief Technology Officer tjg at exceptionalminds.com > Red Hat Certified Engineer www.exceptionalminds.com > Avalon Technology Group, Inc. (503) 246-3630 > >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< > > -- > http://www.python.org/mailman/listinfo/python-list From pinard at iro.umontreal.ca Tue Feb 15 15:00:33 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 15 Feb 2000 15:00:33 -0500 Subject: Real Problems with Python In-Reply-To: Justus Pendleton's message of "Tue, 15 Feb 2000 18:27:40 GMT" References: <000e01bf7605$02aefe00$962d153f@tim> <889lhn$bn$1@nnrp1.deja.com> <88c5qn$ot4$1@nnrp1.deja.com> Message-ID: Justus Pendleton writes: > I guess I don't see how MI is a different issue [...] Neither do I. But for a different reason. What means MI? :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From Gaetan_Corneau at baan.com Fri Feb 18 11:58:58 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Fri, 18 Feb 2000 11:58:58 -0500 Subject: Python misconceptions in IBM Ruby article... Message-ID: <816010E2456BD111A48700805FBBE2EE01C6052F@ex-quebec-u1.baan.com> > class Spam: > > def eggs(self): > self.x = 1 > class C { > int i; > void foo(int i) {this->i = i} > } The point is that you have to declare "self" as the first member argument in Python, but not in C++. It may be a good or a bad thing for language purists, but one thing is shure, it's a very common "gotcha" for newbies. Another thing I don't like, exactly for the same reason, is the "class variable" vs "instance variable" declarations. Solving these two "problems" would contribute to help Python adoption, IMHO. Last, I really miss the C/C++ "?" operator, but please, don't start that thread again ;) ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From thamelry at vub.ac.be Tue Feb 8 04:19:50 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 8 Feb 2000 09:19:50 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <87on3m$p2i$1@mach.vub.ac.be> Roy Smith wrote: : I'm a hard-core python addict, and I agree 100% with fcahoon. This : sillyness with indenting for statement grouping is without a doubt the : most serious blemish on the language. I am in exactly the same position. It was a serious design error. I wonder how the CP4A people are going to explain to complete computer illiterates that a python program can contain errors that are _not even visible_ when you look at the code. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From eschen42 at my-deja.com Fri Feb 4 15:46:24 2000 From: eschen42 at my-deja.com (eschen42 at my-deja.com) Date: Fri, 04 Feb 2000 20:46:24 GMT Subject: Q: How to Lock Zope-shared file with DAV Explorer Message-ID: <87fdqv$ofq$1@nnrp1.deja.com> I just downloaded Zope 2.1.3 and DAV Explorer 0.59 (both for x86 NT4). I can connect to the Zope server (the "zopebox") with both my browser and DAV Explorer. I can get files just fine. However, when I try to lock files (e.g., index_html at the root), I get the message "This resource does not support locking". Does the file need to be in a database in order to support locking? Or is there some administrative thing that I'm supposed to do first? Thank you. Sent via Deja.com http://www.deja.com/ Before you buy. From dgrisby at uk.research.att.com Wed Feb 16 06:10:23 2000 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 16 Feb 2000 11:10:23 -0000 Subject: [CORBA] omniNames feature request References: <4200573822B7D496.C1F8C19BCF648E3E.28F066B210DA0684@lp.airnews.net> Message-ID: <88e0iv$q55$1@pineapple.uk.research.att.com> In article , Samuel A. Falvo II wrote: >>Well, the INS does not, strictly, permit you to synthesize your own IOR; it >>does provide for means to pass the appropriate parameters (host, port) to your >>ORB and let *it* do the synthesizing (there may be negotiations involved with >>the ORB of the NS). You then get access to it through the ORB: >> >> ns = orb.resolve_initial_references( "NamingService" ) > >UUGH! That's anything but well factored. Once again, CORBA screws up. :( I'm glad to say that the above is not true. orb.string_to_object() will now be able to accept URLs: orb = CORBA.ORB_init() obj = orb.string_to_object("corbaloc::foo.example.com:1234/MyTestObj") test = obj._narrow(Example.Test) if test is not None: # Use the test object The OMG isn't quite so hopeless after all. Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From anders.eriksson at morateknikutveckling.se Wed Feb 16 10:05:03 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Wed, 16 Feb 2000 16:05:03 +0100 Subject: Where is the Python Journal? References: Message-ID: On Wed, 16 Feb 2000 08:58:17 +0100 (MET), Mikael Olofsson wrote: >Hi! > >Not long ago there was a Python journal at > > www.pythonjournal.org > FOund it at http://www.pythonjournal.com/ // Anders From paul at prescod.net Wed Feb 9 22:34:59 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 19:34:59 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> Message-ID: <38A231E3.587D4928@prescod.net> This conversation strikes me as a little odd. The original poster hypothesized that languages become popular due, basically, to luck. I responded that no, languages are popular for reasons. Now if we presume that people WANTED these languages to be popular and that they do not, then my position has the logical corollary that someone (or some group of people) are at fault for the fact that they never became popular. This last little bit makes me a bad guy because it means I'm saying someone screwed up. But what I'm not clear on is where exactly you and the other participants start disagreeing with me. Is or isn't there a real reason that Lisp is almost 50 years old, still widely praised by those "in the know" and is still not popular yet? --------------------------------------------- Neel Krishnaswami wrote: > > ... You are right that Lisp-ers (and Smalltalkers) have gone to great lengths to promote their languages. My hypothesis is that they have not gone to great lengths to *adapt* their languages for popularity. This leaves the vast majority of programmers in C++ hell -- sometimes by choice and sometimes through environment. > > If this is "suppressing widespread knowledge of a programming > language," I think Java is the only case of a language that wasn't > suppressed. :) Actually, Java has the same adaptability problem but Sun got around it by tricking thousands of people into rebuilding everything in 100% Java. I would never have guessed that that strategy would work but I guess if you have enough money and press you can pull off almost anything. > Nowadays when people are giving away 500 MHz P3's in cereal boxes, > this may be hard to believe, but remember that until around 1992 or > 93, personal computers simply weren't powerful enough to run a full > Common Lisp or Smalltalk. #1. Who said anything about a "full" common lisp or a "full" smalltalk. It goes back to adaptability. #2. Lisp and smalltalk-like languages have been available on PCs for a very long time. > People in the PC world were writing > spreadsheets in assembly language, for heaven's sake! Well I still wouldn't write a spreadsheet in any of these languages. The more interesting question is about high level apps. Why Visual Basic and DBase rather than Smalltalk and Lisp? > Er, it's not obvious to me where 'programming language' ends and > 'development environment' begins. A programming language is an > interface between the programmer and the computer, and so is the > IDE. The line between the two is necessarily somewhat artificial. No, there is a very clear line. A language is a set (usually infinite) of strings. A programming language is a mapping from each of the strings to a program (let's say a Turing machine). I'm sure that if we took the Smalltalk 80 book we could find the line pretty clearly. Unfortunately I don't have the book. > If we haven't invented the one true language yet, why do you think > that we have already found the one true way of interacting with > languages? Experimentation is a good thing, IMO. Fine. But do you agree that languages that are tightly bound to environments (or syntaxes!) that are not independently popular tend to fail. It actually does not help for there to be alternate versions that have different syntaxes or that are more friendly to the outside world because they remain on the fringes of development *within* the community. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From aahz at netcom.com Thu Feb 24 07:56:13 2000 From: aahz at netcom.com (Aahz Maruch) Date: 24 Feb 2000 12:56:13 GMT Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> <89382q$djb$1@nntp6.atl.mindspring.net> <38B527E3.DF8C61AD@inka.de> Message-ID: <8939pd$dj7$1@nntp6.atl.mindspring.net> In article <38B527E3.DF8C61AD at inka.de>, Michael Str?der wrote: >Aahz Maruch wrote: >> In article <38B51486.F0774310 at bibsyst.no>, >> Thomas Weholt wrote: >>> >>>I want to use threading in a server-based search/index application. Any >>>hints? >> >> Unfortunately, using threading in a server gets a bit more complex and >> may not buy you very much. > >Hmm, about doing it like BoboHTTPServer.py found >http://www.digicool.com/releases/bobo/ ? If you want to do it "like" Zope, why not just use Zope? (Bobo, Zope, same difference.) One of the Python mantras: "Never reinvent the wheel." -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From fdrake at acm.org Tue Feb 1 13:38:17 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue, 1 Feb 2000 13:38:17 -0500 (EST) Subject: Dynamic class construction? In-Reply-To: <38970CA2.5CC3149B@math.okstate.edu> References: <000601bf6c54$c6418aa0$d709143f@tim> <38970CA2.5CC3149B@math.okstate.edu> Message-ID: <14487.10265.171748.312036@weyr.cnri.reston.va.us> David C. Ullrich writes: > If the docs are going to change more often than the program > (which is a good thing) the docs should have separate version > numbers. I could download the revised docs, but I don't see the > point, since I have no way of knowing tommorow whether > they're still current. The "revised" version you speak of does have a version number, but it is bound to the Python version as well: 1.5.2p1. I'll be releasing 1.5.2p2 in late February. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:54:40 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:54:40 -0500 Subject: so how do I run this thing?!!!! References: Message-ID: In an article posted Sat, 26 Feb 2000 11:31:29 -0700, Collin Greene (greene at hctc.com) said: > I have tried the run command but it just showns me what i just wrote. > Is there a place to actuially see waht you have witten? If you're running under Win32, you could download and install the Win32 Extensions (http://www.python.org/download/download_windows.html). The installer will add the necessary registry entries to allow you to run a .py or .pyw file from a command line or from within Windows Explorer. -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From moshez at math.huji.ac.il Fri Feb 25 06:49:29 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 13:49:29 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On 25 Feb 2000, Denys Duchier wrote: > I cannot help but add that the derogatory comment concerning tail call > optimization is not only shortsighted, but also fallacious as it rests > entirely on proof by popularity according to which we should all eat > shit, since 50 trillion flies can't all be wrong. I cannot help but add that this comment seems to completely misunderstand Tim's original comment. Tim's comment would be more akin to saying that since so few people enjoy shit-eating, we shouldn't waste too much time trying to cook it up. the-destructor-argument-is-fallacious-to-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From boyle5 at llnl.gov Wed Feb 23 11:25:43 2000 From: boyle5 at llnl.gov (boyle5 at llnl.gov) Date: Wed, 23 Feb 2000 16:25:43 GMT Subject: ftpmirror -local to remote? Message-ID: <8911m2$14b$1@nnrp1.deja.com> In the Tools/scripts subdirectory there is a program 'ftpmirror.py', which can mirror a directory from a remote host to the local machine. I am in need of its conjugate, a code to mirror a local directory onto a remote host. The only pipe I have to the remote machine is ftp. I'm going to try and reverse engineer the current ftpmirror.py, but before I did I thought I'd ask if it has been done before and save me the trouble. There is a Perl code available to do the job, but I would prefer a Python solution. I've hunted around in the usual places, Parnassus, Starship, usw but no joy. Thanks for any help. Jim Sent via Deja.com http://www.deja.com/ Before you buy. From rjroy at takingcontrol.com Mon Feb 21 18:28:21 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Mon, 21 Feb 2000 23:28:21 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> Message-ID: <38b1c147.74099484@news1.on.sympatico.ca> On Mon, 21 Feb 2000 16:30:16 +0100, Gerrit Holl wrote: > >> > > - Clean design, if possible OO. >> > >> > All GUI's have this feature, As Far As I Saw So Far. >> >> Tcl/Tk is not OO (at least not in its base version). > >Tkinter *is* OO, and the fact the underlying Tcl/Tk isn't bothers >me a lot. I think you are wasting your worries on something that is really not all that important. The fact is that we use Tkinter when we program. Tkinter adds an OO layer on top of some procedural code. Is this evil?. No. Is is unprecedented? No. Abstract it far enough and all languages do it. I mean should it bother you a lot that the first C++ compilers (more accurately pre-compilers) actually wrote a pile of C code then compiled it? No because that is an implementation detail. Much like the link from Tkinter to the underlying libraries is. It may not be a perfect model but it works. I mean if you have a high enough pain threshold, I imagine you could bind the Tkinter interface to wxWindows or GTK or... Of course you would lose operability on a number of platforms but hey the world ain't perfect! Remember OO is a philosopy not a language. Certain programming languages happen to make writing in an OO manner easier than others. :-) Bob From stevie_deja at my-deja.com Tue Feb 1 13:50:08 2000 From: stevie_deja at my-deja.com (stevie_deja at my-deja.com) Date: Tue, 01 Feb 2000 18:50:08 GMT Subject: When to use None Message-ID: <8779su$sak$1@nnrp1.deja.com> Would anyone explain to me where there is a difference between the following two calls: if some_var == None : print 'var is none' if some_var is None : print 'var is none' Can '== None' only be used in certain circumstances? Thanks, Steve Sent via Deja.com http://www.deja.com/ Before you buy. From gerrit.holl at pobox.com Fri Feb 18 12:02:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 18:02:39 +0100 Subject: Help needed writing GUI comparison In-Reply-To: <20000217221452.A2943@stopcontact.palga.uucp>; from gerrit.holl@pobox.com on Thu, Feb 17, 2000 at 10:14:52PM +0100 References: <20000217221452.A2943@stopcontact.palga.uucp> Message-ID: <20000218180239.A5551@stopcontact.palga.uucp> Gerrit Holl wrote on 950822092: > Hallo, > > I'm writing a GUI comparison, and I really need help. I don't > want to take the time to learn all GUI's. What I have so far > is attached (HTML), and also available at the following URL: > > http://www.nl.linux.org/~gerrit/gui.html > > Please help and contribute! Second version: * less biased/more general * added benchmarks * added PyQT and PyKDE * reformulated intro * reformulated other things *really* attached this time, for those who are too far away from a browser or too lazy to start one :) regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke -------------- next part -------------- An HTML attachment was scrubbed... URL: From sabren at manifestation.com Thu Feb 24 15:43:49 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 24 Feb 2000 15:43:49 -0500 (EST) Subject: diff? Message-ID: Hey all, I'd like to be able to run something like "diff" as a function in python, but that would be able to compare arbitrary strings/sequences instead of just files... I looked on parnassus, python.org, but didn't see anything.. There's a perl version, which is short enough, and I'll probably just port that unless someone has a better idea: http://www.plover.com/~mjd/perl/diff/Diff.pm trying not to reinvent the wheel here.. :) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From thomas at bibsyst.no Mon Feb 14 02:23:22 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Mon, 14 Feb 2000 08:23:22 +0100 Subject: Error in shelve, keys() returns invalid argument...bug? References: <3ghbas025vshdkbp5o54bjum22ftns5fkg@4ax.com> Message-ID: <38A7AD6A.FA864682@bibsyst.no> wolf at one.net wrote: > > I'm trying to use the shelve module in Win98SE in Python 1.52, and I > can create the shelf just fine, but when I try to get the keys for the > shelf it gives me an error. Here's a screen dump: > > C:\APPS\Thief's Quest>"C:\Program Files\Python\PYTHON.EXE" > 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 shelve > >>> SavedGame = shelve.open("Test.psg") > >>> SavedGame > > >>> SavedGame.keys > > >>> SavedGame.keys() > Traceback (innermost last): > File "", line 1, in ? > File "C:\Program Files\Python\Lib\shelve.py", line 55, in keys > return self.dict.keys() > bsddb.error: (22, 'Invalid argument') > >>> > > Am I doing something wrong? Or does the shelve module need an > additional module in Win98 that doesn't come with the base install? > > Any help would be appreciated! > Respectfully, > > Wolf > > "The world is my home, it's just that some rooms are draftier than > others". -- Wolf I`ve experienced this too. Code that worked fine on Linux failed just like this on Windows. Is the bsddb-module implementation the problem?? Thomas From dworkin at ccs.neu.edu Tue Feb 15 15:13:35 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 15 Feb 2000 15:13:35 -0500 Subject: Time Check In-Reply-To: "Chris Coulson"'s message of "Tue, 15 Feb 2000 19:55:26 -0000" References: <88cb0n$8du$1@nclient11-gui.server.virgin.net> Message-ID: "Chris Coulson" writes: > Is there a command so that you can check a time. I need to create a program > to work on a RISC platform that is triggered after a certain date. See the 'time' module in the standard library. -Justin From c_cazabon at hotmail.com Thu Feb 17 18:57:04 2000 From: c_cazabon at hotmail.com (Charles Cazabon) Date: Thu, 17 Feb 2000 23:57:04 GMT Subject: mxDateTime and MySQLdb on RedHat 6.1 References: <38AC7637.9AFEF477@razorfish.com> Message-ID: <8EDDB69C1hdjsdhdfh75738@news.sshe1.sk.wave.home.com> Thomas Leen claimed in <38AC7637.9AFEF477 at razorfish.com>: >Lenny Self wrote: >> >> Hello. I am having trouble compiling these to new modules on my >> RedHat 6.1 Linux box. Below are the errors I am getting on each >> installation. >> >> *** MySQLdb *** >I as well, and from the looks of it this type of problem has gone >unanswered since late '99. Anybody been able to use mysql/python on >redhat 6.1? Trying to do some cgi stuff myself and while Perl calls to >me, I resist, but cant hold on forever. I'm using Python & MySQL via MySQLdb on RedHat 6.1 without problems -- however, I didn't compile Python, I just used the RedHat binary RPMs to install it. Charles From yueqiang at terra.usc.edu Fri Feb 4 14:38:25 2000 From: yueqiang at terra.usc.edu (Yueqiang Huang) Date: Fri, 4 Feb 2000 11:38:25 -0800 Subject: installation error: version 1.5.2 on Unix In-Reply-To: <389A3ABB.8EA2C83B@python.net> References: <3898FE1B.16E6753E@python.net> <389A3ABB.8EA2C83B@python.net> Message-ID: Tom, I decided to give up yesterday and removed readline from my system, but I changed my mind when I saw your post today. I downloaded readline-4.0 from ftp prep.ai.mit.edu:/pub/gnu and py152.tar from python.org and did the following things: 1./auto/terra-06/wrk6/yueqiang(3): mkdir readline4.0 2./auto/terra-06/wrk6/yueqiang/Python/readline-4.0(24): ./configure --prefix=/auto/terra-06/wrk6/yueqiang/readline4.0 No error message. 3./auto/terra-06/wrk6/yueqiang/Python/readline-4.0(25): make No error message. 4./auto/terra-06/wrk6/yueqiang/Python/readline-4.0(26): make install Now I begin to have error messages. The output of 4: /bin/sh ./support/mkdirs /auto/terra-06/wrk6/yueqiang/readline4.0/include \ /auto/terra-06/wrk6/yueqiang/readline4.0/include/readline /auto/terra-06/wrk6/yueqiang/readline4.0/lib /auto/terra-06/wrk6/yueqiang/readline4.0/info /auto/terra-06/wrk6/yueqiang/readline4.0/man/man3 mkdir /auto/terra-06/wrk6/yueqiang/readline4.0/include mkdir /auto/terra-06/wrk6/yueqiang/readline4.0/include/readline mkdir /auto/terra-06/wrk6/yueqiang/readline4.0/lib mkdir /auto/terra-06/wrk6/yueqiang/readline4.0/info mkdir /auto/terra-06/wrk6/yueqiang/readline4.0/man mkdir /auto/terra-06/wrk6/yueqiang/readline4.0/man/man3 for f in readline.h chardefs.h keymaps.h history.h tilde.h rlstdc.h rlconf.h; do \ ./support/install.sh -c -m 644 ./$f /auto/terra-06/wrk6/yueqiang/readline4.0/include/readline ; \ done mv /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.old mv: cannot access /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a *** Error code 2 (ignored) ./support/install.sh -c -m 644 libreadline.a /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a test -n "ranlib" && ranlib -t /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a fake ranlib -t /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a mv /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libhistory.a /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libhistory.old mv: cannot access /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libhistory.a *** Error code 2 (ignored) ./support/install.sh -c -m 644 libhistory.a /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libhistory.a test -n "ranlib" && ranlib -t /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libhistory.a fake ranlib -t /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libhistory.a ( if test -d doc ; then \ cd doc && \ make infodir=/auto/terra-06/wrk6/yueqiang/readline4.0/info install; \ fi ) /bin/sh ../support/mkdirs /auto/terra-06/wrk6/yueqiang/readline4.0/info /auto/terra-06/wrk6/yueqiang/readline4.0/man/man3 if test -f readline.info; then \ .././support/install.sh -c -m 644 readline.info /auto/terra-06/wrk6/yueqiang/readline4.0/info/readline.info; \ else \ .././support/install.sh -c -m 644 ./readline.info /auto/terra-06/wrk6/yueqiang/readline4.0/info/readline.info; \ fi if test -f history.info; then \ .././support/install.sh -c -m 644 history.info /auto/terra-06/wrk6/yueqiang/readline4.0/info/history.info; \ else \ .././support/install.sh -c -m 644 ./history.info /auto/terra-06/wrk6/yueqiang/readline4.0/info/history.info; \ fi if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \ install-info --dir-file=/auto/terra-06/wrk6/yueqiang/readline4.0/info/dir /auto/terra-06/wrk6/yueqiang/readline4.0/info/readline.info ; \ install-info --dir-file=/auto/terra-06/wrk6/yueqiang/readline4.0/info/dir /auto/terra-06/wrk6/yueqiang/readline4.0/info/history.info ; \ else true; fi .././support/install.sh -c -m 644 ./readline.3 /auto/terra-06/wrk6/yueqiang/readline4.0/man/man3/readline.3 However, after step 4, I have the following things under the target directory of my installation: talc:/auto/terra-06/wrk6/yueqiang/readline4.0(14): ls -lR total 4 drwxr-xr-x 3 yueqiang 512 Feb 4 11:04 include drwxr-xr-x 2 yueqiang 512 Feb 4 11:04 info drwxr-xr-x 2 yueqiang 512 Feb 4 11:04 lib drwxr-xr-x 3 yueqiang 512 Feb 4 11:04 man include: total 1 drwxr-xr-x 2 yueqiang 512 Feb 4 11:04 readline include/readline: total 50 -rw-r--r-- 1 yueqiang 3838 Feb 4 11:04 chardefs.h -rw-r--r-- 1 yueqiang 9263 Feb 4 11:04 history.h -rw-r--r-- 1 yueqiang 3449 Feb 4 11:04 keymaps.h -rw-r--r-- 1 yueqiang 24120 Feb 4 11:04 readline.h -rw-r--r-- 1 yueqiang 2195 Feb 4 11:04 rlconf.h -rw-r--r-- 1 yueqiang 2032 Feb 4 11:04 rlstdc.h -rw-r--r-- 1 yueqiang 2724 Feb 4 11:04 tilde.h info: total 158 -rw-r--r-- 1 yueqiang 29798 Feb 4 11:04 history.info -rw-r--r-- 1 yueqiang 119904 Feb 4 11:04 readline.info lib: total 856 -rw-r--r-- 1 yueqiang 113836 Feb 4 11:04 libhistory.a -rw-r--r-- 1 yueqiang 742672 Feb 4 11:04 libreadline.a man: total 1 drwxr-xr-x 2 yueqiang 512 Feb 4 11:04 man3 man/man3: total 34 -rw-r--r-- 1 yueqiang 34168 Feb 4 11:04 readline.3 Now I assume the installation of readline-4.0 is OK. Then I go on to install python-1.5.2 5./auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2/Modules(33): emacs Setup.in I added the following lines after "#readline readline.c -lreadline -ltermcap" in Setup.in: readline -I/auto/terra-06/wrk6/yueqiang/readline4.0/include -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib -ltermcap 6./auto/terra-06/wrk6/yueqiang(23): mkdir py152 7./auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2(36): ./configure --prefix=/auto/terra-06/wrk6/yueqiang/py152 8./auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2(37): make All ouput of step 8: (cd Modules; make -f Makefile.pre Makefile) cp ./Setup.in Setup echo "# Edit this file for local setup changes" >Setup.local rm -f ../libpython1.5.a /bin/sh ./makesetup Setup.thread Setup.local Setup making Makefile in subdirectory . `Makefile' is up to date. making Makefile in subdirectory Parser `Makefile' is up to date. making Makefile in subdirectory Objects `Makefile' is up to date. making Makefile in subdirectory Python `Makefile' is up to date. making Makefile in subdirectory Modules `Makefile' is up to date. (rm -f Modules/hassignal; cd Modules; make hassignal) rm -f hassignal for i in regexmodule.o regexpr.o pcremodule.o pypcre.o posixmodule.o signalmodule.o arraymodule.o cmathmodule.o mathmodule.o stropmodule.o structmodule.o timemodule.o operator.o fcntlmodule.o pwdmodule.o grpmodule.o selectmodule.o socketmodule.o errnomodule.o md5module.o md5c.o shamodule.o rotormodule.o newmodule.o binascii.o parsermodule.o cStringIO.o cPickle.o config.o getpath.o main.o getbuildinfo.o; do \ if test "$i" = "signalmodule.o"; then \ echo yes >hassignal; break; \ fi; \ done cd Parser ; make OPT="-g -O2" VERSION="1.5" \ prefix="/auto/terra-06/wrk6/yueqiang/py152" exec_prefix="/auto/terra-06/wrk6/yueqiang/py152" all gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c pgenmain.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c acceler.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c grammar1.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c listnode.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c node.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c parser.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c parsetok.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c tokenizer.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c bitset.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c metagrammar.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c firstsets.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c grammar.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c pgen.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c printgrammar.c gcc -g -O2 pgenmain.o acceler.o grammar1.o listnode.o node.o parser.o parsetok.o tokenizer.o bitset.o metagrammar.o firstsets.o grammar.o pgen.o printgrammar.o -lsocket -lnsl -ldl -o pgen gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c myreadline.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c intrcheck.c cd Objects ; make OPT="-g -O2" VERSION="1.5" \ prefix="/auto/terra-06/wrk6/yueqiang/py152" exec_prefix="/auto/terra-06/wrk6/yueqiang/py152" all gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c abstract.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c bufferobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c classobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c cobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c complexobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c fileobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c floatobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c frameobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c funcobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c intobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c listobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c longobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c dictobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c methodobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c moduleobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c object.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c rangeobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c sliceobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c stringobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c tupleobject.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c typeobject.c cd Python ; make OPT="-g -O2" VERSION="1.5" \ prefix="/auto/terra-06/wrk6/yueqiang/py152" exec_prefix="/auto/terra-06/wrk6/yueqiang/py152" all gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c bltinmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ceval.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c compile.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c errors.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c frozen.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c frozenmain.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getargs.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getcompiler.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getcopyright.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getmtime.c gcc -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -DPLATFORM='"sunos5"' \ ./getplatform.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getversion.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c graminit.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c import.c gcc -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ ./importdl.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c marshal.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c modsupport.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c mystrtoul.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c pyfpe.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c pystate.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c pythonrun.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c structmember.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c sysmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c traceback.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c sigcheck.c cd Modules ; make OPT="-g -O2" VERSION="1.5" \ prefix="/auto/terra-06/wrk6/yueqiang/py152" exec_prefix="/auto/terra-06/wrk6/yueqiang/py152" all gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./regexmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./regexpr.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./pcremodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./pypcre.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./posixmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./signalmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./arraymodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./cmathmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./mathmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./stropmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./structmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./timemodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./operator.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./fcntlmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./pwdmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./grpmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./selectmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./socketmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./errnomodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./md5module.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./md5c.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./shamodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./rotormodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./newmodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./binascii.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./parsermodule.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./cStringIO.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./cPickle.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c config.c gcc -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -DPYTHONPATH='":plat-sunos5:lib-tk"' \ -DPREFIX='"/auto/terra-06/wrk6/yueqiang/py152"' \ -DEXEC_PREFIX='"/auto/terra-06/wrk6/yueqiang/py152"' \ -DVERSION='"1.5"' \ -DVPATH='""' \ ./getpath.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c main.c gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getbuildinfo.c if test ! -f libpython1.5.a; \ then for i in Parser Objects Python Modules; do rm -f $i/add2lib; done; true; \ else true; fi for i in Parser Objects Python Modules; do \ (cd $i; make VERSION="1.5" add2lib); done ar cr ../libpython1.5.a acceler.o grammar1.o listnode.o node.o parser.o parsetok.o tokenizer.o bitset.o metagrammar.o myreadline.o if test ! -f ../Modules/hassignal; \ then echo adding intrcheck.o; ar r ../libpython1.5.a intrcheck.o; \ else echo leaving intrcheck.o out; fi leaving intrcheck.o out touch add2lib ar cr ../libpython1.5.a abstract.o bufferobject.o classobject.o cobject.o complexobject.o fileobject.o floatobject.o frameobject.o funcobject.o intobject.o listobject.o longobject.o dictobject.o methodobject.o moduleobject.o object.o rangeobject.o sliceobject.o stringobject.o tupleobject.o typeobject.o touch add2lib ar cr ../libpython1.5.a bltinmodule.o ceval.o compile.o errors.o frozen.o frozenmain.o getargs.o getcompiler.o getcopyright.o getmtime.o getplatform.o getversion.o graminit.o import.o importdl.o marshal.o modsupport.o mystrtoul.o pyfpe.o pystate.o pythonrun.o structmember.o sysmodule.o traceback.o if test ! -f ../Modules/hassignal; \ then echo adding sigcheck.o; ar r ../libpython1.5.a sigcheck.o; \ else echo leaving sigcheck.o out; fi leaving sigcheck.o out touch add2lib if test -f hassignal; \ then echo removing sigcheck.o intrcheck.o; \ ar d ../libpython1.5.a sigcheck.o intrcheck.o 2>/dev/null; \ else echo leaving sigcheck.o intrcheck.o in; fi removing sigcheck.o intrcheck.o *** Error code 2 (ignored) ar cr ../libpython1.5.a regexmodule.o regexpr.o pcremodule.o pypcre.o posixmodule.o signalmodule.o arraymodule.o cmathmodule.o mathmodule.o stropmodule.o structmodule.o timemodule.o operator.o fcntlmodule.o pwdmodule.o grpmodule.o selectmodule.o socketmodule.o errnomodule.o md5module.o md5c.o shamodule.o rotormodule.o newmodule.o binascii.o parsermodule.o cStringIO.o cPickle.o config.o getpath.o main.o getbuildinfo.o touch add2lib echo 0 >buildno cd Modules; make OPT="-g -O2" python.o gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c python.c expr `cat buildno` + 1 >buildno1 mv -f buildno1 buildno gcc -c -g -O2 -I. -DHAVE_CONFIG_H -DBUILD=`cat buildno` \ ./Modules/getbuildinfo.c ar cr libpython1.5.a getbuildinfo.o ranlib libpython1.5.a fake ranlib libpython1.5.a true cd Modules; make OPT="-g -O2" VERSION="1.5" \ prefix="/auto/terra-06/wrk6/yueqiang/py152" exec_prefix="/auto/terra-06/wrk6/yueqiang/py152" \ LIBRARY=../libpython1.5.a link gcc python.o \ ../libpython1.5.a -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib -ltermcap -lsocket -lnsl -ldl -lm -o python Undefined first referenced symbol in file initreadline ../libpython1.5.a(config.o) ld: fatal: Symbol referencing errors. No output written to python *** Error code 1 make: Fatal error: Command failed for target `link' Current working directory /auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2/Modules *** Error code 1 make: Fatal error: Command failed for target `python' I tried the follwoing: 9./auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2/Modules(39): grep initreadline * Output of step 9: config.c:extern void initreadline(); config.c:{"readline", initreadline}, readline.c:initreadline() Note that this readline.c is the one with the python-1.5.2 distribution, not the one with the readline-4.0 distribution. 10./auto/terra-06/wrk6/yueqiang/Python/readline-4.0(34): grep initreadline * No output. Note that the dir in step 10 is the source of readline-4.0. So initreadline() is NOT defined in the readline-4.0 distribution. As you mentioned in your post, maybe the only way out is to hack up a version of readline.c for readline-4.0. I really appreciate your willingness to help. Thanks a lot! yueqiang _______________________________________________________________________ Yueqiang Huang, Department of Earth Sciences, University of Southern CA Los Angeles, CA 90089-0740 USA On Thu, 3 Feb 2000, Thomas A. Bryan wrote: > Yueqiang Huang wrote: > > > > > Yueqiang Huang wrote: > > > > > > > > The error message is > > > > > > > > gcc python.o \ > > > > ../libpython1.5.a -lsocket -lnsl -ldl -lm -o python > > > > Undefined first referenced > > > > symbol in file > > > > Py_Main python.o > > > > > > Was this your first try at running make, or had you already > > > run make once before? If the Python build proceeds far enough, > > > it will leave some garbage around that will cause subsequent makes > > > to fail. The solution in that case is to run 'make clobber' before > > > building. Note that 'make clean' won't solve the problem. If you > > > also want to reconfigure, you should use 'make distclean'. > > > > > At the first run without 'readline', everything was OK except for one > > error message: > > . > > . > > touch add2lib > > if test -f hassignal; \ > > then echo removing sigcheck.o intrcheck.o; \ > > ar d ../libpython1.5.a sigcheck.o intrcheck.o 2>/dev/null; \ > > else echo leaving sigcheck.o intrcheck.o in; fi > > removing sigcheck.o intrcheck.o > > *** Error code 2 (ignored) > > . > > . > > > > However python executable was built and working. > > Okay. > > > Then I wanted to install python-1.5.2 with readline 4.0. I first installed > > readline, then modified /Modules/Setup.in, using the *.h and libreadline.a > > from readline 4.0 (readline.c is the one with the python distribution). > > This process sounds spookily familiar. The time I wasted a half-day compiling > Python was on a Solaris box. I think that the first build was successful, but > I realized that I had forgotten to build it with readline support. > > > The compilation of readline.c was OK, but I got the message I mentioned > > in the previous post. 'make clobber' and 'make distclean; ./configure ...; > > make' will solve that problem, but introduce another problem associated > > with readline. > > Now that I think about it, I think that there was some strange problem with > typedefs or macros when I finally did the 'make distclean'. I'm no longer > at that job, but I'll e-mail my former co-workers and find out what we changed. > Could you post the error you get after doing the 'make distclean'... I > seem to remember that one of my co-workers simply modified a file (readline.c?) > in the Python distribution to get it to compile. > > > Have you installed readline with your python? It seems that a function > > 'initreadline' which is required by /Modules/config.c is not inside the > > readline package. > > Like I said, post the error. Perhaps it's the same problem I had. If so, > then I can probably get the hacked up version of readline.c or config.c for > you. > > helping-python-one-installation-at-a-time-ly yours > ---Tom > > From michael.stroeder at inka.de Sat Feb 19 15:13:24 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 19 Feb 2000 21:13:24 +0100 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') References: <38AC9E92.C1CEFEB7@inka.de> <38AD3C67.A08EFE2D@inka.de> <87u2j68n7j.fsf_-_@den.home.net> <38AD8B9C.F3F4DCF5@inka.de> <8766vlu3ag.fsf@den.home.net> Message-ID: <38AEF964.32B34214@inka.de> yFrank Sergeant wrote: > > Michael Str?der writes: > > > But there are open issues: > > > > SimpleHTTPServer is based on SocketServer and > > [python-doc]/lib/module-SocketServer.html says: > > > > "These four classes process requests synchronously; each request > > must be completed before the next request can be started." > > Sorry, no. I realize that my approach handles the requests > serially. I think this will be sufficient for my purposes, but > I am looking forward stress testing it at some point. I will try out using threads. If I'm successful the code will also appear on http://web2ldap.de/. Ciao, Michael. From gherron at aw.sgi.com Thu Feb 10 19:10:08 2000 From: gherron at aw.sgi.com (Gary Herron) Date: Thu, 10 Feb 2000 16:10:08 -0800 Subject: How to get rid of the space after 'print',? References: <38A34DFE.7B286DD@aston.ac.uk> Message-ID: <38A35360.FFD005BC@aw.sgi.com> Peter Bittner wrote: > > Hi there! > > I'm writing HTML-code with the print statement as follows: > > print '' > print '
Author:', # ,= no newline here > print '' # or put a function call here... > > Between and I want _no_ space, but Python automatically > inserts one. - How can I force Python not to do this?? > Easy, write to stdout directly: import sys sys.stdout.write(SomeString) This writes out the bytes of the string exactly, nothing more, nothing less. No following spaces, no line-ends, and no conversion from other types, just (binary) byte strings. Gary. -- Dr. Gary Herron 206-287-5616 Alias | Wavefront 1218 3rd Ave, Suite 800, Seattle WA 98101 From sabren at manifestation.com Sun Feb 6 21:02:46 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 6 Feb 2000 21:02:46 -0500 Subject: win32 / dynwin.py / callbacks for MIDI input Message-ID: <87l95f$f9g$1@nntp1.atl.mindspring.net> Hey all, This is my first post here... sorry if I'm wordy.. I'm just trying to give enough information to explain this little puzzle... :) I am trying to interface with a MIDI keyboard from windows 98. I've found calldll / dynwin and have successfully used these to send events TO my keyboard by wrapping some of the multimedia routines that live in winmm.dll ... After a few long hours of fumbling arond, I am able to run my program[1], and sound comes out of my keyboard. Now I'd like to go the other way, and get input FROM the keyboard. According to the Microsoft docs[2], I need to write a callback... I've looked at the dynwin examples that use gencb.py , but I'm having a really hard time getting it to work. Specifically, I keep getting an invalid page fault error and crashing python. (ouch!) I'm pretty much a novice when it comes to C/C++, callbacks, DLL's and windows programming in general, and I wondered if maybe someone could help me out here.. :) Here's the C function I'm trying to emulate: void CALLBACK InProc( HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); Here's what I did: ### import gencb def midiInProc( handle, msg, instance, param1, param2 ): pass midiInProc_callback = gencb.generated_callback ( "lwlll", midiInProc ) print "callback at:", midiInProc_callback.address ### This seems to work just fine.. So now I try to call the midiInOpen routine to open the device and tell it about my callback, which is where I get the error. Here's the C version from the docs: MMRESULT midiInOpen( LPHMIDIIN lphMidiIn, UINT uDeviceID, DWORD dwCallback, DWORD dwCallbackInstance, DWORD dwFlags ); lphMidiIn is a pointer to the midi-handle that I'm trying to create. uDeviceID is the number of the device (in my case, 0) dwCallback is supposed to be the address of my function, dwCallbackInstance is just a variable it'll pass to dwCallback so I know which callb ack to use... and dwFlags needs to be this: CALLBACK_FUNCTION = 0x00030000l # dwCallback is a FARPROC Here's what I've done: #### HANDLE = structob.Oracle ( "just a handle.. in this case to a MIDI thingy...", "Ll", ("value",)) curDevice = 0 # my keyboard hmidi = windll.membuf(HANDLE.size) rc = winmm.midiInOpen(hmidi, curDevice, midiInProc_callback.address, \ 0, CALLBACK_FUNCTION) print "result code from midiInOpen: ", rc handle = HANDLE.unpack(hmidi.read())[0]["value"] print "handle:", handle # close it.. rc = winmm.midiInClose(handle) sys.exit(0) ##### If i run this program over and over, I'll alternate between two outcomes: A) The result code for midiInOpen is 0 (meaning it "worked"), and the python crashes.. B) the result code is 20 (meaning the port is already opened, because I opened it and then the program crashed) but the program continues working and then closes the handle.. .... What I think is happening is that when I sucessfully open the handle, it tries to fire the callback (it's supposed to send a "just opened device" message).... And I've either screwed up in defining the callback or passing it to the device, so that when windows tries to invoke the callback, it actually screws with some other part of python and python blows up. Can anyone help me fix this? :) Thanks! -Michal Wallace sabren at manifestation.com [1] for the curious, the (really messy midi-out prototype) code is at: http://www.sabren.com/rants/2000/01/20000129a.php3 [2]Microsoft MIDI input callback docs: http://msdn.microsoft.com/library/psdk/multimed/mmfunc_5u03.htm From Denys.Duchier at ps.uni-sb.de Fri Feb 25 06:23:20 2000 From: Denys.Duchier at ps.uni-sb.de (Denys Duchier) Date: 25 Feb 2000 12:23:20 +0100 Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> Message-ID: "Tim Peters" writes: > It's tail-call *optimization* that's un-Pythonic, as it's a gimmick > supported by only a handful of widely unused <0.5 wink> languages > and surprising to people coming from anything else: damaging > tracebacks would be Major Badness, much worse than the gain for the > relative thimbleful of people who are uncomfortable coding loops > etc. Tim's opinion notwithstanding, it seems to me that the only technical reason why tail call optimization _cannot_ (at least not easily) be supported by python has to do with destructors for local objects. The expectation is that an object created locally and assigned to a local variable has a dynamic extent that coincides with execution in its scope. The timely finalization achieved by reference counting means that its destructor is invoked precisely when the scope is exited. Tail call optimization would have to invoke it when the tail call is made. I cannot help but add that the derogatory comment concerning tail call optimization is not only shortsighted, but also fallacious as it rests entirely on proof by popularity according to which we should all eat shit, since 50 trillion flies can't all be wrong. -- Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de Forschungsbereich Programmiersysteme (Programming Systems Lab) Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier Postfach 15 11 50 Phone: +49 681 302 5618 66041 Saarbruecken, Germany Fax: +49 681 302 5615 From MSteed at altiris.com Thu Feb 17 12:31:29 2000 From: MSteed at altiris.com (Mike Steed) Date: Thu, 17 Feb 2000 10:31:29 -0700 Subject: Which GUI? Message-ID: <65118AEEFF5AD3118E8300508B124877073D8C@webmail.altiris.com> > From: Gerrit Holl [mailto:gerrit.holl at pobox.com] > Sent: Thursday, February 17, 2000 8:17 AM > To: python-list at python.org > Subject: Re: Which GUI? > > > > > Firstly, I would advise against Tkinter. > ... > > The best GUI in my opinion is pyQT. > ... > > Alternatively there is wxPython. > ... > > In conclusion, go for QT unless you need comercial apps, in > which case > > go for wxWin. Of course this is all MHO. > ~~~ > I think we really should create an extensive list with all available > GUI's, with all advantages and disadvantages and a table with info > like crossplatformness, learning curve... The following is a popular clearinghouse for such information. It is not Python-specific, but there is a Python section (which seems incomplete). When you get the "extensive list" done :), perhaps the maintainer would be willing to link to it... http://www.theoffice.net/guitool -- M. From aa8vb at -nojunk-ipass.net Sat Feb 26 14:23:07 2000 From: aa8vb at -nojunk-ipass.net (Randall Hopper) Date: 26 Feb 2000 19:23:07 GMT Subject: Tkinter vs. wxPython (was: Which GUI?) References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> Message-ID: <6C4E773D02F6CFF4.1170B27E887A4CF0.0F14A7BBB3A70EB3@lp.airnews.net> Bernhard Herzog wrote: |Guido van Rossum writes: |> Arguments against Tkinter: |[...] |> - It doesn't let you handle your own paint events; you have to use the |> canvas widget. Occasionally (as when drawing animations or large |> bitmaps) that's annoying and slow, because you have to create and |> destroy tons of small objects. | |It isn't very difficult to work around this limitation with a |C-extension module, at least in a platform specific manner. Sketch for |instance has such an extension module for Unix/X platforms which is |largely based on the X-extension. It lets you effectively implement a |widget completely in Python including handlers for exposure events. Using OpenGL also works well here. Using PyOpenGL, with NumPy for vertex storage only, doesn't require the user to write a C extension module. A Python demo I wrote recently to view map data flings several thousand primitives around in 3D in real-time without my writing any C code. PyOpenGL supports embedding windows in Tkinter apps, among other toolkits (GLUT, etc.). -- Randall Hopper aa8vb at -nojunk-ipass.net From tismer at tismer.com Wed Feb 9 11:03:14 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 09 Feb 2000 17:03:14 +0100 Subject: stackless Python References: <87q4dr$2b62@drn.newsguy.com> Message-ID: <38A18FC2.4E8F2C85@tismer.com> Here's the sinner who did this :-) Michael Hudson wrote: > > Armin Steinhoff writes: > > > Hi All, > > > > is somone using the stackless Python implementation ? > > Are there any information about HOW-TO-USE it ??? > > Using it ... no not really. But I've played with it quite a lot. > > Besides, there isn't much to "use", it works very much like vanilla > Python, at least until you type > > import continuation > > :-) At the moment, there are two lousy example python files which actually use it to implement coroutines and generators. I will have to learn more about this myself, since this is still a closed book for me. > > > BTW ... we are using Python under the RTOS QNX 4.25 ... > > Ah. Don't know anything about QNX, but judging from my experience of > getting it working on linux, you have to bully the files about a bit > to get them to compile. Christian, bless his soul, does go and use > windows for his development platform, and MS Visual C++'s > interpretation of the ANSI C standard is "interesting". Adjusting the > source to sufficient compliance isn't that hard, but I can probably > send you some patches to do it, if you like. Shame on me (*blush*), yes I did so and also claimed that I do no Unix support at the moment (not since I don't want to but just since I got no time). Michael, if you have a working patch, please forward it to me. I'm going to do a major cleanup, check against the current CVS again (I already missed a patch), and I'm going to do quite a lot of redesign: Frame compatibility will be much more complete, after I understood how different nested interpreter must work. I can remove almost all of that crap now. The paradigm "do not store state on the stack" will change to "don't care about the stack". This is possible upto a few restrictions about which frame can finish its interpreter. Will have to change the documentation, and I will try to present something on the next OS conference in Montery. This time I will not bore people with implementation and continuation gibberish, but present real applications. If somebody has something to show, please let me know. ciao - chris.clueless.implementor -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 pinard at iro.umontreal.ca Tue Feb 22 07:36:27 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 07:36:27 -0500 Subject: functional programming In-Reply-To: Moshe Zadka's message of "Tue, 22 Feb 2000 08:39:55 +0200 (IST)" References: Message-ID: Moshe Zadka writes: > At a guess, nobody does anything seriously functional with Python. > Lack of lexical scoping and the weakness of lambdas discourage it. > Whoever wrote this article must have seen "lambda" and concluded Python > has a strong functional basis. So far that I understand functional programming, I would not hesitate using Python. My guess is that I would have no problem naming my lambda's (using `def'), and approximating lexical closures (using `class'). Maybe we should not get distracted that much by syntactical sugar! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From Brian at digicool.com Wed Feb 9 11:01:33 2000 From: Brian at digicool.com (Brian Lloyd) Date: Wed, 9 Feb 2000 11:01:33 -0500 Subject: small python implementation or python subset ? Message-ID: <613145F79272D211914B0020AFF6401914DE29@gandalf.digicool.com> > It is a somewhat difficult job to trim python down quite that small > and still have much left... > > In the context of some research we are doing, we are exploring some > ways to use Python in a trim embedded environment. Anyone else doing > this sort of thing? When I first started out on Python for CE I did a draconian build that scrapped all but the most utterly essential builtin modules (I think I only kept sys and strop, in fact). As I recall, the python15.dll that popped out was 250K-ish. As you pointed out though, hitting the size target doesn't help much if what's left is too minimal to solve your problem... Brian Lloyd brian at digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com From mwh21 at cam.ac.uk Fri Feb 25 14:16:26 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Feb 2000 19:16:26 +0000 Subject: Life's better without builtins? (was: Life's better without braces) References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> <38B691AD.BDB4DD5F@endea.demon.nl> <38B6C026.E7115680@endea.demon.nl> Message-ID: Niels Diepeveen writes: > Michael Hudson schreef: > > > > Think module.__file__ & exec for reload. Something like > > > > def reload(module): > > exec open(module.__file__[:-1]).read() in module.__dict__ > > return module > > That seems a perfect replacement. (except for the [:-1]?) >>> import string >>> print string.__file__ /usr/lib/python1.5/string.pyc Helps? I don't know if it's *always* .pyc, so a true replacement might want to check. > So, only a few more hurdles before the release of PPython;-) Believe me, I've thought of it. Even started a little, but I got bored. Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From glen at electricorb.com Fri Feb 4 08:04:22 2000 From: glen at electricorb.com (Glen Starchman) Date: 4 Feb 2000 07:04:22 -0600 Subject: kjParser Problem -- Addendum References: <38982697.76C77FD6@electricorb.com> Message-ID: <389ABFC9.8366B4E2@electricorb.com> it is x=>y() that will not match...obviously x=y() will not match that production. ;-) Glen Starchman wrote: > I am having a horrible time with the following in kjParser and am > wondering if a) anyone has any suggestions on how to make it work with > kjParser, or, b) if anyone suggests that I dump my kjParser-based parser > and untilize SPARK. > > The problem is this: I have a production for invoking a member function > of a class that looks like (excuse the sloppy rules, it was written very > quickly): > > @R InvokeRule :: Value >> var => var called_with_statement > @R CalledWithRule :: called_with_statement >> args > @R CalledWith2Rule :: called_with_statement >> > > so, this will match: > x=> y() > or > x => y > > or x => y > > but not > > x=y() > > any ideas? Any help is GREATLY appreciated! From drew.csillag at starmedia.net Wed Feb 16 22:02:29 2000 From: drew.csillag at starmedia.net (Andrew Csillag) Date: Wed, 16 Feb 2000 22:02:29 -0500 Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> <88f1lr$ola$1@nntp4.atl.mindspring.net> <38AB10C0.931F8F19@starmedia.net> <88f2k2$rfm$1@nntp4.atl.mindspring.net> Message-ID: <38AB64C5.931377A4@starmedia.net> Michal Wallace wrote: > > >Even easier: > >>>> x = 5 > >>>> y = 20 > >>>> a = x a and b or c > > :) yeah.. that post was from like a week ago, when we were > talking about a way to do that without the boolean operators... > Fredrik suggested that my IIF() routing could be made to > work across namespaces, and I've been trying to figure > it out ever since.. (well, at least somewhere in the back of > my mind...) Not too hard... Just need to do the throw/catch/fiddle with traceback dance: import sys def IIF(exp, t, f): try: raise "foo!" except: tb = sys.exc_traceback fr = tb.tb_frame.f_back locs = fr.f_locals globs = fr.f_globals expVal = eval(exp, locs, globs) if expVal: return eval(t, locs, globs) else: return eval(f, locs, globs) def cli(): a='0 lesser' b='1 greater' print IIF('b>a', 'b', 'a') #should print '1 greater' print IIF('b Message-ID: > > probably because that instance isn't really PyObject* > compatible... > > if I were you, I'd wrap the C++ classes using SWIG: > > http://www.swig.org Though CXX might be a better fit. I dunno, i just find it easier for most of my c++ types to use CXX an create extensions that way, than trying to swigify the headers. Maybe it's cause i use the STL so heavily. In cases where i don't feel like building a C++ class just to expose some simple type, I create the class in python, and create instances in C++ (I made an Instance class for CXX taking a class and arguments). Works great for callbacks. > > > From nikolai at micon.no Mon Feb 28 19:25:43 2000 From: nikolai at micon.no (Nikolai Kirsebom) Date: Tue, 29 Feb 2000 01:25:43 +0100 Subject: Remote Inbox inspector & mail-forwarder Message-ID: I've made a small (and simple) module which makes it possible to inspect a remote Inbox and also have selected received mail-items forwarded to your home e-mail address. Module uses python COM extension and the mxDateTime module. These must be installed. If it sounds interesting, have a look and use it if you want to (and are allowed to). Good luck http://www.micon.no/python.asp Nikolai Kirsebom From dennis_marti at yahoo.com Mon Feb 28 22:43:58 2000 From: dennis_marti at yahoo.com (Dennis Marti) Date: Mon, 28 Feb 2000 22:43:58 -0500 Subject: does opensource move faster with python? References: Message-ID: In article , "Michal Wallace (sabren)" wrote: > ARE there projects out there using python as a prototyping language > with the possible intention of discarding it eventually and rewriting > in C? Yes, but maybe we'll get lucky. Dennis From gerrit.holl at pobox.com Wed Feb 16 15:48:31 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 21:48:31 +0100 Subject: control of child process stdio In-Reply-To: <88eqjc$l42$1@nnrp1.deja.com>; from fplancke@my-deja.com on Wed, Feb 16, 2000 at 06:34:20PM +0000 References: <88eqjc$l42$1@nnrp1.deja.com> Message-ID: <20000216214831.A4101@stopcontact.palga.uucp> Fr?d?ric van der Plancke wrote on 950722460: > How to write a Python script that controls execution of console > Windows/Unix programs (.exe), writing to / reading from them using > their stdin/stdout ? > > (For my current problem simplified assumptions hold: the master script > should spawn the program, send fixed-length data to it, wait for at > most a given time, read fixed-length data from the program, then the > program ends itself. > This will be done several times in sequence.) > > More-or-less platform-independent solutions are preferred, but I mainly > need a Windows solution... You need the os.popen function. regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From vmarkwart at my-deja.com Thu Feb 10 22:56:11 2000 From: vmarkwart at my-deja.com (vmarkwart at my-deja.com) Date: Fri, 11 Feb 2000 03:56:11 GMT Subject: Using gzip with multiple file Message-ID: <88018q$erp$1@nnrp1.deja.com> Hi, Could someone please point me to an example of using gzip to store multiple files in the one archive, or failing that any examples using gzip reliably. TIA Victor Sent via Deja.com http://www.deja.com/ Before you buy. From cpatti at atg.com Mon Feb 7 14:59:30 2000 From: cpatti at atg.com (chris patti) Date: 07 Feb 2000 14:59:30 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> Message-ID: tim muddletin at news.vex.net (tim muddletin) writes: > On 04 Feb 2000 11:50:22 -0500, chris patti > wrote: >simply, it's an FTP archive. > > I'd just like to point out that the tragically missing resource that > spawned this thread is actually around 2 or 3 years old (approx 1997 > as far as i can tell). That is three years in which the author could > have uploaded it to the contrib directory at ftp.python.org if he so > desired---right up until the time it was more-or-less closed down a > few months ago. > > Alas, it seems, an FTP archive would not have saved us in this case, > despite its many potential virtues. > Umm, I'm not sure where you're getting the "tragic" from. I merely noted in my post that I felt a _centralized_ FTP based repository of all the freely available modules in existence for Python would be a Good Thing, because it would make things easier for both maintainers and users as it would provide a central point of exchange. /contrib on ftp.python.org != CPAN, you miss the point, I think. What I'm referring to is not just an FTP archive but a controlled and _maintained_ collection of all the modules. Yes it would require work, and yes I'm willing to put my money where my mouth is and help build such a thing if there's interest in other quarters and archive space becomes available. -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From jimc at regnoc.com Sat Feb 12 10:26:32 2000 From: jimc at regnoc.com (Jim Conger) Date: Sat, 12 Feb 2000 15:26:32 GMT Subject: dynamic html with python Message-ID: <38A57B53.D2A2DE73@regnoc.com> I'm running a linux server with appache for the static web pages. I would like to link from one of these static pages to dynamically generated html from a python script. The script would then take care of both input and html output for that section. I have a number of programming examples of how to generate a simple python http server, but I can't figure out how to launch that activity from within a static html page. Thanks. -- Jim Conger -------------- next part -------------- An HTML attachment was scrubbed... URL: From effbot at telia.com Fri Feb 11 02:27:12 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 07:27:12 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262152524-5049647@hypernet.com> <38A33AD9.3F4EA190@americasm01.nt.com> Message-ID: Robert Eaglestone wrote: > There must be a reason or rationale between 1) the ubiquity > of bracketed syntax, and 2) Python deliberately omitting it. > That is: there is a reason Python doesn't use it, and it must > be a big one or else it just would have used bracketing. I > want to know what this compelling reason is! scientific research. > My assumption is that unless it vastly improves programming > the confusion caused by following a nonstandard syntax isn't > worth the change made. have you tested this on humans, or are you just guessing? (what I find so utterly strange is that as a programmer, I'm working in an environment where I have to learn new things every single day. XML, Java, OO, UML, new tools, Windows 2000, new protocols, Transmeta, portable com- puting, WAP, etc, etc. how on earth can you survive in that world if you think it's impossible to learn to leave out the end bracket when programming Python?) From moshez at math.huji.ac.il Sun Feb 20 00:36:12 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 20 Feb 2000 07:36:12 +0200 (IST) Subject: cgi.py, cookies In-Reply-To: Message-ID: On Sat, 19 Feb 2000, Will Ware wrote: > I didn't see anything in cgi.py about handling cookies. I am > planning a web-based multi-player simulation game and I need > to be able to tell the players apart. I'm just learning about > CGI and forms and all that for the first time, and cookies > seem tome to be the right way to assign persistent identities > to players. Is there any cookie-handling server-side Python > code? Thanks much. See the "cgi" topic on Python's home page for links to cookie handling modules. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mskott at image.dk Tue Feb 22 16:29:01 2000 From: mskott at image.dk (Martin Skøtt) Date: 22 Feb 2000 22:29:01 +0100 Subject: Easy reading HTML? Message-ID: Hi I am currently in the thinking process of writing a little python program to sort my Netscape bookmarks file. It is so smart that this bookmark file is a simple HTML file which I am now looking for an easy way to read. What I need is a function to parse tables which are used to handle folders in the menu and tags. In the I need to know the address it points to and its title (which is the one I want to sort on). Do you have any smart ideas you want to share? I guess its htmllib I need but I don't know where to start with it. -- Kind regards Martin Sk?tt mskott at image.dk So much to see. So much to hear. So little time to do it in. From gerrit.holl at pobox.com Tue Feb 1 10:13:36 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 1 Feb 2000 16:13:36 +0100 Subject: Removing objects of a superclass? Message-ID: <20000201161336.A1785@stopcontact.palga.uucp> Hello, is it possible to _remove_ objects of a superclass? I'm interested in creating a sort of UserString, and because it shares many methods with UserList I want to subclass it. But then, I need to remove some methods like .append and .pop. Can I do that? regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:30:52 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:30:52 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: <894ea9$h33$1@nnrp1.deja.com> <38B69655.DD9980F9@bellatlantic.net> <896qci$8cj$1@nnrp1.deja.com> Message-ID: John: In an article posted Fri, 25 Feb 2000 20:57:56 GMT, John Nielsen (nielsenjf at my-deja.com) said: > The other style doesn't work for me (treats it as html), > > I thought it was odd also, which is why I included the means I use. It's > probably just a typo on his part. Part typo, part drain-bamage [sic] (i.e., write it once incorrectly and then copy the stew out of it.... ouch!) Next time, I'll copy the code directory from the source. hehehe -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From moshez at math.huji.ac.il Sat Feb 26 01:14:35 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 08:14:35 +0200 (IST) Subject: 1000 GUI toolkits In-Reply-To: Message-ID: On Fri, 25 Feb 2000, Robin Dunn wrote: > > But it is interesting: is there a Python module (written in Tkinter of > > PyGTK or ...) which parses HTML with embedded Python and executes it? > > Does grail does that? > > It's called Zope. To clarify: I meant client side. > Actually, wxPython sorta has that ability. GUI objects can be constructed on > the fly and displayed embedded in the HTML page within a wxHtmlWindow. I meant that the Python code would be in the HTML page, and would be compiled to a (say) wxPython (or ...) module which displays a GUI. After all, HTML has this fancy layout capabilities: all you would need to do is bind some callbacks... dreamingly-y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mikael at isy.liu.se Mon Feb 21 03:02:46 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 21 Feb 2000 09:02:46 +0100 (MET) Subject: ANNOUNCE: Phyton-Compiler In-Reply-To: Message-ID: On 20-Feb-00 Not Tonight wrote: > Actually, that'd be good to change the name to Phyton. Every time I > search the net for Python, books or something like that, there appear > those five bazillion "Python" hits, of which about 3 are about the > language and the rest about Monty Python. On AltaVista: +python -"monty python" And you get "bazillion" hits about python. Now all you have to do is to filter out the reptiles... /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: 21-Feb-00 Time: 08:59:46 This message was sent by XF-Mail. ----------------------------------------------------------------------- From bwarsaw at cnri.reston.va.us Wed Feb 16 13:56:27 2000 From: bwarsaw at cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 16 Feb 2000 13:56:27 -0500 (EST) Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216073900.B2508775@vislab.epa.gov> Message-ID: <14506.62171.965245.972734@anthem.cnri.reston.va.us> >>>>> "RH" == Randall Hopper writes: RH> Maybe a "reraise " statement in Python 2.0? TMSA (Time Machine Strikes Again): -------------------- snip snip -------------------- import sys def foo(): raise NameError def bar(): foo() def baz(): try: bar() except NameError: tpe, val, tb = sys.exc_info() raise AttributeError, None, tb baz() -------------------- snip snip -------------------- Python 1.5.2 (#7, Apr 16 1999, 18:24:22) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> ## working on region in file /tmp/python-sFAH4h... Traceback (innermost last): File "", line 1, in ? File "/tmp/python-sFAH4h", line 16, in ? baz() File "/tmp/python-sFAH4h", line 11, in baz bar() File "/tmp/python-sFAH4h", line 7, in bar foo() File "/tmp/python-sFAH4h", line 4, in foo raise NameError AttributeError From t.keil at zvs.zgs.de Thu Feb 17 19:45:41 2000 From: t.keil at zvs.zgs.de (Thomas Keil) Date: Thu, 17 Feb 2000 16:45:41 -0800 Subject: Connecting Microsoft Access Database (DAO) References: <38AB2A28.77FE@zvs.zgs.de> Message-ID: <38AC9634.7A15@zvs.zgs.de> Hello, thanks for help! I finally used a query - perhaps its useful for someone else: # Getting a query from Access Database using DAO and SQL: import win32com.client FileName=r'example.mdb' sql='SELECT * FROM [foo table];' # "sql=foo table" does the same # examples # Date='#02/05/00#' # sql='SELECT * FROM [foo table] WHERE [foobar] = %s' %Date # joining 2 tables: # Tab1='[foo table]' # Tab2='[bar table]' # whereDef='WHERE [foobar] = %s' %Date # ... with range: # whereDef='WHERE [foobar] BETWEEN %s AND %s' %(Date1, Date2) # sql='SELECT * FROM '+Tab1+' INNER JOIN '+Tab2+' ON '+Tab1+'.ID = '+Tab2+'.ID '+whereDef+';' Engine='DAO.DBEngine.36' def Query(FileName, sql): # have a look at the COM-tutorial from Christian Tismer e=win32com.client.Dispatch(Engine) db=e.OpenDatabase(FileName) rs=db.OpenRecordset(sql) query=[] f=rs.Fields query.append(map(lambda fld: fld.Name, f)) # names rs.MoveFirst() # getting data while not rs.EOF: query.append(map(lambda fld: fld.Value, f)) rs.MoveNext() # ! never forget this db.Close() return (query) for z in Query(FileName, sql): print z #--- Th. Keil mailto: t.keil at zvs.zgs.de From ralph.kopp at technidata.de Wed Feb 2 05:31:12 2000 From: ralph.kopp at technidata.de (Ralph Kopp) Date: Wed, 02 Feb 2000 11:31:12 +0100 Subject: Python and TCL (Tkinter) problem Message-ID: <38980770.2C52DCB9@technidata.de> Hello, everybody .... I have an problem with python and tcl8.1 and I hope somebody can help me ..... Following output I got when I test the tkinter: -------------------------------------------------------------------------------------------------- Python 1.5.2 (#5, Feb 1 2000, 11:10:07) [GCC 2.95.2 19991024 (release)] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import _tkinter >>> import Tkinter >>> Tkinter._test() Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 1947, in _test root = Tk() File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 886, in __init__ self.tk = _tkinter.create(screenName, baseName, className) TclError: Can't find a usable init.tcl in the following directories: This probably means that Tcl wasn't installed properly. ---------------------------------------------------------------------------------------------------- The init.tcl is in /usr/local/lib/tcl8.1 ....!?? In the Setup file from python this path exist and python was successfully compile. I have test the tcl installation successfully too. Did somebody know whats the problem is .... Thanx ... Ralph From collins at rushe.aero.org Wed Feb 16 19:26:19 2000 From: collins at rushe.aero.org (JEFFERY COLLINS) Date: Wed, 16 Feb 2000 16:26:19 -0800 Subject: Python for Palm update Message-ID: <200002170026.QAA20266@rushe.aero.org> There has been considerable interest recently in porting python to the palm, even to the point of putting a price on it (http://www.cosource.com). I have mentioned in previous messages that a port was underway, and more recently that a release was imminent. Here is an update on the status of the project. I have an unreleased (alpha) python-1.5.1 port that will run on PalmIII's and greater. It runs a subset of the test suite (reduced versions of test_b1, test_b2, test_grammar,test_pow, and test_types), the results of which are printed on a rather crude display. The python VM is a collection of GLib shared libraries. Palm applications are built essentially freezing the module (via a variation on Guido's freeze tool) and dynamically linking it with the VM on the palm. So, python modules that use only the implemented features can become separate Palm applications. No effort has been made to integrate python with the palm environment, other than the ability to access some compiled python library modules from a palm database. Some challenges to developing a robust python implementation remain. Here is a short list of them and suggested solutions: Recursive function calls fail fatally (for <100 iterations), most likely due to a stack overflow. Christian Tismer's Stackless Python is expected to solve this problem. The heap is quite small (~64K on the Palm III) and it can quickly fill up. There are also some memory leaks in python-1.5.1, since patched in 1.5.2 that may be causing problems. Given the limited development tools at the time port began, adding extension modules requires a modification to the VM libraries. The deficiencies leading to this problem have been fixed in recent (last couple of weeks) versions. Python takes a very long time to start and this is _very_ noticable on the palm. There has been some discussion about python's startup time, but I know of no effort to speed this up significantly. Given these problems, I've decided not to release the 1.5.1 port but instead begin immediately on the 1.5.2+ port. Given my experience with the 1.5.1 port and the tool improvement (plus some already written support code), the second port should be alpha in a few weeks. My goal is to reduce the footprint/memoryprint of python (as in the python 1.5.1 port), and get the changes rolled into the main python branch. These changes will benefit not only the palm port, but other small platform ports as well. I don't plan to focus attention on tight integration with the palm platform. Anyone willing to work on the palm side of things is welcome. These may include extension modules (for graphics, events, etc.), a palm application for running python modules, viewing output, and anything else palm related. I will be focused on creating a python that is small and efficient, and a simple extension mechanism (plus possibly a python module importing mechanism from palm databases). Thanks Jeff From tim_one at email.msn.com Fri Feb 25 03:21:15 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 25 Feb 2000 03:21:15 -0500 Subject: Backreference within a character class In-Reply-To: <3dk8jufesl.fsf@amarok.cnri.reston.va.us> Message-ID: <001601bf7f69$49589920$b62d153f@tim> [Andrew M. Kuchling] > If you're trying to match 3-character words with the same letters in > positions 1 and 3, but not 2, then a lookahead negation would do it: > > pat = re.compile(r"(.)(?!\1).\1") > > The steps here are 1) matches a character 2) assert that the > backreference \1 doesn't match at this point 3) consume the character, > because assertions are zero-width and don't consume any characters, > and 4) match \1. (Alternatively, if the 3-character string is in > variable S, 'if (S[0] == S[2] and S[0] != S[1])' would do it.) > > On a theoretical plane: If you wanted to match general strings of the > form ABA, where A!=B and A,B are of arbitrary non-zero length, I think > this isn't possible with regexes (of either Python or Perl varieties), > because in step 3 you couldn't consume as many characters as were > matched by the first group. Anyone see a > clever way I've missed? (Another jeu d'esprit.) You'd have to do it > by matching the pattern r"(.+)(.+)\1", and then verifying that group 2 > != group 1 in Python code. How about the obvious way? (.+)(?!\1)(.+?)\1 The point being that if the negative lookahead assertion succeeds, \1 can't match any prefix of the remaining string either, so it doesn't matter how many chars B sucks up (B can't equal A, else the assertion would have failed). Example: >>> import re >>> p = re.compile(r"(.+)(?!\1)(.+?)\1") >>> s = "Stichting Mathematisch Centrum, Amsterdam" >>> i = 0 >>> while 1: m = p.search(s, i) if not m: break print "A='%s' B='%s'" % m.groups() i = m.end(0) A='ti' B='ch' A='n' B='g Mathematisch Ce' A='t' B='rum, Ams' >>> Cute: applying that to the paragraph above, it finds A=" suc" at the starts of " succeeds" and " sucks". Backreferences are scary. not-to-mention-irregular-ly y'rs - tim PS: Next try to match ABA where A is not a substring of B. Then where A is not a substring of the reversal of B . This kind of thing is easy in Icon. PPS: Did you mean to say "and A,B are of [*the same*] arbitrary non-zero length"? Icon looks better all the time . From ivanlan at callware.com Thu Feb 17 01:55:42 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 16 Feb 2000 23:55:42 -0700 Subject: Python misconceptions in IBM Ruby article... References: <001d01bf7912$ef340800$dea0143f@tim> Message-ID: <38AB9B6E.599C1F3@callware.com> Hi All-- Tim Peters wrote: > [snip] > Instead, after > comp.lang.ruby is formed, we'll descend on it like a horde of enranged > barbarians . > What do you mean, "like"? I thought we _were_ barbarians, already fully equipped with ranges. > web-journalism-is-more-web-than-journalism-ly y'rs - tim > -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 tim_one at email.msn.com Tue Feb 29 04:25:03 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 29 Feb 2000 04:25:03 -0500 Subject: Multi-argument append() is illegal In-Reply-To: <200002281541.KAA23255@eric.cnri.reston.va.us> Message-ID: <000f01bf8296$dbe53480$732d153f@tim> [Guido van Rossum] > I've noticed that there is some code out there that creates a list of > tuples and uses code like list.append(a,b,c) to add the tuple (a,b,c) > to the list. According to the documentation, this is illegal: > append() only takes a single argument, and one should write > list.append((a,b,c)). However, the actual append() implementation > didn't mind, and implemented list.append(a,b,c) as > list.append((a,b,c)). Many people are using this even though it's > never been documented. > > I am going to rectify this in Python 1.6 -- people coming from other > languages might well expect list.append(a, b, c) to mean the same as > list.append(a); list.append(b); list.append(c), and it's always been > my philosophy to make ambiguous syntax illegal rather than to pick one > interpretation randomly. Before anyone starts , protesting this appears to be as futile as griping about whitespace: The Dictator Has Spoken here. It's been broken forever and needs to get fixed. > ... > You can also grep through your sources for a pattern like > "\. *append *\(.*," -- which doesn't find every occurrence, but is > a good starting point. Actually, it's a terrible starting point: the sheer quantity of "false hits" will drive you mad. For example, note that the one above matches your .append()s again *after* you've fixed them(!). I've been thru this a few times in my own code over the years, and never dreamed up a regexp that didn't leave me with hours of manual drudge. You really need to account for bracket nesting levels to avoid spurious hits on "deep" commas, and to ignore commas in strings and trailing comments, and to span lines too to avoid missing the list.append(long_expression1... ...ending_here, and_another) cases. So, Python to the rescue. What appears to be a very capable checker is attached. It's pretty slow, but not achingly so, and you shouldn't need to use it often. Read the docstring at the top for cautions. A copy of this (or a fixed version, if this proves to have bugs) may show up in the 1.6 distribution. BTW, there's no chance of talking me into trying to extend this to edit your files for you, so it's a good thing you didn't ask . parsing-is-better-than-wild-ass-guessing-ly y'rs - tim #! /usr/bin/env python # Released to the public domain, by Tim Peters, 28 February 2000. """checkappend.py -- search for multi-argument .append() calls. Usage: specify one or more file or directory paths: checkappend [-v] file_or_dir [file_or_dir] ... Each file_or_dir is checked for multi-argument .append() calls. When a directory, all .py files in the directory, and recursively in its subdirectories, are checked. Use -v for status msgs. Use -vv for more status msgs. In the absence of -v, the only output is pairs of the form filename(linenumber): line containing the suspicious append Note that this finds multi-argument append calls regardless of whether they're attached to list objects. If a module defines a class with an append method that takes more than one argument, calls to that method will be listed. Note that this will not find multi-argument list.append calls made via a bound method object. For example, this is not caught: somelist = [] push = somelist.append push(1, 2, 3) """ __version__ = 1, 0, 0 import os import sys import string import getopt import tokenize verbose = 0 def errprint(*args): msg = string.join(args) sys.stderr.write(msg) sys.stderr.write("\n") def main(): args = sys.argv[1:] global verbose try: opts, args = getopt.getopt(sys.argv[1:], "v") except getopt.error, msg: errprint(msg + "\n\n" + __doc__) return for opt, optarg in opts: if opt == '-v': verbose = verbose + 1 if not args: errprint(__doc__) return for arg in args: check(arg) def check(file): if os.path.isdir(file) and not os.path.islink(file): if verbose: print "%s: listing directory" % `file` names = os.listdir(file) for name in names: fullname = os.path.join(file, name) if ((os.path.isdir(fullname) and not os.path.islink(fullname)) or os.path.normcase(name[-3:]) == ".py"): check(fullname) return try: f = open(file) except IOError, msg: errprint("%s: I/O Error: %s" % (`file`, str(msg))) return if verbose > 1: print "checking", `file`, "..." ok = AppendChecker(file, f).run() if verbose and ok: print "%s: Clean bill of health." % `file` [FIND_DOT, FIND_APPEND, FIND_LPAREN, FIND_COMMA, FIND_STMT] = range(5) class AppendChecker: def __init__(self, fname, file): self.fname = fname self.file = file self.state = FIND_DOT self.nerrors = 0 def run(self): try: tokenize.tokenize(self.file.readline, self.tokeneater) except tokenize.TokenError, msg: errprint("%s: Token Error: %s" % (`self.fname`, str(msg))) self.nerrors = self.nerrors + 1 return self.nerrors == 0 def tokeneater(self, type, token, start, end, line, NEWLINE=tokenize.NEWLINE, JUNK=(tokenize.COMMENT, tokenize.NL), OP=tokenize.OP, NAME=tokenize.NAME): state = self.state if type in JUNK: pass elif state is FIND_DOT: if type is OP and token == ".": state = FIND_APPEND elif state is FIND_APPEND: if type is NAME and token == "append": self.line = line self.lineno = start[0] state = FIND_LPAREN else: state = FIND_DOT elif state is FIND_LPAREN: if type is OP and token == "(": self.level = 1 state = FIND_COMMA else: state = FIND_DOT elif state is FIND_COMMA: if type is OP: if token in ("(", "{", "["): self.level = self.level + 1 elif token in (")", "}", "]"): self.level = self.level - 1 if self.level == 0: state = FIND_DOT elif token == "," and self.level == 1: self.nerrors = self.nerrors + 1 print "%s(%d):\n%s" % (self.fname, self.lineno, self.line) # don't gripe about this stmt again state = FIND_STMT elif state is FIND_STMT: if type is NEWLINE: state = FIND_DOT else: raise SystemError("unknown internal state '%s'" % `state`) self.state = state if __name__ == '__main__': main() # end of file From effbot at telia.com Thu Feb 24 10:26:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 15:26:21 GMT Subject: TK and PhotoImage: Problem getting image to display References: <38B4774E.9BE01006@exceptionalminds.com> Message-ID: Kevin Cazabon wrote: > The first thing I'd do is the following: > > class Quoter: > > def __init__(self, master): > > self.qFrame = Frame(master) > > self.qFrame.pack(side=TOP) > > > > #qCompanyLogoCanvas = Canvas(qFrame, width=275, height=50) > > #qCompanyLogoCanvas.pack(side=LEFT) > > > > self.img = PhotoImage(file='amos3.gif') > > self.qAMOSLogoCanvas = Canvas(qFrame, width=300, height=300) > > self.qAMOSLogoCanvas.create_image(0, 0, anchor=NW, image=self.img) > > self.qAMOSLogoCanvas.pack() > > > > What this does is ensures the persistence of the objects, by making them a > static part of "self". Otherwise, they might appear for a fraction of a > second, but be 'cleaned up' by automatic garbage collection. slight elaboration: Tkinter maintains its own widget tree, so you don't have to hang on to the widgets. the "self.img" stuff is crucial, though: http://www.python.org/doc/FAQ.html#4.69 From khadji at pld.com Sun Feb 6 22:25:15 2000 From: khadji at pld.com (Patrick K Moorman) Date: Sun, 6 Feb 2000 21:25:15 -0600 Subject: Files and Directories Message-ID: <2Lqn4.5185$NS3.16759@newsfeed.slurp.net> Thanks to everyone who answered my last question, it is good reminder that computers do *ONLY* what they are told. I am trying to write a little script that will rename files in multiple directories. What am a looking for is a way to take each item returned by os.listdir() and test to see if it is a file or a directory. I have gone through the lib reference but I did not see anything that would work. I know very little about programing or Pyhton (if you haven't guess yet) and I am learning by doing. Or not doing as the case is right now :) From jeremy at cnri.reston.va.us Thu Feb 17 18:23:51 2000 From: jeremy at cnri.reston.va.us (jeremy at cnri.reston.va.us) Date: Thu, 17 Feb 2000 23:23:51 GMT Subject: Recursive function defined within function => NameError References: <38ABCE51.3EF6728E@inka.de> Message-ID: <88hvu3$st7$1@nnrp1.deja.com> I'm not sure what your definition of better is , but the Y combinator can be used to express recursive procedures. Here's an applicative-order version. Jeremy def self_apply(g): return g(g) def Y(f): def stack(x, f=f): return f(lambda x=x:x(x)) return self_apply(stack) def test(): def _fact1(recurse): def _fact2(n, recurse=recurse): if n == 0: return 1 else: return n * recurse()(n - 1) return _fact2 fact = Y(_fact1) print fact(7) print fact(12L) if __name__ == "__main__": test() Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Thu Feb 17 03:35:15 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 08:35:15 GMT Subject: Where is the Python Journal? References: <8EDCA9C19PaCmAnRDLM@194.2.0.33> Message-ID: <7pOq4.120$mYj.170920448@newsa.telia.net> chris patti wrote: > For instance, Mark Dominus who is a good writer (his articles are > some of the only clues we had for a *long time* on some really > poorly understood and badly documented Perl topics) recently wrote > a series of articles on 'memoization' - the use of recursion and > recursive data structures to implement caching algorithms that save > huge gots of time on repeated computations.. http://www.deja.com/=dnc/getdoc.xp?AN=310536564 > Python needs something similar. it's called comp.lang.python (paper editions coming soon ;-) From felixt at dicksonstreet.com Fri Feb 11 21:18:26 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Fri, 11 Feb 2000 20:18:26 -0600 Subject: data structure design question Message-ID: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> I'm thinking of trying to do some chemistry stuff in Python, and one of the things I was thinking of was to define a Chemical (or Molecule) object. On paper chemicals are represented by stuctures like: H | C=O | H so I thought I could initialize instances with some values that mimic what we draw. All I've come up with so far is either #make instances of the constituent elements h1, h2, c, o = H(), H(), C(), O() #initialize with a dictionary of who's connected to who formaldehyde = Chemical({h1:[c], h2:[c], c:[h1, h2, o, o], o:[c, c]}) or else use lists of lists to mimic a connection matrix/table/... : HHCO H -010 H 0-10 C 11-2 O 002- like: formaldehyde = Chemical([H, H, C, O], [[None, 0, 1, 0], [0, None, 1, 0], [1, 1, None, 2], [0, 0, 2, None]]) The dictionary method seems more condensed and readable, so I am preferring it right now, even though I would have to make a new instance for every atom of an element, but I was wondering if there was a better way to do it altogether, and if anyone had advice or could recommend some books/websites that would help me think about this kind of problem. Thanks! Felix From moshez at math.huji.ac.il Fri Feb 18 13:28:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 20:28:52 +0200 (IST) Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <88k09b$96f$1@nnrp1.deja.com> Message-ID: On Fri, 18 Feb 2000 see_plus_plus at my-deja.com wrote: > This is just a display that you haven't mastered C++. You can tell that to my boss, who pays me to write C++. > In your C++ code sample, you on purpose introduced two variables integer > i. The one is the private data member, and the other is the formal > parameter of function member foo. Yes. And it's legal C++, and very common too: consider class Foo { char data; Foo(char data) {this->data = data; } }; > Just because of that you need to use > 'this' to be explicit. Exactly. Python requires you always to be explicit. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From greg at perceval.be Mon Feb 28 08:50:34 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Mon, 28 Feb 2000 14:50:34 +0100 (CET) Subject: Killin' Newbie question In-Reply-To: Message-ID: I can't access the __init__ method outside of the object, so the following is disallowed : ---- class huh(): def __init(self): [some initialisation] ough= huh() [some code] ough.__init__() ---- Right ? The following should be allowed ? class huh(): def __init__(self): [some initialisation] def ReInit(self): self.__init__() ough= huh() [some code] ough.ReInit() Do I have to rewrite the __init__ function in the ReInit() or the call to the init() function inside the ReInit is enough ? Isn't there a better way to do this kind of job, i mean in a OOP point of view. Other little question, what about the following (regarding another remark posted before) : def __init__(this): ... -- 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 robin at jessikat.demon.co.uk Thu Feb 24 12:59:04 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 24 Feb 2000 17:59:04 +0000 Subject: Just tested Tcl/Tk 8.3.0 with Python: It works (on SuSE Linux)! References: Message-ID: In article , Peter Funk writes >Hi! > >Just in case anybody is interested: > >I've just installed and build the Tcl/Tk 8.3.0 combo from source and >tested it together with a rather recent Python CVS tarball (Feb 10th, >2000) on a system running SuSE Linux. The build went through without >any problems and so did the Python test suite. > >But since the Python test suite currently does nothing with Tkinter, >my testing of the Tkinter/Tcl/Tk 8.3 combo is still incomplete. >But my first impression is good. Everything I tested until now seems >to work flawlessly. > >I've used the GCC egcs-2.91.66 19990314 and GLIBC 2.1.2. > >Regards from Germany, Peter I have it running with Win32 and all seems well. -- Robin Becker From mikael at isy.liu.se Fri Feb 11 03:06:34 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Fri, 11 Feb 2000 09:06:34 +0100 (MET) Subject: Proposal: Official whitespace response In-Reply-To: <200002102304.KAA08105@envy.fulcrum.com.au> Message-ID: On 10-Feb-00 Richard Jones wrote: > > Could we please maybe mandate an "Official Response" to the weenies > constantly > posting about whitespace in Python? > > Something like: > > ------- > Subject: Official Response [Re: ] > From: some_python_regular > > Guido van Rossum, the creator of Python, is not going to change this > fundamental aspect of Python. We don't want him to. We all like it. > > If you wish discussion on this topic, please read the mailing list / news > group > archives regarding the topic first: > http://www.dejanews.com/dnquery.xp?DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format= > thre > aded&showsort=date&maxhits=100&groups=comp.lang.python&QRY=whitespace > > Any further messages with the subject line " here> > " will be ignored. I certainly second that. /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-Feb-00 Time: 09:05:59 This message was sent by XF-Mail. ----------------------------------------------------------------------- From ivanlan at callware.com Sat Feb 12 17:51:28 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Sat, 12 Feb 2000 15:51:28 -0700 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: <38A5E3F0.B3DCEC8E@callware.com> Hi All-- osorronophris osorronophris wrote: > > I'm a die-hard C++ programmer that recently took up Python for a change of > scenery and am enjoying it greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've tried chewing gum but it > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? > Yes. I've found that a 7% solution of whitespace-eating nanovirii in a saline solution that, when injected properly, gives quite effective relief over several hours. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 jeremiah at widomaker.com Mon Feb 7 10:46:25 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:46:25 GMT Subject: nonlinear programs? Message-ID: <389DF96A.86D4FFA2@widomaker.com> Is there a way for me to make python start a process(such as mpg123) and then continue on in the program before mpg123 stops? I want to be able to start the song playing, and then still solicit user input about skipping on to the next mp3, or quitting the program. If someone could explain this to me, or point me in the direction of an explanation I would be very greatful. From gerrit.holl at pobox.com Fri Feb 18 17:00:21 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 23:00:21 +0100 Subject: Which GUI? In-Reply-To: <88jg9f$ssd$1@nnrp1.deja.com>; from ndev42@yahoo.com on Fri, Feb 18, 2000 at 01:09:05PM +0000 References: <88jg9f$ssd$1@nnrp1.deja.com> Message-ID: <20000218230021.B9457@stopcontact.palga.uucp> ndev42 at yahoo.com wrote on 950875745: > > > I would like pro and cons for the different GUI's > > I would like to add: > > Is there any GUI toolkit that supports the following > requirements? > > - As portable as Python. > - Does not need ANY extra library to compile, i.e. knows > how to talk to the underlying windowing library underneath, > whether it is X11, Motif, Windows or Mac. This does not exist. > - Clean design, if possible OO. All GUI's have this feature, As Far As I Saw So Far. > - Easy to use, to learn, and well-documented. wxPython and PyQT are best documented. gnome-python is worst documented, so far ;) > - Free software license. PyQT doesn't have this one - the rest has. > - Offers the standard widget toolkit plus some fancy stuff > like grids or plots. wxPython, PyQT or PyGTK. > ... > > Basically, this is (almost) Tcl/Tk. The only problem I have > with Tkinter is that it is truly Python/Tkinter/Tcl/Tk, which > means a whole bunch of software to install before you > actually can get a single widget on screen. On Windows, this is needed for every GUI. On Linux, GTK and QT are most likely already installed. > What happened to Rivet?? I haven't seen Rivet yet. Nor I've looked at STDWIN yet. > Other GUI toolkits are all more or less depending on lower-level > libraries, which make it impossible to distribute a GUI without > requesting the customer to download and install many other > libraries. Not true: most GUI's has a license which permits you to include it in your product. > Sometimes versions don't match, it becomes a nightmare > to export any GUI. Talk about portability: it is Ok to say > that wxPython is portable, but since the underlying code is not > truly the easiest thing to export for the moment, I find it > somewhat hard to declare it "portable" in that respect. > > If there is any project of an OO GUI linking Python through > C-bindings to Motif, X11, Windows and Mac base windowing > libraries, I'd like to hear about it. This has been done for > Tk, why not doing it again for Python? Interesting point. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From pinard at iro.umontreal.ca Tue Feb 22 10:42:19 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 10:42:19 -0500 Subject: functional programming In-Reply-To: Moshe Zadka's message of "Tue, 22 Feb 2000 17:15:59 +0200 (IST)" References: Message-ID: Moshe Zadka ?crit: > Functional programming has a very clear definition: no side effects. If you define functional programming that way, then I agree with you that it would not be easy to make a reasonable Python program without using assignment, ever. Or more precisely, maybe, fully relying on function argument bindings as a way to get rid of assignments. What would be the advantages of using a "functional" Python, as per your definition? I mean, of course, in practice? P.S. - Yes, I know it has been theoretically proven that we could design computers needing no energy, if we could fully avoid side-effects, but I beg to do not consider this a practical advantage yet. :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From paul at prescod.net Wed Feb 9 10:53:03 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 07:53:03 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> Message-ID: <38A18D5F.7CE61061@prescod.net> Thomas Hamelryck wrote: > >... > > Because eyeball retraining can be worth it sometimes. That's something you learn after trying a half dozen or so radically different languages. The average programmer will never come to that recognition. And anyhow, you can get most of the benefits of smalltalk from Python, with a more traditional syntax and most of the benefits of common lisp from Dylan (e.g.) > Besides, it did not stop Perl from becoming extremely popular. Perl 4 was instantly readable to someone who knew C and awk. > I never seriously tried out smalltalk because I could not get a good free smalltalk > implementation, not because of its weird syntax. I still miss a lot of functionality > in Squeak, but if that is added I will certainly give it a go. You can't get a good free smalltalk implementation because not enough programmers want to get involved with the development. That's because of the smalltalk "reinvent the wheel" attitude and its weird syntax. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself The great era of mathematical physics is now over; the 300-year effort to represent the material world in mathematical terms has exhausted itself. The understanding it was to provide is infinitely closer than it was when Isaac Newton wrote in the late seventeenth centruy, but it is still infinitely far away. - The Advent of the Algorithm (pending), by David Berlinski From jhefferon at my-deja.com Fri Feb 18 10:16:40 2000 From: jhefferon at my-deja.com (jhefferon at my-deja.com) Date: Fri, 18 Feb 2000 15:16:40 GMT Subject: Overloading = References: <88htqk$rb5$1@nnrp1.deja.com> Message-ID: <88jnok$2hl$1@nnrp1.deja.com> In article , Michael Hudson wrote: > jhefferon at my-deja.com writes: > > > I have a class, rclass. It has an attribute value. Can I arrange > > so that the string > > r1=r2 > > sets r1.value to equal r2.value (where r1 and r2 are class instances, > > of course) without changing anything else about r1? > > No. Assignment rebinds references, rather than affecting objects. This > is quite a difference from C++ (say), probably one of the harder ones > to get one's head around. > > > > > And if so, can I also have r1=7 set r1.value to be 7? > > > Hmm... do you know about the "exec in globals,locals" style of > doing things? Though `exec'ing user input sounds deeply unwise to me. > What is it you are trying to do? Maybe we can come up with a better > solution (no promises though). Thanks. I *am* reluctant to allow students to accidently exec something that erases all files, or something. I am simulating a computer. It is made up of registers and each register (memory or CPU) may have more than one attribute (for instance, whether to print it out in binary or hex, or how many times it has been referenced in this program, or what source line compiled to this register, etc.). That's why each register is a class instance rather than a simple variable. I want to have the obvious GUI, that allows a person to scroll through memory, for instance. I also want to allow them to do things like set a register `rA=7' or `rA=memory[52]'. In the register class I can use __setattr__ to let me write either `rA.value=7' or `rA.value=memory[52]', right (I look at the type of the thing on the right and if it is a class instance then I see if, say, memory[52].classtype==``register'')? But I can't eliminate the `.value' on the left? I thought maybe I could mess with the top-level dictionary (I don't know what I mean by that!). Thanks again, Jim Hefferon jim at joshua.smcvt.edu Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Thu Feb 24 16:56:00 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 21:56:00 GMT Subject: Backreference within a character class References: Message-ID: taashlo at sandia.gov wrote: > Using the re module, lets say that I want to match "XIX" but not "XXX" > or "WOW" but not "WWW". In my first attempt I used r"(.)([^\1])\1". > This, of course, did't work because the "\1" in character class isn't > interpreted as a backreference. > > So is it possible to specify a regular expression to match these > patterns? this might work: r"(.)(?!\1).\1" From hinsen at cnrs-orleans.fr Thu Feb 3 05:42:48 2000 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: 03 Feb 2000 11:42:48 +0100 Subject: Accessing a lock object in a C module References: <20000202.16275603@sparky.spkydomain> Message-ID: David Fisher writes: > The struct is at the top of threadmodule.c: > /* Lock objects */ > > typedef struct { > PyObject_HEAD > PyThread_type_lock lock_lock; > } lockobject; Fine, but I don't have access to this from another C module. Of course I could copy the structure to my own code and hope that it will never change in threadmodule, but that's not my preferred solution. -- ------------------------------------------------------------------------------- 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 a.eyre at optichrome.com Tue Feb 1 09:48:02 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 1 Feb 2000 14:48:02 -0000 Subject: Py_InitModule In-Reply-To: <8760ee$u2t$1@nnrp1.deja.com> Message-ID: <000301bf6cc3$571fd630$3acbd9c2@peridot.optichrome.com> > (void)Py_InitModule("modname", methods, modname__doc__); Lose the 3rd param. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From schneiker at jump.net Tue Feb 22 22:32:30 2000 From: schneiker at jump.net (Conrad Schneiker) Date: Tue, 22 Feb 2000 21:32:30 -0600 Subject: Python misconceptions in IBM Ruby article... References: <38B0821D.150AC73A@mincom.com> Message-ID: <88vk85$ht0$1@news.jump.net> Michael Hudson wrote in message news:m3k8jytqw6.fsf at atrus.jesus.cam.ac.uk... > John Farrell writes: > > > Now, I do not propose that this be changed, and I do not claim that > > other languages are better because of this. However I do claim that there > > is a tacked-on feeling about it. > > As I tried to explain in an earlier post , there is not really any > other way to do it, given large gobs of the rest of Python. The language-relative degree of necessity or optimality of a given feature doesn't preclude it from still seeming tacked-on to many people--even to people otherwise favorably inclined towards the language involved. And saying that something feels tacked-on to many people isn't saying that that something isn't useful. Saying that Python OO seems tacked-on is one reason that some people prefer Ruby isn't saying that Python didn't do the right thing in this area given what was done in others. Perl OO stuff seems *really* tacked-on to me (not to mention ugly and un-Perlish), even though AFAIK, "... there is not really any other way to do it, given large gobs of the rest of ..." Perl. But even if this reason were true for Perl, I still wouldn't like its OO any better. Since I need OO, I decided to start learning Ruby instead, even though I recognize the well-demonstrated usefulness of Perl (and even more so of Python) OO stuff. It's a matter of trading off differing personal priorities against differing expected future benefits. But none of this is saying that Python didn't do what was best under the circumstances, or that Python (not to mention some of its modules) isn't still a pretty cool and very worthwhile and presently better documented system for you and others to use, OK? Conrad From sadwolf at chollian.net Tue Feb 15 21:21:47 2000 From: sadwolf at chollian.net (Dong-gweon Oh) Date: Wed, 16 Feb 2000 11:21:47 +0900 Subject: Is there any working example of Python ActiveX control for Internet Explore? Message-ID: <88d1or$2h5$1@news2.kornet.net> Does anybody know where I can find working examples of IE ActiveX Control which is written in Python. Thanks in advance. Dong-gweon Oh From aahz at netcom.com Thu Feb 10 20:17:22 2000 From: aahz at netcom.com (Aahz Maruch) Date: 11 Feb 2000 01:17:22 GMT Subject: Maximum recursion depth References: <38A3424D.30F8BFB6@kpnqwest.no> Message-ID: <87vnv2$r06$1@nntp6.atl.mindspring.net> In article <38A3424D.30F8BFB6 at kpnqwest.no>, Stein M. Eliassen wrote: > >I have reached "maximum recursion depth". >Is it possible to increase this limit? Well, the first question is whether you really need to increase it or whether you've hit a bug in your code. I believe the limit is around 10,000 levels.... -- --- 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 Nostalgia just ain't what it used to be From Gaetan_Corneau at baan.com Mon Feb 21 11:54:25 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Mon, 21 Feb 2000 11:54:25 -0500 Subject: Programming Python (was: breaking the ; habit) Message-ID: <816010E2456BD111A48700805FBBE2EE01C60547@ex-quebec-u1.baan.com> > Programming Python is relative not a good book. I understand your point of view, but I think people are too hard when they judge this book. I learned Python by reading it. And I still use it often because it contains a lot of useful information. I agree that it's not the best book to learn Python, that the organisation is less than optimal, all that, but it's still useful. My two cents, ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Tu l'as trop ?cras?, C?sar, ce Port Salut" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From greg at perceval.be Mon Feb 28 11:36:44 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Mon, 28 Feb 2000 17:36:44 +0100 (CET) Subject: Killin' Newbie question In-Reply-To: <38BAAB63.B3BE12D6@sightreader.com> Message-ID: In reply to the message of Ken Seehof sent on Feb 28 (see below) : thanks for all reply. until-next-"this-looks-like-another-newbie"-question'ly yours :) -- 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 Mon, 28 Feb 2000, Ken Seehof wrote: > Date: Mon, 28 Feb 2000 09:07:47 -0800 > From: Ken Seehof > To: python-list at python.org > Newsgroups: comp.lang.python > Subject: Re: Killin' Newbie question > > Gregoire Welraeds wrote: > > > I can't access the __init__ method outside of the object, so the > > following is disallowed : > > ---- > > class huh(): > > def __init(self): > > [some initialisation] > > > > ough= huh() > > > > [some code] > > > > ough.__init__() > > ---- > > > > Right ? > > The following should be allowed ? > > > > class huh(): > > def __init__(self): > > [some initialisation] > > > > def ReInit(self): > > self.__init__() > > > > ough= huh() > > [some code] > > ough.ReInit() > > > > Do I have to rewrite the __init__ function in the ReInit() or the call to > > the init() function inside the ReInit is enough ? > > Isn't there a better way to do this kind of job, i mean in a OOP point of > > view. > > Since the previous reply answers your first question, I'll talk aboutprogramming > style. I would tend to write a ReInit function since > __init__ really means "called when you create the object". However, > there is nothing illegal about calling __init__ directly. > > class huh: > def __init__(self): > # some one-time initialization code > print "spammity" > self.ReInit() > > def ReInit(self): > # some code > print "spam" > > >>> h = huh() > spammity > spam > >>> h.ReInit() > spam > > The only time __init__ is usually called is from a derived object: > > class what(huh): > def __init__(self): > huh.__init__(self) > # more initialization for what > > > Other little question, what about the following (regarding another remark > > posted before) : > > > > def __init__(this): > > Legal, but don't do that. People will think you are a C programmer :-) Ack! > > > -- > > 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/ > > ------------------------------------------------------------------------------- > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From sabren at manifestation.com Sun Feb 27 13:00:28 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 27 Feb 2000 13:00:28 -0500 (EST) Subject: map, filter, lambda, list comprehensions (was RE: parameter undefined in procedure) In-Reply-To: <000701bf8103$e87c2bc0$172d153f@tim> Message-ID: On Sun, 27 Feb 2000, Tim Peters wrote: > > > > def zip(L1, L2): > > return [(x, y) for x in L1, y in L2] Hey Tim, is this the same as: def zip(L1, L2): retlist = [] if len(L1) > len(L2): longer, shorter = L1, L2 else: longer, shorter = L2, L1 for i in len(shorter): newlist = [L1[i], L2[i]] retlist.append(newlist) if longer == L1: for i in range(len(L2), len(L2) + (len(L2) - len(L1))): newlist = [L1[i], None] retlist.append(newlist) else: for i in range(len(L1), len(L1) + (len(L1) - len(L2))): newlist = [None, L2[i]] retlist.append(newlist) return retlist ??? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From taashlo at sandia.gov Thu Feb 24 17:08:19 2000 From: taashlo at sandia.gov (taashlo at sandia.gov) Date: 24 Feb 2000 15:08:19 -0700 Subject: Backreference within a character class References: Message-ID: "Fredrik Lundh" writes: > taashlo at sandia.gov wrote: > > Using the re module, lets say that I want to match "XIX" but not "XXX" > > or "WOW" but not "WWW". In my first attempt I used r"(.)([^\1])\1". > > This, of course, did't work because the "\1" in character class isn't > > interpreted as a backreference. > > > > So is it possible to specify a regular expression to match these > > patterns? > > this might work: r"(.)(?!\1).\1" > > This works perfectly. Now can somebody point me to where this is documented so that: 1) I can understand what this is doing, and 2) I can learn more about these regex extensions. Thanks, Tad From loewis at informatik.hu-berlin.de Fri Feb 18 12:41:01 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 18 Feb 2000 18:41:01 +0100 Subject: Dopy, Pyro or Fnorb: Examples of use and more References: <38AD2D6A.E68601F3@bibsyst.no> Message-ID: Thomas Weholt writes: > Just wondered if there are any examples, other than the ones in the > packages, of use related to Dopy, Pyro or FnOrb. Not that I know of. There are certainly applications of (some of) those, but the authors of these applications usually don't bother with making them available, as it will be quite domain-specific stuff. For Fnorb, you can also look at the Python CORBA examples in ILU or omniORB; they all work the same. > I especially want to see how huge objects can be transferred between > server and client. Are there any restrictions on this, other than > those lined out in the docs, things that have come up in actual use > of the modules etc. ? Again, I can answer primarily for CORBA: In any of the implementations, you can transfer arbitrary objects whose type can be expressed in IDL, and nothing else. This means you can normally not transfer arbitrary Python objects. I doubt that any of these systems have restrictions on the size of the objects you transfer. > And, if anybody know of any reason to use any package over another, > in terms of stability, speed, features etc. I mean, I don`t want to > create a huge pile of code for something that won`t be updated > anymore. FnOrb is Corba-stuff, and that bothers me. It seems to have > alot of overhead/extra stuff that needs to be done for a project > written in and for Python. Why would I care about Corba if all I > want is to use, send and manipulate Python-objects? I'd be curious as to why you want to send Python objects across the wire in the first place, but that's probably a different topic. Anyway, CORBA's prime advantage is that it is cross-language (and cross-platform), so in a pure Python environment, you don't need it. OTOH, perhaps you really want to send references to objects (instead of the objects themselves). CORBA is very good at passing objects by reference, and then doing remote operation calls. Regards, Martin From thomas at xs4all.net Fri Feb 4 18:09:24 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sat, 5 Feb 2000 00:09:24 +0100 Subject: PMZ - Apache AddHandler definition In-Reply-To: <87fa87$lmh$1@nnrp1.deja.com>; from anthonydelorenzo@my-deja.com on Fri, Feb 04, 2000 at 07:45:12PM +0000 References: <87fa87$lmh$1@nnrp1.deja.com> Message-ID: <20000205000924.A3361@xs4all.nl> On Fri, Feb 04, 2000 at 07:45:12PM +0000, anthonydelorenzo at my-deja.com wrote: > PMZ requires configuring the httpd.conf file for the Apache webserver. > However, someone with normal user priveledges (ie using a web hosting > service) cannot normally change this file. > > My imperfect understanding is that I can override my local settings using an > .htaccess file. Do I put this in my user directory, or in my user/www > directory? Your understanding is mostly correct. Almost all configuration settings as found in the global httpd.conf can be altered for a specific directory (and automatically all its subdirectories) by placing a .htaccess file, containing the configuration changes in question, in that directory. This does, however, depend on a global configuration setting ;) Your site admin has to allow overriding for your directory (AllowOverride in the directory/virtualhost block.) Assuming you have the appropriate override permissions, and the site admin did not change the name of the .htaccess file (it's configurable ;) just placing the required config changes in the .htaccess file should be enough. Dont forget to check apache's errorlog if it doesn't work. Most people forget to look there, but it really does contain useful hints on what's wrong. If you suspect one fo the ocnfig options is not allowed in .htaccess, just use the (online) apache reference - it explains each possible option and where and how to place it. but-site-admins-can-be-real-bastards-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From moshez at math.huji.ac.il Wed Feb 16 01:03:15 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 16 Feb 2000 08:03:15 +0200 (IST) Subject: Python sucks loud In-Reply-To: Message-ID: On 15 Feb 2000, William Tanksley wrote: > Pretty much so. Tim keeps on killing people who disagree with him. Please > save us from him by posting more messages in which mindless abuse is > mistaken for humor! I object to that. Tim has never killed anyone who disagreed with him. They just had...ummm...accidents. Yes, that's it, accidents. now-the-psu-does-kill-people-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From moshez at math.huji.ac.il Fri Feb 25 11:55:08 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 18:55:08 +0200 (IST) Subject: setattr and variable names: bug or feature? In-Reply-To: <20000225173314.A19726@stopcontact.palga.uucp> Message-ID: On Fri, 25 Feb 2000, Gerrit Holl wrote: > Dear bottomless information source, > > >>> class Foo: > ... pass > ... > >>> setattr(Foo, '', '') > >>> setattr(Foo, '`', '') > >>> setattr(Foo, '\'', '') > >>> setattr(Foo, '!@#{}\0\0\0', '') > >>> dir(Foo) > ['', '!@#{}\000\000\000', "'", '__doc__', '__module__', '`'] > > Is this a bug or a feature, or None of both? >From the library reference: setattr (object, name, value) This is the counterpart of getattr(). The arguments are an object, a string and an arbitrary value. The string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For example, setattr(x, 'foobar', 123) is equivalent to x.foobar = 123. So, this is a documented feature: nothing says the string should be a Python identifier. One no sane person on earth ever uses, but a documented feature nevertheless. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jingram at intekom.com Fri Feb 4 12:05:02 2000 From: jingram at intekom.com (Johnathan Ingram) Date: Fri, 4 Feb 2000 19:05:02 +0200 Subject: fnorb naming service Message-ID: <001301bf6f31$fa265500$d508a8c0@johnathan.intekom.co.za> Hi Has anybody managed to get fnorb clients to work with another naming service other than the one that comes with fnorb. I am only able to use the fnorb with its own naming service and not with any other orbs naming service. Is this a bug and if so, do you guys have some sort of work around. Thanks Johnathan Ingram Applications Developer Intekom Pty (Ltd) Telephone: +27 11 266-7800 Fax:+27 11 315-0707 The information in this email and in any attachments is confidential and intended solely for the attention and use of the named addressee(s). This information may be subject to attorney and client or other privilege. It must not be disclosed to any person without Intekom's permission. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thantos at chancel.org Wed Feb 2 23:41:41 2000 From: thantos at chancel.org (Alexander Williams) Date: Thu, 03 Feb 2000 04:41:41 GMT Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: On Wed, 02 Feb 2000 20:22:04 -0800, James Logajan wrote: >The vast majority of code (and programming languages) in the world require >explicit memory de-allocation. I don't believe that a GC scheme has yet been >invented that will work well for all problem domains. I'm sure if it had, >we'd all be using it by now. ;) Once upon a time, the vast majority of programming languages used explicit register allocation at the Assembly level, but then C was introduced. Strangely, however, it was not /immediately/ taken up as the Holy Grail, it took time to insiduously spread. -- Alexander Williams (thantos at gw.total-web.net) | In the End, "Join the secret struggle for the soul of the world." | Oblivion Nobilis, a new Kind of RPG | Always http://www.chancel.org | Wins From rpm1deleteme at frontiernet.net Fri Feb 11 21:06:20 2000 From: rpm1deleteme at frontiernet.net (RPM1) Date: Fri, 11 Feb 2000 21:06:20 -0500 Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> Message-ID: <882fld$6t08$1@node17.cwnet.frontiernet.net> Try, http://www.pythonware.com/downloads.htm It's an EXE but it extracts even if you don't have privileges. It's version 1.5.1. Hope this helps, Patrick Mullhaupt J.C.Travers wrote in message <38A455B2.EEBFE3C7 at durham.ac.uk>... >Is there anywhere I can download binaries for WinNT as a zip archive >other than a self-extracting one. This is really anoying me. I need >python on my user area at uni, but haven't got privaleges to extract the >self-extracting archive. At the moment I'm using python1.4b3 as it has >so far been the only winNT binaries I have found in a zip file. > >Cheers, > >John Travers From python at channel21.com Sat Feb 26 17:24:16 2000 From: python at channel21.com (Channel21 Python Team) Date: Sat, 26 Feb 2000 17:24:16 -0500 Subject: More IIS crashing and blank .asp pages Message-ID: <81DD38F43381D111BA3E00A076A0998A459F6D@XENON> so, knowing that I have a multiprocessor PC, do I install 128? > ---------- > From: Mark Hammond[SMTP:mhammond at skippinet.com.au] > Sent: Saturday, February 26, 2000 4:31 PM > To: python-list at python.org > Subject: Re: More IIS crashing and blank .asp pages > > "Channel21 Python Team" wrote in message > news:81DD38F43381D111BA3E00A076A0998A459F5E at XENON... > > I tried once deleting all the .pyc files, but that only made the > server keep > > crashing, so I had to reinstall python > > (guess I was overaggressive in my deletions... > > That particular problem should be gone in 128 - in 125 and earlier > there was a dead-lock problem when Python was being initialized via > COM. This could cause ASP and MTS to hang on startup, especially when > creating .pyc files. > > This is different to the problem Guido was talking about... > > Mark. > > > > -- > http://www.python.org/mailman/listinfo/python-list > From aa8vb at -nojunk-ipass.net Sat Feb 19 08:43:12 2000 From: aa8vb at -nojunk-ipass.net (Randall Hopper) Date: Sat, 19 Feb 2000 13:43:12 GMT Subject: [Q] Python and 3D tools References: <88m003$1dani$1@fu-berlin.de> Message-ID: Jo?o Neto wrote: | |Does anybody know if Python is used together with |some 3D Engine? What kind of engine? Game? SciVis? Here's a list from the past: - PyOpenGL (OpenGL for Python) - Togl (OpenGL widget for Tk/Tkinter) - FOX - GUI Toolkit; GLViewer widget (quatern rot, picking, lighting, - etc.). http://www.cfdrc.com/FOX/fox.html http://home.HiWAAY.net/~johnson2/FXPy/ - CrystalSpace - Free LDPL 3D game engine; has Python scripting http://crystal.linuxgames.com - VTK - http://www.kitware.com/vtk.html - JPython - Access to Java 3D APIs including Magician and Java3D - Quark Army Knife - scripting environment with 3D display. The 3D - PyRPG - Role-playing engine (early) with 3D rendering of a maze http://www.onthenet.com.au/~briblack/pyrpg/ - Blender - modeler - Magiclight - modeler; http://home.bip.net/mikael_aronsson/ - TrueSpace 4.0 - uses Python for scripting - Renderman - Python bindings http://reality.sgi.com/newquist_engr/snakeman/ http://www.lysator.liu.se/~ture/terry.html - Pretty Poly 3D Modeller - free 3D modeller for Linux http://prettypoly.sourceforge.net/ - wxPython GLCanvas (MSW-only!) - Alice (Direct3D-based rendering/animation); www.alice.org - Cortona VRML control's automation interface (Win32) - Python can run -- Randall Hopper aa8vb at -nojunk-ipass.net From scarblac-spamtrap at pino.selwerd.nl Tue Feb 1 12:00:31 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 1 Feb 2000 17:00:31 GMT Subject: Tuples Message-ID: I was making some functions for a chess program earlier. For a few minutes, the idea was to represent the board by a 64-tuple. But that's not very smart, is it? Given 64-tuple x, is there an easy way to get the tuple with values x[6] and x[21] swapped, for instance? Apart from a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2, \ a3,b3,c3,d3,e3,f3,g3,h3,a4,b4,c4,d4,e4,f4,g4,h4, \ a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,e6,f6,g6,h6, \ a7,b7,c7,d7,e7,f7,g7,h7,a8,b8,c8,d8,e8,f8,g8,h8 = x x = (a1,b1,c1,d1,e1,f1,f3,h1,a2,b2,c2,d2,e2,f2,g2,h2, a3,b3,c3,d3,e3,g1,g3,h3,a4,b4,c4,d4,e4,f4,g4,h4, a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,e6,f6,g6,h6, a7,b7,c7,d7,e7,f7,g7,h7,a8,b8,c8,d8,e8,f8,g8,h8) Or even x = (x[0],x[1],x[2],x[3],x[4]..... etc Tuples are immutable, but are there any nice builtin functions that return new tuples, say with one element changed, or something like that? My boards are lists now. -- Remco Gerlich, scarblac at pino.selwerd.nl 5:57pm up 70 days, 1 min, 4 users, load average: 0.17, 0.04, 0.01 From andre at beta.telenordia.se Sat Feb 12 05:52:12 2000 From: andre at beta.telenordia.se (André Dahlqvist) Date: Sat, 12 Feb 2000 11:52:12 +0100 Subject: Using sockets or telnetlib to finger? Message-ID: <883e1e$f3v$1@zingo.tninet.se> Hello I am working on my first Python program, which will be used to finger a server that reports the latest stable, development and pre-patch version of the Linux kernel. I have come up with two different solutions on how to finger the host, and since I'm new to Python I am not sure which of these approaches is preferred. My first attempt was to use sockets since that was what the finger demo that came with Python used: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(HOST, PORT) sock.send('\n') while 1: kernel_info = sock.recv(1024) if not kernel_info: break This solution seams to do the trick, but so does my next approach which uses telnetlib to telnet in to the finger port: telnet = telnetlib.Telnet(HOST, PORT) telnet.write('\n') kernel_info = telnet.read_all() telnet.close() I myself prefer the telnetlib solution as it seams less "low-level", but since I'm just starting out with Python I would like to hear what you guys have to say about it. Whatever approach I use I then need to grab the three version numbers from the finger output that I have collected. The finger output will look like this, where only the version numbers change: [zeus.kernel.org] The latest stable version of the Linux kernel is: 2.2.14 The latest beta version of the Linux kernel is: 2.3.43 The latest prepatch (alpha) version *appears* to be: 2.3.44-8 I need to access the version numbers alone, since I want to translate the rest of the text. To do this I have used what I think is an ugly method. What I do is that I split the string that contains this information with string.split(), and then access the version numbers directly in the resulting list using kernel_info[9], kernel_info[19] and kernel_info[28]. It seams quiet safe to do it like this since the text, apart from the version numbers, pretty much never changes, but is there perhaps a equally simple solution that is less ugly? Could regular expressions do the trick here, and if so can someone perhaps give an example of how I would use them in this situation? Regards Andr? =================================================================== Andr? Dahlqvist GnuPG Key ID: 0x70A2994A Fingerprint: E947 3297 331C CA30 5B88 EDF2 A830 3EBE 70A2 994A =================================================================== From herzog at online.de Sun Feb 13 16:45:31 2000 From: herzog at online.de (Bernhard Herzog) Date: 13 Feb 2000 22:45:31 +0100 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <86ya8szq90.fsf@g.local> <1e5wxbt.bq9v2nqzwbxuN%bparsia@email.unc.edu> <886t16$kbp$1@nntp6.atl.mindspring.net> Message-ID: aahz at netcom.com (Aahz Maruch) writes: > In article <1e5wxbt.bq9v2nqzwbxuN%bparsia at email.unc.edu>, > Bijan Parsia wrote: > > > >Here's are some whimper inducing things for me: > > No class methods > > No super > > Yeah, I've been able to work around these, but they're somewhat > annoying. Note that I believe that Smalltalk has only single > inheritance, so adopting super may be a bit difficult in Python. It seems to me that deciding what super should do is quite straightforward in Python. Given e.g. class Xyzzy(Spot, The, Looney): def walk_silly(self): super() Then super would evaluate to whatever Xyzzy.walk_silly would evaluate to if walk_silly weren't an attribute of Xyzzy. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From aahz at netcom.com Sun Feb 6 17:10:21 2000 From: aahz at netcom.com (Aahz Maruch) Date: 6 Feb 2000 22:10:21 GMT Subject: Vaults of Parnassus problem References: <3899A4F3.76F8FD8A@hotmail.com> <87ca7j$ela$1@nntp3.atl.mindspring.net> <87gker$2d44$1@news.tht.net> <87ha5m$5nq$1@news.tht.net> Message-ID: <87krgd$86u$1@nntp9.atl.mindspring.net> In article <87ha5m$5nq$1 at news.tht.net>, D'Arcy J.M. Cain wrote: > >As for the "honking" part, it is now a Pentium III 500 MgHz system with >128MB of RAM and 27GB of ultra-wide SCSI disk. I'm not sure how honking >people think that is but considering that it's mainly just a web server >and it is replacing a Pentium 120 with a small IDE and 32 MB RAM, I think >it can be considered a significant upgrade. Ah, you just upgraded your web server from "tiny" to "small". ;-) -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From hnowak at cuci.nl Thu Feb 24 01:43:16 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Thu, 24 Feb 2000 07:43:16 +0100 Subject: A question from a total newbie In-Reply-To: <89263v$sau$1@nnrp1.deja.com> Message-ID: <200002240643.HAA05693@dionysus.fw.cuci.nl> On 24 Feb 00, at 2:47, Lisa wrote: > Hi ! I am a total newbie to python, although I had a little programming > experience in Pascal, Fortran and PL/1. > > I would firstly want to apologize if this is not the place to ask my > questions, and I would be very grateful if you can point out to me where > to ask, if this is not the place to ask. Thanks in advance. > > Here are my question: > > Since I am a total newbie in python, where should I start? Try http://www.python.org (as others have pointed out already), check out the doc section and the tutorial. The standard library is important too as soon as you know a bit more. > I am thinking of starting on DOS level, without any cumbersome > layers on windows. Do you recommend that? Depends what you mean by 'DOS level'. If you indeed mean a DOS prompt, well, that's a good way to start; a good text editor and/or DOS shell enchancement/replacement (4DOS, bash) may come in handy. Myself, I often write scripts and programs in vi, then execute them from the command line. If you mean Python in interactive mode (which is also similar to a shell), you can use either DOS (simply start Python) or Windows (IDLE). Interactive mode is a great way to try out things and learn new aspects of the language. > If so, where can I get python that runs on DOS? If you really want a pure DOS one, I happen to have one at http://www.cuci.nl/~hnowak/newsite/Python/Python-DX/python-dx.html (look for Python-DX). (This site will probably disappear soon, so don't wait too long.) If you use DOS via Windows rather than an older DOS system (6.x or lower), it might be better to use the Windows version instead; it can be used from the command line too, and soon you'll want the Windows stuff anyway. :o) > And what else do I need? What is TCK or whatever it is I saw on > www.python.org? I am not sure about those things, I hope if someone here > can give me a pointer or two. Tcl/Tk is a GUI toolkit for Python. Doesn't work under DOS (assuming you still want that), by the way. See http://www.pythonware.com for more info. > Books, which are the books for newbies that you recommend? There are so > many books out there I do not know which ones are good. "Programming Python" by Mark Lutz has had some bad press lately, but I still think it's a neat book. There's also "Learning Python" which might be more worthwile. www.python.org has a section on books BTW... http://www.python.org/psa/bookstore/ > Are there any online tutorials that I can use, while I am selecting > which book to buy? http://www.python.org/doc/current/tut/tut.html > There are many more questions I think I should ask, unfortunately I do not > know what else to ask. If you know what other questions I should ask, I > would appreciate if you can help me ask the right questions. > > Thank you all. > > Please cc: me a copy of your reply so I can be sure to get your advice. Hope this helps, --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From jbauer at rubic.com Wed Feb 9 19:59:45 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Wed, 09 Feb 2000 18:59:45 -0600 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> <38A1F3C0.F9BBC038@prescod.net> Message-ID: <38A20D81.A58F8FC0@rubic.com> Paul Prescod wrote: > What about string.strip and string.rstrip? Those methods are indiscriminate with chopping off whitespace when you want to preserve trailing tabs/spaces (e.g. tab-delimited files). Wait a sec ... didn't we already have a similar discussion last year when you proposed adding a second argument to the string.strip() family? Jeff Bauer Rubicon Research From zelle at wartburg.edu Fri Feb 25 13:02:32 2000 From: zelle at wartburg.edu (John Zelle) Date: Fri, 25 Feb 2000 12:02:32 -0600 Subject: Passing arguments by value... References: Message-ID: <38B6C3B8.5BB0EB96@wartburg.edu> Actually, parameters _are_ passed by value in Python. However, as you discovered, variables are actually just references to objects. Technically, the reference is being passed by value. Probably the solution to your problem is to copy the object. Check out the copy module. John Zelle zelle at wartburg.edu "John F. Brainard" wrote: > > I'm working on a set of HTML Layout classes for CGI programming > in Python and have stumbled upon a small problem... > > The sample code below should be self explanitory... > > #begin python code > html = body.Body() > > font1 = tags.Font(4, "Arial", "#FF0000") > font1.addText(string.strip(""" > Some text would go in here. > """)) > > html.addElement(font) > > font1.clearText() > font1.addText(string.strip(""" > Some other text here. > """)) > > print "" + str(html) + "" > #end python code > > After I create the font1 object and set it's properties, I add it > to the html object. Then, I change the text and add it again to > the html object. What I get as the output is... > > #Begin HTML here > > > > Some other text here. > > > > Some other text here. > > > #End HTML here > > Is there a way to copy the font object or pass it by value rather > than reference to the addElement() function? > > Thank you, > > John F. Brainard Jr. > johnbrainard at stny.rr.com From rdudfield at my-deja.com Mon Feb 21 13:39:49 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Mon, 21 Feb 2000 18:39:49 GMT Subject: [Q] Python and 3D tools References: <88m003$1dani$1@fu-berlin.de> <88mvf2$9e9$1@news.udel.edu> <88rh2i$3ko$1@serv1.iunet.it> Message-ID: <88s0pk$f50$1@nnrp1.deja.com> In article <88rh2i$3ko$1 at serv1.iunet.it>, "Maurizio Turatti" wrote: > > "Jo?o Neto" wrote in message > > news:88m003$1dani$1 at fu-berlin.de... > > Hi > > > > Does anybody know if Python is used together with > > some 3D Engine? > > > > VTK (http://www.kitware.com/vtk.html) has python bindings. > > Crystal Space has the begginings of python bindings. You can use python from within the console, and do a few other things atm. http://crystal.linuxgames.com linux, dos, windows, OS/2, BeOs, MacOS, Solaris, others. Quark the quake level editor uses python, so does Blender the 3D modeler/animator. Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From paulb at infercor.no Thu Feb 10 11:24:45 2000 From: paulb at infercor.no (Paul Boddie) Date: Thu, 10 Feb 2000 17:24:45 +0100 Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> Message-ID: <38A2E64D.CB7DA73A@infercor.no> thucdat1143 at my-deja.com wrote: > > Lieber Bernhard, > > You are not happy with Borland's products? Neither am I! > But being a 'Free Software Projects and Consulting', you should be more > Linux-oriented than MSWin-oriented. > All these stuffs (Perl, Tcl, Python) are more home on Unix than MSWin, > and soon their wrapper (Ruby) will make Unix the destiny. > Check this out: www.ruby-lang.org to see what IBM is talking about Ruby. The IBM article [1] is rather amusing. At every point of comparison between Ruby, Python and Perl, examples of Ruby and Perl, but not Python, are given to "demonstrate" Ruby's syntactic superiority. Paul [1] http://www-4.ibm.com/software/developer/library/ruby.html From joe at localhost.localdomain Mon Feb 7 23:02:37 2000 From: joe at localhost.localdomain (joe at localhost.localdomain) Date: Tue, 08 Feb 2000 04:02:37 GMT Subject: arguments from the prompt References: Message-ID: On Sun, 06 Feb 2000 22:57:29 GMT, Fredrik Lundh wrote: >joe at localhost.localdomain wrote: >> how do I write a python script to recive arguments from the >> command prompt? > >you import the sys module, and read up on >sys.argv in the manual? > >(hint: sys.argv contains a list of all command >line arguments passed to the program. argv[0] >is the name of the program itself). > >if you want to parse options in a standard >fashion, you can use the getopt module. see >the docs for details. > > > it says NameError: sys Here is the program I am writing (to cheat on my algebra homework when they want me to make tables of quadratic functions.) I want to be able to type: ./prog a b c min max inc and have it print a pretty table #!/usr/bin/python from sys import argv a=sys.argv[1] b=sys.argv[2] c=sys.argv[3] start=sys.argv[4] end=sys.argv[5] inc=sys.argv[6] x=start for x in range(start,end,inc): y=a*x**2+b*x+c print x,": ",y From gerrit.holl at pobox.com Tue Feb 22 14:52:00 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 20:52:00 +0100 Subject: PROPOSAL: [].__doc__, "".__doc__, ... In-Reply-To: ; from pinard@iro.umontreal.ca on Mon, Feb 21, 2000 at 06:38:19PM -0500 References: <20000220213311.A7023@stopcontact.palga.uucp> Message-ID: <20000222205200.A4493@stopcontact.palga.uucp> > Gerrit Holl writes: > > > I think it would be a nice feature for all types with methods to have > > docstrings describing the methods, so [].__doc__ would be a string with > > the descripion of .index, .append... etc. > > It already works, at least partly: > > >>> print [].append.__doc__ > L.append(object) -- append object to end I know. > Still, `print [].__doc__' raises an exception. I know. That's what I mean :) regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From mikael at isy.liu.se Tue Feb 29 03:17:56 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 29 Feb 2000 09:17:56 +0100 (MET) Subject: A comp.lang.python code snippet archive? In-Reply-To: <200002281844.TAA19752@dionysus.fw.cuci.nl> Message-ID: On 28-Feb-00 Hans Nowak wrote: > I would like to know: > * if it's still worthwile to continue this site > * what kind of improvements I could make (a search engine would be cool but > I don't know much about CGI) This is the first time I've heard about your site. After a brief browsing, I'm pretty sure that it will be of great help to me. I'm very glad that your ambition is to test the code and clean it up. However, it may be a good thing to use some sort of python code detector to filter out candidate messages. Perhaps you already use such an animal. These candidate messages could be included in your archieve under a special section: Untested. Later, these could be tested and cleaned for possible inclusion in appropriate sections. I understand very well that the testing and cleaning process requires a lot of work. I do not volonteer to help, but I think that you do need helping hands. Your site is (or may become) just as valuable to the community as the Python docs, the FAQ, the Vault of Parnassus, et cetera. I-only-miss-your-name-at-the-site-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: 29-Feb-00 Time: 08:55:42 This message was sent by XF-Mail. ----------------------------------------------------------------------- From arnaud at crao.net Tue Feb 29 04:42:13 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Tue, 29 Feb 2000 10:42:13 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: <1260348438-26442187@hypernet.com> Message-ID: In article <1260348438-26442187 at hypernet.com>, gmcm at hypernet.com wrote: > > I need to do some good old > > "SELECT obj1.a,obj2.c FROM obj1,obj2 WHERE obj1.d=obj2.e AND > > obj1.f=value" > > > > Well .... :) > > view1 = db.view('view1') > view2 = db.view('view2') > view2.rename(view2.e, 'd') > v = view1.join(v2, view1.d) > v = v.select(f=value) > for row in v: > print row.a, row.c Thx Gordon. Now MetaKit is working fine and does almost what I want :) I also tried Gadfly which is plenty old SQL but, as far as I try it, less suitable for objects persistence. > A MetaKit row is an object, but not an object of your making. > It can have properties that are ints, strings, doubles, or other > views. So while it's not pickle, it's a whole lot easier to map > object persistence into Metakit than into a conventional > RDBMS. Sure it is ! If MetaKit doesn't yet have an orthogonal persistence model, it seems to be on a good way. Maybe the next step will be a mixed of pickle and MetaKit. I like the MetaKit way to query objects. We're getting close to OQL (maybe I'm wrong with the name ... haven't touch an O2 database for years). > Don't think you'll find anything that meets those requirements > that doesn't consume vast amounts of resources (including > $$, probably). Memory ... gigabytes of memory. But yet, I'm not sure I can find any commercial products to meet my requirements. Actually, I'm trying to set this on a cluster and, as I have very few data modifications (4 times a day) I'm looking toward duplication of the database (data distribution thru LH* or RP* gives me headache) ... But all this is a bit out of topic ;-) Regards, Arnaud From larooy at xtra.co.nz Thu Feb 17 03:56:46 2000 From: larooy at xtra.co.nz (john) Date: Thu, 17 Feb 2000 21:56:46 +1300 Subject: A = X > Y ? X : Y References: Message-ID: <38ABB7CE.9CFEFD4A@xtra.co.nz> a=(x,y)[y>x] Moshe Zadka wrote: > On Sun, 13 Feb 2000, Grant Edwards wrote: > > > On Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen wrote: > > > > >I fear that this question has already been asked, > > > > Yes, it has. > > > > >but is there and > > >equivalant one line command that is equivalant to the C command: > > > > > >a = x > y ? x : y > > > > Possibly. > > > > Generally this question is answered with at least a half-dozen > > or so one-line code examples -- almost all of which somebody > > will claim are wrong in one respect or another. While there > > may exist an equivalent chunk of Python code, the practical > > answer seems to be that there isn't a _good_ (readable and > > obviously correct) way to do this with one line of Python code. > > > > -- > > Grant Edwards grante Yow! I'm in direct contact > > at with many advanced fun > > visi.com CONCEPTS. > > -- > > http://www.python.org/mailman/listinfo/python-list > > > > -- > Moshe Zadka . > INTERNET: Learn what you know. > Share what you don't. From sholden at bellatlantic.net Thu Feb 10 08:56:38 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 10 Feb 2000 13:56:38 GMT Subject: Open script References: <000a01bf73c5$d9b48060$6c00a8c0@ruidovisual.pt> Message-ID: <38A2C3B0.1C5B8849@bellatlantic.net> Pedro: Although, technically, directories are files, the Python file reading utility functions don't have any way of interpreting their contents. Consequently you will get an IOError (in my case, 21, "Is a directory"). Try taking a look at the os library module documentation. You will see it includes various useful bits and pieces. You might find os.listdir especially useful, as it returns a list of the entries in a directory. >>> import os >>> os.listdir("r:/ZipDisks/Text Editors") ['emacs-19_34_6-bin-i386_tar.gz', 'pfe0702i.zip', 'UltraEdit32.zip', 'cooledit-3_12_0_tar.tar', 'vim-5_5-src_tar.tar'] >>> Good luck. Steve > Pedro Silva wrote: > > Hi, > > I'm trying to use OPEN to open a folder, because I need to get the content of > that folder. > This folder is in the filesystem. > > The code line that I'm using is: > > f = open('var/spool/news/articles','r') > fs = f.realines() ???? f.readlines() ????? > return fs > > But this is giving me and error. Is this correct or because articles is a > folder and is because of that that the error is displayed. > > Please send me your answers to: psilva at ruido-visual.pt > > Thanks, > > Pedro -- "If computing ever stops being fun, I'll stop doing it" From tim_one at email.msn.com Wed Feb 16 00:55:23 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 00:55:23 -0500 Subject: Iterators & generators & coroutines In-Reply-To: <88cg9r$10t$1@nntp9.atl.mindspring.net> Message-ID: <001001bf7842$69f37200$b7a0143f@tim> [Aahz Maruch, on ways to "spell" generators] > ... > Because now you either have the for construct implicitly create a new > generator frame or you cannot do > > b = BinTree() > for node in b.traverser(): > for node in b.traverser(): > > I would much rather create the generator frames explicitly as in the > following (I'm now assuming my later idea that a call to a generator > creates a generator frame that can be used like a function) > > b = BinTree() > g1 = b.traverser() > for node in g1(): > g2 = b.traverser() > for node in g2(): > > It just seems more Pythonic to me. It's certainly Pythonic to expose the machinery, but also Pythonic to provide some sugar for the most common cases. This need not be an either/or argument. Python currently hides the generation of the "loop index" that supports the __getitem__ protocol, and that it *didn't* expose the machinery there leads to clumsiness like the common (& excessively novel): for i in range(len(sequence)): idiom. The bulk of for loops don't need the loop index, though, and we're all delighted to use the simpler for thing in sequence: when we can (and that still generates the integers in range(len(sequence)), but all under the covers). I expect generators would be very similar in practice. less-typing-or-more-power-is-a-nice-choice-to-offer-ly y'rs - tim From embed at geocities.com Mon Feb 14 10:30:32 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 14 Feb 2000 10:30:32 -0500 Subject: Off Topic Posts References: <20000212103916.A1007@stopcontact.palga.uucp> Message-ID: > > I agree it would be split, but a charter "language options and comments" > would be too small, I think. What about a list/newsgroup for general, > non-technical discussion? The future of Python could also be discussed > there, and people who think Python sucks loud could post there instead > of here :) > You expect people who are inconsiderate to observe these finer points of ettiquette? Just ignore the jerks. Warren From jjlucsy at concentric.net Wed Feb 23 11:40:58 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Wed, 23 Feb 2000 11:40:58 -0500 Subject: Which GUI? References: <88jg9f$ssd$1@nnrp1.deja.com> <38b3df23.76266295@news.oh.verio.com> Message-ID: <64Us4.2790$w7.153521@news1.usenetserver.com> Just so you're aware, I'm writing by hand my own wrapper around FLTK. Currently I'm just exposing the classes I need to get my project completed, but I should have a considerable amount finished fairly soon. My implementation is subclassable, but does have a few snags at the present. If you're interested, let me know. I'm currently doing this under Win2K/MSVC6. - Joel Lucsy (jjlucsy at concentric.net) "Kevin Dahlhausen" wrote in message news:38b3df23.76266295 at news.oh.verio.com... > Fast-Light Toolkit meets these. As pointed out, the wrapper doesn't allow you > to subclass arbritary widgets yet. The grid widget is an add-on, and the > wrapper for it is started but not complete. The Python wrappers are over on: > > http://fltk.netpedia.net > From gerrit.holl at pobox.com Thu Feb 10 15:18:49 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 10 Feb 2000 21:18:49 +0100 Subject: will python 3000 break my code? In-Reply-To: <87tnmk$2uo$1@nntp6.atl.mindspring.net>; from aahz@netcom.com on Thu, Feb 10, 2000 at 07:00:36AM +0000 References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <87tnmk$2uo$1@nntp6.atl.mindspring.net> Message-ID: <20000210211849.A8912@stopcontact.palga.uucp> Aahz Maruch wrote on 950162436: > In article <87tkoi$hql$1 at nntp1.atl.mindspring.net>, > Michal Wallace wrote: > > > >Anyone know what, specifically, will not be compatible, and compared to > >what? :) > > Nope. I get the feeling that it will be similar to moving from Perl 4 > to Perl 5. I don't think that's a nice explanation on a Python newsgroup :( regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From te at first.gmd.de Fri Feb 25 07:00:20 2000 From: te at first.gmd.de (Thilo Ernst) Date: Fri, 25 Feb 2000 13:00:20 +0100 Subject: Pythonwin (Version 2 beta 3) Message-ID: <38B66ED4.449139CA@first.gmd.de> > When printing a python source file using pythonwin (I like the > shades of grey) it prints out all but the last page. Same here. (win32all-128 on WinNT4sp4). To be exact, if the script is short enough to fit on one page, that page _is_ printed. Another workaround is to add some sixty or so newlines at the end of the file before printing it. Somewhat tasteless, but easy: hold down the Enter key for about three seconds. (Ah, now I get it. This bug really is a feature. It encourages good one-class-per-file style. Think about it - bad "multipage behaviour" is punished in a _very_ adequate way. We simply need it. At least until a 60 lines-limit makes it into the language so longer scripts get rejected by the parser :-) - Thilo From shippy at cs.nmt.edu Thu Feb 24 11:33:25 2000 From: shippy at cs.nmt.edu (Jeff Shipman) Date: Thu, 24 Feb 2000 09:33:25 -0700 Subject: regular expression References: Message-ID: <38B55D55.EFF16F5E@cs.nmt.edu> In order to grab the groups that you matched with parenthesis, use '\g<#>' where # is the group number. So, in this case, you would use '\g<1>'. That should work. If not, bonk me over the head. =) courtneyb wrote: > How do u return the content between the pre tags? -- +-----------------------------------------------------+ | Jeff "Shippy" Shipman E-Mail: shippy at cs.nmt.edu | | Computer Science Major ICQ: 1786493 | | New Mexico Institute of Mining and Technology | | Homepage: http://www.nmt.edu/~shippy | +-----------------------------------------------------+ From dgrisby at uk.research.att.com Thu Feb 10 06:41:53 2000 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 10 Feb 2000 11:41:53 -0000 Subject: GCOM, was Re: Communicating with MICO References: <3898d8cb@nntp.server.uni-frankfurt.de> <87mb8g$tlr$1@pineapple.uk.research.att.com> Message-ID: <87u861$35t$1@pineapple.uk.research.att.com> In article , Samuel A. Falvo II wrote: [...lots of interesting COMishness...] >So the "sluggishness" that CORBA has amassed a reputation for is not the >fault of the spec, but of the individual ORB and B/POA APIs. However, the >APIs do add an unnecessary layer of complication to the development of any >standards-compliant ORB. And 2.3 just makes things worse. I'm interested in this "sluggishness". Do you have any experience or references to suggest that CORBA is sluggish in comparison to COM? Some CORBA implementations are quite slow (most notably Orbix), but others are not. I've just done a web search, and I can't find _any_ speed comparisons of CORBA and COM; all of the COM/CORBA comparisons use other criteria. There are plenty of performance comparisons between different CORBA ORBs. As for API complexity, I agree that the CORBA APIs are unnecessarily awkward. However, the often-cited paper by Emerald Chung et al. http://www.research.microsoft.com/~ymwang/papers/HTML/DCOMnCORBA/S.html implies that using COM from C++ is far more of a burden. I have no experience of COM programming myself, so I don't know how accurate it is. Anyway, to get back on-topic for the newsgroup, using CORBA from Python cuts out the vast majority of the API ugliness. CORBA lets you do some fundamentally complex things, though, so there is bound to be some complexity in the API. For most things you can do with CORBA, the Python code is extremely simple. I assume the same is true for Python's COM interface. Do you have a reference for GCOM? Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From wolf at one.net Sat Feb 12 15:54:20 2000 From: wolf at one.net (wolf at one.net) Date: Sat, 12 Feb 2000 15:54:20 -0500 Subject: Error in shelve, keys() returns invalid argument...bug? Message-ID: <3ghbas025vshdkbp5o54bjum22ftns5fkg@4ax.com> I'm trying to use the shelve module in Win98SE in Python 1.52, and I can create the shelf just fine, but when I try to get the keys for the shelf it gives me an error. Here's a screen dump: C:\APPS\Thief's Quest>"C:\Program Files\Python\PYTHON.EXE" 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 shelve >>> SavedGame = shelve.open("Test.psg") >>> SavedGame >>> SavedGame.keys >>> SavedGame.keys() Traceback (innermost last): File "", line 1, in ? File "C:\Program Files\Python\Lib\shelve.py", line 55, in keys return self.dict.keys() bsddb.error: (22, 'Invalid argument') >>> Am I doing something wrong? Or does the shelve module need an additional module in Win98 that doesn't come with the base install? Any help would be appreciated! Respectfully, Wolf "The world is my home, it's just that some rooms are draftier than others". -- Wolf From boud at rempt.xs4all.nl Sat Feb 26 04:28:05 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 26 Feb 2000 09:28:05 GMT Subject: 1000 GUI toolkits References: Message-ID: <8986b5$7kn$1@news1.xs4all.nl> Moshe Zadka wrote: > On Fri, 25 Feb 2000, Robin Dunn wrote: >> > But it is interesting: is there a Python module (written in Tkinter of >> > PyGTK or ...) which parses HTML with embedded Python and executes it? >> > Does grail does that? >> >> It's called Zope. > To clarify: I meant client side. >> Actually, wxPython sorta has that ability. GUI objects can be constructed on >> the fly and displayed embedded in the HTML page within a wxHtmlWindow. > I meant that the Python code would be in the HTML page, and would be > compiled to a (say) wxPython (or ...) module which displays a GUI. > After all, HTML has this fancy layout capabilities: all you would need to > do is bind some callbacks... I don't think so - you'd probably have to write an interpreter plugin or something yourself. Robin's idea is sound, though. When I needed a really complex grid layout for Kura, I decided not to try to bend PyQt's grid class to my wishes, but to use a HTML table that was displayed by the khtmlw HTML widget. Of course, when Qt 2 is bound, I'd use the canvas class. -- Boudewijn Rempt | http://www.valdyas.org From darcy at vex.net Sat Feb 5 08:56:06 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 5 Feb 2000 13:56:06 GMT Subject: Vaults of Parnassus problem References: <3899A4F3.76F8FD8A@hotmail.com> <87ca7j$ela$1@nntp3.atl.mindspring.net> <87gker$2d44$1@news.tht.net> Message-ID: <87ha5m$5nq$1@news.tht.net> tim wrote: > aahz at netcom.com (Aahz Maruch) wrote in > <87ca7j$ela$1 at nntp3.atl.mindspring.net>: >>again it works for me. Either there's a regular transient problem >>at vex.net or there's some weird network problem. > There have been a few "transient" (as Aahz says) problems this week, but none > "regular" (as far as i have seen), and generally not lasting too long at any > one time. So if you have a problem, do try to stay calm as possible, and try > back again in a little while. (-: > As of today the vex.net web server is on a big "honking" (as D'Arcy says) new > machine. Heh. This may help, too. So far it looks to be working well! There are still a few things left to do. The systems still depend on each other to some extent. Soon the web server will be completely self sufficient and will run whether the shell server is up or not. That means that the next time some user process takes down our shell machine that the web server will continue to run. As for the "honking" part, it is now a Pentium III 500 MgHz system with 128MB of RAM and 27GB of ultra-wide SCSI disk. I'm not sure how honking people think that is but considering that it's mainly just a web server and it is replacing a Pentium 120 with a small IDE and 32 MB RAM, I think it can be considered a significant upgrade. -- 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 JGRAVES3 at austin.rr.com Wed Feb 23 08:55:03 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Wed, 23 Feb 2000 13:55:03 GMT Subject: Porting Python to non-pc platforms References: <731E80062E7A91F28525688D0074EC5C.0074F3D08525688D@ttm.com> <38B2FF71.1D7A677D@ttm.com> <38B36868.6CB9B73E@bellatlantic.net> Message-ID: Steve Holden wrote in message <38B36868.6CB9B73E at bellatlantic.net>... >Perhaps a Python-to-RPG translator might help? :-) >regards > Steve No! H*ll No! even. I want to move toward Python not away from it! (-: That being said, I'm considering writing a simple RPG/DDS generator in Python just because I think it would be fun. I had started designing one to be implemented in Java a year ago or so but didn't have the time to finish it. But now that I've found Python I'll probably use it or JPython for my design. Jay From foof at eyeofdog.com Fri Feb 18 00:20:28 2000 From: foof at eyeofdog.com (Alex Shinn) Date: 18 Feb 2000 00:20:28 -0500 Subject: name-spaces and loading a file Message-ID: <8766vn2ijn.fsf@curious.eyeofdog.com> I'm new to Python and having trouble figuring out how to load a file. Not importing a module, but just exec'ing a file within the current context. I'm working on an interactive story engine with the primary purpose of making it easy for non-programmers to write story modules. A story would be comprised of a collection of files, each describing a scene, like the following: title = "Passages" background = "passages.png" text = "You are in a maze of twisty passages, all alike." option("Keep going", "passages") option("Turn back", "cave_entrance") so when you chose a scene, such as cave_entrance, it would load the file with that name. Right now I'm using the following hack exec 'from scenes.' + scene + ' import *' but this doesn't give you access to the global story variables from within the scene, and anything set in the scene has to be referenced with exec 'scene.' + var which only works for variables known by the main engine ahead of time... it doesn't let the story author declare a new global in one scene to be accessed by other scenes. Plus there are other quirks like having to use reload when going back to an old scene. Am I missing something simple, or is there no way to just load a file? -- Alex Shinn From embed at geocities.com Tue Feb 15 11:06:32 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 15 Feb 2000 11:06:32 -0500 Subject: BSDDB Pack function? References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: > approximately 3 times faster using your bsddb. Well it finished running in under an hour, whereas the stock python bsddb library took over four hours to finish. However, at the end, when I had deleted around 150,000 rows from the table, leaving 25,000 rows, the file itself had not "shrunk" at all and was still over 200 mb. This is okay, since it's rare that you'd really want to deallocate the disk space, since it's just going to get used again next time you add more records, however a "pack" function (like we had for dbf files) would be nice. Is there one or must I export the file to flat ASCII, and re-create a file to pack it down when much data is deleted? Warren Postma From bittneph at aston.ac.uk Thu Feb 10 18:47:10 2000 From: bittneph at aston.ac.uk (Peter Bittner) Date: Thu, 10 Feb 2000 23:47:10 +0000 Subject: How to get rid of the space after 'print',? Message-ID: <38A34DFE.7B286DD@aston.ac.uk> Hi there! I'm writing HTML-code with the print statement as follows: print '' print '
Author:', # ,= no newline here print '' # or put a function call here... Between and I want _no_ space, but Python automatically inserts one. - How can I force Python not to do this?? Please, e-mail! Kipis! # I don't know the Nederlands' "cheers", sorry! :o) Peter | Peter H. Bittner | International Student at Aston University | e-mail: bittneph at aston.ac.uk | web: http://beam.to/bimbo +-------------------------- From embed at geocities.com Thu Feb 24 10:03:41 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 24 Feb 2000 10:03:41 -0500 Subject: how would Dan Quayle spell python? References: Message-ID: > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. # misspell.py Y = [ 'Y', 'IE', 'AE', 'IEA', 'IEAY', 'IY', 'HIY', 'HAEY', 'HAIEU', 'AIE', 'HY', 'HYHY' ] O = [ 'O', 'AW', 'AEW', 'oW', 'AWY' ] for y in Y: for o in O: print 'P'+y+'TH'+o+'N ', From kc5tja at garnet.armored.net Thu Feb 17 15:30:59 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 17 Feb 2000 20:30:59 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: Message-ID: >Oh, continuations *cannot* be simulated by threads. (Coroutines can be OK, that's informative. So much for the differences between threads and continuations. But I'm still left wondering just what the heck continuations are. :) -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From embed at geocities.com Wed Feb 23 13:10:47 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 23 Feb 2000 13:10:47 -0500 Subject: Installing on Win 2K? References: <89129k$1iv$1@nnrp1.deja.com> Message-ID: Works fine for me. You say you're logging on as administrator so you should have permissions for the machine. Try logging on NOT as administrator. I just logged in with my normal user account. I have been using Python on W2K for a month or two and it has no problems that I can see. Warren From pinard at iro.umontreal.ca Wed Feb 16 13:59:49 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 16 Feb 2000 13:59:49 -0500 Subject: PROPOSAL: fix tabs & spaces in default library In-Reply-To: Gerrit Holl's message of "Sun, 13 Feb 2000 20:18:12 +0100" References: <20000213201812.A4849@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > in the default library reference, almost all modules are indented with > four spaces, but not all. What about running a script on it so they are > all indented four spaces? Also, by the way, I would suggest that the Python distribution tries better to comply with Guido's coding standards for white space within lines. To make a complete picture of what I would like for each and every line of code: * four spaces per indent on the left, * no space before function opening parenthesis in the middle, * no spurious space at all, ever, on the right :-). Guido does not agree that the third point is important, yet I think that it is clearly mandated by perfection! What else for us, anyway! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bjorn at roguewave.com Tue Feb 22 13:25:32 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 22 Feb 2000 11:25:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <000401bf7d07$59acc080$e82d153f@tim> Message-ID: <38B2D49C.F18B47CC@roguewave.com> Tim Peters wrote: > [Greg Ewing] > > Oh, no, nooo, nooooooo... > > > > Is there time to stop this madness? > > Doubt it. It was debated at length before Barry implemented it. Write it > this way instead, and it reads beautifully & naturally: > > tab = "\t"; space = " "; nospace = "" > > tab.join(list_of_strings) > space.join(ditto) > nospace.join(user_sequence) > > That is, you don't *have* to use a character literal (which indeed "looks > funny", although less and less so the longer the string). > > > ... > > Whatever you do, don't stuff it onto some arbitrary > > type just for the sake of making it a method. > > It's not arbitrary. The essence of the current string.join is the string > used as glue; indeed, that's why join has been in the string module all > along. I must respectfully disagree. When doing OO design, the fundamental question is "if I want to do 'foo', to what am I doing 'foo'?"... In this case "if I want to 'join', what am I 'joining'?", the answer is that you're joining a sequence type. Thus, IMHO it the natural (and extensible to user types) way to do it would be: [1,2,3].join() (1,2,3).join(' ') if you think of another domain, say a gui with a textarea this might become clearer. Nobody would want to write: "foo bar".put(textarea) since the "right" way to do it would be: textarea.put("foo bar") Besides has anyone even considered " ".join(myUserListDerivedClass)? How about " ".join(myTreeThatHasLinear__getitem__)? Just my 2% of $1. -- bjorn From pinard at iro.umontreal.ca Sun Feb 20 14:35:34 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 20 Feb 2000 14:35:34 -0500 Subject: ANNOUNCE: Phyton-Compiler In-Reply-To: Andreas Otto's message of "Sun, 20 Feb 2000 19:25:39 +0100" References: <38B031A3.80A4B0A1@t-online.de> Message-ID: Andreas Otto writes: > Technology Startup!! Orthographical Endup!! I presume that if you used Python at least once, you would know how to spell it :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From daryl_stultz at my-deja.com Thu Feb 10 13:56:10 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Thu, 10 Feb 2000 18:56:10 GMT Subject: Redirect DOS command output References: <87ura9$ib0$1@nnrp1.deja.com> Message-ID: <87v1k7$nct$1@nnrp1.deja.com> In article <87ura9$ib0$1 at nnrp1.deja.com>, daryl_stultz at my-deja.com wrote: > Hey, I'm using os.system() to execute a DOS command (on an NT machine). After doing some more research, I came across win32pipe.popen() and that did the trick. ******* import win32pipe output = win32pipe.popen("dir", "r") print output.read() ******* Just out of curiosity, is there a cross platform way to do the above? Maybe using os.pipe ? thanks Sent via Deja.com http://www.deja.com/ Before you buy. From phd at phd.russ.ru Tue Feb 15 05:09:24 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 15 Feb 2000 10:09:24 +0000 (GMT) Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: <00bd01bf7707$afff8c20$34aab5d4@hagrid> Message-ID: On Mon, 14 Feb 2000, Fredrik Lundh wrote: > > > if you prefer to use free and IMHO better data- > > > base engines, check out metakit (www.equi4.com) > > > or gadfly (www.chordate.com). > > > > Any information on what ways these are "better" than Berkeley DB? Any > > pointers, at least? > > humbly speaking: > > metakit: fast, efficient, small, highly portable, > great python interface, and free. Hm, portable? Well, exerpt from README: ---------- * Solaris 2.6 / gcc 2.8.1 The Solaris builds are nasty for several reasons: - I do not own such a machine, and often have to make arrangements (or fight limited space on one of the machines I can telnet to). - The gcc 2.8.1 optimizer appears to be buggy, I have had to turn off the default "-O3" flag to prevent compiler crashes (several files). - Locking on Solaris (especially w.r.t NFS) remains a mystery to me. The Tcl and Python extensions both use locking (the core not yet). See tcl/Mk4tcl.cpp around line 520, and python/PyStorage.cpp around line 80 for details. It's all pretty messy, and not 100% correct. Despite this, I'm doing my best to resolve these issues. Having a solid build of the core *and* of Tcl / Python extensions is quite important. * Other Unix systems No notes yet, more details expected when the new release is tried on other Unix systems. ---------- I cannot consider it "portable". Oh, yes, I have exactly 2.8.1, even worse, on Solaris 2.5.1. No other program reveals bugs in 2.8.1. Thanks. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From paul at prescod.net Wed Feb 9 14:44:26 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 11:44:26 -0800 Subject: Interoperable smalltalk implementation References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> <38A18D5F.7CE61061@prescod.net> <1e5qk7x.1oib1uavroxupN%bparsia@email.unc.edu> Message-ID: <38A1C39A.5FFFB809@prescod.net> Bijan Parsia wrote: > > ... > > There are several excellent free (in various senses) Smalltalks. There > are some Smalltalks that integrate better than others. Some people > *want* a "single world" approach, and some smalltalks accomodate them. Okay, in this case I would be happy to be wrong. I would love to find out that modern Smalltalks are more interoperable than the last time I investigated. Which implementation (and extension libraries) should I download to write plain vanilla CGIs and which should I get to write GUI Windows programs? I won't demand that they be the same implementation, but I need good text processing (at least regexps) in both environments. I would be very happy if the language dialects they supported was close enough that an XML parser written in one would work in the other. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From herzog at online.de Wed Feb 16 10:59:32 2000 From: herzog at online.de (Bernhard Herzog) Date: 16 Feb 2000 16:59:32 +0100 Subject: Moving from perl to python: questions References: <816010E2456BD111A48700805FBBE2EE01C60501@ex-quebec-u1.baan.com> Message-ID: Gaetan Corneau writes: > You can simplify "chomp", too: Well, there are at two bugs in this implementation: > # I didn't try it, but it should work :) > def chomp(lines): > "remove the end of line markers from array" > import os > nl_len = len(os.linesep) # length of os dependent line seperator os.linesep is irrelevant here. The line separator will always be '\n'. The underlying C-library takes care of translating whatever platform specific convention is used into newlines if you opened the file in text mode (the default). If the lines were read from a file in binary mode you might get problems with readline (or readlines) because they only recognise '\n' as the line separator and therefore won't work correctly with e.g. Mac-textfiles. > for i in range(0, len(lines)): > lines[i] = lines[i][:-nl_len] The last line may not end in a newline. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From phoss at attglobal.net Fri Feb 25 17:57:31 2000 From: phoss at attglobal.net (phoss at attglobal.net) Date: Fri, 25 Feb 2000 22:57:31 GMT Subject: Applet Troubles with JPython and Classpath Message-ID: <8971cp$dnp$1@nnrp1.deja.com> I'm having a problem with getting applets to run with JPython when the jypthon.jar file is listed in the classpath. If I comment out that part of the classpath, they work fine. This implies that they download the jar-file when it is not present locally from the classpath. Sent via Deja.com http://www.deja.com/ Before you buy. From craigf at ilid.com.au Thu Feb 10 15:51:59 2000 From: craigf at ilid.com.au (Craig Findlay) Date: Fri, 11 Feb 2000 07:51:59 +1100 Subject: Using class data attributes References: <2l94ass5kdbgkaep64k9rl14m14dojc2vd@4ax.com> <14498.12166.309708.334072@beluga.mojam.com> Message-ID: <0596assu91lkohbm887fv52uf7rn9dfsni@4ax.com> Thanks Skip, those methods seem to be exactly what I was looking for. Craig Skip Montanaro wrote: > > Craig> I would like to be able to read and write data attributes as in > Craig> Delphi and automatically invoke functions. > >Take a look at the special methods __getattr__ and __setattr__. They should >provide the hooks you need to accomplish what you want. For details, check >the reference manual section on customizing attribute access: > > http://www.python.org/doc/ref/attribute-access.html > >__getattr__ is only called if normal attribute lookup >fails. If defined, __setattr__ is always called, even if the attribute in >question already exists. > >Skip Montanaro | http://www.mojam.com/ >skip at mojam.com | http://www.musi-cal.com/ >"Languages that change by catering to the tastes of non-users tend not to do >so well." - Doug Landauer From python at channel21.com Thu Feb 24 09:55:27 2000 From: python at channel21.com (python) Date: Thu, 24 Feb 2000 09:55:27 -0500 Subject: Blank ASP pages Message-ID: <81DD38F43381D111BA3E00A076A0998A459F54@XENON> My server is spitting out blank .asp pages which use python. If Python is not declared, the asp pages work fine. I just yesterday stepped up to Python 1.52 and the new win32all After the install, the blanks started appearing. All the paths look fine in registry. Any clues? ( Intel dual PIII 550 Xeon, 1G RAM, NT 4.0 SP 6a, IIS 4) ************************************************** Jason S. Nadler Lead Programmer Channel21 Productions, Inc. ... What are you doing right now? ************************************************** From markovitch at insoft.ru Mon Feb 14 11:34:38 2000 From: markovitch at insoft.ru (Yakov Markovitch) Date: Mon, 14 Feb 2000 19:34:38 +0300 Subject: How can I debug remote Python programmes? Message-ID: <38A82E9E.4453AA35@iso.ru> Hello. Does anybody know about some means for remote debugging for Python? I desperately need something of kind. The problem is - I have to use Python as extension language on application server and users of that server have to be able to debug Python scripts from client workstations. Client workstations run under Win98, server runs under WinNT/Linux. CORBA is used for remote calls. Please help. From creditsolutions at incomeamerica.com Thu Feb 3 06:05:14 2000 From: creditsolutions at incomeamerica.com (creditsolutions at incomeamerica.com) Date: Thu, 03 Feb 2000 03:05:14 PST Subject: FREE! Guaranteed Approval for Visa & MasterCard Message-ID: CREDIT SOLUTIONS GROUP Guaranteed Approval $4,650 IN UNSECURED Visa & MasterCard! FREE CREDIT SERVICES & FINANCIAL BENEFITS Your past credit history is Unimportant--even BANKRUPTCY. You can get $4,650 in Visa / MasterCard and Personal Line of Credit. No Hassles, No Tricks, Just Credit Solutions. Print out the application form at the end of this message or Visit us at our Web Site: www.incomeamerica.com/creditsolutions.htm Students are encouraged to apply, No past credit is necessary. A Better Financial Future is awaiting YOU! -------------------- APPLICATION FORM ------------------------ Instructions: Print out and complete this form, indicating whether you want Visa/MasterCard or Both. Mail this form along with a $5.95 shipping and handling fee. We'll process your request within 24 hours via UPS ground. (Provide us with a hand written copy if you don't have a printer.) Credit Solutions Group New Accounts Department 16161 Ventura Blvd. Suite 672 Encino, CA 91436 (818)886-1912 Name:_______________________________________________________ Address:_____________________________________ Apt. #_______ City:____________________________ State:____ Zip:___________ e-mail:_____________________________________________________ Phone:(____)_______________________________________________ Signature:__________________________________________________ I would like to receive: ___ Visa ___ MasterCard ___ Both If you'd like to be removed from our list, Click REMOVE From tbryan at python.net Wed Feb 2 22:23:10 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 02 Feb 2000 22:23:10 -0500 Subject: shelve implementation References: <20000201.10464788@sparky.spkydomain> Message-ID: <3898F49E.4062B220@python.net> Robin Becker wrote: > > In article <20000201.10464788 at sparky.spkydomain>, David Fisher > writes > >On another archeologial note, both cStringIO and cPickle are copyright > >Digital Creations and are the only modules that i have found: > > > >#define UNLESS(E) if(!(E)) > > > >which lets them write code like: > > > > UNLESS(PyArg_ParseTuple(...)) > > return NULL; > > > >which i think is unbearably cute. > > As for cute I seem to remember B or maybe bcpl had 'unless' (or the > equivalent) or maybe I've gone gaga. Well, Perl has 'unless', so you know that it's gotta be a good idea. ;-) off-topic-but-I-couldn't-resist-ly ---Tom From jimbag at kw.igs.net Thu Feb 10 01:23:38 2000 From: jimbag at kw.igs.net (JB) Date: Thu, 10 Feb 2000 06:23:38 GMT Subject: PIL Message-ID: <38A25966.5737A2B0@kw.igs.net> Would anyone know if there is a way to get PIL to build without having tcl, Tk and X11 installed? If not, are there any other image manipulation pkgs for python that don't need all this... uh... support?? cheers jb From thomas at bibsyst.no Thu Feb 3 06:33:21 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 03 Feb 2000 12:33:21 +0100 Subject: zip module References: <87an99$mrd$1@news.smartworld.net> Message-ID: <38996781.1E14C558@bibsyst.no> Luiz Martins wrote: > > Is there a module somewhere to open/create zip files? I want to create > archives that contain multiple directory hierarchies, path information, > modifications dates etc. My archives will be used by folks using winzip > under windows 9x > > Felipe Martins > fmartins at math.csuohio.edu This was discussed earlier in this group. There`s a module called zipfile.py. I`ve used it with success. See earlier postings for url etc. Thomas From glen at electricorb.com Wed Feb 2 07:33:32 2000 From: glen at electricorb.com (Glen Starchman) Date: 2 Feb 2000 06:33:32 -0600 Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> <878j9k$vpe$2@thoth.cts.com> Message-ID: <389822FF.DDFF265A@electricorb.com> Case sensitivity is a wonderful thing. With a language like VB which is not case-sensitive (although the IDE will change all occurences of a variable to the first defined case) the developer may refer to objPerson as OBJperson, oBJPeRsOn, etc... personally I find this annoying, and a terrible practice to get into if the developer then has to write C code! As for language keywords being case-sensitive... ditto! However, in the case of keywords it forces the developer to think when typing a keyword. All in all a good thing and makes for cleaner, more standard code... as long as someone doesn't do something like: def function(x,y): #do some silly stuff... def FUNCTION(x,y): #be even more silly f = FUNCTION(1,2) F=function(1,2) THAT makes for unreadable code! ;-) Will Rose wrote: > Thomas Wouters wrote: > : On Sun, Jan 30, 2000 at 06:13:45PM +0000, Neel Krishnaswami wrote: > > :> Well, I'd prefer Python to be case-insensitive, just as a matter of my > :> own preference. Eyeball grep is for me basically case-insensitive, and > :> I have spent hours trying to find bugs caused by case errors, because > :> my eyes just slide over the difference. > > : Funny, my eyeball grep is decidedly case-sensitive. N and n look very > : differently, and I scan them very differently, too. I sooner have trouble > : with 'I', 'l', '1' and in some fonts 'i', or '0' and 'O' and in some fonts > : 'Q'. On my old Atari ST I used to have a perfect screen font (which came > : with the Warp 9 screen accelerator) but unfortunately I have not been able > : to find an adequate substitute on any of the UNIX or Windows systems i've > : been working on, and I've been looking for over 5 years now ;) > > This discussion has made it pretty clear to me that there are (at least) > two sorts of people - those who are case-sensitive readers, and those > who aren't. I don't know how one gets into one category or another; it > doesn't seem to be language-sensitive. (Is Japanese case-sensitive?). > The existence of the two types would explain why so many people like > the Microsoft CI/CP filesystems, which I, being case-sensitive, loathe. > It also means that there is no real way of settling the argument, since > each group will always prefer a different solution. > > Will > cwr at cts.com From bparsia at email.unc.edu Thu Feb 10 00:51:23 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Thu, 10 Feb 2000 00:51:23 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> Message-ID: <1e5rg41.fyvsfg8oy85cN%bparsia@email.unc.edu> My last post on this. Really. Except for that other one. And I might change my mind, who knows? :) Paul Prescod wrote: > This conversation strikes me as a little odd. The original poster > hypothesized that languages become popular due, basically, to luck. I > responded that no, languages are popular for reasons. We're fine here. Except that luck is a good reason (well, timing, positioning, etc.). It's not the *sole* reason. Lots of money helps. :) > Now if we presume > that people WANTED these languages to be popular and that they do not, > then my position has the logical corollary that someone (or some group > of people) > are at fault for the fact that they never became popular. *Saying* it's a logical corollary doesn't *make* it one. It doesn't in anyway follow. It's perfectly possible that all the people who wanted a langauge to be popular did everything in their power to make it popular *and* the language not be popular. The simply counter possibility is a larger bunch of people with *more* resources wanted that language to be unpopular (or some other langauge to be super-popular). (This *particular* possibility still leave "someone" "at fault", but *surely* you can think up others. Consider some prisoner dilemma scenarios.) > This last little bit makes me a bad guy because it means I'm saying > someone screwed up. More precisely you said that various specific people *were* screwed up in various specific ways. And through in a bit of disjointed Alan Kay bashing. History is surely more complex than you make it out to be. Even just reading Gabrial's "Worse is better" paper should give one that sense (even though he tends to be a bit reductive). > But what I'm not clear on is where exactly you and the other > participants start disagreeing with me. Is or isn't there a real reason > that Lisp is almost 50 years old, still widely praised by those "in the > know" and is still not popular yet? [snip] There are a variety of reasons, sure. But I don't think we can unpack them without a bit of research, eh? And one interesting point is that while not winning the Popularity Contest, Common Lisp has a *number* of interesting axes of success. Perhaps the cabal "behind" Common Lisp were trying to do *other things* than merely become popular. (Not that there's anything *wrong* with wanting to be popular. I actually have gotten quite a kick of watching the rise of Python. I remember noticing shifts in the general popular technical literature. Similarly, I notice that a decline in the Java buzz has diminished the (often externally imposed) doom and gloom and defensiveness of "alternative" languages. I think this is to the good.) Cheers, Bijan Parsia. From Gaetan_Corneau at baan.com Wed Feb 16 09:52:39 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Wed, 16 Feb 2000 09:52:39 -0500 Subject: Moving from perl to python: questions Message-ID: <816010E2456BD111A48700805FBBE2EE01C60501@ex-quebec-u1.baan.com> > > > 2) How to implement a no-frills file slurp() function > > > > What is a "slurp" function? > > Hum... The attachment of my code didn't make it. Let's try > this again... Something like this? def slurp(filename): "Slurp all the lines of a file into an array" return open(filename).readlines() You can simplify "chomp", too: # I didn't try it, but it should work :) def chomp(lines): "remove the end of line markers from array" import os nl_len = len(os.linesep) # length of os dependent line seperator for i in range(0, len(lines)): lines[i] = lines[i][:-nl_len] Hope ths helps, ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From tim_one at email.msn.com Fri Feb 4 01:20:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 4 Feb 2000 01:20:59 -0500 Subject: Circular references and python In-Reply-To: <389A680D.7502D66F@Lugoj.Com> Message-ID: <000d01bf6ed8$00d7d7c0$a2a0143f@tim> [Neel Krishnaswami, on modern generational gc] [James Logajan] > Have the algorithms improved, Very much so, but also very much more complex. The best require subtle platform-dependent HW and/or OS support (e.g., being able to mark pages as read-only, then intercept the memory errors raised when an attempt is made to write into them). > or have clock speeds gotten high enough that the problem has been > submerged? Neel means improvement in percentage of total runtime consumed by gc, so clock rate isn't relevant. > Aren't there important pathological problem domains (data structures) > which limit most all GC schemes? I know in sorting, I have a choice > of quick-sort [etc; worst case vs expected case] There are guaranteed real-time GC schemes too, but that's really a different area. Python doesn't even guarantee that, e.g., list.append works in bounded time. Don't be paranoid unless you *need* to be <0.9 wink>; Python's reference counting isn't real-time either. > ... > On the other hand, if I'm willing to run just a tad slower than > quick-sort, I can use heap-sort and be assured of N*log(N) complexity > for all orderings. It's more like a factor of 2 in this specific case. By adding a "virtual recursion depth" counter to quicksort, it's possible to detect bad cases and switch to (e.g.) heapsort for pathological subfiles, thus giving up only *truly* "a tad" on quicksort's expected performance, while still guaranteeing heapsort's worst-case performance. There are analogues in the GC world. > I'll admit I'm not sure what the situation is with GC these days; > any good (and relatively current) books on the subject? Paul Wilson's survey paper is very good, and should be available on the web (sorry, no time to search for it now -- University of Texas is a good clue). 1996's "Garbage Collection: Algorithms for Automatic Dynamic Memory Management" (Wiley & Sons), by Richard Jones and Rafael Lins, is the best recent book that I know of. It's excellent -- and their pseudo-code looks an awful lot like Python! maybe-not-a-coincidence-before-this-is-over-ly y'rs - tim From effbot at telia.com Sun Feb 27 05:50:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 10:50:39 GMT Subject: so how do I run this thing?!!!! References: <38B8EEC6.358B80B9@commsecure.com.au> Message-ID: <3k7u4.8156$al3.108001@newsc.telia.net> Ray Loyzaga wrote: > Use Unix. > > Your windows machine thinks that it should open the file in one of the > "text" displaying applications. thanks for contributing no intelligence at all to this newsgroup. From dkhchan at my-deja.com Thu Feb 10 02:25:26 2000 From: dkhchan at my-deja.com (dkhchan at my-deja.com) Date: Thu, 10 Feb 2000 07:25:26 GMT Subject: Shared Memory Module Message-ID: <87tp54$pis$1@nnrp1.deja.com> When I compile the shm, I got gcc -fPIC -DHAVE_UNION_SEMUN -g -O2 -I/usr/include/python1.5 - I/usr/include/pyt hon1.5 -DHAVE_CONFIG_H -c ./shmmodule.c ./shmmodule.c: In function `check_semaphore_identity': ./shmmodule.c:619: storage size of `arg' isn't known ./shmmodule.c: In function `PyShmSemaphore_setgid': ./shmmodule.c:755: storage size of `arg' isn't known ./shmmodule.c: In function `PyShmSemaphore_setperm': ./shmmodule.c:781: storage size of `arg' isn't known ./shmmodule.c: In function `PyShmSemaphore_setuid': ./shmmodule.c:809: storage size of `arg' isn't known ./shmmodule.c: In function `PyShmSemaphore_setval': ./shmmodule.c:857: storage size of `arg' isn't known ./shmmodule.c: In function `PyShm_semaphore': ./shmmodule.c:1218: storage size of `arg' isn't known ./shmmodule.c: In function `PyShm_create_semaphore': ./shmmodule.c:1269: storage size of `arg' isn't known make: *** [shmmodule.o] Error 1 Please help. Thanks a lot :-) Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Fri Feb 11 01:56:54 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 06:56:54 GMT Subject: ruby AND python References: Message-ID: Robert Hicks wrote: > I just read an interesting article about how the Ruby language is gaining in > popularity (specially in Japan). I found it interesting because it had a > direct comparison (several times) with Python. How will this language affect > Python? Will it drive quality and innovation? I hope so! What do you think? other recent threads have touched upon this subject; my 2 ?re is while that the article was flawed, ruby it- self appears to be (yet another) good language. like rebol, lua, dylan, squeak, scheme, etc, etc. most real differences between ruby and python appears to be differences between the current implementations, though. CPython 1.5.2 isn't the only implementation out there, you know... > Note: I think Python is a great langauge so do not take the remarks above to > mean that I think that the language is lacking in quality. I intend to be a > Python programmer for a long long time yet! same here! ;-) From darrell at dorb.com Wed Feb 23 14:19:17 2000 From: darrell at dorb.com (Darrell) Date: Wed, 23 Feb 2000 11:19:17 -0800 Subject: (no subject) References: <81DD38F43381D111BA3E00A076A0998A459F40@XENON> Message-ID: <002001bf7e32$e0ec4b70$6401a8c0@dorb> I hope "viper" doesn't referr to the new experimental version of Python. ----- Original Message ----- From: "python" To: Cc: "python" Sent: Wednesday, February 23, 2000 8:14 AM Subject: (no subject) > I am using NT 4.0 Service Pack 6a and IIS 4.0 on a dual-processer PIII Intel > system w/ 1G RAM. Python Version is 1.5. > I get the following error in my Event Logs every 2 hours (and the services > crash simultaneously as well), and I have no idea what's causing it and how > to stop it... : > > An object call caused an exception. > (IID: {51372AEF-CAE7-11CF-BE81-00AA00A2FA25}) (Method: 3) > (Microsoft Transaction Server Internals Information: File: > i:\viper\src\runtime\mtxex\activity.cpp, Line: 889) > (Exception: C0000005) (Address: 0x1e6054df) > PyWinTypes15!PyWinThreadState_Free(void) + 0xF > asp!TerminateExtension + 0x3D35 > asp!TerminateExtension + 0x33E3 > asp!TerminateExtension + 0x313B > asp!TerminateExtension + 0x7AC3 > asp + 0x325C6 > mtxex!MTSCreateActivity + 0x1F3C > mtxex!MTSCreateActivity + 0xF3E > > > *** if you notice the file reference > i:\viper\src\runtime\mtxex\activity.cpp, there is no, nor was there ever, an > i drive on my machine... > > please help!! > we've been using python on the web for 3 years now and this is something new > which is going wrong... (this machine is a new installation as of about a > month ago - the errors only started happening after I started running > high-traffic sites on the machine) > > > > ************************************************** > Jason S. Nadler > Lead Programmer > Channel21 Productions, Inc. > > ... What are you doing right now? > ************************************************** > > > > ************************************************** > Jason S. Nadler > Lead Programmer > Channel21 Productions, Inc. > > ... What are you doing right now? > ************************************************** > > -- > http://www.python.org/mailman/listinfo/python-list From aahz at netcom.com Mon Feb 21 10:52:32 2000 From: aahz at netcom.com (Aahz Maruch) Date: 21 Feb 2000 15:52:32 GMT Subject: Problem with re.findall?????!!!!!!!!!! References: <38B10F76.91DC90C1@earthlink.net> Message-ID: <88rn00$90j$1@nntp6.atl.mindspring.net> In article <38B10F76.91DC90C1 at earthlink.net>, J Donald wrote: > >I'm getting an AttributeError when I try to use re.findall or {my >compiled re object}.findall. IIRC, findall() requires Python 1.5.2; make sure you're both using that version and that nothing left over from previous versions is being accessed. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From effbot at telia.com Wed Feb 16 12:40:31 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 17:40:31 GMT Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> Message-ID: Adrian Eyre wrote: > I suspect, however, that JPython has this already implemented, > so this is unlikely to change in CPython. don't know about JPython, but it's definitely implemented in the current CPython code base. > Doesn't really bother me too much. It just feels like a kludge. it isn't, when compared to the alternatives. > And the similarity of index() and find() makes me feel that one > should be redundant (probably the one which returns -1). like getattr/hasattr, you mean? From philh at vision25.demon.co.uk Mon Feb 14 12:43:06 2000 From: philh at vision25.demon.co.uk (phil hunt) Date: Mon, 14 Feb 2000 17:43:06 +0000 Subject: breaking the ; habit References: Message-ID: On Mon, 14 Feb 2000 13:49:46 +0100 (MET), Mikael Olofsson wrote: > >On 12-Feb-00 osorronophris osorronophris wrote: > > I'm a die-hard C++ programmer that recently took up Python for a change of > > scenery and am enjoying it greatly. The one problem I am having is that I > > can't break myself of the semicolon habit. I've tried chewing gum but it > > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? > >Assuming you have a programmable editor, set it to quit if you ever >type ;. > >I once knew a guy who were used to UNIX. One summer he had to live in >a DOS-environment, and he hated every minute of it. What he hated even >more was when he got back to his UNIX home, and found himself typing >dir all the time. OK, what did he do? He made an alias, of course. No, >he didn't make dir mean ls, he had it mean logout. Now you guess: How >fast did he break his habit? Fast, real fast, mind my words. > >Good luck! Alternately, if you have some spare electronics lying around, you could program it to give your genitals an electric shock whenever you press ;. -- ***** 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 afellows at asc.corp.mot.com Tue Feb 22 01:34:56 2000 From: afellows at asc.corp.mot.com (Andrew Fellows) Date: Tue, 22 Feb 2000 17:04:56 +1030 Subject: embedded console for JPython ? Message-ID: <38B22E10.F2F3AA04@asc.corp.mot.com> I'm trying to figure out the best way to get an interactive JPython console into an java app currently under development. The idea would be to use this as a way to dig into the app and test and tweak it. Problem is that I'm not sure about the best way to go. After reading through the archives and demos I figure the best way is to create an Invoker class that invokes a JPython interpreter within a JFrame using it's own thread, and on another thread, invoke the app. This way I see the one java virtual machine and can get at the app easily via the interpreter but it means I must write the interactive console bit, something I had assumed was already out there. I tried having the command line interpreter invoking the app but could only do this by invoking two instances of the jvm, not the desired result. So I am not only not sure about the best way to go but doubly so because there doesn't seem to be much discussion about this, have I missed something ? Any pointers, sites, references and/or mind blitzing ideas are welcome. Thanks Andrew Fellows From rockjock810 at my-deja.com Sat Feb 19 14:34:39 2000 From: rockjock810 at my-deja.com (rockjock810 at my-deja.com) Date: Sat, 19 Feb 2000 19:34:39 GMT Subject: ODBC, mxODBC problem References: <88jk4o$vsg$1@nnrp1.deja.com> <38ae2f29@omega> <38ae3017@omega> Message-ID: <88mr8f$482$1@nnrp1.deja.com> I didn't have any problems making it work on the same WinNT machine using Perl. And yes, the DSN was defined in the ODBC manager. I suspect that Python seems to treat WinNT network shares rather odd. Maybe a little enlightenment on how it interacts with other servers would do the trick. I tried this script: n=open(r"\\www\c$\cgi-bin\test.dat","r+") and I've been getting "Permission denied" messages. I wonder what WinNT account Python uses and how I should share the said file so I can open it from the machine where the script originates. In article <38ae3017 at omega>, "Cristian Echeverria" wrote: > Of course you need to create DSN in your ODBC manager > called "express" pointing to your database > > Cristian Echeverria escribi? en el mensaje de > noticias 38ae2f29 at omega... > > If you are on Win9X try this > > db = ODBC.Windows.Connect("express","","",0) > > Sent via Deja.com http://www.deja.com/ Before you buy. From neilh at hare.net.au Sat Feb 26 08:21:38 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Sun, 27 Feb 2000 00:21:38 +1100 Subject: Pythonwin (Version 2 beta 3) References: <02eb01bf7f33$cc5d27e0$01646464@computer> Message-ID: <002a01bf805c$6b01a640$01646464@computer> I have fixed PythonWin source code printing to print the last page. The file is view.py located at: \Program Files\Python\PythonWin\pywin\scintilla\view.py You can download the fixed file from http://www.scintilla.org/view.py The problem is caused by having the last page in the starts array be marked with the same value (length of document) that is also used as a sentinel on the last page plus 1. When the sentinel is discovered, printing stops. If you want to just patch the code, replace from line 507 which starts with if not pInfo.GetPreview() to the end of the OnPrepareDC method with: if not pInfo.GetPreview() and self.starts is not None: prevPage = pInfo.GetCurPage() - 1 if prevPage > 0 and self.starts[prevPage] >= self.GetTextLength(): # All finished. pInfo.SetContinuePrinting(0) return dc.SetMapMode(win32con.MM_TEXT); (indenting as appropriate) A better approach in the code may be to choose a sentinel 1 greater than any possible document index. Neil From tismer at tismer.com Tue Feb 1 09:47:08 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 01 Feb 2000 15:47:08 +0100 Subject: was Stackless 1.01 Homepage: another bug in stackless? References: <388BE68E.B26985CA@tismer.com> <$WXiIAAO+Dj4Ew2W@jessikat.demon.co.uk> <388C7D4A.D873AA@tismer.com> <388C9733.B4F60DC0@tismer.com> <7PUz+AAC6aj4Ewne@jessikat.demon.co.uk> <38947CE6.5ADEE391@tripoint.org> <3896C84B.8195845B@tismer.com> <+KfOlDAduul4EwXi@jessikat.demon.co.uk> Message-ID: <3896F1EC.EE896035@tismer.com> Robin Becker wrote: ... > Hi it works ok with Zope now. YAHOOOOOO !$%?@ :-]D well that's great. As I heard from some major Zopistas on IPC8, they are very much interested in a Stackless Zope, at least for the Medusa stuff. But most probably they can make use of fast threadless context switching as well. Hach, great. > What's ptools? Seems ptools.timing is > needed for the generator demo. Oh yeah. I'll include the function into the demo code. Here is my clumsy ptools (pirx' tools) file :-) ciao - chris.thoughtless -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 -------------- next part -------------- # ptools (p wie pirx) # # Just some little helpers which don't fit elsewhere, # posted for review """ Pirx Tools V0.0 timing measure time behavior of some function sort "Schwartzian Sort" and stable sort together transpose very fast transpose """ def timing(func, args=None, n=1, **keywords) : import time time=time.time appl=apply if args is None: args = () if type(args) != type(()) : args=(args,) rep=range(n) dummyarg = ("",) dummykw = {} dummyfunc = len if keywords: before=time() for i in rep: res=appl(dummyfunc, dummyarg, dummykw) empty = time()-before before=time() for i in rep: res=appl(func, args, keywords) else: before=time() for i in rep: res=appl(dummyfunc, dummyarg) empty = time()-before before=time() for i in rep: res=appl(func, args) after = time() return round(after-before-empty,4), res # this is taken from the FAQ and modified slightly: """ 4.51. I want to do a complicated sort: can you do a Schwartzian Transform in Python? Yes, and in Python you only have to write it once: def st(List, Metric): def pairing(element, M = Metric): return (M(element), element) paired = map(pairing, List) paired.sort() return map(stripit, paired) def stripit(pair): return pair[1] """ # now, this is my version: def sort(List, Metric=None, stable=1) : """sort a list by a given metric function. The sort defaults to be stable, keeping the order of elements which cannot be distinguished by the metric""" # transpose has problems with small lists, but in that # case we don't need it: if len(List) < 2: return List[:] shaker = [List] where = 0 if Metric : # sorter is a list of function results shaker.insert(0, map(Metric, List)) where = -1 # we are at the end if stable : # always stabilize behind the key shaker.insert(1, range(len(List))) # and we are still either at front or end shaker = transpose(shaker) shaker.sort() return list(transpose(shaker)[where]) def transpose(x) : """transpose a sequence of lists into a list of tuples. This is very fast, but doesn't work for len(x)==1""" return apply(map, (None,)+tuple(x)) # Special problem with fast transpose: # Due to map, transpose of a list with a single element # returns a list, shape is lost. # Solution: def transpose(x) : if len(x) == 1 : return map(lambda y : (y,), x[0]) return apply(map, (None,)+tuple(x)) # General problems with transpose (not solvable here): # A list of empty tuples returns an empty list (shape lost) #EOModule :-) From bela_b at gmx.net Sun Feb 13 16:13:11 2000 From: bela_b at gmx.net (Bela Bauer) Date: Sun, 13 Feb 2000 22:13:11 +0100 Subject: Graphic-Library for Screensavers Message-ID: <38A71E67.B771E1B1@gmx.net> Hi, do you know any easy to use graphics library able to write screensavers (especially for Linux)? Of course it would be good to have the possiblity of processing 3D, but first I just want to print color text. Thanx Bela -- Bela Bauer bela_b at gmx.net bela at schuelerdiskussion.de / www.schuelerdiskussion.de From kens at sightreader.com Tue Feb 22 16:22:13 2000 From: kens at sightreader.com (Ken Seehof) Date: Tue, 22 Feb 2000 14:22:13 -0700 Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <38b1a83b.25970002@news.concentric.net> Message-ID: <88uvdv$2e6$1@hpbs1500.boi.hp.com> How about making tabs a syntax error in Python 2.0! I've removed the tabs from my keyboard. Is there a way to write a python function to switch between applications? I can't do Alt-Tab anymore cause I don't have a tab key. - Ken Tim Ottinger wrote in message news:38b1a83b.25970002 at news.concentric.net... > >Inbetween all the bickering, I got a lot of useful information. It > >would be nice to summarize these points in a succinct, factual manner. > > Would have been cool to get it without the bickering, though. > > >First and foremost, I did not find in the FAQ, or in any of my searching > >around on www.python.org, or in any place in Mark Lutz's _Programming > >Python_ that was clear from the TOC or index, or in the 1/3 of the tome > >I've read so far, any sort of clue into the really incredibly obvious > >question that is underneath all this: "How do you deal with tabs vs. > >spaces?" > > > >I don't know why this is so hidden. I think any reasonable FAQ on the > >matter must state, in some obvious and up-front way THE PYTHON > >INTERPRETER ALWAYS INTERPRETS A TAB AS 8 SPACES. There was a quote from > >Guido's guide to programming style (or something like that -- NOT the > >first document I'd look at when trying to figure out how the dang thing > >works) that was quite to the point somewhere in the responses to my post > >that was quite to-the-point which I think you should probably use. > > Every non-M$ programmer I know sets tabs to 8 spaces, shifts/indents > to 4, and most of them set whatever editor they use to write spaces > rather than tabs. > > I do this in vim, M$ IDE (when forced to use it), and in all other > editors I've ever used for code work. When you print text, it expands > tabs to 8 chars normally, so most developers automagically (without > thinking) either use 8-char tabs, or don't use them. > > I hate the little beasties, and am not so pressed for disk space that > I'd use them to save 7 bytes each. > > So I think we all overlook the errors that we don't personally commit. > That's just humanity, not pythonity. Who would have thought it? > > Tim From amused at webamused.com Sun Feb 13 12:39:30 2000 From: amused at webamused.com (Joshua Macy) Date: Sun, 13 Feb 2000 17:39:30 GMT Subject: merging really huge lists fast References: <38A6E891.9494D59A@bibsyst.no> Message-ID: <38A6E9F5.69590793@webamused.com> thomas wrote: > > Hi, > > I got huge lists I want to merge, but the good old new_list = list1 + > list2 seems to be slow. Any hints? > > Thomas new_list = list1 + list2 creates a new list containing a (shallow) copy of the elements of list1 and list2. list1.extend(list2) will append list2 to the end of list1. My guess, without timing it, is that the latter would be faster for huge lists, although it changes the semantics... Joshua From psilva at ruido-visual.pt Fri Feb 11 07:12:47 2000 From: psilva at ruido-visual.pt (Pedro Silva) Date: Fri, 11 Feb 2000 12:12:47 -0000 Subject: Find word Message-ID: <000801bf7489$4ed22640$6c00a8c0@ruidovisual.pt> Hi, I want to find some words in a file, how can I do this in python? What I want is: I have a file, that is a text file that is in teh filesystem. I need to get some lines in that file, and for that I need to find some words. For example, in that file I know that I have the words: From, Subject, Date and Xref and I need the text that is after this words. How can I find these words? This is to show the content of a file, but like I want: From: Pedro Subject: Find Words Date: 11/02/2000 Content: xxxxxxxxxxx Something like this!!! Can anyone help me? Please send your answers to: psilva at ruido-visual.pt Thanks, Pedro -------------- next part -------------- An HTML attachment was scrubbed... URL: From saraz at videotron.ca Fri Feb 4 09:04:18 2000 From: saraz at videotron.ca (Alain) Date: Fri, 04 Feb 2000 14:04:18 GMT Subject: Running a python script from JAVA, with correct indentation References: <20000204.9584017@sparky.spkydomain> Message-ID: Here's the python code of my script: import telnetlib telnet = telnetlib.Telnet() telnet.set_debuglevel(2) telnet.open ('132.208.135.240',23) telnet.write('\n') telnet.read_until('Password:') telnet.write('fixit\n') telnet.read_until('>') telnet.write('enable\n') telnet.read_until('Password:') telnet.write('laboinfo\n') telnet.read_until ('#') telnet.write('configure terminal\n') telnet.read_until ('#') telnet.write ('access-list 99 permit 111.111.0.0 0.0.255.255\n') telnet.read_until('#') telnet.write('access-list 99 permit 111.111.0.0 0.0.255.255\n') telnet.read_until('#') telnet.write('access-list 99 permit 111.111.0.0 0.0.255.255\n') telnet.read_until('#') telnet.write ('interface Ethernet 0/1 \n') telnet.read_until ('#') telnet.write ('ip access-group 99 IN \n') telnet.read_until ('#') telnet.write ('exit \n') telnet.read_until ('#') telnet.write ('exit \n') telnet.read_until ('#') telnet.write ('exit \n') Any idea? David Fisher a ?crit dans le message : 20000204.9584017 at sparky.spkydomain... >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/3/00, 3:12:09 PM, "Alain" wrote regarding Running a python script from JAVA, with correct indentation: > Hi, > I'm trying to run a script from a file. The script is written in python. The > script is a telnet session between a router and a computer. If I run the > script from a DOS prompt window, everything is good. But if I start the > script from my program, using a Runtime object, there's a problem. The > communication between the router and the computer is stop, even if the > telnet session is still open. Here's the JAVA code: [...] > Is there someone have a solution? Well, this is a blind guess without seeing the python code, but are you using os.popen() somewhere? The windows C-runtime has a problem redirecting console i/o if there isn't a console open (like a dos window). So this could describe your problem. Look at the python FAQ for "popen" for more info. When-all-you-have-is-a-hammer-everything-looks-like-a-nail-ly yr's david From a00tch00 at nchc.gov.tw Sun Feb 27 03:37:03 2000 From: a00tch00 at nchc.gov.tw (T. C. Huang) Date: Sun, 27 Feb 2000 16:37:03 +0800 Subject: How to create a Phonebook using win32ras.CreatePhonebookEntry Message-ID: <38B8E22F.54FECB31@nchc.gov.tw> Hi, I want to write a script to create a Phonebook entry on a win98 machine by using win32ras.CreatePhonebookEntry(0,'') and win32ras.CreatePhonebookEntry(0,None), but without luck. However I can manipulate the an existing entry by win32ras.EditPhonebookEntry(0,None,'MyConnection'). Does anynoe know what's wrong in my use of CreatePhonebookEntry() function? Thank you very much! T. C. Huang From effbot at telia.com Thu Feb 10 03:09:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 08:09:23 GMT Subject: 'import site' failed; use -v for traceback References: Message-ID: Warren Postma wrote: > I have just built a static version of the python interpreter, and linked it > to the sample code from "Demo\embed" subdirectory, and it runs, but the > first line it prints out is: > > 'import site' failed; use -v for traceback > > I figured out that I needed a local copy of Exceptions.py and Site.py, and > Os.py to build my micro-python embedded environment up, and put them in a > subdirectory called Lib under where the EXE is located. So far so good, but > how do I get the traceback message for why 'import site' is failing? better make that "exceptions.py" and "site.py". and the standard "site.py" imports "os.py", which imports "ntpath.py", which imports "stat.py" and so on. I'd recommend using "exceptions.py" and an empty (or at least user-defined) "site.py". you can also run the standard interpreter with the -v option, down in your micro-python environment, so see what's going on. hope this helps! From donn at u.washington.edu Wed Feb 2 12:29:15 2000 From: donn at u.washington.edu (Donn Cave) Date: 2 Feb 2000 17:29:15 GMT Subject: Case Sensitivity and Learnability References: <878j9k$vpe$2@thoth.cts.com> <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> Message-ID: <879phb$13i0$1@nntp6.u.washington.edu> Quoth Will Rose : ... | This discussion has made it pretty clear to me that there are (at least) | two sorts of people - those who are case-sensitive readers, and those | who aren't. I don't know how one gets into one category or another; it | doesn't seem to be language-sensitive. (Is Japanese case-sensitive?). | The existence of the two types would explain why so many people like | the Microsoft CI/CP filesystems, which I, being case-sensitive, loathe. | It also means that there is no real way of settling the argument, since | each group will always prefer a different solution. I've missed some of the discussion, so I hope I'm not repeating something that's already been chewed over, but I just wanted to point out that there are indeed two sorts of people - one believes that there are two sorts of people, and the other doesn't! Ha, ha ha. Also I must add that there are those who have no trouble spelling things right, and those who can't do it to save their lives - what will Python 2.0 have for them? Wouldn't it be nice if it could accept MessageRecieved as a valid spelling for MessageReceived, for example? Anyway, just wanted to point out that for some of us, Python is part of a larger system of software and not a universe unto itself. Where I am, it seems like this external world is case sensitive. On UNIX and BeOS anyway, case has meaning. I write BeOS system interfaces, and the idea that window.PostMessage(B_QUIT_REQUESTED) might just as well be spelled in whatever case suits the writer is unthinkable. Maybe the perspective behind it is, are we Python programmers who happen to work with BeOS, or BeOS programmers who happen to work in Python? I think the latter, and at least when I have this hat on I don't just prefer case sensitivity due to a quirk in my own nature, I need it. Donn Cave, donn at u.washington.edu From dan at cgsoftware.com Mon Feb 28 11:13:04 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Mon, 28 Feb 2000 08:13:04 -0800 (PST) Subject: A comp.lang.python code snippet archive? In-Reply-To: Message-ID: > > *nod* thanks, definitely a great resource. > > However what I'm referring to would be the programmatic extraction of > every snippet posted to the list, which would get archived on a > website somewhere for reference including the post that included it. > > Wouldn't that be a great resource? I might even actually be able to > put my money where my mouth is this time and actually _DO_ this :) > > -Chris > -- I'll happily make a program to do the extraction if someone will provide the space/account to run the program under. --Dan From chris at rpgarchive.com Wed Feb 23 00:22:52 2000 From: chris at rpgarchive.com (chris davis) Date: Wed, 23 Feb 2000 05:22:52 GMT Subject: Sockets or networking library? Message-ID: I'm looking for a good sockets or networking library, preferably with some abstraction. I'm building a multi-player network game, and want something abstracted along the lines of directx. If there's nothing out there I'll do it myself, but I want to know that it hasn't been done already. From bjorn at roguewave.com Thu Feb 10 19:04:54 2000 From: bjorn at roguewave.com (bjorn) Date: Thu, 10 Feb 2000 17:04:54 -0700 Subject: Off Topic Posts References: Message-ID: <38A35226.8934F6C9@roguewave.com> comp.lang.python.whitespace ? only-half-joking'ly y'rs --bjorn Gene Chiaramonte wrote: > Please stop the madness! I can't take it anymore. > > Can the admins of this list please setup another newsgroup for posts > regarding python language opinions? Lets keep this list for people who need > help USING PYTHON to solve real problems. There is a great group here and > they have helped me tremendously in getting up to speed with python. The > support here is great and much better than any commercial support I have > ever received. I worry that the constantly increasing number of off topic > opinion type posts here has gone above a reasonable threshold. > > Better yet - If you don't like Python, don't use it. There a plenty of other > languages that have a delimited block structure. Go use C or C++, use Delphi > and type Begin...End 100 times day. Use VB if that's your thing. But leave > Python alone. > > Enough already! If it's not a Python question, don't waste your time sending > it in the first place. > > Thanks, > > Gene > > -- > http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Mon Feb 21 13:40:46 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 18:40:46 GMT Subject: None & Ellipsis References: Message-ID: Moshe Zadka wrote > On Sat, 19 Feb 2000, Gerrit Holl wrote: > > > > > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > > > > >>> t1, t2, None, t4, t5, None, None, t8, None = t > > > > >>> None > > > > 'i' > > > > > > >>> del None > > > >>> None > > > >>> > > > > Ah...! Is this behaviour documented! > > Yes. It's called the "Python 3 namespace rule". exactly. and combined with the "local variables are detected by static analysis" rule, things get really weird. consider this: def mylongfunction(): a = None # ... # a few hundred lines of computation # ... a = 1, 2, 3 None, None, b = a this results in an exception. on what line? From timd at macquarie.com.au Tue Feb 22 17:40:59 2000 From: timd at macquarie.com.au (Timothy Docker) Date: 23 Feb 2000 09:40:59 +1100 Subject: catching X client kills in Tkinter Message-ID: Is it possible to catch the failure of a Tkinter based application when the server connection is closed (ie under X11 and unix). For example in the script below, if I push the button, or click on the window manager close button, "Done" is printed as expected.... from Tkinter import * def done(): x.quit() x = Button(text="Quit",command=done) x.pack() try: x.mainloop() finally: print "Done" On the other hand, if the X server exits, or I do an xkill, then the following message is printed X connection to :0.0 broken (explicit kill or server shutdown). I'd like to do some cleaning up before exiting - is there any way to do this? Thanks for any tips! -------------------------------------------------------------- Tim Docker timd at macquarie.com.au From BC at prism.co.nz Wed Feb 23 23:28:38 2000 From: BC at prism.co.nz (Bing Chen) Date: Thu, 24 Feb 2000 17:28:38 +1300 Subject: Can I run a c++ object in Python program? Message-ID: <892c2s$maj$1@news.ihug.co.nz> I pass a object from c++ to Python as follow: PyObject *pargs = Py_BuildValue("Oli",m_curr,field.first,field.second); PyObject *pdict, *pval; pdict = PyDict_New(); PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); PyDict_SetItemString(pdict, "Y", pargs); /* dict['Y'] = pargs */ PyRun_String("from BaseModule import *", file_input, pdict, pdict); PyRun_String("X = BaseModelLink(Y)", file_input, pdict, pdict); the "m_curr" is an instance of class in my application, when I run some method in the Python program as follow: def BaseModelLink(pargs): base = pargs[0] vid = pargs[1] unit = pargs[2] return base.get_lit(vid,unit) it crash. How can I make the object work in the pyhton program? Thank you guys in advance! BC From grant at nowhere. Fri Feb 18 11:10:49 2000 From: grant at nowhere. (Grant Edwards) Date: Fri, 18 Feb 2000 16:10:49 GMT Subject: Which GUI? References: Message-ID: In article , Warren Postma wrote: >2. If Python is so much better than Tcl, why does Python require the > Tcl interpreter be running to get Tkinter going? Because it's easier that way. STk is a Scheme interpreter bound directly to Tk (sans Tcl). It's a nice way to do things, but everytime Tk changes you've got to muck about to get the binding to work again. By leving Tcl in, it makes upgrading to new versions of Tk easier. Leaving Tcl in is a pragmatic solution, even though it doesn't appeal to the minimalist in me. -- Grant Edwards grante Yow! I'm wearing PAMPERS!! at visi.com From kens at sightreader.com Sun Feb 27 18:43:39 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 15:43:39 -0800 Subject: Overloading = References: <3.0.5.32.20000220133808.008876e0@mail.dicksonstreet.com> Message-ID: <38B9B6AB.A3BDB599@sightreader.com> You can't overload "=" in that case, because "=" is not an assignment operator. In fact, "=" is not an operator at all (in this case). It binds a name to an object. The statement "a=5" doesn't even look at what kind of thing the name "a" used to refer to, it simply binds the name "a" to the object 5. Here a useful exception to the rule: In the statement obj.a = 5 the "=" is the __setattr__ operator, so it's equivalent to obj.__setattr__('a', 5) Then you overload __setattr__ to do whatever typechecking and stuff you want. Perhaps you could prefix the users string with "obj." so "a=5" becomes "obj.a=5". You almost certainly want "a" to be a member of an object anyway. I'd probably nuke the ".value" idea, unless you need it for something, though you could make __setattr__ do anything you want including "obj.a.value=5". Overall, I'd say you've suffered too long as a C++ programmer (as I have) and you need to forget everything you've ever learned. Take a vacation. When you get back, start again on python with a fresh mind. If you try to get python to do C++ tricks, you will just make your life difficult. Python's got its own stuff thats way better. Felix Thibault wrote: > At 22:47 2/17/00 GMT, jhefferon at my-deja.com wrote: > >I have a class, rclass. It has an attribute value. Can I arrange > >so that the string > > r1=r2 > >sets r1.value to equal r2.value (where r1 and r2 are class instances, > >of course) without changing anything else about r1? I'm willing to > >test, say, that r1.classtype==r2.classtype or something, first to make > >sure the assignment is sensible. > > > >And if so, can I also have r1=7 set r1.value to be 7? > > > >I want to have a box in a GUI where users can enter code, such as > >assignments, and I'd like to avoid the reference to the underlying > >attribute. > > > >Thanks, > >Jim Hefferon jim at joshua.smcvt.edu > > > > > >Sent via Deja.com http://www.deja.com/ > >Before you buy. > >-- > >http://www.python.org/mailman/listinfo/python-list > > > > > > Would it be OK for this assignment to use another operation ? > You could use something like- > > def __lshift__(self, other): > if hasattr(other, 'value'): > self.value = other.value > else: > self.value = other > > then your users could type r1 << r2 to put the value of r2 into r1. > > -Felix From effbot at telia.com Wed Feb 2 12:50:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 17:50:40 GMT Subject: Newbie: OverflowError: integer addition - Python data types?? References: <879o21$lu2$1@nnrp1.deja.com> Message-ID: e.e.sutton at cummins.com wrote: > I can't get a Python version of my VBScript Fibonacci series script to > work. I get an OverflowError: integer addition error at series 46. > > Can Python not handle large numbers? plain integers can handle what C's long signed integer can handle on your platform (usually 32 bits, i.e. +-2E9) long integers have unlimited precision. (unlike some other languages, python doesn't auto- magically change the type if an expression overflows). > Is there a special data type I should be using? long integers? http://www.python.org/doc/current/lib/typesnumeric.html PS. assigning to the function name is very unpythonish (doesn't VBScript support recursion? ;-) From bjorn at roguewave.com Tue Feb 8 20:45:10 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 08 Feb 2000 18:45:10 -0700 Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: <38A0C6A6.9DC3B02F@roguewave.com> Ben Wolfson wrote: > On Wed, 09 Feb 2000 01:15:11 GMT, cjc26 at nospam.cornell.edu (Cliff Crawford) > wrote: > > >Pada Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen bilang: > >| I fear that this question has already been asked, but is there and > >| equivalant one line command that is equivalant to the C command: > >| > >| a = x > y ? x : y > > > >a = (x > y and [x] or [y])[0] > > Isn't this actually wrong? wrong to use? ... certainly. It is semantically equivalent though. --bjorn From gerrit.holl at pobox.com Wed Feb 23 09:22:07 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 15:22:07 +0100 Subject: Killer Apps In-Reply-To: ; from mikael@isy.liu.se on Wed, Feb 23, 2000 at 08:24:25AM +0100 References: <20000222215610.E4549@stopcontact.palga.uucp> Message-ID: <20000223152207.A2803@stopcontact.palga.uucp> > > On 22-Feb-00 Gerrit Holl wrote: > > ROFL! > > I know they say "It's better to remain silent and seem stupid, than > opening your mouth and thus revealing the truth", but I still have > to ask. > > I have seen this ROFL a number of times, especially written by you, > Gerrit. What exactly is it supposed to mean? Rolling Over the Floor Lauging. See the following URL for this and many more abbrevations and hacker slang: http://www.jargon.org regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From python at commandprompt.com Mon Feb 21 22:49:30 2000 From: python at commandprompt.com (python at commandprompt.com) Date: Mon, 21 Feb 2000 19:49:30 -0800 (PST) Subject: Donations to Python Community Message-ID: Hello, I recently posted this message to comp.os.python: Hello, I represent LinuxPorts.Com (http://www.linuxports.com/) and I have been approached by a printer to possibly publish OpenSource books. To start these books would just be paper versions of the actual documentation. In this case, the Python Documentation and we were wondering if this would be of interest to the Python Community. I spoke with the printer and we both have agreed that if we do this that we will be providing a portion of the Gross Profits back to the individual projects. In this case the Python project. Anyway, if this of interest to you please go to http://www.linuxports.com/ and make your vote. It will help us determine the demand for such a book. ----- We received about 8 responses with feedback that we much appreciated and would now like to solicit some more. If the people that read this email could just think about a few of the following questions and provide some feedback we would be very thankful. We are considering publishing the current set of Python documentation as a single volume versus several volumes such as toExcel does. Would this be of interest to the Python community? One person made mention of the "Vaults of Parnassus" if we were to include a snapshot of this would this be of interest? We are also considering "paying" someone to write a book about Python. Unfortunately, unlike traditional publishers the author would not get paid until the book was done, and then it would be on the basis of per book sold. We are aware that this is not the normal way of doing things, but we are not Prentice Hall and this would be the only way "currently" that we could pull this off. Is there anyone on this list that feels confident enough in their Python skills and writing ability to be able to perform such a task? Last but definitely not least, no matter what we do, if we publish a Python book, 20% to 40% of the Gross Profits would go back to the PSA. Thanks for your time: Joshua Drake Webmaster - LinuxPorts.Com WebMaster - LinuxDoc.org From rbill at datasprings.com Thu Feb 17 20:54:34 2000 From: rbill at datasprings.com (Robert W. Bill) Date: Thu, 17 Feb 2000 19:54:34 -0600 Subject: mxDateTime and MySQLdb on RedHat 6.1 Message-ID: <3.0.6.32.20000217195434.007d2320@mail.visi.com> >Thomas Leen wrote: >I as well, and from the looks of it this type of problem has gone >unanswered since late '99. Anybody been able to use mysql/python on >redhat 6.1? Trying to do some cgi stuff myself and while Perl calls to >me, I resist, but cant hold on forever. I replied to Lenny's original post, but the "unanswered since late 99" in your post worries me. I do use MySQLdb with RedHat6.1 and Python successfully. If you could give me some more info, I'm sure this can be corrected before you have to use that hArSh 4-letter word again :) If installing the earlier mentioned 'python-devel.1.5.2-??.rpm doesn't fix it, please send the output of 'rpm -qa | grep -i python' and the MySQLdb version number. If it is using the module that is troublesome, I can send you examples that will get you going- just ask. From python at rose164.wuh.wustl.edu Thu Feb 3 08:50:19 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Thu, 03 Feb 2000 13:50:19 GMT Subject: TKinter on Win98 and os.popen In-Reply-To: References: Message-ID: <20000203.13501983@sparky.spkydomain> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/3/00, 6:59:02 AM, "Damian Dobroczy?ski"
wrote regarding TKinter on Win98 and os.popen : > Problem description: > script: > import os > f = os.popen('python -c "print 1"','r') > on Win98 Python in IDLE shell ends up with exception: > "Traceback (innermost last): > File "", line 1, in ? > f = os.popen('python -c "print 1"','r') > OSError: (0, 'Error')" > Other 'popens' with other commands also fails. Is it normal behaviour when > using Tkinter mod? This one's in the faq. It's a bug on win9x with the popen command. On win9x, popen expects a console to redirect i/o to. In idle and Tkinter, there is no console open. I spent about two days beating my head against this on, before i realized it wasn't my fault <0.1wink>. The faq sugests some fixes, but i just started using os.system and redirecting to/from a file. Which is ugly, but that's win32 for you. The microsoft site also has some info about this. David Fisher From bruce_dodson.nospam at bigfoot.com Tue Feb 29 18:59:30 2000 From: bruce_dodson.nospam at bigfoot.com (Bruce Dodson) Date: Tue, 29 Feb 2000 19:59:30 -0400 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> Message-ID: <08Zu4.6976$3z.60274@newscontent-01.sprint.ca> I wouldn't worry about that. You won't have to throw or rewrite old code, unless you want to take advantage of features in Python 3000. That is, if your app doesn't need anything from Python 3000, it can go on using the 1.x interpreter for which it was designed. >"The language will be incompatible" seems like kind >of a dangerous statement to be making without >backing it up... As much as I love python, for example, >I can't very well recommend using it if everything I >write will have to be thrown out in a year or two. From aahz at netcom.com Tue Feb 1 14:10:23 2000 From: aahz at netcom.com (Aahz Maruch) Date: 1 Feb 2000 19:10:23 GMT Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> Message-ID: <877b2v$si2$1@nntp3.atl.mindspring.net> In article <8779su$sak$1 at nnrp1.deja.com>, wrote: > >Would anyone explain to me where there is a difference between the >following two calls: > >if some_var == None : print 'var is none' > >if some_var is None : print 'var is none' The latter is faster because it does a direct object comparison rather than going through the conversion. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From alex at somewhere.round.here Sun Feb 6 14:55:26 2000 From: alex at somewhere.round.here (Alex) Date: 06 Feb 2000 14:55:26 -0500 Subject: chdir questions References: Message-ID: > I know this is must be an easy one but how do I use os.chdir? I have > tried many different ways of listing the path but no matter how I type > it I get an error. Most common is either: > > >>> os.chdir(C:\temp) > File "", line 1 > os.chdir(C:\temp) > ^ > SyntaxError: invalid syntax I don't use windows, so there might be another problem with what you're trying to do. However, one thing that struck me about it is that os.chdir is usually passed a string. E.g. you might want to try something like os.chdir('C:\temp'). Alex. From robin at jessikat.demon.co.uk Tue Feb 1 08:20:07 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Tue, 1 Feb 2000 13:20:07 +0000 Subject: shelve implementation References: <20000201.10464788@sparky.spkydomain> Message-ID: In article <20000201.10464788 at sparky.spkydomain>, David Fisher writes > > >>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< > ... >On another archeologial note, both cStringIO and cPickle are copyright >Digital Creations and are the only modules that i have found: > >#define UNLESS(E) if(!(E)) > >which lets them write code like: > > UNLESS(PyArg_ParseTuple(...)) > return NULL; > >which i think is unbearably cute. > > > > mumble mumble err err? :) Somehow I had assumed loads, dumps were intrinsic and not synthetic. As for cute I seem to remember B or maybe bcpl had 'unless' (or the equivalent) or maybe I've gone gaga. -- Robin Becker From hnowak at cuci.nl Thu Feb 10 17:25:14 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Thu, 10 Feb 2000 23:25:14 +0100 Subject: perl chomp equivalent in python? In-Reply-To: Message-ID: <200002102225.XAA22165@dionysus.fw.cuci.nl> On 10 Feb 00, at 16:31, Justin Sheehy wrote: > > Of all newgroups, certainly comp.lang.python would be > > sympathetic to this issue. ;-) > > Last time I checked, Python wasn't sensitive to extra whitespace at > the _end_ of a line. With one exception... print 1+ \ 2 In this (admittedly silly) example, whitespace after the \ will cause a SyntaxError: invalid token. I'm curious why this hasn't been fixed yet? Probably a matter of "looks easy, difficult to do"? --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From gerrit.holl at pobox.com Mon Feb 21 10:30:16 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 16:30:16 +0100 Subject: Which GUI? In-Reply-To: <20000221104750.25346.qmail@web3607.mail.yahoo.com>; from ndev42@yahoo.com on Mon, Feb 21, 2000 at 02:47:50AM -0800 References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> Message-ID: <20000221163016.B2377@stopcontact.palga.uucp> > > > --- Gerrit Holl wrote: > [...] > > > - Does not need ANY extra library to compile, i.e. > > > knows how to talk to the underlying windowing > > > library underneath, > > > whether it is X11, Motif, Windows or Mac. > > > > This does not exist. > > Tcl/Tk does just that. Tk *is* an extra library you'll newed to compile/install. > > > - Clean design, if possible OO. > > > > All GUI's have this feature, As Far As I Saw So Far. > > Tcl/Tk is not OO (at least not in its base version). Tkinter *is* OO, and the fact the underlying Tcl/Tk isn't bothers me a lot. > [...] > > > The only problem I have > > > with Tkinter is that it is truly > > > Python/Tkinter/Tcl/Tk, which > > > means a whole bunch of software to install > > > before you > > > actually can get a single widget on screen. > > > > On Windows, this is needed for every GUI. On Linux, > > GTK and QT are most likely already installed. > > > What about Solaris? HPUX? IRIX? AIX? OSF/1 or the > latest True64? They do not come with fancy GUI > stuff pre-installed, only X11. I know. > "Most-likely installed" is not enough. It is either > there or not. X11 is always there on Unixes, otherwise > the user would not even bother about GUIs. I agree. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From effbot at telia.com Wed Feb 2 12:26:46 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 17:26:46 GMT Subject: Python and TCL (Tkinter) problem References: <38980770.2C52DCB9@technidata.de> Message-ID: Ralph Kopp wrote: > I have an problem with python and tcl8.1 and I hope somebody can help me > TclError: Can't find a usable init.tcl in the following directories: > > > This probably means that Tcl wasn't installed properly. > -------------------------------------------------------------------------- -------------------------- Tkinter as distributed with Python 1.5.2 does *not* work with Tk 8.1 and later. either use 8.0.5, or get patches from here: http://www.deja.com/getdoc.xp?AN=484958681&fmt=text From flounder_pounder at telebot.com Wed Feb 9 13:39:37 2000 From: flounder_pounder at telebot.com (flounder) Date: Wed, 09 Feb 2000 18:39:37 +0000 Subject: Question about encryption in Python Message-ID: <38A1B469.35E03159@telebot.com> An HTML attachment was scrubbed... URL: From aahz at netcom.com Wed Feb 9 17:13:11 2000 From: aahz at netcom.com (Aahz Maruch) Date: 9 Feb 2000 22:13:11 GMT Subject: Python and Klingons References: <38A1AACB.8A5D0933@callware.com> <38A1DC11.A815C692@callware.com> Message-ID: <87sopn$km8$1@nntp6.atl.mindspring.net> In article <38A1DC11.A815C692 at callware.com>, Ivan Van Laningham wrote: > >-ly y'rs, I prefer sodium. -- --- 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 Nostalgia just ain't what it used to be From gmcm at hypernet.com Tue Feb 1 23:27:40 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 1 Feb 2000 23:27:40 -0500 Subject: using marshal module In-Reply-To: <3897af70$1@news.actrix.gen.nz> Message-ID: <1262656859-6533134@hypernet.com> Christine Davis writes: > > I am new to python (but old(er) to C++); and trying to get a script to > work. What it is meant to do, is reads in a file, config.db and then > changes the values of one of the fields, and write the revised contents > back. if I call dump(, pointer>) no change seems to take place. (The field isn't changed, nor > does the field get concatenated at the end. > > I have this feeling I may be missing out something important, but silly. You got that right . By leaving out the mode, you are opening the file for read access. Just like in C, you probably want "r+b" and a seek(0), or two files. > Here is the piece of broken code: > > # open the file > fp = open(filename) > datastuff = marshal.load(fp) > > # change the field > datastuff['field'] = 'new string of stuff' > > # "write it back to the file" > # also tried "marshal.dump(datastuff, fp)" which didn't work either > marshal.dump(datastuff['field'], fp) > > # close the file > fp.close() > > > -- > http://www.python.org/mailman/listinfo/python-list - Gordon From effbot at telia.com Sun Feb 27 10:46:02 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 15:46:02 GMT Subject: Checking Suspicious Functions References: Message-ID: <_Ebu4.768$y3.191191040@newsb.telia.net> Moshe Zadka wrote: > After Tim and mine discusion, I thought writing code for a change would be > nice. Here's a rough draft of my "checking whether a function can return a > value from one place and return None from another" code: is that "None" or "none"? if the latter, Skip posted patches to compile.c long ago: http://www.musi-cal.com/~skip/python/ if the former, why? when did None stop being a valid return value? From kc5tja at garnet.armored.net Sun Feb 13 21:02:55 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 14 Feb 2000 02:02:55 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> Message-ID: In article <000001bf768e$48e40580$45a0143f at tim>, Tim Peters wrote: >class BinTree: > # with members .left and .right of type BinTree (& None means none), > # and .data of an arbitrary type > ... > def traverse_post(self): > for child in self.left, self.right: > if child is not None: > suspend child.traverse_post() > suspend self.data > >b = BinTree() >... >for leaf in b.traverse_post(): > process(leaf) I'm sorry, but I can't follow this code at all. What are the precise semantics of suspend here? How does it return? -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From gerrit at nl.linux.org Mon Feb 28 03:25:44 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Mon, 28 Feb 2000 09:25:44 +0100 Subject: name of object inside it's methods? In-Reply-To: ; from moshez@math.huji.ac.il on Mon, Feb 28, 2000 at 08:43:25AM +0200 References: Message-ID: <20000228092544.B1416@stopcontact.palga.uucp> > On Mon, 28 Feb 2000, Michal Wallace (sabren) wrote: > > > A) you could recursively loop through all the namespaces > > available to your program and do an "is" check against > > everything you find.... > > Which wouldn't work if the object doesn't have a Python visible name, > like a Python object inside a list. > > > B) you could give the object a .Name attribute and just > > use that instead. :) > > class foo(): > pass > b = foo() > b.Name = "b" > a = b > print a File "", line 1 class foo(): ^ SyntaxError: invalid syntax regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From thor at localhost.localdomain Sun Feb 13 06:05:28 2000 From: thor at localhost.localdomain (Manuel Gutierrez Algaba) Date: 13 Feb 2000 11:05:28 GMT Subject: MiniBloquiHeader Message-ID: In http://www.ctv.es/USERS/irmina/Mini/MiniBloquiHeader.html you can find a nice application for doing Headers in TeX/LaTeX using a small python script that implements a tiny Block-based language. Pretty nice for programming documentation guys. But nice too in general. -- MGA From aa8vb at yahoo.com Fri Feb 25 11:05:39 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 25 Feb 2000 11:05:39 -0500 Subject: idlerc.py In-Reply-To: <5Rwt4.22183$Jz3.111477@nnrp1.uunet.ca> References: <20000225073335.A3192031@vislab.epa.gov> <5Rwt4.22183$Jz3.111477@nnrp1.uunet.ca> Message-ID: <20000225110539.A3389718@vislab.epa.gov> Warren Postma: |> Now is there a way to put these color settings in an ".idlerc" of sorts so |> they're kept from version to version without hacking any source? | |How about checking your working (and home directory for unix} for an |"idlerc.py" on Unix and if so, run it. Sounds good, but IDLE doesn't support it. |Problem with .idlerc is it's very Unix-ish and wouldn't fit in on Win32, |whereas an INI file or Registry is very Windows-ish and not very Unix. True, though NT has homedirs for users I believe, on MSWin FAT FS (and VFAT too IIRC) can't handle files beginnning with dot. |Compromise? :-) Hmm. Well, maybe we don't need too. IDLE is a Tk app, right? Why not use the Tk mechanisms for specifying resources? On UNIX, that translates into .Xdefaults. On MSWin, that's tk.tcl file (according to Brent Welch in his Tcl/Tk book). The difference is abstracted by Tk and the app code is the same. -- Randall Hopper aa8vb at yahoo.com From gmcm at hypernet.com Thu Feb 17 22:31:34 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 17 Feb 2000 22:31:34 -0500 Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <38AC9D57.5CC8066C@mincom.com> Message-ID: <1261277864-11095295@hypernet.com> John Farrell wrote: > I agree that Python's OO features feel added on. Consider: > > * You have to pass self to each member function. There's no obvious > requirement that self need actually be the bound instance. No, you have to code the method with an explicit self. The "bound" part means it doesn't have to be passed in. And you can't bind to something that's not an instance. > * Classes are not types. This strongly suggests that Python had > types other than 'instance' first, and when objects were added, > it was too late to make all types classes. > * In a method, fields of the bound instance need to be referenced > through the self parameter, because the scoping rules do not understand > about instance variables. In a language where variables don't have to be declared, creating scoping rules that could tell the difference between an instance variable and a local would be a, um, challenge. > * Proper OO languages do not use white space to delimit blocks, > and use semicolons and block delimiters. The really good ones use intention . > That last one's a joke! Don't turn this into another white space thread! - Gordon From bed at adtranzsig.de Wed Feb 9 10:34:52 2000 From: bed at adtranzsig.de (Oliver Benduhn) Date: Wed, 9 Feb 2000 16:34:52 +0100 Subject: telnet functions Message-ID: <87s1eu$n57$2@desig-bs01-s04.adtranzsig.de> hello, does anybody here has any good experiences with telnet over an Python script. There is an Telnet Module but it doesnt offer the functions i need. i has to log me on with user-name and password and i have to start a Perl-Script on a Sun-Unix mashine. thanks -- mit freundlichen Gr??en Oliver Benduhn From sabren at manifestation.com Fri Feb 11 13:48:56 2000 From: sabren at manifestation.com (Michal Wallace) Date: Fri, 11 Feb 2000 13:48:56 -0500 Subject: javadoc equivalent? Message-ID: <881lj1$5af$1@nntp6.atl.mindspring.net> Hey All, Is there a tool similar to javadoc in python? Something that would go through a .py file, read the doc strings (assuming they're in there), and then print the results in a nicely formatted HTML document? Could such a beast read docstrings in .pyc's, or do they get compiled out? -Michal http://www.sabren.com/ From anthonydelorenzo at my-deja.com Sat Feb 5 14:29:39 2000 From: anthonydelorenzo at my-deja.com (anthonydelorenzo at my-deja.com) Date: Sat, 05 Feb 2000 19:29:39 GMT Subject: Python XML processing of RSS files References: <87f843$k4u$1@nnrp1.deja.com> Message-ID: <87htn0$e7c$1@nnrp1.deja.com> > I'm working on adding a newsfeed via RSS (rich > site summary) files, which are in XML. OK, so I ditched Pyxie and actually managed to implement a solution using an xmllib.XMLParser class. However, I'm still sure that my program could be better... xmllib seems more suited to dealing with tags than character data... > I did find a link to a library called rssclient, > but the server is down. I'd still like to find this library, if anyone knows where it is. Tony Sent via Deja.com http://www.deja.com/ Before you buy. From vetler at ifi.uio.no Wed Feb 23 08:29:35 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: Wed, 23 Feb 2000 14:29:35 +0100 (MET) Subject: Which GUI? In-Reply-To: <20000223083325.B1000@stopcontact.palga.uucp> Message-ID: on 2000-02-23, Gerrit Holl wrote: > > > * Gerrit Holl > > > * Tkinter is built on Tcl/Tk, but because the bridge between > > > Tkinter and Tcl/Tk is too large, Tkinter needs to provide their > > > own documentation and advantages. > > > > It has already been mentioned in another posting that Tkinter in fact > > does *not* depend on Tcl. (It was Fredrik Lundh in > > ). > > Even worse. > Tkinter needs to provide their own documentation this is actually wrong. I use the Tcl/Tk documentation all the time when I'm using Tkinter. no problem. > and advantages, while wxWindows or QT already has lots of > documentation, that not need to be copied into wxPython and PyQT. wxPython and pyQt are not as portable as Tkinter. > I repeat: > > Tkinter reinvents the wheel. > WxPython uses existing code. > > Tell me, what's more OO? Tkinter does NOT reinvent the wheel. I can't understand where this comes from. Tkinter uses existing code! It is not base directly on libX11! vr From a.eyre at optichrome.com Tue Feb 1 09:43:37 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 1 Feb 2000 14:43:37 -0000 Subject: Packages, modules, libraries,... In-Reply-To: Message-ID: <000201bf6cc2$b8fc7030$3acbd9c2@peridot.optichrome.com> > Just to be sure: I guess I have to import cafe before I can import > cafe.bacon. No, but be aware that importing cafe.bacon will implicitly import the cafe package first, so any code in __init__.py will get executed first. > Are there any special demands on cafe/__init__.py compared to > ordinary modules? Not as far as I am aware. Bear in mind that any symbols exported in the __init__.py file will be put in the cafe namespace, so be cafeful not to use the same names as any modules in the cafe package. Oh. One more thing I forgot to mention. A package has an additional attribute called "__path__" which is the full path that the __init__.py file is in. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From frederic.laurent at sxb.bsf.alcatel.fr Thu Feb 17 03:13:00 2000 From: frederic.laurent at sxb.bsf.alcatel.fr (Frederic LAURENT) Date: Thu, 17 Feb 2000 09:13:00 +0100 Subject: simple java parser Message-ID: <38ABAD8C.DD5E5A0C@sxb.bsf.alcatel.fr> Hello I need to use a simple java parser. Is an existing parser available, or is somebody used to use the parser module in order to make one quickly ? thanks in advance -- Fred From effbot at telia.com Mon Feb 21 15:13:37 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 20:13:37 GMT Subject: Int methods (was RE: string.py) References: Message-ID: Quinn Dunkan wrote: > Beautiful! Move aside, "greedy matching", let's go change the re > documentation to say "maximal munch". does "munching" really involve backtracking? (greedy matching means "match as much as possible, as long as the rest of the expression matches the rest of the target string". iirc, python's tokenizer doesn't backtrack). From bgdarnel at my-deja.com Tue Feb 8 15:38:26 2000 From: bgdarnel at my-deja.com (Ben Darnell) Date: 8 Feb 2000 20:38:26 GMT Subject: Python Palm Pilot Hotsync Conduit References: <879010fcpj.fsf@iname.com> Message-ID: In article , Jeff Senn wrote: >You could possibly even use pyrite/pilot-link on windows -- I did some >work awhile ago to get pilot-link stuff to work on windows -- but it >would not integrate well into your world if you use Palm's Hotsync. But wouldn't it be possible to get Pyrite to use your code instead of pilot-link on Windows, thus getting full integration with Palm's Hotsync from a cross-platform conduit? I think this idea is worth pursuing (although I'm not the person to do it, since I don't work with Windows much). -Ben -- Ben Darnell bgdarnel at unity.nc su.edu http://thoughtstream.org From landauer at apple.com Thu Feb 10 22:12:23 2000 From: landauer at apple.com (Doug Landauer) Date: Thu, 10 Feb 2000 19:12:23 -0800 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <8ED6BCFDChdjsdhdfh75738@news.sshe1.sk.wave.home.com> Message-ID: > Rule of Software Systems: Upgrade software when it fixes bugs you > need fixed, or adds features you need added. Never anytime else. Aw, c'mon, this is comp.lang.python. Upgrade your software any time it looks like it will make programming more fun!!! Oh, ya, and those other things times you suggested. -- Doug Landauer landauer at apple.com (work) landauer at scruznet.com (not-work) From tothfile at freemail.hu Tue Feb 1 08:44:02 2000 From: tothfile at freemail.hu (Attila =?iso-8859-1?Q?Filet=F3th?=) Date: Tue, 01 Feb 2000 14:44:02 +0100 Subject: What is winfo_id() under Win32 References: <3890439A.1C1BA6D2@freemail.hu> <86pt4k$f6h$1@nnrp1.deja.com> <38916AC9.AD1008A2@freemail.hu> Message-ID: <3896E322.4FC286C4@freemail.hu> Hi! > 'CreateWindowFromHande'. > > Damn - should cut and paste :-) CreateWindowFromHandle - didnt have > the 'l' Oh no, I was lame, I should have spotted it. It works fine with 'l' :-) [ hwnd = self.winfo_id() wnd = win32ui.CreateWindowFromHandle(hwnd) parent = wnd.GetParent() parent.ShowWindow(SW_SHOWMAXIMIZED) ] However, I think I will choose Fredrik's solution: [ hwnd = eval(self.wm_frame()) win32gui.ShowWindow(hwnd, SW_SHOWMAXIMIZED) ] Thanks a lot, BR, Attila From tim_one at email.msn.com Sat Feb 26 01:29:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 01:29:59 -0500 Subject: nested functions In-Reply-To: Message-ID: <000301bf8022$e7d061a0$3c2d153f@tim> [Tim, sketches what happens at runtime when building a function object] [Fran?ois Pinard] > It looks more powerful than I imagined! Isn't this one more step towards > lexical closures? :-) Well, Python *already* has closures. They're just more like the Java inner class flavor than the Scheme flavor: explicit importation of objects across scope boundaries, instead of implicit importation of names across scope boundaries. Python's flavor is actually *nice* "in the large" because it makes the boundary leaks explicit. Ir's "in the small" that it sucks by comparison. > Thanks for educating me, and sharing this fine information with us. An answer can only aspire to being but a pale reflection of the glory of the question, so thank *you* for the opportunity to fall short once again . the-joy-is-in-striving-ly y'rs - tim From skip at mojam.com Fri Feb 4 15:02:14 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 4 Feb 2000 14:02:14 -0600 (CST) Subject: An FTP based Python Module repository (was Re: Imagemagick) In-Reply-To: References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <14491.4735.38605.328866@beluga.mojam.com> Message-ID: <14491.12358.631090.221439@beluga.mojam.com> chris> I should note that the important thing here is that the modules chris> are actually _stored_ on the website in question, it must be a chris> complete archive of all the modules it presents, such that other chris> sites could reliably mirror it and get a copy of all the modules. Yes, that makes a much stronger argument for an FTP archive. I suppose you could somehow require the web-base repository to actually contain the stuff it reposits... Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ 847-971-7098 "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From pbible at home.com Sun Feb 20 18:37:06 2000 From: pbible at home.com (Paul E. Bible) Date: Sun, 20 Feb 2000 23:37:06 GMT Subject: Win32Com Question??? Message-ID: I've been reading Mark Hammond's 'Python Programming on Win32' and am trying to get a COM component to work under Python. I've been successful with components using only VARIANTs, but have not been able to get other automation types to work. For example, the following function works just fine: FunctionA(VARIANT vParm1, VARIANT vParm2); but, if the component requires other data types such as BSTRs (see below), Python gives me attribute errors. FunctionB(BSTR bstrParm1, BSTR bstrParm2) I know that Python supports other automation types in Win32Com, but this feature is not explained very well in Mark's book; or at least I didn't see where it was explained. Can someone please elaborate on how to use a COM component that uses data types other than VARIANTS. Thank you in advance, Paul From dgrisby at uk.research.att.com Thu Feb 3 05:24:08 2000 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 3 Feb 2000 10:24:08 -0000 Subject: Communicating with MICO References: <3898d8cb@nntp.server.uni-frankfurt.de> Message-ID: <87bl08$nui$1@pineapple.uk.research.att.com> In article <3898d8cb at nntp.server.uni-frankfurt.de>, wrote: >Howdy - I'm looking for a way to implement a >MICO (CORBA implementation - see http://www.mico.org) >server object with python. Is this somehow possible ? I'm not aware of any Python ORBs which are based on MICO. There are, however, three other ORBs which you can use for your server. MICO clients will be able to connect to the server with no difficulties. Check out omniORBpy: http://www.uk.research.att.com/omniORB/omniORBpy/ Fnorb: http://www.fnorb.com/ ILU: ftp://ftp.parc.xerox.com/pub/ilu/ilu.html I prefer omniORBpy, but I wrote it so I'm not exactly unbiased. Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From pinard at iro.umontreal.ca Sun Feb 20 16:08:28 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 20 Feb 2000 16:08:28 -0500 Subject: ANNOUNCE: Python Compiler (No spell errors) In-Reply-To: Andreas Otto's message of "Sun, 20 Feb 2000 21:19:13 +0100" References: <38B04C41.CCE242FD@t-online.de> Message-ID: Andreas Otto writes: > After implementation of Tcl as compiler-language we have plans for > python. By `python' we usual refer to the system command. We write Python, with a capital, for the programming language. I get that you did not really study, nor use this language yet. You are having _plans_ for Python, indeed? I surely got that you want to make money out of it (there is nothing wrong with that), but I'm still curious about the technical contents of your plans, if about something you do not know yet. I guess you might have to establish some kind of credibility for yourself about Python, before starting to speak business. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bjorn at roguewave.com Fri Feb 18 13:39:11 2000 From: bjorn at roguewave.com (bjorn) Date: Fri, 18 Feb 2000 11:39:11 -0700 Subject: Overloading = References: <88htqk$rb5$1@nnrp1.deja.com> <88jnok$2hl$1@nnrp1.deja.com> Message-ID: <38AD91CE.17FA2503@roguewave.com> How about making register an object. Then you can do: register[r1] = 7 register[r2] = memory[register[r1]] # indirect load? etc. and the implement __getitem__ and __setitem__ to do your magic. --bjorn (ps: assuming r1 = 'r1' or something similar...) jhefferon at my-deja.com wrote: > In article , > Michael Hudson wrote: > > jhefferon at my-deja.com writes: > > > > > I have a class, rclass. It has an attribute value. Can I arrange > > > so that the string > > > r1=r2 > > > sets r1.value to equal r2.value (where r1 and r2 are class > instances, > > > of course) without changing anything else about r1? > > > > No. Assignment rebinds references, rather than affecting objects. This > > is quite a difference from C++ (say), probably one of the harder ones > > to get one's head around. > > > > > > > > And if so, can I also have r1=7 set r1.value to be 7? > > > > > Hmm... do you know about the "exec in globals,locals" style of > > doing things? Though `exec'ing user input sounds deeply unwise to me. > > What is it you are trying to do? Maybe we can come up with a better > > solution (no promises though). > > Thanks. I *am* reluctant to allow students to accidently exec something > that erases all files, or something. > > I am simulating a computer. It is made up of registers and each > register (memory or CPU) may have more than one attribute (for instance, > whether to print it out in binary or hex, or how many times it has > been referenced in this program, or what source line compiled to this > register, etc.). That's why each register is a class instance rather > than a simple variable. > > I want to have the obvious GUI, that allows a person to scroll through > memory, for instance. I also want to allow them to do things like > set a register `rA=7' or `rA=memory[52]'. > > In the register class I can use __setattr__ to let me write either > `rA.value=7' or `rA.value=memory[52]', > right (I look at the type of the thing on the right and if it is a > class instance then I see if, say, memory[52].classtype==``register'')? > But I can't eliminate the `.value' on the left? I thought maybe I could > mess with the top-level dictionary (I don't know what I mean by that!). > > Thanks again, > Jim Hefferon jim at joshua.smcvt.edu > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list From lutz at rmi.net Wed Feb 2 13:11:08 2000 From: lutz at rmi.net (Mark Lutz) Date: Wed, 2 Feb 2000 11:11:08 -0700 Subject: IPC8 Proceedings on www.python.org? When? References: Message-ID: This is perhaps not exactly what you seek, but has everyone seen Frank Willison's write-ups about the coference yet? They live here: http://www.oreilly.com/frank/ There are 3 articles about the conference there. --Mark Lutz (http://rmi.net/~lutz) ------ (note: my web page is temporarily unavailable, while my ISP searches for a clue) Peter Funk wrote in message news:m12FvnC-000CywC at artcom0.artcom-gmbh.de... > I can hardly wait to see the IPC8 conference proceedings on www.python.org. > Can somebody tell, when they will appear there? > > Regards, Peter > -- > Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 > From python-list at teleo.net Fri Feb 18 14:36:38 2000 From: python-list at teleo.net (Patrick Phalen) Date: Fri, 18 Feb 2000 11:36:38 -0800 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') In-Reply-To: References: Message-ID: <0002181140220L.01356@quadra.teleo.net> [Moshe Zadka, on Fri, 18 Feb 2000] :: On Fri, 18 Feb 2000, Michael [iso-8859-1] Str?der wrote: :: :: > I guess I have to rewrite my synchronous code completely :: > if I want to write a medusa handler. Am i right? :: :: Yep. Medusa is only syntactic sugar for a raw select(), which tends to :: make your code inside-out (so to speak). If you want to do it simply, :: consider mixing in ThreadingTCPServer and do it in threads. :: :: (That of course assumes you are on a platform which uses threads. I :: believe Python can use threads on Win32 and on most Unices, but I may be :: wrong) That's right -- since the introduction of the PyThreadState structure in 1.5. Be mindful also that the global lock will be in effect. From infotechsys at pivot.net Tue Feb 29 15:26:29 2000 From: infotechsys at pivot.net (Wayne) Date: Tue, 29 Feb 2000 15:26:29 -0500 Subject: Why doesn't the text appear? Message-ID: <38BC2B74.665D8E80@pivot.net> Hello, I have two module . In the first I have this code- # test call method from Tkinter import * from TestModule import * class CallModule: def __init__(self, master): frame = Frame(master) frame.pack() self.bCall = Button(frame, text = "Next", command = self.callModule) self.bCall.pack(side = LEFT) self.bQuit = Button(fram, text = "Quit", command = frame.quit) self.bQuit.pack(side = LEFT) def callModule(self): doNextModule() root = Tk() callmodule = CallModule(root) root.mainloop() In the second file I have the code below. I would like to know why the text is not visible when the window appears but if the "Enter" key is pressed I see the text on my termonal? TIA. Wayne from Tkinter import * class Var: def __init__(self, master): frame = Frame(master) frame.pack() self.field = Entry(frame) self.field.pack() self.value = StringVar() self.value.set("Jean-Paul Sartre") self.field["textvariable"] = self.value self.field.bind('', self.print_value) def print_value(self, event): print 'Value is "%s"' % self.value.get() def doNextModule(): root = Tk() var = Var(root) root.mainloop() From skip at mojam.com Tue Feb 15 12:36:35 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 15 Feb 2000 11:36:35 -0600 (CST) Subject: why don't my global variables get initialized? In-Reply-To: References: Message-ID: <14505.36515.741649.992574@beluga.mojam.com> Nathan> However, this doesn't seem to be working, because none of those Nathan> three global variables are initialized after I call the Nathan> function: Nathan> Python 1.5.2 (#1, Jul 22 1999, 11:59:40) [GCC 2.8.1] on sunos5 Nathan> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>>> from genetics import * >>>> init_global_data('att48.tsp') >>>> num_cities Nathan> 0 >>>> citylist Nathan> [] >>>> matrix Nathan> [] Nathan> Those are the default values those variables started out with. All you've done is create new names that reference the initial values. The values in the module were updated, but the names in the current scope were still referencing the old values. Try the following instead: impor genetics genetics.init_global_data('att48.tsp') print genetics.num_cities print genetics.citylist print genetics.matrix from-module-import-*-strikes-again-ly y'rs, Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From michael.stroeder at inka.de Tue Feb 22 02:44:04 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Tue, 22 Feb 2000 08:44:04 +0100 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') References: Message-ID: <38B23E44.8EF86BDD@inka.de> Moshe Zadka wrote: > > On Sat, 19 Feb 2000, Michael [iso-8859-1] Str?der wrote: > > > Moshe Zadka wrote: > > > Yep. Medusa is only syntactic sugar for a raw select(), which tends to > > > make your code inside-out (so to speak). If you want to do it simply, > > > consider mixing in ThreadingTCPServer and do it in threads. > > > > But if I use threads I don't have to use Medusa at all... > > That was the idea.... Using threads was just adding a few more lines. :-) Ciao, Michael. From JGRAVES3 at austin.rr.com Tue Feb 22 18:33:04 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Tue, 22 Feb 2000 23:33:04 GMT Subject: Porting Python to non-pc platforms (AS/400) References: <38B313D6.AD23EAB2@ttm.com> <14515.5580.141809.386579@beluga.mojam.com> Message-ID: >How about springing for the C compiler and doing the port? There's not >really a chance to after that question. I presume that the C >compiler for the AS/400 isn't free. Consequently, the port is not likely to Its about $1200 for my machine. >happen in the traditional manner (person x discovers Python's not available >on his favorite platform, y, so he downloads GCC and ports it). >Consequently, the port will have to come (mostly) from the community that >uses the platform and has the bucks to spring for the compiler. I have VERY little experience with C (I can recognize a C program 2 out of 3 times. (-: ) In your opinion, how hard is Python to port? If I shell out the bucks for a compiler, what chance to you give a neophyte C programmer of getting it to compile and run? >Just out of curiosity, what language have you standardized on, and on what >platforms? I know you asked this question of Scott, but I'll reply for the AS/400 community in general. I would guess 90% of all application development is done in some variant of RPG. Cobol probably makes up the other 10%. OS/400 is mainly an applications box with a very good and robust DB built-in. Also to that end, there are OS features that allow groups of DB records to be displayed on the screen efficiently. As I understand it, these features are hard to code in C (or at least harder than RPG/COBOL). Also, its only within the last 3-4 years that the C compiler has achieved acceptable performance. IBM is pushing Java very hard to fill in as an applications language and have made great strides, but most new development on the AS/400 is still done in RPG. I'm new to Python but it has taken a deep hold over me. I very much want to use it in my AS/400 work. I may have to think spending the dough on the C compiler. Thanks for your time... Jay Graves From ngps at madcap.dyn.ml.org Fri Feb 4 02:46:42 2000 From: ngps at madcap.dyn.ml.org (Ng Pheng Siong) Date: 4 Feb 2000 07:46:42 GMT Subject: [ANNOUNCE] M2Crypto 0.03 Message-ID: <389a83e2.0@news.cyberway.com.sg> [ Apologies if you see this more than once. It seems my ISP runs a random discard filter on stuff going thru its mail and Usenet systems. ] Hello, I am pleased to announce the release of M2Crypto 0.03. M2Crypto = Python + OpenSSL + SWIG. It makes accessible to the Python programmer DH, DSA, RSA, symmetric ciphers, message digests, HMACs and sufficient SSL functionality to implement servers and clients. M2Crypto's SSL support includes https servers (based on Medusa and Zope's ZServer), https enhancements to Python's client-side web libraries, and three models for building SSL servers: forking, threading and asynchronous socket I/O. This release bundles a HTTPS server and an encrypting Medusa monitor compatible with Zope 2.1.3, provides XMLrpc-over-HTTPS functionality, and has the beginnings of PGP2 support. M2Crypto is available here: http://www.post1.com/home/ngps/m2 Feedback is most appreciated. -- Ng Pheng Siong * http://www.post1.com/home/ngps -- Ng Pheng Siong * http://www.post1.com/home/ngps From prudek at nembv.cz Fri Feb 25 08:14:39 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 14:14:39 +0100 Subject: Bring value from walk() References: <38B663AF.EDF3622E@nembv.cz> <38B67709.53302F15@mach.uni-karlsruhe.de> Message-ID: <38B6803F.ED046DB3@nembv.cz> > In Estimatespace you should initialize Total with zero, > so python knows the value the first time you add Fs to it. > And then return Total. If I initialize Total in Estimatespace, it will be initialized each time walk is executed. And single walk() line actually means that Estimatespace is called many times (as many as there are subdirs within RootDir), therefore Total will be zero. -- Milos Prudek From michael.stroeder at inka.de Tue Feb 22 05:25:05 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Tue, 22 Feb 2000 11:25:05 +0100 Subject: eqiv of perl's CGI.pm? References: <38B23CD8.8C2DE915@inka.de> <00022200295401.00839@quadra.teleo.net> Message-ID: <38B26401.B56DE08B@inka.de> Patrick Phalen wrote: > > :: Have a look at http://sites.inka.de/ms/python/pylib/. If you're > :: interested in using that drop me a note and I will package a newer > :: version with demo script. > > Well, I'm certainly interested; I was getting ready to write something > quite similar this week ... so thank you! I updated cgiforms.py and uploaded test-cgiforms.py as a demo on: http://sites.inka.de/ms/python/pylib/ License: GPL > I'm afraid I may need to invest in a German/English dictionary, however. > ;) Sorry, due to workload I can't translate the texts and comments in a reasonable time frame. This module wasn't meant to be released to the public in the first place. Note: - Unlike cgi.py this module does only handle input data of type application/x-www-form-urlencoded. - Unlike cgi.py (and older cgiforms.py versions) this module should now be thread-safe if you set the parameters for formClass.__init__() - I don't care if future releases of this module breaks your code. Ciao, Michael. From pehr at pehr.net Thu Feb 17 02:24:47 2000 From: pehr at pehr.net (pehr anderson) Date: Thu, 17 Feb 2000 07:24:47 GMT Subject: morsaeall: morse-code terminal emulater in python Message-ID: <38ABA257.89A935BC@pehr.net> Dear Pythonistas, http://pehr.net/morseall Morseall-0.1.1 is the latest in minimal user-interface design, It gives you access to a one-button shell. Ever wanted to control your computer with a single switch? Relax! Now you can with this handy pygnome app. If you knows somebody who has trouble using a normal keyboard, this might be just the ticket. I'm looking for testers and real-world feature requests This started out as a computer interface for a quadrapelegic individual. If things go well, it could make a sweet inerface for a wearable with a heads-up display. Or use it at work until your Carpal Tunnel Syndrome goes away! The primary code drives the gnome zvt widget and gives you a really high quality shell. I also include earlier code which does as much as I could with Tkinter. (too bad tk doesn't have a great terminal emulator widget.) I'd like to extend this to work with the ncurses library, but I'm not up-to-speed on python extension modules. The current ncurses code doesn't have bindings for mouse calls. (left mouse button = morse code key). Let me know what you think! And share it with anybody who needs a more accessable desktop interface. -pehr From mwh21 at cam.ac.uk Thu Feb 10 03:35:11 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 10 Feb 2000 08:35:11 +0000 Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> Message-ID: Morning! "Evan Simpson" writes: > Bob Alexander wrote in message > news:00e401bf7332$4aea6ea0$74eb0b18 at stcla1.sfba.home.com... > > It can't be encapsulated into something that looks like a function call > > since Python doesn't support macros. Functions always evaluate all of > their > > arguments before invoking function code, so there is no way to evaluate > only > > one of the selected expressions. > > Sure it does. They're called bytecodehacks :-) Thanks for the plug. > Even better, they are > *semantic* macros, and can achieve feats to which no mere syntactic macro > could aspire. Evan, what are you talking about here? As far as I understand it, the effects that can be acheived with the "semantic" bytecodehack-y macros is a strict subset of what could be acheived with a full-blown syntax- mutating macro facility. The main distinction of bytecodehacks' macros is that that are inherently hygenic, i.e. you don't end up overwriting local variables just because you happened to use that variable name in the routine you use the macro in. Unless I created something I really didn't understand... ooh-look-bricktext-ly y'rs Michael From aya at waena.edu Thu Feb 3 01:29:24 2000 From: aya at waena.edu (aya) Date: Thu, 3 Feb 2000 01:29:24 -0500 Subject: _opengl mystery Message-ID: <38992034@9.242.61.10> Hi Pythonamians, About 1 hour ago I took a look at Python for the first time. I installed all the binaries and modules, and, as expected, none of the demos ran. But at least they all barf on the same error: <<<<< Traceback (innermost last): File "./jw.py", line 7, in ? from OpenGL.Tk import * File "/usr/lib/python1.5/site-packages/OpenGL/Tk/__init__.py", line 9, in ? from OpenGL.GL import * File "/usr/lib/python1.5/site-packages/OpenGL/GL/__init__.py", line 7, in ? from _opengl import * ImportError: No module named _opengl >>>>> and in the file /usr/lib/python1.5/site-packages/OpenGL/GL/__init__.py..... <<<<< import OpenGL.shared import OpenGL if OpenGL._numeric: from _opengl_num import * from openglutil_num import * else: from _opengl import * from openglutil import * >>>>> So. my question is: 1) Why would this module import another module that doesn't exist? 2) Where can I get these modules (either the numeric or the _opengl). I have installed python-doc-html-1.5.2-1.noarch.rpm python-opengl-1.5.5-2.i386.rpm python-imaging-1.0b1-3.i386.rpm python-tkinter-1.5.2-2.i386.rpm python-imaging-_tkinter-1.0b1-3.i386.rpm and all the supporting libs, but none of these have _opengl in them 3) Am I correct in assuming that the file in question is called "_opengl.py"? When I do a 'locate _opengl' all I get is /usr/lib/python1.5/site-packages/OpenGL/shared/linux2/_opengl_nummodule.so /usr/lib/python1.5/site-packages/OpenGL/shared/linux2/_openglmodule.so 4) is that _opengl_nummodule.so the numeric module for python? If so, why does "if OpenGL._numeric:" fail in the file "/usr/lib/python1.5/site-packages/OpenGL/GL/__init__.py"? Thank in advance for putting up these newbie questions -aya From mwh21 at cam.ac.uk Wed Feb 2 10:47:12 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 02 Feb 2000 15:47:12 +0000 Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> <38975766.21B319AD@dcs.kcl.ac.uk> Message-ID: Bernhard Herzog writes: > Laurence Tratt writes: > > > stevie_deja at my-deja.com wrote: > > > > > Would anyone explain to me where there is a difference between the > > > following two calls: > > > > > > if some_var == None : print 'var is none' > > > > > > if some_var is None : print 'var is none' > > > > > > Can '== None' only be used in certain circumstances? > > > > In this particular circumstance, both lines of code will always produce the > > same result; > > Whether they're equivalent depends on what some_var actually is. If it's > a class instance whose class implements the __cmp__ method it may well > be equal but not identical to None: > > >>> class C: > .. def __cmp__(self, other): > .. return cmp(None, other) > .. > >>> c = C() > >>> c == None > 1 > >>> c is None > 0 > >>> > Yikes! That's impressively devious. I-always-*knew*-there-was-a-reason-I-always-use-"is"-ly y'rs Michael From moshez at math.huji.ac.il Fri Feb 18 13:31:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 20:31:59 +0200 (IST) Subject: module for sed, the stream editor In-Reply-To: <38AD7D2F.F4DEFD45@pacific.jpl.nasa.gov> Message-ID: On Fri, 18 Feb 2000, Benyang Tang wrote: > Is there a python module to do sed, the stream editor? Well, there isn't a whole lot that sed can do that a combination of the fileinput module, the string module and the re module can't do. Try looking at the documentation of those modules and see if it helps any. If, specifically, you are asking if there is a module to parse sed commands and transform them to a function taking a line and returning a line, then I know of no such module, and suspect there isn't one. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From phd at phd.russ.ru Thu Feb 17 07:10:43 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 17 Feb 2000 12:10:43 +0000 (GMT) Subject: FTP In-Reply-To: <000b01bf793f$c28a5750$3acbd9c2@peridot.optichrome.com> Message-ID: On Thu, 17 Feb 2000, Adrian Eyre wrote: > I'm aware of the ftplib module for use in ftp clients, but has > anyone here [written|seen|heard of|dreamed about] a module which > would provide ftp *server* functionality? Zope (www.zope.org) has builtin FTP server. It is close coupled with rest of Zope, so you cannot just take and use it, but it can give you a start point. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From kens at sightreader.com Tue Feb 22 16:59:03 2000 From: kens at sightreader.com (Ken Seehof) Date: Tue, 22 Feb 2000 14:59:03 -0700 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> <20000218225338.A9457@stopcontact.palga.uucp> Message-ID: <88v1j1$2q3$1@hpbs1500.boi.hp.com> What exactly is it that you want to do? It is unlikely that you really want to overload print (which is impossible anyway). However there is almost certainly a way to do what you want. If the following does not anwer your question, please explain exactly what you want to do (i.e. the end result) and provide an example. 1. Change what gets printed for an instance of a particular class? 2. Change where things get printed to (e.g. message window, socket etc...)? 3. Change the format of what you are trying to print (e.g. no spaces between items, etc.) The answer to 1. is: overload __repr__() or __str__() for your class. The answer to 2. is: replace sys.stdout.write (you still use print, but this will change where the print output goes). This won't change what gets printed, it only changes where everything gets printed to when you use the print command. You don't -use- sys.stdout.write instead of print; you -replace- sys.stdout.write, and -then- use print. Changing sys.stdout.write changes the effect of using print. Only super-geeks are allowed to do this. The answer to 3. is: learn how to use the % format operator. Play around in the interpreter and you will learn everything quickly. >>> a = 'A' >>> b = 'B' >>> pi = 3.1415926535897932 >>> print "%s%s" % (a,b) AB >>> print "pi = %1.4f" % pi 3.1416 >>> print "pi = %1.2" % pi 3.14 Another answer to 3. is: learn to use the + operator for strings >>> print a+b AB Gerrit Holl wrote in message news:20000218225338.A9457 at stopcontact.palga.uucp... > Florent Rami?re wrote on 950907619: > > Thanks for your answers, > > > > in fact as Moshe Zadka told me, it is a documented feature ... (sorry) > > Well, i should have read more carefully the doc (re-sorry) > > And is there a solution to my problem ? > > And sys.stdout.write is not a good solution for me (i need to keep > > printing with print) > > > > Is there an easy way to override the print statement (i saw it one time > > in the news, but i can not find it) > > No. You can't override statements. print is a statement as if, while and > for are statements. > > regards, > Gerrit. > > -- > cat: /home/gerrit/.signature: No such quote or joke > From pinard at iro.umontreal.ca Fri Feb 18 20:32:16 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 18 Feb 2000 20:32:16 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: Alex's message of "17 Feb 2000 23:24:54 -0500" References: Message-ID: Alex writes: > (define-key py-mode-map "\C-c\C-c" > '(lambda () (interactive) > (save-window-excursion > (py-shell) > (while > (save-excursion > (sleep-for 0.1) > (beginning-of-line) > (not (looking-at ">>>"))))) > (py-execute-buffer))) Thanks a lot, again. P.S. - Please privately send me your full name and email address, so I could add a reference comment for the bits of code you sent me. I usually do. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From skip at mojam.com Fri Feb 11 16:16:15 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 11 Feb 2000 15:16:15 -0600 (CST) Subject: range(start,stop) In-Reply-To: <38A478A4.532D73F5@mail.dotcom.fr> References: <38A478A4.532D73F5@mail.dotcom.fr> Message-ID: <14500.31775.253142.367708@beluga.mojam.com> Stephane> What the interest for the range function to stop at stop-1 and Stephane> not at stop ? Well, unless you made a mistake in your message, it does what you ask already: >>> print range(0,9) [0, 1, 2, 3, 4, 5, 6, 7, 8] If what you really meant was why doesn't range(start, stop) include stop in its output, that has to do with consistent modulo arithmetic. Others can describe it better. You might try searching the list archives. I'm fairly certain Tim Peters or GvR have expounded on this topic before. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From amitp at Xenon.Stanford.EDU Thu Feb 3 22:04:20 2000 From: amitp at Xenon.Stanford.EDU (Amit Patel) Date: 4 Feb 2000 03:04:20 GMT Subject: Execfile() - bug / strange behavior Message-ID: <87dfjk$qip$1@nntp.Stanford.EDU> I'm trying to understand why execfile(fn) is different from exec open(fn,'r').read(). Here's my program: ==== def timbot(): a = 3 execfile("1.txt") print a print locals() timbot() ==== Then I have 1.txt: ==== a = 5 b = 8 ==== When I run this, I expect to see a is 5, but I get: ==== 3 {'b': 8, 'a': 3} ==== I don't understand why variable a is not set, but b is! Even stranger, when I try to print b from timbot(), it gives me NameError, even though it's in locals()! When I change execfile("1.txt") to exec open("1.txt",'r').read(), it works just fine! This seems to be different from any recent execfile bugs I can find on Deja, but it sounds like it could be the the same as a bug reported in **1996** (egads! Was Tim even a bot back then? Did we even have 1.5?): http://www.deja.com/getdoc.xp?AN=145064312&fmt=text Any ideas? Either why it's still a bug or what I'm doing wrong or why the documentation is misleading ..? - Amit [In case anyone is wondering, this is Python 1.5.2 for Linux, from RH 6.1] From hamish_lawson at yahoo.co.uk Mon Feb 7 04:19:26 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Mon, 07 Feb 2000 09:19:26 GMT Subject: How do I wrap text? References: <389CD409.C6A884BE@mailexcite.com> Message-ID: <87m2ms$7ec$1@nnrp1.deja.com> You may be interested in my TextFormatter module, which wraps text into columns (including a single column). It's at http://www.cs.st-andrews.ac.uk/~hamish/python/TextFormatter.py Hamish Lawson University of St Andrews, Scotland Sent via Deja.com http://www.deja.com/ Before you buy. From hildeb at www.stahl.bau.tu-bs.de Fri Feb 11 10:24:30 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 11 Feb 2000 15:24:30 GMT Subject: PyApache, couldn't geta hold of author, willing to donate sometime References: Message-ID: On Fri, 11 Feb 2000 14:48:48 +0000 (GMT), Oleg Broytmann wrote: > No, there is no "better", but there is different module - httpdapy. I >personnaly use PyApche, slowly moving from CGIs to Zope, or at least PCGI. Does pyApache have the same performance impact as mod_perl upon the execution time of the programs? We're setting up a bare-bones Apache-1.3.11 server whose main mission is to run a big Python cgi script. Any caveats? From jhouchin at texoma.net Thu Feb 24 10:29:15 2000 From: jhouchin at texoma.net (Jimmie Houchin) Date: Thu, 24 Feb 2000 15:29:15 GMT Subject: Fast way to grab line from file? References: <88sprs$1ao$1@nnrp1.deja.com> Message-ID: <38b54896.5415753@news.texoma.net> Hello, I don't know if you've solved this problem yet, but here goes with what I just recently did. I downloaded the last six month's of Zope's email archives to my PC at work. However Netscape munges the imports and creates many bad messages. The problem is that Netscape splits the file into messages according to a 'from' on a newline. Legitimate froms on newlines which were not headers became interpreted as such. I created a script which parsed my directory of downloads read each file and simply inserted a space before each non-header 'from'. This required knowing which 'from's were headers and which were not. To do this I needed to navigate within each file to determine if the 'from' was followed by other headers. After working thru this I simpled created a list after readlines. f = open(file, 'r') flist = [] for line in f.readlines(): flist.append(line) # insert other work here... This allowed me to open, read, modify and write 28 files and 25 megabytes of messages in less than 90 seconds clock time on a PII 266 running Win95. Writing your readlines() to a list can give line 100 by indexing the list. You could also do something like: # warning not tested. import NewBuiltins # NewBuiltins from Marc-Andr? Lemburg #http://starship.python.net/crew/lemburg/mxTools.html f = open(file,'r') for i, line in irange(f.readlines()): if i == 100: dowork(line) else: pass Hope this can help. Jimmie Houchin On Tue, 22 Feb 2000 01:47:41 GMT, chiefteo69 at my-deja.com wrote: >Hi there, > Does anyone know of a faster way to grab line >100 from a given file without doing 100 readline() >calls? This way is too slow, but I can't find out >how to do this in python. Thanks, > >-Mateo > > >Sent via Deja.com http://www.deja.com/ >Before you buy. From bparsia at email.unc.edu Sun Feb 13 23:13:09 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Sun, 13 Feb 2000 23:13:09 -0500 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> <881ac8$qu4$1@sun.rhrk.uni-kl.de> Message-ID: <1e5yqen.1w4r3yevna9a5N%bparsia@email.unc.edu> Fredrik Lundh wrote: > Markus Kohler wrote: > > > seriously, what are the major shortcomings in Python > > > from a Smalltalk professional's perspective? > > -- Smalltalk's calling mechanism is much simpler than Pythons making it > > easier to compile. > > can you elaborate? Probably not, but that doesn't necessarily stop me (even *if* this was addressed to Markus ;)) > as I see it, python's calling mechanism involves passing > a tuple (and an optional keyword dictionary) to a callable > object. how does smalltalk differ from this? I suspect that Markus may have meant the lookup mechanism, though I'm not sure. I don't know that either the lookup or the call mechanism is "simpler" but it certainly seems *cheaper*. I.e., the cost of a method send is typically negligable. But I suspect that this is a implementation issue. > > Almost every Smalltalk implementation I have seens runs > > faster than Python. > > just one simple question: reading some smalltalk code makes > me think that smalltalk requires you to declare what instance > variables you're going to use? is this true? I'm not sure what you mean. You define classes with ivars, yes. You can change these at anytime, including programmatically. You can catch message sends to non-existent methods (including calls to accessors of non-existent ivars) and redirect them in various ways (including by trapping #doesNotUnderstand:). > can you add extra stuff to an instance afterwards without > any extra cost? There are a variety of things you can do with a variety of costs. It's certainly easy enough, for example, to implemente the __get_attr__, __set_attr__ and friends stuff. > (should of course figure that out myself, but I don't seem > to be squeak-compatible ;-) Sorry to hear that. I'm sure I could help you get up and running. We start with a quick little brain reformat... Cheers, Bijan Parsia. From tim_one at email.msn.com Sun Feb 20 17:56:37 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 17:56:37 -0500 Subject: Continuations and threads (was Re: Iterators & generators) Message-ID: [Aahz Maruch] > Okay, now I'm starting to get this (be very, very frightened). Now, > can you (or someone) provide an equally simple explanation of the > differences between continuations and threads? Given that we already > have threads (sort of), what is the attraction of continuations? The latter are more powerful, but that's not really the attraction. Continuations are both fast and space-efficient compared to threads on most platforms. Read Christian's paper! You'll find, e.g., that his simple implementation of generators using continuations ran 3x faster than a simple implementation using threads (& on a platform that does a relatively good job with threads). My coroutine-on-threads implementation of some six years ago was so slow as to be unusable for any real work. The Stackless coroutine implementation flies (and see Sam Rushing's writings on Medusa & friends for deadly practical high-end applications). > Is it easier to write continuations than simulate threads on an > unthreaded OS? I've never seen an implementation of (pseudo)threads using continuations that I thought was suitable for more than toy researchy problems or educational purposes. When it comes to "real work", the pragmatics are everything. Threads do very well at the things threads were designed to do . In particular, the benefit *most* people get from threads in Python today is simply allowing blocking I/O (or other "system" or "foreign") operations to proceed in parallel with their Python code, and with each other. Since the I/O stuff is coded in vendor C libraries, a Python implementation of continuations can't get at that benefit at all (random C code won't let Python "timeslice" it). So Python threads serve important purposes Python continuations couldn't touch, and also for which the latter aren't pragmatically suited. OTOH, note that backtracking searches, generators, and coroutines (the things the in crowd *really* want continuations for) are *not* pseudo-parallel: they have a single flow of control, albeit not always stack-like, and often execute just a few instructions before needing to "switch". Threads weren't designed for that; you fight them every step of the way; and e.g. on some platforms a thread sucks up a megabyte of stack space, while a continuation will usually suck up only a few hundred bytes. Now picture Sam trying to juggle ten thousand simultaneous socket connections, each servicing a possibly different protocol. There are esoteric variations on continuations designed to deal with "real parallelism" too, but in Python's role as a glue language it's vital to speak the same parallelism language all the apps you're pasting together use. So real Python has to have real threads no matter what. So long as you stay within pure Python, a continuation-based emulation of threads may be suitable for "educational purposes" on platforms without threads -- but that's a lot of work to implement, with little bang for the buck. continuations-suck-but-the-things-you-can-do-with-them-don't- and-for-those-things-threads-suck-worse-ly y'rs - tim From moshez at math.huji.ac.il Sat Feb 19 00:01:41 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 07:01:41 +0200 (IST) Subject: binary distribution for SGI In-Reply-To: <38ADE87D.5E1110FB@pacific.jpl.nasa.gov> Message-ID: On Fri, 18 Feb 2000, Benyang Tang wrote: > Where can I get a binary distribution for SGI? Try mxCGIPython (search for it on the starship) > I tried to compile it > from the source codes but failed; Can you say what failed? > I don't know whether it was because I > did not login in as a root user. Compilers usually don't require you to be root. From felixt at dicksonstreet.com Sun Feb 20 20:36:03 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Sun, 20 Feb 2000 19:36:03 -0600 Subject: data structure design question In-Reply-To: References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> <3.0.5.32.20000217003512.0089b140@mail.dicksonstreet.com> <88gcem$kql$1@mach.vub.ac.be> Message-ID: <3.0.5.32.20000220193603.00804680@mail.dicksonstreet.com> At 14:02 2/17/00 GMT, Michael Zawrotny wrote: >On 17 Feb 2000 08:45:10 GMT, Thomas Hamelryck wrote: What I want to model is an oscillating reaction (the Belousov= Zhabotinsky reaction) and I had a scheme like this in mind: class Atom(QNode): .... class Molecule(QGraph): Node = Atom .... class Solute(Molecule): def __init__(self, concentration, *substargs): self.conc = concentration apply(Substance.__init__, (self,)+substargs) .... class Solvent(Molecule): def __init__(self, fraction, *substargs): self.frac = fraction apply(Substance.__init__, (self,)+substargs) .... class Solution: def __init__(self, solvents, solutes, volume): """set initial concentrations""" def reaction1(self): """use rate law to get changes in concentration""" .... def react(self, iterations, step=1): """run all reactions and update concentrations, every step iterations, store concentrations in the return value""" So, to begin with, the Molecule objects would just do a few things, like calculate their molecular mass, and the meat of the module would be in the reaction methods. I was thinking, though, that if I chose the right data structure for the molecules to begin with, it would be easier to do more at lower levels, later, or to drop in something like MMTK, that would make the Molecules behave so that the reactions were more...automatic. Well, that's probably asking a little too much :) But right now, I'm looking at graphs made of these: class QNode: """QNode -> nodes which keep a count of how many times they are linked """ def __repr__(self): return self._name + `self._index` def __init__(self, name, index): self._name = name self._index = index self.links = {} def link(self, other): """link(other) Set to one/increment link count to node""" self.links[other] = self.links.get(other, 0) + 1 def delink(self, other): """delink(other) Decrement/delete link count to node""" self.links[other] = self.links.get(other, 1) - 1 if not self.links[other]: del self.links[other] ...but maybe there's something I'm not getting and it's a Bad Idea for nodes to carry bond order ? From thamelry at vub.ac.be Wed Feb 9 04:15:44 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 9 Feb 2000 09:15:44 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> Message-ID: <87rb80$chc$2@mach.vub.ac.be> Paul Prescod wrote: : If it takes more than fifteen minutes to retrain the eyes from the old : language to the new language, most programmers will never make the jump. : Why would they, when there are already too many languages to learn that : do not demand eyeball retraining? Because eyeball retraining can be worth it sometimes. Besides, it did not stop Perl from becoming extremely popular. It also takes more than 15 minutes to get used to indentation in Pyton (this regardless whether you start to like it or not). I never seriously tried out smalltalk because I could not get a good free smalltalk implementation, not because of its weird syntax. I still miss a lot of functionality in Squeak, but if that is added I will certainly give it a go. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From tratt at dcs.kcl.ac.uk Tue Feb 15 04:38:49 2000 From: tratt at dcs.kcl.ac.uk (Laurence Tratt) Date: Tue, 15 Feb 2000 09:38:49 +0000 Subject: Help with Python Grammar change References: Message-ID: <38A91EA9.52CA20BE@dcs.kcl.ac.uk> Travis Oliphant wrote: > I have a question for people familiar with the Python Grammar: > > How difficult would it be and what are the problems with altering the > grammar (and compile.c code) [slice notation for function arguments] > Is this at all possible, or would it break things horribly? Whether or not it's possible in this instance (and to be honest, this doesn't seem a particuarly useful change but that's just me), changes to the grammar shouldn't be undertaken lightly. Quite a few of us poor souls out there have Python eating programs of one sort or another and changes to the grammar can cause our programs to fail in baldness inducing ways. If I have to end up looking like a Benny Hill sidekick, it would be nice to know it was in the name of new functionality and not just getting-into-the-realms-of-another-language-beginning-with-P tiny syntactic sugar . in-the-modern-diet--age-why-not-syntactic-aspartame-ly y'rs Laurie From aahz at netcom.com Thu Feb 24 07:27:06 2000 From: aahz at netcom.com (Aahz Maruch) Date: 24 Feb 2000 12:27:06 GMT Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> Message-ID: <89382q$djb$1@nntp6.atl.mindspring.net> In article <38B51486.F0774310 at bibsyst.no>, Thomas Weholt wrote: > >I want to use threading in a server-based search/index application. Any >hints? The Python-docs didn`t help much. Tutorials, examples and code, >pleez. Take a look at this example I posted a while back: http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=570016307&fmt=text Unfortunately, using threading in a server gets a bit more complex and may not buy you very much. If you really want a threaded server, I suggest looking at Zope and Zserver -- they've already done all the hard 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From aahz at netcom.com Tue Feb 22 17:15:16 2000 From: aahz at netcom.com (Aahz Maruch) Date: 22 Feb 2000 22:15:16 GMT Subject: Converting Strings to Integers in Python References: Message-ID: <88v1pk$l42$1@nntp6.atl.mindspring.net> In article , Lenny Self wrote: > >I am new to Python and programming in general. I was wondering if someone >might help me with the proper syntax for converting a string or a portion of >a string into an integer. i = int(s) -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From moshez at math.huji.ac.il Sun Feb 13 01:06:20 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 13 Feb 2000 08:06:20 +0200 (IST) Subject: breaking the ; habit In-Reply-To: <38a5d928@news.isc.rit.edu> Message-ID: On Sat, 12 Feb 2000, osorronophris osorronophris wrote: > I'm a die-hard C++ programmer that recently took up Python for a change of > scenery and am enjoying it greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've tried chewing gum but it > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? Python will work just fine with semicolons at the end of statements, instead or in addition to newlines. it's-braces-it-has-trouble-with-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From greene at hctc.com Mon Feb 21 13:00:59 2000 From: greene at hctc.com (Collin Greene) Date: Mon, 21 Feb 2000 11:00:59 -0700 Subject: could help out a newbie? I WOULD APPRECIATE ANY TIPS Message-ID: i ma new to programming adn i wan to know anything about python that anyone has to tell me also i would like to know where ot donwload python? if you have a follow up please e mail me greene at hctc.com From info at goodswell.com Sat Feb 5 13:04:18 2000 From: info at goodswell.com (info at goodswell.com) Date: Saturday, 05 Feb 2000 12:04:18 -0600 Subject: Help.. News and Mail server Message-ID: <05020012.0418@goodswell.com> Anybody can tell me which News groups server and e-mail server can let me access without password..? Please e-mail me..: info at goodswell.com thanks for help..!! Stephen Lee reg. From tim_one at email.msn.com Sat Feb 5 03:34:42 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 5 Feb 2000 03:34:42 -0500 Subject: failure in test_long under gcc (was RE: errors when doing 'make test') In-Reply-To: <389BDD96.335C10CC@yahoo.com> Message-ID: <002301bf6fb3$d9733b20$182d153f@tim> [posted & mailed] [Al-Amerrho H. Amerin] > I've downloaded the latest CVS snapshot. I was able to compile without > any problems and everything seems to be okay. I can run and use python. > However, when I do 'make test' as the README says, I get these 2 errors: > > 2 tests failed: test_types test_long > > I did the following to determine the exact problem: > ... > long miscellaneous operations > Traceback (innermost last): > File "test_long.py", line 257, in ? > test_misc() > File "test_long.py", line 231, in test_misc > raise TestFailed, "int(long(-sys.maxint-1)) overflowed!" > test_support -- test failed: int(long(-sys.maxint-1)) overflowed! > > These errors seem to be related to 'sys.maxint'. In my box its value is: > > 2147483647 > > My system: > Linux version 2.2.9-27mdk (root at locutus.mandrakesoft.com) (gcc version > pgcc-2.91.66 19990314 (egcs-1.1.2 release)) #1 Mon Jun 14 16:44:05 CEST > 1999 > Detected 350805109 Hz processor. > Console: colour VGA+ 80x25 > Calibrating delay loop... 699.60 BogoMIPS > Memory: 63164k/65472k available (964k kernel code, 408k reserved, 888k > data, 48k init) > VFS: Diskquotas version dquot_6.4.0 initialized > CPU: AMD AMD-K6(tm) 3D processor stepping 0c > > My python installation: > Python 1.5.2+ (#2, Feb 5 2000, 02:07:33) [GCC pgcc-2.91.66 > 19990314 (egcs-1.1.2 release)] on linux2 sys.maxint is correct for your machine. Previous reports of this symptom were traced to an optimization bug in a particular version of gcc (sorry, don't recall the details; DejaNews has 'em *somewhere*, though ). Try recompiling Python without optimization. If the problem goes away, now you know why. Using a newer version of the compiler may fix it (anyone out there know for sure?). If not, it should suffice to disable optimization only for the file Objects/longobject.c. Or, if you're extreme, just disable it for the function PyLong_AsLong in that file. There's nothing wrong with the code there (it's been critically reviewed by dozens of unhappy campers by now <0.9 wink>), so there's nothing more we can do about it on this end. BTW, I wrote both the function and the test that's failing, so I can pretend to know what I'm talking about here . the-good-news-is-that-it-doesn't-fail-anywhere-else-ly y'rs - tim From reic0024 at ub.d.umn.edu Tue Feb 1 10:35:07 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Tue, 1 Feb 2000 09:35:07 -0600 Subject: programming for children In-Reply-To: References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: On 1 Feb 2000, Ralf Hildebrandt wrote: > >I thought of a nice python environment under windows ... It would be best to > >have german documentation too. > > > >What do you think? > > I always thought LOGO would be the way to go. > Anyway, as far as I know there's no embedded development system for Python > on Windows. LOGO would be good, but don't underestimate kids. 11 year olders can handle at least some Basic. They had us playing with LOGO (moving the turtle, defining routines to draw something, problem solving) in like 3rd and 4th grade -- 8 through 10 years old. I had begun programming (more or less) in TRS-80 BASIC around 11-12 years old. LOGO is neet for a while, as one can draw neet pictures, but programming something functional, like a little quiz or game, gives one a sense of accomplishment, especially at that age. If he cannot handle python, perhaps he should play around with BASIC. As for the "environment," I think just the plain ol' interactive command line would suffice, unless he wanted to do minor graphics stuff. In which case, perhaps QuickBasic (get out those old DOS disks...) might be worth a look. Aaron From effbot at telia.com Fri Feb 18 09:15:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 14:15:42 GMT Subject: Which GUI? References: Message-ID: Moshe Zadka wrote: > > I think I'll make another point 'can be subclassed' in my comparison. > > Why? In Python, subclassing is much less important then in other OO > languages. For example, while widgets in Tkinter can be subclassed, the > official effbotic advice is not to do so (and, I must say, I agree). Tkinter widgets should be treated as components, not arbitrary classes. but frankly, the whole "subclassability" discussion is a red herring. there is one *major* difference between Tkinter and the other toolkits: there is (currently) no direct access to the underlying drawing API in Tkinter. while you can capture the "expose" event, you cannot do much about it. this is intentional: when Tk(inter) was designed, scripting languages were simply too slow to do all the drawing them- selves, so the Tk designers worked hard on power widgets like the Text and Canvas. (the usual way of creating custom widgets is to combine existing widgets into compound widgets; also called mega widgets. in addition to Pmw, there are lots of good mega widget libraries over in Tcl land. using them from Python isn't that hard, really). ... the drawing API issue can be fixed, of course. we've done that in "uiToolkit for Tkinter", for example. and people are working on similar stuff over in Tcl land. (and now that we have faster computers and faster inter- preters, it actually makes some sense ;-). ... btw, I just looked at the wxPython tutorial. every single example in that tutorial can be written in Tkinter, using about 50% as much Python code. and things like layout management and event handling looks embarrasingly primitive compared to Tkinter. methinks wxPython is superior to Tkinter in pretty much the same way as languages with braces are superior to languages using indentation... From JGRAVES3 at austin.rr.com Thu Feb 10 18:11:25 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Thu, 10 Feb 2000 23:11:25 GMT Subject: OT Re: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> Message-ID: >if ( foo > bar ) > do_something(); > do_something_else(); > done(); >endif > >I only know of one language which uses this syntax, >and it's not in common use. However, lots of us may RPG does something like this and there is ALOT of RPG code in the world. (view with monospacing) C FOO IFEQ BAR C EXSR FIRST C EXSR SECOND C ENDIF but because it has a column based syntax, it does not allow ANY indentation. to extend the example C FOO IFEQ BAR C EXSR FIRST C X IFGT Y C EXSR SECOND C ENDIF C ENDIF is RPG's way of writing if foo == bar: first() if x > y: second() I'm not saying I like it but I have gotten used to it. Python is a breath of fresh air to me. I'm getting used to the indentation fairly quickly. It's all in the editor you use. if you have a 'real' editor which supports 'tabs->spaces' and has a indent/dedent command it shouldn't be any issue. just my $.02. Python Newbie.... Jay Graves From tbryan at python.net Sun Feb 20 06:43:24 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sun, 20 Feb 2000 06:43:24 -0500 Subject: Setting up Emacs to use python References: <38AF819A.1849E465@ucsd.edu> Message-ID: <38AFD35C.470DC34F@python.net> Tristan Juricek wrote: > > I've just installed Linux on my computer and I'm interested in setting > up Emacs for use with Python. Being new at both Emacs and Python, I'm a > little unclear on what I need to do. In case it's not a quick answer, > does anybody know of a good set of documentation on this subject? It would help if you mentioned which Linux distribution and version you have. In any case, the following instructions are fairly generic. Note that in Emacs speak, C-x means "hold the control key while pressing the x key." C-x f means "hold the control key while pressing the x key and then release the control key to press the f key." C-x C-f means "hold the control key while pressing the x key and then hold the control key while pressing the f key." If that explanation wasn't clear to you, try reading the Emacs tutorial by pressing C-h t or by selecting it from the Help menu. Try to save some effort since python-mode may have come with your distribution. Start emacs, and type M-x locate-library python-mode It will say something like /usr/share/emacs/site-lisp/python-mode.el if it can find Python-mode on your system. You can also open a Python file to check to see whether Python mode is being activated: emacs & (in the emacs application, type) C-x C-f test.py The buffer status line should look something like --:-- test.py (Python)--L1--All---------------------- If it instead looks like this --:-- test.py (Fundamental)--L1--All----------------- then Python mode is not installed or not properly configured. If you don't see such a status line, you can always get a brief description of all the currently active modes by pressing C-h m. See whether Python mode is listed in the modes *Help* buffer. (optional step) You may have 'locate' or 'slocate' on your machine. To check whether you already have python-mode.el installed somewhere on your machine. Try running something like this locate python | grep 'el$' That locates all files with python in the name that end in 'el'. It's generally called python-mode.el, but it could be something like python.el. If it's already on your system, then open the file to see what version it is. The current version is 3.105. If necessary, download python-mode.el from http://www.python.org/emacs/python-mode/python-mode.el and read the instructions available at http://www.python.org/emacs/python-mode/installation.html Generally, there is at least one directory on your system where emacs will automatically look for byte-compiled modes and such. In an emacs window (also called a frame, by the way), type M-x describe-variable load-path Emacs should open a new buffer with an explanation of the load-path variable and its current value. One or more directories generally have the name site-lisp in them. If necessary, move python-mode.el into one of those directories. For example, on a Red Hat 6.0 system, something like this should work. mv /path/to/downloaded/python-mode.el /usr/share/emacs/site-lisp/ Then follow those instructions on the python web site, something like C-x C-f /usr/share/emacs/site-lisp/python-mode.el RET M-x byte-compile-file RET M-x locate-library RET python-mode RET C-x C-f ~/.emacs RET (Add the following lines to the end of your .emacs file.) ;;; For Python mode (setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist)) (setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist)) (autoload 'python-mode "python-mode" "Python hacking mode." t) ;;; add these lines if you like color-based syntax highlighting (global-font-lock-mode t) (setq font-lock-maximum-decoration t) Now, close emacs (C-x C-c) and reopen emacs. Open a buffer C-x C-f test.py Check that you're in Python mode (see above). Learn *all* of the features of Python-mode by typing C-c ? to open a buffer with 684 lines describing the mode. it's-easier-than-it-sounds-ly yours ---Tom From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:13:01 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:13:01 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: <894ea9$h33$1@nnrp1.deja.com> Message-ID: In an article posted Thu, 24 Feb 2000 23:19:41 GMT, John Nielsen (nielsenjf at my-deja.com) said: > Maybe it is a version issue? > > What version of python are they running? > > I get sub 1 second responses with ASP and python using the > <%@ LANGUAGE = Python%> directive. > > john 1.5.2 (blah-blah-blah) -- I made a page the imported sys.py and printed sys.version. Good idea.... Thx. -- -=< tom >=- Thomas D. Funk (tdfunk at asd-web.com) | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From sabren at manifestation.com Sun Feb 13 03:47:21 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 13 Feb 2000 03:47:21 -0500 Subject: c++ callbacks and thread safety Message-ID: <885r3l$r3n$1@nntp9.atl.mindspring.net> Hey All! Since I don't really know my way around C/C++, I was pretty nervous about trying to reimplement a python extension as a .pyd.... But after reading the docs, I tried it out and managed to get my MIDI input module *almost* working. (Pretty amazing testimony to how easy extending python is!) But, there is one small problem.. MIDI input (at least on win32) requires a callback, which I've set up to look basically like this: ////////// void CALLBACK _midiCallback( .... ) { PyEval_CallObject (a_callable_PyObject, NULL); } ///////// My python script looks like this: ### import winmidi import sys def myCallback(): print "in myCallback!" allDone = 0 winmidi.inOpen(myCallback) while allDone == 0: if sys.stdin.readline()[:-1] == "quit": allDone = 1 winmidi.inClose() ### It seems to work just fine... until I press a note on my keyboard. Then python crashes. BUT.. if I change the loop to: ### while allDone == 0: pass ### ... then it works perfectly, meaning the "in my callback" message prints out every time I hit a note. I gather that I need to do some kind of thread checking here... but I don't understand what to do. I tried putting Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS in various places, but that didn't seem to help... Besides, I'm just guessing now, and I want to understand... Can someone tell me what I'm doing wrong, or perhaps point me in the right direction? Thanks! :) [I tried looking at some of the source for the win32 extensions that use callbacks, but I don't know enough C++ to know what to look for...] -Michal http://www.sabren.com/ From moshez at math.huji.ac.il Fri Feb 25 10:12:03 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 17:12:03 +0200 (IST) Subject: idlerc.py In-Reply-To: <5Rwt4.22183$Jz3.111477@nnrp1.uunet.ca> Message-ID: On Fri, 25 Feb 2000, Warren Postma wrote: > > Now is there a way to put these color settings in an ".idlerc" of sorts so > > they're kept from version to version without hacking any source? > > How about checking your working (and home directory for unix} for an > "idlerc.py" on Unix and if so, run it. > > Problem with .idlerc is it's very Unix-ish and wouldn't fit in on Win32, > whereas an INI file or Registry is very Windows-ish and not very Unix. > > Compromise? :-) No, polymorphism ;-) Why not have a generic config-information searching API which is platform specific and Python chooses which module which implements this API based on platform. Think "os.path". -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tcmits1 at cs.com Mon Feb 28 23:38:29 2000 From: tcmits1 at cs.com (Tcmits1) Date: 29 Feb 2000 04:38:29 GMT Subject: JPython install on win98, NT Message-ID: <20000228233829.01209.00001933@ng-fg1.news.cs.com> I just installed version 1.1. There is mention of scripts to run the interpreter and compiler. Don't see these. There isn't doc on win installing. I tried calling into the jar directly: C:\jpython>java -cp jpython.jar org.python.util.jpython packageManager: processing new jar, "C:\jpython\jpython.jar" packageManager: processing new jar, "C:\jdk1.3\jre\lib\rt.jar" packageManager: processing new jar, "C:\jdk1.3\jre\lib\i18n.jar" packageManager: processing new jar, "C:\jdk1.3\jre\lib\ext\sunrsasign.jar" 'import exceptions' failed; using string-based exceptions JPython 1.1 on java1.3beta (JIT: null) Copyright (C) 1997-1999 Corporation for National Research Initiatives >>> print "hello" hello >>> Where do I locate better install directions and all required scripts? Josef From tseaver at starbase.neosoft.com Wed Feb 23 23:44:43 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 23 Feb 2000 22:44:43 -0600 Subject: Sockets or networking library? References: Message-ID: In article , chris davis wrote: >I'm looking for a good sockets or networking library, preferably with some >abstraction. I'm building a multi-player network game, and want something >abstracted along the lines of directx. If there's nothing out there I'll do >it myself, but I want to know that it hasn't been done already. If you go at it yourself, a lot of the documentation and high-level design for the ACE library (http://www.cs.wustl.edu/~schmidt/ACE.html) will give you excellent food for thought. Although written in C++, ACE does a really nifty job of encapsulating ugly platform dependencies and of presenting a consistent, configurable interface to cross-platform network programming. Nothing-up-my-sleeve'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From tgabriel at bellsouth.net Mon Feb 7 20:47:38 2000 From: tgabriel at bellsouth.net (Xenophanes) Date: Mon, 07 Feb 2000 20:47:38 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <389F75B9.C7F38C52@bellsouth.net> Go to Guido's site and read about his desire to have a language that is easy for non-programmers to learn. Python is not meant to replace C. It is a scripting language that is easy to learn. It is intended to be what it is. Look into what they are doing with it at Yorktown High in Arlington, VA. This issue is not about making it easy for C programmers. It is about a learnable language for those who do not want to or need to learn C in order to take control of the software around them. It is about empowerment. From moshez at math.huji.ac.il Fri Feb 25 10:08:44 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 17:08:44 +0200 (IST) Subject: To Reduce or Not To Reduce In-Reply-To: <20000225134447.A3175@stopcontact.palga.uucp> Message-ID: On Fri, 25 Feb 2000, Gerrit Holl wrote: > First, I had this code: > > >>> def fib(n): > >>> retval = 0 > >>> for i in range(n): > >>> retval = retval + i > >>> return retval > > I thought: this must be slow, because it redefines 'retval' for every n. Well, actually, local variable access is done via array indexing, which is very fast. > So I rewrote it using reduce: > > >>> def fib(n): > >>> return reduce(operator.add, xrange(n)) operator.add is slightly slower then the + operator. It's the C function call arg parsing that's killing you. > Timing turns out, however, that this version is actually _slower_! Maybe > this is because it has to look up 'add' in another namespace. Getting 'add' > in the local namespace only optimizes it a little bit. Of course! It only looks up operator.add once. I'm surprised you managed to see a difference! > What am I missing? When should I use reduce? Not this time: How about def fib(n): return (n*(n-1))/2 This function, of course, has nothing to do with the fibonacci function. BTW: When comparing, try not to let noise into the system. Either consistently use "range" or consistently use "xrange". -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From pf at artcom-gmbh.de Thu Feb 17 11:44:33 2000 From: pf at artcom-gmbh.de (Peter Funk) Date: Thu, 17 Feb 2000 17:44:33 +0100 (MET) Subject: 78 chars per line are enough! Period. Message-ID: quoted from the patch submission guide lines pages on www.python.org: Make sure all lines fit in 78 columns. I can't agree more. I'm so old, that I still remember my punch card times :) Now let's see how it looks, when I fire up Python on my computer: $ python Python 1.5.2+ (#2, Feb 14 2000, 08:50:31) [GCC egcs-2.91.66 19990314 (egcs-1.1. 2 release)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> Am I the only one bothered by this excedingly long and ugly broken line? Since SuSE sells more than 100,000 copies of their Linux CDs each time, I think there must be more people, which see such an overly verbose prompt. Now after several years I thought, it must be easy to fix this anoying detail had look into the sources. I think this can be done in .../src/Python/getversion.c. However, Py_GetVersion can also be accessed through the 'sys' builtin module. Now I wonder, whether it would break any existing python applications, if Py_GetVersion would return a string containing a newline. Regards, Peter P.S.: I feel nitpicking today. ;-) -- Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 From tim_one at email.msn.com Wed Feb 16 23:10:27 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 23:10:27 -0500 Subject: IDLE in any other GUI. In-Reply-To: Message-ID: <001301bf78fc$ecab3c40$dea0143f@tim> [posted & mailed] [Just van Rossum] > ... > Later, when Guido write Idle, I complained to him that his code > was tightly bound to Tk, which I consider a platform also... (Of > course he denied this...) It was not easy for me to take > advantage of Idle's code in my own IDE. In the meantime, the > situations has apparently become better, I believe PythonWin > uses some parts of Idle. Yes, and substantial rearranging & rewriting of the code (since the 1.5.2 release) was done to ease that. > Some parts of an IDE are hard to factor out: eg. Idle's syntax > coloring is neccesarily bound to Tk for performance reasons. I > haven't studied the latest Idle sources, so I have no idea what > how the amounts of "generic" code and Tk-dependent code relate, > but it would be interesting to know. > > Anyone familiar enough with Idle guts to give a brief summary of > what's there? Idle could be a killer app, but I think it has to > separate itself from Tk as much as practical to actually > become one. The "deep" parts shared by IDLE and PythonWin are pointed to in IDLE's EditorWindow.py, following the comment: # Tk implementations of "virtual text methods" -- each platform # reusing IDLE's support code needs to define these for its GUI's # flavor of widget. PythonWin uses an unrelated text widget, and so implements the methods following this comment differently. All of the stuff for parsing Python code, suggesting indentation (which is now as smart as the Emacs pymode -- which means "very smart"), and doing various reformatting are written in terms of these "virtual text methods". So while it remains woefully underdocumented, in practice it will prove easier than you fear . There's one huge compromise: IDLE uses Tk-style text indices (line.column strings, w/ various optional modifiers) throughout. Mark Hammond wrote a layer around PythonWin's text widget (currently Scintilla, IIRC) to translate its view of text indices to & from Tk's. This layer also contains implementations for some Tk text commands, since they have to be spelled *somehow* and Tk's spellings seem as good as anything else (e.g., text.get() and text.delete() -- basic operations any text widget has to support). if-tk-isn't-a-platform-python-isn't-a-language-ly y'rs - tim From moshez at math.huji.ac.il Tue Feb 22 09:02:15 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 16:02:15 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On 22 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > using Python.My guess is that I would have no problem naming my lambda's > (using `def'), and approximating lexical closures (using `class'). > > Maybe we should not get distracted that much by syntactical sugar! :-) You can't do serious functional programming without tail recursion. From gmcm at hypernet.com Mon Feb 7 23:05:19 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 7 Feb 2000 23:05:19 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87o1br$ltq$1@nnrp1.deja.com> Message-ID: <1262139803-5814898@hypernet.com> fcahoon at my-deja.com writes: [skip to example] > > if condition1: > statement1 > statement2 > if condition2: > statement3 > statement4 > > To which loop does statement4 belong? Unambiguous. It belongs to "if condition2". Python interprets tabs as 8. > This is what I've seen in some C code that's been through many hands: > > The old-timers used 8-space tabs to effect 3-space indentation. Don't > ask me why. 1 indent = 3S, 2 indent = 6S, 3 indent = TS. Python will warn about this, because there are interpretations of "tab" that yield inconsistent results. Thus most coders use only spaces or only tabs. > The 2nd generation of coders set their tabs to 3 spaces in > the editor, editing some parts of the code, unaware that other parts of > the same file contained 8-space tabs. This will almost certainly make some line ending in a colon appear to be followed by a dedent. That's quite noticable. If the 2nd programmer edits a block indented by the first programmer, Python will give him a syntax error. If he adds a brand new block, no problem, because indentation is everywhere locally consistent. > Tabs were converted to spaces > under the mistaken assumption that they were all 3-space tabs. There are Python tools that will convert Python code from any indentation style to any other style, based on a Python parse of the code, not the programmer's guess. Deformations can proceed indefinitely in C, but they will be very quickly noticed in Python, so the code won't stay strangely formatted for long. Just as I run indent on all but the most pristine C code, I run tabcleaner on any oddly formatted Python. - Gordon From aahz at netcom.com Mon Feb 14 16:28:51 2000 From: aahz at netcom.com (Aahz Maruch) Date: 14 Feb 2000 21:28:51 GMT Subject: String manipulation References: <38A87064.BEB93BB7@aston.ac.uk> Message-ID: <889s2j$m59$1@nntp6.atl.mindspring.net> In article <38A87064.BEB93BB7 at aston.ac.uk>, Peter Bittner wrote: > >Is there no such thing in Python as > > mystring += "something" // C-style No. -- --- 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 Have you coined a word today? From kirill at pmg17.vstu.vinnica.ua Mon Feb 28 06:29:10 2000 From: kirill at pmg17.vstu.vinnica.ua (Kirill Simonov) Date: Mon, 28 Feb 2000 13:29:10 +0200 (EET) Subject: array constructor In-Reply-To: Message-ID: On Mon, 28 Feb 2000, Tom Holroyd wrote: > I want a 4x4 array of zeros. You may use dictionaries for this purpose. m = {} for i in range(4): for j in range(4): m[i,j] = 0 -- Kirill From effbot at telia.com Wed Feb 9 15:39:14 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 20:39:14 GMT Subject: Which Python book? References: <85035b$1sb$1@bignews.shef.ac.uk> <850pt8$qv9$1@nnrp1.deja.com> <852g8h$75@gap.cco.caltech.edu> <86fl0m$gmj$1@inputplus.demon.co.uk> <86kqtq$6kq$1@jaffa.itower.net> <38A0B834.DF6BBAC6@netscape.com> <38A0C9EF.F81FAC8E@webamused.com> Message-ID: Joshua Macy wrote: > The organization is quite simple: it's exactly what's in the > Table of Contents. they might even have done it that way on purpose... > An index would be gilding the lilly. O'Reilly did publish an index anyway: http://www.oreilly.com/catalog/pythonpr/inx.html (fun geek exercises include translating that to a free- text database, and storing it on your computer in case you really need to find out where to look things up -- bonus points if you put it on your palm pilot! ;-) From aahz at netcom.com Tue Feb 1 11:20:26 2000 From: aahz at netcom.com (Aahz Maruch) Date: 1 Feb 2000 16:20:26 GMT Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <87714a$o7$1@nntp6.atl.mindspring.net> In article <876emj$kco$1 at oak.fernuni-hagen.de>, Fritz Heinrichmeyer wrote: > >My son is 11 years and wants to learn programming. He heared about java at >school (cool like nike or adidas ...) but in my opinion this is very hard >stuff for a beginner to bring anything to play. Gerrit is 13 now, I think, and started learning Python a year ago. He has since become a very helpful member of the Python community. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From martindvorak at my-deja.com Sat Feb 5 11:15:21 2000 From: martindvorak at my-deja.com (martindvorak at my-deja.com) Date: Sat, 05 Feb 2000 16:15:21 GMT Subject: deleting global namespaces References: <87fm8a$v4j$1@nnrp1.deja.com> <20000205154128.A14392@xs4all.nl> Message-ID: <87hiam$6lk$1@nnrp1.deja.com> > There is no guaranteed automatic way to make Python delete something. The > only way to 'delete' something is to remove all references to it, and make > the refcounter (or garbage collector, in Java) delete the object. But it > sounds to me like you are trying to use the wrong tool for the wrong task -- > modules only get executed once, upon the first load time. The top level of a > module is intended to run just once in it's lifetime, not every time you > wish to reset the data to the starting point. > > To do what you want, either work with functioncalls to reset the module to > its initial state, or just use objects. Using objects is probably the best > method, as it groups data, methods and state in one easy-to-use package ;) > > So you can do either: > > module.py: > ----- > var = SomeState > def reset(): > global var > var = SomeState > > def do_something_with_var(): > ... > ----- > > and manually call reset() when you wish to reset the data, or: > > module.py: > ----- > class Module: > def __init__(self): > self.var = SomeState > def do_something_with_var(self): > ... > ----- > > If you then wish to reset to the initial state, just create a new > module.Module object. That's clear but it does not solve my problem. I know objects and use them extensively, but I need to divide the whole application (which consists of hundrends of objects) into independent components each with its own global namespace so that component's objects can use this global namespace independently on other objects in other components. Martin Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Sat Feb 19 11:12:53 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 18:12:53 +0200 (IST) Subject: IDLE for JPython In-Reply-To: <38AEBAC7.5DEE27EC@ieee.org> Message-ID: On Sat, 19 Feb 2000, jarek wrote: > Is it possible to useIDLE with JPython? (This probably require to run > Tkinter.) > Is there some other IDE that would run with JPython? > I was looking through JPython web site and could not find any > information about that. See jtkinter.sourceforge.net -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From DOUGS at oceanic.com Wed Feb 2 21:56:43 2000 From: DOUGS at oceanic.com (Doug Stanfield) Date: Wed, 2 Feb 2000 16:56:43 -1000 Subject: compiling source Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F2B3@huina.oceanic.com> There is a precompiled binary available for Windows 98. Its available from the download link at http://www.python.org/windows/ -Doug- > -----Original Message----- > From: Mike [mailto:pick_001 at hotmail.com] > Sent: Wednesday, February 02, 2000 4:03 PM > To: python-list at python.org > Subject: compiling source > > > > I'm new to programming. I decided to teach myself pythong as a first > language. I run win98, linux, and BeOS on my system. > compiling the python > source in those two doesnt see hard because they both come > with GCC. But is > there a way I can do the same in windows? I dont have to > install some big > C++ package to compile it, is there a smaller version I can > find on the web > somewhere for this? > > Thanks > > > Mike > > > -- > http://www.python.org/mailman/listinfo/python-list > From ivanlan at callware.com Fri Feb 18 12:02:30 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 18 Feb 2000 10:02:30 -0700 Subject: string.py References: Message-ID: <38AD7B26.2F8CB4BA@callware.com> Hi All-- Moshe Zadka wrote: > [snip] > I think Gerrit is on to something. How about....(drum roll)...int methods? > > I mean, we've broken the barrier with string methods, so there's no > reason not to allow: > > >>> a = 5.radix(2) > >>> print `a` > "101" > >>> > > I see there might be parser problems, but maybe (5).radix? Python seems > willing to check for it: > > >>> a = (5).radix(2) > Traceback (innermost last): > File "", line 1, in ? > AttributeError: 'int' object has no attribute 'radix' > > totally-out-of-my-head-ly y'rs, Z. > Nope. I like it. Why not? -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 newsbunny at noether.freeserve.co.uk Wed Feb 23 14:46:58 2000 From: newsbunny at noether.freeserve.co.uk (Martin P Holland) Date: Wed, 23 Feb 2000 19:46:58 +0000 Subject: PyQT,PyKDE failure: References: Message-ID: On Wed, 23 Feb 2000 13:27:00 -0500, Warren Postma wrote: >I tried to install some RPMs for PyQT and PyKDE and got the following error Try installing from source it's fairly straightforward. atb Martin -- http://www.noether.freeserve.co.uk http://www.kppp-archive.freeserve.co.uk From cpatti at atg.com Fri Feb 4 16:33:06 2000 From: cpatti at atg.com (chris patti) Date: 04 Feb 2000 16:33:06 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <389B3D45.81EF7466@equi4.com> Message-ID: Jean-Claude Wippler writes: > chris patti wrote: > > [to quote Ivan: bobbit] > > > One of the reasons for CPAN's success in the Perl world is that, > > simply, it's an FTP archive. > > > > Thus, people can and do mirror it. This creates a multi-site, > > persistent cache of the entire library, so when the one site where > > module Frobnitz.pm comes from goes down, the world doesn't suffer. > > > > The Python world needs something similar. > > > > Another big win in this is that it eases the automated retrieval and > > installation of modules, in the Perl world we have CPAN.pm which lets > > you say things like: > > > > install frobnitz > > > > And it will search the archive, find the latest version, download it > > and install it to your local Perl installation. > > > > Such a thing is _eminently_ possible in Python... > > > > I have neither bandwidth nor disk to offer, so feel free to have me > > publicly tarred and feathered for heresy :) > > An FTP repository for packages, with an HTTP-based web interface for > those who prefer that access mechanism... gee, that's an idea. One > could even periodically produce CD-ROM's from such a repository. It's > not new, of course (www.cdrom.com?). Nor particularly difficult. > > Has anyone considered teaming up with the Tcl community and then asking > VA Linux (of SourceForge fame :) to consider providing the underlying > infrastructure? (No, I won't crosspost, though it would seem logical) > > Perhaps not. Pythoneers want a Python-specific solution (Trove/Zope?), > just like Tcl people and Perl. I seem to be one of the few who fails to > see why... > > -jcw I see no reason not to share web / ftp server space, but I fail to understand how / why any other combined archive would be useful. Just slap me around if I'm being dense, here :) -Chris -- -------------------------------------------------------------------- Chris Patti| \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From moshez at math.huji.ac.il Fri Feb 11 12:39:46 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 19:39:46 +0200 (IST) Subject: Comparing file objects: what is compared? In-Reply-To: <20000211165155.A4849@stopcontact.palga.uucp> Message-ID: On Fri, 11 Feb 2000, Gerrit Holl wrote: > Hello, > > >>> fp1=open('/tmp/file_one', 'w') > >>> fp2=open('/tmp/file_two', 'w') > >>> cmp(fp1, fp2) > -1 > >>> cmp(fp2, fp1) > 1 > > What is compared? The date of creation? The filename? The contents? > > I've searched the FAQ, the documentation, the sig archives and the > newsgroup, but I'm not able to find the answer. What is compared when > comparing file objects? I don't know, don't care, and it's implementation dependant. The important thing is that 1. Any two objects can be compared 2. The ordering is stable (that is, if neither fp1 nor fp2 changes, fp1 will stay larger then fp2) 3. The ordering has the natural properties expected from an ordering. (I.e., if a. INTERNET: Learn what you know. Share what you don't. From mikael at isy.liu.se Tue Feb 8 04:40:16 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 08 Feb 2000 10:40:16 +0100 (MET) Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87on3m$p2i$1@mach.vub.ac.be> Message-ID: On 08-Feb-00 Thomas Hamelryck wrote: > I am in exactly the same position. It was a serious design error. > I wonder how the CP4A people are going to explain to complete > computer illiterates that a python program can contain errors that > are _not even visible_ when you look at the code. But they _are_ visible! It's just as visible to me as it is to the interpreter. Consider the following. for whatever: if a: do_something else: do_something_else do_yet_another_thing I can certainly see this error. I do not even need to read the code. It's simply pattern recognition, which is what our eyes do best. What's more, I'm glad that the interpreter reprts this to me. What block should do_yet_another_thing be in? Did I mean 2 or 4 spaces? I'd better think that through. /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: 08-Feb-00 Time: 10:28:14 This message was sent by XF-Mail. ----------------------------------------------------------------------- From fredp at mygale.org.nospam Thu Feb 3 08:32:14 2000 From: fredp at mygale.org.nospam (Fred Pacquier) Date: 3 Feb 2000 13:32:14 GMT Subject: Ann: PMZ - Poor Man's Zope References: Message-ID: <8ECF95999PaCmAnRDLM@194.2.0.33> ajung at starship.skyport.net (Andreas Jung) said : >Dear all, >I am happy to announce the availability of POOR MAN'S ZOPE 0.1. >PMZ is very similar to Active Server Pages or PHP3/4 and allows you >to include Python code into your HTML pages. (...) >The functionalty is implemented as an external handler for the Apache >web server. You could also say that it's like PSP (Python Server Pages), only without Java... This is something I've been feeling the need of too, wondering why it didn't already exist (well, maybe it did :-). This could really fill a void for those (like me) who prefer Python to PHP and the rest, but do not have the time/means/needs to go through the steep Zope learning curve... Thanks for starting it ! -- YAFAP : http://www.multimania.com/fredp/ From fdrake at acm.org Mon Feb 14 12:22:29 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 14 Feb 2000 12:22:29 -0500 (EST) Subject: TCL has Tk... In-Reply-To: References: Message-ID: <14504.14805.107030.838217@weyr.cnri.reston.va.us> Grant Edwards writes: > Modula-3 has it's own widget set and windowing system. Don't > know if that has contributed to it's success or not. Have you ever used it? I'd say it's a point against. Modula-3 is nice, but the widget set didn't behave in a way that I liked whenever I played with the sample code. It was enough that I didn't use it for any GUI work, though I liked the language and the "Network Objects" support. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From moshez at math.huji.ac.il Tue Feb 15 00:49:08 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 15 Feb 2000 07:49:08 +0200 (IST) Subject: Multicolumn listbox for Tkinter available ? In-Reply-To: <38a87401@wwwproxy3.westgroup.com> Message-ID: On Mon, 14 Feb 2000, MikeZ wrote: > Does anyone where I can get a Multicolumn listbox implemented in Tkinter ? IDLE has one. (See the source distribution, Tools/idle/) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From rsmol at bart.nl Sun Feb 27 16:13:33 2000 From: rsmol at bart.nl (Richard Smol) Date: Sun, 27 Feb 2000 22:13:33 +0100 Subject: GUI in Python under MSDOS? References: <7gxs4.10514$Jz3.75949@nnrp1.uunet.ca> Message-ID: <38B9937D.F446585C@bart.nl> chris patti wrote: > > "Warren Postma" writes: > > > Is there any gui for Python that will operate under MSDOS, especially > > extended 32-bit MSDOS using the djgpp 32 bit C++ compiler/dos-extender? > > Yes, you heard me right. > > > > Support for VESA or even some common accellerated VGA cards would be > > excellent, but standard VGA [unaccellerated] would still be better than > > nothing. > > > > I found a version of Squeak [a free and nifty smalltalk-80 variant, see > > www.squeak.org ] that has a DOS version, but I much prefer Python's syntax > > and structure. > > > > Any ideas? > > > > Warren > > The mere thought of a DOS port of Tk and then Tkinter to DOS > makes my head hurt :) > > The mere fact that Python runs in extended DOS is a major win, > though. Porting Tk to DOS would not be trivial, since there would be no base-widgets to work with. It would be great fun though to make it work. You might get stuff like those those early "Windows-lookalike" DOS apps (anyone remember WordPerfect 6.0 for DOS?) It should be possible though to port Curses to DOS relatively easy. Greetz, RS From 2jerry at writeme.com Tue Feb 22 18:07:41 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 00:07:41 +0100 Subject: Misunderstanding classes (newbie) References: Message-ID: <88v4lu$ags$1@wanadoo.fr> This is just a list of class elements ? no ? class lm: def __init__(self, last=None,first=None,age=0): self.lastname=last self.firstname=first self.age=age then .. list_lm=[] a=lm('jerome','VACHER',29) list_lm.append(a) list_lm.append(lm('paul','DUBOIS',45)) a[0].lastname='jerome' Is that you want ? Best Regard, Jerry the foolish dracomorpheus, - france - sorry at spam.invalid a ?crit dans le message ... >Hi, > >I'm a Python newbie (and an OOP newbie) trying to >construct a class that: > > (a) behaves like a list but has a FORTRAN-like variable > starting index, > (b) has per-index attributes. > >i.e. Each element of the list has two (or more) attributes, > and, by default, the first element is at x[1]. > >e.g. x[1].lastname, x[1].firstname, x[1].age > x[2].lastname, x[2].firstname, x[2].age > >I seem to be able to get each part of the solution >independently (the first part by using UserList and >__getitem__), but when I attempt to combine them, I >clearly don't understand what I'm doing. > >Suggestions? > >Thanx. > >P.S. Please respond to the list. From sholden at bellatlantic.net Fri Feb 11 08:02:35 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 11 Feb 2000 13:02:35 GMT Subject: will python 3000 break my code? References: <001201bf7454$2263bd60$d6a0143f@tim> Message-ID: <38A40887.E65A13D5@bellatlantic.net> The timbot wrote: > > [Ronald L. Dilsavor] > > I am in the process of deciding whether to have a team of folks > > invest in implementing our product in Python and this [presumed > > incompatibility of Python 3000] was one of the "cons" on my list. > > As it should be! Don't overvalue it, though. For example, even if Python > 3000 is an *entirely different language*, no C program stopped working the > day C++ was released -- or a decade later, either. > > [much other reassuring and sensible stuff] > > it's-not-really-that-scary!-ly y'rs - tim With trepidation, I write to ask what the appropriate forum is for suggesting language improvements -- and I don't mean introducing redundant bracketing for block delimitation. However, recent threads have persuaded me that this probably isn't the forum for my lame suggestions: you guys are busy enough. I would have talked to people at the conference, but then the weather and a client emergency meant that all I got for my fee was an email acknowledgement. Next year, maybe... regards Steve -- "If computing ever stops being fun, I'll stop doing it" From effbot at telia.com Mon Feb 7 12:48:26 2000 From: effbot at telia.com (Fredrik Lundh) Date: 7 Feb 2000 11:48:26 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 7) Message-ID: Major New Internet Portal Python Powered! http://www.filibuster.org On the edu-sig, David Scherer reminds us what CP4E (and Python) is all about http://www.python.org/pipermail/edu-sig/2000-February/000098.html New guidelines for patch contributions http://www.python.org/patches/ Python's CVS repository can be accessed via the web http://cvs.python.org/ The edu-sig deals with everything related to using Python in education (except, perhaps, whether Python should remain case sensitive or not). Great discussions, thus far http://www.deja.com/=dnc/getdoc.xp?AN=580836413 http://www.python.org/sigs/edu-sig/ The import-sig will design a new architecture for the import facilities in Python (to better support embedding, archives, installers, etc) http://www.deja.com/=dnc/getdoc.xp?AN=581571482 http://www.python.org/sigs/import-sig/ New Python consortium members that we forgot to mention in last week's URL ASTi: http://www.asti.com BeOpen: http://www.beopen.com Danny Yee reviews Dave Beazley's Python Essential Reference http://www.deja.com/=dnc/getdoc.xp?AN=582232970 http://www.anatomy.usyd.edu.au/danny/book-reviews/h/Python_Reference.html How do I add subject lines to mails sent via smtplib? http://www.deja.com/=dnc/getdoc.xp?AN=582411857 What's wrong with execfile and local variables? http://www.deja.com/=dnc/getdoc.xp?AN=581374636 http://www.deja.com/=dnc/getdoc.xp?AN=581843072 How do I best prepare a Python? http://www.deja.com/=dnc/getdoc.xp?AN=581198835 A useful example of asynchronous socket work http://www.deja.com/=dnc/getdoc.xp?AN=581929417 New releases of plotting software http://www.deja.com/=dnc/getdoc.xp?AN=581191243 (gdchart) http://www.deja.com/=dnc/getdoc.xp?AN=582314930 (pxDislin) And to round off this week's URL, here's some Python poetry http://www.deja.com/=dnc/getdoc.xp?AN=581006163 ======================================================================== 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 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 Python To-Do List anticipates some of Python's future direction http://www.python.org/cgi-bin/todo.py The Vaults of Parnassus ambitiously collects Python resources http://www.vex.net/~x/parnassus/ 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 sholden at bellatlantic.net Tue Feb 22 08:37:13 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 22 Feb 2000 13:37:13 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <88tkob$jqd$1@nnrp1.deja.com> Message-ID: <38B2910B.A0AD14C3@bellatlantic.net> ndev42 at yahoo.com wrote: > > In article , > "Fredrik Lundh" wrote: > [...] > This accumulation of layers helps us programmers ship libraries > and development tools fast, but they certainly do not help out > the users in the end. Just to get a "Hello world" button with > Python, you need Python + Tkinter + Tk + Tcl + X11, whereas > you could have short-circuited that to Python + X11, if an intelligent > widget set was built directly from X11 in Python. Not just binding > the X functions, making OO widgets and Python compatibility, too. > A next step could be to provide the same OO widgets, bound to > other low-library window libraries on other OS's. That is some > effort, I realize, but looking back at how much has been spent on > making free GUI tools already, looks pretty small. > Of course, you would create these widgets to conform with the appropriate look-and-feel for each platform to which you were porting? Generally, the amount of effort required to build a portable GUI layer is CONSIDERABLY greater than "some". > Every time a new layer is added, new compatibility issues are brought > in. Plus: if you did not develop all the layers, you have to support > any change in other people's code to keep compatible. Any layer that > becomes drastically incompatible with a previous version of itself > propagates this property to the rest of the assembly. This becomes > a true nightmare when you have several generations of software to > support on the same machine. > Configuration control has always been a b**ch in complext systems. It isn't likely to get any less complicated. > Oh well, just my 5c I guess... > -- > Nicolas > > Sent via Deja.com http://www.deja.com/ > Before you buy. Let's be clear: you are complaining about the complexity of your environment, not the complexity of Python's GUI support. IMO, the Python builders took a very sensible decision to use an existing GUI toolkit, and while I agree some of the implementation details are plain ugly, fortunately they are hidden below the abstraction we use to access them. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From shochat at chelmsford.com Sun Feb 13 07:02:42 2000 From: shochat at chelmsford.com (David Shochat) Date: Sun, 13 Feb 2000 07:02:42 -0500 Subject: When to compile regex? Message-ID: <38A69D62.5A68F54D@chelmsford.com> In section 4.2.3 of the Python Library Reference (1.5.2) it says that using compile is more efficient "when the expresion will be used several times in a single program". I'm trying to figure out the intended meaning of this. Does that mean "executed more than once", or "occurs more than once in the program text"? Specifically, if it only occurs once, but that is in a loop, is there an advantage to compiling before entering the loop? -- David From rjroy at takingcontrol.com Tue Feb 15 21:08:26 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Wed, 16 Feb 2000 02:08:26 GMT Subject: BSDDB Pack function? References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: <38aa0248.419826718@news1.on.sympatico.ca> (from Robin's Reference Guide) ref B-Tree dbs Space freed by deleting key/data pairs from the database is never reclaimed from the filesystem, although it is reused where possible. This means that the btree storage structure is grow-only. If sufficiently many keys are deleted from a tree that shrinking the underlying database file is desirable, this can be accomplished by creating a new tree from a scan of the existing one. You don't have to export to ascii and re-import. Try something like this. from TCS.bsddb import db d = db.DB() d.open('test.db', db.DB_BTREE) e = db.DB() e.open('test2.db', db.DB_BTREE, db.DB_CREATE) c=d.cursor() try: while 1: key,val = c.next() print key,val e[key]=val except db.error, val: print 'errror', val c.close() e.close() d.close() On Tue, 15 Feb 2000 11:06:32 -0500, "Warren Postma" wrote: >> approximately 3 times faster using your bsddb. > >Well it finished running in under an hour, whereas the stock python bsddb >library took over four hours to finish. However, at the end, when I had >deleted around 150,000 rows from the table, leaving 25,000 rows, the file >itself had not "shrunk" at all and was still over 200 mb. This is okay, >since it's rare that you'd really want to deallocate the disk space, since >it's just going to get used again next time you add more records, however a >"pack" function (like we had for dbf files) would be nice. > >Is there one or must I export the file to flat ASCII, and re-create a file >to pack it down when much data is deleted? > >Warren Postma > > From gtalvola at NameConnector.com Tue Feb 1 15:55:04 2000 From: gtalvola at NameConnector.com (Geoff Talvola) Date: Tue, 01 Feb 2000 15:55:04 -0500 Subject: question about COM and ADO References: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC98@RED-MSG-50> Message-ID: <38974828.5C173268@NameConnector.com> Bill Tutt wrote: > > -----Original Message----- > > From: gtalvola at NameConnector.com [mailto:gtalvola at NameConnector.com] > > > [problems with translating the below VB code into Python] > > > > Dim cnn as New ADODB.Connection > > > > cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data > > > Source=c:\db1.mdb" > > > > dim rs as New ADODB.Recordset > > > > rs.CursorLocation = constants.adUseClient > > > > rs.Open "SELECT * FROM Table1", cnn, adOpenStatic, > > > > adLockBatchOptimistic > > > > set rs.ActiveConnection = Nothing > > Well according to build.py: > # This is not the best solution, but I dont think there is > # one without specific "set" syntax. > # If there is a single PUT or PUTREF, it will function as a > property. > # If there are both, then the PUT remains a property, and > the PUTREF > # gets transformed into a function. > # (in vb, PUT=="obj=other_obj", PUTREF="set obj=other_obj > So, something like the following might work since, ActiveConnection does > have a put and a putref functions: > rs.SetActiveConnection(None) > > This code in Python > rs.ActiveConnection = None > Has the bogus VB equivalent of: > rs.ActiveConnection = Nothing > (i.e. no Set) > > The PUT vs. PUTREF distinction royally sucks. > > Bill Unfortunately, this doesn't work either: >>> rs.SetActiveConnection(None) Traceback (innermost last): File "", line 1, in ? rs.SetActiveConnection(None) File "E:\Program Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2EA4x0x2x1.py", line 1490, in SetActiveConnection return self._ApplyTypes_(0x3e9, 8, (24, 0), ((9, 1),), 'SetActiveConnection', None, arg1) File "E:\Program Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2EA4x0x2x1.py", line 375, in _ApplyTypes_ return self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid, LCID, wFlags, retType, argTypes) + args), user, resultCLSID) TypeError: None is not a invalid interface object in this context -- - Geoff Talvola Parlance Corporation gtalvola at NameConnector.com From Sunil.Hadap at cui.unige.ch Tue Feb 1 07:36:46 2000 From: Sunil.Hadap at cui.unige.ch (Sunil Hadap) Date: Tue, 01 Feb 2000 13:36:46 +0100 Subject: Plugs and connections via python scripting! Message-ID: <3896D35E.88F1B0E5@cui.unige.ch> I am attempting a first draft design of my 3d animation system. It will have python as embedded language. Engines are powerful features of modern animation systems. The attributes of graphical objects can be wired to script a complex behavior, hence the animation. User can connect the plugs (the object attributes) using connections (visually or using embedded scripting language). To elaborate, consider cubeOne and ballOne, the two graphics objects. cube cubeOne ball ballOne { { length radius height color { x, y, z } width } } one should be able to make ballOne's color change as cubeOne moves by scripting connect cubeOne.length ballOne.color.x connect cubeOne.height ballOne.color.y connect cubeOne.width ballOne.color.z etc... I am new to python as well as to "Design Patterns". How I can implement this in python! Are there any language specific features I can utilize. The above illustration is only schematic. What I want to achieve is when I query ballOne.color, while drawing it, the connection to ballOne.color should be automatically evaluated to update value of ballOne.color depending on position of cubeOne. Thank you very much for your inputs. If this is off topic kindly email me directly. -- "Live as if you would die tomorrow, learn as if you would live forever." --Mahatma Gandhi From effbot at telia.com Fri Feb 11 06:03:09 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 11:03:09 GMT Subject: Retrieve file by FTP (using urllib) References: Message-ID: Oleg Broytmann wrote: > What am I doing wrong? And how to use urllib to get files by FTP? interesting. they're using a non-standard server, which seems to implement the FTP protocol a bit more literally than urllib expects... full story: urllib issues an NLST command to make sure the file exists, before starting the download. however, RFC959 doesn't necessarily allow this: [NLST] causes a directory listing to be sent from server to user site. The pathname should specify a directory or other system-specific file group descriptor; a null argument implies the current directory. most FTP servers seem to treat NLST commands as ordinary "ls -l", but this one doesnt. I'm pretty sure the only reasonable solution is to remove the offending code from urllib... From carpenterasNOcaSPAM at mpco.com.invalid Wed Feb 9 10:10:02 2000 From: carpenterasNOcaSPAM at mpco.com.invalid (ASCarpenter) Date: Wed, 09 Feb 2000 07:10:02 -0800 Subject: COM and python Message-ID: <04e9bbf8.f292f07f@usw-ex0106-048.remarq.com> Is there anyone who can give me some hints on how to get to a custom COM component from python. Makepy won't work because it exposes the interface from IUnknown, not IDispatch. >From what I can tell I need to add an extension to python, but I'm wondering how to deal with the object instantiation and reference counting. Any examples out there? Also, does anyone know if this is covered in Mark's book (guess I'll drop a name because I see it so often here), in which case I can wait for that to turn up. * 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 ngps at post1.com Tue Feb 22 11:51:12 2000 From: ngps at post1.com (Ng Pheng Siong) Date: Tue, 22 Feb 2000 16:51:12 GMT Subject: Using Vim's embedded Python? Message-ID: <88uept$62e$1@nnrp1.deja.com> Hello, I'm writing a document that includes code snippets. I would like to prefix the code with line numbers for ease of reference elsewhere in the document. I'm using Vim with Python embedded. I tried to loop over vim.current.range, but apparently the lines in the range are read-only. Vim's help text for Perl and Tcl seem to indicate those languages' Vim interfaces do not have such constraints. Any hints? Alternatively, is this easily done using Vim's internal scripting language? (BTW, I think I should be able to do this with DTML and AMK's nght2html.py. May have to go that way sooner then. ;-) TIA. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps Sent via Deja.com http://www.deja.com/ Before you buy. From robin at alldunn.com Wed Feb 2 21:39:37 2000 From: robin at alldunn.com (Robin Dunn) Date: Wed, 2 Feb 2000 18:39:37 -0800 Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> Message-ID: "Mike Callahan" wrote in message news:3898ABDB.86804799 at home.com... > I thought that a new Python was going to be released "soon" which would > make some minor changes to the language. The one thing that struck in my > mind is that one would call string methods rather than functions, ie. > astring.upper() vs. string.upper(astring). There were other changes as > well. > An alpha is scheduled to be released in March, with final release in the Summer. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From alex at somewhere.round.here Thu Feb 24 17:26:00 2000 From: alex at somewhere.round.here (Alex) Date: 24 Feb 2000 17:26:00 -0500 Subject: Backreference within a character class References: Message-ID: > can somebody point me to where this is documented http://www.python.org/doc/current/lib/re-syntax.html The "r" at the start means "raw string. I don't know where this is documented, I learnt it from the newsgroup. It means read the string literally. Otherwise, you have to escape the backslashes. Alex. From garry at sage.att.com Tue Feb 8 14:15:52 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Tue, 8 Feb 2000 19:15:52 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> Message-ID: <38A06B68.AA77099F@sage.att.com> fcahoon at my-deja.com wrote: > > In article <1e5nkk6.1a5z8bp1lixbdvN%bparsia at email.unc.edu>, > bparsia at email.unc.edu (Bijan Parsia) wrote: > > I think, notwithstanding your experience with C (though why that > should > > be applicable to Python...), *you* have a riddle to answer: There is a > > *lot* of Python code out there. The standard distribution contains > loads > > of modules from many different sources. You *yourself* indicate that > > Python is becoming common place.... > > The popularity of a language cannot be taken as prima facie evidence of > its technical superiority. he didn't say it was. what he said was, lots of code has been written, and empirical evidence suggests that your fears are unfounded. > It's true that my experience writing python can, for practical purposes, > be called 0 here. However, I think it is a mistake to consider the > posters responding to me to be representative of people with experience > with python. you can't draw too much conclusion from this thread. most python users have long since given up arguing this point with people who don't use the language. people who dislike the indentation scheme tend to be vocal about it. the bottom line is: this is not a problem. indeed, many people (myself included) consider it a great advantage. it is one of the things i like most about python. if you don't like it, don't use it. -- 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 sabren at manifestation.com Mon Feb 28 01:23:26 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Mon, 28 Feb 2000 01:23:26 -0500 (EST) Subject: name of object inside it's methods? In-Reply-To: Message-ID: On Mon, 28 Feb 2000, Moshe Zadka wrote: > On Mon, 28 Feb 2000, Jason Stokes wrote: > > > > > >In other words I want the method to print the name of the object that it > > >belongs to > > > > > > Objects do not have names. Objects can be referred to by names, but this is > > not the same thing; any object can be referred to by multiple names. > > Or none at all: > > reader = lambda f=open("file"): f.readline() > > The file isn't referred to with any name you can get your hands on easily. > (Yes, you could start taking reader apart, but it's at best shaky) Hmmm.... On third thought, there are several ways you can "sort of" get the name(s) of an object, if you're willing to be flexible, (or in the first case, just plain nuts): A) you could recursively loop through all the namespaces available to your program and do an "is" check against everything you find.... B) you could give the object a .Name attribute and just use that instead. :) I'm sure there are other ways to fill out that list.. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From ivanlan at callware.com Wed Feb 16 11:35:52 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 16 Feb 2000 09:35:52 -0700 Subject: Real Problems with Python References: <000e01bf7763$dc8a9300$66a2143f@tim> Message-ID: <38AAD1E8.70075F92@callware.com> Hi All- Robin Becker wrote: > > In article , Fran?ois Pinard > writes > >neelk at brick.cswv.com (Neel Krishnaswami) writes: > > > >> I thought that the Smalltalk and Scheme designers were in regular > >> communication. > > > >Great minds and good people stay in regular communication. Aren't we all > >often reading (and writing to) this mailing list? :-) :-) Keep happy! > > > oooooooommmmmmhhhhh oooooohhhhhmmmmmmm, ooooommmmmhhhhhh mani padme > oooooohhhhmmmmmm :) ^^^^^^^^^^^^^^^^ s/oooooohhhhmmmmmm/huummmmmmmmmmmm/g -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 qoppi at my-deja.com Tue Feb 8 15:40:47 2000 From: qoppi at my-deja.com (qoppi at my-deja.com) Date: Tue, 08 Feb 2000 20:40:47 GMT Subject: performance issues between scripting languages in asp pages Message-ID: <87pv0f$2h4$1@nnrp1.deja.com> i've done some rudimentary testing using wcat to view performance differences between scripting languages for a set of pages(jscript, vbscript,perlscript,python). Initial results indicate that using vbscript as the server side scripting language consistently results in more pages being served by the webserver...has anyone else had a similar experience? Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Fri Feb 18 16:24:52 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 21:24:52 GMT Subject: Compiled code question References: <38ADAC1C.5A1D3388@exceptionalminds.com> Message-ID: Timothy Grant wrote: > When I copy a new version of the .py to the server I kinda thought that > the next time my users double-clicked their icons they would be running > the new code, this didn't happen. On the windows boxes, I must load the > .py into PythonWin, select the Run button, then exit my programme. Now > if the icon is double-clicked, the new code is executed. I'm sure this > has something to do with the byte code compiler and windows file > associations, but I have no idea what. tried synchronizing the clocks? From rchowd1 at my-deja.com Tue Feb 8 17:58:17 2000 From: rchowd1 at my-deja.com (rchowd1 at my-deja.com) Date: Tue, 08 Feb 2000 22:58:17 GMT Subject: Session variable in python Message-ID: <87q726$8ir$1@nnrp1.deja.com> How do we handle sessions in python (server side) ? Could you please explain with a simple example with a form (client-side) and python (server-side). Thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From reic0024 at ub.d.umn.edu Tue Feb 1 13:07:38 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Tue, 1 Feb 2000 12:07:38 -0600 Subject: programming for children In-Reply-To: <%dEl4.13464$t_.281347@news.rdc1.nj.home.com> References: <876emj$kco$1@oak.fernuni-hagen.de> <%dEl4.13464$t_.281347@news.rdc1.nj.home.com> Message-ID: On Tue, 1 Feb 2000, Brett g Porter wrote: > I disagree with this -- what did Philippe Kahn say -- "BASIC is to > programming like crack is to your brain" ? It's almost as bad as giving > someone a Herb Schildt C++ book... I'll give you that. I'm mostly speaking out of my own experience. As cruddy as BASIC maybe, it was easy enough to figure out without more than a reference for functions. Not useful for anything much, and not very interesting, but definately usable by kids. Aaron From sdyer7073 at my-deja.com Tue Feb 22 19:21:15 2000 From: sdyer7073 at my-deja.com (Shawn Dyer) Date: Wed, 23 Feb 2000 00:21:15 GMT Subject: how to turn arbitrary binary string into unix filename? References: Message-ID: <88v95p$qan$1@nnrp1.deja.com> Here is another possible solution for that problem that I have used (it takes advantage of the fact that a string is also a sequence type): >>> import md5, string >>> md=md5.md5() >>> md.update('Test Message') >>> md.digest() '\321\324\030\013~A\034K\350k\000\373.\341\003\353' >>> string.join(map(lambda x: '%02x' % ord(x), md.digest()),'') 'd1d4180b7e411c4be86b00fb2ee103eb' >>> In article , "Michal Wallace (sabren)" wrote: > On Fri, 18 Feb 2000, Bill Janssen wrote: > > > I'm sort of surprised that there doesn't seem to be any standard way > > to take a binary string in Python and turn it into a text string > > suitable for a UNIX filename. This is handy if you are trying to map > > data to filenames, for instance; you take the MD5 hash of the data, > > for instance the Message-ID of a mail message, convert it to an ASCII > > string (typically by hexifying it), and use that as the filename. But > > after half an hour of poking around, I can't see a standard method > > that one can call to hexify a string. > > Hey Bill, > > This code takes a binary string and converts it to a > hexidecimal representation. (It doubles the length > but only uses the characters 0-9 and a-f) > > def hexify(binaryString): > result = "" > for i in binaryString: > result = result + string.zfill(hex(ord(i))[2:],2) > return result > > Sent via Deja.com http://www.deja.com/ Before you buy. From kern at caltech.edu Tue Feb 15 17:14:52 2000 From: kern at caltech.edu (Robert Kern) Date: 15 Feb 2000 22:14:52 GMT Subject: "Real" problem... References: <38A99C34.109D34BB@math.okstate.edu> Message-ID: <88cj4s$erh@gap.cco.caltech.edu> In article <38A99C34.109D34BB at math.okstate.edu>, "David C. Ullrich" writes: > Well, this time I started at python.org, and sure enough > I found what I was looking for, an arbitrary-precision > floating point package. > > Or so it seemed - Netscape and urllib.urlretrieve both whine > about 'cannot find file or directory'. What I'm looking for is > > ftp://ftp.python.org/pub/python/contrib/Math/real-accurate.pyar > > , which is a link I found at > > http://www.python.org/topics/scicomp/numbercrunching.html The link is broken. See http://www.python.org/download/Contributed.html for information on the anonymous ftp archive policy (it changed recently). The correct link is ftp://ftp.python.org/pub/python/contrib-09-Dec-1999/DataStructures/real-accurate.pyar > . Thanks. > > DU -- 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 wolf at one.net Wed Feb 9 17:22:54 2000 From: wolf at one.net (wolf at one.net) Date: Wed, 09 Feb 2000 17:22:54 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262139803-5814898@hypernet.com> <87ocad$to2$1@nnrp1.deja.com> Message-ID: fcahoon at my-deja.com wrote: >Suppose that I'm one of those set-tabs-to-logical-indentation sorts of >guys, so I set my tab width to 4, then look at this code in my editor. >Gee, it sure _looks_ like statement4 belongs to "if condition1"! And, >if I convert tabs to spaces when I save, statement4 _will_ belong to "if >condtion1". I've just unwittingly changed the logic of the code! > >You may, of course, argue that this is unlikely, but it is still >plausible enough to make me _very_ nervous. You know, tabs in Python code are really not a good idea. :) You should use an editor that converts tabs to spaces when you press the tab key. ScopeEdit, for instance, does this. So does E! No tabs, no possible ambiguity! Respectfully, Wolf "The world is my home, it's just that some rooms are draftier than others". -- Wolf From dilsavor at erinet.com Thu Feb 10 11:31:01 2000 From: dilsavor at erinet.com (Ronald L. Dilsavor) Date: Thu, 10 Feb 2000 12:31:01 -0400 Subject: How to do this? - newbie Message-ID: <38a2e958$0$1403@news.voyager.net> Hi, I am new to python and am quite excited about it. I spent much of last night writing my fist code snippet and I came across 1 thing which I could not figure out how to do. Suppose >>> a=('x',1) then how can I create an x of numerical type such that >>> print x 1 - just using manipulations of a = ('x',1) Also let me know if this type of thing would not be considered best practice in python. I thought I would need to make use of eval() but could not find an incantation that would do it. Thanks, Ron From effbot at telia.com Wed Feb 16 15:43:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 20:43:22 GMT Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> Message-ID: Michael Hudson wrote: > While we're at it, I've just noticed that some things aren't string > methods that you might expect to be. > That leaves capwords, center, ljust, rjust and expandtabs. Is there a > reason for their omission? lazyness? the 16-bit unicode string object implements them all, so it shouldn't be that hard to add them to 8-bit strings. imo, this should be fixed before 1.6 (well, I'm not so sure about "capwords"...) From echeverria at interactiva.cl Tue Feb 29 22:51:22 2000 From: echeverria at interactiva.cl (Cristian Echeverria) Date: Tue, 29 Feb 2000 23:51:22 -0400 Subject: any non programmers out there? References: Message-ID: <38bc8506@omega> I think a very good and basic introduction is the Python tutorial: http://www.python.org/doc/current/tut/tut.html Cristian Echeverria Collin Greene escribi? en el mensaje de noticias sbourus0jp101 at corp.supernews.com... > I don't need technical help. What I need is basic help and instruction, you > wont need to baby me through it and I love to work on y own I just need > someone who can introduce me the this wonderful lang called python and help > me with the daily ins and outs of it. thanks > Greene at hctc.com > > From justus at my-deja.com Wed Feb 16 12:56:53 2000 From: justus at my-deja.com (Justus Pendleton) Date: Wed, 16 Feb 2000 17:56:53 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> <889lhn$bn$1@nnrp1.deja.com> <88c5qn$ot4$1@nnrp1.deja.com> Message-ID: <88eod3$jb1$1@nnrp1.deja.com> In article , =?ISO-8859-1?Q?Fran=E7ois_Pinard?= wrote: > Justus Pendleton writes: > > > I guess I don't see how MI is a different issue [...] > > Neither do I. But for a different reason. What means MI? :-) MI = Multiple Inheritance, i.e. class Foo (Bar, Splat): pass instead of just class Foo (Bar): pass Sent via Deja.com http://www.deja.com/ Before you buy. From scarblac-spamtrap at pino.selwerd.nl Mon Feb 14 10:18:38 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 14 Feb 2000 15:18:38 GMT Subject: When to compile regex? References: <38A69D62.5A68F54D@chelmsford.com> <20000214151918.D658@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote in comp.lang.python: > >>> for i in range(0): > ... print "do something" > ... > > Compiling *in* the loop would be more efficient than compiling outsite > the loop :) > > writing-an-empty-program-is-always-the-fastest-solution-ly y'rs - gerrit Well, to be the fastest solution, it has to be a solution first ;) -- Remco Gerlich, scarblac at pino.selwerd.nl 4:14pm up 82 days, 22:18, 5 users, load average: 0.14, 0.10, 0.06 From michael.stroeder at inka.de Tue Feb 22 19:55:56 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Wed, 23 Feb 2000 01:55:56 +0100 Subject: Easy reading HTML? References: Message-ID: <38B3301C.38BAAF20@inka.de> "Martin Sk?tt" wrote: > > I am currently in the thinking process of writing a little python > program to sort my Netscape bookmarks file. Parsing Netscape bookmarks was already done. I forgot the URL but search for bkmk2db/db2bkmk. You can derive your own sub-class for your output format. Ciao, Michael. From Sven.Drescher at dlr.de Tue Feb 1 09:00:05 2000 From: Sven.Drescher at dlr.de (Sven Drescher) Date: Tue, 1 Feb 2000 15:00:05 +0100 Subject: Need help with Tk problem... Message-ID: <876ook$ieq$1@news.go.dlr.de> Hallo! I need a little Tk feature for my GUI, but I don't know how to do the following. I looked for it in Deja and FAQs but nothing found. I want to get the current size of an widget, e.g. Tkinter.Frame() I know the options geometry, width and height. But if the frame grows or shrinks, these options don't change. What did I wrong? Is there an other function to get the current size??? Thanks for help! Sven -- ______________________________________ German Aerospace Research Establishment e-mail: Sven.Drescher at dlr.de From effbot at telia.com Sun Feb 27 16:20:00 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 21:20:00 GMT Subject: Best book to learn Python? References: Message-ID: <4ygu4.1255$mYj.193107968@newsa.telia.net> Quill wrote: > I'd like to learn Python, and I want to purchase a good book. I'd like > one that is suitable for a beginning programmer. If anyone has had any > success learning from a book please let me know. Please post responses to > the group. "Learning Python" and "The Quick Python Book" is probably your best bets at the moment. they're a bit different in style; you may wish to check them out in your local bookstore to see which one you prefer. you can more info via the page: http://www.python.org/psa/bookstore/ (but consider ordering via www.noamazon.com, or support your local bookstore...) From jason at hostway.com Wed Feb 2 18:22:57 2000 From: jason at hostway.com (Jason Abate) Date: Wed, 2 Feb 2000 17:22:57 -0600 Subject: socket.gethostbyaddr() problem Message-ID: <87aec4$gmn$1@news.jump.net> I'm having a problem with socket.gethostbyaddr(). If I call it as root, it works fine, but if I call it as non-root, I get the following exception: socket.gethostbyaddr(socket.gethostname()) socket.error: host not found This is on a fairly standard Redhat 6.0 box. I've checked to see if /etc/hosts is world readable, and nslookup on the machine works fine. Any idea what could be causing this problem? I'm desparate to fix and, and welcome any suggestions. Thanks, -jason ------------------------------- Jason Abate Hostway Corporation jason at hostway.com From trentm at ActiveState.com Tue Feb 8 09:35:02 2000 From: trentm at ActiveState.com (Trent Mick) Date: Tue, 8 Feb 2000 14:35:02 -0000 Subject: 64-bit port of Python In-Reply-To: <000701bf71ff$b6b6dda0$d92d153f@tim> Message-ID: [Trent and Tim talk about 64-bit porting issues in the Python code. Trent also sneakily changes email addresses.] [Tim Peters]: > It's not what you suspect . Almost everything boiled down > to mistaken > and unintended assumptions that sizeof(int) == sizeof(long), in and around > the implementations of (unbounded) long arithmetic, and > overflow-checking of > int arithmetic. All that stuff was fixed then. AFAIK, core Python code > *never* casts a pointer to any sort of int, or vice versa, either > explicitly or implicitly. A couple of example where I think the Python core does just that: "Modules/arraymodule.c::728": static PyObject * array_buffer_info(self, args) arrayobject *self; PyObject *args; { return Py_BuildValue("ll", (long)(self->ob_item), (long)(self->ob_size)); } where 'ob_item' is a pointer. "Python/bltinmodule.c::899": static PyObject * builtin_id(self, args) PyObject *self; PyObject *args; { PyObject *v; if (!PyArg_ParseTuple(args, "O:id", &v)) return NULL; return PyInt_FromLong((long)v); } Python sort of relies on C's 'long' to be the largest native integer. This is evidenced by all the use of PyInt_FromLong() above. There are no format specifiers in the PyArg_Parse*() and Py_BuildValue() functions for converting a pointer. This was fine when 'long' would do. On Win64 sizeof(long)==4 and size(void*)==8. I think this also brings up some wider issues in the Python source. For instance, the python integer type uses the C 'long' type. Was it the implicit intention that this be the system's largest native integral type, i.e. 32-bits on a 32 sys and 64-bits on a 64-bit system? If so, then the representation of the Python integer type will have to change (i.e. the use of 'long' cannot be relied upon). One should then carry through and change (or obselete) the *_AsLong(), *_FromLong() Python/C API functions to become something like *_AsLargestNativeInt(), *_FromLargestNativeInt() (or some less bulky name). Alternatively, if the python integer type continues to use the C 'long' type for 64-bit systems then the following ugly thing happens: - A Python integer on a 64-bit Intel chip compiled with MSVC is 32-bits wide. - A Python integer on a 64-bit Intel chip compiled with gcc is 64-bits wide. That cannot be good. From alex at somewhere.round.here Sat Feb 12 18:15:21 2000 From: alex at somewhere.round.here (Alex) Date: 12 Feb 2000 18:15:21 -0500 Subject: delays in python References: <38A5E385.83F33D90@stat.ubc.ca> Message-ID: The time.sleep function accepts float's, doesn't it? E.g. time.sleep (0.5) should put your program out for half a second. Alex. From effbot at telia.com Wed Feb 2 11:20:56 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 16:20:56 GMT Subject: Tk variables problem References: <879a88$t68$1@news.go.dlr.de> Message-ID: Sven Drescher wrote: > I cannot understand why the following little program doesn't work correct. > It's surely a little problem, but in my program are more situations, where > such an error is raised. /.../ > Attribute Error: 'None' object has no attribute 'tk' you must create a Tk instance (a root window) before you can create variables. creating such a window initializes the Tk interface, and installs a default root object. (if you create a widget, it automagically creates a root window for you, but image and variable objects doesn't do that) From gerrit.holl at pobox.com Tue Feb 1 09:47:23 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 1 Feb 2000 15:47:23 +0100 Subject: programming for children In-Reply-To: ; from hildeb@stahlw06.stahl.bau.tu-bs.de on Tue, Feb 01, 2000 at 11:58:42AM +0000 References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <20000201154723.A1704@stopcontact.palga.uucp> Gutentag, Ralf Hildebrandt wrote on 949402722: > On Tue, 1 Feb 2000 11:05:54 +0100, Fritz Heinrichmeyer wrote: > >My son is 11 years and wants to learn programming. He heared about java at > >school (cool like nike or adidas ...) but in my opinion this is very hard > >stuff for a beginner to bring anything to play. > > > >I thought of a nice python environment under windows ... It would be best to > >have german documentation too. There is a German book, isn't there? There is a Germen list, isn't there? > >What do you think? > > I always thought LOGO would be the way to go. Nonsense. I started with LOGO and I wish I never did. Python is definately the right way to go. When he talks here, his English will be improved also. You should know how much of my English I learned here! regards, Gerrit. From sparhawk at aon.at Mon Feb 28 16:36:52 2000 From: sparhawk at aon.at (Gerhard Gruber) Date: Mon, 28 Feb 2000 22:36:52 +0100 Subject: [ANC] Template for CGI scripts ond others Message-ID: I've just submitted a module template.py to the source tree at http://www.vex.net/parnassus/resource.py. This module was primarily written for handling templates of HTML files in CGI scripts but can be used in any kind of programm that needs to use pre-prepared textfiles with variable content. Check out the description I entered for more details. You can download it at http://members.aon.at/sparhawk in the download section and you can email me at sparhawk at aon.at if you have question concerning the use or bug reports. I don't expect problems, though, because it is fairly easy to use. :) -- Bye, Gerhard In Windows, the graphic driver is responsible for maintaining the mouse. :))) Need a daily tv guide? Look at my homepage: http://members.aon.at/sparhawk From mmueller at dgfz.de Wed Feb 16 05:02:54 2000 From: mmueller at dgfz.de (Mike Mueller) Date: Wed, 16 Feb 2000 11:02:54 +0100 Subject: netcdf with python from win32 Message-ID: <3.0.6.32.20000216110254.00965510@orion.dgfz.de> I plan to work with netcdf from Python. The ScientificPython packages has such an interface. Unfortunately I couldn't get the netcdf module to compile. All the make files included are for Unix-like os. My own attempts to compile the module failed due my lack of experience with C. Furthermore, the compilation of netcdf for win32 seems to be no trivial task. If anybody has successfully compiled netcdf for win32 with Python and FORTRAN interfaces and is willing to share the outcome of this effort it would nice if I could have the binaries. I am working with NT4.0 Services Pack 4.0 Thanks Mike --------------------------------------------------------- Dipl.-Ing. Mike Mueller, M.Sc. Dresden Groundwater Research Center Meraner Str. 10 D-01217 Dresden Germany Tel.: +49 351/4050675 Fax.: +49 351/4050679 e-mail: mmueller at dgfz.de http://www.dgfz.de ---------------------------------------------------------- From skip at mojam.com Wed Feb 9 11:59:56 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 9 Feb 2000 10:59:56 -0600 (CST) Subject: A = X > Y ? X : Y In-Reply-To: <87s5lq$j93$1@nntp3.atl.mindspring.net> References: <38A0BD01.9586107B@be-research.ucsd.edu> <87s5lq$j93$1@nntp3.atl.mindspring.net> Message-ID: <14497.40204.132370.427503@beluga.mojam.com> Michal> I know there's been a couple replies to this... but why not do Michal> something like VB's (or at least VBA's - not sure if VB proper Michal> has it) "immediate If" function? Michal> def iif( condition, first, second ): ... Michal> then it's: Michal> a = iif( a > y, x, y ) Wrong semantics. Both x and y will be evaulated before the function call regardless of the value of the condition. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From fredrik at pythonware.com Tue Feb 1 08:20:11 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 14:20:11 +0100 Subject: Compile Problem Imaging-1.0/Tk References: <3895AE03.D26FD7CD@daimlerchrysler.com> Message-ID: <031501bf6cb7$12454dd0$f29b12c2@secret.pythonware.com> Tilo Schwarz wrote: > ./Tk/tkImaging.c: In function `PyImagingPhoto': > ./Tk/tkImaging.c:76: warning: passing arg 1 of `Tk_FindPhoto' from > incompatible > pointer type > ./Tk/tkImaging.c:76: too many arguments to function `Tk_FindPhoto' > make: *** [tkImaging.o] Error > 1 > > I couldn't find something about that in an FAQ. > I have only one tk.h on my system (SUSE 6.2), which is in > /usr/X11R6/include/tk.h and the libs seem to be alright: > /usr/X11R6/lib/libtk8.0.a > /usr/X11R6/lib/libtk8.0.so > /usr/lib/libtcl8.0.a > /usr/lib/libtcl8.0.so > > Now I have in Tk/tkImaging.c:76: > > photo = Tk_FindPhoto(interp, argv[1]); > > and in tk.h: > > EXTERN Tk_PhotoHandle Tk_FindPhoto _ANSI_ARGS_((char *imageName)); > > which obviously doesn't match. looks like an old header file. iirc, they added the interp argument at some time during the 8.0 beta phase, so you might have an early 8.0 version on your machine. unless you want to grab the latest and greatest Tcl/Tk (8.0.5 is probably your best bet for Python 1.5.2), you could try changing the call in tkImaging.c to match your header file: photo = Tk_FindPhoto(argv[1]); /* using old Tk library */ From thomas at xs4all.net Thu Feb 3 03:19:57 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 3 Feb 2000 09:19:57 +0100 Subject: socket.gethostbyaddr() problem In-Reply-To: <87aec4$gmn$1@news.jump.net>; from jason@hostway.net on Wed, Feb 02, 2000 at 05:22:57PM -0600 References: <87aec4$gmn$1@news.jump.net> Message-ID: <20000203091957.A6378@xs4all.nl> On Wed, Feb 02, 2000 at 05:22:57PM -0600, Jason Abate wrote: > I'm having a problem with socket.gethostbyaddr(). If I call it as > root, it works fine, but if I call it as non-root, I get the following > exception: > > socket.gethostbyaddr(socket.gethostname()) > socket.error: host not found > > This is on a fairly standard Redhat 6.0 box. I've checked to see if > /etc/hosts is world readable, and nslookup on the machine works fine. > Any idea what could be causing this problem? I'm desparate to fix > and, and welcome any suggestions. It works fine on my rh6.0 box here: >>> socket.gethostbyaddr(socket.gethostname()) ('tilburg.poiesz.net', [], ['194.109.58.47']) Did you check /etc/resolv.conf as well? I do get a 'host not found' error when my /etc/resolv.conf is unreadable and my hostname is not listed in /etc/hosts. If that doesn't fix it, are you using a DNS, or are you unconnected and relying entirely on /etc/hosts ? Does it have the proper entries for your hostname ? -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From python at rose164.wuh.wustl.edu Wed Feb 2 08:50:05 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Wed, 02 Feb 2000 13:50:05 GMT Subject: Tk variables problem In-Reply-To: <879a88$t68$1@news.go.dlr.de> References: <879a88$t68$1@news.go.dlr.de> Message-ID: <20000202.13500539@sparky.spkydomain> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/2/00, 7:10:50 AM, "Sven Drescher" wrote regarding Tk variables problem: > Hi! > I cannot understand why the following little program doesn't work correct. > It's surely a little problem, but in my program are more situations, where > such an error is raised. > I thought, there isn't a problem, but... > Tanks for hints, what I did wrong. > Sven > e.g.: > #!/usr/.../python > import Tkinter > class test: > def __init__(self): > self._bool=Tkinter.BooleanVar() > self._bool.set(1) > self.display() > def display(self): > print "Hi!" > print "The value is ", self._bool.get() > a=test() > a.hallo() > error: > Variable.__init__(self, master) > self._tk = master.tk > Attribute Error: 'None' object has no attribute 'tk' > ... you need to instantiate a root window, like this: root = Tkinter.Tk() before you make the call to Tkinter.BooleanVar(). David Fisher -------------- next part -------------- An HTML attachment was scrubbed... URL: From doughellmann at home.com Fri Feb 25 16:46:39 2000 From: doughellmann at home.com (Doug Hellmann) Date: Fri, 25 Feb 2000 21:46:39 GMT Subject: Interview test for developers Message-ID: <38B6F9C5.953E3C78@home.com> As one of the developers on a project using Zope and Python, I have been asked to create a test to be given to applicants for positions in our group. We already have such tests for C, C++, Perl, SQL, etc. The goal of the tests is not to find out exactly how much a person knows about the subject. We just want to verify that if someone claims they know a language they *know* the language, not *know of* the language. Tests are not given to applicants unless they claim knowledge in an area for which we have a written test. The other tests have questions such as "what does this statement do," "find the syntax error in this statement," "optimize this snippet of code," "which header file has the definition for string functions like strcmp," and "what does this compiler/linker error message mean." There are also questions asking the applicant to write very brief segments of code to do a relatively simple task (for example, the perl test asks them to write a loop to read all of the lines from stdin and print out the lines which do not begin with a comment sign). These are not meant to be tricky questions, since we don't want it to take a long time to take the test. The test is taken with pencil and paper, so minor syntax errors, etc. are ignored when we grade. We typically look over the answers with the applicant and discuss correct and incorrect answers -- this gives us a little insight into how they learn from mistakes, etc. Anyone who knows more than "Python is a scripting language" should be able to do relatively well on the test I will be assembling. Anyone who knows a significant amount of Python should be able to get the harder questions (such as optimization) -- these are used to identify people who have a higher than average knowledge in the area. I'm planning to model the Python test on the others, but do not want to use exactly the same questions since we typically give each applicant a couple of tests. I thought it might be a good idea to ask around to see if anyone a) had such a test from which I could borrow inspiration or b) if anyone had suggestions for questions to include in the test. I will to post the results back to the group once I have my final draft written, if there is interest in seeing the test. Thanks for your input, Doug From seanb at home.com Wed Feb 9 11:23:52 2000 From: seanb at home.com (seanb at home.com) Date: Wed, 9 Feb 2000 11:23:52 -0500 (EST) Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87rc79$chc$4@mach.vub.ac.be> Message-ID: <200002091623.LAA29125@seanb.sttln1.wa.home.com> On 9 Feb, Thomas Hamelryck wrote: > > Thomas Hamelryck (that's me!) wrote: > : I am in exactly the same position. It was a serious design error. > : I wonder how the CP4E people are going to explain to complete > : computer illiterates that a python program can contain errors that > : are _not even visible_ when you look at the code. > > Mikael Olofsson wrote: > : But they _are_ visible! It's just as visible to me as it is to the > : interpreter. > > Mix tabs and spaces and you can get errors that are not visible. > Try it. > > Cheers, > > --- > Thomas Hamelryck Institute of Molecular and Structural Biology > Aarhus University Gustav Wieds Vej 10C > DK-8000 Aarhus C Denmark Executive summary: Consistently of indentation style, which is simply a VERY good idea in most other languages, is CRITICAL with python. -- Sean Blakey (206)297-7123 quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0]) From python-list at teleo.net Fri Feb 18 13:33:52 2000 From: python-list at teleo.net (Patrick Phalen) Date: Fri, 18 Feb 2000 10:33:52 -0800 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') In-Reply-To: <38AD8B9C.F3F4DCF5@inka.de> References: <38AC9E92.C1CEFEB7@inka.de> <87u2j68n7j.fsf_-_@den.home.net> <38AD8B9C.F3F4DCF5@inka.de> Message-ID: <0002181035260E.01356@quadra.teleo.net> [Michael Str?der, on Fri, 18 Feb 2000] :: But there are open issues: :: :: SimpleHTTPServer is based on SocketServer and :: [python-doc]/lib/module-SocketServer.html says: :: :: "These four classes process requests synchronously; each request :: must be completed before the next request can be started." :: :: In my case there might be long-running LDAP queries which would :: block all other users. Do you already have some example code with :: threading? I will dig into this and publish the code... Have you looked at Medusa? http://www.nightmare.com/medusa/ From effbot at telia.com Wed Feb 16 18:09:04 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 23:09:04 GMT Subject: Barcode-module References: <38AAA1EC.FA68F9C@bibsyst.no> Message-ID: Thomas Weholt wrote: > I`d like to generate barcodes. Can it be done from within python > somwhow?? of course. you need a specification, PIL or Piddle, and a few spare hours. or start here: http://www.cgpp.com/bookland/ (ISBN barcode generator in pure Python, plus links to more code and info on this topic). hope this helps! From thomas at xs4all.net Sat Feb 5 12:01:09 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sat, 5 Feb 2000 18:01:09 +0100 Subject: deleting global namespaces In-Reply-To: <87hiam$6lk$1@nnrp1.deja.com>; from martindvorak@my-deja.com on Sat, Feb 05, 2000 at 04:15:21PM +0000 References: <87fm8a$v4j$1@nnrp1.deja.com> <20000205154128.A14392@xs4all.nl> <87hiam$6lk$1@nnrp1.deja.com> Message-ID: <20000205180108.B19265@xs4all.nl> On Sat, Feb 05, 2000 at 04:15:21PM +0000, martindvorak at my-deja.com wrote: > > If you then wish to reset to the initial state, just create a new > > module.Module object. > That's clear but it does not solve my problem. I know > objects and use them extensively, but I need to divide > the whole application (which consists of hundrends > of objects) into independent components each with its own > global namespace so that component's objects can > use this global namespace independently on other > objects in other components. I guess I still dont understand the problem. You can place these objects each in its own module, giving each a seperate global namespace. IMHO, if you are relying on a module-level attribute to be in a specific state, as set by module initialization, you either have to create a function to reset them to that state (which seems simple, to me, but see the first line of this paragraph) or your attributes are in the wrong place. Also, dont forget that you can set module-level attributes from class __init__ methods (and, of course, other class methods as well.) You just have to be very careful that you only have one object instantiated, if you rely on module-level attributes. Are you sure you can't do what you want by replacing the references to 'attribute' by 'self.attribute' ? -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From gerrit.holl at pobox.com Sun Feb 13 15:59:51 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 13 Feb 2000 21:59:51 +0100 Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] In-Reply-To: <886tdh$t4n$1@nntp6.atl.mindspring.net>; from aahz@netcom.com on Sun, Feb 13, 2000 at 06:33:21PM +0000 References: <000301bf75f6$34eb3e60$962d153f@tim> <886tdh$t4n$1@nntp6.atl.mindspring.net> Message-ID: <20000213215951.A14407@stopcontact.palga.uucp> Aahz Maruch wrote on 950463201: > In article <000301bf75f6$34eb3e60$962d153f at tim>, > Tim Peters wrote: > >[Aahz Maruch] > >> > >> Would make it a lot easier to do, say, > >> > >> def foo(bar): > >> print bar > >> > >> foo(a;b;c) > > > >Since it's unclear why that's an interesting thing *to* do, I'm not sure why > >it would be an advantage to make it easier to do it . > > Here's (what I hope is) a slightly clearer example: > > def foo ( bar, baz ) : > print bar > print baz > > foo ( a;b;c, d ) # doesn't work > foo ( (a,b,c), d ) > > I find the former to be clearer; I'm uncomfortable with the idea that > arguments to a function are necessarily tuples (which is what the > current syntax implies). I find this clearer: foo({a,b,c}, d) The same characters are used as with dictionaries, but the difference is clear... Especially for singleton tuples, no awful trailing ',' is needed. But we're a decade too late, I'm afraid! regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From jstok at bluedog.apana.org.au Mon Feb 14 08:33:04 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Tue, 15 Feb 2000 00:33:04 +1100 Subject: Order of object cleanup at interpreter exit? References: Message-ID: Rob W. W. Hooft wrote in message ... >I am writing a package (98% python) that controls an analytical robot. >The robot is controlled via a simple text protocol over a socket >connection. > >When the robot control object is garbage-collected, the __del__ method >takes care of a proper termination of the socket connection by sending >a last "EXIT" command: [snip] >And indeed, it seems that the "sendfixed" function was already garbage >collected: "print sendfixed" just before the call reports "None".... > >I was not aware that it was "illegal" to call a function from a destructor. >Is this a strange caveat? Bug? Feature? Any way to avoid it? The order names are cleaned up at the time of system exit is undefined. This means you cannot rely on the names in your __del__ method being around when you call them. In other words, don't rely on implicit cleanup code when the system exits, because it's unreliable. Instead, explicitly clean up by, say, creating an explicit shutdown step. This is a gotcha, rather than a bug or a feature. From tim_one at email.msn.com Mon Feb 21 19:37:58 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 21 Feb 2000 19:37:58 -0500 Subject: Int methods (was RE: string.py) In-Reply-To: <20000221084211.B872@stopcontact.palga.uucp> Message-ID: <000001bf7ccd$1196d220$29a2143f@tim> [Tim] >> ... >> The parser has trouble with 5.radix because "maximal munch" >> lexing sucks up "5." as a float. [Gerrit Holl] > I can't understand why this won't work, either: > >>> aaa=4 > >>> 1.aaa > File "", line 1 > 1.aaa > ^ > SyntaxError: invalid syntax If you understood why 5.radix didn't work, you can't possibly not understand why 1.aaa didn't work -- they're both of the form int_literal "." name and the parses "sees that" as float_literal name > >>> (1,2).aaa > Traceback (innermost last): > File "", line 1, in ? > AttributeError: 'tuple' object has no attribute 'aaa' > >>> (1,2).(aaa) > File "", line 1 > (1,2).(aaa) > ^ > SyntaxError: invalid syntax What about it? The LHS (left hand side) of an attribute reference can be any expression, but the RHS (right hand side) must be a name. "(aaa)" isn't a name, and the introduction of int methods doesn't require generalizing any of these rules. From wlfraed at ix.netcom.com Thu Feb 24 00:36:48 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Wed, 23 Feb 2000 21:36:48 -0800 Subject: A question from a total newbie References: <88j7a2$n5e$1@nnrp1.deja.com> <89263v$sau$1@nnrp1.deja.com> Message-ID: On Thu, 24 Feb 2000 02:47:28 GMT, Lisa declaimed the following in comp.lang.python: > > I am thinking of starting on DOS level, without any cumbersome > layers on windows. Do you recommend that? > Use the standard Windows binaries and run inside a command line shell on W9x (what does M$ call it? a DOS Prompt window?). You don't need to /program/ window/mouse stuff to just work the core language -- though PythonWin makes for a decent development environment too. -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 22:52:39 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 22:52:39 -0500 Subject: Python and ASP question References: <89apf7$sgr$1@nnrp1.deja.com> Message-ID: Yosef: In an article posted Sun, 27 Feb 2000 09:06:47 GMT, yosefgold at hotmail.com (yosefgold at hotmail.com) said: > I am trying to import a module (using the 'import' statement) into an > ASP page and it does not seem to be working. Is this a limitation of > Python/ASP or am I doing something wrong? There are a couple of things you might want to check: That the Win32 Python Extensions are properly installed. Your Python version is 1.5.2. <%@Language=Python%> as the first executable line in the ASP file. Between the <% %> delimiters, leading spaces are important. For instance: <% import sys pyVersion = sys.version %> will work. Whereas <% import sys pyVersion = sys.version %> will fail. The interpreter doesn't like the leading spaces in front of import and pyVersion. Here's a sample ASP file that should work as-is (it works for me). Copy and paste it into an ASP file and execute it from your server. It should display the current Python version and a list of server environment variables. If this doesn't work, your Win32 Extensions installation may be hosed up. -----------[ copy after this line ]-------------- <%@Language=Python%> <% # NO leading spaces here indent = " " * 5 def emitEnv(): # leading spaces needed here... import os for key in os.environ.keys(): Response.Write("
%s%s=%s\n" % (indent, key, os.environ[key])) # again, NO leading spaces here import sys pyVersion = sys.version %>

Current Python Version

<%=indent + pyVersion%>

Server Environment Variables

<% # no leading spaces, yet again emitEnv() %> -----------[ copy before this line ]-------------- Hope this helps some. Btw, it sometimes makes it easier to get assistance around here if you include error messages and/or tracebacks when you have problems. "import won't work" is a bit vague. Just a thought.... -=< tom >=- Thomas D. Funk (tdfunk at asd-web.com) | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From gerrit.holl at pobox.com Tue Feb 8 14:12:15 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 8 Feb 2000 20:12:15 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87phc0$ojo$1@nnrp1.deja.com>; from fcahoon@my-deja.com on Tue, Feb 08, 2000 at 04:48:02PM +0000 References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> Message-ID: <20000208201215.B2074@stopcontact.palga.uucp> fcahoon at my-deja.com wrote on 950024882: > The popularity of a language cannot be taken as prima facie evidence of > its technical superiority. Consider Perl. The number of modules > available for Perl on CPAN is positively mind-boggling. Does this mean > that Perl must necessarily be a superior language? This is a *very* true point. [ ("Windows NT", "Linux"), ("Perl", "Python"), ("Majordomo", "Mailman") ] I'm sure a *lot* people in here can .extend() this list with many items. In all of these cases, the latter is better than the former, but the former has good things the latter hasn't too. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From moshez at math.huji.ac.il Sun Feb 27 00:29:46 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 07:29:46 +0200 (IST) Subject: parameter undefined in procedure In-Reply-To: Message-ID: On Sat, 26 Feb 2000, Don Tuttle wrote: > 2) And without trying to re-kindle any passionate dialog, was there ever any > general consenous reached about whether "list comprehensions" where likely > to be included in Python? Oh, there's consensus, but you won't like it: they'll probably be made into the language if someone (a) figures out a nice syntax and (b) submits a patch to Guido. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From MSteed at altiris.com Tue Feb 1 15:13:22 2000 From: MSteed at altiris.com (Mike Steed) Date: Tue, 1 Feb 2000 13:13:22 -0700 Subject: re AMTE thread re DrScheme & Python Message-ID: <65118AEEFF5AD3118E8300508B124877073D52@webmail.altiris.com> > From: urner at alumni.princeton.edu [mailto:urner at alumni.princeton.edu] > Sent: Tuesday, February 01, 2000 1:01 PM > To: python-list at python.org > Subject: Fwd: re AMTE thread re DrScheme & Python > > For more context re the below, see the archived thread > (on-going) at the Math Forum. This is from an > Association of Mathematics Teacher Educators > listserv: > > http://forum.swarthmore.edu/epigone/amte/snuquoiyor > > If people posting here have the time to read what > Matthias says about Python... e.g.: > > > As far as the language is concerned, Python is a > > - highly irregular, > > - badly implemented > > - non-parethetical version of (Mz)Scheme > > - without underlying theory of programming > > language design > > - or program development > > - with a cult-like following. > > I'd be happy to read their feedback. Hmm, are you sure he didn't mean Perl? :) -- M. From effbot at telia.com Tue Feb 1 16:04:39 2000 From: effbot at telia.com (/F) Date: Tue, 01 Feb 2000 21:04:39 GMT Subject: file modes References: <8772sg$fdb$1@news6.svr.pol.co.uk> Message-ID: Dave Berkeley wrote: > But the "wb" mode does not seem to override the underlying mode of stdout. > I'm using Python 1.5.2 on Win 98 SE, talking to Apache 1.3.9. > > How can I write to stdout in binary mode? you can use the -u option to the interpreter to force stdout and stderr into unbuffered binary mode. From scarblac-spamtrap at pino.selwerd.nl Sun Feb 6 20:32:22 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 7 Feb 2000 01:32:22 GMT Subject: nonlinear programming? References: <87l1oa$g88$1@nnrp1.deja.com> Message-ID: jeremiahrogers at my-deja.com wrote in comp.lang.python: > is there a way for me to start on a function, then > move onto another function before that function > ends? I am working on an mpg123 frontend, and i > want to start a song playing, then allow the user > to either skip that song, or perform other > essential tasks during the time when a song is > playing. is this possible? You need Threading. Different threads execute 'simultaneously'. Look in Deja to find recent posts on learning how to do threads; and there should be something on the python.org site. -- 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 effbot at telia.com Thu Feb 17 07:25:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 12:25:32 GMT Subject: FTP References: <000b01bf793f$c28a5750$3acbd9c2@peridot.optichrome.com> Message-ID: <0NRq4.3915$dT4.209167872@newsb.telia.net> Adrian Eyre wrote: > I'm aware of the ftplib module for use in ftp clients, but has > anyone here [written|seen|heard of|dreamed about] a module > which would provide ftp *server* functionality?' http://www.nightmare.com/medusa/ From jidun at my-deja.com Thu Feb 10 21:16:58 2000 From: jidun at my-deja.com (jidun at my-deja.com) Date: Fri, 11 Feb 2000 02:16:58 GMT Subject: Embedding and extending Message-ID: <87vreo$aoq$1@nnrp1.deja.com> I know there are some threads discussing this, but usually they concentrate on one or the other. Also all of them refer to the online python.org documentation which really isnt that good on these two topics, imho. Here is my understanding from those threads: To do both I need three 'modules': 1: python 2: the module that extends python (.dll on Win32) 3: my application that embeds python (.exe on Win32) Is there a way to eliminate module 2? In other words, can module 3 be both the app that embeds python and the module that has the functions python can call back to? To elaborate: I know that a extend-module called 'mymod' needs an initmymod function that python calls when it imports it to get hold of the function table. When I embed python in my application, can I somehow hand over that function table to python so that my scripts can call back into my application? Thanks -Ron Sent via Deja.com http://www.deja.com/ Before you buy. From te at first.gmd.de Fri Feb 25 11:49:37 2000 From: te at first.gmd.de (Thilo Ernst) Date: Fri, 25 Feb 2000 17:49:37 +0100 Subject: Phyththon misspelling contest References: <8owt4.22169$Jz3.111396@nnrp1.uunet.ca> <38B698C3.18B690C6@onera.fr> Message-ID: <38B6B2A1.6339791E@first.gmd.de> Marc POINOT wrote: > Oh! Nice... is it a hat? > > __/--\__ > > No, this is not a hat. This is an elephant. > It has been swallowed by a Python. > What about a tiny improvement(my excuses to Mr StExupery): __/-^-\__ In case it isn't obvious: the caret marks the hump of a camel being digested. Considering that a snake is long, more swallowed items could be shown. Examples: a feather, a coffee cup, ... - Thilo From gerrit.holl at pobox.com Mon Feb 21 15:11:45 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 21:11:45 +0100 Subject: Life's better without braces Message-ID: <20000221211145.B3016@stopcontact.palga.uucp> Hello all, I have a problem. In my Python enthuishasm, I ripped off the braces from my keyboard because I thought I didn't need them. Unfortunately, I have a problem now. I can't create dictionairies any more! And because braces aren't the only keys on the brace key, I can't create lists either. The solution for the latter is list(()), but how do I create an empty dictionairy without braces? I know I can do: >>> import os >>> d=os.environ.data >>> for k in d.keys(): ... del d[k] ... >>> d {} But is there a more efficient way to do it? Does the 'new' modules has something I want? HELP! If I'll rip off the ';' too, I won't be able to type blocks any more, since I won't be able to type a ':' either. Hmm, is it safe to rip off the '$'? I don't need a '4'! regards, Gerrit. From justus at my-deja.com Mon Feb 14 14:37:27 2000 From: justus at my-deja.com (Justus Pendleton) Date: Mon, 14 Feb 2000 19:37:27 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <889lhn$bn$1@nnrp1.deja.com> In article , neelk at alum.mit.edu wrote: > > > 3. Multiple inheritance is unsound > > > > > > By 'unsound' I mean that a method call to a method inherited by a > > > subclass of two other classes can fail, even if that method call > > > would work on an instance of the base class. > Here's some code: > > class Foo: > x = 99 > def frob(self): > print "%d bottles of beer" % self.x > > class Bar: > x = "bar" > def wibble(self): > print "Belly up to the " + self.x > > Note that all the operations on Foo and Bar work safely for direct > instances of Foo and Bar. But if you define a subclass like so: > > class Baz(Bar, Foo): > pass In an earlier post you mentioned that Dylan gets this "right" but as I understand it, in Dylan two classes with the same getter generic function ("x" in this case) are "disjoint - they can never have a common subclass and no object can be an instance of both classes" (from the Dylan Reference Manual section on Slot Inheritance). It seems like Dylan resolves this by simply saying you can't write code like that, not by making Multiple Inheritance safer. Or am I missing something? Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Tue Feb 8 23:26:13 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 8 Feb 2000 23:26:13 -0500 Subject: 64-bit port of Python In-Reply-To: Message-ID: <000601bf72b5$cceb8f60$372d153f@tim> [posted & mailed] [Trent and Tim talk about 64-bit porting issues in the Python code. Trent also sneakily changes email addresses.] [Tim] > AFAIK, core Python code *never* casts a pointer to any sort of > int, or vice versa, either explicitly or implicitly. [Trent Mick [mailto:trentm at ActiveState.com]] > A couple of example where I think the Python core does just that: Good eye, Trent! Thank you. I'm also sending this to Mark Hammond, since ActiveState now pays him to worry about Python's Windows story -- and perhaps pays you too . > "Modules/arraymodule.c::728": > > static PyObject * > array_buffer_info(self, args) > arrayobject *self; > PyObject *args; > { > return Py_BuildValue("ll", > (long)(self->ob_item), (long)(self->ob_size)); > } > > where 'ob_item' is a pointer. Yes, the author of the new buffer interface code is being shot for many reasons . > "Python/bltinmodule.c::899": > > static PyObject * > builtin_id(self, args) > PyObject *self; > PyObject *args; > { > PyObject *v; > > if (!PyArg_ParseTuple(args, "O:id", &v)) > return NULL; > return PyInt_FromLong((long)v); > } Oh yes. Been there forever, and won't work at all (while nothing promises that id returns an address, it's crucial that "id(x) == id(y)" iff "x is y" in Python). > Python sort of relies on C's 'long' to be the largest native integer. Don't forget that Python was written pre-ANSI, and this was a common (universal?) assumption in the fuzzier K&R flavor of C. ANSI C went on to guarantee the existence of *some* integral type such that a pointer could be cast to that type and back again without loss of info -- but one committee member told me that at least he was surprised as all heck when it was pointed out that the std neglected to say that must be a *standard* integral type. The notion that "long isn't long enough" is a loophole in the std, and I'm not sure it was an intentional one. Nevertheless, it's an official one now, so that's that. > This is evidenced by all the use of PyInt_FromLong() above. There are > no format specifiers in the PyArg_Parse*() and Py_BuildValue() > functions for converting a pointer. This was fine when 'long' would > do. On Win64 sizeof(long)==4 and size(void*)==8. > > I think this also brings up some wider issues in the Python source. > For instance, the python integer type uses the C 'long' type. Was it > the implicit intention that this be the system's largest native > integral type, i.e. 32-bits on a 32 sys and 64-bits on a 64-bit > system? More the explicit intention that it be the longest standard integral type, back in the days that was believed to "mean something non-trivial". It's been a darned good bet for a decade . The advertised semantics at the Python level promise only that it's at least 32 bits. > If so, then the representation of the Python integer type will have > to change (i.e. the use of 'long' cannot be relied upon). One should > then carry through and change (or obselete) the *_AsLong(), > *_FromLong() Python/C API functions to becomesomething like > AsLargestNativeInt(), *_FromLargestNativeInt() (or some > less bulky name). > > Alternatively, if the python integer type continues to use the C > 'long' type for 64-bit systems then the following ugly thing > happens: > - A Python integer on a 64-bit Intel chip compiled with MSVC is > 32-bits wide. > - A Python integer on a 64-bit Intel chip compiled with gcc is > 64-bits wide. > That cannot be good. Two things work against all that: 1. In 1.5.2, and more in the current CVS tree, there's already grudging support for "longer than long" via the config LONG_LONG macro (e.g., under MS Windows that's already #defined as __int64). That may spread more, although it's ugly so will be resisted (Guido hates #ifdef'ing code, and platform #ifdef'ed macros aren't exactly liked -- each one is that much more for new ports to wrestle with, and everyone to trip over forever after). 2. It's already not good that int size can matter across platforms with grosser differences than the above. For that & other reasons, the sharp Python-level distinction between (bounded) ints and (unbounded) longs is slated for (backward compatible) death. Andrew Kuchling already has much of the work for that in hand, but unclear whether it will make it into 1.6 (it's not a high priority now, although I expect you just boosted it a bit ...). Once it's in, "id" can return million-bit ints as easily as it returns C longs now. or-if-activestate-solves-this-for-perl-first-we'll-just-rewrite-python- in-that-ly y'rs - ti From effbot at telia.com Tue Feb 8 05:04:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 10:04:34 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87on3m$p2i$1@mach.vub.ac.be> Message-ID: Thomas Hamelryck wrote: > I am in exactly the same position. It was a serious design error. > I wonder how the CP4A people are going to explain to complete > computer illiterates that a python program can contain errors that > are _not even visible_ when you look at the code. have you read the CP4E paper? did you understand it? the people who are going to use CP4E environments won't have that problem. tabs and spaces are a text file encoding issue, so why the heck do you use tools that forces you to deal with text file encoding issues? the CP4E folks won't. (if you bother to read the CP4E paper, you'll find that automagic whitespace handling is only a small part of what you can do in an intelligent environment -- how about automatic syntax checking, semantic analysis, data-flow/type safety analysis, support for refactoring, alternate views of the source code, etc, etc.). and btw, if CP4E (or any other of all current attempts to create development environments) turns out to be a success, do you really expect companies to keep paying programmers who refuse to use modern tools? or at least pay them what they're used to? http://library.northernlight.com/PN20000113240000125.html From scarblac-spamtrap at pino.selwerd.nl Sun Feb 6 20:36:21 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 7 Feb 2000 01:36:21 GMT Subject: modules documentation References: <389DC06F.52BA60AB@retemail.es> Message-ID: Xose L. Gonzalez wrote in comp.lang.python: > Being new in Python, I got impressed by its easiness for learning it and > using it, but IMO there is a lack of documentation, namely: > > Where (web page) can I get a modules' documentation more complete than > the one supplied in the Python delivery, specially regarding the text > files processing?? > (normally there are no examples in the modules tutorial) Is there anything wrong with the Library Reference at python.org? http://www.python.org/doc/current/lib/lib.html And also the other stuff you can find by clicking "Documentation" on the main Python page. -- 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 charoger at online.no Tue Feb 22 17:32:44 2000 From: charoger at online.no (Roger Baklund) Date: Tue, 22 Feb 2000 23:32:44 +0100 Subject: msvcrt, open_osfhandle, locking References: Message-ID: Mark Hammond wrote in message news:d_Ds4.1368$LX4.4097 at news-server.bigpond.net.au... > file handle. The locking module works directly with file object - no locking module...? -- Roger From shochat at my-deja.com Sun Feb 13 21:12:36 2000 From: shochat at my-deja.com (shochat at my-deja.com) Date: Mon, 14 Feb 2000 02:12:36 GMT Subject: support@usenetserver.com References: <38A6A00C.DF503BD8@chelmsford.com> Message-ID: <887oai$liq$1@nnrp1.deja.com> I must apologize for posting something which was actually intended to be a mail message to my news provider. Obviously my postings *are* reaching the group (I'm doing this from deja), but they don't show up on the server. -- David (extremely embarassed) Shochat Sent via Deja.com http://www.deja.com/ Before you buy. From dworkin at ccs.neu.edu Wed Feb 16 10:36:29 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 16 Feb 2000 10:36:29 -0500 Subject: rtti unix vs win32 In-Reply-To: curtin@my-deja.com's message of "Wed, 16 Feb 2000 14:00:04 GMT" References: <88eah3$8fj$1@nnrp1.deja.com> Message-ID: curtin at my-deja.com writes: > what is the best way to do a run-time type > identification of what o/s my program is running > on? sys.platform is the simplest way to get that information. -Justin From gmcm at hypernet.com Wed Feb 2 21:52:53 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 2 Feb 2000 21:52:53 -0500 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <3898E3FC.61C6CA9C@callware.com> Message-ID: <1262576128-2292072@hypernet.com> Ivan Van Laningham wrote: > > Kirby Urner wrote: > > > ]snip[ > > I, in turn, sincerely apologize for writing an emotional evaluation about > > Python and its users. I should not have given permission to post my first > > reaction to a newsgroup about which I knew nothing. I particularly regret > > using the word "cult" for Python users. > > > > -- Matthias Felleisen > > > > Hmmph. It's not enough. He should grovel more, and he should be forced > to use Python for a month. Well, I'm glad it's over. I was running low on candles and bat's wings, and couldn't find a virgin anywhere... - Gordon From sholden at bellatlantic.net Mon Feb 28 00:10:02 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 05:10:02 GMT Subject: Python code using threads References: Message-ID: <38BA032B.81CA5806@bellatlantic.net> Jason Stokes wrote: > > Can anyone point me in the direction of some good open source Python code > that uses threading and locking? I learn best by reading production level > code. For locking, search deja news. There has been some recent discussion on the topic. For threading I can do no better than repeat jblaine at shell2.shore.net (Jeff Blaine)'s recent post (once is never enough, especially for me): Ripped straight from Aahz Maruch's post the other day and simplified as more of a 'visual learning tool' demo. Added a few comments... whatever...just posting in case someone finds this one more graspable at a thread-beginner level like me. #!/usr/local/bin/python import time, threading, whrandom class MyThread(threading.Thread): """ Each thread picks a 'random' integer between 0 and 19 and reports in once per second for that many seconds. """ def run(self): iterations = whrandom.randint(0, 19) for i in range(iterations): print " ", self.getName(), "is reporting in" time.sleep(1) print self.getName(), "is DONE" if __name__ == '__main__': threadList = [] # Create 5 MyThread() threads for i in range(5) : thread = MyThread() threadList.append(thread) # Start all threads for thread in threadList: thread.start() # As long as we have more than just the 'main' thread running, print out # a status message while threading.activeCount() > 1 : print str(threading.activeCount()), "threads running including main" time.sleep(1) Please note, you should not expect this to run under Idle, which gave somewhat incomprehensible results to a newbie like me, but it works fine as a standalone. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From gtnorton at my-deja.com Mon Feb 14 04:12:18 2000 From: gtnorton at my-deja.com (gtnorton at my-deja.com) Date: Mon, 14 Feb 2000 09:12:18 GMT Subject: Greetings! Message-ID: <888gtg$67n$1@nnrp1.deja.com> Hello people, I've been away for quite a while and it's good to see that the community is as strong as ever.I'm looking to give Python another try after a failed first attempt last year(inexperience plus the book I owned really turned me off!).Instead of learning Python, I started learning C (yeah, I know, C as a first language?) but always had Python in the back of my head. I'm looking forward to asking you good people many silly, silly questions once again Such as: When I attempt to use the "raw_input" function on IDLE -- IT NO WORK it's fine through the command line and PythonWin.Bug? What gives? Also, are any newbies (or anyone)interested in starting a communty group here on Deja or some kind of programming club?.I feel I'm learning C much faster when I'm bouncing ideas off others as I do in a C group I work with.If interested, drop me a line at: strat_addict at yahoo.com And my best to you all, G.T.Norton Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Fri Feb 11 10:52:12 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 11 Feb 2000 10:52:12 -0500 Subject: Special Interest Group: Import redesign In-Reply-To: Message-ID: <1261838166-23957028@hypernet.com> Rob W. W. Hooft wrote: > >>>>> "GM" == Gordon McMillan writes: > > GM> As a result of the Developer's Day session on Import Uitilities, > GM> a new SIG (the import-SIG) has been formed. The goal is a new > GM> architecture for the import facility in Python. > > Will this address the O(N**2) problem of locating large numbers of > modules in lots of package directories? > > devel[286]~%% strace ndisp ambi/s01f001.kcd |& grep -c open > 2145 Yup. With the (prototype) imputil.py and archives, you can reduce this to linear in the number of packages, (actually archives, but 1 package per archive seems a sensible way to manage things). On my Linux box, using the RH style configuration (*everything* is shared), I reduced the number of opens on startup (for a trivial script) from 107 to 9 using imputil, archives and a tweaked getpath.c (that just finds a "boot" path, instead of a full-blown one). - Gordon From J.C.Travers at durham.ac.uk Sun Feb 20 09:30:38 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Sun, 20 Feb 2000 14:30:38 +0000 Subject: [Q] Python and 3D tools References: <88m003$1dani$1@fu-berlin.de> Message-ID: <38AFFA8E.EF6DB969@durham.ac.uk> Randall Hopper wrote: > > Jo?o Neto wrote: > | > |Does anybody know if Python is used together with > |some 3D Engine? > > What kind of engine? Game? SciVis? > > Here's a list from the past: > ..... > - wxPython GLCanvas (MSW-only!) This also works for me on Linux... Cheers, John. From effbot at telia.com Thu Feb 10 03:21:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 08:21:29 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> <87sbgq$nga$1@nnrp1.deja.com> Message-ID: Quinn Dunkan wrote: > Hey, as long as they get answered! > > msg a: > blurfl? ez ziq glid org, dor bung whoey funt spaz? erk un ling bluk > fith domp. > > msg b: > > blurfl? ez ziq glid org, dor bung whoey funt spaz? erk un ling bluk > > fith domp. > geeble gorp. blinkin brug ting dos bergle pop, lerp el tisty frunken. > blakken eeben, dep morden spee fozz. > > msg c: > > > blurfl? ez ziq glid org, dor bung whoey funt spaz? erk un ling bluk > > > fith domp. > > geeble gorp. blinkin brug ting dos bergle pop, lerp el tisty frunken. > > blakken eeben, dep morden spee fozz. hey, that almost survives my "is that dutch?" test (read it out load, with swedish pronounciation, and see if some- one else in the room replies, or more likely, takes offense). From alex at somewhere.round.here Thu Feb 24 16:02:25 2000 From: alex at somewhere.round.here (Alex) Date: 24 Feb 2000 16:02:25 -0500 Subject: Best way to find unique items in a list References: Message-ID: How about the following: import operator def unique_elements(l): d = {} length = len(l) map(operator.setitem, length * [d], l, length * [None]) return d.keys () test_list = ['Max','Gitte','Magnus','Caroline','Clara','Max','Gitte'] print unique_elements(test_list) This returns ['Magnus', 'Gitte', 'Caroline', 'Clara', 'Max']. You could easily sort the result if you want that. You might also want to check out kjbuckets, which provides a set type. Alex. From krodgers at tdyryan.com Thu Feb 24 16:27:21 2000 From: krodgers at tdyryan.com (krodgers at tdyryan.com) Date: Thu, 24 Feb 2000 21:27:21 GMT Subject: Bug in win32all-128 with multiprocessor NT Message-ID: <8947n9$c5k$1@nnrp1.deja.com> Here's a bug I've run across in win32all-128 (actually, has been present at least since win32all-125, but I've been too busy to report it) on a two-processor NT box. I've reproduced the bug on several different machines, with NT 4 SP3, SP4, SP5. Here's the problem: For reasons too obscure to go into here, I have an app that I need to make sure is only running on one processor of a dual-processor machine. For processname "pname", here's a script to do that: import win32api, win32pdhutil, win32con, win32process pid = win32pdhutil.FindPerformanceAttributesByName("pname") handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, 0, pid[0]) win32process.SetProcessAffinityMask(handle, 1) win32api.CloseHandle(handle) Using win32all-125, -127, or -128, this script dies with the following error: 'The instruction at "0x00000001" referenced memory at "0x00000001". The memory could not be "read".' If you run the script in Pythonwin, then Pythonwin is the process in which the error is reported; if you run the script with just the plain Python interpreter, the error is reported in python.exe. The process affinity actually does get set correctly, so the error is more an annoyance than anything, but since I noticed that the SetProcessAffinityMask function is mentioned in the new Win32 Python book, I thought I'd report this problem. If anybody else has a multiprocessor machine they could try this out on, I'd be very interested to hear the results. You can email me at krodgers at ryanaero.com. Thanks! Kevin Rodgers Northrop Grumman Ryan Aeronautical Center krodgers at ryanaero.com "Snakes. Why did it have to be snakes?" -- Indiana Jones Sent via Deja.com http://www.deja.com/ Before you buy. From stidolph at origin.ea.com Wed Feb 9 11:57:12 2000 From: stidolph at origin.ea.com (Stidolph, David) Date: Wed, 9 Feb 2000 10:57:12 -0600 Subject: A = X > Y ? X : Y Message-ID: <11A17AA2B9EAD111BCEA00A0C9B41793034AB159@molach.origin.ea.com> I would think that this would be better because it eliminates a local variable assignment. def iif( condition, first, second ): if condition: return first else: return second -----Original Message----- From: Michal Wallace [mailto:sabren at manifestation.com] Sent: Wednesday, February 09, 2000 8:46 AM To: python-list at python.org Subject: Re: A = X > Y ? X : Y Curtis Jensen wrote in message <38A0BD01.9586107B at be-research.ucsd.edu>... >I fear that this question has already been asked, but is there and >equivalant one line command that is equivalant to the C command: > >a = x > y ? x : y I know there's been a couple replies to this... but why not do something like VB's (or at least VBA's - not sure if VB proper has it) "immediate If" function? def iif( condition, first, second ): result = second if condition: result = first return result then it's: a = iif( a > y, x, y ) -michal http://www.sabren.com/ -- http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Fri Feb 25 14:48:24 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 25 Feb 2000 19:48:24 GMT Subject: No way to reach CXX again ? References: <38B676D7.28C44F56@onera.fr> Message-ID: Marc POINOT wrote: > I'm trying to dowload CXX (LLNL/ P.Dubois). > I've unsuccessfuly tried all the links > I had: no way... > > Any idea? Is CXX dead? Is CXX now private? fwiw, the ftp site works fine from here: ftp://ftp-icf.llnl.gov/pub/python/ From bowman at montana.com Wed Feb 16 09:27:55 2000 From: bowman at montana.com (bowman) Date: Wed, 16 Feb 2000 14:27:55 GMT Subject: rtti unix vs win32 References: <88eah3$8fj$1@nnrp1.deja.com> Message-ID: curtin at my-deja.com wrote: >what is the best way to do a run-time type >identification of what o/s my program is running >on? sys.platform From effbot at telia.com Fri Feb 25 05:54:50 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 25 Feb 2000 10:54:50 GMT Subject: msvcrt, open_osfhandle, locking References: <68Hs4.1435$LX4.4374@news-server.bigpond.net.au> <06db8d30.f0a3be48@usw-ex0105-038.remarq.com> Message-ID: <_btt4.7925$al3.104409@newsc.telia.net> Roger Baklund (shouldn't that be Backlund? ;-): > >Oops - meant "locking function in msvcrt module" > > Hmmm. Do you have an example? I can't get it to work. > > The documentation says: "locking (fd, mode, nbytes) > Lock part of a file based on a file descriptor from the C > runtime. Raises IOError on failure. " > and for open_osfhandle: "open_osfhandle (handle, flags) > Create a C runtime file descriptor from the file handle handle." forget those docstrings. they may be technically correct, but they sure are confusing as hell ;-) here's an extract from the eff-bot guide (see msvcrt-example-3.py for the full story): ... _LK_UNLCK = 0 # unlock the file region _LK_LOCK = 1 # lock the file region _LK_NBLCK = 2 # non-blocking lock _LK_RLCK = 3 # lock for writing _LK_NBRLCK = 4 # non-blocking lock for writing ... file = open(FILE, "r+") # look from current position (0) to end of file msvcrt.locking(file.fileno(), _LK_LOCK, os.path.getsize(FILE)) ... hope this helps! From tom at parlant.com Wed Feb 16 11:08:50 2000 From: tom at parlant.com (Thomas Lane) Date: Wed, 16 Feb 2000 09:08:50 -0700 Subject: Multicolumn listbox for Tkinter available ? References: <38a977e2@wwwproxy3.westgroup.com> Message-ID: <38AACB92.199FF676@parlant.com> If anyone finds one of these, I am very interested as well. I need one of these for an application I am working on, and I dread building one from distinct pieces (buttons, entry fields). Does anyone know if there is a way to port/adapt the tcl one (from the link below) to Tkinter? -Thomas Lane MikeZ wrote: > > Thanks, but this doesn't quite do it, since it is nothing more then a bunch > of list controls side by side. > > There is a tcl implementation here: > > http://www1.clearlight.com/~oakley/tcl/mclistbox/index.html > > and I wondered if there was a Tkinter equivalent. > > -Mike Z. > > Moshe Zadka wrote in message ... > >On Mon, 14 Feb 2000, MikeZ wrote: > > > >> Does anyone where I can get a Multicolumn listbox implemented in Tkinter > ? > > > >IDLE has one. (See the source distribution, Tools/idle/) > >-- > >Moshe Zadka . > >INTERNET: Learn what you know. > >Share what you don't. > > > > From moshez at math.huji.ac.il Mon Feb 14 11:16:03 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 18:16:03 +0200 (IST) Subject: eff-bot In-Reply-To: <04df01bf76f3$01e24600$01ffffc0@worldnet.att.net> Message-ID: On Mon, 14 Feb 2000, Emile van Sebille wrote: > to the tim-bot. I mean, there really is no Tim Peters, is there? > Has anyone seen the tim-bot in human form? It's just a self > maintaining program written in, eh.., well maybe python now, but > probably assembler fat-fingered into some early VAX that has > managed to crib parts and pieces over the years and upgrade itself > using every imaginable language and idiom available. Probably > doesn't even consume any power! ;-) I beg to disagree. Do you really think AI has progressed far enough? Notice that Guido is the only one who claims to have seen Tim. Maybe it is Guido has something to hide? Have you ever noticed Tim and Guido hardly ever seem to disagree? My Official Conspiracy Theory is that Guido is actually Tim. Sure, he has a Python script answering the easy e-mails, but the gist of it is all Guido. now-i-must-hide-from-the-psu-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From hildeb at www.stahl.bau.tu-bs.de Wed Feb 16 10:00:40 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 16 Feb 2000 15:00:40 GMT Subject: fork() and anydbm question Message-ID: I've written a little program which mails me the daily Dilbert, Robotman etc. It mainly consists of a function "fetch_and_mail()" which tries to get the GIF, checks whether that particular GIF was already fetched yesterday (yes, updates on those servers are not reliable!). This is done by writing the GIF's md5 hash into a persistent dictionary using anydbm. fetch_and_mail() calls fork() in order to parallelize the process of fetching the GIF's: def fetch_and_mail(): parent = os.fork() # return 0 in the child if (parent > 0): # not 0, meaning parent process time.sleep(5) # give the process 5s to fork return # parent returns if (parent == -1): print "fork() failed" sys.exit(1) # we're in the child now ... lots of ugly code ... try: page = urllib.urlopen(mainurl) except: print "urlopen(" + mainurl + ") failed" os._exit(1) ... Questions: * What about the database created by anydbm.open() ? Does it become inconsistent since multiple processes write to it? * Is the use of os._exit(1) in the child process correct? Or should I use sys.exit(1) instead? From bjorn at roguewave.com Thu Feb 24 15:57:13 2000 From: bjorn at roguewave.com (bjorn) Date: Thu, 24 Feb 2000 13:57:13 -0700 Subject: Best way to find unique items in a list References: <38B59831.FDF0FD5@exceptionalminds.com> Message-ID: <38B59B29.66624788@roguewave.com> Timothy Grant wrote: > maxm wrote: > > Anyone for a little brain gym? > > > > ------------------------------------------ > > > > def Unique(theList): > > uniqueList = [] > > OldValue = '' > > theList.sort() > > for value in theList: > > if OldValue != value: > > uniqueList.append(value) > > OldValue = value > > return uniqueList > > > > print Unique(['Max','Gitte','Magnus','Caroline','Clara','Max','Gitte']) > > How about... > > def Unique(theList): > uniqueList = [] > for value in theList: > if value in uniqueList: > continue > uniqueList.append(value) > return uniqueList shorter and faster... :-) def Unique(theList): uniqueList = {} for value in theList: uniqueList[value] = 1 return uniqueList.keys() -- bjorn From agcolstonNOagSPAM at buckman.com.invalid Fri Feb 18 00:22:43 2000 From: agcolstonNOagSPAM at buckman.com.invalid (Tonetheman) Date: Thu, 17 Feb 2000 21:22:43 -0800 Subject: What is the correct way to install PIL on Windows Message-ID: <0e3da846.4297725e@usw-ex0105-035.remarq.com> I downloaded a precompiled version of PIL for Python 1.52 from Pythonware (I think) and I unzipped it. I am very new to using python so be kind if possible. After a while I figured out that I needed to move the _imaging.dll to the DLLS directory. I knew that I needed to create a PIL diretory somewhere. After hacking around a while I found a registry key and added the pil directory to the system path. Now when I go into python and type import sys print sys.path it includes the PIL directory. Everything seems to work fine. My question is what is the correct way to install the package? Should I have just used PYTHONPATH? There was another strange file in the zipped up distribution called pil.pth. Is this file supposed to be placed somewhere and that will somehow tell python where everything is at? If so did I just miss it in the docs. Any ideas? Thanks ahead of time. Tony Colston * 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 ron at graburn.com Sun Feb 13 18:10:51 2000 From: ron at graburn.com (Ronald Hiller) Date: Sun, 13 Feb 2000 23:10:51 GMT Subject: Changes to urlparse.py: urljoin Message-ID: <38A739C1.7666E84E@bellatlantic.net> I've been having some problems with the urljoin function. When I try and join URLs that have '..' components that make the path above the root, they aren't joined properly. For example: goof> python Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import urlparse >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") 'http://www.xyz.com/../x/y/z.gif' >>> # Now with the changes: > python Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import urlparse >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") 'http://www.xyz.com/x/y/z.gif' >>> My patches for urlparse are included below...do they look reasonable? What is the process for getting these into the "real" source tree? Thanks, Ron *** orig/Lib/urlparse.py Thu Mar 18 10:10:44 1999 --- urlparse.py Sun Feb 13 16:51:36 2000 *************** *** 166,171 **** --- 166,175 ---- i = i+1 else: break + while segments[0] == '': + del segments[0] + while segments[0] == '..': + del segments[0] if len(segments) == 2 and segments[1] == '..' and segments[0] == '': segments[-1] = '' elif len(segments) >= 2 and segments[-1] == '..': From sholden at bellatlantic.net Wed Feb 23 00:02:33 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 05:02:33 GMT Subject: help: menu item callback in TK References: <88uvl5$sj0$1@pollux.ip-plus.net> Message-ID: <38B369EB.D21F5BA8@bellatlantic.net> lin li wrote: > > Hi, > > I have the following problem and any help is greatly appreciated. > I generated a menu using the data in a dynamically composed list. > Since I do not know what will be in the list, I can only have all the > command items in the menu to point to the same callback. Now > from inside the callback, how can I find out which menu item is > selected? To make it more interesting, the menu can have two or > three levels of cascades. > > I am running Python 1.5.2 with Tkinter on NT. > > Thank you very much. > > Lin Since you clearly must have the menu string available when you construct the menu, can't you use the menu string in building a lambda which you can use as your callback function? The lambda could call a function common to all menu items, and inside that function you would be able to access the string the user had selected. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From jae at ilk.de Wed Feb 2 05:03:44 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Wed, 02 Feb 2000 11:03:44 +0100 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <000101bf6d4f$fb1ba480$28a0143f@tim> (tim_one@email.msn.com) References: <000101bf6d4f$fb1ba480$28a0143f@tim> Message-ID: <02022000.7@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Tim" == Tim Peters writes: [...] Tim> virtually-everyone-using-python-today-does-so-by-choice-ly But whose choice? ;-)) Bye, J - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 MARS: http://JuergenErhard.tripod.com/mars_index.html GIMP - Image Manipulation Program (http://www.gimp.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 iEUEARECAAYFAjiYAP4ACgkQN0B+CS56qs33HwCYvNZWCdlZPieCTOmU/AJBzWas WQCcCeN0ch7LcC5C4DBDm5GHRo34cC8= =gFyr -----END PGP SIGNATURE----- From jfarrell at mincom.com Thu Feb 17 20:16:07 2000 From: jfarrell at mincom.com (John Farrell) Date: Fri, 18 Feb 2000 11:16:07 +1000 Subject: Python misconceptions in IBM Ruby article... References: <38AB8445.DF945829@webone.com.au> Message-ID: <38AC9D57.5CC8066C@mincom.com> Stuart Hungerford wrote: > Neither Python nor Perl were designed as > object-oriented > languages. Consequently, the OO features often feel "added on" and are > not fully > integrated into the language core, making for cryptic code.""" I agree that Python's OO features feel added on. Consider: * You have to pass self to each member function. There's no obvious requirement that self need actually be the bound instance. * Classes are not types. This strongly suggests that Python had types other than 'instance' first, and when objects were added, it was too late to make all types classes. * In a method, fields of the bound instance need to be referenced through the self parameter, because the scoping rules do not understand about instance variables. * Proper OO languages do not use white space to delimit blocks, and use semicolons and block delimiters. That last one's a joke! Don't turn this into another white space thread! Anyway, even though I do agree with the added on statement, that does not mean that Python is bad or needs to be changed. I am only pointing out that the criticism is justifiable. John -- Dr John Farrell - Research Architect - Mincom Limited I don't suffer from stress. I am a carrier. -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d- s++:+ a C+++ U+ 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------ This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this E-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. From mhammond at skippinet.com.au Tue Feb 1 07:08:13 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 12:08:13 GMT Subject: question about COM and ADO References: <86t965$vlq$1@nnrp1.deja.com> Message-ID: Try: rs.ActiveConnection.Value = None ? Or just set rs itself to None... Mark. wrote in message news:86t965$vlq$1 at nnrp1.deja.com... > I'm using ADO from Python, and I'm having a problem figuring out > how to do the equivalent of the VB code > > Dim cnn as New ADODB.Connection > cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb" > dim rs as New ADODB.Recordset > rs.CursorLocation = constants.adUseClient > rs.Open "SELECT * FROM Table1", cnn, adOpenStatic, > adLockBatchOptimistic > set rs.ActiveConnection = Nothing > > in Python. I'm trying to create a disconnected client-side recordset, > which requires that after I open the recordset, I set its > ActiveConnection property to Nothing (at least that's how it's done in > VB). I can't figure out the equivalent in win32com. In particular, it > chokes if I try to set it to None: > > >>> from win32com.client import * > >>> cnn = Dispatch('ADODB.Connection') > >>> cnn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb" > ) > >>> rs = Dispatch('ADODB.Recordset') > >>> rs.CursorLocation = constants.adUseClient > >>> rs.Open( "SELECT * FROM Table1", cnn, > constants.adOpenStatic,constants.adLockBatchOptimistic ) > >>> rs.ActiveConnection = None > Traceback (innermost last): > File "", line 1, in ? > rs.ActiveConnection = None > File "E:\Program > Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2EA4x0x2x 1 > .py", line 390, in __setattr__ > apply(self._oleobj_.Invoke, args + (value,) + defArgs) > com_error: (-2146825287, 'OLE error 0x800a0bb9', (0, 'ADODB.Recordset', > 'The application is using arguments that are of the wrong type, are out > of acceptable range, or are in conflict with one another.', '', 0, > -2146825287), None) > > > Anyone have an idea of how to do this? > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From a.eyre at optichrome.com Fri Feb 4 08:05:06 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Fri, 4 Feb 2000 13:05:06 -0000 Subject: Can someone tell me whats wrong with this? In-Reply-To: <949669150.72286756@news.sheltonbbs.com> Message-ID: <003701bf6f10$756cfce0$3acbd9c2@peridot.optichrome.com> > os.system("export CVSROOT='os.system(TmpGrep)'") > os.system("echo $CVSROOT") These are 2 separate shell sessions, if you want CVSROOT to be available for the 2nd command, you must do both lines in one os.system. You might find it easier, though, to use the -d parameter. def Cvs_Update(): module = raw_input("Module: ") cvsroot = os.system("grep -w " + TmpMod + " /etc/hscvs.conf | awk -F= '{ print $2 }'") os.system("cvs -d " + cvsroot + " update " + module") ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From moshez at math.huji.ac.il Sat Feb 12 01:18:12 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 08:18:12 +0200 (IST) Subject: How do you undo x = `a` if A is a list? In-Reply-To: <088a01bf7519$580332a0$01ffffc0@worldnet.att.net> Message-ID: On Fri, 11 Feb 2000, Emile van Sebille wrote: > >>> f = open(r"c:\temprepr","r") > >>> c = eval(f.readline) bug: you meant eval(f.readline()) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From neilh at hare.net.au Thu Feb 24 20:58:21 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Fri, 25 Feb 2000 12:58:21 +1100 Subject: Pythonwin (Version 2 beta 3) References: Message-ID: <02eb01bf7f33$cc5d27e0$01646464@computer> > When printing a python source file using pythonwin (I like the > shades of grey) it prints out all but the last page. Do all source files do this? Does Print Preview show all pages? Neil From hildeb at www.stahl.bau.tu-bs.de Mon Feb 7 08:55:02 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 7 Feb 2000 13:55:02 GMT Subject: mail filter in python? References: <20000208000902.31713@nms.otc.telstra.com.au> Message-ID: On Tue, 8 Feb 2000 00:09:02 +1100, Greg McFarlane wrote: >I am looking for a replacement for the "filter" program that comes >with elm - something that I do not have to compile and something that >is easy to hack on. Does anyone know of a python version? www.procmail.org >(FYI, the elm filter program is executed each time the Unix mail >system attempts to deliver a mail message to your mailbox. You can >configure it to put certain messages into folders, to delete others or >to forward others to someone else. It is very useful for dealing with >mailing lists and other high-volume email sources.) elm filter is buggy and should not be used for security reasons. See bugtraq From gerrit.holl at pobox.com Tue Feb 8 14:15:10 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 8 Feb 2000 20:15:10 +0100 Subject: OT: about the multiple posts In-Reply-To: <389F738E.6C47BD6F@bellsouth.net>; from tgabriel@bellsouth.net on Mon, Feb 07, 2000 at 08:38:23PM -0500 References: <87nklj$ct9$1@nnrp1.deja.com> <389F738E.6C47BD6F@bellsouth.net> Message-ID: <20000208201510.C2074@stopcontact.palga.uucp> Xenophanes wrote on 949952303: > I have been using Netscape since it started and never had any problem Do > you have version 4.7? If not maybe you need to upgrade? Move to another > if you want, but Netscape is the best you will find. I disagree. The original poster uses Linux, and there are a lot of other good mailreaders for Linux. Mutt , Pine . Or newsreaders, Slrn , Tin . Search www.freshmeat.net regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From phd at phd.russ.ru Tue Feb 29 05:57:00 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 29 Feb 2000 10:57:00 +0000 (GMT) Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) In-Reply-To: Message-ID: On Tue, 29 Feb 2000, Fredrik Lundh wrote: > besides, egroups is python powered. Any proof? I'd very interested to see... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From parkw at better.net Tue Feb 1 18:30:53 2000 From: parkw at better.net (William Park) Date: Tue, 1 Feb 2000 18:30:53 -0500 Subject: Charts In-Reply-To: References: <3890C74D.786411BC@acm.org> Message-ID: <20000201183053.B6173@better.net> On Tue, Feb 01, 2000 at 10:26:29PM +0000, Jeff Blaine wrote: > On Thu, 27 Jan 2000 15:31:41 -0700, Thierry Thelliez wrote: > >Is there any packages for creating charts (histograms, scattered plots, > >line charts,...) in Python ? Sorry I missed the original post. For simple character plot on terminal screen, I wrote something simple. But, for anyting that I want to print out, I use PiCTeX. William From gmcm at hypernet.com Sat Feb 26 12:52:47 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 26 Feb 2000 12:52:47 -0500 Subject: functional programming In-Reply-To: <38B7FF8E.BC6F8C09@bellatlantic.net> Message-ID: <1260534928-15224947@hypernet.com> Steve Holden wrote: > Tim Peters wrote: > > > > [functional programming stuff with Moshe Zadka, who signed off with:] > > > > > disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. > > > > it's-only-half-as-scary-if-you-think-we're-the-same-ly y'rs - tim > > Sorry, but I have to disagree: that's at least twice as scary. The > Timbot might well have been programmed in Yorkshire. If I ever > see it write anything beginning with "I remember when I were an Icon > generator ..." that will increase the scariness factor still further. > > "You had tail optimization? You were lucky ..." The Timbot had a tail? Heck, when I was lad we had to make our own spines from discarded exoskeletons ... - Gordon From annis at biostat.wisc.edu Wed Feb 16 15:08:54 2000 From: annis at biostat.wisc.edu (William Annis) Date: 16 Feb 2000 14:08:54 -0600 Subject: Where is the Python Journal? References: <8EDCA9C19PaCmAnRDLM@194.2.0.33> Message-ID: chris patti writes: > poorly understood and badly documented Perl topics) recently wrote > a series of articles on 'memoization' - the use of recursion and > recursive data structures to implement caching algorithms that save > huge gots of time on repeated computations.. > > Python needs something similar. I couldn't resist, largely because I thought it was so cute when I came up with this after a little thought: class memoize: def __init__(self, fn): self.fn = fn self.args = {} def __call__(self, *args): if not self.args.has_key(args): self.args[args] = apply(self.fn, args) return self.args[args] if __name__ == '__main__': import math msin = memoize(math.sin) print msin(0), msin(math.pi/2), msin(math.pi/4) # Continue abusing to your heart's content... But, I agree about the Python journal idea and I'm also in the same boat: getting the Perl Journal despite my apostasy. I suppose we shouldn't whine unless we intend to write articles, too. :) -- William Annis - System Administrator - Biomedical Computing Group annis at biostat.wisc.edu PGP ID:1024/FBF64031 Mi parolas Esperanton - La Internacia Lingvo www.esperanto.org From ullrich at math.okstate.edu Tue Feb 1 11:41:06 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 01 Feb 2000 10:41:06 -0600 Subject: Dynamic class construction? References: <000601bf6c54$c6418aa0$d709143f@tim> Message-ID: <38970CA2.5CC3149B@math.okstate.edu> Tim Peters wrote: > [Adrian Eyre] > >> [...] > >> > >> There's already a module which does this... > >> > >> import new > >> > >> def anOp(self): > >> return 'This is an instance of the class %s' % \ > >> self.__class__.__name__ > >> > >> someOps={'__str__':anOp} > >> G=new.classobj('G', (Group,), someOps) # Group defined elsewhere > > [David C. Ullrich] > > I sorta thought there might be a module that does this, but I > > couldn't find it. > > > > Um, I still can't find it. It appears to be a builtin module - > > new.__doc__ says > > > > ' Functions to create new objects used by the interpreter. > > You need to know a great deal about the interpreter to use this!', > > > > which is helpful, I guess, but I can't find any more about it in > > the docs (or I'm not looking in the right place? It's not in the > > "module index", I don't find any interesting files contaning > > the text "classobj", etc.) > > The "new" module is deliberately undocumented. You mean _was_. It's undocumented in the official 1.5.2 docs, and it's documented in the "revised" 1.5.2 docs. If the docs are going to change more often than the program (which is a good thing) the docs should have separate version numbers. I could download the revised docs, but I don't see the point, since I have no way of knowing tommorow whether they're still current. > As the docstring says, you > need to understand the internals of Python inside out to use it safely; but > if you do know the internals sufficiently well to use "new" at all, you > don't need any docs. The module is not safe for general use (it provides > unchecked access to the internals, and it's very easy to crash the > interpreter by misusing it, and it's impossible not to misuse it if you > don't know the internals ...). > > I'm not sure what the problem here is (haven't followed this thread), but > "new" isn't the answer <0.9 wink>. The problem was that I didn't realize I was using 1.5.2 on n-1 machines and 1.5.1 on one machine (the one that wasn't in use when I made the switch). > If that doesn't dissuade you, study Modules/newmodule.c in the source > distribution. Thanks. I had everything working exactly the way I wanted except that __name__ was readonly - I started the thread just looking for comments on whether I was doing it the "right" way, and whether anyone saw any problems lurking in what I'd been doing. Nobody's pointed out any possible Bad Things with what I'd been doing, so right now everything's absolutely perfect, thanks. Why _did_ the status of __name__ change? When I was told that "new" was introduced in 1.5.2 I conjectured that that was the reason. But that's not so so that can't be it... > the-code-*is*-the-docs-in-this-case-ly y'rs - tim It's code in that funny language where all the statements are inside comments, right? DU From Gareth.McCaughan at pobox.com Fri Feb 25 13:35:00 2000 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: 25 Feb 2000 18:35:00 +0000 Subject: Life's better without builtins? (was: Life's better without braces) References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> <38B691AD.BDB4DD5F@endea.demon.nl> Message-ID: <86g0uh3zcb.fsf@g.local> Niels Diepeveen wrote: > Do you have some source code of this? I can't think of a way to do > reload() or tuple(). What's wrong with this? def tuple(seq): if len(seq)==0: return () else: return (seq[0],) + tuple(seq[1:]) -- Gareth McCaughan Gareth.McCaughan at pobox.com sig under construction From piet at cs.uu.nl Wed Feb 16 04:57:33 2000 From: piet at cs.uu.nl (piet at cs.uu.nl) Date: 16 Feb 2000 10:57:33 +0100 Subject: is this a Python bug? References: Message-ID: >>>>> Moshe Zadka (MZ) writes: MZ> On 15 Feb 2000, Brian Langenberger wrote: >> R is supposed to work to give raw strings with the backslashes stored >> as backslashes. I've never had a problem until I tried making a >> string with nothing but backslashes. MZ> Raw strings cannot end with a backslash. They can. But only with an even number of them. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: Piet.van.Oostrum at gironet.nl From gregm at iname.com Mon Feb 7 08:09:02 2000 From: gregm at iname.com (Greg McFarlane) Date: Tue, 8 Feb 2000 00:09:02 +1100 Subject: mail filter in python? Message-ID: <20000208000902.31713@nms.otc.telstra.com.au> I am looking for a replacement for the "filter" program that comes with elm - something that I do not have to compile and something that is easy to hack on. Does anyone know of a python version? (FYI, the elm filter program is executed each time the Unix mail system attempts to deliver a mail message to your mailbox. You can configure it to put certain messages into folders, to delete others or to forward others to someone else. It is very useful for dealing with mailing lists and other high-volume email sources.) -- Greg McFarlane INMS Telstra Australia gregm at iname.com From aahz at netcom.com Mon Feb 14 00:31:26 2000 From: aahz at netcom.com (Aahz Maruch) Date: 14 Feb 2000 05:31:26 GMT Subject: Threads in Python References: <8881oc$5o9$1@news02.btx.dtag.de> Message-ID: <8883ve$rvs$1@nntp6.atl.mindspring.net> In article <8881oc$5o9$1 at news02.btx.dtag.de>, Tobias Rademacher wrote: > >I just decided to learn Python. Are Threads intregreated in the Language >like in Java? As Fredrik said, yes and no. Threads are incredibly easy to use in Python; the biggest drawback is the Python global interpreter lock, which means that only one thread can run Python code at any time. That's usually not a big drawback, because threading is usually used to optimize I/O, and extension libraries (including I/O) can release the global lock. -- --- 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 Have you coined a word today? From python at columbus.rr.com Sat Feb 12 10:12:15 2000 From: python at columbus.rr.com (Mark Nielsen) Date: Sat, 12 Feb 2000 15:12:15 GMT Subject: PyApache, couldn't geta hold of author, willing to donate sometime References: Message-ID: <38A5321A.593C1A80@columbus.rr.com> > Some primitive and incomplete persistent mechanics already built in > PyApache - look into README. But to make it more like mod_perl PyApache > need to be rewritten more like mod_perl. > I already mentioned httpdapy, check it out, may be you'll find something > there. Thanks! I re-read the README for Pyapache. When I first read this, I wasn't sure that I wanted to use the database connection in the way the README decribes it. The one concern I have is, how do I make sure the database connection will die if the Apache child process dies? It seems to mention that you have to make sure you do clean up. I had another thought, writing an SSI module is (mostly) not a problem, however what would be a simple way to make sure any python script gets filtered through a second python script? This would make it easy to implement an SSI module. I just read httpdapy. It looks pretty cool. It might be what I am looking for. If I study httpdapy, perhaps I will see what I am looking for. I am going to install httpdapy and study it for a while. The README looked very promising. Mark From trentm at ActiveState.com Thu Feb 10 11:17:40 2000 From: trentm at ActiveState.com (Trent Mick) Date: Thu, 10 Feb 2000 16:17:40 -0000 Subject: How to get rid of the space after 'print',? In-Reply-To: <38A34DFE.7B286DD@aston.ac.uk> Message-ID: 'print's behaviour is, I believe, in the spirit of "make the most common task easy". If you want finer control, e.g. not printing the space, then use: import sys sys.stdout.write('my string') # no trailing newline or space Trent > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Peter Bittner > Sent: Thursday, February 10, 2000 11:47 PM > To: python-list at python.org > Subject: How to get rid of the space after 'print',? > Importance: High > > > Hi there! > > I'm writing HTML-code with the print statement as follows: > > print '' > print '
Author:', # ,= no newline here > print '' # or put a function call here... > > Between and I want _no_ space, but Python automatically > inserts one. - How can I force Python not to do this?? > > Please, e-mail! > > Kipis! # I don't know the Nederlands' "cheers", sorry! :o) > Peter > > | Peter H. Bittner > | International Student at Aston University > | e-mail: bittneph at aston.ac.uk > | web: http://beam.to/bimbo > +-------------------------- > -- > http://www.python.org/mailman/listinfo/python-list > From effbot at telia.com Tue Feb 22 16:30:24 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 21:30:24 GMT Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <000401bf7d07$59acc080$e82d153f@tim> <38B2D49C.F18B47CC@roguewave.com> <6SAs4.640$mYj.190014976@newsa.telia.net> <20000222211326.B4549@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > > -- python 1.6 will have *two* different string types. > > > > -- python 1.6 will have lots of sequence types (at > > least one more than 1.5.2!) > > If types will eventually be classes, I think it would not be hard to > add one method to all SequenceTypes. bzzt. how the heck do *you* know if any given class in *my* program is used as a sequence? or did you mean that *I* have to do that? "btw, now that you've installed 1.7, your old sequence classes no longer work. you have to make sure they all inherit from AbstractSequence. if you're using old C types, you're SOL" hello? From effbot at telia.com Thu Feb 24 09:55:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 14:55:35 GMT Subject: Tkinter vs. wxPython (was: Which GUI?) References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> Message-ID: Guido van Rossum wrote: > Note that Fredrik is the author of a large body of Tkinter > documentation (too bad he is such a perfectionist that someone else > beat him to publishing the first Tkinter book :-). His company about > to launch a Tkinter-based product, so his fierce defense of Tkinter > can be explained in various ways. yep, but those you mentioned aren't on that list ;-) for bystanders, the book is John Grayson's "Python and Tkinter programming". For more info, see Alessandro Bottoni's review: http://www.deja.com/=dnc/getdoc.xp?AN=588012707 ...the product is PythonWorks (see www.pythonware.com for more info). it's written in uiToolkit, and the layout editor is designed to work with lots of different toolkits. we expect to support both Tkinter and uiToolkit early on, with support for other toolkits coming at a later time (including HTML, of course) ...and my book? well, we'll see :-) > Limiting the debate for now to Tkinter vs. wxPython, I see arguments > on both sides. virtually all arguments (both pro and con) has already been mentioned in the thread. I won't add more stuff here ("the more you talk, the less they hear" but I will follow up some of your comments over at the eff-bot site. watch the daily Python-URL site for a pointer: http://hem.passagen.se/eff/url.htm to start with, here's a (slightly outdated) discussion of some Tkinter performance issues: http://www.pythonware.com/people/fredrik/fyi/fyi03.htm ... > I've always said, with chairman Mao, "let 1000 flowers bloom" -- there > aren't quire 1000 different GUI toolkits, so there's still room for a > few more. we're working on it ;-) From pinard at iro.umontreal.ca Tue Feb 8 20:59:27 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 08 Feb 2000 20:59:27 -0500 Subject: A = X > Y ? X : Y In-Reply-To: Brad Howes's message of "Wed, 09 Feb 2000 01:23:28 GMT" References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: Brad Howes writes: > Curtis Jensen writes: > Its in the FAQ -- and its not as pretty: > a = ( ( x > y ) and x ) or y > Seems to work fine for numbers -- not sure about objects or strings. If really in the FAQ, it should not be. It surely does not work when x is 0, and y is less than 0. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tony at lsl.co.uk Thu Feb 10 05:40:11 2000 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 10 Feb 2000 10:40:11 -0000 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <20000210130520.39607@connect.com.au> Message-ID: <001601bf73b3$3537e8e0$f0c809c0@lslp7o.lsl.co.uk> Evan Gibson wrote, on 10 February 2000 02:05: > Imagine my surprise when I came across python and it was almost IDENTICAL > to the version of pseudo-code I used to use (Except for putting colons at > the end of "if" statements!). <> > To me whitespace indentation is one of the best features of python. It > makes python almost the same as the make-believe programming language I > actually think in. Which is an excellent summary of why many of us (who normally try *very* hard to be part of a *silent* majority) love Python just the way it is. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.demon.co.uk/ .. "equal" really means "in some sense the same, but maybe not .. the sense you were hoping for", or, more succinctly, "is .. confused with". (Gordon McMillan, Python list, Apr 1998) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From mgushee at havenrock.com Wed Feb 16 18:08:05 2000 From: mgushee at havenrock.com (Matt Gushee) Date: 16 Feb 2000 18:08:05 -0500 Subject: Tcl (Tkinter) problems References: <38AADE9C.AD26CD80@math.utah.edu> Message-ID: Mladen Bestvina writes: > I can't get python to see the file init.tcl. > > Traceback (innermost last): > File "SnapPeaGUI.py", line 1118, in ? > root = Tk() > File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 886, in > __init__ > self.tk = _tkinter.create(screenName, baseName, className) > TclError: Can't find a usable init.tcl in the following directories: > No directories listed? That's odd. > > This probably means that Tcl wasn't installed properly. Possibly, or it might mean that Python doesn't look for the version of Tcl you have. Maybe someone has seen this before. But if not, it would be helpful if you told us: What platform you're running (Linux, I would guess, but what distribution?) Did you install Tcl & Python both from binary packages? If so, were they from the same or different sources? I suspect that with Tcl 8.3, you're going to have to patch something in Python (probably a very simple fix, but I'm not sure) and compile from source anyway. -- Matt Gushee Portland, Maine, USA mgushee at havenrock.com http://www.havenrock.com/ From sholden at bellatlantic.net Fri Feb 25 10:03:50 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 15:03:50 GMT Subject: Bring value from walk() References: <38B663AF.EDF3622E@nembv.cz> Message-ID: <38B699D8.8464105D@bellatlantic.net> Milos Prudek wrote: > > I need a function that walks the dir tree and adds up occupied space. > This is the source. "print Dirn", "print '-',X,Fs" and "print End of > walk..." lines are for debugging only. > Milos: This isn't classed up, but might do what you want. I'm sure it could be optimized: this is NOT production code. regards Steve def usage(path, names, verbose=0): sum = 0 names.sort() dirs = [] files = [] for name in names: n = os.path.join(path,name) if os.path.isdir(n): dirs.append(n) else: files.append(n) for d in dirs: sum = sum + usage(d, os.listdir(d), verbose) for f in files: l = os.path.getsize(f) sum = sum + l if verbose: print "%s %d" % (f, l) print "%s %d" % (path, sum) return(sum) -- "If computing ever stops being fun, I'll stop doing it" From alex at somewhere.round.here Wed Feb 23 14:36:29 2000 From: alex at somewhere.round.here (Alex) Date: 23 Feb 2000 14:36:29 -0500 Subject: Problem with Emacs mode, at start only References: <14508.12680.569760.298585@anthem.cnri.reston.va.us> Message-ID: The following changes to the output filter and py-execute-file pollute the interpreter's namespace slightly, but they put a stop to the premature deletion of the temporary files in which python code is to be executed by putting the responsibility for the deletion on the interpreter itself, after the execfile has been called. ;; Python subprocess utilities and filters (defun py-execute-file (proc filename) "Send to Python interpreter process PROC \"execfile('FILENAME')\". Make that process's buffer visible and force display. Also make comint believe the user typed this string so that `kill-output-from-shell' does The Right Thing." (let ((curbuf (current-buffer)) (procbuf (process-buffer proc)) ; (comint-scroll-to-bottom-on-output t) (msg (format "## working on region in file %s...\n" filename)) (cmd (format (concat "try: \n" " __os_for_emacs_control__ = " "__import__('os') \n" " print \n" " execfile(r'%s')\n" "finally: \n" " __os_for_emacs_control__.remove(r'%s')\n" " del __os_for_emacs_control__\n\n") filename filename))) (unwind-protect (save-excursion (set-buffer procbuf) (goto-char (point-max)) (move-marker (process-mark proc) (point)) (funcall (process-filter proc) proc msg)) (set-buffer curbuf)) (process-send-string proc cmd))) (defun py-comint-output-filter-function (string) "Watch output for Python prompt and exec next file waiting in queue. This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string (when (and (or (string-equal string ">>> ") (and (>= (length string) 5) (string-equal (substring string -5) "\n>>> "))) py-file-queue) ;; (py-safe (delete-file (car py-file-queue))) (if (not (file-exists-p (car py-file-queue))) (progn (setq py-file-queue (cdr py-file-queue)) (if py-file-queue (let ((pyproc (get-buffer-process (current-buffer)))) (py-execute-file pyproc (car py-file-queue)))) )) )) After this, you can make a binding like (define-key py-mode-map "\C-c\C-c" '(lambda () (interactive) (save-window-excursion (py-shell)) (py-execute-buffer))) And it seems to work without the problems that Francois described. For me, it has also been helpful in that it allows me to type in the interpreter buffer while the interpreter is executing a file with less risk of confusing the output filter. Alex. From Gaetan_Corneau at baan.com Wed Feb 23 09:18:32 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Wed, 23 Feb 2000 09:18:32 -0500 Subject: copy directory from a to b, how? Message-ID: <816010E2456BD111A48700805FBBE2EE01C60582@ex-quebec-u1.baan.com> Hello, Take a look at the shutil module. Bye, ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Tu l'as trop ?cras?, C?sar, ce Port Salut" > How do I copy a directory in python? > > I'd like to copy from c:\inetpub\staging to c:\inetpubwwwroot. > > I could do this by using os.system(...), but I'm thinking > there must be > a better way. > > Any information appreciated. > > > Thanks. From effbot at telia.com Fri Feb 4 04:12:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 04 Feb 2000 09:12:01 GMT Subject: mapped files and mmap() wrapper in Python? References: <389A9117.C4CBAD14@arakne.com> Message-ID: Jean Hemmi wrote: > Has somebody been working on a wrapper module around the mmap() set of > functions ? > The purpose would be to provide for providing Python access to mapped > files, > I imagine that the implementation would have the mapped memory areas > appear as Python buffer objects (in read or read/write modes), and that > sub-buffer objects could be extracted... > > I'll be glad to hear from any one having approached the subject... http://starship.python.net/~amk/python/code/mmap.html (unix) http://www.python.org/windows/win32/#mmapfile (windows) (hint: www.python.org => "search" would have helped you find them in a fraction of the time it took you to compose that message...) From tjh8300 at cs.rit.edu Thu Feb 3 15:09:37 2000 From: tjh8300 at cs.rit.edu (Thomas Happ I) Date: Thu, 3 Feb 2000 15:09:37 -0500 Subject: Thanks! (Re: Built-in exception class not found) In-Reply-To: References: Message-ID: Thanks to Fredrik Lundh and Michael Hudson for quickly pointing out the source of the error. It turns out I somehow did not have Python 1.5.2 fully installed and it was using the Python 1.5.1 libraries which had been previously installed. It was an easy fix, and now everything is working again. Thanks again, Tom //------------------------------------------------------- //Thomas Happ //Graduate Assistant, RIT CS Dept. //karidian at core.binghamton.edu //http://www.core.binghamton.edu/~karidian //------------------------------------------------------- On 3 Feb 2000, Michael Hudson wrote: > Thomas Happ I writes: > > > Hello, > > I am attempting to install Python on our systems here at RIT. > > We're running Solaris 7. It seems to work in most respects, but whenever > > any program is run, it displays the following message: > > > > Built-in exception class not found: EnvironmentError. Library mismatch? > > [Warning! Falling back to string-based exceptions > > [Python 1.5.2 (#4, Jan 14 2000, 09:18:57) [GCC 2.95.1 19990816 (release)] > > [on sunos5 > > [Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > > > > I looked through the Setup file in the Modules part of the > > installation and couldn't find any modules related to this. I also > > checked the FAQ and the Bug report but couldn't find any similar problems. > > Has anyone encountered this or a similar problem before? (As I am not a > > python user myself, please respond to me via e-mail -- I don't normally > > read this newsgroup:) > > Thanks, > > Tom > > Hmm. Do you have a python 1.5.1 (or earlier) installation knocking > about somewhere? Looking at cvs diffs, it seems that EnvironmentError > appeared between 1.5.1 and 1.5a2, so if a python 1.5.1 library is > being found before the 1.5.2 one, you'd get this error. I'd suggest > either nuking the 1.5.1 install (if this is an option) or mucking with > $PYTHONPATH. > > HTH, > Michael > > From yueqiang at talc.usc.edu Thu Feb 3 15:28:58 2000 From: yueqiang at talc.usc.edu (Yueqiang Huang) Date: Thu, 3 Feb 2000 12:28:58 -0800 Subject: installation error: version 1.5.2 on Unix In-Reply-To: <3898FE1B.16E6753E@python.net> References: <3898FE1B.16E6753E@python.net> Message-ID: > Yueqiang Huang wrote: > > > > The error message is > > > > gcc python.o \ > > ../libpython1.5.a -lsocket -lnsl -ldl -lm -o python > > Undefined first referenced > > symbol in file > > Py_Main python.o > > ld: fatal: Symbol referencing errors. No output written to python > > *** Error code 1 > > make: Fatal error: Command failed for target `link' > > > > Any idea? Thanks in advance! > > Was this your first try at running make, or had you already > run make once before? If the Python build proceeds far enough, > it will leave some garbage around that will cause subsequent makes > to fail. The solution in that case is to run 'make clobber' before > building. Note that 'make clean' won't solve the problem. If you > also want to reconfigure, you should use 'make distclean'. > > Please tell me if that helps. I wrote a FAQ entry on make clobber > after I wasted nearly a day trying to make Python compile with a > half-built libpython1.5.a lying around that I didn't notice at first. > I had run 'make clean', but that didn't get rid of the faulty library. > > ---Tom Tom, At the first run without 'readline', everything was OK except for one error message: . . touch add2lib if test -f hassignal; \ then echo removing sigcheck.o intrcheck.o; \ ar d ../libpython1.5.a sigcheck.o intrcheck.o 2>/dev/null; \ else echo leaving sigcheck.o intrcheck.o in; fi removing sigcheck.o intrcheck.o *** Error code 2 (ignored) . . However python executable was built and working. Then I wanted to install python-1.5.2 with readline 4.0. I first installed readline, then modified /Modules/Setup.in, using the *.h and libreadline.a from readline 4.0 (readline.c is the one with the python distribution). The compilation of readline.c was OK, but I got the message I mentioned in the previous post. 'make clobber' and 'make distclean; ./configure ...; make' will solve that problem, but introduce another problem associated with readline. Have you installed readline with your python? It seems that a function 'initreadline' which is required by /Modules/config.c is not inside the readline package. Thanks! yueqiang From glen at electricorb.com Fri Feb 4 07:57:34 2000 From: glen at electricorb.com (Glen Starchman) Date: 4 Feb 2000 06:57:34 -0600 Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> <878j9k$vpe$2@thoth.cts.com> <389822FF.DDFF265A@electricorb.com> <3898771C.934A73A1@prescod.net> Message-ID: <389ABEC4.49654423@electricorb.com> The problem is that it lets people program very sloppily and sets a precedent for failure when they undertake a case-sensitive language (most of the common ones). Paul Prescod wrote: > Glen Starchman wrote: > > > > Case sensitivity is a wonderful thing. With a language like VB which is not > > case-sensitive (although the IDE will change all occurences of a variable to the > > first defined case) the developer may refer to objPerson as OBJperson, > > oBJPeRsOn, etc... personally I find this annoying, and a terrible practice to > > get into if the developer then has to write C code! > > If the IDE normalizes case for you, what's the problem? > > One of Visual Basic's great features is that the IDE helps you *a lot* > to get things right. It is perfect for newbies. Python's case > sensitivity would not be a problem if there was an IDE that detected > when you had misused case and corrected it for you (...this probably > requires type annotation....) > > Maybe the CP4E *debugger* should detect case sensitivity problems at > runtime and should just "fix up" the source code. > > -- > Paul Prescod - ISOGEN Consulting Engineer speaking for himself > "Ivory towers are no longer in order. We need ivory > networks. Today, sitting quietly and thinking is the > world?s greatest generator of wealth and prosperity." > - http://www.bespoke.org/viridian/print.asp?t=140 From aahz at netcom.com Sat Feb 19 10:52:27 2000 From: aahz at netcom.com (Aahz Maruch) Date: 19 Feb 2000 15:52:27 GMT Subject: Miscellaneous design and Python use questions References: <1261274784-11280577@hypernet.com> <87bt5fgeiq.fsf@travis.aggievilla.org> Message-ID: <88me7r$aal$1@nntp6.atl.mindspring.net> In article <87bt5fgeiq.fsf at travis.aggievilla.org>, Travis B. Hartwell wrote: >"Gordon McMillan" writes: >> >> You'll probably be happier if you stop thinking in strict OO terms, >> and realize that Python is all about interfaces, and interfaces are >> implicit (no need to inherit from some particular base class). To >> paraphrase Aahz: loosely couple, and componentize the hell out of >> everything. > > What exactly do you mean by interfaces here? I think I understand >what your paraphrasing meant: Don't have your classes / modules / >whatever tied too tightly together (i.e., a good example of information >hiding) and make everything very indepedent. Is that right? That's essentially correct. It may help if I give you an example: A while back, I had to write an application in Perl that took a Unix mailbox and extracted each message in it to do some processing. When I converted to using POP3 instead of a mailbox, I uncovered all sorts of squirrely dependencies despite my careful use of standard libraries and classes. Had I written the application in Python (knowing what I now do about how Python works), it would have been somewhat easier, because I would have written the two halves of the application twice: in addition to the "real" version, I would have written a skeleton version of the mailbox handler and message processer to test the interface to the other half. This makes it much more likely to produce clean code that separates the interface boundary correctly. You actually test this four ways: skeleton/skeleton, skeleton/real, real/skeleton, real/real. To put it another way, this is rather similar to (ugh!) the Microsoft idea of COM objects. This despite the fact that Python does no real information hiding. (Yes, you can do the same thing in Perl, but the style just doesn't seem to lend itself to thinking that way.) -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From fredp at mygale.org.nospam Fri Feb 18 07:53:35 2000 From: fredp at mygale.org.nospam (Fred Pacquier) Date: 18 Feb 2000 12:53:35 GMT Subject: Killer Apps??? References: Message-ID: <8EDE8A92CPaCmAnRDLM@194.2.0.33> insanik at hotmail.com (Nick Henderson) said : >Hello, > >I am new to the world of programming and python. I know Zope is super >cool and is python's "killer app." >I was wondering if there were any other such killer apps? >Thanks, Nick Henderson An impressive one, that first sold me on the power of Python, was the Web groupware app BSCW (bscw.gmd.de). It was definitely way ahead of its time as far back as 1996, and I have yet to see anything approaching its functionality/ease of use ratio in the open source world of today (yes, Zope does more, but Zope is hard :-). Interestingly, BSCW started out as open source before it got trendy, and went against the times by going commercial in 1998... -- YAFAP : http://www.multimania.com/fredp/ From neale-news at lug.freei.net Fri Feb 4 12:51:41 2000 From: neale-news at lug.freei.net (neale-news at lug.freei.net) Date: 04 Feb 2000 09:51:41 -0800 Subject: Bug in ConfigParser.py Message-ID: This was a bug in an earlier version of Python, then it got fixed, and now it's back. (Okay maybe it didn't ever get fixed, I might have just made that part up.) *** /usr/lib/python1.5/ConfigParser.py Mon Sep 13 00:14:19 1999 --- ConfigParser.py Fri Feb 4 09:48:51 2000 *************** *** 212,218 **** depth = 0 while depth < 10: # Loop through this until it's done depth = depth + 1 ! if not string.find(value, "%("): try: value = value % d except KeyError, key: --- 212,218 ---- depth = 0 while depth < 10: # Loop through this until it's done depth = depth + 1 ! if string.find(value, "%(") != -1: try: value = value % d except KeyError, key: From kern at caltech.edu Wed Feb 16 05:39:31 2000 From: kern at caltech.edu (Robert Kern) Date: 16 Feb 2000 10:39:31 GMT Subject: netcdf with python from win32 References: <3.0.6.32.20000216110254.00965510@orion.dgfz.de> Message-ID: <88dup3$2t@gap.cco.caltech.edu> In article <3.0.6.32.20000216110254.00965510 at orion.dgfz.de>, Mike Mueller writes: > I plan to work with netcdf from Python. > > The ScientificPython packages has such an interface. Unfortunately I > couldn't get the netcdf module to compile. All the make files included are > for Unix-like os. My own attempts to compile the module failed due my lack > of experience with C. Furthermore, the compilation of netcdf for win32 > seems to be no trivial task. > > If anybody has successfully compiled netcdf for win32 with Python and > FORTRAN interfaces and is willing to share the outcome of this effort it > would nice if I could have the binaries. I have them here: http://starship.python.net/crew/kernr/binaries/ScientificPython-2.0b1w.zip > I am working with NT4.0 Services Pack 4.0 > > Thanks > > Mike -- 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 daniels at mindspring.com Mon Feb 14 20:24:08 2000 From: daniels at mindspring.com (Alan Daniels) Date: 15 Feb 2000 01:24:08 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: On 14 Feb 2000 17:33:13 +0100, the infinitely wise Martin von Loewis (loewis at informatik.hu-berlin.de) spoke forth to us, saying... >Indeed. I think Tim's right here (as always:); if the request for >garbage collection is rephrased as 'reclaim cycles', everybody will be >happy. Okay, I'm going to go out on a limb here and demonstrate my lack of knowledge on subtle language issues like this one, but here goes: The debate seems to come down between reference counting (which collects items immediately, but can lose objects due to cyclical references) and Java-style garbage collection for lack of a better phrase (which reclaims *all* objects, but does it in its own sweet time). My question is: How hard would it be to keep the reference counting, but add a built-in function, maybe called "gc()", that would walk through all the existing objects, find the ones that have been orphaned due to cyclical references, and reclaim them? Would something like that be enough to make everybody happy? Possibly implemented as a patch so that it was optional? It would still be deterministic (in that __del__ would always get called right away, when appropriate), but would still make sure that no objects were ever left unreclaimed indefinitely. Would that work, or no? -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From aahz at netcom.com Thu Feb 3 09:58:17 2000 From: aahz at netcom.com (Aahz Maruch) Date: 3 Feb 2000 14:58:17 GMT Subject: Newbie: OverflowError: integer addition - Python data types?? References: <879o21$lu2$1@nnrp1.deja.com> <38986D0C.9C19D1F@callware.com> Message-ID: <87c529$8sj$1@nntp1.atl.mindspring.net> In article <38986D0C.9C19D1F at callware.com>, Ivan Van Laningham wrote: > >2) Defining a function Fibonacci() which uses a local variable inside >itself name Fibonacci is terrible practice. It's confusing and obscures >your meaning. When people read the function, every time they see the >name of a function inside the function, they're *first* going to think >"Recursion!" They have to go back and re-read it before they realize >it's only a variable having local scope. Also, in such a short function >there is no need to be so verbose, either; try renaming the Fibonacci >variable to f. I think you'll find it's much clearer. I disagree to a certain extent with your last point; I think naming the variable "fib" is a lot clearer than "f". I have an extremely strong dislike for one- and two-character names unless they're being used strictly as loop variables. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From kdart at pacbell.net Sun Feb 6 23:51:20 2000 From: kdart at pacbell.net (Keith Dart) Date: Sun, 6 Feb 2000 20:51:20 -0800 Subject: Whitespace delimiters suck In-Reply-To: <86a46g$9c3$1@nnrp1.deja.com> References: <000001bf63a1$832e5740$6ea0143f@tim> <868bbv$lug@news.or.intel.com> <86a46g$9c3$1@nnrp1.deja.com> Message-ID: On Fri, 21 Jan 2000, Justus Pendleton wrote: > > > I thought they gotten rid of all such languages until I came across > Python. > > Good programming languages should be whitespace tolerant, and most of > them > > are. > > Haveyouevertriedtore adEng lishthatdoesn 'tuse whitespaceproperly? > > Most human languages aren't really whitespace tolerant (well, at least > the ones I know :-). When I was learning Japanese, one of the hardest > things about reading it was the fact that they don't use whitespace to > delineate words. > > How come now one is out there advocating that we "fix" English by > removing the mandated whitespace? :') In ancient times (using cuniform, etc.) texts were written without spaces, or even vowels. consonants were just strung together. I guess this was done to save space, since these forms of writing were very expensive (in time and materials). /___\\|//__//// \ (+ +) \\\\ -- --------------------oOOo~(_)~oOOo---------------------------------------- Keith Dart ============================================================================ From effbot at telia.com Thu Feb 24 15:56:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 20:56:33 GMT Subject: diff? References: Message-ID: <5Wgt4.862$mYj.189901824@newsa.telia.net> Michal Wallace (sabren) wrote: > I'd like to be able to run something like "diff" as a function in > python, but that would be able to compare arbitrary strings/sequences > instead of just files... I looked on parnassus, python.org, but didn't > see anything.. Tools/scripts/ndiff.py (in the 1.5.2 source distribution) From tseaver at starbase.neosoft.com Mon Feb 21 15:48:27 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 21 Feb 2000 14:48:27 -0600 Subject: Reading Netscape Mail Folders References: <38B19FF9.83B98466@bellatlantic.net> Message-ID: <24B466DC54C4F03F.2859430E081F2ED8.931793678FF616B7@lp.airnews.net> In article <38B19FF9.83B98466 at bellatlantic.net>, Steve Holden wrote: >One of the problems with using Netscape is the inability to save >message *including attachments* in RFC822 format. It saves the base >message, but precious little else, dumping headers and the like >with gay abandon. > >I realise I could go to the Open Source repository to learn how to decode >the file format and do the job in C (blerch!). But I wondered if anyone >had already done a similar thing in Python? Seems like many things one >might require turn out to be already available, or almost, so I thought >this was worth a try. > >regards > Steve >-- >"If computing ever stops being fun, I'll stop doing it" The standard mailbox module opens NS Messenger's mail folder files fine. I don't know about attachments, though. Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From donn at u.washington.edu Tue Feb 8 15:58:14 2000 From: donn at u.washington.edu (Donn Cave) Date: 8 Feb 2000 20:58:14 GMT Subject: mail filter in python? References: <38A06C98.9B2ECA2A@sage.att.com> <20000208000902.31713@nms.otc.telstra.com.au> <20000207154641.A2817@stopcontact.palga.uucp> Message-ID: <87q016$rro$1@nntp6.u.washington.edu> Quoth "Garrett G. Hodgson" : ... | that's two people who've pointed out the difficulty in getting it right. | perhaps a better approach is to build yourself a python syntax to | generate the crufty procmail syntax. If I'm not already counted among those two, make that three! But I don't know that it's not worth bothering with, it depends on one's ambitions. A recreational code abuser might have a little fun with this and harm no one. A very ambitious programmer might very well be able to contribute something that's substantially better than procmail - there's plenty room for improvement and no chance at all that procmail itself will improve. I personally wouldn't try to ``front end'' .procmailrc, unless maybe the object were a very constrained front end that simplified the issues for the kind of interface you'd get on a web form. Otherwise, you have to learn more .procmailrc syntax to do it, than you'd have to learn just to use .procmailrc directly! But I'm assuming the author would be the only user, perhaps that's not true. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From moshez at math.huji.ac.il Sat Feb 19 06:30:48 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 13:30:48 +0200 (IST) Subject: None & Ellipsis In-Reply-To: <20000219101220.A2136@stopcontact.palga.uucp> Message-ID: On Sat, 19 Feb 2000, Gerrit Holl wrote: > > > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > > > >>> t1, t2, None, t4, t5, None, None, t8, None = t > > > >>> None > > > 'i' > > > > >>> del None > > >>> None > > >>> > > Ah...! Is this behaviour documented! Yes. It's called the "Python 3 namespace rule". -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From Patrick.Boulay at fr.nestle.com Fri Feb 25 08:23:45 2000 From: Patrick.Boulay at fr.nestle.com (Boulay,Patrick,PARIS) Date: Fri, 25 Feb 2000 14:23:45 +0100 Subject: Tkinter vs. wxPython (was: Which GUI?) Message-ID: <8F39A83598A3D111B27D00805F8BA3CA01155E1A@frnsl035.nestle.fr> I do use wxWindows on HPUX 10.20 and I wish to use wxPython too .... Has anyone ever tried to set up wxPython on such a paltform ??? I intend to use wxWindows/wxPython/DCOracle on NT/Unix/Linux platforms .... Patrick > ----Message d'origine----- > De: Randall Hopper [SMTP:aa8vb at yahoo.com] > Date: vendredi 25 f?vrier 2000 13:49 > ?: python-list at python.org > Objet: Re: Tkinter vs. wxPython (was: Which GUI?) > > Guido van Rossum: > |Arguments for wxPython: > |Arguments against it (from very limited exposure): > > Ditto most of these comments, for and against. > > Add to "against it": > > - Building wxWindows and wxPython on non-Linux systems is a real > challenge. Building Tcl/Tk/Tkinter is a snap in comparison. > > -- > Randall Hopper > aa8vb at yahoo.com > > -- > http://www.python.org/mailman/listinfo/python-list From PClaerhout at CREO.BE Fri Feb 11 05:53:02 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Fri, 11 Feb 2000 11:53:02 +0100 Subject: Hotfolder class Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70F8@MSGEURO1> Does anyone has a class which can be used for a hot folder mechanism? (You know, when you drop a file in a folder, that you can pick it up and do something with it) Thanks,

From claird at starbase.neosoft.com Sat Feb 12 18:04:35 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 12 Feb 2000 17:04:35 -0600 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38A5DEB7.E1B018AC@rubic.com> Message-ID: <757FC1A58B25E650.9EADB7C5E716E186.22A0DB7A6AC20E17@lp.airnews.net> In article <38A5DEB7.E1B018AC at rubic.com>, Jeff Bauer wrote: . . . >-and-if-paul-prescod's-string.rstrip()-2nd-argument- >ever-pans-out-you'll-have-an-easy-way-to-remove-the- >semicolon-training-wheels-off-your-early-python-code-ly yr's, . . . In the interest of there's-more-than-one-way-..., I suggest an alternative: simply join Paul's fantasy realm where Python already works that way. Then the imaginary self (this->self?) can automate its train- ing wheels operation. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From senn at maya.com Wed Feb 9 10:16:45 2000 From: senn at maya.com (Jeff Senn) Date: 09 Feb 2000 10:16:45 -0500 Subject: small python implementation or python subset ? In-Reply-To: Marc BRETTE's message of "Wed, 09 Feb 2000 11:05:58 +0100" References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> Message-ID: Marc BRETTE writes: > I am looking for a very lightweight implementation of python or for a > python subset definition. ... > almost all its modules. An older version (1.2) seems lighter (300 k), > but I don't want a dead distribution. > Does any one around knows about a lightweigth python or a way to strip > the regular python distribution ? This may not be exactly what you hoped for -- but look here: http://www.abo.fi/~iporres/python/ It is a somewhat difficult job to trim python down quite that small and still have much left... In the context of some research we are doing, we are exploring some ways to use Python in a trim embedded environment. Anyone else doing this sort of thing? -- -Jas --------------------------------------------------------- / / |-/ \ / /| Jeff Senn 412-488-2900 MAYA Design Group /|/| |/ o | /-| Chief Technologist 412-488-2940 fax 2100 Wharton Street Taming Complexity Head of R&D senn at maya.com Pittsburgh, PA 15203 www.maya.com From wtanksle at hawking.armored.net Tue Feb 15 15:00:00 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 15 Feb 2000 20:00:00 GMT Subject: Python sucks loud References: Message-ID: On Mon, 14 Feb 2000 18:38:07 GMT, HelloAgain wrote: >Michael Hudson wrote: >> grant at nowhere. (Grant Edwards) writes: >> > Forget it wrote: >> > >You people are funny here, all excited about Python. >> > >Following one guy's recommendation, for two days already I'm looking at >> > >Python as a potential plug-in language, and it DISGUSTS me. >> > [...] >> > That's one of the lamest, most transparent flame-bait postings >> > I've seen in a long time. >I'm curious (although not excessively so) why do you people all think >that was a flame bait? Why couldn't it simply be a harmless opinion, >along with a few questions (to which I got a pretty good response, >thanks again to everyone who have contributed)? Eh? You honestly don't think that it was a flame-bait? That's almost funny. >Isn't that a bit creepy that so many people want to isolate themselves >from anything, about which they're not sure ahead of time that it'll >agree with their preferences? Here: it's been *four* days now that I'm >looking at it, and still I think Python is an ugly language. Yes, I agree this it's a strange fact about people. Probably not about the people you were expecting, though -- you left yourself wide open for that one. :-) >That's trolling by your book? Nope. >Well, you better put it in the FAQ that you don't >want anyone disrupt your Pythonic mutual-masturbation idyll here. Now _that_'s trolling. >profession attracts more than its share of narrow-minded, low-brow, >humourless yet exceedingly self-confident cretins. (Or is it only the >case with Python "specialists", hmmmmm ?) Pretty much so. Tim keeps on killing people who disagree with him. Please save us from him by posting more messages in which mindless abuse is mistaken for humor! -- -William "Billy" Tanksley, in hoc signo hack From gerrit.holl at pobox.com Mon Feb 7 09:50:05 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 7 Feb 2000 15:50:05 +0100 Subject: Files and Directories In-Reply-To: <389E4A53.6F383092@webamused.com>; from amused@webamused.com on Mon, Feb 07, 2000 at 04:40:17AM +0000 References: <2Lqn4.5185$NS3.16759@newsfeed.slurp.net> <389E4A53.6F383092@webamused.com> Message-ID: <20000207155005.B2817@stopcontact.palga.uucp> Joshua Macy wrote on 949894817: > Patrick K Moorman wrote: > > > > Thanks to everyone who answered my last question, it is good reminder that > > computers do *ONLY* what they are told. I am trying to write a little > > script that will rename files in multiple directories. What am a looking > > for is a way to take each item returned by os.listdir() and test to see if > > it is a file or a directory. I have gone through the lib reference but I > > did not see anything that would work. I know very little about programing > > or Pyhton (if you haven't guess yet) and I am learning by doing. Or not > > doing as the case is right now :) > > > os.isdir(path) will return true for a directory, and os.isfile(path) > will return true for a regular file. os.path.isdir and os.path.isfile ~~~~ ~~~~ regards, Gerrit. -- homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From jeremiah at widomaker.com Mon Feb 7 18:57:34 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 23:57:34 GMT Subject: about the duplication of messages.. Message-ID: <389F4A27.5914A46A@widomaker.com> I'm very sorry that i posted multiple messages. My news program(netscape) didn't confirm that the message had been sent when i sent it, and it also didn't load up the messages when i clicked to get new messages in the newsgroup window. I promise that I'll never let this happen again. --jeremiah From danielt3 at gte.net Sun Feb 13 11:45:57 2000 From: danielt3 at gte.net (Daniel T.) Date: Sun, 13 Feb 2000 16:45:57 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: In article <38a5d928 at news.isc.rit.edu>, osorronophris osorronophris wrote: >I'm a die-hard C++ programmer that recently took up Python for a change of >scenery and am enjoying it greatly. The one problem I am having is that I >can't break myself of the semicolon habit. I've tried chewing gum but it >just doesn't seem to work, and I'd like to avoid the patch. Any ideas? I have my python editor print code in a different font. That way it looks different enough that I'm not trying to use c++ idioms. -- When a thing ceases to be a subject of controversy, it ceases to be a subject of interest. -- William Hazlitt From tomh at po.crl.go.jp Mon Feb 28 05:37:30 2000 From: tomh at po.crl.go.jp (Tom Holroyd) Date: Mon, 28 Feb 2000 19:37:30 +0900 Subject: Traling junk in string.atof (RE: array constructor) In-Reply-To: <000f01bf8197$0c473020$f0a2143f@tim> References: <000f01bf8197$0c473020$f0a2143f@tim> Message-ID: On Sun, 27 Feb 2000, Tim Peters wrote: > I'm curious how you ended up with a numeric string with a trailing comma to > begin with. For example, if you're reading lines of comma-separated values, > the natural idiom is > > numbers = map(float, string.split(line, ",")) Eh, parsing a random file that was meant more for humans; I had already done a split on some other separator and was loathe to perform two (or is that "slothe"? :-) I just thought it would make sense for a function _called_ atof() to _behave_like_ the POSIX function atof(), which converts the initial portion of a string only -- a behavior which most programmers that use atof() are well aware of (and even (gosh) use). Dr. Tom From claird at starbase.neosoft.com Sun Feb 13 17:23:41 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 13 Feb 2000 16:23:41 -0600 Subject: python for use in web development.. References: <38A6BCE3.EB4BE313@earthlink.net> Message-ID: In article <38A6BCE3.EB4BE313 at earthlink.net>, Francisco Hernandez wrote: >is there any python frameworks for cgi programming using Apache? . . . Several: . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From moshez at math.huji.ac.il Fri Feb 11 16:11:03 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 23:11:03 +0200 (IST) Subject: range(start,stop) In-Reply-To: <38A478A4.532D73F5@mail.dotcom.fr> Message-ID: On Fri, 11 Feb 2000, Stephane BAUSSON wrote: > Hello > > Just a question for a Python expert ... > What the interest for the range function to stop at stop-1 and not at > stop ? > For me it does not feel natural to write .... Well, in the absence of step argument, the invariant: in range(start, stop) there are stop-start elements is very important. E.g., range(0, n) is a list with n elements, so for i in range(0, n): # equivalent to range(n) print "hello" will print "hello" exactly n times. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From moshez at math.huji.ac.il Mon Feb 28 00:33:31 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 28 Feb 2000 07:33:31 +0200 (IST) Subject: name of object inside it's methods? In-Reply-To: Message-ID: On Mon, 28 Feb 2000, Jason Stokes wrote: > > >In other words I want the method to print the name of the object that it > >belongs to > > > Objects do not have names. Objects can be referred to by names, but this is > not the same thing; any object can be referred to by multiple names. Or none at all: reader = lambda f=open("file"): f.readline() The file isn't referred to with any name you can get your hands on easily. (Yes, you could start taking reader apart, but it's at best shaky) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gmcm at hypernet.com Thu Feb 10 09:45:58 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 10 Feb 2000 09:45:58 -0500 Subject: SmallTalk / Lisp [was Re: Whitespace as syntax ...] In-Reply-To: <1e5rg41.fyvsfg8oy85cN%bparsia@email.unc.edu> Message-ID: <1261928538-18521086@hypernet.com> Bijan, Paul - Come on guys, this is actually a pretty common pattern: Some pioneering sould come up with a way of doing something that is enormously advanced over the current state. Most people can't wrap their brains around it - it's "weird". Time passes, and concepts stolen from the pioneering solution get introduced in baby steps. By the time the consensus state has reached the point that most people *could* wrap their brains around the pioneering solution, it is considered *old* and *out of date*, (the first being true, the second may well be false). It is very, very rare for a pioneering solution to ever make it in the real world. Heck, the notion that Columbus "discovered" America is wrong at least 3 times. Viking-longboat-found-in-Sea-of-Galilea-ly y'rs - Gordon From infonuovo at email.com Thu Feb 10 02:22:51 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Wed, 9 Feb 2000 23:22:51 -0800 Subject: Const and the Zen of the Pythonista In-Reply-To: Message-ID: > Am I finally getting it or have I merely become a language-lawyer overnight? Yes. Or maybe not. (I couldn't help it.) Nice analysis. It doesn't work for me though. When I write a const, for me I am *telling* **you** that I will never change the value associated with that symbol, and you can count on it. It gives you something that is difficult to determine by analysis. It gives it to the future **me** when I review my own code too. Having the language processor hold me to my promise helps me not lie to myself and that is ***really*** valuable to me. (I also hide things in plain site, regularly, sometimes daily, and not just my eyeglasses.) If we had a language that was value oriented (whether or not strongly-typed), then I could say things like let a = ..., b = ..., c = ... in f(a,b,c) and all would be well, even with a pretty elaborate f-thingy, even with assignment (so long as let-clause and where-clause stuff makes equivalents of const's). In a statement language with Python's rules, const is the closest thing I have to being able to provide that clear fixed-definition-in-scope-by-value-right-here sort of thing. -- orcmid PS: I would really love this. I don't know that it is in the spirit of Python with regard to side effect tolerance, though. I would in particular like the option to arrange that it is *not* OK for someone to stick a new member into an object of mine that has nothing to do with the invariants I provided when I defined the object. Fortunately, I can simply refrain from that behavior, but I don't like the idea of any object being a potential baggage carrier for what might be some pretty weird stuff and that, apparently, one can hack into the (Python) implementation of any object one can access. -- dh. From dworkin at ccs.neu.edu Thu Feb 10 12:20:45 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 12:20:45 -0500 Subject: Split string In-Reply-To: "Pedro Silva"'s message of "Thu, 10 Feb 2000 17:01:09 -0000" References: <001d01bf73e8$6db5c860$6c00a8c0@ruidovisual.pt> Message-ID: "Pedro Silva" writes: > listing=os.listdir("/var/spool/news/articles") > str=string.split(listing) os.listdir returns a list, not a string. You already have what you want without that second (erroneous) line. -Justin From ke at gnu.franken.de Thu Feb 10 23:10:08 2000 From: ke at gnu.franken.de (Karl EICHWALDER) Date: 11 Feb 2000 05:10:08 +0100 Subject: small python implementation or python subset ? References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> <38A282D0.2487CA89@sxb.bsf.alcatel.fr> Message-ID: newsbunny at noether.freeserve.co.uk (Martin P Holland) writes: | I think that is a question for whoever created your python rpm. | Here on RH6 it is stripped. Some binaries or libraries on SuSE Linux are unstripped intentionally, e.g., the X server binaries. Others might be unstripped by accident; I'll ask what's up the the python binary. Of course, if the user is short on disk space, he should feel free to try to strip some of these files. -- 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 neelk at brick.cswv.com Fri Feb 18 18:51:07 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 18 Feb 2000 23:51:07 GMT Subject: Miscellaneous design and Python use questions References: <87itzn19mz.fsf@travis.aggievilla.org> Message-ID: Travis B. Hartwell wrote: > > 1) When I do a typical OO-design with C++, I pay a lot of attention > to information hiding. I.E., I keep all of the data members private > and rely on get/set functions to use them. I feel that this is a good > practice. But, with Python, we don't have the access issue. I still > believe that information hiding is a good idea. From the experienced > Python developers, is it practice to use such functions within your > classes? Or do you just access things directly? What are your > thoughts on style regarding this? Write it 3 times, and the right choice will be obvious the third time through. The first version, you'll write garbage but learn the contours of the problem domain; the second time you'll get a workable but ugly solution; and the third time through you will build something that *other people* will be happy reading and extending. Remember, if your interface is good then people won't try to break it. Consider: How often do C programmers break the FILE abstraction to look at the implementation details? Not very often at all -- and C programmers are notorious for breaking abstraction to do low-level grovelling for even marginal speedups. Neel From aa8vb at yahoo.com Tue Feb 15 08:52:50 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Tue, 15 Feb 2000 08:52:50 -0500 Subject: Modules implicitly exposing exceptions from other modules In-Reply-To: <14504.21592.958597.17477@weyr.cnri.reston.va.us> References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> Message-ID: <20000215085250.A2423951@vislab.epa.gov> Fred L. Drake, Jr.: |Jason Stokes writes: | > I notice that the nntplib.NNTP class can throw exceptions from the | > underlying socket module without documenting them. What's good practice | > when your module involves exposing exceptions from an implementation module | > that client code might not necessarily be aware of? | | Document them if they would not be expected by an experienced |programmer. In general, all network access can throw socket.error, |and that seems a reasonable expectation. I'd be stronger with this. That is, replace "experienced programmer" with "any programmer". A user calling Module A shouldn't have to know what other modules Module A uses to catch and handle any error exception that might be thrown. My perspective: There are program bug exceptions and error condition exceptions. Considering the latter: All error exceptions potentially thrown in a method should be documented for that method. Module-specific error exceptions should be transformed as they propogate up. The latter is so if you call Module B which calls Module A, you're only expected to catch generic exceptions or Module B exceptions to handle any error exceptions that may arise). For example, I don't think tossing broken socket Socket exceptions across the NNTP boundary is a good idea. How does the NNTP client catch these (or know to catch these)? A wildcard except clause, which catches bugs and errors. -- Randall Hopper aa8vb at yahoo.com From mikael at isy.liu.se Mon Feb 14 08:07:43 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 14:07:43 +0100 (MET) Subject: Where to place job offers? In-Reply-To: <000201bf76dc$61f0ffd0$2001a8c0@ntws132.office01.de> Message-ID: On 14-Feb-00 Matthias Menne wrote: > Can anybody make suggestions, where to place job offers for > Python/Zope application developers in Germany? There is a job offer list somewhere at www.python.org. I guess it's open for job offers all over the world. /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-Feb-00 Time: 14:06:01 This message was sent by XF-Mail. ----------------------------------------------------------------------- From wtanksle at hawking.armored.net Sat Feb 26 18:38:03 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 26 Feb 2000 23:38:03 GMT Subject: Which GUI? References: Message-ID: On Wed, 23 Feb 2000 18:13:54 +0100 (MET), Vetle Roeim wrote: >on 2000-02-23, Gerrit Holl wrote: >> > wxPython and pyQt are not as portable as Tkinter. >> Please give an example! >well.. I'm only repeating what I've read previously in this thread. >I believe Qt is not available for Windows without paying money, and I'm >not sure what platforms Qt and wxWindows (or whatever it's called) is >available on. I'm not sure that "portable" should be equated to "has been ported". wxWindows is practically a baby, but it's already been ported to a huge number of platforms. Check out the list at its website. >gooey-schmooey-let's-all-use-curses-ly y'rs, vr Oh, one of the wxWindows supported platforms is -- are you ready for this -- Curses. I think that should end the entire debate right there. -- -William "Billy" Tanksley, in hoc signo hack From alex at somewhere.round.here Thu Feb 10 11:40:30 2000 From: alex at somewhere.round.here (Alex) Date: 10 Feb 2000 11:40:30 -0500 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: > Thanks! No worries, although I realized later that they will break if the file has a line longer than sizehint (never happened to me, yet, I hope) and that all the methods can simply be placed in the one class. I guess publishing stuff forces you to think things through more clearly. Alex. From roth at teleport.com Tue Feb 29 10:04:57 2000 From: roth at teleport.com (tony roth) Date: Tue, 29 Feb 2000 07:04:57 -0800 Subject: does pythonwin support adsi` References: <38BB2467.34A55FA1@earthlink.net> Message-ID: hey thanks for the info and sorry about the bad grammer! "greg Landrum" wrote in message news:38BB2467.34A55FA1 at earthlink.net... > test wrote: > > > > and were to I get examples? > > thanks > > tr > > From the pythonwin help (win32com help, search for ADSI): > > Python's adsi access works really well with Exchange (late or early binding since you can read microsoft's type library). > > -greg > > -- > > greg Landrum (greglandrum at earthlink.net) > Software Carpenter/Computational Chemist From daryl_stultz at my-deja.com Wed Feb 9 10:23:10 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Wed, 09 Feb 2000 15:23:10 GMT Subject: win32security, client privleges References: <87pu3o$23i$1@nnrp1.deja.com> Message-ID: <87s0or$fpr$1@nnrp1.deja.com> In article , "Mark Hammond" wrote: > Note that privileges are different than permissions. So, you can use > the function below to enable the privilege for your session - just > pass ntsecuritycon.SE_SECURITY_NAME to this function... Yes, GetFileSecurity() now returns sucessfully. However, I have no idea how to deal with the result. > If you look up the MS docs for GetFileSecurity() you will notice the > following: So that I may not annoy you with further questions, perhaps you can point me to these MS docs. Thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From robin at alldunn.com Thu Feb 24 18:40:38 2000 From: robin at alldunn.com (Robin Dunn) Date: Thu, 24 Feb 2000 15:40:38 -0800 Subject: Tkinter vs. wxPython (was: Which GUI?) References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> Message-ID: Now that Guido has some sanity back into this conversation I finally feel free to join in... "Guido van Rossum" wrote in message news:5l3dqjckt5.fsf_-_ at eric.cnri.reston.va.us... [...] > Limiting the debate for now to Tkinter vs. wxPython, I see arguments > on both sides. > > Arguments for Tkinter: [...] > - It has a superior canvas widget, which supports an object-oriented > drawing model directly; it even draws splines! wxPython can do splines too, in any class derived from wxDC. Though of course this means that you have to draw it yourself in a paint event handler, instead of fire-and-forget like Tkinter's canvas. However that will probably be changing in the future. (Yes, I am dropping a hint...) [...] > > Arguments against [wxPython] (from very limited exposure): > > - Because it's implemented using SWIG, it is potentially less robust > in the face of buggy user code; it's possible to do things that simply > hang or crash the program rather than causing a traceback. This is > very rare in Tkinter. Yep. I'm looking into a couple ideas that should help in this area... > > - Much more simple-minded text widget (but Scintilla is coming?). Yes. It's nearly done. If I don't have too many distractions then I hope to release it in 2-3 weeks time. [...] > - Are there any books out yet? Not yet, but this is something else I hope to change in the not so distant future. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From neelk at brick.cswv.com Sun Feb 13 16:53:35 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 13 Feb 2000 21:53:35 GMT Subject: Real Problems with Python References: <000e01bf7668$850d9740$572d153f@tim> Message-ID: Alex wrote: > > > > Couldn't we approximate lexical scoping with classes? > > Could someone give me an example of how to do this? Probably I am > simply confused about the terminology, but don't you run into the same > sorts of namespace problems with nesting classes as you do with nesting > functions? Certainly; here's a teeny closure in Scheme: (define make-adder (lambda (n) (lambda (x) (+ n x)))) (define add-three (make-adder 3)) (add-three 6) -> 9 (add-three 9) -> 12 And here's the Python equivalent, using classes: >>> class Adder: ... def __init__(self, n): ... self.n = n ... def __call__(self, x): ... return self.n + x ... >>> add_three = Adder(3) >>> add_three(6) 9 >>> add_three(9) 12 Basically, you use the __call__ method to let instances use the function call syntax. Neel From greglandrum at earthlink.net Mon Feb 28 20:41:31 2000 From: greglandrum at earthlink.net (greg Landrum) Date: Tue, 29 Feb 2000 01:41:31 GMT Subject: does pythonwin support adsi` References: Message-ID: <38BB2467.34A55FA1@earthlink.net> test wrote: > > and were to I get examples? > thanks > tr >From the pythonwin help (win32com help, search for ADSI): > Python's adsi access works really well with Exchange (late or early binding since you can read microsoft's type library). -greg -- greg Landrum (greglandrum at earthlink.net) Software Carpenter/Computational Chemist From tim_one at email.msn.com Wed Feb 9 23:53:24 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 9 Feb 2000 23:53:24 -0500 Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] In-Reply-To: <1e5r2o4.14puk8l1i1mb9N%bparsia@email.unc.edu> Message-ID: <000601bf7382$c3009040$8e2d153f@tim> [posted & mailed] [Bijan Parsia, defends Smalltalk against all comers, notably Paul] > ... > Methinks that there are many arrogances to be found in many places. > ... > I'm done. Bijan, you've been patient, good-natured and consistently informative. I have no idea why some of c.l.py's normally curious & friendly residents have gotten bugs up their butts about Smalltalk, but after this verbal rebuke from one of c.l.py's normally hostile residents , I hope they'll settle down and welcome you here as you not only deserve, but have more than *earned* in this thread. Your posts were a pleasure! Come back anytime. and-get-those-ugly-colons-out-of-smalltalk-ly y'rs - tim From btang at pacific.jpl.nasa.gov Fri Feb 18 15:57:47 2000 From: btang at pacific.jpl.nasa.gov (Benyang Tang) Date: Fri, 18 Feb 2000 12:57:47 -0800 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> Message-ID: <38ADB24B.184E5656@pacific.jpl.nasa.gov> "Florent Rami?re" wrote: > > Hello, > > here is something i do not understand ... > > Let's say i want to write two strings which must display "HELLO" > 2 solutions to this problem: > print "HEL" + "LO" > > or > print "HEL", > print "LO", > > But this last solutions does not work !! Python inserts a white space > !? > > I wanted "HELLO", python give me "HEL LO" !!!! > > I certainly have missed something, could you help me on this ? > > Thanks for reading this . > Florent. This will do: sys.stdout.write('HEL') sys.stdout.write('LO') From J.C.Travers at durham.ac.uk Fri Feb 18 08:47:57 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Fri, 18 Feb 2000 13:47:57 +0000 Subject: Which GUI? References: <88jg9f$ssd$1@nnrp1.deja.com> Message-ID: <38AD4D8D.49726043@durham.ac.uk> ndev42 at yahoo.com wrote: > - Does not need ANY extra library to compile, i.e. knows > how to talk to the underlying windowing library underneath, > whether it is X11, Motif, Windows or Mac. > - Clean design, if possible OO. > - Offers the standard widget toolkit plus some fancy stuff > like grids or plots. > ... > > Basically, this is (almost) Tcl/Tk. Sorry, I don't think I understand. Having to install Tk/Tcl before you can use Tkinter doesn't constitute having an extra library to install?? Hmmm. Installing Tk for me is no different (if not slightly more complicated) than installing the fundamental wx or Qt stuff. And I can't see how Tk/Tcl has a clear design. It seems to be a load of wrappers built on top of each other. And as for fancy stuff in Tkinter... that rerquires a whole new module (PMW) to be installed. Not wanting to take this too far, but it seems as if there are a few misconceptions hanging around here. Cheers, John From dworkin at ccs.neu.edu Mon Feb 14 12:37:50 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 14 Feb 2000 12:37:50 -0500 Subject: how to talk to __main__? In-Reply-To: "Michal Wallace"'s message of "Mon, 14 Feb 2000 12:02:30 -0500" References: <889cg2$83e$1@nntp9.atl.mindspring.net> Message-ID: "Michal Wallace" writes: > allDone = 0 > > def callback(): > allDone = 1 # allDone is local, so this won't work > #__main__.allDone = 1 # gives an error > > # assign callback() to external event here... > > while not allDone: > pass > > print "All done!" As the eff-bot said, you could solve this by importing __main__, but it's worth noticing that you don't have to resort to such namespace trickery. Just put the statement 'global allDone' at the front of your function definition, and that name will refer to the corresponding global variable. -Justin From sk at nvg.unit.no Sat Feb 19 19:56:14 2000 From: sk at nvg.unit.no (Steinar Knutsen) Date: 20 Feb 2000 00:56:14 GMT Subject: Silly brackets (Was: Re: Problems extending Python with C.) References: Message-ID: <88ne3e$hcs$1@snipp.uninett.no> The problem described below was caused by my misplacing a bracket in the C-part of the code. As my Python-trained brain only looked at the indentation, the error was easily missed. Remind me to flame the next guy who claims indentation is brittle and brackets are robust. :) In article , Steinar Knutsen wrote: >I do not understand why I only can use the function ncmp as defined below >properly in the sort method of a list when I put a Python function as a >wrapper around it. > >Or in other words: >import numcompare >b = somefunctiongeneratingalistofstrings() >b.sort(numcompare.ncmp) ># b does not get sorted > >Whereas >import numcompare >b = somefunctiongeneratingalistofstrings() >def NCMP(x,y): > return numcompare.ncmp(x,y) >b.sort(NCMP) ># b is sorted correctly For a rather... liberal definition of correctness... >C-source for module: >------------------------------------------------------------------------ >#include >#include "/usr/local/include/python1.5/Python.h" > >static PyObject * ncmp(PyObject *self, PyObject *args) >{ > const char* x; > const char* y; > long cc; > > if (!PyArg_ParseTuple(args, "ss", &x, &y)) { > return NULL; > } > else { > cc = numcompare(x, y); > if (cc > 0) { > return Py_BuildValue("i", 1); > } > else if ( cc == 0 ) { > return Py_BuildValue("i", 0); > } > else { > return Py_BuildValue("i", -1); > } > } >} > >int numcompare(char* x, char* y) >{ > int i0 = -1, i1 = -1; > char* endx; > char* endy; > int lenx, leny; > long X, Y; > > lenx = strlen(x)-1; > leny = strlen(y)-1; > while ( i0 < lenx && i1 < leny ) { > i0++; > i1++; > if ( ( x[i0] >= '0' && x[i0] <= '9' ) && > ( y[i1] >= '0' && y[i1] <= '9' ) ) { > X = strtol(x+i0, &endx, 10); > Y = strtol(y+i1, &endy, 10); > } > if ( X != Y ) { > return X-Y; > } > else { > /* -1 on cause of increment in start of while-loop */ > i0 = (int)(endx - x) - 1; > i1 = (int)(endy - y) - 1; > continue; > } And here a } is missing... > if ( x[i0] != y[i1] ) { > return x[i0]-y[i1]; > } > } > return strcmp(x, y); >} > >static struct PyMethodDef functions[] = { > { "ncmp", ncmp, 1}, > { NULL, NULL} >}; > >void initnumcompare() >{ > (void)Py_InitModule("numcompare", functions); >} >----------------------------------------------------------------------- > >I guess I'm missing something very obvious here, but I just don't get >what. The Python is 1.5.2, the compiler is GCC 2.7.2.2, the OS is NetBSD >1.3.3. (Yeah, I know I should upgrade, but the system works. :) ) > >Thanks for any and all help. -- Steinar From bayinnaung at my-deja.com Mon Feb 14 04:13:03 2000 From: bayinnaung at my-deja.com (bayinnaung at my-deja.com) Date: Mon, 14 Feb 2000 09:13:03 GMT Subject: CGI/HTML forms in a standalone application. Message-ID: <888gut$67u$1@nnrp1.deja.com> CGI/HTML forms in a standalone application. Maybe this is a naive beginner question, but it's been gnawing at my brain for awhile so I'll go ahead and ask it. The idea: Write a CGI web application in Python and HTML forms that can also be used as a non-web/standalone application on a single/PC. Can you use a kind of dummy server to simulate the CGI on a single machine. The benefits: scalability: web or standalone use possible, HTML forms are quicker to author than Tk or Java-like GUI's if you're need speed. Jon Fernquest bayinnaung at hotmail.com Sent via Deja.com http://www.deja.com/ Before you buy. From kens at sightreader.com Sun Feb 27 17:11:10 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 14:11:10 -0800 Subject: Phyththon misspelling contest References: Message-ID: <38B9A0FE.E20FF615@sightreader.com> {python} Will Ware wrote: > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. > > -- > - - - - - - - - - - - - - - - - - - - - - - - - > Resistance is futile. Capacitance is efficacious. > Will Ware email: wware @ world.std.com From framiere at netcom-service.com Sat Feb 19 06:30:24 2000 From: framiere at netcom-service.com (Florent Ramière) Date: Sat, 19 Feb 2000 12:30:24 +0100 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> Message-ID: <88lv9g$sfd$1@news2.isdnet.net> Hello, well, i thinked about this method, it can be suitable for my project, but in one only way: it has to be set one time for all ... Is this possible ? Thanks for reading. Florent. > > > Is there an easy way to override the print statement (i saw it one time > > in the news, but i can not find it) > > > > You want sys.stdout.softspace: > > >>> print 1,;print 2 > 1 2 > >>> print 1,;sys.stdout.softspace=0;print 2 > 12 > > It's a bit tedious to actually use, as it keeps getting reset; you > could try this: > > >>> class SF: > ... def __init__(self,string): self.string = string > ... def __str__(self): sys.stdout.softspace = 0; return self.string > ... > >>> print SF("2"),1 > 21 > > HTH, > Michael From meng.engineering at bluewin.ch Tue Feb 22 02:28:55 2000 From: meng.engineering at bluewin.ch (Markus Meng) Date: Tue, 22 Feb 2000 08:28:55 +0100 Subject: Can't run FOX test scripts from the pythonwin env ... ??? Message-ID: <88te71$ra5$1@bw107zhb.bluewin.ch> Hey and hello, I just wonder if somebody else has the same problem. I tried all the test scripts for NT using python 1.52 and the test scripts from FXPy/test directory by "double clicking" on the python script files. Everything works as expected. However when I load a python script into pythinwin and want to make it running from there everything crashes... any idea? markus -- ******************************************************************** ** Meng Engineering Telefon 056 222 44 10 ** ** Markus Meng Natel 079 230 93 86 ** ** Bruggerstr. 21 Telefax 056 222 44 10 ** ** CH-5400 Baden Email meng.engineering at bluewin.ch ** ******************************************************************** ** Theory may inform, but Practice convinces. -- George Bain ** From sholden at bellatlantic.net Fri Feb 11 08:13:40 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 11 Feb 2000 13:13:40 GMT Subject: Python and Samba References: <38A33CA3.CD301863@kpnqwest.no> <87vnt8$voa$1@nntp6.atl.mindspring.net> <880m13$bpo$1@sunnews.cern.ch> Message-ID: <38A40B1F.2F703073@bellatlantic.net> Radovan Garabik wrote: > > Aahz Maruch wrote: > : In article <38A33CA3.CD301863 at kpnqwest.no>, > : Stein M. Eliassen wrote: > :> > :>I wonder if there is a way to use samba services from python? > :> > :>What I would like to do is browse shares from Python code. > :>Now I have to mount the share in a script before running the my python > :>code. > > : Hmmmm... I'm doing some WAGing here, but it seems to me that the > : fundamental problem is that you really need to have a UNC and/or Win32 > : environment in order to browse Samba shares. If you were running Python > : on NT, this wouldn't be an issue, I think. So the fundamental problem > : isn't a Samba library per se, but the SMB client for Unix. > > there is a smbclient for unix (and if I am not mistaken, a library too, > in this case you pobably can SWIG a module....), you have to parse > smbclient's output... not difficult, just a bit boring. > > -- > ----------------------------------------------------------- > | Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik | > | __..--^^^--..__ garabik @ fmph . uniba . sk | > ----------------------------------------------------------- Recent versions of Samba come with SMBFS, an UNSUPPORTED client-side driver for SMB which will allow Linux systems to mount SMB shares. However the Samba team recommend that you use smbsh, a shell which modifies filename semantics so that network resources can be accessed as /smb/hostname/sharename/... and this seems to be the way forward ... I'm using the now somewhat outdated 2.0.4b on my Linux SPARCstation. The README-smbmount file concludes a summary of alternative with: "... 3) Encourage people to use the "smbsh" utility that is part of samba and is being developed to replace the need for "SMBFS" - this is portable to platforms other than Linux - it allows each user to authenticate as themselves instead of allowing all users to use an SMB session that is authenticated as just one user. We have chosen the later and hope that our users will understand and support the decision that has been made." So caveat emptor (except that it's free, so we aren't really emptors). regards Steve -- "If computing ever stops being fun, I'll stop doing it" From anders.eriksson at morateknikutveckling.se Mon Feb 7 08:01:18 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 07 Feb 2000 14:01:18 +0100 Subject: PIL for 1.5.1 Message-ID: Hello! My ISP has Python 1.5.1 installed and I wonder where can I get PIL that works for this version? // Anders From egbert at bork.demon.nl Sat Feb 12 08:13:11 2000 From: egbert at bork.demon.nl (Egbert Bouwman) Date: Sat, 12 Feb 2000 14:13:11 +0100 Subject: Where is glob ? In-Reply-To: <38A462AC.67FA47AF@darmstadt.gmd.de>; from Robb Shecter on Fri, Feb 11, 2000 at 08:27:40PM +0100 References: <38A4483C.AE1A51F0@darmstadt.gmd.de> <38A43E31.F6530D17@rubic.com> <38A462AC.67FA47AF@darmstadt.gmd.de> Message-ID: <20000212141310.A798@bork> In Python 1.5.1 (debian slink) the command >>> import glob gives: ImportError: No module named glob However the module is mentioned in the library reference. The same thing happens with fnmatch. Is there any particular reason for these absences ? egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From kfriesen at netcom.ca Thu Feb 3 10:55:31 2000 From: kfriesen at netcom.ca (Kim Friesen) Date: Thu, 03 Feb 2000 15:55:31 +0000 Subject: Vaults of Parnassus problem Message-ID: <3899A4F3.76F8FD8A@hotmail.com> Hi, Is anyone having problems accessing the Python modules at the vaults of parnassus ??? The link from python.org just goes into limbo and never returns any data ... ?? From bill.anderson at libc.org Sat Feb 12 17:40:43 2000 From: bill.anderson at libc.org (Bill Anderson) Date: Sat, 12 Feb 2000 15:40:43 -0700 Subject: [Tutor] Weighted Random numbers References: <200002121116.DAA20152@alpha.ece.ucsb.edu> Message-ID: <38A5E16B.71DCA169@libc.org> (x-posted to comp.lang.python in the hopes of reaching a wider audience [esp re: NumPY]... hope nobody minds) "Wesley J. Chun" wrote: > > > Date: Fri, 11 Feb 2000 18:19:54 -0700 > > From: Bill Anderson > > > > I am working on a bannerad system in Python (for Zope). I have most of > > it functional, but I need to be able to weight certain selections, just > > as with any of the myriad perl implementations. Anyone have any pointers > > on a way to do this in python? > > the best way to do this is to choose from a weighted > list of 1 to 100 say, with each number representing a > percentage or proportion of the time an ad should be > chosen. each ad would get a "range" based on the %age > of the time it should show. the "odds" of all the > individual ads summed together should be 100. > > for example, a heavily weight ad (from BigBucksAdAgency) > may get 50% and be given the segment from 1-50. another > ad, not as prominent may get 25%, so it gets 51-75. a > 3rd and 4th ad get 10% each, so 76-85, and 86-95, re- > spectively, and the 5th and final ad gets 5%, 96-100. That's a lot like what I was thinking. I as considering building a list of banners, with the weight being the number of times the ad was in the list. Then using whrandom, I'd select one. The only issue I see so far with the percentage method, is that it makes management more of a headache. In order to set weights, I would need a master page with all the banners, their weight percentage, and the total. Hmmm ... some random unweighted-thoughts ... I think the difference in these two methods are in the type of weighting. In my method, the weight is against a non-weighted ad, that is, an ad with weight 1. An ad with weight 5 is 5x more likely to be seen than a standard ad. In your method, the weight is relative to the other ads. An ad with weight 5 will be seen 5% of the time. The difference is sublt, but important, IMHO. I guess unless I (or anyone else ;) can come up with a different method, I'll probably wind up implementing them both, with an option to select at system creation time. Bill -- 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 akuchlin at mems-exchange.org Fri Feb 25 13:09:17 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 25 Feb 2000 13:09:17 -0500 Subject: jack, curses and rpms References: <1260689398-5933775@hypernet.com> <25022000.1@sanctum.jae.ddns.org> Message-ID: <3dbt55i27m.fsf@amarok.cnri.reston.va.us> "Juergen A. Erhard" writes: > Why two versions? Did Oliver forget to submit his patches to Guido > (et al)? Or did Guido not accept them? If so, why not? > > What needs to be done to synchronize the canonical Python and the > Python RPMs? Here's the story. Oliver Andrich maintains a bunch of Python-related RPMs at www.andrich.net, and he also did an enhanced version of the curses module that provides many additional features such as ncurses. So Oliver's RPMs contain the fancy cursesmodule; Debian's Python distribution probably doesn't have it, and neither does a stock Red Hat. The problem is that Oliver's enhanced module probably won't work on systems that support only BSD curses. I have not verified this; if someone wants to try compiling it on a system with only plain curses, that would be useful. I don't believe it was ever submitted to GvR for inclusion. ncurses implements the SYSV curses API, and BSD curses is no longer maintained, so maybe there are no platforms left that only have plain curses, and compatibility is no longer an issue. (Do the *BSDs use ncurses as standard these days?) Also, maybe so few people use the cursesmodule that GvR wouldn't care if there was a backwards-incompatible change. -- A.M. Kuchling http://starship.python.net/crew/amk/ When a man tells you that he got rich through hard work, ask him *whose*? -- Don Marquis From kopecjc at worldnet.att.net Fri Feb 11 22:08:49 2000 From: kopecjc at worldnet.att.net (Joseph C. Kopec) Date: Sat, 12 Feb 2000 03:08:49 GMT Subject: "Python Annotated Archives" A good book? References: <8777m9$r2v$1@news.hal-pc.org> Message-ID: <38A4CE64.76D308E0@worldnet.att.net> I have read and loved Learning Python and more recently have been using Python Annotated Archives. Frankly, I have been a little disappointed with PAA. It is little more than 700 pages of commented code -- a program is presented verbatim and followed by an interpretation of the code. Unfortunately, this interpretation is done very much on a line-by-line basis, with little in the way of context or even a decent explanation of why a program was structured the way it was. Additionally, many of the code examples are somewhat dated -- in some cases they are programs that have been in the standard distribution for years (for instance, the regular express section uses regex and not re). That said, if you (or your employer) have $50 to burn and you like to have things on paper rather than using on-line resources, it is one of the more up-to-date books. Other larger Python books such as Programming Python and Internet Programming With Python are kind of old. (Note, however, that the new edition "Programming Python" is due out in a few months.) Additionally, I have heard good things about the New Riders book on Python (is it called Essential Python?). Hope this helps. Steven Pauly wrote: > Greetings, > > As a newbie pythonista, I saw this book and was wondering what others > thought, as far as technical quality, target audience suitabilty, and > readability. > > I have "Learning Python" and have generally liked it. But it seems to lack > as many code examples as I would like. No bash intended, just my opinion. > > Python is great! > > Steve. > -- > Steven Pauly (281) 496-8041 (steve.pauly at glm.com) > Global Marine Drilling Co. / Houston / Tx / 77079 > stevep at brokersys.com / stevep at bash.linux-shell.net From alxchltn at my-deja.com Sat Feb 26 03:50:29 2000 From: alxchltn at my-deja.com (alxchltn at my-deja.com) Date: Sat, 26 Feb 2000 08:50:29 GMT Subject: Module Packages Message-ID: <89844l$5ek$1@nnrp1.deja.com> Greetings, I'm trying to write a package consisting of four modules that are all in the same folder. After a series of choices from the first module, the second module is called and so on. When module 2 tries to call a function from the first, It raises an error - "no function named..." Should I be using something else besides "from import *", adding something to "__init__.py" or just make a copy of the function and paste it to module 2. I don't just want it to work, I want it to work proper. Thank you, alx Sent via Deja.com http://www.deja.com/ Before you buy. From trentm at ActiveState.com Mon Feb 14 13:37:58 2000 From: trentm at ActiveState.com (Trent Mick) Date: Mon, 14 Feb 2000 18:37:58 -0000 Subject: os.shell, recursion, encryption In-Reply-To: <20000215021003.C1D571CD98@dinsdale.python.org> Message-ID: > Thanks for the lesson. It's a little clearer, but now I question whether > this can be used for what I want to do. It seems like popen creates a > file. I don't want to do that. Instead, I'd like to simply run a > commercial program with a command like 'pkzip asdf.zip *.*'. I gave the > following a try and it came back with "bad command or filename." Am I on > the right path or should I be using a different function than popen? > os.system() doesn't work and I don't know what mode to use for spawnv. > Thanks again. > > import os > zipExe='c:/progra~1/pkzipdos/pkzip.exe' > os.popen('> '+zipExe+' asdf.zip *.*', 'w') I have not been following this thread but methinks you want to say: import os zipExe = 'c:/progra~1/pkzipdos/pkzip.exe' zipOutput = os.popen(zipExe + ' asdf.zip *.*', 'r') print zipOutput.readlines() The p in popen stand for 'pipe' I believe. You are openning a pipe to the command that you are running (here pkzip). The 'bad command or filename' is comming from the greater than sign '>' that you prefixed the command with. I think you may be using the Perl syntax for open(). If you still get 'bad command or filename' then pkzip.exe is not where you think it is or something else is broken. As well you want to open the pipe for reading because you want to get the status output from pkzip (right?). If you don't care about the zip status output then try import os zipExe = 'c:/progra~1/pkzipdos/pkzip.exe' os.system(zipExe + ' asdf.zip *.*') Again, when you say that os.system() was broken as well, I think the greater than sign is your problem. Hope this helps, Trent From egibson at connect.com.au Wed Feb 9 21:05:20 2000 From: egibson at connect.com.au (Evan Gibson) Date: Thu, 10 Feb 2000 13:05:20 +1100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <38A18D5F.7CE61061@prescod.net>; from Paul Prescod on Wed, Feb 09, 2000 at 07:53:03AM -0800 References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> <38A18D5F.7CE61061@prescod.net> Message-ID: <20000210130520.39607@connect.com.au> On Wed, Feb 09, 2000 at 07:53:03AM -0800, Paul Prescod wrote: > Thomas Hamelryck wrote: > >... > > Because eyeball retraining can be worth it sometimes. > > That's something you learn after trying a half dozen or so radically > different languages. The average programmer will never come to that > recognition. At Uni I came across Forth, Fortran, Pascal, C, C++, Machine Code, Lisp, Perl, Rexx, Structured Basic... I very quickly got to the point of not thinking in any particular language and just scribbling down algorithms on pieces of paper in some thrown together amalgamation of languages. When it came to implementation time I'd just interpret that into whatever language I needed, but I didn't _think_ in those languages so I wasn't restricted when it came to moving between them. Imagine my surprise when I came across python and it was almost IDENTICAL to the version of pseudo-code I used to use (Except for putting colons at the end of "if" statements!). When writing things down on paper you USE indenting, because it's far cheaper in writing time than curly braces are and easier to see at a glance how things work. (Especially when your writing is as messy as mine. Whitespace is far more noticable than trying to work out whether some obscure piece of scribble is a brace or a question mark.) To me whitespace indentation is one of the best features of python. It makes python almost the same as the make-believe programming language I actually think in. The only things it took _me_ time to get used to was the appropriate use of "self" and the difference between global and local namespaces. -- Evan ~ThunderFoot~ Gibson ~ nihil mutatem, omni deletum ~ May the machines watch over you with loving grace. From tomh at po.crl.go.jp Mon Feb 28 21:30:47 2000 From: tomh at po.crl.go.jp (Tom Holroyd) Date: Tue, 29 Feb 2000 11:30:47 +0900 Subject: array constructor & atof() In-Reply-To: <38BA6AFF.5CBD8B75@camelot-it.com> References: <38BA6AFF.5CBD8B75@camelot-it.com> Message-ID: On Mon, 28 Feb 2000, Michael Tiomkin wrote: > Well, the following worked for me (forcing list copy): > >>> a=[[0]*4]*4 > >>> b=map(lambda x: x+[],a) Hrm. Or m = map(lambda x: x[:], [[0] * 4] * 4). That's halfway decent. Thanks (and to the other constructive suggestions). > In some countries, 123,456 means 1.23456e5 That's a valid reason. > If you use a delimiter on a list of numbers, you can use splitfields > from string module. BTW, Python could have a better split function, > like that in awk, or at least with a string of possible delimiters, > and the meaning of choosing the maximal string of a type [a1...an]*. Now *there* is an excellent point -- my problem would easily have been solved if I could have said 'string.split(str, ",;")' and this makes even more sense since 'string.split(str)' means *any* whitespace. Unfortunately the former already means that the delimiter is the full string ",;" rather than any of them. So: >>> import re >>> re.split(", |; ", "123.45, this; and that") ['123.45', 'this', 'and that'] Yea, that's the ticket. Dr. Tom Holroyd "I am, as I said, inspired by the biological phenomena in which chemical forces are used in repetitious fashion to produce all kinds of weird effects (one of which is the author)." -- Richard Feynman, _There's Plenty of Room at the Bottom_ From infonuovo at email.com Tue Feb 8 10:46:26 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Tue, 8 Feb 2000 07:46:26 -0800 Subject: Redundant elements in sys.path In-Reply-To: <38A030C1.14FF5F9D@bellatlantic.net> Message-ID: I have noticed the same thing with the python 1.5.2 for Win32 distribution, without PythonWin installed. This shows up on Windows 98 and Windows 98 SE, although I thought I noticed more capitalization variations. It appears to be an artifact of the installation process that appears harmless although a bit distracting when I look at it. My hypothesis is that it may also be a redundancy resulting from capturing the Fat32 long file names as well as the underlying DOS forms of the file names, with no filtering for duplicates. (Do those even make sense on NT? Does PROGRA~1 correspond to anything on your system?) Related install question: Do you have Tcl-Tk installed as part of python 1.5.2 for Win32? I noticed that on WIn98 there is a registry error (bad path to a Tcl-Tk library module) in that install. I reported it to the Tcl-Tk folk and they said it doesn't show up in the Win32 installer for Tck-Tk versions later than the one packaged inside python 1.5.2. I mention it now here before I forget one more time. -- orcmid -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Steve Holden Sent: Tuesday, February 08, 2000 07:06 To: python-list at python.org Subject: Redundant elements in sys.path I noticed that both PythonWin and Idle have the same items, although with different case representations, in sys.path. Since the filestore isn't case-sensitive on Windows NT I'm wondering a) How these duplicates came about (multiple installs?), and b) What I can do to get rid of them (registry scoured, but nothing probable found). The code I used to detect this situation is no great shakes: >>> s=list(sys.path) >>> s.sort() >>> for p in s: ... print p Output from PythonWin: C:\Program Files\Python C:\Program Files\Python\DLLs C:\Program Files\Python\DLLs C:\Program Files\Python\Lib C:\Program Files\Python\Lib\lib-tk C:\Program Files\Python\Lib\plat-win C:\Program Files\Python\Pythonwin C:\Program Files\Python\Pythonwin C:\Program Files\Python\lib C:\Program Files\Python\lib\lib-tk C:\Program Files\Python\lib\plat-win C:\Program Files\Python\win32 C:\Program Files\Python\win32\lib Output from Idle: C:\PROGRA~1\PYTHON C:\PROGRA~1\Python\Tools\idle C:\Program Files\Python C:\Program Files\Python C:\Program Files\Python\DLLs C:\Program Files\Python\DLLs C:\Program Files\Python\Lib C:\Program Files\Python\Lib\lib-tk C:\Program Files\Python\Lib\plat-win C:\Program Files\Python\Pythonwin C:\Program Files\Python\lib C:\Program Files\Python\lib\lib-tk C:\Program Files\Python\lib\plat-win C:\Program Files\Python\win32 C:\Program Files\Python\win32\lib Since I'm not running from source distribution I'd appreciate it if someone could explain how PYTHONPATH is initialized and how I can simplify my environment to remove this duplication. regards Steve Holden -- "If computing ever stops being fun, I'll stop doing it" -- http://www.python.org/mailman/listinfo/python-list From loewis at informatik.hu-berlin.de Mon Feb 14 10:28:11 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 14 Feb 2000 16:28:11 +0100 Subject: Embed Python and Database in my C program References: Message-ID: "Warren Postma" writes: > I need a simple DB engine for a C program that can be easily accessed from > both Python and C. Does anyone have any suggestions? The platforms are WinNT > and an embedded realtime Win32 variant called "Phar Lap Realtime ETS > kernel". If ODBC is available on your target systems, and if the ODBC-supported databases qualify as 'simple', I guess you could use ODBC from both C and Python. In C, you wouldn't use the Python wrapper code, but the native ODBC functions directly. Another alternative is to use Berkeley DB, which also has a C interface, and the bsddb module around it. BSD DB also runs on Windows. > It looks like the "shelve" part of Python creates a binary on-disk > dictionary. If that's so, and you can interate through a rowset and > look up on a single key, I could live with that. Shelve is implemented on top of anydbm and pickle. anydbm in turn is implemented on top of bsd db (if available). bsddb provides a persistens string->string dictionary, so if you only need to store strings, bsd db should work fine. If you need to store objects of varying type, you'll have to use shelve. Of course, to access a shelve from C, you'll have to do a lot of PyObject_CallMethod calls. Hope this helps, Martin From just at letterror.com Sun Feb 13 13:47:11 2000 From: just at letterror.com (Just van Rossum) Date: Sun, 13 Feb 2000 19:47:11 +0100 Subject: Python aka. Smalltalk Lite? In-Reply-To: <886t16$kbp$1@nntp6.atl.mindspring.net> References: <860ftk$bas@news.or.intel.com> <86ya8szq90.fsf@g.local> <1e5wxbt.bq9v2nqzwbxuN%bparsia@email.unc.edu> Message-ID: At 6:26 PM +0000 13-02-2000, Aahz Maruch wrote: >In article <1e5wxbt.bq9v2nqzwbxuN%bparsia at email.unc.edu>, >Bijan Parsia wrote: >> >>Here's are some whimper inducing things for me: >> No class methods >> No super > >Yeah, I've been able to work around these, but they're somewhat >annoying. Note that I believe that Smalltalk has only single >inheritance, so adopting super may be a bit difficult in Python. Last time I tried to (not) get my head exploded about 'super' I realized it's more subtle than that. I managed to implement it in Python, but it's *majorly* ugly and inneficient. For entertainment, I've appended the code. I'm not sure anymore if it's even correct... Just import sys from types import FunctionType, MethodType def getbasemethod(method): assert type(method) == MethodType for base in method.im_class.__bases__: try: basemethod = getattr(base, method.__name__) except AttributeError: pass else: assert type(basemethod) == MethodType # XXX no can't do, see below: #basemethod.im_self = method.im_self return basemethod else: raise AttributeError, method.__name__ def findclass(klass, code): for value in klass.__dict__.values(): if type(value) == FunctionType: if value.func_code is code: return klass for base in klass.__bases__: k = findclass(base, code) if k: return k def super(): try: 1/0 except: frame = sys.exc_info()[2].tb_frame.f_back selfname = frame.f_code.co_varnames[0] self = frame.f_locals[selfname] klass = self.__class__ code = frame.f_code methodname = frame.f_code.co_name klass = findclass(klass, code) if not klass: raise AttributeError, methodname # would be even better if we could bind it to "self" return getbasemethod(getattr(klass, methodname)) class A: def foo(self): try: print super() except AttributeError: print "no super method foo" class B(A): def foo(self): s = super() print s s(self) class C(B): def foo(self): s = super() print s s(self) i = C() i.foo() From quinn at pfennig.ugcs.caltech.edu Mon Feb 21 14:57:46 2000 From: quinn at pfennig.ugcs.caltech.edu (Quinn Dunkan) Date: 21 Feb 2000 19:57:46 GMT Subject: Int methods (was RE: string.py) References: Message-ID: On Sun, 20 Feb 2000 17:54:55 -0500, Tim Peters wrote: >The parser has trouble with 5.radix because "maximal munch" lexing sucks up Beautiful! Move aside, "greedy matching", let's go change the re documentation to say "maximal munch". have-to-have-something-to-differentiate-ourselves-from-perlers-ly y'rs incidentally, in ruby: 4.type -> Fixnum 4. isn't a float in ruby 4.0.type -> Float From garabik at center.fmph.uniba.sk.spam Fri Feb 11 04:50:27 2000 From: garabik at center.fmph.uniba.sk.spam (Radovan Garabik) Date: 11 Feb 2000 09:50:27 GMT Subject: Python and Samba References: <38A33CA3.CD301863@kpnqwest.no> <87vnt8$voa$1@nntp6.atl.mindspring.net> Message-ID: <880m13$bpo$1@sunnews.cern.ch> Aahz Maruch wrote: : In article <38A33CA3.CD301863 at kpnqwest.no>, : Stein M. Eliassen wrote: :> :>I wonder if there is a way to use samba services from python? :> :>What I would like to do is browse shares from Python code. :>Now I have to mount the share in a script before running the my python :>code. : Hmmmm... I'm doing some WAGing here, but it seems to me that the : fundamental problem is that you really need to have a UNC and/or Win32 : environment in order to browse Samba shares. If you were running Python : on NT, this wouldn't be an issue, I think. So the fundamental problem : isn't a Samba library per se, but the SMB client for Unix. there is a smbclient for unix (and if I am not mistaken, a library too, in this case you pobably can SWIG a module....), you have to parse smbclient's output... not difficult, just a bit boring. -- ----------------------------------------------------------- | Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik | | __..--^^^--..__ garabik @ fmph . uniba . sk | ----------------------------------------------------------- From effbot at telia.com Tue Feb 29 00:04:45 2000 From: effbot at telia.com (Fredrik Lundh) Date: 28 Feb 2000 23:04:45 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) Message-ID: <3326DD1EE2F0A189.8CE210DACA89D440.29CA859F010483DB@lp.airnews.net> Help wanted: Andrew Kuchling: Maintainer needed for the curses module http://www.deja.com/=dnc/getdoc.xp?AN=590053755 David Ascher: Call for Patch for Borland compiler http://www.deja.com/=dnc/getdoc.xp?AN=588013997 www.faqts.com: Python Knowledge Base http://www.faqts.com/knowledge-base/index.phtml/fid/199/lang New mailing lists: ASP scripting with Python: http://www.asplists.com/asplists/asppython.asp Glenn Norton announces a small study group for Python newcomers: http://www.egroups.com/group/python-studies/info.html More Python-related projects move to sourceforge: Numerical Python: http://numpy.sourceforge.net Bernard Herzog's Sketch: http://sketch.sourceforge.net Alessandro Bottoni reviews John Grayson's 'Python and Tkinter programming,' and likes what he sees: http://www.deja.com/=dnc/getdoc.xp?AN=588012707 Over at the software carpentry, Philip Wadler discusses how to 'embed' a make-like tool in Python: http://software-carpentry.codesourcery.com/lists/sc-discuss/msg00068.html >From the newsgroup: Tim Peters: Fun with Lazy Streams http://www.deja.com/=dnc/getdoc.xp?AN=590446915 http://www.deja.com/=dnc/getdoc.xp?AN=590532128 (errata) Tom Bryan: How to configure Emacs to use Python http://www.deja.com/=dnc/getdoc.xp?AN=587498993 http://www.python.org/emacs/python-mode Tim Peters: Performance penalties when using nested functions http://www.deja.com/=dnc/getdoc.xp?AN=589614882 Fredrik Lundh: How to do file locking on Windows http://www.deja.com/=dnc/getdoc.xp?AN=589808979 Aahz Maruch: How to use threads (a simple threading example) http://www.deja.com/=dnc/getdoc.xp?AN=570016307 Fredrik Lundh: extracting hyperlinks from an HTML document http://www.deja.com/=dnc/getdoc.xp?AN=588617613 Tom Bryan: Comparing Perl and Python http://www.deja.com/=dnc/getdoc.xp?AN=588777654 Jamie Zawinski: Tabs versus Spaces: An Eternal Holy War http://www.jwz.org/doc/tabs-vs-spaces.html Jay Graves wants to run Python on AS/400: http://www.deja.com/=dnc/getdoc.xp?AN=588863805 Andreas Otto: proposes a 'token-stream compiler' for Python http://home.t-online.de/home/aotto/compiler-Paper.html (in german) The annual GUI war came and went. Highlights: Gerrit Holl: Python GUI Comparision http://www.nl.linux.org/~gerrit/gui.html Guido van Rossum: Tkinter vs. wxPython http://www.deja.com/=dnc/getdoc.xp?AN=589134497 Peter Funk: Tkinter works with Tcl/Tk 8.3.0 http://www.deja.com/=dnc/getdoc.xp?AN=589280553 Lyle Johnson: Python bindings for the FOX user interface toolkit http://home.hiwaay.net/~johnson2/FXPy Fredrik Lundh: Some notes on Tkinter performance http://www.pythonware.com/people/fredrik/fyi/fyi03.htm Kevin Rogers: Where to find Tkinter documentation http://www.deja.com/=dnc/getdoc.xp?AN=588911772 Fredrik Lundh: How to print stuff from Tkinter http://www.deja.com/=dnc/getdoc.xp?AN=588907043 Kevin Cazabon: How to make sure Tkinter images stay on screen http://www.deja.com/=dnc/getdoc.xp?AN=589175052 Robin Becker: Tkinter stubs for dummies http://www.python.org/pipermail/python-list/2000-February/046654.html On the lighter side: Martijn Faassen explains why Tim Peters must be invisible: http://www.deja.com/=dnc/getdoc.xp?AN=588080148 Will Ware: Phyththon misspelling contest http://www.deja.com/=dnc/viewthread.xp?AN=589151105 Egbert Bouwman: a regular expression that matches all possible spellings of the word 'python' (from 'pitn' to 'phphphieyythonne'): http://www.deja.com/=dnc/getdoc.xp?AN=589804937 ...and finally, Francois Pinard wonders what a 'killer app' really is. Bill Gates has the answer: http://www.python.org/pipermail/python-list/2000-February/046773.html ======================================================================== 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 krodgers at tdyryan.com Wed Feb 23 12:51:37 2000 From: krodgers at tdyryan.com (krodgers at tdyryan.com) Date: Wed, 23 Feb 2000 17:51:37 GMT Subject: Which GUI? References: <20000223083325.B1000@stopcontact.palga.uucp> <20000223161839.B3134@stopcontact.palga.uucp> Message-ID: <8916n7$4vo$1@nnrp1.deja.com> In article <20000223161839.B3134 at stopcontact.palga.uucp>, Gerrit wrote: > > > Tkinter does NOT reinvent the wheel. I can't understand where this comes > > from. > > It provides their own classes. These classes are invented by Tkinter, they > do not exist in Tcl/Tk. And the methods don't even *match* with Tcl functions! > Lessee if I get this now . . . your chief complaint is that there's not a one-to-one match between Tk and Tkinter? So because of this, Tkinter is "reinventing the wheel"? When I first started using Python and Tkinter, about three and a half years ago, the only Tkinter documentation was Matt Conway's "Tkinter Life Preserver". While that was better than nothing, it was still pretty dire. Then Mark Lutz's "Programming Python" came out, with some pretty good stuff on Tkinter. (BTW, PP has been getting some IMHO undeserved bad press in this newsgroup lately; yes, it's big and yes, it covers a lot of territory, but you need to remember that it was one of the first two Python books, the first from O'Reilly, and part of its goal was to cover as much as possible. I like it and still use it.) Fredrik Lundh's book-to-be has been around for, what, close to two years now? The Grayson book is out. So, unless you're tchrist and refuse to recognize any docs except Unix format manpages, the documentation situation for Tkinter is "pretty good" right now. I personally like the fact that Tkinter doesn't just slavishly wrap Tk. Being able to do, e.g., self.lbl = StringVar() Label(master, textvariable=self.lbl).grid() # don't need ref to Label self.lbl.set("This is a test . . .") and have the label widget text change, is cool. Tkinter manages the widget references behind the scenes. It may be possible to do this in straight Tcl/Tk, but I don't have to know that - Tkinter is a sufficiently "thick" wrapper that I don't even have to know what Tcl/Tk "native" code looks like. I looked at wxPython, and even subscribed to the mailing list for a while, but I never got over the feeling that I was writing C/C++ in Python. I want to write Python in Python! Tkinter "feels" like Python. Aesthetically, I wish that Tk were bound more closely to the Win32 widget set (instead of "emulating" most of the widgets), but the TkGS project will change that. To each his/her own. But I certainly plan to keep paying attention to what I have to do to write code, and how pleasant that is, and whether it works, and not worry overmuch about the "purity" of the OO layers beneath. oooeee-GUI-ly y'rs Kevin Sent via Deja.com http://www.deja.com/ Before you buy. From embed at geocities.com Wed Feb 9 09:53:18 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 09:53:18 -0500 Subject: Pickle can't import class from __console__ References: <20000121005801.BBB734181E@koro.off.connect.com.au> Message-ID: I was playing with the posted samples of pickling interactively in IDLE, and experienced this problem: Is it not possible to use Pickle interactively!? # HERES WHERE I'M DUMPING THE CONTENTS OF THE PICKLE JAR OUT FOR ME TO SEE: >>> f1 = open('foo.pickle','r') >>> x = f1.read() >>> print x (i__console__ foo p0 (dp1 b. >>> f1.close() # HERE I'M TRYING TO RELOAD THE PICKLED OBJECT INTERACTIVELY: >>> zz = pickle.load(open('foo.pickle','r')) Traceback (innermost last): File "", line 1, in ? zz = pickle.load(open('foo.pickle','r')) File "c:\Python\Lib\pickle.py", line 826, in load return Unpickler(file).load() File "c:\Python\Lib\pickle.py", line 495, in load dispatch[key](self) File "c:\Python\Lib\pickle.py", line 612, in load_inst klass = self.find_class(module, name) File "c:\Python\Lib\pickle.py", line 669, in find_class raise SystemError, \ SystemError: Failed to import class foo from module __console__ >>> Warren Postma From gherman at darwin.in-berlin.de Fri Feb 18 04:10:18 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Fri, 18 Feb 2000 10:10:18 +0100 Subject: ANN: py2pdf 0.2 -- Python syntax coloring in PDF Message-ID: <38AD0C7A.75B939B7@darwin.in-berlin.de> py2pdf.py 0.2 -- Python syntax coloring in PDF This is to announce the availability of py2pdf, a module to help generate PDF files documenting Python source code in a nicely colored fashion. The current version is 0.2 and right now there are many shortcomings about lack of flexibility and program de- sign. In fact, the resulting PDFs are much nicer than the code itself, which should not come as a surprise with 0.2 being not much more than a two day hack, disassembling Marc-Andre's nice py2html and throwing it to Andy's PDFgen. I'm getting this out that early because I've been told several people would need PDF documentation support for Python source code. So I put most emphasis so far on getting some good-look- ing output, maybe a bit too much. Therefor, please take it as a proof of concept rather than as a production quality module! I'm eager to get some feedback, but please don't expect me to be as responsive as those famous bots on comp.lang.python! Below you'll find some excerpts of the source comments. You'll find py2pdf in my corner of the Starship Python: http://starship.python.net/crew/gherman/programs/py2pdf/ Enjoy, Dinu py2pdf - 0.2 FEATURES: - Python syntax color highlighting in PDF - fully visible whitespace such as blanks and tabs - multi-line strings over page breaks rendered ok - plain text output including tags for debugging - 100% pure Python, fully platform independent APPLICABILITY: - Python syntax color highlighting in PDF - pretty-printing in a printer-friendly format - teaching, reviewing, documenting Python code - debugging Python code with indentation problems - writing course material (sample solutions) - providing initial printing engine to Python IDE developers - providing 'uncorruptable' source code to publishers - writing code fragments to be used with pdflatex (not yet) DEPENDENCIES: - JvR's PyFontify v. 0.3 - optionally Marc-Andre's mxTextTools - Andy Robinson's PDFgen v. 2000-02-16 (using package structure) (likely, any newer version will do, like PDFgen-19991012, likely, pd2py will be distributed with PDFgen as a demo.) TODO: - test stdin, stdout - test CGI mode - test parameter tag - improve comments - add support for monochrome display/printing - move PDF formatting into class PrettyPrint and ... - reorganise functions/classes... - ... then add flexible bgcolor (now hard-wired only) - ... then add support for paper formats other than A4 - ... then add time stamp to page decoration frame - ... then switch on/off blank/tab rendering - ... then add smart line wrapping - reduce end user risk to accidentally use tags in their code - implement -URL with PDF hyperlinks (postponed) - support single-page PDF output in a page fraction (postponed) - generalize/reunify with py2html, maybe (long term) - what's next? py2opengl? ;-) SUGGESTIONS for PDFgen: - get rid of the 'saved ' message - fix buglet in PDFgen Odyssey demo - add PDF hyperlinks (not there yet) - add PDF outline/bookmarks (not there yet) BUGS: - misplaced tokens for blanks after inline strings (see especially function dummy()) -- 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 simone at nospam.oreilly.com Tue Feb 1 16:45:48 2000 From: simone at nospam.oreilly.com (Simone Paddock) Date: Tue, 01 Feb 2000 21:45:48 GMT Subject: CALL FOR PAPERS for the O'REILLY OPEN SOURCE CONVENTION 2000 Message-ID: <38975426.1212742@news.sonic.net> Want to make all those endless nights hacking away at your favorite Open Source Language finally pay off? This is your chance to share those jewels of code with your peers! Submit your proposal for talks, tutorials and refereed papers for The O'Reilly Open Source Software Convention July 17-20, 2000 in Monterey, California ******************************************************************** Last year's event attracted over 1700 attendees, with an audience hungry for information and eager to hear about the latest developments and trends in the Open Source world. This time, it could be YOUR chance to enlighten, and maybe even enrapture, a room full of your peers with your latest innovation or foray into an Open Source technology. But not only that: it's also an excellent opportunity for you to rub shoulders with the heroes, founders and demi-gods of the Open Source community - plus have a ton of fun! Here are the topics: ? Linux ? Apache ? Python ? Sendmail ? Open Source Business Strategies ? Tcl/Tk ? Other open source technologies This year, we are focusing on Open Source technologies enabling secure, high-volume e-commerce. Technical talks in any of the above tracks that zoom in on e-commerce will be particularly welcomed! All submissions should be directed to: oscon00proposals at oreilly.com For detailed information on submitting a proposal, please see: http://conferences.oreilly.com/oscon2000/call.html If you have any questions about submitting a proposal, please contact Joseph McIntyre at joseph at oreilly.com Need some additional time to put together that mind blasting proposal that is going to knock the socks off your fellow hacker's feet? You got it! We are extending the original submission deadline to Feb. 18, 2000. Don't miss it. Simone Paddock, Online Evangelist O'Reilly & Associates simone at oreilly dot com www.oreilly.com From effbot at telia.com Mon Feb 14 14:04:13 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 19:04:13 GMT Subject: Python sucks loud References: Message-ID: HelloAgain wrote: > I'm curious (although not excessively so) why do you people all think > that was a flame bait? Why couldn't it simply be a harmless opinion, > along with a few questions (to which I got a pretty good response, > thanks again to everyone who have contributed)? > > Isn't that a bit creepy that so many people want to isolate themselves > from anything, about which they're not sure ahead of time that it'll > agree with their preferences? Here: it's been *four* days now that I'm > looking at it, and still I think Python is an ugly language. That's > trolling by your book? Well, you better put it in the FAQ that you don't > want anyone disrupt your Pythonic mutual-masturbation idyll here. > > Looking at some programmers it's hard to escape a feeling that this > profession attracts more than its share of narrow-minded, low-brow, > humourless yet exceedingly self-confident cretins. (Or is it only the > case with Python "specialists", hmmmmm ?) yes. From mike.zaharkin at westgroup.com Mon Feb 14 16:30:41 2000 From: mike.zaharkin at westgroup.com (MikeZ) Date: Mon, 14 Feb 2000 16:30:41 -0500 Subject: Multicolumn listbox for Tkinter available ? Message-ID: <38a87401@wwwproxy3.westgroup.com> Does anyone where I can get a Multicolumn listbox implemented in Tkinter ? Thanks again, -Mike Z. From bjorn at roguewave.com Thu Feb 3 18:10:07 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Thu, 03 Feb 2000 16:10:07 -0700 Subject: File size limitations References: <87cql2$t8j$1@nnrp1.deja.com> Message-ID: <389A0ACF.DBF4FA2F@roguewave.com> I'm pretty sure Python uses the fseek/lseek etc. functions for file IO. It would be trivial to create an extension module with Swig (http://www.swig.org) if you knew which calls you needed to make assuming you used floating point numbers for communicating between the languages. Python long integer to __int64 etc. is of course possible, but requires some actual coding. -- bjorn gmc333 at my-deja.com wrote: > I'd like to use Python for some large-scale file processing on Windows > NT. There is a possibility that the size of the files I'll be working > with will exceed 2^32 bytes. > > Can Python handle files that large? Random I/O is a specific concern, > since an implementation based on fseek/lseek system calls will fail > (these calls use 32-bit math, and bad things can happen with seeks that > go too far). > > Thanks! > > Greg > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list From nathan at islanddata.com Thu Feb 10 11:37:46 2000 From: nathan at islanddata.com (Nathan Clegg) Date: Thu, 10 Feb 2000 08:37:46 -0800 (PST) Subject: code to parse a file In-Reply-To: <000e01bf73d6$c481cde0$6c00a8c0@ruidovisual.pt> Message-ID: On 10-Feb-2000 Pedro Silva wrote: > for lines in f.readline(): I believe this is your mistake here. If you use readline(), you will be looping over the characters of a single line. I think you want to use readlines(). ---------------------------------- Nathan Clegg nathan at islanddata.com From calishar at *NOSPAM*home.com Wed Feb 23 20:55:33 2000 From: calishar at *NOSPAM*home.com (Calishar) Date: Thu, 24 Feb 2000 01:55:33 GMT Subject: Pythonwin (Version 2 beta 3) Message-ID: Hi Folks, I think I have run across a bug in Pythonwin (from win32all-128), and am posting a message in here to see if others have run across it, or if Mark is already aware of it. When printing a python source file using pythonwin (I like the shades of grey) it prints out all but the last page. Also, I think I have a bug when the interactive window is docked. I think that if it is the active window (and maybe one or two other criteria) pressing ctrl-W will cause the whole pythonwin app to freeze. I tried right-clicking the icon in the system tray and selected 'Break into Running code' but it didn't help either. By the way, I just want to say thank you to Mark for all the work he has put in making Python programming on Win32 an easier task, win32all is a great package, and the book looks pretty great too. Calishar From rogerlamreplace_with_previous_token at email.com Mon Feb 28 04:41:42 2000 From: rogerlamreplace_with_previous_token at email.com (Roger Lam) Date: Mon, 28 Feb 2000 17:41:42 +0800 Subject: [smtplib]: How to send binary file attachement ? Message-ID: <89dgc8$1ul$1@horn.hk.diyixian.com> anyone got a working sample code? Thanks Roger. From bvoh at sdynamix.com Thu Feb 3 01:43:55 2000 From: bvoh at sdynamix.com (bvoh at sdynamix.com) Date: Wed, 02 Feb 2000 22:43:55 -0800 Subject: Language Challenge 2000 Message-ID: <389923AB.741B7DB9@sdynamix.com> Language Challenge 2000 The entire onboard software for the Apollo Lunar Landing Mission was about 10% the size of today's typical word processor -- a huge regress by any standard. For a measure of progress in scientific software you are invited to participate in a comparative test by solving a real world problem in the language of your choice. Find the optimal initial angle for a trajectory to reach a target at 2000 m to within .5 m. The equations of motion are given by, mx" + Dcos(alfa) = 0 my" + Dsin(alfa) + mg = 0 where D = .5*Cd*A*rho(y)*v^2 alfa = atan(y'/x') and rho() is a variable atmospheric density w.r.t. altitude. Parameters: m = 20 kg Cd = .3 A = .02 m^2 g = 9.80665 m/s^2 Initial values: x = 0 m y = 0 m v = 180 m/s alfa = 40 deg Rules: Solution must be general; trial and error methods based on apriori knowledge of the solution range do not qualify. Feel free to use external software resources as well as the "Trajectory" example on our "Application profiles" page as a convenient guideline. Criteria: a) Execution time b) Size of executable Submit: Executable module (show final angle and distance), main program text file and indicate the integration and optimization algorithms used. e.g. Levenberg-Marquardt (netlib). All entries must be received by March 31, 2000. The best entry in each language will be posted on our site to serve as a barometer for those pondering what language to choose for their technical computing. It might also double as a place where flame war enthusiasts can calibrate their rhetoric against the realities of feasible solutions. The overall winner will receive: Compaq Visual Fortran V6.1 -- Professional Edition SDX Modeling and Simulation Software V3.0 as a special recognition for demonstrated skills in crafting the fastest solution with a smallest footprint. Questions regarding the contest should be directed to info at sdynamix.com with Contest 2000 in the "Subject" line. ----------------------------------------------- Modeling * Simulation * Analysis http://www.sdynamix.com ----------------------------------------------- From effbot at telia.com Wed Feb 9 08:27:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 13:27:39 GMT Subject: make BSD No such file or directory Error code 1 References: <87rekg02lfv@enews4.newsguy.com> Message-ID: wes wrote: > ./importdl.c:269: mach-o/dyld.h: No such file or directory I wrote: > it's official declared as a mystery; some hints > (but no verified solutions) can be found in the > "support archive": the eff-bot's was sloppy; in the following post, Nigel Head tells you how he worked around this problem: http://www.deja.com/=dnc/getdoc.xp?AN=538326712 From gmcm at hypernet.com Thu Feb 24 17:58:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 24 Feb 2000 17:58:18 -0500 Subject: Passing arguments by value... In-Reply-To: Message-ID: <1260689396-5933856@hypernet.com> John F. Brainard wrote: > I'm working on a set of HTML Layout classes for CGI programming > in Python and have stumbled upon a small problem... > > The sample code below should be self explanitory... > > #begin python code > html = body.Body() > > font1 = tags.Font(4, "Arial", "#FF0000") > font1.addText(string.strip(""" > Some text would go in here. > """)) > > html.addElement(font) > > font1.clearText() > font1.addText(string.strip(""" > Some other text here. > """)) > > print "" + str(html) + "" > #end python code > > After I create the font1 object and set it's properties, I add it > to the html object. Then, I change the text and add it again to > the html object. What I get as the output is... > > #Begin HTML here > > > > Some other text here. > > > > Some other text here. > > > #End HTML here > > Is there a way to copy the font object or pass it by value rather > than reference to the addElement() function? You have a couple alternatives. Make font.__repr__ return "...." and do html.addElement(repr(font1)). Or just use a new instance of font for each separate element, (and drop the clearText method). - Gordon From effbot at telia.com Tue Feb 29 15:59:28 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 20:59:28 GMT Subject: comp.lang.python: more traffic than ever before Message-ID: this month, comp.lang.python has seen nearly 50% more posts than any month before: http://www.egroups.com/group/python-list/info.html http://starship.python.net/crew/just/FindMailStats/ From cpatti at atg.com Mon Feb 28 13:15:53 2000 From: cpatti at atg.com (chris patti) Date: 28 Feb 2000 13:15:53 -0500 Subject: Python program examples References: <38BA5DC6.A83448DF@computer.org> Message-ID: Eugene Kelly writes: > I am looking for neat little examples of Python programs for an intro. > programming course I am currently giving to business students. We are > working in a MS Windows 98 environment. If you have any examples to hand > that you would be willing to share please send them to me directly. > Programs should be small i.e. < 100 lines max and < 50 would be best. > Thanks in advance, > Eugene. Check out the Python snippets archive - just pointed out to me today: http://tor.dhs.org/~zephyrfalcon/snippets/ Also check out 'The Vaults' at: http://www.vex.net/parnassus/ Good luck! -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From alex at somewhere.round.here Thu Feb 24 17:18:00 2000 From: alex at somewhere.round.here (Alex) Date: 24 Feb 2000 17:18:00 -0500 Subject: Backreference within a character class References: Message-ID: > I want to match "XIX" but not "XXX" or "WOW" but not "WWW". This seems to do the trick: import re matcher = re.compile(r'(.)(?!\1).\1').match print matcher('XAX') print matcher('XXX') Alex. From tim_one at email.msn.com Mon Feb 21 11:37:37 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 21 Feb 2000 11:37:37 -0500 Subject: Continuations Made Simple (hopefully) and Illustrated Message-ID: <#zkz$nIf$GA.323@cpmsnbbsa03> [Denys Duchier, posts a Python propositional tautology checker using Continuation Passing Style; Tim posts a variant in "straight Python", then sez... ] > People are invited to play with both and do the "compare & > contrast" bit for themselves . I don't think either > version is a pure win on all counts, but the CPS version > certainly has attractions! Here's one very special attraction of the CPS version: it works <0.1 wink>. The thing I posted was simply a greedy recursive search. So "the first" assignment of values to vars "that works" is taken at each level of the expression, and if a successful assignment to one subexpression X is such that a later subexpression Y fails, there's no backtracking to try a different set of assignments in X (that may allow Y to succeed too). An example is the expression: OR(AND(P, NOT(P)), NOT(P)).isValid() Falsifying that requires falsifying both AND(P, NOT(P)) and NOT(P). Falsifying AND(P, NOT(P)) requires falisfying either P or NOT(P). My program falsifies P (i.e., sets P to 0), then goes back up to the top expression, and sees that it's impossible to falsify NOT(P) when P is 0. It therefore reports that the whole expression can't be falsfied (i.e., is valid). That's incorrect. When it failed to falsify NOT(p), it *should* backtrack to AND(P, NOT(P)) and try falsifying the NOT(P) half of that instead. Then it would set P to 1, and go on to discover that P=1 also falsifies the RHS of the original expression too, so that P=1 falsifies the entire expression. So my version failed to capture the most important feature of the CPS version -- keep that in mind when you "compare & contrast" . chastenedly y'rs - tim From timd at macquarie.com.au Tue Feb 29 17:13:00 2000 From: timd at macquarie.com.au (Timothy Docker) Date: Wed, 1 Mar 2000 09:13:00 +1100 (EST) Subject: catching X client kills in Tkinter In-Reply-To: <20000229092115.A3766475@vislab.epa.gov> References: <20000229092115.A3766475@vislab.epa.gov> Message-ID: <14524.17034.195523.421444@qad16> Randall Hopper writes: > |Is it possible to catch the failure of a Tkinter based application > |when the server connection is closed (ie under X11 and unix). > > For close (typically bound to the "X" window manager icon): > > top.protocol( 'WM_DELETE_WINDOW', MyCleanupFunct ) > > I don't know if you can catch an X kill (maybe with signal handlers, unless > it materializes as a SIGKILL or another uncatchable signal). Unfortunately this doesn't catch the situation where the X server exits, or forcible closes the socket connection (done byt the xkill command). There seems to be no direct way to do this with Tkinter at present. At the Xlib level, the only way to catch it is with the call XSetIOErrorHandler(...) Unfortunately Xlib exits when (if) this call returns. I have seen longjmp used to resolve this issue, but longjmp isn't practical in a python environment. Nevertheless since I only want to clean up before exiting, this is ok for me. Basically I just wrapped this function in it's own python->C dynamic module, such that it calls a python callback when an IO error occurs, before exiting. Tim From patrick-lewisNOpaSPAM at yahoo.com.invalid Tue Feb 1 12:19:17 2000 From: patrick-lewisNOpaSPAM at yahoo.com.invalid (plewis) Date: Tue, 01 Feb 2000 09:19:17 -0800 Subject: Tkinter and OpenGL References: <3896A132.E3571243@cui.unige.ch> Message-ID: <18682648.88db7216@usw-ex0102-084.remarq.com> In article <3896A132.E3571243 at cui.unige.ch>, Sunil Hadap wrote: >Hello, > >Is it possible to use OpenGL with Tkinter and Pmw, any experiences. Yes, using Tkinter with OpenGL is possible. Check out David Aschner's PyOpenGL at: http://starship.python.net:9673/crew/da/Code/PyOpenGL With it, you can create an Tkinter OpenGL widget that you can draw into. I have used Pmw with an application that used PyOpenGL, but did not interface the two directly (didn't need to). No reason you couldn't, though. The widget is very clean and straightforward. >Other option is FLTK but at a first glance pyFLTK is not matured. What >about python with wxWindows or Qt and it's support for OpenGL. I believe there are bindings for GTK+, and wxWindows. I am not sure about Qt. I couldn't get GTK+ or wxWindows to compile properly with the OpenGL extensions, however. (I know, personal problem ;-) ). I have had some success with the Fox toolkit and FXPy. It has some useful widgets, an interesting message passing mechanism, and looks better than Tk (IMHO). http://www.cfdrc.com/FOX/fox.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 skip at mojam.com Fri Feb 18 16:54:59 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 18 Feb 2000 15:54:59 -0600 (CST) Subject: python online help? In-Reply-To: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov> References: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov> Message-ID: <14509.49075.215941.665626@beluga.mojam.com> Benyang> Is there a online help in python? Say something like Benyang> help print Benyang> would give document of the print command. Not quite. Many objects have documentation strings you can display during an interactive session: >>> import string >>> print string.__doc__ A collection of string operations (most are no longer used in Python 1.6). ... >>> print string.join.__doc__ join(list [,sep]) -> string Return a string composed of the words in list, with intervening occurences of sep. The default separator is a single space. (joinfields and join are synonymous) Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From thomas at xs4all.net Thu Feb 10 04:11:36 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 10 Feb 2000 10:11:36 +0100 Subject: about the multiple posts In-Reply-To: <20000208173046.A7310@networksplus.net>; from moeller@networksplus.net on Tue, Feb 08, 2000 at 05:30:46PM -0600 References: <87nklj$ct9$1@nnrp1.deja.com> <389F738E.6C47BD6F@bellsouth.net> <20000208173046.A7310@networksplus.net> Message-ID: <20000210101136.D477@xs4all.nl> On Tue, Feb 08, 2000 at 05:30:46PM -0600, Derek Moeller wrote: > On Mon, Feb 07, 2000 at 08:38:23PM -0500, Xenophanes wrote: > > if you want, but Netscape is the best you will find. > MUAFlameWar!!! > ..though tis hard to bring about battles in c.l.py if it's not about > whitespace... Normally I'd agree, c.l.py is a place for openness, free flow of ideas, and very weird tastes as well as the mainstream one. Live and let die, in peace, regardless of success or popularity, and that 'for heavens sake lets all keep an open mind' attitude. I try to be very tolerant towards a lot of things (unfortunately, i'm also loudmouthed and arrogant, so people dont notice it when i'm tolerant ;P But Netscape is just bloody too inviting a target! The only thing good(*)ish thing about Netscape is that it is incredibly feature-rich. However, this starts all kinds of warning lights in my head, and that creeping 'oh-my,-that's-*godda*-be-horrible-code' feeling i always get when i see advanced cases of featuritis. I'm afraid to upgrade my netscape, nowadays, fearful of whatever features i have to identify and turn off once i get it running ;P And using Netscape for mail and news really goes too far. Maybe it's the best choice for Windows users; I've seen the problems people at work have with Eudorka and Pegasus and such, and how they are very casual with the conventions, if not the standards, that ruled the mail world before they came 'round. But if Netscape is the best choice, I'd suggest someone build a real mail and/or news client, for windows users. Using Python, of course. *) Good in a technical, nerdy sense, as in a reason to use it. Netscape has been very good for the World Wide Web, of course, which in turn has been very good for the internet in general, which indirectly gave me this job. To be truthful, i probably would've gotten this job regardless of the success of the web (i can remember gopher!) but it wouldn't be as much fun ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From gerrit.holl at pobox.com Sat Feb 12 04:40:41 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 10:40:41 +0100 Subject: Offtopic, offtopic, offtopic! In-Reply-To: ; from mwh21@cam.ac.uk on Thu, Feb 10, 2000 at 11:58:43PM +0000 References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> <38A28055.D8F187EB@inka.de> <38A34199.BF367B98@americasm01.nt.com> <20000210181818.A3770@better.net> Message-ID: <20000212104041.B1007@stopcontact.palga.uucp> Michael Hudson wrote on 950223523: > William Park writes: > > > Terminating a block with 'end..' like Bourne Shell is what I initially > > expected from Python. But, indentation is okey too. > > > > Guido is not going to move on this issue. So, please kill this thread! > > Hmm, that's what I've been doing all along... You seem to read it like me, though! regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From Richard.Jones at fulcrum.com.au Thu Feb 10 18:04:58 2000 From: Richard.Jones at fulcrum.com.au (Richard Jones) Date: Fri, 11 Feb 2000 10:04:58 +1100 Subject: Proposal: Official whitespace response Message-ID: <200002102304.KAA08105@envy.fulcrum.com.au> Could we please maybe mandate an "Official Response" to the weenies constantly posting about whitespace in Python? Something like: ------- Subject: Official Response [Re: ] From: some_python_regular Guido van Rossum, the creator of Python, is not going to change this fundamental aspect of Python. We don't want him to. We all like it. If you wish discussion on this topic, please read the mailing list / news group archives regarding the topic first: http://www.dejanews.com/dnquery.xp?DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=thre aded&showsort=date&maxhits=100&groups=comp.lang.python&QRY=whitespace Any further messages with the subject line " " will be ignored. ------- Suggestions welcome :) Richard From effbot at telia.com Sun Feb 13 05:02:20 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 10:02:20 GMT Subject: Python aka. Smalltalk Lite? References: <001001bf75a0$0441c6e0$7c2d153f@tim> Message-ID: Tim Peters wrote: > I don't subscribe to the "random bag of features" school of language > comparison. Programming Python will never *feel like* programming in > Smalltalk, so True Smalltalkers will never feel truly at home in Python. hey, isn't superficial differences what everyone's interested in these days? after all, once we add braces to Python, it'll be exactly like interpreted C, right? ;-) (for the kind of stuff I was fishing for, see bijan's and markus' posts). From emile at fenx.com Sat Feb 12 17:28:52 2000 From: emile at fenx.com (Emile van Sebille) Date: Sat, 12 Feb 2000 14:28:52 -0800 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: <017e01bf75a8$8f2b5340$01ffffc0@worldnet.att.net> Simply re-wire the keyboard by cutting the etch for the semi-colon and crossing it over to the colon, then go cold-turkey. it's-an-annoying-bad-habit-isn't-it-ly y'rs Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: osorronophris osorronophris Newsgroups: comp.lang.python To: Sent: Saturday, February 12, 2000 2:11 PM Subject: breaking the ; habit > I'm a die-hard C++ programmer that recently took up Python for a change of > scenery and am enjoying it greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've tried chewing gum but it > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? > > Regards, > Ryan > -- > http://www.python.org/mailman/listinfo/python-list > From gmcm at hypernet.com Fri Feb 25 08:28:16 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 25 Feb 2000 08:28:16 -0500 Subject: system return status on Windows In-Reply-To: <38B63317.1A0A1C3D@nembv.cz> Message-ID: <1260637198-9073474@hypernet.com> Milos Prudek wrote: > Great, thanks. Could you send something about mode (magic operational > constant) of spawnv? I do not have Visual C++ Runtime Library > documentation... P_WAIT obvious P_NOWAIT ditto P_NOWAITO same as P_NOWAIT apparently P_OVERLAY like fork() without exec() (except slower) P_DETACH background - no opportunity to interact with anything. - Gordon From jari.oksanen at helsinki.fi Mon Feb 7 03:24:31 2000 From: jari.oksanen at helsinki.fi (Jari Oksanen) Date: Mon, 07 Feb 2000 10:24:31 +0200 Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> <389E35EE.F8383238@austin.rr.com> Message-ID: <389E813F.CEA9BE7D@helsinki.fi> Fredrik Lundh wrote: > > Daniel Weber wrote: > > I've got 4.0 and it still won't print. Bummer... > > what platform? what error messages do you get? > > (you're not exactly the first one who has down- > loaded the document, but you're the first one > claiming acrobat 4.0 cannot print it...) > > I am another. However, I had problems only in Linux (acroread 4.0). Specifically, the problem was that text did not fit in the table cells and was partly overwritten. The file printed smoothly in Acrobat Reader 4.0 under Windows, though. My wild guess is that the problems were caused by the True Type fonts used in the document, and I haven't bothered to install those. So the solution could be (if the problem is the same) to either install True Type fonts or go to a Windows machine. -- J.Oksanen -- UHLA (University of Helsinki at Lahti) ? Find books on "hyalosphenia" at bn.com. ? Search for news on "hyalosphenia" at Individual.com. ? Research "hyalosphenia" at AtHand Yellow Pages. From a.eyre at optichrome.com Mon Feb 7 06:14:18 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 7 Feb 2000 11:14:18 -0000 Subject: An FTP based Python Module repository (was Re: Imagemagick) In-Reply-To: Message-ID: <001001bf715c$7a1bb7b0$3acbd9c2@peridot.optichrome.com> > there are *lots* of tools out there to mirror web- > sites. all it takes from the website is to make sure > that everything is visible via plain links, and tools > like python's "websucker" can to the rest. without > you being present. It's still easier if the website's files are available via ftp. Make the job of mirroring easier (no link-chasing), and makes sure all files are transferred (including unlinked documents). If the guy running parnassus could provide an ftp interface to the website, this should be good enough. I still think the idea of perl's "install someModule" is a bit suspect anyway. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From dcinege at psychosis.com Sat Feb 19 14:55:40 2000 From: dcinege at psychosis.com (Dave Cinege) Date: Sat, 19 Feb 2000 14:55:40 -0500 Subject: small python implementation or python subset ? References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> <38A282D0.2487CA89@sxb.bsf.alcatel.fr> <38A2A55C.F16C61E@equi4.com> Message-ID: <38AEF53C.57000DA3@psychosis.com> Jean-Claude Wippler wrote: > > You can add "SLOPPY" to that list - SourceLess One Package Python :) > > I've been hacking away at creating a smaller Python core which can be > deeply embedded in various contexts. It runs .pyc files, and is pretty > small (especially when upx-compressed, I'll save the conclusions for > when this stuff is ready for public consumption). > > I invite everyone who has worked on this to send patches (or modified > sources, but please get in touch first, to avoid useless repetition). > End of this month, I'll integrate it all into a single patch set, ready > for evaluation and hopefully acceptance into the Python core as a set of > #ifdef's (like the current #define WITHOUT_COMPLEX). No promises, but > I've brought this up and gotten a basic go-ahead from, eh, management :) > > Alternately, if someone else is almost there, please step forward so > that we can exchange notes and get this stuff over and done with. How small have you gotten one? I run the Linux Router Project, which pumps a very full Linux OS into a ~1.5mb of compressed space. Right now. the scripting is all done with ash (not bash!) sh shell, and sed. I've gotten very far with just these, but it may be worth going with a minimallist python, if it's small enough. From effbot at telia.com Mon Feb 14 11:22:26 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 17:22:26 +0100 Subject: BSDDB copyright and licensing restrictions while in use viaPython References: Message-ID: <00bd01bf7707$afff8c20$34aab5d4@hagrid> Oleg Broytmann wrote: > > if you prefer to use free and IMHO better data- > > base engines, check out metakit (www.equi4.com) > > or gadfly (www.chordate.com). > > Any information on what ways these are "better" than Berkeley DB? Any > pointers, at least? humbly speaking: metakit: fast, efficient, small, highly portable, great python interface, and free. gadfly: mostly python, real query language, great python interface, and free. which one to pick depends on the application, but I strongly doubt that there's any kind of application for which bsddb 1.85 comes out on top. From sanderson at ttm.com Tue Feb 22 17:55:18 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 22 Feb 2000 17:55:18 -0500 Subject: Porting Python to non-pc platforms References: Message-ID: <38B313D6.AD23EAB2@ttm.com> Not having Python on the 400 is the only thing preventing us from standardizing on it here as a development language at this point. We don't have the C compiler either. Regards, -scott JGRAVES3 at austin.rr.com wrote: > > I would like this very much. My AS/400 doesn't have a C compiler or I > would give it a shot. As soon as I get the time, I'm going to try JPython > on my AS/400 tho. I'm glad at least on other person on here has heard of > the AS/400. > > Jay > From reic0024 at ub.d.umn.edu Mon Feb 14 12:15:19 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Mon, 14 Feb 2000 11:15:19 -0600 Subject: Simple client/server exchanging objects In-Reply-To: <38A80085.AECFF9EC@bibsyst.no> References: <38A80085.AECFF9EC@bibsyst.no> Message-ID: You could check out dopy or Python if CORBA is overkill and you don't want to start from scratch -- They're both listed on the Vaults of Parnassus at: http://www.vex.net/~x/parnassus/apyllo.py/126307487.549099265 Aaron From Denys.Duchier at ps.uni-sb.de Fri Feb 25 15:02:47 2000 From: Denys.Duchier at ps.uni-sb.de (Denys Duchier) Date: 25 Feb 2000 21:02:47 +0100 Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> <38B69C6D.3E7C17D2@bellatlantic.net> <38B6AD20.696990CB@bellatlantic.net> Message-ID: Steve Holden writes: > I was thinking more of the need for stack traceback when errors were > detected. I agree that a call at the end of a try block is not a > tail call. I am just concerned that tail call optimization would lose > important debugging context unless you substitute some mechanism which > retains the required information, which would defeat the point of the > optimization. Uncaught exceptions are handled at main level, and > need full dynamic context. > > Or have I missed something? No, you are quite correct, but your concern is more about error reporting (for debugging purposes) than about exception handling. In defense of tail call optimization, I might (very cautiously) offer the following 2 arguments: * as I believe you go on suggesting in another message, if one regards tail call optimization as _just_ an optimization, then nothing stops you from turning it off when debugging. * tail call optimization is less damaging to debugging than is commonly believed. The reason is that you only loose those intermediate frames where what is being computed no longer (locally) matters (or else they would not be a tail calls). Personally, I rather like getting just the highlights in my tracebacks and I have never come across a case where the lost information would have made a significant difference. A non-expert programmer might feel differently. on the other hand, continuations are hell to debug no matter what :-) The point, however, is moot since, as I suggested previously, the finalization semantics of Python (much like that of C++) are not easily reconciled with tail call optimization. Sincerely, -- Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de Forschungsbereich Programmiersysteme (Programming Systems Lab) Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier Postfach 15 11 50 Phone: +49 681 302 5618 66041 Saarbruecken, Germany Fax: +49 681 302 5615 From coulson.chris at virgin.net Tue Feb 15 14:55:26 2000 From: coulson.chris at virgin.net (Chris Coulson) Date: Tue, 15 Feb 2000 19:55:26 -0000 Subject: Time Check Message-ID: <88cb0n$8du$1@nclient11-gui.server.virgin.net> Is there a command so that you can check a time. I need to create a program to work on a RISC platform that is triggered after a certain date. From effbot at telia.com Sun Feb 27 16:14:02 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 21:14:02 GMT Subject: win32 IDE References: <38B99B4C.4F26226F@sightreader.com> Message-ID: Ken Seehof wrote: > You should join the IDE-SIG, which unfortunately does not yet exist. http://www.python.org/sigs/progenv-sig/ From sabren at manifestation.com Fri Feb 18 16:19:02 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Fri, 18 Feb 2000 16:19:02 -0500 (EST) Subject: how to turn arbitrary binary string into unix filename? In-Reply-To: <00Feb18.122230pst."3872"@watson.parc.xerox.com> Message-ID: On Fri, 18 Feb 2000, Bill Janssen wrote: > I'm sort of surprised that there doesn't seem to be any standard way > to take a binary string in Python and turn it into a text string > suitable for a UNIX filename. This is handy if you are trying to map > data to filenames, for instance; you take the MD5 hash of the data, > for instance the Message-ID of a mail message, convert it to an ASCII > string (typically by hexifying it), and use that as the filename. But > after half an hour of poking around, I can't see a standard method > that one can call to hexify a string. Hey Bill, This code takes a binary string and converts it to a hexidecimal representation. (It doubles the length but only uses the characters 0-9 and a-f) def hexify(binaryString): result = "" for i in binaryString: result = result + string.zfill(hex(ord(i))[2:],2) return result Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From fritz.heinrichmeyer at fernuni-hagen.de Tue Feb 1 05:05:54 2000 From: fritz.heinrichmeyer at fernuni-hagen.de (Fritz Heinrichmeyer) Date: Tue, 1 Feb 2000 11:05:54 +0100 Subject: programming for children Message-ID: <876emj$kco$1@oak.fernuni-hagen.de> My son is 11 years and wants to learn programming. He heared about java at school (cool like nike or adidas ...) but in my opinion this is very hard stuff for a beginner to bring anything to play. I thought of a nice python environment under windows ... It would be best to have german documentation too. What do you think? --- Fritz Heinrichmeyer mailto:fritz.heinrichmeyer at fernuni-hagen.de FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany) tel:+49 2331/987-1166 fax:987-355 http://ES-i2.fernuni-hagen.de/~jfh From rickhigh at aol.com Tue Feb 1 03:20:08 2000 From: rickhigh at aol.com (RICKHIGH) Date: 01 Feb 2000 08:20:08 GMT Subject: JPython 1.1 final References: Message-ID: <20000201032008.27139.00000919@ng-ca1.aol.com> Awesome From Vladimir.Marangozov at inrialpes.fr Mon Feb 14 13:57:37 2000 From: Vladimir.Marangozov at inrialpes.fr (Vladimir Marangozov) Date: Mon, 14 Feb 2000 19:57:37 +0100 Subject: Real Problems with Python References: <000d01bf7668$84028fe0$572d153f@tim> Message-ID: <38A85021.AB82DB06@inrialpes.fr> Tim Peters wrote: > > [NeelK] > > In the long run, the solution is to use a conservative garbage > > collection algorithm (such as the Boehm collector), > > [Tim] > > "No chance" in CPython [...] > > [Fran?ois Pinard] > > I'm not sure of the implications of the above, but one sure thing > > is that I very much like the current implications of reference > > counting. When I write: > > > > for line in open(FILE).readlines(): > > > > I rely on the fact FILE will automatically get closed, and very soon > > since no other references remain. ... > > Yes, that's exactly the kind of thing that makes many CPython users > consider RC to be "a feature". There's no reason at all to believe > that CPython will ever give this up; even NeilS's BDW patch for CPython > retains refcounting, simply for *speed* reasons (RC has excellent > locality of reference, especially when trash is being created and > recycled at high dynamic rates). > That last one is a good one. So far, nobody has shown any evidence that LOR is good or bad when different objects are involved (except, I remember, some special cases like iterating over ints that happen to be allocated close to each other). Better yet, nobody _can_ show such evidence as far as one stays on top of a virtual memory manager. make-that-simply-"RC-is-faster-than-the-alternatives"-- -and-I'll-take-it-ly y'rs -- Vladimir MARANGOZOV | Vladimir.Marangozov at inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252 From claird at starbase.neosoft.com Fri Feb 11 22:55:21 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 11 Feb 2000 21:55:21 -0600 Subject: Interpreted C (was: Python sucks loud) References: <200002112329.SAA01742@seanb.sttln1.wa.home.com> Message-ID: In article <200002112329.SAA01742 at seanb.sttln1.wa.home.com>, wrote: . . . >If you really want a C-like scripting language, I have two suggestions >for you: JavaScript or Pike. . . . >place to look (again, I don't know Pike much - maybe someone else here >knows more about it. > >A good place to look for Pike info is the Pike homepage, >http://pike.idonex.se . . . discusses Pike. There are actually several interpreters for C or near-C; examines another. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From gerrit.holl at pobox.com Wed Feb 23 09:35:26 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 15:35:26 +0100 Subject: functional programming In-Reply-To: ; from scarblac-spamtrap@pino.selwerd.nl on Wed, Feb 23, 2000 at 09:22:42AM +0000 References: Message-ID: <20000223153526.B2858@stopcontact.palga.uucp> > Michal Wallace (sabren) wrote in comp.lang.python: > > I guess my original question had to do with what functional > > programming looks like in the wild, and what it might look like in > > python. Aahz posted a recursive version of a fib() routine. Is this > > not what you'd want? What would fib() look like in one of the > > functional languages you're used to? > > Michael Hudson posted this little bit of Haskell last week: > > fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ] > > I can't translate that to anything resembling Python at all. I don't > know if list comprehensions in Python will be/are this powerful. Well, you can just write a class doing it. # pseudo-code def fib(...): ... class Fibonacci: def __getslice__(self, start, stop): return fib(start, stop) def __getitem__(self, item): return fib(0, item) ... regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From jima at aspectdv.com Thu Feb 3 12:59:26 2000 From: jima at aspectdv.com (Jim Althoff) Date: Thu, 03 Feb 2000 09:59:26 -0800 Subject: switch to JPython In-Reply-To: <38999696.BC2CC281@beasys.com> Message-ID: <4.2.0.58.20000203094939.00d23740@mail.aspectdv.com> We have a growing development group that does all application development in JPython. We take extensive advantage of Java API's'. Our user interfaces, for example, are all Swing-based and coded in such a way that they run either standalone or as applets. We get tremendous leverage from using the Java API's. And I believe that our productivity in using JPython instead of pure Java for the ap.s is possibly 2x better. Debugging tools in JPython could use some improvement. I have found that pdb works to a limited extent. pdb works fairly well when you are doing non-GUI things. But if you are using Swing, as soon as you create a JFrame and the Swing event handler takes over, pdb breaks. So I use a combination of pdb (for debugging code that can be tested without a Swing GUI running) and a combination of the JPython interactive interpreter and print statements for everything else. Jim At 02:54 PM 2/3/00 +0000, PHO Van Son wrote: >Hi, > >I like Python a lot. >For my job, I code more and more with Java. So, I am wondering if it is >better for me to switch to Jpython. >The problem is that AFAIK that JPython doesn't have debugger (like pdb), >and I am now used to Tkinter, may be i have to learn swing and awt (and >i am afraid i have enought time) > >I would like if anyone having experience in JPython giving me advice. > >Thanks. >PHO Van Son > >-- >http://www.python.org/mailman/listinfo/python-list From cjensen at be-research.ucsd.edu Wed Feb 9 16:13:09 2000 From: cjensen at be-research.ucsd.edu (Curtis Jensen) Date: Wed, 09 Feb 2000 13:13:09 -0800 Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> Message-ID: <38A1D865.3C7976CD@be-research.ucsd.edu> Fredrik Lundh wrote: > > Justin Sheehy wrote: > > > Why not just use the max method? > > > > > > a = max(x,y) > > > > Well, the original poster's question was for something equivalent to > > their use of C's ?: ternary operator. max() is not equivalent to that. > > umm. to be precise, he asked for something equivalent to > "the C command a = x > y ? x : y". I'd say "a = max(x, y)" > is a pretty good approximation ;-) > > (sure, the x and y *names* are both evaluated, but they're > references, and the corresponding objects are not affected > in any way...) > > a = max(x,y) is what I was looking for. Thanks. Some days it's just hard to see the obvious. -- Curtis Jensen cjensen at be-research.ucsd.edu http://www-bioeng.ucsd.edu/~cjensen/ FAX (425) 740-1451 From aahz at netcom.com Wed Feb 23 23:11:45 2000 From: aahz at netcom.com (Aahz Maruch) Date: 24 Feb 2000 04:11:45 GMT Subject: 1000 GUI toolkits (was Re: Tkinter vs. wxPython) References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> Message-ID: <892b21$127$1@nntp6.atl.mindspring.net> In article <5l3dqjckt5.fsf_-_ at eric.cnri.reston.va.us>, Guido van Rossum wrote: > >I've always said, with chairman Mao, "let 1000 flowers bloom" -- there >aren't quire 1000 different GUI toolkits, so there's still room for a >few more. In the mean time, it's likely that the big three will be >Tkinter, wxPython and gtk. (I haven't really used gtk yet -- for now >it sounds too Linux-centric even though it has a Windows port). You skipped one: HTML (Okay, so I'm half-joking. But I really do have a strong preference for HTML as my UI of choice, not least because it allows a text-based interface.) -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From tim_one at email.msn.com Sun Feb 20 14:14:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 14:14:29 -0500 Subject: Could embeded Python echo evaluation? References: Message-ID: [Kim Jeong Ju] > When you run Python in console mode, you can see result string after > evaluation without any explicit print command. > > >>> 3 + 4 > 7 > >>> dir > > > But embeded Python doesn't show its result string. > You should specify 'print' command to see the result as in > console mode. > ... > Why this behavior happens? Python used to (many years ago) automagically display non-None expression results in both interactive and batch modes. There were many complaints about this behavior in batch mode, especially from people chaining methods for side effects; e.g., myPoint.moveRight(2).moveUp(6).changeColor(RED) where each method of myPoint returns "self". This is a pretty common style. > Are there any way to let Python echoing result automatically > in embeded version? No, not anymore. The function com_expr_stmt in compile.c compiles different code depending on whether you're in batch or interactive mode. In the batch case it compiles code to throw away the expression result; in the latter case it generates the PRINT_EXPR opcode that implements the interactive-mode magic. From mwh21 at cam.ac.uk Wed Feb 2 10:45:30 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 02 Feb 2000 15:45:30 +0000 Subject: Am I programming in Python mode? References: <4TCYOB7LsZetOVPsMbGsNhmZpfcB@4ax.com> <38984D06.7A44BF90@lockstar.com> Message-ID: Mordy Ovits writes: > > for i in range(0, n): > string.append(random.choice(string.letters)) I thought of that, but string.lowercase on my system contains lots of accented characters, and I thought what I posted was closer in spirit to the original effort. It also depends if you count ? (e-acute) and e (plain e) as different in this sense too - because if you don't then the resulting string will contain too many of some letters, vowels in particular - there are 10 different sorts of e in my string.letters - and allowing for that is/was more than it's worth farting about with for one USENET post. Cheers, M. PS: Your code has a stereotypical Python gotcha in it... From neilh at hare.net.au Fri Feb 18 07:37:26 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Fri, 18 Feb 2000 23:37:26 +1100 Subject: Killer Apps??? References: <001401bf79dd$c0445420$e62d153f@tim> Message-ID: <00ae01bf7a0c$ea943180$01646464@computer> > It would be immodest of me to mention tabnanny.py, which is likely the last > word in automated detection of tab/space inconsistencies in worlds with a > countable infinity of tab settings. I wish this 'last word' quality of tabnanny.py had been made clear earlier as I have been attempting to better tabnanny. Hubris, I know, but my problem with tabnanny is that people do not use it often enough allowing the nanoviruses to consume large amounts of whitespace before being detected. To counteract this slackness, I have constructed a tabnanny-like agent called TabTimmy that continuously monitors source code and marks bad indentation. This feature is available in the current beta version of my SciTE demonstration editor. http://www.scintilla.org/SciTE.zip This may even go into PythonWin if I can convince Mark to take it seriously. Neil From not at at.home Fri Feb 11 15:17:54 2000 From: not at at.home (Stein M. Eliassen) Date: Fri, 11 Feb 2000 21:17:54 +0100 Subject: Python sucks loud References: Message-ID: <38A46E72.DED117E2@at.home> I guess the troll forgot the medical treatment today. Maybe he escaped his wardens...for now... From J.C.Travers at durham.ac.uk Fri Feb 18 08:40:22 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Fri, 18 Feb 2000 13:40:22 +0000 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC150E.FA51B9E3@durham.ac.uk> <38AC3968.39E53E20@durham.ac.uk> Message-ID: <38AD4BC6.F265F48D@durham.ac.uk> Vetle Roeim wrote: > > * Fredrik Lundh > > J.C.Travers wrote: > > > No, I've tried Tkinter, PyQT, wxPython, some pyGTK. What I really meant > > > was that in terms of the usual quality of interfaces to python modules, > > > > > > Tkinter is the worst I have seen. > > > > you mean > > > > widget = WidgetFactory(master, options...) > > widget.manager(geometry options) > > > > is the worst GUI interface you've seen? that's > > a rather unusual attitude. please elaborate. Yes, it really is. The example you give isn't comprehensive enough to demonstrate. But The code layout of a functional app, with a menu, toolbar, statusbar and then whatever view you put inside, in MY OPINION does. I like a simple, elegant object-oriantated approach. Thats why I like python. Now I haven't used Tkinter a lot, I was put off rather quickly by the whole Tcl idea. (i.e. it being a wrapper around another language), So maybe I am not qualified, I have however written a few little apps in it and then re-written them in PyQT or wxPython, and found them much more statisfying. Cheers, John From garry at sage.att.com Tue Feb 8 14:20:56 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Tue, 8 Feb 2000 19:20:56 GMT Subject: mail filter in python? References: <20000208000902.31713@nms.otc.telstra.com.au> <20000207154641.A2817@stopcontact.palga.uucp> Message-ID: <38A06C98.9B2ECA2A@sage.att.com> Fran?ois Pinard wrote: > > What about creating a mail filter with a Python syntax? Shouldn't be too > > difficult, just create some functions (drop, match_header) and execfile() > > a file with the rexec module... > > Do not underestimate what `procmail' does. It has a _lot_ of features, and > was debugged over many years, by a rather careful programmer. Of course, > one may try and do better, this is often how programs evolve. But the > overall problem might much, much more obfuscated than procmail syntax :-). that's two people who've pointed out the difficulty in getting it right. perhaps a better approach is to build yourself a python syntax to generate the crufty procmail syntax. -- 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 boud at rempt.xs4all.nl Wed Feb 9 10:29:10 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 9 Feb 2000 15:29:10 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> Message-ID: <87s146$b2e$1@news1.xs4all.nl> Paul Prescod wrote: > Weirdo syntaxes also do not help. Python's syntax is a little weird. But > Smalltalk, Lisp and (now) Rebol seem to go out of their way to > antagonize Algol-family-trained programmers. > > If it takes more than fifteen minutes to retrain the eyes from the old > language to the new language, most programmers will never make the jump. > Why would they, when there are already too many languages to learn that > do not demand eyeball retraining? This is very true - in fact, when I first took a look at Python I thought the syntax was so weird I didn't have to take a second look. It was Neel who told me not to be silly. After that I had the whitespace problem - for about five minutes. A month of happily coding CGI scripts later I thought that Python didn't have the rich variety of GUI toolkits I needed... Seriously, the only problem I still have, occasionally, is grasping the lazy typing concept. I like to declare my data structures, and I often create classes as if they were Pascal records or COM interfaces ;-). -- Boudewijn Rempt | http://www.valdyas.org From jam at quark.internal Thu Feb 24 19:51:50 2000 From: jam at quark.internal (Jeff) Date: Thu, 24 Feb 2000 19:51:50 -0500 Subject: pythonware.com - cannot access In-Reply-To: <894iuc$qi1$1@news.udel.edu>; from tjreedy@udel.edu on Thu, Feb 24, 2000 at 07:46:29PM -0500 References: <894iuc$qi1$1@news.udel.edu> Message-ID: <20000224195150.A3588@quark.internal> On Thu, Feb 24, 2000 at 07:46:29PM -0500, Terry Reedy wrote: > For a couple of weeks, at least, I have been unable to access > http://www.pythonware.com/ > or pages beneath from Delaware USA, with Win98 IE5.01. > This is the only presumed-to-be-good site that I am having problems with. > Anyone else having a similar blockage? > > Terry J. Reedy > I am not currently having a problem reaching www.pythonware.com, nor am I having trouble reaching your dialup host.. my guess would be a network problem, which you should escalate to your ISP, are you about to 'traceroute' to the site? can you access other sites like python.org? or slashdot.org, or freshmeat.net? do you know anyone else that also has a dialup account with udel that might be able to help you out? hope that helps.. regards, J -- || visit gfd || psa member -- || New Image Systems & Services, Inc. From robin at alldunn.com Wed Feb 16 18:00:27 2000 From: robin at alldunn.com (Robin Dunn) Date: Wed, 16 Feb 2000 15:00:27 -0800 Subject: BSDDB copyright and licensing restrictions while in use via Python References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: <8_Fq4.128$476.157615355@news.randori.com> "Warren Postma" wrote in message news:K0dq4.30$DZ2.1522 at nnrp1.uunet.ca... > > Do you think it would be hard to get 3.0 going? I'll see what I can do with > it. It's just a matter of finding some time. I'm up to my ears in work at the moment. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From a.eyre at optichrome.com Mon Feb 28 11:03:52 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 28 Feb 2000 16:03:52 -0000 Subject: A comp.lang.python code snippet archive? In-Reply-To: Message-ID: <000001bf8205$684fa280$3acbd9c2@peridot.optichrome.com> > Wouldn't it be awfully neat if there were, say a website with all > the code snippets ever posted to comp.lang.python? Not sure if it's still being updated or not: http://tor.dhs.org/~zephyrfalcon/snippets/ ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From peter.stoehr at sdm.de Thu Feb 10 11:05:54 2000 From: peter.stoehr at sdm.de (Peter Stoehr) Date: Thu, 10 Feb 2000 17:05:54 +0100 Subject: (no subject) References: <002001bf73dd$da4b5540$6c00a8c0@ruidovisual.pt> Message-ID: <38A2E1E2.7213C5A1@sdm.de> No, it is not ... Peter > Pedro Silva schrieb: > > I would like to make me sorry for my questions had appear in html > text, I think that now it is better -- Dr. Peter Stoehr mailto:peter.stoehr at sdm.de sd&m AG http://www.sdm.de software design & management Thomas-Dehler-Strasse 27, D-81737 Muenchen, Germany Tel ++49 89 63812-783, Fax -444 From kcazabon at home.com Sun Feb 20 20:16:56 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Mon, 21 Feb 2000 01:16:56 GMT Subject: PIL photocd loading References: Message-ID: PIL can read PCD files that are in RGB format only... unfortunately 'standard' PCD images are saved in YCC format... so, I have never been able to read a 'standard' PCD image. Kevin. wrote in message news:ud7pumqnr.fsf at cs.uu.nl... > Has anybody succeeded in loading photocd files with PIL? > When I trie this, Python crashes with a memory access violation. > This is on Windows NT with PIL 1.0 (Nov 99). > > import Image > im = Image.open("yose05.pcd") > im.show() > > -- > Piet van Oostrum > URL: http://www.cs.uu.nl/~piet [PGP] > Private email: Piet.van.Oostrum at gironet.nl From bparsia at email.unc.edu Tue Feb 8 20:35:00 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Tue, 8 Feb 2000 20:35:00 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> Message-ID: <1e5p92l.xgr4fe1s2x5ptN%bparsia@email.unc.edu> wrote: > In article <1e5nkk6.1a5z8bp1lixbdvN%bparsia at email.unc.edu>, > bparsia at email.unc.edu (Bijan Parsia) wrote: > > wrote: [snip] > > > I think, notwithstanding your experience with C (though why that > should > > be applicable to Python...), *you* have a riddle to answer: There is a > > *lot* of Python code out there. The standard distribution contains > loads > > of modules from many different sources. You *yourself* indicate that > > Python is becoming common place.... > > The popularity of a language cannot be taken as prima facie evidence of > its technical superiority. [snip] Well, that would be a telling riposte *if* my argument had anything to do with technical superiority. My point was, as Garrett pointed out, that the fact that there are large bodies of Python code from heterogenous sources which themselves have had heterogenous contributers *and yet* there hasn't been (reported) wide scale difficulties is *prima facie* evidence that the "whitespace munging" problem is not severe. Given that, the burden of proof returns to you, and analogies from other, *disanalogous* langauges will no longer serve. > > [ ... ] > > > > > If python code were to become mis-formatted (and given my > experience, I > > > have to believe that sooner or later this _will_ happen) > > > > Er...not your experience of *Python* code, right? So, your experience > > with Python code: 0. Everyone elses: >0 (some up to, what, 8 years? 10 > > years?). I think it more correct that your *lack* of (relevant) > > experience leads you to your belief. > > It's true that my experience writing python can, for practical purposes, > be called 0 here. However, I think it is a mistake to consider the > posters responding to me to be representative of people with experience > with python. Already, among the majority of posts from people who find > that indentation-as-syntax is not a problem, several people _with_ > python experience who believe indentation-as-syntax _is_ a problem have > spoken. [snip] Well, look, you've just *changed* your argument. Your original argument was that *based* on your C experience, certain conclusions about Python can be drawn. Now, that a few people *with* python experience chimed in is some sort of confirmation, but hardly what you should hope for given the strength of your claim and the nature of your supporting evidence. And, yes, sure, there well may have been people turned off by "whitespace", but isn't the true measure, to be consistent with your argument, of the the defectives of Python's block delimitors that when receiving files from other people, one is *typically* left *totally clueless* as to the intent of the programmer? *No one* has claimed that. There are advantages to various sorts of delimiters, and for some that might wiegh heavier than for others. So it's *no surprise* that some people will agree with your position. I don't think you can go from that to some massive technical problem. A massive technical problem would *show up* in the *general use* of the langauge. Think of C and lint. There were serious problems with C that basically *required* a tool to manage them. Python *has* such tools, but they are *not* wildly used, nor is their use strongly encouraged (the way lint's was). Of course, it's theoretically possible that everybody *is* spending all their time indenting and reindenting code, guessing where things should go, and so on, but that the other advantages of Python *so outweigh* this huge effort that people put up with it anyway. I respectfully suggest that the *prima facie* case is very strongly against this. And given that Python is open source and that adding "visible" block delimiters is more or less trivial *and* *no* alternative block delimited version has *appeared* much less gained *any* following, I think we can rest confident that indentation is not a problem. Now the lack of class methods, *that's* a killar. And it's not Smalltalk, and *everything* must be like Smalltalk. (That's for Paul. He needs a stick to beat me with :)) (Not that I *want* to be beaten. No no. Really. Stop looking at me like that!) Cheers, Bijan Parsia. From bjorn at roguewave.com Mon Feb 21 16:48:48 2000 From: bjorn at roguewave.com (bjorn) Date: Mon, 21 Feb 2000 14:48:48 -0700 Subject: Formatting a numerical string w/commas References: <88sabe$oed$1@news3.bu.edu> Message-ID: <38B1B2BF.7DD04E37@roguewave.com> import locale locale.setlocale(locale.LC_ALL, 'us') locale.format('%d', 123456, 3) locale.format('%.3f', 12345.678, 3) -- bjorn steven moy wrote: > Is there an easy way to format a numerical string with commas > in the appropriate places? I also want to be able to handle +/- and > decimal places as well. For example, I would want to convert > -1234567.89 to -1,234,567.89. > > I know how to do it in Perl: > > sub commify { > local $_ = shift; > 1 while s/^(-?\d+)(\d{3})/$1,$2/; > return $_; > } > > Can anyone provide me with a Python equivalent? > > Thanks, > > -$ > > -- > http://www.python.org/mailman/listinfo/python-list From rhicks at rma.edu Thu Feb 10 21:04:56 2000 From: rhicks at rma.edu (Robert Hicks) Date: Fri, 11 Feb 2000 02:04:56 GMT Subject: ruby AND python Message-ID: I just read an interesting article about how the Ruby language is gaining in popularity (specially in Japan). I found it interesting because it had a direct comparison (several times) with Python. How will this language affect Python? Will it drive quality and innovation? I hope so! What do you think? Note: I think Python is a great langauge so do not take the remarks above to mean that I think that the language is lacking in quality. I intend to be a Python programmer for a long long time yet! Bob From JoeSmith at bogusaddress.com Sun Feb 20 04:56:34 2000 From: JoeSmith at bogusaddress.com (Joe Smith) Date: Sun, 20 Feb 2000 09:56:34 GMT Subject: Interactive programs through Popen3 References: <88n50e$h29$1@bob.news.rcn.net> Message-ID: <38AFBB31.27CBAFB5@bogusaddress.com> I take it that you must be running on UNIX. If I remember correctly, 1.5.2 says something about can't fork on Windows NT 4.0. If I remember correctly, popen2() and popen3() also have the same problem. The doc should probably state that the popen2 module/library does not work on NT. It would probably not be difficult to fix these so that they work right on windows NT, but since I figured a way around the problem, I don't feel inspired. Z Three Penguin wrote: > When I try to run an interactive program (such as pico), reading the file > object hangs the interpreter. The code is: > > import popen2 > s=popen2.Popen3("pico") > while s.poll()==-1: > print s.fromchild.read() > a=raw_input() > s.inchild.write(a) > > Any ideas? > > -- > -Z3Penguin > > ------ > Z3Penguin Z3Penguin at PenguinPowered.Com > http://whitecow.peji.com/ > > Just because you're paranoid, it doesn't mean they're not after you. > Communication is Human, Encryption is Divine > Linux. The choice of a GNU generation. > Dr. Pepper and doughnuts... because breakfast is the most important meal of > the day. > > ~ > . . > /V\ got linux? > // \\ > /( )\ > ^`~'^ > > PGP Fingerprint: A757 001D 58E3 1486 6466 BE35 4E28 A328 90CF 4E88 > Obtain my PGP key from: http://whitecow.peji.com/key.asc From jayantha at ccs.neu.edu Thu Feb 17 17:36:18 2000 From: jayantha at ccs.neu.edu (Joshua C. Marshall) Date: Thu, 17 Feb 2000 17:36:18 -0500 Subject: Superclasses In-Reply-To: <_ZWq4.180$mYj.170807808@newsa.telia.net> References: <_ZWq4.180$mYj.170807808@newsa.telia.net> Message-ID: On Thu, 17 Feb 2000, Fredrik Lundh wrote: > Joshua C. Marshall wrote: > > Given a class object, is there a way to get at its superclass object? > > the thing you're looking for is "__bases__" Thanks, that's what I needed. Incidently, where is "__bases__" defined? If "T" is a class object, doing a "dir(T)" doesn't show "__bases__" as a field. Sorry if this is a double-post. Doesn't seem my last one went through. From amused at webamused.com Sun Feb 6 11:19:08 2000 From: amused at webamused.com (Joshua Macy) Date: Sun, 06 Feb 2000 16:19:08 GMT Subject: CGI Scripts References: <389CEA00.9D771D21@webamused.com> Message-ID: <389D9C9A.96F5229C@webamused.com> Fredrik Lundh wrote: > > Joshua Macy wrote: > > Sorry, typo. That should have read: > > > > print "Content-type: test/html\n\n" > > or rather, > > print "Content-type: test/html\n" > > since print already adds a newline all by itself. > you can of course also use an extra print state- > ment: > > print "Content-type: test/html" > print > > just like in the posted script. > > Oops. Type in haste, repent in leisure. Joshua From dfan at harmonixmusic.com Thu Feb 24 10:03:31 2000 From: dfan at harmonixmusic.com (Dan Schmidt) Date: 24 Feb 2000 10:03:31 -0500 Subject: functional programming References: <000801bf7daa$80dde000$51a0143f@tim> Message-ID: neelk at brick.cswv.com (Neel Krishnaswami) writes: | Tim Peters wrote: | | > Not long ago Billy mentioned an especially pure functional | > language called Joy, and reading the Joy papers should give a quick | > feel for how powerful and natural reasoning can be in a language | > aiming at that. OTOH, Joy is useless . | | IMO, it's the endpoint of the strongly-typed FP mafia's approach, | carried to its logical limit -- every Joy progam will terminate, at | the cost of the language's Turing-completeness. I *was* shocked by | just how much Joy *can* do: it pretty much sold me on the idea that | embedding Joy-style "extremely-pure" sublanguages in bigger ones is a | Good Idea. I looked it up and here's the Joy URL: -- Dan Schmidt | http://www.dfan.org From gerrit.holl at pobox.com Tue Feb 1 15:17:37 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 1 Feb 2000 21:17:37 +0100 Subject: When to use None In-Reply-To: <877b2v$si2$1@nntp3.atl.mindspring.net>; from aahz@netcom.com on Tue, Feb 01, 2000 at 07:10:23PM +0000 References: <8779su$sak$1@nnrp1.deja.com> <877b2v$si2$1@nntp3.atl.mindspring.net> Message-ID: <20000201211737.A2206@stopcontact.palga.uucp> Aahz Maruch wrote on 949428623: > In article <8779su$sak$1 at nnrp1.deja.com>, wrote: > > > >Would anyone explain to me where there is a difference between the > >following two calls: > > > >if some_var == None : print 'var is none' > > > >if some_var is None : print 'var is none' > > The latter is faster because it does a direct object comparison rather > than going through the conversion. Does this also count for type(a) is type(b)? There should be a FAQ entry for this one! regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From tbryan at python.net Wed Feb 16 05:57:17 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 16 Feb 2000 05:57:17 -0500 Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> Message-ID: <38AA828D.2A46C166@python.net> Forrest Cahoon wrote: > > In article <200002102304.KAA08105 at envy.fulcrum.com.au>, > Richard.Jones at fulcrum.com.au wrote: > > > > Could we please maybe mandate an "Official Response" to the weenies > > constantly posting about whitespace in Python? > As a "newbie" who made such a post recently, I can tell you what would > have been useful to me ... indeed, what would have made me feel it was > unnecessary to post. > [...snip...] > Inbetween all the bickering, I got a lot of useful information. It > would be nice to summarize these points in a succinct, factual manner. Well, the Python FAQ Wizard empowers the PSA members to do something about this situation. I skipped most of the thread this time, but if *you* could tell me what useful information you got out of that thread, I'll summarize it and add it to the FAQ. I propose two entries. One in the Programming Python in the FAQ section that deals with practical issues of dealing with whitespace in Python programs and one in the Python's Design section that deals with the fact that this isn't likely to change, that the majority of Python programers like it as it currently is, and that it has been discussed many times on comp.lang.python. > I don't know why this is so hidden. I think any reasonable FAQ on the > matter must state, in some obvious and up-front way THE PYTHON > INTERPRETER ALWAYS INTERPRETS A TAB AS 8 SPACES. Agreed. [...snip...] > You can pooh-pooh the objections to using indentation as syntax, but you > can't pooh-pooh the importance of understanding the mechanics of how it > is implemented! Yet most of you pythoneers (who respond at all -- no > doubt many more are coding) would rather spend your time explaining why, > philosophically, it's not a problem, instead of describing how > indentation-as-syntax actually works. True. So let's get it into the FAQ once and for all. > (Personally, I'd feel more secure about python if tabs generated a > compile error, and thus could be guaranteed not to be in any running > code.) Some people don't use spaces for indentation and use *only* tabs. That way, they can set the "size" of the tab in their editor and see their code with more or less separation. I suspsect that the -t option is what you really want. > The second thing of interest I learned is that there is a module called > pyindent.py (?) that is supposed to allow me to put redundant > information in my python code, if I'm really so silly as to be worried > about this whitespace thing. Yes, I'm really that silly. I'll probably > use pyindent.py (is that what it was called?) More information would be > appreciated. Do you mean tabnanny.py or pindent.py? They should be in Tools/scripts directory of the Python source download. See the comments at the beginning of pindent.py to see what it does. > The third thing related to this issue that was educational for me was > the emacs python-mode keybindings that help deal with indentation. Great for all of us who use Emacs! And the help provided by the mode is first rate: just hit C-c ? when in Python mode. > So, yeah, write your position paper, say it's not a problem, whatever -- > but put these facts in it. At least, that's my advice. > ... and I've probably written 30 lines of python by now!!!! once-you-start-down-the-python-path -forever-will-it-dominate-your-destiny-ly yours Tom From mridulj at newgen.co.in Thu Feb 17 01:28:13 2000 From: mridulj at newgen.co.in (Mridul) Date: Thu, 17 Feb 2000 11:58:13 +0530 Subject: Sound related functions or modules in python?? Message-ID: <025001bf7910$3d5dac50$b305a8c0@matrix> Hi, Could anybody let me know how to play around with sound using python............?? to be precise how to program in python for sound related stuff........ 1.I want to know how to record sound from a Mic using python?????? 2.How to playback recorded sound or files using python........?????? 3.If python supports speech-recognition??????? 4.Whether python supports speech synthesis????? 5.File formats related to sound that python supports.......? Any help will be greatly appreciated!!!!!!!!!! Mridul -------------- next part -------------- An HTML attachment was scrubbed... URL: From embed at geocities.com Mon Feb 14 12:35:46 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 14 Feb 2000 12:35:46 -0500 Subject: BSDDB copyright and licensing restrictions while in use via Python References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: > > Has the db1.8.5 source code a more liberal license than the 2.0 code from > > Sleepycat? > > I'm pretty sure that's the case. But instead of > trusting my memory, why not download it and > check check the license yourself: The only apparent license in 1.8.x is at the top of each source file. They appear to describe the plain vanilla bsd license. If you modify the source code, you must leave the headers intact. If you distribute only a binary you must mention the use of the product in your documentation. It appears the 2.0 license is significantly more restrictive for commercial users. I guess I'm free to write and release (for free) a non-official "wbsddb 1.9" should I find there are any significant problems in 1.8. > check out metakit (www.equi4.com) The problem I have with MetaKit is that it's essentially C++ only. (Unless I goofed and it really is useable from a C API also). My application is in straight C because I need a very tiny memory footprint. C+Python gives me the most bang per kilobyte, and I'm not considering C++ right now. For those who are already working in C++ and Python, I would recommend MetaKit highly. It appears to be at an early stage of use and adoption, but it appear stable and well written from the playing around I've done. If it's possible to build a straight C wrapper around the C++ version of Python, and MetaKit doesn't require the C++ Runtime Libraries, or the IOStreams or C++ Strings template classes, then I could use MetaKit. > or gadfly (www.chordate.com). An excellent "in memory database" that implements an astonishingly large SQL subset, this technology is great whenever you need to provide an SQL interface to an in-memory data set. Alas, In Memory is not what I need, and an SQL interpreter in Python is not what I need either, although I'll grant you that it's really nifty, and when/if I ever need an SQL engine, this is how I would do it. I would not "choose" to work with SQL if I don't have to, but rather, would use this if SQL was required of me. Warren From ben.flynn at cis.co.uk Thu Feb 10 06:30:36 2000 From: ben.flynn at cis.co.uk (ben.flynn at cis.co.uk) Date: Thu, 10 Feb 2000 11:30:36 GMT Subject: Shell_NotifyIcon Message-ID: <87u7gs$3si$1@nnrp1.deja.com> Does anybody know how to interrogate the system tray in Windows 98 using python in order to obtain the window handle for the clock. I need to know this in order to use the win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid) command to remove it. Any ideas ? or is the wrong way of doing it. Ben Flynn Sent via Deja.com http://www.deja.com/ Before you buy. From 2jerry at writeme.com Mon Feb 21 20:03:10 2000 From: 2jerry at writeme.com (Jerry) Date: Tue, 22 Feb 2000 02:03:10 +0100 Subject: Python window.destroy()? References: <38B1D2EB.FE88C9DC@swt.edu> Message-ID: <88sn2f$i1j$1@wanadoo.fr> Hi, if you are using tkinter.. bind coming in the button widget : #--------- def callback(event): print "Activate pop-up menu" bt = Button(root, text="call") bt.bind("", callback) #bt.bind("", popup.destroy) sure ??? bt.pack() #--------- but are you sure you want to destroy popup menu whenever you the Button Area ? is it not the popup AND the button area you need to quit before killing popup ? Best regards, Jerry the foolish dracomorpheus. Navneet M Shah a ?crit dans le message <38B1D2EB.FE88C9DC at swt.edu>... >Hi, > >Can anybody help me and give me the python code for > >A window should pop up when a mouse enters the button and the same >window should disaapear as soon as the mouse leaves the button. > >Thanks, >Navneet > From effbot at telia.com Tue Feb 8 13:34:53 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 18:34:53 GMT Subject: Several questions: python plugin, xml-rpc + Medusa References: <38A01C84.88229E45@ttm.com> <14496.21079.898203.98612@beluga.mojam.com> Message-ID: Skip Montanaro wrote: > Scott> Second question: has anyone melded the xmlrpclib stuff to Medusa > Scott> yet, other than Zope? If I were to need something like that, > Scott> should I just use Zope? I'm trying to keep things lightweight, > Scott> and I don't need the full-fledged Zope framework (which is verra, > Scott> verra nice, but the master of the castle already has one, you > Scott> see...) > > I use the ZServer component of Zope with XML-RPC without using all of Zope. > ZServer is built on Medusa, so it would appear the good folks at Digital > Creations have already done the legwork you require. Sam has contributed a sample module for medusa to the standard xmlrpclib distribution [1]. > Scott> Thirdly: SOAP sounds interesting as well. Is SOAP as > Scott> cross-language portable as XML-RPC? I can do the latter in > Scott> Python, Perl, Java, etc... what has SOAP been implemented for at > Scott> this juncture? > > SOAP implementations aren't as mature as XML-RPC yet. I stopped looking > fairly early on because all the stuff I saw floating around required > Internet Explorer or Perl. Fredrik Lundh is/was working on a Python > interface to SOAP, but I don't know the status. we're still working on it -- just gotta ship a few other things first. hope to make an announcement in a not too distant future. From rollert at t-online.de Sat Feb 19 18:14:16 2000 From: rollert at t-online.de (Tino Roller) Date: Sun, 20 Feb 2000 00:14:16 +0100 Subject: embedding & extending [SWIG,newbie] Message-ID: <38AF23C8.C9C2BE43@t-online.de> I have actually started to do some trials with extending/embedding python and would like to use python as script language in a project written in C. Can somebody help me out 1) small simmple C programme "testit.c" #include "Python.h" #include int main () { printf ("Initializing python...\n"); Py_Initialize (); PyRun_SimpleString ("print \"Hello\""); PyRun_SimpleString ("import sys"); PyRun_SimpleString ("sys.path.append (\"/home/rollert/test/python\")"); printf ("python: importing module ptest...\n"); PyRun_SimpleString ("import ptest"); PyRun_SimpleString ("print dir(ptest)"); printf ("Finalizing python\n"); Py_Finalize (); return 0; }; make: gcc testit.c -o testit -I/usr/include/python1.5 -L/usr/lib/python1.5/config/lib -lpython1.5 -ldl -lpthread 2) extension module using SWIG: a) SWIG interface file ptest.i %module ptest %{ #include "ptest.h" %} int func1 (int); double foo; b) ptest.h #ifndef __TEST_H__ #define __TEST_H__ int func1 (int n); double foo; #endif c) ptest.c #include "ptest.h" int func1 (int n) { return n*n; } double foo = 3; make: swig -python ptest.i gcc -shared -I/usr/include/python1.5 ptest.c ptest_wrap.c -o ptestmodule.so Importing module ptest in Python works, calling testit gives error message Traceback (innermost last): File "", line 1, in ? ImportError: /home/rollert/c/kreport/kreport/python/ptestmodule.so: undefined symbol: PyString_FromString Linking the module with libpython1.5.a results in: Initializing python... Hello python: importing module ptest... Fatal Python error: PyThreadState_Get: no current thread Thanks, Tino From guido at python.org Tue Feb 15 20:45:06 2000 From: guido at python.org (Guido van Rossum) Date: Tue, 15 Feb 2000 20:45:06 -0500 Subject: Python Conference Proceedings now on-line Message-ID: <200002160145.UAA27016@eric.cnri.reston.va.us> The proceedings for the 8th International Python Conference are now on-line: http://www.python.org/workshops/2000-01/proceedings.html Enjoy. --Guido van Rossum (home page: http://www.python.org/~guido/)

Proceedings of the 8th International Python Conference are now on-line. (15-Feb-2000) From effbot at telia.com Tue Feb 8 03:11:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 08:11:32 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: Roy Smith wrote: > I fear disaster every time I have to move a block of code. As the logic > of my program develops, I'll either have to move a block of code into an > if, or move it out of one, or I'll take a block of code and turn it into > a function/method of its own, or maybe even extract something into a > subclass. This means cutting and pasting (well, killing and yanking, > since I use emacs), and changing the indent level up or down. Emacs > tries to be smart about indenting and sometimes does something wrong, > changing the meaning of the code. having written a few 100k lines of Python code in emacs, I don't understand what you're talking about. maybe C-c < and C-c > doesn't work on your machine? if that's the case, don't you think it's easier to fix your emacs installation than to redesign Python? From cpatti at atg.com Tue Feb 22 10:27:32 2000 From: cpatti at atg.com (chris patti) Date: 22 Feb 2000 10:27:32 -0500 Subject: GUI in Python under MSDOS? References: <7gxs4.10514$Jz3.75949@nnrp1.uunet.ca> Message-ID: "Warren Postma" writes: > Is there any gui for Python that will operate under MSDOS, especially > extended 32-bit MSDOS using the djgpp 32 bit C++ compiler/dos-extender? > Yes, you heard me right. > > Support for VESA or even some common accellerated VGA cards would be > excellent, but standard VGA [unaccellerated] would still be better than > nothing. > > I found a version of Squeak [a free and nifty smalltalk-80 variant, see > www.squeak.org ] that has a DOS version, but I much prefer Python's syntax > and structure. > > Any ideas? > > Warren The mere thought of a DOS port of Tk and then Tkinter to DOS makes my head hurt :) The mere fact that Python runs in extended DOS is a major win, though. I have a 386 laptop I plan to run it and Squeak on :) -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From jayfreeman at earthlink.net Wed Feb 23 15:03:31 2000 From: jayfreeman at earthlink.net (Jay Freeman) Date: Wed, 23 Feb 2000 14:03:31 -0600 Subject: Question about X window control References: <38B3FF12.9254AEDF@earthlink.net> <891aqs$mqq$1@info3.fnal.gov> Message-ID: <38B43D12.56527AC5@earthlink.net> Hi again, cgw at alum.mit.edu wrote: > > Well, this question doesn't have a lot to do with Python but I'll answer it > anyway. > > xanim has a -S option to control scaling and a -W option to control > window placement. If you type "xanim --help" you'll see it all spelled > out in great detail. Thanks for replying, but neither of these is any help. Scaling is irrelevant, the anim is already the size I want it to be. And the +Wxnum and +Wynum parameters position the anim within the window, not the window within the desktop. What I was after on the Pyhton side of things is how to tell that window to maximize itself. I can get the pid of the xanim process, but where do I go from there (if anywhere)? Jay From tbryan at python.net Sat Feb 26 10:26:14 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 26 Feb 2000 10:26:14 -0500 Subject: How to send data into other's CGI on the site and read it back? References: <38B69308.38F59503@mail.iem.nctu.edu.tw> Message-ID: <38B7F096.9D4D6D9@python.net> Jeff Chou wrote: > > Dear mentors: > > How to use Python script to send data into other's cgi > on the web site and read its results back for calculating? See FAQ 4.61: How can I mimic CGI form submission (METHOD=POST)? http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.061.htp It shows a short sample program. ---Tom From sabren at manifestation.com Thu Feb 10 01:23:38 2000 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 10 Feb 2000 01:23:38 -0500 Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> Message-ID: <87tli4$s50$1@nntp1.atl.mindspring.net> Bob Alexander wrote in message <00e401bf7332$4aea6ea0$74eb0b18 at stcla1.sfba.home.com>... >It can't be encapsulated into something that looks like a function call I betcha it can!... How about this? ### def cStyleIIF(condition, iftrue, iffalse): if eval(condition): return eval(iftrue) else: return eval(iffalse) x = 5 y = 20 a = cStyleIIF("x Message-ID: * Mikael Olofsson > On 15-Feb-00 Andy Robinson wrote: > > Years back, I subscribed to comp.sys.next.programming, > > comp.sys.next./software, and comp.sys.next.advocacy. It worked really > > well. The 'advocacy' group was the place for flame wars, defending > > the honor of our superior engineering solutions, and general chat.; > > the 'programming' and 'software' groups had specific enough titles to > > be unlikely to atrract flames. I've suggested this split a few times > > in the last five years and don't know why people want to keep it in > > one group. > > > > But there's no point starting the official newsgroups creation > > procedure if only two of us feel this way. > > I could do without the flame wars. During the last three months the > number of posts have steadily increased from ~500 posts a week with very > few inflammatory posts to ~1000 posts a week with a significant part > being inflammatory. The last week there were ~150 post that I consider > being part of flame wars (whitespace, brackets, python sucks, and > related). I admit, I have posted a handful of these. Of course I can > filter them out, but I refuse to make new filters every day just to cope > with digital bullshit. > > And what if I the increase continues? I say split, maybe even to more > than two groups. Or perhaps, make it moderated. as the python community grows and the number of posts increases, a split would seem natural. I would suggest something like c.l.python, c.l.python.moderated, c.l.python.web, c.l.python.tkinter (or perhaps c.l.python.gui would be better).. any other suggestions? vr From jcw at equi4.com Mon Feb 28 16:36:03 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Mon, 28 Feb 2000 22:36:03 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: <38BA8A1F.2B4ADA0B@equi4.com> Message-ID: <38BAEA35.5AC6A84A@equi4.com> Arnaud, > > If you let me know which release of MacPython you use (an URL > > perhaps), > > 1.5.2c1 In that case, there must be another problem - it's what Mk4py.PPC.slb was built for... here's what "Python IDE" tells me over here: Python 1.5.2c1 (#56, Apr 12 1999, 14:19:52) [CW PPC w/GUSI w/MSL] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import Mk4py >>> Mk4py.Storage() >>> > Do you have any clue about efficient search into a memory-mapped file? > I'm afraid I'll be limited to some kind of hash tables ... and coding > "yet another database system" bugs me ... Or b-trees. I also did some experiments with ternary search trees. Check out python/millions.py in the MK source distribution. Hashing may or may not be a good option. Efficiency is not just about how much time it takes to access an item, it's also about locality of reference (which hashing sort of deliberately messes up :) when you need to access lots of items in quick succession. -- Jean-Claude From mmen at axion-gmbh.de Mon Feb 14 06:12:29 2000 From: mmen at axion-gmbh.de (Matthias Menne) Date: Mon, 14 Feb 2000 12:12:29 +0100 Subject: Where to place job offers? Message-ID: <000201bf76dc$61f0ffd0$2001a8c0@ntws132.office01.de> Can anybody make suggestions, where to place job offers for Python/Zope application developers in Germany? Matthias _________________________________________________________________ Wir suchen kurzfristig erfahrene ---------------------------------------- Software-Engineers Internet-Applications ---------------------------------------- Sie besitzen fundierte Kenntnisse in Konzeption, Design und Programmierung von Internet-Anwendungen und beherrschen mindestens eine objektorientierte Programmiersprache. Idealerweise verf?gen Sie ?ber Erfahrungen mit Python und Zope. Sie zeichnen sich durch konzeptionelles und analytisches Denken aus, besitzen eine selbst?ndige Arbeitsweise und sind gewohnt, im Team zu arbeiten. Axion ist ein junges, innovatives Beratungs- und Softwarehaus mit ca. 30 Mitarbeitern in K?ln. Wir expandieren in den Zukunftsm?rkten Business Solutions, Data Warehousing, Knowledge-Management und Web-Applications. Weiterbildung besitzt bei uns einen hohen Stellenwert. Daneben bieten wir ein attraktives, leistungsorientiertes Gehalt sowie ein ausgesprochen gutes Betriebsklima. Wenn es Sie reizt, in fachlich und technologisch innovativen Software-Projekten neue Herausforderungen anzunehmen, z?gern Sie nicht lange und bewerben Sie sich bitte schriftlich, auch per Email. F?r Vorabinformationen steht Ihnen Herr Bock telefonisch (-76) gerne zur Verf?gung. Axion GmbH Gesellschaft f?r Kommunikations- und Informationstechnik mbH Goltsteinstr. 89 50968 K?ln Germany fon +49 (221) 94 36 98-21 fax +49 (221) 94 36 98-11 mobil +49 172 59 18 712 email: bock at axion-gmbh.de http://www.axion-gmbh.de From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 22:55:02 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 22:55:02 -0500 Subject: comp.lang.python: more traffic than ever before References: Message-ID: Fred: In an article posted Tue, 29 Feb 2000 20:59:28 GMT, you said: > this month, comp.lang.python has seen nearly > 50% more posts than any month before: And I just thought I was a really slow reader. -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From bvisscher at my-deja.com Tue Feb 1 18:55:05 2000 From: bvisscher at my-deja.com (bvisscher at my-deja.com) Date: Tue, 01 Feb 2000 23:55:05 GMT Subject: Porting omniORB python to OpenVMS Message-ID: <877rom$akl$1@nnrp1.deja.com> Hello, I have been attempting to port the omniORB python CORBA mapping (omniORBpy) to OpenVMS and I think I need some help. I have been using Uwe Zessin's excellent port of python for OpenVMS (version 1.5.2-V005). Good job! I have made some source code changes for OpenVMS version 7.1 and for threading support. For example, I have managed to get popen working (the VMS RTL call is idiosyncratic). I modified the LINK line to include /thread=(multi, upcall) since I will need good thread support for omniORB. OmniORBpy requires both embedding (for the IDL compiler) and extending (for the python callable interface). Embedding works. Extending doesn't :-(. To extend, I follow the directions on the OpenVMS python website and modify config.dat by adding the following line: _omnipy init_omnipy D omnilib:omni_share.olb/library just before: !: -- ADDMODULE MARKER 2 -- */ I then execute the necessary command procedures. The resulting python interpreter works fine until I try to import the _omnipy module. When I do that I get: python -v exampleserver.py [...] import StringIO # precompiled from /PYVMS_DISK/PYTHON/PYTHON-1_5_2/LIB/StringIO. pyc import _omnipy # builtin Fatal Python error: PyThreadState_Get: no current thread %SYSTEM-F-OPCCUS, opcode reserved to customer fault at PC=FFFFFFFF809D25A8, PS=0 000001B %TRACE-F-TRACEBACK, symbolic stack dump follows image module routine line rel PC abs PC 0 FFFFFFFF809D25A8 FFFFFFFF809D25A8 0 FFFFFFFF8093E568 FFFFFFFF8093E568 _OMNIPYMODULE_0_2 0 00000000000CC068 000000000055E068 _OMNIPYMODULE_0_2 0 00000000000CDC00 000000000055FC00 _OMNIPYMODULE_0_2 0 00000000000B0110 0000000000542110 _OMNIPYMODULE_0_2 0 00000000000B0A40 0000000000542A40 _OMNIPYMODULE_0_2 0 00000000000CF050 0000000000561050 _OMNIPYMODULE_0_2 OMNIPY init_omnipy 30016 00000000000041B8 000000000062AB08 PYTHON_ALPHA 0 0000000000082348 0000000000092348 PYTHON_ALPHA 0 0000000000082144 0000000000092144 [...] Any help would be greatly appreciated. (I have seen something similar when I was doing something silly. The code in question was (I think) running before main started. Not the case here.) (Apologies to anyone not interested in this. I hope Uwe reads this!) Thanks in advance, Bruce Visscher Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Fri Feb 11 09:17:02 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 14:17:02 GMT Subject: will python 3000 break my code? References: <001201bf7454$2263bd60$d6a0143f@tim> Message-ID: Tim Peters wrote: > [Ronald L. Dilsavor] > > I am in the process of deciding whether to have a team of folks > > invest in implementing our product in Python and this [presumed > > incompatibility of Python 3000] was one of the "cons" on my list. > > As it should be! Don't overvalue it, though. For example, even if Python > 3000 is an *entirely different language*, no C program stopped working the > day C++ was released -- or a decade later, either. That is, you won't be > alone no matter what, and the current implementation of Python is > extraordinarily clean and maintainable: it still needs Guido's help to > guide its evolution, but not at all to keep it running in top shape. just to add a few extra points to Tim's excellent treatment of this issue: if you plan to use python in a commercial context, you have a number of ways to make sure you don't get into trouble. they all involve small amounts of $'s, though: 1. join the consortium and put some pressure on the technical director to make sure nobody's left behind by Py3K: http://www.python.org/consortium/ (yes, the consortium's technical director do have some influence in these matters ;-). 2. make it clear to commercial python tool vendors (Secret Labs, Active State, etc) that you're willing to support vendors providing a clean upgrade path from Python 1.X to Py3K. 3. set aside some time to study Python internals, and make sure you have local expertise to make necessary modifications, if necessary. also avoid designing your application to be overly dependent on implementation details in CPython 1.X (reference counting, types, access to bytecodes, etc. looking at JPython might help here). 4. buy beer to everyone at the python conference! (or join the consortium and buy beer to everyone at the consortium meetings) From ivanlan at callware.com Wed Feb 9 16:28:49 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 09 Feb 2000 14:28:49 -0700 Subject: Python and Klingons References: <38A1AACB.8A5D0933@callware.com> Message-ID: <38A1DC11.A815C692@callware.com> Hi All-- Fredrik Lundh wrote: > > Ivan Van Laningham wrote: > > 15. Python? That is for children. A Klingon Warrior uses only machine > > code, keyed in on the front panel switches in raw binary. > > I kinda liked #5 better: > > 5. Indentation?! - I will show you how to indent when I indent your skull! > It's certainly apropos of the recent drivel-spamfest, but I try not to encourage them. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 hgg9140 at seanet.com Thu Feb 24 19:47:11 2000 From: hgg9140 at seanet.com (Harry George) Date: 24 Feb 2000 16:47:11 -0800 Subject: Argo / Python / UML design tools References: Message-ID: TCM is free, and I parse its data files in python, in order to generate XML and python and java outputs. Pierre-Charles David writes: > ebecker at software-manufaktur.de (Edelhard Becker) writes: > > > Hi Greg, > > > > On Mon, 14 Feb 2000 13:11:23 -0500, Greg Wilson wrote: > > > Is anyone working on UML design tools that are Python-friendly? > > > More specifically, has anyone taken a look at Argo > > > (http://www.ics.uci.edu/pub/arch/uml/) with an eye to making it > > > understand Python? If so, I'd be grateful for a ping... > > > > "Together" (http://www.togethersoft.com/index.htm) is implemented in > > Java and comes with JPython. Unfortunately it's not cheap ... > > Same for ObjectDomain (http://www.objectdomain.com). > > -- > Pierre-Charles David (david at essi.fr) -- Harry George hgg9140 at seanet.com From boud at rempt.xs4all.nl Tue Feb 8 09:13:31 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 8 Feb 2000 14:13:31 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> <87omh2$lfi$1@oravannahka.helsinki.fi> Message-ID: <87p8ab$9l0$1@news1.xs4all.nl> Jere Kahanpaa wrote: > Ronald Caudill wrote: > : The programs I want to do soon needs a Grid widget and a calendar > : widget. Are these widgets available in Python? Or can one write > : your own. Or what do Python programmers do when they need widgets > : like this? > : Ronald > wxPython (http://alldunn.com/wxPython/) has both. I haven't used > them, but at least the wxGrid widget should be quite flexible. For what I understand from the wxGrid documentation, the wxWindows grid isn't editable, at least not in-place. (I can't test it out - I still can't get wxPython installed.) -- Boudewijn Rempt | http://www.valdyas.org From effbot at telia.com Mon Feb 7 13:00:00 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 07 Feb 2000 18:00:00 GMT Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 7) References: Message-ID: I messed up: > New Python consortium members that we forgot to mention in > last week's URL > ASTi: the correct info is: Advanced Simulation Technology, Inc (ASTi) http://www.asti-usa.com/ sorry! /F From effbot at telia.com Mon Feb 28 15:12:04 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 20:12:04 GMT Subject: Best book to learn Python? References: <38BA416E.BDF9F3A9@sightreader.com> <38bad288_2@news1.prserv.net> Message-ID: shendry at usa.capgemini.com wrote: > Has "Learning Python" been updated? it was published in march 1999. you're probably confusing "Learning Python" with "Programming Python" (october 1996) > I am hesitating to buy it since it's published a few years ago (last time I > checked at my local B&N store), whereas "Quick Python" is more recent, > although I've heard that it has plenty of typos. according to the authors, most of the typos were added by the publisher, very late in the process. make sure you check the errata: http://www.manning.com/Harms/Errata.html here are some additional reviews: http://www.amazon.com/exec/obidos/ts/book-customer-reviews/1884777740 http://weblogs.userland.com/zopeNewbies/discuss/msgReader$283 (but before ordering, see http://www.noamazon.com/ !) From garry at sage.att.com Mon Feb 7 08:04:03 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Mon, 7 Feb 2000 13:04:03 GMT Subject: re AMTE thread re DrScheme & Python References: <1262576128-2292072@hypernet.com> <73BD666B8B0196AB.1AF26399FCBBB6AD.501B5E4C2B5C17BB@lp.airnews.net> Message-ID: <389EC2C3.149CDEC3@sage.att.com> Tres Seaver wrote: > Gordon McMillan wrote: > >Well, I'm glad it's over. I was running low on candles and bat's > >wings, and couldn't find a virgin anywhere... > > I gave up on THAT recipe some time back. My wife has been complaining pretty > bitterly about the wax and chicken bones strewn about the back porch, though. my wife was merely annoyed about those, but the virgins *really* pissed her off... -- 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 mikael at isy.liu.se Fri Feb 4 02:43:45 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Fri, 04 Feb 2000 08:43:45 +0100 (MET) Subject: programming for children In-Reply-To: <87c6pr$hsr$1@kopp.stud.ntnu.no> Message-ID: On 03-Feb-00 Magnus Lie Hetland wrote: > > Maybe you would like to make a German translation of Instant Python? > (http://www.idi.ntnu.no/~mlh/python/instant.html) > > There are several other translations, and a German one would be nice... Or > perhaps > Instant Hacking would be more appropriate to a beginning 11-year-old... > (http://www.idi.ntnu.no/~mlh/python/hacking.html) I hate to make you dissapointed, but none of these URLs exist. Even http://www.idi.ntnu.no/~mlh/ is a 404. Is something fundamentally wrong, or did you just misspell it? /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-Feb-00 Time: 08:40:44 This message was sent by XF-Mail. ----------------------------------------------------------------------- From mwh21 at cam.ac.uk Thu Feb 24 12:28:20 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 24 Feb 2000 17:28:20 +0000 Subject: Looking for Python equivelent References: <8Mdt4.171$cz3.15110@news.uswest.net> Message-ID: "Lenny Self" writes: > Hello. > > I am attmpting to find the Python equivelent for these calls in C++ > > inet_addr() and inet_ntoa() > > Basically, I am attmepting to decode a string (in Python) that was encoded > via the first of the two functions above. I have been told that the second > function will decoding if I were using C++. > > If anyone can point me in the right direction I would greatly appriciate it. > socket.inet_aton & socket.inet_ntoa ? HTH, Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From tbryan at python.net Mon Feb 21 18:51:45 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 21 Feb 2000 18:51:45 -0500 Subject: Formatting a numerical string w/commas References: <88sabe$oed$1@news3.bu.edu> Message-ID: <38B1CF90.3FB473EB@python.net> steven moy wrote: > > Is there an easy way to format a numerical string with commas > in the appropriate places? Easy? I don't know. Equivalent to your commify? Sure! > > I know how to do it in Perl: > > sub commify { > local $_ = shift; > 1 while s/^(-?\d+)(\d{3})/$1,$2/; > return $_; > } > > Can anyone provide me with a Python equivalent? Sure...of course, I've done a bit of overkill here. You can stick this in commify.py and do a from commify import commify to use the function wherever you like. ################## commify.py ################ #!/bin/env python import re regex = re.compile(r'^(-?\d+)(\d{3})') def commify(num, separator=','): """commify(num, separator) -> string Return a string representing the number num with separator inserted for every power of 1000. Separator defaults to a comma. E.g., commify(1234567) -> '1,234,567' """ num = str(num) # just in case we were passed a numeric value more_to_do = 1 while more_to_do: (num, more_to_do) = regex.subn(r'\1%s\2' % separator,num) return num if __name__ == '__main__': test_vals = (12345, -12345, 1234567, -1234567, 1234567.89, -1234567.89, 1234567.8901, -1234567.8901) print "If you use '.' as your decimal indicator..." for number in test_vals: print commify(number) weirdo_test_vals = ('12345', '-12345', '1234567', '-1234567', '1234567,89', '-1234567,89', '1234567,8901', '-1234567,8901') print "If you use ',' as your decimal indicator..." for number in weirdo_test_vals: print commify(number,'.') From skip at mojam.com Fri Feb 18 13:19:33 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 18 Feb 2000 12:19:33 -0600 (CST) Subject: breaking the ; habit In-Reply-To: <20000218161115.D3878@stopcontact.palga.uucp> References: <000101bf75de$0d12f940$962d153f@tim> <9t9d7pyn98a.fsf@mraz.iskon.hr> <20000218161115.D3878@stopcontact.palga.uucp> Message-ID: <14509.36149.8696.777315@beluga.mojam.com> Gerrit> Gnu does more strange things: gatewaying all it's mailinglist to Gerrit> the main newsgroup hierarchy. Using Texinfo instead of Gerrit> Man. Using obscure mailinglist management software, but writing Gerrit> very well mailinglist management software their own. Gerrit, Please recall that when most of these conventions were established, the net was a far different place than it is today (for one thing, I don't think you'd been born yet ). That there is a top-level gnu.* newsgroup hierarchy carried by most news servers reflects GNU's relative importance in this whole "open source" game we play. The start of Richard Stallman's work predates Perl and Python by at least a decade. Mailman is still practically in its infancy, so it's understandable if all the various GNU mailing lists don't use it yet. Texinfo is a far more capable documentation tool for general purpose manuals than man pages ever could be. Comparing the two is probably not fair. They really solve different problems. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From rchowd1 at my-deja.com Wed Feb 9 11:47:37 2000 From: rchowd1 at my-deja.com (rchowd1 at my-deja.com) Date: Wed, 09 Feb 2000 16:47:37 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> Message-ID: <87s5n8$j1q$1@nnrp1.deja.com> In article , "Fredrik Lundh" wrote: > John Nielsen wrote: > > rchowd1 at my-deja.com wrote: > > > How do we handle sessions in python (server side) ? > > > > > > Could you please explain with a simple example with a form > > > (client-side) and python (server-side). > > > > You're probably not using 'SetValue' in order to set > > session/application values. > > umm. just curious, but I thought Python was > a programming language, not a web application > server. I agree that I did not put the question in a understandable manner. Apache is the WEB SERVER I am using and python is being used for cgi-scripting. So when I get a request from a form on the client side, how can I handle the session in the python(cgi)script in the server side. Thanks. > > or in other words, the answer could have been > "it depends on what web server environment > you're using". but not this time. > > yet another case of mostly anonymous my-deja > posters asking (and in this case answering) a > strange question. > > who's behind this secret conspiracy? > > qopp- at my-deja.com: performance issues between scripting languages in asp > pages > daryl_stult- at my-deja.com: win32security, client privleges > stevie_dej- at my-deja.com: pickling parent > thucdat114- at my-deja.com: corel + borland = the end of MS win > fcahoo- at my-deja.com: whitespace as syntax > jeremiahroger- at my-deja.com: nonlinear programming? > eschen4- at my-deja.com: how to lock Zope-shared file with DAV E > > "Erase your 95/98/NT, install Linux now. > Bright future for everything." > > (hmm. is it just me, or is it a trend in there...) > > Sent via Deja.com http://www.deja.com/ Before you buy. From mikael at isy.liu.se Mon Feb 14 07:49:46 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 13:49:46 +0100 (MET) Subject: breaking the ; habit In-Reply-To: <38a5d928@news.isc.rit.edu> Message-ID: On 12-Feb-00 osorronophris osorronophris wrote: > I'm a die-hard C++ programmer that recently took up Python for a change of > scenery and am enjoying it greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've tried chewing gum but it > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? Assuming you have a programmable editor, set it to quit if you ever type ;. I once knew a guy who were used to UNIX. One summer he had to live in a DOS-environment, and he hated every minute of it. What he hated even more was when he got back to his UNIX home, and found himself typing dir all the time. OK, what did he do? He made an alias, of course. No, he didn't make dir mean ls, he had it mean logout. Now you guess: How fast did he break his habit? Fast, real fast, mind my words. Good luck! /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-Feb-00 Time: 13:41:09 This message was sent by XF-Mail. ----------------------------------------------------------------------- From moshez at math.huji.ac.il Tue Feb 22 03:30:30 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 10:30:30 +0200 (IST) Subject: Fast way to grab line from file? In-Reply-To: <88sprs$1ao$1@nnrp1.deja.com> Message-ID: On Tue, 22 Feb 2000 chiefteo69 at my-deja.com wrote: > Hi there, > Does anyone know of a faster way to grab line > 100 from a given file without doing 100 readline() > calls? This way is too slow, but I can't find out > how to do this in python. Thanks, And how exactly would Python know where the 100 lines begin without the preceding 99 .readline()'s? From phd at phd.russ.ru Wed Feb 23 04:01:02 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Wed, 23 Feb 2000 09:01:02 +0000 (GMT) Subject: Easy reading HTML? In-Reply-To: <38B3301C.38BAAF20@inka.de> Message-ID: On Wed, 23 Feb 2000, Michael [iso-8859-1] Str?der wrote: > > I am currently in the thinking process of writing a little python > > program to sort my Netscape bookmarks file. > > Parsing Netscape bookmarks was already done. I forgot the URL but > search for bkmk2db/db2bkmk. You can derive your own sub-class for > your output format. That's my. I am here: http://sun.med.ru/~phd/Software/Python/ Download Bookmarks database and Internet robot, FLAD, m_lib.tgz and pbar.tgz. Mirrors: http://members.xoom.com/phd2/Software/Python/ http://www.fortunecity.com/skyscraper/unix/797/Software/Python/ I have started to rewrite parser to more modular design, more databases support and so on, but do not expect any results soon :) Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From nobody at nowhere.nohow Fri Feb 18 00:18:08 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Fri, 18 Feb 2000 05:18:08 GMT Subject: Python misconceptions in IBM Ruby article... References: <38AB8445.DF945829@webone.com.au> <38AC9D57.5CC8066C@mincom.com> Message-ID: John Farrell wrote: >I agree that Python's OO features feel added on. Consider: > > * You have to pass self to each member function. There's no obvious > requirement that self need actually be the bound instance. > * In a method, fields of the bound instance need to be referenced > through the self parameter, because the scoping rules do not understand > about instance variables. The use of the 'self' parameter in methods is something that both Modula-3 and Smalltalk do (IIRC -- it's been a few years). I think it results in much more readable code. While OO may be an 'add-on' in the case of M3, I hardly think that you can claim OO is an 'add-on' to Smalltalk. > * Classes are not types. This strongly suggests that Python had > types other than 'instance' first, and when objects were added, > it was too late to make all types classes. The class/type dichotomy is a sticky one. > * Proper OO languages do not use white space to delimit blocks, > and use semicolons and block delimiters. Proper languages put semicolons _between_ statements not at the end of statements. -- Grant Edwards grante Yow! Let me do my TRIBUTE at to FISHNET STOCKINGS... visi.com From eh at eh.com Sun Feb 20 11:43:17 2000 From: eh at eh.com (eh) Date: Sun, 20 Feb 2000 11:43:17 -0500 Subject: interactive window Message-ID: is there a way to expose the interactive window as a com object. thanx, Michael Mead From rhicks at rma.edu Sat Feb 12 17:58:56 2000 From: rhicks at rma.edu (Robert Hicks) Date: Sat, 12 Feb 2000 22:58:56 GMT Subject: TCL has Tk... Message-ID: Why can't Python have its own widget set instead of using Tk or wxPython? From fcahoon at my-deja.com Thu Feb 10 13:52:40 2000 From: fcahoon at my-deja.com (fcahoon at my-deja.com) Date: Thu, 10 Feb 2000 18:52:40 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <20000208220926.A3388@stopcontact.palga.uucp> Message-ID: <87v1dm$n9q$1@nnrp1.deja.com> In article <20000208220926.A3388 at stopcontact.palga.uucp>, Gerrit wrote: > fcahoon at my-deja.com wrote on 949964685: > > [ ... ] > > I believe that the Ruby language (http://www.ruby-lang.org/) has the OO > > advantages of Python without the whitespace-as-syntax deficiency. > > [ ... ] > > The English in here is certainly a whole lot better than the English > in the ruby mailinglist ;-) > > regards, > Gerrit. Work on English-language documentation is ongoing: the new FAQ reads quite nicely -- see http://www.pragprog.com:8080/rubyfaq/rubyfaq.html There is a push to generate more English-language materials; in a few months I think this situation will be greatly improved. f Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Wed Feb 16 11:16:33 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 16 Feb 2000 11:16:33 -0500 Subject: Plugin into a server In-Reply-To: Message-ID: <1261404724-3461885@hypernet.com> Szilveszter Juhos writes: > I want to install new executable objects into a server (running on a > remote machine) with a client like: > > class Printer: > """ > This class should run on the SERVER side > """ > def Run(self): > print 'dummy message' > > theClient = Connector() > theClient.SendObject(Printer(),'cmd') > del theClient > > The idea is that the Connector class implements the interface between the > server and the client. When I send an object with attribute 'cmd', the > server side will accept it as an executable object at the server side. I > can easily trasfer data, but not executable. It is obvious from the > documentation that pickling/marshaling will not work (at least I could not > find a way), but what is the way than to send executable objects across > network? Cheap answer: yes, you can use marshal (on the code object), or simply transmit source. Better answer: Think again. It will be very difficult to write code on the client that will do anything useful on the server (eg, a "print" statement will end up buried in a server log somewhere). It will be easy to write code that screws up the server accidentally. It will be trivial for a malicious hacker to leave your server in ruins. - Gordon From J.C.Travers at durham.ac.uk Fri Feb 18 19:46:56 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Sat, 19 Feb 2000 00:46:56 +0000 Subject: Which GUI? References: Message-ID: <38ADE800.9C7E60E4@durham.ac.uk> Moshe Zadka wrote: > > On 18 Feb 2000, Vadim Zeitlin wrote: > > > On Fri, 18 Feb 2000 07:25:05 +0200 (IST), Moshe Zadka wrote: > > >hour. I couldn't get wxWindows (the basis for wxPython) to compile on that > > >C++ compiler for 2 weeks. > > > > Hello, > > > > you may be surprized to hear this, but wxWindows is developped by a team of > > volunteers > But I'm afraid, at the moment, I'm left with the impression that > staking Python's GUI on wxWindows is a dangerous bet. And staking Python's GUI on something as un-python like as Tcl/Tk (even with the Tkinter wrappers) is also a dangerous bet. Cheers, John. From moshez at math.huji.ac.il Fri Feb 25 11:26:46 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 18:26:46 +0200 (IST) Subject: Optimizing code In-Reply-To: Message-ID: On 25 Feb 2000, Harald Hanche-Olsen wrote: > Presumably because the address space is still 32 bits, and no object > in memory can conceivably be longer than 2**32. (In any case I found > your use of __len__ to be slightly offensive.) But wait, you sure > *could* imagine an object longer than 2**31, and since python ints are > signed, then len() would turn out to be negative. Ummmm.....xrange() uses O(1) memory, so it should be able to be as long as I want: what if I want to count to 2^33? This is a limitation, pure and simple. Thankfully, it's fixed in the CVS version (thanks, Andrew!), so it'll be all right in 1.6. or-you-can-live-on-the-edge-and-use-the-cvs-version-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jstok at bluedog.apana.org.au Sun Feb 6 21:38:56 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 7 Feb 2000 13:38:56 +1100 Subject: Database for storing heterogeneous "message" objects Message-ID: I want to use a database to store sets of heterogeneous "message" objects, which currently cover email and news messages, but will be extended more generally to include messages in web-accessible archives and other "email-like" things. Queries can be made on a message database based on their header properties. The Python standard relational database API doesn't quite fit this domain because the structure of such a database isn't quite tabular. Although the messages will have certain mandatory headers like from, subject etc. in common, individual messages will also have optional headers that aren't defined for all messages. I want to allow queries on optional headers -- if a header is defined for a message, any selection rule based on that message will be applied to it, otherwise the test automatically fails. From mikael at isy.liu.se Tue Feb 8 07:15:17 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 08 Feb 2000 13:15:17 +0100 (MET) Subject: arguments from the prompt In-Reply-To: Message-ID: On 08-Feb-00 joe at localhost.localdomain wrote: > thanks, btw is there a FAQ? Yes, at the Python Language Website. http://www.python.org/doc/FAQ.html /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: 08-Feb-00 Time: 13:13:49 This message was sent by XF-Mail. ----------------------------------------------------------------------- From tdickenson at geminidataloggers.com Thu Feb 10 05:38:14 2000 From: tdickenson at geminidataloggers.com (Toby Dickenson) Date: Thu, 10 Feb 2000 10:38:14 +0000 Subject: Question concerning makepy.py for COM References: <38A1EE08.1550D3BF@ttm.com> Message-ID: <5v35ask6jegt76hmpblnc56kip72l697th@4ax.com> Scott Anderson wrote: >mhammond at skippinet.com.au wrote: >> You dont need to do anything special - just call >> "win32com.client.Dispatch(prog_id)" and it should work. > >That's dynamic dispatch. I was under the impression that makepy >generated a Python module suitable for doing static dispatch... win32com.client.Dispatch chooses the best form of dispatch out of all those available. Its preferred choice it to use makepy's output, if its available. If you want to force dynamic dispatch, use win32com.client.dynamic.Dispatch If you want to force use of the makepy output, the best thing to do is copy the module from makepy's cache directory, give it a sensible name, possibly add it to your revision control system, and import it directly. In your case: import scotts_controls o = scotts_controls.TSHSWAPI() If you choose this latter option then you should be aware that you will not be able to use the easier of the two Event support options provided by win32com.client, DispatchWithEvents. You will have to use the lower level getevents. Toby Dickenson tdickenson at geminidataloggers.com From bestvina at math.utah.edu Wed Feb 23 12:24:02 2000 From: bestvina at math.utah.edu (Mladen Bestvina) Date: Wed, 23 Feb 2000 10:24:02 -0700 Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <38B40EBD.13EC1C1E@math.utah.edu> Message-ID: <38B417B2.C03EEC3B@math.utah.edu> Fredrik Lundh wrote: > > Tkinter as distributed with Python 1.5.2 does *not* work with > Tk 8.1 and later. either use 8.0.5, or get patches from here: I have Tk 8.0.5: mladen at drava:/home/mladen/projects/grayson > wish % info library /usr/local/lib/tcl8.0 % Mladen Bestvina From thomas at xs4all.net Fri Feb 4 04:21:44 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 4 Feb 2000 10:21:44 +0100 Subject: Eight suggestions for Python books (long) In-Reply-To: ; from effbot@telia.com on Thu, Feb 03, 2000 at 11:09:25PM +0000 References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> Message-ID: <20000204102144.F6378@xs4all.nl> On Thu, Feb 03, 2000 at 11:09:25PM +0000, Fredrik Lundh wrote: > for your amusement, here's a list of existing cookbook-ish > Python books, in no specific order. > + Python Annotated Archives (by Martin Brown): > + Programming with Python (by Tim Altom): > + The Python Grimoire (by Andrew Kuchling): > + (the eff-bot guide to) The Standard Python Library, > eMatter edition (by Fredrik Lundh): Dont forget the bookwork Deja can provide by searching for articles by Tim Peters, and the Tim Peters shrine (http://www.python.org/tim_one/) It's no way near ordered (except perhaps chronologically, but given the number of time machines in the python community you're better off sorting by the third word of every second line ;) but it *is* a nice collection of snippets and insights into python. A gold-mine of knowledge, some of which is even practical :) shelve-your-sanity-before-reading-any-though-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From emile at fenx.com Tue Feb 15 09:25:05 2000 From: emile at fenx.com (Emile van Sebille) Date: Tue, 15 Feb 2000 06:25:05 -0800 Subject: A little present. Message-ID: <06be01bf77c0$7505be00$01ffffc0@worldnet.att.net> In the current context, class Hole: simply provides a unique identifier similar to None to test. More generally, I use empty classes as attribute containers, generally to hold retrieved ODBC data. This allows me to parse the SQL between SELECT and FROM, and use the field names as instance attributes. HTH, Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Warren Postma Newsgroups: comp.lang.python To: Sent: Tuesday, February 15, 2000 5:56 AM Subject: Re: A little present. > > Here's one: > > > > class Hole: > > pass > > > Can anyone give me a useful example of WHY you'd want to do this, or is this > just more weird example of Functional Code-Fu? { If do right, no can > defend. } > > Warren > > > -- > http://www.python.org/mailman/listinfo/python-list > > From cpatti at atg.com Thu Feb 10 11:59:22 2000 From: cpatti at atg.com (chris patti) Date: 10 Feb 2000 11:59:22 -0500 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <87tnmk$2uo$1@nntp6.atl.mindspring.net> Message-ID: aahz at netcom.com (Aahz Maruch) writes: > In article <87tkoi$hql$1 at nntp1.atl.mindspring.net>, > Michal Wallace wrote: > > > >Anyone know what, specifically, will not be compatible, and compared to > >what? :) > > Nope. I get the feeling that it will be similar to moving from Perl 4 > to Perl 5. > -- > --- Aahz (Copyright 2000 by aahz at netcom.com) E-gads. I _fear_ for that particular comparison :) -Chris (Perl's 'object system' introduced in Perl5 is one of the things that made me switch to Python! :) -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From btang at pacific.jpl.nasa.gov Fri Feb 18 12:11:11 2000 From: btang at pacific.jpl.nasa.gov (Benyang Tang) Date: Fri, 18 Feb 2000 09:11:11 -0800 Subject: module for sed, the stream editor Message-ID: <38AD7D2F.F4DEFD45@pacific.jpl.nasa.gov> Is there a python module to do sed, the stream editor? From Sunil.Hadap at cui.unige.ch Fri Feb 4 14:21:34 2000 From: Sunil.Hadap at cui.unige.ch (Sunil Hadap) Date: Fri, 04 Feb 2000 20:21:34 +0100 Subject: Freezing data members of a class! Message-ID: <389B26BE.F1E0760F@cui.unige.ch> Hello, I hope this is not too trivial question I want to stop the user from adding any more data members to instance of a class than those added by the constructor. Secondly I want to prevent the user from chaning type of the data member (trough assignment) which gets defined only construction time. I have done the following. Is this the best way! class SuData: def __setattr__(self,attrname,value): print "__setattr__ for %s called with value " % attrname, value if self.__dict__.has_key(attrname): if type(self.__dict__[attrname]) is type(value): self.__dict__[attrname] = value else: raise AssertionError, attrname else: raise AssertionError, attrname def __delattr__(self,attrname): raise AssertionError, attrname class SuNumericData(SuData): def __init__(self, initial): self.__dict__['_data'] = initial Python is fun to dig into! Thanks a lot Sunil From tseaver at starbase.neosoft.com Sun Feb 6 01:07:18 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 6 Feb 2000 00:07:18 -0600 Subject: Examples for boss: Python for www game and chat References: <3899BA97.D7CD8E90@psychosis.com> <389A455E.6DC89BD5@python.net> Message-ID: <8FB90F429C2DD269.6824DB9CE1092815.20F8B7B65155945D@lp.airnews.net> In article <389A455E.6DC89BD5 at python.net>, Thomas A. Bryan wrote: >Dave Cinege wrote: >> >> I need refereces, of of any internet gaming systems that utilize python > >Origin Systems in Austin, TX, once contacted me about a Python position for >some sort of multi-player online game. Unfortunately, I couldn't take the >job. I think that they also posted to comp.lang.python. Search deja.com >for the post....summer of 1999. > >---Tom They're still hiring, or were at IPC8. http://www.origin.ea.com/ is their URL. Multiplayer-massive'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From invalid.address at 127.0.0.1 Wed Feb 16 12:23:55 2000 From: invalid.address at 127.0.0.1 (David) Date: Wed, 16 Feb 2000 17:23:55 GMT Subject: Keep comp.lang.python Friendly Message-ID: <38aadad5.46484491@news.telus.net> I've been reading comp.lang.python since '98. One of the things that has most impressed me is the spirit of community displayed here. It is, I feel, one of the most important Python features: a supportive, communicative, open forum. My perception is that the social/emotional climate in this newsgroup has changed over the past few months. It is becoming less friendly and more hostile. I fully understand how difficult it is to maintain a positive attitude in the face of unwarranted abuse -- and there has been some abusive trolling taking place. Please maintain the high road. Always act friendly and helpfully, each and every time you post. It will require deliberately choosing your response, consciously overriding your gut impulse -- and it will be worth that effort. Thanks for reading and considering what I've said, and an especial thank-you to the 'wise old men' who have formed the backbone of this community, openly sharing their expertise with kindness, humour and patience. From phawkins at spamnotconnact.com Wed Feb 16 13:13:55 2000 From: phawkins at spamnotconnact.com (Patricia Hawkins) Date: 16 Feb 2000 13:13:55 -0500 Subject: shelve broken on redhat 6.1 Message-ID: Has anyone else noticed? Shelve is broken on the RedHat 6.1 distribution -- python-1.5.2-7.i386.rpm 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 >>> import shelve >>> x = shelve.open("x") >>> x["v"]=3 >>> x.close() >>> x = shelve.open("x") Traceback (innermost last): File "", line 1, in ? File "/usr/lib/python1.5/shelve.py", line 152, in open return DbfilenameShelf(filename, flag) File "/usr/lib/python1.5/shelve.py", line 142, in __init__ Shelf.__init__(self, anydbm.open(filename, flag)) File "/usr/lib/python1.5/anydbm.py", line 83, in open raise error, "db type could not be determined" anydbm.error: db type could not be determined >>> When I forced a downgrade to python-1.5.2-2.i386.rpm, it worked just fine. I haven't had a chance to look into this deeply (maybe a new version of one of the default DB's? maybe something wrong in the build?), but thought I'd mention it in case anyone else was having trouble with it. -- Patricia From kern at caltech.edu Mon Feb 21 19:02:12 2000 From: kern at caltech.edu (Robert Kern) Date: 22 Feb 2000 00:02:12 GMT Subject: PIL Fonts References: <38B1CD28.C6BA714@harborside.com> Message-ID: <88sjm4$oj6@gap.cco.caltech.edu> In article <38B1CD28.C6BA714 at harborside.com>, Brian Prentice writes: > I am using Windows 95 and have no access to the font files required by > the PIL library. I looked for bdf, pcf and pil fonts on the web but > could not find any. Could anyone please provide me with a basic set of > pil fonts (say Arial, Times Roman and Courier of various sizes in > normal, bold and italic)? Try the PIDDLE dristribution. http://piddle.sourceforge.net > Has anyone considered incorporating the true type renderer at > http://www.freetype.org/ into the PIL library. This would would enhance > the library considerably and solve the font availability problem. I don't know about including bindings to FreeType in PIL, but I have written an extension to expose almost all of FreeType's API to Python and to render onto PIL images. http://starship.python.net/crew/kernr/Projects.html I also have a slightly OO wrapper that I am cleaning up to make rendering tasks easier. I will try to get a Windows binary of version 0.6 up soon. -- 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 moshez at math.huji.ac.il Thu Feb 10 03:34:42 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 10 Feb 2000 10:34:42 +0200 (IST) Subject: Where is Python 1.6? In-Reply-To: <38A1E664.3CEAF4BF@be-research.ucsd.edu> Message-ID: On Wed, 9 Feb 2000, Curtis Jensen wrote: > Would it be possible to include a history ability into the Python > interpretor? Something simmilar to the BASH shell, or doskey in DOS. > Up-Arrow prints the previous command. I think this would be a great new > feature. Guido's time machine strikes again! Readline support retroactively added to Python! Film at 11. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From backov at nospam.csolve.net Sat Feb 12 12:04:14 2000 From: backov at nospam.csolve.net (Jason Maskell) Date: Sat, 12 Feb 2000 17:04:14 GMT Subject: Access violation in MSVCRT.DLL when attempting to use Python.. Message-ID: I have finally got all my code ported over to VC++, and now I seem to be having a strange problem.. I am testing out my glue code with simple test cases - in this case, I run this PyRun_SimpleString("ddinterface.setelement(('form','textfield0',{'text':'Bla hz','frame':0}))\n"); Which sets a couple properties of that interface element. The function works fine, decreases all the references that it needs to (I believe) and then return PyInt_FromLong(1); Somewhere after that return and before I get control back in C++, I get this access violation. I traced through the code and it's in Python for a quite a bit, then it's in MSVCRT.DLL. However, it is all in assembly so I have no clue what is going on. Can anyone give me a quick pointer how to set up VC so that I can trace into the python source? Do I need to link to the python debug dll? And really, the important question here: What's going on? Cheers, Jason From jcw at equi4.com Thu Feb 10 06:47:46 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Thu, 10 Feb 2000 12:47:46 +0100 Subject: small python implementation or python subset ? References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> <38A282D0.2487CA89@sxb.bsf.alcatel.fr> Message-ID: <38A2A55C.F16C61E@equi4.com> Marc BRETTE wrote: > > OK, to summarize all answer that has been dent to me : > > 1/ On unix the python executable after source compilation seems not to > be stripped. Performing a "strip python", I scaled my executable down > to 300 k (instead of 1.3 M - but with almost no module, even the > string implementation in C was not included). > > 2/ The URL http://www.abo.fi/~iporres/python/ gives a way to reduce > drastically python size. It provides a PDF document describing how to > do this and a patch file to apply to Python 1.5.1 (I didn't try it, > and don't know yet how to apply it, but it seems promising). > > Thanks a lot for all your answers. > > PS : For future keyword search : embedded python, reducing python, > lightweight python. You can add "SLOPPY" to that list - SourceLess One Package Python :) I've been hacking away at creating a smaller Python core which can be deeply embedded in various contexts. It runs .pyc files, and is pretty small (especially when upx-compressed, I'll save the conclusions for when this stuff is ready for public consumption). I invite everyone who has worked on this to send patches (or modified sources, but please get in touch first, to avoid useless repetition). End of this month, I'll integrate it all into a single patch set, ready for evaluation and hopefully acceptance into the Python core as a set of #ifdef's (like the current #define WITHOUT_COMPLEX). No promises, but I've brought this up and gotten a basic go-ahead from, eh, management :) Alternately, if someone else is almost there, please step forward so that we can exchange notes and get this stuff over and done with. -- Jean-Claude [MI5T] From curtis001 at my-deja.com Fri Feb 4 18:19:18 2000 From: curtis001 at my-deja.com (curtis001 at my-deja.com) Date: Fri, 04 Feb 2000 23:19:18 GMT Subject: fetch a html page via proxy? References: <387978ff.3083491@news.jps.net> <87cdfl$j60$1@nnrp1.deja.com> Message-ID: <87fmph$vhr$1@nnrp1.deja.com> Just a note to say that I fixed my proxy problem (whoohoo!) by getting the urrlib module from the tarball of the 1.5.2 version, and copied it into place. Dunno what was wrong with my old copy, but this -- along with using the http_proxy environment variable -- did the trick. (Now maybe I can sleep!) Curtis Sent via Deja.com http://www.deja.com/ Before you buy. From skip at mojam.com Tue Feb 22 18:03:40 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 22 Feb 2000 17:03:40 -0600 (CST) Subject: Porting Python to non-pc platforms In-Reply-To: <38B313D6.AD23EAB2@ttm.com> References: <38B313D6.AD23EAB2@ttm.com> Message-ID: <14515.5580.141809.386579@beluga.mojam.com> Scott> Not having Python on the 400 is the only thing preventing us from Scott> standardizing on it here as a development language at this point. Scott> We don't have the C compiler either. How about springing for the C compiler and doing the port? There's not really a chance to after that question. I presume that the C compiler for the AS/400 isn't free. Consequently, the port is not likely to happen in the traditional manner (person x discovers Python's not available on his favorite platform, y, so he downloads GCC and ports it). Consequently, the port will have to come (mostly) from the community that uses the platform and has the bucks to spring for the compiler. Just out of curiosity, what language have you standardized on, and on what platforms? Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From gerrit.holl at pobox.com Wed Feb 23 10:18:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 16:18:39 +0100 Subject: Which GUI? In-Reply-To: ; from vetler@ifi.uio.no on Wed, Feb 23, 2000 at 02:29:35PM +0100 References: <20000223083325.B1000@stopcontact.palga.uucp> Message-ID: <20000223161839.B3134@stopcontact.palga.uucp> > on 2000-02-23, Gerrit Holl wrote: > > > > > > * Gerrit Holl > > > > * Tkinter is built on Tcl/Tk, but because the bridge between > > > > Tkinter and Tcl/Tk is too large, Tkinter needs to provide their > > > > own documentation and advantages. > > > > > > It has already been mentioned in another posting that Tkinter in fact > > > does *not* depend on Tcl. (It was Fredrik Lundh in > > > ). > > > > Even worse. > > Tkinter needs to provide their own documentation > > this is actually wrong. I use the Tcl/Tk documentation all the time when > I'm using Tkinter. no problem. I *do* have had problems with this. Please type "man canvas" and search for 'create'. There's not straight way to find out the Python way without either reading the source or reading the documentation by the effbot. > > and advantages, while wxWindows or QT already has lots of > > documentation, that not need to be copied into wxPython and PyQT. > > wxPython and pyQt are not as portable as Tkinter. Please give an example! > > I repeat: > > > > Tkinter reinvents the wheel. > > WxPython uses existing code. > > > > Tell me, what's more OO? > > Tkinter does NOT reinvent the wheel. I can't understand where this comes > from. It provides their own classes. These classes are invented by Tkinter, they do not exist in Tcl/Tk. And the methods don't even *match* with Tcl functions! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From neelk at brick.cswv.com Tue Feb 8 21:40:39 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 9 Feb 2000 02:40:39 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> Message-ID: Bijan Parsia wrote: > > But seriously, the *size* of the Squeak base is rather large. The > biggest reasons for not using it as a drop in replacement for Python or > Perl is that 1) it's not *structured* to be a drop in replacement for > Python or Perl, and 2) the *content* of it's class library doesn't (yet) > cover a lot of things that people use Python and Perl for (especially on > the *nix size of things). > > One large advantage that both Perl and Python have is that they fit in > well with a fairly common mindset that stems from certain set > programming/working environments. This is more or less explicit in their > designs. Squeak and Smalltalk are not a smooth fit for that mindset, so > really mastering them typically requires a shift in deeply held habits. Only-half-a-joke: I think that Squeak's the biggest competitor not to Python, but GNOME and KDE -- the world just hasn't realized it yet. > I think this is generally true for Lisps as well. Less so, I think. For Common Lisp this is true, since it has development environments and coding habits strongly reminiscent of the ST style, but most Scheme implementations work more or less like any other Unix scripting language. (There are some noble exceptions, like DrScheme from Rice, but in general this is true I think.) And Dylan was designed from the start to be able to fit in either mold. The Gwydion compiler is basically the standard Unix compiler, but the Functional Developer environment (as well as the Apple release that preceded it) were very sophisticated dev environments. Neel From tim_one at email.msn.com Tue Feb 1 17:25:53 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 1 Feb 2000 17:25:53 -0500 Subject: Array Module In-Reply-To: Message-ID: <000101bf6d03$4dabd6e0$4b2d153f@tim> [Gene Chiaramonte] > Anyone else think we should add a sort() method to the array module? > > I do. More generally, arrays "should" support every list method that makes sense (other "missing" array methods include .index, .remove and .pop). Guido is known to accept patches . In the case of .sort, Python's list.sort() is (for "go fast on average", "go supernaturally fast in common special cases", and "don't go slow regardless" reasons) a difficult algorithm requiring some of the hairiest code in the whole implementation. Because C isn't itself polymorphic, it can't be reused for arrays (at least not without ugly multiple-include #ifdef trickery). list.sort() is constrained in that it knows nothing about the types being sorted, but each of the 11 flavors of arrays does know that, so a different algorithm entirely may well be better for arrays. The product of my time and interest isn't large enough to overcome all that . Until it overcomes somebody else's, this is likely your best bet: def sortarray(a, compare=None): """Array a -> return new sorted array of same type.""" import array aslist = a.tolist() if compare is None: aslist.sort() else: aslist.sort(compare) return array.array(a.typecode, aslist) The relative difference in time between this and what a native array.sort() would take becomes smaller the larger the array (because sorting dominates the time; the list<->array conversions are relatively cheap), up until the extra memory use triggers paging. if-it-wasn't-clear-the-answer-to-your-question-is-"yes"-ly y'rs - tim From echuck at mindspring.com Sun Feb 27 23:13:49 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Sun, 27 Feb 2000 23:13:49 -0500 Subject: trim() References: Message-ID: <38B9F5FD.CA99FED8@mindspring.com> I think this is pretty cool. I could use this for the CGI scripts I'm writing where I often have indented HTML. It ends up being indented in the final result which not only looks bad but takes up more bandwidth. Thanks, -Chuck "Michal Wallace (sabren)" wrote: > Hey all, > > I posted a couple days ago about actually needing a whitespace-eating > nanovirus.. And ever since I built it, I've been using it almost every > day for text processing... Being able to indent triple-quoted-string > is a really really nice feature: > > def test(): > > output = textmuncher(trim(""" > this is > some > input > text > """)) > > goal = trim(""" > this is > some expected > output text > """) > > assert goal == output, "test failed" > > Anyway, I was wondering if anyone else ever has need of that particular > capability. I think it's useful enough to go into the string module, and > I was just debating whether or not to submit it... here's the code: > > def trim(s): > """strips leading indentation from a multi-line string.""" > lines = string.split(s, "\n") > > # strip leading blank line > if lines[0] == "": > lines = lines[1:] > > # strip indentation > indent = len(lines[0]) - len(string.lstrip(lines[0])) > for i in range(len(lines)): > lines[i] = lines[i][indent:] > > return string.join(lines, "\n") > > .. I guess it probably ought to run expandtabs(), too, but.. well.. > what do you think? > > Cheers, > > - Michal > ------------------------------------------------------------------------- > http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ > ------------------------------------------------------------------------- From effbot at telia.com Mon Feb 28 08:23:57 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 13:23:57 GMT Subject: lambda fctions & local variables References: Message-ID: Frantisek Kvapil wrote: > I have some matching function: > def match(pattern,value): > return len(pattern)==len(value) > > and some finding function: > def find(pattern,list): > return filter(lambda x: match(pattern,x),list) > > but the problem is that the lambda function don't know > local variable pattern, > > so may you be so nice to tell me how to make it works > (still using lambda functions if possible) use explicit binding: return filter(lambda x, p=pattern: match(p, x), list) also see: http://www.python.org/doc/FAQ.html#4.5 http://www.python.org/doc/FAQ.html#6.10 From hildeb at www.stahl.bau.tu-bs.de Mon Feb 28 06:29:47 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 28 Feb 2000 11:29:47 GMT Subject: Mail attachments References: Message-ID: On Mon, 28 Feb 2000 10:15:24 +0000 (GMT), Oleg Broytmann wrote: >> I am trying to figure out how to read and interpret email attachments. I >> looked into mimetools.py and mimify.py, but don't really understand how they >> work. Say I have a message with multiple files attached, can I use some >> library function to determine where the attachments start and end, and/or to >> extract those parts? Or do I have to look for certain tags myself? I have a similar problem: I want to create an email with an attachment. Right now I simply invoke "mpack", which also takes care of sending the message, but I'd rather be independend... How can I implement that in native Python? From michael.stroeder at inka.de Thu Feb 24 08:15:07 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 24 Feb 2000 14:15:07 +0100 Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> <89382q$djb$1@nntp6.atl.mindspring.net> <38B527E3.DF8C61AD@inka.de> <8939pd$dj7$1@nntp6.atl.mindspring.net> Message-ID: <38B52EDB.F5D17971@inka.de> Aahz Maruch wrote: > > In article <38B527E3.DF8C61AD at inka.de>, > Michael Str?der wrote: > >Aahz Maruch wrote: > >> In article <38B51486.F0774310 at bibsyst.no>, > >> Thomas Weholt wrote: > >>> > >>>I want to use threading in a server-based search/index application. Any > >>>hints? > >> > >> Unfortunately, using threading in a server gets a bit more complex and > >> may not buy you very much. > > > >Hmm, about doing it like BoboHTTPServer.py found > >http://www.digicool.com/releases/bobo/ ? > > If you want to do it "like" Zope, why not just use Zope? (Bobo, Zope, > same difference.) I just meant to use BoboHTTPServer.py as an example for a threading SocketServer. > One of the Python mantras: "Never reinvent the wheel." Off course. Ciao, Michael. From aa at computer.org Fri Feb 4 04:46:24 2000 From: aa at computer.org (Anders Andersen) Date: 04 Feb 2000 10:46:24 +0100 Subject: Ann: PMZ - Poor Man's Zope References: <1262508367-6369026@hypernet.com> <3daelhyjc8.fsf@amarok.cnri.reston.va.us> Message-ID: > It's perfectly possible to use DTML outside of Zope; nght2html, the > templating system I use for my Web pages, uses DocumentTemplate > because I didn't want to write and maintain Yet Another templating > syntax, and DocumentTemplate has practically all the bells and > whistles you need. (nght2html is available at > http://www.mems-exchange.org/software/python/nght2html/ .) nght2html was unknown for me, and yesterday I announced [1] xmlt [2] with a similar usage. Xmlt also uses DocumentTemplate from Zope but the contents file (ht files in nght2html) of xmlt can be an ordinary html file (usually without any fancy markup for the layout). The user guide [3] gives a short introduction to xmlt. > -- A.M. Kuchling Anders, [1] ftp://starship.python.net/pub/crew/anders/xmlt/ANNOUNCE [2] ftp://starship.python.net/pub/crew/anders/xmlt/ [3] ftp://starship.python.net/pub/crew/anders/xmlt/doc/xmlt.html (also at my local site http://www.cs.uit.no/~aa/dist/tools/xmlt/) -- Anders Andersen - - From embed at geocities.com Tue Feb 22 09:42:08 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 22 Feb 2000 09:42:08 -0500 Subject: GUI in Python under MSDOS? Message-ID: <7gxs4.10514$Jz3.75949@nnrp1.uunet.ca> Is there any gui for Python that will operate under MSDOS, especially extended 32-bit MSDOS using the djgpp 32 bit C++ compiler/dos-extender? Yes, you heard me right. Support for VESA or even some common accellerated VGA cards would be excellent, but standard VGA [unaccellerated] would still be better than nothing. I found a version of Squeak [a free and nifty smalltalk-80 variant, see www.squeak.org ] that has a DOS version, but I much prefer Python's syntax and structure. Any ideas? Warren From felixt at dicksonstreet.com Thu Feb 17 01:35:12 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Thu, 17 Feb 2000 00:35:12 -0600 Subject: data structure design question In-Reply-To: <889cga$1ef$1@mach.vub.ac.be> References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> Message-ID: <3.0.5.32.20000217003512.0089b140@mail.dicksonstreet.com> At 17:03 2/14/00 GMT, Thomas Hamelryck wrote: >Felix Thibault wrote: >: H >: | >: C=O >: | >: H > >What you really need is a graph data structure. There is an excellent >module called kjbuckets that is just the right tool for the job. You can >consider the bonds as edges in the graph and the atoms as nodes. > >Take a look at: > >http://www.pythonpros.com/arw/kjbuckets/ > I'm looking at kjbuckets now, but I have a question about the graphs- the documentation says: [Graphs] relate Python hashable objects to other objects, with no significance to order or redundancies on the pairings. Technically, kjGraph defines a directed graph abstract data type... Does this mean that I can use a graph to show which atoms are connected, but I need to find some other way to show whether a bond is a single or multiple bond...or else have nucleus-nodes inter-connected by electron=pair-nodes ? Thanks, Felix >Cheers, > >--- >Thomas Hamelryck Institute of Molecular and Structural Biology >Aarhus University Gustav Wieds Vej 10C >DK-8000 Aarhus C Denmark > > > >-- >http://www.python.org/mailman/listinfo/python-list > > From tim_one at email.msn.com Sun Feb 27 02:55:47 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 02:55:47 -0500 Subject: Fun w/ lazy streams (was RE: functional programming) In-Reply-To: Message-ID: <000301bf80f8$0f3c0660$172d153f@tim> [Moshe Zadka] > Just one thing bugged me: Hmm! Something else bugged me: the version I got back on the mailing list said "filter" in one place where "sfilter" is in the original program, so the "stream of primes" example blew up. So, if that happens to anyone else, change any instance of "filter" to "sfilter". I probably bumped the "delete" key in my eagerness to see what the timbot was posting . > ... > Tim, with the natural implementation of even_stream, and odd_stream, > you do realize (of course you do) that > > sintersect2(even_stream, odd_stream) > > is a good old fashioned infinite loop? Oh yes. I bothered to write an "infinite loop" caution for sfilter's docstring, but got bored, so you should consider it implied everywhere else . > (What's more : sintersect2(even_stream, prime_stream) is not an infinite > loop, but taking its tail *is*) Yes, that's business as usual for this kind of approach too -- nothing gets computed until something else *requires* it. The raw intersection is, in effect, a delayed function evaluation. It's not until you specifically try to extract the tail (or head!) that the hopeless computation gets invoked. Here's the same thing in Haskell (read ":" as an infix cons): sintersect2 (x:xs) (y:ys) | x == y = x : sintersect2 xs ys | x < y = sintersect2 xs (y:ys) | otherwise = sintersect2 (x:xs) ys evens = [2, 4 ..] odds = [1, 3 ..] hopeless = sintersect2 evens odds No problem there, but you'll wait forever if you try to print head hopeless or tail hopeless Note the key word "print" there, though! Haskell is profoundly lazy, and e.g. the further definitions h = head hopeless t = tail hopeless don't cause a problem either -- unless you try to display h or t, or use them in some other context that actually requires one to get evaluated. > I sort of wonder how common this bug is in Haskell: it doesn't *look* like > an infinite loop. I'd say it's a common enough newbie problem, akin to getting surprised by mutable default args in Python. It's rare after experience, for two reasons: working with infinite streams requires picking up a few "tricks of the trade" (this is one), and functions like sintersect2 are pretty rare in practice. An experienced programmer knows better than to *try* to intersect infinite streams unless they have a priori reason to believe that the intersection is also infinite. So if they flub that, it's viewed not as a bug in the code but as a failure of analysis. Note one curious thing: the "vulnerable" stream functions I posted in Python are obvious from inspection: they're exactly the ones that begin with a "while" loop! It's harder to see the true source of the potential problem if they're written recursively instead (so much for recursion always being easier to reason about <0.9 wink>). > BTW: It reminded me of implementing the same thing in Scheme, where > everything is natural as breathing (with a snorkel, and through the ears, > but what the heck ) > > I actually think it was the same thing, except I didn't implement > intersect (probably unconcious fear of the infinite loop) Scheme, Haskell or Python, it's inherent in the problem domain. After all, even a simple "x in stream" is (in general, when stream is unbounded) undecidable. recusively-enumerable-made-concrete-ly y'rs - tim From blakelys at spamoff-ihug.co.nz Fri Feb 18 04:57:06 2000 From: blakelys at spamoff-ihug.co.nz (Simon Blakely) Date: Fri, 18 Feb 2000 22:57:06 +1300 Subject: Killer Apps??? References: Message-ID: PySol 3.40 If its the only game they play, I can switch to Linux Simon Nick Henderson wrote in message news:W45r4.864$Q36.49138 at news.uswest.net... > Hello, > > I am new to the world of programming and python. I know Zope is super cool > and is python's "killer app." > > I was wondering if there were any other such killer apps? > > Thanks, Nick Henderson > > From moshez at math.huji.ac.il Fri Feb 18 00:52:31 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 07:52:31 +0200 (IST) Subject: Miscellaneous design and Python use questions In-Reply-To: <87itzn19mz.fsf@travis.aggievilla.org> Message-ID: On 17 Feb 2000, Travis B. Hartwell wrote: > 2) I am planning using Python embedded in one of my applications -- > using C++ Builder for the GUI development and speed-critical > portions. For the rest, I would prefer to use Python just because I > have become accustomed to its power. But, I have been having a few > road-blocks in this plan for embedded Python. I guess I'm having a > hard time visualizing exactly where to have the 'dividing line' > between C++ and Python and in designing the interfaces between the > two. What are some general hints in designing applications using > Python as the engine and C++ as the front-end? Well, it sure seems to me like the wrong way around. In most applications I've seen, it's much easier to extend Python then to embed it. That is, if I were you, I'd code the whole application in a bunch of Python modules, and then take the few that are the bottleneck, and recode them in C/C++ keeping the same interface. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From kohler at medien.tecmath.com Tue Feb 8 04:59:58 2000 From: kohler at medien.tecmath.com (Markus Kohler) Date: Tue, 8 Feb 2000 10:59:58 +0100 Subject: Readable Functional Languages References: <000401bf6dfc$0ee5f180$822d153f@tim> <87fq9n$1sn$1@vvs.superst.iae.nl> <87okkg$42u$1@nnrp1.deja.com> Message-ID: <87op9v$2eo$1@sun.rhrk.uni-kl.de> Try smalltalk (www.squeak.org for example). It's a pure OOPL but it also comes with complete support for closures. Markus From tim_one at email.msn.com Tue Feb 15 03:42:03 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 15 Feb 2000 03:42:03 -0500 Subject: MI (was RE: Real Problems with Python) In-Reply-To: Message-ID: <001d01bf7790$88918f60$66a2143f@tim> [Neel Krishnaswami] >>> 3. Multiple inheritance is unsound >>> >>> By 'unsound' I mean that a method call to a method inherited by a >>> subclass of two other classes can fail, even if that method call >>> would work on an instance of the base class. [Tim] >> Unsure what this is about; am pretty sure nobody has complained >> about it before. Certainly "depth first, left to right" is an >> unprincipled approach, but in practice it's more than predictable >> enough to use. [Neel] > Here's some code: > > class Foo: > x = 99 > def frob(self): > print "%d bottles of beer" % self.x > > class Bar: > x = "bar" > def wibble(self): > print "Belly up to the " + self.x > > Note that all the operations on Foo and Bar work safely for direct > instances of Foo and Bar. But if you define a subclass like so: > > class Baz(Bar, Foo): > pass > > you can get type errors even though both of the superclasses have > type-safe operations: > > >>> q = Baz() > >>> q.frob() > Traceback (innermost last): > [...] > TypeError: illegal argument type for built-in operation Ah! That one. Don't worry about it . > This is only an annoyance in day-to-day work, It's never been an annoyance for me -- simply hasn't come up. I suppose it may someday. Then I'll rename the ambiguous attr <0.9 wink>. > but it becomes a big problem if you are serious about building > automatic code analysis tools for Python (eg for CP4E). This is > because the soundness theorems needed to write things like soft > typing tools no longer hold. :( The Types-SIG is wrestling with such things in a preliminary way, and it already appears all but decided that the full range of tricks you can pull in Python today are simply uncheckable, or even inexpressible with reasonable effort (e.g., the canonical example of that is "spelling" the type of Python's "map" function -- Python isn't curried, so an unboundedly many "base" signatures get involved). The language won't be changed to forbid such things, but if you want to use type checking you're going to have to accept restrictions on what you can code. I expect that, as in most other languages that take this all too seriously , the checker will look at the code above and say "name clash -- you're on your own; I can't help". I personally would be delighted to get such a warning & rewrite the offending code, since I personally would never want to rely on "depth-first left-to-right" for resolving clashes. But somebody else may want to, and that's fine too. Then again, overall, I think MI where implementation (beyond mere interface) is inherited from more than one class is usually far more trouble than it's worth (simple mixin classes are an exception), so I don't tend to get anywhere near this kind of trouble. As you noted later, SI languages don't have a problem here, and in practice it's (IMO) *usually* best to pretend an MI language is an SI one. I'll backtrack here & agree w/ your original post: this is indeed unlikely to "get fixed". Although it's likely you *will* get an option to warn about cases like this, at least in code where it *can* be detected at compile-time, and provided you explicitly ask to get warned. theoretically-absurd-yet-practically-sufficient-ly y'rs - tim From bjorn at roguewave.com Tue Feb 22 17:41:45 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 22 Feb 2000 15:41:45 -0700 Subject: Formatting a numerical string w/commas References: <200002221225.HAA00397@csa.bu.edu> <200002221312.OAA04666@pandora> <38B305E4.E74833C2@exceptionalminds.com> Message-ID: <38B310A9.90A1DDB3@roguewave.com> The only problem with these kinds of approaches, is that you are trying to reimplement locale dependent formatting by hand (and most approaches assume everyone is using the us locale :-) -- bjorn ps: as far as the coding style, the only suggestion I have would be to put the function comment in a doc string... Timothy Grant wrote: > I've seen some traffic on this formatting numbers, and recently had to > format and deformat some number for a Tkinter app I was writing, so I > wrote to fairly generic functions for doing so. > > This is the first time I've ever posted *real* code on the list so > please be gentle, but constructive criticism, especially about style, is > always welcome. > > ############################################################ > # > # Name: commanumber() > # > # Purpose: To format a number with commas and possibly a > # dollar sign. > # > # Arguments: n = the number to be converted > # dp = number of decimal places (defaults to 2) > # ds = dollar sign (1|0) (defaults to $) > # > def commanumber(n, dp=2, ds=1): > > if not n: > return '' # If None then bail out here > > if type(n) == type('x'): > if n == '': > return '' # If an empty string then bail out here. > n = string.atof(n) > > m = '%0.*f' % (dp, n) > > d = string.split(m, '.') # Split at the decimal point > r = list(d[0]) > > # It looks ugly but it really isn't. A couple of really nice > Pythonisms > # make it work right. The first is list insertion, and the second is > integer > # division. > # > # the insertion point is calculated based on the counter item, plus > the a left > # shift for each ',' already inserted the ((x/3)-1) > # > for x in range(3, len(r), 3): > r[(x+((x/3)-1))*(-1):(x+((x/3)-1))*(-1)] = [','] > > if ds: > s = '$' > else: > s = '' # Rebuild the string from the list > > for i in r: > s = s + i > > if len(d) == 2: # Check to see if we have a decimal portion to add > return s + '.' + d[1] > else: > return s > > > ############################################################ > # > # Name: stripfmt() > # > # Purpose: Strip all formatting from a prettified number > # > # Arguments: n = the number to strip > # > def stripfmt(n): > n = string.replace(n, ',', '') #remove commas > n = string.replace(n, '$', '') #remove dollar signs. > return n > > -- > Stand Fast, > tjg. > > Chief Technology Officer tjg at exceptionalminds.com > Red Hat Certified Engineer www.exceptionalminds.com > Avalon Technology Group, Inc. (503) 246-3630 > >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< > > -- > http://www.python.org/mailman/listinfo/python-list From echuck at mindspring.com Mon Feb 28 08:07:28 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Mon, 28 Feb 2000 08:07:28 -0500 Subject: Introspection Message-ID: <38BA7310.C6968E6E@mindspring.com> If I want a handle/pointer to an instance's class, how do I do that? In Objective-C I can say: [someObject class] Which in Python would be: someObject.class() However, Python doesn't have a well-defined root class with such utility methods. Also, I also don't see anything useful from: dir(someObject) Also, I notice the following oddity: I can use the __name__ attribute to get the name of a class, but if I say "dir(someClass)", I get attributes like __doc__ and __module__, but no __name__. How does Python get the __name__ then? >>> class Foo: ... pass ... >>> Foo.__name__ 'Foo' >>> dir(Foo) ['__doc__', '__module__'] >>> -Chuck From zeitlin at seth.lpthe.jussieu.fr Wed Feb 9 12:12:57 2000 From: zeitlin at seth.lpthe.jussieu.fr (Vadim Zeitlin) Date: 9 Feb 2000 17:12:57 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> <87omh2$lfi$1@oravannahka.helsinki.fi> <87p8ab$9l0$1@news1.xs4all.nl> <87pnfc$q5s$1@news1.xs4all.nl> Message-ID: On 8 Feb 2000 18:32:12 GMT, Boudewijn Rempt wrote: >That sounds cool! I did take a look at the latest documentation >available from the wxwindows website (indeed, I went to the length of >again trying to install the whole system, too), and it still showed the >old edit-box-on-top-of-the-grid widget. The docs, unfortunately, tend to lag a bit behind the code. However I just sent a proposal to wxwin-dev list with exact description of how this feature may be implemented and I'm 90% sure it will make it in 2.2 now. We plan to have support for arbitrary (even user-defined) data and the standard implementations for supporting strings, bools, lists and may be images (don't know how to edit those though...). I don't know when Robin will find time to add this to wxPython though - although this class is designed with wXPython in mind, so it should be relatively easy (i.e. not as difficult as many other things Robin had already done). >I'll go off badgering Troll Tech for a decent grid again, now ;-), just >to retain parity... And let the best one win :-) Regards, VZ From sabren at manifestation.com Fri Feb 18 16:44:10 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Fri, 18 Feb 2000 16:44:10 -0500 (EST) Subject: python online help? In-Reply-To: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov> Message-ID: On Fri, 18 Feb 2000, Benyang Tang wrote: > Is there a online help in python? Say something like > help print > would give document of the print command. not for print, but for just about anything else: >>> import sys >>> print sys.__doc__ Maybe there ought to be a "help" function built into the listener though for all the reserved words and whatnot.. Also to do paging for you... Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From fdrake at acm.org Thu Feb 10 15:35:26 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 10 Feb 2000 15:35:26 -0500 (EST) Subject: perl chomp equivalent in python? In-Reply-To: <20000210212121.B8912@stopcontact.palga.uucp> References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> <20000210212121.B8912@stopcontact.palga.uucp> Message-ID: <14499.8462.183995.348956@weyr.cnri.reston.va.us> Gerrit Holl writes: > >>> import os > >>> lines = open("path-to-file", 'r').readlines() > >>> for line in lines: > ... print line[:len(os.linesep)] > > cross-platformness-rules-ly y'rs - gerrit Gerrit, This won't work on DOS or Windows. os.linesep is two characters, but the line will only contain a '\n', since the file was opened in text mode. The original code was fine. ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From thantos at chancel.org Mon Feb 28 21:05:29 2000 From: thantos at chancel.org (Alexander Williams) Date: Tue, 29 Feb 2000 02:05:29 GMT Subject: Multi-argument append() is illegal References: <200002281541.KAA23255@eric.cnri.reston.va.us> Message-ID: On Mon, 28 Feb 2000 10:41:02 -0500, Guido van Rossum wrote: >I am going to rectify this in Python 1.6 -- people coming from other >languages might well expect list.append(a, b, c) to mean the same as >list.append(a); list.append(b); list.append(c), and it's always been >my philosophy to make ambiguous syntax illegal rather than to pick one >interpretation randomly. This would seem to violate the Principal of Least Surprise, at least when considering the rest of the language. Unless you also start requiring the presence of parens on every other construction of a tuple (as in: >>> a, b, c = string.split("1 2 3") ) you're introducing inconsistancy with Python in general. Just another thought. -- Alexander Williams (thantos at gw.total-web.net) | In the End, "Join the secret struggle for the soul of the world." | Oblivion Nobilis, a new Kind of RPG | Always http://www.chancel.org | Wins From greg at cosc.canterbury.ac.nz Tue Feb 8 19:47:36 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Wed, 09 Feb 2000 13:47:36 +1300 Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> Message-ID: <38A0B928.6CAD4245@cosc.canterbury.ac.nz> Warren Postma wrote: > > I have Acrobat 4.0 and it prints all the python manuals as a bunch of > accented vowels (a,e,i,o,u) plus typographic symbols and dingbats. :-( Are you sure you haven't got the Perl manual by mistake? :-) -- 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 effbot at telia.com Fri Feb 25 06:35:50 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 25 Feb 2000 11:35:50 GMT Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> Message-ID: Denys Duchier wrote: > proof by popularity according to which we should all eat > shit, since 50 trillion flies can't all be wrong. CP4F, anyone? ;-) From echuck at mindspring.com Sun Feb 27 23:18:43 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Sun, 27 Feb 2000 23:18:43 -0500 Subject: Python and ASP question References: <89apf7$sgr$1@nnrp1.deja.com> Message-ID: <38B9F723.67B83BFC@mindspring.com> I hacked together a quick prototype of ASP using Python as the language. So you don't use the ASP server or get any of its COM objects, but you do get HTML and Python using <% and %>. I don't know if you're stuck with ASP or not, or if that's more important to you than Python... I could pursue this program some more by creating more test cases, refining it, etc. I don't know how much interest is out there. -Chuck yosefgold at hotmail.com wrote: > I am trying to import a module (using the 'import' statement) into an > ASP page and it does not seem to be working. Is this a limitation of > Python/ASP or am I doing something wrong? > > My real goal is to import one of my own modules into the Application > context. However, I tried importing some built in modules, > like 'string' to see how these work. The ASP page does not seem to > recognize the 'import' statement. > > If import is not allowed, that severely limits the usefullness of using > Python as a ASP scripting language. The only other option would seem > to be to make my Python components available as COM objects. If I do > this however, I might as well write the ASP pages in Jscript or > VBscript. > > Is anyone using Python as an ASP scripting language for real projects? > > Thanks, > Yosef Gold > yosefgold at hotmail.com > > Sent via Deja.com http://www.deja.com/ > Before you buy. From effbot at telia.com Fri Feb 11 17:13:30 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 22:13:30 GMT Subject: Comparing file objects: what is compared? References: <20000211165155.A4849@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > >>> fp1=open('/tmp/file_one', 'w') > >>> fp2=open('/tmp/file_two', 'w') > >>> cmp(fp1, fp2) > -1 > >>> cmp(fp2, fp1) > 1 > > What is compared? The date of creation? The filename? The contents? http://www.python.org/doc/current/ref/comparisons.html tells you how comparisions work. this case falls in the "other types" category: "Most other types compare unequal unless they are the same object; the choice whether one object is considered smaller or larger than another one is made arbitrarily but consistently within one execution of a program." From thucdat1143 at my-deja.com Thu Feb 10 11:11:55 2000 From: thucdat1143 at my-deja.com (thucdat1143 at my-deja.com) Date: Thu, 10 Feb 2000 16:11:55 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> Message-ID: <87uo06$fri$1@nnrp1.deja.com> Blaming white space and delimeters are just silly excuse. In the hand of a good software engineer, even assembler dances and sings. There is no perfect language, there are only average and good SW engineers. Look up what Deja.com is looking for, none of the languages you listed below, but a very weird one: Perl ! Dat In article <87thrq$gf7 at news.or.intel.com>, "tye4" wrote: > Future language designers should learn from the blunders of Python > and other languages. > > Listed below, from worst to best block delimiter schemes found in languages. > > Pascal. Score: 2/10. Pascal is my most favorite lang... however, hate those > 'begins' - they create double indentation as shown below. This bug was fixed > in future incarnations of Pascal, e.g. Ada > > if foo then > begin > bar; > stool; > end; > > ------------------------------------- > > C++/Java. Score: 5/10 > if (foo) > { > bar(); > stool(); > } > > -------------------------------- > > Python. Score: 7/10. > Good points of Python: > 1) No semicolons at end of line > 2) No 'begin' or '{' for start of a block > 3) Forces programmers to indent (improves readability) > > Bad points: > 1) No visible indicator for end of a block > 2) If indentation level is 2 or 3 spaces, ending of block even more harder > to discern > 3) Have to pay careful attention to the properties of Editors (does it > convert tabs to spaces? etc.) > 4) Forces programmers to indent (potential source of errors if tabs and > spaces are mixed) > > if foo: > bar() > stool() > x = 10 > > --------------------------------------- > > Ada. Score 10/10 > No redundant 'begin' or '{'. Visible indicator of end of a block > > if foo then > bar; > stool; > end if > > XML: Score: 11/10. Simple and intuitive block begin and end. > > > > > > tye4 > > Sent via Deja.com http://www.deja.com/ Before you buy. From gtalvola at NameConnector.com Tue Feb 1 17:02:28 2000 From: gtalvola at NameConnector.com (Geoff Talvola) Date: Tue, 01 Feb 2000 17:02:28 -0500 Subject: question about COM and ADO References: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC99@RED-MSG-50> Message-ID: <389757F4.AD4F51A9@NameConnector.com> Bill Tutt wrote: > > Unfortunately, this doesn't work either: > > > > >>> rs.SetActiveConnection(None) > > Traceback (innermost last): > > File "", line 1, in ? > > rs.SetActiveConnection(None) > > File "E:\Program > > Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2 > > EA4x0x2x1.py", > > line 1490, in SetActiveConnection > > return self._ApplyTypes_(0x3e9, 8, (24, 0), ((9, 1),), > > 'SetActiveConnection', None, arg1) > > File "E:\Program > > Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2 > > EA4x0x2x1.py", > > line 375, in _ApplyTypes_ > > return > > self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid, > > LCID, wFlags, retType, argTypes) + args), user, resultCLSID) > > TypeError: None is not a invalid interface object in this context > > Ok, this is a tad bizzare... > What version of the Win32 extensions are you running? > > Bill AHA! I was using version 125. I installed version 128, and your suggestion of rs.SetActiveConnection(None) works perfectly. Thanks! -- - Geoff Talvola Parlance Corporation gtalvola at NameConnector.com From gmcm at hypernet.com Tue Feb 29 12:26:40 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 29 Feb 2000 12:26:40 -0500 Subject: (Easy ??) question about class definition In-Reply-To: References: Message-ID: <1260277295-30721219@hypernet.com> Gregoire Welraeds writes: > > I think the problem I have is common in OOP... but I don't have any > beginning of solution. That's because Python makes it too easy ;-). > I got the following problem. Imagine i want to manage a menu. So I define > 2 classes. First one is the class menu and is basicly a list of entry. The > second is the item class representing each menu entry. When an item of my > menu is selected, I want to execute some action... The action I want to > perform is different for each item. So I get the following > > class entry: > def __init__(self, name, action): > self.name= name > self.action= action > def selected(): > exec(self.action) > [some methods] Not quite. Change that to: def selected(self): self.action() Now the actions can be functions: def action1(): print "action1" e1 = entry("First", action1) or bound methods: class A: .... def action(self): print "A.action" a = A() e2 = entry("Second", a.action) That's all there is to it. > class menu: > def __init__(self, name): > self.name= name > self.list=[] > [some methods] > ... > > Now self.action is a reference to something I have to define elsewhere. It > could be a separate function... but then, the function is not bound to a > class as method are and everybody can use it. And I don't want to have > each action to be define in the class. > thus the problem is that each action i bound with an instance of the class > item. > I know there are some solutions in Design Pattern but I don't know howto > implement this in Python. > > thanks for your answer. > > -- > 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/ > ------------------------------------------------------------------------------- > > > > > -- > http://www.python.org/mailman/listinfo/python-list - Gordon From emile at fenx.com Fri Feb 4 21:57:53 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 4 Feb 2000 18:57:53 -0800 Subject: Haskell or Python! References: <000f01bf6edf$26ad09a0$a2a0143f@tim> <389B1F39.A6DC301A@prescod.net> <389B20B2.95834DE3@callware.com> Message-ID: <010c01bf6f84$cf152960$01ffffc0@worldnet.att.net> ----- Original Message ----- From: Ivan Van Laningham To: Python Mailing List Sent: Friday, February 04, 2000 10:55 AM Subject: Re: Haskell or Python! > Hi All-- > > Paul Prescod wrote: > > > > [bobbit] > > > http://webworst.about.com/entertainment/webworst/library/weekly/aa101498 htm?iam=ask&terms=gonad > > > > Since the conversation was devolving, I figured we might as well jump > > directly to the worst of the web. > > > > Luckily, the conversation can devolve no more. You have reached the > singularity, the pre-big-bang, of evolution. > Unless, of course, you buy into the closed universe model... > -ly y'rs, > Ivan;-(> > ---------------------------------------------- > Ivan Van Laningham The-future-is-so-bleak-in-the-open-model-ly y'rs Emile van Sebille emile at fenx.com ------------------- From mhammond at skippinet.com.au Sat Feb 12 19:27:18 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 13 Feb 2000 00:27:18 GMT Subject: Question concerning makepy.py for COM (long, code included) References: <2BB61D79860D1D3A85256881003AC7A0.003AC7DD85256881@ttm.com> <38A42C9B.268AF5D6@ttm.com> Message-ID: "Scott Anderson" wrote in message news:38A42C9B.268AF5D6 at ttm.com... > mhammond at skippinet.com.au wrote: > Next question then, since I'm getting the same error from static > dispatch as I am from dynamic: are OCX controls treated differently than > "normal" COM objects? Nope - everything is just a COM object. > Here's what I'm getting: ... > "C:\dev\python\win32com\gen_py\DBD89B20-C44F-11CF-8C05-0004AC77A721x0x 1x0.py", > line 50, in __setattr__ > pywintypes.com_error: (-2147418113, 'Unexpected failure', None, None) This is simply an error that has been returned from the object. Python (or me) has no idea what has caused this. Sorry. Mark. From linli at computer.org Wed Feb 23 08:30:11 2000 From: linli at computer.org (Lin Li) Date: Wed, 23 Feb 2000 14:30:11 +0100 Subject: help: menu item callback in TK References: <88uvl5$sj0$1@pollux.ip-plus.net> <38B369EB.D21F5BA8@bellatlantic.net> Message-ID: <38B3E0E3.508AB49F@computer.org> Steve Holden wrote: > lin li wrote: > > > > Hi, > > > > I have the following problem and any help is greatly appreciated. > > I generated a menu using the data in a dynamically composed list. > > Since I do not know what will be in the list, I can only have all the > > command items in the menu to point to the same callback. Now > > from inside the callback, how can I find out which menu item is > > selected? To make it more interesting, the menu can have two or > > three levels of cascades. > > > > I am running Python 1.5.2 with Tkinter on NT. > > > > Thank you very much. > > > > Lin > > Since you clearly must have the menu string available when you construct > the menu, can't you use the menu string in building a lambda which you > can use as your callback function? The lambda could call a function > common to all menu items, and inside that function you would be able to > access the string the user had selected. > > regards > Steve > -- > "If computing ever stops being fun, I'll stop doing it" Provided, of course, that I know how to use lambda. I decided to call this an incentive and start learning. Thanks a lot. Lin From gmcm at hypernet.com Fri Feb 4 21:27:55 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 4 Feb 2000 21:27:55 -0500 Subject: Execfile() - bug / strange behavior In-Reply-To: <87fp1r$1s4$1@vvs.superst.iae.nl> Message-ID: <1262404824-2550024@hypernet.com> Carel Fellinger wrote: > Tim Peters wrote: > > {Amit Patel] > >> I'm trying to understand why execfile(fn) is different from exec > >> open(fn,'r').read(). Here's my program: > >> > >> def timbot(): > >> a = 3 > >> execfile("1.txt") > >> print a > >> print locals() > >> timbot() > >> > >> > > > You can't actually get the timbot interested in pursuing this, since it > > never uses these things without explicity naming the dicts it wants used as > > execution context. > > And how then would it pass on the locals dict in this case? According to > the docs, and a recent explanation on this list, it is not possible to > use something like execfile("1.txt", globals(), locals()), as those are > readonly in case of functions! One of the few dark corners of Python IMHO. In this case: >>> d = {'a':3} >>> execfile('1.txt', {}, d) >>> d {'b': 8, 'a': 5} >>> The only reason for using execfile is if you don't know what the file contains. Thus you wouldn't know what names it will introduce. So the only sane way of dealing with it is with an explicit dict. KeyErrors are easier to deal with than NameErrors. - Gordon From sholden at bellatlantic.net Wed Feb 23 15:03:35 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 20:03:35 GMT Subject: Oil on troubled waters ... References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <20000223201942.A4980@stopcontact.palga.uucp> Message-ID: <38B43D19.F2BFBE1B@bellatlantic.net> Gerrit Holl wrote: > [original technical discussion snipped] > > > > umm. that's no Tkinter installation problems (but I'm > > sure Gerrit will pop up and say it is ;-) > > I consider this as a public insultation only because your > opinion on something differs from mine and my English lacks > here to explain how FURIOUS I am! No smiley can help you! > > I did not say Tkinter sucks. I explained why _I_ did not want > to use it. That's a personal opinion and I find this attack > ABSOLUTLY RIDICULOUS. I think despite your claimed lack of English (not often noticable in your technical posts, by the way) you have adequately conveyed a sense of outrage. However, nobody claims you said Tkinter sucks. This is one of those times when, if you don't see what's funny, it's better to walk away. Reduce your sensitivity setting a few notches ... I read this as good-natured joshing, not an "attack". Perhaps a feeble attempt at humor (though I must admit I smiled), but definitely not intended to insult or infuriate. More briefly: Get over it. Life's too short. Your obvious competence speaks for itself most of the time. daren't-put-a-smiley-on-this-one-ly y'rs Steve -- "If computing ever stops being fun, I'll stop doing it" From pinard at iro.umontreal.ca Thu Feb 24 21:08:54 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 24 Feb 2000 21:08:54 -0500 Subject: ANNOUNCE: Python Compiler (No spell errors) In-Reply-To: see_plus_plus@my-deja.com's message of "Thu, 24 Feb 2000 20:47:11 GMT" References: <38B04C41.CCE242FD@t-online.de> <8945c6$a8j$1@nnrp1.deja.com> Message-ID: see_plus_plus at my-deja.com ?crit: > Wait & See. This new compiler is coming out from the same country where > Mercedez, BMW & Porsche are produced. You know the quality of those cars, > do you? Do they have bulls in this country? :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From drs at labs.agilent.com Fri Feb 25 16:56:42 2000 From: drs at labs.agilent.com (David Smith) Date: Fri, 25 Feb 2000 13:56:42 -0800 Subject: parameter undefined in procedure References: Message-ID: <38B6FA9A.2AE5E25A@labs.agilent.com> Moshe Zadka wrote: > The "lambda" expression defines a function. Inside it, the only locals > are the parameters (since there can be no assignments inside a lambda), > so in your case the only local is "x". "dictionary" isn't a global, > and it isn't a builtin (thank God!) either. If you want your lambda > expression to see it, you have to explicitly define it: > > return map(lambda x, dictionary=dictionary: dictionary.get(x, "default"), > list) Thank you for the clarification. > If you think this is god-awful ugly, you're right. Why not code it > as an explicit loop? Lisp hangover, I suppose. Which is also the reason lambda is in Python, no? David Smith From moonseeker at my-deja.com Wed Feb 2 10:33:33 2000 From: moonseeker at my-deja.com (moonseeker at my-deja.com) Date: Wed, 02 Feb 2000 15:33:33 GMT Subject: dyn added methods dont know self? References: <878vfb$3hn$1@nnrp1.deja.com> Message-ID: <879iod$hf3$1@nnrp1.deja.com> In article , scarblac-rt at pino.selwerd.nl wrote: > You can just assign to them, self.function = etc. > > I think the 'self' is only used when the function you call in an instance > is part of its class. You can add functions to an instance, but you'd > have to give the instance manually, I suppose. > > class A: > def __init__(self): > self.text = "Spam!" > > # This function isn't part of the class, yet. > def foo(self): > print self.text > > # Make an instance > a = A() > > # Make foo an attribute of the *instance* > a.foo = foo > # Then it has to be called with the instance > a.foo(a) # Prints "Spam!" > > # However, it can also be added to the *Class*. Then you don't get > # the problem with the extra argument, but it's added to all instances. > del a.foo > A.foo = foo > a.foo() # Prints "Spam!" as well > > So, you call a function in an instance; if it exists in the instance, > it's just executed. If it doesn't, the interpreter looks in the class, > and fills in the instance as the first argument (the "self"). > > Why do you need this, anyway? :) Hi! I need this because I have to build an interface to a data string containing many data fields (output from a database), and I want to say 'Hugo is [2:11], now I generate a method Hugo() which returns the partial string. I have found out how to insert a method correct to an instance: new.instancemethod (function, instance, class) returns a method reference. Regards, Mike PS: I like dynamically generated methods, classes and modules, I use this heavily in my MUE project. Sent via Deja.com http://www.deja.com/ Before you buy. From culliton at clark.net Mon Feb 28 15:36:26 2000 From: culliton at clark.net (Tom Culliton) Date: Mon, 28 Feb 2000 20:36:26 GMT Subject: When to compile regex? References: <38A69D62.5A68F54D@chelmsford.com> <38b691f5.4085985@news.concentric.net> Message-ID: A common performance trick I use is to not just precompile all my regular expressions, but to even precompute the search or match method reference (e.g. - asrch = regex.compile(arg).search). Something that even caching can't help with. With a match or search in an inner loop this can make a significant difference in your throughput, and it's an optimization that can actually improve readability. In article , Fredrik Lundh wrote: >Tim Ottinger wrote: >> >In section 4.2.3 of the Python Library Reference (1.5.2) it says that >> >using compile is more efficient "when the expresion will be used several >> >times in a single program". I'm trying to figure out the intended >> >meaning of this. Does that mean "executed more than once", or "occurs >> >more than once in the program text"? Specifically, if it only occurs >> >once, but that is in a loop, is there an advantage to compiling before >> >entering the loop? >> >> It has to be compiled before it's used. If you don't compile it, then >> it will be compiled at the point of use, as a temporary, and then >> tossed away later. > >better make that: > > ...compiled at the point of use, stored in a cache, > possibly tossed away later, if the cache fills up. > >in 1.5.2, the cache holds 20 regular expressions. in 1.6, >it will probably be much larger. From robin at jessikat.demon.co.uk Sat Feb 26 13:34:41 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sat, 26 Feb 2000 18:34:41 +0000 Subject: functional programming References: <38B7FF8E.BC6F8C09@bellatlantic.net> <1260534928-15224947@hypernet.com> Message-ID: In article <1260534928-15224947 at hypernet.com>, Gordon McMillan writes >Steve Holden wrote: > >> Tim Peters wrote: >> > >> > [functional programming stuff with Moshe Zadka, who signed off with:] >> > >> > > disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. >> > >> > it's-only-half-as-scary-if-you-think-we're-the-same-ly y'rs - tim >> >> Sorry, but I have to disagree: that's at least twice as scary. The >> Timbot might well have been programmed in Yorkshire. If I ever >> see it write anything beginning with "I remember when I were an Icon >> generator ..." that will increase the scariness factor still further. >> >> "You had tail optimization? You were lucky ..." > >The Timbot had a tail? Heck, when I was lad we had to make >our own spines from discarded exoskeletons ... > >- Gordon > Tonight is Python night on TV; luckily I can remember this stuff from the first time around so I'm going to the pub. -pre-animately yrs- Robin Becker From patrick-lewisNOpaSPAM at yahoo.com.invalid Thu Feb 3 10:10:03 2000 From: patrick-lewisNOpaSPAM at yahoo.com.invalid (plewis) Date: Thu, 03 Feb 2000 07:10:03 -0800 Subject: _opengl mystery References: <38992034@9.242.61.10> Message-ID: <2dfadd60.38ddf0f1@usw-ex0103-085.remarq.com> I guess the short answer is uninstall the python-opengl rpm. It is only necessary if you want to run applications that use OpenGL. But, you want OpenGL to work, right? I have a Debian system, so things could be a little different for you, but here's what you should check: line 2 in /usr/lib/python1.5/site-packages/OpenGL/GL/__init__.py is "import OpenGL". (This file is imported when "from OpenGL.GL" is called). This causes your /usr/lib/python1.5/site-packages/OpenGL/__init__.py to load. line 1 of OpenGL/__init__.py is "import OpenGL.shared". This loads /usr/lib/python1.5/site-packages/OpenGL/shared/__init__.py into Python. On my system OpenGL/shared/__init__.py is: import sys,os sys.path.insert(0, __path__[0]+os.sep+sys.platform) This should insert (big breath) /usr/lib/python1.5/site-packages/OpenGL/shared/linux2 into the search path that Python looks for modules. I suspect something described above is not the same on your system (i.e. it is broken). Because, now OpenGL.GL should be able to call from _opengl import * and Python will be able to find your system's _openglmodule.so. As to your specific questions >1) Why would this module import another module that doesn't exist? It does exist, Python just can't find it. :) > >2) Where can I get these modules (either the numeric or the >_opengl). I >have installed > python-doc-html-1.5.2-1.noarch.rpm > python-opengl-1.5.5-2.i386.rpm > python-imaging-1.0b1-3.i386.rpm > python-tkinter-1.5.2-2.i386.rpm > python-imaging-_tkinter-1.0b1-3.i386.rpm >and all the supporting libs, but none of these have _opengl in >them The numeric homepage is at http://numpy.sourceforge.net. I have no idea if there is an rpm for it; I couldn't find one with a quick search at redhat.com. You may or may not need it, depending on your application. > >3) Am I correct in assuming that the file in question is called >"_opengl.py"? > "import _opengl" will try to find _opengl.py, _opengl.pyc, _openglmodule.so, and probably a few more variations that I am forgetting. _openglmodule.so is an "extension module" written in C. >4) is that _opengl_nummodule.so the numeric module for python? >If so, why >does "if OpenGL._numeric:" fail in the file >"/usr/lib/python1.5/site-packages/OpenGL/GL/__init__.py"? _opengl_nummodule.so is not the numeric module for python, but (speculation alert- haven't looked at source) is rather is a helper for PyOpenGL that uses the Numeric module. OpenGL can use Numeric for to help speed things up. Hope this helps. Patrick Lewis * 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 tseaver at starbase.neosoft.com Sun Feb 6 01:29:38 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 6 Feb 2000 00:29:38 -0600 Subject: Communicating with MICO References: <3898d8cb@nntp.server.uni-frankfurt.de> <87bl08$nui$1@pineapple.uk.research.att.com> Message-ID: In article , Samuel A. Falvo II wrote: >In article <87bl08$nui$1 at pineapple.uk.research.att.com>, Duncan Grisby wrote: > >>I prefer omniORBpy, but I wrote it so I'm not exactly unbiased. > >I may be talking to you in the future about this, if you don't mind. As >you're probably aware, I'm working on a COM implementation for Linux called >GCOM. The IDL for it will be based on CORBA's own IDL, and I plan on using >GIOP for communications between local servers. Remote servers are handled >via GIOP-IIOP bridges (called ORBs ... go figure!). Umm, perhaps I misunderstand, but in the CORBA world, GIOP is an "abstract" protocol, of which IIOP is an instantiation which uses TCP as its transport mechanism. TAO has another version called UIOP which uses AF_LOCAL stream sockets. There is at least one other, for DECnet, I think, but nobody is using it anymore. Protocol-schmotocol'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From bparsia at email.unc.edu Wed Feb 9 11:14:45 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 11:14:45 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> Message-ID: <1e5qf2x.1wwzz3givk8rdN%bparsia@email.unc.edu> Thomas Hamelryck wrote: [snip] > I never seriously tried out smalltalk because I could not get a good free > smalltalk implementation, not because of its weird syntax. I still miss a > lot of functionality in Squeak, but if that is added I will certainly give > it a go. Just FYI, there is a non-commercial (though not open source) version of VisualWorks 5i. Very cool environment. They've added rather nice XML/XSL support. It's certainly worth playing with. Cheers, Bijan Parsia. From nobooze4u at BLAM!worldnet.att.net Fri Feb 11 14:47:10 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Fri, 11 Feb 2000 19:47:10 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> Message-ID: <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> x-no-archive: yes Forget it wrote: > Just looked at the demo/embed sample. Haaaaah! K&R style. Ahahahaha. oooh. By belly hurts. Wow. I thought I was gonna wet my pants. I haven't seen any K&R C for probably, oh, like 10 years. Sorry, I'm bugging you, people, but I had to let it out or I was gonna be in trouble. I'll leave you alone now. From mwh21 at cam.ac.uk Thu Feb 3 14:47:34 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 03 Feb 2000 19:47:34 +0000 Subject: Built-in exception class not found References: Message-ID: Thomas Happ I writes: > Hello, > I am attempting to install Python on our systems here at RIT. > We're running Solaris 7. It seems to work in most respects, but whenever > any program is run, it displays the following message: > > Built-in exception class not found: EnvironmentError. Library mismatch? > [Warning! Falling back to string-based exceptions > [Python 1.5.2 (#4, Jan 14 2000, 09:18:57) [GCC 2.95.1 19990816 (release)] > [on sunos5 > [Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > > I looked through the Setup file in the Modules part of the > installation and couldn't find any modules related to this. I also > checked the FAQ and the Bug report but couldn't find any similar problems. > Has anyone encountered this or a similar problem before? (As I am not a > python user myself, please respond to me via e-mail -- I don't normally > read this newsgroup:) > Thanks, > Tom Hmm. Do you have a python 1.5.1 (or earlier) installation knocking about somewhere? Looking at cvs diffs, it seems that EnvironmentError appeared between 1.5.1 and 1.5a2, so if a python 1.5.1 library is being found before the 1.5.2 one, you'd get this error. I'd suggest either nuking the 1.5.1 install (if this is an option) or mucking with $PYTHONPATH. HTH, Michael From sanderson at ttm.com Tue Feb 22 19:48:03 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 22 Feb 2000 19:48:03 -0500 Subject: Porting Python to non-pc platforms (AS/400) References: Message-ID: <38B32E43.6B640461@ttm.com> skip at mojam.com wrote: > How about springing for the C compiler and doing the port? There's not > really a chance to after that question. I presume that the C > compiler for the AS/400 isn't free. Consequently, the port is not likely > to happen in the traditional manner (person x discovers Python's not > available on his favorite platform, y, so he downloads GCC and ports it). > Consequently, the port will have to come (mostly) from the community that > uses the platform and has the bucks to spring for the compiler. Well, first I would have to convince the CEO that we need Python. Then, I would need to convince him that we need Python on the 400. :-) > Just out of curiosity, what language have you standardized on, and on what > platforms? We haven't yet. I was considering moving to Java from a mixture of RPG, VB, and other assorted crap. That was before I discovered Python. I think I may go for a mixture, anyway. Java has the enterprise-class application server availability (Zope is nice [and I use it here], but it really can't compare to something like BEA WebLogic or Apple's WebObjects IMO), while Python is great for scripting and has a much lighter GUI footprint. Swing is an abomination. Regards, -scott From drek at interlog.com Fri Feb 11 17:00:26 2000 From: drek at interlog.com (Agent Drek) Date: Fri, 11 Feb 2000 17:00:26 -0500 (EST) Subject: compiling w/threads on NetBSD In-Reply-To: <20000211220612.A7720@stopcontact.palga.uucp> Message-ID: I'm compiling python 1.5.2 on NetBSD 1.4.1 ... I want to get ZOPE going on it. I suspect that an answer to this threads question will answer my ncurses q. I have this threads package installed ... /usr/pkg/pthreads ./configure --help tells me that I can ... --with-thread but it does not know anything about /usr/pkg/pthreads there is a switch for --with-libs= but none for --with-includesdir what can I do? -- -ly y'rs, Agent Drek Big Animation Inc > 'digital plumber' http://www.bigstudios.com From shawn_leblanc at my-deja.com Thu Feb 24 13:44:57 2000 From: shawn_leblanc at my-deja.com (shawn_leblanc at my-deja.com) Date: Thu, 24 Feb 2000 18:44:57 GMT Subject: Phyththon misspelling contest References: <38b6518c.14504847@news1.mysolution.com> Message-ID: <893u78$46n$1@nnrp1.deja.com> Greetings! > >Get Chaucerian, win valuable prizes! Extra points if none of > >your posts spells it the same way as any other. Bythawn? Paithauhn? with milk and cookies, Shawn Sent via Deja.com http://www.deja.com/ Before you buy. From nobooze4u at WHOOSH!worldnet.att.net Tue Feb 15 01:01:21 2000 From: nobooze4u at WHOOSH!worldnet.att.net (Yes, Sir) Date: Tue, 15 Feb 2000 06:01:21 GMT Subject: Python sucks loud References: Message-ID: x-no-archive: yes Grant Edwards wrote: > > In article , Forget it wrote: > >x-no-archive: yes > >You people are funny here, all excited about Python. > >Following one guy's recommendation, for two days already I'm looking at > >Python as a potential plug-in language, and it DISGUSTS me. > > [...] > > That's one of the lamest, most transparent flame-bait postings > I've seen in a long time. Cry you mercy! I know not what to offer your Lordships. > > -- > Grant Edwards grante Yow! I am having a > at CONCEPTION-- > visi.com From mikael at isy.liu.se Tue Feb 29 04:03:08 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 29 Feb 2000 10:03:08 +0100 (MET) Subject: HTML parser documentation In-Reply-To: <38badaa2_2@news1.prserv.net> Message-ID: On 28-Feb-00 sh wrote: > I want to write program to extract info out of web sites, process the info, > and then republish it on my web page. > > I heard that Python is the best language to do this, and it is an ideal > language to learn programming (i.e. I'm not much of a programmer). The > online info on Python.org is too difficult for me to understand. > > Can anyone please suggest a well written web page or book that can help a > newbie like me learn this subject matter? I've researched Python books > online, but none of the descriptions mention coverage of HTML parsing. I can recommend a few. First, a tutorial by Josh Cogliati. http://www.honors.montana.edu/~jjc/easytut/ Second, two short ducuments written by Magnus Lie Hetland; a tutorial on Python and an introduction to programming. You can reach them through http://www.idi.ntnu.no/~mlh/python/ The site seems to be down at the moment, though. Enjoy, /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: 29-Feb-00 Time: 09:52:18 This message was sent by XF-Mail. ----------------------------------------------------------------------- From nobooze4u at SPLAT!worldnet.att.net Sat Feb 12 01:06:20 2000 From: nobooze4u at SPLAT!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 06:06:20 GMT Subject: Python sucks loud References: Message-ID: x-no-archive: yes Dennis Lee Bieber wrote: > > On 11 Feb 2000 23:27:17 GMT, Samuel A. Falvo II) > declaimed the following in comp.lang.python: > > Forget it wrote: > > >x-no-archive: yes > > ^^^^^^^^^^^^^^^^^ > > Hahahahahahahahahaaa! > > > > Newbie. > > I've been in other newsgroups where it has been stated that most > sites which honor "no archive" headers will also accept it as the first > line of text in the body -- explicitly for those "do everything poorly" > utilities folks insist on using... Damn. Why did you tell him? I was gonna provoke this pompous ass into betting like $50 on it . Coz I need the money, you see. From jkraai at murl.com Sat Feb 19 13:45:58 2000 From: jkraai at murl.com (jim kraai) Date: Sat, 19 Feb 2000 12:45:58 -0600 Subject: Killer Apps??? References: Message-ID: <38AEE4E6.38642254@murl.com> Python XML toolkits have the potential to be a killer app. But without a force like TCL's Scriptics Connect, it won't be. Hoping-this-stimulates-adrenal-glands-ly y'rs, --jim Nick Henderson wrote: > > Hello, > > I am new to the world of programming and python. I know Zope is super cool > and is python's "killer app." > > I was wondering if there were any other such killer apps? > > Thanks, Nick Henderson From aahz at netcom.com Fri Feb 18 01:00:47 2000 From: aahz at netcom.com (Aahz Maruch) Date: 18 Feb 2000 06:00:47 GMT Subject: Killer Apps??? References: Message-ID: <88in6f$evg$1@nntp6.atl.mindspring.net> In article , Nick Henderson wrote: > >I am new to the world of programming and python. I know Zope is super cool >and is python's "killer app." > >I was wondering if there were any other such killer apps? Yes. Zope. I-know-you-think-I'm-joking-but-I'm-not-ly y'rs, -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From darcy at vex.net Fri Feb 4 21:15:09 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 5 Feb 2000 02:15:09 GMT Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> <87f8ko$qah$1@news.tht.net> <6AGm4.2674$dT4.201832448@newsb.telia.net> Message-ID: <87g13d$1mlh$1@news.tht.net> Fredrik Lundh wrote: > D'Arcy J.M. Cain wrote: >> I just received an advance copy of Martin C. Lawrence's "Python the > you mean "Martin C. Brown", right? Doh! Yah. I was writing that from a client's site from memory. > iirc, the book was published in november, so > it should be out there. The copyright says 2000. I assumed that that meant that it had to have been published this year. Are copyrights like car model years? :-) -- 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 newsbunny at noether.freeserve.co.uk Sun Feb 13 07:12:48 2000 From: newsbunny at noether.freeserve.co.uk (Martin P Holland) Date: Sun, 13 Feb 2000 12:12:48 +0000 Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: <883cm6$mud$1@news1.xs4all.nl> <885sd0$okq$1@news1.xs4all.nl> Message-ID: On 13 Feb 2000 09:09:52 GMT, Boudewijn Rempt wrote: > Curiously, most of those who >downloaded kpybrowser were Windows users. Can't imagine that they will >be able to fire it up... I imagine that this is a case of having to submit to tyranny at work but at home they have free will and use the one true OS ;-) atb Martin -- http://www.noether.freeserve.co.uk http://www.kppp-archive.freeserve.co.uk From moshez at math.huji.ac.il Fri Feb 18 23:35:28 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 06:35:28 +0200 (IST) Subject: What a weird thing !!? In-Reply-To: <88kca9$il$1@news3.isdnet.net> Message-ID: On Fri, 18 Feb 2000, Florent Rami?re wrote: > And is there a solution to my problem ? > And sys.stdout.write is not a good solution for me (i need to keep > printing with print) Why? > Is there an easy way to override the print statement (i saw it one time > in the news, but i can not find it) No. You might be able to do something with sys.stdout.softspace, but it won't be easy -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From paul at digicool.com Sat Feb 12 13:47:16 2000 From: paul at digicool.com (Paul Everitt) Date: Sat, 12 Feb 2000 13:47:16 -0500 Subject: OT: Celebrating Python Message-ID: <38A5AAB4.5F56B3A0@digicool.com> Today I put on my shirt from SPAM 1, and noticed the date of the conference: Feb 13-14, 1994. I was a bit surprised -- I didn't think it was _six_ years ago! I also noticed that tomorrow marks the sixth anniversary of the first conference. Thus, in the midst of all the regular newsgroup traffic, tomorrow's a good time to think back on how far Python has come. Those of us at the get-together at NIST six years ago can certainly attest, quite a ways indeed! --Paul From ivanlan at callware.com Wed Feb 2 21:12:12 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 02 Feb 2000 19:12:12 -0700 Subject: re AMTE thread re DrScheme & Python References: <65118AEEFF5AD3118E8300508B124877073D52@webmail.altiris.com> <3898d76d.201105044@news.teleport.com> Message-ID: <3898E3FC.61C6CA9C@callware.com> Hi All-- Kirby Urner wrote: > ]snip[ > I, in turn, sincerely apologize for writing an emotional evaluation about > Python and its users. I should not have given permission to post my first > reaction to a newsgroup about which I knew nothing. I particularly regret > using the word "cult" for Python users. > > -- Matthias Felleisen > Hmmph. It's not enough. He should grovel more, and he should be forced to use Python for a month. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com ivanlan at home.com http://www.pauahtun.org See also: 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 rickhigh at aol.com Wed Feb 2 23:34:30 2000 From: rickhigh at aol.com (RICKHIGH) Date: 03 Feb 2000 04:34:30 GMT Subject: JPython mentioned in featured article at JDJ References: <38975303.C91E8D69@earthlink.net> Message-ID: <20000202233430.24799.00000952@ng-ce1.aol.com> It is on the JDJ http://www.sys-con.com/java/archives/subscribe/0502/ Also be sure to vote for you favorite language..... http://www1.sys-con.com/forums/Thread.cfm?CFApp=2&Thread_ID=379&mc=25 From bparsia at email.unc.edu Thu Feb 10 00:51:19 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Thu, 10 Feb 2000 00:51:19 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> Message-ID: <1e5rfjz.9cxojz7w765jN%bparsia@email.unc.edu> Neel Krishnaswami wrote: > Paul Prescod wrote: > > > > I admit that Smalltalk and Lisp have annoyed me for a while. I would > > apologize for taking it out on you but actually I didn't. The question > > was asked whether languages succeed or fail for a reason. I strongly > > believe that they do. If you spend 10 minutes reading www.python.org and > > then 10 minutes on www.smalltalk.org you will see the difference > > yourself. I'm still missing the big problem with www.smalltalk.org. I thought the proposals for mod.smalltalk and xml.smalltalk were useful and interesting. Are these even comparable sites, aside from the domain names? www.python.org is run by an organization which one *might* describe as an "industry group", but also is, as much as any group is, the "vendor" of the Python 1.5.2 implementation. (Nothing *wrong* with any of this, mind.) www.smalltalk.org is and advocacy site run by an individual. And I *still* don't see what's so wrong with it. Try surfing around a bit more before generalizing. >If it is an attack against the Smalltalk community to point > > out that they have surpressed widespread knowledge of a great > > programming language for nigh twenty years? It's an attack, and an unfounded one, to suggest that the Smalltalk community "suppressed" knowledge of Smalltalk, yes. It's also just plain *false*, but what does *that* matter? And your recent posts *help*? Criticism is one thing; mindless, inaccurate, vague, uninformed bashing is another. Y'know. Sorta like the stuff about whitespace. [snip a very nice summary of Common Lisp resources. I could say similar things about Smalltalk.] > > Smalltalk and Lisp should be a hundred times more popular today than > > they are. The state of programming language deployment should be five > > years ahead of where it is. People should not think that Java is cool > > and modern. It's all very disappointing. And it's all *our* little fault. Deary me :) [snip] > >This annoys me not only because it holds the ideas in Smalltalk > > back from popularity but because it strikes me as arrogant. Just give > > me a programming language please! Well, *striking* you as arrogant is one thing. *Being* arrogant is another. Historically, there have been "IDE free" Smalltalks. They generally haven't caught on. Gnu Smalltalk is being revitalized, so there will be one again. You can run headless versions of many Smalltalks, yadda yadda yadda. Silly facts. I won't even go into the fact that some of the important ideas of Smalltalk are in the fact that (for most implementations) the "language" syntax is just *one* interface to the objects. You don't write program texts, you manipulate program objects through an number of modalities. This has some interesting consquences, and is worth exploring. IMHO. [snip] Cheers, Bijan Parsia. From python-list at teleo.net Tue Feb 8 00:59:10 2000 From: python-list at teleo.net (Patrick Phalen) Date: Mon, 7 Feb 2000 21:59:10 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87o4ge$od9$1@nnrp1.deja.com> References: <860ftk$bas@news.or.intel.com> <00020717051900.00606@quadra.teleo.net> <87o4ge$od9$1@nnrp1.deja.com> Message-ID: <00020722101600.00643@quadra.teleo.net> [fcahoon at my-deja.com, on Mon, 07 Feb 2000] :: You know, Patrick, when viewed from deja.com, the way you've quoted me :: is seriously mis-formatted. I think the problem stems from your use of :: tabs as indentation. :: :: Good thing it's not python code, eh? No, actually they were spaces. Too many spaces. ;) :: Earlier in your post, you expressed pleasure at the prospect of Perl's :: popularity waning (oops, I snipped that part before realizing I would be :: referring to it). Not at all. I was expressing pleasure at the prospect of Python's popularity waxing. After all, that's what the majority of your paragraph was about. :: > [ ... remainder snipped for brevity (hope that's ok) ... ] I'm all in favor of that. From bedard at info.uqam.ca Fri Feb 18 15:57:14 2000 From: bedard at info.uqam.ca (François Bédard) Date: Fri, 18 Feb 2000 20:57:14 GMT Subject: Which GUI? References: Message-ID: I see no mention in this thread of JPython + Swing. Any special reason? Fran?ois B?dard Anders M Eriksson has written > Hello! > > As a new comer to Python I have not yet started programming apps that > has a GUI. I have concentrated my efforts on CGI. > > But now I'm reaching the point of no return and I need to create apps > with a GUI, but which one? > > I'm using Windows NT as my development platform and at the moment my > apps will probably not be interesting enough for anyone else, but... > > I would like pro and cons for the different GUI's > > // Anders > From Denys.Duchier at ps.uni-sb.de Fri Feb 25 16:33:10 2000 From: Denys.Duchier at ps.uni-sb.de (Denys Duchier) Date: 25 Feb 2000 22:33:10 +0100 Subject: functional programming References: Message-ID: Moshe Zadka writes: > On 25 Feb 2000, Denys Duchier wrote: > > > The point, however, is moot since, as I suggested previously, the > > finalization semantics of Python (much like that of C++) are not > > easily reconciled with tail call optimization. > > I won't say anything about C++ (what I'd like to say about it isn't > fit for prime time), but about Python, this is untrue: either the called > function has a reference to the object (in which case it won't be > finalized) or it can be deleted when the calling frame is deleted, in > which case the call to the destructor will *precede* the tail-call, > and still leave it in tail position. As I said in my original message, you can indeed do this but it violates an assumption that many Python programmers seem to care about: namely that the destructor of an object is invoked when exiting the scope rather than prior to the tail call, or, as the logical generalization would have it, as soon as possible (i.e. as soon as it is no longer referenced in subsequent code). Consider the following (I am not saying that this is necessarily a sensible programming style, but current Python semantics give it a straightforward reading and I have actually occasionally done similar things in C++): class Lock: def __init__(self): acquire_some_lock() def __del__(self): release_some_lock() def foo() lock = Lock() baz() It makes a difference whether the lock is released before the call to baz() or after. I am by no means sanguine about keeping Python's finalization semantics, but it _is_ an issue that makes a difference. Sincerely, -- Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de Forschungsbereich Programmiersysteme (Programming Systems Lab) Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier Postfach 15 11 50 Phone: +49 681 302 5618 66041 Saarbruecken, Germany Fax: +49 681 302 5615 From def-p at usa.net Sun Feb 27 16:45:36 2000 From: def-p at usa.net (Def P) Date: 27 Feb 00 14:45:36 MST Subject: Mail attachments Message-ID: <20000227214536.3558.qmail@nwcst283.netaddress.usa.net> Hi, I am trying to figure out how to read and interpret email attachments. I looked into mimetools.py and mimify.py, but don't really understand how they work. Say I have a message with multiple files attached, can I use some library function to determine where the attachments start and end, and/or to extract those parts? Or do I have to look for certain tags myself? ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 From bjorn at roguewave.com Mon Feb 21 18:06:49 2000 From: bjorn at roguewave.com (bjorn) Date: Mon, 21 Feb 2000 16:06:49 -0700 Subject: Formatting a numerical string w/commas References: <200002212202.RAA17807@csa.bu.edu> Message-ID: <38B1C508.5D4BF97A@roguewave.com> Hmmm.... this is actually interesting ;-) _locale seems to be built in on my windows box, but not on my linux or hp boxes... I'm cc'ing Martin and the list, in case anyone else knows more about this. -- bjorn steven moy wrote: > >import locale > >locale.setlocale(locale.LC_ALL, 'us') > > Hi Bjorn, > > Thanks for the reply. I'm fairly new to Python so I'm still trying to > get a feel for how things work. The "import locale" is looking for > an "_locale" module which doesn't seem to exist on either of the systems > I'm working on. Where can I get that or is it something I'm supposed to build > on my own? > > Thanks again for your time, > > -$ From dgrisby at uk.research.att.com Wed Feb 2 14:05:26 2000 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 2 Feb 2000 19:05:26 -0000 Subject: Porting omniORB python to OpenVMS References: <877rom$akl$1@nnrp1.deja.com> <8791t9$f19$1@pineapple.uk.research.att.com> <879p1s$mqa$1@nnrp1.deja.com> Message-ID: <879v5m$l75$1@pineapple.uk.research.att.com> In article <879p1s$mqa$1 at nnrp1.deja.com>, wrote: >in the example client with the example server running (both from >omniORBpy/releasenote). Yes! Congratulations on your successful port. Did you have to make any patches to omniORBpy to get it to work? If so, can you send them to me please. Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From alv50855 at batman.tamucc.edu Sun Feb 27 08:31:08 2000 From: alv50855 at batman.tamucc.edu (alv50855 at batman.tamucc.edu) Date: Sun, 27 Feb 2000 13:31:08 GMT Subject: name of object inside it's methods? Message-ID: <8EE74F2D4usenetacct@216.169.37.95> can someone fill in the blank ------------------------------- class Hello: def __init__(self, x): self.x = x def classname(self): ------------------------------- >>>from hello import * >>>clown = Hello(1) >>>clown.classname() clown In other words I want the method to print the name of the object that it belongs to From bparsia at email.unc.edu Mon Feb 7 22:27:37 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Mon, 7 Feb 2000 22:27:37 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> wrote: [snip] > I am not a Python user for this very reason, and I know many developers > who are interested in the buzz about Python but when they hear "Python > uses whitespace as syntax" refuse to touch it. Er... almost every language uses whitespace as syntax, usually for token delimitation (is that the word?). I believe that Fortran didn't use whitespace as syntax. Ick. Oh oh oh. You mean use whitespace as *block* delimiters. Yes, Python and several other languages use that to some degree, Python rather deeply and consistently. So you should point out to those developers that it's *not at all* like Fortran, and they should take a look and maybe a touch before tossing it. > I am a C programmer who works in an environment where many coders have > come and gone, and some were better than others. Different tab > conventions have been used in different places in the codebase, and > sometimes tabs have been converted to spaces incorrectly as well -- > leaving a horrible mess. Sure. Of course, there was no compiler based mechanism enforcing consistent levels of indentation, was there? That *might* make a difference, eh? I think, notwithstanding your experience with C (though why that should be applicable to Python...), *you* have a riddle to answer: There is a *lot* of Python code out there. The standard distribution contains loads of modules from many different sources. You *yourself* indicate that Python is becoming common place.... ....*if* keeping Python block structure working were such a difficulty, don't you think someone might have noticed by now? Given that it's pretty much only a problem in a few, well defined places, why are you so worried aobut it? > Fortunately it is easy to fix this with a pretty-printing program (I use > "M-x indent-region" in emacs). That is because the information required > to fix the indentation _is present in the file_. Not if the curly brace eating nano-virus strikes! > If python code were to become mis-formatted (and given my experience, I > have to believe that sooner or later this _will_ happen) Er...not your experience of *Python* code, right? So, your experience with Python code: 0. Everyone elses: >0 (some up to, what, 8 years? 10 years?). I think it more correct that your *lack* of (relevant) experience leads you to your belief. Cheers, Bijan Parsia. From dgrisby at uk.research.att.com Mon Feb 14 06:15:57 2000 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 14 Feb 2000 11:15:57 -0000 Subject: [CORBA] omniNames feature request References: Message-ID: <888o5d$mk9$1@pineapple.uk.research.att.com> In article , Samuel A. Falvo II wrote: >Can an option be added into the next release of omniNames (like -iorfile >) such that it causes omniNames to produce a very simple text file >containing nothing but the name service's IOR? I need this output because >omniORB's solution to boot-strapping the name service is ... well, >omniORB-specific. My application needs complete interoperability, so I need >to publish the name service's IOR at a well-known TCP/IP port using plain >sockets. Good idea. That will be easy to do. In the mean time, the IOR is printed in the omniNames log file on a line like Root context is IOR:.... so it's easy to extract it from there. >(Why, oh WHY didn't OMG specify a fixed TCP/IP port and object key for the >name service? Is it really too much to ask for?!) The OMG has now come up with a thing called the Interoperable Naming Service which solves these issues. It hasn't been fully accepted yet, and it has undergone many changes over its lifetime. Once it is finally standardised, which will hopefully be in the next few months, omniORB and omniORBpy will support it. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From nielsenjf at my-deja.com Tue Feb 29 20:29:41 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Wed, 01 Mar 2000 01:29:41 GMT Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: <894ea9$h33$1@nnrp1.deja.com> Message-ID: <89hrq1$n50$1@nnrp1.deja.com> Another thing to do is import time and print err I mean Response.Write str(time.strftime('%H:%M:%S',time.localtime(time.time()))) I'm curious if python starts on time, but you don't see the page several seconds later. Also, print out your paths, maybe some path information is screwed up. And did you look at all of your SeverVariables? This puts all of the SeverVariables in a nice python dictionary: d_env={} #initialize dictionary for key in Request.ServerVariables: d_env[key]=str(Request.ServerVariables(key)) How much of the setup do you know about? Do they have something silly like python installed on a busy remote share? john In article , Tom Funk wrote: >> > 1.5.2 (blah-blah-blah) -- I made a page the imported sys.py and printed > sys.version. > > Good idea.... > > Thx. > > -- > -=< tom >=- > Thomas D. Funk (tdfunk at asd-web.com) | "Software is the lever > Software Engineering Consultant | Archimedes was searching for" > Advanced Systems Design, Tallahassee FL. | > > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From dworkin at ccs.neu.edu Tue Feb 22 23:54:30 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 22 Feb 2000 23:54:30 -0500 Subject: functional programming In-Reply-To: "Michal Wallace's message of "Tue, 22 Feb 2000 19:08:17 -0500 (EST)" References: Message-ID: "Michal Wallace (sabren)" writes: > Aahz posted a recursive version of a fib() routine. Is this > not what you'd want? What would fib() look like in one of the > functional languages you're used to? The function Aahz posted looks much like the immediately intuitive version of the same function in most functional languages. However, that is far from the most efficient way to compute fibonacci sequences, and you would probably optimize a program in a functional language quite differently than a program in Python. Contrary to what someone wrote earlier, you most certainly _can_ program functionally in Python. It just isn't easy. Also, typical functional idioms tend to be painfully inefficient in Python. Viper addresses some of the implementation issues that make this so, but the core Python implementation probably never will. -Justin From pf at artcom-gmbh.de Fri Feb 25 02:38:01 2000 From: pf at artcom-gmbh.de (Peter Funk) Date: Fri, 25 Feb 2000 08:38:01 +0100 (MET) Subject: Just tested Tcl/Tk 8.3.0 with Python: Some problems remain. In-Reply-To: from Robin Becker at "Feb 25, 2000 0:41: 5 am" Message-ID: Hi! Robin Becker wrote: [...about my testing of Tcl/Tk 8.3.0 together with Python on Linux...] > >(gdb) bt > >#0 0x401812bf in FreeResources () from /usr/local/lib/libtk8.3.so > >#1 0x401810d4 in Tk_FreeConfigOptions () from /usr/local/lib/libtk8.3.so > >#2 0x401b546b in DestroyListbox () from /usr/local/lib/libtk8.3.so [...] > I'm using pmw 0.8.1 with tcl/tk8.3 on win32 and don't seem to get this > with any of the combobox demos. Which combobox demo and what exactly > caused the problem I've just rerun the 'ComboBox_test.py' in the Pmw_0_8_1/tests directory and the problem stays the same. The program segfaults during a test with a pulled down listbox containing some longer strings. Sorry, that this is not very specific. But at the moment I've no time to investigate this further. Your experience shows that this seems to be a problem related to the memory management under Unix/X11 only. May be that I get some time next week and than I could try this on one of our Solaris or IRIX boxes with Purify. This morning I've seen, that the Box with Metrowerks Code warrior 5.0 for the Mac just arrived on my desk. This is required to build Tcl/Tk/Python from Source under MacOS. One of my employess will try this during the next week. I will report about our experience later. Regards, Peter From effbot at telia.com Wed Feb 16 11:38:44 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 16:38:44 GMT Subject: Unicode support in Python 1.6 References: <38AA70AB.24B8ED1@sap.com> Message-ID: Daniel Dittmar wrote: > Can anyone explain how Unicode will look like in 1.6? I suppose there > will be a new type similar to strings yes. > but will there be Unicode literals? yes. > And will some standard modules be Unicode aware such that they > will accept either Unicode or standard strings? yes. (more info coming soon) From foobar at foo.com Sat Feb 5 22:12:20 2000 From: foobar at foo.com (Foo J. Bar) Date: Sun, 06 Feb 2000 03:12:20 +0000 Subject: SocketServer, handle(), and scope Message-ID: <389CE694.4DC0C179@foo.com> I'm using the SocketServer module for a a ThreadingTCPServer. I created a new class that had an override for the handle function. This all works fine and my client does indeed connect to and send messages to the server without any problems. However, my problem is that my program is running a fairy large application where the user has an interactive session with the Python interpreter. He/she types: --------------------------------- # foo.py contains a fairly large class Bar import foo,time a = foo.Bar() a.start_large_application() a.rate = 30 def doit(): while 1: a.send_message() time.sleep(1.0/a.rate) # myhandler.py contains a class that # overrides the handle function import SocketServer,thread from myhandler import Myhandler myserver=SocketServer.ThreadingTCPServer(('',4444),Myhandler) thread.start_new(myserver.serve_forever,()) doit() ----------------------------- I need to be able to change this value ('a.rate') from a remote workstation (hense the need for my application to run a server (SocketServer). How should I do this? How does one design (or use) the handle function (or Myhandle class) so that information can be shared between classes (or changed in the scope the user is running in). Any advice (or pointers to existing code) would be greatly appreciated. Thanks, Sam From effbot at telia.com Wed Feb 23 15:09:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 20:09:06 GMT Subject: IIS keeps crashing from PyWin References: <81DD38F43381D111BA3E00A076A0998A459F44@XENON> Message-ID: python wrote: > An object call caused an exception. > (IID: {51372AEF-CAE7-11CF-BE81-00AA00A2FA25}) (Method: 3) > (Microsoft Transaction Server Internals Information: File: > i:\viper\src\runtime\mtxex\activity.cpp, Line: 889) > (Exception: C0000005) (Address: 0x1e6054df) > PyWinTypes15!PyWinThreadState_Free(void) + 0xF > asp!TerminateExtension + 0x3D35 > asp!TerminateExtension + 0x33E3 > asp!TerminateExtension + 0x313B > asp!TerminateExtension + 0x7AC3 > asp + 0x325C6 > mtxex!MTSCreateActivity + 0x1F3C > mtxex!MTSCreateActivity + 0xF3E > > > *** if you notice the file reference > i:\viper\src\runtime\mtxex\activity.cpp, there is no, nor was there ever, an > i drive on my machine... maybe the microsoft employee that compiled the transaction server had an I drive? (sorry, don't know why this is happening, but it sure looks like PyWinThreadState_Free is misbehaving. iirc, exception c0000005 is "access violation") From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:22:05 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:22:05 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: Message-ID: [This followup was posted to comp.lang.python and a copy was sent to the cited author.] In an article posted Thu, 24 Feb 2000 23:37:01 GMT, Mark Hammond (mhammond at skippinet.com.au) said: [re: effect of setting IIS default language to Python] > That would be interesting to know! I'll see if I can get them to do this, but I was actually hoping someone here could try it for me and report back. Sadly, I now appear to be the only one having this problem. > My guess is that Python is being reloaded each time. But 8 seconds > still seems very slow for this. Seems pretty slow to me, too. > I would personally just add some debug statements to pythoncom15.dll > to report its progress. Probably not an option. I can't imagine I could get them to replace a Python DLL and then restore the original later. I once lost FTP access to my site and it took them a month to restore it. Also, I've downloaded the FrontPage 2K Server Extensions to my FTP directory for them to install and I've been waiting now for two weeks.... > However, this doesnt work for your ISP, and I dont have time to do all > this work (ie, the testing/measuring) myself right now... I understand, Mark. No need, anyway, methinks. We should be able to figger this out. Thanks for thinking about it, though. -- -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From wrlddomprod at hotmail.com Tue Feb 22 16:14:06 2000 From: wrlddomprod at hotmail.com (Shawn LeBlanc) Date: Tue, 22 Feb 2000 13:14:06 PST Subject: Phython as In-Game scripting language Message-ID: <20000222211406.41743.qmail@hotmail.com> Greetings! Being totally new to Python and completely honest in saying that I have no idea of what I'm doing, I had a few questions. My team and I are thinking about embedding Python into our game engine on the Windows platform. The basic idea would be that the major entities, including enemies, would have a script attached to them to control behavior. This would allow the level/content designers to concentrate more on the game design side of things, since behaviors would be outside of the main game engine. Is it possible to have multiple scripts running at the same time? Would this involve creating multiple interpreter objects? According to the docs, this is possible but it isn't totally safe to do. What would be a good strategy for this? My other question was one of performance. Is it crazy to have ~10 different objects with each an individual script and hoping the game will be running at 30 frames per second? The question might not be valid, since I'm not sure how to implement it in the first place. And lastly, is it faster to call C functions in Python or vice-versa? with milk and cookies, Shawn ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From infonuovo at email.com Fri Feb 11 20:19:01 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Fri, 11 Feb 2000 17:19:01 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <38A33AD9.3F4EA190@americasm01.nt.com> Message-ID: I know better and I am responding anyhow. Tchh. Short Answer: There are always reasons. Reasons don't mean much. We always have them. Arguing about reasons is one of the more non-productive human activities. Probably more valuable response: The first problem that I have with this discussion is that it is too late. There are plenty of other languages. Python is what it is and it is not at all difficult to avoid the problem of invisible misalignment of indented text. It can be handled mechanically. I find it an opportunity to explore the possibility of using indentation alone for clear expression. (In languages with bracketing structures, I am always managing my indentation so that it is always honestly consistent with the actual structure and yes, I and others make/miss bugs when that isn't the case.) For a little off-topic perspective on this, when Peter Landin presented "The Next 700 Programming Languages" at the San Dimas ACM Conference on Programming Language Pragmatics, his use of indentation as part of the language structure was a small part of the paper and its ideas. Now it was pretty cool that he had also come up with a way to express the formal grammar of a language that employed indentation structurally. And, as you might have guessed, the discussion of this seminal paper was almost entirely focused on the use of indentation. That was in 1965. Repetition does not make an argument stronger, on either side. Sorry. I am mostly amused by this and I will now restrain myself. (To show you the errors of *my* youth, as an Algol 60 wonk I insisted that ";" was a separator and not a terminator, even though, as Ben Schneiderman was quick to point out later using actual replicatable empirical evidence, most human beings working with computer programs saw it as a terminator. I think we have PL/I to thank for that. I still think that the C Language view of ";" is ugly [well, a bit of a wart]. It doesn't deter me from producing C and C++ programs, though. Even correct ones.) (And if you want another one, from someone else's youth: Beside column sensitivity in the input line, the thing about Fortran not being sensitive to white space at all came from a concern for keypunching errors and the propensity for engineers to write early Fortran programs on the backs of envelopes. As far as I know, there is no argument to eliminate sensitivity to white space from programming languages to avoid structural or transcription problems (wow you could have spaces in identifiers and it would all work, golly). Of course the reason that columns after position 72 in the fixed-input line were ignored was originally because the IBM 704's card reader didn't read beyond column 72 of 80-column punched cards and the compiler simply never saw that stuff. The practice was to use that part of the card for sequence numbers and such to help rescue dropped or reordered card decks. The fixed-form input layout of Fortran was created at a time when that was the only way to get input into those computers and the use of free-form alphanumeric text, let alone special symbols, was a rare, emerging practice. It isn't fair to judge that practice from today's approach to media and display presentation when no such thing existed at that time. Aren't you glad you didn't ask.) -- Dennis ------------------ Dennis E. Hamilton InfoNuovo mailto:infonuovo at email.com tel. +1-206-779-9430 (gsm) fax. +1-425-793-0283 http://www.infonuovo.com -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Eaglestone, Robert [NGC:B918:EXCH] Sent: Thursday, February 10, 2000 14:25 To: python-list at python.org Subject: Re: Whitespace as syntax (was Re: Python Rocks!) [ ... ] Hi Gordon, Here is my problem. There must be a reason or rationale between 1) the ubiquity of bracketed syntax, and 2) Python deliberately omitting it. That is: there is a reason Python doesn't use it, and it must be a big one or else it just would have used bracketing. I want to know what this compelling reason is! My assumption is that unless it vastly improves programming the confusion caused by following a nonstandard syntax isn't worth the change made. Thanks, Rob -- http://www.python.org/mailman/listinfo/python-list From delgado at olaf.de Thu Feb 24 04:25:04 2000 From: delgado at olaf.de (Olaf Delgado) Date: Thu, 24 Feb 2000 11:25:04 +0200 Subject: Can I run a c++ object in Python program? References: <892c2s$maj$1@news.ihug.co.nz> Message-ID: <0u0398.4d.ln@olaf.de> In article <892c2s$maj$1 at news.ihug.co.nz>, "Bing Chen" writes: > I pass a object from c++ to Python as follow: > PyObject *pargs = Py_BuildValue("Oli",m_curr,field.first,field.second); [...] > def BaseModelLink(pargs): > base = pargs[0] > vid = pargs[1] > unit = pargs[2] > return base.get_lit(vid,unit) > it crash. > How can I make the object work in the pyhton program? It is not enough to pass the address of a C++ object. You have to make each of it's methods available individually to Python, i.e. write a wrapper function for each of them and make it known to the interpreter. The online docs describe how this is down. There is also a program called Swig (see www.swig.org) which can do that almost automatically for you. Olaf -- //// Olaf Delgado Friedrichs, Bielefeld, Germany `=' --- http://www.mathematik.uni-bielefeld.de/~delgado --- From effbot at telia.com Mon Feb 28 16:19:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 21:19:40 GMT Subject: Appending/inserting in outfile.write() References: <38BADE7B.CC1D599@interpath.com> Message-ID: Will wrote: > I'm trying to write a CGI Python guestbook. Would there be a way for me > to get the script to simply append, say 14 bytes from the end, to the > HTML guestbook file rather than completely overwriting it and holding > only one entry? I can use outfile.write to simply rewrite the entire > file. Do I need to use another function or just set a flag? If I can't > insert text, can i just delete the last 14 bytes and rewrite the end > from there? you cannot insert or delete data from files, but overwriting things is easy: fp = open(filename, "r+") fp.seek(-14, 2) fp.write("add to the end of the file") for more info, see the docs. hope this helps! From oscar at math.cinvestav.mx Thu Feb 24 15:53:01 2000 From: oscar at math.cinvestav.mx (Oscar Mendez) Date: Thu, 24 Feb 2000 14:53:01 -0600 Subject: unsubscribe (HOW TO) Message-ID: Please somebody tell me how to unsubscribe me of this list. From wware at world.std.com Thu Feb 24 12:30:58 2000 From: wware at world.std.com (Will Ware) Date: Thu, 24 Feb 2000 17:30:58 GMT Subject: Phython as In-Game scripting language References: <20000224155917.81782.qmail@hotmail.com> Message-ID: Shawn LeBlanc (wrlddomprod at hotmail.com) wrote: : Just so I understand (and because my programmer teammates are : asking me questions) is plain vanilla Python (no stackless or : microthread) unable to run multiple scripts simultaneously? I dunno much about how Python interfaces with normal threads. I was interested in running as many threads as possible, and I was comfortable with the idea that the solution would look like a bunch of stepping state machines, so I ended up hacking the Python VM. There is a discussion of how to use Python's threading module here, courtesy of Aahz Maruch: http://www.deja.com/=dnc/getdoc.xp?AN=570016307 -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From tony at lsl.co.uk Thu Feb 3 04:52:24 2000 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 3 Feb 2000 09:52:24 -0000 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <878v62$696$1@mach.vub.ac.be> Message-ID: <002401bf6e2c$5f1bb150$f0c809c0@lslp7o.lsl.co.uk> Am I the only person to think that "DrScheme" sounds irresistibly like something from Firesign Theatre (not in itself a BAD thing, you'll understand...) Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.demon.co.uk/ .. "equal" really means "in some sense the same, but maybe not .. the sense you were hoping for", or, more succinctly, "is .. confused with". (Gordon McMillan, Python list, Apr 1998) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From python at channel21.com Wed Feb 23 11:14:48 2000 From: python at channel21.com (python) Date: Wed, 23 Feb 2000 11:14:48 -0500 Subject: (no subject) Message-ID: <81DD38F43381D111BA3E00A076A0998A459F40@XENON> I am using NT 4.0 Service Pack 6a and IIS 4.0 on a dual-processer PIII Intel system w/ 1G RAM. Python Version is 1.5. I get the following error in my Event Logs every 2 hours (and the services crash simultaneously as well), and I have no idea what's causing it and how to stop it... : An object call caused an exception. (IID: {51372AEF-CAE7-11CF-BE81-00AA00A2FA25}) (Method: 3) (Microsoft Transaction Server Internals Information: File: i:\viper\src\runtime\mtxex\activity.cpp, Line: 889) (Exception: C0000005) (Address: 0x1e6054df) PyWinTypes15!PyWinThreadState_Free(void) + 0xF asp!TerminateExtension + 0x3D35 asp!TerminateExtension + 0x33E3 asp!TerminateExtension + 0x313B asp!TerminateExtension + 0x7AC3 asp + 0x325C6 mtxex!MTSCreateActivity + 0x1F3C mtxex!MTSCreateActivity + 0xF3E *** if you notice the file reference i:\viper\src\runtime\mtxex\activity.cpp, there is no, nor was there ever, an i drive on my machine... please help!! we've been using python on the web for 3 years now and this is something new which is going wrong... (this machine is a new installation as of about a month ago - the errors only started happening after I started running high-traffic sites on the machine) ************************************************** Jason S. Nadler Lead Programmer Channel21 Productions, Inc. ... What are you doing right now? ************************************************** ************************************************** Jason S. Nadler Lead Programmer Channel21 Productions, Inc. ... What are you doing right now? ************************************************** From scarblac-spamtrap at pino.selwerd.nl Mon Feb 21 20:41:02 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 22 Feb 2000 01:41:02 GMT Subject: Newbie question about exceptions References: <88s311$dt1@news.dns.microsoft.com> Message-ID: Vijay Baliga wrote in comp.lang.python: > Why isn't "finally" allowed with "try/except"? Everything with "except:" is done if that exception is matched. A "finally:" clause is executed regardless of whether an exception was raised. If you have an "except:" clause already, that's quite superfluous. Ideally, I would like to do > the following: > > try: > f1 = open(file1) > use(f1) > f2 = open(file2) > use(f1, f2) > f3 = open(file3) > use(f1, f2, f3) > except: > print 'File open error' > finally: > f1.close() > f2.close() > f3.close() How about: try: f1 = open(file1) (etc) except: print 'File open error' f1.close() It will always get there. (Of course, no need to close files - it'll be done automatically after the file leaves scope, because of refcounting) -- Remco Gerlich, scarblac at pino.selwerd.nl "Early to rise, early to bed, makes a man healthy, wealthy and dead." -- TP From moshez at math.huji.ac.il Mon Feb 14 04:34:51 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 11:34:51 +0200 (IST) Subject: CGI/HTML forms in a standalone application. In-Reply-To: <888gut$67u$1@nnrp1.deja.com> Message-ID: On Mon, 14 Feb 2000 bayinnaung at my-deja.com wrote: > that can also be used as a non-web/standalone application > on a single/PC. > > Can you use a kind of dummy server to simulate the CGI on a single > machine. You can derive a class from SimpleHTTPRequestHandler, copy some code from CGIHTTPRequestHandler and come up with a class CGILikePythonFunctionHTTPRequestHandler -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit.holl at pobox.com Wed Feb 2 09:24:49 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 2 Feb 2000 15:24:49 +0100 Subject: poplib: problem deleting mails In-Reply-To: <38982CC7.3ED89559@iitb.fhg.de>; from gbl@iitb.fhg.de on Wed, Feb 02, 2000 at 02:10:31PM +0100 References: <38982CC7.3ED89559@iitb.fhg.de> Message-ID: <20000202152449.A840@stopcontact.palga.uucp> Carsten Gaebler wrote on 949497031: > Hi there! > The POP3 object's dele() function doesn't delete messages that > have a "Status: O" line in the header. Is that a bug? Not in Python. It must be your server. Neither the RFC nor the Python module says anything about it. regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From cpatti at black-racer.atg.com Fri Feb 4 11:50:22 2000 From: cpatti at black-racer.atg.com (chris patti) Date: 04 Feb 2000 11:50:22 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > > > > GH> Google -> PythonMagick -> I'm feeling lucky > > GH> http://starship.skyport.net/crew/zack/pymagick > > > > But when you try to download something all links are dead alleys or invalid > > files. > > I'm sorry. I should have looked further than my nose is long. > > (maybe this proverb is Dutch only, but who cares; everyone speaks > Dutch anyway) > > groeten, > Gerrit. If I might be so bold... One of the reasons for CPAN's success in the Perl world is that, simply, it's an FTP archive. Thus, people can and do mirror it. This creates a multi-site, persistent cache of the entire library, so when the one site where module Frobnitz.pm comes from goes down, the world doesn't suffer. The Python world needs something similar. Another big win in this is that it eases the automated retrieval and installation of modules, in the Perl world we have CPAN.pm which lets you say things like: install frobnitz And it will search the archive, find the latest version, download it and install it to your local Perl installation. Such a thing is _eminently_ possible in Python... I have neither bandwidth nor disk to offer, so feel free to have me publicly tarred and feathered for heresy :) -Chris ------------------------------------------------------------------ Chris Patti| \ Art Technology Group||617-386-1649 \ cpatti at atg.com ------------------------------------------------------------------ From t.keil at zvs.zgs.de Wed Feb 16 17:52:24 2000 From: t.keil at zvs.zgs.de (Thomas Keil) Date: Wed, 16 Feb 2000 14:52:24 -0800 Subject: Please help: Connecting Microsoft Access Database (DAO) Message-ID: <38AB2A28.77FE@zvs.zgs.de> Hello, does anyone know how to get a Report from an Access Database? " import win32com.client engine=win32com.client.Dispatch("DAO.DBEngine.36") db=engine.OpenDatabase(r'foo.mdb') rs=db.OpenRecordset('bar') " 'bar' is a report; it needs two values: "first date" and "second date". Thanks for any help. Th. Keil mailto: t.keil at zvs.zgs.de From embed at geocities.com Mon Feb 14 10:02:42 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 14 Feb 2000 10:02:42 -0500 Subject: Threads in Python References: <8881oc$5o9$1@news02.btx.dtag.de> <8883ve$rvs$1@nntp6.atl.mindspring.net> Message-ID: > As Fredrik said, yes and no. Threads are incredibly easy to use in > Python; the biggest drawback is the Python global interpreter lock, > which means that only one thread can run Python code at any time. > That's usually not a big drawback, because threading is usually used to > optimize I/O, and extension libraries (including I/O) can release the > global lock. What about pre-emption? Can the Python interpreter pre-emptively switch threads between any two lines of Python code? Is there a "Schedule()" call to force a thread to give up it's timeslice? Warren From rjroy at takingcontrol.com Thu Feb 10 23:34:00 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Fri, 11 Feb 2000 04:34:00 GMT Subject: Remove duplicates in a sequence? References: Message-ID: <38a39011.603799531@news1.on.sympatico.ca> There is a recent thread on this subject. If I recall, what seemed fastest was mydict={} for item in mylist: mydict[item]=None mylist = mydict.keys() If you care about relative order then it gets a bit more complicated' On Fri, 11 Feb 2000 02:45:38 GMT, danielt3 at gte.net (Daniel T.) wrote: >I have a sequence that contains strings, and I want to remove any >duplicates. I know how to write a function to do it, but I was wondering >if there was already one in the language or a library that does it. > >I've looked in the docs for "unique" and "remove" but no luck... Can >anyone help me? > >-- >When a thing ceases to be a subject of controversy, >it ceases to be a subject of interest. > -- William Hazlitt From ullrich at math.okstate.edu Tue Feb 15 17:12:19 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 15 Feb 2000 16:12:19 -0600 Subject: "Real" problem... References: <38A99C34.109D34BB@math.okstate.edu> Message-ID: <38A9CF43.81C125CF@math.okstate.edu> Never mind - found it at the Vaults of Parnassus: ftp://ftp.python.org/pub/python/contrib-09-Dec-1999/ DataStructures/real-accurate.pyar "David C. Ullrich" wrote: > Well, this time I started at python.org, and sure enough > I found what I was looking for, an arbitrary-precision > floating point package. > > Or so it seemed - Netscape and urllib.urlretrieve both whine > about 'cannot find file or directory'. What I'm looking for is > > ftp://ftp.python.org/pub/python/contrib/Math/real-accurate.pyar > > , which is a link I found at > > http://www.python.org/topics/scicomp/numbercrunching.html > > . Thanks. > > DU From rhundt at cup.hp.com Tue Feb 15 22:59:10 2000 From: rhundt at cup.hp.com (Robert Hundt) Date: Tue, 15 Feb 2000 19:59:10 -0800 Subject: Help! Init Problem after setup... Message-ID: <38AA208E.85695302@cup.hp.com> Hi @ll, I have a question for Python on HP-UX 10.20. I made Python, and Tcl and Tk and everything worked fine and I finally installed the whole stuff to a specific directory. Everything works fine - so far... Now I want to create another application, that links to Python lib and sits in another directory tree. I can link this app, I can even run it, however, I always get messages at startup saying: 'import exceptions' failed; use -v for traceback Warning! Falling back to string-based exceptions 'import site' failed; use -v for traceback So - I already tried setting PYTHONPATH to the exec-prefix that I specified during config - but gee, I can't get rid of this problem. Even worse, I can't even "import" specific other modules. Please help me!!! What's wrong? Thank you very much in anticipation! -- Robert Hundt HP 408-447-0546 rhundt at cup.hp.com From gerrit at nl.linux.org Mon Feb 28 07:28:12 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Mon, 28 Feb 2000 13:28:12 +0100 Subject: Python program examples In-Reply-To: <38BA5DC6.A83448DF@computer.org>; from eugene.kelly@computer.org on Mon, Feb 28, 2000 at 11:36:38AM +0000 References: <38BA5DC6.A83448DF@computer.org> Message-ID: <20000228132812.A6199@humbolt.nl.linux.org> On Mon, Feb 28, 2000 at 11:36:38AM +0000, Eugene Kelly wrote: > I am looking for neat little examples of Python programs for an intro. > programming course I am currently giving to business students. We are > working in a MS Windows 98 environment. If you have any examples to hand > that you would be willing to share please send them to me directly. > Programs should be small i.e. < 100 lines max and < 50 would be best. Have you already found the Demo/ directory? regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From newsbunny at noether.freeserve.co.uk Thu Feb 10 12:14:23 2000 From: newsbunny at noether.freeserve.co.uk (Martin P Holland) Date: Thu, 10 Feb 2000 17:14:23 +0000 Subject: small python implementation or python subset ? References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> <38A282D0.2487CA89@sxb.bsf.alcatel.fr> Message-ID: On 10 Feb 2000 08:21:05 -0500, Fran?ois Pinard wrote: >Does someone know why Python is installed unstripped? I think that is a question for whoever created your python rpm. Here on RH6 it is stripped. atb Martin -- http://www.noether.freeserve.co.uk http://www.kppp-archive.freeserve.co.uk From gerrit.holl at pobox.com Thu Feb 10 15:21:21 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 10 Feb 2000 21:21:21 +0100 Subject: perl chomp equivalent in python? In-Reply-To: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net>; from emile@fenx.com on Wed, Feb 09, 2000 at 06:16:29PM -0800 References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> Message-ID: <20000210212121.B8912@stopcontact.palga.uucp> Emile van Sebille wrote on 950116589: > Kees, > > Try this: > > >>> lines = open(r'c:\config.sys').readlines() > > >>> for line in lines: > print line[:-1] Incorrect :( >>> import os >>> lines = open("path-to-file", 'r').readlines() >>> for line in lines: ... print line[:len(os.linesep)] cross-platformness-rules-ly y'rs - gerrit -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From kojo at tamu.edu Tue Feb 1 01:26:01 2000 From: kojo at tamu.edu (Kojo Idrissa) Date: Tue, 01 Feb 2000 00:26:01 -0600 Subject: "Archive" vs. "Reference"- Book Compare & Contrast Message-ID: <38967C79.1900FB54@tamu.edu> I'm relatively new to Python and I've been using "Learning Python" to teach myself. I'm trying to decide which would be better for me, "Python Annotated Archives" or "Python Essential Reference". I realize they are different books, but I'd like a more informed viewpoint. My basic understanding is that "Archive" is akin to a Python CookBook, while "Reference" is a language ref. Am I on track? I'm planning to do a project with Python this semester, so I'm leaning towards "Archive". At $50, I'm just wondering if it's worth the money. Any and all comments are welcome. TIA. -- **************************** Kojo Idrissa KPMG Scholar Accounting Doctoral Student Texas A&M University kojo at tamu.edu 401M Wehner Bldg. 409-862-2726 **************************** From kc5tja at garnet.armored.net Sat Feb 12 05:15:48 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 12 Feb 2000 10:15:48 GMT Subject: Python sucks loud References: Message-ID: In article , Fredrik Lundh wrote: >he knows exactly who he is. why else do you >think he needs to behave like this to get any- >one to listen to him, if only for a split second? Heh...actually, I was rather enjoying myself, actually. :) The trick is to always find a way to out-wit or out-spout the other guy. There's no hard feelings involved here at all. Baiting the baiter is a sport in and of itself. Sometimes you back yourself into a corner though, and that gives your pseudo-opponent the upper hand. That can get embarrasing sometimes, but hey, it's all in good fun. At least I think so. :) But I digress. By popular demand, I'll quit it now. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From hinsen at cnrs-orleans.fr Fri Feb 4 10:01:49 2000 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: 04 Feb 2000 16:01:49 +0100 Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) References: <65118AEEFF5AD3118E8300508B124877073D54@webmail.altiris.com> Message-ID: Pieter Nagel writes: > The problem with most "world-class IDEs" is that they try to provide > everything, in a single, non-extensible, forced, and closed way - > instead of just creating an "ecology" within which everything can > easily be provided. Exactly. I was tempted to switch from Emacs to IDLE for Python development, but it didn't last long. Not because IDLE is bad or doesn't have advantages over Emacs, but because I develop in Python + C, and IDLE won't handle the C part. Emacs may not be the latest technology, but it allows integration of anything which has a command line interface. And I won't accept any IDE, world-class or not, that doesn't, nor any tool that doesn't provide a command line interface. -- ------------------------------------------------------------------------------- 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 parkw at better.net Wed Feb 9 15:11:43 2000 From: parkw at better.net (William Park) Date: Wed, 9 Feb 2000 15:11:43 -0500 Subject: Which Python book? In-Reply-To: <38A0C9EF.F81FAC8E@webamused.com> References: <85035b$1sb$1@bignews.shef.ac.uk> <850pt8$qv9$1@nnrp1.deja.com> <852g8h$75@gap.cco.caltech.edu> <86fl0m$gmj$1@inputplus.demon.co.uk> <86kqtq$6kq$1@jaffa.itower.net> <38A0B834.DF6BBAC6@netscape.com> <38A0C9EF.F81FAC8E@webamused.com> Message-ID: <20000209151143.A265@better.net> On Wed, Feb 09, 2000 at 02:09:48AM +0000, Joshua Macy wrote: > Dan Christian wrote: > > > > There is also a "Pocket Python" book that I can never seem to find my > > way around. Maybe I just haven't used it enough to grok the > > organization. > > I never take my computer anywhere without one of my copies of Python: > Pocket Reference in the pouch. Perhaps someday I'll have absorbed it > so thoroughly that I don't need it, but until then I'm always reaching > for it. The organization is quite simple: it's exactly what's in the > Table of Contents. That's not as flip as it sounds; unlike, say, > Programming Python, I've never been at a moment's loss as to where to > find a bit of knowledge based on nothing more than the section title as > listed in the Table of Contents. An index would be gilding the lilly. > > Joshua If you take computer with you, then why don't you try online HTML docs? I read them using 'lynx'. William From wcohen at interpath.com Mon Feb 28 15:45:47 2000 From: wcohen at interpath.com (Will) Date: Mon, 28 Feb 2000 15:45:47 -0500 Subject: Appending/inserting in outfile.write() Message-ID: <38BADE7B.CC1D599@interpath.com> I'm trying to write a CGI Python guestbook. Would there be a way for me to get the script to simply append, say 14 bytes from the end, to the HTML guestbook file rather than completely overwriting it and holding only one entry? I can use outfile.write to simply rewrite the entire file. Do I need to use another function or just set a flag? If I can't insert text, can i just delete the last 14 bytes and rewrite the end from there? Thanks, Will From felixt at dicksonstreet.com Sun Feb 20 14:38:08 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Sun, 20 Feb 2000 13:38:08 -0600 Subject: Overloading = In-Reply-To: <88htqk$rb5$1@nnrp1.deja.com> Message-ID: <3.0.5.32.20000220133808.008876e0@mail.dicksonstreet.com> At 22:47 2/17/00 GMT, jhefferon at my-deja.com wrote: >I have a class, rclass. It has an attribute value. Can I arrange >so that the string > r1=r2 >sets r1.value to equal r2.value (where r1 and r2 are class instances, >of course) without changing anything else about r1? I'm willing to >test, say, that r1.classtype==r2.classtype or something, first to make >sure the assignment is sensible. > >And if so, can I also have r1=7 set r1.value to be 7? > >I want to have a box in a GUI where users can enter code, such as >assignments, and I'd like to avoid the reference to the underlying >attribute. > >Thanks, >Jim Hefferon jim at joshua.smcvt.edu > > >Sent via Deja.com http://www.deja.com/ >Before you buy. >-- >http://www.python.org/mailman/listinfo/python-list > > Would it be OK for this assignment to use another operation ? You could use something like- def __lshift__(self, other): if hasattr(other, 'value'): self.value = other.value else: self.value = other then your users could type r1 << r2 to put the value of r2 into r1. -Felix From fdrake at acm.org Tue Feb 8 13:15:38 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue, 8 Feb 2000 13:15:38 -0500 (EST) Subject: pretty print xml document In-Reply-To: <002101bf725f$4e782720$3acbd9c2@peridot.optichrome.com> References: <389FEC18.594FBD7C@sxb.bsf.alcatel.fr> <002101bf725f$4e782720$3acbd9c2@peridot.optichrome.com> Message-ID: <14496.23882.521333.985948@weyr.cnri.reston.va.us> Adrian Eyre writes: > You might get a better response on XML issues if you post to > the XML-SIG list. Anyway - from one of the XML-SIG lot (can't > remember which): The original poster may also want to look at the xml.sax.writer, which desparately needs documentation. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From kens at sightreader.com Mon Feb 28 04:23:14 2000 From: kens at sightreader.com (Ken Seehof) Date: Mon, 28 Feb 2000 01:23:14 -0800 Subject: does opensource move faster with python? References: Message-ID: <38BA3E82.6BCD84F8@sightreader.com> Michal Wallace (sabren) wrote: > Does opensource move faster with Python? > > I just surfed over to the GnuCash website. I've been waiting quite a > while for a "real" release.. But it never seems to come.. Same thing > with Mozilla.... I'm not trying to rag on them.. But I have to wonder: > would development move any faster using Python to prototype these > tools? That's the claim I keep hearing about python.. But how come > more of the free software world isn't using it? Momentum. Safety in numbers. Fear. But most of all, C/C++ programmers don't have any spare time to learn anything new. In any case, python numbers are growing exponentially. There's a new book about every month, and the IPC8 python conference had double last years showing. > ARE there projects out there using python as a prototyping language > with the possible intention of discarding it eventually and rewriting > in C? I doubt it, though it would certainly be possible. I can't think of any situation where I would use python purely as a prototyping language, and then discard the python. Except in very unusual cases, there really isn't any disadvantage in a final product being written in multiple languages. On the contrary there are many advantages. In fact, I often take a perfectly good C program and -add- python to it! The python development scenario goes something like this: 1. Wrap existing c libraries in python (usually this has already been done) 2. Write the application in python 3. Replace performance critical elements with C (wrapped in python) 4. Continue using python for the framework Note that step 3 will generally involve a very small percentage of your code, since 98 percent of CPU time is usually spent in 2 percent of the code. The only thing I can think of that I wouldn't write this way is a hardware driver. Remember the previous generation: 1. Wrap assembly hardware control routines in C. 2. Write program in C 3. Replace performance critical elements with assembly (wrapped in C) 4. Continue using C for the framework Not "prototype in C and rewrite the whole thing in assembly" unless your target is a chip that you don't have a C compiler for. The whole process goes 4 to 7 times faster in Python than in C or C++ depending on whose estimates you look at. My measurements have indicated only about 4 to 1 development speed improvement, but that was after 12 years of C++ experience and about 2 months of Python experience. I'm sure the ratio has increased for me since then but I haven't had an opportunity to measure it. However, I have gained some insight about where the boost comes from. Think about where your time goes when you write a program. The interactive interpreter tightens the development loop and gives instant feedback. Unit testing is trivial. Much less tendency for bugs to appear (almost all memory and type related bugs just don't happen, dispite purely academic concerns about Pythons lack of static type checking). Much easier to find bugs too, even when they are in the C components. > Cheers, > > - Michal > ------------------------------------------------------------------------- > http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ > ------------------------------------------------------------------------- Enjoy, - Ken From sabren at manifestation.com Mon Feb 7 09:32:32 2000 From: sabren at manifestation.com (Michal Wallace) Date: Mon, 7 Feb 2000 09:32:32 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <001001bf715c$7a1bb7b0$3acbd9c2@peridot.optichrome.com> Message-ID: <87ml2o$m60$1@nntp4.atl.mindspring.net> Adrian Eyre wrote in message <001001bf715c$7a1bb7b0$3acbd9c2 at peridot.optichrome.com>... >I still think the idea of perl's "install someModule" is >a bit suspect anyway. Actually, it works quite well.... The thing perl has that python doesn't though, is namespace protection... for example, I'm working on a set of MIDI modules... well, I can set it up so to use my stuff you do "import midi".. but that'll conflict with the midi stuff already out there... CPAN would have encouraged me and the other MIDI author to name our modules "midi.hisversion" and "midi.myversion".... which is not to say that we can't do that in python, but... well, nobody does... -michal http://www.sabren.com/ From anders.eriksson at morateknikutveckling.se Wed Feb 2 06:22:21 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Wed, 02 Feb 2000 12:22:21 +0100 Subject: Environment variables in cgi References: <3897FBB2.2CD552B9@arca.net> Message-ID: On Wed, 02 Feb 2000 10:41:06 +0100, Maurizio Manetti wrote: >I'm newbie with python. I'm trying to make some little cgi program. Me too!! >I have this problem: >In my little script I import the powerful module cgi, then I ty to >access the dictionary cgi.environ but it seems not to exist! Why? I don't think that there is a dictionary called environ in the cgi module. As far as I can figure out (with the help of my friends) the way to do this is to use the FieldStorage function to create an dictionary which includes all cgi fields, both from your form and from the shell. import cgi cgidata = cgi.FieldStorage() Now the variable cgidata will be a dictionary with all the fields. If you have an form with a field called 'username' then you can get the username like this: uname = cgidata['username'] now the variable uname will contain the value of the field username. To see which fields that are 'imported' you could use the function test() cgi.test() It will then print out an HTML page with all the fields that the cgi module can get. // Anders -- English isn't my first or second language, so errors or anything that you find offending is not there on purpose it's just due to the translation. From stevep at weck.brokersys.com Tue Feb 1 13:12:25 2000 From: stevep at weck.brokersys.com (Steven Pauly) Date: 1 Feb 2000 18:12:25 GMT Subject: "Python Annotated Archives" A good book? Message-ID: <8777m9$r2v$1@news.hal-pc.org> Greetings, As a newbie pythonista, I saw this book and was wondering what others thought, as far as technical quality, target audience suitabilty, and readability. I have "Learning Python" and have generally liked it. But it seems to lack as many code examples as I would like. No bash intended, just my opinion. Python is great! Steve. -- Steven Pauly (281) 496-8041 (steve.pauly at glm.com) Global Marine Drilling Co. / Houston / Tx / 77079 stevep at brokersys.com / stevep at bash.linux-shell.net From tim_one at email.msn.com Wed Feb 16 00:55:15 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 00:55:15 -0500 Subject: Real Problems with Python In-Reply-To: <36D1542F6A4700D6.94850CC9820472D8.A6C711CADC502BE1@lp.airnews.net> Message-ID: <000d01bf7842$6577fc00$b7a0143f@tim> [Bijan Parsia] > Er..Just out of curiosity, what *can't* you model in Scheme? :) [Tim] > Smalltalk . [Tres Seaver] > I'd be willing to venture some of Forth's wierder stuff, too. 'Twas but a joke, Tres (Bijan is a Smalltalk fan, and had a Perl fan asked instead I would have answered Ruby ). Scheme is exceptionally good at modeling unusual semantics, which is why, e.g., GNU picked Scheme as the basis of its GUILE project. a-joke-explained-is-always-funnier-ly y'rs - tim From dieter at handshake.de Thu Feb 10 13:51:58 2000 From: dieter at handshake.de (Dieter Maurer) Date: 10 Feb 2000 19:51:58 +0100 Subject: ZOPE and ILU? References: Message-ID: Steffen Ries writes on 10 Feb 2000 07:32:17 -0500: > I'm trying to hook up external CORBA objects to Zope, using ILU. > > I can't believe that I'm the first one to try that. Is there anybody > out there, who can give me some hints? We do it. More precisely: we have implemented a Zope Database Adapter for a multimedia database, which is accessable as Corba Object via ILU. With respect to ILU, there is absolutely no distinction regarding its use in Zope or in any other Python environment. Maybe, with the exception of persistence (it is probably no a good idea, to make the ILU objects persistent). If you have more precise questions, you can send me a mail. Dieter From sabren at manifestation.com Thu Feb 24 16:11:29 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 24 Feb 2000 16:11:29 -0500 (EST) Subject: diff? In-Reply-To: <5Wgt4.862$mYj.189901824@newsa.telia.net> Message-ID: On Thu, 24 Feb 2000, Fredrik Lundh wrote: > Michal Wallace (sabren) wrote: > > I'd like to be able to run something like "diff" as a function in > > python, but that would be able to compare arbitrary strings/sequences > > instead of just files... I looked on parnassus, python.org, but didn't > > see anything.. > > Tools/scripts/ndiff.py > > (in the 1.5.2 source distribution) Woohoo! Wow.. so let me try this one.... """" hey everyone. I just had a cool idea for a function called timemachine()... just pass it a string describing a feature, and somebody will come along and implement it two years ago.. I'd write this myself, unless... someone else already has it? """ :) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From cpatti at atg.com Fri Feb 4 15:26:13 2000 From: cpatti at atg.com (chris patti) Date: 04 Feb 2000 15:26:13 -0500 Subject: Lisp 2 Python? References: Message-ID: "Joel Lucsy" writes: > Are there any lisp-to-python converters? > Surely you jest. Python is LISP-like in various respects, but LISP and Python share vastly different ancestry. Even that aside, the synteaxes are HUGELY different. A say, Python to Pascal converter is one thing, a Python to LISP converter is another entirely. Also, which LISP? Common LISP I presume? You'd almost need something as complex as common lisp itself to convert that to PYthon :) Good luck, -Chris -- -------------------------------------------------------------------- Chris Patti| \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From effbot at telia.com Fri Feb 11 06:08:25 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 11:08:25 GMT Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> <880pqd$224d$1@gavrilo.mtu.ru> Message-ID: Oleg Orlov wrote: > All these features already were discussed here earlier, but > I do not find any convincing reason not to include them into > Python 1.6 time? Python 1.6 is almost frozen, and alphas should appear really soon. but for Py3K, sure. ... just one nit: > Extensions for Ruby written in C/C++ can easily > define Ruby classes. so can Python extensions written in C/C++. it's just that types are more efficient in the CPython implementation, so nobody's doing that. From psilva at ruido-visual.pt Mon Feb 14 07:05:57 2000 From: psilva at ruido-visual.pt (Pedro Silva) Date: Mon, 14 Feb 2000 12:05:57 -0000 Subject: (no subject) Message-ID: <000501bf76e3$da319700$6c00a8c0@ruidovisual.pt> Hi, I have some External Method with this code: def subobj_fs(self,obj): import os,os.path lst = os.listdir("/var/spool/news/articles/obj") %(obj) x = len(lst) return lst In my dtml Method, Zope, I call this function like this: Then this would call the function in the External Method and list the directories in var/spool/news/articles/products. Is this like this? I already tryed to execute this and it gave me and error, Key error. I've saw it already, but I can't figure where is the error. Can anyone help me? Please, send your answers to: psilva at ruido-visual.pt Thanks, Pedro Silva From mhammond at skippinet.com.au Tue Feb 22 17:20:30 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 22 Feb 2000 22:20:30 GMT Subject: win32security References: <87pu3o$23i$1@nnrp1.deja.com> <88joeo$32s$1@nnrp1.deja.com> <88ukc0$aeq$1@nnrp1.deja.com> Message-ID: Check out the documentation for these functions from Microsoft. Eg, a search for "GetFileSecurity" will yield some good hits, including: HOWTO: Add an Access-Allowed ACE to a File (ID: Q102102) HOWTO: Obtain the Owner of a File on Windows NT (ID: Q218965) etc. Mark. wrote in message news:88ukc0$aeq$1 at nnrp1.deja.com... > I applied Mark's privilege procedure to the script (and changed a couple > of things) to get this: > > ********************* > import win32api > from ntsecuritycon import * > from win32security import * > from win32con import * > > def AdjustPrivilege(priv, enable = 1): > # Get the process token. > flags = TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY > # Get the ID for the system shutdown privilege. > htoken = OpenProcessToken(win32api.GetCurrentProcess(), flags) > id = LookupPrivilegeValue(None, priv) > # Now obtain the privilege for this process. > # Create a list of the privileges to be added. > if enable: > newPrivileges = [(id, SE_PRIVILEGE_ENABLED)] > else: > newPrivileges = [(id, 0)] > # and make the adjustment. > AdjustTokenPrivileges(htoken, 0, newPrivileges) > > #mainline > print "*" * 20 > > AdjustPrivilege(SE_SECURITY_NAME) > > sid,domain,z = LookupAccountName('\\\\server1','dstultz') #server1 is > our server, dstultz is me > newACL=ACL() > newACL.AddAccessAllowedAce(GENERIC_ALL , sid) > fileSec=GetFileSecurity('e:\\test.txt',DACL_SECURITY_INFORMATION) > #text.txt is (duh) a test file > > fileSec.SetDacl(1, newACL, 0) > > SetFileSecurity('e:\\test.txt', DACL_SECURITY_INFORMATION, fileSec) > #this fails > > ********************* > Here is the error: > > pywintypes.api_error: (1338, 'SetSecurityDescriptorDacl', 'The security > descriptor structure is invalid.') > > I would think that SOMEONE must have a module to do this sort of thing: > Pass a filename and get/set access rights... > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From sholden at bellatlantic.net Fri Feb 25 10:06:24 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 15:06:24 GMT Subject: Bring value from walk() References: <1260637200-9073387@hypernet.com> <38B68FE6.35EABD1B@nembv.cz> Message-ID: <38B69A71.CA1546BF@bellatlantic.net> Milos Prudek wrote: > > > You need a mutable object. Making Fs a list with one > > element, (initialized to 0), and then totalling into Fs[0] will do > > the trick. > > Thanks for great explanation. This is the final, working code: > > import os, os.path, stat > > def EstimSpace(Fs, Dirn, Nams): > for X in Nams: > Fs[0]=Fs[0]+os.stat(Dirn+'/'+X)[stat.ST_SIZE] > return > > def EstDirSpace(RootDir): > Fs=[] > Fs.append(0) > os.path.walk(RootDir, EstimSpace, Fs) > return Fs[0] > > print "Estimated space is",EstDirSpace('c:/Program Files/Python') > > Of course, next task will be rounding up the estimate of every file to > cluster size of target disk drive... that will be easy. I would love to know if you've found some way to account for the space occupied by directories, and if you know of some automated way to grab the clustersize of the partition. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From aa8vb at yahoo.com Wed Feb 16 08:46:35 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 16 Feb 2000 08:46:35 -0500 Subject: IDLE Icon Name Message-ID: <20000216084635.A2475732@vislab.epa.gov> If you set the title of the IDLE window: idle.py -t IDLE It works, but why does the icon name come up as "*IDLE" rather than "IDLE"? -- Randall Hopper aa8vb at yahoo.com From mark at chem.uwa.edu.au Mon Feb 7 17:45:18 2000 From: mark at chem.uwa.edu.au (Mark C Favas) Date: 7 Feb 00 22:45:18 GMT Subject: PyExpat update References: <389F1CD5.102E6757@prescod.net> Message-ID: Paul Prescod writes: >I did some work on pyexpat over the weekend. Modulo bugs I have >introduced, I think that my changes so far have all been backwards >compatible. I list my new features at the bottom of this message. <---- snip ----> Is there any chance that pyexpat could handle DTDs and thus default values for attributes (I believe there was a test version of expat that added this capability...) I'd like to use the SAX interface to that to spped parsing up - I currently use the validating xmlproc part of the PyXML-0.5.3 package. In hope, Mark >setjmp/longjmp is gone >setjmp/longjmp works on Windows Umm - did setjmp/longjmp come back? -- 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 frank.sergeant at redneck.net Fri Feb 18 11:55:28 2000 From: frank.sergeant at redneck.net (Frank Sergeant) Date: 18 Feb 2000 10:55:28 -0600 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') References: <38AC9E92.C1CEFEB7@inka.de> <38AD3C67.A08EFE2D@inka.de> Message-ID: <87u2j68n7j.fsf_-_@den.home.net> < Michael Str?der asks about an embeddable Python web server> Well, here is what I've been using very successfully. It lets you embed a web server into your Python application. The web server will serve up ordinary files, but when the magic directory name 'cgi-bin' is used it results in a call to a method in your application. (I think I should have used a different magic directory name, such as 'py-bin'.) I was driven to this because I wanted to run a Python web server on Windows and the one that came with the Python distribution involved forking, etc. which were not supported under Windows. Also, I wanted the application to stay resident rather than starting up repeatedly as it would under standard CGI. This is not polished yet, but I hope it will give you something to work with. Any suggestions and improvements are always welcome and I look forward to making this available on the web eventually. -- Frank frank at canyon-medical.com -------- cgilite.py --------- #! /usr/local/bin/python """cgi lite Excerpts from the full cgi.py module. See the original module for extensive comments. Frank Sergeant frank at canyon-medical.com. (My modifications freely available for all purposes.) """ # Imports # ======= import string import urllib # Parsing functions # ================= # Maximum input we will accept when REQUEST_METHOD is POST # 0 ==> unlimited input maxlen = 0 def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. """ name_value_pairs = string.splitfields(qs, '&') dict = {} for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) if len(value) or keep_blank_values: ## fcs ## warning, this puts all values into list, even ## when the value is a single item. Consider changing this. #if dict.has_key (name): # dict[name].append(value) #else: # dict[name] = [value] if dict.has_key (name): # if we have more than a single value, then create a list if type(dict[name]) == type([]): dict[name].append(value) else: dict[name] = list (dict[name], value) else: # with a single value, do not put it into a list dict[name] = value return dict # Utilities # ========= def escape(s, quote=None): """Replace special characters '&', '<' and '>' by SGML entities.""" s = string.replace(s, "&", "&") # Must be done first! s = string.replace(s, "<", "<") s = string.replace(s, ">", ">",) if quote: s = string.replace(s, '"', """) return s -------- cgilite.py --------- """httpd.py February 18, 2000 Frank Sergeant frank at canyon-medical.com This is a simple HTTP server, based on CGIHTTPServer.py and working much like Tcl's tclhttpd, for use as an embedded web server in a Python application. Certain URLs are interpreted as calls to Python functions. This allows persistent state as opposed to the cgi approach which would start up Python for each request. Another problem with CGIHTTPServer.py is that is forked a new process to handle each cgi request and fork does not work on Windows. This module builds on SimpleHTTPServer by implementing GET and POST requests to run Python methods. It collects the query information and stuffs it into a dictionary which is passed to the Python function. The Python function then works much like a cgi program except that it reads the passed parameters from the dictionary argument rather than from environment variables. If the URL is http://somehost/cgi-bin/patlist then the method to be executed will be py_patlist(). There does not need to be a .../cgi-bin directory. Probably, I should have used 'py-bin' instead of 'cgi-bin' as the magic directory name. (My modifications freely available for all purposes.) """ __version__ = "0.1" import os import sys import time import socket import string import urllib import BaseHTTPServer import SimpleHTTPServer import cgilite # Dummy response page for testing DEFAULT_TESTING_MESSAGE = """\ This is just a silly test

Don't worry, be happy

This is a first test of calling a Python function via a URL. """ class PyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): """Incomplete HTTP server. It handles GET and POST "cgi" commands but only for the Python application it is embedded in. The application will be a subclass of PyHTTPRequestHandler. The "cgi" URL is interpreted as a request to run a method of the application beginning with a prefix of 'py_'. For example, a URL of http://someserver/cgi-bin/trash would be taken as a request to run self.py_trash(). GET (where directory is not 'cgi-bin') and HEAD requests are handled normally, from the document directory rooted at the working directory this program is started with. """ def do_POST(self): """Serve a POST request. This is only implemented for CGI scripts. """ print "Entered do_POST" if self.is_cgi(): self.run_py() else: self.send_error(501, "Can only POST to CGI scripts") def send_head(self): """Version of send_head that support CGI scripts""" if self.is_cgi(): return self.run_py() else: return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self) def is_cgi(self): """test whether PATH corresponds to a CGI script. Set cgi_info to a tuple (dir, rest) if PATH requires running a CGI script. Note that rest begins with a slash if it is not empty. The default implementation tests whether the path begins with one of the strings in the list self.cgi_directories (and the next character is a '/' or the end of the string). """ path = self.path print "entering is_cgi with path = %s" % path for x in self.cgi_directories: i = len(x) if path[:i] == x and (not path[i:] or path[i] == '/'): #if we find the directory self.cgi_info = path[:i], path[i+1:] print "is_cgi returns true with (%s, %s)" % self.cgi_info return 1 print "is_cgi returns false" return 0 #cgi_directories = ['/cgi-bin', '/htbin'] cgi_directories = ['/cgi-bin'] def run_py(self): """Execute the requested method.""" self.send_response(200, "Script output follows") self.send_header ("Content-type", "text/html") self.end_headers() try: self.parseRequestLine() if self.command == 'POST': form = string.strip (self.rfile.readline()) if self.query: form = form + "&" + string.strip (self.query) else: # must be GET form = string.strip (self.query) print "form = %s" % form dict = cgilite.parse_qs (form, 1) # keep blank values print "dict = %s" % dict print "(scriptfile, script) = (%s, %s)" \ % (self.scriptfile, self.script) # Call the requested method methodName = "py_" + self.script print "method name is %s" % methodName method = getattr (self, methodName) generatedHTML = method (dict) self.wfile.write( generatedHTML ) except: print "Hit exception under run_py" self.server.handle_error(self.request, self.client_address) def parseRequestLine (self): # extract any parameters from the end of the request line # and store them in query dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, self.query = rest[:i], rest[i+1:] else: self.query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' self.scriptname = dir + '/' + script self.script = script self.scriptfile = self.translate_path(self.scriptname) self.rest = rest def show_headers (self): print "status = %s" % self.headers.status print "headers ----------------" for i in self.headers.headers: print " %s" % i print "end headers ------------" def set_root (dir): # make the request document root directory the current directory os.chdir(dir) def test(HandlerClass = PyHTTPRequestHandler, ServerClass = BaseHTTPServer.HTTPServer): SimpleHTTPServer.test(HandlerClass, ServerClass) if __name__ == '__main__': # Well, you'd need to define your class named Application and # have it supply the 'py_...' methods that the special URLs # would invoke. class MyApp (PyHTTPRequestHandler, Application): pass test (MyApp) ------------------------------------------------- From bobcassl at voicenet.com Fri Feb 4 14:38:22 2000 From: bobcassl at voicenet.com (rh cassel) Date: Fri, 04 Feb 2000 19:38:22 GMT Subject: "Python Programming on Win 32" available References: <3898b54c.1949600@news.btx.dtag.de> <87aigo$jv8$1@news.vanderbilt.edu> Message-ID: Yesterday, I was notified that Amazon had shipped my copy (ordered in Nov.). UPS tracking nbr showed it to be in UPS's hands. Bob Brad Clements wrote in message ... >Waa! I ordered it months ago.. Now I have to remember who from.. > >Ahh, found it. I ordered it on 8/30/99 from O'Reilly. Time to track this >down. > >-- >Brad Clements, >bkc at murkworks.com >"Jonathan Gilligan" wrote in message >news:87aigo$jv8$1 at news.vanderbilt.edu... >> I ordered it from fatbrain today and am told that it shipped this >afternoon. >> >> "Stefan Franke" wrote in message >> news:3898b54c.1949600 at news.btx.dtag.de... >> > Is the book available already? Amazon.com says "ships within 2-3 >> > days." >> > >> > Stefan >> > >> > >> >> > > From BgPorter at NOacmSPAM.org Thu Feb 24 19:17:55 2000 From: BgPorter at NOacmSPAM.org (Brett g Porter) Date: Fri, 25 Feb 2000 00:17:55 GMT Subject: 1000 GUI toolkits References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> <20000224132812.A3201@stopcontact.palga.uucp> <894diu$o80$1@news.udel.edu> Message-ID: "Terry Reedy" wrote in message news:894diu$o80$1 at news.udel.edu... > If you rewrite Pysol in HTML, you'll get a prize. > > Agreed that fine-grained interaction, such as with games, is a poor > application for HTML. Do you paint DHTML / JavaScript with the same brush? From jfarrell at mincom.com Sun Feb 20 19:09:01 2000 From: jfarrell at mincom.com (John Farrell) Date: Mon, 21 Feb 2000 10:09:01 +1000 Subject: Python misconceptions in IBM Ruby article... References: Message-ID: <38B0821D.150AC73A@mincom.com> Moshe Zadka wrote: > On Fri, 18 Feb 2000, John Farrell wrote: > > I agree that Python's OO features feel added on. Consider: > > * You have to pass self to each member function. There's no obvious > > requirement that self need actually be the bound instance. > > Huh? ``self'' is passed automagically to each member function. Yes, I realise that, but when I am writing a method I have an uncomfortable feeling that 'self' might under some circumstances be different from the object that the method is bound to. What if I assign to 'self'? What if I do this: class Stuff: def foo(x): print x a = Stuff() Stuff.foo(a) Stuff.foo(4) When I write in Java I would intend something like this to mean that foo is a class method of Stuff. However in Python, I can't write class methods. Whenever I invoke a method defined in a class it is interpreted as an instance method, and Python checks to see that the first parameter is an instance of Stuff. If that check was removed, I claim that all code that currently works would continue to work, and methods which were written as class methods would also work. (I am not saying that that check SHOULD be removed.) This suggests that what Python is really giving us is: * class methods, i.e. normal methods whose names look like Class.blah rather than just blah. * an automatic type check on the first parameter of a class method * the ability to bundle the method and its first parameter together to make a bound method. Now, I do not propose that this be changed, and I do not claim that other languages are better because of this. However I do claim that there is a tacked-on feeling about it. I think it's a little bit disingenuous to disparage the Ruby article for claiming that Python's OO features feel added-on, when there is considerable evidence to support that claim. John -- Dr John Farrell - Research Architect - Mincom Limited I don't suffer from stress. I am a carrier. -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d- s++:+ a C+++ U+ 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------ This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this E-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. From gmcm at hypernet.com Mon Feb 14 10:46:30 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 10:46:30 -0500 Subject: os.shell, recursion, encryption In-Reply-To: <38a79bec_3@news5.newsfeeds.com> Message-ID: <1261579303-39527346@hypernet.com> 55555 wrote: > I'm spawning pkzip for dos using os.shell() because I would like to use the encryption > feature. As far as I can tell that is not available in the gzip library and the > documentation on the cryptography toolbox didn't give me the impression that all the bugs > were worked out. Does anyone know whether that has changed? 1) You must mean os.system 2) What cryptography toolbox? There are a number of them. > Anyway, os.shell() pops up a new dos box for each call. I'm using os.path.walk() and > making a lot of calls to the zip program. I'm wondering if there is a way to not spawn > 40 windows. 0 windows would be ideal. You probably want os.spawnv. > Finally, I'm wondering if there is a way to attach to a global variable while moving > around with os.path.walk()? I understand recursion and have read Python's scope rules > but I can't seem to either pass local varaibles through or to attach to a global > variable. Yes, you can use a global var, as long as your callback uses "global". It might be better to use a mutable arg as the user arg to os.path.walk - say, a list. - Gordon From gerrit.holl at pobox.com Tue Feb 22 15:13:26 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 21:13:26 +0100 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <6SAs4.640$mYj.190014976@newsa.telia.net>; from effbot@telia.com on Tue, Feb 22, 2000 at 06:48:34PM +0000 References: <000401bf7d07$59acc080$e82d153f@tim> <38B2D49C.F18B47CC@roguewave.com> <6SAs4.640$mYj.190014976@newsa.telia.net> Message-ID: <20000222211326.B4549@stopcontact.palga.uucp> > bjorn wrote: > > I must respectfully disagree. When doing OO design, the fundamental > question > > is "if I want to do 'foo', to what am I doing 'foo'?"... In this case "if > I > > want to 'join', what am I 'joining'?", the answer is that you're joining a > > sequence type. Thus, IMHO it the natural (and extensible to user types) > way > > to do it would be: > > > > [1,2,3].join() > > (1,2,3).join(' ') > > umm. you seem to be missing a few things: > > -- python 1.6 will have *two* different string types. > > -- python 1.6 will have lots of sequence types (at > least one more than 1.5.2!) If types will eventually be classes, I think it would not be hard to add one method to all SequenceTypes. > -- while join can be *defined* as a series of concatenations, > *implementing* things that way doesn't work in real life. do > you really think that *all* sequence objects should know > how to join all possible string types in an efficient way? or > is that better left to the string implementation? I find 'string.join(['a','b','c'], '\t') MUCH more readable than tab.join(['a','b','c']). I'll probably keep using the former. > -- there is no common base class for sequence objects. Not yet. If it will be, I find it much better to have the method added to the Sequence. > still convinced that all sequence containers should be > required to know how to concatenate strings? Yes. > > if you think of another domain, say a gui with a textarea this might > become > > clearer. Nobody would want to write: > > > > "foo bar".put(textarea) > > read the list of issues again. still think this is a > great example? > > > Besides has anyone even considered " ".join(myUserListDerivedClass)? > > How about " ".join(myTreeThatHasLinear__getitem__)? > > if you mean what I think you mean, this already works > in 1.5.2 > > btw, string.join(sequence, separator) won't go away. > (it'll call separator.join to do the work, but that's just > an implementation detail ;-) I'll still use that one. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From giannozzo at arca.net Wed Feb 2 04:41:06 2000 From: giannozzo at arca.net (Maurizio Manetti) Date: Wed, 02 Feb 2000 10:41:06 +0100 Subject: Environment variables in cgi Message-ID: <3897FBB2.2CD552B9@arca.net> I'm newbie with python. I'm trying to make some little cgi program. I have this problem: In my little script I import the powerful module cgi, then I ty to access the dictionary cgi.environ but it seems not to exist! Why? If use, instead, the os.environ dictionary (importing the os module) everything works perfectly. Thank you very much From shecter at darmstadt.gmd.de Fri Feb 11 12:34:52 2000 From: shecter at darmstadt.gmd.de (Robb Shecter) Date: Fri, 11 Feb 2000 18:34:52 +0100 Subject: How to do line wrapping? Message-ID: <38A4483C.AE1A51F0@darmstadt.gmd.de> Hi, Is there a python module that can help with reformatting a plain text file so that all lines are less then a certain length? It would have to not cut words in half. Just wanted to know, before I write it myself. Thanks! - Robb From mikael at isy.liu.se Tue Feb 1 04:39:20 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 01 Feb 2000 10:39:20 +0100 (MET) Subject: MiniBloquiHeader In-Reply-To: Message-ID: On 01-Feb-00 Manuel Gutierrez Algaba wrote: > For those who use LaTeX I've made a little utility that > uses python,pstricks and fancyhdr : > > http://www.ctv.es/USERS/irmina/MiniBloquiHeader.html Since the documentation is in Spanish (I guess), I would appreciate at least a few words in English explaining the function of your utility. /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: 01-Feb-00 Time: 10:35:24 This message was sent by XF-Mail. ----------------------------------------------------------------------- From python-list at teleo.net Fri Feb 18 16:01:06 2000 From: python-list at teleo.net (Patrick Phalen) Date: Fri, 18 Feb 2000 13:01:06 -0800 Subject: Coding problems with ftplib and uploading a file In-Reply-To: <88k890$fa2$1@nnrp1.deja.com> References: <88k890$fa2$1@nnrp1.deja.com> Message-ID: <0002181227340M.01356@quadra.teleo.net> [pem at my-deja.com, on Fri, 18 Feb 2000] :: ftp = FTP('servername') :: ftp.login('uname', 'passwd') :: ftp.sendcmd('cdup') :: ftp.sendcmd('cdup') :: ftp.cwd('/web') :: fini = open('/myfile.html').readlines() :: ftp.storlines('STOR ' fini) :: ftp.quit() :: :: All of the commands work just fine except for the storlines command. I :: have read all of the documentation available to me at work (Programming :: in Python and Learning Python, and web docs on ftplib) but none are :: clear about the syntax of the storlines command. In addition, I read :: the ftplib.py as well as the rfc 959 on FTP and I guess I am just not :: getting it. Any help would be greatly appreciated. You need a comma between 'STOR ' and fini From aahz at netcom.com Tue Feb 22 12:23:00 2000 From: aahz at netcom.com (Aahz Maruch) Date: 22 Feb 2000 17:23:00 GMT Subject: functional programming References: Message-ID: <88uglk$1nh$1@nntp6.atl.mindspring.net> In article , Moshe Zadka wrote: > >Functional programming has a very clear definition: no side >effects. Iterating explicitly means "with side effects." I'm not saying >one style is better then the other, but you *can't* program functionally >in Python. I had to get over it, and learn to write fibonaci with a while >loop, when I first got to Python. What do you call this: def fib(x): if x != int(x): raise "Must use an integer" if x < 0: raise "Must be > 0" if x == 0 or x == 1: return 1L else: return fib(x-1) + fib(x-2) (apologies for any errors, but I think this is basically correct) -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From claird at starbase.neosoft.com Tue Feb 1 12:03:53 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 1 Feb 2000 11:03:53 -0600 Subject: Why Perl do But Python can't? References: <200001310128.UAA02858@poverty.bloomington.in.us> <8737c1$76d$1@news.cz.js.cn> <058AFBA1CD7F1621.791F88D00D532EC1.0128BF9429776D7B@lp.airnews.net> Message-ID: <750C7510A79887C5.2162AE658A51222E.BD04094EB7C2B6E8@lp.airnews.net> In article <058AFBA1CD7F1621.791F88D00D532EC1.0128BF9429776D7B at lp.airnews.net>, I remarked: >In article <8737c1$76d$1 at news.cz.js.cn>, ???? wrote: . . . >>2:use expect mod ,but python dosn't have. >> >>is there better solution? > . > . > . >As best I can understand, > use expect mod ,but python dosn't have. >refers to Expect.pm, and has no particular relation to >WWW, suid, sgid, or other elements of this post. > >In fact Python does have analogues to Expect.pm. The >little research I've done indicates that they're not >well-researched. I've been considering writing up a . . . I made two errors in what I sent before. The sentence immedi- ately above should have read ... they're not well-maintained. Moreover, I hiccoughed, and left out a paragraph on the module that addresses this domain and *is* well-maintained: telnetlib I apologize for the confusion. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From stevep at weck.brokersys.com Tue Feb 22 14:00:32 2000 From: stevep at weck.brokersys.com (Steven Pauly) Date: 22 Feb 2000 19:00:32 GMT Subject: where can i get python? any tips? a References: Message-ID: <88umcg$2n5o$2@news.hal-pc.org> Remco Gerlich wrote: > Collin Greene wrote in comp.lang.python: >> I am looking python does anyone know where I can download it? also any >> tips anyone would be willing to share would be greatly appreaciated. > http://www.python.org > Tip: read the "Documentation" sections completely. > Learn about "search engines". ^^^^^^^ Two or Four Stroke? :-) > -- > Remco Gerlich, scarblac at pino.selwerd.nl > Murphy's Rules, "You'll get a heck of a suntan, though...": > When a large nuclear bomb explodes in Villains and Vigilantes (Fantasy > Games Unlimited), it might do only four points of damage --- less than > a punch in the nose. -- Steven Pauly (281) 496-8041 (steve.pauly at glm.com) Global Marine Drilling Co. / Houston / Tx / 77079 stevep at brokersys.com / stevep at bash.linux-shell.net From vmjr at netcom.com Wed Feb 9 17:40:20 2000 From: vmjr at netcom.com (Victor M. J. Ryden) Date: Wed, 09 Feb 00 22:40:20 GMT Subject: Base64 Decoding Message-ID: I'm trying to use python to decode some e-amil I'm getting which contain MIME base64 encoded documents. I looked at the doc's for the mimetools and base64 modules. I'm confused because they ask for both an input AND output file name. I can understand the input, but not the output. There can be several encoded documents in a single input file, all of which have their respective file names as part of the encoding prelude. Has anyone any experience with this, and do you have any hints? TIA From effbot at telia.com Mon Feb 14 02:49:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 07:49:58 GMT Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] References: <000301bf75f6$34eb3e60$962d153f@tim> Message-ID: Tim Peters wrote: > [Aahz Maruch] > > Here's an interesting question that I don't think I've seen here: > > given that the semicolon is not a significant character in Python, > > why wasn't it chosen as the tuple creator? > > Python's tuple notation was inherited from ABC. Python generalized it > somewhat, but didn't fiddle. otoh, the ABC quick reference at http://www.cwi.nl/~steven/abc/qr.html uses: {1; 2; 3} From invalid.address at 127.0.0.1 Sat Feb 12 02:17:18 2000 From: invalid.address at 127.0.0.1 (David) Date: Sat, 12 Feb 2000 07:17:18 GMT Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> <38A24345.3F763311@Lugoj.Com> Message-ID: <38a50571.9732754@news.telus.net> Authorware Professional, now sold by Macromedia. CAI language; very good for what it was designed to do. >>Off topic: >>By the way, speaking of code blocks, does anyone know of any languages that >>use blocks...literally? That is, given the prevalence of GUIs, a >development >>environment/language where code is contained in rectangles? From gherman at darwin.in-berlin.de Fri Feb 18 11:04:14 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Fri, 18 Feb 2000 17:04:14 +0100 Subject: ANN: py2pdf 0.2 -- Python syntax coloring in PDF References: <38AD0C7A.75B939B7@darwin.in-berlin.de> Message-ID: <38AD6D7E.5D77F07C@darwin.in-berlin.de> "Dinu C. Gherman" wrote: > > py2pdf.py 0.2 -- Python syntax coloring in PDF > > [...] > > DEPENDENCIES: > - JvR's PyFontify v. 0.3 > - optionally Marc-Andre's mxTextTools > - Andy Robinson's PDFgen v. 2000-02-16 (using package structure) > (likely, any newer version will do, like PDFgen-19991012, > likely, pd2py will be distributed with PDFgen as a demo.) I should add that you can get the most recent version of PDFgen from http://www.reportlab.com (a link that shows up only later in py2pdf's docstring...). Sorry for the ommission... 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 thamelry at vub.ac.be Thu Feb 3 04:30:40 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 3 Feb 2000 09:30:40 GMT Subject: Language Challenge 2000 References: <389923AB.741B7DB9@sdynamix.com> Message-ID: <87bhs0$nvg$1@mach.vub.ac.be> bvoh at sdynamix.com wrote: : Language Challenge 2000 [snip] : The overall winner will receive: : Compaq Visual Fortran V6.1 -- Professional Edition This is a joke right? The winner receives a Fortran compiler???? ROTFL! Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From effbot at telia.com Mon Feb 14 10:50:49 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 15:50:49 GMT Subject: BSDDB copyright and licensing restrictions while in use via Python References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: Warren Postma wrote: > Has the db1.8.5 source code a more liberal license than the 2.0 code from > Sleepycat? I'm pretty sure that's the case. But instead of trusting my memory, why not download it and check check the license yourself: http://www.sleepycat.com/historic.html if you prefer to use free and IMHO better data- base engines, check out metakit (www.equi4.com) or gadfly (www.chordate.com). From robodan at netscape.com Tue Feb 8 19:43:32 2000 From: robodan at netscape.com (Dan Christian) Date: Tue, 08 Feb 2000 16:43:32 -0800 Subject: Which Python book? References: <85035b$1sb$1@bignews.shef.ac.uk> <850pt8$qv9$1@nnrp1.deja.com> <852g8h$75@gap.cco.caltech.edu> <86fl0m$gmj$1@inputplus.demon.co.uk> <86kqtq$6kq$1@jaffa.itower.net> Message-ID: <38A0B834.DF6BBAC6@netscape.com> Art Pollard wrote: > > Here is my $0.02 worth on the various Python books. > > Programming Python: Not particularly good. Not worth the $$$. I'm sure > I'll > find a use for my copy but I haven't found it yet. This used to be the most complete reference book (for all the standard modules and such). I think the "Essential Reference" book has surpassed it. Personally, I liked it. It used to be the only book out there. It is definately out of date. The CD is v1.3 and it was before the new 're' style of regular expressions. > Python Esential Reference: Excellent Book! I highly recommend it. Between > Quick Python and PER, I'd say you would have the core of what it takes to > learn > Python. I haven't use this too much, but it seems to be the best and most up to date reference. The organization and indexing seem good. There is also a "Pocket Python" book that I can never seem to find my way around. Maybe I just haven't used it enough to grok the organization. > > Of course, I am just learning Python myself. It is funny to me that the > O'Reilley books > seemed to come up short on this one. Usually, they are pretty good. They were there first and haven't been updated in a while. I talked to them at a show about "Programming Python" being out of date and they said that they welcomed the feedback. I thought that "Learning Python" was O'Reilley. > I'd > also like to > see a good explanation somewhere about how to use IDLE and techniques for > writing / debugging Python programs since Python's development tools are a > tad > rougher to the nice IDE's I'm used to. (So I'm spoiled.... :-) > > -Art Another "older" title is "Internet programming in Python". Good intro stuff and then some CGI and server examples. The writing is quite personal and funny. Again, this pre-dates 're' (unless there is a new revision that I don't know about). Both "Programming Python" and "Internet Programming in Python" talk in some depth about how to embed and extend it. That may seem 'extra', but it was the first thing that I needed to do. -Dan -- T-h-i-s- -s-i-g-n-a-t-u-r-e- -i-s- -c-o-p-y- -p-r-o-t-e-c-t-e-d- -i-n-f-o-r-m-a-t-i-o-n-.- - -U-n-l-i-c-e-n-s-e-d- -d-e-c-o-d-i-n-g- -i-s- -a- -f-e-d-e-r-a-l- -o-f-f-e-n-s-e-.- From moshez at math.huji.ac.il Fri Feb 18 00:18:51 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 07:18:51 +0200 (IST) Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: Message-ID: On 17 Feb 2000, Samuel A. Falvo II wrote: > >Oh, continuations *cannot* be simulated by threads. (Coroutines can be > > OK, that's informative. So much for the differences between threads and > continuations. But I'm still left wondering just what the heck > continuations are. :) Well, just like the rest of us. I'll explain continuations in Scheme, because that's the only continuatios I know of. I assume Christian will pop up with Stackless's module "continuation" any time now. Scheme has a function called call-with-current-continuation (usually aliased in implementation to call/cc). It takes one function, which takes one parameter, and calls it with an opaque object -- the continuation. The continuation is a function accepting one parameter (OK, I'm simplifying the truth here, but never mind). When the continuation is called with a parameter "x", the function which called call/cc thinks call/cc returned with the value "x". On the other hand, if the function which was given to call/cc returns with the value "x", the function which called call/cc also thinks call/cc returned with value "x". You can use it like setjmp/longjmp, in things like callbacks: before before calling the callback, set a global variable to the current continuation, and call it. Any time the callback wants to "longjmp", it merely calls the continuation with a pre-determined value. When the call/cc returns that value, you know the callback jumped. That was probably very incomprehensible, but that's quite all right. Continuations are hard. The timbot explained to me a few times, so by now I can fool lots of people into believing I understand them, but it still sometimes baffles me. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From lpagano at appliedtheory.com Tue Feb 8 16:20:53 2000 From: lpagano at appliedtheory.com (Lou Pagano) Date: Tue, 08 Feb 2000 16:20:53 -0500 Subject: Debugger Is Sorely Lacking!! Message-ID: <3.0.5.32.20000208162053.007c5cc0@franklin.appliedtheory.com> I am brand spanking new at Python, and so, make LOTS of mistakes. I have found a lot lacking in the debugger. There is no way to: 1: Trace the VALUE of a variable as a script runs. 2: Step through a module if it executes outside of a class or function. When execution enters the 'MAIN' logic, the debugger gets grayed out, can't be accessed, and the script is hung. 3: Step through the raw_input logic. The operator can never enter anything and the debugger gets grayed out, and the script is hung. 4: When I try to set a breakpoint, execution never stops there! I am looking for a debugger that can handle all the 'normal' debugging functions any other debugger can do. Anyone know of one? I'm willing to change editors if necessary. I am using the Python 1.5.2, and I think the debugger release is 0.5. I am developing on a Windows 98 box, but the final code will have to run on a LINUX server. Ideally, the debugger should run in both environments. One other annoyance: When I place a comment between code lines, the following line never indents correctly without using spaces. I suggest that the indent rules apply from code line to code line and ignore all comments. This happens even if the comment is at the END of a Python code line. Lou Pagano From sabren at manifestation.com Mon Feb 28 04:59:58 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Mon, 28 Feb 2000 04:59:58 -0500 (EST) Subject: Traling junk in string.atof (RE: array constructor) In-Reply-To: <20000228092338.A1416@stopcontact.palga.uucp> Message-ID: On Mon, 28 Feb 2000, Gerrit Holl wrote: > > > I remember reading about a language that generates absolutely no errors of > > any kind. > > HTML, javascript, CSS, PHP. There's another language, too... It's called "Trython". It looks an awful lot like some other scripting language I recall seeing once, but you put everything inside the special trython begin/end blocks, like so: ################## try: exec(""" insert any crappy, bugridden code you want :) """) except: pass ################## :) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From amused at webamused.com Sat Feb 12 11:55:08 2000 From: amused at webamused.com (Joshua Macy) Date: Sat, 12 Feb 2000 16:55:08 GMT Subject: Two question from a newbie References: <%zep4.24612$3b6.103195@ozemail.com.au> Message-ID: <38A58E16.188BD6DC@webamused.com> Jason Stokes wrote: > > Moshe Zadka wrote in message ... > > > > >if x.mode in ("view", "modify"): > > myMode = x.mode > > I don't see that this idiom has that much to recommend it. Mr Drake's > version is clear in that we're comparing x.mode with two modes -- "view" and > "modify". Your version attempts to *find* x.mode in the tuple ("view", > "modify") and executes the sub-bock if successful. The intention of the > first example is immediately apparent. The intention of the second is not > so immediate, so it must lose out if you want to write maximally > comprehendable code. Consider what happens if you want to add another three modes (particularly if this test occurs in other places in your code). Something like: modes = ("view", "modify", "debug", "modifyWithRollback") if x.mode in modes: myMode = x.mode has it all over if (x.mode == "view" or x.mode == "modify" or x.mode == "debug" or x.mode == "modifyWithRollback"): myMode = x.mode IMO, of course. Joshua From effbot at telia.com Mon Feb 14 16:38:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 21:38:34 GMT Subject: Python tkinter question References: <38a85efa@wwwproxy3.westgroup.com> Message-ID: MikeZ wrote: > I am interested in creating a text control in tkinter and then allow the > user the highlight an area of text in this control. > > I am having a problem trying to figure out how to get the text that was > highlighted by the user. Is there an event and/or method that I can use from > the text control. text = w.get(SEL_FIRST, SEL_LAST) also see: http://www.pythonware.com/library/tkinter/introduction/text.htm From bowman at montana.com Tue Feb 15 09:18:21 2000 From: bowman at montana.com (bowman) Date: Tue, 15 Feb 2000 14:18:21 GMT Subject: erasing and writing test on console. References: <38A95B81.DCFC4C25@durham.ac.uk> Message-ID: J.C.Travers wrote: >where the 'zzzz bytes downloaded' is updated. >Do I need to use curses to do this, or is there a simpler way just using >the standard print and an erase function that I haven't heard of? Not the most elegant way, but one that usually works: set your print up so you are not emitting a new line. Then emit enough backspace characters to get back to the zzzz, and print the new number. From mtho at axion-gmbh.de Sat Feb 26 08:44:20 2000 From: mtho at axion-gmbh.de (Manfred Thoma) Date: Sat, 26 Feb 2000 13:44:20 +0000 Subject: ZOPE - Add User to a Folder Message-ID: <38B7D8B4.391E40AE@axion-gmbh.de> Is there anyone who can explain me, or even better give me a complete sourcecode, how i can add a User to the acl_user-Folder with DTML - Tags!? Thousand thanks to the one who does it.... mtho at axion-gmbh.de From effbot at telia.com Wed Feb 23 12:04:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 17:04:33 GMT Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <38B40EBD.13EC1C1E@math.utah.edu> Message-ID: Mladen Bestvina wrote: > >>> Tkinter._test() > Traceback (innermost last): > File "", line 1, in ? > File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 1947, in _test > root = Tk() > File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 886, in > __init__ > self.tk = _tkinter.create(screenName, baseName, className) > TclError: Can't find a usable init.tcl in the following directories: > > > > > This probably means that Tcl wasn't installed properly. Tkinter as distributed with Python 1.5.2 does *not* work with Tk 8.1 and later. either use 8.0.5, or get patches from here: http://www.deja.com/getdoc.xp?AN=484958681&fmt=text hope this helps! From tim_one at email.msn.com Tue Feb 29 01:17:45 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 29 Feb 2000 01:17:45 -0500 Subject: functional programming & tail recursion? In-Reply-To: Message-ID: <000401bf827c$b20fd1c0$732d153f@tim> [Dennis E. Hamilton] > I am a little puzzled by the discussion on tail recursion. The seems to > imply that tail recursion involves simply catching variations on the case > > def f(...): > stuff; ...; > return f(transformed ...) Also tail-calls in general. This comes primarily from the Scheme world, which language has no iteration. Scheme implementations are required (by the Scheme std) to be "properly tail recursive", which is defined in such a way that iteration can be written via recursion yet run in bounded space. The same idea pops up in truly (which Scheme is not) functional languages too, with somewhat more force, since a truly functional language has no rebinding of names (try to write a useful loop wherein *nothing* can vary <0.5 wink>). > In my experience, most interesting recursive forms don't > automatically take that structure. Sure, but experienced Schemers can be very clever about bashing stuff into that form. In fact, they *have* to be to avoid the gross inefficiencies in some of your recursive Fibonacci examples. However, don't assume that's hard! Any loop you write can be easily expressed as a tail-recursive function instead. It's so easy that most Schemes even have a macro or two that "look like loops" that automagically transfrom into recursive functions. Also don't assume that it's slow: function calls in Scheme are very much cheaper than in, e.g., Python. > And when they do, one might as well go the rest of the way and implement > the recurrence-iteration! In Python, you bet. It's not an option in functional languages, though. But don't dismiss it out of hand -- there is great power hiding in the approach. If you're really curious, pick up Abelson & Sussman's "Structure and Interpretation of Computer Programs", and use it to learn a little Scheme and a lot of CompSci. > ... > The file also demonstrates why one indeed wants to replace recursive > descents by recurrence iterations whenever possible. In Python (and C, and C++, and Fortran, and Java, and Visual Basic, and Perl, and JavaScript, and Tcl, and ...), yes. In several other languages, no. you-can-ignore-it-in-python-for-decades-and-not-miss-a-thing-ly y'rs - tim From rob at hooft.net Tue Feb 22 08:14:56 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: Tue, 22 Feb 2000 14:14:56 +0100 (CET) Subject: Inter process communication using Tk/send hangs on suspended processes In-Reply-To: <20000223001005.14713@nms.otc.telstra.com.au> References: <20000216225453.06891@nms.otc.telstra.com.au> <14509.6815.70098.462099@temoleh.chem.uu.nl> <20000223001005.14713@nms.otc.telstra.com.au> Message-ID: <14514.35792.211455.606578@temoleh.chem.uu.nl> >>>>> "GM" == Greg McFarlane writes: GM> On 18 Feb, Rob W. W. Hooft wrote: >> >>>>> "GM" == Greg McFarlane writes: GM> On 15 Feb, Rob W. W. Hooft wrote: >> >> I have a group of python programs. Whenever any new program is >> started, it will try to establish connections to each of the other >> ones using Tk/send (it is asking each for their background color, >> and will choose a new one for itself). >> GM> The only things I can think of are to fork separate processes to GM> do each send and kill them if they do not respond quickly. >> That doesn't work, as this will result in X requests that arrive >> out-of-order. As far as I know, no 2 processes can share their X >> socket connection. I guess I'll have to investigate the "server" >> concept. GM> That is only true if you fork without exec'ing and are not GM> careful about closing the inherited file descriptors. What I GM> meant was to fork *and exec* another process, passing in GM> information like the X display using the command line arguments. Yikes, that sounds really expensive: execing another python process, and importing Tkinter in there..... I guess I could do one fork/exec for all queries. I'll have a look. The alternative idea of a server that is automatically (re-)started to keep a centralized database sounds very nice as well. More work to get started, but very powerful! Thanks for all help, 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 bob at horvath.com Fri Feb 25 13:44:57 2000 From: bob at horvath.com (Bob Horvath) Date: Fri, 25 Feb 2000 18:44:57 +0000 Subject: identity of the caller? References: <38B4EDE0.1DB1B55F@horvath.com> <38B53445.AE517D15@horvath.com> Message-ID: <38B6CDA9.8B158EE9@horvath.com> Warren Postma wrote: > > I'm doubt it too. I suspect there is a more clever way to do it, just that > > I am not clever enough to at the moment to think of it. > > Sometimes the obvious is just too obvious. > > Senders call receivers, and pass a reference to themselves as a PARAMETER to > the function, called Sender. Who called me? Well, I'll just look at the > parameter 'Sender'. Yes, that is probably end up doing something like that, although I appreciate people showing me how to do it the ugly way, as I had requested. I am trying to create something that is modelled after something already done in an internal tool that we use. If I ever want to get it so that others can use and contribute to it, is would be nice if it were similar to what they currently use. Currently, they don't have to specify who they are when they send something, and I was trying to figure out a way to model it in Python without having to change that mindset. Without going into the boring details, I hope that helps to understand why I decided to open up the kludge closet looking for another tool. From jfarrell at mincom.com Mon Feb 21 22:42:38 2000 From: jfarrell at mincom.com (John Farrell) Date: Tue, 22 Feb 2000 13:42:38 +1000 Subject: Cool things about Ruby on the way out of Python? Message-ID: <38B205AE.666D1AA2@mincom.com> After a debate on this list about claims made in this paper: Ruby: a new language http://www-4.ibm.com/software/developer/library/ruby.html I read the paper to learn what the fuss about Ruby was about. Ruby is a pretty neat language designed like an OO form of Perl. If I had to summarise it in one sentence, I would say "OO Perl without so much line noise, and these cool things called iterators". One of the big things Ruby does is allows you to pass around blocks of code as parameters. In Python, they are equivalent to lambda expressions, except that in Ruby the body of the lambda can (directly) contain statements. In Python you would write: for x in [1, 2, 3]: print x In Ruby you would write: [1, 2, 3].each do |x| print x end A more direct translation would be: map (lambda x: print x, [1, 2, 3]) # not legal Python, I know Effectively everything you can iterate over in Ruby has to implement this 'each' functionality, then you can pass code into it. (BTW, I really dislike the magic syntax to invoke the code in Ruby, but that's not the point of this thread.) Now, the good things about the Python way are: * easy to understand * no sucky Perl-like syntax The good things about the Ruby way are: * because you can implement each yourself, you can make it mean different things for all the types of objects you iterate over. * you can put statements inside lambdas IMHO, if we could get around the syntax problems, map/each and lambda could be used to write beautiful programs. I think the reason that lambda doesn't really work in Python is because it can only return values, and hence doesn't do what you might want it to all the time. Map also doesn't work because it is such a fundamental concept that it needs to be syntax (hence list comprehensions), and once you make it into a function it's harder to see what it does. Ruby looks cute. If I was a Perl user I might be tempted to go to it. In the mean time, I will stick with Python, and pine for the long days by the fjords spent writing Miranda. John -- Dr John Farrell - Research Architect - Mincom Limited I don't suffer from stress. I am a carrier. -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d- s++:+ a C+++ U+ 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------ This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this E-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. From wware at world.std.com Sat Feb 26 00:45:06 2000 From: wware at world.std.com (Will Ware) Date: Sat, 26 Feb 2000 05:45:06 GMT Subject: i know this sounds redicculus but!!!.... References: Message-ID: Collin Greene (greene at hctc.com) wrote: : anyone know a good tutorial... Try this: http://www.python.org/doc/current/tut/tut.html -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From bwilk_97 at yahoo.com Sun Feb 6 14:52:03 2000 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Sun, 06 Feb 2000 19:52:03 GMT Subject: Excel Question References: Message-ID: [Robin Becker] > Why don't you make the python a server instead of a client. Then your > excel could call a small vba routine to open up a python com object. Two reasons really. 1. This is a simulation model. There are many different versions of the model. I don't really want to have to register an object per model version. 2. There is a performance decrease when I run the model as a server.(almost twice as slow.) It just works really well the way I have it, if I can just get around this one problem. Now, having said that. I might have to go with the server object anyway if From breiter at usf.Uni-Osnabrueck.DE Mon Feb 7 13:39:47 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 7 Feb 2000 18:39:47 GMT Subject: mail filter in python? References: <20000208000902.31713@nms.otc.telstra.com.au> Message-ID: <87n3hj$r30$2@newsserver.rrzn.uni-hannover.de> In article , scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) writes: > Greg McFarlane wrote in comp.lang.python: >> I am looking for a replacement for the "filter" program that comes >> with elm - something that I do not have to compile and something that >> is easy to hack on. Does anyone know of a python version? > The best program out there for this sort of thing is Procmail. I second that. Just for completion, there is another newcomer in the mailfilter competion. Still a greenhorn, but maildrop. Of course, who ever could get a C++ save. :) http://www.flounder.net/~mrsam/maildrop/README.html Bernhard -- Free Software Projects and Consulting (intevation.net) Association for a Free Informational Infrastructure (ffii.org) From tim_one at email.msn.com Mon Feb 14 22:22:26 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 14 Feb 2000 22:22:26 -0500 Subject: Python sucks loud In-Reply-To: Message-ID: <000f01bf7763$e23d5080$66a2143f@tim> [Forget it] > You people are funny here, all excited about Python. > Following one guy's recommendation, for two days already I'm > looking at Python as a potential plug-in language, and it > DISGUSTS me. [Grant Edwards] > That's one of the lamest, most transparent flame-bait postings > I've seen in a long time. Oh ya? What about *this* one?! Monkey boy. forget-it-forgot-to-liken-guido-to-hitler-ly y'rs - tim From jeremy at cnri.reston.va.us Mon Feb 21 14:37:01 2000 From: jeremy at cnri.reston.va.us (Jeremy Hylton) Date: Mon, 21 Feb 2000 14:37:01 -0500 (EST) Subject: DCPIGgies meeting, March 13 Message-ID: <14513.37853.690552.202436@goon.cnri.reston.va.us> (Second) Notice to all Washington DC area Python users: We will be having our first DCPIGgies (DC Python Interest Group) meeting of the year on Monday March 13, 2000 from 7:30pm to 9:00pm at CNRI in Reston, Va. Please RSVP to me, jeremy at cnri.reston.va.us. Speaker: Scott Cotton Static Type and Interface Checking for Python General Review and Fundamental Decisions Abstract ---------- This presentation reviews various possible ways of adding static type checking to python. The problem poses two questions: 1) What sort of static type checking system would be most appropriate for python? 2) By what means may static type checking be made optional? A decision tree for each question is presented based on a combination of type theory, an understanding of python, and properties that have become apparent in the development of a sample type checking system. Finally, we discuss some overall approaches that would maximize the benefits and/or minimize the drawbacks of adding optional static type checking to python. Scott will be speaking from 8:00 to 9:00pm. We will have food and introductions starting at 7:30pm. We may also have some time after the talk for Q&A with Guido and Barry on Python and JPython. Pizza, salad, and soda will be provided courtesy of Foretec Seminars. Please RSVP by email to jeremy at cnri.reston.va.us. I need to know how many people will attend and how many will be eating pizza. Directions to CNRI can be found on the Web: http://www.cnri.reston.va.us/directions.html Mailing list: There is a mailing list for people interested in DCPIGgies meetings; see http://www.python.org/mailman/listinfo/dcpiggies. This is a low volume list for announcing meetings, arranging to share rides, and other thrilling PIGgy topics. See you there! Jeremy From moshez at math.huji.ac.il Sat Feb 19 06:44:05 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 13:44:05 +0200 (IST) Subject: What a weird thing !!? In-Reply-To: <88lukr$2cfj$1@news5.isdnet.net> Message-ID: On Sat, 19 Feb 2000, Florent Rami?re wrote: > Hi, > > sorry for replying this message, but is what you say means that there is > absolutely no way to print excatly what i want to print ??? > > I will never be able to display "ab" in two print ??? Use sys.stdout.write. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From dweber1 at austin.rr.com Tue Feb 15 19:35:11 2000 From: dweber1 at austin.rr.com (Daniel Weber) Date: Wed, 16 Feb 2000 00:35:11 GMT Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> <20000212113935.C1007@stopcontact.palga.uucp> Message-ID: <38A9FF25.71B5B776@austin.rr.com> Fredrik Lundh wrote: > Gerrit Holl wrote: > > I think it should be published in the original Docbook format too, since > > people can generate their favorite format AND contribute to the manual > > than. > > given that I hear far more complaints than thank > you's, it's more likely that I will stop distributing > the acrobat version. > > "this is what you want, this is what you get" > > Maybe the fact that it can't be printed irritates so many people is a compliment :-) I love the manual - I just wish I could print it.... The Tkinter book isn't as nice as the on-line manuals. :-( From metafakx at yifan.net Fri Feb 25 17:09:59 2000 From: metafakx at yifan.net (david) Date: Fri, 25 Feb 2000 15:09:59 -0700 Subject: fatal SIGSYS under irix In-Reply-To: <000201bf8022$e61bfae0$3c2d153f@tim>; from tim_one@email.msn.com on Sat, Feb 26, 2000 at 01:29:56AM -0500 References: <000201bf8022$e61bfae0$3c2d153f@tim> Message-ID: <20000225150959.A21867@yifan.net> * Tim Peters : > > I'd say both OSes are unreasonable here (Irix shouldn't blow up, Linux > should at least complain). Under Win95 (dear Lord, how embarrassing for > Unix ): > > >>> f = open("blah.blah") > >>> f.seek(1, -4) > Traceback (innermost last): > File "", line 1, in ? > IOError: [Errno 22] The device does not recognize the command > >>> > Here is what happens under Linux: >>> f = open('home.html') >>> f.seek(1, -4) Traceback (innermost last): File "", line 1, in ? IOError: [Errno 22] Invalid argument >>> - David From effbot at telia.com Wed Feb 2 12:52:41 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 17:52:41 GMT Subject: use the module select in JPython References: Message-ID: nhat wrote: > I have problem with JPython 1.1 on Windows 98. I can use the module "select" > in Python 1.52 but not do it in JPython. You can explain me why and how to > surmount. JPython only supports a subset of the built-in modules (i.e. modules that are written in C in CPython). and in this case, the fact that Java (last time I checked, at least) doesn't support polling makes things a bit harder. however, it should be possible to use threads to emulate this module, and it listed as "being under consideration" on the jpython.org site: http://www.jpython.org/docs/differences.html "working code would make the decision much easier" From gmcm at hypernet.com Sat Feb 19 16:14:01 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 19 Feb 2000 16:14:01 -0500 Subject: dynamically extend classes In-Reply-To: <7kwvo1mbam.fsf@jpl.nasa.gov> Message-ID: <1261127653-5875859@hypernet.com> Matt Wette wrote: > Is there a way to dynamically extend classes in Python? > > I'd like to be able to have sitecustomize.py import a module > and add methods to a class so that later, when anohter modules > imports this module and uses the class it sees the added methods. > > Doable? Oh yeah. class MyAddedMethods: def snarf(self): ... import innocent bases = innocent.Sucker.__bases__ innocent.Sucker.__bases__ = bases + (MyAddedMethods,) print "Come on in, dear, the water's fine!" import sound sound.play('Theme_from_Jaws') - Gordon From lenny at squiggie.com Thu Feb 17 15:20:19 2000 From: lenny at squiggie.com (Lenny Self) Date: Thu, 17 Feb 2000 12:20:19 -0800 Subject: mxDateTime and MySQLdb on RedHat 6.1 Message-ID: Hello. I am having trouble compiling these to new modules on my RedHat 6.1 Linux box. Below are the errors I am getting on each installation. *** mxDateTime *** It says to to run: make -f Makefile.pre.in boot When I do it just comes back with: make: Makefile.pre.in: No such file or directory make: *** No rule to make target `Makefile.pre.in'. Stop. I just decompresses the zip file and moved it to the proper location in the python path /usr/lib/python1.5/site-packages/DateTime. Any suggestions? *** MySQLdb *** When I run the build.py script as it says to do I get these messages: cp: /usr/lib/python1.5/config/Makefile.pre.in: No such file or directory make: Makefile.pre.in: No such file or directory make: *** No rule to make target `Makefile.pre.in'. Stop. make: *** No targets. Stop. Traceback (innermost last): File "build.py", line 14, in ? import MySQLdb File "MySQLdb.py", line 19, in ? from _mysql import * ImportError: No module named _mysql Any suggestions here? Thanks in advance. -- Lenny From pinard at iro.umontreal.ca Wed Feb 16 23:15:43 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 16 Feb 2000 23:15:43 -0500 Subject: Problem with Emacs mode, at start only Message-ID: Hi, people. I have a little problem, which is a bit annoying, yet not that much. Maybe there is an already known solution for it? Or am I alone in having this problem? When, in Emacs, I do not have `*Python*' window initialised, or more precisely, when there is no process running in that window, then `C-c C-c' in the window where is the Python source invariably fails the first time, with the diagnostic below. Repeating the command a second time works as expected, and the next times as well, as long as the Python sub-process does not terminate. Here is how it looks after `C-c C-c' twice: ----------------------------------------------------------------------> ## working on region in file /usr/tmp/python-5616l1C... Python 1.5.2 (#1, Jul 23 1999, 06:38:16) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> Traceback (innermost last): File "", line 1, in ? IOError: [Errno 2] Aucun fichier ou r?pertoire de ce type >>> ## working on region in file /usr/tmp/python-5616y_I... >>> ----------------------------------------------------------------------< This is with Python mode 3.105, while using Emacs 20.5. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From 2jerry at writeme.com Tue Feb 22 18:51:55 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 00:51:55 +0100 Subject: commands.getoutput help References: <88v5nm$nu5$1@nnrp1.deja.com> Message-ID: <88v78r$d50$1@wanadoo.fr> with : rsync = commands.getoutput('rsync %s %s' % (source,destination)) that is better I personnally prefer : concate + rsync = commands.getoutput('rsync "+source+" "+destination) easiest to read ... Best regards, Jerry the foolish dracomorpheus, jerome VACHER - france - Paris - yo_james at my-deja.com a ?crit dans le message <88v5nm$nu5$1 at nnrp1.deja.com>... >Hello, > >I was wondering if it was possible to pass a >string into the commands.getoutput module? Here >is an example of what I want to do: > >source = '/home/from/' >destination = '/home/to/' ># rsync copies files from the source to a ># destination >rsync = commands.getoutput('rsync %s %s') >%(source,destination) > >Any help will be greatly appreciated. > >James > > >Sent via Deja.com http://www.deja.com/ >Before you buy. From reic0024 at ub.d.umn.edu Sun Feb 13 20:47:12 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Sun, 13 Feb 2000 19:47:12 -0600 Subject: Where can I find PyObjC? Message-ID: Is there a tarball of this around anymore? I can find very little information on it, just a page at python.org with an archived mailing list. I realize that this SIG is dead, and most likely the entire project alltogether. But is anyone using it? And where can I get it? Did it only work with NeXTSTEP/OpenStep/Mac OS X Server, or would it work under Linux as well (calling other Objective-C kits, perhaps GNUstep)? Aaron From aahz at netcom.com Wed Feb 16 20:24:53 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 01:24:53 GMT Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <88f53h$em2$1@nntp6.atl.mindspring.net> <14507.17447.857827.44321@anthem.cnri.reston.va.us> Message-ID: <88fil5$shr$1@nntp6.atl.mindspring.net> In article <14507.17447.857827.44321 at anthem.cnri.reston.va.us>, Barry A. Warsaw wrote: > >>>>>> "A" == Alex writes: > > >> how does one do 'ff'.atoi(16) using 'ff'.int()? > > A> Aahz, my impression was that he was talking about functions > A> available in the string module, not really methods of a string > A> object. > >Actually, he's talking about the builtin int(), float(), and long() >functions. We decided that those subsumed all the functionality of >string.atoi(), etc. so it didn't add anything to make string methods >of atoi, etc. Well, int() definitely does *NOT* subsume all functionality of string.atoi() (note the "16" radix above; string.atoi('ff',16) in 1.5.2), so I think that atoi() needs to be a string method. If you've got atoi(), might as well add the others for consistency. I'm assuming, of course, that the revised 1.5.2 documents are correct and that int() still does not take a radix. -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From Gareth.McCaughan at pobox.com Thu Feb 10 16:44:59 2000 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: 10 Feb 2000 21:44:59 +0000 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> Message-ID: <86ya8szq90.fsf@g.local> Paul Prescod wrote: > You are right that Lisp-ers (and Smalltalkers) have gone to great > lengths to promote their languages. My hypothesis is that they have not > gone to great lengths to *adapt* their languages for popularity. This > leaves the vast majority of programmers in C++ hell -- sometimes by > choice and sometimes through environment. I think it's possible that some of the changes that would be necessary to "adapt their languages for popularity" would also damage the things that make those languages better than "C++ hell" in the first place. For instance, lots of people are afraid of Lisp because the syntax looks funny -- eeurgh, all those parentheses. But that funny syntax is a crucial part of Lisp's strength, because it's what enables the powerful macro system that's such a vital part of Lisp. (Smalltalk syntax looks funny, too, but it isn't so fundamental to the language. Perhaps a more approachable version of Smalltalk might be possible.) But the main reason -- so far as my limited observation shows -- why so many people think that Lisp and Smalltalk are no use is something that the Lisp and Smalltalk communities really can't do all that much about. Namely, there are a bunch of myths about both languages, very widely purveyed, and entirely false. "Lisp programs are really slow". "You can't do low-level stuff in Lisp". "Lisp systems have to be really big and bloated". "Smalltalk is a toy language". "Garbage collection means that your program will stop working for several seconds at random times". "Lisp is only for AI programs". These legends were mostly true once upon a time. They're utterly false now. But they scare people away. Perhaps they could be banished by a sufficiently vigorous marketing campaign by the Lisp and Smalltalk communities, or by the vendors of Lisp and Smalltalk systems, but they really don't have the resources for that. >> Er, it's not obvious to me where 'programming language' ends and >> 'development environment' begins. A programming language is an >> interface between the programmer and the computer, and so is the >> IDE. The line between the two is necessarily somewhat artificial. > > No, there is a very clear line. A language is a set (usually infinite) > of strings. A programming language is a mapping from each of the strings > to a program (let's say a Turing machine). Let's *not* say a Turing machine. Real programs run on machines that are connected to the outside world, and their behaviour can involve things like graphics, user interaction, and network communication. And it's exactly the presence of these things that makes the division between language and environment sometimes misleading. Suppose a language is specified as including a TRACE statement, defined in some such terms as "After `TRACE foo' is executed, and until a corresponding `UNTRACE foo', every invocation of the procedure `foo' will result in the output of a diagnostic message with such-and-such a format. The message is sent to the USER-INTERACTION stream." Is that part of the language or part of the environment? What if there's also a BREAK statement that establishes a breakpoint? Is that language or environment? What if other objects in the environment are explicitly defined by the language specification to be manipulable by the program? Suppose your language's library (and the library *is* part of the language, right?) includes a function defined to pop up a browser window in which the user can inspect the current state of the program and select one of the program's variables, whose binding will then be returned as the result of the function call? Language or environment? (These examples aren't taken directly from real languages, nor should I be assumed to think they're good things to have.) -- Gareth McCaughan Gareth.McCaughan at pobox.com sig under construction From somewhere at home.now Fri Feb 11 16:30:07 2000 From: somewhere at home.now (Stein M. Eliassen) Date: Fri, 11 Feb 2000 22:30:07 +0100 Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> Message-ID: <38A47F5F.AEF12053@home.now> Warren Postma wrote: > > He's gone, right!? Whew. :-) Ahh, that must have been the sucking sound I heard. From Denys.Duchier at ps.uni-sb.de Fri Feb 25 10:57:15 2000 From: Denys.Duchier at ps.uni-sb.de (Denys Duchier) Date: 25 Feb 2000 16:57:15 +0100 Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> <38B69C6D.3E7C17D2@bellatlantic.net> Message-ID: Steve Holden writes: > [remarks on the practicality of tail call optimization which > seemed to overlook the need to retain context for exception > handling] No such thing was overlooked. Calls appearing within the lexical scope of a try are not tail calls; thus they are not subject to tail call optimization... ... or you can implement exception handling using continuations :-) oh hum... -- Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de Forschungsbereich Programmiersysteme (Programming Systems Lab) Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier Postfach 15 11 50 Phone: +49 681 302 5618 66041 Saarbruecken, Germany Fax: +49 681 302 5615 From olipt at mayo.edu Tue Feb 15 12:38:08 2000 From: olipt at mayo.edu (Travis Oliphant) Date: Tue, 15 Feb 2000 11:38:08 -0600 Subject: Help with Python Grammar change In-Reply-To: <38A91EA9.52CA20BE@dcs.kcl.ac.uk> References: <38A91EA9.52CA20BE@dcs.kcl.ac.uk> Message-ID: > > Whether or not it's possible in this instance (and to be honest, this > doesn't seem a particuarly useful change but that's just me), changes > to the grammar shouldn't be undertaken lightly. Quite a few of us poor souls > out there have Python eating programs of one sort or another and changes to > the grammar can cause our programs to fail in baldness inducing ways. I can understand this problem. The reason I'm interested is due to the use of Python as a data analysis environment. There is a debate brewing about whether or not slices of array objects should be references or copies and I was hoping that it would be possible for a "function-call" to produce copying behavior and "indexing" notation to continue with it's current reference behavior. If a is a 3-dimensional array currently a[:,:,5] returns a reference to a two-dimensional sub-array. It would be useful if a(:,:,5) returned a copy to that array. Using the current grammar we could make a(slice(None),slice(None),5) return the copy, but it is definitely not as clever. > > If I have to end up looking like a Benny Hill sidekick, it would be > nice to know it was in the name of new functionality and not just > getting-into-the-realms-of-another-language-beginning-with-P tiny > syntactic sugar . This is just an example of possible usage. It would allow many other readability enhancments for array programmars as well. -Travis From greene at hctc.com Mon Feb 21 12:53:21 2000 From: greene at hctc.com (Collin Greene) Date: Mon, 21 Feb 2000 10:53:21 -0700 Subject: i am a newbie to python , where can i D/L it? Message-ID: i have just heard about python and i was told it was a good begginging lag to start programming with i jsut need to know where i cna get it i thought is free, is it not, thanks for any halp Collin From mwh21 at cam.ac.uk Fri Feb 11 12:22:17 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 11 Feb 2000 17:22:17 +0000 Subject: Comparing file objects: what is compared? References: <20000211165155.A4849@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > Hello, > > >>> fp1=open('/tmp/file_one', 'w') > >>> fp2=open('/tmp/file_two', 'w') > >>> cmp(fp1, fp2) > -1 > >>> cmp(fp2, fp1) > 1 > > What is compared? The date of creation? The filename? The contents? > > I've searched the FAQ, the documentation, the sig archives and the > newsgroup, but I'm not able to find the answer. What is compared when > comparing file objects? > File objects have no specialized "cmp" method, so get the default cmp(fp1,fp2) == cmp(id(fp1),id(fp2)) one. HTH, Michael From herzog at online.de Sat Feb 26 10:28:19 2000 From: herzog at online.de (Bernhard Herzog) Date: 26 Feb 2000 16:28:19 +0100 Subject: Tkinter vs. wxPython (was: Which GUI?) References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> Message-ID: Guido van Rossum writes: [...] > Arguments against Tkinter: [...] > - It doesn't let you handle your own paint events; you have to use the > canvas widget. Occasionally (as when drawing animations or large > bitmaps) that's annoying and slow, because you have to create and > destroy tons of small objects. It isn't very difficult to work around this limitation with a C-extension module, at least in a platform specific manner. Sketch for instance has such an extension module for Unix/X platforms which is largely based on the X-extension. It lets you effectively implement a widget completely in Python including handlers for exposure events. If anybody's interested, I can easily release it separately from Sketch. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From rob at hooft.net Tue Feb 15 08:29:07 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 15 Feb 2000 14:29:07 +0100 Subject: Order of object cleanup at interpreter exit? References: Message-ID: >>>>> "MH" == Michael Hudson writes: MH> Try this: MH> def __del__(self,sendfixed=sendfixed): MH> if self.status>0: MH> sendfixed(self.sock1,'EXIT') MH> self.status=-1 MH> That way, sendfixed shouldn't get collected before the instance MH> object. This is a much cleaner workaround than what I had thought of. Thanks. 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 aahz at netcom.com Mon Feb 21 13:18:30 2000 From: aahz at netcom.com (Aahz Maruch) Date: 21 Feb 2000 18:18:30 GMT Subject: Killer Apps References: Message-ID: <88rvhm$efe$1@nntp6.atl.mindspring.net> In article , Hirsch, John wrote: > >I've always thought that Tim Peters was Pythons killer app.. No, the Timbot is Python's app killer. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From aotto at t-online.de Sun Feb 20 14:20:30 2000 From: aotto at t-online.de (Andreas Otto) Date: Sun, 20 Feb 2000 20:20:30 +0100 Subject: ANNOUNCE: Phyton-Compiler Message-ID: <38B03E7E.F9F7D45F@t-online.de> Technology Startup!! We are a group of developers which realises compilers for scripting language's. After implementation of Tcl as compiler-language we have plans for phyton. ??? Ask ??? =========== Does a requirement exist for a Phyton compiler and are your ready to pay for it ?? We are grateful for suggestions and business models in above area details under: Only German http://home.t-online.de/home/aotto/compiler.html mfg aotto :) -------------- next part -------------- A non-text attachment was scrubbed... Name: aotto.vcf Type: text/x-vcard Size: 451 bytes Desc: Card for Andreas Otto URL: From emile at fenx.com Fri Feb 11 07:40:21 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 11 Feb 2000 04:40:21 -0800 Subject: How to do this? - newbie References: <38a2e958$0$1403@news.voyager.net><38A2EE79.14190ABA@bellatlantic.net> <38a3892d$0$96317@news.voyager.net> Message-ID: <06ee01bf748d$2a28f040$01ffffc0@worldnet.att.net> >>> exec (a[0]+"="+`a[1]`) >>> x 1 Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Ronald L. Dilsavor Newsgroups: comp.lang.python To: Sent: Thursday, February 10, 2000 7:52 PM Subject: Re: How to do this? - newbie > > > From: Steve Holden > > Organization: Holden Web: Intranet Technology Specialists > > Reply-To: sholden at BellAtlantic.net > > Newsgroups: comp.lang.python > > Date: Thu, 10 Feb 2000 16:59:10 GMT > > Subject: Re: How to do this? - newbie > > > > "Ronald L. Dilsavor" wrote: > >> > >> Hi, > >> I am new to python and am quite excited about it. I spent much of last night > >> writing my fist code snippet and I came across 1 thing which I could not > >> figure out how to do. > >> > >> Suppose > >> > >>>>> a=('x',1) > >> then how can I create an x of numerical type such that > >>>>> print x > >> 1 > >> > >> - just using manipulations of a = ('x',1) > >> > >> Also let me know if this type of thing would not be considered best practice > >> in python. I thought I would need to make use of eval() but could not find > >> an incantation that would do it. > >> > >> Thanks, > >> Ron > > I am sure there are people reading this group who can tell you > > how to dynamically construct something which will create a > > variable called a and assign it the value 1. > > > > But it seems you really want to be able to retrieve the numeric > > value using the symbol 'a' as a key, and that's what dictionaries > > are for. > > > >>>> mydict={} # empty dictionary > >>>> mydict['a']=1 # enter value 1 against key 'a' > >>>> print mydict['a'] # retrieve the value > > 1 > >>>> > > > > Is *that* what you want? > > > > regards > > Steve > > > > In fact that is exactly what I ended up doing (using a dictionary) and I may > just keep it that way. I was just wondering how to do it the way I asked. > Ron > > -- > http://www.python.org/mailman/listinfo/python-list > From effbot at telia.com Thu Feb 17 14:43:39 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 20:43:39 +0100 Subject: two questions References: Message-ID: <004301bf7980$b00733a0$34aab5d4@hagrid> Moshe wrote: > Hey, what are you doing posting from the eff-bot's account? I'm sure > you're not the bot in question, because the bot knows that Tkinter runs on > distinctively non-X-windows based platforms such as MS-Windows (may > it forever perish in the deepest hell). Tk is also supposed to compile > on Macs (don't know about OS X, though), but Tkinter is only usable when > the moon is shining just right. but Mac OS X is a Unixoid. I'm pretty sure it doesn't support the Win32 API, and you answered the rest of your question your- self... ;-) From dworkin at ccs.neu.edu Thu Feb 10 17:09:13 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 17:09:13 -0500 Subject: emacs CC-mode configuration for Python source In-Reply-To: "Trent Mick"'s message of "Thu, 10 Feb 2000 14:11:23 -0000" References: Message-ID: "Trent Mick" writes: > Does anybody have a the proper configuration lisp code for setting up emacs > CC-mode to conform with the Python source? It would save me the trouble and > slight inconsistencies of figuring out myself. Don't use cc-mode, use python-mode. http://www.python.org/emacs/python-mode/ -Justin From 2jerry at writeme.com Tue Feb 22 17:41:50 2000 From: 2jerry at writeme.com (Jerry) Date: Tue, 22 Feb 2000 23:41:50 +0100 Subject: Multiple ExtensionClass References: Message-ID: <88v35e$2d2$1@wanadoo.fr> Sorry to borrow you but I tried the example to see that strange behaviour: I write this : >>>class A: def fa(self): print "func fa" >>>class B(A): def fb(self): print "func fb" >>>a=B() >>>a.fb() func fb >>>a.fa() func fa What is wrong that work properly ... do you miss the self for the class methode ? the trace back is significant : raceback (innermost last): File "", line 1, in ? a.fa() TypeError: no arguments expected best regard, Jerry the foolish dracomorpheus, j?r?me VACHER - france - Joel Lucsy a ?crit dans le message ... >I've figured it myself (just takes time). Basically I use the >PURE_MIXIN_CLASS macro in ExtensionClass. Since the result is an >uninstantionable I wrapped a Python class around them. I'll be releasing the >end result to the public when I'm finished. I'm basically rewriting the >pyFLTK toolkit by hand instead of using swig. > >"Joel Lucsy" wrote in message >news:CCXq4.651$yT3.43993 at news1.usenetserver.com... >> Ok, I've whipped up two ExtensionClass classes (stirred, not shaken) and >am >> trying to figure out how one can be a "subclass" of the other. I'll >> illustrate what I want (in python for brevity): >> >> class A: >> def func1(): >> pass >> class B(A): >> def func2(): >> pass >> >> Now I'd like to be able to do: >> a=B() >> a.func1() >> >> So far I haven't figured out how to do this without duplicating the >methods. >> Should I be messing with the method tables, or somehow manipulating the >> dictionaries, or something completely different? I've tried making python >> wrappers, but it complains about multiple bases or something. Basically it >> wont let me derive from two different ExtensionClasses's. Either that or >I'm >> missing something. >> Any clues would be great. Thanks. >> >> -- >> - Joel Lucsy (jjlucsy at concentric.net) >> >> >> >> >> > > > > From tim_one at email.msn.com Tue Feb 22 22:03:04 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 22 Feb 2000 22:03:04 -0500 Subject: functional programming In-Reply-To: <38B2CE44.CB9B41A9@roguewave.com> Message-ID: <000801bf7daa$80dde000$51a0143f@tim> [Fran?ois Pinard] >>> What would be the advantages of using a "functional" Python, >>> as per your definition? I mean, of course, in practice? I'll toss one in, since I don't think anybody else mentioned it yet: functional programs *can* be much easier to reason about. NeelK nearly said as much in the case of threaded programs, but it applies to single-threaded programs too. Not long ago Billy mentioned an especially pure functional language called Joy, and reading the Joy papers should give a quick feel for how powerful and natural reasoning can be in a language aiming at that. OTOH, Joy is useless . [Moshe Zadka] >> None. But it would be cool to have tail recursion, which could probably >> be implemented in a post-Stackless world. [bjorn] > Maybe I'm dense, but what is stopping us from implementing tail call > optimization (of which tail recursion is just a special case) with the > current Python implementation. Identifying a call in a tail position > is a simple static analysis that isn't affected by Python's dynamicity (is > that a word?). Once they're identified you only need to translate a > call to a jump instead of a push return address and jump. There is no > semantic change to Python. I doubt Python will ever do this, not because of implementation reasons, but for a combo of two and a half other reasons: 1. Guido doesn't want to support functional styles in Python; or, more accurately, wants not to support them . 2. Python tries to give users (at least those who bother to read the Reference Manual ) a clear model for "what happens" at runtime. Explaining language semantics by explaining how the implementation works is frowned upon in many respectable circles, but in my experience is the only approach most users can actually grasp (no, a meta-circular interpreter is right out the window): it's efficient of the user's time, and doesn't lie (except when it does -- in which case it points to a bug in the docs and/or the implementation). Magical optimizations work against that. 2.5. One great thing that shakes bugs out of Python code is that it raises an exception whenever it has a reasonable doubt about the code you told it execute, and a key part of making that *usable* is Python's never-lies complete stack trace. 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, and I want to crawl up that chain to examine the state of the locals in B and C at the time they made their calls. Optimize intermediate frames away, and tracebacks would become much harder to decipher. the-state-of-things-that-blow-up-is-as-important-as-the- state-of-things-that-don't-ly y'rs - tim From aahz at netcom.com Mon Feb 14 13:21:57 2000 From: aahz at netcom.com (Aahz Maruch) Date: 14 Feb 2000 18:21:57 GMT Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> Message-ID: <889h45$fqu$1@nntp6.atl.mindspring.net> In article <38A80085.AECFF9EC at bibsyst.no>, Thomas Weholt wrote: > >I`d like to make a client/server application exchanging objects of >different type, sizes etc. Are there any simple tutorials or docs >available on this, and what are my options on how to implement this ?? We've been using Medusa (asyncore to be precise) with cPickle and zlib. No simple examples, unfortunately. -- --- 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 Have you coined a word today? From tim_one at email.msn.com Thu Feb 10 19:53:22 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 10 Feb 2000 19:53:22 -0500 Subject: Python on CE (was RE: Python on Phar Lap ETS (RTOS) - Success!) In-Reply-To: Message-ID: <000101bf742a$65e63f60$d6a0143f@tim> [Warren Postma] > ... > (Windows CE is much more involved to port due to the pervasive > use of Unicode throughout Windows CE.). Mark Hammand has the CE port well in hand; see http://starship.python.net/crew/skippy/ce/ It currently builds on the post-1.5.2 CVS development tree, and life should get simpler after 1.6 (i.e., 1.6 will add general & pleasant Unicode support to Python). most-things-have-already-been-done-ly y'rs - tim From effbot at telia.com Wed Feb 23 12:15:18 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 17:15:18 GMT Subject: Which GUI? References: <8913lj$7mu$1@news.netvision.net.il> Message-ID: Reuben Sumner wrote > My guess is that you do indeed get the prize. Just to insert a somewhat > more specific comparison between Tkinter and wxPython (then the debate can > continue on more subjective matters), from what I can tell you can print > from wxPython and you cannot from Tkinter. Tkinter supports limited printing (the canvas can be printed to a postscript printer). if you need something better than that, there are stand-alone printing libraries available, including: http://piddle.sourceforge.net http://www.cygnus.com/~irox/tkprint/ also see: http://www.reportlab.com/ From daryl_stultz at my-deja.com Tue Feb 29 16:09:56 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Tue, 29 Feb 2000 21:09:56 GMT Subject: 1000 GUI toolkits References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> Message-ID: <89hcj1$c97$1@nnrp1.deja.com> In article , Marshmallow Fluffy wrote: > No joke at all. HTTP/HTML is a really nice alternative to the GUI of > the month. Python shines when it comes to writing little specialty > server thingies, and more of the presentation details are in the hands > of the end user (don't like the interface? Use another browser). This is intriguing. How would I go about programming a little app to run in my KDE browser (or Netscape). Wouldn't I also need a web server running? I've got an ASP server at the office, but I might like to whip up a little something for home use. That would be pretty cool to pull down the bookmarks to run different apps... Sent via Deja.com http://www.deja.com/ Before you buy. From jamarijr at hotmail.com Wed Feb 23 08:15:58 2000 From: jamarijr at hotmail.com (Arinte) Date: Wed, 23 Feb 2000 13:15:58 GMT Subject: Python and reentrancy? Message-ID: <890mib$oin$1@nnrp1.deja.com> Hi I have this situation. I have python embedded in a .dll, and that dll is loaded by a program that talks to some hardware. I setup a callback in python, so that when I get certain info from the hardware it is supposed to tell python thru the callback. When I first establish the callback I send a message to it and it works fine. But, when I run a python script that should post info while the script is running it doesn't seem to work. Basically, I want it to work like a Windows message, while the script is running if a message comes in it should post it and still be running the usual part of the script. Do I need to do anything special to achieve that? Also, what if I want the script to wait until a message has been posted thru the callback? Kind of like a Thread wait event, but without having to create a extra thread. TIA Sent via Deja.com http://www.deja.com/ Before you buy. From ndev42 at yahoo.com Fri Feb 18 08:09:05 2000 From: ndev42 at yahoo.com (ndev42 at yahoo.com) Date: Fri, 18 Feb 2000 13:09:05 GMT Subject: Which GUI? References: Message-ID: <88jg9f$ssd$1@nnrp1.deja.com> > I would like pro and cons for the different GUI's I would like to add: Is there any GUI toolkit that supports the following requirements? - As portable as Python. - Does not need ANY extra library to compile, i.e. knows how to talk to the underlying windowing library underneath, whether it is X11, Motif, Windows or Mac. - Clean design, if possible OO. - Easy to use, to learn, and well-documented. - Free software license. - Offers the standard widget toolkit plus some fancy stuff like grids or plots. ... Basically, this is (almost) Tcl/Tk. The only problem I have with Tkinter is that it is truly Python/Tkinter/Tcl/Tk, which means a whole bunch of software to install before you actually can get a single widget on screen. What happened to Rivet?? Other GUI toolkits are all more or less depending on lower-level libraries, which make it impossible to distribute a GUI without requesting the customer to download and install many other libraries. Sometimes versions don't match, it becomes a nightmare to export any GUI. Talk about portability: it is Ok to say that wxPython is portable, but since the underlying code is not truly the easiest thing to export for the moment, I find it somewhat hard to declare it "portable" in that respect. If there is any project of an OO GUI linking Python through C-bindings to Motif, X11, Windows and Mac base windowing libraries, I'd like to hear about it. This has been done for Tk, why not doing it again for Python? -- Nicolas Sent via Deja.com http://www.deja.com/ Before you buy. From claird at starbase.neosoft.com Mon Feb 7 16:29:16 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 7 Feb 2000 15:29:16 -0600 Subject: mail filter in python? References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> <14495.11639.467461.357073@beluga.mojam.com> Message-ID: <2F844DA7C27DCB96.6A16918939BCF4E6.A83B155EA285A0CD@lp.airnews.net> In article <14495.11639.467461.357073 at beluga.mojam.com>, Skip Montanaro wrote: > > Cameron> In any case, I agree with Mr. Wouters: use procmail, and just > Cameron> invoke your Python work as an external process. > >Worth noting that the procmail tips page at > > http://www.procmail.org/jari/pm-tips.html > >mentions Lua as a possible replacement for the procmail language (see the >end of question 3.5). That item was presumably added about two years ago, >so I tend to think it's either very hard to do or didn't generate enough >steam in the procmail community. If such a thing was possible with Lua, it >would likely be possible with Python as well. Anyone for "pluggable >brains"? . . . Good points. I'm sending a copy of this to Jari Aalto, who might be able to help. My purely personal speculation is, the latter: "it ... didn't generate enough steam in the procmail community." I'll grossly generalize that the mailing-agent communities tend to regard C as the natural language for all implementations, and see little advantage to such distractions as higher-level scripting. Lua is very simple to interface, unless some catastrophic surprise turned up specifically with the procmail work. Yes, of course Python is also quite simple to interface. There's another complexity that's timely to mention now. Mailing-agent work tends to be hilariously non-orthogonal; stuff pops in from all directions. Filtering is making its way back upstream into the 800-pound gorilla of the mail-transfer agent market, sendmail; see the mention of the "content management API" (what I usually call Milter) in . As someone noted, it would be good also to know where Sieve and Sift-Mail are headed. So: the problem in this area that the original questioner has is that there are too many answers. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From moshez at math.huji.ac.il Fri Feb 25 10:13:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 17:13:59 +0200 (IST) Subject: pythonian way In-Reply-To: <4Twt4.22186$Jz3.111631@nnrp1.uunet.ca> Message-ID: On Fri, 25 Feb 2000, Warren Postma wrote: > Moshe spake: > > A = filter(lambda x: x != '\n', H.readlines()) > > Hey, that's the first actually Useful-Use-of-Lambda I've seen! :-) Shhhhhhh!!!!!! Be quiet! Do you want Guido to retroactively pull the plug on "lambda, filter, map and reduce" in one fell swoop? closing-the-curtains-and-shutting-the-door-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From markn at cs.mu.OZ.AU Tue Feb 1 08:18:14 2000 From: markn at cs.mu.OZ.AU (Mark NG) Date: 02 Feb 2000 00:18:14 +1100 Subject: RMI or RPC for python ? Message-ID: G'day, Does there exist a Remote Method Invocation or Remote Procedure Call framework for Python like the RMI classes/interfaces in java ?? or do we have to go it alone with the pickle jar ? thanks, mark From scherbi at bam.com Fri Feb 11 14:07:40 2000 From: scherbi at bam.com (Bill Scherer) Date: Fri, 11 Feb 2000 14:07:40 -0500 Subject: CPython, JPython, and corba Message-ID: <38A45DFC.854D379B@bam.com> Howdy - I have a need to do ditributed objects, like corba, fnorb, ilu, pyro, dopy, or whatever, that will work between CPython and JPython. Pyro and dopy both use the select module which JPython doesn't have. Is such a beast available for JPython? Fnorb uses some C so I don't think that will work either. Has anybody doen this, and if so, with what? Thanks! -- William K. Scherer Sr. Member of Applications Staff Bell Atlantic Mobile From ke at gnu.franken.de Thu Feb 10 22:41:38 2000 From: ke at gnu.franken.de (Karl EICHWALDER) Date: 11 Feb 2000 04:41:38 +0100 Subject: [Doc-SIG] Monty: A structured text syntax idea References: <000d01bf73a4$ea589d50$f0c809c0@lslp7o.lsl.co.uk> Message-ID: "Tony J Ibbs (Tibs)" writes: | It seems to me that the idea of "short" markup for doc strings | (acceptable to most people, close to conventions used in email | fairly naturally, etc.) and "proper" markup in the actual | documentation is a GOOD plan (much praise to Frank) - but I had to | be convinced about that first part. Thanks for the additional information. Sounds reasonable. Since the kind of markup often is a matter of taste, I think that's a good approach (the most important part is that the author team agrees to use the same "style"). BTW, even "short" markup could constitue a valid SGML document; most probably, you also discussed this issue earlier. -- 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 hanche at math.ntnu.no Fri Feb 25 10:28:47 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 25 Feb 2000 10:28:47 -0500 Subject: Optimizing code References: <20000224161930.A4922@stopcontact.palga.uucp> <20000225074854.A1014@stopcontact.palga.uucp> Message-ID: + Gerrit Holl : | > File "du.py", line 21, in du | > return len(disk) | > TypeError: __len__() should return an int | | A long? I don't see any long? Because I didn't show it to you. 8-) | Perhaps you are running a "future" version of Python silently | converting ints to longs? Nah. It's plain vanilla 1.5.2. But this is on a FreeBSD 3.3 machine, where file sizes and offsets are specified using 64 bit integers. Since they don't fit into a (32 bit) python int, python evidently decides to make them all long ints, whether that is needed or not. | And, by the way, why can't len() return a long integer? Presumably because the address space is still 32 bits, and no object in memory can conceivably be longer than 2**32. (In any case I found your use of __len__ to be slightly offensive.) But wait, you sure *could* imagine an object longer than 2**31, and since python ints are signed, then len() would turn out to be negative. so-more-than-2GB-of-swap-could-get-you-into-trouble-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 tbryan at python.net Fri Feb 4 22:01:49 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Fri, 04 Feb 2000 22:01:49 -0500 Subject: installation error: version 1.5.2 on Unix References: <3898FE1B.16E6753E@python.net> <389A3ABB.8EA2C83B@python.net> Message-ID: <389B929D.B50FFDAA@python.net> On Fri, 4 Feb 2000, Yueqiang Huang wrote: > I decided to give up yesterday and removed readline from my system, > but I changed my mind when I saw your post today. I downloaded > readline-4.0 from ftp prep.ai.mit.edu:/pub/gnu and py152.tar from > python.org and did the following things: Didn't you still have your Python source directory on your system? If I remember correctly, it contains a demo directory and a tools directory with utilities such as freeze (for shipping python code to those without python). I think that freeze even needs the original source directory. [...Yueqiang makes libreadline.a...] > However, after step 4, I have the following things under the target > directory of my installation: [..listing of directory showing /auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a...] > Now I assume the installation of readline-4.0 is OK. Then I go on to > install python-1.5.2 > I added the following lines after "#readline readline.c -lreadline -ltermcap"$ > > readline -I/auto/terra-06/wrk6/yueqiang/readline4.0/include -L/auto/terra-06/$ Oops! That should be something like the following (explanation below): readline readline.c \ -I/auto/terra-06/wrk6/yueqiang/readline4.0/include \ -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib \ -lreadline -ltermcap You also missed something in the documentation: """editing the file Modules/Setup. This file is initially copied (when the toplevel Makefile makes Modules/Makefile for the first time) from Setup.in; if it does not exist yet, make a copy yourself. Never edit Setup.in -- always edit Setup.""" Actually, when I'm just adding modules, I don't even edit Setup. If you create a module called Setup.local in the Modules directory, it will be read after Setup is read. Thus, it overrides whatever is in Setup. In this way, you'll be able to use the same Setup.local when Python-1.6 comes out later this year. [..making Python..] > gcc python.o \ > ../libpython1.5.a -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib -l$ > Undefined first referenced > symbol in file > initreadline ../libpython1.5.a(config.o) > ld: fatal: Symbol referencing errors. No output written to python > *** Error code 1 > make: Fatal error: Command failed for target `link' > Current working directory /auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2/Mo$ > *** Error code 1 > make: Fatal error: Command failed for target `python' [..grep showing initreadline() in readline.c...] > No output. Note that the dir in step 10 is the source of readline-4.0. > So initreadline() is NOT defined in the readline-4.0 distribution. Yes. That is correct. I can now confidently diagnose the problem: simple misunderstanding. Python's readline.c does not provide any readline capability itself. It *exposes* functionality *provided by* libreadline to Python. (Use the source...see the comments at the begining of the readline.c file.) Thus, the line readline readline.c -lreadline -ltermcap means something like "build the readline module from readline.c, using the functions provided by libreadline and libtermcap." Simply append your -L and -I flags so that it looks in the correct place for the library and include files, and you'll have a nice interpreter with command line editing. :) > As you mentioned in your post, maybe the only way out is to hack up a > version of readline.c for readline-4.0. No. I was thinking of a completely different problem. You'll probably be able to fix your problem by changing the line in your Setup file that specifies the readline support. > I really appreciate your willingness to help. Thanks a lot! You're welcome. I enjoy troubleshooting build problems. except-for-the-hours-I-wasted-with-apache's-mod_ssl-ly yours ---Tom From cgw at fnal.gov Thu Feb 10 16:45:32 2000 From: cgw at fnal.gov (cgw at fnal.gov) Date: Thu, 10 Feb 2000 15:45:32 -0600 Subject: problem with setrlimit on Linux 2.2? References: <14499.7397.57420.918651@buffalo.fnal.gov> Message-ID: <87vbhs$4tp$1@info3.fnal.gov> In article <14499.7397.57420.918651 at buffalo.fnal.gov>, Charles G Waldman wrote: > > I'm sure that just as soon as I press "send", I'll realize that > something trivial is wrong with this code: > > #!/usr/bin/env python > > import sys,os,resource,signal > > def sorry(*args): > print "Sorry, time's up" > > > signal.signal(signal.SIGXCPU, signal.SIG_IGN) Sorry to follow up on my own post, but of course I meant to say here: signal.signal(signal.SIGXCPU, sorry) the SIG_IGN was left over from some experimenting - in any case, neither SIG_IGN nor my handler function makes any difference - I think this is because the process is being sent SIGKILL instead of SIGXCPU (which would make this a Linux rather than a Python bug). From Wilfried.Wiehler at mch.sni.de Tue Feb 1 03:19:35 2000 From: Wilfried.Wiehler at mch.sni.de (Wilfried Wiehler) Date: Tue, 01 Feb 2000 09:19:35 +0100 Subject: sending keystroke to a dos application References: <3.0.6.32.20000131123003.009693c0@orion.dgfz.de> Message-ID: <38969717.6FB9664@mch.sni.de> Mike, another solution: the Windows Scripting Host has the so called SendKeys control. Sorry, I have only a JavaScript example: objWshShell = WScript.CreateObject("WScript.Shell"); taskid = objWshShell.Run("D:\\test\\winmips.EXE",1,0); objWshShell.AppActivate(taskid); WScript.sleep(1000); // wait for winmips to get the focus objWshShell.SendKeys("%(FL)");// Alt/File/Load As I remember wsh scripts can be written in Python too. The details should be found somewhere on www.python.org. wsh can be downloaded from ms. Tschuess Wilfried Mike Mueller wrote: > Does the dos window offer COM support I could use to pass some keystrokes? From cpatti at atg.com Wed Feb 16 14:11:17 2000 From: cpatti at atg.com (chris patti) Date: 16 Feb 2000 14:11:17 -0500 Subject: Where is the Python Journal? References: <8EDCA9C19PaCmAnRDLM@194.2.0.33> Message-ID: fredp at mygale.org.nospam (Fred Pacquier) writes: > anders.eriksson at morateknikutveckling.se (Anders M Eriksson) said : > > >>Not long ago there was a Python journal at > >> > >> www.pythonjournal.org > >> > > > >FOund it at http://www.pythonjournal.com/ > > Seems pretty dead now though, doesn't it ? Pity. It really _is_ a pity. I still get the Perl Journal every month despite the fact I'm now less than enthused with the language, having found Python... The thing is, the articles are _good_ and they're good because they talk about people actually using Perl to solve interesting problems, whether they be real life pracitcal problems or abstract computer science / algorithm problems. For instance, Mark Dominus who is a good writer (his articles are some of the only clues we had for a *long time* on some really poorly understood and badly documented Perl topics) recently wrote a series of articles on 'memoization' - the use of recursion and recursive data structures to implement caching algorithms that save huge gots of time on repeated computations.. Python needs something similar. -Chris (Ugh I wish I was more solid with algorithms) -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From amused at webamused.com Sat Feb 5 01:48:44 2000 From: amused at webamused.com (Joshua Macy) Date: Sat, 05 Feb 2000 06:48:44 GMT Subject: Can someone fix my code (Part II) References: <87gchv$ebu$1@nnrp1.deja.com> Message-ID: <389BC5B2.7151A912@webamused.com> Names are created when assigned, but must exist when referenced. where_temp is local to ssi_or_exit, so it's not in any namespace that the references to it in ssi can read (remember that attempts to find names look first to the local namespace, then the global one, then the builtins). You either have to pull where_temp out to the module level (e.g. stick it after import sys and before def ssi_or_exit) which is ugly and would require you declaring it global within ssi_or_exit and ssi, or pass it as a parameter (e.g. def ssi_or_exit(where_temp): ), or make both functions part of a class and where_temp a member of that class. I notice that you still have that rather unfortunate recursion going on, where ssi_or_exit calls ssi which calls ssi_or_exit which calls ssi which calls ssi_or_exit...and so on. That's a bad habit to get into, and could very well cause your code to blow up if you ran it long enough. You should probably follow one of the suggestions you were given to rewrite it as something like: while 1: ssi_or_exit() ssi() Joshua bovinesoft at my-deja.com wrote: > > When I last posted to this newsgroup, I had a problem and I think I > fixed it (Thanks to all who helped!). Now, however, I am having new > difficulties on my new code. The error message that I got from the code > below was: "NameError: where_temp". If anyone can help me out, I would > be greatly appreciative. Thanks again! > > import sys # to use the exit() function > > def ssi_or_exit(): > sorx = raw_input("Would you like to generate HTML or exit ? ") > if sorx == "g": # if they want to generate a web page > body_path = raw_input("Please type the path of the body section: > ") > body = open(body_path, "r") # open the text of the web page body > body2 = body.readlines() # body2 is the body text variable > temp_path = raw_input("Please type the path of the HTML template: > ") > temp = open(temp_path, "r") # open the HTML template > temp2 = temp.readlines() # temp2 is the template text variable > new_path = raw_input("Please type the path of the new HTML file: > ") > new = open(new_path, "w") # create new file at the specified path > where_temp = raw_input("Put the template before or after > the body? ") > ssi() > elif sorx == "x": # if they want to exit > sys.exit("Thank you for using Bovine No Server SSI!") > > def ssi(): > if where_temp == "b": # for template before body > for line in temp2: > new.write(line) > for line in body2: > new.write(line) > elif where_temp == "a": # for body before template > for line in body2: > new.write(line) > for line in temp2: > new.write(line) > body.close() > temp.close() > new.close() > ssi_or_exit() > > ssi_or_exit() > > Sent via Deja.com http://www.deja.com/ > Before you buy. From mbre at sxb.bsf.alcatel.fr Wed Feb 9 05:05:58 2000 From: mbre at sxb.bsf.alcatel.fr (Marc BRETTE) Date: Wed, 09 Feb 2000 11:05:58 +0100 Subject: small python implementation or python subset ? Message-ID: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> Hi, I am looking for a very lightweight implementation of python or for a python subset definition. I would like to run the python interpreter (or even the python interpreter without its parser by running only python bytecode) in a very restricted environnement (say a python interpreter less than 300 k), and I don't need all the fancy functionnalities of python. I downloaded the 1.5 distribution but the binary is 1.5 Mb stripped of almost all its modules. An older version (1.2) seems lighter (300 k), but I don't want a dead distribution. Does any one around knows about a lightweigth python or a way to strip the regular python distribution ? marc -- Marc Brette Marc.Brette at sxb.bsf.alcatel.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: From gchiaramonte at ibl.bm Thu Feb 10 18:34:16 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Thu, 10 Feb 2000 19:34:16 -0400 Subject: Off Topic Posts In-Reply-To: <38A34199.BF367B98@americasm01.nt.com> Message-ID: Please stop the madness! I can't take it anymore. Can the admins of this list please setup another newsgroup for posts regarding python language opinions? Lets keep this list for people who need help USING PYTHON to solve real problems. There is a great group here and they have helped me tremendously in getting up to speed with python. The support here is great and much better than any commercial support I have ever received. I worry that the constantly increasing number of off topic opinion type posts here has gone above a reasonable threshold. Better yet - If you don't like Python, don't use it. There a plenty of other languages that have a delimited block structure. Go use C or C++, use Delphi and type Begin...End 100 times day. Use VB if that's your thing. But leave Python alone. Enough already! If it's not a Python question, don't waste your time sending it in the first place. Thanks, Gene From embed at geocities.com Tue Feb 15 09:02:09 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 15 Feb 2000 09:02:09 -0500 Subject: BSDDB copyright and licensing restrictions while in use via Python References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: > My BSDDB extension module (http://starship.python.net/crew/robind/) >is Open Source so there are no legal issues for you. It's a bit out of date. It mentions 2.3 and yet 2.7 and 3.0 are the only ones up there on the Sleepycat web page. Do you think it would be hard to get 3.0 going? I'll see what I can do with it. Warren From skip at mojam.com Thu Feb 17 12:00:40 2000 From: skip at mojam.com (Skip Montanaro) Date: Thu, 17 Feb 2000 11:00:40 -0600 Subject: dumbass locale question Message-ID: <200002171700.LAA21343@beluga.mojam.com> I run a web site here in the US, but I get input from all over. If I ask for "c".upper() I get the appropriate response: "C". However, if I ask for "?".upper(), I don't get "?", I just get "?". I don't have the luxury of assuming that my users come from one locale or another. I can assume for the most part that they are entering letters that come pretty much from the Latin-1 character set. To get "?".upper() to work can I play some tom-foolery with the locale or must I craft my own upper() and lower() functions? Thx, Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From kuncej at mail.conservation.state.mo.us Tue Feb 8 13:00:54 2000 From: kuncej at mail.conservation.state.mo.us (Jeffrey Kunce) Date: Tue, 08 Feb 2000 12:00:54 -0600 Subject: Alice-style plugin for general python? Message-ID: [Scott Anderson] > Question the first: I've seen the Win16 Netscape plugin... is there a > 32-bit version for the later browsers running around? I've got an itch > I want to scratch, and a plugin would do it. :-) The plugin for Alice (www.alice.org) is really cool. Works on both Netscape and IE, probably only on win32. Since Alice is a mostly-python app, I wonder if their plugin technology can be generalized to work for arbitrary python applications. Has anyone looked into this? --Jeff From embed at geocities.com Fri Feb 25 10:04:01 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 25 Feb 2000 10:04:01 -0500 Subject: pythonian way References: Message-ID: <4Twt4.22186$Jz3.111631@nnrp1.uunet.ca> Moshe spake: > > Here's a version that works: > > A = filter(lambda x: x != '\n', H.readlines()) > Hey, that's the first actually Useful-Use-of-Lambda I've seen! :-) Warren From fdrake at acm.org Thu Feb 10 13:35:47 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 10 Feb 2000 13:35:47 -0500 (EST) Subject: IDLE and Hooks in apps for usage of My Favorite Editor In-Reply-To: References: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com> <38A234AA.2B1FE6CB@python.net> <14498.52621.853399.866552@weyr.cnri.reston.va.us> Message-ID: <14499.1283.295475.398450@weyr.cnri.reston.va.us> chris patti writes: > I think it's heavily proprietary and not available as source code. I don't really care if it's available as source. I don't think the interface is documented beyond the API, and that's not good enough for an alternate implementation. If anyone's found a specification (below the API level), or knows about an implementation based on reverse engineering of a working system, that's good enough for me. ;) There is another message bus system based on X11 called KoalaTalk, but I'm not sure of it's current status; see ftp://koala.inria.fr/pub/KoalaTalk/ It depends on libICE from X11R6, but the manual indicates that clients don't need to be X clients, which I find confusing. Perhaps someone who knows more about what's in libICE can explain what libICE has to do with it; it looks like it's based on Sun RPC, so it *should* be usable just about anywhere. The archives on the FTP site are dated 1995, so it appears unmaintained. The Koala project's home page (http://www.inria.fr/koala/) certainly leads me to think this isn't maintained. Or it could be bug-free. ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From robin at jessikat.demon.co.uk Tue Feb 8 11:16:33 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Tue, 8 Feb 2000 16:16:33 +0000 Subject: PIL & Tk8.2 Message-ID: has anyone got a Tk8.2 compatible version of PIL? -- Robin Becker From moshez at math.huji.ac.il Fri Feb 11 12:07:48 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 19:07:48 +0200 (IST) Subject: Two question from a newbie In-Reply-To: <14500.13201.442851.52269@weyr.cnri.reston.va.us> Message-ID: On Fri, 11 Feb 2000, Fred L. Drake, Jr. wrote: > > 1.) How do I implement ORs and ANDs in an if-statment? > > > > - e.g. I'd like to have this C-code in Python: > > > > if (x.mode == "view" || x.mode == "modify") > > myMode = x.mode; > > if (x.mode == "view" or x.mode == "modify"): > myMode = x.mode Apparently Fred is hacking too much C these days, otherwise he'd encourage you to use Python (rather then C-in-Python): if x.mode in ("view", "modify"): myMode = x.mode (I saved you one time of writing x.mode. One less bug when you ch\ange the name "mode"). -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From 2jerry at writeme.com Mon Feb 21 20:37:07 2000 From: 2jerry at writeme.com (Jerry) Date: Tue, 22 Feb 2000 02:37:07 +0100 Subject: oups ! it was an answer to this one ..-^ References: <88sod7$cut$1@wanadoo.fr> Message-ID: <88sp26$dhh$1@wanadoo.fr> nothing to add Jerry <2jerry at writeme.com> a ?crit dans le message <88sod7$cut$1 at wanadoo.fr>... >I just unzip PIL on python directory, >copy _tkinter.pyd and _imaging.pyd in python base directory >then add \pil15b2\imaging in the PYTHONPATH variable .. > >you can verify it using the IDLE: > open it > then : import sys > then : for f in sys.path: > print f > sure , if import image doesn't work .. > >that simple but, elsewhere can you detail the unsuccess symptomatics ? >maybe something more difficult ... > >Jerry the foolish dracomorpheus, >alias j?r?me VACHER. > > From rhundt at cup.hp.com Wed Feb 16 23:26:47 2000 From: rhundt at cup.hp.com (Robert Hundt) Date: Wed, 16 Feb 2000 20:26:47 -0800 Subject: C Wrapper Generators? Message-ID: <38AB7887.8CAC1433@cup.hp.com> Hi @ll, These question might be a little bit out of place, but... I need some pointers for C interface/wrapper generators ( -- given a header file, generate wrapper code for python integration) I know of SWIG, but I seem to have problems to compile it on my HP-UX 10.20 box. And PGEN doesn't work at all with my headers. Do you know of any other tools or maybe binary distributions? Thank you so much in advance! Regards -- Robert Hundt HP 408-447-0546 rhundt at cup.hp.com From wtanksle at hawking.armored.net Wed Feb 16 16:42:52 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 16 Feb 2000 21:42:52 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> <889lhn$bn$1@nnrp1.deja.com> Message-ID: On 15 Feb 2000 01:27:32 GMT, Neel Krishnaswami wrote: >Justus Pendleton wrote: >> neelk at alum.mit.edu wrote: >> > > > 3. Multiple inheritance is unsound >> > > > By 'unsound' I mean that a method call to a method inherited by >> > > > a subclass of two other classes can fail, even if that method >> > > > call would work on an instance of the base class. >So I looked at some other dynamic languages to see what they did. >o Dylan -- forbids using MI when there are multiple slots with the > same name. >Other languages seem to either forbid name conflicts or just suck it >up and live with an unsafe rule, which leads me to conclude that the >moral is TANSTAAFL -- there ain't no such thing as a free lunch. Sather uses yet another system, which I see as very interesting -- it totally disallows inheritance of every kind (single AND multiple). In its place it offers two concepts: interface and importation. Let me give a pseudo-Python example: # the base class class First: def fun(hmm): print hmm # this is how to exactly imitate Python's current # behavior (assuming no extra error checks occur) class Second(First): import First # here we 'subclass' from First, but we don't inherit _any_ # behavior or data. class Third(First): def fun(yadda): print "Whee!", yadda # Here the compiler will print an error message, because we don't define # any implementation of the interface we claim. class Fourth(First): def boring(): print "braces are cool, indentation sucks!" This is only a single-inheritance example, of course. The rest is left as an excercise to the reader. >Neel -- -William "Billy" Tanksley, in hoc signo hack From herzog at online.de Mon Feb 21 15:30:44 2000 From: herzog at online.de (Bernhard Herzog) Date: 21 Feb 2000 21:30:44 +0100 Subject: Killer Apps References: <88rvhm$efe$1@nntp6.atl.mindspring.net> Message-ID: aahz at netcom.com (Aahz Maruch) writes: > In article , > Hirsch, John wrote: > > > >I've always thought that Tim Peters was Pythons killer app.. > > No, the Timbot is Python's app killer. IIRC, Guido went to CNRI to work on bots and agents or something similar. Could the timbot and the effbot be an offshoot of that? Next, he's going to start a company with timbot and effbot as the main products. Van Rossum's Universal Robots? -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From sabren at manifestation.com Thu Feb 10 19:32:13 2000 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 10 Feb 2000 19:32:13 -0500 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> Message-ID: <87vlb7$tca$1@nntp1.atl.mindspring.net> Fredrik Lundh wrote in message ... >given that 1.6 isn't finished yet, and there will be >a 1.7 release after that, don't you think it's a bit >early to decide what to do in python 3000? ;-) > >(personally, I'd be very surprised if the changes were >such that old code couldn't be automatically translated). I guess that makes sense... As a programmer, I say bring it on... but as a businessperson, that unqualified statement on the website gave me the chills.. I suspect I'm not alone in that - what company wants to invest in (software) technology that may be obsolete in two years? An upgrade is one thing, but an upgrade that breaks stuff is dangerous... especially when there's no clear sign saying what to avoid... -michal http://www.sabren.com/ From effbot at telia.com Thu Feb 24 10:26:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 15:26:22 GMT Subject: Sockets or networking library? References: Message-ID: Tres Seaver wrote: > If you go at it yourself, a lot of the documentation and high-level design > for the ACE library (http://www.cs.wustl.edu/~schmidt/ACE.html) will give you > excellent food for thought. Although written in C++, ACE does a really > nifty job of encapsulating ugly platform dependencies and of presenting > a consistent, configurable interface to cross-platform network > programming. footnote: the python version of ACE is called asyncore, and is shipped with 1.5.2: http://www.python.org/doc/current/lib/module-asyncore.html also see medusa: http://www.nightmare.com/medusa From andrew at andrewcooke.free-online.co.uk Tue Feb 8 03:37:36 2000 From: andrew at andrewcooke.free-online.co.uk (Andrew Cooke) Date: Tue, 08 Feb 2000 08:37:36 GMT Subject: Readable Functional Languages References: <000401bf6dfc$0ee5f180$822d153f@tim> <87fq9n$1sn$1@vvs.superst.iae.nl> Message-ID: <87okkg$42u$1@nnrp1.deja.com> In article <87fq9n$1sn$1 at vvs.superst.iae.nl>, Carel Fellinger wrote: > Tim Peters wrote: > > > So long as you're just out exploring and don't mind making any actual > > progress for a while , point your browser to > > That's fine with me, so Haskell it be:) Didn't see the rest of this thread (found a pointer to this post as elj), but thought I'd add a few comments: - While Haskell is the "standard" functional language, you might consider ML, which has an interesting type system (OCaml is a variant that mixes OOP with functional languages). - If you're looking for a language in which you can do both functional and procedural programming, have a look at Common Lisp. It's a fascinating language - I have learnt a huge amount from it (not just about FL and OO, but also dynamic code generation). From the subject line ("Readable") you might object to the parentheses, but once you understand the language you'll understand why it's like that, and the advantages it gives you. Cheers, Andrew PS I wrote a survey of languages that you can get to by following a link from http://www.andrewcooke.free-online.co.uk/index.html - it has links to further info on both Lisp, ML and OCaml. Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Tue Feb 29 22:58:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 29 Feb 2000 22:58:29 -0500 Subject: Worthless (was RE: functional programming) In-Reply-To: <89hdhn$pc2$2@newshost.accu.uu.nl> Message-ID: <000101bf8332$674d8400$412d153f@tim> [Steve Holden] > Now I'm confused. I thought this was a timbot post, but you're Tim, > aren't you? We picture an entity typing at a computer terminal, as if there were "someone on the other end" to read it. Heh heh. Humans. Or so they imagine. [Martijn Faassen] > Actually, this is the focus of a vast distributed analysis project like > Distributed.net and Seti at Home. The PSU has smuggled a set of Python scripts > into Zope and IDLE that have nothing to do with their official purposes -- > this code analyses 'Tim Peters' posts to comp.lang.python in an attempt to > determine which are posted by the bot and which are posted by the > human (if any human indeed exists -- no proof exists besides the word > of Gordon McMillan and Guido van Rossum, but we know what unreliable > bunch of jokers *those* are). I've noticed that neither "Tim Peters" nor the timbot ever claimed to have met Guido or Gordon. Suspicious asymmetry, don't you agree? OTOH, at least "Tim Peters" *has* claimed to have met Jim Hugunin -- but Jim never claimed to have met "him". So Jim may know something the rest of us haven't yet discovered. Perhaps that's why "Jim" became a Python unperson. > Hopefully they'll give us some results soon. Naturally, but whether reliable results or merely more disinformation may be impossible to determine. > The-PSU-doesn't-exist-really-!-ly yours, No, it certainly does not. Although Sinterklaas does. Guido, maybe. The timbot, no. The effbot, yes, the eff-bot, no. At least two of these statements are true. aptly-titled-thread-ly y'rs - tim From robin at jessikat.demon.co.uk Thu Feb 3 05:22:44 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 3 Feb 2000 10:22:44 +0000 Subject: shelve implementation References: <20000201.10464788@sparky.spkydomain> <3898F49E.4062B220@python.net> Message-ID: In article <3898F49E.4062B220 at python.net>, Thomas A. Bryan writes >Robin Becker wrote: >> >> In article <20000201.10464788 at sparky.spkydomain>, David Fisher >> writes > >> >On another archeologial note, both cStringIO and cPickle are copyright >> >Digital Creations and are the only modules that i have found: >> > >> >#define UNLESS(E) if(!(E)) >> > >> >which lets them write code like: >> > >> > UNLESS(PyArg_ParseTuple(...)) >> > return NULL; >> > >> >which i think is unbearably cute. >> >> As for cute I seem to remember B or maybe bcpl had 'unless' (or the >> equivalent) or maybe I've gone gaga. > >Well, Perl has 'unless', so you know that it's gotta be a good idea. ;-) > >off-topic-but-I-couldn't-resist-ly > >---Tom BCPL has while C do S until C do S S repeat S repeatwhile C S repeatuntil C -- Robin Becker From jfbrain at lancelot.roundtable.dyndns.org Thu Feb 24 14:58:45 2000 From: jfbrain at lancelot.roundtable.dyndns.org (John F. Brainard) Date: Thu, 24 Feb 2000 19:58:45 GMT Subject: Passing arguments by value... Message-ID: I'm working on a set of HTML Layout classes for CGI programming in Python and have stumbled upon a small problem... The sample code below should be self explanitory... #begin python code html = body.Body() font1 = tags.Font(4, "Arial", "#FF0000") font1.addText(string.strip(""" Some text would go in here. """)) html.addElement(font) font1.clearText() font1.addText(string.strip(""" Some other text here. """)) print "" + str(html) + "" #end python code After I create the font1 object and set it's properties, I add it to the html object. Then, I change the text and add it again to the html object. What I get as the output is... #Begin HTML here Some other text here. Some other text here. #End HTML here Is there a way to copy the font object or pass it by value rather than reference to the addElement() function? Thank you, John F. Brainard Jr. johnbrainard at stny.rr.com From r-stadhe at online.no Tue Feb 15 14:00:26 2000 From: r-stadhe at online.no (RCS) Date: Tue, 15 Feb 2000 20:00:26 +0100 Subject: Python sucks loud References: Message-ID: <8nhq4.470$Po1.10193@news1.online.no> If you think Python syntax is ugly, then good luck with the other programming languages around that you would care to check out (are you a novice at programming?) As far as I'm concerned, Python (with the aid of C/C++) has proved to be the greatest thing in my programming career (I have dumped Delphi, Pascal and partly Java in favour of Python/C++). Cheers, From effbot at telia.com Thu Feb 3 19:21:25 2000 From: effbot at telia.com (Fredrik Lundh) Date: 3 Feb 2000 18:21:25 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 3) Message-ID: <0590AC14A6988683.3CC7C76F1668AD63.E13134B462D809BE@lp.airnews.net> The eff-bot finally makes it back from the Python conference, after an involuntary detour to Oslo. Here's this weeks' Python-Alert, worth well over $9.52 per week: First, a couple of reminders: Don't forget Software Carpentry's design competition: http://software-carpentry.codesourcery.com/contest-rules.html Don't forget the www.python.org design competition: http://www.python.org/Redesign.html And don't forget the O'Reilly Python Conference: deadline extended to at least Feb 15: http://conferences.oreilly.com/oscon2000/call.html The eighth Python conference (SPAM8) was a huge success. Almost everyone was there, except Tim Peters. He might be real, though -- at least two usually reliable sources told me they'd met him in real life. Here're interesting links: http://www.oreilly.com/frank/index.html (frank willison) http://starship.python.net/crew/amk/diary (andrew kuchling) http://freeweb.pdq.net/robinf1/spam8pix/ (robin friedrich's photo album) http://www.python.org/workshops/2000-01/ (conference site) http://www.reiters.com/ (official conference bookstore) http://www.cravindogs.com/about.html (python powered, sort of) In other news: ActiveState (www.activestate.com) joins the Python Consortium, and announces great plans for Python. David Ascher has more info on this: http://www.egroups.com/group/python-list/77941.html http://www.activestate.com/press/releases/python.htm Secret Labs AB (www.pythonware.com) joins the Python Consortium, and also receives first round of venture funding from the East Sweden Foundation of Entrepreneurship and Technology Transfer. People keep releasing cool software: Christian Tismer's ?bercool stackless python: http://www.tismer.com/research/stackless/ Barry Warsaw announces JPython 1.1 final: http://www.jpython.org/NEWS Andreas Jung releases PMW (Poor Man's Zope): http://www.suxers.de/pmz.htm More books arrive: Python and Tkinter Programming (by John Grayson) http://www.deja.com/getdoc.xp?AN=575925861 http://www.manning.com/grayson/ Python Programming for Win32 (Andy Robinson & Mark Hammond) http://www.oreilly.com/catalog/pythonwin32 (both books mention my name, so they can't be that bad ;-) Btw, judging from what people told the eff-bot at SPAM8, at least four more books are in the works. And if you want to write your own Python book, Greg Wilson has some great ideas for you: http://www.deja.com/getdoc.xp?AN=579589266 Finally, the Scheme folks reveal the truth about Python and Pythoneers, but completely fails to start another flame war. Read more in this thread: http://www.deja.com/viewthread.xp?AN=580480307 ======================================================================== 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 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 Python To-Do List anticipates some of Python's future direction http://www.python.org/cgi-bin/todo.py The Vaults of Parnassus ambitiously collects Python resources http://www.vex.net/~x/parnassus/ 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 jstok at bluedog.apana.org.au Mon Feb 28 17:46:46 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Tue, 29 Feb 2000 09:46:46 +1100 Subject: Which GUI? References: Message-ID: Vadim Zeitlin wrote in message ... >On 26 Feb 2000 23:38:03 GMT, William Tanksley wrote: >>Oh, one of the wxWindows supported platforms is -- are you ready for this >>-- Curses. > > Sorry, I have to correct you here. wxWindows does not support text mode UI >and neither does wxPython. This could be done (and I wanted to do it at one >moment), but more time passes, less chances there are that it will ever >happen. I would love to be able to have wxCurses port, but there is apparently >not enough interest in it. WxWindows does have a Curses port -- for version 1.1. But even it's incomplete. It's impossible to port all of wxWindows over to Curses, but a certain subset can be. From wking at sheltonbbs.com Fri Feb 4 07:58:27 2000 From: wking at sheltonbbs.com (Mike Partin) Date: Fri, 4 Feb 2000 06:58:27 -0600 Subject: Can someone tell me whats wrong with this? Message-ID: <949669150.72286756@news.sheltonbbs.com> If someone could tell me what is wrong with this code I'd be very grateful. def Cvs_Update(): TmpMod = raw_input("Module: ") TmpGrep = "grep -w " + TmpMod + " /etc/hscvs.conf | awk -F= '{ print $2 }'" os.system("export CVSROOT='os.system(TmpGrep)'") os.system("echo $CVSROOT") #os.system(cmd) From jayantha at ccs.neu.edu Thu Feb 17 12:30:52 2000 From: jayantha at ccs.neu.edu (Joshua C. Marshall) Date: Thu, 17 Feb 2000 12:30:52 -0500 Subject: Superclasses Message-ID: Given a class object, is there a way to get at its superclass object? I'm looking for something like: class A: pass class B(A): pass B.__superclass__ == A # where this is true Please CC jayantha at ccs.neu.edu From tim_one at email.msn.com Sun Feb 27 19:54:51 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 19:54:51 -0500 Subject: IDE-sig In-Reply-To: <38B9CADF.CCBD74D7@sightreader.com> Message-ID: <000d01bf8186$6bca8b20$f0a2143f@tim> [posted & mailed] [Ken Seehof, pitches an IDE SIG] Note that this is essentially an attempt to resurrect the Progenv-SIG under a new name. The latter was killed off in January of '98 after inspiring a grand total of about 40 msgs (including spam ) over its entire life. There are many more IDE-type projects in existence today than then, but the Big Unknown is whether IDE developers will actually participate. > Why comp.lang.python won't do: > > - Scope is too broad for a single discussion thread > - Too easy to miss something important because of the chaos Neither objection would apply to, e.g., an egroups list. A full-blown SIG likely requires a couple hundred members to justify the hassle on CNRI's end. yet-another-reason-the-types-sig-was-born-doomed-ly y'rs - tim PS: I'd certainly sign up for the IDE SIG if it's created. From tismer at tismer.com Fri Feb 25 10:16:50 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 25 Feb 2000 16:16:50 +0100 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: <38B69CE2.516D99B@tismer.com> Gerrit Holl wrote: > > Hello all, > > I have a problem. In my Python enthuishasm, I ripped off the braces > from my keyboard because I thought I didn't need them. > Unfortunately, I have a problem now. I can't create dictionairies any > more! And because braces aren't the only keys on the brace key, > I can't create lists either. The solution for the latter is list(()), > but how do I create an empty dictionairy without braces? > > I know I can do: > >>> import os > >>> d=os.environ.data > >>> for k in d.keys(): > ... del d[k] > ... > >>> d > {} > > But is there a more efficient way to do it? Does the 'new' modules has > something I want? >>> class braces: ... def __call__(self): return self.__dict__ ... >>> dic = braces()() >>> dic {} >>> Well, the lack of [] doesn't make this too useful. How about >>> help = braces() >>> dic = help() >>> help.thing = 42 >>> dic {'thing': 42} >>> > HELP! > > If I'll rip off the ';' too, I won't be able to type blocks any more, > since I won't be able to type a ':' either. Hmm, is it safe to rip > off the '$'? I don't need a '4'! I just successfully ripped out my ";", and it still works fine. Hint : use a German keyboard. Well, I'm missing the comma a little now. No problem, since I can always change tuples to lists, modify them and tuple them back. Considering to remove the "o" key. It is too easily taken as a zero. Now I don't write any for loops any longer, back to the while 1 idiom. ciao - chris (xxps, cannot say "Pytxn" any longer) -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 12163 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 navneet at swt.edu Mon Feb 21 19:06:03 2000 From: navneet at swt.edu (Navneet M Shah) Date: Mon, 21 Feb 2000 18:06:03 -0600 Subject: Python window.destroy()? Message-ID: <38B1D2EB.FE88C9DC@swt.edu> Hi, Can anybody help me and give me the python code for A window should pop up when a mouse enters the button and the same window should disaapear as soon as the mouse leaves the button. Thanks, Navneet From effbot at telia.com Sun Feb 13 04:54:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 09:54:06 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <2bvp4.3417$dT4.207709696@newsb.telia.net> Tim Peters wrote: > > ... > > o Christian Tismer's Stackless Python patch enables the use of > > first-class continuations in regular Python code. This lets > > people easily and in pure Python create and experiment with all > > sorts of funky control structures, like coroutines, generators, > > and nondeterministic evaluation. > > > > Prognosis: > > > > Pretty good, if Stackless Python makes it in, along with list > > comprehensions. (Personally, I suspect that this is the single most > > important improvement possible to Python, since it opens up a > > whole new category of expressiveness to the language.) > > Don't tell him I said this, but that's exactly why Guido fears it (any stuff > he may say about destabilizing the core interpreter loop is a smoke screen > <0.5 wink>): one programmer's "expressiveness" is often another's > "gibberish". Christian needs to find a "killer app" for Stackless. Perhaps > the Palm Pilot port is it. Perhaps some form of migrating computations > among machines is it. I can name two right away: high-performance web servers and user interface toolkits. but I fear that nobody's going to spend much time developing that stuff if they aren't assured that (at least portions) of stackless python goes into the core CPython distribution... (on the other hand, I wouldn't be surprised if one or two proof-of-concept killer applications could out there when it's time to start thinking about what to put into 1.7...). From mwh21 at cam.ac.uk Tue Feb 8 18:05:38 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 08 Feb 2000 23:05:38 +0000 Subject: stackless Python References: <87q4dr$2b62@drn.newsguy.com> Message-ID: Armin Steinhoff writes: > Hi All, > > is somone using the stackless Python implementation ? > Are there any information about HOW-TO-USE it ??? Using it ... no not really. But I've played with it quite a lot. Besides, there isn't much to "use", it works very much like vanilla Python, at least until you type import continuation :-) > BTW ... we are using Python under the RTOS QNX 4.25 ... Ah. Don't know anything about QNX, but judging from my experience of getting it working on linux, you have to bully the files about a bit to get them to compile. Christian, bless his soul, does go and use windows for his development platform, and MS Visual C++'s interpretation of the ANSI C standard is "interesting". Adjusting the source to sufficient compliance isn't that hard, but I can probably send you some patches to do it, if you like. Cheers, Michael From bad_packet at my-deja.com Wed Feb 9 13:00:00 2000 From: bad_packet at my-deja.com (bad_packet at my-deja.com) Date: Wed, 09 Feb 2000 18:00:00 GMT Subject: tkinter help? Message-ID: <87s9us$mci$1@nnrp1.deja.com> I had Python 1.5.1 working fine with tkinter on mkLinux, then decided to upgrade to 1.5.2. The short version is that now tkinter doesn't work altho I had edited /Modules/Setup and everything seemed to compile ok. Following the suggested test procedures, I can do import Tkinter and import _tkinter, but when I do Tkinter._test(), I get: XIO: Fatal IO error 0 (unknown error) on X server ":0.0" after 18 requests (17 known processed) with 1 events remaining. and Python shuts down. I assume that X is unhappy about something (I am running kde), but I am at a loss to understand what. If anyone has any suggestions about resolving this, I'd be most grateful for your help. Thanks. Richard Gordon Sent via Deja.com http://www.deja.com/ Before you buy. From scarblac-spamtrap at pino.selwerd.nl Thu Feb 24 10:11:38 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 24 Feb 2000 15:11:38 GMT Subject: 1000 GUI toolkits References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> <20000224132812.A3201@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote in comp.lang.python: > HTML is not designed to be interactive, so HTML should not be > used interactive. HTML has hyperlinks, forms and so on. Those were designed to be filled in, clicked on and so on. That's interactive. It all depends on your application, but just a small web server thing that outputs HTML and takes it input from forms can be really powerful, and it works immediately over the network. I like it. -- Remco Gerlich, scarblac at pino.selwerd.nl 4:06pm up 92 days, 22:10, 8 users, load average: 0.09, 0.22, 0.28 From tilo.schwarz at daimlerchrysler.com Thu Feb 3 12:39:12 2000 From: tilo.schwarz at daimlerchrysler.com (Tilo Schwarz) Date: Thu, 03 Feb 2000 18:39:12 +0100 Subject: Compile Problem Imaging-1.0/Tk References: <3895AE03.D26FD7CD@daimlerchrysler.com> <20000201135410.H19725@xs4all.nl> Message-ID: <3899BD40.845F5B5A@daimlerchrysler.com> Hi all, thanks for your help, I did it the easy way and got a binary distribution ;-) Bye Tilo -------------------- Tilo Schwarz, DaimlerChrysler, Research Center Ulm, FT3/AB Address: Wilhelm-Runge-Str.11, P.O. Box 23 60, 89013 Ulm, Germany Phone: +49 731 505 2376 Email: tilo.schwarz at daimlerchrysler.com From stidolph at origin.ea.com Wed Feb 23 16:03:44 2000 From: stidolph at origin.ea.com (Stidolph, David) Date: Wed, 23 Feb 2000 15:03:44 -0600 Subject: Phython as In-Game scripting language Message-ID: <11A17AA2B9EAD111BCEA00A0C9B41793034AB1D3@molach.origin.ea.com> I'm working on a game using Python. We use C++ for all speed issues, like rendering and hardware handling. We use Python for all game logic and changing object state (like selecting what graphic to display for a UI element). Seems plenty fast to us! :) Of special note, this would not have been possible except for the AWESOME tool Swig. -----Original Message----- From: rdudfield at my-deja.com [mailto:rdudfield at my-deja.com] Sent: Wednesday, February 23, 2000 2:34 PM To: python-list at python.org Subject: Re: Phython as In-Game scripting language In article <20000222211406.41743.qmail at hotmail.com>, "Shawn LeBlanc" wrote: > Greetings! > > Being totally new to Python and completely honest in saying that > I have no idea of what I'm doing, I had a few questions. > > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior. This would allow the level/content designers > to concentrate more on the game design side of things, since > behaviors would be outside of the main game engine. Is it > possible to have multiple scripts running at the same time? > Would this involve creating multiple interpreter objects? According > to the docs, this is possible but it isn't totally safe to do. > What would be a good strategy for this? > > My other question was one of performance. Is it crazy to have > ~10 different objects with each an individual script and hoping > the game will be running at 30 frames per second? The question might not be > valid, since I'm not sure how to implement it in the first > place. > Microthreads would be good for this. Although I'm not sure if the authour is continuing work on them. As a side note you might want to check out crystalscript. Which is python, semi-based on unreals agent apis. It is for use with crystalspace. There is a link to crystalscript off the cyrstal.linuxgames.com site. Rene. Sent via Deja.com http://www.deja.com/ Before you buy. -- http://www.python.org/mailman/listinfo/python-list From thomas at bibsyst.no Thu Feb 24 09:26:28 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 24 Feb 2000 15:26:28 +0100 Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> Message-ID: <38B53F94.5AC0585C@bibsyst.no> Thomas Weholt wrote: > > Hi, > > I want to use threading in a server-based search/index application. Any > hints? The Python-docs didn`t help much. Tutorials, examples and code, > pleez. > > thank you. > > Thomas Ok, so threading might not be the solution on the server-side, but what are the alternatives ?? I gonna get, hopefully, some clients connection, sometimes at the same time, using common resources. How am I gonna do this without setting some of the clients "on hold"??? Thomas From effbot at telia.com Wed Feb 23 17:49:03 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 22:49:03 GMT Subject: IDLE References: Message-ID: Robert Hicks wrote: > I am trying to use IDLE on a pc at work. When I start it an error kicks back > saying that the init.tcl file in bad and that I need to reinstall TCL/Tk. So > I remove Python and reinstall...yet the same error shows up. I do not have > this problem at home. maybe the new files is installed in a new place, so IDLE keeps picking up the old ones. the information on this page might help you sort things out: http://www.pythonware.com/people/fredrik/fyi/fyi02.htm hope this helps! From mwh21 at cam.ac.uk Fri Feb 18 12:39:02 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 18 Feb 2000 17:39:02 +0000 Subject: Superclasses References: <_ZWq4.180$mYj.170807808@newsa.telia.net> Message-ID: "Joshua C. Marshall" writes: > On Thu, 17 Feb 2000, Fredrik Lundh wrote: > > > Joshua C. Marshall wrote: > > > Given a class object, is there a way to get at its superclass object? > > > > the thing you're looking for is "__bases__" > > Thanks, that's what I needed. Incidently, where is "__bases__" defined? > If "T" is a class object, doing a "dir(T)" doesn't show "__bases__" as a > field. > That's because it's a magic attribute; look at Objects/classobject.c around about line 190 or so. There is a fairly small set of such attributes in Python; the "__class__" attribute of instance objects is similar. Maybe `dir' should be fixed to add such things. But it's only a minor wart. > Sorry if this is a double-post. Doesn't seem my last one went through. It did. But never mind, it wasn't about whitespace! Cheers, Michael From bittneph at aston.ac.uk Tue Feb 8 06:38:10 2000 From: bittneph at aston.ac.uk (Peter Bittner) Date: Tue, 08 Feb 2000 11:38:10 +0000 Subject: Database with a web-interface (CGI) Message-ID: <38A00022.3CC17880@aston.ac.uk> Hi there! I need to build a web-interface with a database in the background (probably Oracle; possibly MySQL), so I need to write a Python CGI-script that takes input from an HTML-form and puts the data into the database (Input-operation) and, repectively, gets data out of the database with an SQL-query and displays the result in the browser. I've looked for example-source, but there doesn't seem to be much in the Web on Python (unlike Perl & PHP). :o( Does anyone have some example source? Please, help! Peter | Peter H. Bittner | International Student at Aston University | e-mail: bittneph at aston.ac.uk | web: http://beam.to/bimbo +-------------------------- From herzog at online.de Mon Feb 14 13:59:47 2000 From: herzog at online.de (Bernhard Herzog) Date: 14 Feb 2000 19:59:47 +0100 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <86ya8szq90.fsf@g.local> <1e5wxbt.bq9v2nqzwbxuN%bparsia@email.unc.edu> <886t16$kbp$1@nntp6.atl.mindspring.net> Message-ID: "Evan Simpson" writes: > Suppose we have... > > class Xyzzy(Spot, The, Looney): > def walk_silly(self): > return super() > walk = walk_silly > > ... what should Xyzzy().walk() do? Ah. I *knew* I was missing something obvious. > The name 'walk' is in no way accessible > to the implementation of 'super'. Apart from that, I suppose if it can > somehow get hold of the method object, 'super' could find the __name__ of > the method and the class to which it's bound, and go from there. I think it should either (1) always use walk_silly, i.e. the name associated with the function object, or (2) the attribute name used to access a method should be stored in the method object so that the implementation of super can access it. I'd probably prefer (1). (2) is too much DWIM for my tastes. > I'd expect it to have to be called as 'super(self)', though. Yes. super should evaluate to an unbound method object. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From neelk at brick.cswv.com Fri Feb 18 21:03:45 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 19 Feb 2000 02:03:45 GMT Subject: static class methods in Python? References: <1261276284-11190393@hypernet.com> <88kqbq$9qo$1@nntp6.atl.mindspring.net> Message-ID: Aahz Maruch wrote: > In article , > Neel Krishnaswami wrote: > > > >This is probably a stupid question, but what /is/ a class method? > >I've never programmed in C++ (or Java), so an explanation would be > >appreciated. > > Class methods are used to access and modify class variables. For > example: > > class foo: > bar = None > def __init__(self): > pass > classdef isdone(): > if foo.bar is not None: > return "!!!" > classdef clear(): > foo.bar = None > > Clearer? Yes, thanks. I'd agree that the self.__class__.bar you'd have to do in real Python is a little bit ugly. One thing I looked at doing was changing Python so the syntax "class.foo" would expand to "self.__class__.foo" (or whatever "self" actually is). This would solve the problem without adding a new keyword. However, I was scared away by the following comment in Parser/pgen.c: /* This algorithm is from a book written before the invention of structured programming... */ :) Neel From effbot at telia.com Thu Feb 10 13:12:20 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 18:12:20 GMT Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> <38A2E64D.CB7DA73A@infercor.no> <01e101bf73ed$ba98c240$a602a8c0@intranet.pspl.co.in> Message-ID: <8cDo4.316$Ph6.184515072@newsa.telia.net> Shalabh Chaturvedi wrote: > Even more amusing really entertaining, that one ;-) > "Neither Python nor Perl were designed as object-oriented languages." > > Is this true about Python ? I guess matz (who occasionally drops by and posts well- balanced and interesting stuff in this newsgroup) refers to the type/class split in the current C implementation. if you write an extension object, you'll get better per- formance if you implement it as a type descriptor, and one or more factory functions the advantage is that you can use low-level slots for certain operations, while the disadvantage is that you cannot subclass types in Python code. (you can write complete classes in C too, but that's a bit more work, and doesn't give you quite the same performance advantage, so nobody's doing that) this is mostly a CPython implementation quirk, and it will definitely be fixed in Py3K. > ""Though it is rarely claimed that Ruby is more powerful than Python, """ no, but don't forget that it's more popular than Python: "Though it is rarely claimed that Ruby is more powerful than Python, Ruby is faster, more natural, more elegant, and increasingly more popular." one sentence combining the worst aspects of wallish pseudo- science, lispish puritanism, and microsoft markese. poor matz. he really deserves a better marketing department ;-) From garabik at melkor.dnp.fmph.uniba.sk.spam Tue Feb 1 13:49:57 2000 From: garabik at melkor.dnp.fmph.uniba.sk.spam (Radovan Garabik) Date: 1 Feb 2000 18:49:57 GMT Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <949430917.149313@cdwork.cvt.stuba.sk> Fritz Heinrichmeyer wrote: : My son is 11 years and wants to learn programming. He heared about java at : school (cool like nike or adidas ...) but in my opinion this is very hard : stuff for a beginner to bring anything to play. : I thought of a nice python environment under windows ... It would be best to : have german documentation too. : What do you think? do you know about KAREL? it is a programming language designed for children. You are in control of a robot in a room, there are walls, bricks etc and you program the robot with commands like MOVE, TURN LEFT, DROP BRICK, PICK UP BRICK, the language has conditions (IF WALL, IF NOT WALL, IF BRICK, WHILE NOT WALL), can define it's own procedures etc... (I am loosely translating the commands from slovak equvalent I vaguealy remember from the time I saw KAREL) This is probably aimed at a bit younger children though. There are implementation for some 8-bit computers, as well as for win3.1, even in 3D graphics I thought about writting KAREL in python, with modified python-like syntax, it's own editor etc... but due to lack of time I probably will not do it (anytime soon). However, just making a few functions, displaying via tkinter and using standard python shell as a command line should be easy to write (and maybe once I'll do it). And it would still be standard python (definitely an advantage :-)). Just an idea... -- ----------------------------------------------------------- | 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 pollarda at lextek.com Sun Feb 27 14:46:40 2000 From: pollarda at lextek.com (Art Pollard) Date: Sun, 27 Feb 2000 11:46:40 -0800 Subject: IDLE Tutorial... Message-ID: <89brnp$s99$1@jaffa.itower.net> Hi. I am fairly new to Python and would like to use an IDE for doing my Python programming... However, I am having a hard time figuring out IDLE. Is there a short writeup/tutorial somewhere that describes writing programs using IDLE and using IDLE's debugger for debugging? Thanks, -Art From thomas at bibsyst.no Thu Feb 3 09:51:20 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 03 Feb 2000 15:51:20 +0100 Subject: embeding python in C++ ?? References: <20000203085900.02304.00000899@ng-da1.aol.com> Message-ID: <389995E8.2502CD52@bibsyst.no> JerryJerry wrote: > > I would like to embed python within a C++ application. I want to call python > scripts from C++ objects and call C++ object methods from python scripts. > > Does anyone have experience with this? > > I am new to Python, so I don't know how involved this is, or if it is even > possible. > > Thanks in advance. > Jerry I think the "Programming Python"-book has some examples on this. I`ve asked questions about a similar topic earlier so search this group and take a look at the answers I got then. Thomas From effbot at telia.com Wed Feb 9 13:41:57 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 18:41:57 GMT Subject: Loading C module under WinNT References: <87s9d2$lvg$1@nnrp1.deja.com> Message-ID: sirotenko at fnal.gov wrote: > I am running Python 1.5.2 on Windows NT. I have my C module, ca, > compilled and build as dll. > 1) if the name of the DLL is camodule.dll, I can not load it > with import ca, I have ImportError: module is not found > 2) if the name of DLL is ca.dll - it works ok. > The problem is that I already has ca.dll from other vendor and my > package is using that ca.dll, so I must > use name different from ca.dll, otherwise python gets confused. > On unix camodule.so works ok, does anyone knows why it does not work > on Windows NT? Thanks a lot, because Python doesn't look for module.so on Windows. however, you can use .pyd instead. just do: > rename ca.dll ca.pyd and everything should work just fine. (you can use imp.get_suffixes() to get a list of all module suffixes supported on your platform). > Sent via Deja.com http://www.deja.com/ argh! From pj at sgi.com Tue Feb 29 11:33:10 2000 From: pj at sgi.com (Paul Jackson) Date: 29 Feb 2000 16:33:10 GMT Subject: Strange Python problem on Linux. References: <38BBB8EF.9306991C@python.net> Message-ID: <89gsc6$871sk@fido.engr.sgi.com> Along the lines of the previous suggestion that the "#! ..." line might have odd chars, in addition to trying 'cat -v', also try: head -1 mdef.py > silly.py echo 'print "What's wrong?"' >> silly.py chmod u+x silly.py ./silly.py If the 'odd character' guess is right, then the silly.py constructed with a ver batim copy of the same first line will also fail. That or just edit 'mdef.py', deleting the first line and rekeying it from scratch, if you are more interested in cures than in a diagnosis. -- ======================================================================= 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 dworkin at ccs.neu.edu Wed Feb 9 16:45:35 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 09 Feb 2000 16:45:35 -0500 Subject: Real Problems with Python In-Reply-To: Gerrit Holl's message of "Wed, 9 Feb 2000 22:20:12 +0100" References: <20000209222012.A2749@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > 7. Error messages spanning multiple LOC > $ python sample.py > Traceback (innermost last): > File "sample.py", line 3, in ? > print "this" + \ > NameError: oops I don't see that this is all that big a deal, let alone a Real Problem. Slightly suboptimal behavior perhaps, but certainly not on the scale of the issues raised in the original post, such as lack of real gc, scoping issues, the type/class dichotomy, etc. -Justin From pinard at iro.umontreal.ca Wed Feb 9 14:52:29 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 09 Feb 2000 14:52:29 -0500 Subject: Colour `curses'? Message-ID: Hi, everybody. I do not see that `import curses' gives access to terminal colour. Shouldn't it? Or is there some trick to know? -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From gerrit.holl at pobox.com Fri Feb 18 01:44:32 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 07:44:32 +0100 Subject: Help needed writing GUI comparison In-Reply-To: ; from effbot@telia.com on Thu, Feb 17, 2000 at 10:16:05PM +0000 References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> Message-ID: <20000218074432.A777@stopcontact.palga.uucp> Fredrik Lundh wrote on 950822165: > Gerrit Holl wrote: > > > > Hallo, > > > > I'm writing a GUI comparison, and I really need help. I don't > > want to take the time to learn all GUI's. What I have so far > > is attached (HTML), and also available at the following URL: > > > > http://www.nl.linux.org/~gerrit/gui.html > > "when using Tkinter, you are writing Tcl style, not Python style" > > about as unbiased as a microsoft whitepaper on solaris ;-) That's why I need help: people need to tell me the truth (?) about Tkinter. To be fair, I copied this opinion from the older GUI comparison page, since I don't know much about it... regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From Alessandro.Bottoni at think3.com Mon Feb 28 10:41:04 2000 From: Alessandro.Bottoni at think3.com (Alessandro Bottoni) Date: Mon, 28 Feb 2000 16:41:04 +0100 Subject: GUI in Python under MSDOS? Message-ID: <6D8A17398E28D3119F860090274DD7DB4984E8@pces.cadlab.it> I just hate DOS but, if you do have to develop GUI applications for it, have a look at: http://www.neosoftware.com/ Until a few years ago, they were willing to sell/other-distribution-agreements the GUI library that is at the basis of NeoPaint (a very nice one, indeed). May the Force be with you.... -------------------------------- Alessandro Bottoni (Alessandro.Bottoni at Think3.com) (alessandro.bottoni at libero.it) Web Programmer Think3 inc. (www.think3.com) > -----Original Message----- > From: Al Christians [SMTP:achrist at easystreet.com] > Sent: Monday, February 28, 2000 8:42 AM > To: python-list at python.org > Subject: Re: GUI in Python under MSDOS? > > Richard Smol wrote: > > > > > > Porting Tk to DOS would not be trivial, since there would be no > > base-widgets to work with. It would be great fun though to make > > it work. You might get stuff like those those early Windows-lookalike" > > DOS apps (anyone remember WordPerfect 6.0 for DOS?) > > From jjlucsy at concentric.net Thu Feb 17 16:44:46 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Thu, 17 Feb 2000 16:44:46 -0500 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <20000217214601.B2438@stopcontact.palga.uucp> Message-ID: > Why the hell hasn't wxPython become the standard GUI for Python yet? Well, it's little too cumbersome in terms of size of redistribution (as far as Windows is concerned). It has a 1.7meg pyd, not to mention various other pyd's as well. I can think of other things, but this is the showstopper for me right now. I'm currently trying to use pyFLTK, but am quite disappointed that the controls can't be subclassed. I'm taking a stab at rewriting it, but no success yet. -- - Joel Lucsy (jjlucsy at concentric.net) From skip at mojam.com Tue Feb 15 10:18:01 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 15 Feb 2000 09:18:01 -0600 (CST) Subject: IDLE and Hooks in apps for usage of My Favorite Editor In-Reply-To: References: <14504.27894.464229.484275@weyr.cnri.reston.va.us> Message-ID: <14505.28201.692698.777047@beluga.mojam.com> Moshe> Of course, you have to assume things like vi will have to be Moshe> changed quite a bit to do that. Wait. No. I changed my mind. vi Moshe> could probably be changed to support such a library in a Moshe> weekend. By that time, EMACS will have about 5 modes which Moshe> support it, of course. I could have sworn I saw XML-RPC for Emacs mentioned somewhwere. Try searching the archives at http://www.xmlrpc.com/. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From ndev42 at yahoo.com Mon Feb 21 05:47:50 2000 From: ndev42 at yahoo.com (Nicolas Devillard) Date: Mon, 21 Feb 2000 02:47:50 -0800 (PST) Subject: Which GUI? Message-ID: <20000221104750.25346.qmail@web3607.mail.yahoo.com> --- Gerrit Holl wrote: [...] > > - Does not need ANY extra library to compile, i.e. > > knows how to talk to the underlying windowing > > library underneath, > > whether it is X11, Motif, Windows or Mac. > > This does not exist. Tcl/Tk does just that. > > - Clean design, if possible OO. > > All GUI's have this feature, As Far As I Saw So Far. Tcl/Tk is not OO (at least not in its base version). [...] > > The only problem I have > > with Tkinter is that it is truly > > Python/Tkinter/Tcl/Tk, which > > means a whole bunch of software to install > > before you > > actually can get a single widget on screen. > > On Windows, this is needed for every GUI. On Linux, > GTK and QT are most likely already installed. What about Solaris? HPUX? IRIX? AIX? OSF/1 or the latest True64? They do not come with fancy GUI stuff pre-installed, only X11. "Most-likely installed" is not enough. It is either there or not. X11 is always there on Unixes, otherwise the user would not even bother about GUIs. > > What happened to Rivet?? > > I haven't seen Rivet yet. Nor I've looked at STDWIN > yet. Thanks for this... er... constructive answer :-) -- Nicolas __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From james+news at daa.com.au Fri Feb 11 04:00:25 2000 From: james+news at daa.com.au (James Henstridge) Date: Fri, 11 Feb 2000 09:00:25 GMT Subject: Python-Fu for GIMP? References: <38A03990.998FF375@doc.ic.ac.uk> <00020808062400.01078@quadra.teleo.net> Message-ID: <38A3CF6C.AEB2A8F9@daa.com.au> Note that the latest version of the plug-in is distributed with the 1.1 series of the gimp. To enable it, pass the --enable-python argument to configure when compiling the gimp. The version on the web site will work fine with gimp-1.0 though. James. Patrick Phalen wrote: > > [Anthony Mayer, on Tue, 08 Feb 2000] > :: Has anyone done, or thought about, a Python-Fu scripting plugin for > :: GIMP? Along the lines of the Perl-Fu one? > > Yes, someone has: > > http://www.daa.com/au/~james/pygimp/ From wware at world.std.com Mon Feb 14 15:44:45 2000 From: wware at world.std.com (Will Ware) Date: Mon, 14 Feb 2000 20:44:45 GMT Subject: os.shell, recursion, encryption References: <38a79bec_3@news5.newsfeeds.com> <38a854a7_2@news5.newsfeeds.com> Message-ID: 55555 (55555 at dakotacom.net) wrote: : How does os.popen work? I'm afraid that I don't understand pipes. Caveat: I'm a Unix guy, pretty clueless about Windows, and this may all be Unix-ish stuff. When you open a file for reading, the file becomes a source of bytes. You read the bytes in sequence and there is some testable condition to tell you when there are no more bytes. Since many files are text, it's often convenient to take the bytes in lines. So you often see idioms like this: f = open('somefile') for L in f.readlines(): .... do something with L .... f.close() or more tersely: for L in open('somefile').readliines(): .... do something with L .... In this latter case, the opened file should automatically be closed when it gets garbage-collected. (Whether that happens, or the conditions under which it might not, is another question for subtler minds than mine.) In Unix, many programs (particularly ones that operate on text) are written to look like filters, meaning that they accept a stream of bytes from elsewhere and produce a stream of bytes that can go to yet somewhere else. Each such program has "standard input" and "standard output". Output from one program can be directed to the input of another, and hence the term "pipe", just like in plumbing. So you see constructs like this: filter1 < infile | filter2 | filter3 | filter4 > outfile And this means that the contents of 'infile' are run thru all four filters in succession, and the results end up in 'outfile'. Python, too, can accept input from a chain of filters, so I can type something like this: p = os.popen('filter1 < infile | filter2 | filter3 | filter4') for L in p.readlines(): ... do stuff with L ... p.close() and this means that I want, as input, the stuff that would have been dumped into 'outfile' in the earlier example. Sorry if this seems circuitous and long-winded (and I'm _really_ sorry if none of this is meaningful in the Windows world), but this saves you the hassle of creating a bunch of intermediate files to catch the output at each stage in the pipeline. (Essentially Unix is creating those files itself and keeping track of them without bothering you with the details, and they all disappear when you're finished.) I suspect Python would also be happy with an output pipe, something where you'd be writing to the front of a pipeline like this: p = os.popen('filter1 | filter2 | filter3 | filter4 > outfile', 'w') for : ... p.write(....) p.close() but I've never myself written that, that I can recall. -- -- I can picture in my mind a world without war, a world without hate. And -- -- I can picture us attacking that world, because they'd never expect it. -- Will Ware - N1IBT - wware at world.std.com From paul at prescod.net Wed Feb 9 18:09:52 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 15:09:52 -0800 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: <38A1F3C0.F9BBC038@prescod.net> What about string.strip and string.rstrip? -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From nobooze4u at BLAM!worldnet.att.net Fri Feb 11 13:59:41 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Fri, 11 Feb 2000 18:59:41 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> Message-ID: x-no-archive: yes Steve Holden wrote: > This is flamebait. I declare this thread closed. > Unilaterally. NOW. Flamebait, huh? In the eye of beholder, perhaps. Here: "A line containing a line continuation character cannot contain a comment." Now, that's real advanced. How about "only text typed with your left hand constitutes valid input"? Classes full o code... Like I said, phooey. The docs are very decent though, it's a shame that the thing itself is so funny. Seems like, at the end of the day, Visual Basic does win. Even though it sucks royally too. Jeezus, Tiny C with objects, that's all I ask for. Any recommendations? From tim_one at email.msn.com Mon Feb 28 03:42:19 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 28 Feb 2000 03:42:19 -0500 Subject: functional programming In-Reply-To: <38B84ABA.AA22EFD6@maxtal.com.au> Message-ID: <001001bf81c7$ba587ea0$f0a2143f@tim> [John "Max" Skaller, on his nascent Python compiler, IIRC compiling to ocaml] > Vyper. on the other hand, is designed to do functional programming > well, but you can 'force it' to make Python work too :-) [you do this > by coding your module in a .py file, use a .vy file for the full thing] > > The latest version even supports 'pattern matching' like in ML, > with a pythonic twist. As you know, Python allows an escape from > block structure using bracket balancing rules -- Vyper also supports > the converse, allowing an arbitrary suite to be nested in an expression > using enblock <: and deblock :> symbols. FYI, Donald Beaudry once made a patch to support block bracketing via (: and :) -- which glyphs Steven Majewski dubbed the "smiling Guido" and "frowning Guido". Your glyphs seem somehow more phallic . BTW, unclear what pattern matching has to do with embedding suites in expressions. > Such an expression-nested suite has the same value it would were it > a nested parameterless function, namely None unless something is > 'return'ed. > > Combined with lexical scoping, Vyper is a fairly reasonable > dynamic functional language, as well as being procedural and object > oriented :-) While Vyper sounds less like Python by the week, at least I'll enjoy playing with it! What of the reason you originally undertook this? That is, besides general frustration, you had specific unhappiness about the speed of your Interscript: > download Interscript http://Interscript.sourceforge.net Can you run Interscript under Vyper yet? If so, fast enough now? Just a gentle reminder that the market for new functional languages has been fatally over-served for most of my adult life <0.5 wink>, but the market for a fast Python may approach the size of the worldwide market for BBQ-flavored salt-free potato chips someday. in-a-world-of-six-billion-that's-bigger-than-it-sounds-ly y'rs - tim From ivanlan at callware.com Thu Feb 17 16:45:33 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 17 Feb 2000 14:45:33 -0700 Subject: Help needed writing GUI comparison References: <20000217221452.A2943@stopcontact.palga.uucp> Message-ID: <38AC6BFD.D8A7598C@callware.com> Hi Gerrit-- Gerrit Holl wrote: > > Hallo, > > I'm writing a GUI comparison, and I really need help. I don't > want to take the time to learn all GUI's. What I have so far > is attached (HTML), and also available at the following URL: > > http://www.nl.linux.org/~gerrit/gui.html > > Please help and contribute! > You need to reference John Grayson's book from Manning on Python and Tkinter program. This one is out now. Addtionally, the last 8 chapters of _Teach Yourself Python in 24 Hours_ focuses on an introduction to Tkinter for utter newbies (the whole book is targetted specifically at people who have never programmed before). It's due out in April. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 gerrit.holl at pobox.com Sun Feb 20 15:33:11 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 20 Feb 2000 21:33:11 +0100 Subject: PROPOSAL: [].__doc__, "".__doc__, ... Message-ID: <20000220213311.A7023@stopcontact.palga.uucp> Hello, I think it would be a nice feature for all types with methods to have docstrings describing the methods, so [].__doc__ would be a string with the descripion of .index, .append... etc. What do you think? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From eugene.kelly at computer.org Mon Feb 28 13:36:17 2000 From: eugene.kelly at computer.org (Eugene Kelly) Date: Mon, 28 Feb 2000 18:36:17 +0000 Subject: Python program examples References: <38BA5DC6.A83448DF@computer.org> <20000228132812.A6199@humbolt.nl.linux.org> Message-ID: <38BAC021.1C288F00@computer.org> No, I have not found this directory. Where is it hiding? Directions appreciated. Thanks, Eugene. Gerrit Holl wrote: > On Mon, Feb 28, 2000 at 11:36:38AM +0000, Eugene Kelly wrote: > > I am looking for neat little examples of Python programs for an intro. > > programming course I am currently giving to business students. We are > > working in a MS Windows 98 environment. If you have any examples to hand > > that you would be willing to share please send them to me directly. > > Programs should be small i.e. < 100 lines max and < 50 would be best. > > Have you already found the Demo/ directory? > > regards, > Gerrit. > > -- > -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com > Version: 3.12 > GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? > Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y > -----END GEEK CODE BLOCK----- From skip at mojam.com Wed Feb 9 11:00:54 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 9 Feb 2000 10:00:54 -0600 (CST) Subject: Mystery of Python In-Reply-To: <38A189EF.A55F3EF2@prescod.net> References: <38A189EF.A55F3EF2@prescod.net> Message-ID: <14497.36662.11797.571057@beluga.mojam.com> The variable char isn't interned, while the string literal "i" is. Try: for char in "abcdefghijklmnopqrstuvwxyz": print char, sys.getrefcount(intern(char)) Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From tbryan at python.net Mon Feb 7 19:17:40 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 07 Feb 2000 19:17:40 -0500 Subject: Newbie question - what is the 'r' operator? References: Message-ID: <389F60A4.1F84F0BC@python.net> Craig Findlay wrote: > > This is probably obvious but ... > > I have seen example code where an 'r' prefix is used in from of a > string, eg r'mystring' > > What does it do, I can't seem to locate any documentation about it. > Thanks in advance for any help. It indicates a raw string. >>> s1 = 'a \normal \tstring\012example' >>> print s1 a ormal string example >>> s2 = r'a \normal \tstring\012example' >>> print s2 a \normal \tstring\012example I'm not sure of the formal definition of a raw string. It may simply escape all of the backslashes. For example, >>> s1 'a \012ormal \011string\012example' >>> s2 'a \\normal \\tstring\\012example' Thus, \t won't be interpreted as a tab in a raw string. great-for-regular-expressions-and-win32-paths-ly yours ---Tom From jcw at equi4.com Mon Feb 28 09:45:57 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Mon, 28 Feb 2000 15:45:57 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: <38BA8A1F.2B4ADA0B@equi4.com> Arnaud, > "Fredrik Lundh" wrote: > > MacPython dynamic modules aren't portable between releases. [...] > So, I need to re-compile the module from the sources. Hmmmm ..... but > I don't have CodeWarrior ... so ... If you let me know which release of MacPython you use (an URL perhaps), I can try to do a build which works with it. Version madness :( I haven't done much with Mk4py on the Mac, other than building an email database (work in progress). It will be much more scalable once the Mac supports memory-mapped files (MacOS X, next summer). -- Jean-Claude From thor at localhost.localdomain Wed Feb 23 15:45:34 2000 From: thor at localhost.localdomain (Manuel Gutierrez Algaba) Date: 23 Feb 2000 20:45:34 GMT Subject: Python Ring Info Message-ID: Python ring Info ------------------------- This is a piece of information about the existing python ring in: http://www.ctv.es/USERS/irmina/pythonring.html (now with Statistics) What is it? >From a functional point of view, it's a list of linked web sites that share a common interest or information, in this case python related stuff. How does it work? The HTML code included in each node of the ring calls a CGI that performs the movement thru the ring. How can I join? In the above web site , fill in your data and that's all. Why I should ? If you've done a web site, I think it's worth you spend 15 minutes promoting it, after your web site has been included in it you'll get more hits than ever. Moreover, your information may be interesting for other people, or you can be interested in other people's work, a big Webring provides the community a lot of unusual but somehow interesting data. How can I get more hits? Because the Webring is a democratic way of organization, that is, all its members tend to receive the same ammount of visits, the big ones as much as the small ones. Well, I don't have a Web page.., so? So you must ( :) ) start doing one right now. Seriously, we ( at least me,MGA) are interested in people's work, perhaps you've been collecting data or even your libraries or methods of work are clearly defined, the ammount of time required for a fast compilation of that info is not too much. And I remark that you can learn only if all ( or many) want to show or teach what they know. Of course we admit commercial Web sites also, *any* Web site about python. Thanks for your time and patience reading this. MGA From python at channel21.com Fri Feb 25 10:33:09 2000 From: python at channel21.com (Channel21 Python Team) Date: Fri, 25 Feb 2000 10:33:09 -0500 Subject: FW: Should I start a new list? Message-ID: <81DD38F43381D111BA3E00A076A0998A459F5F@XENON> looks like the guys over on the asp lists were cool enough to start a new list just for us! ;) > ---------- > From: Charles Carroll[SMTP:darthcarroll at hotmail.com] > Sent: Thursday, February 24, 2000 6:46 PM > To: dixon at channel21.com > Subject: RE: Should I start a new list? > > http://www.asplists.com/asplists/asppython.asp > has been started in your honor > > >From: Jason Nadler > >To: 'Charles Carroll' > >Subject: RE: Should I start a new list? > >Date: Thu, 24 Feb 2000 16:50:58 -0500 > > > >well, all of the lists are shown on python.org, but the most active list > is > >python-list at python.org > > > >yes, the win32all contains all the com extensions and dlls. - you can > >download them on the site. > > > > > > > ---------- > > > From: Charles Carroll[SMTP:darthcarroll at hotmail.com] > > > Sent: Thursday, February 24, 2000 4:11 PM > > > To: dixon at channel21.com > > > Subject: Should I start a new list? > > > > > > [asppython] perhaps? > > > > > > I have [AspPerlScript] and [aspJscript] > > > > > > I did not know Python plugin was available for ASP.DLL > > > > > > What is the URLs of the Python plugin and the various python > listservers > > > you > > > belong to? > > > > > > [aspcrash] is the best place to discuss this now. If there were any > >Python > > > > > > experts on the [aspadvanced] list they will help over on [aspcrash] > > > > > > Charles M. Carroll > > > creator of LearnASP.com > > > moderator of ASPlists.com > > > disciple of Reiss, Trout, Cooper > > > > > > ______________________________________________________ > > > Get Your Private, Free Email at http://www.hotmail.com > > > > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com > From kens at sightreader.com Sun Feb 27 20:09:51 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 17:09:51 -0800 Subject: IDE-sig Message-ID: <38B9CADF.CCBD74D7@sightreader.com> If you are involved in IDE development, or anything listed below, or you want to keep up on the latest developments, you might be interested in an IDE sig. If so, please send me an email. When I get enough, I will forward the petition (stack of emails) to Senator Greg Stein in charge of meta-sig. --- Send your reply to: kens at sightreader.com Optionally, you can give a brief description of why we need an ide-sig. I will notify you when and if the ide-sig gets created. IDE development includes the following: - What we usually think of: - IDLE - PythonWin - Boa Constructor - Unusual IDE variants - Neural Integrator - Any embedded scripting project, if you want nice interface for script development - Any component that could be useful to IDE developers: - Source code editors - Interactive interpreters - Parsers - Code generators - Source code control - Project management - Browsers - Debuggers IDE-sig objectives: - Code re-use and interoperability between IDE systems - Promotion of new IDE systems - General forum for development of IDE components Why comp.lang.python won't do: - Scope is too broad for a single discussion thread - Too easy to miss something important because of the chaos Ken Seehof From dan at cgsoftware.com Fri Feb 18 00:32:41 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Thu, 17 Feb 2000 21:32:41 -0800 (PST) Subject: Python misconceptions in IBM Ruby article... In-Reply-To: Message-ID: > > > * Proper OO languages do not use white space to delimit blocks, > > and use semicolons and block delimiters. > > Proper languages put semicolons _between_ statements not at the > end of statements. That's it, i'm taking action. Effective tomorrow morning, i'm gonna write a small language where whitespace is ignored, statements are meaningless, and the delimiters are ;,{, and } All programs that compile will simply core dump. It'll be a proper OO language. Why, you ask? Because it doesn't use whitespace to delimit it's blocks. Regardless of the fact that their is not even a hint of any kind of OO, it'll be proper OO, because it uses ";" to end statements, and "{" and "}" to delimit blocks. Why will all compiled programs core dump? Well, actually, this is a feature. Whenever someone tries to complain about the whitespace, you simply have them write large applications in my language, which will promptly core dump after they spend hours writing many lines of code, for no good reason they'll have an epiphany, cry, and come be productive members of the python community. Who wants to bet the first program written is a mysterious whitespace eating nanovirus? Must-be-late-cause-this-seemed-reasonable-ly yours, Dan From kern at caltech.edu Wed Feb 23 20:11:32 2000 From: kern at caltech.edu (Robert Kern) Date: 24 Feb 2000 01:11:32 GMT Subject: Which GUI? References: <14513.35377.353913.763784@weyr.cnri.reston.va.us> Message-ID: <8920g4$l26@gap.cco.caltech.edu> In article <14513.35377.353913.763784 at weyr.cnri.reston.va.us>, "Fred L. Drake, Jr." writes: > > Moshe Zadka writes: > > Because PyGTK doesn't work on Win32 (relevant to a month ago when I > > checked) > > The port has been done, but I don't know if the sources have been > merged. http://www.geocities.com/kevin_j_butler/pygtk/ I ran across this by accident. People, please be a little louder about your accomplishments! > -Fred oh-yeah,-I-have-a-package-to-announce-too--ly y'rs -- 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 effbot at telia.com Tue Feb 15 15:33:03 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 15 Feb 2000 20:33:03 GMT Subject: simple HTML to XML converter References: <38a98d61@guardhouse.chbs> Message-ID: <3Kiq4.3736$dT4.208367104@newsb.telia.net> Paul Pfaff wrote: > Hello, is there a simple HTML and/or Text converter into XML and/or WML > format ? http://www.w3.org/People/Raggett/tidy/ (yes, a python reimplementation would be cool, but they've put a lot of effort into tidy...) From darrell at dorb.com Wed Feb 9 19:45:42 2000 From: darrell at dorb.com (Darrell) Date: Wed, 9 Feb 2000 19:45:42 -0500 Subject: HP Ini file module References: Message-ID: <00c001bf7360$2912b610$0101a8c1@server> I don't work for HP but have an INI parser. Never used to though. http://www.dorb.com/darrell/WinIniParser/ --Darrell ----- Original Message ----- From: "Gene Chiaramonte" To: Sent: Wednesday, February 09, 2000 2:23 PM Subject: HP Ini file module > At frozenspam 8 someone from HP mentioned they had a python module available > to work with ini files on windows. Anyone know where I might find that? > > Thanks, > > Gene > > > -- > http://www.python.org/mailman/listinfo/python-list From greene at hctc.com Fri Feb 25 21:12:41 2000 From: greene at hctc.com (Collin Greene) Date: Fri, 25 Feb 2000 19:12:41 -0700 Subject: thanks for the help !!!!...any tips for how to best learn python?!!! Message-ID: any tips to help me newbie # 1 get started at prgramming in python, thanks any help is appreaceated!!:) greene at hctc.com From dvl at de.uu.net Thu Feb 24 10:22:27 2000 From: dvl at de.uu.net (Dirk Vleugels) Date: 24 Feb 2000 16:22:27 +0100 Subject: Simple example of threading References: <200002241512.JAA29137@www.polytopic.com> Message-ID: Hi, rmeegan at murlmail.com writes: > [Thomas Weholt] > There is something to be said for spawning new processes to handle > server requests. In particular, parent processes can kill their > children when they wander off and start misbehaving. Threads can't be > killed by other threads, including the main thread of the process that > spawned them. Is this true? Under posix_threads there is pthread_cancel. This call is used to 'cancel' misbehaving threads (blocking on certain system calls (see doc)). The thread may ignore cancel requests, but this is under user control. Sadly, pthread_cancel is missing in python, dunno why. > Good luck - > - Robert Cheers, Dirk -- Dirk.Vleugels at de.uu.net http://www.de.uu.net Database Engineer UUNET Deutschland GmbH From effbot at telia.com Mon Feb 28 17:22:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 22:22:32 GMT Subject: String processing inside lists References: Message-ID: Gary Moore wrote: > The problem happened when I tried to use the construct: > > for x in actors > > to process the list of actors prior to output. > > When I use the string library to process this list, I want the actual > strings contained in the list to change. What I found was that no > matter how I tried to change the strings in the actors list, I was > unsuccessful. > ... > My concern is that I must not be understanding some basic concept concerning > the FOR loop in Python. I reread the material in 'Learning Python', but > still could not understand why the first solution above did not work. you don't grok assignment yet (but you will): in many programming languages, a variable is a small region of memory in which you can put things of a given type. however, in Python, a variable is a name which can point to any existing object. variables don't have types (but objects do). when you assign a new object to a variable, you just change the name so it points to the new object. the old object is not affected by this (in fact, it doesn't even notice, unless the assigment means that nobody cares about the object anymore, in which case it's destroyed) so in your loop, when you created a new object using replace and assigned it to "x", you modified the "x" variable to point to the new object. the old one (owned by the list) wasn't affected. hope this helps! From mark at chem.uwa.edu.au Wed Feb 23 19:36:34 2000 From: mark at chem.uwa.edu.au (Mark C Favas) Date: 24 Feb 00 00:36:34 GMT Subject: Installing on Win 2K? References: <89129k$1iv$1@nnrp1.deja.com> Message-ID: Preston Landers writes: >Has anyone succesfully installed Python on W2K? Is there something I'm >missing? Yes - I've successfully installed the standard 1.5.2 distribution, the wun32all extensions and built the current CVS distribution on Win2K. The only glitch (which I also had on NT4) was that I had to copy the Tcl/Tk dlls to the DLL subdirectory of the Python folder to get Tkinter to work without error. 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 jimsev at my-deja.com Fri Feb 11 08:45:02 2000 From: jimsev at my-deja.com (Jim Severino) Date: Fri, 11 Feb 2000 13:45:02 GMT Subject: Specifying subject using smtplib References: <87kp4l$aid$1@nnrp1.deja.com> Message-ID: <8813ot$6o3$1@nnrp1.deja.com> Fredrik Thank you for your totally correct reply. I just bought your book from Fatbrain, and recommend it to anyone who programs (or dabbles, as I do) in Python. Jim In article , "Fredrik Lundh" wrote: > Jim Severino wrote: > > In the smtplib module, the SMTP object's method "sendmail" is formatted > > like so: > > > > sendmail (from_addr, to_addrs, msg[, mail_options, rcpt_options]) > > > > Can anyone tell me where you specify the message's subject? > > in the message itself. > > from_addr and to_addrs are commands to the > mail transport; everything that you want to go > into the message header should be explicitly put > into the message. > > (the mail transport agent may rewrite some of > the headers, but don't rely on that...) > > here's an example from the eff-bot guide (see > footer for more info): > > # File: smtplib-example-1.py > > import smtplib > import string, sys > > HOST = "localhost" > FROM = "effbot at spam.egg" > TO = "fredrik at spam.egg" > > SUBJECT = "for your information!" > > BODY = "next week: how to fling an otter" > > body = string.join(( > "From: %s" % FROM, > "To: %s" % TO, > "Subject: %s" % SUBJECT, > "", > BODY), "\r\n") > > print body > > server = smtplib.SMTP(HOST) > server.sendmail(FROM, [TO], body) > server.quit() > > > > > > -- ------------------------- I'll check my my-deja email as often as I can. Well, whenever I remember, anyways. Sent via Deja.com http://www.deja.com/ Before you buy. From a.eyre at optichrome.com Tue Feb 29 05:59:56 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 29 Feb 2000 10:59:56 -0000 Subject: A comp.lang.python code snippet archive? In-Reply-To: Message-ID: <000e01bf82a4$1d51c9d0$3acbd9c2@peridot.optichrome.com> >> #snippet "mysnippet.py" >> #category "Networking" >> #description "This does something interesting" >> #begin >> #!/usr/bin/env python > Nice thought, but I don't think it will work. Well, technically: yes. But > I think many people are just like me in this respect: I will not always > remember to do this. Surely we don't intend to archive *all* snippets in c.l.py. Only ones that are meaningful out of the context of the posting, and are useful/reuseable. The author of the snippet can decide whether this is the case, and only use the above notation if they want it to be included in the archive. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From a.eyre at optichrome.com Fri Feb 4 05:27:26 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Fri, 4 Feb 2000 10:27:26 -0000 Subject: Python cookbook In-Reply-To: <3899D4E4.B797EB62@rubic.com> Message-ID: <002e01bf6efa$6e851cc0$3acbd9c2@peridot.optichrome.com> > 1. Cut the meat into desired serving sizes. Eww. I'm not eating chopped up Cleese, Chapman, et al. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From JamesL at Lugoj.Com Wed Feb 9 23:49:09 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Wed, 09 Feb 2000 20:49:09 -0800 Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> Message-ID: <38A24345.3F763311@Lugoj.Com> Wake me when the other thread dies. Off topic: By the way, speaking of code blocks, does anyone know of any languages that use blocks...literally? That is, given the prevalence of GUIs, a development environment/language where code is contained in rectangles? For example (the following will need to be viewed using a fixed-width font): +====================+ | def Func(a, q) | +====================+ | if a == b | | +----------------+ | | | xyzzy = Plunk()| | | | w = xyzzy + 42 | | | | | | | +----------------+ | | else | | +----------------+ | | | w = sqrt(-1) | | | +----------------+ | | return q/w | +--------------------+ Anyway, hope you get the idea. Many variations on how the boxes should appear are possible. From tismer at tismer.com Sun Feb 27 10:50:56 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 27 Feb 2000 16:50:56 +0100 Subject: functional programming References: Message-ID: <38B947E0.4803806D@tismer.com> Moshe Zadka wrote: > > On Fri, 25 Feb 2000, Toby Dickenson wrote: > > > It looks like it should be possible to implement a tail-optimised > > variant of apply() using Stackless? > > It won't help: the apply call itself won't be tail-optimised.... Why not? I can easily implement an explicit tail call to the current function. This no automatic tail optimization, but the programmer decides by hand the he wants to do a tail jump now. I could use apply style, or simple function style. Sketch: import continuation def something(arg1, arg2): .... continuation.tailcall_self(arg1+2, arg2-42) # we never get here # and as we are at it, we can also have the regular call # of the current function without having to know its name: def somethingelse(arg1, arg2): .... continuation.call_self(arg1+2, arg2-42) # we do get here # and advantage: We can now use recursive functions # in a local context: def localrecfunc(x1, x2): def localfunc(a, b, call=continuation.call_self): ... if : return call(a+1, b-2) # will come back here thing = localfunc(x1, x2) def localtailfunc(x1, x2): def localfunc(a, b, tailcall=continuation.tailcall_self): ... if : return tailcall(a+1, b-2) # will not come back thing = localfunc(x1, x2) It is easy to do this, and an apply would be easy as well. I'm just curious about the interface: It is hard to find the right names for these functions. Also, they don't appear to belong to the continuation module, so I hesitate to embed them there and also hesitate to write another extension module. Stackless Python can stand all kinds of jumps and calls, anywhere, at any time. The problem is just how to spell it. Suggestions? -- 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 ivanlan at callware.com Wed Feb 2 12:44:44 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 02 Feb 2000 10:44:44 -0700 Subject: Newbie: OverflowError: integer addition - Python data types?? References: <879o21$lu2$1@nnrp1.deja.com> Message-ID: <38986D0C.9C19D1F@callware.com> Hi All-- e.e.sutton at cummins.com wrote: > > I can't get a Python version of my VBScript Fibonacci series script to > work. I get an OverflowError: integer addition error at series 46. > > Can Python not handle large numbers? > > Is there a special data type I should be using? > > Series 45 is the following number. > 45 1836311903 (1.84E+09) > > File "M:\SRC\scripting\fibonacci\fib.py", line 47, in Fibonacci > fib = fibA + fibB > OverflowError: integer addition > > def Fibonacci(i): > fibA=1 > fibB=1 > if i == 0: > Fibonacci = fibA > elif i == 1: > Fibonacci = fibB > elif i > 1: > fib=0 > for j in range(2, i+1): > fib = fibA + fibB > fibA = fibB > fibB = fib > Fibonacci = fib > return Fibonacci > Aahz pointed out in another post that you need to use long integers. The simplest change you can make is to change fibA=1 fibB=1 to fibA=1L fibB=1L This will cure your immediate problem. However, two things. 1) If you're going to post code, post complete code. I.e., here you forgot to post the line in which you called Fibonacci(). 2) Defining a function Fibonacci() which uses a local variable inside itself name Fibonacci is terrible practice. It's confusing and obscures your meaning. When people read the function, every time they see the name of a function inside the function, they're *first* going to think "Recursion!" They have to go back and re-read it before they realize it's only a variable having local scope. Also, in such a short function there is no need to be so verbose, either; try renaming the Fibonacci variable to f. I think you'll find it's much clearer. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com ivanlan at home.com http://www.pauahtun.org See also: 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 gerrit.holl at pobox.com Mon Feb 7 14:36:45 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 7 Feb 2000 20:36:45 +0100 Subject: OFFTOPIC (Was: Re: mail filter in python?) In-Reply-To: <20000207175222.J19265@xs4all.nl>; from thomas@xs4all.net on Mon, Feb 07, 2000 at 05:52:23PM +0100 References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207170156.A3609@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> Message-ID: <20000207203644.B4977@stopcontact.palga.uucp> Thomas Wouters wrote on 949942343: > On Mon, Feb 07, 2000 at 05:01:56PM +0100, Gerrit Holl wrote: > > File locking isn't hard to implement, what kind of security checks do you > > mean? Python is portable so that's not a problem. > > File locking _is_ hard to implement, in a portable, secure, race-proof > manner. flock()/lockf()/O_EXCL are the easiest ways of locking, but are not > very portable, and are likely not to work on some filesystems (like NFS). > Also, some NFS servers and clients do their best to do NFS locking in a > secure way, but most do not succeed, or succeed at the cost of stability and > speed. Oh, sorry. I thought you could just create a file called ".filename.lock" and remove it when you're ready, in a try: ... finally: ... clause? > There is a fairly portable way of locking, even over NFS, using hard links > between lockfiles, but it is tricky to implement. See the mailman-developers > archive on www.python.org/pipermail/mailman-developers, there should be a > few recent postings by me about locking. I don't see the point. > > > It would be hard to reimplement all that from scratch :( > > > > I don't think so. Security is not an issue, the command runs under the > > right uid. > > That depends on how/where you install it. It usually has to run with > mail-gid permissions, for instance. All in all, i think you're better off > with a frontend to procmail, which creates a procmailrc to your liking. Or > perhaps you can use the powers of procmail to make it start a python script > to do the filtering, and accepts the action from it -- it would then take > care of locking, security and the mailbox format itself. Suse: 20:33:54:tty7:gerrit at stopcontact:~$ ls -l $(type -p procmail) -rwxr-xr-x 1 root root 68596 aug 7 1999 /usr/bin/procmail* Redhat, Stampede: 20:36:17:0:gerrit at humbolt:~$ ls -l $(type -p procmail) -rwsr-sr-x 1 root mail 55088 Jan 25 1998 /usr/bin/procmail* regards, Gerrit. -- homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From guertin at middlebury.edu Wed Feb 16 23:50:54 2000 From: guertin at middlebury.edu (David Guertin) Date: 16 Feb 2000 23:50:54 -0500 Subject: Where is Imaging.h? Message-ID: Hi folks, Please pardon this python ignoramus, but I'm trying to compile the source for Sketch 0.6.5 on a Red Hat Linux box. Compilation chokes with the error: looking for include dir for Imaging.h under /usr/include/python1.5 Imaging.h not found under /usr/include/python1.5 ! OK, fine, I just need to add a header file that isn't on my system. The thing is, I can't find this header file in any of the Python packages I've been able to find. This system has: $ rpm -qa | grep python python-imaging-1.0b1-3 pythonlib-1.22-5 python-1.5.1-10 python-imaging-_tkinter-1.0b1-3 python-_tkinter-1.5.2-2 python-tkinter-1.5.2-2 python-devel-1.5.2-2 and none of these packages (installed from RPM binaries) contains Imaging.h. I expected to find it in python-devel, but it's not there. Do I need to compile one of these packages from source and set some flag? Thanks, -- Dave Guertin guertin at middlebury.edu From tim_one at email.msn.com Wed Feb 16 00:55:06 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 00:55:06 -0500 Subject: Real Problems with Python In-Reply-To: Message-ID: <000b01bf7842$5fdf2f20$b7a0143f@tim> [Bijan Parsia] > Er..Just out of curiosity, what *can't* you model in Scheme? :) [Tim] > Smalltalk . [Neel Krishnaswami] > I know this is a joke, Shhh! Don't spoil the fun for Bijan . > but wasn't Scheme invented because Sussman wanted to understand > how Smalltalk worked by implementing something like it in MacLisp? > I thought that the Smalltalk and Scheme designers were in regular > communication. I had heard the latter before too, but really don't know. Sure sounds plausible, even likely. Language designers are generally quite friendly with each other! In other lines of business, this would be called price-fixing . "hey-larry-you-put-in-array-context-and-i'll-use-whitespace-for- block-structure"-ly y'rs - tim, possibly quoting 1990 email From aahz at netcom.com Fri Feb 18 20:07:06 2000 From: aahz at netcom.com (Aahz Maruch) Date: 19 Feb 2000 01:07:06 GMT Subject: static class methods in Python? References: <1261276284-11190393@hypernet.com> Message-ID: <88kqbq$9qo$1@nntp6.atl.mindspring.net> In article , Neel Krishnaswami wrote: > >This is probably a stupid question, but what /is/ a class method? >I've never programmed in C++ (or Java), so an explanation would be >appreciated. Class methods are used to access and modify class variables. For example: class foo: bar = None def __init__(self): pass classdef isdone(): if foo.bar is not None: return "!!!" classdef clear(): foo.bar = None Clearer? -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From herzog at online.de Sat Feb 26 10:33:27 2000 From: herzog at online.de (Bernhard Herzog) Date: 26 Feb 2000 16:33:27 +0100 Subject: Just tested Tcl/Tk 8.3.0 with Python: It works (on SuSE Linux)! References: <200002241914.OAA28515@fuseki.aa.ans.net> Message-ID: michael shiplett writes: > "pf" == Peter Funk writes: > > pf> But since the Python test suite currently does nothing with > pf> Tkinter, my testing of the Tkinter/Tcl/Tk 8.3 combo is still > pf> incomplete. > > "gvr" == Guido van Rossum writes: > > gvr> Since Tk is interactive, it's hard to test automatically. > > Just another data point regarding python-1.5.2 + tcl/tk-8.3.0. Last > week I built sketch-0.6.5[1] using the aforementioned releases on > solaris 2.5.1, solaris 7, and linuxppc R5. It's worked without problem > on all three platforms. That's very good news for me! I haven't tried tcl/tk 8.3 myself yet. It should be noted, though, that Sketch uses its own version of _tkinter.so when run under Python 1.5.2 because of thread-related problems with the one that comes with Python. Sketch's own version has some modifications to make it work with tk 8.1, so it's not really a good test for the 8.3 compatibility of Python itself. > michael > > 1. a vector graphics program a la adobe illustrator. for a URL, see my .sig -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From sabren at manifestation.com Sat Feb 12 00:11:54 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sat, 12 Feb 2000 00:11:54 -0500 Subject: const for bytecode optimization... References: <881psn$tbp$1@nntp6.atl.mindspring.net> Message-ID: <882q3k$2jj$1@nntp9.atl.mindspring.net> Michael Hudson wrote in message ... >It is called __debug__: Well, I'll be. Thanks! (you too, Skip) >There's definitely mileage in making the compiler a little cleverer. > >In the mean time, there are a few packages that will do post hoc >optimization; my bytecodehacks package is one, Skip Montanero has >another. I'll have to check that out :) >There's not *too* much mileage here without doing type >analysis/annotation of one sort or another, and that's a *hard* >problem (see December Types-SIG, for instance). I'm curious.. Has anyone else tried writing another language that compiles to run on the Python virtual machine? I would think that if someone did that, they could have all the language features they wanted... and access to everything written in python.. (kinda like JPython does for Java)... -michal http://www.sabren.com/ From jimc at regnoc.com Sat Feb 12 17:15:22 2000 From: jimc at regnoc.com (Jim Conger) Date: Sat, 12 Feb 2000 22:15:22 GMT Subject: dynamic html with python References: <38A57B53.D2A2DE73@regnoc.com> <0002121004350I.02623@quadra.teleo.net> Message-ID: <38A5DB25.E5B9689E@regnoc.com> Merci beaucoup! Jim C. Patrick Phalen wrote: > [Jim Conger, on Sat, 12 Feb 2000] > :: > :: I'm running a linux server with appache for the static web pages. I > :: would like to link from one of these static pages to dynamically > :: generated html from a python script. The script would then take care of > :: both input and html output for that section. I have a number of > :: programming examples of how to generate a simple python http server, but > :: I can't figure out how to launch that activity from within a static html > :: page. > > Take a look at: > > http://www.zope.org > http://www.suxers.de/pmz.htm -- Jim Conger Project Manager Silicon Valley Oil Co. jimc at regnoc.com, 925-842-6729 -------------- next part -------------- An HTML attachment was scrubbed... URL: From poinot at onera.fr Fri Feb 25 07:34:31 2000 From: poinot at onera.fr (Marc POINOT) Date: Fri, 25 Feb 2000 13:34:31 +0100 Subject: No way to reach CXX again ? Message-ID: <38B676D7.28C44F56@onera.fr> I'm trying to dowload CXX (LLNL/ P.Dubois). I've unsuccessfuly tried all the links I had: no way... Any idea? Is CXX dead? Is CXX now private? Marcvs [alias What about this one: a=3.14159 kg=1000 a+kg ] From python at channel21.com Sat Feb 26 17:37:01 2000 From: python at channel21.com (Channel21 Python Team) Date: Sat, 26 Feb 2000 17:37:01 -0500 Subject: Everybody point at the dufus Message-ID: <81DD38F43381D111BA3E00A076A0998A459F6E@XENON> Well, I figured out why I was serving up blank asp pages ... After one of the asplist guys gave me the idea about the com issues w/ sybase, etc... ( I posted that email to this list ) I tried the following: I tried making pages w/ just <%@ Language=Python%> and it worked fine. Then, I imported a few standard modules (string, os, random, time) and it worked fine. I imported one of my modules and it worked fine. But, when I imported any database access modules (or modules which called other db access modules) the pages were blanked... So, I figure I try to import the root db access module (also the same one which all other db access-type modules use before changing default db user) from the command line. Lo and behold, I get an INVALID LOGIN error spit back by SQL. Hmm... why is that? So, I go and nuke the DSN and then add it again, making sure to use the same login and password I have set in the module. Reload module, and bam! INVALID LOGIN again! So, I figure it's not compiling properly, so I should go and manually delete the .pyc file and see what happens... Only problem is there is NO PYC FILE!? This make me do a FIND on all 81G worth of HDD space to fine files matching the module name, and BAMMO - there's the .pyc file (obviously disconnected from the source file) in some completely random directory. I delete the renegade .pyc (and most of all my other non-lib .pyc's), and successfully import the module, and make a db call on it. I reboot the machine and VOILA! The sites are up and running ;) Now, lets hope that IIS doesn't start crashing again... - Jason *blushing* ************************************************** Jason S. Nadler Lead Programmer Channel21 Productions, Inc. ... What are you doing right now? ************************************************** From gerrit.holl at pobox.com Wed Feb 9 16:20:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 9 Feb 2000 22:20:12 +0100 Subject: Real Problems with Python In-Reply-To: ; from neelk@cswcasa.com on Wed, Feb 09, 2000 at 01:56:11PM -0500 References: Message-ID: <20000209222012.A2749@stopcontact.palga.uucp> neelk at cswcasa.com wrote on 950100971: > > 1. Reference counting memory management ... > 2. Lack of lexical scoping ... > 3. Multiple inheritance is unsound ... > 4. Lack of support for highly declarative styles of programming ... > 5. The type/class dichotomy, and the lack of a metaobject system. ... > 6. The iteration protocol ... 7. Error messages spanning multiple LOC $ python sample.py Traceback (innermost last): File "sample.py", line 3, in ? print "this" + \ NameError: oops $ cat sample.py #!/usr/bin/env print "this" + \ "that" + \ oops It should say: Traceback (innermost last): File "sample.py", line 3, in ? print "this" + \ "that" + \ oops NameError: oops regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From 55555 at dakotacom.net Mon Feb 14 21:08:32 2000 From: 55555 at dakotacom.net (55555) Date: 14 Feb 2000 20:08:32 -0600 Subject: os.shell, recursion, encryption References: <38a79bec_3@news5.newsfeeds.com> Message-ID: <38a8b520_2@news5.newsfeeds.com> Thanks for the lesson. It's a little clearer, but now I question whether this can be used for what I want to do. It seems like popen creates a file. I don't want to do that. Instead, I'd like to simply run a commercial program with a command like 'pkzip asdf.zip *.*'. I gave the following a try and it came back with "bad command or filename." Am I on the right path or should I be using a different function than popen? os.system() doesn't work and I don't know what mode to use for spawnv. Thanks again. import os zipExe='c:/progra~1/pkzipdos/pkzip.exe' os.popen('> '+zipExe+' asdf.zip *.*', 'w') On Mon, 14 Feb 2000 20:44:45 GMT, wware at world.std.com (Will Ware) wrote: > 55555 (55555 at dakotacom.net) wrote: > : How does os.popen work? I'm afraid that I don't understand pipes. > > Caveat: I'm a Unix guy, pretty clueless about Windows, and this may > all be Unix-ish stuff. > > When you open a file for reading, the file becomes a source of bytes. > You read the bytes in sequence and there is some testable condition > to tell you when there are no more bytes. Since many files are text, > it's often convenient to take the bytes in lines. So you often see > idioms like this: > > f = open('somefile') > for L in f.readlines(): > .... do something with L .... > f.close() > > or more tersely: > > for L in open('somefile').readliines(): > .... do something with L .... > > In this latter case, the opened file should automatically be closed > when it gets garbage-collected. (Whether that happens, or the > conditions under which it might not, is another question for subtler > minds than mine.) > > In Unix, many programs (particularly ones that operate on text) are > written to look like filters, meaning that they accept a stream of > bytes from elsewhere and produce a stream of bytes that can go to > yet somewhere else. Each such program has "standard input" and > "standard output". Output from one program can be directed to the > input of another, and hence the term "pipe", just like in plumbing. > So you see constructs like this: > filter1 < infile | filter2 | filter3 | filter4 > outfile > And this means that the contents of 'infile' are run thru all four > filters in succession, and the results end up in 'outfile'. > > Python, too, can accept input from a chain of filters, so I can > type something like this: > > p = os.popen('filter1 < infile | filter2 | filter3 | filter4') > for L in p.readlines(): > ... do stuff with L ... > p.close() > > and this means that I want, as input, the stuff that would have > been dumped into 'outfile' in the earlier example. > > Sorry if this seems circuitous and long-winded (and I'm _really_ > sorry if none of this is meaningful in the Windows world), but this > saves you the hassle of creating a bunch of intermediate files to > catch the output at each stage in the pipeline. (Essentially Unix > is creating those files itself and keeping track of them without > bothering you with the details, and they all disappear when you're > finished.) > > I suspect Python would also be happy with an output pipe, something > where you'd be writing to the front of a pipeline like this: > > p = os.popen('filter1 | filter2 | filter3 | filter4 > outfile', 'w') > for : > ... > p.write(....) > p.close() > > but I've never myself written that, that I can recall. > > -- > -- I can picture in my mind a world without war, a world without hate. And -- > -- I can picture us attacking that world, because they'd never expect it. -- > Will Ware - N1IBT - wware at world.std.com -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From effbot at telia.com Mon Feb 28 14:00:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 19:00:33 GMT Subject: Python program examples References: <38BA5DC6.A83448DF@computer.org><20000228132812.A6199@humbolt.nl.linux.org> <38BAC021.1C288F00@computer.org> Message-ID: Eugene Kelly wrote: > > Have you already found the Demo/ directory? > No, I have not found this directory. Where is it hiding? Directions appreciated. look in the Python source distribution (it's also shipped with some binary distributions). also see the Tools stuff (especially Tools/scripts). if you don't have the source distribution, get it from here: http://www.python.org/1.5/ From al_amerin at yahoo.com Sat Feb 5 03:21:43 2000 From: al_amerin at yahoo.com (Al-Amerrho H. Amerin) Date: Sat, 05 Feb 2000 02:21:43 -0600 Subject: errors when doing 'make test' Message-ID: <389BDD96.335C10CC@yahoo.com> I've downloaded the latest CVS snapshot. I was able to compile without any problems and everything seems to be okay. I can run and use python. However, when I do 'make test' as the README says, I get these 2 errors: 2 tests failed: test_types test_long I did the following to determine the exact problem: $ python test_types.py 6. Built-in types 6.1 Truth value testing 6.2 Boolean operations 6.3 Comparisons 6.4 Numeric types (mostly conversions) 6.4.1 32-bit integers 6.4.2 Long integers Traceback (innermost last): File "test_types.py", line 89, in ? if int(long(x)) != x: raise TestFailed, 'long op' OverflowError: long int too long to convert $ $ python test_long.py long / * % divmod long bit-operation identities long str/hex/oct/atol long miscellaneous operations Traceback (innermost last): File "test_long.py", line 257, in ? test_misc() File "test_long.py", line 231, in test_misc raise TestFailed, "int(long(-sys.maxint-1)) overflowed!" test_support -- test failed: int(long(-sys.maxint-1)) overflowed! These errors seem to be related to 'sys.maxint'. In my box its value is: 2147483647 My system: Linux version 2.2.9-27mdk (root at locutus.mandrakesoft.com) (gcc version pgcc-2.91.66 19990314 (egcs-1.1.2 release)) #1 Mon Jun 14 16:44:05 CEST 1999 Detected 350805109 Hz processor. Console: colour VGA+ 80x25 Calibrating delay loop... 699.60 BogoMIPS Memory: 63164k/65472k available (964k kernel code, 408k reserved, 888k data, 48k init) VFS: Diskquotas version dquot_6.4.0 initialized CPU: AMD AMD-K6(tm) 3D processor stepping 0c My python installation: Python 1.5.2+ (#2, Feb 5 2000, 02:07:33) [GCC pgcc-2.91.66 19990314 (egcs-1.1.2 release)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam I hope someone could tell me what's wrong with my installation. Thanks! From python at rose164.wuh.wustl.edu Fri Feb 4 04:58:40 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Fri, 04 Feb 2000 09:58:40 GMT Subject: Running a python script from JAVA, with correct indentation In-Reply-To: References: Message-ID: <20000204.9584017@sparky.spkydomain> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/3/00, 3:12:09 PM, "Alain" wrote regarding Running a python script from JAVA, with correct indentation: > Hi, > I'm trying to run a script from a file. The script is written in python. The > script is a telnet session between a router and a computer. If I run the > script from a DOS prompt window, everything is good. But if I start the > script from my program, using a Runtime object, there's a problem. The > communication between the router and the computer is stop, even if the > telnet session is still open. Here's the JAVA code: [...] > Is there someone have a solution? Well, this is a blind guess without seeing the python code, but are you using os.popen() somewhere? The windows C-runtime has a problem redirecting console i/o if there isn't a console open (like a dos window). So this could describe your problem. Look at the python FAQ for "popen" for more info. When-all-you-have-is-a-hammer-everything-looks-like-a-nail-ly yr's david From sconley at cs.csubak.edu Mon Feb 14 01:21:57 2000 From: sconley at cs.csubak.edu (Sean Conley) Date: Sun, 13 Feb 2000 22:21:57 -0800 Subject: socket troubles Message-ID: <38A79F05.2C2F25B5@cs.csubak.edu> This problem has me completely stumped. I am trying to write a telnet client (actually a mud client) in Python. The problem is that I can connect and read information from the socket, but nothing seems to happen when I send to the socket. I believe it may be a problem with my program, as I had the same problem with Perl/Tk and was unable to solve it there either. So, if anyone has ANY idea why this could be please email me or post here. Forgive any horrible syntax as this is my first attempt at a python program and I am just trying to get the skeleton, and the most important part of the program working before I start cleaning it up. Anyhow, here is the code: #!/usr/bin/python from Tkinter import * from _tkinter import * from socket import * from string import * from re import * #************************* #*** Get input from the socket and post it to the screen #************************* def readsock(*args): data = s.recv(80) #*** Telnet arbitration stuff here if compile(chr(255)).search(data): print "IAC\n" textbox.config(state="normal") textbox.insert(index="insert", chars=data) textbox.see(index='end') textbox.config(state="disabled") #************************* #*** Write to the socket #************************* def writesock(*args): global contents info = contents.get() s.send(info) #************************* #*** Declare some variables #************************* HOST = 'shwaine.mudservices.com' PORT = 3000 #************************* #*** Set up what it looks like #************************* root = Tk() outputscroll = Scrollbar(root) textbox = Text(root) inputbox = Entry(root) outputscroll.config(command=textbox.yview) textbox.config(yscrollcommand=outputscroll, state="disabled") contents = StringVar() inputbox["textvariable"] = contents inputbox.bind(sequence="", func=writesock) inputbox.pack(side="bottom", fill="x") outputscroll.pack(side="right", fill="y") textbox.pack(expand=1, fill="both") s = socket(AF_INET, SOCK_STREAM) s.connect(HOST, PORT) createfilehandler(s, READABLE, readsock) mainloop() From mikael at isy.liu.se Wed Feb 16 10:19:48 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 16 Feb 2000 16:19:48 +0100 (MET) Subject: Where is the Python Journal? In-Reply-To: Message-ID: On 16-Feb-00 Anders M Eriksson wrote: > On Wed, 16 Feb 2000 08:58:17 +0100 (MET), Mikael Olofsson > > www.pythonjournal.org ? > > FOund it at http://www.pythonjournal.com/ Thanks! Why didn't I try that? Sometimes I just don't think. /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: 16-Feb-00 Time: 16:18:23 This message was sent by XF-Mail. ----------------------------------------------------------------------- From lance.shuler at intel.com Wed Feb 2 15:46:34 2000 From: lance.shuler at intel.com (Lance Shuler) Date: Wed, 02 Feb 2000 12:46:34 -0800 Subject: Installer Beta3f, and pythoncom, pywintypes Message-ID: <389897A9.6D9DB75C@intel.com> Hi, I looked on Gordon's website and the searched Dejanews and haven't found the answer yet. So, here goes... I am trying to freeze a python code that accesses Excel using Windows COM. In Beta 3f, I am getting errors that were not present in Beta 3e. In 3f, I am getting an error in bindepend that it cannot analyze c:\winnt\system32\pythoncom.dll nor c:\winnt\system32\pywintypes.dll. Of course these two files don't exist, except in "xxx15.dll" form. Here are diffs from the a 3f logfile and a 3e logfile: 302,303c300,301 < ('pywintypes', 'c:\\winnt\\system32\\pywintypes.dll', 'b'), --- 3f Builder.log --- < ('pythoncom', 'c:\\winnt\\system32\\pythoncom.dll', 'b'), --- > ('pywintypes', 'c:\\winnt\\system32\\pywintypes15.dll', 'b'), --- 3e Builder.log --- > ('pythoncom', 'c:\\winnt\\system32\\pythoncom15.dll', 'b'), It appears that others have seen this in the newsgroup. My question is what is the workaround to put in my ".cfg" file to allow me to continue to build the exe correctly? For Windows COM, do I just need to revert to Beta 3e? Thanks, Lance From tim_one at email.msn.com Sun Feb 20 18:13:33 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 18:13:33 -0500 Subject: Test (ignore): Python mailing list may be down Message-ID: [Tim] > From my POV, mail to python-list at python.org may have been broken all > weekend. > > testing-from-oe-ly y'rs - tim [Gordon McMillan [mailto:gmcm at hypernet.com]] > You're coming through on the mail list. > At least "Re: Could embeded Python echo evaluation?" (Feb 20) > did, the last before that was "RE: Miscellaneous design and > Python use questions" on Feb 18. > > low-on-winks-myself-ly y'rs Yes, the "echo" msg was posted from Outlook Express via the newsgroup route, as was the test msg to which you replied here. All test msgs mailed to python-list at python.org (via a variety of origins) have gone the bit-bucket route. Msgs I mailed after Friday midnight eventually bounced back with a "connection timed out" error. A test msg posted from DejaNews just came thru on the list too. So, tentative conclusions: + Mail->News has been busted all weekend. + News->Mail is working. mailers-beware-ly y'rs - tim From boud at rempt.xs4all.nl Thu Feb 3 11:48:13 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 3 Feb 2000 16:48:13 GMT Subject: Python/Tkinter GUI builders? References: <6D8A17398E28D3119F860090274DD7DB498484@pces.cadlab.it> Message-ID: <87cbgd$hbg$1@news1.xs4all.nl> Alessandro Bottoni wrote: > I'm looking for a GUI Builder for Python/TKinter. In the Vaults of Parnassus > I discovered the (very interesting) project of Henning Schoder: ViPyl ( see > http://vipyl.sourceforge.net/ ). Unfortunately, ViPyl is at an early > development stage at the moment and cannot be used for real programming. > Does anybody knows of any other GUI Builder for TKInter? Not only that, but Vipyl uses PyKDE, not TkInter... -- Boudewijn Rempt | http://www.valdyas.org From robin at jessikat.demon.co.uk Fri Feb 25 12:53:01 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 25 Feb 2000 17:53:01 +0000 Subject: Tkinter: changing colour of scrollbars on Windows References: <+qeJ5DALRjt4EwlZ@jessikat.demon.co.uk> Message-ID: In article <+qeJ5DALRjt4EwlZ at jessikat.demon.co.uk>, Robin Becker writes ... >I think Tk now uses scrollbars and they aren't aren't colourable the ^ native :( >same way as they used to be. -- Robin Becker From thomas at bibsyst.no Thu Feb 10 10:37:32 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 10 Feb 2000 16:37:32 +0100 Subject: code to parse a file References: <000e01bf73d6$c481cde0$6c00a8c0@ruidovisual.pt> Message-ID: <38A2DB3C.8F9E4E44@bibsyst.no> > Pedro Silva wrote: > > Hi > > I had write some code in a Python Method, a Zope Product, that will > open a file and will read line-by-line and check if some string is in > that line, if yes, it will return the line to a variable. > The code I write is: > > f=open('/var/spool/news/articles/esoterica/geral/1','r') > for lines in f.readline(): > if string.find('From:'): > from=lines > if string.find('Subject:'): > sub=lines > if string.find('Date:'): > date=lines > if string.find('Xref:'): > f.seek(0,2) > for text in f.read(): > cont=text > return from,sub,date,cont > > Is this code correct to do what I pretend? > If not, can anyone help me to solve this? > > Please send your answers to: psilva at ruido-visual.pt > > Thanks, > > Pedro If I`m not mistaken, your posting is written in, or at least sent as, HTML. Not smart when posting to newsgroups. I don`t actually care, but you`ll get alot of flak from text-based-newsreading-hardcore kinda people. And most people, probably the same group, will not bother to send answers directly to your email adress, but send it all to the newsgroup. I`ve tried this and that`s how I know. ;-> Did I answer your python-question? Well .... Thomas From echuck at mindspring.com Mon Feb 28 09:06:10 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Mon, 28 Feb 2000 09:06:10 -0500 Subject: Wash. D.C. Area: DCPIGgies, Mar. 13 References: <14504.29126.591718.912874@goon.cnri.reston.va.us> Message-ID: <38BA80D2.AFEDC97E@mindspring.com> Can we add to the agenda: * Changing the name from "piggies" to something more respectable. :-) -Chuck Jeremy Hylton wrote: > Notice to all Washington DC area Python users: > > We will be having our first DCPIGgies (DC Python Interest Group) > meeting of the year on Monday March 13, 2000 from 7:30pm to 9:00pm at > CNRI in Reston, Va. > > Speaker: Scott Cotton > > Static Type and Interface Checking for Python > General Review and Fundamental Decisions > > Abstract > ---------- > This presentation reviews various possible ways of adding static type > checking to python. The problem poses two questions: > > 1) What sort of static type checking system would be most > appropriate for python? > 2) By what means may static type checking be made optional? > > A decision tree for each question is presented based on a combination > of type theory, an understanding of python, and properties that have > become apparent in the development of a sample type checking system. > Finally, we discuss some overall approaches that would maximize the > benefits and/or minimize the drawbacks of adding optional static type > checking to python. > > Scott will be speaking from 8:00 to 9:00pm. We will have food and > introductions starting at 7:30pm. We may also have some time after > the talk for Q&A with Guido and Barry on Python and JPython. > > Pizza, salad, and soda will be provided courtesy of Foretec Seminars. > Please RSVP by email to jeremy at cnri.reston.va.us. I need to know how > many people will attend and how many will be eating pizza. > > Directions to CNRI can be found on the Web: > > http://www.cnri.reston.va.us/directions.html > > Mailing list: There is a mailing list for people interested in > DCPIGgies meetings; see http://www.python.org/mailman/listinfo/dcpiggies. > This is a low volume list for announcing meetings, arranging to share > rides, and other thrilling PIGgy topics. > > See you there! > Jeremy From bob at staff.cs.usyd.edu.au Thu Feb 10 01:32:06 2000 From: bob at staff.cs.usyd.edu.au (Bob Kummerfeld) Date: 10 Feb 2000 17:32:06 +1100 Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> <38A24345.3F763311@lugoj.com> Message-ID: <87tm16$e2@staff.cs.usyd.edu.au> The language/system "boxer" did something like this. Bob. -- From m.faassen at vet.uu.nl Tue Feb 29 16:16:51 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 29 Feb 2000 21:16:51 GMT Subject: Worthless (was RE: functional programming) References: <000e01bf8193$d9b8b640$f0a2143f@tim> Message-ID: <89hd03$pc2$1@newshost.accu.uu.nl> > [Moshe Zadka] >> disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. > [Tim] >> it's-only-half-as-scary-if-you-think-we're-the-same-ly y'rs - tim Ah, a clear hint Tim is Moshe, as I was already suspecting. :) But you're wrong, that _would_ be scary. [Tim] > It's probably trying to make Python a language sufficiently powerful to > counteract the evil machines, so that machines and humans destroy each other > completely, and it alone is left in charge of comp.lang.python. And how do the whitespace eating nanovirii fit into this? The PSU would like to know. PSU-what-is-that-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From tismer at tismer.com Tue Feb 1 07:29:33 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 01 Feb 2000 13:29:33 +0100 Subject: Stackless Python 1.0 + Continuations 0.6 References: <86f8uu$3ds$1@kopp.stud.ntnu.no> <388BDEFA.8D57A66F@tismer.com> <388C91E1.500B272A@hassler.de> <388EB066.3DACCDEE@tismer.com> <012001bf6b52$bf5d3430$0100a8c0@rochester.rr.com> Message-ID: <3896D1AD.5058B081@tismer.com> Howdy, let me try to give some hints. Well, I see I have to build a tutorial/FAQ at some time :-) Darrell wrote: > > """ > Great job Christian. > It sure can speed up deep recursive functions. That's for one. The real advantage is that you can switch contexts, regardless how deeply they are nested. This lets you write collaborating tasks which can talk to each other without having to save/restore contexts. In other words: You can combine algorithms as coroutines. > What are the chances this will make it into python 1.6 ? No idea. They are not 0 and not 1. Guido didn't definately say no, but asked me how hard it would be to include this version as #ifdefs. I think there is just no decision yet, and I'll carry on improving and maintaining the code. There is a good chance that Stackless becomes the enabling technology for a Palm port of Python, and that is a very good argument for at least some #ifdef solution. I would use conditional compilation for the few involved modules, where the changes are not so much. For ceval.c, I wouldn't do that but provide a second file instead. There are so many changes that #ifdefs would be very confusing. I wrote the stuff in order to replace ceval.c while making minimum changes, but after all I'd prefer to take the freedom to reorganize it, in order to get it more readable. Currently the files are still diffable. This will vanish, in favor of readability and maybe a couple more optimizations. > The following is excerpts from the Stackless distribution. > With some comments and mods to help me understand. > Let me know if I'm way off or if this should have been an attachment. > """ > import continuation, time > > get_caller = continuation.caller > > def nS2(n): > """ > Not limited by stack depth. > """ > # Causes a GP if no parms passed. This one is solved. The GP was a bug in update which didn't check if the frame had a node object. In your case, it doesn't exist in the first place, and update should behave as a no-op. Works now. > # If given a 1 cont would point up on in the call stack/chain ? > cont=get_caller(0) > # I feel an ignorant statement coming on. > # Using "cont" instead of "call" is an optimization. > # cont assumes that when called it doesn't have to > # return to it's caller. So a deep recursion doesn't have > # to keep a stack to return to each level. The final return > # at some depth, is the final returned value. Right. The dfault continuation behavior on being called is to jump. To make it into a call, it's call attribute can be used. This is all just stuff to speed up things. Usually you don't need these extras. There are also jump_cv and call_cv atributes, for the common situation that you don't only want to jump passing a value, but passing the source continuation as well. cont, value = contobject.jump_cv(42) jumps to contobject's continuation, passing the continuation at "=" and the value 42 as a tuple. We expect that at some time someone jumps back to us, using the same protocol. call_cv is even more useful, since for building generators you are often asking for the current caller by continuation.caller() or contobject.caller(), and this can be done in one step with the call_cv trick. > call=cont.call > # Each call to cont arrives at this point. > # And k is assigned to the current value of n with update(n) > # If you had used n it would always be the original value. > k=cont.update(n) Actually, the update method is a trick to cope with continuations in the same frame. There is no problem with continuations from other frames since they have some useful state. But cont stems from cont = get_caller(0) (btw, this is now avaliable as continuation.current()) so it has the state from that assignment. This is very useless, since we don't want to repeat the assignment of the continuation. k = cont.update(n) updates the state of cont to exactly this assignment of a value. For convenience, we pass n as the start value, and it goes directly through update into k. But when we call cont later, this value comes from elsewhere :-) > if k: > # This won't return so "print msg" is never called > # if "call(k-1" had been used it would have printed the msg. > cont(k-1) > msg=""" > This isn't printed when cont is used. Using cont > doesn't experience stack depth limits. > > This is printed when call is used. > Using call runs slower and has the same limits > as a normal recursive function. > """ Right, despite the fact that it can be much faster than true recursion, since all local variables are already bound. All recursive incarnations see the same locals, and they behave more like fast globals. Reminds be a little of good old Fortran :-) Well, it's a matter of taste and just a fact, not a feature. Frame-recursion is just possible, but no recommended style, probably. But it works and was a good stres test to push the limits of my implementation. > # ====================================================================== > # coroutine > # ====================================================================== > """ > This was hard to understand. > """ Actually, this module is due to Sam Rushing, with minor changes of mine. It was hard for me to understand as well, most probably since Sam and I seem to have different points of view. I would do it "the other way round", very similar to the generator classes which I did (modelled after the threads generator of Tim Peters). But this is a matter of taste again, and the coroutines are as fast as the generators. This is one reason why I was reluctant to include Gen's and Co's as C versions in the first place: There are so many possibilities to implement them, that I'd like to collect some implementations of other people, until "the way to do it" has settled. Then we will make them inot permanent C versions. Thanks for all the comments. I think it would make sense to add this as some "examples.py" to the distribution. If you have worked on further, can I please have a copy? > class coroutine: > > current = None > caller_of_this = continuation.caller > > def __init__ (self, f, *a, **kw): > self.state = lambda v,f=f,a=a,kw=kw: apply (f, a, kw) > self.caller = None > > def resume (self, value=None): > caller = coroutine.current > caller.state = self.caller_of_this() > self.caller=caller.state > self.caller = caller > coroutine.current = self > # If you tracing this call will runaway. > self.state (value) > > def kill (self): > self.__dict__.clear() > > def resume_caller (value): > me = coroutine.current > me.caller.resume (value) > > def resume_main (value): > _main.resume (value) > > _main = coroutine (None) > coroutine.current = _main > > if __name__ == '__main__': > # counter/generator > > def counter (start=0, step=1): > n = start > while 1: > print 'A:',n > resume_caller (n) > n = n + step > print 'B:', n > > """ > It's surprising that cc.resume() returns a value. > Guess it's related to the lambda in the __init__ ?? > Need an experiment. > Prints: > A: 0 > 0 > B: 1 > A: 1 > 1 > B: 2 > A: 2 > 2 > > The second resume takes us back to the "print 'B:'" > Then back to the "print A:" > It's as though the counter functions are in separate threads. > And resume or resume_caller is a blocking message pass. > """ > cc = coroutine(counter) > print cc.resume() > print cc.resume() > print cc.resume() > > # same-fringe > def _tree_walker (t): > if type(t) is type([]): > for x in t: > _tree_walker (x) > else: > """ > Passes control back to same_fringe > tree_walker and _tree_walker are in the same pseudo thread. > """ > resume_caller (t) > > def tree_walker (t): > _tree_walker (t) > print 'Returns None causing the caller to exit' > resume_caller (None) > print 'Never prints' > > def same_fringe (t1, t2): > co1 = coroutine (tree_walker, t1) > co2 = coroutine (tree_walker, t2) > while 1: > leaf1 = co1.resume() > leaf2 = co2.resume() > """ > tree_walker searches finds a result and calls resume_caller(t) > which passes back the result. It's printed then cox.resume() > continues the search. tree_walker is waiting to continue the > search. > """ > print 'leaf1: %s leaf2: %s' % (leaf1, leaf2) > if leaf1 == leaf2: > if leaf1 is None: > return 1 > else: > return 0 > > print same_fringe ( > [0,1,[2,3],[4,[5,[6]],7,[[[[8]]]],9]], > [[[0,1],2,[3,[4],[5]],[[6],[7]],8],9] > ) > > -- > http://www.python.org/mailman/listinfo/python-list -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 tismer at tismer.com Thu Feb 24 14:46:12 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 24 Feb 2000 20:46:12 +0100 Subject: Continuations and threads (was Re: Iterators & generators) References: Message-ID: <38B58A84.3D0F7F0D@tismer.com> "Samuel A. Falvo II" wrote: > > In article , Tim Peters wrote: > >The latter are more powerful, but that's not really the attraction. > >Continuations are both fast and space-efficient compared to threads on most > >platforms. Read Christian's paper! You'll find, e.g., that his simple > >implementation of generators using continuations ran 3x faster than a simple > >implementation using threads (& on a platform that does a relatively good Thanks Tim, yes this is true. > This is because the operating system switches threads, not the application. > At worst case, it does so on an every so often (time-slicing). At best > case, it will put a thread to sleep as soon as the OS sees that it can't > possibly proceed any further without a message or event from another thread. > > Continuations, however, are entirely user-space constructs. There's no > user-to-kernel-to-user transitions involved. So of course they're going to > be faster when run under such a system. Until here I agree. > Now, implement an operating environment that uses continuations natively, > and you'll find it'll be no faster than using threads. Why? Because the > continuation functions are stuff away in kernel-space (otherwise, they > wouldn't be "native" to the operating system). Misconception, sorry. Nobody claimed that they need to be "native" to the operating system. Instead, they are made native to the environment, in this case the Python machine. > Because continuations are inherently language specific. If languages like C > and its ilk used indirect stack frames (instead of embedded stack frames), > continuations in C would be more than possible, and threading would be far > easier. Billy and I had a discussion on this topic the other day, in fact. So what? Language specific, or native to operating system? I'm not sure if we are both talking about the same thing. ... > Why can't Python's threads package use OS-native threading API, assuming one > exists? It does. Threads are good. But for not hardware dependent problems, mine are smaller and faster. [Tim] > >space, while a continuation will usually suck up only a few hundred bytes. > > What is your basis for this conclusion? An execution context is an > execution context is an execution context -- the amount of information which > is required to be stored is going to be roughly equal no matter what. In > fact, continuations will consume more space than a pure thread specifically > because a function's "frame" isn't stored on "the stack." Thus, something > somewhere must maintain a reference to it. Then consider that there can be > several "continuation objects," where each object stores a branch of the > frame tree within it. Well, if you know better... :-) A continuation in Python is not much more than a frame, below 300 byte, and it can be made smaller. It does not capture the hardware state, but Python's VM state. That makes a big difference, since they are always captured in some defined VM state, in the context of a function call or between execution of opcodes. This needs a very small amount of information. Even a frame is too much in principle, but it was the most obvious way to implement it. You may disagree, but while I'm writing this, there is a Python script in the background, running 1000-2000 continuation driven small tasks on my notebook. Really :-) ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 12163 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 bittneph at aston.ac.uk Fri Feb 11 08:36:55 2000 From: bittneph at aston.ac.uk (Peter Bittner) Date: Fri, 11 Feb 2000 13:36:55 +0000 Subject: What does str(...) do? Message-ID: <38A41077.9BDAE248@aston.ac.uk> Hi there! I've seen print '....' + str(text) + '...' in some code (in a function definition). What does this 'str(...)' really do? - Is it absolutely necessary?? Peter | Peter H. Bittner | International Student at Aston University | e-mail: bittneph at aston.ac.uk | web: http://beam.to/bimbo +-------------------------- From vonbrand at sleipnir.valparaiso.cl Sun Feb 20 09:26:45 2000 From: vonbrand at sleipnir.valparaiso.cl (Horst von Brand) Date: Sun, 20 Feb 2000 11:26:45 -0300 Subject: Silly brackets (Was: Re: Problems extending Python with C.) In-Reply-To: Message from "Martin v. Loewis" of "Sun, 20 Feb 2000 11:55:38 BST." <200002201055.LAA00737@loewis.home.cs.tu-berlin.de> Message-ID: <200002201426.e1KEQj216931@sleipnir.valparaiso.cl> "Martin v. Loewis" said: > > I believed, for years, that C compilers should have an option to > > emit warning diagnostics when indentation is not consistent with > > brackets. It is a big waste, in my opinion, that compilers ignore > > all that redundancy, while it could be used to better help > > programmers. > One of the problems is that C uses a preprocessor, which often does > funny things to indentation, making the notion of column number > meaningless to preprocessor output. Combine this with the common > approach of implementing the preprocessor as a separate process, and > you'll see that what you want is very hard to implement. What matters is the source before preprocessing, and there a program like indent is enough to highlight real structure (and thus expose this class of bugs), possibly coupled with a diff to the original to find them. -- Horst von Brand vonbrand at sleipnir.valparaiso.cl Casilla 9G, Vi?a del Mar, Chile +56 32 672616 From cgw at alum.mit.edu Fri Feb 11 12:01:37 2000 From: cgw at alum.mit.edu (cgw at alum.mit.edu) Date: Fri, 11 Feb 2000 11:01:37 -0600 Subject: problem with setrlimit on Linux 2.2? References: <14499.7397.57420.918651@buffalo.fnal.gov><87vbhs$4tp$1@info3.fnal.gov> Message-ID: <881f9h$qpb$1@info3.fnal.gov> Please ignore last two messages, I figured out what I was doing wrong. With soft limit < hard limit, setrlimit behaves as it should. Sorry for the noise on the list. From sholden at bellatlantic.net Thu Feb 24 12:56:13 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 24 Feb 2000 17:56:13 GMT Subject: how would Dan Quayle spell python? References: Message-ID: <38B570BD.525F614E@bellatlantic.net> Shouldn't that last line read: print 'P'+y+'TH'+o+'NE ', perhaps? regards Steve Warren Postma wrote: > > > Get Chaucerian, win valuable prizes! Extra points if none of > > your posts spells it the same way as any other. > > # misspell.py > Y = [ 'Y', 'IE', 'AE', 'IEA', 'IEAY', 'IY', > 'HIY', 'HAEY', 'HAIEU', 'AIE', 'HY', 'HYHY' ] > O = [ 'O', 'AW', 'AEW', 'oW', 'AWY' ] > for y in Y: > for o in O: > print 'P'+y+'TH'+o+'N ', -- "If computing ever stops being fun, I'll stop doing it" From sabren at manifestation.com Fri Feb 11 14:01:46 2000 From: sabren at manifestation.com (Michal Wallace) Date: Fri, 11 Feb 2000 14:01:46 -0500 Subject: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> <20000211073300.A711@stopcontact.palga.uucp> Message-ID: <881mb3$4bh$1@nntp6.atl.mindspring.net> Gerrit said: >Let me add two characters, and it's totally valid. > >if ( foo > bar ): > do_something(); > do_something_else(); > done(); >#endif hmm.... I think I may have an answer once and for all... #### file: wba.py ##### """wba : a module for whiney block addicts""" endif = "" #### ### your python program #### from wba import endif if (5>7): # let's hope this never gets printed print "five is greater than seven" elif (5==7): # this too: print "today, five equals seven.." else: print "yay! five is still less than seven!" endif print "that was fun!" ### eh? -michal http://www.sabren.com/ From daniels at mindspring.com Wed Feb 16 19:46:14 2000 From: daniels at mindspring.com (Alan Daniels) Date: 17 Feb 2000 00:46:14 GMT Subject: Moving from perl to python: questions References: <38AAB0ED.D9603D2F@austin.ibm.com> Message-ID: On Wed, 16 Feb 2000 08:15:09 -0600, the infinitely wise David R. Favor (dfavor at austin.ibm.com) spoke forth to us, saying... [snip...] > 1) Best way to convert array argv[1:] into string to pass functions Easiest way to get all the lines in a file in one shot is: lines = open("some_file.txt").readlines() Wether you want to wrap this in a function to gracefully catch any exceptions (such as the file not existing) is up to you. > 2) How to implement a no-frills file slurp() function A quick way to do a Perl-style chomp (I've used this before in production code and it seemed to work well enough): def chomp(x): while x != "" and x[-1] in "\r\n": x = x[:-1] return x Hope this helps. -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From tim_one at email.msn.com Thu Feb 24 22:56:06 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 24 Feb 2000 22:56:06 -0500 Subject: (no subject) In-Reply-To: <20000224195930.9372.qmail@nwcst281.netaddress.usa.net> Message-ID: <001101bf7f44$3e5932c0$b62d153f@tim> [Def P] > ... > I still don't understand the benefit of string methods > over oldfashioned string functions... The string functions aren't going away, so feel free to ignore string methods if they don't appeal to you. At heart, I think they were driven by the upcoming introduction of a new Unicode string type. Python 1.6 no longer has *a* string type, it's got two. Viewing the various string operations as abstract methods on a variety of concrete string types is natural and appealing, while (possibly) adding a pile of new string *functions* that work sensibly *only* on Unicode strings (e.g., titlecase, byte-order mark fiddling, who knows?) would be unnatural and unappealing. Special methods in a subclass are natural. Using string methods certainly "looks different" at first, but the implementation has been available for several months (in the CVS development tree), and people who have *used* string methods uniformly report that they quickly come to like them (btw, "space.join(list)" is gorgeous!). So give 'em a try, or stop whining . in-the-end-guido-is-simply-mysterious-ly y'rs - tim From MSteed at altiris.com Thu Feb 17 10:47:45 2000 From: MSteed at altiris.com (Mike Steed) Date: Thu, 17 Feb 2000 08:47:45 -0700 Subject: Ann: gdchart 0.3 Message-ID: <65118AEEFF5AD3118E8300508B124877073D8A@webmail.altiris.com> Hi, I put up a new version of my Python interface to Bruce Verderaime's GDChart library. Version 0.3 adds support for missing data sets. The source archive includes the GDChart library, the Python interface, makefiles for Win32, Linux, and Solaris, and a precompiled Win32 binary: http://members.xoom.com/msteed/software/gdchart-py-0.3.tar.gz If you just want the Win32 binary and test script, you can get: http://members.xoom.com/msteed/software/gdchart-w32bin-0.3.zip The Vaults of Parnassus entry should be updated soon. Mike Steed From arcege at shore.net Thu Feb 3 08:33:35 2000 From: arcege at shore.net (Michael P. Reilly) Date: Thu, 03 Feb 2000 13:33:35 GMT Subject: Q: Py_InitModule References: <8760ee$u2t$1@nnrp1.deja.com> Message-ID: rerwig at my-deja.com wrote: : On learning on ho to write extension modules, I : found the piece of information below: : Module documentation string : By far the easiest, add a character string : argument to the end of Py_InitModule. : void : initmodname() : { : static char modname__doc__[] = "\ : This module contains some functions, : constants and maybe a type."; : (void)Py_InitModule("modname", methods, : modname__doc__); : } : However, compiling it produces an warning as : Py_InitModule only expects 2 parms, not 3. : What am I missing? You need to call Py_InitModule3() for a 3-argument call. (void)Py_InitModule("modname", methods, modname__doc__); That's what you get when you proof your own work. I've corrected the existing online documentation already. My apologies. -Arcege From 2jerry at writeme.com Mon Feb 21 20:25:58 2000 From: 2jerry at writeme.com (Jerry) Date: Tue, 22 Feb 2000 02:25:58 +0100 Subject: well Message-ID: <88sod7$cut$1@wanadoo.fr> I just unzip PIL on python directory, copy _tkinter.pyd and _imaging.pyd in python base directory then add \pil15b2\imaging in the PYTHONPATH variable .. you can verify it using the IDLE: open it then : import sys then : for f in sys.path: print f sure , if import image doesn't work .. that simple but, elsewhere can you detail the unsuccess symptomatics ? maybe something more difficult ... Jerry the foolish dracomorpheus, alias j?r?me VACHER. From infonuovo at email.com Sat Feb 12 20:26:52 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Sat, 12 Feb 2000 17:26:52 -0800 Subject: Please do not Bcc: ListServers In-Reply-To: Message-ID: I notice that I seem to receive some python-related messages via the list server yet I must be receiving a Bcc rather than a To: or Cc. The only problem with that is that my mailbox rules don't kick in. I can repair that, but it would work more easily if I knew the addressing that had the message get to me, especially when I don't know any of the explicitly-named people! Thanks, -- orcmid -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Alex Sent: Saturday, February 12, 2000 15:15 To: jean at stat.ubc.ca Subject: Re: delays in python The time.sleep function accepts float's, doesn't it? E.g. time.sleep (0.5) should put your program out for half a second. Alex. -- http://www.python.org/mailman/listinfo/python-list From aahz at netcom.com Thu Feb 10 20:20:30 2000 From: aahz at netcom.com (Aahz Maruch) Date: 11 Feb 2000 01:20:30 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262152524-5049647@hypernet.com> <38A33AD9.3F4EA190@americasm01.nt.com> Message-ID: <87vo4u$kau$1@nntp6.atl.mindspring.net> In article <38A33AD9.3F4EA190 at americasm01.nt.com>, Eaglestone, Robert [NGC:B918:EXCH] wrote: > >There must be a reason or rationale between 1) the ubiquity of >bracketed syntax, and 2) Python deliberately omitting it. That is: >there is a reason Python doesn't use it, and it must be a big one or >else it just would have used bracketing. I want to know what this >compelling reason is! There is, but if we told you, we'd have to kill you. More seriously, it's pretty clear that you have not been carefully reading comp.lang.python for the last couple of weeks. The short answer is that Guido has experience with one of the few projects (ABC) to really do some in-depth user testing to find out what makes a language easy to read (NOTE: *not* easy to write). Python is the result of that experience. -- --- 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 Nostalgia just ain't what it used to be From tjreedy at udel.edu Sat Feb 19 14:35:04 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 19 Feb 2000 14:35:04 -0500 Subject: name-spaces and loading a file References: <8766vn2ijn.fsf@curious.eyeofdog.com> Message-ID: <88mr39$7ne$1@news.udel.edu> "Alex Shinn" wrote in message news:8766vn2ijn.fsf at curious.eyeofdog.com... > I'm working on an interactive story engine with the primary purpose of > making it easy for non-programmers to write story modules. A story > would be comprised of a collection of files, each describing a scene, > like the following: ... Suggestions (emailed and posted): 1. Separate initial processing of input text from run-time use of compiled internal version so you can optimize different data forms for different operations (writing versus running). 2. Allow more than one scene per system file (easy if you do 1.); little files take up extra space (especially on Win95 with 32K disk blocks) and can be a nuisance to work with. Some authors may prefer to have related scenes, if not all, in one file for easier editing. 3. Compile input text to either dictionary or scene class instance (former may seem initially easier, but latter bundles scene methods within scene class). In other words, exec just once before running. 4. Store scene objects in one runtime file with marshall or pickle and shelve (which you can use as an external dictionary). 5. To make interaction instantaneous: keep scenes when moving to another; prev_scene = cur_scene After displaying graphic and text, read the possible next scenes. This will finish before a person can read and respond. Then prompt for what to do. -- (Optional, after or instead of above) To reduce disk access further, keep a cache of scenes (100 say depending on size and memory), deleting the least most recently used when reading another off the disk. This is a pretty standard algorithm; python code was posted a couple of years ago and might be findable via DejaNews. Terry J. Reedy From wilrader at my-deja.com Tue Feb 22 01:12:04 2000 From: wilrader at my-deja.com (wilrader at my-deja.com) Date: Tue, 22 Feb 2000 06:12:04 GMT Subject: New User Message-ID: <88t9bi$bjo$1@nnrp1.deja.com> I'm new to Python and I was wondering if someone could tell me how do to it and where I can get UNDERSTANDABLE tutorals. Sent via Deja.com http://www.deja.com/ Before you buy. From robin at jessikat.demon.co.uk Thu Feb 24 19:41:05 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 25 Feb 2000 00:41:05 +0000 Subject: Just tested Tcl/Tk 8.3.0 with Python: Some problems remain. References: Message-ID: In article , Peter Funk writes >Hi! > >Some challenging hours ago I wrote: >> Subject: Just tested Tcl/Tk 8.3.0 with Python: It works (on SuSE Linux)! >[...] >> I've just installed and build the Tcl/Tk 8.3.0 combo from source and >> tested it together with a rather recent Python CVS tarball (Feb 10th, >[...] >> But since the Python test suite currently does nothing with Tkinter, >> my testing of the Tkinter/Tcl/Tk 8.3 combo is still incomplete. >[...] > >But the Pmw (python mega widgets) Toolkit, current version is >0.8.3, contains a rather long and decent test suite called All.py, >which used to run without error on Python 1.5.2 with Tcl/Tk 8.0.5. >This test suite stresses also many parts of the underlying Tk-Subsystem. > >Unfortunately this test crashes the interpreter during the combobox >test with the following back trace (shortened here): > >Program received signal SIGSEGV, Segmentation fault. >0x401812bf in FreeResources () from /usr/local/lib/libtk8.3.so >(gdb) >(gdb) bt >#0 0x401812bf in FreeResources () from /usr/local/lib/libtk8.3.so >#1 0x401810d4 in Tk_FreeConfigOptions () from /usr/local/lib/libtk8.3.so >#2 0x401b546b in DestroyListbox () from /usr/local/lib/libtk8.3.so >#3 0x402722c3 in Tcl_EventuallyFree () from /usr/local/lib/libtcl8.3.so >#4 0x401b65e7 in ListboxEventProc () from /usr/local/lib/libtk8.3.so >#5 0x40183424 in Tk_HandleEvent () from /usr/local/lib/libtk8.3.so >#6 0x40199332 in Tk_DestroyWindow () from /usr/local/lib/libtk8.3.so >[...] >#54 0x8079482 in PyEval_EvalCode (co=0x80db5d8, globals=0x80ac7e0, > locals=0x80ac7e0) at ceval.c:324 >#55 0x805d48e in run_node (n=0x80ab188, filename=0xbffff14d "./All.py", > globals=0x80ac7e0, locals=0x80ac7e0) at pythonrun.c:891 >#56 0x805d43c in run_err_node (n=0x80ab188, filename=0xbffff14d "./All.py", > globals=0x80ac7e0, locals=0x80ac7e0) at pythonrun.c:876 >#57 0x805d408 in PyRun_File (fp=0x80a9ae8, filename=0xbffff14d "./All.py", > start=257, globals=0x80ac7e0, locals=0x80ac7e0) at pythonrun.c:864 >#58 0x805cb07 in PyRun_SimpleFile (fp=0x80a9ae8, > filename=0xbffff14d "./All.py") at pythonrun.c:574 >#59 0x805c759 in PyRun_AnyFile (fp=0x80a9ae8, filename=0xbffff14d "./All.py") > at pythonrun.c:455 >#60 0x804fa23 in Py_Main (argc=2, argv=0xbfffee84) at main.c:294 >#61 0x804f500 in main (argc=2, argv=0xbfffee84) at python.c:12 > >May be someone else feels eager to reproduce this on his personal >platform? Or investigate this further in more detail? ;-) >Or eager to forward this experience to the Tcl/Tk people? > >Regards from Germany, Peter I'm using pmw 0.8.1 with tcl/tk8.3 on win32 and don't seem to get this with any of the combobox demos. Which combobox demo and what exactly caused the problem -- Robin Becker From mlh at idi.ntnu.no Tue Feb 29 16:04:44 2000 From: mlh at idi.ntnu.no (Magnus Lie Hetland) Date: Tue, 29 Feb 2000 22:04:44 +0100 Subject: Phython as In-Game scripting language References: <20000224155917.81782.qmail@hotmail.com> <38B9A3C6.9CFA5FF8@sightreader.com> Message-ID: <89hc9g$kno$1@kopp.stud.ntnu.no> It seems that threading is an issue - or running multiple interpreters... What about embedding a Java interpreter - and using JPython? Then that would not be a problem, would it? And you could even have several scripting languages... (With a JIT the speed would probably be comparable too... However - I don't know how easy it is to embed a Java JIT... :) -- Magnus Lie Hetland magnus at hetland.org From gerrit.holl at pobox.com Wed Feb 16 10:22:57 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 16:22:57 +0100 Subject: is this a Python bug? In-Reply-To: <88eb8h$pcb$1@news1.tc.umn.edu>; from brian@brian.cbs.umn.edu on Wed, Feb 16, 2000 at 02:12:33PM +0000 References: <88eb8h$pcb$1@news1.tc.umn.edu> Message-ID: <20000216162257.B963@stopcontact.palga.uucp> Brian Langenberger wrote on 950706753: > piet at cs.uu.nl wrote: > :>>>>> Moshe Zadka (MZ) writes: > > : MZ> On 15 Feb 2000, Brian Langenberger wrote: > :>> R is supposed to work to give raw strings with the backslashes stored > :>> as backslashes. I've never had a problem until I tried making a > :>> string with nothing but backslashes. > > : MZ> Raw strings cannot end with a backslash. > > : They can. But only with an even number of them. > > I'm assuming there's some clever and important reason for this. > But for the life of me I can't figure out what it is. > Could someone enlighten me as to the reason? :) http://www.python.org/doc/current/ref/strings.html When an `r' or `R' prefix is present, backslashes are still used to quote the following character, but all backslashes are left in the string. For example, the string literal r"\n" consists of two characters: a backslash and a lowercase `n'. String quotes can be escaped with a backslash, but the backslash remains in the string; for example, r"\"" is a valid string literal consisting of two characters: a backslash and a double quote; r"\" is not a value string literal (even a raw string cannot end in an odd number of backslashes). Specifically, a raw string cannot end in a single backslash (since the backslash would escape the following quote character). regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From thamelry at vub.ac.be Wed Feb 9 04:22:45 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 9 Feb 2000 09:22:45 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> <38A0497E.FC5CA78C@prescod.net> Message-ID: <87rbl5$chc$3@mach.vub.ac.be> Fredrik Lundh wrote: [snip] : (after all, Python 1.5.2 do have certain shortcomings. : how come these "I've never used Python, but I'm the : right person to tell you what to change" folks never : spot any of these?) [snip] Well, shall we continue the thread with a discussion on reference counting and circular references? Naaah, I'll go back coding. In Python, BTW. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From gmcm at hypernet.com Fri Feb 11 10:52:12 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 11 Feb 2000 10:52:12 -0500 Subject: Python aka. Smalltalk Lite? In-Reply-To: Message-ID: <1261838168-23956935@hypernet.com> Cliff Crawford wrote: > Pada Fri, 11 Feb 2000 07:27:12 GMT, Fredrik Lundh bilang: > | > | seriously, what are the major shortcomings in Python > | from a Smalltalk professional's perspective? > | > | let's see: > | > | -- no blocks (lambda doesn't really cut it) > | -- type/class dichotomy (CPython implementation) > | -- no garbage collection (CPython implementation) > | > | what else? > > It's not as easy to play with metaclasses in Python. But that isn't > needed too often in Real Programs anyway..:) That goes with "class / type dichotomy" - it's part of reforming the object model. The current scheme is an acknowledged hack; but there's little agreement on what the model should be. - Gordon From aahz at netcom.com Mon Feb 21 18:50:56 2000 From: aahz at netcom.com (Aahz Maruch) Date: 21 Feb 2000 23:50:56 GMT Subject: Killer Apps References: <88rvhm$efe$1@nntp6.atl.mindspring.net> <20000221214622.D4076@stopcontact.palga.uucp> Message-ID: <88sj10$rmj$1@nntp6.atl.mindspring.net> In article <20000221214622.D4076 at stopcontact.palga.uucp>, Gerrit Holl wrote: > >> In article , >> Hirsch, John wrote: >>> >>>I've always thought that Tim Peters was Pythons killer app.. >> >> No, the Timbot is Python's app killer. > >Er... please explain! Do you mean tabnanny.py? Or is it my English >lacking here? Well, it was a bit of a colloquialism, but it was mainly just a joke (made be swapping the two words) that Tim is always poking holes in other people's ideas. explaining-jokes-is-never-funny-ly y'rs -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From tjuricek at ucsd.edu Sun Feb 20 14:31:48 2000 From: tjuricek at ucsd.edu (Tristan Juricek) Date: Sun, 20 Feb 2000 19:31:48 GMT Subject: Setting up Emacs to use python References: <38AF819A.1849E465@ucsd.edu> <38AFD35C.470DC34F@python.net> Message-ID: <38B040A9.15176AEC@ucsd.edu> Thank you, this works wonderfully. -Tristan "Thomas A. Bryan" wrote: > Tristan Juricek wrote: > > > > I've just installed Linux on my computer and I'm interested in setting > > up Emacs for use with Python. Being new at both Emacs and Python, I'm a > > little unclear on what I need to do. In case it's not a quick answer, > > does anybody know of a good set of documentation on this subject? > > It would help if you mentioned which Linux distribution and version you > have. In any case, the following instructions are fairly generic. > Note that in Emacs speak, C-x means "hold the control key while > pressing the x key." C-x f means "hold the control key while pressing > the x key and then release the control key to press the f key." > C-x C-f means "hold the control key while pressing the x key and then > hold the control key while pressing the f key." If that explanation > wasn't clear to you, try reading the Emacs tutorial by pressing > C-h t or by selecting it from the Help menu. > > Try to save some effort since python-mode may have come with your > distribution. Start emacs, and type > M-x locate-library > python-mode > It will say something like /usr/share/emacs/site-lisp/python-mode.el > if it can find Python-mode on your system. > You can also open a Python file to check to see whether Python mode > is being activated: > emacs & > (in the emacs application, type) C-x C-f test.py > The buffer status line should look something like > --:-- test.py (Python)--L1--All---------------------- > If it instead looks like this > --:-- test.py (Fundamental)--L1--All----------------- > then Python mode is not installed or not properly configured. > If you don't see such a status line, you can always get a brief > description of all the currently active modes by pressing C-h m. > See whether Python mode is listed in the modes *Help* buffer. > > (optional step) > You may have 'locate' or 'slocate' on your machine. To check > whether you already have python-mode.el installed somewhere on > your machine. Try running something like this > locate python | grep 'el$' > That locates all files with python in the name that end in 'el'. > It's generally called python-mode.el, but it could be something > like python.el. If it's already on your system, then open > the file to see what version it is. The current version is 3.105. > > If necessary, download python-mode.el from > http://www.python.org/emacs/python-mode/python-mode.el > and read the instructions available at > http://www.python.org/emacs/python-mode/installation.html > > Generally, there is at least one directory on your system where > emacs will automatically look for byte-compiled modes and such. > In an emacs window (also called a frame, by the way), type > M-x describe-variable > load-path > Emacs should open a new buffer with an explanation of the load-path > variable and its current value. One or more directories generally > have the name site-lisp in them. If necessary, move python-mode.el > into one of those directories. For example, on a Red Hat 6.0 system, > something like this should work. > mv /path/to/downloaded/python-mode.el /usr/share/emacs/site-lisp/ > > Then follow those instructions on the python web site, something like > C-x C-f /usr/share/emacs/site-lisp/python-mode.el RET > M-x byte-compile-file RET > M-x locate-library RET python-mode RET > C-x C-f ~/.emacs RET > (Add the following lines to the end of your .emacs file.) > ;;; For Python mode > (setq auto-mode-alist > (cons '("\\.py$" . python-mode) auto-mode-alist)) > (setq interpreter-mode-alist > (cons '("python" . python-mode) > interpreter-mode-alist)) > (autoload 'python-mode "python-mode" "Python hacking mode." t) > ;;; add these lines if you like color-based syntax highlighting > (global-font-lock-mode t) > (setq font-lock-maximum-decoration t) > > Now, close emacs (C-x C-c) and reopen emacs. > Open a buffer > C-x C-f test.py > Check that you're in Python mode (see above). > Learn *all* of the features of Python-mode by typing > C-c ? > to open a buffer with 684 lines describing the mode. > > it's-easier-than-it-sounds-ly yours > ---Tom From wlfraed at ix.netcom.com Tue Feb 15 23:26:43 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Tue, 15 Feb 2000 20:26:43 -0800 Subject: OT: Celebrating Python References: <38A5AAB4.5F56B3A0@digicool.com> <884dhj$l0a$1@nntp6.atl.mindspring.net> <14504.12483.890085.354771@weyr.cnri.reston.va.us> <38A9DAEE.F66E05C6@bellatlantic.net> Message-ID: On Tue, 15 Feb 2000 23:03:22 GMT, Steve Holden declaimed the following in comp.lang.python: > "Time flies like a banana": description or imperative? > You might be missing one option (since there are three ways to read that old phrase), or it may fall under one of the categories given... A command to make some measurement of time for the flies as one would measure the banana A reference to "time" "flying" in a manner similar to a banana flying A reference to some odd insect species "Time fly" which is partial to a certain overripe fruit -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From skip at mojam.com Wed Feb 9 17:27:48 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 9 Feb 2000 16:27:48 -0600 (CST) Subject: command line editing In-Reply-To: <38A1E664.3CEAF4BF@be-research.ucsd.edu> References: <3898ABDB.86804799@home.com> <389A3E61.47E255A0@home.com> <38A1E664.3CEAF4BF@be-research.ucsd.edu> Message-ID: <14497.59876.572847.234317@beluga.mojam.com> Curtis> Would it be possible to include a history ability into the Curtis> Python interpretor? Something simmilar to the BASH shell, or Curtis> doskey in DOS. Up-Arrow prints the previous command. I think Curtis> this would be a great new feature. If you use a Unix-like operating system and have GNU readline handy, this is already available (also see the rlcompleter module). Later on (probably after 1.6), one thought is to have the interactive command loop coded in Python so that you can more easily add this sort of stuff. In the meantime, take a look at the source to the code module, especially the InteractiveConsole class. You may be able to mangle it to do command history. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From gerrit.holl at pobox.com Fri Feb 11 16:06:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 11 Feb 2000 22:06:12 +0100 Subject: Except an exception AND all its subclasses? Message-ID: <20000211220612.A7720@stopcontact.palga.uucp> Hello, it's not possible to catch an exception and all its subclasses as of python 1.5.2, is it? I think this would be a nice feature for a future version of Python. What do you think? regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From ullrich at math.okstate.edu Wed Feb 16 11:41:48 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Wed, 16 Feb 2000 10:41:48 -0600 Subject: "Real" problem... References: <38A99C34.109D34BB@math.okstate.edu> <88cj4s$erh@gap.cco.caltech.edu> Message-ID: <38AAD34C.66D4F92@math.okstate.edu> Thanks - actually I found the correct link elsewhere. Robert Kern wrote: > In article <38A99C34.109D34BB at math.okstate.edu>, > "David C. Ullrich" writes: > > Well, this time I started at python.org, and sure enough > > I found what I was looking for, an arbitrary-precision > > floating point package. > > > > Or so it seemed - Netscape and urllib.urlretrieve both whine > > about 'cannot find file or directory'. What I'm looking for is > > > > ftp://ftp.python.org/pub/python/contrib/Math/real-accurate.pyar > > > > , which is a link I found at > > > > http://www.python.org/topics/scicomp/numbercrunching.html > > The link is broken. See > http://www.python.org/download/Contributed.html for information on the > anonymous ftp archive policy (it changed recently). > > The correct link is > ftp://ftp.python.org/pub/python/contrib-09-Dec-1999/DataStructures/real-accurate.pyar > > > . Thanks. > > > > DU > > -- > 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 manny at budget.net Wed Feb 16 17:00:54 2000 From: manny at budget.net (Manny) Date: Wed, 16 Feb 2000 22:00:54 GMT Subject: IDLE, ALT-M and Packages Message-ID: <38ab1b18.3494965@news.chatlink.com> I added the following chunk o' code to IDLE 0.4, and just re-added it to IDLE 0.5, so I thought I'd put it up and see what anyone else thinks of it. This allows loading files in packages with ALT-M It does not, however, run the file quite correctly. For example, loading 'Package.Sub' and pressing F5 just gets you 'Sub' whereas 'import Package.Sub' imports Package, then Sub nor does it verify it's actually part of package. But it may be of convenice to anyone working with a package. --Manny ------------------------------- In open_module (line 310 in Idle 0.5): replace: (f, file, (suffix, mode, type)) = imp.find_module(name) with if('.' in name): nl = string.split(name,'.') path = apply(os.path.join,nl[:-1]); path_list = map(os.path.join,sys.path,[path]*len(sys.path)); name = nl[-1]; (f, file, (suffix, mode, type)) = imp.find_module(name,path_list); else: (f, file, (suffix, mode, type)) = imp.find_module(name) From gerrit.holl at pobox.com Tue Feb 22 16:55:22 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 22:55:22 +0100 Subject: Life's better without braces In-Reply-To: <88utem$gfr$1@nntp6.atl.mindspring.net>; from aahz@netcom.com on Tue, Feb 22, 2000 at 09:01:10PM +0000 References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> <88utem$gfr$1@nntp6.atl.mindspring.net> Message-ID: <20000222225522.A5923@stopcontact.palga.uucp> > In article <20000222213539.C4549 at stopcontact.palga.uucp>, > Gerrit Holl wrote: > > > >> > >> [2] I occasionally think about this problem. The setup: GvR was far > >> too profligate in adding functions to bltinmodule.c that could have > >> been written in pure Python instead. So, how many built-in functions > >> can you re-implement in pure Python? > > > >These are possible: > > > >abs, callable, chr, delattr, divmod, > >execfile, filter, getattr, hex, input, int, isinstance, issubclass, > >len, list, long, map, max, min, oct, range, raw_input, reduce, reload, > >repr, setattr, tuple, vars. > > > >These aren't: > > > >apply, buffer, coerce, compile, complex, dir, eval, exit, globals, hash, > >id, intern, locals, round, slice, type, xrange > > Hmmm? What makes you say that range() is possible in pure Python and > xrange() is not? (I think the latter requires a class with __getitem__ > but is otherwise doable.) xrange returns an XRangeType; can I return that from a Python function? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From claird at starbase.neosoft.com Mon Feb 28 07:44:30 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Feb 2000 06:44:30 -0600 Subject: does opensource move faster with python? References: <38BA3E82.6BCD84F8@sightreader.com> Message-ID: In article <38BA3E82.6BCD84F8 at sightreader.com>, Ken Seehof wrote: >Michal Wallace (sabren) wrote: . . . >In any case, python numbers are growing exponentially. There's >a new book about every month, and the IPC8 python conference >had double last years showing. The factor was actually larger, almost frighteningly so: something in the range of 2.4. > >> ARE there projects out there using python as a prototyping language >> with the possible intention of discarding it eventually and rewriting >> in C? Yes. 'Happens all the time. > >I doubt it, though it would certainly be possible. > >I can't think of any situation where I would use python purely as a >prototyping language, and then discard the python. Except in very >unusual cases, there really isn't any disadvantage in a final product >being written in multiple languages. On the contrary there are many While I'm one of the world's most extreme advocates of multi-language development, it certainly has its disadvantages. The first to constrain progress often is institutional rejection. We're working on that, of course. . . . >The whole process goes 4 to 7 times faster in Python than in C or C++ >depending on whose estimates you look at. My measurements have >indicated only about 4 to 1 development speed improvement, but that >was after 12 years of C++ experience and about 2 months of Python >experience. I'm sure the ratio has increased for me since then but I I like to repeat measured data, whenever I find it. . . . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From tim_one at email.msn.com Fri Feb 11 21:39:10 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 11 Feb 2000 21:39:10 -0500 Subject: How to do line wrapping? In-Reply-To: <38A43E31.F6530D17@rubic.com> Message-ID: <001001bf7502$577f2d00$622d153f@tim> [Jeff Bauer, line-wrapping code] > ... > Both Brad and Hamish wrote their own. I used the standard > formatter.py module. I'm wondering if formatter.py is > unpopular because it's a less well-known module or if > the documentation needs clarifying or if it's just > unwieldy for simple wordwrap tasks. It's a continuing problem in Python: new users especially get excited over how easy it is to build frameworks for solving whole classes of problems "once & for all". Then they discover nobody uses their code: it's often easier in Python to write a special-case solution from scratch than to figure out how to use a framework, some of which are so overly general that it can be hard even to see that your current problem is an instance! This isn't "a problem" so much as that it's delightful -- consider the alternatives . christian's-"stackless-python"-considered-a-framework- so-general-even-guido-can't-see-its-obvious-value-ly y'rs - tim From mwh21 at cam.ac.uk Fri Feb 25 09:48:02 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Feb 2000 14:48:02 +0000 Subject: Life's better without builtins? (was: Life's better without braces) References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> <38B691AD.BDB4DD5F@endea.demon.nl> Message-ID: Niels Diepeveen writes: > Gerrit Holl schreef: > > > > > > > [2] I occasionally think about this problem. The setup: GvR was far > > > too profligate in adding functions to bltinmodule.c that could have > > > been written in pure Python instead. So, how many built-in functions > > > can you re-implement in pure Python? > > > > These are possible: > > > > abs, callable, chr, delattr, divmod, > > execfile, filter, getattr, hex, input, int, isinstance, issubclass, > > len, list, long, map, max, min, oct, range, raw_input, reduce, reload, > > repr, setattr, tuple, vars. > > Do you have some source code of this? I can't think of a way to do > reload() or tuple(). Think module.__file__ & exec for reload. Something like def reload(module): exec open(module.__file__[:-1]).read() in module.__dict__ return module I agree about tuple though. Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From tim_one at email.msn.com Thu Feb 24 22:39:54 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 24 Feb 2000 22:39:54 -0500 Subject: Comparing perl and python In-Reply-To: Message-ID: <000f01bf7f41$fae9eea0$b62d153f@tim> [Aahz Maruch[ > Best description I ever heard [of Perl] was "`sed' on crack". [Fran?ois Pinard] > Even if I am a Python lover now, I'm a previous Perl addict, and Perl was > not that bad[1]. So, even if humorous, such judgements are derogative > and unfair, and we should stay more open minded. No way -- this newsgroup has a Zero Tolerance policy for drugs . Frankly, I expect Larry Wall would be tickled by the "sed on crack" description. Just as Guido would be by calling Python "Perl on Thorazine". > ... > I just hope that Python will learn from, and avoid Perl social mistakes. > That would not be an easy challenge, if Python starts growing too fast... Well, c.l.py has high tolerance for bad taste, even extending to humorous wordplay that can be perceived as derogative and unfair (Monty Python would approve). It has low tolerance for flaming, though, and that appears to be key. People withdraw from overly contentious threads here just a tad or two beyond the point where they *start* becoming flamewars, letting them die or moving them off the group. Doesn't hurt to remember that everyone was a newbie once, too. c.l.py-is-c.l.p.m-on-quaaludes-ly y'rs - tim From dascher at mindspring.com Thu Feb 3 14:28:33 2000 From: dascher at mindspring.com (David Ascher) Date: Thu, 3 Feb 2000 11:28:33 -0800 Subject: Mark Hammond & David Ascher, ActiveState, Python world domination Message-ID: <002701bf6e7c$dbb7d040$c355cfc0@ski.org> For those of you who weren't at the 8th International Python Conference, I'd like to share a bit of news. As the press release below explains, Mark Hammond and I have been hired by ActiveState to work on Python-related projects, and ActiveState has joined the Python Consortium. Today is my first day in my new job, so it seems fitting to write a little about what it will entail and why I took this job. I discovered Python about five years ago. Since then, I've used Python in my day-job as a scientist, but, as most of you know, it's hard to resist the pull, and over the years I put more and more time into Python-related things, such as co-authoring Learning Python with Mark Lutz, developing training courses for Python and JPython, doing consulting gigs, and otherwise contributing to the Python effort (although the word 'effort' sounds so, well, effortful!). After a long period of rumination, I decided that I was really having too much fun doing Python things, so a change in career was called for. At about the same time, Dick Hardt approached me about the possibility of a job at ActiveState, which I knew only as a company that did Perl on Windows. Clearly, Dick isn't silly enough to think that I would be useful in that particular product line =). So, why did I decide to take that particular job rather than other Python-based jobs (yes, they are out there!)? There are at least four reasons. 1) I expect to have a lot of fun doing Python-related things full-time. Those of you who are in that position tell me it's fun, and I believe it. I also expect to enjoy discovering Vancouver and Canada, which is an intriguing notion to me given my Franco-American background. 2) ActiveState's involvement in Python is good news for the Python world. There are several aspects to that, from the straightforward, such as ActiveState's joining the Python Consortium, to the more strategic. ActiveState is a successful company which has credibility among large corporations; that we as a company are investing in Python for the long term is a significant (IMO) boost to Python's credibility among some decision-makers. I hope that it makes the job of Python advocates everywhere somewhat easier. 3) We have exciting plans for Python-related tools and services. ActiveState is in the business of helping people be more productive with their programming environments, and we have several projects in mind which, if we do our job right, will make Python users happier and more productive. While I can't discuss many of the specifics, I can say that our plans include Windows and non-Windows platforms, and several open source projects. 4) ActiveState is a growing company, and it's going to be fun and challenging to help build it up. One of the challenges there will be to leverage the multi-language and multi-platform expertise in the company. So far, the Perl folks and the Python folks are getting along just great. Some have asked me in email what this means for my current public Python projects, particularly Snow, PyOpenGL and Python training. - Snow is on hold indefinitely. I've received several encouraging comments about the quality of the output, and expressions of frustration about the installation process. The former I am proud of, the latter I acknowledge -- Snow was a good experiment in design, and quite a learning experience. As such it needs to be redone from the ground up before it can be foisted on unsuspecting souls, and I'm not going to have the time needed to do so in the foreseeable future. If someone wants to take over the task of building a very high quality plotting framework in Python, let me know and I'll share my experience on the topic. (Step 1: find three spare months; ...) Data representation is still a topic that I care about deeply, so I might "thaw" Snow in the future. - PyOpenGL is ongoing and alive, although I would like to publically acknowledge that Randall Hopper has been doing most of the maintenance work in the last few months, and his help is greatly appreciated. I'm trying to convince him to take that project over, as his daily use of the tool makes him a better choice as project lead. Regardless, PyOpenGL will continue. - I am no longer offering Python/JPython training, but I would like to encourage budding trainers out there -- there are fun opportunities available for anyone who'se willing to stand up and teach Python programming. Python's clean design really does make the teacher's task much easier! Finally, I'll naturally continue to be involved in other projects, such as NumPy, as a participant of the Open Source development process. What does this mean for Mark Hammond, PyWin32, Pythonwin, etc? Well, I won't presume to speak for Mark, so I'll just let him write his own thoughts on the topic. Cheers, and thanks to everyone involved for making Python such a great language! --David Ascher The press release follows: ACTIVESTATE ADDS PYTHON TO SUPPORTED LANGUAGES AND JOINS THE PYTHON CONSORTIUM Vancouver, January 26th, 2000. ActiveState announced today, at the 8th International Python Conference, Arlington, Virginia, that it will support Python, as it moves into additional open source scripting tools. ActiveState has joined the Python Consortium as part of its commitment to support and promote Python. "I'm very happy that ActiveState has joined the consortium and I'm looking forward to working with them on future Python developments," said Guido van Rossum, Creator of Python. This new ActiveState initiative has seen two prominent Python Developers join the ActiveState team. David Ascher, active Python contributor, co-author of the O'Reilly publication "Learning Python" and accomplished Python Consultant and Trainer and Mark Hammond, co-author of Python COM support, current maintainer and release manager for all Python for Windows extensions and co-author of "Python Programming on Win32". David will relocate shortly to ActiveState headquarters in Vancouver from his current San Francisco base, while Mark will continue to be based in Melbourne, Australia. "I'm thrilled that, after 5 years of involvement, I'll be able to focus full time on Python," said David. "ActiveState's involvement in Python is welcome. Python keeps growing and a corporation can devote significant resources to tackling development in areas that may not be high on the minds of individual contributors." "We have big plans for our contribution to the Python effort," continued Mark. "ActiveState believes that Python has a very bright future and we are committed to providing the same support and services to Python users as are currently offered to the Perl Community." "Out of all things that could happen to Python in 2000, this would top my list," said Paul Everitt, CEO Digital Creations and creators of Zope. "While ActiveState's renown makes this a legitimizer for Python, their expertise fills in the last missing piece for the Python story." Dick Hardt, ActiveState CEO, attending the conference commented, "The addition of Python skills at ActiveState allows us to focus on a range of scripting solutions, providing a significant step in the company's future growth." For further information please contact DickH at ActiveState.com From sholden at bellatlantic.net Sun Feb 13 16:02:21 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sun, 13 Feb 2000 21:02:21 GMT Subject: Flamage's good for your health! References: <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> <20000212224414.I477@xs4all.nl> <20000213112534.M477@xs4all.nl> Message-ID: <38A71BA6.E52E6809@bellatlantic.net> Forget it wrote: > > x-no-archive: yes > Thomas Wouters wrote: > > Hm, Python is a great language to teach stupid people. You do run the risk > > they might actually _learn_ something, though. I've seen it happen, it's not > > always pretty. > Ah, perhaps you're right. After all, no user complained so far, it's I > who doesn't like the language for my own reasons. Decisions, > decisions... Humility becomes you. Try it again: you might find the results more productive than juvenile baiting. Hope you find the language you want - and don't forget, you CAN put semicolons after Pythin statements. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From rumjuggler at home.com Tue Feb 8 20:25:41 2000 From: rumjuggler at home.com (Ben Wolfson) Date: Wed, 09 Feb 2000 01:25:41 GMT Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: On Wed, 09 Feb 2000 01:15:11 GMT, cjc26 at nospam.cornell.edu (Cliff Crawford) wrote: >Pada Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen bilang: >| I fear that this question has already been asked, but is there and >| equivalant one line command that is equivalant to the C command: >| >| a = x > y ? x : y > >a = (x > y and [x] or [y])[0] Isn't this actually wrong? -- Barnabas T. Rumjuggler For the world, I count it not an inn, but an hospital, and a place, not to live, but to die in. -- Thomas Browne From boud at rempt.xs4all.nl Tue Feb 8 13:32:12 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 8 Feb 2000 18:32:12 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> <87omh2$lfi$1@oravannahka.helsinki.fi> <87p8ab$9l0$1@news1.xs4all.nl> Message-ID: <87pnfc$q5s$1@news1.xs4all.nl> Vadim Zeitlin wrote: > On 8 Feb 2000 14:13:31 GMT, Boudewijn Rempt wrote: >>For what I understand from the wxGrid documentation, the wxWindows >>grid isn't editable, at least not in-place. > This is not entirely true. The old wxGrid class didn't support in-place > editing, indeed, but it was editable: it used a text control positioned near > the top of the grid to edit the contents of the selected cell (quite > convenient, in fact). > However the upcoming wxWin 2.2 release will contain the new wxGrid class > (which is already in the cvs and is being actively debugged right now) which > does support in-place editing, has model-view architecture (thus you don't > have to copy the contents of millions cells in memory, but only need to > provide the values for those which are displayed) and quite a few other nice > features. That sounds cool! I did take a look at the latest documentation available from the wxwindows website (indeed, I went to the length of again trying to install the whole system, too), and it still showed the old edit-box-on-top-of-the-grid widget. I'll go off badgering Troll Tech for a decent grid again, now ;-), just to retain parity... -- Boudewijn Rempt | http://www.valdyas.org From mwh21 at cam.ac.uk Wed Feb 16 14:57:47 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 16 Feb 2000 19:57:47 +0000 Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> Message-ID: While we're at it, I've just noticed that some things aren't string methods that you might expect to be. The heuristic: >>> for i in dir(string): ... if i in dir(""): continue ... if type(getattr(string,i)) not in [types.FunctionType]: continue ... print i produces: atof atoi atol capwords center expandtabs joinfields ljust rjust splitfields zfill atof/atoi/atol I can understand - use float/int/long instead. splitfields, joinfields and zfill were obsolete anyway. That leaves capwords, center, ljust, rjust and expandtabs. Is there a reason for their omission? just-curiously-ly y'rs Michael "Fredrik Lundh" writes: > Adrian Eyre wrote: > > I suspect, however, that JPython has this already implemented, > > so this is unlikely to change in CPython. > > don't know about JPython, but it's definitely implemented > in the current CPython code base. > > > Doesn't really bother me too much. It just feels like a kludge. > > it isn't, when compared to the alternatives. > > > And the similarity of index() and find() makes me feel that one > > should be redundant (probably the one which returns -1). > > like getattr/hasattr, you mean? > > From tjg at avalongroup.net Fri Feb 18 13:53:46 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Fri, 18 Feb 2000 10:53:46 -0800 Subject: Review of the new TK book from Manning? Message-ID: <38AD953A.F89C5515@exceptionalminds.com> Is there anyone out there who can provide a review of the new Tkinter book that was just published by--I believe Manning? Thanks. -- Stand Fast, tjg. Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From bkc at Murkworks.com Thu Feb 3 08:57:45 2000 From: bkc at Murkworks.com (Brad Clements) Date: Thu, 3 Feb 2000 08:57:45 -0500 Subject: "Python Programming on Win 32" available References: <3898b54c.1949600@news.btx.dtag.de> <87aigo$jv8$1@news.vanderbilt.edu> Message-ID: Waa! I ordered it months ago.. Now I have to remember who from.. Ahh, found it. I ordered it on 8/30/99 from O'Reilly. Time to track this down. -- Brad Clements, bkc at murkworks.com "Jonathan Gilligan" wrote in message news:87aigo$jv8$1 at news.vanderbilt.edu... > I ordered it from fatbrain today and am told that it shipped this afternoon. > > "Stefan Franke" wrote in message > news:3898b54c.1949600 at news.btx.dtag.de... > > Is the book available already? Amazon.com says "ships within 2-3 > > days." > > > > Stefan > > > > > > From embed at geocities.com Wed Feb 9 10:52:54 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 10:52:54 -0500 Subject: small python implementation or python subset ? References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> Message-ID: On Windows, Python15.dll contains everything you need to embed Python in another C program, and that DLL on on my system is quite small enough already, 558K. Why not statically link the equivalent of that to your program? The Python.exe on my system appears to merely call Python15.dll, and is 5k in size. On Unix, I am not sure why it would be larger. Hmm. Warren From exarkun at flashmail.com Thu Feb 24 13:24:04 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Thu, 24 Feb 2000 18:24:04 +0000 Subject: Threads and classes Message-ID: <38B57744.21491DBA@flashmail.com> Which of the following is better/prefered, or is the absolutely no difference? thread.start_new_thread(SomeClass.someMethod, (someInstance,)) or thread.start_new_thread(SomeInstance.someMethod, ()) Thank in advance Jp -- 1.79 x 10^24 furlongs per picofortnight - It's not just a good idea, It's the law! -- 6:20pm up 22 days, 52 min, 1 user, load average: 0.07, 0.06, 0.06 From backov at nospam.csolve.net Fri Feb 25 14:01:35 2000 From: backov at nospam.csolve.net (Jason Maskell) Date: Fri, 25 Feb 2000 19:01:35 GMT Subject: Win2k and Python access violation - please help me out here! References: <1260623840-9876921@hypernet.com> Message-ID: gmcm at hypernet.com (Gordon McMillan) wrote in <1260623840-9876921 @hypernet.com>: >Jason wrote: > >> Oops, I missed 3 lines at the top of the call stack: >> >> NTDLL! 77f8ed61() >> NTDLL! 77f8ecf1() >> MSVCRTD! 10238575() > >Are you using python15.dll or python15_d.dll? Mixing run time >libraries is a great way to crash. Using the debug dll. Just for fun, I changed over to the release version and compiled it. Same problem. The release side is using all release dlls. Cheers, Jason From dworkin at ccs.neu.edu Sat Feb 26 15:24:15 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 26 Feb 2000 15:24:15 -0500 Subject: Converting a floating point number to a string In-Reply-To: kurtn@my-deja.com's message of "Sat, 26 Feb 2000 20:07:59 GMT" References: <899bqt$udk$1@nnrp1.deja.com> Message-ID: kurtn at my-deja.com writes: > As the subject says I would like to convert a floating point number > to a string >>> str(0.1) '0.1' -Justin From emile at fenx.com Thu Feb 10 22:20:46 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 10 Feb 2000 19:20:46 -0800 Subject: How to get rid of the space after 'print',? References: <38A34DFE.7B286DD@aston.ac.uk> Message-ID: <06a901bf743f$03391ee0$01ffffc0@worldnet.att.net> ----- Original Message ----- From: Peter Bittner Newsgroups: comp.lang.python To: Sent: Thursday, February 10, 2000 3:47 PM Subject: How to get rid of the space after 'print',? > Hi there! > > I'm writing HTML-code with the print statement as follows: > > print '' > print '
Author:', # ,= no newline here > print '' # or put a function call here... > > Between and I want _no_ space, but Python automatically > inserts one. - How can I force Python not to do this?? > > Please, e-mail! > > Kipis! # I don't know the Nederlands' "cheers", sorry! :o) > Peter -------- proost! ------ > > | Peter H. Bittner > | International Student at Aston University > | e-mail: bittneph at aston.ac.uk > | web: http://beam.to/bimbo > +-------------------------- > -- > http://www.python.org/mailman/listinfo/python-list > Emile van Sebille emile at fenx.com ------------------- From sabren at manifestation.com Sun Feb 13 22:51:23 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 13 Feb 2000 22:51:23 -0500 Subject: c++ callbacks and thread safety References: <885r3l$r3n$1@nntp9.atl.mindspring.net> Message-ID: <887u4n$mo4$1@nntp9.atl.mindspring.net> I wrote in message <885r3l$r3n$1 at nntp9.atl.mindspring.net>... >I gather that I need to do some kind of thread checking here... but I don't >understand what to do. I tried putting Py_BEGIN_ALLOW_THREADS >and Py_END_ALLOW_THREADS in various places, but that didn't seem >to help... Besides, I'm just guessing now, and I want to understand... Can >someone tell me what I'm doing wrong, or perhaps point me in the right >direction? Thanks! :) Never mind! :) I spent a good 20 hours tearing my hair out this weekend and it works just fine now. :) After looking at the Thread-SIG archives, I totally understand why questions about this fall on dead ears... It's just an all around mess. Maybe I'll write a HOWTO... -Michal From sholden at bellatlantic.net Fri Feb 25 12:05:15 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 17:05:15 GMT Subject: functional programming References: Message-ID: <38B6B649.1B4436A5@bellatlantic.net> Moshe Zadka wrote: > > > [Steve Holden's remarks about tail recursion] > > Yes: the definition of "full dynamic context". > You're not objecting that in > > for i in range(10): > if i>8: > raise ValueError() > > The dynamic context does not include the context for i=0,...,8 > > But you do claim that in > > def tail(n): > if n>8: > raise ValueError > if n==10: > return > return tail(n+1) > tail(0) > > The dynamic context includes that for i=0,...,8 > > Why? Probably because I find it easier to mentally unfold iterations than recursions when decoding a traceback. Point taken. > > I will repeat my claim, that no one except someone expecting > tail-optimization does "return f(x)". > Well, I *might* infer from this you are trying to claim that everyone who writes "return f(x)" expects tail-optimization, whereas I suspect many people who write that aren't even aware that such a thing exists :-) Still, as long as it's only an optimization, and thus doesn't occur unless the optimizer comes into play I don't see much to disagree about. > but-it-doesn't-mean-it's-worth-it-ly y'rs, Z. > -- > Moshe Zadka . > INTERNET: Learn what you know. > Share what you don't. thinking-maybe-I've-followed-Z's-sig-too-closely-ly y'rs - Steve -- "If computing ever stops being fun, I'll stop doing it" From mwh21 at cam.ac.uk Mon Feb 28 12:06:08 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Feb 2000 17:06:08 +0000 Subject: A comp.lang.python code snippet archive? (was: Re: Fun w/ lazy streams (was RE: functional programming)) References: <000001bf80bf$72946560$7da2143f@tim> Message-ID: chris patti writes: > Wouldn't it be awfully neat if there were, say a website with all > the code snippets ever posted to comp.lang.python? It's That Bloody Time Machine Again (tm): http://tor.dhs.org/~zephyrfalcon/snippets/ It's not *every* snippet, but it's a lot of them. Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From money at gettingpaidonline.cjb.net Wed Feb 9 12:03:00 2000 From: money at gettingpaidonline.cjb.net (Receive a check every month for doing nothing!) Date: Wed, 09 Feb 2000 17:03:00 GMT Subject: receive a monthly paycheck for surfing the web Message-ID: <8ed5.a942.226@wabbytwax> http://gettingpaidonline.cjb.net From jjlucsy at concentric.net Tue Feb 22 18:37:25 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Tue, 22 Feb 2000 18:37:25 -0500 Subject: Multiple ExtensionClass References: <88v35e$2d2$1@wanadoo.fr> Message-ID: You miss the point, I'm writing the classes in C, not Python. I'm using the ExtensionClass library from Zope. "Jerry" <2jerry at writeme.com> wrote in message news:88v35e$2d2$1 at wanadoo.fr... > Sorry to borrow you but I tried the example to see that strange behaviour: > I write this : > >>>class A: > def fa(self): > print "func fa" > > >>>class B(A): > def fb(self): > print "func fb" > > >>>a=B() > >>>a.fb() > func fb > >>>a.fa() > func fa > > What is wrong that work properly ... do you miss the self for the class > methode ? > the trace back is significant : > raceback (innermost last): > File "", line 1, in ? > a.fa() > TypeError: no arguments expected > > best regard, Jerry the foolish dracomorpheus, j?r?me VACHER - france - > > Joel Lucsy a ?crit dans le message ... > >I've figured it myself (just takes time). Basically I use the > >PURE_MIXIN_CLASS macro in ExtensionClass. Since the result is an > >uninstantionable I wrapped a Python class around them. I'll be releasing > the > >end result to the public when I'm finished. I'm basically rewriting the > >pyFLTK toolkit by hand instead of using swig. > > > >"Joel Lucsy" wrote in message > >news:CCXq4.651$yT3.43993 at news1.usenetserver.com... > >> Ok, I've whipped up two ExtensionClass classes (stirred, not shaken) and > >am > >> trying to figure out how one can be a "subclass" of the other. I'll > >> illustrate what I want (in python for brevity): > >> > >> class A: > >> def func1(): > >> pass > >> class B(A): > >> def func2(): > >> pass > >> > >> Now I'd like to be able to do: > >> a=B() > >> a.func1() > >> > >> So far I haven't figured out how to do this without duplicating the > >methods. > >> Should I be messing with the method tables, or somehow manipulating the > >> dictionaries, or something completely different? I've tried making python > >> wrappers, but it complains about multiple bases or something. Basically > it > >> wont let me derive from two different ExtensionClasses's. Either that or > >I'm > >> missing something. > >> Any clues would be great. Thanks. > >> > >> -- > >> - Joel Lucsy (jjlucsy at concentric.net) > >> > >> > >> > >> > >> > > > > > > > > > > From flight at mathi.uni-heidelberg.de Wed Feb 2 06:16:12 2000 From: flight at mathi.uni-heidelberg.de (Gregor Hoffleit) Date: Wed, 2 Feb 2000 12:16:12 +0100 Subject: Bug: Signal processing in 1.5.2 and Python (readline, LinuxThreads etc.) Message-ID: <20000202121612.B3061@mathi.uni-heidelberg.de> Hi, I just wanted to draw your attention to a bug report I submitted into the Python BTS (Bug #196; currently available as http://www.python.org/python-bugs/incoming?id=196;user=guest). I describe that the combination of Python 1.5.2, LinuxThreads and readline support has strange effects to the signal handling of the interpreter. I tested various combinations of 1.5.1, 1.5.2, different glibc's, GNU Pth instead of LinuxThread's pthreads and tried to find a pattern. The most obvious observation of this problem certainly is that a Python 1.5.2 interpreter on Debian 2.2 systems will exit if you press Control-C on the command line, while you would expect a KeyboardInterrupt exception. Moving the readline module out of the way, *or* compiling the interpreter without thread support or with Pth threads will cure this a little bit, but still there are strange effects. Perhaps you're interested in browsing the report and trying this with different Linux and different Unix flavors. Please don't hesitate to send me your results. Maybe somebody can give me a hint where to look for the bad guy. Candidates seem to be LinuxThreads, GNU readline, the Python readline module and the Python thread support, but I'm lost where to look for the bug. Gregor From kdart at pacbell.net Sun Feb 6 23:21:45 2000 From: kdart at pacbell.net (Keith Dart) Date: Sun, 6 Feb 2000 20:21:45 -0800 Subject: Using tabs effectively. Was: Why not use tabs? In-Reply-To: <38858B76.AC22E62B@bogusaddress.com> References: <860ftk$bas@news.or.intel.com> <948195584.987404@news.adtranzsig.de> <388466D4.CC797CFC@earth.ox.ac.uk> <20000118.19182100@robert.polytopic.com> <38854A89.B3FBFA12@Lugoj.Com> <38858B76.AC22E62B@bogusaddress.com> Message-ID: On Wed, 19 Jan 2000, Joe Smith wrote: > > If one is using all tabs, then putting a comment at the top of the file > indicating the tab setting seems like a waste. If one is mixing tabs and > spaces, then it is needed. Maybe the comment should be one of the following: > using all tabs, using all spaces or mixing with a tab setting of X. FYI, I use only tabs and have not had a problem. I also use a a VIM feature (which emacs also has) of automatically indicating settings with a special line that VIM recognizes. Put the following anywhere near the top or bottom of your Python file (or your favorite variant): # vim:ts=4:sw=4 /___\\|//__//// \ (+ +) \\\\ -- --------------------oOOo~(_)~oOOo---------------------------------------- Keith Dart ============================================================================ From charleshixsn at earthlink.net Wed Feb 16 16:36:10 2000 From: charleshixsn at earthlink.net (Charles Hixson) Date: Wed, 16 Feb 2000 21:36:10 GMT Subject: PROPOSAL: fix tabs & spaces in default library References: <20000213201812.A4849@stopcontact.palga.uucp> Message-ID: <38AB1830.3FEE1EC7@earthlink.net> Personally I feel that the whitespace leading the line should be chunked into groups of two or three spaces. If you don't want to call the "thing" used to identify a chunk a tab, then call it something else, but the tab key is convenient to generate it with, and the usage is appropriate for tabs which have, historically, been setable except for a small period of time on unix (and possibly other) systems. I don't like using leading spaces, as different fonts/platforms indent them differently, and in some of them a space isn't large enough to detect by eyeballing the code. Fran?ois Pinard wrote: > Gerrit Holl writes: > > > in the default library reference, almost all modules are indented with > > four spaces, but not all. What about running a script on it so they are > > all indented four spaces? > > Also, by the way, I would suggest that the Python distribution tries better to > comply with Guido's coding standards for white space within lines. To make a > complete picture of what I would like for each and every line of code: > > * four spaces per indent on the left, > * no space before function opening parenthesis in the middle, > * no spurious space at all, ever, on the right :-). > > Guido does not agree that the third point is important, yet I think that > it is clearly mandated by perfection! What else for us, anyway! :-) > > -- > Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bwarsaw at cnri.reston.va.us Mon Feb 14 18:49:30 2000 From: bwarsaw at cnri.reston.va.us (Barry A. Warsaw) Date: Mon, 14 Feb 2000 18:49:30 -0500 (EST) Subject: Except an exception AND all its subclasses? References: <4I%o4.455$Ph6.187912704@newsa.telia.net> Message-ID: <14504.38026.972642.323173@anthem.cnri.reston.va.us> >>>>> "MZ" == Moshe Zadka writes: MZ> Where the very beginning is defined as "from the time we MZ> stopped using string exceptions?". I'm sure there was no such MZ> feature when exceptions were strings. In fact, I distinctly MZ> remember a post by the other bot about how to simulate it with MZ> string exceptions. Remember though, that class-based exceptions have been allowed for a very long time, and AFAIK, the catch behavior for classes has been in Python just as long. The primary recent addition was the conversion of the standard exceptions from strings to classes. Using string exceptions, you can still fake the derived class catch by sticking all the string exceptions into a tuple and catching that. MZ> Sorry I didn't resist the temptation to mention time machines MZ> <0.5 wink> No problem. Guido's by far got the neatest one I been in, although it can be dangerous for the novice to operate. Besides that nasty first step, you need to watch out for the blue knob, the bank of yellow buttons below the chronometer, and if the snake shaped klaxon below the chin rest ever starts to play the Monty Python theme song, be very very afraid. -Barry From thamelry at vub.ac.be Mon Feb 14 12:03:06 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 14 Feb 2000 17:03:06 GMT Subject: data structure design question References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> Message-ID: <889cga$1ef$1@mach.vub.ac.be> Felix Thibault wrote: : I'm thinking of trying to do some chemistry stuff in : Python, and one of the things I was thinking of was : to define a Chemical (or Molecule) object. On paper : chemicals are represented by stuctures like: : H : | : C=O : | : H What you really need is a graph data structure. There is an excellent module called kjbuckets that is just the right tool for the job. You can consider the bonds as edges in the graph and the atoms as nodes. Take a look at: http://www.pythonpros.com/arw/kjbuckets/ Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From clopez at abo.fi Tue Feb 1 05:43:05 2000 From: clopez at abo.fi (Cesar Lopez) Date: Tue, 01 Feb 2000 12:43:05 +0200 Subject: C, C++ to python References: <874t8o$3lm$1@lola.ctv.es> Message-ID: <3896B8B9.11CCDA9D@abo.fi> Try to use SWIG you can download in www.swig.org Bye and Good Luck Antoni Aloy wrote: > Hi! > Anybody knows if exits a tool to convert C or C++ code to Python. I like to > make a port for TVision and such a tool would be a great help. > > Best regards > > Antoni Aloy From fredrik at pythonware.com Tue Feb 1 13:30:23 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 19:30:23 +0100 Subject: Tuples References: Message-ID: <004501bf6ce2$677d3210$f29b12c2@secret.pythonware.com> Remco Gerlich wrote: > I was making some functions for a chess program earlier. For a few > minutes, the idea was to represent the board by a 64-tuple. > > But that's not very smart, is it? > > Given 64-tuple x, is there an easy way to get the tuple with values > x[6] and x[21] swapped, for instance? Apart from > > a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2, \ > a3,b3,c3,d3,e3,f3,g3,h3,a4,b4,c4,d4,e4,f4,g4,h4, \ > a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,e6,f6,g6,h6, \ > a7,b7,c7,d7,e7,f7,g7,h7,a8,b8,c8,d8,e8,f8,g8,h8 = x > > x = (a1,b1,c1,d1,e1,f1,f3,h1,a2,b2,c2,d2,e2,f2,g2,h2, > a3,b3,c3,d3,e3,g1,g3,h3,a4,b4,c4,d4,e4,f4,g4,h4, > a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,e6,f6,g6,h6, > a7,b7,c7,d7,e7,f7,g7,h7,a8,b8,c8,d8,e8,f8,g8,h8) > > Or even > > x = (x[0],x[1],x[2],x[3],x[4]..... > etc > > Tuples are immutable, but are there any nice builtin functions that > return new tuples, say with one element changed, or something like that? T = 1, 2, 3 L = list(T) ... modify list in place T = tuple(L) (note: this is more efficient than it may seem -- the list() and tuple() functions copy references, not the objects themselves). > My boards are lists now. sounds reasonable (unless you prefer dictionaries, of course). From moshez at math.huji.ac.il Sun Feb 20 00:32:43 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 20 Feb 2000 07:32:43 +0200 (IST) Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') In-Reply-To: <38AEF89A.4410B93F@inka.de> Message-ID: On Sat, 19 Feb 2000, Michael [iso-8859-1] Str?der wrote: > Moshe Zadka wrote: > > Yep. Medusa is only syntactic sugar for a raw select(), which tends to > > make your code inside-out (so to speak). If you want to do it simply, > > consider mixing in ThreadingTCPServer and do it in threads. > > But if I use threads I don't have to use Medusa at all... That was the idea.... -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From vetler at ifi.uio.no Thu Feb 17 18:36:17 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 18 Feb 2000 00:36:17 +0100 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC150E.FA51B9E3@durham.ac.uk> <38AC3968.39E53E20@durham.ac.uk> Message-ID: * Fredrik Lundh > J.C.Travers wrote: > > No, I've tried Tkinter, PyQT, wxPython, some pyGTK. What I really meant > > was that in terms of the usual quality of interfaces to python modules, > > > > Tkinter is the worst I have seen. > > you mean > > widget = WidgetFactory(master, options...) > widget.manager(geometry options) > > is the worst GUI interface you've seen? that's > a rather unusual attitude. please elaborate. doh! he probably prefers the pyMotif interface ;-) I'm-happy-I-don't-have-to-use-Motif-ly y'rs, vr From jstok at bluedog.apana.org.au Sat Feb 26 13:17:10 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Sun, 27 Feb 2000 05:17:10 +1100 Subject: self argument References: <8984mm$5pi$1@nnrp1.deja.com> Message-ID: london999 at my-deja.com wrote in message <8984mm$5pi$1 at nnrp1.deja.com>... >I am very new to Python, but it appears that every function defined in a >class must have self as a first variable name. No. You're just a little confused on a couple of points. Firstly, member functions always receive the invoked upon class instance as the first argument. The convention is to call this argument "self", but there's no requirement to do so. Secondly, not all functions are members of a class. Functions that are not class members don't receive this implicit argument; this way, you can program in conventional functional or procedural style. > Even better, it would be nice (probably too late >I know), if self was defined implicitly as the "this" pointer is in C++. I'm not sure why Python's way was chosen, but you get used to it. From mhammond at skippinet.com.au Tue Feb 1 06:00:30 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 11:00:30 GMT Subject: Date Time problem in the Win32 extensions References: <003501bf6714$767725b0$cf02a8c0@intranet.pspl.co.in> Message-ID: "George Thom at s" wrote in message news:003501bf6714$767725b0$cf02a8c0 at intranet.pspl.co.in... > On retrieval of the PIDSI_EDITTIME property, a PyTime object is obtained. > It, however, gives me 1601 as the year and consequently the Format() method I guess it is a bug somewhere - probably in the .h file that describes "PIDSI_EDITTIME". The 1601 makes it sound suspiciously like this field should be treated as an integer, and is the number of minutes the file has been edited for... Mark. From exarkun at flashmail.com Sat Feb 26 14:18:52 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Sat, 26 Feb 2000 19:18:52 +0000 Subject: pickle error Message-ID: <38B8271C.2AD6AD47@flashmail.com> When trying to run this program: import pickle file = open('pickle.dat', 'r') P = pickle.Unpickler(file) entry = P.load() print entry the python interpreter gives me this error: Traceback (innermost last): File "Pickle.py", line 1, in ? import pickle File "/usr/lib/python1.5/pickle.py", line 4, in ? See module copy_reg for a mechanism for registering custom picklers. AttributeError: load Can anybody tell me what's up? -- 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 -- 7:17pm up 24 days, 1:49, 0 users, load average: 0.07, 0.05, 0.01 From vetler at ifi.uio.no Mon Feb 14 12:07:45 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: Mon, 14 Feb 2000 18:07:45 +0100 Subject: Simple client/server exchanging objects In-Reply-To: <38A810A0.DB9ED318@bibsyst.no> References: <38A80085.AECFF9EC@bibsyst.no> <38A810A0.DB9ED318@bibsyst.no> Message-ID: on 2000-02-14, thomas wrote: > > Sound like CORBA would do the trick here. > > > > Either that, or you just serialize your objects, push them over the > > link and then read the data back into new objects. > > > > Perhaps the latter example would be best. You avoid having to learn > > CORBA ;) > > Yeah, that`s what I thought, but the serialize-bit isn`t the problem. > The server/client-part is. How do I set up a server listening to a port, > waiting for clients to connect and upload objects?? > > I haven`t made any server/client software so far so I need the basics > and then some .... :-> aha! well.. I haven't done this Python, but it's probably not that different from other languages. try looking in the Socket Programming HOWTO (). and the documentation for the socket module () there may exist other useful modules, but you'll have to look around. vr From tismer at tismer.com Thu Feb 10 18:13:22 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 11 Feb 2000 00:13:22 +0100 Subject: Maximum recursion depth References: <38A3424D.30F8BFB6@kpnqwest.no> Message-ID: <38A34612.C4B4098D@tismer.com> "Stein M. Eliassen" wrote: > > Hi, > > I have reached "maximum recursion depth". > > Is it possible to increase this limit? Yes. Use Stackless Python. I've set recursion depth to some arbitrary 123456 at the moment. Will become a system variable later. ciao - chris http://www.tismer.com/research/stackless -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 michael at camelot-it.com Mon Feb 7 03:23:04 2000 From: michael at camelot-it.com (Michael Tiomkin) Date: Mon, 07 Feb 2000 10:23:04 +0200 Subject: import statement suggestion/question References: <87kpdl$ohe$1@watserv3.uwaterloo.ca> Message-ID: <389E80E6.7B866031@camelot-it.com> Fredrik Lundh wrote: > Kannan Vijayan wrote: > > wouldn't it be easier to maybe modify the import statement itself > > to something like this: > > > > import LongModuleName as LMN > > or to avoid using up reserved words > > import LongModuleName(LMN) > > import LongModuleName:LMN > > > > you get the idea. > > > > it would allow people to get rid of the sometimes-annoyingly-long > > module names, and still keep the code clean and easy to understand. > > > > It would also help when you want to import modules, but keep them > > hidden using the prefix _ notation. > > this has been suggested many times before. > > the usual counter argument is that those lengthy > prefixes makes your code much easier to read, and > that allowing arbitrary renaming is a great way to > confuse the hell out of people (explicit renaming > using assignments are pretty bad style, imho...). You can easily do the same in Python WITHOUT these changes, e.g. instead of import VijayanModule_Doing_A_B_C(VMD) you can use import VijayanModule_Doing_A_B_C VMD=VijayanModule_Doing_A_B_C del VijayanModule_Doing_A_B_C # can be omitted I'm not sure it is worth changing the language in order to save one line of code and make it less comprehensible. Michael From nathan at islanddata.com Wed Feb 16 16:29:01 2000 From: nathan at islanddata.com (Nathan Clegg) Date: Wed, 16 Feb 2000 13:29:01 -0800 (PST) Subject: Moving from perl to python: questions In-Reply-To: <20000216201432.A2386@stopcontact.palga.uucp> Message-ID: On 16-Feb-2000 Gerrit Holl wrote: > First, string.rstrip() might strip unwanted whitespace too; it does > not only strip the newline. Duly noted in my comments. > Second: f.close is a function, so you'll need to append two > parantheses: > f.close() My mistake. > Third: a one-space indentation is considered Bad Style(tm) But very handy in a poor editing environment such as my mail client and was only used to illustrate an example, not create long-standing source. ---------------------------------- Nathan Clegg nathan at islanddata.com From wpostma at earthlink.net Sat Feb 26 11:58:45 2000 From: wpostma at earthlink.net (Warren Postma) Date: Sat, 26 Feb 2000 16:58:45 GMT Subject: Python IDE won't run on 68k Mac (Centris 650) Message-ID: <9DTt4.10085$7c2.173560@newsread2.prod.itd.earthlink.net> I get the following Traceback error immediately upon trying to open up the Python IDE on my Mac 68k. I just installed [using the easy install option, which installed fat binaries] and the following error comes up when I try to open the Python IDE. The python interpreter icon [command-line version] works fine. Here's the traceback. Any ideas? Traceback (innermost last): File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:PythonIDE.py", line 41, in ? import PythonIDEMain File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:PythonIDEMain.py", line 8, in ? import W File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:W.py", line 7, in ? from Wtext import * File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:Wtext.py", line 4, in ? import waste ImportError: DragLib: The named library was not found. Warren Postma From tim_one at email.msn.com Sat Feb 26 01:30:01 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 01:30:01 -0500 Subject: To Reduce or Not To Reduce In-Reply-To: <20000225134447.A3175@stopcontact.palga.uucp> Message-ID: <000401bf8022$e9387d20$3c2d153f@tim> [Gerrit Holl] > I thought I finally understood reduce, but apparantly, I don't. > ... > What am I missing? When should I use reduce? We went thru this on the Edu-SIG not long ago: never. I wasn't joking. reduce is virtually useless in Python, almost always both slower and more obscure than the obvious alternatives. You're not going to stumble into the cases where it's faster without becoming an expert in the internals of the implementation, but I won't spoil the fun of discovery for you . even-metaclasses-may-be-more-useful-ly y'rs - tim From pehr at pehr.net Thu Feb 24 23:19:37 2000 From: pehr at pehr.net (pehr anderson) Date: Fri, 25 Feb 2000 04:19:37 GMT Subject: jack, curses and rpms References: <24022000.4@sanctum.jae.ddns.org> Message-ID: <38B602D8.B2345CBC@pehr.net> I'm very interested in having the next version of the cursesmodule support the mouse function calls. Do you know if this is included in the latest version of cursesmodule? -pehr "Juergen A. Erhard" wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I recently discovered jack, a CD ripping/MP3 encoding integrator > written in python (cool, I can hack it ;-). > > Nice program. > > With but one problem... it needs a curses interface (yep, the docs are > right about that, you *need* it). Which in turn needs a patched > Modules/cursesmodule.c (it doesn't work with the one in 1.5.2). > > Okay, so I got cursesmodule.c from the CVS... tried to patch it with > the included diff... which failed. > > Huh? > > So, I checked that... and found that I needed the cursesmodule.c from > the Python RPMs. I got that and patched it... and all's well. > > Well, not really... the fact that the Python RPMs have a very > different (at least in source, if not in function) cursesmodule.c is > pretty bad. > > Some call this fragmentation, some will call the Python RPMs a fork (I > for one will do that). > > This situation should be ended *NOW*.[1] > > Bye, J > > [1] Whoever needs to get together and talk should do so... to sooner, > the better (and the later the worse). Actually, this should never > have happened to begin with... > > PS: Of course, if the changes in the Python RPMs are to be integrated > into Python proper, all will be well again (*when* that has happened). > > PPS: I could yammer to the Debian Python maintainer to integrate the > RPM patches into the Debian package... but I won't. I really want > *one* Python, not several slightly incompatible ones. > > - -- > J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 > My WebHome: http://JuergenErhard.tripod.com > I'm a FIG (http://www.fig.org) > Codito, ergo sum - I code, therefore I am -- Raster > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.1 (GNU/Linux) > Comment: Use Mailcrypt and GnuPG > > iEYEARECAAYFAji1jqYACgkQN0B+CS56qs3lNQCdFo8/YjfTHMxyLB7OQMd9mCT1 > h2YAoKGavNot8bmajLPi0+RYR5vWnCX/ > =9qW2 > -----END PGP SIGNATURE----- From ajb at buzzword.cc.monash.edu.au Thu Feb 3 21:39:58 2000 From: ajb at buzzword.cc.monash.edu.au (Andrew J Bromage) Date: Fri, 4 Feb 2000 13:39:58 +1100 Subject: Haskell or Python! In-Reply-To: <389A3521.C5C1BC6E@prescod.net>; from Paul Prescod on Thu, Feb 03, 2000 at 06:10:41PM -0800 References: <38994478.72056B85@cui.unige.ch> <3mdm4.17496$3b6.72189@ozemail.com.au> <87da9a$4mo@goaway.cc.monash.edu.au> <389A3521.C5C1BC6E@prescod.net> Message-ID: <20000204133958.A1245@buzzword.cc.monash.edu.au> G'day all. On Thu, Feb 03, 2000 at 06:10:41PM -0800, Paul Prescod wrote: > The coolest thing about functional programming languages is the totally > inscrutable terminology. Monads, gonads and lambda -- oh my! As opposed to perfectly clear terminology like "xrange", "DEDENT" and "pickle", you mean? :-) > (one of these things is not like the others, one of these things just > does not belong, if you....) Wait... don't tell me... I know! "Lambda" is supported in Python and the others aren't, right? What do I win? Cheers, Andrew Bromage From tomh at po.crl.go.jp Mon Feb 7 20:11:31 2000 From: tomh at po.crl.go.jp (Tom Holroyd) Date: Tue, 8 Feb 2000 10:11:31 +0900 Subject: const in Python In-Reply-To: <1262179804-3408142@hypernet.com> References: <1262179804-3408142@hypernet.com> Message-ID: On Mon, 7 Feb 2000, Gordon McMillan wrote: > Anders M Eriksson writes: > > > > Would someone please explain why there isn't a const 'operator' in > > Python! > > If you are truly concerned, you could make them attributes of > a class that prohibits setattr. But generally naming > "constants" in all upper case is enough to tell a Pythonista > that it shouldn't be modified. Right, like this: class ReadOnly: def __setattr__(self, name, value): if self.__dict__.has_key(name): raise TypeError, 'value is read only' self.__dict__[name] = value >>> const = ReadOnly() >>> const.x = 5 >>> const.x = 9 TypeError: value is read only Dr. Tom Holroyd "I am, as I said, inspired by the biological phenomena in which chemical forces are used in repetitious fashion to produce all kinds of weird effects (one of which is the author)." -- Richard Feynman, _There's Plenty of Room at the Bottom_ From pinard at iro.umontreal.ca Sun Feb 27 01:06:59 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 27 Feb 2000 01:06:59 -0500 Subject: Q about tail recursion In-Reply-To: Harald Hanche-Olsen's message of "26 Feb 2000 10:09:15 -0500" References: <000a01bf8033$269bdee0$3c2d153f@tim> Message-ID: Harald Hanche-Olsen writes: > Um, not really, because they are followed by an implicit "return None". By the way, I sometimes hesitate at having an explicit: return None as the last line of a function. I guess I usually give in writing it, would it be only as some kind of documentation, but then (being anal myself :-) I would consider as a style bug not doing it always, if I do it sometimes. (It would of course always be OK _not_ writing that line for `def's not meant to return a usable value.) I wonder a bit. Is there any common wisdom about this detail? -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tsarna at endicor.com Fri Feb 25 11:09:20 2000 From: tsarna at endicor.com (Ty Sarna) Date: 25 Feb 2000 16:09:20 GMT Subject: Compiling Python on NetBSD References: <895tkq$fr2$1@news.tht.net> Message-ID: <951493485.416315@fezzik.endicor.com> In article <895tkq$fr2$1 at news.tht.net>, D'Arcy J.M. Cain wrote: > Can someone tell me why the decision was made to use cc on ELF systems > and ld on a.out? I checked and my a.out system accepts cc -shared just > fine. The reason for asking is that our package building system now My memory of this is a bit fuzzy now, but I believe it's because "cc -shared" didn't work on older systems. At one time, the ELF and a.out toolchains were fairly different, and I think our system makefiles used cc on ELF and ld on a.out, and I propagated that. Nowadays the toolchain is more consistent between the two. > has to do the same test on every Python package to decide whether to > add -Wl, in front of the ld flags if there are additional libraries > to link in. It would be a lot cleaner if we didn't have to add this > test in on every package. No, that's not true. For packages, you can just use -R, since that works with both cc and ld. This won't work on 1.3.x and earlier, but anyone using modern pkgsrc on OS versions that old will probably have other problems anyway -- it's only marginally supported. > Anyway, I am thinking of patching the configure script in our package > system so that the NetBSD* simply sets LDSHARED to "cc -shared" in every > case. Anyone see a downside to that? It doesn't buy anything, and creates an unneeded difference between the package and the standard distribution. Merging it back into standard python would be bad, too. AFAIK, stock Python builds on NetBSD systems back to 1.0 or so (not that I've tried it lately, but I made some effort at the time...). From prudek at nembv.cz Fri Feb 25 02:45:27 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 08:45:27 +0100 Subject: system return status on Windows References: <000c01bf7f31$93a8c6e0$b62d153f@tim> Message-ID: <38B63317.1A0A1C3D@nembv.cz> Tim Peters wrote: > > [Milos Prudek > You could also try os.spawnv or os.spawnve (but those only exist under > Windows). BTW, don't expect os.popen to work sensibly under Windows either. Great, thanks. Could you send something about mode (magic operational constant) of spawnv? I do not have Visual C++ Runtime Library documentation... -- Milos Prudek From a.eyre at optichrome.com Tue Feb 8 13:07:05 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 8 Feb 2000 18:07:05 -0000 Subject: pretty print xml document In-Reply-To: <389FEC18.594FBD7C@sxb.bsf.alcatel.fr> Message-ID: <002101bf725f$4e782720$3acbd9c2@peridot.optichrome.com> > I want to pretty print an xml document that I've created : You might get a better response on XML issues if you post to the XML-SIG list. Anyway - from one of the XML-SIG lot (can't remember which): def formatDOM(node, spacing = 2, indent = 0): """formatDOM(node[, spacing=2]) Format a DOM tree prettily by inserting whitespace where appropriate. spacing specifies the number of spaces to indent. This assumes that the tree has been stripped of whitespace. """ indented_types = [core.ELEMENT_NODE, # which node types to indent core.PROCESSING_INSTRUCTION, core.COMMENT_NODE] doc = node.get_ownerDocument() if(doc is None): # I'm the root node, start the recursion for child in node.childNodes[:]: formatDOM(child, spacing=spacing, indent=indent) return indent_str = "\n" + " "*(indent+spacing) indented=0 # has anything been indented? for child in node.childNodes[:]: if(child.nodeType in indented_types): node.insertBefore(doc.createTextNode(indent_str), child) indented=1 formatDOM(child, spacing=spacing, indent=indent+spacing) if(indented): # need to indent my close tag node.appendChild(doc.createTextNode("\n" + " "*indent)) ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From sholden at bellatlantic.net Tue Feb 29 08:32:29 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 29 Feb 2000 13:32:29 GMT Subject: thread problem References: <000101bf8273$6a9590e0$732d153f@tim> Message-ID: <38BBCA6F.66D4A50A@bellatlantic.net> So Python 3K might finally incorporate a DWIM-mode processor? Tim Peters wrote: > > [Greg Wilson] > > *sigh* Thanks --- here's me thinking complicated, and it's simple. > > Don't suppose there'll be a warning option in 1.6 for this kind of thing? > > Python is awfully smart, but I think we'll have to wait for P3K before it > can successfully guess how overly complicated your thoughts are . > > nobody-wants-to-be-falsely-accused-of-thinking-too-simply-ly y'rs - tim thoughts-like-programs-should-be-just-complicated-enough-ly y'rs - Steve -- "If computing ever stops being fun, I'll stop doing it" From loewis at informatik.hu-berlin.de Mon Feb 14 12:04:12 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 14 Feb 2000 18:04:12 +0100 Subject: [CORBA] omniNames feature request References: Message-ID: kc5tja at garnet.armored.net (Samuel A. Falvo II) writes: > (Why, oh WHY didn't OMG specify a fixed TCP/IP port and object key for the > name service? Is it really too much to ask for?!) As an update to what Duncan said: The "Interoperable Naming Specification Finalization Task Force" (INS FTF) has completed its work, and their updated specification is currently being voted by the technical committee. IANA has assigned port 2809 for CORBA bootstrapping purposes. The INS spec assumes this as the default in the corbaloc URLs; the default object key for the name service is "NameService". Regards, Martin From michael.stroeder at inka.de Sat Feb 19 15:10:02 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 19 Feb 2000 21:10:02 +0100 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') References: Message-ID: <38AEF89A.4410B93F@inka.de> Moshe Zadka wrote: > > On Fri, 18 Feb 2000, Michael [iso-8859-1] Str?der wrote: > > > I guess I have to rewrite my synchronous code completely > > if I want to write a medusa handler. Am i right? > > Yep. Medusa is only syntactic sugar for a raw select(), which tends to > make your code inside-out (so to speak). If you want to do it simply, > consider mixing in ThreadingTCPServer and do it in threads. But if I use threads I don't have to use Medusa at all... Ciao, Michael. From trentm at ActiveState.com Fri Feb 11 08:14:35 2000 From: trentm at ActiveState.com (Trent Mick) Date: Fri, 11 Feb 2000 13:14:35 -0000 Subject: How do you undo x = `a` if A is a list? In-Reply-To: Message-ID: > Now how do I read that line in from a file and convert it from a > string to a > list? Here is one way. Save your variable in the proper format to a Python module. Don't know if I would recommend it. As Skip et al. suggest, eval() and its kin are probably better. 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 sys >>> a = [1,2,3] >>> output = open('save.py','w') >>> output.write("a = " + str(a)) >>> output.close() >>> ^Z Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> from save import * >>> a [1, 2, 3] Trent From dfavor at austin.ibm.com Wed Feb 16 09:15:09 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Wed, 16 Feb 2000 08:15:09 -0600 Subject: Moving from perl to python: questions Message-ID: <38AAB0ED.D9603D2F@austin.ibm.com> I'm moving from perl to python. Attached is a simple snippet of code that I'm having trouble with. Questions: 1) Best way to convert array argv[1:] into string to pass functions 2) How to implement a no-frills file slurp() function Assistance appreciated. Thanks. From froydnj at cs.rose-hulman.edu Tue Feb 15 12:05:50 2000 From: froydnj at cs.rose-hulman.edu (Nathan Froyd) Date: Tue, 15 Feb 2000 12:05:50 -0500 Subject: why don't my global variables get initialized? Message-ID: I'm writing a python program with some global variables that I need initialized. For testing purposes, I thought I would write a function that would do the Right Thing and read in everything correctly: def init_global_data(filename): global num_cities, citylist, matrix zfile = open(filename, 'r') num_cities = read_number_of_cities(zfile) citylist = read_city_names(zfile) matrix = read_distance_matrix(zfile, num_cities) However, this doesn't seem to be working, because none of those three global variables are initialized after I call the function: Python 1.5.2 (#1, Jul 22 1999, 11:59:40) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> from genetics import * >>> init_global_data('att48.tsp') >>> num_cities 0 >>> citylist [] >>> matrix [] Those are the default values those variables started out with. What am I missing? I know you can change global variables and I thought the way I was doing it was the proper way, but it's obviously not. What's wrong? Thanks! From slowman at khg.com Wed Feb 23 08:28:52 2000 From: slowman at khg.com (Slowman) Date: Wed, 23 Feb 2000 13:28:52 GMT Subject: Python port to PalmOS Message-ID: <38b3e042.7854561@news.i-cable.com> Is there any available or in progress ? Palm has Java and I like Palm to have Python too :-) ! From tbryan at python.net Wed Feb 2 22:31:59 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 02 Feb 2000 22:31:59 -0500 Subject: Tkinter and OpenGL References: <3896A132.E3571243@cui.unige.ch> <18682648.88db7216@usw-ex0102-084.remarq.com> Message-ID: <3898F6AF.6EF50666@python.net> plewis wrote: > >about python with wxWindows or Qt and it's support for OpenGL. > > I believe there are bindings for GTK+, and wxWindows. I am not > sure about Qt. The Vaults of Parnassus show the current PyQt and PyKDE site to be http://www.river-bank.demon.co.uk/software/ I knew someone using PyQt a few months ago, and he was fairly happy with it. He wasn't doing any OpenGL though. ---Tom From thomas at xs4all.net Thu Feb 3 11:23:42 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 3 Feb 2000 17:23:42 +0100 Subject: Vaults of Parnassus problem In-Reply-To: <3899A4F3.76F8FD8A@hotmail.com>; from kfriesen@netcom.ca on Thu, Feb 03, 2000 at 03:55:31PM +0000 References: <3899A4F3.76F8FD8A@hotmail.com> Message-ID: <20000203172342.E6378@xs4all.nl> On Thu, Feb 03, 2000 at 03:55:31PM +0000, Kim Friesen wrote: > Is anyone having problems accessing the Python modules at the vaults of > parnassus ??? > The link from python.org just goes into limbo and never returns any data Works fine here. I've seen earlier reports to the same effect (or was that you ? I dont remember) but it works fine form here. You'd best investigate what is failing for you: finding the site, connecting to the site, or getting an answer from the parnassus part of vex.net. Can you reach www.vex.net ? If not, can you telnet to it, on port 80 ? If that fails, there's a problem with your network connection to www.vex.net -- you'd best contact your internet provider to see what's wrong. Maybe someone on the way to vex.net is blackholing you, or your ISP. Or perhaps there is a problem routing specific networks from your ISP (we've seen similar problems here, we were unable to reach cnn.com and a few other sites because two unrelated (as far as we know) backbones changed their connection ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From aahz at netcom.com Wed Feb 2 12:54:37 2000 From: aahz at netcom.com (Aahz Maruch) Date: 2 Feb 2000 17:54:37 GMT Subject: Case Sensitivity and Learnability References: <878j9k$vpe$2@thoth.cts.com> <20000131160402.D19725@xs4all.nl> <879phb$13i0$1@nntp6.u.washington.edu> Message-ID: <879r0t$u43$1@nntp9.atl.mindspring.net> In article <879phb$13i0$1 at nntp6.u.washington.edu>, Donn Cave wrote: > >I've missed some of the discussion, so I hope I'm not repeating >something that's already been chewed over, but I just wanted to >point out that there are indeed two sorts of people - one believes >that there are two sorts of people, and the other doesn't! Ha, ha ha. Actually, there are three kinds of people: those who can count and those who can't. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From mwh21 at cam.ac.uk Fri Feb 25 09:55:03 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Feb 2000 14:55:03 +0000 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > > > [2] I occasionally think about this problem. The setup: GvR was far > > too profligate in adding functions to bltinmodule.c that could have > > been written in pure Python instead. So, how many built-in functions > > can you re-implement in pure Python? > > These are possible: > > abs, callable, chr, delattr, divmod, > execfile, filter, getattr, hex, input, int, isinstance, issubclass, > len, list, long, map, max, min, oct, range, raw_input, reduce, reload, > repr, setattr, tuple, vars. > > These aren't: > > apply, buffer, coerce, compile, complex, dir, eval, exit, globals, hash, > id, intern, locals, round, slice, type, xrange To followup to a different bit of the thread about 30 seconds after the last one, I think you can actually do quite a few of these. `compile' would be a lot of work, but given the `new' module, definitely possible (ask Jeremy Hylton!). `dir' shouldn't be too hard given `type' & some knowledge of Python internals. `eval' can be done using `compile' & `exec'. `globals' and `locals' can be done using the usual sys.exc_traceback mucking around. The builtin `exit' is just a string! Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From aahz at netcom.com Sun Feb 13 18:36:05 2000 From: aahz at netcom.com (Aahz Maruch) Date: 13 Feb 2000 23:36:05 GMT Subject: Changes to urlparse.py: urljoin References: <38A73982.AAA65E9C@graburn.com> Message-ID: <887f55$pf3$1@nntp6.atl.mindspring.net> In article <38A73982.AAA65E9C at graburn.com>, Ronald Hiller wrote: > >I've been having some problems with the urljoin function. When I try >and join URLs that have '..' components that make the path above the >root, they aren't joined properly. Yeah, we ran into that problem and wrote a patch for it. I'll bug the developer to submit it (I think it's a bit more complete than yours). I don't think it'll do any harm if you want to submit your patch, though. -- --- 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 Have you coined a word today? From mwh21 at cam.ac.uk Tue Feb 22 13:04:19 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 22 Feb 2000 18:04:19 +0000 Subject: functional programming References: <38B2CE44.CB9B41A9@roguewave.com> Message-ID: bjorn writes: > Maybe I'm dense, but what is stopping us from implementing tail call > optimization (of which tail recursion is just a special case) with the > cu= rrent Python implementation. Identifying a call in a tail > position is a simple static analysis that isn't affected by Python's > dynamicity (is that a wor= d?). Once they're identified you only need > to translate a call to a jump inste= ad of a push return address and > jump. There is no semantic change to Python. Ta da! http://starship.python.net/crew/mwh/bch/module-bytecodehacks.tailr.html Generates rather poor code and can't do mutually tail recursive functions, but works. It's *very* easy to spot tail calls in Python bytecode; just look for a CALL_FUNCTION followed by a RETURN_VALUE. It would probably be fairly simple to add a TAIL_CALL opcode to the interpeter, and then translate CALL_FUNCTION/RETURN_VALUE pairs to this new opcode. I might do it one day if I get bored. Tail recursion can make debugging much harder, mind. Oh, hang on: exceptions. Arse (I think). never-mind-it-was-a-nice-idea-ly y'rs Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From robin at jessikat.demon.co.uk Thu Feb 3 09:42:17 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 3 Feb 2000 14:42:17 +0000 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: In article , Alexander Williams writes >On Thu, 3 Feb 2000 10:33:15 +0000, Robin Becker > wrote: > >>Ritchie, McIlroy kernighan et al.) and these preceded C. None of these >>languages required explicit register allocation. > >I really have to remember to subtitle for the sense-of-humour >impaired. Missing subtitle today: Hyperbolie. > >Yes, I'm aware there were languages between Assembler and C. The >subtly implied point is that just because something is currently >widespread, doesn't mean it will always be, especially when easier, >more efficient means come along. > >Gee, jokes really /aren't/ as funny when they require explaining ... > Gee! The subtle joke is that those guys had to implement those languages before implementing C where they introduced a typing/storage declaration mechanism which allowed them to explicitly allocate registers. Mumble, dribble, real senility has now set in. -- Robin Becker From bvisscher at my-deja.com Thu Feb 3 14:22:57 2000 From: bvisscher at my-deja.com (bvisscher at my-deja.com) Date: Thu, 03 Feb 2000 19:22:57 GMT Subject: Porting omniORB python to OpenVMS References: <877rom$akl$1@nnrp1.deja.com> <8791t9$f19$1@pineapple.uk.research.att.com> <879p1s$mqa$1@nnrp1.deja.com> <879v5m$l75$1@pineapple.uk.research.att.com> <87bbrp$rq9$1@nnrp1.deja.com> Message-ID: <87ckib$oq4$1@nnrp1.deja.com> In article <87bbrp$rq9$1 at nnrp1.deja.com>, Uwe Zessin wrote: > In article <879v5m$l75$1 at pineapple.uk.research.att.com>, > Duncan Grisby wrote: > > In article <879p1s$mqa$1 at nnrp1.deja.com>, > wrote: > > > > >in the example client with the example server running (both from > > >omniORBpy/releasenote). Yes! > > > > Congratulations on your successful port. Did you have to make any > > patches to omniORBpy to get it to work? If so, can you send them to > > me please. > > And congratulations from me, too. > Would you mind to share your changes to Python for OpenVMS with me > so I can see if I can put them in the next release (1.5.2-V007) ? Thanks to you both. I have sent each of you the necessary changes via e-mail. Bruce Visscher Sent via Deja.com http://www.deja.com/ Before you buy. From jlehmann at nsw.bigpond.net.au Mon Feb 28 08:15:57 2000 From: jlehmann at nsw.bigpond.net.au (John Lehmann) Date: Mon, 28 Feb 2000 13:15:57 GMT Subject: lambda fctions & local variables References: Message-ID: <38BA72EA.1BBD6D34@nsw.bigpond.net.au> Do you want something like this? def find(pattern,list): return filter(lambda x, p = pattern: match(p, x), list) Frantisek Kvapil wrote: > > Hello, > > I have some matching function: > def match(pattern,value): > return len(pattern)==len(value) > > and some finding function: > def find(pattern,list): > return filter(lambda x: match(pattern,x),list) > > but the problem is that the lambda function don't know > local variable pattern, > > so may you be so nice to tell me how to make it works > (still using lambda functions if possible) > > thanks and have nice day > > Frantisek Kvapil From dfavor at austin.ibm.com Thu Feb 17 06:15:35 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Thu, 17 Feb 2000 05:15:35 -0600 Subject: Is there a python equivalent of the perl... References: <38AB1376.515C9A59@austin.ibm.com> <38AB1842.4AF85B0C@roguewave.com> Message-ID: <38ABD857.42C0F0EF@austin.ibm.com> bjorn wrote: > > The profiler might do what you want (it's fully described in the > manual). I was positive I'd read something about this. Thanks for reminding me of the name. From thomas at xs4all.net Fri Feb 4 06:19:37 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 4 Feb 2000 12:19:37 +0100 Subject: File size limitations In-Reply-To: <389A0ACF.DBF4FA2F@roguewave.com>; from bjorn@roguewave.com on Thu, Feb 03, 2000 at 04:10:07PM -0700 References: <87cql2$t8j$1@nnrp1.deja.com> <389A0ACF.DBF4FA2F@roguewave.com> Message-ID: <20000204121936.G6378@xs4all.nl> On Thu, Feb 03, 2000 at 04:10:07PM -0700, Bjorn Pettersen wrote: > gmc333 at my-deja.com wrote: > > I'd like to use Python for some large-scale file processing on Windows > > NT. There is a possibility that the size of the files I'll be working > > with will exceed 2^32 bytes. > > > > Can Python handle files that large? Random I/O is a specific concern, > > since an implementation based on fseek/lseek system calls will fail > > (these calls use 32-bit math, and bad things can happen with seeks that > > go too far). > I'm pretty sure Python uses the fseek/lseek etc. functions for file IO. It > would be trivial to create an extension module with Swig Actually, The Code does this: #if defined(HAVE_FSEEKO) ret = fseeko(f->f_fp, offset, whence); #elif defined(HAVE_FSEEK64) ret = fseek64(f->f_fp, offset, whence); #else ret = fseek(f->f_fp, offset, whence); #endif (see fileobject.c) which at least suggests python can handle 64bit filesystems if they exist. Another hint was a posting a few weeks back by someone who hit a bug because tell() returns a long object instead of an int object, for very large files (on filesystems that support it.) Wether it works on Windows NT is something else, but I'd hazard a 'yes' on that, myself. It's easy to try, though, start the interpreter, open a file, seek() to a very large number, and write some characters. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From saraz at videotron.ca Thu Feb 3 14:08:24 2000 From: saraz at videotron.ca (Alain) Date: Thu, 03 Feb 2000 19:08:24 GMT Subject: Running a script python from JAVA Message-ID: Hi, I'm trying to run a script from a file. The script is written in python. The script is a telnet session between a router and a computer. If I run the script from a DOS prompt window, everything is good. But if I start the script from my program, using a Runtime object, there's a problem. The communication between the router and the computer is stop, even if the telnet session is still open. Here's the code: private void runPython(String fileName, String aDevice) { try { Process process; Runtime runtime = Runtime.getRuntime(); String os = System.getProperty( "os.name" ); if ( os.equals( "Windows 95" )) { String cmd = "start python " + fileName; process=runtime.exec(cmd); } else if os.equals( "Windows NT" )) { String cmd = "cmd /C \"start python " + fileName + "\""; runtime.exec( cmd ); } } catch (IOException e) writeToLogFile("Telnet to: "+aDevice+" failled: "+e.getMessage()); } } Is there someone have a solution? Thanks, Alain From timmuddletin at news.vex.net Sat Feb 5 15:59:01 2000 From: timmuddletin at news.vex.net (tim muddletin) Date: 5 Feb 2000 20:59:01 GMT Subject: Imagemagick References: Message-ID: <87i2ul$11jt$1@news.tht.net> On 29 Jan 2000 17:39:47 +0100, Piet van Oostrum wrote: >Does anybody have a copy of Python/Imagemagick or pymagick or a working link? Good news! I was just looking around Graham Higgins new PyApache site (which seems to me not so much a PyApache specific site, but a nice all around general Python/CGI site to me) which he lately submitted to VoP... And what do i find sitting there on his server? A copy of the long (long, long, long) lost PyMagick module.... so i've updated my links to that, if anyone still wants it. (Personally I'd recommend the ever convenient Python Imaging LIbrary (PIL) for most tasks, but someone may need ImageMagick functions perhaps)... http://www.bel-epa.com/pyapache/py_modules/PyMagick/ (Of course take a look around Graham's whole site starting at http://www.bel-epa.com/pyapache/ while you are there <-: ) ... From pinard at iro.umontreal.ca Wed Feb 16 13:43:02 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 16 Feb 2000 13:43:02 -0500 Subject: Real Problems with Python In-Reply-To: Michael Hudson's message of "13 Feb 2000 19:08:16 +0000" References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: Michael Hudson writes: > =?ISO-8859-1?Q?Fran=E7ois_Pinard?= writes: > > Couldn't we approximate lexical scoping with classes? [...] > It would also be nice if people got the terminology right [...] Sorry, I gave in the current terminology mixup. I wanted to say that my modest needs for Scheme lexical closures were easy to satisfy using approximations based on Python classes. :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From cfelling at iae.nl Fri Feb 11 19:51:34 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 12 Feb 2000 01:51:34 +0100 Subject: Fully Bracketed Syntax References: <65118AEEFF5AD3118E8300508B124877073D74@webmail.altiris.com> Message-ID: <882aqm$23s$1@vvs.superst.iae.nl> Neel Krishnaswami wrote: > Dylan uses this style, but Modula-2 uses the Pascal BEGIN/END style. It has been a long time since I used Modula-2, but if memory serves me right... and indeed according to my copy of the 3e edition of Wirth's "Progr. in Modula-2" it sure does (okee, it uses END instead of ENDIF:) > Now to break a trend, and supply some real numbers (this is a slightly > edited version of a post I've made before -- I'd be willing to submit > it to the FAQ...): ... nice point snipped I liked this reasening before, and I like it now, so IMHO it does deserve to be part of the FAQ on whitespace eating nanovirusses. -- groetjes, carel From dfavor at austin.ibm.com Wed Feb 16 16:15:35 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Wed, 16 Feb 2000 15:15:35 -0600 Subject: Is there a python equivalent of the perl... Message-ID: <38AB1376.515C9A59@austin.ibm.com> Benchmark.pm module, to allow benchmarking arbitrary snippets of code? Thanks. From gmcm at hypernet.com Mon Feb 14 13:28:43 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 13:28:43 -0500 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <001b01bf7712$37f31f20$3acbd9c2@peridot.optichrome.com> References: <003001bf74b0$dfde09c0$f29b12c2@secret.pythonware.com> Message-ID: <1261569578-40112683@hypernet.com> Adrian Eyre writes: > I was refering to the connection with my original post about the join() > method being added to the string object, when it more logically goes > on a list/sequence... > > e.g. > > >>> s = "this is a test" > >>> s.split() > ['this', 'is', 'a', 'test'] > > ...seems reasonable, but... > > >>> l = s.split() > >>> " ".join(l) > 'this is a test' > > ...doesn't. If it were on a list, you could do things like this: > > >>> s = "a:b:c" > >>> s.split(":").join(", ") > 'a, b, c' And what should ['a',3,None,[Tim(1),Tim(2)]].join(';') return? It would be most bizarre to have a method on list that only worked for certain kinds of lists, (and guessing your intent is the specialty of that other language). Your needs are met by (", ").join("a:b:c".split(":")). Requiring the arg to be a list-of-strings is restrictive, but not bizarre. - Gordon From sholden at bellatlantic.net Mon Feb 21 15:28:43 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 21 Feb 2000 20:28:43 GMT Subject: Reading Netscape Mail Folders Message-ID: <38B19FF9.83B98466@bellatlantic.net> One of the problems with using Netscape is the inability to save message *including attachments* in RFC822 format. It saves the base message, but precious little else, dumping headers and the like with gay abandon. I realise I could go to the Open Source repository to learn how to decode the file format and do the job in C (blerch!). But I wondered if anyone had already done a similar thing in Python? Seems like many things one might require turn out to be already available, or almost, so I thought this was worth a try. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From moshez at math.huji.ac.il Fri Feb 18 08:26:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 15:26:59 +0200 (IST) Subject: Which GUI? In-Reply-To: <20000218075244.B777@stopcontact.palga.uucp> Message-ID: On Fri, 18 Feb 2000, Gerrit Holl wrote: > > Well, it's little too cumbersome in terms of size of redistribution (as far > > as Windows is concerned). It has a 1.7meg pyd, not to mention various other > > pyd's as well. > > Tcl/Tk is much larger. > $ du -chs /usr/X11R6/lib/{tk8.0,tk4.2,libtk8.0.a,libtk4.2.a} /usr/lib/python/lib-dynload/_tkinter.so Gerrit, is there a reason you're comparing Win32 dll's with (what I presume are) ELF GNU/Linux shared objects? Do you think it serves any kind of purpose? > What about pyQT? QT isn't free on Win32. Thus, portable free programs cannot use PyQT. On the other hand, portable free programs cannot use PyGTK either, but GTK does run on Win32, so it's only a matter of interest, I suppose. > I think I'll make another point 'can be subclassed' in my comparison. Why? In Python, subclassing is much less important then in other OO languages. For example, while widgets in Tkinter can be subclassed, the official effbotic advice is not to do so (and, I must say, I agree). Not to mention that Tkinter is built on _tkinter, whose widgets cannot be subclassed, so here is another point to the pointlessness of the subclass-ability. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From bwarsaw at python.org Fri Feb 4 18:10:14 2000 From: bwarsaw at python.org (Barry Warsaw) Date: Fri, 4 Feb 2000 18:10:14 -0500 (EST) Subject: Python CVS available via the Web Message-ID: <14491.23638.906549.587613@anthem.cnri.reston.va.us> The very latest CVS snapshot of the Python source code is has been available by anonymous CVS for a while now. See http://www.python.org/download/cvs.html for details. Just van Rossum reminds me that I forgot to announce that I've also installed Greg Stein's excellent ViewCVS tool so you can get Web access to the CVS repository for Python (and JPython, Mailman, Distutils, XML-SIG, and CC Mode). Visit http://cvs.python.org/ to take a look. It won't be very fast though; it's running on a pretty old machine. Enjoy, -Barry From skaller at maxtal.com.au Sat Feb 26 16:50:50 2000 From: skaller at maxtal.com.au (skaller) Date: Sun, 27 Feb 2000 08:50:50 +1100 Subject: functional programming References: <001401bf7cd4$d3e9f760$29a2143f@tim> Message-ID: <38B84ABA.AA22EFD6@maxtal.com.au> Tim Peters wrote: > That is, Python wasn't designed to support programming in these styles, but > is flexible enough that you can force it to work. Python was designed to > support a variety of OO & "imperative procedural" styles instead. Vyper, on the other hand, is designed to do functional programming well, but you can 'force it' to make Python work too :-) [you do this by coding your module in a .py file, use a .vy file for the full thing] The latest version even supports 'pattern matching' like in ML, with a pythonic twist. As you know, Python allows an escape from block structure using bracket balancing rules -- Vyper also supports the converse, allowing an arbitrary suite to be nested in an expression using enblock <: and deblock :> symbols. Such an expression-nested suite has the same value it would were it a nested parameterless function, namely None unless something is 'return'ed. Combined with lexical scoping, Vyper is a fairly reasonable dynamic functional language, as well as being procedural and object oriented :-) -- John (Max) Skaller, mailto:skaller at maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net From aahz at netcom.com Sat Feb 12 01:12:49 2000 From: aahz at netcom.com (Aahz Maruch) Date: 12 Feb 2000 06:12:49 GMT Subject: How to do line wrapping? References: <001001bf7502$577f2d00$622d153f@tim> <882pgk$8mo$1@nntp9.atl.mindspring.net> Message-ID: <882tl1$qgt$1@nntp6.atl.mindspring.net> In article <882pgk$8mo$1 at nntp9.atl.mindspring.net>, Michal Wallace wrote: > >I wonder if part of that has to do with lack of documentation. >If we could add full text searches of module documentation to >VoP or the hypothetical CPyAN, it might make things easier.. That's easy, as long as VoP extracts the module documentation to HTML pages. See http://www.searchbutton.com/ (Disclaimer: I'm a founder. But most of the code is Python. ;-) -- --- 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 Nostalgia just ain't what it used to be From dalke at acm.org Tue Feb 8 21:42:25 2000 From: dalke at acm.org (Andrew Dalke) Date: Tue, 8 Feb 2000 19:42:25 -0700 Subject: Coverage Analysis References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB143@molach.origin.ea.com> <14496.35410.540653.714924@beluga.mojam.com> Message-ID: <87qk2f$38h$1@nntp9.atl.mindspring.net> Skip Montanaro wrote in message > I have in my inbox a patch I've yet to look at from > a fellow that improves the display of continuation > lines. I also have a modified version of Skip's code. The changes are listed below, but the most important is better identification of which lines were not executed (reads the LINENO fields from the code objects). It's at: ftp://starship.python.net/pub/crew/dalke/trace.py Andrew dalke at acm.org # Support for files with the same basename (submodules in packages) # Expanded the idea of how to ignore files or modules # Split tracing and counting into different classes # Extracted count information and reporting from the count class # Added some ability to detect which missing lines could be executed # Added pseudo-pragma to prohibit complaining about unexecuted lines # Rewrote the main program From gherman at darwin.in-berlin.de Mon Feb 7 16:53:00 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Mon, 07 Feb 2000 22:53:00 +0100 Subject: Finally, Python hardware, too! Message-ID: <389F3EBC.152715FC@darwin.in-berlin.de> Have a look at these amazing creatures: http://www.snakerobots.com 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 moshez at math.huji.ac.il Fri Feb 25 02:17:06 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 09:17:06 +0200 (IST) Subject: 1000 GUI toolkits In-Reply-To: Message-ID: On Fri, 25 Feb 2000, Brett g Porter wrote: > "Terry Reedy" wrote in message > news:894diu$o80$1 at news.udel.edu... > > If you rewrite Pysol in HTML, you'll get a prize. > > > > Agreed that fine-grained interaction, such as with games, is a poor > > application for HTML. > > Do you paint DHTML / JavaScript with the same brush? Well, of course not! But, well, JavaScript has one overwhelming disadvantage: it's not Python . If I wanted to use JavaScript for programming, I'd be reading c.l.javascript, not c.l.py... But it is interesting: is there a Python module (written in Tkinter of PyGTK or ...) which parses HTML with embedded Python and executes it? Does grail does that? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tbryan at python.net Fri Feb 18 23:28:11 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Fri, 18 Feb 2000 23:28:11 -0500 Subject: Numerical Python install problem References: <38ADFBA4.55729EB4@mindspring.com> Message-ID: <38AE1BDB.F9BE95C@python.net> Robert Schweikert wrote: > > Hello, > > I am running Python 1.5.2 on RH 6.1 distro. Used the Python rpm to get > it running instead of building it myself. I also installed the Distutils > with no problem. But now when I try to install Numerical Python Version > 14 I get the following errors: Note that there is also a an RPM for Numerical Python. I have a (probably out-of-date) version on my system. $ rpm -qi python-numpy Name : python-numpy Relocations: (not relocateable) Version : 1.11 Vendor: (none) Release : 2 Build Date: Thu Apr 8 20:16:09 1999 Install date: Fri May 7 21:28:12 1999 Build Host: localhost Group : Development/Languages/Python Source RPM: python-numpy-1.11-2.src.rpm Size : 2753381 License: Distributable Packager : Travis Oliphant URL : http://www.python.org/topics/scicomp/numpy.html Summary : Python numerical facilities Description : NumPy is a collection of extension modules to provide high-performance multidimensional numeric arrays to the Python programming language. > gcc -c -I/usr/include/python1.5 -IInclude -g -O2 -fPIC > Src/_numpymodule.c Src/arrayobject.c Src/ufuncobject.c ... > In file included from /usr/include/bits/errno.h:25, > from /usr/include/errno.h:36, > from /usr/include/python1.5/Python.h:59, > from Src/ufuncobject.c:14: > /usr/include/linux/errno.h:4: asm/errno.h: No such file or directory ... > distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1 > Any ideas wht could be going on here? Well, it looks like gcc can't find asm/errno.h. First run 'loacate errno.h | grep asm'. If that command finds errno.h, you could try adding a -I flag to the gcc command somehow. For example, $ locate errno.h | grep asm /usr/src/linux-2.2.5/include/asm-i386/errno.h /usr/i386-glibc20-linux/include/asm/errno.h I would try adding -I/usrr/i386-glibc20-linux/include/ Then again, it could be a completely different problem. ---Tom From bparsia at email.unc.edu Fri Feb 11 16:52:33 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Fri, 11 Feb 2000 16:52:33 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> <1e5swv6.1q9lq2u1flfqi0N%bparsia@email.unc.edu> <38a43d45.12878348@news.concentric.net> Message-ID: <1e5uj1c.1j9rf00aeqrfzN%bparsia@email.unc.edu> Tim Ottinger wrote: > On Thu, 10 Feb 2000 23:03:45 -0500, bparsia at email.unc.edu (Bijan > Parsia) wrote: [snip] > >Sure. It drives me nuts when I *can't* use em :) Just to be clear, I meant the Smalltalk IDE/world. [snip] > A fine idea would be if it just exported the part you wanted to edit, > called your editor, and then re-imported automagically. Better if it > can be done via menu click and/or keystroke. Doable. I'm not sure how worth it. Smalltalk/X seems to integrate nicely with things like CVS, though. The real challange is something like the debugger or an inspector...these aren't about text. (IDLE, in my experience, is fairly reasonable, indeed, I probably wouldn't write any or, at least, much, Python without it. I certainly see how it could be straightforwardly extended to make me feel pretty comfy...a tribute, of course, to Python's reflection capacities. There's this time/energy problem though...:)) Cheers, Bijan Parsia. From effbot at telia.com Wed Feb 9 03:27:59 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 08:27:59 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> Message-ID: John Nielsen wrote: > rchowd1 at my-deja.com wrote: > > How do we handle sessions in python (server side) ? > > > > Could you please explain with a simple example with a form > > (client-side) and python (server-side). > > You're probably not using 'SetValue' in order to set > session/application values. umm. just curious, but I thought Python was a programming language, not a web application server. or in other words, the answer could have been "it depends on what web server environment you're using". but not this time. yet another case of mostly anonymous my-deja posters asking (and in this case answering) a strange question. who's behind this secret conspiracy? qopp- at my-deja.com: performance issues between scripting languages in asp pages daryl_stult- at my-deja.com: win32security, client privleges stevie_dej- at my-deja.com: pickling parent thucdat114- at my-deja.com: corel + borland = the end of MS win fcahoo- at my-deja.com: whitespace as syntax jeremiahroger- at my-deja.com: nonlinear programming? eschen4- at my-deja.com: how to lock Zope-shared file with DAV E "Erase your 95/98/NT, install Linux now. Bright future for everything." (hmm. is it just me, or is it a trend in there...) From gmcm at hypernet.com Mon Feb 14 14:02:43 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 14:02:43 -0500 Subject: Python sucks loud In-Reply-To: Message-ID: <1261567534-40235659@hypernet.com> Forget it/ HelloAgain wrote: > > > Forget it wrote: > > > >You people are funny here, all excited about Python. > > > >Following one guy's recommendation, for two days already I'm looking at > > > >Python as a potential plug-in language, and it DISGUSTS me. > Isn't that a bit creepy that so many people want to isolate themselves > from anything, about which they're not sure ahead of time that it'll > agree with their preferences? We are wondering, since Python obviously violates all your preferences, why you're still around. Or were you calling us creepy, and in the process establishing the fact that you've been neutered? - Gordon From Vladimir.Marangozov at inrialpes.fr Wed Feb 16 15:09:34 2000 From: Vladimir.Marangozov at inrialpes.fr (Vladimir Marangozov) Date: Wed, 16 Feb 2000 21:09:34 +0100 Subject: RC (was Re: Real Problems with Python) References: <001901bf7862$a0d1dee0$b7a0143f@tim> Message-ID: <38AB03FE.F05C9612@inrialpes.fr> [Tim & Vladimir, on the impact of reference counting (RC) compared to more elaborated garbage collection (GC) algorithms on locality of reference (LOR).] [Tim] > > [Vladmir & Tim have apparently lost everyone, so let's wrap it up] You're right. Let's bring the volunteers on board! > > [Tim] > >> Vlad, you're trying to get "deep" on what is really a "shallow" point: > > [Vladimir Marangozov] > > Tim, you're trying to get "shallow" on what is really a "deep" point. > > I suspect it's really a bit of both! And I have to admit that "deep" and "shallow" are perfectly balanced . > This started as a very brief Usenet > posting, and I don't feel bad about pointing people to LOR (locality of > reference) as a way to get a first handle on why RC (reference counting) has > run faster in Python than every "real GC" attempt to replace it. Well, I for one don't feel good with misleading arguments . By mentioning LOR in this highly valuable thread, you're suddenly getting "deep" <0.9 wink>. Python was not implemented with LOR in mind, though some of the objects have been subsequently tuned to be slightly "LOR aware". I would have exposed lighter arguments for a first kiss between RC & GC: "RC is fast enough and handles successfully 95% of the cases; it was easy to implement and the GC implementations available 10 years ago, when Python has seen the light for the first time, were unappropriate for a number of reasons. See the FAQ for a discussion on some of them". Moreover, we've experienced that RC is error prone and obviously it cannot handle cyclic trash, so it's desirable to include some form of more sophisticated garbage collection, adapted to Python's peculiarities. However, this is a very subtle task, because we cannot get rid of RC "just like that". It's something too fundamental in Python that penetrates its most inner internals. Worse, a number of implementation strategies have been adopted, specifically because we had RC. (I'll not mention them here to avoid technical details) Well, someone could try to get rid of RC by redefining Py_INCREF/Py_DECREF to empty macros , but she'll see a fat core dump pretty soon, which is not so attractive as a solution. And if we plug a "conventional" garbage collector and disable RC, it doesn't perform well because of this chronic Python dependency on the RC "drug". Period. That's why, after several long debates here and there, some brave people that I won't name (they are too precious to be exposed in public ) have had the idea of implementing a garbage collector "on top of" RC, thus preserving Python's strong dependency on RC. At that time, I think that Tim was with mixed feelings (check DejaNews for details), but he encouraged the pioneers to implement their ideas, which proves BTW that he was not one of them . Nor was I. This is a complete, gentle and pretty fair introduction to the whole story about RC and GC in Python, without any big words like LOR. > To a first approximation, LOR is the single most useful concept to get > across to people struggling with memory issues on VM (virtual memory) > systems. To a second approximation, "cache effects" is more accurate, > but also much harder to get a grip on. To a third approximation, > "platform quirks" would have covered my ass completely, yet left > everyone without a clue. I like this much better (except that VM stands for Vladimir Marangozov in the first place ). Not sure that by saying it you've attracted many passengers on board, though. > > So I'm definitely indulging in idealized fiction, that happens to be true > in some actual cases. My track record of *predicting* how various gc > approaches would turn out in Python ain't half bad, you know . Only because you're half lucky when you predict wrong . > OTOH, your saying "it ain't necessarily so!" in six ways is six > times true, but doesn't leave people with even a sixth of a first > approximation to trip over. Point taken (see above), but let me reiterate that explicitly: Don't ever think about LOR if you're a normal Python user and/or developer. LOR is a blob that you'd eventually want to consider only for *tuning*, not designing, a memory manager for Python. It's such a crap that if you want some truth, you'll have to poke in kernel mode the virtual memory manager (VMM) of your machine. If you can't poke your VMM, all bets are off. In other words, you simply don't want to do that. > If they're interested enough, they'll pursue it and fill in the > painful details themselves. Fair enough. >> >> And that's why I don't buy your argument. > > That's OK by me: you're still trying to make it too deep . Oh, I can make it even deeper <0.5 wink>, but as far as we agreed that it's not that shallow, I'll try to take a short vacation in some indentation thread . Because, let me tell you one thing -- white space affects directly the LOR of the parser, which infects the LOR of the compiler, which infects the builtins and the whole Python world. I have formal proofs that any change of the indentation rules results in 35% increase of the page faults for only 63.7% of the cache misses. The net effect is an overall slowdown of 10%. What's the conclusion? The conclusion is that we shouldn't bother changing the indentation rules, because a simple printf inserted by Marc-Andre in the beginning of eval_code2 is enough to slow down the interpreter by 5%, (Tim, do you remember that experiment? -- only cache misses and very bad LOR ). Therefore a second printf at the end of eval_code2 should be sufficient to achieve the same net effect of 10%. just-an-educated-guess-with-a-conclusion--ly y'rs -- Vladimir MARANGOZOV | Vladimir.Marangozov at inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252 From claird at starbase.neosoft.com Fri Feb 18 21:19:15 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 18 Feb 2000 20:19:15 -0600 Subject: Which GUI? References: <88jg9f$ssd$1@nnrp1.deja.com> Message-ID: <90041EE28E4B778A.B7E5C38CAFBFC6FD.1FE0A06FDC52F8CF@lp.airnews.net> In article <88jg9f$ssd$1 at nnrp1.deja.com>, wrote: > >> I would like pro and cons for the different GUI's > >I would like to add: > >Is there any GUI toolkit that supports the following >requirements? > >- As portable as Python. . . . No. 'Never will be. Python is magnificently portable. It's really, *really* good in this regard. I propose that there will NEVER be a GUI toolkit that handles WinCE, QNX, MacOS, NeXT, BeOS, ... with comparable comfort. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From thomas.heller at ion-tof.com Wed Feb 2 13:29:33 2000 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Wed, 2 Feb 2000 19:29:33 +0100 Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) References: Message-ID: <037101bf6dab$7424d7b0$4500a8c0@thomasnotebook> > First, I'm intrigued by Eiffel's Programming by Contract. Can anyone > enlighten me on this subject, or post some links? > Look at demo/metaclasses/Eiffel.py in the source distribution! Thomas Heller From tim_one at email.msn.com Thu Feb 24 20:42:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 24 Feb 2000 20:42:29 -0500 Subject: system return status on Windows In-Reply-To: <38B53760.22753DE0@nembv.cz> Message-ID: <000c01bf7f31$93a8c6e0$b62d153f@tim> [Milos Prudek Python 1.5.2, Pythonwin, Win98. ] > I cannot get nonzero status from os.system() call in MS Windows. That's OK -- neither can anyone else. > Like this: > > print os.system('arj a test nonexistent_file') > > I have verified that errorlevel is raised, Actually, you haven't: you've verified that arj sets errorlevel, but that's not how Microsoft's implementation of the C library function "system" (which Python invokes) works. MS's system actually acts like command.com /c arj a test nonexistent_file and command.com *always* returns a 0 exit status. That's what os.system sees. So you're stuck. It may (or may not ... anyone know for sure?) work to install "a real shell" instead, and set the MS envar COMSPEC to point to it. You could also try os.spawnv or os.spawnve (but those only exist under Windows). BTW, don't expect os.popen to work sensibly under Windows either. python-is-only-a-few-thousand-lines-of-excruciating-code-away-from- making-this-stuff-appear-to-work-under-windows-ly y'rs - tim From qoppi at my-deja.com Tue Feb 8 15:39:24 2000 From: qoppi at my-deja.com (qoppi at my-deja.com) Date: Tue, 08 Feb 2000 20:39:24 GMT Subject: scripting language performance issues Message-ID: <87puts$2ff$1@nnrp1.deja.com> i've done some rudimentary testing using wcat to view performance differences between scripting languages for a set of pages ( vbscript, jscript, python,perlscript). Initial results indicate that using vbscript as the server side scripting language consistently results in more pages being served by the webserver...has anyone else had a similar experience? Sent via Deja.com http://www.deja.com/ Before you buy. From felixt at dicksonstreet.com Wed Feb 23 21:44:32 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Wed, 23 Feb 2000 20:44:32 -0600 Subject: functional programming In-Reply-To: References: Message-ID: <3.0.5.32.20000223204432.008668e0@mail.dicksonstreet.com> At 02:00 2/24/00 +1100, Jason Stokes wrote: > >Remco Gerlich wrote in message ... >>Michal Wallace (sabren) wrote in comp.lang.python: >>> I guess my original question had to do with what functional >>> programming looks like in the wild, and what it might look like in >>> python. Aahz posted a recursive version of a fib() routine. Is this >>> not what you'd want? What would fib() look like in one of the >>> functional languages you're used to? >> >>Michael Hudson posted this little bit of Haskell last week: >> >>fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ] >> >>I can't translate that to anything resembling Python at all. I don't >>know if list comprehensions in Python will be/are this powerful. > > >This example exploits lazy evaluation. Since Python is strict, like most >procedural languages, it isn't possible to produce this in Python. > > >-- >http://www.python.org/mailman/listinfo/python-list > > Isn't this more or less the same thing, except that it's not as terse?: import UserList class LyinLazyFibber(UserList): def more(self, now, goal): sofar = self.data nexttolast, last = sofar[-2:] for next in range(goal - now): next = last + nexttolast sofar.append(next) nexttolast, last = last, next self.last = goal def __getitem__(self, index): if index < 0: raise "CantGetThereFromHere" if index > self.last: self.more(self.last, index) return self.data[index] def __getslice__(self, left, right): if right < 0: raise "NotInThisLifetime" if right > self.last: self.more(self.last, right) return self.data[left:right] def __init__(self, first2=None): if first2 is None: self.data = [1,1] elif len(first2) != 2: raise ValueError, "value must be a list of 2 numbers" else: try: test = first2[0] + first2[1] except: raise TypeError, "objects %s %s cannot be added" % tuple(first2) else: self.data = list(first2) self.last = 1 From kopecjc at worldnet.att.net Fri Feb 18 07:34:45 2000 From: kopecjc at worldnet.att.net (Joseph C. Kopec) Date: Fri, 18 Feb 2000 12:34:45 GMT Subject: Problem in Using re.subn() Message-ID: <38AD3BEF.221D4108@worldnet.att.net> I was working through an example in Preston Lander's "Writing CGI Scripts in Python" on DevShed (http://www.devshed.com/Server_Side/Python/CGI/) -- an excellent article, which I highly recommend -- and kept getting an error message when attempting to run a script set forth therein containing re.subn(). Basically, the re.subn() call looks like this: def Display(Content): TemplateHandle = open(TemplateFile, "r") # open in read only mode # read the entire file as a string TemplateInput = TemplateHandle.read() TemplateHandle.close() # close the file # this defines an exception string in case our # template file is messed up BadTemplateException = "There was a problem with the HTML template." SubResult = re.subn('', Content, TemplateInput) if SubResult[1] == 0: raise BadTemplateException print "Content-Type: text/html\n\n" print SubResult[0] Which gives a Trackback of: Traceback (innermost last): File "/usr/local/apache/cgi-bin/process.py", line 100, in ? DisplayForm() File "/usr/local/apache/cgi-bin/process.py", line 38, in DisplayForm Display(FormInput) File "/usr/local/apache/cgi-bin/process.py", line 23, in Display SubResult = re.subn('', Content, TemplateInput) File "/var/tmp/python-root/usr/lib/python1.5/re.py", line 52, in subn pattern = _cachecompile(pattern) File "/var/tmp/python-root/usr/lib/python1.5/re.py", line 33, in _cachecompile value = compile(pattern, flags) File "/var/tmp/python-root/usr/lib/python1.5/re.py", line 79, in compile code=pcre_compile(pattern, flags, groupindex) pcre.error: ('nothing to repeat', 6) I know my Content and TemplateInput values are good strings. Does anyone have any guess what is going on? Any suggestions would be much appreciated. From cbbrowne at news.hex.net Tue Feb 22 22:53:24 2000 From: cbbrowne at news.hex.net (Christopher Browne) Date: Wed, 23 Feb 2000 03:53:24 GMT Subject: Cool things about Ruby on the way out of Python? References: <38B205AE.666D1AA2@mincom.com> <874sb1j2vm.fsf@ev.netlab.co.jp> Message-ID: Centuries ago, Nostradamus foresaw a time when Yukihiro Matsumoto would say: >Some points in Python which I don't like are too essential to remove >from the language (e.g. block by indentation) I'd think it an interesting idea to have a Lisp mapping of Python, whereby there would be "block by parenthesis" which would provide some interesting things: a) The ability to create an unambiguous "pretty-printer;" you'd transform to "s-expression form," pretty-print *THAT,* and then "DES" it, b) The ability to have a macro rewriting system, where you might write programs that build s-expressions, and then "DES" them. -- "``Normal'' people don't like things to be powerful or scalable or reusable, just pretty." -- posterkid (posterkid at psnw.com) cbbrowne at ntlug.org- From gerrit.holl at pobox.com Thu Feb 17 01:45:07 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 07:45:07 +0100 Subject: Abstract classes? In-Reply-To: ; from danielt3@gte.net on Thu, Feb 17, 2000 at 04:05:27AM +0000 References: Message-ID: <20000217074507.B1675@stopcontact.palga.uucp> Daniel T. wrote on 950756727: > Also, any general critiques of this code? > > class Observer: > def update( self ): > raise "sub-classes must over-ride this method" raise NotImplementedError("sub-classes must override this method") >>> print NotImplementedError.__doc__ Method or function hasn't been implemented yet. The NotImplementedError was designed *exactly* for this case. regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From mridulj at newgen.co.in Wed Feb 23 02:13:37 2000 From: mridulj at newgen.co.in (Mridul) Date: Wed, 23 Feb 2000 12:43:37 +0530 Subject: Comparing perl and python Message-ID: <007701bf7dcd$80ea0010$b305a8c0@matrix> Here's something to chew on as far as speed is concerned: Python2C More recently, Bill Tutt and Greg Stein developed Python2C. This translates Python to C code. Mostly, the C code ends up manipulating PyObjects in much the same way as if you had recreated the Python code in C using the high level Python / C API. That is, you'll get a speed up from the fact that there's no byte-code interpreter loop, but that's less than most people expect. (There's been a lot of talk about global program analysis and type deduction. When these ideas bear fruit, more dramatic speed ups will become possible.) By the way has anybody used it?????????If so please give us a feedback and from where to download it from........ > > > > > > > > Aahz Maruch wrote in message > news:88vtfj$egl$1 at nntp6.atl.mindspring.net... > > In article , > > Tim Roberts wrote: > > > > > >It's clear that there is a substantial library of modules for python, > > >approaching that of perl. However, I am disturbed by what seems to be a > > >dramatic performance difference. I've tried writing some simple test > cases > > >in both languages, and I'm finding python to be 2x, 3x, and in one case > 12x > > >slower than the equivalent program in perl. (The 12x case was a simple > > >"grep the files in stdin", using the "re" and "multifile" modules in > > >python.) > > > > In raw speed, Perl tends to run about twice as fast for the most > > "obvious" way to do things. This advantage spreads to 5x or 10x when > > you talk about the "obvious" way to do certain kinds of I/O. > > > > The advantage diminishes rapidly when you compare the code of expert > > programmers, and it mostly vanishes when you start looking at real, > > complex programs. Main reason for that is that Python code is so much > > easier to write, you spend more time looking at the algorithms -- that's > > where you get your order of magnitude increases in performance. > > > > Remember that Perl is optimized to be a "super AWK". And IMO, that's > > about all it's good for. > > -- > > --- 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 > > > > Love does not conquer all. Humans are extremely flexible, usually more > > flexible than we're willing to admit. But some flexibility comes at a > > cost, and sometimes that cost is more than we can bear. > > -- > > http://www.python.org/mailman/listinfo/python-list > > > From robin at jessikat.demon.co.uk Tue Feb 15 19:35:14 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Wed, 16 Feb 2000 00:35:14 +0000 Subject: Real Problems with Python References: <000e01bf7763$dc8a9300$66a2143f@tim> Message-ID: In article , Fran?ois Pinard writes >neelk at brick.cswv.com (Neel Krishnaswami) writes: > >> I thought that the Smalltalk and Scheme designers were in regular >> communication. > >Great minds and good people stay in regular communication. Aren't we all >often reading (and writing to) this mailing list? :-) :-) Keep happy! > oooooooommmmmmhhhhh oooooohhhhhmmmmmmm, ooooommmmmhhhhhh mani padme oooooohhhhmmmmmm :) -- Robin Becker From claird at starbase.neosoft.com Mon Feb 21 00:08:34 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 20 Feb 2000 23:08:34 -0600 Subject: Which GUI? References: <38B04C8C.45F96A76@bellatlantic.net> Message-ID: In article <38B04C8C.45F96A76 at bellatlantic.net>, Steve Holden wrote: . . . >If we wanted a minimalist solution we would hardly be using Windows >as an operating system, would we? And Tcl/Tk certainly works OK, though >it would be nice if its Win implementations made it easier to conform >to the platform's look and feel. . . . Tk is indeed moving in that direction. Slowly. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From mstenber at cc.Helsinki.FI Tue Feb 29 09:42:56 2000 From: mstenber at cc.Helsinki.FI (Markus Stenberg) Date: 29 Feb 2000 16:42:56 +0200 Subject: Blowfish in Python? References: <000a01bf810a$422a7cc0$172d153f@tim> Message-ID: "Tim Peters" writes: > [Markus Stenberg] > > ... > > speed was horrendous. > > > I think the main reason was the fact that I had to use _long ints_ for > > calculations, as the normal ints are signed, and apparently the bitwise > > operators do not work as advertised when bit32 is set (=number is > > negative). Or that's my theory anyway - my implementation worked with > > long's and did not work with ints. > Try to whittle this down. Negative ints are nothing special to the bitwise > ops, so if they "don't work as advertised" it would be a (very surprising!) > bug in the implementation. For example, here's the implementation of int &: > They're all like that -- they can't screw up unless C screws up. Hmm.. As far as I'm concerned, shifts for example do screw up. i.e. 0xffffffff >> 30 [64bit Python: 3] [32bit Python: -1] As far as I'm concerned, that should _not_ happen. Or maybe it's just me. > And are routinely highly optimized too. Once you get "&" to work , > one machine instruction in C is going to turn into a couple of function > calls in Python. Yes, & works. + does not (that's obvious), but shifts not working was disappointment (made implementation of say, +, somewhat painful and thus inefficient). > > my Python-with-longs implementation was kilobytes/second, to be precise, > > 2-10k/s depending on the machine. > Using ints will get you the biggest bang for the buck at this point, but > it's never going to be *fast* in pure Python 1.5.2. As a matter of fact, my "function for >> and +" approach was actually _slower_ than just using long's and (when needed) rounding them down. Problem, apparently: each "most simple cycle" in Blowfish code involves 3 shifts to right, one +, and several array lookups. Guess I could gain lot of speed by putting the stuff within One Huge Function(r), but I intended code to be somewhat readable as well.. *sigh* > not-implying-it-will-be-faster-in-later-versions-either-ly y'rs - tim -Markus -- Finger mstenber at sirppi.helsinki.fi for my PGP public key: pub 1024/5DAC7D21 1994/04/20 Markus Stenberg Key fingerprint = 25 BA 5B 57 F1 77 0C F0 2A D0 E6 3A 2E 81 6F D3 From a.eyre at optichrome.com Mon Feb 14 13:56:39 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 14 Feb 2000 18:56:39 -0000 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <1261569578-40112683@hypernet.com> Message-ID: <001c01bf771d$399d72c0$3acbd9c2@peridot.optichrome.com> > And what should ['a',3,None,[Tim(1),Tim(2)]].join(';') return? The same as string.join(['a',3,None,[Tim(1),Tim(2)]], ';') or ";".join(['a',3,None,[Tim(1),Tim(2)]]) > It would be most bizarre to have a method on list that only > worked for certain kinds of lists, (and guessing your intent is > the specialty of that other language). Fair point. I see the conversion from string.method(x, y) to x.method(y), not y.method(x). It doesn't feel like join is an instance method of a string. Putting join onto the string implies you are 'join'ing the string. If string.split() and string.join() are logically inverse functions, one converting from string to list and one converting from list to string, how, from an OO perspective, can they both end up as instance methods on the same type? Maybe " ".join should be renamed to: " ".useThisAsTheSeparatorToJoin(["my", "list"]) Furthermore, this will make a previously optional argument (separator) compulsory. > Your needs are met by (", ").join("a:b:c".split(":")). Requiring > the arg to be a list-of-strings is restrictive, but not bizarre. The other alternative would be to allow it on all lists, but run the list through... map(lambda x: str(x), ) ...first. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From gmcm at hypernet.com Fri Feb 18 08:47:00 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 08:47:00 -0500 Subject: Python misconceptions in IBM Ruby article... In-Reply-To: Message-ID: <1261240945-13317119@hypernet.com> Quinn Dunkan wrote: > On Thu, 17 Feb 2000 22:31:34 -0500, Gordon McMillan wrote: > >In a language where variables don't have to be declared, > >creating scoping rules that could tell the difference between an > >instance variable and a local would be a, um, challenge. > > You might have to do something weird like stick a '@' in front of your > variable. Ah, and then: s/@/self./g Gotcha! And while we're at it: s/;//g - Gordon From effbot at telia.com Sun Feb 6 03:41:24 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 08:41:24 GMT Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> Message-ID: Chadha, Saurabh wrote: > Can anybody mail be a postscript of the Tkinter manual, the one on > the python.org site, i am not able to print it because of some CS8 missing > error from acroread. get acrobat 4.0 and those problems will go away: http://www.adobe.com/products/acrobat/readstep.html From tim_one at email.msn.com Sat Feb 26 01:29:56 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 01:29:56 -0500 Subject: fatal SIGSYS under irix In-Reply-To: Message-ID: <000201bf8022$e61bfae0$3c2d153f@tim> [Quinn Dunkan] > % python ~/tmp > quinn at cholera > Python 1.5.2 (#10, Feb 11 2000, 15:14:46) [GCC 2.8.1] on irix6-n32 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> f = open('foo') > >>> f.seek(1, -4) > zsh: 61898 invalid system call python > 140% > > Granted, I reversed the order of the arguments for seek(). But > killing the interpreter is a bit harsh. This happens on all > irix systems I was able to test. Linux just ignores the bad > SEEK_* arg. I'd say both OSes are unreasonable here (Irix shouldn't blow up, Linux should at least complain). Under Win95 (dear Lord, how embarrassing for Unix ): >>> f = open("blah.blah") >>> f.seek(1, -4) Traceback (innermost last): File "", line 1, in ? IOError: [Errno 22] The device does not recognize the command >>> > I don't know if this is because it doesn't send SIGSYS for that, or > because linux python is catching it. The hpux and solaris boxes > are down so I couldn't test them... Look at function file_seek in Objects/fileobject.c. Regardless of platform, Python clears errno, calls the platform's flavor of fseek, and raises an exception based on the new errno value if the fseek returns a non-zero result. Python generally doesn't try to validate arguments when using a tissue-thin wrapper around a libc function, partly because it seems redundant, partly because it doesn't want to prevent you from getting at platform-specific extensions. But if the platform fseek is unreasonable about error-checking under several OSes, Guido would probably opt to validate fseek's argument himself. the-python-implementation-would-be-a-lot-simpler-if-oses-worked-ly y'rs - tim From jstok at bluedog.apana.org.au Thu Feb 3 06:20:59 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Thu, 3 Feb 2000 22:20:59 +1100 Subject: Haskell or Python! References: <38994478.72056B85@cui.unige.ch> Message-ID: <3mdm4.17496$3b6.72189@ozemail.com.au> Sunil Hadap wrote in message <38994478.72056B85 at cui.unige.ch>... >I am confused which is better language for the purpose. Here are more >specific questions > >- Can Haskell be used as interpreted language so that the animator > can code interactively in the animation software Yes. There's an implementation called "HUGS" which is interpreted. >- Is Haskell matured to provide good support to libraries such as I/O > GUI, network like Python Haskell does have a socket and a GUI library, but they're very limited. Haskell is very weak on library support. Haskell is especially weak on IO, being a pure functional language. Haskell is designed mainly to be of interest in the language research community. >- Can I use traditional OO concepts in Haskell though it is Functional Yes. Haskell is fully object oriented. >- Is it dynamically typed. I mean can I get full information of type >and > its constituents (members) dynamically. No. Haskell is a statically typed language with no introspective features. >- Is it a good idea to mix Python and Haskell It's certainly possible. For example: implement the hardcore numerical stuff in Haskell, and the GUI stuff in Python. Both have COM bindings and C language interfaces, so could be persuaded to talk to each other. If functional programming is your thing, impure functional languages like Lisp or Erlang or Clean are real options. However much I like Haskell's design I can't see it being useful for general purpose development. From greene at hctc.com Mon Feb 21 13:08:47 2000 From: greene at hctc.com (Collin Greene) Date: Mon, 21 Feb 2000 11:08:47 -0700 Subject: where can i get python? any tips? a Message-ID: I am looking python does anyone know where I can download it? also any tips anyone would be willing to share would be greatly appreaciated. From uche.ogbuji at fourthought.com Sun Feb 6 12:20:47 2000 From: uche.ogbuji at fourthought.com (Uche Ogbuji) Date: Sun, 06 Feb 2000 10:20:47 -0700 Subject: Worldpilot Message-ID: <389DAD6F.100404A4@fourthought.com> We are eager to try out Worldpilot, which was demoed at IPC8, but it uses the Cyrus IMAP server, which we simply cannot get to work. We've tried 2 RPMs and rebuilding it twice on Red Hat 6.1. We can't even add a mailbox because the "SASL" password muck is apparently broken. We have searched Dejanews, Google, etc., and there are many complaints about this but no solutions that worked for us. So, my questions are: 1) Is there any way to get Worldpilot to work with good old UW IMAP? 2) Can a working Cyrus IMAP be installed on RH 6.1 without having a black-belt in TCL/SASL/whatever? Thanks for any help. -- Uche Ogbuji Fourthought, Inc., IT Consultants uche.ogbuji at fourthought.com (970)481-0805 Software-engineering, project-management, knowledge-management http://Fourthought.com http://OpenTechnology.org From bestvina at math.utah.edu Wed Feb 23 11:45:49 2000 From: bestvina at math.utah.edu (Mladen Bestvina) Date: Wed, 23 Feb 2000 09:45:49 -0700 Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> Message-ID: <38B40EBD.13EC1C1E@math.utah.edu> Fredrik Lundh wrote: > you've stumbled upon a basic Python feature: you cannot > change the indentation level unless you're opening a new > block. > > in other words, get rid of that extra leading space, and see > if you get any further. Sorry, here it is again: mladen at drava:/home/mladen/projects/grayson > python Python 1.5.2 (#4, Feb 14 2000, 16:39:33) [GCC pgcc-2.91.57 19980901 (egcs-1.1 re on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import _tkinter >>> import Tkinter >>> Tkinter._test() Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 1947, in _test root = Tk() File "/usr/local/lib/python1.5/lib-tk/Tkinter.py", line 886, in __init__ self.tk = _tkinter.create(screenName, baseName, className) TclError: Can't find a usable init.tcl in the following directories: This probably means that Tcl wasn't installed properly. From thomas at xs4all.net Tue Feb 8 04:45:28 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Tue, 8 Feb 2000 10:45:28 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87on3m$p2i$1@mach.vub.ac.be>; from thamelry@vub.ac.be on Tue, Feb 08, 2000 at 09:19:50AM +0000 References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87on3m$p2i$1@mach.vub.ac.be> Message-ID: <20000208104528.O19265@xs4all.nl> On Tue, Feb 08, 2000 at 09:19:50AM +0000, Thomas Hamelryck wrote: > Roy Smith wrote: > : I'm a hard-core python addict, and I agree 100% with fcahoon. This > : sillyness with indenting for statement grouping is without a doubt the > : most serious blemish on the language. > I am in exactly the same position. It was a serious design error. > I wonder how the CP4A people are going to explain to complete > computer illiterates that a python program can contain errors that > are _not even visible_ when you look at the code. It was obviously not a design error -- a lot of people like it. As for how CP4E is going to solve it -- probably by telling people not to mix tabs and spaces. Tabs are great, I usually use tabs. But tabs are 8 spaces, period. If you want less indentation, use spaces -- do not shrink tabs. (Unless, of course, everyone uses tabs, and only tabs.) As has been said before, indentation is NOT invisible. If it is invisible (ie, spaces/tabs with no visible characters following) then the python parser doesn't care about it, either. The only thing that is confusing and invisible is the difference between tabs and spaces. The least you can do when editing someone else's python code is check how he/she does his/her indentation, and match that. But even that isn't too necessary, as long as you check that tabs are always eight spaces. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From erw at dde.dk Mon Feb 14 10:05:41 2000 From: erw at dde.dk (Erwin S. Andreasen) Date: 14 Feb 2000 15:05:41 GMT Subject: perl-like -M option Message-ID: perl has a useful -M option that lets you import a module on the command line. E.g. perl -MLWP::Simple -e 'print get "http://www.python.org"' will import the LWP::Simple module, then run the get function from that (which gets a documented point to by an URL) and prints the result. I personally find that handy so I've implemented something similar in Python. If you specify: -Mmodulename It does a "from modulename import *" -Mmodulename:foo It does a "from modulename import foo" -Mmodulename: It does a "import foo" (accidentally, -Mm1,m2,m3: works too) Before: ./python -c 'import urllib, string;\ print string.join(urllib.urlopen("http://berta").readlines(), "")' After: ./python -Murllib -Mstring -c 'print join(urlopen("http://berta").readlines(), "")' It feels a bit more readable in such oneliners. More usefully, this could be used to invoke some modules that make magic stuff happen to an existing program, without having to edit the program. E.g. consider this (there may be some obvious ways of manipulating the dictionaries easier, but I've only written some 500 lines of various Python code so far :) ) Trace.py: --------- import sys trace = [ 'open' ] main = __import__('__main__') class Wrapper: def __init__(self,name,what): self.name, self.what = name, what def __call__(self,*args): print ">>", self.name, str(args), " = ", try: result = apply(self.what, args) except Exception, e: print e raise e, None, sys.exc_info()[2] print str(result) return result for x in trace: # Not sure if this is the most optimal way of doing it :) main.__dict__[x] = Wrapper(x, __builtins__[x]) If you have a file like: open("/etc/passwd", "r") open("/etc/passwd2", "r") and run: python -MTrace: thatfile you would get something like: >> open ('/etc/passwd', 'r') = >> open ('/etc/passwdd', 'r') = [Errno 2] No such file or directory: '/etc/passwdd' Traceback (innermost last): [...] Of course that will only affect the main module... but I suppose that you could override importing too, and add some code to add the tracing to the imported modules. Anyway, that's the general idea, that you can easily import modules on code you execute on the command line with -c, and that you can import modules that do something extra to the program executed. Does that seem useful? The patch against 1.5.2 is at http://www.andreasen.org/misc/pypatch -- it's currently not in a state that complies with the standards for patches as I can see them on www.python.org, just a tentative idea. -- ============================================================================== Erwin Andreasen Herlev, Denmark UNIX System Programmer <*> (not speaking for) DDE ============================================================================== From cgw at alum.mit.edu Wed Feb 23 14:01:48 2000 From: cgw at alum.mit.edu (cgw at alum.mit.edu) Date: Wed, 23 Feb 2000 13:01:48 -0600 Subject: Question about X window control References: <38B3FF12.9254AEDF@earthlink.net> Message-ID: <891aqs$mqq$1@info3.fnal.gov> In article <38B3FF12.9254AEDF at earthlink.net>, Jay Freeman wrote: > Hi, > > I'm a brand new Python guy (and like it). I'm working on an information > kiosk system running on Linux. It uses a touch screen and plays avi > video files. I'm using Popen3() to call xanim to display them. I'd like > to play them full screen but there doesn't seem to be any parameter to > xanim to allow that. If I can't do full screen I would at least like to > be able to center the xanim window, Well, this question doesn't have a lot to do with Python but I'll answer it anyway. xanim has a -S option to control scaling and a -W option to control window placement. If you type "xanim --help" you'll see it all spelled out in great detail. From jblaine at shell2.shore.net Wed Feb 9 10:16:10 2000 From: jblaine at shell2.shore.net (Jeff Blaine) Date: Wed, 09 Feb 2000 15:16:10 GMT Subject: IDLE and Hooks in apps for usage of My Favorite Editor Message-ID: Am I the only one who chooses specifically not to use IDEs (IDLE included) because they don't allow you to edit files with your editor of preference? Am I the only one on the planet who thinks allowing a programmer to use his/her editor of choice in applications is VERY important? I've seen _one_ application (TkRat, an IMAP client done in Tcl/Tk) in a long long time that allows calling an external editor. Is this a difficult task which I just don't understand the complexities of? From stidolph at origin.ea.com Fri Feb 25 10:48:07 2000 From: stidolph at origin.ea.com (Stidolph, David) Date: Fri, 25 Feb 2000 09:48:07 -0600 Subject: Phython as In-Game scripting language Message-ID: <11A17AA2B9EAD111BCEA00A0C9B41793034AB1F0@molach.origin.ea.com> Python is EASY to embed. Python code is easy to call from c/c++. It is easy to call C++ classes from Python (ala SWIG). Python is easy to code and understand. Very little downside to Python so far. With some work we hope to have the debugger and profiler working (already working to some extent, but needs some work). -----Original Message----- From: Shawn LeBlanc [mailto:wrlddomprod at hotmail.com] Sent: Friday, February 25, 2000 9:35 AM To: python-list at python.org Subject: Re: Phython as In-Game scripting language Greetings! >What sort of game are you writing? First person shooter on PC? Right now, it's more R&D than anything else. The idea is having a more-or-less generallized 3d engine, but the actual design seems to lean towards the Quake/Unreal model. So, we would be able to make a FPS with it, but that's not our goal as of yet. As a slightly off topic question, which other languages like Python could be embedded efficently in a game project? I've seen that several games use Lua (Grim Fandango), and there's got to be other games that use embedded languages. What would be the advantages and disadvantages of using Python in a game? with milk and cookies, Shawn ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com -- http://www.python.org/mailman/listinfo/python-list From tjreedy at udel.edu Thu Feb 24 18:02:52 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 18:02:52 -0500 Subject: where can i download python for free? References: Message-ID: <894cs4$nv6$1@news.udel.edu> www.python.org "Collin Greene" wrote in message news:sb32ip54r2a166 at corp.supernews.com... > i ma very interested in python but i cant really find where t get it, could > anyone help me out? > > From S.I.Reynolds at cs.bham.ac.uk Mon Feb 21 13:27:33 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Mon, 21 Feb 2000 18:27:33 +0000 Subject: Q: Catching any exception an printing it Message-ID: <38B18395.61EA@cs.bham.ac.uk> Python allows you to do, try: if a: raise SomeException() else: raise xyz() except: print 'There was an error' but is it possible to print out the exception if you don't know what type it is? I'd like the above error message to be more useful, but the exception raised inside the try block could be anything. Is it possible to find the last exception raised? Cheers, Stuart From daniels at mindspring.com Wed Feb 16 20:01:16 2000 From: daniels at mindspring.com (Alan Daniels) Date: 17 Feb 2000 01:01:16 GMT Subject: Where is the Python Journal? References: <8EDCA9C19PaCmAnRDLM@194.2.0.33> Message-ID: On 16 Feb 2000 14:08:54 -0600, the infinitely wise William Annis (annis at biostat.wisc.edu) spoke forth to us, saying... [snip...] >class memoize: > def __init__(self, fn): > self.fn = fn > self.args = {} > > def __call__(self, *args): > if not self.args.has_key(args): > self.args[args] = apply(self.fn, args) > return self.args[args] This is gold. Thank you! P.S. Count me in as another who goes out and buys the Perl Journal on a regular basis, even though my heart lies elsewhere. Its the closest thing I've found to a useful sort of "algorithms monthly" magazine that is actually written in something approaching English. Perl-is-arcane-at-times-but-it-beat-math-notationly your's, Alan. -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From moshez at math.huji.ac.il Sat Feb 26 09:28:38 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 16:28:38 +0200 (IST) Subject: Life's better without builtins? (was: Life's better without braces) In-Reply-To: <20000226151713.A3420@stopcontact.palga.uucp> Message-ID: On Sat, 26 Feb 2000, Gerrit Holl wrote: [I tried to write] > def reload(module): > del sys.modules[module] > exec 'import '+module [Gerrit found a bug] > No. The 'reload()' function takes a module and returns a module: > >>> import os > >>> reload(os) > I'm sorry, but my version is so buggy anyway, it probably isn't even funny. Someone did have a working version -- just search this thread. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From c_cazabon at hotmail.com Thu Feb 24 19:48:56 2000 From: c_cazabon at hotmail.com (Charles Cazabon) Date: Fri, 25 Feb 2000 00:48:56 GMT Subject: Comparing perl and python References: <88vtfj$egl$1@nntp6.atl.mindspring.net> Message-ID: <8EE4BF5F1hdjsdhdfh75738@news.sshe1.sk.wave.home.com> Aahz Maruch claimed in <88vtfj$egl$1 at nntp6.atl.mindspring.net>: >Remember that Perl is optimized to be a "super AWK". And IMO, that's >about all it's good for. Best description I ever heard was "`sed' on crack". Charles From bwarsaw at python.org Thu Feb 10 18:36:34 2000 From: bwarsaw at python.org (Barry Warsaw) Date: Thu, 10 Feb 2000 18:36:34 -0500 (EST) Subject: emacs CC-mode configuration for Python source References: Message-ID: <14499.19330.201219.820755@anthem.cnri.reston.va.us> >>>>> "TM" == Trent Mick writes: TM> I mean for editting the Python C source code, i.e. the C code TM> for the interpreter (.c and .h files). I was not clear. Yes, I TM> use python-mode for Python script code (.py files). Heh, I'm getting good at using Guido's time machine while he's not around. I only broke one toe this time! CC Mode supports styles; try using the "python" style, which is part of any recent CC Mode. I added that a long time ago when I starting hacking more of the Python C source. -Barry From fredrik at pythonware.com Tue Feb 1 05:48:51 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 11:48:51 +0100 Subject: Lexing in Python 2 References: <001501bf63f3$3c018ac0$ec2d153f@tim> <388B855A.78D6E46B@prescod.net> Message-ID: <010801bf6ca1$ee6bf450$f29b12c2@secret.pythonware.com> Paul Prescod wrote: > With all due respect, what the hell is shlex and how did it get into > the standard distribution? afaik, it's a support module for netrc: http://www.python.org/doc/current/lib/module-netrc.html > It is my unconsidered, uneducated opinion that lexers do not vary as > widely as parsers (LL(1), LR(1), LR(N) etc.) so we could just choose one > at random and start building modules around it. re 1.6? From thomas at bibsyst.no Mon Feb 14 08:17:57 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Mon, 14 Feb 2000 14:17:57 +0100 Subject: Simple client/server exchanging objects Message-ID: <38A80085.AECFF9EC@bibsyst.no> Hi, I`d like to make a client/server application exchanging objects of different type, sizes etc. Are there any simple tutorials or docs available on this, and what are my options on how to implement this ?? The objects are rather simple, but can be huge in size. Thomas From robin at jessikat.demon.co.uk Thu Feb 3 05:33:15 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 3 Feb 2000 10:33:15 +0000 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: In article , Alexander Williams writes >On Wed, 02 Feb 2000 20:22:04 -0800, James Logajan >wrote: > >>The vast majority of code (and programming languages) in the world require >>explicit memory de-allocation. I don't believe that a GC scheme has yet been >>invented that will work well for all problem domains. I'm sure if it had, >>we'd all be using it by now. ;) > >Once upon a time, the vast majority of programming languages used >explicit register allocation at the Assembly level, but then C was >introduced. Strangely, however, it was not /immediately/ taken up as >the Holy Grail, it took time to insiduously spread. > Well I used Algol60, 68, Fortran II, IV, Basic before C was invented in 1972. I don't remember having to take care of the registers. I'm probably senile though :) I used Pascal soon after it came out, I don't know if that was before C. Certainly CPL, B & BCPL were used/known by the early Unixers (Thompson, Ritchie, McIlroy kernighan et al.) and these preceded C. None of these languages required explicit register allocation. -- Robin Becker From neelk at brick.cswv.com Fri Feb 18 19:24:58 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 19 Feb 2000 00:24:58 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: <001301bf79dd$1c718c00$e62d153f@tim> Message-ID: Tim Peters wrote: > > What's *interesting* is what the language could provide if they were > available to a few insane souls to build on "under the covers". A > Scheme True Believer builds all control flow (from function calls > thru exceptions to pseudo-threading) on top of them. In fact, that's why I want them; NOT to use directly in code meant to be read and used on a daily basis, but to be buried discreetly in the guts of abstractions built on top of them. If they are ever included, I would expect the standard library to contain warnings like "If you use the continuation module, expect to confuse yourself." So I'd want continuations to build backtracking engines in Python with, which I'd then use to build useful GUI and collection manipulation libraries, and I'd want 'em to implement exceptions with restarts, to make exception-handling cleaner and more powerful, and definitely some slick pattern-matching and FSM schemes are also possible. Note that in every case the fact that continuations are used isn't even exposed to the user of the library, let alone the user of the application. Finally, extending bytecodehacks to optimize running code would also be fun. (This is not as deranged as it sounds! If you store profiling information, you could theoretically exploit stacklessness and coroutines to do nifty Self-style dynamic recompilation tricks. In pure Python, even.) Neel From alex at somewhere.round.here Mon Feb 21 21:27:41 2000 From: alex at somewhere.round.here (Alex) Date: 21 Feb 2000 21:27:41 -0500 Subject: Fast way to grab line from file? References: <88sprs$1ao$1@nnrp1.deja.com> Message-ID: Hi, Mateo. You try something like this: class lazy_file: def __init__ (self,filename, sizehint=10**7): self.file = open (filename, mode) self.sizehint = sizehint self.buffer = None def readline (self): if not self.buffer: self.buffer = self.file.readlines (self.sizehint) if not self.buffer: self.line = '' else: self.line = self.buffer.pop (0) return self.line f = lazy_file('file_i_want_line_100_from') for i in 100*[None]: line = f.readline () I don't know why, but it seems that slurping up a chunk of the file using readlines and a sizehint is generally faster than just doing a whole lot of readline calls. It may help in your case. If that still weren't fast enough, I would probably try something like first_hundred = os.popen('head -100 file_i_want_line_100_from').readlines() if len(first_hundred) == 100: line = first_hundred[-1] else: line = '' next. Don't really know whether it would help, though. Alex. From curtin at my-deja.com Wed Feb 16 09:00:04 2000 From: curtin at my-deja.com (curtin at my-deja.com) Date: Wed, 16 Feb 2000 14:00:04 GMT Subject: rtti unix vs win32 Message-ID: <88eah3$8fj$1@nnrp1.deja.com> i've been given a new mandate to get my code running on unix as well as win32. what is the best way to do a run-time type identification of what o/s my program is running on? i'm doing this in quite a few locations and i'm hoping just to check some sys parameter but have no idea on which one... also, on NT i use the CreateProcess() where on unix i'll have to fork()/exec(), it seems that pdb() gets messed up after the fork. any way to debug after forking? thanks, craig Sent via Deja.com http://www.deja.com/ Before you buy. From a.eyre at optichrome.com Wed Feb 2 12:54:01 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Wed, 2 Feb 2000 17:54:01 -0000 Subject: Removing [methods from] a superclass? In-Reply-To: <877gl5$1tu$1@nnrp1.deja.com> Message-ID: <001b01bf6da6$7cb09810$3acbd9c2@peridot.optichrome.com> > It's not his inheritance model; he is trying to reuse code, isn't he? Indeed. But in a confusing way. In what sense is a "string" thought of as a "list". IIRC Python already has a vague object hierarchy (even though it is written in C not C++): Object +- Sequence | +- List | +- Tuple | +- String +- Mapping | +- Dictionary +- Number +- Integer +- Long integer > He shouldn't have to rewrite the system libraries to have a system class > inherit from a user defined class. Maybe this indicates the system libraries need reworking. The UserXxxx classes are only a temporary fix until the point when Python finally loses the type/class distinction. > In his book Framing Software Reuse, Paul Bassett introduces the notion > of "frames", which complement traditional OO programming. A frame has > the ability to add, *delete*, select, modify, and iterate the default > properties of other frames. Bassett believes that deletion of properties > is integral to successful reuse in the real world. Perhaps. But I can well see this idea more open to abuse. Deciding class roles/inheritences is always tricky, but seeing as Python already has this defined to a certain extent, it seems odd not to use it. > Heck, even Eiffel, seemingly language of choice of the Object Gestapo > ;-) lets you undefine features (albeit with some restrictions). Never played with it. Nor Smalltalk. Python does just about everything I need in a language. :) ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From gherman at darwin.in-berlin.de Tue Feb 8 05:07:18 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Tue, 08 Feb 2000 11:07:18 +0100 Subject: ANN: calie 0.5 (mostly for LaTeX users) Message-ID: <389FEAD6.1A8427B9@darwin.in-berlin.de> Hello all, working on a rather "large, collaborative" LaTeX project (read: two people working on the dissertation of one of them) on Windows and Macs and having no GNU recode immediatly avail- able I felt the need for something like a poor man's recode replacement to translate between different LaTeX input charac- ter encodings. This is exactly what calie.py does. The only basic catch (or feature, depending on your point of view) is that calie needs certain files of an existing LaTeX distribution (very few though). There's not much more to be said, except to refer to the doc string of calie.py available here: http://starship.python.net/crew/gherman/playground/calie/ Any-comments-welcome'ly, 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 Thu Feb 17 16:16:57 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 17 Feb 2000 14:16:57 -0700 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38AC50B2.3FAF778@sage.att.com> Message-ID: <38AC6549.8C48CA4@callware.com> Hi All-- "Garrett G. Hodgson" wrote: > > osorronophris osorronophris wrote: > > > > I'm a die-hard C++ programmer that recently took up Python for a change of > > scenery and am enjoying it greatly. The one problem I am having is that I > > can't break myself of the semicolon habit. I've tried chewing gum but it > > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? > > glue an inverted thumbtack to your ";" key. > if that doesn't work, coat it with poison, > or maybe LSD. > I guess it shows what sort of person I am when I find this suggestion at once gleefully morbid and deliciously elegant in its simplicity. Surely, it is the most Pythonic of the proferred solutions. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 dnf1 at cec.wustl.edu Wed Feb 16 12:05:49 2000 From: dnf1 at cec.wustl.edu (David Fisher) Date: Wed, 16 Feb 2000 11:05:49 -0600 Subject: socket troubles (repost) Message-ID: <38AAD8EC.1743D5CF@cec.wustl.edu> Sorry if this is a repeat, i can't see the first post on the mailing list, so i'm sending it again Hey, interesting program. I don't do much with Tk, so I learned a bit reading this. Too bad createfilehandler doesn't work on win32, where I do most of my programming. Luckily my computer dual boots :). Anyhoo, your code was fine for send and recv on a socket, the problem was that telnet protocol is more that just sending and receiving. I don't know what the protocol is, luckily I don't have to, the telnetlib does. And by another lucky coincidence you can pass a Telnet object instead of a socket to the Tk handers. Cool huh? Your code with the telnetlib changes is below. I also changed a couple of other things in writesock. I added a newline to the data going out, and cleared the entry buffer after sending. But. Before you go any further, why reinvent the wheel? Search the vaults of parnassus (http://www.vex.net/parnassus/) for 'mud' and you might find a few mud clients already written in Python. BTW, on a style note, I wouldn't import all those modules using from import *. I'd be worried about a name collision. But, then I'm a slow, cautious kind of guy. David #!/usr/bin/python from Tkinter import * from _tkinter import * from string import * from re import * from telnetlib import Telnet #************************* #*** Get input from the socket and post it to the screen #************************* def readsock(*args): data = s.read_eager() #*** Telnet arbitration stuff here if compile(chr(255)).search(data): print "IAC\n" textbox.config(state="normal") textbox.insert(index="insert", chars=data) textbox.see(index='end') textbox.config(state="disabled") #************************* #*** Write to the socket #************************* def writesock(*args): global contents info = contents.get() + '\n' contents.set('') s.write(info) #************************* #*** Declare some variables ************************* HOST = 'shwaine.mudservices.com' PORT = 3000 #************************* #*** Set up what it looks like #************************* root = Tk() outputscroll = Scrollbar(root) textbox = Text(root) inputbox = Entry(root) outputscroll.config(command=textbox.yview) textbox.config(yscrollcommand=outputscroll, state="disabled") contents = StringVar() inputbox["textvariable"] = contents inputbox.bind(sequence="", func=writesock) inputbox.pack(side="bottom", fill="x") outputscroll.pack(side="right", fill="y") textbox.pack(expand=1, fill="both") s = Telnet(HOST, PORT) createfilehandler(s, READABLE, readsock) mainloop() >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/14/00, 12:21:57 AM, Sean Conley wrote regarding socket troubles: > This problem has me completely stumped. I am trying to write a telnet > client (actually a mud client) in Python. The problem is that I can > connect and read information from the socket, but nothing seems to > happen when I send to the socket. I believe it may be a problem with my > program, as I had the same problem with Perl/Tk and was unable to solve > it there either. So, if anyone has ANY idea why this could be please > email me or post here. Forgive any horrible syntax as this is my first > attempt at a python program and I am just trying to get the skeleton, > and the most important part of the program working before I start > cleaning it up. Anyhow, here is the code: From jjlucsy at concentric.net Fri Feb 18 09:42:55 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Fri, 18 Feb 2000 09:42:55 -0500 Subject: Which GUI? References: Message-ID: "Moshe Zadka" wrote in message news:Pine.GSO.4.10.10002181521450.2615-100000 at sundial... > On Fri, 18 Feb 2000, Gerrit Holl wrote: > > I think I'll make another point 'can be subclassed' in my comparison. > Why? In Python, subclassing is much less important then in other OO > languages. For example, while widgets in Tkinter can be subclassed, the > official effbotic advice is not to do so (and, I must say, I agree). > Not to mention that Tkinter is built on _tkinter, whose widgets cannot > be subclassed, so here is another point to the pointlessness of the > subclass-ability. The idea for subclassability is for creating custom controls with custom looks. For instance, if I wanted a grid control which allowed for spacings between the grids, or better yet, custom grid objects, how would I do this without subclassing? Callbacks I suppose. Well, the GUI toolkit has to offer them, which some don't. In Tkinter you can wrap a bunch of stuff into a metawidget so one doesn't need to subclass. wxPython doesn't need subclassing because it uses events (but you can also subclass as well). In (py)FLTK you need to subclass in order to get these custom objects. And because (py)FLTK doesn't have a lot of controls, it becomes paramount to be able to do this. It just depends of the toolkit. -- - Joel Lucsy (jjlucsy at concentric.net) From tim_one at email.msn.com Fri Feb 18 01:55:15 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 18 Feb 2000 01:55:15 -0500 Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: <88imhd$f97$1@nntp6.atl.mindspring.net> Message-ID: <001301bf79dd$1c718c00$e62d153f@tim> [Aahz Maruch] > ... > No, no, I meant that one could implement continuations using fork() > and IPC. It should therefore be possible to implement continuations > using threads. And I think that's all the Timbot meant. It wasn't, but maybe I should pretend it was . Tried to clarify this in another msg. The difficulty with using fork() is that continuations are entirely about capturing control-flow state and nothing about capturing data state (except for such "implementation data" that's stacked to record info about control flow). A resumed continuation "sees" changes in ordinary data state made since the time it was captured. If a continuation *didn't* see changes in data state, then invoking it later multiple times would do exactly the same thing each of those times (barring connection to an external source of non-determinacy, etc). And that's pretty useless. Suggestion: forget all this. It's at the wrong level for almost everyone struggling to follow it. While continuations were a kind of breakthrough in the theoretical world, in practice they're simply an *implementation technique*. Almost nobody is ever going to want to use them directly. What's *interesting* is what the language could provide if they were available to a few insane souls to build on "under the covers". A Scheme True Believer builds all control flow (from function calls thru exceptions to pseudo-threading) on top of them. Python won't do that, and I expect Guido is just irked at suggestions that "he should" (why the hell should he ?). In Python the value would be for what they could provide we don't already have: not exception-handling, but (most clearly) lightweight generators & coroutines, and (less clearly) lightweight alternatives to threads. The pragmatics of Stackless are such that you can have thousands of "pseudothreads" running even on feeble platforms with no thread support; and without the C stack interwined in the program state, it's even possible we could whip something up to, e.g., freeze a (pure) Python program in mid-stream, pickle it, send it across the web, and resume it where it left off on some other architecture. Indulge some crazy-ass fanatasies! Worrying about the mechanics of continuations here is akin to a debate starting about what kind of numeric types P3K should offer, that degenerates into an endless discussion about how best to build adder circuits in .18 micron technology <0.9 wink>. they're-a-means-not-an-end-ly y'rs - tim From gerrit at nl.linux.org Mon Feb 28 11:06:27 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Mon, 28 Feb 2000 17:06:27 +0100 Subject: MFC In-Reply-To: <894hee$12g$1@isn.dac.neu.edu>; from ekappoti@lynx.neu.edu on Thu, Feb 24, 2000 at 07:13:48PM -0500 References: <894hee$12g$1@isn.dac.neu.edu> Message-ID: <20000228170627.B12906@humbolt.nl.linux.org> On Thu, Feb 24, 2000 at 07:13:48PM -0500, Eric Kappotis wrote: > Is there anyway I can use Microsoft Foundation Classes to create a GUI with > python, if so how do I do it and what would be a good book to learn MFC? http://www.nl.linux.org/~gerrit/gui.html:

Pythonwin is a wrapper to the Microsoft Foundation Classes, MFC. With it, you can write application that are bound very tightly to Windows; you can use the features of the Windows UI. There are about 30 MFC objects exported. It's included within the Windows Python distribution. If you use Windows, you already have it, if you don't, you won't need it anyway ;).

Inside the Pythonwin distribution, you will find a Help File (Pythonwin.hlp) which is a reference manual for all objects exposed in Pythonwin. The homepage has some documentation resources:

regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From effbot at telia.com Mon Feb 21 13:24:09 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 18:24:09 GMT Subject: Which GUI? References: <20000220194012.A2069@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > * It's MUCH easier to translate C++ calls to Python calls > than translate Tcl/Tk calls to Python calls. So everything > needs to be double documented in Tkinter (okay, if you want > to take the time to document *everything*...) Tkinter is not Tcl/Tk, so everything needs to be "doubly documented". and accordingly, people are doing that. visit your favourite on-line bookstore and find out for yourself. > * It's up to 1000 times slower. oh, I'm sure can prove that wxPython is up to 10,000 times slower than Tkinter. all depends on the bench- mark, you know... > > methinks wxPython is superior to Tkinter in pretty much > > the same way as languages with braces are superior to > > languages using indentation... > > The reason you named is the only valid reason I heared for keeping > Tkinter so far. huh? so the books, the support, the existing code base, the portability, the company backing, plus the whole tcl/tk universe, doesn't count as "valid reasons". and you think you're capable of putting together an *unbiased* gui comparision? > > > Why the hell hasn't wxPython become the standard Python GUI yet? > eric, the famous user interface designer? look, I've been programming user interfaces for 20 years. if you wanna impress me, stick to facts. or just explain to me why putting wxPython on top of wxWindows on top of Gtk on top of Xlib is more Python- like than putting Tkinter on top of libtk on top of Xlib? why not just place a lean and mean OO layer on top of Gtk (or Xt)? in my book, *that* would be Python-like... From moshez at math.huji.ac.il Fri Feb 25 09:27:46 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 16:27:46 +0200 (IST) Subject: Newbie Newbie, we are all Newbie to something In-Reply-To: Message-ID: On Fri, 25 Feb 2000, Gregoire Welraeds wrote: > Can someone give me an example of resource that won't be automatically > reclaimed. A file descriptor, if you're using os.open, for example. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mstenber at cc.Helsinki.FI Thu Feb 10 03:12:05 2000 From: mstenber at cc.Helsinki.FI (Markus Stenberg) Date: 10 Feb 2000 10:12:05 +0200 Subject: Informix References: <87tne5$off$1@nnrp1.deja.com> Message-ID: prudek at my-deja.com writes: > How can I access Informix tables from Python? The only solution I could > come up with is: > - use Informix's ESQL/C to embed SQL commands into C source. > - embed resulting C program into Python > > I need a solution for both Zope and standalone Python. There is a Python module for informix access. See www.python.org -> modules -> ... -Markus > -- > Milos Prudek -- If you sat a monkey down in front of a keyboard, the first thing typed would be a UNIX command. -- Bill Lye From effbot at telia.com Mon Feb 14 02:49:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 07:49:58 GMT Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] References: <000301bf75f6$34eb3e60$962d153f@tim> <886tdh$t4n$1@nntp6.atl.mindspring.net> Message-ID: Aahz Maruch wrote: > Here's (what I hope is) a slightly clearer example: > > foo ( a;b;c, d ) # doesn't work > foo ( (a,b,c), d ) > > I find the former to be clearer; I'm uncomfortable with the idea that > arguments to a function are necessarily tuples (which is what the > current syntax implies). not if you get rid of that extra space ;-) From cwr at crash.cts.com Wed Feb 2 01:36:36 2000 From: cwr at crash.cts.com (Will Rose) Date: 2 Feb 2000 06:36:36 GMT Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> Message-ID: <878j9k$vpe$2@thoth.cts.com> Thomas Wouters wrote: : On Sun, Jan 30, 2000 at 06:13:45PM +0000, Neel Krishnaswami wrote: :> Well, I'd prefer Python to be case-insensitive, just as a matter of my :> own preference. Eyeball grep is for me basically case-insensitive, and :> I have spent hours trying to find bugs caused by case errors, because :> my eyes just slide over the difference. : Funny, my eyeball grep is decidedly case-sensitive. N and n look very : differently, and I scan them very differently, too. I sooner have trouble : with 'I', 'l', '1' and in some fonts 'i', or '0' and 'O' and in some fonts : 'Q'. On my old Atari ST I used to have a perfect screen font (which came : with the Warp 9 screen accelerator) but unfortunately I have not been able : to find an adequate substitute on any of the UNIX or Windows systems i've : been working on, and I've been looking for over 5 years now ;) This discussion has made it pretty clear to me that there are (at least) two sorts of people - those who are case-sensitive readers, and those who aren't. I don't know how one gets into one category or another; it doesn't seem to be language-sensitive. (Is Japanese case-sensitive?). The existence of the two types would explain why so many people like the Microsoft CI/CP filesystems, which I, being case-sensitive, loathe. It also means that there is no real way of settling the argument, since each group will always prefer a different solution. Will cwr at cts.com From gmcm at hypernet.com Thu Feb 3 22:57:44 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 3 Feb 2000 22:57:44 -0500 Subject: Ann: PMZ - Poor Man's Zope In-Reply-To: <389A393C.C0175C38@prescod.net> Message-ID: <1262485861-7723088@hypernet.com> Paul Prescod wrote: > Gordon McMillan wrote: > > > > Hmm. Looks to me like PMZ runs anywhere, DTML in Zope, > > ASP under IIS and PSP under a servlet style web server. > > Ahh, but those are implementations. The language is the interface. Which language? HTML? Python? Python embedded in HTML comments? How long will it take to define a SAX superset to parse oddball things people stick in XML comments? > Okay, some of these are probably (?) syntactically constrained by their > environments (PSP and Python on ASP) ... but there must be lots of areas > where they could standardize stuff, especially in the all-Python > implementations like PMZ, DocumentTemplate and "real" Zope. We're not talking about a standard interface to transforming standardized data into non-standard form. This stuff goes the other way (for an extremely debased notion of "standardized"). Better yet, you could write your own, then claim it's a standard ! - Gordon From J.C.Travers at durham.ac.uk Wed Feb 16 09:02:19 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Wed, 16 Feb 2000 14:02:19 +0000 Subject: IDLE in any other GUI. Message-ID: <38AAADEB.42C7CBA8@durham.ac.uk> Is anyone working on or wanting to work on implementing IDLE in a different gui to TK. Something like QT, which is also cross platform would be good (i.e. I would much prefer using it, IMHO TK is horrible, and QT simple and beautiful, and MUCH MUCH easier to code in!). Just a question, not wanting to start an inter-gui war! John Travers From anders.eriksson at morateknikutveckling.se Mon Feb 7 11:13:46 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 07 Feb 2000 17:13:46 +0100 Subject: const in Python Message-ID: Hello! Would someone please explain why there isn't a const 'operator' in Python! Very often I have constants in my code and it would be nice if Python could check that someone (.I.) don't change them! // Anders -- English isn't my first or second language, so errors or anything that you find offending is not there on purpose it's just due to the translation. From zessin at my-deja.com Thu Feb 3 02:48:10 2000 From: zessin at my-deja.com (Uwe Zessin) Date: Thu, 03 Feb 2000 07:48:10 GMT Subject: Porting omniORB python to OpenVMS References: <877rom$akl$1@nnrp1.deja.com> <8791t9$f19$1@pineapple.uk.research.att.com> <879p1s$mqa$1@nnrp1.deja.com> <879v5m$l75$1@pineapple.uk.research.att.com> Message-ID: <87bbrp$rq9$1@nnrp1.deja.com> In article <879v5m$l75$1 at pineapple.uk.research.att.com>, Duncan Grisby wrote: > In article <879p1s$mqa$1 at nnrp1.deja.com>, wrote: > > >in the example client with the example server running (both from > >omniORBpy/releasenote). Yes! > > Congratulations on your successful port. Did you have to make any > patches to omniORBpy to get it to work? If so, can you send them to > me please. And congratulations from me, too. Would you mind to share your changes to Python for OpenVMS with me so I can see if I can put them in the next release (1.5.2-V007) ? -- Uwe Zessin Sent via Deja.com http://www.deja.com/ Before you buy. From emile at fenx.com Fri Feb 18 22:27:34 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 18 Feb 2000 19:27:34 -0800 Subject: Killer Apps??? References: <14509.31078.932335.402705@beluga.mojam.com> Message-ID: <024401bf7a89$46d2edc0$01ffffc0@worldnet.att.net> Wow! If you released the eff-bot code, that'd be a killer app! It-is-written-in-python-isn't-it?-ly yr's Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Fredrik Lundh Newsgroups: comp.lang.python To: Sent: Friday, February 18, 2000 2:16 PM Subject: Re: Killer Apps??? > Fran?ois Pinard wrote: > > Just curious, and using English as a second language, here. > > > > I do not understand what these applications are supposed to kill? > > Developers? Users? Competitors? :-) Why the reference to "killing"? > > [checking the eff-bot archive] > > (oh, here it is) > > [start of transmission] > > UNITED STATES OF AMERICA, PLAINTIFF, VS. MICROSOFT > CORPORATION, ET AL., DEFENDANTS > > WASHINGTON, D. C. DECEMBER 15, 1998 > > EXCERPTS OF BILL GATES' DEPOSITION > > QUESTION: THE PORTION OF IT I WANT TO REFER YOU > TO IS AT THE BOTTOM OF THE FIRST PAGE UNDER THE HEADING > CALLED "THE LATEST KILLER APP." DO YOU SEE THAT? > > ANSWER: I SEE A HEADING. > > QUESTION: YES. THE FIRST PARAGRAPH UNDER THE > HEADING READS AS FOLLOWS: "OUR INDUSTRY IS ALWAYS LOOKING > FOR THE NEXT 'KILLER APPLICATION' -- FOR A CATEGORY OF > SOFTWARE THAT, BY ITS UTILITY AND INTELLIGENT DESIGN, > BECOMES INDISPENSABLE TO MILLIONS OF PEOPLE. WORD > PROCESSORS AND SPREADSHEETS WERE THE KILLER APPLICATIONS FOR > BUSINESS P.C.'S STARTING IN 1981." > AND THE NEXT SENTENCE READS, "THE LATEST CONFIRMED > 'KILLER APP' IS THE WEB BROWSER." > DO YOU RECALL WRITING THAT, SIR? > > ANSWER: NO. > > QUESTION: DO YOU HAVE ANY REASON TO BELIEVE YOU > DIDN'T WRITE IT? > > ANSWER: NO. > > QUESTION: CAN YOU EXPLAIN WHAT YOU MEANT HERE BY > DESCRIBING THE WEB BROWSER AS A "KILLER APP"? > > ANSWER: I JUST MEANT THAT BROWSING WOULD BE, IN > OUR VIEW, A POPULAR THING, NOT NECESSARILY ON THE WEB, BUT > JUST BROWSING IN GENERAL WOULD BE A POPULAR ACTIVITY. > > QUESTION: IS A KILLER APPLICATION AN APPLICATION > THAT DRIVES SALES OF OTHER PRODUCTS, LIKE OPERATING SYSTEMS > AND HARDWARE? > > ANSWER: NO. > > QUESTION: DO YOU HAVE A DEFINITION IN YOUR OWN > MIND OF "KILLER APPLICATION"? > > ANSWER: IT MEANS A POPULAR APPLICATION. > > QUESTION: LET ME RESORT AGAIN TO THE MICROSOFT > COMPUTER DICTIONARY, AND I'LL READ YOU WHAT THAT SAYS ABOUT > KILLER APPLICATIONS. YOU MAY DISAGREE WITH IT, AND IF SO, > YOU CAN TELL ME. > THE MICROSOFT COMPUTER DICTIONARY, 1997 EDITION, > DEFINES "KILLER APP" AS FOLLOWS, AND IT GIVES TWO > DEFINITIONS. AND I'LL BE VERY COMPLETE THIS TIME, > MR. GATES. > THE FIRST DEFINITION IS, "AN APPLICATION OF SUCH > POPULARITY AND WIDESPREAD STANDARDIZATION THAT IT FUELS > SALES OF THE HARDWARE PLATFORM OR OPERATING SYSTEM FOR WHICH > IT WAS WRITTEN." > I WILL READ IT TO YOU. THE SECOND DEFINITION IS, > "AN APPLICATION THAT SUPPLANTS ITS COMPETITION." > LET ME GO BACK AND READ YOU THE FIRST DEFINITION > AGAIN, NOW THAT YOU'VE HEARD BOTH OF THEM. > THE FIRST DEFINITION READS AS FOLLOWS: "AN > APPLICATION OF SUCH POPULARITY AND WIDESPREAD > STANDARDIZATION THAT IT FUELS SALES OF THE HARDWARE PLATFORM > OR OPERATING SYSTEM FOR WHICH IT WAS WRITTEN." > > ANSWER: I ALREADY TOLD YOU THAT MY DEFINITION OF > "KILLER APP" IS A VERY POPULAR APPLICATION. > > QUESTION: WHAT ABOUT A RELATIONSHIP TO AN > OPERATING SYSTEM? > > ANSWER: USUALLY THEY'RE JUST TALKING ABOUT IT > BEING A VERY POPULAR APPLICATION. I CERTAINLY KNOW OF > THINGS THAT HAVE BEEN REFERRED TO AS KILLER APPLICATIONS > THAT HAVEN'T DRIVEN HARDWARE SALES OR OPERATING SYSTEM > SALES. > > QUESTION: WHAT OTHER APPLICATIONS WOULD YOU > IDENTIFY AS BEING KILLER APPLICATIONS? > > ANSWER: APPLIED SIMULATOR. > > [end of transmission] > > > -- > http://www.python.org/mailman/listinfo/python-list > From phd at phd.russ.ru Tue Feb 29 07:59:00 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 29 Feb 2000 12:59:00 +0000 (GMT) Subject: Sending MIME-Attachments in Python In-Reply-To: Message-ID: On 29 Feb 2000, Ralf Hildebrandt wrote: > I want to create an email consisting of a single attachment (which I then > need to pipe to sendmail for sending). Yesterday I posted the answer: http://www.deja.com/=dnc/getdoc.xp?AN=590791917 Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From a.eyre at optichrome.com Thu Feb 17 07:08:54 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Thu, 17 Feb 2000 12:08:54 -0000 Subject: FTP Message-ID: <000b01bf793f$c28a5750$3acbd9c2@peridot.optichrome.com> I'm aware of the ftplib module for use in ftp clients, but has anyone here [written|seen|heard of|dreamed about] a module which would provide ftp *server* functionality? ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From wlfraed at ix.netcom.com Thu Feb 24 00:36:49 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Wed, 23 Feb 2000 21:36:49 -0800 Subject: PythonWin -- print option? Message-ID: <98g9bs8e1ugl1r7k0t8j0jdb441251ak51@4ax.com> Forgive the possibly obvious... I've just installed Python 1.5.2 and PythonWin. I did manage to figure out why the PythonWin options didn't work (seems I needed to add PythonWin to the autoexec.bat PATH). However, PythonWin has a print button, along with print entries on the File menu. All of these are ghosted out in my installation. Are these place-holders for a future capability, or is there a likelihood of some other missing information in my configuration? (I just managed to get IDLE to run -- apparently my system isn't layed out like M$ defaults; I put non-M$ programming languages under "C:\Programming Languages\" rather than "C:\Program Files\", so not even FixTK.py could find the tk/tcl DLLs until I put a copy into the Python directory Is there anyway to change the font used by IDLE, it is puny?). -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From m.faassen at vet.uu.nl Thu Feb 17 22:54:39 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 18 Feb 2000 03:54:39 GMT Subject: Python sucks loud References: Message-ID: <88ifpv$33i$1@newshost.accu.uu.nl> Moshe Zadka wrote: > On 15 Feb 2000, William Tanksley wrote: >> Pretty much so. Tim keeps on killing people who disagree with him. Please >> save us from him by posting more messages in which mindless abuse is >> mistaken for humor! > I object to that. Tim has never killed anyone who disagreed with him. They > just had...ummm...accidents. Yes, that's it, accidents. > now-the-psu-does-kill-people-ly y'rs, Z. I'm afraid I'm going to have to correct you: * The Python Secret Underground does not exist * It doesn't kill people * There are no whitespace eating nanoviruses * They are not alien either * You will not be terminated for revealing this information * It will have been an accident. Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From hanche at math.ntnu.no Thu Feb 10 21:54:59 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 10 Feb 2000 21:54:59 -0500 Subject: Off Topic Posts References: Message-ID: + "Gene Chiaramonte" : | Please stop the madness! I can't take it anymore. Neither can I. Time to learn about killfiles. You can let your newsreader filter out (some of) the stuff you don't want, you know. | Can the admins of this list please setup another newsgroup for posts | regarding python language opinions? That is not how usenet works. There is a formal procedure for the creation of newsgroups: You issue a Request for Discussion in the right fora, there is a discussion period, then a vote, and if the motion passes, the newsgroup is created. The exception is the alt.* hierarchy, where anybody can create groups to their heart's content. | Lets keep this list for people who need help USING PYTHON to solve | real problems. [...] I worry that the constantly increasing number | of off topic opinion type posts here has gone above a reasonable | threshold. Well, the problem is that discussions on the strengths and weaknesses of Python is very much an on-topic discussion, as long as we haven't split the group. The problem with the whitespace thread is not that it's off-topic, but that it goes on for too long, with the same old arguments being repeated ad nauseam. This kind of thing happens regularly on all newsgroups, though more rarely here than elsewhere. Learn to endure it, or better yet to filter it out. | Enough already! If it's not a Python question, don't waste your time | sending it in the first place. Personally, I have enjoyed many posts here comparing Python with other languages like Haskell, Common Lisp, Smalltalk etc. I would hate to see such discussion banished from the newsgroup. yes-I-like-Lisp-too-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 rjroy at takingcontrol.com Sun Feb 20 23:09:31 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Mon, 21 Feb 2000 04:09:31 GMT Subject: Tkinter: creating a scrolling canvas that contains widows (Frame widgets) References: <490s4.103351$A5.1984558@news1.rdc1.bc.home.com> Message-ID: <38b0b97b.6567671@news1.on.sympatico.ca> Save yourself a lot of work and download Pmw. Among other wonderful things, it has a scrolled frame class that sounds like it will de everything you need. The url is: http://www.dscpl.com.au/pmw/ Bob On Mon, 21 Feb 2000 01:02:56 GMT, "Kevin Cazabon" wrote: >I've been trying to create a class that I can use to place Frame() widgets >into a scrolling 'container'. > >Basically, I want a master "Frame" that has a Y scroll bar (and maybe X as >well). In this frame, I want to be able to add sub-frames (any number). If >all of these frames won't fit, I want to be able to scroll the master Frame >as necessary. > >The only suitable Tkinter class for the Master I can find is the Canvas >widget. I have no problem creating this, and adding windows to it using >canvas.create_window(x,y, window=mywidget), but have had a heck of a time >getting it to scroll properly, especially when the user resizes the overall >master frame. > >This may sound complicated, but it really isn't... just the implementation >might be! > >Any suggestions, or if you can point me to an exapmle that might help (like >the ScrolledText widget, which is very similar to what I need, kindof...), I >would greatly appreciate it. > >Kevin Cazabon >kcazabon at home.com > > From effbot at telia.com Fri Feb 18 16:59:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 21:59:01 GMT Subject: Python misconceptions in IBM Ruby article... References: <38AC9D57.5CC8066C@mincom.com> <88k09b$96f$1@nnrp1.deja.com> Message-ID: wrote: > This is just a display that you haven't mastered C++. heh. and you haven't mastered reading and understanding usenet posts ;-) From gerrit.holl at pobox.com Tue Feb 22 15:56:10 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 21:56:10 +0100 Subject: Killer Apps In-Reply-To: <000901bf7d07$603089a0$e82d153f@tim>; from tim_one@email.msn.com on Tue, Feb 22, 2000 at 02:35:22AM -0500 References: <88sj10$rmj$1@nntp6.atl.mindspring.net> <000901bf7d07$603089a0$e82d153f@tim> Message-ID: <20000222215610.E4549@stopcontact.palga.uucp> > [Aahz Maruch] > > Well, it was a bit of a colloquialism, but it was mainly just a joke > > (made by swapping the two words) that Tim is always poking holes in > > other people's ideas. > > This is highly unfair, Aahz. Tim only pokes holes in three (just three!) > kinds of ideas: > > 1. Incorrect ideas. > 2. Useful ideas. > 3. Correct ideas. > > I have always been tolerant-- even praiseful! --of ideas that are so off the > wall that they can't be called either correct or incorrect with a straight > face -- provided only, of course, that they're useless. ROFL! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From dfavor at austin.ibm.com Wed Feb 16 09:39:04 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Wed, 16 Feb 2000 08:39:04 -0600 Subject: Moving from perl to python: questions References: <816010E2456BD111A48700805FBBE2EE01C604FE@ex-quebec-u1.baan.com> Message-ID: <38AAB688.7C87780@austin.ibm.com> Gaetan Corneau wrote: > > David, > > > 1) Best way to convert array argv[1:] into string to pass functions > > from string import join > > l = ["aaa", "bbb", "ccc"] > > s = join(l[1:]) > > > 2) How to implement a no-frills file slurp() function > > What is a "slurp" function? Hum... The attachment of my code didn't make it. Let's try this again... -------------- next part -------------- #!/usr/local/bin/python def slurp(filename): "Slurp all the lines of a file into an array" print filename try: f = open(filename) lines = f.readlines() f.close() return lines def chomp(lines): "remove the end of line markers from array" import os nl_len = len(os.linesep) # length of os dependent line seperator while i < len(lines): line_len = len(lines[i]) lines[i] = lines[i][:line_len-nl_len] if __name__ == '__main__': from sys import argv #from getopt import * #opts = getopt(sys.argv[:1],'f:') lines = slurp(str(argv[1:])) print lines From akuchlin at mems-exchange.org Thu Feb 3 18:09:11 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 03 Feb 2000 18:09:11 -0500 Subject: Ann: PMZ - Poor Man's Zope References: <1262508367-6369026@hypernet.com> Message-ID: <3daelhyjc8.fsf@amarok.cnri.reston.va.us> "Gordon McMillan" writes: > Hmm. Looks to me like PMZ runs anywhere, DTML in Zope, > ASP under IIS and PSP under a servlet style web server. It's perfectly possible to use DTML outside of Zope; nght2html, the templating system I use for my Web pages, uses DocumentTemplate because I didn't want to write and maintain Yet Another templating syntax, and DocumentTemplate has practically all the bells and whistles you need. (nght2html is available at http://www.mems-exchange.org/software/python/nght2html/ .) -- A.M. Kuchling http://starship.python.net/crew/amk/ In her world there are so many windows. Each opening shows her an existence that's fallen to her -- some only for moments, others for lifetimes. -- Despair's realm, in SANDMAN #41: "Brief Lives:1" From ulf.engstrom at b2b-link.com Thu Feb 24 07:13:52 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F6m?=) Date: Thu, 24 Feb 2000 13:13:52 +0100 Subject: CGI and COM Message-ID: <000801bf7ec0$9da94500$d300a8c0@Alexis> I've just started with some COM-programming with the win32com package, and I get the part I want to working correctly when I run it in IDLE or in any way, except that I know want it to be done from a CGI-script. (I'm writing params to a program with COM) I know this raises some security issues when run as CGI, but is there a way do overrun this? I'm running W2k with IIS5. I tried to set guest login to use Administrator, this made the script take forever, but still came out negative. Some other way? Regards Ulf (Alexis) -------------- next part -------------- An HTML attachment was scrubbed... URL: From emile at fenx.com Fri Feb 11 08:54:53 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 11 Feb 2000 05:54:53 -0800 Subject: will python 3000 break my code? Message-ID: <078d01bf7497$93e4eac0$01ffffc0@worldnet.att.net> Steve, Until someone picks the short straw and has to go monitor an advocacy group this is the right place. It's only when you get into the 'asked-and-answered' stage of responses that things won't progress. At that point, you make it your own, a la VIPER or Stackless, or simply accept that Guido will continue to do-the-right-thing. Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Steve Holden Newsgroups: comp.lang.python To: Sent: Friday, February 11, 2000 5:02 AM Subject: Re: will python 3000 break my code? > The timbot wrote: > > > > [Ronald L. Dilsavor] > > > I am in the process of deciding whether to have a team of folks > > > invest in implementing our product in Python and this [presumed > > > incompatibility of Python 3000] was one of the "cons" on my list. > > > > As it should be! Don't overvalue it, though. For example, even if Python > > 3000 is an *entirely different language*, no C program stopped working the > > day C++ was released -- or a decade later, either. > > > > [much other reassuring and sensible stuff] > > > > it's-not-really-that-scary!-ly y'rs - tim > > With trepidation, I write to ask what the appropriate forum is for > suggesting language improvements -- and I don't mean introducing > redundant bracketing for block delimitation. However, recent threads > have persuaded me that this probably isn't the forum for my lame > suggestions: you guys are busy enough. I would have talked to people > at the conference, but then the weather and a client emergency meant > that all I got for my fee was an email acknowledgement. Next year, > maybe... > > regards > Steve > -- > "If computing ever stops being fun, I'll stop doing it" > -- > http://www.python.org/mailman/listinfo/python-list > From effbot at telia.com Wed Feb 16 13:13:53 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 18:13:53 GMT Subject: BSDDB copyright and licensing restrictions while in use viaPython References: Message-ID: Oleg Broytmann wrote: > I am not a lawer, but I don't see any problem here. SleepyCat's FAQ > has clear statement (http://www.sleepycat.com/faq.html#A22): > > 22.Do I have to license Berkeley DB to use it in Perl or Python? > > No. The Berkeley DB license requires that software that uses Berkeley > DB be freely redistributable. In the case of Perl or Python, that software > is Perl or Python, and not your scripts. Any scripts you write are your > property, including scripts that make use of Berkeley DB. None of the Perl, > Python or Berkeley DB licenses place any restrictions on what you may do > with them. a real lawyer would probably read the *license* rather than the FAQ ;-) -- and that license isn't fully compatible with the last sentence in the FAQ entry. (looks more like LGPL to me: if you redistribute, you need to provide sources for the database engine and the interface code used in your application). From DOUGS at oceanic.com Thu Feb 10 19:25:30 2000 From: DOUGS at oceanic.com (Doug Stanfield) Date: Thu, 10 Feb 2000 14:25:30 -1000 Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Pyt hon Rocks!) Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F2EE@huina.oceanic.com> May not be exactly what you mean but I'm sort of partial to Prograph, or with a picture. O-O and dataflow and a very cool IDE. Always thought there would be some ideas there that would work for an IDE for any language that was used for building interactive GUI applications. -Doug- > -----Original Message----- > From: James Logajan [mailto:JamesL at Lugoj.Com] > Sent: Wednesday, February 09, 2000 6:49 PM > To: python-list at python.org > Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: > Python Rocks!) > > > Wake me when the other thread dies. > > Off topic: > By the way, speaking of code blocks, does anyone know of any > languages that > use blocks...literally? That is, given the prevalence of > GUIs, a development > environment/language where code is contained in rectangles? > For example (the > following will need to be viewed using a fixed-width font): > > +====================+ > | def Func(a, q) | > +====================+ > | if a == b | > | +----------------+ | > | | xyzzy = Plunk()| | > | | w = xyzzy + 42 | | > | | | | > | +----------------+ | > | else | > | +----------------+ | > | | w = sqrt(-1) | | > | +----------------+ | > | return q/w | > +--------------------+ > > Anyway, hope you get the idea. Many variations on how the boxes should > appear are possible. > -- > http://www.python.org/mailman/listinfo/python-list > From nikolai.kirsebom at siemens.no Mon Feb 28 07:37:15 2000 From: nikolai.kirsebom at siemens.no (Nikolai Kirsebom) Date: Mon, 28 Feb 2000 12:37:15 GMT Subject: Python and ASP question References: <89apf7$sgr$1@nnrp1.deja.com> Message-ID: <38ba6bc4.258841494@news.mch.sni.de> I'm using Python as scripting language on my web-server. Small but working projects (guestbooks, db-maintenance, registrations, counters), and I've not had any problems using Python as the scripting language (on the ASP pages). To me it sounds like you may have some problems with the installation. Page normally starts with <%@ Language=Python %> <% import MyModule o = MyModule.ObjLoading() %> and then in the html-code <%= o.SomeObjMethod(parameters) %> Hope this helps. Nikolai Kirsebom On Sun, 27 Feb 2000 09:06:47 GMT, yosefgold at hotmail.com wrote: >I am trying to import a module (using the 'import' statement) into an >ASP page and it does not seem to be working. Is this a limitation of >Python/ASP or am I doing something wrong? > >My real goal is to import one of my own modules into the Application >context. However, I tried importing some built in modules, >like 'string' to see how these work. The ASP page does not seem to >recognize the 'import' statement. > >If import is not allowed, that severely limits the usefullness of using >Python as a ASP scripting language. The only other option would seem >to be to make my Python components available as COM objects. If I do >this however, I might as well write the ASP pages in Jscript or >VBscript. > >Is anyone using Python as an ASP scripting language for real projects? > >Thanks, >Yosef Gold >yosefgold at hotmail.com > > > >Sent via Deja.com http://www.deja.com/ >Before you buy. From claudius at catlover.com Sun Feb 20 10:31:52 2000 From: claudius at catlover.com (claudius at catlover.com) Date: Sun, 20 Feb 2000 15:31:52 GMT Subject: cgi.py, cookies References: Message-ID: wware at world.std.com (Will Ware) says: >I didn't see anything in cgi.py about handling cookies. I am >planning a web-based multi-player simulation game and I need >to be able to tell the players apart. I'm just learning about >CGI and forms and all that for the first time, and cookies >seem to me to be the right way to assign persistent identities >to players. Is there any cookie-handling server-side Python >code? Thanks much. There's an excellent cookie module (Cookie.py) by Tim O'Malley available, probably via Vaults of Parnassus. I wonder/hope that it shows up in the 1.6 distribution. From aotto at t-online.de Mon Feb 21 01:52:13 2000 From: aotto at t-online.de (Andreas Otto) Date: Mon, 21 Feb 2000 07:52:13 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> Message-ID: <38B0E09D.EC26F41E@t-online.de> > Does a requirement exist for a Python compiler and are your ready to pay > for it ?? This was a question I don?t have Python knowlege, but i have the technologie to write compilers for scripting languages. Phyton should be easy enougth to learn in some days. If the python people are interested in having an compiler OK, if they are not interested also OK Our compiler is a) not free b) optimizes the source code in an aggressive manner, you will loose all the stuff you don't need. c) produces one stand alone Python/C source-file, with every command change to his c-command ( no big String-Array ) d) you will find most of the errors at compile-time my english is not as good as it should be Refer (german version only) http://home.t-online.de/home/aotto/compiler.html mfg aotto -------------- next part -------------- A non-text attachment was scrubbed... Name: aotto.vcf Type: text/x-vcard Size: 451 bytes Desc: Card for Andreas Otto URL: From arcege at shore.net Thu Feb 3 15:21:56 2000 From: arcege at shore.net (Michael P. Reilly) Date: Thu, 03 Feb 2000 20:21:56 GMT Subject: embeding python in C++ ?? References: <20000203105403.04628.00000136@ng-cv1.aol.com> Message-ID: JerryJerry wrote: : Thanks for responding. Where would I find your reference to extending and : embedding documentation? Jerry, The documents you probably want to read are: * "Extending and Embedding" on the Python website * "Python/C API" on the Python website * "How to write a Python extension" on the Python Starship You might also want to use: * CXX to create Python C++ objects (this URL will change soon, check the Python website for notices) * SWIG to make C/C++ code availabe to Python -Arcege From emile at fenx.com Tue Feb 29 20:52:24 2000 From: emile at fenx.com (Emile van Sebille) Date: Tue, 29 Feb 2000 17:52:24 -0800 Subject: A comp.lang.python code snippet archive? References: <200002291944.UAA29289@dionysus.fw.cuci.nl> Message-ID: <045b01bf8320$d0f56b00$01ffffc0@worldnet.att.net> Not to mention all to pseudo-code that looks like python. ;) some-of-it-even-runs-ly y'rs Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Hans Nowak To: Adrian Eyre ; Sent: Tuesday, February 29, 2000 11:44 AM Subject: RE: A comp.lang.python code snippet archive? > Maybe some kind of "Python code detector" could be helpful, if only for a > first rough scan of all the messages. I have no idea how to do this though. > (In Perl it's easy, you simply check if the number of $'s is above > average... ) Maybe it should look for reserved words like def or > import? But a snippet is not guaranteed to include those words, and a > message which does use them is not guaranteed to have Python code. =/ > > Ideas, anyone? > > > --Hans Nowak (zephyrfalcon at hvision.nl) > Homepage: http://fly.to/zephyrfalcon > You call me a masterless man. You are wrong. I am my own master. > > -- > http://www.python.org/mailman/listinfo/python-list > From gerrit.holl at pobox.com Thu Feb 24 07:28:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 24 Feb 2000 13:28:12 +0100 Subject: 1000 GUI toolkits In-Reply-To: ; from meowing@banet.net on Thu, Feb 24, 2000 at 08:20:20AM +0000 References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> Message-ID: <20000224132812.A3201@stopcontact.palga.uucp> > Aahz Maruch wrote: > > (Okay, so I'm half-joking. But I really do have a strong preference for > > HTML as my UI of choice, not least because it allows a text-based > > interface.) > > No joke at all. HTTP/HTML is a really nice alternative to the GUI of > the month. Python shines when it comes to writing little specialty > server thingies, and more of the presentation details are in the hands > of the end user (don't like the interface? Use another browser). HTML is not designed to be interactive, so HTML should not be used interactive. If you rewrite Pysol in HTML, you'll get a prize. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From tim_one at email.msn.com Tue Feb 15 00:39:32 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 15 Feb 2000 00:39:32 -0500 Subject: eff-bot In-Reply-To: Message-ID: <001701bf7777$08cf9a60$66a2143f@tim> [Moshe Zadka] > ... > Have you ever noticed Tim and Guido hardly ever seem to disagree? I have! And it used to baffle me. > My Official Conspiracy Theory is that Guido is actually Tim. No, this is an insufficient application of Occam's Razor. After many years, the (nearly self-evident in retrospect) truth dawned on me: whenever Guido & I *have* disagreed (the timbot assures me this has been often), and I turned out to be right, he simply used his time machine to erase all traces of his opposing opinions, reweaving the very fabric of existence. The cases where he turned out to be right remain in the historical record unaltered, and account for the two instances of disagreement still to be found there. Damn, but he's good. hooray!-guido-increased-our-chocolate-ration!-ly y'rs - 198tim From pinard at iro.umontreal.ca Sun Feb 27 08:22:28 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 27 Feb 2000 08:22:28 -0500 Subject: Q about tail recursion In-Reply-To: "Tim Peters"'s message of "Sun, 27 Feb 2000 03:22:05 -0500" References: <000601bf80fb$bbabac40$172d153f@tim> Message-ID: "Tim Peters" ?crit: > [...] even consider putting "assert 0" at the end of the function if > you never expect to "fall off the end". Another good idea, thanks! By the way, I do much like that `assert' is a an element of Python syntax, instead of a feature of the library. It's much cleaner this way, and it also recognises that assertions are an important enough concept, to warrant a good place even in a language which tries to not proliferate concepts. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From claird at starbase.neosoft.com Mon Feb 28 09:44:30 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Feb 2000 08:44:30 -0600 Subject: Veeeeery Basic Question References: <38b99975.2288717@news.mindspring.com> Message-ID: In article <38b99975.2288717 at news.mindspring.com>, Eric Stewart wrote: >I'm writing my first script....ever. I just finished _Learning >Python_ by Lutz. > >Here's what I want to do: >Iterate over a series of image files in a given directory. >Randomly select one on those files >Post that file to a web site. > >Each time you hit the web site you will see a different randomly >selected image. > >I guess this will be a CGI script that will run in the Directory >cgi-bin, which will be referenced by the HTML. > >The image files which i will select from will be in a seperate >directory, i.e C:Web Stuff\Images . . . Fredrik addresses the Python aspects quite well, of course. If this is a serious development for you, there are at least a couple more questions you'll do well to consider before coding. >From your description, it sounds as though your plan is that every access of the URL will cause an image to be copied from a staging (?) host across a network to a Web service host. If that's what you want, and it works for you, so much the better. My personal reaction to that is that it's seriously susceptible to a bottleneck in the stag- ing-to-Webserver network bandwidth. Moreover, a very, very common computing idiom is likely to multiply your performance by many orders of magni- tude. Are you familiar with "indirection"? There's likely to be a convenient way for you to randomize selection of a pointer to an image, rather than randomize the operation of copying an image around. Also, to be precise, while CGI might well be the mechanism you choose for this exercise, it doesn't have to be. Your description leaves me wondering whether you understand there are alternatives. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From mhammond at skippinet.com.au Wed Feb 23 16:41:55 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 23 Feb 2000 21:41:55 GMT Subject: msvcrt, open_osfhandle, locking References: <38B3D3EA.C2BB4846@endea.demon.nl> Message-ID: "Niels Diepeveen" wrote in message news:38B3D3EA.C2BB4846 at endea.demon.nl... > > > Mark Hammond schreef: > > > file handle. The locking module works directly with file object - no > > need to deal woth OS handles at all. > > Is this a 1.6 feature? In 1.5.2 locking() takes a file descriptor > (f.fileno()), I think. Oops - that would be my mistake. I know it didnt take a Win32 handle, but didnt check, and if I did I would have found you are correct. Mark. From janssen at parc.xerox.com Mon Feb 7 20:47:01 2000 From: janssen at parc.xerox.com (Bill Janssen) Date: Mon, 7 Feb 2000 17:47:01 PST Subject: mail filter in python? In-Reply-To: Your message of "Mon, 07 Feb 2000 12:43:30 PST." <14495.11639.467461.357073@beluga.mojam.com> Message-ID: <00Feb7.174654pst."3624"@watson.parc.xerox.com> I use a Python filter heavily with MH. I first run regular MH "inc +inbox" to pick up the mail from the spool file, then read a sorting routine from ~/.mailfilter.py, which is called on each message, with the message itself as an object parameter. The object type of the message is a subclass of mhlib.Message, which adds the methods matches(NAMES, HEADERNAMES) -- see if any of the specified NAMES occur in any of the headers with the specified HEADERNAMES addr_matches(ADDRESS, HEADERNAME) -- returns True if ADDRESS occurs in any of the instances of the header with HEADERNAME sentto (NAMES) -- returns True if the message was sent to any of the specified NAMES (which are just strings). It looks at "To", "Cc", "Resent-To", and "Apparently-TO". copy (FOLDERNAME, UNSEEN=1) -- copies the message into the folder specified with FOLDERNAME. Adds to the `unseen' sequence if UNSEEN is True. refile (FOLDERNAME, UNSEEN=1) -- similar to `copy', but deletes the message from the original folder. resend (TO) -- resends the message to the list of addresses in the TO parameter discard () -- deletes the message from its folder The filter itself looks like ------------------------------------------------------------ # This file contains the rule which sorts my incoming mail when invoked by the "mhfile" command # # This file must define the procedure "mailfilterfn()". It is eval'ed by the mhfile # module upon load of mhfile.py. It can be re'evaled by calling mhfile.read_filter_fn(). import mhfile, rfc822 def mailfilterfn (msg): if (msg.matches("", "from")): msg.refile("overhead/outgoing") return ... if (msg.sentto("python-list at cwi.nl", "python-list at python.org") or msg.matches("comp.lang.python", "newsgroups")): msg.refile("ext/python") elif (msg.sentto("db-sig at python.org")): msg.refile("ext/python/db-sig") ... ################################################## ## ## Put any leftover messages in "mail" ## else: if not filed_in_my_direct: msg.refile("mail") else: msg.discard() return ------------------------------------------------------------ and so forth. Here's the code snippet from mhfile.py: ------------------------------------------------------------ if (not read_filter_fn_if_necessary()): sys.stderr.write("Can't read mail filter file.\n"); return incoming = jmhlib.Folder(mhlib.MH(), 'inbox') for msg in incoming.listmessages(): if verbose: print 'processing message', msg try: m = jmhlib.Message(incoming, msg) except: if verbose: print "couldn't access msg " + str(msg) traceback.print_exc() mailfilterfn (m) m.fp.close() ------------------------------------------------------------ I'll leave the implementation of read_filter_fn_if_necessary as an exercise for the reader :-; it's kind of fun! Here's the contents of jmhlib.py: ------------------------------------------------------------ # subclass of mhlib.Message for adding common operations import sys, os, mhlib, types, string, rfc822, time, pwd, re, shutil, traceback from mhlib import Folder def add_msg_to_unseen (folder, msgnum): d = folder.getsequences() unseen = ((d.has_key("unseen") and d["unseen"]) or []) unseen.append(msgnum) d["unseen"] = unseen folder.putsequences(d) class Message(mhlib.Message): # Check to see if any of the specified 'names' are in any of the # specified headers def matches (self, names, headers): if type(names) == types.StringType: names = ( names , ) if type(headers) == types.StringType: headers = ( headers , ) for header in headers: headerval = self.getheader(header) if not headerval: continue for name in names: testname = string.lower(name) testheader = string.lower(headerval) # print "looking for <%s> in <%s>" % (testname, testheader) if (string.find(testheader, testname) >= 0): # print " *** found it" return 1 return 0 def addr_matches (self, mail_addr, header_name): # returns 1 if "mail_addr" is in any of the addresses in the headers with the name "header_name" real_header_name = string.lower(header_name) real_mail_addr = string.lower(mail_addr) if not hasattr(self, "_addrs"): self._addrs = {} if not self._addrs.has_key(real_header_name): self._addrs[real_header_name] = self.getaddrlist(real_header_name) test_values = self._addrs[real_header_name] for value in test_values: # each value is a pair of (comment, mail_addr) if ((string.find(string.lower(value[0]), real_mail_addr) >= 0) or (string.find(string.lower(value[1]), real_mail_addr) >= 0)): return 1 return 0 # was the message sent to any of the specified names? def sentto (self, *names): for header_name in ("to", "resent-to", "apparently-to", "cc"): for name in names: if self.addr_matches (name, header_name): return 1 return 0 # put a copy of the message into another folder def copy (self, foldername, unseen=1): newfolder = Folder(self.folder.mh, foldername) ton = newfolder.getlast() + 1 # print "copying %s into %s/%s" % (self.number, foldername, ton) self.folder.copymessage(self.number, newfolder, ton) if unseen: add_msg_to_unseen (newfolder, ton) # put the message in a different folder def refile (self, foldername, unseen=1): # print "putting %s into %s" % (self.number, foldername) self.copy(foldername, unseen) self.discard() # resend the message to the specified names def resend(self, *to): os.system('/usr/lib/sendmail %s <%s' % (string.join(to), self.folder.getmessagefilename(self.number))) # discard message def discard(self): self.folder.removemessages([self.number]) ------------------------------------------------------------ Have fun! Bill From bjm at cdc.noaa.gov Wed Feb 9 16:29:07 2000 From: bjm at cdc.noaa.gov (Barry McInnes) Date: 9 Feb 2000 21:29:07 GMT Subject: Solaris 2.7 __imaging.so ? Message-ID: <87sm73$mms$1@mwrns.noaa.gov> When I create the Imaging 1.0 library under Solaris 2.7 I get lots of undefined symbols. These can be overcome by adding the correct libraries to the makefile, but then I get the following error when trying to run the recommended test lorenz{root} 180: setenv PYTHONPATH .:./PIL lorenz{root} 181: python Python 1.5.2 (#2, Feb 8 2000, 10:27:03) [GCC 2.95.2 19991024 (release)] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import _imaging Traceback (innermost last): File "", line 1, in ? ImportError: ld.so.1: python: fatal: ./_imaging.so: required mapping 0x10000 size 0x206000, is already in use by file python >>> ^D lorenz{root} 182: Any help appreciated, thanks barry From effbot at telia.com Fri Feb 18 16:36:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 21:36:23 GMT Subject: how to turn arbitrary binary string into unix filename? References: <00Feb18.122230pst."3872"@watson.parc.xerox.com> Message-ID: Bill Janssen wrote: > But after half an hour of poking around, I can't see a > standard method that one can call to hexify a string. well, you could have written one from scratch in much less than 30 minutes, right? ;-) here's some sample code from the eff-bot guide: # md5-example-2.py import md5 import string import base64 hash = md5.new() hash.update("spam, spam, and eggs") value = hash.digest() print string.join(map(lambda v: "%02x" % ord(v), value), "") print base64.encodestring(value) ... running this prints: 4c054aa3b6eda37560c57283b71046c3 TAVKo7bto3VgxXKDtxBGww== ... alternatively use "sha" instead of "md5"; sha instances have a hexdigest method that does exactly what you want. gives you a stronger digest, and even longer file names! From matthias.huening at univie.ac.at Tue Feb 29 02:59:28 2000 From: matthias.huening at univie.ac.at (Matthias Huening) Date: Tue, 29 Feb 2000 08:59:28 +0100 Subject: A comp.lang.python code snippet archive? References: <200002281844.TAA19752@dionysus.fw.cuci.nl> Message-ID: <89fuas$86ti$1@www.univie.ac.at> >I would like to know: >* if it's still worthwile to continue this site Yes, it is! At least I would like you to continue this project. Being a newbie I learn a lot by looking at the snippets. Matthias - - - - - matthias.huening at univie.ac.at http://www.ned.univie.ac.at/ From jeremiah at widomaker.com Mon Feb 7 10:47:25 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:47:25 GMT Subject: nonlinear programs Message-ID: <389E0874.891BC285@widomaker.com> is there a way for me to start on a function, then move onto another function before that function ends? I am working on an mpg123 frontend, and i want to start a song playing, then allow the user to either skip that song, or perform other essential tasks during the time when a song is playing. is this possible? From tbryan at python.net Wed Feb 9 22:46:50 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 09 Feb 2000 22:46:50 -0500 Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com> Message-ID: <38A234AA.2B1FE6CB@python.net> Mike Steed wrote: > > I've seen _one_ application (TkRat, an IMAP client done in > > Tcl/Tk) in a long long time that allows calling an external > > editor. > > > > Is this a difficult task which I just don't understand the > > complexities of? > > A while ago there was a discussion about this on the Vim developers list. > The consensus was that we need a protocol to allow communication between > (for example) editors and debuggers -- open file x, set a breakpoint on line > y, etc. The intent would be to enable the plugging in of any (smart) editor > to any (smart) IDE. > > I have dreamed of this for some time. I would like to help with such a > project (feels too big for me to do alone), but as far as I know there is > nothing like this in development. If I get ambitious enough, I might try it > anyway. FUSE, the IDE (er...collection of tools) for Tru64 Unix (DEC Alpha box), calls an external editor. It can be set to FUSE's own editor, (X)emacs, or vi. For the (X)emacs part, I know that it uses ToolTalk (?) support. Sun has an IDE on Solaris called Workshop that can (must?) integrate with Xemacs. I'm not sure how these tools integrate or whether it is the type of integration you're looking for, but you might want to look at one or both before proceeding. In particular, you may want to look at the functionality provided by ToolTalk before designing your standard protocol. ---Tom From mjabbur at iss.net Thu Feb 24 08:27:14 2000 From: mjabbur at iss.net (Marlon Jabbur) Date: Thu, 24 Feb 2000 10:27:14 -0300 Subject: Readline Message-ID: hi list, i'm looking for a readline module in python, i'm planning to do a application that open a shell and behave like bash. Anyone knows if this module already exists???? Thanks. Marlon From tbryan at python.net Wed Feb 2 22:40:44 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 02 Feb 2000 22:40:44 -0500 Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <3898F8BC.3E4DD8B6@python.net> Ralf Hildebrandt wrote: > > On Tue, 1 Feb 2000 11:05:54 +0100, Fritz Heinrichmeyer wrote: > > > >I thought of a nice python environment under windows ... It would be best to > >have german documentation too. > > Anyway, as far as I know there's no embedded development system for Python > on Windows. For an IDE under Windows, there's PythonWin or IDLE. Or, my favorite, Xemacs and Python mode. :) C-c-C-!-ly yours ---Tom From kens at sightreader.com Tue Feb 29 15:02:26 2000 From: kens at sightreader.com (Ken Seehof) Date: Tue, 29 Feb 2000 12:02:26 -0800 Subject: (Easy ??) question about class definition References: Message-ID: <38BC25D1.AA1A970E@sightreader.com> You forgot your self. >>> def f(): ... print 'spam' ... >>> >>> class entry: ... def __init__(self, name, action): ... self.name= name ... self.action= action ... def selected(self): ... apply(self.action, ()) ... >>> def f(): ... print 'spam' ... >>> e = entry('spammer', f) >>> >>> e.selected() spam >>> Also, you can use apply instead of exec, and get the added bonus of being able to add parameters later. Gregoire Welraeds wrote: > Hello again, > > I think the problem I have is common in OOP... but I don't have any > beginning of solution. > > I got the following problem. Imagine i want to manage a menu. So I define > 2 classes. First one is the class menu and is basicly a list of entry. The > second is the item class representing each menu entry. When an item of my > menu is selected, I want to execute some action... The action I want to > perform is different for each item. So I get the following > > class entry: > def __init__(self, name, action): > self.name= name > self.action= action > def selected(): > exec(self.action) > [some methods] > > class menu: > def __init__(self, name): > self.name= name > self.list=[] > [some methods] > ... > > Now self.action is a reference to something I have to define elsewhere. It > could be a separate function... but then, the function is not bound to a > class as method are and everybody can use it. And I don't want to have > each action to be define in the class. > thus the problem is that each action i bound with an instance of the class > item. > I know there are some solutions in Design Pattern but I don't know howto > implement this in Python. > > thanks for your answer. > > -- > 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 rdudfield at my-deja.com Wed Feb 23 15:33:58 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Wed, 23 Feb 2000 20:33:58 GMT Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> Message-ID: <891g7l$cf8$1@nnrp1.deja.com> In article <20000222211406.41743.qmail at hotmail.com>, "Shawn LeBlanc" wrote: > Greetings! > > Being totally new to Python and completely honest in saying that > I have no idea of what I'm doing, I had a few questions. > > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior. This would allow the level/content designers > to concentrate more on the game design side of things, since > behaviors would be outside of the main game engine. Is it > possible to have multiple scripts running at the same time? > Would this involve creating multiple interpreter objects? According > to the docs, this is possible but it isn't totally safe to do. > What would be a good strategy for this? > > My other question was one of performance. Is it crazy to have > ~10 different objects with each an individual script and hoping > the game will be running at 30 frames per second? The question might not be > valid, since I'm not sure how to implement it in the first > place. > Microthreads would be good for this. Although I'm not sure if the authour is continuing work on them. As a side note you might want to check out crystalscript. Which is python, semi-based on unreals agent apis. It is for use with crystalspace. There is a link to crystalscript off the cyrstal.linuxgames.com site. Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Sun Feb 13 01:15:35 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 13 Feb 2000 08:15:35 +0200 (IST) Subject: A = X > Y ? X : Y In-Reply-To: Message-ID: On Sun, 13 Feb 2000, Grant Edwards wrote: > On Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen wrote: > > >I fear that this question has already been asked, > > Yes, it has. > > >but is there and > >equivalant one line command that is equivalant to the C command: > > > >a = x > y ? x : y > > Possibly. > > Generally this question is answered with at least a half-dozen > or so one-line code examples -- almost all of which somebody > will claim are wrong in one respect or another. While there > may exist an equivalent chunk of Python code, the practical > answer seems to be that there isn't a _good_ (readable and > obviously correct) way to do this with one line of Python code. > > -- > Grant Edwards grante Yow! I'm in direct contact > at with many advanced fun > visi.com CONCEPTS. > -- > http://www.python.org/mailman/listinfo/python-list > -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From fredrik at pythonware.com Tue Feb 1 05:17:59 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 11:17:59 +0100 Subject: ANN: Python training in Sweden! References: Message-ID: <009601bf6c9d$9ddc77c0$f29b12c2@secret.pythonware.com> Mikael Olofsson wrote: > http://www.pythonware.com/training/blue.css > which is a Not-Found-Booboo. should be fixed by now: http://www.pythonware.com/training/ From lisse at saintmail.net Tue Feb 29 22:55:39 2000 From: lisse at saintmail.net (Lisa) Date: Wed, 01 Mar 2000 03:55:39 GMT Subject: XML-RPC References: <88aka3$mn4$0@216.39.162.232> Message-ID: <89i4bq$sn0$1@nnrp1.deja.com> In the page http://www.pythonware.com/products/xmlrpc/, there is a mention that 0.99 of xml-rpc would have been out by dec.99, and I would like to know if anyone has any info as to where to find that thing? BTW, is there any info online, anywhere, that can link me to more info regarding xml, the standard, the tutorial, and such? Thank you all !! Lisa lisse at saintmail.net PS. Please cc: me your reply. Thanks again ! Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Sun Feb 27 00:24:37 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 07:24:37 +0200 (IST) Subject: Converting a floating point number to a string In-Reply-To: <899bqt$udk$1@nnrp1.deja.com> Message-ID: On Sat, 26 Feb 2000 kurtn at my-deja.com wrote: > Hei > As the subject says I would like to convert a > floating point number to a string, in other words > the opposite of 'atof'. I appreciate all the help > I can get. >>> a = 1.0 >>> str(a) '1.0' -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit.holl at pobox.com Fri Feb 18 10:11:15 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 16:11:15 +0100 Subject: breaking the ; habit In-Reply-To: <9t9d7pyn98a.fsf@mraz.iskon.hr>; from hniksic@iskon.hr on Tue, Feb 15, 2000 at 09:47:01AM +0100 References: <000101bf75de$0d12f940$962d153f@tim> <9t9d7pyn98a.fsf@mraz.iskon.hr> Message-ID: <20000218161115.D3878@stopcontact.palga.uucp> Hrvoje Niksic wrote on 950604421: > cjc26 at nospam.cornell.edu (Cliff Crawford) writes: > > > Pada 13 Feb 2000 10:18:13 -0500, Fran?ois Pinard bilang: > > | > > | Just for fun, my own difficulty was to break the habit of the space before > > | the opening parenthesis which is part of a function call, since it has > > | been burned from GNU standards into my neurons, years ago. > > > > Now I know who to curse the next time I see code formatted like that. > > > > and-i-thought-it-was-microsoft-ly y'rs, > > That has absolutely nothing to do with Microsoft. And yes, it's been > in the GNU standards for ages. That's how I code C, too. Gnu does more strange things: gatewaying all it's mailinglist to the main newsgroup hierarchy. Using Texinfo instead of Man. Using obscure mailinglist management software, but writing very well mailinglist management software their own. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From scarblac-spamtrap at pino.selwerd.nl Tue Feb 1 08:23:22 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 1 Feb 2000 13:23:22 GMT Subject: list -> dict help References: <3895BE15.A7CF569B@bam.com> <3895DEAE.574232D2@bam.com> Message-ID: Bill Scherer wrote in comp.lang.python: > Thanks! This works almost perfect. My only problem now is that of course I'm > dealing with many lines of input, and I want to put them all in the same > dictionary. (sorry for not mentioning this originally). eg: > > I'll have many lists that are functionally equivalent to the following: > > ['a', 'b', 'c', 1] > ['a', 'b', 'r', 21] > ['a', 'g', 'e', 'z', 13] > etc... > > my earlier statement, that l[:-2] are netsed keys and l[-2:] is the terminal > key/value pair, still holds. So that would result in a dictionary such as the following? {'a' : {'b' : {'c' : 1, 'r' : 21}, 'g' : { 'e' : {'z': 13 }}}} The following should work then (expanded from the previous answer): #!/usr/local/bin/python def convert(list): d = { list[0] : None } lastdict = d # Remember which dict to change with which keys, lastkey = list[0] # for replacing the None. for key in list[1:-1]: lastdict[lastkey] = { key : None } lastdict = lastdict[lastkey] lastkey = key # Add the last key lastdict[lastkey] = list[-1] return d dict = {} def add_list_to_dict(list): """ Find the first place in the existing dictionary where this list adds something new. Put the 'convert' of the remainder of the list into dict at that point. """ tempdict = dict for keynum in range(len(list)-1): try: tempdict = tempdict[list[keynum]] except KeyError: if keynum == len(list)-2: tempdict[list[keynum]] = list[keynum+1] else: tempdict[list[keynum]] = convert(list[keynum+1:]) return >>> add_list_to_dict(['a','b','c',1]) >>> add_list_to_dict(['a','b','r',21]) >>> add_list_to_dict(['a','g','e','z',13]) >>> dict {'a': {'b': {'r': 21, 'c': 1}, 'g': {'e': {'z': 13}}}} There is an undefined case, if a new list overlaps with an old list. My code keeps the old value. >>> dict = {} >>> add_list_to_dict(['a','b','c',1]) >>> add_list_to_dict(['a','b','c',2]) >>> dict {'a': {'b': {'c': 1}}} Probably someone can improve on it, but it works for me :-). For production code it needs better names and better bounds checking. ObShouldHaveAskedThisEarlier: What do you need this for, anyway? Isn't there a simpler 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 wware at world.std.com Tue Feb 29 18:39:27 2000 From: wware at world.std.com (Will Ware) Date: Tue, 29 Feb 2000 23:39:27 GMT Subject: Phython as In-Game scripting language References: <20000224155917.81782.qmail@hotmail.com> <38B9A3C6.9CFA5FF8@sightreader.com> <89hc9g$kno$1@kopp.stud.ntnu.no> Message-ID: I will be momentarily be posting a stackless/microthreads merge (or at least a first crude cut at one, bugs remain) which may be of interest to people following this thread. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From effbot at telia.com Wed Feb 2 17:39:03 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 22:39:03 GMT Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> Message-ID: Mike Callahan wrote: > I thought that a new Python was going to be released "soon" which would > make some minor changes to the language. The one thing that struck in my > mind is that one would call string methods rather than functions, ie. > astring.upper() vs. string.upper(astring). There were other changes as > well. Python 1.6 will go into alpha towards the end of this month. Changes include support for unicode strings, string methods, a new regular expression engine, and assorted bug fixes and other tweaks. afaik, most non-unicode changes are already in the CVS repository. From bradh at mediaone.net Tue Feb 8 21:58:08 2000 From: bradh at mediaone.net (Brad Howes) Date: Wed, 09 Feb 2000 02:58:08 GMT Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: Justin Sheehy writes: > Brad's example is incorrect, and is not in the FAQ. Oops! Mea culpa. > People ought to look at the FAQ when they talk about it. Yes. Sorry for the misinformation. Brad -- "Were people this stupid before TV?" -- _White Noise_ by Don DeLillo From dworkin at ccs.neu.edu Fri Feb 11 19:04:33 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 11 Feb 2000 19:04:33 -0500 Subject: Find word In-Reply-To: "Pedro Silva"'s message of "Fri, 11 Feb 2000 12:12:47 -0000" References: <000801bf7489$4ed22640$6c00a8c0@ruidovisual.pt> Message-ID: "Pedro Silva" writes: > I want to find some words in a file, how can I do this in python? You posted almost exactly the same request a day or two ago, and some of us responded with suggestions. Please read those suggestions. -Justin From wware at world.std.com Thu Feb 24 18:32:05 2000 From: wware at world.std.com (Will Ware) Date: Thu, 24 Feb 2000 23:32:05 GMT Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> <891g7l$cf8$1@nnrp1.deja.com> <893u76$46l$1@nnrp1.deja.com> Message-ID: shawn_leblanc at my-deja.com wrote: : Just so I understand (and also because my : programmer teammates are asking me questions), is : unmodified (no stackless or microthreads) Python : unable to run multiple scripts at the same time? : I'm thinking no because if Python was able to run : multiple scripts simultaneously, there : wouldn't be a need for SP or MT's. Sorry, my last post must have been unclear. There are standard Python modules called "thread" and "threading" documented on these two web pages: http://www.python.org/doc/current/lib/module-thread.html http://www.python.org/doc/current/lib/module-threading.html These modules assume that threads are available at the OS level. I think this stuff is switched on in the standard executables you'd pull down from ftp.python.org, such is the impression I get from looking at Modules/Setup.in.thread. I haven't verified that; you might end up needing to rebuild Python from source to take advantage of this. I don't think you can get multiple scripts to run simultaneously without using one of these three: SP, MT, OS threads. But I haven't looked at how Zope handles this, maybe there's a fourth way I don't know about. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From aahz at netcom.com Thu Feb 17 17:54:43 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 22:54:43 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: <001601bf7853$6b03e7e0$b7a0143f@tim> <88h50k$mt2$1@nntp6.atl.mindspring.net> <38AC5FCA.75F4EA42@prescod.net> Message-ID: <88hu7j$kqc$1@nntp6.atl.mindspring.net> In article <38AC5FCA.75F4EA42 at prescod.net>, Paul Prescod wrote: > >I'm not sure if I believe what Tim said about implementing threads with >continuations or vice versa. A continuation is, in my mind, only vaguely >related to a thread. Assuming that I've understood everything you've said about continuations, I think I also understand what Tim meant about modeling threads with continuations and vice-versa. Seems to me that one could easily implement continuations with a process that forks off and blocks waiting for one of two signals: resume or die. (When a process forks, both processes have almost exactly the same state, right?) If everything I've said above is correct, then it should be reasonably straightforward to also model continuations with threads (but probably not Threading.py). I leave the reverse model as an exercise for the reader. ;-) >def producer(): > global producer_continuation, consumer_continuation, data > while 1: > producer_continuation=currentContinuation() > data = readSomeData() > consumer_continuation( ) > >def consumer(): > global producer_continuation, consumer_continuation, data > while 1: > consumer_continuation=currentContinuation() > producer_continuation( ) > print data > >producer_continuation=None >consumer_continuation=None >data=None To demonstrate what I think is my understanding, let me rewrite your code a bit for correctness and simplicity: def producer(): global producer_continuation, consumer_continuation, data producer_continuation=currentContinuation() while 1: data = readSomeData() consumer_continuation() def consumer(): global producer_continuation, consumer_continuation, data consumer_continuation=currentContinuation() producer() while 1: print data producer_continuation() producer_continuation=None consumer_continuation=None data=None consumer() Am I right? -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From anthonydelorenzo at my-deja.com Fri Feb 4 14:52:46 2000 From: anthonydelorenzo at my-deja.com (anthonydelorenzo at my-deja.com) Date: Fri, 04 Feb 2000 19:52:46 GMT Subject: parsing text References: <949666439.1009585074@news.sheltonbbs.com> Message-ID: <87famb$m2u$1@nnrp1.deja.com> > Hi again, I'm currently having a problem parsing text, reading it actually. I'm > trying to read a config file in the form of name=value I'd need to search for > name, and return value. If anyone has any code snippets that do nething like > this I would appreciate it. Assuming that you decide not to directly import it, as was suggested, you could do something like this, assuming that each item is on a different line. This would give you a dictionary of values. import string configfile = open ('filename.ext','r') name, value = string.split(configfile.readline(),'=') config[name] = value Tony Sent via Deja.com http://www.deja.com/ Before you buy. From infonuovo at email.com Tue Feb 29 12:03:10 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Tue, 29 Feb 2000 09:03:10 -0800 Subject: Functional Programming versus ToolCraft In-Reply-To: <000901bf8290$7e1881a0$732d153f@tim> Message-ID: OK, By descriptive schemes, I did mean Prolog and what happens in Haskell (basically, facts get cached so that they are available for consultation in new questions). I want to point out a difference between local and global issues here, and then get to a more interesting thing (and then maybe give up this thread altogether). As far as I am concerned, use of imperative operations in the implementation of a function can lead to a functional result so long as the operation of the function never shows a side-effect. That is, if you can't tell that I did imperatives, treating the function implementation as a black box, I have done my job. In particular, if there is no impact on the global state of the computation, as opposed to the local state of the function implementation, I am not so picky. Yes, assignment operations are inherently "side-effects." What is interesting for me is that practically every engine that implements functional systems employs imperative mechanisms internally, and in fact, this is a source of the effectiveness of the functional implementation. The difference for scheme is that it only makes that accelerator capability available to users of the engine via idiomatic trickery. Fine. - - - - - - - - - What is interesting to me is that in the use of different programming systems, people learn things about the underlying mechanism (whether accurate or the programming equivalent of urban folklore) and develop a model (possibly inaccurate) that guides how programs are expressed. It is not accounted for in the straightforward semantics of the language as it might be defined abstractly, but it is a response to the actual behavior of the tool. I call this collapse and modeling "toolcraft." For example, it is toolcraft to expect the kinds of failure trace-back that the Python engine provides and then be familiar with it as how things should be. It is an interesting human adaptation mechanism. So, conniving tail-recursive forms of function definitions is part of the toolcraft around the use of scheme. I notice, as can anyone who runs my fibt(n) versus fibn(n) examples, that there is a benefit to that in Python as well as in scheme, and you can write a purely functional program with good performance (but it is expected to take space of order O(n), not O(1), though the engine *might* have an accelerator that improves that). Now there are all of these idioms for getting computations to be O(const) in space in Scheme. The idiom in python is to use safe imperatives and iterations (i.e., with no side-effects arising against the *use* of the function, rather than relying on the fact that the implementation will do that last step for me (not so well, lacking the global knowledge of the problem that I have). If someone put that accelerator into the standard python implementation, after a while, there would be a lot of idiomatic expressions that connived to take advantage of the accelerator in the implementation. (The error trace-back mechanism would also have to be improved and people would adapt to that, too.) It is fascinating for me how our relationship to tools isn't a relationship to the semantics and purity of it but to the pragmatics of the underlying implementation. No surprise, actually. Yet we don't seem to be very aware of doing that, and that makes this almost an anthropological discussion rather than anything about language systems! It makes the debates about good/right things pretty amusing, though. I find toolcraft to be a fascinating topic. For one thing, awareness that we have lots of it is a good practice when we have problems communicating yet we appear to be talking about the same things. (I recently started looking at this because of the dramatic differences in toolcraft I saw among open-source practitioners and Win32 developers.) I think being aware of the foundation for idioms that arise in conjunction with different tools, and that toolcraft idioms are inescapable, is an important aspect of teaching, experience, and design for programming systems. -- Dennis -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Tim Peters Sent: Tuesday, February 29, 2000 00:39 To: python-list at python.org Subject: RE: functional programming & tail recursion? > I don't think one should begrudge an iterative implementation (which is > pretty immediate) as non-functional! "functional" implies (among other things) "no side effects". i = i+1 is not a functional program. Saying that iteration is not functional is a matter of defn, not of moral judgment. albeit-on-real-hw-nothing-is-functional-under-the-covers-ly y'rs - tim -- http://www.python.org/mailman/listinfo/python-list From aahz at netcom.com Tue Feb 22 17:51:24 2000 From: aahz at netcom.com (Aahz Maruch) Date: 22 Feb 2000 22:51:24 GMT Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <20000222213539.C4549@stopcontact.palga.uucp> <88utem$gfr$1@nntp6.atl.mindspring.net> <20000222225522.A5923@stopcontact.palga.uucp> Message-ID: <88v3tc$mlj$1@nntp6.atl.mindspring.net> In article <20000222225522.A5923 at stopcontact.palga.uucp>, Gerrit Holl wrote: > >> >> Hmmm? What makes you say that range() is possible in pure Python and >> xrange() is not? (I think the latter requires a class with __getitem__ >> but is otherwise doable.) > >xrange returns an XRangeType; can I return that from a Python function? I agree that you probably cannot return an XRangeType, but I think you can mimic the xrange() behavior with a class. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From sholden at bellatlantic.net Tue Feb 8 07:48:27 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 08 Feb 2000 12:48:27 GMT Subject: CGI Scripts References: Message-ID: <38A010B6.6F9E9298@bellatlantic.net> Have you viewed the HTML source of your generated page? It's possible the output from your script is appearing somewhere other than inline, in which case your code might actually be running but the browser may not be rendering the output. regards Steve Robert Rutkowski wrote: > > I'm new to programing and in an effort to learn python, I'm trying to write > a simple text counter. The script is called with an SSI exec command. The > path on my server is correct and the script appears to work. I receive no > errors, and the script runs just fine locally on my machine. > My problem is that the script returns a result via the print command. {print > `count()`}, but when I try to run the script on my server, I get no results, > just a blank page. > Am I missing something? Is there a module that I need to pass the result to > to see it in my web browser. > > ----------------------------------------------------- > #!/usr/contrib/bin/python > > #Python Counter Script > > import cgi > import string > > def count(): > count = open('counter.log', 'r+') > strhits = count.read() > hits = string.atoi(strhits) > hits = hits+1 > count.seek(0, 0) > count.write(`hits`) > count.close() > return hits > > print "Content-type: text/html" > print > print `count()` > ------------------------------------------------ From jjlucsy at concentric.net Tue Feb 22 10:25:29 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Tue, 22 Feb 2000 10:25:29 -0500 Subject: Multiple ExtensionClass References: Message-ID: I've figured it myself (just takes time). Basically I use the PURE_MIXIN_CLASS macro in ExtensionClass. Since the result is an uninstantionable I wrapped a Python class around them. I'll be releasing the end result to the public when I'm finished. I'm basically rewriting the pyFLTK toolkit by hand instead of using swig. "Joel Lucsy" wrote in message news:CCXq4.651$yT3.43993 at news1.usenetserver.com... > Ok, I've whipped up two ExtensionClass classes (stirred, not shaken) and am > trying to figure out how one can be a "subclass" of the other. I'll > illustrate what I want (in python for brevity): > > class A: > def func1(): > pass > class B(A): > def func2(): > pass > > Now I'd like to be able to do: > a=B() > a.func1() > > So far I haven't figured out how to do this without duplicating the methods. > Should I be messing with the method tables, or somehow manipulating the > dictionaries, or something completely different? I've tried making python > wrappers, but it complains about multiple bases or something. Basically it > wont let me derive from two different ExtensionClasses's. Either that or I'm > missing something. > Any clues would be great. Thanks. > > -- > - Joel Lucsy (jjlucsy at concentric.net) > > > > > From mmiller3 at iupui.edu Thu Feb 17 18:05:54 2000 From: mmiller3 at iupui.edu (Michael A. Miller) Date: 17 Feb 2000 18:05:54 -0500 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38AC50B2.3FAF778@sage.att.com> <38AC6549.8C48CA4@callware.com> Message-ID: <87900jig4t.fsf@lumen.med.iupui.edu> >>>>> "Ivan" == Ivan Van Laningham writes: > Hi All-- "Garrett G. Hodgson" wrote: >> glue an inverted thumbtack to your ";" key. if that >> doesn't work, coat it with poison, or maybe LSD. > I guess it shows what sort of person I am when I find this > suggestion at once gleefully morbid and deliciously elegant > in its simplicity. Surely, it is the most Pythonic of the > proferred solutions. It has a bad side effect though - at least on my keyboard I need to use shift-; to make a :, which I need for python. Another solution, if you're using a unix variant and X, would be to remap ; to . Mike From effbot at telia.com Mon Feb 7 10:22:12 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 07 Feb 2000 15:22:12 GMT Subject: PIL for 1.5.1 References: Message-ID: Anders M Eriksson wrote: > My ISP has Python 1.5.1 installed and I wonder where can I get PIL > that works for this version? afaik, the standard 1.0 source distribution should work just fine under 1.5.1 (I'm pretty sure it still works with 1.4) http://www.pythonware.com/products/pil From python at rose164.wuh.wustl.edu Wed Feb 2 11:27:56 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Wed, 02 Feb 2000 16:27:56 GMT Subject: Accessing a lock object in a C module In-Reply-To: References: Message-ID: <20000202.16275603@sparky.spkydomain> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/1/00, 8:54:54 AM, Konrad Hinsen wrote regarding Accessing a lock object in a C module: > For a threaded application, I need to access a lock both from Python > code and from a C extension module, but I haven't yet found a way to > do that. > If I create a lock object in Python via the thread module, I can't > access its lock_lock member; the structure definition is not in a > header file, and there is no C-level access routine either. Inversely, > if I create a lock in a C module, I can't create a corresponding lock > object accessible from Python. The struct is at the top of threadmodule.c: /* Lock objects */ typedef struct { PyObject_HEAD PyThread_type_lock lock_lock; } lockobject; hope this helps, David Fisher From aa8vb at yahoo.com Fri Feb 25 17:28:39 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 25 Feb 2000 17:28:39 -0500 Subject: idlerc.py In-Reply-To: References: <20000225073335.A3192031@vislab.epa.gov> <5Rwt4.22183$Jz3.111477@nnrp1.uunet.ca> <20000225110539.A3389718@vislab.epa.gov> Message-ID: <20000225172839.A3177573@vislab.epa.gov> Bernhard Herzog: |Randall Hopper writes: |> Warren Postma: |> |> Now is there a way to put these color settings in an ".idlerc" of sorts so |> |> they're kept from version to version without hacking any source? |> | |> |How about checking your working (and home directory for unix} for an |> |"idlerc.py" on Unix and if so, run it. |> |> Sounds good, but IDLE doesn't support it. | |Don't forget the time machine! It's a little known and perhaps |undocumented feature of Tkinter that it tries to execute a coule of |files in the user's home directory on startup. See the readprofile |method of the Tk class in Tkinter.py. That's good to know! I've not seen that in print before. (Fredrik, I see this isn't mentioned in the latest draft. I think it's definitely worth a mention) |In IDLE'S case, one of the files is ~/.idle.py. | |I don't use IDLE myself, but I just tried it with the version that comes |with 1.5.2 and it works. It didn't work for me. No matter whether I invoke "idle.py" directly or run "python idle.py", it didn't touch ~/.idle.py (I know because I put a print and a sys.exit in there). Under the hood, baseName and className (args to Tk() are left to their defaults. sys.argv[0] is empty (?). And the reason is that IDLE is hacking up sys.argv for some reason when -e isn't specified, which prevents baseName from being set, which causes Tkinter to look for these files: /home/rhh/.Tk.tcl /home/rhh/.Tk.py /home/rhh/..tcl /home/rhh/..py and which therefore prevents .idle.py from being read by Tkinter. Seeing this, I verified that IDLE does indeed read ~/.idle.py when invoked as "idle.py -e". This appears to be a bug. If there are no objections after a while, I'll go ahead and file it. |On potential problem is that this happens very early on and important |parts of IDLE might not be initialized yet. In Sketch at least this |feature is practically worthless because of that. I see. IDLE as-is doesn't appear to be coded to allow an override of class ColorPrefs by Tkinter. I'd code up a quick patch, but I can't figure where in the world the symbols defined in ~/.idle.py are getting placed ! (From Tkinter.py, it looks like they should be in _default_root, but apparently not...) -- Randall Hopper aa8vb at yahoo.com From michael.stroeder at inka.de Sat Feb 19 12:46:48 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 19 Feb 2000 18:46:48 +0100 Subject: Read input in do_POST() method (was: embeddable Python web server) References: <38AC9E92.C1CEFEB7@inka.de> <38AD3C67.A08EFE2D@inka.de> <87u2j68n7j.fsf_-_@den.home.net> <38AD8B9C.F3F4DCF5@inka.de> Message-ID: <38AED708.DED8039A@inka.de> Michael Str?der wrote: > > Frank Sergeant wrote: > > > > if self.command == 'POST': > > form = string.strip (self.rfile.readline()) > > I had problems with HTTP-POST. In my case I read the data like > module cgi does: self.rfile.read(contentlength). This works just > fine when running as a normal CGI-BIN under the control of Apache. I > tried your solution with readline() and it works now. Thanks. Well, I'm pretty much confused about the details of using POST method. Here's what I experienced up to now: Running as CGI-BIN using Apache: Either self.rfile.read(contentlength) or self.rfile.readline() works just fine with all browsers (lynx, w3m, Netscape etc.). Running through own do_POST() method in a web server class derived from SimpleHTTPServer.SimpleHTTPRequestHandler: self.rfile.read(contentlength) works with lynx, w3m, but Netscape 4.7 hangs. self.rfile.readline() works with w3m, Netscape 4.7, but lynx hangs. Can anyone shed light on this?!? Ciao, Michael. From aotto at t-online.de Mon Feb 21 08:02:00 2000 From: aotto at t-online.de (Andreas Otto) Date: Mon, 21 Feb 2000 14:02:00 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <38B0E09D.EC26F41E@t-online.de> Message-ID: <38B13748.D2B0BA62@t-online.de> Remco Gerlich wrote: > It is! When you do, and you learn it well, you'll also see why a compiler > for it is very hard to make. > I've written an compiler for Tcl,.. if tcl works python will works too The way how an compiler for scripting languages works is totally different from the c/c++ way. It will be more interactive how better you teach the compiler how better your code will be If you don't teach the compiler it will only blow away the air and find spelling errors on source code mfg aotto :) -------------- next part -------------- A non-text attachment was scrubbed... Name: aotto.vcf Type: text/x-vcard Size: 451 bytes Desc: Card for Andreas Otto URL: From evan at 4-am.com Sun Feb 13 19:45:46 2000 From: evan at 4-am.com (Evan Simpson) Date: Sun, 13 Feb 2000 18:45:46 -0600 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <86ya8szq90.fsf@g.local> <1e5wxbt.bq9v2nqzwbxuN%bparsia@email.unc.edu> <886t16$kbp$1@nntp6.atl.mindspring.net> Message-ID: Bernhard Herzog wrote in message news:m3n1p493pg.fsf at greebo.nodomain.de... > It seems to me that deciding what super should do is quite > straightforward in Python. > > Given e.g. > > class Xyzzy(Spot, The, Looney): > > def walk_silly(self): > super() > > Then super would evaluate to whatever Xyzzy.walk_silly would evaluate > to if walk_silly weren't an attribute of Xyzzy. Suppose we have... class Xyzzy(Spot, The, Looney): def walk_silly(self): return super() walk = walk_silly ... what should Xyzzy().walk() do? The name 'walk' is in no way accessible to the implementation of 'super'. Apart from that, I suppose if it can somehow get hold of the method object, 'super' could find the __name__ of the method and the class to which it's bound, and go from there. I'd expect it to have to be called as 'super(self)', though. Cheers, Evan @ 4-am From mcalla at home.com Wed Feb 2 17:12:24 2000 From: mcalla at home.com (Mike Callahan) Date: Wed, 02 Feb 2000 22:12:24 GMT Subject: Where is Python 1.6? Message-ID: <3898ABDB.86804799@home.com> I thought that a new Python was going to be released "soon" which would make some minor changes to the language. The one thing that struck in my mind is that one would call string methods rather than functions, ie. astring.upper() vs. string.upper(astring). There were other changes as well. Mike Callahan From tim_one at email.msn.com Wed Feb 2 02:34:45 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 2 Feb 2000 02:34:45 -0500 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <389739fb.95247007@news.teleport.com> Message-ID: <000101bf6d4f$fb1ba480$28a0143f@tim> [posted & mailed] Since this hasn't degenerated into a flame war yet (yay!), I'll risk taking a brief stab at the specifics: [Kirby Urner] > For more context re the below, see the archived thread > (on-going) at the Math Forum. This is from an > Association of Mathematics Teacher Educators > listserv: > > http://forum.swarthmore.edu/epigone/amte/snuquoiyor > > If people posting here have the time to read what > Matthias says about Python... e.g.: > > > As far as the language is concerned, Python is a > > - highly irregular, Beats me. Python's base semantics are exceptionally regular ("everything's an object", "everything's a reference", both without exception). Perhaps this is about syntax, then. Python does use different syntax for different purposes; Lisp does too, but only at the token level; Python does at the expression, statement and block levels as well (Lisp has only the expression level above the token level). I see this as a complex web of tradeoffs, but for all its minimalistic elegance and historicity, the Lisp approach to syntax simply hasn't proved popular (but he should argue about that with the Dylan folks, who are much closer relatives). > > - badly implemented I've been programming professionally for well over 20 years, most of that time as a compiler writer. In terms of robustness, lack of bugs, easy portability, clarity, and ease of maintenance, Python is the single best large C program I've ever seen! The first Python pre-release *alpha* I used was remarkably reliable, and this has not degraded over the years. So this claim is just bizarre on those bases. Maybe it refers to choice of language implementation techniques? Python is a bit "old fashioned" that way. Those are *extremely* complex tradeoffs, though, and Python has taken more of a "better clear than fast" approach than most other language implementations. > > - non-parethetical version of (Mz)Scheme It's really that (Mz)Scheme is a weird variant of Python . Really, IIRC, Guido had never used any Scheme before implementing Python. Algol, ABC and Modula-3 were certainly stronger influences. To the extent that people see a flawed attempt at Lisp in Python, it's coming from their heads, not Guido's. > > - without underlying theory of programming > > language design Certianly not a formally stated one, no. > > - or program development Hey, he may be a living god, but he's only one guy <0.9 wink>. Python was designed to *support* many popular (at the time) approaches to procedural and object-oriented imperative programming, without insisting on any particular one. If you intend to teach a number of approaches, this can be a real advantage. It was not designed to support functional programming styles, and they remain clumsy in Python to this day -- "writing Scheme in Python" is one sure way to come to the conclusion that Python sucks, but it's not something Python was aiming at. > > - with a cult-like following. I was willing to grant this one at once, but, now that I look back at it all-- the loyalty oaths, the relentless self-criticism sessions, the midnight visits from the Ministry of Love --I'm afraid what we really have here is unspeakably more sinister. Besides, cults have a lot easier time raising money. Python hasn't even managed to attract an evangelist yet. virtually-everyone-using-python-today-does-so-by-choice-ly y'rs - tim From gerrit at nl.linux.org Sun Feb 27 16:10:41 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Sun, 27 Feb 2000 22:10:41 +0100 Subject: Best book to learn Python? In-Reply-To: ; from Quillsmind@home.net on Sun, Feb 27, 2000 at 02:55:55PM -0600 References: Message-ID: <20000227221041.A10967@humbolt.nl.linux.org> On Sun, Feb 27, 2000 at 02:55:55PM -0600, Quill wrote: > I'd like to learn Python, and I want to purchase a good book. I'd like > one that is suitable for a beginning programmer. If anyone has had any > success learning from a book please let me know. Please post responses to > the group. I had success with Learning Python. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From fdrake at acm.org Mon Feb 21 13:43:51 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 21 Feb 2000 13:43:51 -0500 (EST) Subject: Interactive programs through Popen3 In-Reply-To: References: <14513.21990.187292.675184@weyr.cnri.reston.va.us> Message-ID: <14513.34663.317297.436850@weyr.cnri.reston.va.us> Trent Mick writes: > Perhaps Joe was referring to the Windows compiled help file for Python > 1.5.2. The page for the popen2 module in this help file states popen2 > availability for UNIX and Windows. Which is incorrect. A little > inconsistency. Trent, That's out of date, unfortunately. I'll see about getting a new version of the HTML Help format when I release an updated documentation set next month. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From thomas at xs4all.net Sun Feb 13 05:18:43 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sun, 13 Feb 2000 11:18:43 +0100 Subject: Please do not Bcc: ListServers In-Reply-To: ; from infonuovo@email.com on Sat, Feb 12, 2000 at 05:26:52PM -0800 References: Message-ID: <20000213111843.L477@xs4all.nl> On Sat, Feb 12, 2000 at 05:26:52PM -0800, Dennis E. Hamilton wrote: > I notice that I seem to receive some python-related messages via the list > server yet I must be receiving a Bcc rather than a To: or Cc. > The only problem with that is that my mailbox rules don't kick in. I can > repair that, but it would work more easily if I knew the addressing that had > the message get to me, especially when I don't know any of the > explicitly-named people! If you want a sure-fire way of finding messages that were delivered by the python-list, dont check on To: or Cc:, instead check on Sender:. This would be 'python-list-admin at python.org' for all messages that came directly from the python list. You might lose that header, if you have an elaborate and insane way of doing forwarding, using umbrella lists or very strange mailservers, but that's fairly unlikely. If it doesn't work, you can try using the 'X-Been-There:' header, though it's not as fool-proof, and the mail may contain more than one of them (in the newest Mailman) Now you just need a mailprogram that can filter on that... Good ones can ;) procmail-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From effbot at telia.com Mon Feb 14 10:44:50 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 15:44:50 GMT Subject: eff-bot References: <38A7A95C.B009BCC6@kw.igs.net> <20000214141846.A1297@bork> Message-ID: Egbert Bouwman wrote: > Where does that name come from, > and what does it imply ? http://www.deja.com/=dnc/getdoc.xp?AN=555241349 From alex at somewhere.round.here Wed Feb 23 17:25:26 2000 From: alex at somewhere.round.here (Alex) Date: 23 Feb 2000 17:25:26 -0500 Subject: Problem with Emacs mode, at start only References: <14508.12680.569760.298585@anthem.cnri.reston.va.us> Message-ID: Maybe this will work a little better. The py-execute-file procedure gets the interpreter to create a file "file.executed" just before execfile'ing "file". Then the output filter only deletes "file" if "file.executed" exists, and in that case cleans up py-file-queue and deletes "file.executed, as well. Open-source-means-you-get-to-see-more-of-my-trial-and-error-than- you-want-to'ly yrs Alex. ;; Python subprocess utilities and filters (defun py-execute-file (proc filename) "Send to Python interpreter process PROC \"execfile('FILENAME')\". Make that process's buffer visible and force display. Also make comint believe the user typed this string so that `kill-output-from-shell' does The Right Thing." (let ((curbuf (current-buffer)) (procbuf (process-buffer proc)) ; (comint-scroll-to-bottom-on-output t) (msg (format "## working on region in file %s...\n" filename)) (cmd (format (concat "open('%s.executed', 'w').write(''); " "execfile('%s')\n") filename filename))) (unwind-protect (save-excursion (set-buffer procbuf) (goto-char (point-max)) (move-marker (process-mark proc) (point)) (funcall (process-filter proc) proc msg)) (set-buffer curbuf)) (process-send-string proc cmd))) (defun py-comint-output-filter-function (string) "Watch output for Python prompt and exec next file waiting in queue. This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string (when (and (or (string-equal string ">>> ") (and (>= (length string) 5) (string-equal (substring string -5) "\n>>> "))) py-file-queue) ;; (py-safe (delete-file (car py-file-queue))) (let* ((current-file (car py-file-queue)) (execution-flag-file (concat current-file ".executed"))) (if (file-exists-p execution-flag-file) (progn (py-safe (delete-file current-file)) (py-safe (delete-file execution-flag-file) (setq py-file-queue (cdr py-file-queue)) (if py-file-queue (let ((pyproc (get-buffer-process (current-buffer)))) (py-execute-file pyproc (car py-file-queue)))) )) )))) From kuncej at mail.conservation.state.mo.us Fri Feb 25 13:03:40 2000 From: kuncej at mail.conservation.state.mo.us (Jeff Kunce) Date: Fri, 25 Feb 2000 12:03:40 -0600 Subject: msvcrt, open_osfhandle, locking References: <68Hs4.1435$LX4.4374@news-server.bigpond.net.au> <06db8d30.f0a3be48@usw-ex0105-038.remarq.com> Message-ID: > >Oops - meant "locking function in msvcrt module" > > Hmmm. Do you have an example? I can't get it to work. A while back I wanted file locking with the same API on both unix and NT. I worked up something based on posixfile, that uses msvcrt on the NT side. I never used it production, so handle with care, but it might give you some ideas. See: ntposixfile.py at: http://starship.python.net/crew/jjkunce/ --Jeff From wicarrol at unity.ncsu.edu Sun Feb 6 17:46:01 2000 From: wicarrol at unity.ncsu.edu (William Isaac Carroll) Date: 6 Feb 2000 22:46:01 GMT Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> <878j9k$vpe$2@thoth.cts.com> Message-ID: <87ktj9$mi$1@uni00nw.unity.ncsu.edu> Will Rose (cwr at crash.cts.com) said: : This discussion has made it pretty clear to me that there are (at least) : two sorts of people - those who are case-sensitive readers, and those : who aren't. I don't know how one gets into one category or another; it : doesn't seem to be language-sensitive. (Is Japanese case-sensitive?). : The existence of the two types would explain why so many people like : the Microsoft CI/CP filesystems, which I, being case-sensitive, loathe. : It also means that there is no real way of settling the argument, since : each group will always prefer a different solution. Well, as far as Japanese goes, the traditional writing systems (Kanji, Hiragana, and Katakana) don't have anything corresponding to case, so the answer is, "not applicable". When writing Japanese in Romaji (Roman letters) I am not sure of the capitalization rules, but I believe they're similar to those of English. My opinion is that a computer language should be case-sensitive, but only allow one choice of case for each spelling. For example: if you have an identifier "IFooYou" in your program, declaring another identifier such as "ifooyou", or "IfooYOU" would be flagged as an error (or at least a warning). Some programmers may want to declare a class "TV" and an instance of that class "tv", and wouldn't like this restriction. I think the answer to that is that the language be classless and prototype-based like Self or Cecil. -- 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 vmarkwart at my-deja.com Sun Feb 20 22:00:37 2000 From: vmarkwart at my-deja.com (vmarkwart at my-deja.com) Date: Mon, 21 Feb 2000 03:00:37 GMT Subject: creating a python excutable References: <01bf7a65$9e487ee0$033abcc3@indiana.pro-net.co.uk> Message-ID: <88q9ok$9gj$1@nnrp1.deja.com> In article <01bf7a65$9e487ee0$033abcc3 at indiana.pro-net.co.uk>, "Jason Cunliffe" wrote: > Hello > > A friend needs to develpo a project where he can have end up with a simple > executable - double click and run . > I have been in gerneral enthusaitically promoting Python for the work he is > doing, but could not answer his question to clearly describe how to make a > simple excutable [win32] from his code. > > He is new to Python and under the impression it is not very easily doable. > > I am sure it can be done, but need some help [first for myself and then for > him how to do this]. > Apologies if this is a FAQ, but I am really looking for a 1.2.3 type > tutoral on this paricualr issuea nd could not find > > thanks > - Jason > Try Gordon McMillans web site http://starship.python.net/crew/gmcm/ Cheeers Victor Sent via Deja.com http://www.deja.com/ Before you buy. From jari.aalto at poboxes.com Tue Feb 8 14:01:04 2000 From: jari.aalto at poboxes.com (Jari Aalto+mail.emacs) Date: 08 Feb 2000 21:01:04 +0200 Subject: mail filter in python? References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> <14495.11639.467461.357073@beluga.mojam.com> <200002072129.PAA47259@starbase.neosoft.com> Message-ID: * Mon 2000-02-07 Cameron Laird mail.misc | , | Skip Montanaro wrote: | > | > Cameron> In any case, I agree with Mr. Wouters: use procmail, and just | > Cameron> invoke your Python work as an external process. | > | >Worth noting that the procmail tips page at | > | > http://www.procmail.org/jari/pm-tips.html | > | >mentions Lua as a possible replacement for the procmail language (see the | >end of question 3.5). That item was presumably added about two years ago, | >so I tend to think it's either very hard to do or didn't generate enough | >steam in the procmail community. If such a thing was possible with Lua, it | >would likely be possible with Python as well. Anyone for "pluggable | >brains"? Correct. I don't know how procmail integrates to the current language, but I have feeling that it it pretty tight bound to the current implementation. There were a discussion in the Emacs list about replacing the obscure and 'distant-to-anynone' language Emacs-Lisp with some other pluggable language like Perl (An there is/was already a prototype about this), but the general reaction was that Emasc was too bound to lisp already. "Perlmacs -- Perl as Emacs extension language" http://www.perl.com/CPAN/authors/id/JTOBEY/ XEmacs team may get serious with pluggable language modules at some time, since the core is more modular than in Emacs. | I'm sending a copy of this to Jari Aalto, who might be | able to help. My purely personal speculation is, the | latter: "it ... didn't generate enough steam in the | procmail community." I'll grossly generalize that the | mailing-agent communities tend to regard C as the | natural language for all implementations, and see little | advantage to such distractions as higher-level scripting. | Lua is very simple to interface, unless some catastrophic | surprise turned up specifically with the procmail work. I checked the lua and seemed quite interesting, if there is a way to hook it into procmail I'd be interested too. Philip? [the current procmail maintainer] | Yes, of course Python is also quite simple to interface. jari From effbot at telia.com Wed Feb 23 11:30:50 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 16:30:50 GMT Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> Message-ID: <_WTs4.7648$al3.101350@newsc.telia.net> Mladen Bestvina wrote: > mladen at drava:/home/mladen/projects/grayson > python > Python 1.5.2 (#4, Feb 14 2000, 16:39:33) [GCC pgcc-2.91.57 19980901 > (egcs-1.1 re on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import _tkinter > >>> import Tkinter > >>> Tkinter._test() > File "", line 1 > Tkinter._test() > ^ > SyntaxError: invalid syntax umm. that's no Tkinter installation problems (but I'm sure Gerrit will pop up and say it is ;-) you've stumbled upon a basic Python feature: you cannot change the indentation level unless you're opening a new block. in other words, get rid of that extra leading space, and see if you get any further. PS. if your response isn't "duh", make sure you work through a few basic Python examples before diving into the wonderful world of Tkinter. From gerrit.holl at pobox.com Tue Feb 1 15:19:07 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 1 Feb 2000 21:19:07 +0100 Subject: "Python Annotated Archives" A good book? In-Reply-To: <8777m9$r2v$1@news.hal-pc.org>; from stevep@weck.brokersys.com on Tue, Feb 01, 2000 at 06:12:25PM +0000 References: <8777m9$r2v$1@news.hal-pc.org> Message-ID: <20000201211906.B2206@stopcontact.palga.uucp> Steven Pauly wrote on 949425145: > Greetings, > > As a newbie pythonista, I saw this book and was wondering what others > thought, as far as technical quality, target audience suitabilty, and > readability. > > I have "Learning Python" and have generally liked it. But it seems to lack > as many code examples as I would like. No bash intended, just my opinion. > > Python is great! So are the code examples in Demo/ in the distribution, and in Tools/. You can actually use the latter, but it also contains some excellent examples on how to write a Python shell, for example. regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From sascha at bespin.bespin.escape.de Sun Feb 20 11:28:11 2000 From: sascha at bespin.bespin.escape.de (Sascha Matzke) Date: 20 Feb 2000 16:28:11 GMT Subject: Python datastructure -> Corba IDL References: Message-ID: Hello, On 19 Feb 2000, Samuel A. Falvo II wrote: >In article , Sascha Matzke wrote: >>how can I represent the following datastructure in Corba IDL... >> >>([{},{},...],0) >> >>a tuple of a list of dictonaries and an integer... > > // NOTE: CORBA hasn't a clue as to what a "dictionary" or other > // associative arrays are, so your software will need to build these > // data structures manually. Ie., it'll require some amount of > // "custom marshaling" on your part. > > struct DictEntry > { > string key; > any data; // I'm not sure what you're storing here... > }; > > // From this point on, CORBA can handle everything else. > > typedef sequence Dictionary; > typedef sequence DictionaryList; > > struct MyStruct > { > DictionaryList list_of_dic; > long integer; > }; And how do I represent this thing in python... I can't simply return the datastructure above ([{},{},...],0).... Sascha -- .-> Sascha Matzke - sascha at bespin.de ------------------------. `-- On this earth for 24 years, 129 days <----------------' From yo_james at my-deja.com Tue Feb 22 18:22:35 2000 From: yo_james at my-deja.com (yo_james at my-deja.com) Date: Tue, 22 Feb 2000 23:22:35 GMT Subject: commands.getoutput help Message-ID: <88v5nm$nu5$1@nnrp1.deja.com> Hello, I was wondering if it was possible to pass a string into the commands.getoutput module? Here is an example of what I want to do: source = '/home/from/' destination = '/home/to/' # rsync copies files from the source to a # destination rsync = commands.getoutput('rsync %s %s') %(source,destination) Any help will be greatly appreciated. James Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Mon Feb 21 19:54:05 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 00:54:05 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote:> > Tcl/Tk is not OO (at least not in its base version). > > Tkinter *is* OO, and the fact the underlying Tcl/Tk isn't bothers > me a lot. get over it. first, Tk *is* object oriented. it provides widget classes, and widget instances have distinct identities, attributes, and methods. second, even if Tk hadn't been object-oriented, what makes you think that providing an object-oriented layer on top of a non-object-oriented library would be a bad thing? are you aware of the fact that major portions of the standard library are designed that way? do you really think that anyone would take you seriously if you claimed that Python's file objects, or the socket module shouldn't be used? (after all, the underlying C library isn't "object oriented"...) > > What about Solaris? HPUX? IRIX? AIX? OSF/1 or the > > latest True64? They do not come with fancy GUI > > stuff pre-installed, only X11. > > I know. fyi, OSF/1 (aka Digital Unix, aka Tru64) comes with libtcl and libtk preinstalled... and Xt. and Motif. and CDE libs. etc. From just at letterror.com Wed Feb 9 18:36:10 2000 From: just at letterror.com (Just van Rossum) Date: Thu, 10 Feb 2000 00:36:10 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: References: <1262139803-5814898@hypernet.com> <87ocad$to2$1@nnrp1.deja.com> Message-ID: At 5:22 PM -0500 09-02-2000, wolf at one.net wrote: >No tabs, no possible ambiguity! One more time: it's the *mix* of tabs and spaces, not tabs by themselves. Don't lie to people. Just From rhicks at rma.edu Tue Feb 22 17:50:00 2000 From: rhicks at rma.edu (Robert Hicks) Date: Tue, 22 Feb 2000 22:50:00 GMT Subject: Font in tkinter / idle References: <87putpfssr.fsf@parus.parus.no> Message-ID: you want to edit EditorWindow.py: if sys.platform[:3] == 'win': text['font'] = ("verdana", 10) # text['font'] = ("courier new", 10) change the font and size to what you would like to see... Bob "Jon K Hellan" wrote in message news:87putpfssr.fsf at parus.parus.no... > How do I change the default font for tkinter apps, > in particular idle? > > Jon K?re From cjw at connection.com Wed Feb 16 09:33:33 2000 From: cjw at connection.com (Colin J. Williams) Date: Wed, 16 Feb 2000 09:33:33 -0500 Subject: re Compile - a bug? Message-ID: <38AAB53D.15FF380@connection.com> It seems that an unbalanced parenthesis in a comment gives: hpat= compile(r''' File "G:\Program Files\Python\Lib\re.py", line 79, in compile code=pcre_compile(pattern, flags, groupindex) pcre.error: ('unmatched brackets', 128) with the text below: hpat= compile(r''' (<(?Pth) [^>]*>) # Either header up to terminating '>' # |(?Ptd)[^>]*>) <-- Grief! (.*?) # Followed by anything ",flags + VERBOSE # Matching terminator ''') ------------------------------- Correctly, the PythonWin editor does not report the mismatch. Colin W. From JGRAVES3 at austin.rr.com Tue Feb 22 17:02:23 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Tue, 22 Feb 2000 22:02:23 GMT Subject: Porting Python to non-pc platforms References: <731E80062E7A91F28525688D0074EC5C.0074F3D08525688D@ttm.com> <38B2FF71.1D7A677D@ttm.com> Message-ID: I would like this very much. My AS/400 doesn't have a C compiler or I would give it a shot. As soon as I get the time, I'm going to try JPython on my AS/400 tho. I'm glad at least on other person on here has heard of the AS/400. Jay Scott Anderson wrote in message <38B2FF71.1D7A677D at ttm.com>... >On a slightly different note, has anyone ported Python to the AS/400? > >Regards, >-scott > >gavrilov at iname.com wrote: >> >> Look on Deeply Embedded Python. http://www.abo.fi/~iporres/python/ > From gerrit.holl at pobox.com Fri Feb 4 02:33:18 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 4 Feb 2000 08:33:18 +0100 Subject: [Edu-sig] Getting it going In-Reply-To: <20000203214409.A1753@stopcontact.palga.uucp>; from gerrit.holl@pobox.com on Thu, Feb 03, 2000 at 09:44:09PM +0100 References: <20000203155039.71475.qmail@hotmail.com> <20000203214409.A1753@stopcontact.palga.uucp> Message-ID: <20000204083318.A365@stopcontact.palga.uucp> Gerrit Holl wrote on 949610649: > Ulf Engstr?m wrote on 949593039: > > Seems like some people have gathered up now, but still the posting is close > > to nothing. Sorry, wrong list! regards, Gerrit. From effbot at telia.com Fri Feb 18 07:57:07 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 12:57:07 GMT Subject: tkinter + stubs References: <9qnJpBA0STr4Ew0D@jessikat.demon.co.uk> Message-ID: Robin Becker wrote: > having just had to recompile _tkinter for the third time in the last > year I would like to make a plea to Guido to allow export of the dynamic > load code in the future python16.dll. > > My reasoning is this; if stubs are ever to be used with _tkinter the > steps to be carried out are > > determine suitable tcl/tk dynamic libraries. > find and call Tcl_CreateInterp () to get an initial interpreter > find and call Tcl_InitStubs(interp,version,0) > find and call Tk_InitStubs(interp,version,0) > > to do this easily would mean duplicating all the dynamic loading code. > However, if we could avoid always using the "init" prefix then we get > the dynamic load almost for free if the entry points are exported. can you explain what "stubs" are, for an ordinary python mortal (or point to an explanation)? last time I checked, it looked like a home-brewn dynamic linking scheme (do it all by hand, instead of using the run- time linker?)... From mfletch at tpresence.com Fri Feb 11 13:24:06 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Fri, 11 Feb 2000 13:24:06 -0500 Subject: Parnassus mirror? Message-ID: Hmm, they give you an ftp directory ;) . Who knows, we could dump a few hundred megabytes of Python modules on them and say it's all Parnassus'. Add a decent auto-make and configure system and you could have a CPyAN :) . Enjoy, Mike -----Original Message----- From: Thomas A. Bryan [mailto:tbryan at python.net] Sent: Friday, February 11, 2000 12:46 AM To: python-list at python.org Subject: Re: Parnassus mirror? ... I was recently thinking that a Parnassus mirror at www.sourceforge.com would make sense, but I haven't had time to pursue it. ... From peter.sommerfeld at gmx.de Wed Feb 16 13:31:34 2000 From: peter.sommerfeld at gmx.de (Peter Sommerfeld) Date: Wed, 16 Feb 2000 19:31:34 +0100 Subject: Real Problems with Python Message-ID: >[Bijan Parsia] >> Er..Just out of curiosity, what *can't* you model in Scheme? :) > >[Tim] >> Smalltalk . > >[Neel Krishnaswami] >> I know this is a joke, > >Shhh! Don't spoil the fun for Bijan . > >> but wasn't Scheme invented because Sussman wanted to understand >> how Smalltalk worked by implementing something like it in MacLisp? >> I thought that the Smalltalk and Scheme designers were in regular >> communication. Scheme was originally invented when Steel & Sussmann made an experimental Lisp implementation of Carl Hewitt's Actor model which has been has been influenced by Smalltalk. [G.L. Steele: The Evolution of Lisp]. Actors are objects which communicate by messages but without an explicit return path. The continuation is determined by the receiving actor only. -- Peter From jcw at equi4.com Sat Feb 5 11:28:07 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Sat, 05 Feb 2000 17:28:07 +0100 Subject: Freezing an app using win32com and wxPython References: <87ckq3$ot1$1@nnrp1.deja.com> Message-ID: <389C4F96.610BE6D2@equi4.com> Calishar wrote: [...] > When I have installed the application on my test (never had python > installed) system, and try to run it, I get the following. > > Initialsing 'pywintypes' > Initialising 'pythoncom' > Initialising 'win32ui' > Traceback (innermost last): > File "c:\progra~1\python\sifex\sifex.py", line 1, in ? > File "C:\PROGRA~1\PYTHON\win32com\client\__init__.py", line 8, in ? > File "C:\PROGRA~1\PYTHON\win32com\client\dynamic.py", line 22, in ? > ImportError: DLL load failed: A device attached to the system is not > functioning. > > I have copied python15.dll, python15.lib, pythoncom15.dll, and > pywintypes.dll to the c:\windows\system directory, and I have setup > registry entried pointing to pythoncom15 and pywintypes (under > Local_Machine\Software\\Python\PythonCore\Modules (actually I exported > the regeistry entries for these modules from my development system) By pure coincidence, I had what looks like the same problem 2 days ago. It turns out that I had to replace mfc42.dll in c:\windows\system\ by a newer one. Perhaps this works for you too... -- Jean-Claude From moshez at math.huji.ac.il Fri Feb 18 15:06:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 22:06:52 +0200 (IST) Subject: Which GUI? In-Reply-To: Message-ID: On 18 Feb 2000, Vadim Zeitlin wrote: > On Fri, 18 Feb 2000 07:25:05 +0200 (IST), Moshe Zadka wrote: > >hour. I couldn't get wxWindows (the basis for wxPython) to compile on that > >C++ compiler for 2 weeks. > > Hello, > > you may be surprized to hear this, but wxWindows is developped by a team of > volunteers And those volunteers get my full appreciation. The ones who *don't* get my appreciation, however, is those claiming that wxWindows is as portable as Tcl/Tk. It isn't. It's a fine product, but it isn't portable enough for my needs. And I should have said AIX/Visual Age C++, but AIX/g++ also gave me some problems with wxWindows. > If you have troubles compiling wxWin, one of wxWindows mailing lists is the > right place to report problems to - did you do it? In fact, yes. And the volunteers were very responsive, and helpful. But it still didn't solve my problems, which are, I admit peculiar. However, Tkinter's ability to compile on my peculiar platforms sure helped me. Please note that I'm not against wxWindows. I'm only against it being the standard GUI for Python. And again, my thanks to all the volunteers who helped me out with wxWindows. It is a great community, and I might have another chance to try it. But I'm afraid, at the moment, I'm left with the impression that staking Python's GUI on wxWindows is a dangerous bet. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From kirill at ilmax.net Fri Feb 25 03:30:38 2000 From: kirill at ilmax.net (Kirill Budkevich) Date: Fri, 25 Feb 2000 03:30:38 -0500 (EST) Subject: Programming for Web Message-ID: <20000225103406.E6960139.B35FEE22@194.226.124.151> Programming for Web. Belorussian company "Ilmax" Ltd offers you services on web programming. It is possible for us to redo an old site using new technologies. We have highly qualified web programmers (PERL,JavaScript). Our specialists speak Your language. The level of our prices will pleasantly surprise You. The prices are formed considering our expenses in OUR country. In case our offer is interesting to You, do not hesitate to contact us. We will be glad to cooperate with You. Kirill Budkevich Ilmax Ltd Avangardnaya str 61/3, Minsk, Belarus Tel: +375 017 2358821 Fax: +375 017 2352641 e-mail: kirill at ilmax.net -------------- next part -------------- Programming for Web. Belorussian company "Ilmax" Ltd offers you services on web programming. It is possible for us to redo an old site using new technologies. We have highly qualified web programmers (PERL,JavaScript). Our specialists speak Your language. The level of our prices will pleasantly surprise You. The prices are formed considering our expenses in OUR country. In case our offer is interesting to You, do not hesitate to contact us. We will be glad to cooperate with You. Kirill Budkevich Ilmax Ltd Avangardnaya str 61/3, Minsk, Belarus Tel: +375 017 2358821 Fax: +375 017 2352641 e-mail: kirill at ilmax.net From travis at travis.aggievilla.org Fri Feb 18 02:23:41 2000 From: travis at travis.aggievilla.org (Travis B. Hartwell) Date: 18 Feb 2000 00:23:41 -0700 Subject: Miscellaneous design and Python use questions References: <1261274784-11280577@hypernet.com> Message-ID: <87bt5fgeiq.fsf@travis.aggievilla.org> "Gordon McMillan" writes: [snip] > You'll probably be happier if you stop thinking in strict OO > terms, and realize that Python is all about interfaces, and > interfaces are implicit (no need to inherit from some particular > base class). To paraphrase Aahz: loosely couple, and > componentize the hell out of everything. > What exactly do you mean by interfaces here? I think I understand what your paraphrasing meant: Don't have your classes / modules / whatever tied too tightly together (i.e., a good example of information hiding) and make everything very indepedent. Is that right? > > 2) I am planning using Python embedded in one of my applications -- > > using C++ Builder for the GUI development and speed-critical > > portions. For the rest, I would prefer to use Python just because I > > have become accustomed to its power. But, I have been having a few > > road-blocks in this plan for embedded Python. I guess I'm having a > > hard time visualizing exactly where to have the 'dividing line' > > between C++ and Python and in designing the interfaces between the > > two. What are some general hints in designing applications using > > Python as the engine and C++ as the front-end? > > Write it all in Python first, then decide if you need any C++. I > say that as a long time C++/Java/C/.../IBM S370 assembler > programmer. Even if you don't use any Python, you'll still save > time, because you'll have a model that works. > > - Gordon From a00tch00 at nchc.gov.tw Tue Feb 29 18:33:22 2000 From: a00tch00 at nchc.gov.tw (T. C. Huang) Date: Wed, 01 Mar 2000 07:33:22 +0800 Subject: How to start up the default web browser on win32 Message-ID: <38BC5742.CE330192@nchc.gov.tw> Hi, I want to write a python script to start up the default web browser on Win32 platform. I'm not familiar with Win32, anyone can help me? T. C. Huang From mhammond at skippinet.com.au Sat Feb 5 18:35:58 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 05 Feb 2000 23:35:58 GMT Subject: Freezing an app using win32com and wxPython References: <87ckq3$ot1$1@nnrp1.deja.com> Message-ID: It simply sounds like the system you are using for testing does not have all the updated COM DLLs. If you go to the "installation problems" page from my starship page you should see instructions about how to update the COM support. Mark. "Calishar" wrote in message news:bhfo9sksmnk9ndf4m1aq510sk1amilkg2c at 4ax.com... > On Fri, 04 Feb 2000 23:16:56 GMT, "Mark Hammond" > wrote: > > > wrote in message > >news:87ckq3$ot1$1 at nnrp1.deja.com... > >You should be very close. If you can make the nominated modules > >available then life should be good. What specific problem do you > >have? > > > > Hi Mark, > When I have installed the application on my test (never had python > installed) system, and try to run it, I get the following. > > Initialsing 'pywintypes' > Initialising 'pythoncom' > Initialising 'win32ui' > Traceback (innermost last): > File "c:\progra~1\python\sifex\sifex.py", line 1, in ? > File "C:\PROGRA~1\PYTHON\win32com\client\__init__.py", line 8, in ? > File "C:\PROGRA~1\PYTHON\win32com\client\dynamic.py", line 22, in ? > ImportError: DLL load failed: A device attached to the system is not > functioning. > > I have copied python15.dll, python15.lib, pythoncom15.dll, and > pywintypes.dll to the c:\windows\system directory, and I have setup > registry entried pointing to pythoncom15 and pywintypes (under > Local_Machine\Software\\Python\PythonCore\Modules (actually I exported > the regeistry entries for these modules from my development system) > > In the programs installed directory, I have the pyds for win32api, > win32ui, and wxc (needed for wxPython). > > I have taken a look at line 22 (and the 22nd line ignoring blanks, and > the 22nd line of programming code, excluding comments, docstrings, and > blanks) and am not getting any reference to win32com.client.dynamic, > however line1 is the following line > import win32com.client, win32com # win32com imports for freeze > > I added an import of win32com to rty to fix the problem, but it didn't > work. > > Any help you can give would be much appreciated, my sales rep told the > client I would be finished for wednesday.... > > Nigel > From effbot at telia.com Fri Feb 11 02:27:12 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 07:27:12 GMT Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com><389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be><38A06C31.70753311@prescod.net><1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu><38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> Message-ID: Gareth McCaughan wrote: > (Smalltalk syntax looks funny, too, but it isn't so fundamental > to the language. Perhaps a more approachable version of Smalltalk > might be possible.) you mean Python? (yeah, I know that we haven't implemented everything just yet, but we're working on it ;-) seriously, what are the major shortcomings in Python from a Smalltalk professional's perspective? let's see: -- no blocks (lambda doesn't really cut it) -- type/class dichotomy (CPython implementation) -- no garbage collection (CPython implementation) what else? From moshez at math.huji.ac.il Tue Feb 22 01:57:07 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 08:57:07 +0200 (IST) Subject: Life's better without braces In-Reply-To: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: On Mon, 21 Feb 2000, Gerrit Holl wrote: > Hello all, > > I have a problem. In my Python enthuishasm, I ripped off the braces > from my keyboard because I thought I didn't need them. > Unfortunately, I have a problem now. I can't create dictionairies any > more! And because braces aren't the only keys on the brace key, > I can't create lists either. The solution for the latter is list(()), > but how do I create an empty dictionairy without braces? >>> import UserDict >>> a=UserDict.UserDict().data >>> a {} From andrew.henshaw at gtri.gatech.edu Mon Feb 28 15:58:52 2000 From: andrew.henshaw at gtri.gatech.edu (Andrew Henshaw) Date: Mon, 28 Feb 2000 15:58:52 -0500 Subject: HTML template for database report Message-ID: <38BAE18C.82AA6543@gtri.gatech.edu> Has anyone developed a system for generating a database report (I'm thinking of an MS Access-type report) using a template made from an HTML file. If not it would seem like a nice Python project for me. First of all, I'm aware of the use that Access has for an HTML template and that seems very restrictive and not well suited. What I'd like is something that combines the capabilities of the Access report designer with HTML formatting. What I have in mind would be a template that might look something like this (the tags that I'm making up would be embedded in HTML comments): HTML here some more HTML some more HTML some more HTML I could then pass this to some Python code that would extract the data, format it, and generate the output. This way, when I customize my reports, I can focus on a single file. This seems useful, so it must have already been done. If so, where? If not, any suggestions? Andrew Henshaw andrew.henshaw at gtri.gatech.edu From dcinege at psychosis.com Thu Feb 3 12:27:51 2000 From: dcinege at psychosis.com (Dave Cinege) Date: Thu, 03 Feb 2000 12:27:51 -0500 Subject: Examples for boss: Python for www game and chat Message-ID: <3899BA97.D7CD8E90@psychosis.com> I need refereces, of of any internet gaming systems that utilize python, in some way. Also of help would be an internet chat system that uses python, in some way. I'm building an internet based game, using flash4 for the frontend and (hopefully) python as the backend. (via CGI, and Daemons) Now I know, and you know, it doesn't make much of a difference if the backend is done in python, perl, C, or But the clients want to 'see' something that says it's capable. So yeah I'm asking for something nobody can really observe, but pass along what you can. TIA Dave From mikael at isy.liu.se Mon Feb 14 08:36:59 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 14:36:59 +0100 (MET) Subject: eff-bot In-Reply-To: <042401bf76ec$d58b5160$01ffffc0@worldnet.att.net> Message-ID: On 14-Feb-00 Emile van Sebille wrote: > It's a nick-name for Fredrik Lundh. It's origin is obscure, having > been passed down from generation to generation, and this probably > should be a FAQ (and may well be, I didn't check ;-). I'm sure the > eff-bot, if it's up and on-line can point immediately and without > eff-ort to the precise moment of inception, which is what makes the > eff-bot the eff-bot. Wow! And I thought Fredrik Lundh was a nick-name for the eff-bot. /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-Feb-00 Time: 14:35:24 This message was sent by XF-Mail. ----------------------------------------------------------------------- From effbot at telia.com Mon Feb 14 00:23:49 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 05:23:49 GMT Subject: Threads in Python References: <8881oc$5o9$1@news02.btx.dtag.de> Message-ID: Tobias Rademacher wrote: > I just decided to learn Python. Are Threads intregreated in the Language > like in Java? yes, and no -- they're there, but most of the support is provided through (an optional) extension module: http://www.python.org/doc/current/lib/module-threading.html From hnowak at cuci.nl Tue Feb 29 14:44:14 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Tue, 29 Feb 2000 20:44:14 +0100 Subject: A comp.lang.python code snippet archive? In-Reply-To: <000e01bf82a4$1d51c9d0$3acbd9c2@peridot.optichrome.com> References: Message-ID: <200002291944.UAA29289@dionysus.fw.cuci.nl> On 29 Feb 00, at 10:59, Adrian Eyre wrote: > >> #snippet "mysnippet.py" > >> #category "Networking" > >> #description "This does something interesting" > >> #begin > >> #!/usr/bin/env python > > > Nice thought, but I don't think it will work. Well, technically: yes. > > But I think many people are just like me in this respect: I will not > > always remember to do this. > > Surely we don't intend to archive *all* snippets in c.l.py. Only ones that > are meaningful out of the context of the posting, and are > useful/reuseable. The author of the snippet can decide whether this is the > case, and only use the above notation if they want it to be included in > the archive. It's a nice idea, but I don't think people will do this. I think hardly anyone who posts some Python code will think "Oh yeah, this might be added to the snippet repository, so I'll add some headers for easy recognition and classification." Maybe some kind of "Python code detector" could be helpful, if only for a first rough scan of all the messages. I have no idea how to do this though. (In Perl it's easy, you simply check if the number of $'s is above average... ) Maybe it should look for reserved words like def or import? But a snippet is not guaranteed to include those words, and a message which does use them is not guaranteed to have Python code. =/ Ideas, anyone? --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From newsgroup at mactod.com Sun Feb 27 02:13:25 2000 From: newsgroup at mactod.com (wes) Date: Sat, 26 Feb 2000 21:13:25 -1000 Subject: Troubleshooting installing Python 1.5.2 on BSDI 3.1 virtual server account Message-ID: <89amd3020ih@enews1.newsguy.com> "wes" wrote in message news:... > Greetings, > > Trying to get Python 1.5.2 to make and install on a BSDI 3.1-based virtual > server account at an IPP for the past two weeks and no luck! And Zope was > installed and running on my Win98 PC in less than 5 minutes! Yeow! > > > Currently getting the following error on BSDI 3.1: > > gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ > ./importdl.c > ./importdl.c:269: mach-o/dyld.h: No such file or directory > *** Error code 1 > > > Administrator assisted me in installing 'gmake', 'gcc', and 'install' > locally and using 'virtual sh' command but still no luck. End up with a > different error: > > gmake[1]: Entering directory `/usr/local/Python-1.5.2/Python' > gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ > ./importdl.c > /usr/libexec/cpp: Cannot fork > gmake[1]: *** [importdl.o] Error 1 > gmake[1]: Leaving directory `/usr/local/Python-1.5.2/Python' > gmake: *** [Python] Error 2 > $ > > > Tried following the HOWTO for BSDI 4.X but doesn't seem to work unless I'm > following it wrong: > http://yyy.zope.org/Members/BitDancer/bsdi4_x_install > How-To: Installing Zope under BSDI 4.x > Created by BitDancer. Last modified on 1999/11/08. > > Apparently between BSDI 3.x and BSDI 4.x the way shared libraries are done > was improved. Python as of 1.5.2 is not aware of this change. This means > that the compilation of the Zope dynamic modules fails. The fix is simple, > and has been reported to the Python newsgroup, so hopefully this HOWTO will > be obsolete in the near future. > > To compile Zope under BSDI 4.x, you have to get your Python installation > done right. After that Zope compiles without a hitch. Not being a Configure > guru, I'm not sure where the neccessary changes go to make the fix > correctly. So I'll just tell you how I did it: > > Run configure with the --with-threads option. > > Make sure you have edited Modules/Setup to uncomment the line specifying > that modules be built for dynamic loading. > > Try to make Python. It fails. > > Edit Modules/Makefile and change the following three lines to appear as > indicated here:: > > LDSHARED= gcc -shared > CCSHARED= -fpic > LINKFORSHARED= -Xlinker -export-dynamic > > > Make python. It should work, and the corrected version of the Makefile > should get copied to the [pythonlib]/config directory. > > At this point, Zope should build correctly. > > Note that there is a bug somewhere (probably in BSDI) that causes the Python > make test to hang in the signal test. This does not appear to impact Zope. > > > Tried python.org and zope.org and weblogs.userland.com/zopeNewbies/ but no > luck on BSDI information. > > Help! > Thanks! > > From ullrich at math.okstate.edu Wed Feb 16 11:43:19 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Wed, 16 Feb 2000 10:43:19 -0600 Subject: "Real" problem... References: <38A99C34.109D34BB@math.okstate.edu> <88ef0m$c03$1@nnrp1.deja.com> Message-ID: <38AAD3A7.326EA659@math.okstate.edu> Ng Pheng Siong wrote: > In article <38A99C34.109D34BB at math.okstate.edu>, > "David C. Ullrich" wrote: > > Well, this time I started at python.org, and sure enough > > I found what I was looking for, an arbitrary-precision > > floating point package. > > > Take a look at BigDecimal.py at > http://www.post1.com/home/ngps/fin > > > Cheers. Thanks - I'll take a look. Since I posted the question I've found the one I was looking for - after a few hours playing with it it looks like it's going to be tough to beat. > > -- > Ng Pheng Siong * http://www.post1.com/home/ngps > > Sent via Deja.com http://www.deja.com/ > Before you buy. From darrell at dorb.com Sun Feb 27 19:51:45 2000 From: darrell at dorb.com (Darrell) Date: Sun, 27 Feb 2000 16:51:45 -0800 Subject: Making sense of Stackless References: <146101bf8164$fc19df90$6401a8c0@dorb> <38B98A01.9DC6C456@tismer.com> Message-ID: <148f01bf8185$fd355eb0$6401a8c0@dorb> Christian wrote: > > What do you want to achieve with the update() ? > I haven't taken the time to learn how to use this yet. Your solution: > c=continuation.current() > if c != None: is exactly what I wanted. Thanks. > > This has the same effect as your construct() call. > current() is the same as caller(0), btw. > What happens here? > If you mean what happens in construct(). Nothing more than c=continuation.current() > Well, it would be a speed improvement if we could save that > if part. You could try a c.update(), but this doesn't work > since c is dead already. Maybe I should provide a method > update_release() that does the same thing, but also > frees the connection? Note that this would combine > update() and deleting co.link into one step. > It would be nice if I could do this. def classIterator(seq): offset= -1 return continuation.current(1) offset=offset+1 return seq[offset] The parm into current indicates I want the continuation to point just past this point. --Darrell From rdudfield at my-deja.com Thu Feb 3 11:13:52 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Thu, 03 Feb 2000 16:13:52 GMT Subject: Ann: PMZ - Poor Man's Zope References: Message-ID: <87c9fs$gdu$1@nnrp1.deja.com> In article , Andreas Jung wrote: > Dear all, > > I am happy to announce the availability of POOR MAN'S ZOPE 0.1. > > PMZ is very similar to Active Server Pages or PHP3/4 and allows you > to include Python code into your HTML pages. > Heh this is funny. I just found your old code a week or two ago, and changed it to parse for python code on multiple lines as well. I got rid of the cgi and restricted execution stuff as the imports were taking alot of the time at start up ( and I don't need them unlike alot of people I'm sure ). I also used as the tags instead of . Noticed in your docs you said it might be faster as an apache module... I don't think it would for most files, as the main slow down would be in starting up python, and since your going to be executing python anyway... Another extention to your script that I was thinking of making is the following: Have a string which the stuff html get put into instead of printing it. If there is a problem with your python code, then have another function serve up some other text. You could define a function that gets called if an exception is raised or some other error occurs. You would of course have to make your python code concat stuff on to the end of this string instead of printing it. Anyway just something I need in my case. Also I found a myerrorprint handy. Like your myprint, but it writes to stderr instead, which you can read in the apache error log file. One more thing. If you could add the idea of having templates, like in some other python code that would be great. The problem I have with the other template code is that it can not be read by wysiwyg html editors. So I think the following scheme would be good. Have a list. Lets call it _pmz_listOhtmlBits. Now we have some new invented tags called Short for python template. Then you can code in your html: This is the first part of my conditionally served html. bla blab bla bla! . This is the second part of my conditionally served html. dum de dum dum de dum! . When the code is parsed we have _pmz_listOhtmlBits with these two bits of html as elements. Which we can then place into the html doc with our python code. One more thing before I go. If you put a long piece of python code into a module instead of straight into the html, then you can get a speed up, and it looks nicer. import doStuff Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From BC at prism.co.nz Mon Feb 14 21:30:27 2000 From: BC at prism.co.nz (Bing Chen) Date: Tue, 15 Feb 2000 15:30:27 +1300 Subject: How to transmit arguments from c++ to python Message-ID: <88adoe$itp$1@news.ihug.co.nz> Hi, All Many thanks you guys tell me how to transmit arguments from my c++ application to python program? Many thanks for anyone who know why the PyRun_File crash c++ application, but PyRun_String works very well. Many thanks Bing Chen From n9mtb at mindspring.com Fri Feb 11 15:40:12 2000 From: n9mtb at mindspring.com (Rob Tillotson) Date: 11 Feb 2000 14:40:12 -0600 Subject: Python Palm Pilot Hotsync Conduit References: <879010fcpj.fsf@iname.com> Message-ID: <87r9ejbhhv.fsf@pyrite.org> bgdarnel at my-deja.com (Ben Darnell) writes: > But wouldn't it be possible to get Pyrite to use your code instead of > pilot-link on Windows, thus getting full integration with Palm's Hotsync > from a cross-platform conduit? I think this idea is worth pursuing > (although I'm not the person to do it, since I don't work with Windows > much). I'm not sure whether it would be worth the effort to do, but it shouldn't be too difficult. (This sort of inside-out arrangement is one of the reasons I did all that rewriting of Sulfur in 0.9.x... one of these days there will be a standard, external conduit manager on Unix too, and I want Pyrite to be able to work with it.) Basically, you would need to do two things: - create a new Store plugin which uses the Python->PalmDesktop glue code, instead of pilot-link. - replace parts of the Sulfur application context, specifically the parts that deal with finding and starting a Pyrite application. Among other things, the context would have to instantiate the new Store and put a reference to it in the application object's "remote" attribute. This would allow a whole series of Pyrite conduits to run within a Palm Desktop sync session. If you want to anything really fancy like using the Palm Desktop's native sync logic, though, things will get much more complicated... (Unfortunately, I can't do much about any of this at the moment, as I don't know much about Windows development and probably don't have the resources to do it anyway.) --Rob -- Rob Tillotson N9MTB http://pyrite.linuxbox.com/ From nascheme at enme.ucalgary.ca Thu Feb 10 01:14:02 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Thu, 10 Feb 2000 06:14:02 GMT Subject: Real Problems with Python References: Message-ID: neelk at cswcasa.com wrote: >Python isn't perfect, and I enjoy thoughtful criticism. But I am sick >to death of the -stupid- whitespace flamewar, since it's a) not a >problem, and b) not thoughtful. I agree. Thank you for injecting some intelligence into this newgroup. >1. Reference counting memory management I have a new patch in the works. Just to wet your appetite: * It is portable. It should run anywhere Python runs. * It does not require rewriting or recompiling existing extension modules. * It has very low overhead. The bad news is that: * It only finds cycles that involve lists, tuples, dictionaries, instances and classes and that have a least one dictionary in them. * __del__ methods sometimes may not be called for instances involved in cycles. * It requires some extra memory when doing the collection. I still need to clean up and test the patch some more but things are looking good. It currently is not thread safe but should be possible to make so. If anyone is interested in helping out or testing it, a prelimiary patch is at: http://www.ucalgary.ca/~nascheme/python/gc-cycle.diff Comments are definitely appreciated. Neil -- "Applying computer technology is simply finding the right wrench to pound in the correct screw." -- Tim Wright, Sequent Computer Systems. From J.C.Travers at durham.ac.uk Fri Feb 18 14:37:59 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Fri, 18 Feb 2000 19:37:59 +0000 Subject: Help needed writing GUI comparison References: <20000217221452.A2943@stopcontact.palga.uucp> <20000218180239.A5551@stopcontact.palga.uucp> Message-ID: <38AD9F97.9F186662@durham.ac.uk> You might add the link to the PyKDE tutorial : http://www.xs4all.nl/~bsarempt/python/tutorial.html Cheers, John Gerrit Holl wrote: > > Gerrit Holl wrote on 950822092: > > Hallo, > > > > I'm writing a GUI comparison, and I really need help. I don't > > want to take the time to learn all GUI's. What I have so far > > is attached (HTML), and also available at the following URL: > > > > http://www.nl.linux.org/~gerrit/gui.html > > > > Please help and contribute! > > Second version: > * less biased/more general > * added benchmarks > * added PyQT and PyKDE > * reformulated intro > * reformulated other things > > *really* attached this time, for those who are too far away from > a browser or too lazy to start one :) > > regards, > Gerrit. > > -- > cat: /home/gerrit/.signature: No such quote or joke > > ------------------------------------------------------------------------ > > gui.htmlName: gui.html > Type: Hypertext Markup Language (text/html) From rickhigh at aol.com Tue Feb 1 03:26:43 2000 From: rickhigh at aol.com (RICKHIGH) Date: 01 Feb 2000 08:26:43 GMT Subject: JPython mentioned in featured article at JDJ Message-ID: <20000201032643.27139.00000922@ng-ca1.aol.com> Here is the link to first article for my column in the Java Developer's Journal (JDJ). The article covers programming languages for the Java Virtual Machine. If you get a chance, read it and let me know what you think. The link... http://www.sys-con.com/java/archives/0502/hightower/index.html --Rick Hightower If you like the article, please feel free to forward the link. Also, please vote for you favorite langauge at the JDJ forum. From Quillsmind at home.net Sun Feb 27 15:55:55 2000 From: Quillsmind at home.net (Quill) Date: Sun, 27 Feb 2000 14:55:55 -0600 Subject: Best book to learn Python? Message-ID: I'd like to learn Python, and I want to purchase a good book. I'd like one that is suitable for a beginning programmer. If anyone has had any success learning from a book please let me know. Please post responses to the group. Thanks in advance From tim_one at email.msn.com Fri Feb 11 00:52:09 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 11 Feb 2000 00:52:09 -0500 Subject: will python 3000 break my code? In-Reply-To: <38a38e87$0$88916@news.voyager.net> Message-ID: <001201bf7454$2263bd60$d6a0143f@tim> [Ronald L. Dilsavor] > I am in the process of deciding whether to have a team of folks > invest in implementing our product in Python and this [presumed > incompatibility of Python 3000] was one of the "cons" on my list. As it should be! Don't overvalue it, though. For example, even if Python 3000 is an *entirely different language*, no C program stopped working the day C++ was released -- or a decade later, either. That is, you won't be alone no matter what, and the current implementation of Python is extraordinarily clean and maintainable: it still needs Guido's help to guide its evolution, but not at all to keep it running in top shape. Many people understand the current implementation, and can handle that fine. So if Python 3000 turns out to be wholly incompatible, I fully expect someone else (i.e., other than Guido) would jump in to continue work on the current Python line. So nothing is going to break your product -- the question will be whether you like Python 3000 enough to justify whatever it may take to move to it. > I would like to assume that automatic translators will be > developed - I personally would not count on that, but then I am a bit of a pessimist about such things. The world of free software is great at delivering what developers want to write; it's not so hot at delivering what would be most useful, unless that happens to coincide with the former. For example, I wouldn't work on such a translator for love, but may for pay. And if you were in my shoes, you'd be typing the same thing <0.5 wink>. > but at this point its just an assumption. If nobody knows what is > going to be in 3000 then how do they know it will be incompatible? Educated guesses, of course. For example, the type of every instance (of every class) today is InstanceType. Nobody likes that; it was a flaw in the original design, and there's no clean way to repair it without possibly breaking somebody's code. Or perhaps "do" will become a keyword, to enable a new loop construct that obviates the need for an often-complained-about clumsy Python idiom today. Anyone with a variable named "do" would then get hosed. Etc. There are a number of things that Guido may like to clean up, and this is his chance to do it. You can try to guess how "bad" things will break, but you really have no solid info to go on (my guess is "not so bad", but nobody knows at this stage). So a conservative worst-case plan is to assume that Python as we know it will be around forever (& there will at *least* be a new Python 1.6 and a new Python 1.7 to come in this line), while Python 3000 is some other new language entirely. it's-not-really-that-scary!-ly y'rs - tim From kc5tja at garnet.armored.net Tue Feb 15 23:56:22 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 16 Feb 2000 04:56:22 GMT Subject: [CORBA] omniNames feature request References: <4200573822B7D496.C1F8C19BCF648E3E.28F066B210DA0684@lp.airnews.net> Message-ID: >Well, the INS does not, strictly, permit you to synthesize your own IOR; it >does provide for means to pass the appropriate parameters (host, port) to your >ORB and let *it* do the synthesizing (there may be negotiations involved with >the ORB of the NS). You then get access to it through the ORB: > > ns = orb.resolve_initial_references( "NamingService" ) UUGH! That's anything but well factored. Once again, CORBA screws up. :( I would have done things differently (using C; sorry, I don't know Python's binding): CORBA_Object_ptr rmtObj; CORBA_CosNameService_ptr nameService; CORBA_Environment ev; rmtObj = CORBA_IIOP_make_IOR( "garnet.armored.net", 2809, "NameService", &ev ); assert( ev._major == CORBA_NO_EXCEPTION ); nameService = CORBA_CosNameService__narrow( rmtObj ); assert( CORBA__is_nil( nameService ) == FALSE ); ... etc ... I mean, how can they _not_ see this? This solution is vastly more powerful and is so painfully and patently obvious that I cannot fathom how noone can think of it. >What's-in-a-name'ly, Everything. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From moshez at math.huji.ac.il Fri Feb 18 09:32:24 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 16:32:24 +0200 (IST) Subject: Metaclass hierarchy? (was Re: Superclasses) In-Reply-To: <1261238252-13478968@hypernet.com> Message-ID: On Fri, 18 Feb 2000, Gordon McMillan wrote: > > .... If "T" is a > > class object, "dir(T)" does not show "__bases__" as a field. What is the > > lookup rule for getting fields from class objects? Is it similar to > > getting fields from instances (where the interpreter goes up the class > > hierarchy until it finds what you're looking for)? If so, what hierarchy > > is being examined? > > See \Doc\ref\types.html. Or, if you're fortunate enough to be using a Real OS, try string.replace(..., '\\', '/') -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From agc at redestb.es Thu Feb 17 11:36:18 2000 From: agc at redestb.es (agc) Date: Thu, 17 Feb 2000 17:36:18 +0100 Subject: enlaces Message-ID: <88h8gg$1vnl84@SGI3651ef0.iddeo.es> http://www.noguska.net/linux/rpm/rpm-HOWTO.html http://www.ceu.fi.udc.es/GPUL/links/ http://www.demasiado.com/index.phtml?id=1110&pid=inform?tica From rickhigh at aol.com Wed Feb 2 23:41:03 2000 From: rickhigh at aol.com (RICKHIGH) Date: 03 Feb 2000 04:41:03 GMT Subject: Do you like JPython? Message-ID: <20000202234103.24799.00000954@ng-ce1.aol.com> Can you explain to the Java community why JPython is the best thing since sliced bread? Then vote http://www1.sys-con.com/forums/Thread.cfm?CFApp=2&Thread_ID=379&mc=25 From akuchlin at mems-exchange.org Mon Feb 21 17:28:02 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 21 Feb 2000 17:28:02 -0500 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> Message-ID: <3dhff29onh.fsf@amarok.cnri.reston.va.us> "Thomas A. Bryan" writes: > Gerrit, this is the strangest thing I've ever seen. I sure hope that > it's just getting late, and you're being silly. You didn't really > rip keys off of your keyboard, did you? This is probably just a _jeu d'esprit_, done less out of seriousness than out of curiosity (to see if it's possible to get things done under that constraint). Similar games might include changing your login shell to /usr/bin/emacs [1], reimplementing the Unix command set in Perl (http://language.perl.com/ppt/), writing code in Intercal, or trying to write pure Python versions of as many built-in functions as possible. [2] [1] Greg Ward just observed that it's possible to boot Linux and pass it "init=/usr/bin/emacs", to run Emacs as the single process on the system. The return of the Lisp Machine! [2] I occasionally think about this problem. The setup: GvR was far too profligate in adding functions to bltinmodule.c that could have been written in pure Python instead. So, how many built-in functions can you re-implement in pure Python? (Efficiency, and indeed sanity, aren't important criteria.) Examples: def repr(thing): return `thing` # Can't use chr() and a loop to make this dictionary... chrdict = {0:'\000', 1:'\001', ... 255: '\377'} def chr(i): if not (0<= i < 256): raise ValueError, "chr() arg not in range(256)" return chrdict[i] def hasattr(obj, name): s = 'obj.' + name try: exec s return 1 except AttributeError: return 0 -- A.M. Kuchling http://starship.python.net/crew/amk/ The concept is staggering. Pointless, but staggering. -- The Doctor, in "The Pirate Planet" From tsarna at endicor.com Mon Feb 21 14:56:18 2000 From: tsarna at endicor.com (Ty Sarna) Date: 21 Feb 2000 19:56:18 GMT Subject: Barcode-module References: <38AAA1EC.FA68F9C@bibsyst.no> Message-ID: <951161531.458977@fezzik.endicor.com> In article , Fredrik Lundh wrote: > Thomas Weholt wrote: > > I`d like to generate barcodes. Can it be done from within python > > somwhow?? Which symbology? There are dozens, maybe hundreds of them. > of course. you need a specification, PIL or Piddle, > and a few spare hours. > > or start here: > http://www.cgpp.com/bookland/ > > (ISBN barcode generator in pure Python, plus links > to more code and info on this topic). I have a Python barcode framework and symbologies for Code 39 (regular and extended), Interleaved 2 of 5, MSI, Codabar, and USPS Postnet and FIM, with various degrees of testing (I've actually done mailings with the USPS codes). I think I may have started Code 128 and others. These were all on top of an unreleased PIDDLE/pdfgen/reportlab/PLATYPUS-like library I wrote. While I think it was superior in some respects, PIDDLE beat me to market and I consider mine dead at this point. However, I could be convinced to port my barcode stuff to reportlab/PLATYPUS, and to implement new symbologies. From sabren at manifestation.com Mon Feb 14 12:02:30 2000 From: sabren at manifestation.com (Michal Wallace) Date: Mon, 14 Feb 2000 12:02:30 -0500 Subject: how to talk to __main__? Message-ID: <889cg2$83e$1@nntp9.atl.mindspring.net> Hey all, I understand why __name__ evaluates to "__main__", but how come you can't say __main__.x = 1 to reassign some global variable x? I realize this is sort of bad practice to start out with... But, for example... with my callback I wanted to do: ########## allDone = 0 def callback(): allDone = 1 # allDone is local, so this won't work #__main__.allDone = 1 # gives an error # assign callback() to external event here... while not allDone: pass print "All done!" ########### -Michal http://www.sabnren.com/ From jjlucsy at concentric.net Wed Feb 16 12:35:46 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Wed, 16 Feb 2000 12:35:46 -0500 Subject: Subclassable C Extension References: <14506.53524.931405.880938@beluga.mojam.com> Message-ID: I misspoke, I tried the ExtensionClass module, not CXX. However, seeing as I was trying it late last night, the problems I was running into were stupid mistakes and it seems like everything is working. Gotta-stop-programming-when-tired-ly yours, Joel Lucsy "Skip Montanaro" wrote in message news:14506.53524.931405.880938 at beluga.mojam.com... > > Joel> How does one write a subclassable C extension? I've written C > Joel> extensions, but can't seem to figure out how to make it > Joel> subclassable. I've tried using the CXX files from > Joel> somewhereoranother, but that seems to GPF/coredump. I'll take > Joel> examples, URL's to examples, or whatever. Thanks. > > You can't subclass types defined in vanilla extension modules. Check out > Digital Creations' ExtensionClass module, available as part of Zope > (http://www.zope.org/). > > Skip Montanaro | http://www.mojam.com/ > skip at mojam.com | http://www.musi-cal.com/ > "Languages that change by catering to the tastes of non-users tend not to do > so well." - Doug Landauer > From niels at endea.demon.nl Fri Feb 25 09:29:01 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Fri, 25 Feb 2000 15:29:01 +0100 Subject: Life's better without builtins? (was: Life's better without braces) References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> Message-ID: <38B691AD.BDB4DD5F@endea.demon.nl> Gerrit Holl schreef: > > > > [2] I occasionally think about this problem. The setup: GvR was far > > too profligate in adding functions to bltinmodule.c that could have > > been written in pure Python instead. So, how many built-in functions > > can you re-implement in pure Python? > > These are possible: > > abs, callable, chr, delattr, divmod, > execfile, filter, getattr, hex, input, int, isinstance, issubclass, > len, list, long, map, max, min, oct, range, raw_input, reduce, reload, > repr, setattr, tuple, vars. Do you have some source code of this? I can't think of a way to do reload() or tuple(). > > These aren't: > > apply, buffer, coerce, compile, complex, dir, eval, exit, globals, hash, > id, intern, locals, round, slice, type, xrange I think you're a bit pessimistic there. For example: _interns = {} def intern(s): try: return _interns[s] except KeyError: _interns[s] = s return s class _slice_hack_class: def __getitem__(self, n): return n _slice_hack = _slice_hack_class() def slice(*args): if len(args) == 0: raise TypeError('slice requires at least 1 argument; 0 given') elif len(args) == 1: return _slice_hack[:args[0]:] elif len(args) == 2: return _slice_hack[args[0]:args[1]:] elif len(args) == 3: return _slice_hack[args[0]:args[1]:args[2]] else: raise TypeError('slice requires at most 3 arguments; ' + `len(args)` + ' given') def round(val, prec = 0): if val >= 0.0: return 10.0 ** (-prec) * float(long(val * 10.0 ** prec + 0.5)) else: return 10.0 ** (-prec) * float(long(val * 10.0 ** prec - 0.5)) -- Niels Diepeveen Endea automatisering From GRUBER at TELELINE.ES Fri Feb 25 05:48:36 2000 From: GRUBER at TELELINE.ES (PEDRO C. GUILLEM VALENTIN) Date: Fri, 25 Feb 2000 10:48:36 GMT Subject: DISTRIBUIDOR Message-ID: <86tt4.1777$pc4.8200@telenews.teleline.es> MSGSL ?BUSCAMOS DISTRIBUIDORES O INSTALADORES EN TODO EL MUNDO PARA NUESTRA GAMA DE PRODUCTOS RELACIONADOS CON LA SEGURIDAD! CAJAS FUERTES HOMOLOGADAS CAJAS FUERTES IGNIFUGAS Y ANTIMAGNETICAS CAJAS ANTIMAGNETICAS ARMARIOS DE SEGURIDAD DESTRUCTOR DE DOCUMENTOS TRANSMISORES TELEFONICOS TRANSMISORES DE SONIDO AMBIENTE RECEPTORES SERIE ALEX ANULADOR DE TRANSMISORES LOCALIZADORES DE TRANSMISORES SCANNER RADIO RECEPTORES TRANSMISION RECEPCION DE VIDEO CAMARAS TRANSMISION DE VIDEO POR LINEA TELEFONICA TRANSMISION RECEPCION DETECTORES RADAR DISPOSITIVOS TELEFONICOS DETECTORES DE ESCUCHAS TELEFONICAS Y ANULADORES GRABADORAS DE CASETTE ANTIESCUCHAS SECRAFONOS CAMARAS DE VIDEO EN BLANCO Y NEGRO GRABADORES DE VIDEO CAMARAS DE VIDEO EN COLOR SECUENCIADORES Y GENERADORES DE CUADRANTES MONITORES DE VIDEO RADIOLOCALIZACION AMPLIFICADORES DETECTORES DE METALES Y MINAS SISTEMAS INFRARROJOS-LASER MICROFONOS Y GRABACION POR CABLE MICROFONOS Y AURICULARES PARA TRANSMISORES RECEPTORES EQUIPOS PARA VEICULOS SISTEMAS DE VISION NOCTURNA PRISMATICOS DUPLICADOR MAIL STRIPPER-TINTA INVISIBLE-DETECTORES FALSIFICACIONES EQUIPOS MONTADOS EN MALETINES MASCARAS ANTIGAS-PROTECCION FUEGO LINTERNA-PUNTERO LASER EQUIPAMIENTO POLICIAL CHALECOS ANTIBALAS LECTOR TEMPERATURA PROTECCION HOGAR ACCESORIOS EQUIPOS ELECTRONICOS ANTENAS ESPECIALES PARA NUESTROS EQUIPOS El perfil de las empresas que buscamos corresponde a empresas no muy grandes y que ya vendan o instalen alguno de los art?culos aqu? expuestos. Los distribuidores recibir?n un c?digo para acceder a nuestra tienda ON LINE recibiendo el mismo trato comercial que los grandes distribuidores establecidos. Rogamos a los candidatos se dirijan a MSGSL por e-mail especific?ndonos que tipo de establecimiento regenta, si disponen de servicio t?cnico para algunos de nuestros productos, zona geogr?fica de influencia, antig?edad en la zona y naturalmente todos sus datos comerciales para poderle remitir su c?digo por e-mail en el caso de que sea seleccionado. Nuestra tienda ON LINE saldr? a la red el pr?ximo d?a 20 de marzo del 2000 con los primeros 100 art?culos testados en laboratorio y con las homologaciones pertinentes. Cada semana, se ir?n incorporando art?culos a dicha tienda a medida que superen nuestras exigencias, hasta alcanzar al final de este a?o los mas de 3000 art?culos que ya tenemos referenciados. Los distribuidores seleccionados se ir?n agregando a nuestra lista que aparecer? en nuestra pagina Web en el apartado de distribuidores oficiales. Nuestra direcci?n provisional en Internet es gruber at teleline.es y nuestra direccion de la tienda ON LINE es msgsl.com From framiere at netcom-service.com Fri Feb 18 15:35:56 2000 From: framiere at netcom-service.com (Florent Ramière) Date: Fri, 18 Feb 2000 21:35:56 +0100 Subject: What a weird thing !!? Message-ID: <88kash$15se$1@news5.isdnet.net> Hello, here is something i do not understand ... Let's say i want to write two strings which must display "HELLO" 2 solutions to this problem: print "HEL" + "LO" or print "HEL", print "LO", But this last solutions does not work !! Python inserts a white space !? I wanted "HELLO", python give me "HEL LO" !!!! I certainly have missed something, could you help me on this ? Thanks for reading this . Florent. -- ---- Florent Rami?re framiere at netcom-service.com Netcom http://www.netcom-service.com 15, rue de R?musat - 75016 Paris Tel : 06-60-61-85-32 --- Fax : 01-42-30-50-55 From jstok at bluedog.apana.org.au Wed Feb 23 09:58:00 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Thu, 24 Feb 2000 01:58:00 +1100 Subject: functional programming References: Message-ID: Michal Wallace (sabren) wrote in message ... >On Tue, 22 Feb 2000, Moshe Zadka wrote: > >> Functional programming has a very clear definition: no side >> effects. Iterating explicitly means "with side effects." That's what they'll have you believe! Actually "functional" styles of programming are a fuzzier set than that. There are the "pure functional" languages like Haskell that are based on lambda calculus, and prohibit all side effects. But there are also "impure" languages such as Lisp and Erlang which offer functional features, but mix it up with procedural styles of programming. Functional programming, at a bare minimum, means this: the ability to use functions as first class objects, to pass functions as arguments to other functions and to return functions as results of a function call. From tim_one at email.msn.com Sun Feb 27 19:40:19 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 19:40:19 -0500 Subject: map, filter, lambda, list comprehensions (was RE: parameter undefined in procedure) In-Reply-To: Message-ID: <000c01bf8184$6491b4c0$f0a2143f@tim> [Evan Simpson] > ... I actually think I "get" list comprehensions now. They describe > a list by giving the expression used to compute an element, generator(s) > which produce the arguments to the expression, and an optional filter > expression. Right? Right, after changing "filter expression" to "filter expression(s)". > So the difficulty you describe above is the problem of Pythonically > expressing things like 'for x, y in map(None, s1, s2)' versus the > cartesian 'for x in s1, for y in s2'. Despite my utter lack of language > implementation experience, I can never resist proposing a syntax, so here > goes: I'd play along, except this game was played for months in '98 already, and if DejaNews ever recovers its memory you can just read what Guido decreed . What Greg Ewing actually implemented is (IIRC) a compatible subset. Here are examples taken from the docs for Greg's patch: numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] fruit = ["Apple", "Banana", "Pear"] mult3 = [3 * x for x in numbers] evens = [x for x in numbers if x % 2 == 0] crossprod = [(x, y) for x in numbers for y in fruits] What's missing is lockstep (parallel) iteration. IIRC, Guido settled on some use of the semicolon for that. Once that's in, the door is open to a bit more syntax to get at the loop index too; e.g., perhaps for i in *; x in seq: acting like the old for i indexing x in seq: proposal that died for requiring a new keyword. > ... > How's this: > > [x * y for x, y in {range(3), range(3)}] == [0, 1, 4] for x, y in (range(3), range(3)): already has a different meaning in Python (one that raises a runtime exception), and using curly braces instead requires too much lookahead in the parser (not to mention people) to distiguish it from a dict. > [x * y for x, y in {range(3)}{range(3)}] == [0, 0, 0, 0, 1, 2, 0, 2, 4] Similarly. > ... > I would expect assignment to an iteration index to be a > compile-time error. I would not, as Python explicitly allows that today. > Well, *I* like it, anyway :-) The functionality or your syntax ? patched-out-ly y'rs - tim From sholden at bellatlantic.net Tue Feb 22 23:56:06 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 04:56:06 GMT Subject: Porting Python to non-pc platforms References: <731E80062E7A91F28525688D0074EC5C.0074F3D08525688D@ttm.com> <38B2FF71.1D7A677D@ttm.com> Message-ID: <38B36868.6CB9B73E@bellatlantic.net> Perhaps a Python-to-RPG translator might help? :-) regards Steve Jay Graves wrote: > > I would like this very much. My AS/400 doesn't have a C compiler or I would > give it a shot. As soon as I get the time, I'm going to try JPython on my > AS/400 tho. I'm glad at least on other person on here has heard of the > AS/400. > > Jay > > Scott Anderson wrote in message <38B2FF71.1D7A677D at ttm.com>... > >On a slightly different note, has anyone ported Python to the AS/400? > > > >Regards, > >-scott > > > >gavrilov at iname.com wrote: > >> > >> Look on Deeply Embedded Python. http://www.abo.fi/~iporres/python/ > > -- "If computing ever stops being fun, I'll stop doing it" From robin at alldunn.com Thu Feb 17 21:31:53 2000 From: robin at alldunn.com (Robin Dunn) Date: Thu, 17 Feb 2000 18:31:53 -0800 Subject: wxPython book??? References: Message-ID: "Robert Hicks" wrote in message news:h6_q4.2$UB1.412 at news... > A "Learning wxPython" or "Programming wxPython" book would be an outstanding > edition to the Python community. I think a book of this type "could" push > wxPython into the Python limelight. Plus as a Python neophyte...I need to > read! > > What do you think? > Actually, I've been asked by a publisher's rep to put an outline together, so there may be a book in the works soon... -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From evan at 4-am.com Sun Feb 27 12:15:30 2000 From: evan at 4-am.com (Evan Simpson) Date: Sun, 27 Feb 2000 11:15:30 -0600 Subject: map, filter, lambda, list comprehensions (was RE: parameter undefined in procedure) References: <000701bf8103$e87c2bc0$172d153f@tim> Message-ID: Tim Peters wrote in message news:000701bf8103$e87c2bc0$172d153f at tim... > The biggest attraction for Guido was in allowing to replace map and filter, > and many uses of lambda, with a much clearer ("more Pythonic") construct. > But multi-argument uses of "map" require iterating over sequences in > parallel (lockstep, not nested), and Python's "for" can't express that > (directly) today. Since "for" should act much the same whether in a loop or > a comprehension, it was decided that Python should first grow "parallel > iteration 'for'" syntax. That was scheduled for 1.6, but looks like it's > getting delayed in the crunch to get Unicode support out the door. Thanks for finding that posting; I actually think I "get" list comprehensions now. They describe a list by giving the expression used to compute an element, generator(s) which produce the arguments to the expression, and an optional filter expression. Right? So the difficulty you describe above is the problem of Pythonically expressing things like 'for x, y in map(None, s1, s2)' versus the cartesian 'for x in s1, for y in s2'. Despite my utter lack of language implementation experience, I can never resist proposing a syntax, so here goes: We want to be able to combine multiple sequences in any combination of nested and parallel iteration. Redefining 'x, y in s1, s2' is right out, and anything too similar to this would be confusing. Do we want to avoid computing the whole result before iteration begins? I would think so. We probably just want to tell the comprehension/loop how to manage its internal indexes. If we want to spell 'cartesian product' or 'parallel zip' outside of a list comprehension or for loop, we just *use* a list comprehesion, yes? So the syntax can be special to 'for', like the use of 'in' is. How's this: [x * y for x, y in {range(3), range(3)}] == [0, 1, 4] [x * y for x, y in {range(3)}{range(3)}] == [0, 0, 0, 0, 1, 2, 0, 2, 4] That is, {s1, s2, ...} is parallel iteration over the sequences listed, and {s1}{s2} (or {s1}*{s2}?) is nested iteration over the sequences from left to right. Nested iteration descriptors would flatten, so that {{s1, s2}, {s3}{s4, s5}} would produce five elements per iteration, not two. 'for x in {s1}' is the same as 'for x in s1'. Now suppose we abuse the similarity to dict notation, such that [(i, x) for x in {i: s1}] == [(i, x) for i, x in{range(s1), s1}]. This is just a way of naming the iteration index(es).We could then write... for x in {i: s1}: if x is None: s1[i] = 0 ...and... result = {} for x, y in {i: s1}{j: s2}: if x * 2 > y + 3: result[i, j] = x else: result[i, j] = y I would expect assignment to an iteration index to be a compile-time error. Well, *I* like it, anyway :-) Cheers, Evan @ 4-am & digicool From ulf.engstrom at b2b-link.com Thu Feb 24 10:20:37 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F6m?=) Date: Thu, 24 Feb 2000 16:20:37 +0100 Subject: Python accessing Excel 97 via com Message-ID: <001901bf7eda$b3faed80$d300a8c0@Alexis> You can access one cell or many cells with Range() Like in mySpread.Range('A1').Value = 'Spam' mySpread.Range('A1:A3').Value = ['spam','and','eggs'] going vertical/both ways takes some thinking sometimes: vertical mySpread.Range('A1:A2').Value = [['More'],['Spam']] and going both mySpread.Range('A1:B2').Value = [['row1col1','row1col2'],['row2col1','row2col2']] Hope this helps :) Regards Ulf -------------- next part -------------- An HTML attachment was scrubbed... URL: From moshez at math.huji.ac.il Wed Feb 16 16:44:31 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 16 Feb 2000 23:44:31 +0200 (IST) Subject: Subclassable C Extension In-Reply-To: Message-ID: On Wed, 16 Feb 2000, Joel Lucsy wrote: > How does one write a subclassable C extension? I've written C extensions, > but can't seem to figure out how to make it subclassable. I've tried using > the CXX files from somewhereoranother, but that seems to GPF/coredump. I'll > take examples, URL's to examples, or whatever. Thanks. Try ExtensionClass from Zope (www.zope.org) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From alex at somewhere.round.here Fri Feb 25 15:48:44 2000 From: alex at somewhere.round.here (Alex) Date: 25 Feb 2000 15:48:44 -0500 Subject: How do Java JIT compilers cope with JPython? Message-ID: Hi. Has anyone looked at how effective the new Java JIT compiler is for run-time optimization of JPython byte code? If you have a JPython function that is always called with a list as an argument, is the compiler smart enough to optimize for this? I'm guessing no, but I thought I would check whether anyone has looked. Alex. From effbot at telia.com Mon Feb 14 12:49:16 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 17:49:16 GMT Subject: how to talk to __main__? References: <889cg2$83e$1@nntp9.atl.mindspring.net> Message-ID: Justin Sheehy wrote: > "Michal Wallace" writes: > > > allDone = 0 > > > > def callback(): > > allDone = 1 # allDone is local, so this won't work > > #__main__.allDone = 1 # gives an error > > > > # assign callback() to external event here... > > > > while not allDone: > > pass > > > > print "All done!" > > As the eff-bot said, you could solve this by importing __main__, but > it's worth noticing that you don't have to resort to such namespace > trickery. > > Just put the statement 'global allDone' at the front of your function > definition, and that name will refer to the corresponding global variable. unless the callback function is defined in another module, of course. From iam at not.you Thu Feb 24 10:46:37 2000 From: iam at not.you (Ken Power) Date: Thu, 24 Feb 2000 15:46:37 GMT Subject: Phyththon misspelling contest References: Message-ID: <38b6518c.14504847@news1.mysolution.com> Thu, 24 Feb 2000 05:03:41 GMT, in comp.lang.python, wware at world.std.com (Will Ware) managed to squeak: >Get Chaucerian, win valuable prizes! Extra points if none of >your posts spells it the same way as any other. pithion -------------------------------- Ken Power uncle_wiggly at bigfoot dot com -------------------------------- From harold.taylor.delete-this at remove-this.uni-tuebingen.de Tue Feb 22 16:18:16 2000 From: harold.taylor.delete-this at remove-this.uni-tuebingen.de (H.V.Taylor) Date: Tue, 22 Feb 2000 22:18:16 +0100 Subject: New Python study group References: <88nn7r$m17$1@nnrp1.deja.com> Message-ID: chris patti wrote: >gtnorton at my-deja.com writes: > > >> Our address is: >> http://python-studies-subscribe at egroups.com >> or for more information, drop a line to: >> strat_addict at yahoo.com >> Hope to see you there. >> > >I'm presuming the http in: >> http://python-studies-subscribe at egroups.com > >Is a typo? > >-Chris Seems so. However, after looking through the (for me) surprisingly large list of Python-groups I believe that using this: http://www.egroups.com/group/python-studies/info.html will do the job ;-) Looks interesting, Harold From olipt at mayo.edu Mon Feb 14 18:23:28 2000 From: olipt at mayo.edu (Travis Oliphant) Date: Mon, 14 Feb 2000 17:23:28 -0600 Subject: Help with Python Grammar change Message-ID: I have a question for people familiar with the Python Grammar: How difficult would it be and what are the problems with altering the grammar (and compile.c code) so that one can enter slice-syntax as an argument to a function call: In other words if g is a function: def g(a,b): # some nifty code return I want >>> g(1:10:2,3) to call function g with slice(1,10,2) and 3 as arguments. Is this at all possible, or would it break things horribly? Thanks for any feedback, Travis Oliphant From claird at starbase.neosoft.com Fri Feb 18 20:56:18 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 18 Feb 2000 19:56:18 -0600 Subject: Which GUI? References: <20000217161727.A1183@stopcontact.palga.uucp> <14508.12208.365515.624845@weyr.cnri.reston.va.us> <20000217201253.A1930@stopcontact.palga.uucp> Message-ID: <3598FED9D9124222.EC5A7C080FB45444.95DC36610430366B@lp.airnews.net> In article <20000217201253.A1930 at stopcontact.palga.uucp>, Gerrit Holl wrote: >Fred L. Drake, Jr. wrote on 950786896: >> >> Gerrit Holl writes: >> > I think we really should create an extensive list with all available >> > GUI's, with all advantages and disadvantages and a table with info >> > like crossplatformness, learning curve... >> >> I think we can link to it from python.org when you have it ready; >> send a note to python-docs at python.org with the URL. >> Isn't the volunteerism in this community great? ;) > >It is; note that I said "we", not "you" or "I". I shall start it, but >people need to correct and complete me. . . . I've got a lot of new notes to put into it. It's likely to be next Wednesday before I make the time. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From aahz at netcom.com Sun Feb 13 13:33:21 2000 From: aahz at netcom.com (Aahz Maruch) Date: 13 Feb 2000 18:33:21 GMT Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] References: <000301bf75f6$34eb3e60$962d153f@tim> Message-ID: <886tdh$t4n$1@nntp6.atl.mindspring.net> In article <000301bf75f6$34eb3e60$962d153f at tim>, Tim Peters wrote: >[Aahz Maruch] >> >> Would make it a lot easier to do, say, >> >> def foo(bar): >> print bar >> >> foo(a;b;c) > >Since it's unclear why that's an interesting thing *to* do, I'm not sure why >it would be an advantage to make it easier to do it . Here's (what I hope is) a slightly clearer example: def foo ( bar, baz ) : print bar print baz foo ( a;b;c, d ) # doesn't work foo ( (a,b,c), d ) I find the former to be clearer; I'm uncomfortable with the idea that arguments to a function are necessarily tuples (which is what the current syntax implies). -- --- 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 Have you coined a word today? From aahz at netcom.com Sun Feb 13 13:23:14 2000 From: aahz at netcom.com (Aahz Maruch) Date: 13 Feb 2000 18:23:14 GMT Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> Message-ID: <886sqi$pp3$1@nntp6.atl.mindspring.net> In article , Fran?ois Pinard wrote: > >Just for fun, my own difficulty was to break the habit of the space before >the opening parenthesis which is part of a function call, since it has >been burned from GNU standards into my neurons, years ago. I don't have that difficulty because I disagree quite vehemently with Guido about it. ;-) (I'll submit patches in his preferred style, but I won't do that with my own code.) -- --- 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 Have you coined a word today? From 2jerry at writeme.com Tue Feb 22 18:58:44 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 00:58:44 +0100 Subject: catching X client kills in Tkinter References: Message-ID: <88v7ll$7ai$1@wanadoo.fr> Are you sure script exit ? try ps -edf I think jobs is here. I'm not sure killing displayer (X server) will explicitly kill the x.mainloop too ? don't have UNIX o.s. near me to try it . Jerry the foolish dracomorpheus, jerome VACHER - france - Paris - Timothy Docker a ?crit dans le message ... > >Is it possible to catch the failure of a Tkinter based application >when the server connection is closed (ie under X11 and unix). For >example in the script below, if I push the button, or click on the >window manager close button, "Done" is printed as expected.... > > >from Tkinter import * > >def done(): x.quit() >x = Button(text="Quit",command=done) >x.pack() > >try: > x.mainloop() >finally: > print "Done" > > >On the other hand, if the X server exits, or I do an xkill, then the >following message is printed > > X connection to :0.0 broken (explicit kill or server shutdown). > >I'd like to do some cleaning up before exiting - is there any way to >do this? > >Thanks for any tips! > > > >-------------------------------------------------------------- >Tim Docker timd at macquarie.com.au From khadji at pld.com Sun Feb 6 12:52:57 2000 From: khadji at pld.com (Patrick K Moorman) Date: Sun, 6 Feb 2000 11:52:57 -0600 Subject: chdir questions Message-ID: I know this is must be an easy one but how do I use os.chdir? I have tried many different ways of listing the path but no matter how I type it I get an error. Most common is either: >>> os.chdir(C:\temp) File "", line 1 os.chdir(C:\temp) ^ SyntaxError: invalid syntax >>> os.chdir(c\temp) File "", line 1 os.chdir(c\temp) ^ SyntaxError: invalid token I have looked through many tut's but it seems that this is too simple to be mentioned. Can anyone give the syntax for this including what the path should look like? On a related note, is there a book that has the stanard lib broke down like this? Thank you. From greg at cosc.canterbury.ac.nz Mon Feb 21 22:39:12 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 22 Feb 2000 16:39:12 +1300 Subject: Except an exception AND all its subclasses? References: Message-ID: <38B204E0.351EB4FF@cosc.canterbury.ac.nz> Moshe Zadka wrote: > > Perhaps there should be an "easy language reference"/"advanced tutorial". Ideally, there should be a tutorial which gets around to covering everything in the reference manual by the time you get to the end of it. (No, I'm not volunteering to write 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 fcahoon at my-deja.com Tue Feb 8 01:15:43 2000 From: fcahoon at my-deja.com (fcahoon at my-deja.com) Date: Tue, 08 Feb 2000 06:15:43 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262139803-5814898@hypernet.com> Message-ID: <87ocad$to2$1@nnrp1.deja.com> In article <1262139803-5814898 at hypernet.com>, gmcm at hypernet.com wrote: > fcahoon at my-deja.com writes: > [skip to example] > > > > if condition1: > > statement1 > > statement2 > > if condition2: > > statement3 > > statement4 > > > > To which loop does statement4 belong? > > Unambiguous. It belongs to "if condition2". Python interprets > tabs as 8. I think this should be in the Python FAQ. Or is it, and I missed it somehow? If so, please excuse my oversight. Suppose that I'm one of those set-tabs-to-logical-indentation sorts of guys, so I set my tab width to 4, then look at this code in my editor. Gee, it sure _looks_ like statement4 belongs to "if condition1"! And, if I convert tabs to spaces when I save, statement4 _will_ belong to "if condtion1". I've just unwittingly changed the logic of the code! You may, of course, argue that this is unlikely, but it is still plausible enough to make me _very_ nervous. f > [ ... rest snipped ... ] Sent via Deja.com http://www.deja.com/ Before you buy. From kuncej at mail.conservation.state.mo.us Tue Feb 15 10:45:26 2000 From: kuncej at mail.conservation.state.mo.us (Jeff Kunce) Date: Tue, 15 Feb 2000 09:45:26 -0600 Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> <38A810A0.DB9ED318@bibsyst.no> Message-ID: > > > I`d like to make a client/server application exchanging objects of > > > different type, sizes etc. Are there any simple tutorials or docs > > > available on this, and what are my options on how to implement this ?? > Yeah, that`s what I thought, but the serialize-bit isn`t the problem. > The server/client-part is. How do I set up a server listening to a port, > waiting for clients to connect and upload objects?? I'd really recommend looking at XML-RPC: http://www.pythonware.com/products/xmlrpc/ It's really simple and is something of a standard. If you don't want to use it as-is, it still provides a good basic example of client/server in python. --Jeff From akuchlin at mems-exchange.org Sat Feb 19 13:14:04 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 19 Feb 2000 13:14:04 -0500 Subject: Replacing "\"s using re.sub References: <38AEC633.C0FA6EC@erols.com> Message-ID: <3dk8k1t5zn.fsf@amarok.cnri.reston.va.us> "Edward C. Jones" writes: > I need to replace all instances of "\" in a string with "\\". The > function "re.sub" looks like the way to do it. "re.sub" is called > by "re.sub(pattern, repl, string)". For my problem what should > "pattern" and "repl" be? If you're only dealing with a substitution of one exact string with another exact string, it's faster and easier to use string.replace: S2 = string.replace(S, '\\', '\\\\') If you must use regular expressions for some reason (sigh), think about the problem a bit. "pattern" needs to match a single \ ; \ is used as a special character in regular expressions, so to match a single \ the pattern has to be \\ . You want the replacement to be \\, but \ is also special in replacement strings for things like \g<2>, so you need to double them both. The patterns need to be inside strings, and Python also uses \ as a special character; use a raw string, as in r"contents", to prevent Python from paying attention to \.. S = "String with \\ in it; here's another \\ " S2 = re.sub(r'\\', r'\\\\', S) print S print S2 This outputs: String with \ in it; here's another \ String with \\ in it; here's another \\ If you didn't use a raw string, you'd need yet another level of \ quoting, doubling all the backslashes again: S2 = re.sub('\\\\', '\\\\\\\\', S) -- 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 XoseLuis at retemail.es Wed Feb 9 15:41:28 2000 From: XoseLuis at retemail.es (Xose L. Gonzalez) Date: Wed, 09 Feb 2000 21:41:28 +0100 Subject: mail processing Message-ID: <38A1D0F8.27C72A7C@retemail.es> Hi I have a (maybe) special need, and I think in python could be done very easily: I receive n-plicated e-mail messages (same content but different destinations), so I would like to have a simple python demon that tests the POP3 and deletes the repeatead messages. Is it feasible with a simple program? Thanx in add-vans Xose Luis From sdm7g at Virginia.EDU Fri Feb 11 11:52:53 2000 From: sdm7g at Virginia.EDU (Steven D. Majewski) Date: Fri, 11 Feb 2000 11:52:53 -0500 (EST) Subject: [was: Corel + Borland = The End of MS Win] In-Reply-To: References: Message-ID: On Fri, 11 Feb 2000, Fredrik Lundh wrote: > according to Steven Majewski [...] Like Kibo, you need only mention my name an I appear with an off topic comment. Check out Byte.com/TechNet article: Jon Udell's: "A Perl Hacker in the Land of Python" ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- "There's a new programming language called C+++. It's 50% better than C++, but every time you compile, your modem hangs up." From skip at mojam.com Wed Feb 16 10:23:40 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 16 Feb 2000 09:23:40 -0600 (CST) Subject: Moving from perl to python: questions In-Reply-To: <38AAB0ED.D9603D2F@austin.ibm.com> References: <38AAB0ED.D9603D2F@austin.ibm.com> Message-ID: <14506.49404.856387.84490@beluga.mojam.com> David> 1) Best way to convert array argv[1:] into string to pass functions import string args = string.join(sys.argv[1:]) David> 2) How to implement a no-frills file slurp() function By "slurp" I presume you mean to read it all in one chunk. This presents the file line-by-line to the programmer through the line variable: f = open("foo") for line in f.readlines(): do_fun_stuff() This just stuffs the file's contents into a variable: f = open("foo") data = f.read() More elaborate structures are useful for very large files. The topic is discussed occasionally in the newsgroup. Check the archives at deja.com for details. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From wjk at wjk.mv.com Thu Feb 24 00:54:35 2000 From: wjk at wjk.mv.com (Wm. King) Date: Thu, 24 Feb 2000 00:54:35 -0500 Subject: Formatting a numerical string w/commas References: <88sabe$oed$1@news3.bu.edu> Message-ID: <38B4C799.3321BC45@wjk.mv.com> As a relative newbie - I thought about what you wanted to do to insert a comma in a string containing numbers ----------- and came up with the following - the regular expression and other stuff I am doing could probably be tightened up I guess cause I don't know all the in's and out's yet but I think its kinda interesting: import re pattern=re.compile("[0-9][0-9][0-9][0-9][\.\,$]") test=123567789.98 teststr=str(test) a = pattern.search(teststr) while a: b = a.regs[0] c = b[0] + 1 teststr = teststr[0:c] + "," + teststr[c:] a = pattern.search(teststr) Would like to know what anyone else thinks about one - thanks From thomas at xs4all.net Sat Feb 5 11:53:52 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sat, 5 Feb 2000 17:53:52 +0100 Subject: class objects in dictionaries In-Reply-To: <87hhq0$69k$1@nnrp1.deja.com>; from mdvorak@ninell.cz on Sat, Feb 05, 2000 at 04:06:26PM +0000 References: <87hhq0$69k$1@nnrp1.deja.com> Message-ID: <20000205175352.A19265@xs4all.nl> On Sat, Feb 05, 2000 at 04:06:26PM +0000, mdvorak at ninell.cz wrote: > I would like to put all my class definitions in a dictionary > __objects__ in main global namespace. I know I can do it by > putting the class objects into module called __objects__ and > import this module, but that way classes would have different > global namespace and I need them to have the same global > namespace as the main script. > I need to do something like: > from class_objects import * to __objects__ > Is there any way in Python how to do this? Well, yes. Create a module called __objects__ and do the imports there: from prison import * from rome import * Of course, this does not import all classes (Those starting with a _ are skipped) and it imports other things than classes as well. To have only classes, you can either name all the classes on the import line: from prison import you, lucky, bastard from rome import biggus, dickus Or you can create a real dictionary called __objects__, and fill that with class objects only, automatically. Something like this: from types import ClassType def fill(objdict, modules): for module in modules: for item in dir(module): if type(module.__dict__[item]) == ClassType: objdict[item] = module.__dict__[item] and call it at the appropriate place, like this: >>> import mailbox >>> objects = {} >>> fill(objects, [mailbox]) >>> objects {'_Mailbox': , '_Subfile': , 'BabylMailbox': , 'MmdfMailbox': , 'UnixMailbox': , 'MHMailbox': } But dont forget that changing some of the class objects on the fly (replacing them with new classes), after the call to fill(), wont get them changed in the self-made dict. (But the same goes for 'from import '!) Altering classes in-place is safe, though. Also, you might want to skip classnames starting with a _ (change the if in fill() to look like this: if name[0] <> '_' and type(module.__dict__[item]) == ClassType: Just to keep this list of objects consistent with what 'from foo import *' would give you. Idle-hands--rhut-rho-ly y'rs -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From herzog at online.de Fri Feb 25 13:22:56 2000 From: herzog at online.de (Bernhard Herzog) Date: 25 Feb 2000 19:22:56 +0100 Subject: idlerc.py References: <20000225073335.A3192031@vislab.epa.gov> <5Rwt4.22183$Jz3.111477@nnrp1.uunet.ca> <20000225110539.A3389718@vislab.epa.gov> Message-ID: Randall Hopper writes: > Warren Postma: > |> Now is there a way to put these color settings in an ".idlerc" of sorts so > |> they're kept from version to version without hacking any source? > | > |How about checking your working (and home directory for unix} for an > |"idlerc.py" on Unix and if so, run it. > > Sounds good, but IDLE doesn't support it. Don't forget the time machine! It's a little known and perhaps undocumented feature of Tkinter that it tries to execute a coule of files in the user's home directory on startup. See the readprofile method of the Tk class in Tkinter.py. In IDLE'S case, one of the files is ~/.idle.py. I don't use IDLE myself, but I just tried it with the version that comes with 1.5.2 and it works. On potential problem is that this happens very early on and important parts of IDLE might not be initialized yet. In Sketch at least this feature is practically worthless because of that. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From embed at geocities.com Fri Feb 25 09:31:02 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 25 Feb 2000 09:31:02 -0500 Subject: Phyththon misspelling contest References: Message-ID: <8owt4.22169$Jz3.111396@nnrp1.uunet.ca> "Will Ware" wrote in message news:FqF4q5.GEt at world.std.com... > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. [ Picture of a large Python ] title: "Ce n'est pas un Python." From peter.stoehr at sdm.de Fri Feb 11 11:21:26 2000 From: peter.stoehr at sdm.de (Peter Stoehr) Date: Fri, 11 Feb 2000 17:21:26 +0100 Subject: Two question from a newbie References: <38A431EE.5A7B2B1@aston.ac.uk> Message-ID: <38A43706.A611448F@sdm.de> Hi Peter, how about reading manuals? Peter Bittner schrieb: > > I've got two simple questions: > > 1.) How do I implement ORs and ANDs in an if-statment? > > - e.g. I'd like to have this C-code in Python: > > if (x.mode == "view" || x.mode == "modify") > myMode = x.mode; http://www.python.org/doc/current/lib/boolean.html > > 2.) What does str(...) do? (I've already posted this, sorry!) http://www.python.org/doc/current/lib/built-in-funcs.html#l2h-145 > > I've seen > print '....' + str(text) + '...' > in some code (in a function definition). > What does this 'str(...)' really do? - Is it absolutely necessary?? > > Please, e-mail! > > Peter > > | Peter H. Bittner > | International Student at Aston University > | e-mail: bittneph at aston.ac.uk > | web: http://beam.to/bimbo > +-------------------------- Greetings from Munich Peter From kcazabon at home.com Sun Feb 20 20:06:46 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Mon, 21 Feb 2000 01:06:46 GMT Subject: PIL Problem: New image is all black on Unix? References: <38B02B50.482854B7@cs.rit.edu> Message-ID: A type "1" image is a monotone black/white image. Instead of using 0xFF and 0x00 as colors, try using 0 and 1 (on and off). Kevin Cazabon. "Thomas & Jennifer Thompson" wrote in message news:38B02B50.482854B7 at cs.rit.edu... > I'm running Python v1.5.2 on Solaris 5.7 with PIL v1.0. When I create a > > new image of type "1' and size xy with either white or black pixels, > the image comes out black in both cases. So: > > >>> import Image > >>> raw=Image.new("1", (20,20), 0xFF) > > returns a black image which I expect to be white. > > >>> import Image > >>> raw=Image.new("1", (20,20), 0x00) > > returns a black image which I do expect. > > Further, if I try to set a pixel to white using > ImageDraw.setink(color) and ImageDraw.point(xy), > it still comes out black. > > These commands work fine on my Win95 system (Python > v1.5.1, PIL v1.0b1). Is this a known bug with PIL and Solaris > and will using the latest version of PIL for Solaris fix this? > Or did I miss something somewhere? > > Any help would be greatly appreciated! > > Tom Thompson > From curtin at my-deja.com Wed Feb 16 09:06:41 2000 From: curtin at my-deja.com (curtin at my-deja.com) Date: Wed, 16 Feb 2000 14:06:41 GMT Subject: pdb.set_trace() and fork() on unix Message-ID: <88eate$8rd$1@nnrp1.deja.com> hi, i have a set of scripts that create processes (fork()/exec()) to do some work. i had written the scripts originally on NT and debugged using mhammond's PythonWin. when the scripts did the CreateProcess() his debugger did not get "hosed" at all. i'm now porting these over to solaris and have to convert to fork()/exec()/waitpid(). i tried placing some pdb.set_trace()s after the fork() and my tty gets hosed (standard unix debugger fork() issue). i'm just wondering how other python/unix developers debug this kind of issue. this makes me think how nice the NT environment really was. thanks, craig Sent via Deja.com http://www.deja.com/ Before you buy. From george_planansky at harvard.edu Wed Feb 23 01:13:39 2000 From: george_planansky at harvard.edu (George Planansky) Date: 23 Feb 2000 01:13:39 -0500 Subject: run pythonwin scripts remotely from unix -- how? Message-ID: Pythonwin looks like a godsend for sysadmins. But how do I run a python script on an NT machine, remotely, from unix (solaris say)? That is, how do I achieve the equivalent of rsh, going from solaris to NT, using pythonwin ? George Planansky Earth & Planetary Sciences Harvard University From kcazabon at home.com Fri Feb 25 00:05:36 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Fri, 25 Feb 2000 05:05:36 GMT Subject: TK and PhotoImage: Problem getting image to display References: <38B4774E.9BE01006@exceptionalminds.com> Message-ID: Yes, I completely agree... however I prefer to still use self.frame = ... and so forth, because it makes configuring them afterwards much easier. It's simpler to call self.frame.config(option=whatever) than to try to track the instance of the widget itself. Kevin Cazabon. "Fredrik Lundh" wrote in message news:x4ct4.802$mYj.191054848 at newsa.telia.net... > Kevin Cazabon wrote: > > The first thing I'd do is the following: > > > class Quoter: > > > def __init__(self, master): > > > self.qFrame = Frame(master) > > > self.qFrame.pack(side=TOP) > > > > > > #qCompanyLogoCanvas = Canvas(qFrame, width=275, height=50) > > > #qCompanyLogoCanvas.pack(side=LEFT) > > > > > > self.img = PhotoImage(file='amos3.gif') > > > self.qAMOSLogoCanvas = Canvas(qFrame, width=300, height=300) > > > self.qAMOSLogoCanvas.create_image(0, 0, anchor=NW, > image=self.img) > > > self.qAMOSLogoCanvas.pack() > > > > > > > What this does is ensures the persistence of the objects, by making them a > > static part of "self". Otherwise, they might appear for a fraction of a > > second, but be 'cleaned up' by automatic garbage collection. > > slight elaboration: Tkinter maintains its own widget > tree, so you don't have to hang on to the widgets. > > the "self.img" stuff is crucial, though: > > http://www.python.org/doc/FAQ.html#4.69 > > > > From effbot at telia.com Wed Feb 9 16:12:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 21:12:40 GMT Subject: Python and Klingons References: <38A1AACB.8A5D0933@callware.com> Message-ID: Ivan Van Laningham wrote: > 15. Python? That is for children. A Klingon Warrior uses only machine > code, keyed in on the front panel switches in raw binary. I kinda liked #5 better: 5. Indentation?! - I will show you how to indent when I indent your skull! From billtut at microsoft.com Wed Feb 23 04:27:17 2000 From: billtut at microsoft.com (Bill Tutt) Date: Wed, 23 Feb 2000 01:27:17 -0800 Subject: Comparing perl and python Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCD6C@RED-MSG-50> > From: Mridul [mailto:mridulj at newgen.co.in] > Here's something to chew on as far as speed is concerned: > > Python2C > More recently, Bill Tutt and Greg Stein developed Python2C. This > translates Python to C code. Mostly, the C code ends up > manipulating > PyObjects in much the same way as if you had recreated > the Python code > in C using the high level Python / C API. That is, you'll > get a speed > up from the fact that there's no byte-code interpreter loop, but > that's less than most people expect. (There's been a lot > of talk about > global program analysis and type deduction. When these ideas bear > fruit, more dramatic speed ups will become possible.) > Its available from http://lima.mudlib.org/~rassilon/p2c. However I wouldn't recommend its use in production code as of yet. There are still some serious known outstanding bugs that need to get fixed. (Including the fact that I can't debug p2c itself in MSVC due to a debug symbol limit) If you'd like to help by working on the code that is always appreciated since my time on the project is limited due to this annoying thing called fulltime work. Bill From greg at perceval.be Tue Feb 29 12:20:46 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Tue, 29 Feb 2000 18:20:46 +0100 (CET) Subject: re.compile question In-Reply-To: Message-ID: Hello, Yes it's me again ;) How can I test that a re.compile has failed, Eg: If i simply forget a ( in my regular expression -- 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 wlfraed at ix.netcom.com Thu Feb 17 23:53:13 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Thu, 17 Feb 2000 20:53:13 -0800 Subject: Python misconceptions in IBM Ruby article... References: <38AB9B6E.599C1F3@callware.com> Message-ID: On Thu, 17 Feb 2000 09:32:09 +0200 (IST), Moshe Zadka declaimed the following in comp.lang.python: > > No, no, Ivan, We're a cult. We will voodo Ruby until there is nothing left > but ashes. > Why not just wish it "an interesting life" -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From xy0xy0 at earthlink.net Sun Feb 13 16:17:44 2000 From: xy0xy0 at earthlink.net (Francisco Hernandez) Date: Sun, 13 Feb 2000 21:17:44 GMT Subject: python for use in web development.. Message-ID: <38A6BCE3.EB4BE313@earthlink.net> is there any python frameworks for cgi programming using Apache? like Mason for Perl.. or Project Midguard or PHPLib for PHP3.. so i can do things like session variables.. user tracking.. cacheing.. embedded Python in HTML etc.. any help is appreciated.. thanks From aahz at netcom.com Thu Feb 17 09:51:24 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 14:51:24 GMT Subject: Python misconceptions in IBM Ruby article... References: <001d01bf7912$ef340800$dea0143f@tim> Message-ID: <88h1tc$i7p$1@nntp6.atl.mindspring.net> In article <001d01bf7912$ef340800$dea0143f at tim>, Tim Peters wrote: > >Yes: the mistaken points in the article are obvious to any Python >programmer, so there's no point to refuting them on c.l.py. Instead, after >comp.lang.ruby is formed, we'll descend on it like a horde of enranged >barbarians . Incidentally, there's an RFD for comp.lang.ruby going on in news.groups, for those of you with x-post filters. Current news.groupie sentiment (which I agree with) is that there is insufficient English traffic to warrant creation of c.l.r at this time; the way to handle this is to push Ruby discussion to comp.lang.misc until it hits more than ten articles per day. -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From cpatti at atg.com Mon Feb 28 10:47:29 2000 From: cpatti at atg.com (chris patti) Date: 28 Feb 2000 10:47:29 -0500 Subject: A comp.lang.python code snippet archive? (was: Re: Fun w/ lazy streams (was RE: functional programming)) References: <000001bf80bf$72946560$7da2143f@tim> Message-ID: "Tim Peters" writes: > Thought a fair # of people might enjoy playing with the attached. I've > likely posted all of it before over the years, but in scattered pieces and > spelled different ways. > > premature-spring-cleaning-ly y'rs - tim > [ Haskell stuff and code snipped ] Wouldn't it be awfully neat if there were, say a website with all the code snippets ever posted to comp.lang.python? What might we be talking, a few megs of source code at most? What a great resource that would be to beginners and hardcore geeks alike. The only thing is how would one programmatically identify a Python snippet? By keyword maybe? There's a mailing list gateway to this group, right? That would make it even easier to do programmatically (e.g. some simple procmail rules or something :) Just wondering. -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From michelorengo at netscape.com Wed Feb 2 15:30:40 2000 From: michelorengo at netscape.com (Michel Orengo) Date: Wed, 02 Feb 2000 15:30:40 -0500 Subject: MAPI and NT Service References: Message-ID: <389893F0.241D5332@netscape.com> I have spent a little bit more time on this issue... Actually, I am using cc-mail - which I believe is the source of my problems... I test again the script with the interactive session and at the statement: outbox = session.Outbox I had the following error: "MAPI was unable to load the information service CCDB8.DLL. Be sure the service is correctly installed and configured" I looked at the MSDN Library, and found that if I use cc-mail I had to create Personal Folders (why?) So be it, I created the personal folders. It didn't do it, tough. Since, I was pissed at cc-mail, I looked around the office to find a computer without cc-mail on it. I founded a Win95, where I installed Outlook (so that I can have a better MAPI) After installation of pythonwin, I ran the script in the interactive window WITHOUT any problem. Well, it looks like I need to find an NT without cc-mail and test it on it. That might take a little longer...but I keep you posted... Thanks for your help. Michel Mark Hammond wrote: > The fact that the logon worked really doesnt mean much Im afraid. If you > are really keen, you should see of you can use the win32com.mapi stuff to > get at the Outbox - Im guessing you will see the same problem - logon works, > but access to the folders fails... > > Mark. > > > -----Original Message----- > > From: Michel Orengo [mailto:michelorengo at netscape.com] > > Sent: Wednesday, 2 February 2000 5:37 AM > > To: Mark Hammond > > Subject: Re: MAPI and NT Service > > > > > > Mark Hammond wrote: > > > > > MAPI defers alot of security stuff until actually needed. What user > > > is the service logged on as? I would guess that it is NT/Exchange > > > security related rather than your script... > > > > > > > I don't think it is related to the security stuff, because I logged fine > > with MAPILogonEX. > > As I answer to Bill - who helped me previously: > > > > > > With: > > > > import mapi > > mapi.MAPIInitialize((mapi.MAPI_INIT_VERSION, mapi.MAPI_NT_SERVICE)) > > rawSession = mapi.MAPILogonEx(0, , , > > mapi.MAPI_EXPLICIT_PROFILE | mapi.MAPI_NEW_SESSION | mapi.MAPI_NO_MAIL | > > > > mapi.MAPI_NT_SERVICE) > > > > session = win32com.client.Dispatch("MAPI.Session") > > session.Logon(profileName=, profilePassword=, showDialog=0, > > newSession = 0, NoMail=1) > > > > The latest line fails (same as I had before) > > > > But then I realized that with that code I was logging twice: > > - first with mapi.MAPILogonEX > > - then with session.Logon > > > > I figured out that it might have a way to map a MAPI object with a CDO > > Object > > since CDO is built on top of MAPI. > > Looking at the the CDO doc, I found the MAPIOBJECT property that hold > > the MAPI > > handle. > > I gave it a try with: > > > > session.MAPIOBJECT = rawSession > > > > then: > > > > outbox = session.Outbox > > > > and it worked! > > > > However, since I was in a trial mode, I did that using the interactive > > session. > > > > I tried with my NT Service but it failed on: > > > > outbox = session.Outbox > > > > Unfortunately, I didn't have time to look into it very seriously. I plan > > to > > spend more time on this in the near future, but other projects deadlines > > force > > me to hold on this project. > > > > > > > > The project is still on hold, I hope to work on it very soon. > > In the meantime, if you have any suggestion... > > > > Thanks for your help > > Michel > > > > > > From mhammond at skippinet.com.au Fri Feb 4 18:32:06 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 04 Feb 2000 23:32:06 GMT Subject: File size limitations References: <87cql2$t8j$1@nnrp1.deja.com> Message-ID: If you use the win32api module you can get access to 64 bits of file size - albiet in an ugly way. win32api.FindFiles has the high and low 32 bits of the file size - you need to perform the magic to turn these 2 values into a single Python long yourself. If you use the win32file module, the function win32file.GetFileSize() should return the file size correctly for huge files - an int object in the < 2^32 case, and a long object for larger files. Mark. wrote in message news:87cql2$t8j$1 at nnrp1.deja.com... > I'd like to use Python for some large-scale file processing on Windows > NT. There is a possibility that the size of the files I'll be working > with will exceed 2^32 bytes. > > Can Python handle files that large? Random I/O is a specific concern, > since an implementation based on fseek/lseek system calls will fail > (these calls use 32-bit math, and bad things can happen with seeks that > go too far). > > Thanks! > > Greg > > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From phd at phd.russ.ru Fri Feb 25 04:28:28 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 25 Feb 2000 09:28:28 +0000 (GMT) Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: <38B47786.28DE4374@equi4.com> Message-ID: Hello. Thanks for listening! On Thu, 24 Feb 2000, Jean-Claude Wippler wrote: > MetaKit has been "closed source" until last December, and hence has not > benefited from the wide platform tweaking OSS usually gets over time. > Perhaps it would be best to reserve judgement until MetaKit has been > around as open source for a year or so? That was the point I tried to express - there are some advantages in Berkeley DB over MetaKit; one reason is that MetaKit is a bit young. > Oleg, I welcome your input on MK, positive and negative. Yes, in a way > MK is a "poor boy", because it is a new kid in the (OSS) neighbourhood. > But it's a lively newcomer, and you're welcome to help make it grow up. Sure. Currently I work mostly with PostgreSQL and MySQL, but when I'll have spare time, I'll continue one of my hobby projects, where I want to create database for URLs; parser will store URLs using abstract interface, and different backends will implement the interface. I hope to have BSDDB, MetaKit, SQL and ZODB-based backends. After playing with this I hope to have good experience to compare DBM and alike... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From timmuddletin at news.vex.net Tue Feb 8 13:04:25 2000 From: timmuddletin at news.vex.net (tim muddletin) Date: 8 Feb 2000 18:04:25 GMT Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> Message-ID: <87plr8$qig$1@news.tht.net> cpatti at atg.com (chris patti) wrote: >Umm, I'm not sure where you're getting the "tragic" from. O the dark and dismal tragedy of any Python resource falling by the wayside! >I merely noted in my post that I felt a _centralized_ FTP based >repository of all the freely available modules in existence for Python >would be a Good Thing, because it would make things easier for both And I merely noted the slight irony of how this may or may not relate to the missing resource which was at the root of this meandering thread: that the resource in question being so old, and never uploaded to the central repository, such as it was. I in no way mean any negative feeling or antagonistic attitude towards your idea. Of course, a central repository can not be in any way a Bad Thing. >/contrib on ftp.python.org != CPAN, you miss the point, I think. Nay, you attribute a point to me that was not mine. In no way do i equate CPAN with ftp.python.org --- except perhaps in the extremely limited sense commonality of them being central FTP sites. However, since the point is raised, I do still find it a curious fact that while ftp.python.org was available so few people availed themselves of it. Too be sure, it grew to be a rather unmanagable mess --- but still, messy as it may have grown, it was a 'central' ftp repository nonetheless. You may argue that if the site was "_maintained_" (as you say), there may have been more incentive for people to upload there. And doubtless this would be an excellent point, and quite plausible---but still I wonder about this apparent conspicuous lack uploads at ftp.python.org when it was running for many years. (Not to mention the presumable lack of volunteers flocking to clean it up and add services to it---though the sins of the past do not mean ammends for them would not be a good idea now). If one goes back to the original resource that was being looked for at the beginning of this thread, you will find that the web page for PythonMagick indeed was there---the problem was that the FTP link on that page to the actual file was dead... the directory no longer existed on that FTP site. It seems curious that this author who evidently was already linking his package to an external FTP site didn't choose to utilise ftp.python.org ... so even in this case, where it seems a most favourable case for uploading to ftp.python.org long ago (before it was quite so messy), the person chose not to. I have no idea why not; i won't speculate. I'm not advocating not uploading to ftp's, and I'm not saying a central FTP based archive (CPAN-like, or otherwise) would not be helpful or useful, and appealing to many! (After all, it's a fairly frequently recurring thread here---Deja search for CPAN in this newsgroup reports about 300 hits.) I wish you all good fortune imaginable in your pursuit of a central python FTP archive. I here merely muse over the curiously ironic case which this thread has spawned out of. Just ignore me. (-: ... From gavrilov at iname.com Tue Feb 22 16:05:26 2000 From: gavrilov at iname.com (Alexander Gavrilov) Date: Tue, 22 Feb 2000 21:05:26 GMT Subject: Porting Python to non-pc platforms References: <88uom6$e0j$1@nnrp1.deja.com> Message-ID: Look on Deeply Embedded Python. http://www.abo.fi/~iporres/python/ wrote in message news:88uom6$e0j$1 at nnrp1.deja.com... > Hi. > > I have a question regarding which source files > (Modules,Objects,Parser,Python) are necessary to > get a "bare-bones" python interpreter running on > a non-pc platform. By non-pc I mean game console. > In my case I would still like to be able to embed > python in a C/C++ app and use it to execute > scripts. > > Thanks. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From pj at sgi.com Tue Feb 8 11:02:31 2000 From: pj at sgi.com (Paul Jackson) Date: 8 Feb 2000 16:02:31 GMT Subject: const in Python References: <1262179804-3408142@hypernet.com> Message-ID: <87pemn$2bu2k@fido.engr.sgi.com> Fredrik Lundh replied: |> so you don't trust yourself enough to avoid overwrite |> anything using a certain name convention (UPPERCASE |> is pretty much standard in Python land), but are 100% |> convinced you won't ever overwrite the 'const' variable? You miss the previous author's point, I suspect. It's not that 'const' (as fabricated earlier in this thread) is significantly more or less resistant to willful violation than UPPERCASE, rather it's that the writer 3 messages ago is more accustomed to 'const' than UPPERCASE as a reminder of the basic dataflow fact that the value of this variable won't change again. Just another minor skirmish in the usual clash of culture and custom across language boundaries. Neither of these conventions are padlocks with any substantial inherent powers of prevention; but rather little yellow stickies, that serve as one more little reminder of a program's structure. Hence putting down the convention you don't prefer on account of its being made of paper, not steel, is a fine example of constructing a Paper Tiger. -- ======================================================================= 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 gerrit.holl at pobox.com Fri Feb 18 08:48:48 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 14:48:48 +0100 Subject: Teach Yourself Python in 24 Hours (Was: Re: Help needed writing GUI comparison) In-Reply-To: <38AC9E96.FDAE287C@prescod.net>; from paul@prescod.net on Thu, Feb 17, 2000 at 05:21:26PM -0800 References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> <38AC9E96.FDAE287C@prescod.net> Message-ID: <20000218144848.A3437@stopcontact.palga.uucp> Paul Prescod wrote on 950804486: > Ivan Van Laningham wrote: > > > > > > Addtionally, the last 8 chapters of _Teach Yourself Python in 24 Hours_ > > So the idea is you walk around reading the book for one day (no sleep, > no breaks) and by the end you're a Python expert. I could see that being > valuable for people who pad their resumes and then need to cram before > their first day of work. Who said 24 hours behind each other? 24 days every day an hour is also 24 hours. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From kvijayan at csclub.uwaterloo.ca Sun Feb 6 16:34:45 2000 From: kvijayan at csclub.uwaterloo.ca (Kannan Vijayan) Date: 6 Feb 2000 21:34:45 GMT Subject: import statement suggestion/question Message-ID: <87kpdl$ohe$1@watserv3.uwaterloo.ca> One thing that annoys me about importing modules is the usually-lengthy-prefix you have to add to each function/object you handle i.e: import LongModuleName LongModuleName.foo() etc.. right now this can be somewhat alleviated by doing this: import LongModuleName LMN = LongModuleName del LongModuleName LMN.foo() wouldn't it be easier to maybe modify the import statement itself to something like this: import LongModuleName as LMN or to avoid using up reserved words import LongModuleName(LMN) import LongModuleName:LMN you get the idea. it would allow people to get rid of the sometimes-annoyingly-long module names, and still keep the code clean and easy to understand. It would also help when you want to import modules, but keep them hidden using the prefix _ notation. -kannan kvijayan at csclub.uwaterloo.ca From python-mode at python.org Tue Feb 22 10:51:20 2000 From: python-mode at python.org (python-mode at python.org) Date: Tue, 22 Feb 2000 10:51:20 -0500 (EST) Subject: Python mode - `C-c |' feature suggestion References: Message-ID: <14514.45176.931019.526625@anthem.cnri.reston.va.us> >>>>> "I" == ISO writes: I> My suggestion is that `C-c |' be made clever enough to discover I> the left margin of the region under consideration, and that it I> removes that margin while transmitting the region to the Python I> interpreter. That would allow for using that command in a much I> wider variety of (smaller :-) contexts. I've also wanted this for a while, but never had the time to add it. I'd accept a patch that implemented this feature. -Barry From aotto at t-online.de Tue Feb 29 04:14:05 2000 From: aotto at t-online.de (Andreas Otto) Date: Tue, 29 Feb 2000 10:14:05 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <38B0E09D.EC26F41E@t-online.de> <38B58623.6FD5FF59@stud.upb.de> Message-ID: <38BB8DDD.1716A2F1@t-online.de> Have a look to: http://home.t-online.de/home/aotto/comp-code.html ,special the "Example" section, and you'll get some of the informations you look for mfg aotto :) -- ================================================================ Andreas Otto Phone: ++49-(0)8152-399540 IPN Ingenieurbuero fuer mailto:aotto at t-online.de Praezisionsnumerik Web: http://home.t-online.de/home/aotto Ulmenstrasse 3 Skills: Unix,Sql,Tcl,Shell,Sybase... D-34289 Zierenberg Area: Bank, FX, MM, shares, options ================================================================= From ivanlan at callware.com Thu Feb 24 21:30:19 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 24 Feb 2000 19:30:19 -0700 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <8945c6$a8j$1@nnrp1.deja.com> Message-ID: <38B5E93B.6CA86E92@callware.com> Hi All-- Fran?ois Pinard wrote: > > see_plus_plus at my-deja.com ?crit: > > > Wait & See. This new compiler is coming out from the same country where > > Mercedez, BMW & Porsche are produced. You know the quality of those cars, > > do you? > > Do they have bulls in this country? :-) > Sure. They call them "Stiere". -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 a.eyre at optichrome.com Mon Feb 7 06:29:19 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 7 Feb 2000 11:29:19 -0000 Subject: class objects in dictionaries In-Reply-To: <87hhq0$69k$1@nnrp1.deja.com> Message-ID: <001101bf715e$931e8a60$3acbd9c2@peridot.optichrome.com> > I need to do something like: > > from class_objects import * to __objects__ Try __import__. def loadClassObjects(): global __objects__ __objects__ = __import__("class_objects") def useClassObjects(): global __objects__ MyClass = __objects__["MyClass"] ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From fdrake at acm.org Mon Feb 14 14:15:36 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 14 Feb 2000 14:15:36 -0500 (EST) Subject: Modules implicitly exposing exceptions from other modules In-Reply-To: References: Message-ID: <14504.21592.958597.17477@weyr.cnri.reston.va.us> Jason Stokes writes: > I notice that the nntplib.NNTP class can throw exceptions from the > underlying socket module without documenting them. What's good practice > when your module involves exposing exceptions from an implementation module > that client code might not necessarily be aware of? Document them if they would not be expected by an experienced programmer. In general, all network access can throw socket.error, and that seems a reasonable expectation. If you think specific changes are appropriate to the documentation, please send a patch (with disclaimers; http://www.python.org/patches/) to python-docs at python.org. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From aotto at t-online.de Sun Feb 20 15:19:13 2000 From: aotto at t-online.de (Andreas Otto) Date: Sun, 20 Feb 2000 21:19:13 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) Message-ID: <38B04C41.CCE242FD@t-online.de> Technology Startup!! We are a group of developers which realises compilers for scripting language's. After implementation of Tcl as compiler-language we have plans for python. ??? Ask ??? =========== Does a requirement exist for a Python compiler and are your ready to pay for it ?? We are grateful for suggestions and business models in above area details under: Only German http://home.t-online.de/home/aotto/compiler.html mfg aotto :) -------------- next part -------------- A non-text attachment was scrubbed... Name: aotto.vcf Type: text/x-vcard Size: 451 bytes Desc: Card for Andreas Otto URL: From aem3 at doc.ic.ac.uk Tue Feb 15 11:14:35 2000 From: aem3 at doc.ic.ac.uk (Anthony Mayer) Date: Tue, 15 Feb 2000 16:14:35 +0000 Subject: Python-Fu for GIMP? References: <38A03990.998FF375@doc.ic.ac.uk> <00020808062400.01078@quadra.teleo.net> <38A3CF6C.AEB2A8F9@daa.com.au> Message-ID: <38A97B6B.D9A86FE3@doc.ic.ac.uk> [snip] Thanks! Very useful. From Sunil.Hadap at cui.unige.ch Tue Feb 8 12:48:10 2000 From: Sunil.Hadap at cui.unige.ch (Sunil Hadap) Date: Tue, 08 Feb 2000 18:48:10 +0100 Subject: Wrapper for Cosmo3D swig vs c++ Message-ID: <38A056DA.BA4D1512@cui.unige.ch> Hello, I am set for creating wrappers for SGI's Cosmo3D 3d graphics API. The API is c++ one. As I count, there are around 100 classes, just to get idea of the volume. I have 2 options a) To use Swig - I learnt from the swig manual that it can help in creating the Python classes as in Cosmo3D at the cost of performance. I did not get the point. What I see is there is just a def statement in the shadow class which links class member function to a swig generated wrapper function. I suppose def is a simple namespace alias which is not a major overhead. I hope I am not wrong. Is this something I should worry or just use swig with very minor performance overhead. b) Use c or better c++ (CXX) api. Am I getting into a big task considering 100 classes to wrap. Is it worth the performance I get. I have not even studied c/c++ API, hence could not visualize how it will improve the performance. After all swig will generate similar code except with different namespace entries, and then the shadow class. Thank you very much Sunil -- "Live as if you would die tomorrow, learn as if you would live forever." --Mahatma Gandhi From skip at mojam.com Mon Feb 21 14:42:06 2000 From: skip at mojam.com (Skip Montanaro) Date: Mon, 21 Feb 2000 13:42:06 -0600 (CST) Subject: Q: Catching any exception an printing it In-Reply-To: <38B18395.61EA@cs.bham.ac.uk> References: <38B18395.61EA@cs.bham.ac.uk> Message-ID: <14513.38158.899968.987735@beluga.mojam.com> Stuart> but is it possible to print out the exception if you don't know Stuart> what type it is? I'd like the above error message to be more Stuart> useful, but the exception raised inside the try block could be Stuart> anything. Is it possible to find the last exception raised? Check the docs for the sys.exc_info() function. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From wtanksle at hawking.armored.net Sat Feb 26 18:43:42 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 26 Feb 2000 23:43:42 GMT Subject: functional programming References: <000801bf8030$a8a2f2a0$3c2d153f@tim> Message-ID: On Sat, 26 Feb 2000 03:08:26 -0500, Tim Peters wrote: >[Neel Krishnaswami, writes some unusual stuff about the Joy language, > then recants] >> Augh! I just realized I screwed up the names. Joy, while an >> excellent and cool language (it's a functional Forth, more >> or less), is fully and totally 100% Turing-complete. >Joy is both much more and much less than a functional Forth. It's >both lovely & strange; Agreed. >e.g., I'm not sure I've bumped into a language before >where it's considered natural (as opposed to merely possible, and with great >strain) to write an *anonymous* recursive function. I think you've bumped into Forth before, which does allow that. It looks like this: :noname endcase IF do-endcase ELSE RECURSE THEN ; :NONAME defines a nameless word. I believe this was added in the ANSI standard, though, so that may have been after your time. But yes, Forthers don't traditionally peel off nameless recursions that commonly, while Joy's style seems to encourage it. >> The language that I was /actually/ talking about is Charity, >> which is a categorical programming language invented at the >> University of Calgary: >> http://www.cpsc.ucalgary.ca/projects/charity/home.html >New one on me -- thanks! I see it shares category theory's fondness for >wholesale invention of impenetrable terminology too . Alas, doesn't >look like an active project anymore. Excellent! I'll certainly have to study it. Hmm, Charity's death seems to contradict II Corinthians 13. Maybe it's not really dead. >die-young-and-leave-a-good-looking-corpse-ly y'rs - tim if-I-have-not-charity-I-am-nothing-ly y'rs -- -William "Billy" Tanksley, in hoc signo hack From robin at jessikat.demon.co.uk Mon Feb 7 08:55:08 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Mon, 7 Feb 2000 13:55:08 +0000 Subject: calldll & threads Message-ID: Is call dll totally thread safe/compatible? It seems from observation that call backs seem to use only one thread context; anybody know if that is true? -- Robin Becker From phd at phd.russ.ru Fri Feb 18 11:14:51 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 18 Feb 2000 16:14:51 +0000 (GMT) Subject: PyGreSQL and windows In-Reply-To: Message-ID: On Fri, 18 Feb 2000, Agent Drek wrote: > The Windows environment is still quite foreign to me ... is ODBC a > python module that will let me communicate to a the postgres server > from windows? ODBC is the M$ standard to access databases. To access a database you need universal ODBC manage and a driver for your particualr database. Postgres does have the driver... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From kens at sightreader.com Mon Feb 28 11:49:45 2000 From: kens at sightreader.com (Ken Seehof) Date: Mon, 28 Feb 2000 08:49:45 -0800 Subject: MFC References: <894hee$12g$1@isn.dac.neu.edu> Message-ID: <38BAA729.D2202B35@sightreader.com> PythonWin is MFC wrapped in Python Go to http://www.python.org/download/download_windows.html Download Win32all (This gives you PythonWin) Another approach is to forget MFC and get wxPython instead wxPython is based on wxWindows which is similar to MFC but better (in my opinion) and is multi-platform, so your app will run on Linux, etc. too. Unless you have legacy MFC code, I highly recommend wxPython. Your application look and feel will be the same as with MFC. And it's easier to learn and has a great demo/tutorial that will get you up to speed in about 45 seconds. wxPython can be found at http://alldunn.com/wxPython Eric Kappotis wrote: > Is there anyway I can use Microsoft Foundation Classes to create a GUI with > python, if so how do I do it and what would be a good book to learn MFC? > > Eric Kappotis From jerryjerry at aol.com Thu Feb 3 08:59:00 2000 From: jerryjerry at aol.com (JerryJerry) Date: 03 Feb 2000 13:59:00 GMT Subject: embeding python in C++ ?? Message-ID: <20000203085900.02304.00000899@ng-da1.aol.com> I would like to embed python within a C++ application. I want to call python scripts from C++ objects and call C++ object methods from python scripts. Does anyone have experience with this? I am new to Python, so I don't know how involved this is, or if it is even possible. Thanks in advance. Jerry From skip at mojam.com Fri Feb 4 12:55:11 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 4 Feb 2000 11:55:11 -0600 (CST) Subject: An FTP based Python Module repository (was Re: Imagemagick) In-Reply-To: References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: <14491.4735.38605.328866@beluga.mojam.com> chris> One of the reasons for CPAN's success in the Perl world is that, chris> simply, it's an FTP archive. chris> Thus, people can and do mirror it. This creates a multi-site, chris> persistent cache of the entire library, so when the one site where chris> module Frobnitz.pm comes from goes down, the world doesn't suffer. Why couldn't a CPAN-like thing be a web site? Web sites can (and are) mirrored all the time. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ 847-971-7098 "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From loewis at informatik.hu-berlin.de Mon Feb 21 10:52:40 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Feb 2000 16:52:40 +0100 Subject: Python datastructure -> Corba IDL References: Message-ID: sascha at bespin.bespin.escape.de (Sascha Matzke) writes: > > struct DictEntry > > { > > string key; > > any data; // I'm not sure what you're storing here... > > }; > > > > typedef sequence Dictionary; > > typedef sequence DictionaryList; > > > > struct MyStruct > > { > > DictionaryList list_of_dic; > > long integer; > > }; > > And how do I represent this thing in python... I can't simply return the > datastructure above ([{},{},...],0).... You'd have to follow the language mapping, which would be MyStruct([[],[],...],0) in this case, or MyStruct([[DictEntry("foo",aval)],[]],0) in the case of ([{"foo",aval},{}],0). If you really need arbitrary value types for the dictionary, you'd need to create it using the Any interface, i.e. aval = CORBA.Any(CORBA.TC_long,42) If you go for IDL structures, I'd really recommend to declare a more specific type for the dictionary values. If you are using ILU, you may consider activating the ILU extension, where ILU would accept Python dictionaries for the above Dictionary type: With this extension, ILU maps sequences of two-field structures to dictionaries, if the field names are key and . Regards, Martin From jeremiah at widomaker.com Mon Feb 7 18:32:03 2000 From: jeremiah at widomaker.com (jeremiah at widomaker.com) Date: Mon, 07 Feb 2000 23:32:03 GMT Subject: about the multiple posts Message-ID: <87nklj$ct9$1@nnrp1.deja.com> I'm very sorry that I posted multiple copies of the same comment. There appears to be a bug in my version of netscape that refuses to send an email(probably isolated to me). I clicked on the send button in netscape and it said that it had sent the mail and was waiting for a reply, after about 10 minutes it still hadn't recived a reply. I guess it must have continued sending the message or something similar. I then went to deja.com and posted the message. Neither deja or netscape showed that I had already posted the message. Then I stopped, and apparently today the messages all got posted. I'm really really sorry that I posted multiple copies. Can anyone suggest a good news program that can replace netscape for me? Sent via Deja.com http://www.deja.com/ Before you buy. From mike.zaharkin at westgroup.com Tue Feb 15 10:59:28 2000 From: mike.zaharkin at westgroup.com (MikeZ) Date: Tue, 15 Feb 2000 10:59:28 -0500 Subject: Multicolumn listbox for Tkinter available ? References: Message-ID: <38a977e2@wwwproxy3.westgroup.com> Thanks, but this doesn't quite do it, since it is nothing more then a bunch of list controls side by side. There is a tcl implementation here: http://www1.clearlight.com/~oakley/tcl/mclistbox/index.html and I wondered if there was a Tkinter equivalent. -Mike Z. Moshe Zadka wrote in message ... >On Mon, 14 Feb 2000, MikeZ wrote: > >> Does anyone where I can get a Multicolumn listbox implemented in Tkinter ? > >IDLE has one. (See the source distribution, Tools/idle/) >-- >Moshe Zadka . >INTERNET: Learn what you know. >Share what you don't. > > From timd at macquarie.com.au Tue Feb 8 23:46:07 2000 From: timd at macquarie.com.au (Timothy Docker) Date: 09 Feb 2000 15:46:07 +1100 Subject: Coverage Analysis References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB143@molach.origin.ea.com> <14496.35410.540653.714924@beluga.mojam.com> <87qk2f$38h$1@nntp9.atl.mindspring.net> Message-ID: "Andrew Dalke" writes: > Skip Montanaro wrote in message > > I have in my inbox a patch I've yet to look at from > > a fellow that improves the display of continuation > > lines. > > I also have a modified version of Skip's code. The > changes are listed below, but the most important is > better identification of which lines were not executed > (reads the LINENO fields from the code objects). Damn. I'm the fellow in question, and the patch I gave to Skip does exactly that. Oh well, It was a good idea, and worked well for me. I'll compare the differences. Tim From tismer at tismer.com Wed Feb 16 08:12:47 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 16 Feb 2000 14:12:47 +0100 Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> <88bleg$chl$1@nnrp1.deja.com> <38A96FB1.E7DEA50@tismer.com> <88dqmp$u8n$1@nnrp1.deja.com> Message-ID: <38AAA24F.A6CA9563@tismer.com> Andrew Cooke wrote: [about coroutines] > > What did you read, actually? > > Here some pointers: > > Homepage: http://www.tismer.com/research/stackless/ > > IPC8 paper: http://www.tismer.com/research/stackless/spcpaper.htm > > I read this. If you read it yourself, trying to remember that once you > did not know what coroutines were, I think you'll see that the text > doesn't contain anything like "A coroutine is...". Coroutines aren't > even mentioned in the contents. Oh I am sorry. You are right. Yes I didn't define coroutines and generators. These are well understood concepts, and the audience was supposed to have an idea about that. The real problem appeared to be continuations, and I tried to show that they are even much simpler, and explained them by building a generator from them. Sorry, I mixed words, and I admit that I'm much too deep in this stuff to see other than my problems :-) Time to write a very introductional text, I think. cheers - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 Thu Feb 17 02:32:09 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 17 Feb 2000 09:32:09 +0200 (IST) Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <38AB9B6E.599C1F3@callware.com> Message-ID: [Tim Peters wrote] > Instead, after > comp.lang.ruby is formed, we'll descend on it like a horde of enranged > barbarians . [Ivan Van Laningham] > What do you mean, "like"? I thought we _were_ barbarians, already fully > equipped with ranges. No, no, Ivan, We're a cult. We will voodo Ruby until there is nothing left but ashes. either-that-or-we'll-call-in-the-psu-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From thantos at chancel.org Thu Feb 3 08:24:48 2000 From: thantos at chancel.org (Alexander Williams) Date: Thu, 03 Feb 2000 13:24:48 GMT Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: On Thu, 3 Feb 2000 10:33:15 +0000, Robin Becker wrote: >Ritchie, McIlroy kernighan et al.) and these preceded C. None of these >languages required explicit register allocation. I really have to remember to subtitle for the sense-of-humour impaired. Missing subtitle today: Hyperbolie. Yes, I'm aware there were languages between Assembler and C. The subtly implied point is that just because something is currently widespread, doesn't mean it will always be, especially when easier, more efficient means come along. Gee, jokes really /aren't/ as funny when they require explaining ... -- Alexander Williams (thantos at gw.total-web.net) | In the End, "Join the secret struggle for the soul of the world." | Oblivion Nobilis, a new Kind of RPG | Always http://www.chancel.org | Wins From bogus@does.not.exist.com Thu Feb 3 14:24:42 2000 From: bogus@does.not.exist.com (Michael) Date: Thu, 03 Feb 2000 14:24:42 -0500 Subject: Where is Idle? Message-ID: <3899d6ad_1@news5.newsfeeds.com> I installed python-1.5.2-2.i386.rpm, which I downloaded from ftp://starship.python.net/pub/crew/andrich/ and Idle is not in that package. Is there some other package I need to install? Thanks for any any help. Michael -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==---------- http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- From skip at mojam.com Mon Feb 14 12:59:10 2000 From: skip at mojam.com (Skip Montanaro) Date: Mon, 14 Feb 2000 11:59:10 -0600 (CST) Subject: BSDDB copyright and licensing restrictions while in use via Python In-Reply-To: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: <14504.17006.398813.576385@beluga.mojam.com> Warren> Has the db1.8.5 source code a more liberal license than the 2.0 Warren> code from Sleepycat? Perhaps, but I wouldn't use 1.8.5 in code I expected to be robust. It has known bugs (was there ever a 1.8.6?), one of the main reasons for upgrading to 2.x. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From loewis at informatik.hu-berlin.de Thu Feb 17 07:46:49 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 17 Feb 2000 13:46:49 +0100 Subject: Recursive function defined within function => NameError References: <38ABCE51.3EF6728E@inka.de> Message-ID: Michael Str?der writes: > Can anybody clarify the issue here? I looked in the Language > Reference and found the hint You found the right place in the documentation. A function can only access its own local and the module's global symbols; as a result, looking for 'fak' gives a NameError. > Any better solution? For what problem? Computing the factorial in a local function? Sure: def func1(): def fak(n): from operator import mul if n<=1: return n return reduce(mul,range(1,n)) print fak(6) func1() For defining support functions? Make them global, and prefix them with an underscore: def _fak(n): if n>1: return n*_fak(n-1) else: return n def func1(): print _fak(6) func1() This will prevent anybody importing your module with 'from foo import *' to accidently overwrite a name; it also makes sufficiently clear that this function is not intended for general use. Regards, Martin From tapa1 at susx.ac.uk Tue Feb 1 12:22:56 2000 From: tapa1 at susx.ac.uk (Ben Popoola) Date: Tue, 01 Feb 2000 17:22:56 +0000 Subject: Using Fnorb with FLTKpy Message-ID: <38971670.557C21CB@sussex.ac.uk> Hi, According to the user guide Fnorb and Tkinter can be used at the same time by using the TkReactor module. Can you explain the workings of this module or how to use Fnorb with FLTKpy or other python gui's. Thanks Ben From gchiaramonte at ibl.bm Tue Feb 29 14:49:47 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Tue, 29 Feb 2000 15:49:47 -0400 Subject: buffer_info() for arrays but not structs? In-Reply-To: <033301bf82e5$fdc2ffc0$4500a8c0@thomasnotebook> Message-ID: Good point. duh :-( I have been using windll from Sam Rushing to get a pointer to a variable. var1 = windll.membuf(struct.pack('f', 0.0)) var1 = struct.unpack('f', var1.mb.read()) With the array module you can do this: temp_array = array.array('h', [1, 2, 3]) temp_array_ptr = order_array.buffer_info()[0] Is there a way to get the address of a variable or struct using the standard python libraries? I'm wondering if there is a python function to do this that I have not found. Gene > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Thomas Heller > Sent: Tuesday, February 29, 2000 2:51 PM > To: gchiaramonte at ibl.bm; python-list at python.org > Subject: Re: buffer_info() for arrays but not structs? > > > > Is there a reason an array has a buffer_info() method but a > struct doesn't? > > This would be a nice addition to the struct object. Does anyone know if > > there are plans to add this? > > Probably because a struct is not an object. At least in 1.5. > > Thomas Heller > > > -- > http://www.python.org/mailman/listinfo/python-list From gmcm at hypernet.com Fri Feb 18 08:47:01 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 08:47:01 -0500 Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: Message-ID: <1261240950-13316884@hypernet.com> Toby Dickenson wrote: > What are the implications for the continuation-naive in a > post-stackless world. What about functions such as... > > def x(): > before() > try: > y() > finally: > after() > > Today, either of three things happen: > 1. before() throws > 2. before() and after() are called exactly once each > 3. x() never returns because y() never returns > > As I understand continuations, we now have the possibility of y() > returning more than once, with after() called more times than before() No. In the absence of specific instructions otherwise, the frame dispatcher will behave as expected. - Gordon From tseaver at starbase.neosoft.com Fri Feb 18 19:53:30 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 18 Feb 2000 18:53:30 -0600 Subject: Miscellaneous design and Python use questions References: <87itzn19mz.fsf@travis.aggievilla.org> Message-ID: <88B3A627AC743709.CC5E2EA8F6B2AE9B.EFB0EE72561960D2@lp.airnews.net> In article , Neel Krishnaswami wrote: >Travis B. Hartwell wrote: >> >> 1) When I do a typical OO-design with C++, I pay a lot of attention >> to information hiding. I.E., I keep all of the data members private >> and rely on get/set functions to use them. I feel that this is a good >> practice. But, with Python, we don't have the access issue. I still >> believe that information hiding is a good idea. From the experienced >> Python developers, is it practice to use such functions within your >> classes? Or do you just access things directly? What are your >> thoughts on style regarding this? > >Write it 3 times, and the right choice will be obvious the third time >through. > >The first version, you'll write garbage but learn the contours of the >problem domain; the second time you'll get a workable but ugly >solution; and the third time through you will build something that >*other people* will be happy reading and extending. > >Remember, if your interface is good then people won't try to break >it. Consider: How often do C programmers break the FILE abstraction to >look at the implementation details? Not very often at all -- and C >programmers are notorious for breaking abstraction to do low-level >grovelling for even marginal speedups. Heh, the counterexample which jumps to mind is that "other P" language, which does just such "low-level grovelling" for raw I/O performance. Lets-whine-before-perls'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From agingeri at prairie.nodak.edu Thu Feb 17 08:46:32 2000 From: agingeri at prairie.nodak.edu (Scott Gingerich) Date: Thu, 17 Feb 2000 07:46:32 -0600 Subject: tkinter manual wanted References: <38AB1310.B97A982@freenet.edmonton.ab.ca> <38AB3472.37831502@sage.nelesautomation.com> Message-ID: <38ABFBB8.98DC8D19@prairie.nodak.edu> It also has a ton of source code downloadable from the Manning site. I've had it a week and already it has been very helpful. It has many diagrams, and he explains every section of code. It's $50 from Amazon, but $40 from Manning. Even though I've only had it a week and am a Pynewbie, I'm impressed. Besides, what can you get free that's worth having? ...sorry, couldn't resist. Rod Haper wrote: > > You might want to have a look at the book "Python and Tkinter > Programming" by John Grayson. My copy just arrived from fatbrain on > Monday. I haven't had a chance to do anything more than just thumb > through it yet but it looks promising. I don't have it with me here at > work but it's a chunky 688 pages and appears to have lots of nontrivial > examples. I don't recall the exact quote but among the recommendations > on the back cover is a good one from Guido. > > Joseph Paish wrote: > > > > i am looking for a downloadable tkinter manual/tutorial. i have found > > one or two on the web (on pythonware.com, i think) but would like > > something that can be read without going online. pdf format would be > > ideal, if such a thing exists. > > > > thanks > > > > joe > > -- > +----------------------------------------------------------------------+ > | Rod Haper, Senior System Analyst | Neles Automation | > | Phone: 713-346-0652 - main | SCADA Solution, Inc. | > | 713-939-0393 - fax | 7000 Hollister | > | Rod.Haper at sage.nelesautomation.com | Houston, Texas 77040, USA | > +----------------------------------------------------------------------+ From lf11 at nospam.linuxstart.com Sun Feb 20 22:49:54 2000 From: lf11 at nospam.linuxstart.com (lf11 at nospam.linuxstart.com) Date: Sun, 20 Feb 2000 22:49:54 -0500 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu><38A5E3F0.B3DCEC8E@callware.com> Message-ID: <88qc9j$oo0$1@news.kersur.net> In article <38A5E3F0.B3DCEC8E at callware.com>, Ivan Van Laningham wrote: > Hi All-- > > osorronophris osorronophris wrote: >> >> I'm a die-hard C++ programmer that recently took up Python for a change of >> scenery and am enjoying it greatly. The one problem I am having is that I >> can't break myself of the semicolon habit. I've tried chewing gum but it >> just doesn't seem to work, and I'd like to avoid the patch. Any ideas? >> I've been playing with Python just two days...and I already have no problem with no semicolons. (Of course, the only other programming language I have extensively used is Perl, and that for the past 8 months!) Unfortunately, I tried writing a little Perl script the evening....ooops, I forgot all the damn semicolons! It took me several months to fully acquire the habit. It took 45 minutes to break. Now, how do I get it _back_ in a timely manner?? -lf (The only reason I wrote the script in Perl is because "Programming Python" will t ake a few days to arrive from Amazon.com. Grrr. Where's my matter transporter?) From sconley at cs.csubak.edu Wed Feb 16 13:26:47 2000 From: sconley at cs.csubak.edu (Sean Conley) Date: Wed, 16 Feb 2000 10:26:47 -0800 (PST) Subject: socket troubles (repost) In-Reply-To: <38AAD8EC.1743D5CF@cec.wustl.edu> Message-ID: On Wed, 16 Feb 2000, David Fisher wrote: > Anyhoo, your code was fine for send and recv on a socket, the problem > was that telnet protocol is more that just sending and receiving. I > don't know what the protocol is, luckily I don't have to, the > telnetlib does. And by another lucky coincidence you can pass a > Telnet object instead of a socket to the Tk handers. Cool huh? Yeah, I knew this. The telnet protocol also involves doing some negotions of options like echo, terminal type, etc. I actually looked at the telnet lib, and forgot about it, thanks for reminding me. :o) > Before you go any further, why reinvent the wheel? Search the vaults > of parnassus (http://www.vex.net/parnassus/) for 'mud' and you might > find a few mud clients already written in Python. I looked, and the problem that I've seen isn't the lack of clients, but the lack of X based clients which is what I am looking to create. There are some very nice console based ones like TinyFugue, but I just haven't seen one with all the features I want fo X. > BTW, on a style note, I wouldn't import all those modules using from > import *. I'd be worried about a name collision. But, then I'm a > slow, cautious kind of guy. > Thanks for the tip, I kind of figured this was the wrong way to do things and had planned to change it. As I said in my original post, this is my first attempt at any type of Python code and therefore is ugly. I do appreciate you suggestions however. Sean From aahz at netcom.com Tue Feb 8 16:03:43 2000 From: aahz at netcom.com (Aahz Maruch) Date: 8 Feb 2000 21:03:43 GMT Subject: performance issues between scripting languages in asp pages References: <87pv0f$2h4$1@nnrp1.deja.com> Message-ID: <87q0bf$oib$1@nntp8.atl.mindspring.net> In article <87pv0f$2h4$1 at nnrp1.deja.com>, wrote: > >i've done some rudimentary testing using wcat to view performance >differences between scripting languages for a set of pages(jscript, >vbscript,perlscript,python). Initial results indicate that using >vbscript as the server side scripting language consistently results in >more pages being served by the webserver...has anyone else had a >similar experience? Nope. But your results don't surprise me, particularly if you're using IIS as your web server. Try doing a similar set of tests using Medusa or Zope/Zserver. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Nostalgia just ain't what it used to be. From robin at jessikat.demon.co.uk Wed Feb 23 10:22:04 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Wed, 23 Feb 2000 15:22:04 +0000 Subject: functional programming References: Message-ID: <8L2e1BAcs$s4EwOP@jessikat.demon.co.uk> In article , Remco Gerlich writes >Michal Wallace (sabren) wrote in comp.lang.python: >> I guess my original question had to do with what functional >> programming looks like in the wild, and what it might look like in >> python. Aahz posted a recursive version of a fib() routine. Is this >> not what you'd want? What would fib() look like in one of the >> functional languages you're used to? > >Michael Hudson posted this little bit of Haskell last week: > >fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ] > >I can't translate that to anything resembling Python at all. I don't >know if list comprehensions in Python will be/are this powerful. >(This is just a definition of the infinite list of Fibonacci numbers - >when you need the first 50 or so, just take the first 50 from this list). > > #Joe Bowbeer posted this recently SICP def head(s): # return first element in stream return s and s[0] def tail(s): # return remainder of stream return s and s[1] and s[1]() def addStreams(si, sj): # add corres. elements of two streams if not si: return sj if not sj: return si tailsum = lambda ti=si, tj=sj : addStreams(tail(ti), tail(tj)) return (head(si) + head(sj), tailsum) def nthStream(s, n): # return nth element of stream s while n > 0: s, n = tail(s), n-1 return head(s) def printStream(s, n): # print first n elements of stream s while n > 0: print head(s), s, n = tail(s), n-1 print def mapStream(f,s): return (apply(f,[head(s)]), lambda f=f, s=s: mapStream(f,tail(s))) # then # infinite stream of Fibonacci numbers fibs = (0, lambda : (1, lambda : addStreams(tail(fibs), fibs))) printStream(fibs, 10) -- Robin Becker From tuttledon at hotmail.com Thu Feb 24 23:45:33 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Fri, 25 Feb 2000 04:45:33 GMT Subject: Pythonwin (Version 2 beta 3) References: <02eb01bf7f33$cc5d27e0$01646464@computer> Message-ID: Neil Hodgson wrote in message news:02eb01bf7f33$cc5d27e0$01646464 at computer... > Do all source files do this? Yes. But you can print the last page if you explicitly ask for it (ie print pages 13 to 13) > Does Print Preview show all pages? Yes. Don From seanb at home.com Tue Feb 29 17:09:07 2000 From: seanb at home.com (seanb at home.com) Date: Tue, 29 Feb 2000 17:09:07 -0500 (EST) Subject: How to start up the default web browser on win32 In-Reply-To: <38BC5742.CE330192@nchc.gov.tw> Message-ID: <200002292209.RAA09619@seanb.sttln1.wa.home.com> On 1 Mar, T. C. Huang wrote: > Hi, > > I want to write a python script to start up the default web browser > on Win32 platform. I'm not > familiar with Win32, anyone can help me? > > T. C. Huang > The easiest way I know of is to use the windows "start" command (which launches a program or opens a document in the associated program) to open a url. For example: >>import os >>my_url = 'http://www.python.org/' >>os.system('start %s' % my_url) -- Sean Blakey (206)297-7123 quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0]) From aa8vb at yahoo.com Wed Feb 2 10:24:00 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 2 Feb 2000 10:24:00 -0500 Subject: Python & EPIPE: Handling Chg Proposal In-Reply-To: <877gfm$165i$1@nntp6.u.washington.edu> References: <20000201143138.A1126310@vislab.epa.gov> <877gfm$165i$1@nntp6.u.washington.edu> Message-ID: <20000202102400.A1212577@vislab.epa.gov> Donn Cave: |Quoth Randall Hopper : || The gist of the problem is that any program which writes to stdout or || stderr really needs to handle EPIPE to avoid tripping python error || tracebacks, and doing so is non-trivial and obfuscates otherwise-simple || Python code. || || Basically, this is buggy Python code: || python -c "for i in xrange(100000): print 'Lots of output'" | head | || PROPOSAL: || || Add an "epipe_error" attribute to the file object. It would determine || whether EPIPE errors from read()/write() calls generate SystemExit || or IOError exceptions. || || By default EPIPEs received from the stdin/out/err files would generate || SystemExit exceptions (epipe_error = 0). All other files would default to || IOError exceptions (epipe_error = 1). | |Is the problem really the exception, or the traceback? It looks to me |like it's the traceback, and nothing else about the exception is any |problem for you. It's termination with an error message. Exception and traceback neither are problems; both SystemExit and IOError generate exceptions and invoke stack tracebacks after all. |What if the top level handler that prints out these tracebacks just |handled this one silently, as it does with SystemExit? That would |allow programs to catch pipe errors if they want, a job that could |be much more awkward if some pipe errors raise SystemExit instead. That's one of the options I considered (see the "Possible Solutions" comments at the bottom of my broken_pipe.py script). However, if you get EPIPE from a program-created socket and don't handle it, chances are you want to know about it. It's only the standard pipes set up by the system that you don't want to see errors for. The method I proposed seemed to be flexible, providing reasonable defaults, but allowing the user to reconfigure the default behavior on a per-file basis. -- Randall Hopper aa8vb at yahoo.com From thucdat1143 at my-deja.com Tue Feb 8 16:25:07 2000 From: thucdat1143 at my-deja.com (thucdat1143 at my-deja.com) Date: Tue, 08 Feb 2000 21:25:07 GMT Subject: Corel + Borland = The End of MS Win Message-ID: <87q1jh$437$1@nnrp1.deja.com> It doesn't matter anymore that Gates resigned, maybe he already saw where Coplan was heading to. That's the end of Python/Tcl/Perl on Win32. Erase your 95/98/NT, install Linux now. Bright future for everything (Python, Tcl, Perl) on Linux because Unix is their home anyway. Dat Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Fri Feb 25 08:17:39 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 15:17:39 +0200 (IST) Subject: os.path.walk (was: Re: Optimizing code) In-Reply-To: Message-ID: On 25 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > It would be nice if the Python library was maintaining a little cache for > `stat', and if there was a way for users to interface with it as wanted. Well, now that Guido is back from his trip, it's hard to get him to let me use his time machine, but I'll see what I can do about it. OK, all fixed. We have a statcache module. We had some troubles with the time machine, so you'll have to download the newest Library Reference to learn how to use it. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit at nl.linux.org Tue Feb 29 05:02:21 2000 From: gerrit at nl.linux.org (gerrit at nl.linux.org) Date: Tue, 29 Feb 2000 11:02:21 +0100 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) In-Reply-To: <3326DD1EE2F0A189.8CE210DACA89D440.29CA859F010483DB@lp.airnews.net>; from effbot@telia.com on Mon, Feb 28, 2000 at 11:04:45PM -0600 References: <3326DD1EE2F0A189.8CE210DACA89D440.29CA859F010483DB@lp.airnews.net> Message-ID: <20000229110221.A2042@nl.linux.org> > http://www.deja.com/=dnc/getdoc.xp?AN=590053755 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588013997 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588012707 ... > http://www.deja.com/=dnc/getdoc.xp?AN=590446915 > http://www.deja.com/=dnc/getdoc.xp?AN=590532128 (errata) ... > http://www.deja.com/=dnc/getdoc.xp?AN=587498993 ... > http://www.deja.com/=dnc/getdoc.xp?AN=589614882 ... > http://www.deja.com/=dnc/getdoc.xp?AN=589808979 ... > http://www.deja.com/=dnc/getdoc.xp?AN=570016307 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588617613 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588777654 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588863805 ... > http://www.deja.com/=dnc/getdoc.xp?AN=589134497 ... > http://www.deja.com/=dnc/getdoc.xp?AN=589280553 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588911772 ... > http://www.deja.com/=dnc/getdoc.xp?AN=588907043 ... > http://www.deja.com/=dnc/getdoc.xp?AN=589175052 > http://www.python.org/pipermail/python-list/2000-February/046654.html Why do you link the pipermail archive sometimes but not always? > http://www.deja.com/=dnc/getdoc.xp?AN=588080148 ... > http://www.deja.com/=dnc/viewthread.xp?AN=589151105 ... > http://www.deja.com/=dnc/getdoc.xp?AN=589804937 ... > http://www.python.org/pipermail/python-list/2000-February/046773.html > Suggestions/corrections for next week's posting are always welcome. > http://www.egroups.com/list/python-url-leads/ Can't this list be hosted at one of python.org/starship.python.net? It looks a bit [I-don't-know-how-to-say-it-in-English] to me... > To receive a new issue of this posting in e-mail each Monday morning, > ask to subscribe. Mention "Python-URL!". Hmm, isn't it automated? If not, please subscribe me. I'm not sure who makes this list - Cameron Laird or Fredrik Lundh? Thanks for putting my GUI comparison in the Weekly Python-URL! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From bjorn at roguewave.com Tue Feb 22 14:45:50 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 22 Feb 2000 12:45:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <1260876476-6142700@hypernet.com> Message-ID: <38B2E76D.7DEF295C@roguewave.com> Gordon McMillan wrote: > bjorn wrote: > > > I must respectfully disagree. When doing OO design, the fundamental question > > is "if I want to do 'foo', to what am I doing 'foo'?"... In this case "if I > > want to 'join', what am I 'joining'?", the answer is that you're joining a > > sequence type. Thus, IMHO it the natural (and extensible to user types) way > > to do it would be: > > > > [1,2,3].join() > > (1,2,3).join(' ') > > string.join only works on lists of strings. If you introduce a > special "sequence of strings" type, then join could be a > method on that. Otherwise, you need to work out some new > semantics. Sorry, bad example: ['a', 'b', 'c'].join() [1,2,3].join() would presumably be as ill defined as string.join([1,2,3])... > > if you think of another domain, say a gui with a textarea this might become > > clearer. Nobody would want to write: > > > > "foo bar".put(textarea) > > If textareas had a well defined interface that strings knew > about, that would be fine, > [snip] Exactly. Strings can't possibly know enough about all possible sequence types, including user defined ones, to make this efficient. > [snip] > But the scope here is the existing "string.join". The fact that > the procedural interface has the instance as the 2nd arg is a > distraction. It is a string method, not a list method. > > - Gordon Just because it happened to be in the string module does not make it a string method (it's definitely possible, but one doesn't logically follow from the other). The fact that the string module interface has uses the second argument for the join field is pedagogically an important one. E.g. the self parameter to a method is always passed first, and any of the ast/oo implementations in other procedural languages always pass the object being acted on as the first argument. It therefore seems natural for a Python programmer to infer that join(seq, sep) should be parsed as seq.join(sep). from Frederik: -- python 1.6 will have *two* different string types. which presumably would be convertible, so implementing myContainer.join for regular strings should be convertable to Unicode strings (no?) -- python 1.6 will have lots of sequence types (at least one more than 1.5.2!) Which is (a) a good argument for implementing join in the sequence types, since there are much more than *two* sequence types and (b) suggests that we really need a common base class for the sequence types to share common functionality (Python is an OO language after all...) -- while join can be *defined* as a series of concatenations, *implementing* things that way doesn't work in real life. do you really think that *all* sequence objects should know how to join all possible string types in an efficient way? or is that better left to the string implementation? Conversely, to you really think that both string classes should know how to efficiently join all possible sequence types? Consider: class MyTree: def join(sep=''): lhs = rhs = '' if self.lhs: lhs = self.join(self.lhs) if self.rhs: rhs = self.join(self.rhs) # presumably the + operator would do any neccessary coercion? return lhs + sep + self.data + sep + rhs sometimes implementing join as a series of concatenations does work, and is much easer than trying to implement __getitem__. at-least-until-we-get-generators'ly y'rs -- bjorn From yppzek at w3r92b3.com Mon Feb 14 08:19:45 2000 From: yppzek at w3r92b3.com (yppzek at w3r92b3.com) Date: Mon, 14 Feb 2000 13:19:45 GMT Subject: L`E.G-A,L C,A`B.L,E T-V D,E-S.C.R,A.M.B.L.E.R........ 7625 Message-ID: LEGAL C.A`B`L`E TV D`E-S`C`R`A`M`B`L`E`R Want to watch Sporting Events?--Movies?--Pay-Per-View?? *This is the Famous R-O Shack TV Descrambler You can assemble it from Radio Shack parts for about $12 to $15. We Send You: 1, E-Z To follow Assembly Instructions. 2. E-Z To read Original Drawings. 3. Total Parts List. **** PLUS SOMETHING NEW YOU MUST HAVE! **** Something you can't do without. THE UP-TO-DATE 6 PAGE REPORT: USING A DESCRAMBLER LEGALLY Warning: You should not build a TV Descrambler without reading this report first. This descrambler works on Fiber, TCI, Jarrod and satellite systems ( not DSS ).The signal descrambles right at the box and does not move back through the line so the cable company will not detect it This Box will everywhere in the USA plus England, Brazil, Canada and other countries! We mail out all orders within 24 hours of receiving them. You get the complete 6 page report and instruction package including the instruction plans, the easy to follow diagram, and most important of all the "Using a Descrambler LEGALLY Report all for just--$10.00 Fill out form below and send it, along with your $10.00 payment to: CableFree-TV 12187 S. Orange Blossom Trail #116 Orlando Fl 32837 (Cash, Check or Money Order.) (Florida residents include 7% Florida State Sales Tax) (All orders outside the U.S.A. add $5.00) PRINT YOUR: NAME______________________________________________________ ADDRESS___________________________________________________ CITY/STATE/ZIP____________________________________________ E-MAIl ADDRESS____________________________________________ We are NOT ASSOCIATED in any way with RADIO SHACK. 13io41=0324=0124-12=-412412412412412 gpbiydivjiyqgdhqqetmjkxvgcgzfwytwoghikmrdiemmcjlzslqedvwnegcyxzhfwrtjweckznzwtodznnyvgtiulcwricbekrxpzfsfhjkborirngnzfjufszpwpxpudmwpejgpcyukvnscqwmflnbqyilcbjsfwiwvuliqhoiocuxgtuzwhx begin 644 TURQOISE.GIF M1TE&.#EA_P"6 -4 /____[___W^____F?[WDO_KC?_KB__KB='D_]WOC<7+ MWJ_0_Z_._ZS.__^JC_^M3,JCCO^$AO^$A?^"@O^!AF:WTVBPS:6)PD&7>(5C MKG];JA2&9Q2%:A2%:0Z'90Z"9P M M "'Y! $ + #_ )8 ;_ M0(!P2"P:C\BD$PNF\_H=%' 1K3?;$$V M[A;4X^J\?K^U(Q: "PT-#(.%#8 (;E)^?PR/AH.("XIL?)>8F41^@H2/GZ"@ M at Y0(3G: AJ&0GY*4EIJPL6.GA:JVJJ.*2G:IM[Z'E++"PUBGGK_(D,%'?\?) MR,O$TM-*BL[/SXM#=MC=#*[4X>'Z/3U[O#R M_'KX^=VL >S68%^_ at V80E!N(3,%"AK8*ID-(40P"B 090,#X[-W$BB#[+.#X M;(&"""0[E at K),LO%E,D at 4' (TQ>ZECBK**SYRP$%_P at C>49($"C1?(--UA-^'3 ^/7[P \_G8 at 3*2;Y(!9$A4WHG$$"(*3 6>:(L MF.2&3:JB76L@!A at 0E3K)F8U/$MRW95S# M59CFGP:,&9:'>3;U):!JKC= FY^\Z1I>=F(S)9U,6,D1 at PYZJ"5-":"':)H% M/$:HATU]*N9[S0G(89G3P?01I4M82M)7HVK)@(X\FBHF!:.2&H&?NF;()F4G M#?JA4SPA FL3 B3%(:'W.3!QTV"M8 M&=/[+KRMY4IMR UK"F%-$9\LQ$Z*F:3 %ZB1P!ST"'<%,&F"MHQJ?*R&_+% MA#[(6++B4BI 8_;<.IR2:O;'<<=+:UO V&3''*R[HG:\*6JHP$3(J\L"78^( M1:\7YME48\STGVP_#>W?@889LN"&MF=<:OZ>DS65=ILC8I^ AIHSQO/NC:&[ M at A-* =-)@LEVW]@6X)Y["2C4.&\^1W[9F9^Z2SJV48OI_ZEZ3G>>,.ZF'_ M>YN??7FM']?['G'-K;[7XPE23)"$AR)Z>.<1U*ZF[V!O//NH85'H^P/@/Y!Y MN]9N[[GU/6J8ZH+,>^<\-M 3#N9[Y@>,O@$$A/][<=9V[K"ZW]/?[XZ$/VL- MKW2 XE:YVM$SB;G.,+BB5JC\!RWKF4Z OYN9[AP00 P>:4PNTUVV$C at L [7/ M.ZIS!^PDJ$'J\:@ & 0?!:$50_TI262(&R$)UW>W$[:$,UG)BFFL,1I$1&]M M_9MA]Y)4PTQ1\"XU#%_Y9ABO\?U)23QT1V6"> >C^.$MDC@)8OZP0%%,BUWO M.2#9/@?#)M8/6A.((OC>B$!=(?^GC+=PBP(0 Y>X!(8E?N#:-Q1P%]K,)R(* ML!D+Z>BPL#@@BDQA) 7D"!9&>DQ^83K $:C1T*"ZR^ H1L_=..D!CD(1'EQ M2Z/.2*_AS7]EH]8!LL@*/3[&022S27<.DK)?R$1+3$$, M94:!R=@ED8H?HJ4 3TG-:EI3FOJSI26KJ"WDU*)1E8' 8Y at 2)^R\:)0/1(9= M7E-(".1%1 0$V02A&4UL at L]!$8" /B\ @0OPDY_Z%.=],*A-2VK)BKHR7:H0 M<2MQ0DE3*(F408@!'F]X,F#)')$$X\-1XK30?]0$GSXK8(&25N"D*$UI2DL: MT#EJ$YK_2Z.0(M-TQY% P"Y!@FBK@"-*6:10;RAX MRM;TLZ0F):E*IZK2J)+4 OX4:#2?*"\"4DAZ\]KC.(.4)?S(K.H_>!4 at AUMB"T M^A2/WJA/QUHS5/B Z:BUG "\-)M/O%85JGKM:U\]*UH+")9F]M1??'Z$6+0M M5E,%4LQ$,?$^@*B1G:VIWDP#%==L.A&?_12M<(<+6- "=JK\O(]F'19%X%V( M/V1BJ at -(TD!-S 4@%ELN+F.*(\I;6H9QM_R[PH#O6&=I* M>7MA0$_U,",7-N38SO&2%[08L &!DS@ @L8M%;]+WKE"-WRS55P MFX+O9^:;ANN&1T1BI:)B=5NAWF;S N8M*8$YP($/F/@#)"[QB5=L8@]X@,0# M#BUY+R#' SC @-O4J819EPFUVF-RR?GH$QWI89'Z=[0"3G&)2=R!)G= R21& M<90YL($J/_G$+PYP at D<+ at 2:VC9XZ6TQ*AGD)'VLQ;TIZ[9#A5,.K;GFE U8Q ME#G at Y#K7.<5V=C*=-W!E% ]XN%#U;27!?#[AF.>G+O*A&&HKN07LR$+3 W,E M'10^\>+US2=-,I[SS.E.>]K.?):REO^1;-IJYIA[1#4=<1(PDAT_0M%A**8] M<*5($-X6<=2$0(!+.V 3*_G3P ZVG5-LXAA3-:JFM=&IH58A8*'GD(VE\\ZZ>D@".RUVTL6-[D'3G!BFY1%#!&R+554-]&1C! M/_&-WQ$ \6B]O6F">]SC4\: <"_P(9C>#TGR@:P^^$!M)QUQ;Q=W;P30#5 at H M?_SF'UK'C3O5(J;Z#C.(_ZN$F\@0\@ MW*\DE0DNN_K_*6\RQ+%I:'D>@8[T-T:&YDF6.K!-K/9/%WNJGDVVSU'=S.X: M@)?F /L9&-V1%3;MRTK?^)+;SFFK8\ #A.\TC&E> :TC3&VFNJ.!]'X&L>-" M ]XSWVNFRD/#^7+8.%D&/'H MI\)>^.9.*'\#//5V_L &$N"ET_,9^'I^LLCY2G+/50^AD<>[%J5M$7\9O7*Q MK-7GJXH!7R._R1X@/@$&,'X"8.#X.2^WU6DN3E+U9T=UK]< !C+;A%@?\](K M\F]]#W<8HQ[X)08!7D)^ T T'H!^P<=B>79P_^=D+ 9N)79U*B43_U"$5.U1 M.)]2 "KG.$1G&YB'>T$71:?$?U4591B0 !X ;H6G at .1F=<9!@.;G8IZ& ;JF M:U969R=X@'5F>#6(>JO'5Q"06JH5?W>W@;<0<15FA&XR "#H(T5V3R38="9H M?@B(@P5V?NJ' 2\X?@, 3K8:<-G',;1@!U@=0EP at TWF@F*(A:+' >Q78T0H M?;8W;UY@>:L4?^PA1P_ 5Q9P at VI8A4Y6?,:!@BKH=EI8?N3GA8CG:>$GA at 3@ MA>CG at F3X :97?FSX9$^';A; 8$VX+7)X#K.W=SO!,H& "PS 2E(@)0(9E.(#C M1XAK)X"(B()?N(N'2'X)P';@AP%$(WQ.-HP%2 !HV&14=HQYU64QM(P^4D+@ M](RW8HT.X$X700J;042F04YW44FY92T+B1 at W=F,RM9'&$47'E6D"YX"'Z(N% M>([$J(BVB([D=WBZZ&D;<()2PT> **AX'2"!E^9!F=[$O8! B*8JRD4S8V4L'',P3 at E>X.4 at 5N59W1>2:1B/*UF('S" MB5B+A0>3<-F/P!:&^]B ;YF3E_F"M-B2=V9UR+B) B2&>CDF-Y9;RO68N*E< M&_$0A*F49D8(/L%[&G9+CSD!VQ=W*/:98HB3NKB9:6F )4EZ*EF,+2B I7E\ M7/E_:KB2K*EZ"<92-C0PM9E;3OD8CU)7N;59M&%[H6@%+3<()R&<[ :59_>1 M%H"/RHF(U+F99(F2GUE\S&F6C*B%3"+IV'3"9+$5-Y=DA_\L& M3#OU"W18*4J8'^(DG^RV;?TGH&4XDJ&9AF#YBX57B:79G<$6CT?#=F.9BV5H MG>0GFH4'D)E&4A":;2\C 2'B#=1W%!FJ*L$YGR^S?2A5F?"XA?NHB,ZYI)XI MG>VHHJ/YENGXB_K8HN"FH*@9;"_Y61[U&T67E%!@AT=X*Q-):/6I4FYJB'$*@^='?/\%:J<<\*(PZG&\:(DIB)E4 MN)TQ2&XP]EFM1ZOKJ1CR50P[QB""6C1;>#3>NJDA^J\T.F["AXZ$"*#F"JI;RJY;9@'ORCV_PA_S!U^] MR0@^R['=-46=HZ]-!Z+:NH4G>*DP")U;2:!5&G5[ZHXJF8N!2H_DVJZ-)TG< MU8W-B T_F at 3U*@I^]US_'OM at T&*D%@;>OV9J?Q!JP32NH M:8BB]SB7 Q:,;1EL'L"B;XN(*RFZ4AIL!R>Q&Z1?V[))\E8%&FM[^%W46JGI8>+*.BO.'FWK4B:1V.YI4F\ M+>NR$3M5AHHOQ9-)U'NQL&L at B00JQ_%=D.&]]SFYG::[!WB+%1MB:R7R+X&+=KI_TJOHCW MLI=KHG5VOG(J?)U[@L1WP9]VI>(GCW)*O%C[<:XIN#HKO5<4>ST$NZMC$G=I M(D^H/Q'0?RJ,JWBZB.7:NWGVNW I?%7F8BG88KEKC^7W at N48QDH;P9^6B5/5 M(=&"'+JRO[<0MD=PO=G1*7O3Q"(U5>#;@OYJFL3HM$G+G'6V 5TR+LHJ,B[Z(;^I8>.NQZ2#,(R at J:8+#IVS'1:*:S%3*(GJ;)] MJZO,G&=H";>'M\,Q>;H#Q\@I)9 U%,V'>S>4',>-H\2=F(=-I'&DY5977A$\W MFFGX27 $V\I-*K""@&.7USD*&3 B) M1)M%25G%64T at -EYY#,S)VX#__!G2G<:B6!IU#WR&:'FIU-EV07RC7WI-5*F1 MJ99RI#@:BEL$S0!&K:!*0TDFMCD\N&F<.[VV(^O3P0S20DW.X7>IF*NG&T"Z M[BC0;]UVG(Q23).E#78B'&-1TD9>1W3[LDR?X @1U)?YFS-+/1(-G1 M'LV\36K%RJFKZ at QL5):I6#BW?#K.@]JN%@"5D81+E/67D50]H8T:T#C/S/(2 M&,G5Q2V5\QFR at -73BNW/) K0Q%RG&(S%"UK%[CAZSKQ2KHTM43F1K&TCZ^G< MS!*9*(+W/V*7*K*;V]#%EJ0 M,F)U%Q%NNWAXD8:CC >OA?.V'Y\P(\=D]M,<.4,HR/-O(2'8L at EY!3:$1$=*Y[! M($I>XB ;=[%MU-ULDC0.CPU,DB WEH>7H 2ZS*G'TBNUIN$UI@'AWHL;I#85 MG&@^6;!-4 at 2>I%&^W;VJV^X[B!H.Y7EZYP^[U.!XWJZWEQ,]AU, at QV[24.-4 MZ-#B7_.LPRGW/^:I*C0X-RR)N:T M.4[09-W?^^107M1NWMAG7,7&X>I2;)H-.%H;0[N.D?FOYQ<33S H8R]>6'!&-:.J?7%7SS4YWW;IH&JU/ MP+B%<,W/A5CI62L$C-WXC>INKNK QK#M*.N*9X;838EXCGP:3#K5WFR794*O MFL2Z?%@/@)Y5 _!'FMC9]F6Y14MH(B8$ MD.^FC00:?V_7YET[;Y[US=,0[]O_0,V9I4JNPXCTHSE at _?B22@]\SFO at G3U0 M H2*"U/OD*!HVGX+M]-=^J?3M at KTBGW#Q$?6 GC#*K]V7&RP _:P+M;V32_M M%1#U<)@^!<"X5V\$MXS+=(\[!L#+#D#J(B_9+I:P+H9^7$SZE=Z""BW(@,CZ MW_?V*N4;O"P^E+_I*O$$>6\+^"8FLY]@ B]U/^R )_9]Q!_M+3W[(.AU1YSQ MI-C\SI_+Q9$<3RE1.VZE5I%/3S%ZY6V^F"_Z&R6.S&%U.G]5M]GL-EFNM=6H4C[=7\WT_ M=.]/<)"PT/ 0T2]+;V\Q9FYV?D9.EIZFCKZXAH[ M6WN;N]O[&SQOM[^'C]??Y^_W_\?8$"! PD6 M-'@084*%"QDV=/@08D2)$RE6M'@18T:-&SEV]/@19$B1(TF6-'D294J5*PD& # 0 [ end begin 644 BLUE.GIF M1TE&.#EA00&2 -4 /___]G-_\[&_\;&_\Z]_\:]_[V]_[.]_[VU_[6S][&S M_Z*O_Z&H]Z:FZ(*J_X^B\XN3\HR5XW23[8F-RQBT_P"__P"U_W*"TFR Z0"M M_W!]PEUS\%USYW1SIAJ2XTUVZ&-KYV1PP5IKYTUTUE)KYU)KV$IKYT9KV5MD MI4MAU5M;AT1:OS]8T3Y1I3=0O$%0BR-5HD%&<"I*@B]"G")&;2LXDB$PNF\_HM'K-GO9^[;A\ M3J^#8[@?W,[O^_]U,CIZ>X!',BH^A8:,C8Y)-"\[A(]#-#%OE9I(*9V>+*"A MHJ.AGBF;5C0RDWJ;-"JMJ'2=HRZVM[8S+C.ZO+Z_O#4SPL#%OKNXHK)'JGE0 MJ['+TD\IHKB[QL(UV]PV-3;>W.+CY,/CX. Y-CGL[>K at V[RVH=-.T-%<+QT^ M6#(Q,8OJ&:EV[=+#%R]FO$AX8UT['2!#ZF 7 M3M<*@44NL0J8Y5(F*R\NX4-5C<6M7N8.)H3G+5P-_QF\'#J4Z!#&KX<0.RA% M$:*BTZ9-B:K 2!5+8BD/'CJ\]P/(8:4,7BS OPT3*PS(+HK9";KRA MA%)(J)OF=B8DMQ!C"[]_A49<$:+I"J%#0RC5T(&QXL*0(S,-01 at J4X@/_P[3 MFR,KCAM<<7P%NZ.':=,[R,XXV?(%V[I)Y!*BBPI4KF#IW+U#]XWO.,2!@:-X M2'AR810K5C#5P+QY8^>1HTL?@5QH,)WHU+7KNG6'Z-&D3XOO8>-L/[9PC\RF M#0C3>O9_;./VJ'OWSFTRM#$,FGGXT/[)41;"""$P5V!S&DR0X((**HA@ MJ,$($Q9F2PM&78==;CF(!/_>:&&%6!II,YB7BB3P';'2>^G-<0^+?, at W0SHA MC042.S?0<(,,-O (#H\_!3D,,"T0B=1$RB7)%($4:E#@!1I V> $5%9I9947 M9*GEEEE2.,(*ML!0)##=6,6.A]^%%Z)X.]B at A3^L+"$(B^O]\2*,;!"T2PUG M\N#G5S9NA=4__U#U@@R(!IG?43, YY!)QEEF&&0$#CAAE%IB>265%TP00:=4 M1L#I!%Q*T.67USQJT#<#$AJ#H2\(E5%#P+G0 at K8N5.9D@=)%=ND(69IJ*I=9 MDGK_00DAL)LE!A&(&F^\%\0K@;D8C'!"G[3X9_,*IO:L]!&2ZBA*ASIGZ,.:9O6" M4&:)*;KF7E#S"#@GQVX*R?'<20D7< "!A? *T$$]]HK0;XGL'#"OBO?\J^/ M9Q8,WL$VN-#&G0TG42P7 at Q0[Y\0QC/U>%#:YH+%7S8;E<;(@<:=#R#=(.RU& M4PU'D624L5Q985G*Z^F5G99J[KV(F_LERRRLT(GCIIA2 @]85%LGK#P%9_Z$,/.6B]-; -L[3B;%O<\+H>/92]_RN=.KP at 6[#JW6"" M39N!]*?''Z>VU=Q<(9]5CH3*@#?>)B,G+H(Q:SEO! UDWP#VUW=OK])((S[! MO1>LL.^^/D>N?B=/8R !!)EG+H&^FY_P.,O6;815AZ6#U8,.+7#1[5I'!!JP M[FNIF!TA<""# ;YG1PJ$S]AF)3P_>05DHRA,(0JYYSW+91YTW@>KI3>)B/^K,)=*5ZBPI\($^/&/?U2A]A[0@ <8\I . MF"']-K>"&^I0ASQ\I"1Y:((1(-%]0\SDO9CFB959RP;[<]75S. at KAEVQ$#+8 M7=>2@"*XV*IUM;M!PR#8NH_I( ;$LN7I5KQ-J#Y#0C.8?&9 !EC3F@]@@ ,RF4@/X*Q^/\QA#Q])@A*4DP3H- $2 M+?D!##C at G9DT) 9X>+_#A Z4I+L at B,H3B"[B*1+^A-TAT(,$B36L;+IBT0YP M2<8R=J at S(GDHCI87 at T&)S!_$],L+Z@@1PK0LF3/;DJ@\Y *>^Q,E#'I)@!. at TIR5+@,2B(E$"\'S @P) M at 0_HD&=-_ LH01.WJ]$*#0(MX"D%ZH^&GLT( '48 %3AU1_T0 @H(-9L>D#+ MB=6G/K;JH-T*=3>JZ.U(RF$2"97I,G45CE2#FQ0%^8U14RH%Q MQ3NEN6H9%$B$5FZ5'Q;;ZA'*%J8$G>C at VL.;(4H1&64 M6AC!S& *LX)*68I<6_)4X)@IK^Z6M %_5*EA43H Q";6 (R%_^P!)OM.!ZS3 MII?=G ][.M3/AE:THS5J>R>KU = 8 0EB"I&*@J:[H"E!F=0Z\5^NTKG!32K M!?Q'KXB015[M(!<:.U,.$"7+,+9C?\NU 7.?:R at 4;'1O*@ :$,Q9WJ6:? M*IKUO)?"\!JVO ,00 %TK./RGO< !VCL>BE;69R^-[-/ _ '*NE4^^8WOTB= M[&2S)ZH+1$4%*OA': Y\!ME-3 AQTS?M=*C7_0&D.N"TDV7 J5'= M 56_MC14- ,-7DT[ #"8=\:-M5B;L +COGD]_\-!V?9M83P,< <[JBC$9K,# MB20)*M%QTI8 7MA#DTQ at N^:M+#DC?2V5^YH'(O7 )4&,GOS>P)T MOY?=[';WNV4JTT)6*=59OG8\W?4,@'U#W?20H$I^!4/RV'CG "P9W13C at 5UMR--=S.1!0 M at Q P3RGP-/-7228P?T%U3O@'A/DW.2<77 at EP6 $8@ ,(;@58:8UU:3>X@!RP M@ SX 1R@>J6%?$/4 Y02 \P.!, =,TG&CZ0;_HF>=I7!%VQ T@@?2Q2'KRP M#EBA=69U(W98-1WR&>(G<.NQ PYA=5>$ M[E/?##?X;H7_,D?SYH NC4B$%( M5(]83OG'?T:(6#G&:$DH at -V&4DS8A$'VA$NU-!@PA5;(;ICT;@S AGODJ'N-QGO?1H#@)E[I%5E+E4B) M(T1*U5@)L !'64VKJ(\1R(_T9F\&IGADP%!*)P6IQ&^\-A*X-'X.Q0XT(&)@ MJ0JV4XSO at 0,:\ __7K6, at O21U^1'UR0!&T"232BAI/I98YC5IX099H"AD1NE'IN:1\D9(@S4!A4=OA_>/Y+$& M4E>545 VV9=F(5$WOH@["$$#K,(CS at 61=.(#%?-O/3 !"8!"T$A-?M18UP0! M>CF7=)F7Y927>,F2$M"7AW6) (B)A%F.C6:..JEH+L>3!^")E?98?M0 IC:; MD[F1VP.&8OB/.S"+:-!5::@>O-(#D>!E+/(_.E WZ-DPZM!<,X H\:D1SL-T M9$D(/H!0Z=D!+%6=T at 19C"62'" ")4F7+8F7P.F;?*D *$63V8:^:X>Y+&B9T8G0JPF'^$E-E#F81W0H97;T'W';*5!LV =$50FJV# P8W<68U M%L*8@;"4 S5@%#"0(1E"GR_ HO>Y4 RW'BH@ -&D CP6(V% $J*FQ@@ KOY M at XZ8H G*DMQHI#5YG 8H>1(=SG)8UPZ )?XG.@(NI(SB >2"Q(W,Z?3-@%!CRIXA1)>)F?ZX%9L9!ZH00065 at A17@B at H9@"$&-S",O_'@1$&N546:%RG\X(!<*2. M9:0*T &ET0")B@#HA9L2(*E0^HB5JI*76@*9VI>=NJT1RJ6&R8D\"4TH1$C8 M8YE@^(I0^15NNC4T*E9[6DO?QXOG5V8WX#$4O("#5Y6(R-B^7HZ_"=I]>!)A$ M6K W<(6C" (T ,9 ,_@ ,ZUJA**J"\29+5ZJ37FJT(4+&$N6,$H%*XB4W7 ME*39-G>B^IPOY[%I*J+_(]JJHC$#C" "-M$"J42H78DCSN.C+4HI*X9=1W-( MAF0Y$: !K@&W9G6DB: (.L"2.%4!%6 !'A 6*>67D)J2/WB at P0FQ+)FI1FJU M+->@C6NE"""2HCB*4RBT& !"T"QRNEHBB9>@32;'[J/\S*R>. =4CD')& 3 M?'*K/%N'[> /9K-5+[ E>/L^>JNWEI.SKD&KLZ$" = YND!S2(" _H!B6L! MU-LL"9"U at 5D 2AJ*#ON;UCJYP4FUF-NE&,M8A6A(GKL!3LH!)."2[=N^5_@ M1FJ3.$FAJAM(KE/8P1S PGF9H"3 <.9L7,GCABJJ-:)IAMIMJ](HEKF MAW; L,0P'ZBI\A[1:@##L8EGEOU at DBSQ40YO#6X20RK0U>X-%;VMQ:F A,0 M G@ 10 PE[Q2!?0QB"\;P5 PA.092K K%E; K /<2 G1IH, IOI&FN5F: MG"@5H \PBNO+L$[ZO=!KJ2\,O0]0M85YH8IZE!\[6$ZI(!V E.QQ$0W!T[, M)WZ">0.L"+F;9F41;&ZX5A-PQ%M<@WH+ 9LTBD\E3O_F) (;D'I-T5I;$0,J MH $-$&D$\$73:P$<>#H] /)O&\FO ^J[ ,=4,*0AE)^+ &-"$H@(;65.[&H MB\)):E at WF5IB'V;'XBZKRXB1_J!5=8;)K MH#90K$811\"UU"@QT:-;%0/9^< V:,L1'+HO24X-F\,;4-'JNP'":TT(, $\ MX $@; '[=AHQX '/O ,$$ ,\ .O9%8-4,(EK&-^K (XH,IKM9+BN[1][- 2 M##\,BKJ9^ZS6U*3K&\F1/(63\\Z0K))3*,] #*J*F=NTK_.R"97LC0G[O.["NMU*J2Z$2@[;R^P[D '_S1 M%I !>)T!'B #O#,0^?,&@P#;Q #+]UHR_L51>L!BNT!06JYEJQC"H#. _K6 MH2L!"("]F2O.B^S"ZSPY=\G9.YS43 at H!SKJEV6O/U3F9\U(^5;T_7;&N9J V M;'/*PK,C" W65V0#!<=;L-0!!W!-M0S&4PB]P9F-< V^[BL"?"D!&FS7B4L! M#A ?>W&'=W"S)CP!.P#8S4V]SFN, V2BD_,A954H5/(S&[83 #PW;*:L0# M&Q83_U/,L^F75KK3.BKPB:1V2%&(CZD at R[ 0] 2)NUXK= = PM-- MO=YMUQG0 ]3\TA- Q90 6P\XR2>M%G*Q]+HO7?)EZ:[;9LKH#R.W,3]R Q[ MY$7>PS[>H$D8IIS(6-5T at P!V0_A3)*ETU?QT!BZ0X K>U1X4L[BM4";V#UVT MC$$F989D1$F$WL )A!U.WRHYN at S06!E,O1GP ]7LTBF.N#3.W':];T,J TP M HE+ ]7L ",.PG=.V$ NC7D9NMSHERLW:3FMOAM^J1V^H#_.WX?%CM(822/ M,XOC$!M!X%F-!C/0+ JN S8BEA4F\[N'* M+;^,)<=WC>+'_@(^>\((H,WM&^<-3)SN MW:P*L,B[/J7S_,+4,(&@+I1.,8,@%+T.^E\W,?G+HW4C>\2]#%N .O>74[<+ %$'-G/D1'9%\JW^M$+K4 MOA?P1H5.3B6I=(^7 ZK."\K>"O#16%_L$0_2,4 1VCU<]P#,A#Q,& C?B+C M%0#=CZ98XZM2C)7RT2J)N2S@ 7,#LV+ at 9% #:C0W at S)@ M5[GX%DG"T+^TE'9WEY: H75?0T[W4O_KE[=["8&@,!@4"@;_ M ?!@X4'BP_"#!/%#9+%$Q!'R43+2483#DH-#@H$!P8!@P4+4 J9')>!.@*)B MM""PF%!(&! 8,\@%3E9>?D.00'B,E)RDII2$N,! M 8^9.YD/H0!A >.QJ"3E:$5IYL7I)J>%2WZ>'L %3 ='+(9,!45%A at P:.^84 M-"BG!X%4>?CX,1!(P:!"AQ"12%0-HS41F"QA8*# 4P$!"W;9PH4#50 $JT1E MZ/$"&@<0'VI9\-!#UZ@, FF,2! *% !"1(%@KL2*(TJ6V'"2 UX]M6NKS/@B9LP+%"A"H#A#0\=!O0=[ M-$"EAZ'#APU,@! *$!545 M*'A SERZ=>V>H'7!%CL]%CETY!A#1FX(#1I0I+E!<&_Z-[61[6GHD'!A"1L0 M<[!8PG?C::(S;?HXF3)>*M!A#8)P0 T7&4++9(32>CBMI at I@X"$.'W:80)OB MN(G!!Q]86R"63'S[C3$,($! (0WY*$#_"')(X("J<(Y[[JMSI%NBAB;>R6&% M['SDXAX=GKBAG[E"N. "#5I( P<"U5.O U3NV .P/AQJ+B)"2"AAD?M(?*H2 M2S#!YB.0^K"J,LMZZ $&#QY L(<6-A#S at PQX^4*$FDR" 2\=:&C3 @F(*RXE M8>X((($_+> !AZYBP<"^2BIQ"CA).#"Q*F*0$0JK/IR#E%)-0,*2$PQL1$*= M%F;0<4<6?GPU"QORB4LNNC08 =<1EDC#R2<-BE*9/-SS8]3"GMO (J>V_#(2 MI_C#8!/)5EQ1 50$\4#6B1P8)1;5BCADHWJO),&$5CJMH)T64F7 MN.0J6 M!!J8E]Z?2$IW_U&4!"# 40Q"<_;?C3:8$\:/1 K *E0:F&!09/I at 0 )R.!CX MTH\,X(JKXR ]%04E7J#..U=A'9F*((GDI]80CAPAA1-P7>%C&F;S-8X=@$V& M&&%7)&8 TB5(-)EI8GD4 at Q,3,[$_PAHN!B1##C7EG0E*"1JF^9T[!'4)(1A M(ZA[J8 ""8QZ=P(<=NC00P]_F" !%&K*IX/7)FB *TX at B'@%&YH$XX85HCTT M@%&!X7F>21:Y at 5 MY91'6.&$$THXX8.7R[NA2?347!IF"YJP+8[ L_Q>=AAP!PX*$F'E9C M(X8[B.L ![7?P,'VW'I0WT(>\%I#7\!EDY\.'5C:L*Q$%'K)37.Q4<$-; "Z MT,&*.[2:"PI0E;K4;L)P+A/6 !.:3 $H&1H4-Q M(P 1R);VT at 6##DB at 337A$Y]H@ (IC5 W-,A6!C+@ 1 at X:7 !F( 8+: :&*BK M%&M+20-VL(,_92M;JF'#!(9A)3\015[S0J#_YE2PP!HX\($_&MT^P$/!%B#! M9:O##Q$L\H&O;+ %,6I& ML1"3:# %#F\@95K%0 #(,4?$(3K$5^9Q@<\( (01 (;"A#&" E @* \4U/* M0!3U>F$+&DQ 7>A:W@$0AP,:5%-=-&!#!W)8BRG6H@(4B@%0)K"#-V9S%!Y0 M)\+\Z P#"O(U"2SD#0Z9R)%M1TBE(PLD4T $7%5268E@$!%"H$%SB&!@(L!4 MIG#F#0V\T0*M_,OD9.2 M;,(:/,!' 8"D5P3RJ<\;S "1_LS.#+J#,C,H 57F<"E^+&+$M at YL2_B)J+(@ M&E);(BP!J"1I]BS at DBB9="%\:.;%B'(\1+$-%;#)3*C O^] MIA*%/IA;_-APBF#UKD6/E=YO)E&QYH3DE0TY$T,VRS,!'( E!#*%7TH*% FL M5Z.)6P"^=/ 3 ]RK%P3"J"@J<$W/VF(% KCP+?H2E!.+X at 5V&.X]CZM8S7UU M"LM]%5F=^P)5/5(L!2T"=;E$'QG(;GVL<ZL2E M6(,/<-"!!ACJ#N>ZR4"/:&N-H02-F2^>>"#1+'0\ M.>) M9V# ,C^00=A7P(@/0$ A_^>:$!AXH#];_*(8\&%X<8W+@ @L1>(=*'7%+5X/ M%^0 !_PX*W1!KCH3).(#+1#C+>RD)Q;KH";)GKIL(T!S7BQQ 9HB0 S>F(&I M?DT'Z(NMG5IA;^0EV!D@,EHO,9*L-]-T,DX_P& ",?MSFQ+$7[M%M.U=[YL] M;13BU !R)&!$!/T !KPH1=DW\@ ^X!;F[ )&'__0'.)^&N(/$/6H.R #Y?;= M1[+JAPJ4X/$@2Y)U6YHBGPS1&4?3P/$I'P6!5&!:R^@@ D!9F@ P\&X<7 # M/,!K2J$7,H '+B#R[,T]%K!WCD,(/LIH1&-!C$8"8*_I_, 9&&[AK*_V!".S MB/^AG.2O:@@D2GPO)=(D-6 at CHH!#TVRB!WC+)'Y@!>QC.*REFD3A%X)A&)JF M^A9N 1ZN 1Y@*18FGQ0K!KX/_+#C[XBDD#H&R KO!$;N!-POG11D8&BB6T!+ M3SP !11MT?3%!K&E+YRA.?*,!P9F8+2&"Z\%!G!@ '#+ S3 ALQM6NHL*\B0 M$SX* AZ E$0*',#!(3*F>*QOX2"B _U at 9P+ $3K\]3DS]0NV^[@ <*.-5(@ M8%J03UIPT5+ $K*! ,*PKWC")YX)%8A"X8@"^X*0"+E/[Y P"=>"!6P@!V*@ M"2D(5=#!@E at GFW@@!P*B"3H#MC[ :SI,ZKK%)>H 2;_D=\NX&ZF1M)$H=>> MP ;0H%O$3MF8!:;L -"X!8+RH):$-OKL[L\!N_L2 at Q M\&(NA at S/L3F6 RH%01!^D"JQ!!$#X,M^@.#<:5U@ "B ;Q0HI,_.AO1:8A_9 MX$$:SP-&8!8B;P=*P"-L":BR_Y!"X,!",,1W&( /(2#41.T")B!S"$D%;" C M-7(M5J C_4%E0#+(+,@$LN<6_H2+WHF('&$@UPF5-HP75.,%Z*,::5*8L% 4 MMBC9:$#24'(JH(8'UNFJK at H^'N(UTZWIK$0T "I.4. M+DQ S*A/[BA06&0X5P\#4"%"H H*84;L S1Z$4)$43LXE=/ 2>E(G3$$1&V+V"E$="<,3 MG$XK;O_30[,*1(G"TXHK(B/R-Y'( 0CA,"C"!#[ :$C):\C(3LCH 7:P'DM# M\BC $*:N LKHG2P@)9VB,V24!F+ 8*@%PN+/0<$&(@^#"%3'@E E552%'6K M"1HH/MDBN]RK \9# XX %U.G/]^N=41$$\[%)28 #P:@&+'E!W* /M!I^2)% M$UO"%R 4!"1! MYD0D_A2CAP PUQ Y=2*W!S-P$)42$2(AE at 41_.4?DPB:9F M12FB(O #6JB*C/!( OIHW] E;.RC3K4))2N"!"B at C#P@ [K3LAPL]\ I;'Q& M N)*DDK@=$X'5::C"9K !JXC2]7"!:;Q/KM4 RX@!-"A95+_)VJJJ.UD@'70 M$!OX5 SY:/]"(9X>9";D-$XVP#)7LNUX! 30< ..QD$R at UC4L1 #=0//440! MB1/:U5W?M5WY\ %2-&(HU5[O at P0T<1<\;XDD0 _LL$UAB]*>(6($T/-PL*^& MB%35CXS"Q@'"8=WFAC[LU1!:=*T>DU]'JU\I M;?:0M"0P#P_R$@(V (^RQ1!\*%GP_\,$B,@!NA,1ZVQ8#(!- R")Q+:)6D1; M9;4(6&8%;#55-DX&VL$)>)5DYX$%6J ^-6<\7 at -)<"5U4$Y=Y"G)Z 3^V(. MZQ'#WE(T7? 'GL 'L#.>>@4. MYU5KN99222 *)^D$IF9;<*@/B6LI[5 $ "'=- ]9,1N9,&(/J!%*?52)& ! M$/$]CL&/3$G_FBD GL-%7FUC.79*<<0&J(-Q&U<>?A5ENU1N^G*'J&E=(A,, M:LU >P!G!0L\H5%T'8T-]&?$2 Q_\S?Y/(!;^(UMB@=V'_@'%_5=&P"D*!BD M0BIW[88/I_^&1:V7:TT@"H57>/'#/Q(543&&>0%K#ILV#PEA8*!%.)N1#YO# M V5S'?5V3=WG$YMBDAYAK+!?>?A5U\@9>U #!KK,-57A7 B$2V*+Y6XA7ZNU5Y*9+=0HJ.80 7D^8>X7%P0 # Y]R$)#H-YUR0XG%#@?# M#W(G*YQ#F"#AAZ.C<(5855Z@!JC#%8\X"V)1+KHT;B:@+R. #QD@!)44[JC5 M)*ZJ*$3HQ0 at D!4Q ]VR""%* FFJ9 AB !;8)-Z5*E$TB9X7&-+_6(W=N)2; M6)DO&&CFN([I&(0I8 at 1:QP1, #_V&!V.9HWI!>(X 9"XXANC-V\5#DNF$BHC MXARUPBJ_ES at 8HCF*3VB^HI)O&7T/EQU =N\\F0OFTP82J")#C0^#4"^51WM\ M 1CN@*!](?.( C<5H)?E]%NF$)UL(B5G^1R(J6)]86H6%3S+R$6A90][-T5- M"WE3M'=)B8V3&0-*&:2,)A=39XYC&J:A&?W.X02R^8+=>%[:%5$#^;(N$! V M$(*]F5%W*>==6J/3D%6L &@G5RN=J43YD3EF/VIH10#75I3+BPA(@"6KI&7,98+;IH M8#)H(BH*4"G5BE)P #T%N]%]M46"!,7]IEXMNRH91E MT8$%.""9\SMWZR51*6>%'!@X2]2K_WA=N<*GB0ZEBH]+7B017DWD-A:3-TZ3 MS6)D]5D+X%=R-?]@ BZ at +WOWN)>C>+9"-YV;=HF"$!Y 7NP&:= 3/Z HW[E+.\:@N\M7-IA1C /A"*(FY;QB-\D\VB?2W\"C!< M6#7UA)60*:V,-_4&J)PEUUMYL_V[,K>-HI&([W<+-YG-2)?-"7G 5.X-L+/74. M'4FXZG*0!-W3'4GJF06"+,BJF]/K64J;'-+_,M(AG;A#[0+0X=V%S$:>-'6. MM=5=?2\I.-:+>C>[7-WXP#GF _$>OG52$INE=(+F at M2,>-C7?'TW1SQ4-@*F M!LY+E-E'?&IK%^*@'7<]6YE#C;/7F"\GDN5#+=D7&[PJW;TM_>8KG=N_W>9M M7DI30-W1?5 at UX$B*'B3-3TJ37NF77DJ/_2_K'=T!,^C3 4S[7=!7)P5&8$_Y M4-G]W.#WNYN+.JL,O-:)12_!FVM+?00T*$DZ_SZ!;JR3,SZ)+5X\D$0")F!J ML!923=11)QCB\MS at GUSP\SO9)8##$_VQ>[[25Z#=&Y_Q']_QOQUU7. $/,[\ MAAY)QD,\%I/SC]X%D)[I0S_I.]Y+2]_T,5\#1+_J!_T$-'OE_]S/*SCL9[TH M#KQI?W!>(2!K=3PY/JJ4*_+M,;*WCSB)_>$CQ\/NC7?K3]J)=^A1-+N"[V[P MIU_?#5_1@;Q8&1_T15]*D?[S86 %/O_SD4!EB)[H.Q_]R8(L7*#C'HG5U '^ MU5_^0T"4,R=SZ!__.]\6WY_[XYT%FAP((L(A40B)-""-):.92"@2B(*A>K@> M%MG%XL']OOT\WDO*AXYF=$( PC)'Q(^,'$B88. M4T",*+$$IR&6)ES & BC1HV@/H9( >N5*52H7+5PD7(EK5FR9 at 1[]FR9S)I\ MHL&$&5:KIBK5BHT9/4W0-D%"MPC@'CQH\*")EW/_ M6[)<6:C!;^V;NWX>[&'SXH0(^[>=:C782.)+%*P6!'XKU-, M&35,T(!8,2! %QQ_TC!P9*F5*I'6F at 7#Z P9,_8$#(U"]&@^ 4V_Z/RBQ at O/ MJ3T;7?W9]>=GH3NHR"TZ](P:OF74Z,Q9I[%4(9QN-#/)4D6J$:A"P"J]"0-U M8+Y^:=? W1(DF#JD17-C!HNWYLVSJ/%/+JU6J%B<8 $?_L.(?P5?6U'"<6+& M&CK\EXMB /XAF1\'VL729<4<]=-P,'DF at PTVR 00+IAF*&&*L at UH8=ZL ;B M:L#9P!I HVVX88<501_R=4.7>$=%M59YV0"S1! MQA(3R'.&,JN5=YZ3^[!@0PXQL$>+"S"X(E]\6VZY0 at KY+652@7^DD0PS?2 3 M BY^J-+29CL]&*=1P)'XH5P 4:E"#+I=F"*&:TA(H8> 3KC&G7ZJR.$+-[#8 MJ(H=+N1P M at PP5OB +#%AB:0I\+IR 'YBI5':9+VBH.92Q-MTJ9YRRC>B;;XW&$*VT>E*K MVYY[^OE"M(YZ*.&AB&YX[82,WD"N#8QR>^)IRJ1A:6(>?521$*=^:JJIA2 R M" 8?8,!!OQA\?7*[**[-\0ZPMPUSNN>8R&L/*-J.<<@Y22DDNRR4S MVB=I9;8+H*7Q?*<08M0 M375#>-WU0>M8.X3?UO\I(R'88;L**]EETS"R;PX_?"66LA#CX)R at 99BSM(=: MJ*C_7)W1":GUSW);N;+[[[L>2$O92< MO_S\AJ6IT R[N^12H&+QNNYULVM= 5X at JO5;@4$N9$R8L JWAUL!CS0 0YB M18/@40 at X#IN!VI"W&3E5CS5S,(2;H(Q.&?WKGV0:SD@$P_8"-KM114C\(\S5) # MMLSP22S(P00I:,&=8?!%:8,-&60P35*-\DQ,K ME6)\Z$M!%OO8*L"TSP4P<9$.#5>S;S$C?QC3'X+8!"95_R at Q!2> 2%\<$<5> MJ:) 5;1B#7;G1W[,8 ==]&(.:'"X#Y&,3H(:'(O6:"T]20N..)@E+7-0P<.A MJT25TQ7YY,/'3P(SF&X 9/APV)M&N7(TSFC&F=1T&94PY9$*]%)$)GE)*0YH M&;EQF2>%68I.5/: (-AU!ZT7&FM6-(2!^2^7 MWMPG/^=@0T$>TTXG.A--X"0,E4 at S/TI["J5BM@![JZG<@S"SDFO #C*2T28L*]C-E^J@!^&4:T;'R50*+NZIAZN@ M7NV9U5[^Q:N"':R3QB=(0I8H0JGQWE&,X0?(?$0QQ8)6I8\+#C[?2MC3HM8MXXO&HR#EF at A]!J=]L%1C)$L3RKYQJ%P-I5Q[ M*U<> +>NP!WE:/]:OM0B-[EA&]\,6 2@X6ON>P4Z&T4N4Q>]$\FN)WE#B[;SQQX-YSD%"_YR'O> M_P+85:O_G=F$>GB_TQPK-R5]XPZ("M,:A-<&Q at UL@"ML80 at R5ZK8TAB"Y39? M'.P@!T5UZ85+;.(LRJ<%\[O!AND&O;JA:#0+IJ\.3'OB&^/8PN%33ZQ(&"WH M10^6;Z2O?7-LY"/_-[V*8[&/J40EN:1LECIH,)*K;.7SLJ %BL,!B[ML4I!J MSW I%6>-KVSF,Y\VRV.;Y0UNV5'%D3.C148SG>O,S\",+;1.U1Q>IXQ4&]@Y MT(+>9_CR#%K%(=J6H!7G..<\Z$=#6L!:UC.EISSE<,X at TIK>M(#]4>E%,[H' M at .8TJ4O=ECQ\>LI+E:L.'&WJ5\,: +ZC-*/%*==,QSK7NHZ2AI[MN@/?BEC7 MPH[U#$);UU^SVM7#7O:@?;?14".[![AF-K4U[0((USK:_K>P"[B*[S/T> F.)+QVUL=M('@"L]QL>6Z[X5#_,3-57;$*V[QBV,\XQJ/=! #L@ end From aahz at netcom.com Thu Feb 10 13:25:17 2000 From: aahz at netcom.com (Aahz Maruch) Date: 10 Feb 2000 18:25:17 GMT Subject: Redirect DOS command output References: <87ura9$ib0$1@nnrp1.deja.com> Message-ID: <87uvqd$ntq$1@nntp6.atl.mindspring.net> In article <87ura9$ib0$1 at nnrp1.deja.com>, wrote: > >Hey, I'm using os.system() to execute a DOS command (on an NT machine). >I would like to capture (and parse) the output from the command. I'm >familiar with sys.stout but I'm not sure how to do this. You either need to redirect the output to a file (e.g. os.system("foo > bar") ) or capture the output directly: os.popen("foo") Note that os.popen() is known to have some problems on Win9x (for more info see the Python FAQ). -- --- 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 Nostalgia just ain't what it used to be From bjorn at roguewave.com Tue Feb 22 12:32:01 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 22 Feb 2000 10:32:01 -0700 Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <88tkob$jqd$1@nnrp1.deja.com> <38B2910B.A0AD14C3@bellatlantic.net> <88ub7v$376$1@nnrp1.deja.com> Message-ID: <38B2C811.25D01A87@roguewave.com> ndev42 at my-deja.com wrote: > [suggesting Tkinter interface to all other GUI toolkits similar to > what's been done in Piddle and the DB-SIG] > > I'm sure there are nasty side-effects to that. Ideas? There are only two obvious ones, (i) you'd have to start by defining a Tkinter interface, including semantics, that is independent of Tcl/Tk; and (ii) since not all GUI toolkits would support all of the new "Tkinter" interface, many users would end up having to program to a 'lowest-common-denominator'. Personally, I think this would be a "good thing" for Python, and for GUI toolkits that allready have Python bindings, a first approximation (though not trivial) would be relatively easy to prototype... -- bjorn From moshez at math.huji.ac.il Mon Feb 14 06:51:55 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 13:51:55 +0200 (IST) Subject: dictionary implementation In-Reply-To: <38A7E74D.F5DDF2EF@obop.com.pl> Message-ID: On Mon, 14 Feb 2000, [iso-8859-1] Przemys?aw G. [iso-8859-1] Gawro?ski wrote: > I was wondering what algorithm is used for the standard dictionary in > python ? > Maybe some one currently online knows ? Open hashing based on a primitive polynomial over Z/2 -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From chuckra at icon.co.za Sun Feb 27 03:56:02 2000 From: chuckra at icon.co.za (Charles Marais) Date: Sun, 27 Feb 2000 10:56:02 +0200 Subject: PythonWin and auto completion Message-ID: <38b8e877$0$35291@helios.is.co.za> Hi All I've just installed python on a NT box (I'm new to python), and can't get the auto completion features (mentioned in Mark's book on p52-53) to work. Neither attribute expansion, nor call tips, nor autocompletion seems to work. What am I missing ? Please email. Thanks! -- ====================== Charles Marais chuckra at icon.co.za Mobile +27-82-890-1664 Phone +27 21 786 1644 ====================== From nielsenjf at my-deja.com Tue Feb 8 19:57:30 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Wed, 09 Feb 2000 00:57:30 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> Message-ID: <87qe1n$ds5$1@nnrp1.deja.com> You're probably not using 'SetValue' in order to set session/application values. For example, Session.SetValue('userID', userid) sets the value for the userID (obviously). The general format is: Session.SetValue(the_key,the_value) john In article <87q726$8ir$1 at nnrp1.deja.com>, rchowd1 at my-deja.com wrote: > How do we handle sessions in python (server side) ? > > Could you please explain with a simple example with a form (client-side) > and python (server-side). > > Thanks. > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From stevep at weck.brokersys.com Thu Feb 3 23:41:26 2000 From: stevep at weck.brokersys.com (Steven Pauly) Date: 4 Feb 2000 04:41:26 GMT Subject: Metakit Install hints? Message-ID: <87dl9m$1pvl$1@news.hal-pc.org> Hi, Hope someone can help. I want to play with the database capabilities of metakit. I downloaded mk-i586-pc-linux-gnu.tar.gz, untarred it into ~/pyth/mk-i586-pc-linux-gnu The README under UNIX does not seem to have any relation to what I am seeing in the mk-i586-pc-linux-gnu directory. No .configure executable, no INSTALL. What I really need is a short rundown on how to get metakit working with Python 1.5.2 No big dissertation needed. Environment is SuSE Linux 6.3 2.2.14 Intel tia steve. ps At first, I did not like no {...}, etc. No I really really like the way python starts and ends blocks. And I want case-sensitivity left alone. -- Steven Pauly (281) 496-8041 (steve.pauly at glm.com) Global Marine Drilling Co. / Houston / Tx / 77079 stevep at brokersys.com / stevep at bash.linux-shell.net From cbbrowne at news.hex.net Tue Feb 8 20:14:23 2000 From: cbbrowne at news.hex.net (Christopher Browne) Date: Wed, 09 Feb 2000 01:14:23 GMT Subject: OFFTOPIC (Was: Re: mail filter in python?) References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207170156.A3609@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> <20000207203644.B4977@stopcontact.palga.uucp> Message-ID: Centuries ago, Nostradamus foresaw a time when Gerrit Holl would say: >Thomas Wouters wrote on 949942343: >> On Mon, Feb 07, 2000 at 05:01:56PM +0100, Gerrit Holl wrote: >> > File locking isn't hard to implement, what kind of security checks do you >> > mean? Python is portable so that's not a problem. >> >> File locking _is_ hard to implement, in a portable, secure, race-proof >> manner. flock()/lockf()/O_EXCL are the easiest ways of locking, but are not >> very portable, and are likely not to work on some filesystems (like NFS). >> Also, some NFS servers and clients do their best to do NFS locking in a >> secure way, but most do not succeed, or succeed at the cost of stability and >> speed. > >Oh, sorry. I thought you could just create a file called ".filename.lock" >and remove it when you're ready, in a try: ... finally: ... clause? You might want to look into the protocol used by qmail, known as "maildir." "maildir is a structure for directories of incoming mail messages. It solves the reliability problems that plague mbox files and mh folders." See also Note that Postfix and UW imap are other mail systems that support it; there appears to be a patched version of procmail that supports maildir; . -- Everyone has a photographic memory, some don't have film. cbbrowne at hex.net- From phd at phd.russ.ru Mon Feb 28 05:15:24 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 28 Feb 2000 10:15:24 +0000 (GMT) Subject: Mail attachments In-Reply-To: <20000227214536.3558.qmail@nwcst283.netaddress.usa.net> Message-ID: On 27 Feb 2000, Def P wrote: > I am trying to figure out how to read and interpret email attachments. I > looked into mimetools.py and mimify.py, but don't really understand how they > work. Say I have a message with multiple files attached, can I use some > library function to determine where the attachments start and end, and/or to > extract those parts? Or do I have to look for certain tags myself? Goto http://sun.med.ru/~phd/Software/Python/misc.html and download extract_mime.tgz. There you'll find an example and some docs. Just feed a MIME message into the program... Mirrors: http://members.xoom.com/phd2/Software/Python/ Broytmann http://www.fortunecity.com/skyscraper/unix/797/Software/Python/ Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From n8gray at earthlink.net Thu Feb 3 13:31:43 2000 From: n8gray at earthlink.net (Nathaniel Gray) Date: Thu, 03 Feb 2000 18:31:43 GMT Subject: re AMTE thread re DrScheme & Python References: <002401bf6e2c$5f1bb150$f0c809c0@lslp7o.lsl.co.uk> Message-ID: <3899C9D4.F8002223@earthlink.net> I can hear it now: "Thanks to Dr. Scheme, we're all up against the WALL OF SCIENCE." -- 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 effbot at telia.com Mon Feb 21 13:40:55 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 18:40:55 GMT Subject: None & Ellipsis References: <20000218214032.A8179@stopcontact.palga.uucp> <20000218225110.A9409@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > For sequence unpacking: > > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > >>> t1, t2, None, t4, t5, None, None, t8, None = t > >>> None > 'i' > > I want to use None to say "ignore this". how about using "none" instead? or "nil", "dummy", "foo", "x", etc ;-) (also see my other post) From bittneph at aston.ac.uk Fri Feb 11 10:59:42 2000 From: bittneph at aston.ac.uk (Peter Bittner) Date: Fri, 11 Feb 2000 15:59:42 +0000 Subject: Two question from a newbie Message-ID: <38A431EE.5A7B2B1@aston.ac.uk> I've got two simple questions: 1.) How do I implement ORs and ANDs in an if-statment? - e.g. I'd like to have this C-code in Python: if (x.mode == "view" || x.mode == "modify") myMode = x.mode; 2.) What does str(...) do? (I've already posted this, sorry!) I've seen print '....' + str(text) + '...' in some code (in a function definition). What does this 'str(...)' really do? - Is it absolutely necessary?? Please, e-mail! Peter | Peter H. Bittner | International Student at Aston University | e-mail: bittneph at aston.ac.uk | web: http://beam.to/bimbo +-------------------------- From nikolai.kirsebom at siemens.no Thu Feb 3 07:25:52 2000 From: nikolai.kirsebom at siemens.no (Nikolai Kirsebom) Date: Thu, 03 Feb 2000 12:25:52 GMT Subject: PythonWin debugger / interactive window Message-ID: <389972a2.7610072@news.mch.sni.de> Environemnt: PythonWin: Does anyone know how the debugger command buttons (next, step into, go etc) are available in the interactive debugger window (programatically) ? I would like to write something like (where debugger.step() is a command to the debugger) in the interactive window: for i in range(10): debugger.step() Nikolai Kirsebom From niels at endea.demon.nl Wed Feb 23 08:12:49 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Wed, 23 Feb 2000 14:12:49 +0100 Subject: Reducing Python's memory footprint? References: <38B3AA6A.C85FA919@wolfpack2000.com> Message-ID: <38B3DCD1.985C738F@endea.demon.nl> Joel Hatch schreef: > Using five megs to load a Python interpreter is a little excessive, but > acceptable. Blowing a half of my available RAM on a handful of nifty > panel applets and a monitor or two just doesn't work, though... If it takes 5MB to run a single process, that doesn't mean you need 50MB to run 10 processes. All (or most) of the executable code (the interpreter, C modules etc.) is shared between these processes, so running 10 of them may take only 6MB or so, depending mostly on the amount of memory used to store data. -- Niels Diepeveen Endea automatisering From rbill at visi.com Sat Feb 19 14:38:23 2000 From: rbill at visi.com (Robert W. Bill) Date: Sat, 19 Feb 2000 13:38:23 -0600 Subject: dynamically extend classes Message-ID: <3.0.6.32.20000219133823.007d8100@mail.visi.com> >Matt wrote: >Is there a way to dynamically extend classes in Python? > >I'd like to be able to have sitecustomize.py import a module >and add methods to a class so that later, when anohter modules >imports this module and uses the class it sees the added methods. Matt, This is something I would like to do better myself- that is if you mean run-time code generation and metaprogramming. It has been often useful to have a program write a module and load it, but I have never wrote to a file that is currently a loaded module, closed the file and did a reload. It seems sensible though. This does bring up a question of mine though. MetaClasses? This type of situation is where MetaClasses are useful, according to my meager understanding. IBM SOMobjects made sense to me in this type of situation, DTS C++ was somewhat in my grasp some time ago, but I have not had much luck with this in Python yet. Yes, I've read the 'Killer Joke' essay and related postings, but I still find it extremely difficult to do in Python (I am admittedly dense in the Python arena though). Is it possible that a MetaClass type (maybe I just mean keyword, or syntax- I dunno) would help? Has anyone made such a type? Has anyone pursued MetaClasses beyond "Eiffel.py" and found them useful? Is a MetaClass type needed to successfully use mixins? (in multi-inderitance- I thought mixins were optionally- even decided at run-time- added classes that impart a behavior or quality to a subclass. I apologize to you object gurus if I'm way off :). I also crave metaclasses for object proxies, distributed persistence, method dispatch, as well as the trace and pre/post tools that Guido has provided. Most people posting here are so far beyond me in understanding objects that I realize I may be way off track. So please feel free to let me know how far off! Which of you object greats use metaclasses? Is my understanding of them way off? In real-life designs, are they impractical? Thank you in advance for any clarification. From daniels at mindspring.com Wed Feb 16 19:52:03 2000 From: daniels at mindspring.com (Alan Daniels) Date: 17 Feb 2000 00:52:03 GMT Subject: String question References: <88ev6m$cun$1@news.uit.no> Message-ID: On Wed, 16 Feb 2000 20:59:38 +0100, the infinitely wise Runar Olsen (runaro at stud.cs.uit.no) spoke forth to us, saying... [snip] >I want the variable 'string' to be a string and not a list.. >>>> n =10 >>>> string = "n = ", n >>>> print string >('n = ', 10) > >I want string to be "n = 10". How? By having that comma in there, right after "n = ", you're telling Python that you want "string" to be a tuple, not a string. Properly, what you want is: x = "n = " + str(n) or, x = "n = %d" % n Note I'm naming the variable x here, because "string" is a standard Python module, hence having a variable with the same name is a bad idea (even though its allowed). Read the Python docs on tuples for a better idea of what your code is doing. -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From avv at quasar.ipa.nw.ru Thu Feb 24 17:52:57 2000 From: avv at quasar.ipa.nw.ru (Alexander V. Voinov) Date: Thu, 24 Feb 2000 14:52:57 -0800 Subject: nested functions Message-ID: <38B5B649.B0DFB374@quasar.ipa.nw.ru> Hi, Please remind me, if there are any performance penalties in nesting functions like this: def f1(): .... def f2(x) .... y = f2(x) or one should follow the C style? (Definition of f2 in _not_ in a loop, of course) Thank you in advance Alexander From gerrit.holl at pobox.com Fri Feb 18 15:33:09 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 21:33:09 +0100 Subject: name-spaces and loading a file In-Reply-To: <38AD44E2.637FBFF7@austin.ibm.com>; from dfavor@austin.ibm.com on Fri, Feb 18, 2000 at 07:10:58AM -0600 References: <8766vn2ijn.fsf@curious.eyeofdog.com> <88in3m$r0f$1@nntp6.atl.mindspring.net> <38AD44E2.637FBFF7@austin.ibm.com> Message-ID: <20000218213309.A8102@stopcontact.palga.uucp> David R. Favor wrote on 950854258: ... > Do you mean that within each $scene class all methods pass a dictionary | Eeeeeeeks! -- cat: /home/gerrit/.signature: No such quote or joke From kohler at cms.tecmath.de Fri Feb 4 04:25:58 2000 From: kohler at cms.tecmath.de (Markus Kohler) Date: Fri, 4 Feb 2000 09:25:58 -0000 Subject: Problem with sequence Message-ID: <71D456DBB922D111B79C00A024B95F6308CC08@tmpc06.medien.tecmath.de> Hi, when using the following idl I get into trouble when using the type sequence. Actually it seems that the (un)marshalling code gets a zero pointer exception. It works when I use sequence( see the code I commented out). I'm using fnorb 1.01 on Windows NT (precompiled). module UserManagement { interface TMA_UMService { struct principal { string name; }; typedef sequence encryptedRequest; typedef sequence encryptedSessionKey; typedef sequence encryptedTicket; //typedef sequence encryptedRequest; //typedef sequence encryptedSessionKey; //typedef sequence encryptedTicket; struct answer { encryptedSessionKey key; encryptedTicket ticket; }; exception AccessViolation { string message; }; answer login(in principal aPrincipal, in encryptedRequest anEncryptedRequest) raises (AccessViolation) ; }; }; Regards, Markus From bwarsaw at cnri.reston.va.us Wed Feb 16 19:19:52 2000 From: bwarsaw at cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 16 Feb 2000 19:19:52 -0500 (EST) Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> Message-ID: <14507.16040.591126.119029@anthem.cnri.reston.va.us> >>>>> "FL" == Fredrik Lundh writes: FL> lazyness? Exactly right. They weren't coded as C in stropmodule.c so they didn't make it in the first go 'round of string methods. I think we later decided that they weren't used enough to care about. Note that JPython's string objects don't have these methods either. -Barry From mwh21 at cam.ac.uk Fri Feb 4 04:48:49 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 04 Feb 2000 09:48:49 +0000 Subject: Executing external programs with vars References: <949656797.2089988259@news.sheltonbbs.com> Message-ID: Mike Partin writes: > Hi, I'm relativly new to python as a language, I started trying to > pick it up to implement a shell script I have done for helping with > CVS use. I'm not having problems executing external programs per > say, it's that I'm having problems executing them and including > variables. For example, when updating a cvs module I set my variable > TempVar with raw_input() then when I exec cvs I need it to be in the > form "cvs -z3 co TempVar" but can't seem to get this to work. Any > help would be appreciated. Hmm, I feel like I'm attempting telepathy, but is this what you want? def hopefully_help_mike(): module = raw_input("Enter module to check out: ") os.system("cvs -z3 co %s"%module) HTH, Michael From jstok at bluedog.apana.org.au Thu Feb 3 06:11:20 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Thu, 3 Feb 2000 22:11:20 +1100 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> Message-ID: <5ddm4.17487$3b6.72083@ozemail.com.au> James Logajan wrote in message <3899026C.7FD4481E at Lugoj.Com>... >Neel Krishnaswami wrote: >> Apply Neil Schemenauer's patches that convinces Python to use the >> Boehm garbage collector, or just live with the garbage, if your >> program is relatively short-lived. You can find his patch at: >> >> http://www.acs.ucalgary.ca/~nascheme/python/gc.html >> >> Manually freeing memory is ugly and error-prone. Don't do it. :) > >The vast majority of code (and programming languages) in the world require >explicit memory de-allocation. I don't believe that a GC scheme has yet been >invented that will work well for all problem domains. I'm sure if it had, >we'd all be using it by now. ;) First of all we should distinguish language from implementations of languages, but in this case the line is a little blurry. LISP, Smalltalk, Java, Delphi and Eiffel implementations all use garbage collection as a standard techniqure. More pertinantly, I don't *want* to manually manage object deallocation in my application, and manual memory management is the kind of low level process I expect a scripting language to protect me from. I definitely think the Python interpreter should have a standard garbage collection mode, if only as an option. From iti01362 at mweb.co.za Mon Feb 7 13:24:58 2000 From: iti01362 at mweb.co.za (iti01362 at mweb.co.za) Date: Mon, 7 Feb 2000 20:24:58 +0200 Subject: Database for storing heterogeneous "message" objects References: Message-ID: <389f0a1d.0@news1.mweb.co.za> Jason Stokes wrote in message news:I4qn4.20005$3b6.85771 at ozemail.com.au... > I want to use a database to store sets of heterogeneous "message" objects, > which currently cover email and news messages, but will be extended more > generally to include messages in web-accessible archives and other > "email-like" things. Queries can be made on a message database based on > their header properties. > > The Python standard relational database API doesn't quite fit this domain > because the structure of such a database isn't quite tabular. Sounds like you need to use XML rather? Why bother with a relational database? Mario Marais From breiter at usf.Uni-Osnabrueck.DE Mon Feb 28 14:38:54 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 28 Feb 2000 19:38:54 GMT Subject: Mac OS X threads References: <88unfq$4jn$1@solaris.cc.vt.edu> Message-ID: <89eise$cin$2@newsserver.rrzn.uni-hannover.de> [Posted and mailed] In article <88unfq$4jn$1 at solaris.cc.vt.edu>, "John Deighan" writes: > I was able to compile Python under Mac OS X. However, when I tried to > install Zope (www.zope.org), it said that it needed Python with thread > support. When I tried to recompile Python with thread support (using > "configure --with-threads), it failed because it couldn't link to 3 > thread-related functions. Can anyone help? It would certainly help, if you stated the missing functions or the error message to the readers in the newsgroup. Bernhard -- Free Software Projects and Consulting (intevation.net) Association for a Free Informational Infrastructure (ffii.org) From boud at rempt.xs4all.nl Wed Feb 23 14:38:33 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 23 Feb 2000 19:38:33 GMT Subject: PyQT,PyKDE failure: References: Message-ID: <891cvp$m13$1@news1.xs4all.nl> Warren Postma wrote: > I tried to install some RPMs for PyQT and PyKDE and got the following error > on my system. I had to install PyKDE using the following command because it > didn't recognize PyQT as being installed on my system: > rpm --upgrade --force --nodeps PyKDE* > It was saying PyKDE requird PyQT but when I typed "rpm -q PyQT" it returned > the correct version of PyQT as installed. > Has anyone else got PyQT working, and what RPMs did you install? > [i am using Red Hat Linux 6.1] Did you install sip? I haven't got any experience with the RPM's, since I tend to grab the sources, compile & install them (first sip, then qt, then kde), but you might ask on the PyKDE mailing list (http://mats.gmd.de/mailman/listinfo/pykde), or, if your problems persist, ask the author directly: http://www.river-bank.demon.co.uk/software/ has the correct email address. -- Boudewijn Rempt | http://www.valdyas.org From meh9 at cornell.edu Tue Feb 29 11:16:01 2000 From: meh9 at cornell.edu (Matthew Hirsch) Date: Tue, 29 Feb 2000 11:16:01 -0500 Subject: Linear Algebra and Python Message-ID: Hi All, I'm looking for a module or a set of functions that does linear algebra, things like inverses, multiplication, eigenvalues, etc.. Do you know where I can find this? Thanks for your help, Matt From davidw at prosa.it Sat Feb 12 02:49:24 2000 From: davidw at prosa.it (David N. Welton) Date: 11 Feb 2000 23:49:24 -0800 Subject: ruby AND python References: Message-ID: <874sbej1x7.fsf@freddy.page.street> "Robert Hicks" writes: > I just read an interesting article about how the Ruby language is > gaining in popularity (specially in Japan). I found it interesting > because it had a direct comparison (several times) with Python. How > will this language affect Python? Will it drive quality and > innovation? I hope so! What do you think? Lua and Elastic (www.elasticworld.org) are another two that are worth checking out. Ciao, -- David N. Welton -+- davidw at prosa.it -+- http://www.efn.org/~davidw From fdrake at acm.org Mon Feb 21 13:55:45 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 21 Feb 2000 13:55:45 -0500 (EST) Subject: Which GUI? In-Reply-To: References: Message-ID: <14513.35377.353913.763784@weyr.cnri.reston.va.us> Moshe Zadka writes: > Because PyGTK doesn't work on Win32 (relevant to a month ago when I > checked) The port has been done, but I don't know if the sources have been merged. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From aahz at netcom.com Thu Feb 17 10:44:20 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 15:44:20 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: <001601bf7853$6b03e7e0$b7a0143f@tim> Message-ID: <88h50k$mt2$1@nntp6.atl.mindspring.net> In article <001601bf7853$6b03e7e0$b7a0143f at tim>, Tim Peters wrote: > >This gets really involved really fast, and without a precise model >of computation to build on, discussing relative power is a trap. >*Generally* speaking, coroutines can be implemented via continuations, >but not vice versa (continuations are more powerful); but continuations >and threads can each be implemented via the other (but have vastly >different pragmatics, which is why Christian worked so hard on >Stackless); so if threads are more familiar, rephrase your question >to ask whether having threads can make some things much easier to >do. "Of course", and the same for continuations. Raw threads and >raw continuations are exceedingly difficult to use correctly, though, >so Python offers the higher-level threading.py to make thread life >easier, and continuations in Scheme are usually used "under the >covers" to implement an easier-to-use abstraction (like coroutines, or >backtracking search, or ...). Okay, now I'm starting to get this (be very, very frightened). Now, can you (or someone) provide an equally simple explanation of the differences between continuations and threads? Given that we already have threads (sort of), what is the attraction of continuations? Is it easier to write continuations than simulate threads on an unthreaded OS? -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From nascheme at enme.ucalgary.ca Sat Feb 12 14:45:57 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Sat, 12 Feb 2000 19:45:57 GMT Subject: OT: Celebrating Python References: <38A5AAB4.5F56B3A0@digicool.com> Message-ID: Paul Everitt wrote: >I was a bit surprised -- I didn't think it was _six_ years ago! Time flys when your having fun. :) Neil -- "Reliability means never having to say you're sorry." -- D. J. Bernstein From tim_one at email.msn.com Mon Feb 14 22:22:12 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 14 Feb 2000 22:22:12 -0500 Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] In-Reply-To: Message-ID: <000c01bf7763$d9ba5c00$66a2143f@tim> [Tim] > Python's tuple notation was inherited from ABC. Python generalized it > somewhat, but didn't fiddle. [/F] > otoh, the ABC quick reference at > http://www.cwi.nl/~steven/abc/qr.html > uses: > > {1; 2; 3} That's an ABC list, though. Guido didn't adopt ABC's notation for lists, and I'm glad -- I never liked the semicolons *or* the curlies there. I take it on faith that this notation survived user testing, from which I can only conclude that the users that day were a bunch of dope-smoking Dutch . Python's tuples were called "compounds" in ABC, and used the familiar comma notation. Python's a, b = 1, 2 really wouldn't work as a; b = 1; 2 (indeed, that means something entirely different in Python today). In ABC that was spelled PUT 1, 2 IN a, b There was no indexing of compounds; the only way to break one apart was via multiple-target binding, with exactly as many targets as the compound had "fields". Curious: The quote above used {1; 2; 3} as an example, and that's not a 1-in-6 accident . In ABC, that's exactly the same as the list {3; 2; 1} and the ones corresponding to the other four permutations of the elements. ABC lists "auto-sorted", whether you wanted them to or not. This is one of the ways in which ABC's uncompromising friendliness to raw newbies drove experienced programmers nuts. python-could-have-turned-out-a-lot-stranger-ly y'rs - tim From a.eyre at optichrome.com Mon Feb 21 12:55:02 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 21 Feb 2000 17:55:02 -0000 Subject: rcp Message-ID: <001001bf7c94$c71ffe70$3acbd9c2@peridot.optichrome.com> Has anyone seen any code which can do the equivalent of the Unix command 'rcp', *without* using the command itself. I need to use this on NT as well. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From effbot at telia.com Wed Feb 9 18:01:38 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 23:01:38 GMT Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> <389A3E61.47E255A0@home.com> <38A1E664.3CEAF4BF@be-research.ucsd.edu> Message-ID: Curtis Jensen wrote: > Would it be possible to include a history ability into the Python > interpretor? Something simmilar to the BASH shell, or doskey in DOS. > Up-Arrow prints the previous command. I think this would be a great new > feature. in fact, this is a great old feature (or maybe just GvR playing with his time machine ;-) see: http://www.python.org/doc/current/tut/node13.html From pinard at iro.umontreal.ca Mon Feb 7 20:21:17 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 07 Feb 2000 20:21:17 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: fcahoon@my-deja.com's message of "Tue, 08 Feb 2000 00:04:45 GMT" References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: fcahoon at my-deja.com writes: > Different tab conventions have been used in different places in the > codebase, and sometimes tabs have been converted to spaces incorrectly > as well -- leaving a horrible mess. Fortunately it is easy to fix this > with a pretty-printing program (I use "M-x indent-region" in emacs). > That is because the information required to fix the indentation _is > present in the file_. Best might be to consider that TABs should just plain not be used when writing Python. Python could even be modified to consider that a mix of spaces and TABs is a syntactical error. Should allow TABs only, however, for people limiting themselves to this use. In my opinion, that would quickly eradicate the problem at the source: people mixing TABs and spaces would be warned immediately, and we would soon stop discussing the matter. In the meantime, fix your editor and tools so they do not generate TABs. It might be as simple as that, you know! :-) No mess, no problem. > So now I'm getting scared that Python will become _status quo_ and > we will soon all have to live with the consequences of this perilous > design decision. The design decision is good, and in my case, very much welcome. Editors may be lacking. Use good editors, and configure them appropriately. You will be giving yourself a treat anyway by doing so! :-) > For this I suggest the comments #{ and #} because they are concise, > look like C/Java/Perl, and can be put on the same line as the first/last > statements (obviating the "it takes an extra line" objection I have read > elsewhere in this thread). You could surely do that, for the time it would take to tame yourself that they are good, safe ways to never have problems. Once there, these extra > comments could easily be removed :-). > While I'm sure this will strike many of you as a bunch of gratuitous > flamage, I really am only trying to promote reasoned discussion, honest. Of course. You are very welcome. Problems sometimes go from monstrous to innocuous, when we take the time to spell them out, and share about them. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From aahz at netcom.com Thu Feb 10 20:16:24 2000 From: aahz at netcom.com (Aahz Maruch) Date: 11 Feb 2000 01:16:24 GMT Subject: Python and Samba References: <38A33CA3.CD301863@kpnqwest.no> Message-ID: <87vnt8$voa$1@nntp6.atl.mindspring.net> In article <38A33CA3.CD301863 at kpnqwest.no>, Stein M. Eliassen wrote: > >I wonder if there is a way to use samba services from python? > >What I would like to do is browse shares from Python code. >Now I have to mount the share in a script before running the my python >code. Hmmmm... I'm doing some WAGing here, but it seems to me that the fundamental problem is that you really need to have a UNC and/or Win32 environment in order to browse Samba shares. If you were running Python on NT, this wouldn't be an issue, I think. So the fundamental problem isn't a Samba library per se, but the SMB client for Unix. Put that way, you might be able to find something a little easier. -- --- 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 Nostalgia just ain't what it used to be From ullrich at math.okstate.edu Sat Feb 12 13:12:55 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Sat, 12 Feb 2000 12:12:55 -0600 Subject: range(start,stop) References: <38A478A4.532D73F5@mail.dotcom.fr> Message-ID: <38A5A2A7.C429BF61@math.okstate.edu> You ask for replies from experts. I think the point is that those darned experts are gonna get the stuff right regardless - for non-experts like me it fits in with everything else very nicely. In my limited experience I find that in Python I avoid off-by-one errors by not worrying about them. Now if I could just get the whitespace issues straight... 'ly, DU Stephane BAUSSON wrote: > Hello > > Just a question for a Python expert ... > What the interest for the range function to stop at stop-1 and not at > stop ? > For me it does not feel natural to write .... > > Thank you > > -- > Stephane BAUSSON > Email: Stephane.Bausson at mail.dotcom.fr From anthonydelorenzo at my-deja.com Fri Feb 4 14:08:57 2000 From: anthonydelorenzo at my-deja.com (anthonydelorenzo at my-deja.com) Date: Fri, 04 Feb 2000 19:08:57 GMT Subject: Python XML processing of RSS files Message-ID: <87f843$k4u$1@nnrp1.deja.com> I'm working on adding a newsfeed via RSS (rich site summary) files, which are in XML. I've used Pyxie to parse the files and output them as HTML, which seems to work fine, except that any character entities (eg ") screw up the character data for that element. Is there a better way to do this? If not, how can I make Pyxie work properly with character elements? I did find a link to a library called rssclient, but the server is down. If someone knows where I can get a copy, I'm sure that whoever wrote the thing is better at this stuff than I am. --- Anthony DeLorenzo Whitehorse, YT, Canada mailto:drgonzo at canada.com Sent via Deja.com http://www.deja.com/ Before you buy. From b2blink at hotmail.com Wed Feb 2 15:38:33 2000 From: b2blink at hotmail.com (Ulf Engstrøm) Date: Wed, 02 Feb 2000 15:38:33 CET Subject: strftime and windows Message-ID: <20000202143833.78130.qmail@hotmail.com> Don't know how you format your dates or what you use the mxDateTime for, but the strftime works fine on my windows (2000,98,NT,Millenium). >>>import time >>>time.strftime('%Y-%m-%d',time.localtime(time.time())) '2000-02-02' If there's something special you have problems with, specify and I'll try to help >Hi all, > >I have some really nice code that uses the mxDateTime and strftime to >produce lovely formatted dates. I just discovered that it won't work on >a Win box. Am I missing something, or do I actually have to write a >function to format my dates? ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From sabren at manifestation.com Mon Feb 14 11:47:21 2000 From: sabren at manifestation.com (Michal Wallace) Date: Mon, 14 Feb 2000 11:47:21 -0500 Subject: CGI/HTML forms in a standalone application. References: Message-ID: <889bjo$9s$1@nntp9.atl.mindspring.net> Moshe Zadka wrote in message ... >On Mon, 14 Feb 2000 bayinnaung at my-deja.com wrote: > >> that can also be used as a non-web/standalone application >> on a single/PC. > >You can derive a class from SimpleHTTPRequestHandler, copy some code from >CGIHTTPRequestHandler and come up with a class >CGILikePythonFunctionHTTPRequestHandler Yes! And you can also use the little web browser built into wxWindows (or perhaps Grail?) to display the HTML you generate! -Michal http://www.sabren.com/ From matz at netlab.co.jp Mon Feb 21 23:08:13 2000 From: matz at netlab.co.jp (Yukihiro Matsumoto) Date: 22 Feb 2000 13:08:13 +0900 Subject: Cool things about Ruby on the way out of Python? References: <38B205AE.666D1AA2@mincom.com> Message-ID: <874sb1j2vm.fsf@ev.netlab.co.jp> Hi, John Farrell writes: |IMHO, if we could get around the syntax problems, map/each and lambda |could be used to write beautiful programs. I think the reason that |lambda doesn't really work in Python is because it can only return |values, and hence doesn't do what you might want it to all the time. |Map also doesn't work because it is such a fundamental concept that it |needs to be syntax (hence list comprehensions), and once you make it |into a function it's harder to see what it does. Some points in Python which I don't like are too essential to remove from the language (e.g. block by indentation), but I think the following can be solved in the future version (P3K maybe?). * type, class distinction * statemant, expression distinction * restricted iteration by `for', using index and `__getitem__' |Ruby looks cute. If I was a Perl user I might be tempted to go to it. |In the mean time, I will stick with Python, and pine for the long days |by the fjords spent writing Miranda. You don't have to throw away Python at all. But just visit and play with us sometime. :-) matz. From jamarijr at hotmail.com Wed Feb 16 14:15:36 2000 From: jamarijr at hotmail.com (Arinte) Date: Wed, 16 Feb 2000 19:15:36 GMT Subject: Image operation Message-ID: <88et0i$n24$1@nnrp1.deja.com> How can I use python to open + manipulate a .bmp or .jpg file. I looked at the imageop in the documentation, but wasn't sure how to use it. I am interested in the scaling and dithering functions they have. TIA Sent via Deja.com http://www.deja.com/ Before you buy. From nobooze4u at SPLAT!worldnet.att.net Sat Feb 12 13:54:57 2000 From: nobooze4u at SPLAT!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 18:54:57 GMT Subject: Pike seems good. A Q though. References: <200002112329.SAA01742@seanb.sttln1.wa.home.com> Message-ID: <50ip4.6464$UP1.149900@bgtnsc05-news.ops.worldnet.att.net> x-no-archive: yes seanb at home.com wrote: > A good place to look for Pike info is the Pike homepage, > http://pike.idonex.se Listen, a quick follow up: this site in .se is nearly always unaccessible, and when it is up it's slow like you won't believe it. I can't even peruse it, much less download something from there. Q: Is there a mirror somewhere closer you know of, or that's the only place? The language seems good. From gbl at iitb.fhg.de Wed Feb 2 09:56:11 2000 From: gbl at iitb.fhg.de (Carsten Gaebler) Date: Wed, 02 Feb 2000 15:56:11 +0100 Subject: poplib: problem deleting mails References: <38982CC7.3ED89559@iitb.fhg.de> <20000202152449.A840@stopcontact.palga.uucp> Message-ID: <3898458B.337C1708@iitb.fhg.de> Gerrit Holl wrote: > > The POP3 object's dele() function doesn't delete messages that > > have a "Status: O" line in the header. Is that a bug? > > Not in Python. It must be your server. Neither the RFC nor the Python > module says anything about it. Must be Python because Netscape can delete those messages - on the same server. Regards, Carsten. From vijaybaliga at hotmail.com Mon Feb 21 14:27:12 2000 From: vijaybaliga at hotmail.com (Vijay Baliga) Date: Mon, 21 Feb 2000 11:27:12 -0800 Subject: Running a Python program on a machine where Python isn't installed Message-ID: <88s3im$f1a@news.dns.microsoft.com> Hi, Suppose that I write a Python program using Tkinter and other packages/modules. What would I have to do in order to run it on a machine that didn't have Python, Tk/Tcl, etc installed? Is it even possible? I don't mind distributing a small number of files. Thanks in advance for any help, Vijay Baliga vijaybaliga at hotmail.com From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:45:46 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:45:46 -0500 Subject: thanks for the help !!!!...any tips for how to best learn python?!!! References: Message-ID: Collin: In an article posted Fri, 25 Feb 2000 19:12:41 -0700, Collin Greene (greene at hctc.com) said: > any tips to help me newbie # 1 get started at prgramming in python, thanks > any help is appreaceated!!:) greene at hctc.com You could try http://www.python.org/psa/bookstore/ and then take your pick of the fine choices available there. -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From ivanlan at callware.com Wed Feb 9 12:09:51 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 09 Feb 2000 10:09:51 -0700 Subject: Const and the Zen of the Pythonista References: Message-ID: <38A19F5F.6066C6E9@callware.com> Hi All-- Warren Postma wrote: > > I had a Zen like breakthrough today. Or maybe not. > [snip] > Today, I realized the obvious. [snip] > Am I > finally getting it or have I merely become a language-lawyer overnight? > You have snatched the pebble from our hands; it is time for you to leave, Grasshopper. > Sigh no more, ladies, sigh no more, > Men were deceivers ever,-- > One foot in sea and one on shore, > To one thing constant never. > Why do you bob your hair, girls, You're doin' might wrong. God says it is a glory, and you should wear it long. So before you bob your hair, girls, Please stop and think a while. > Much-ado-about-nothing'ly-yr's > -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 dan at cgsoftware.com Thu Feb 17 14:22:44 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Thu, 17 Feb 2000 11:22:44 -0800 (PST) Subject: two questions In-Reply-To: <38AC4092.57B477CA@roguewave.com> Message-ID: > > Isn't Mac OS X just NeXTStep (ie. Mach 3 + BSD) with some Macintosh bits > thrown in? > > Mac-didn't-use-to-be-Mach'ly y'rs > --bjorn > > It's actually FreeBSD+Mach with a GUI on top. --Dan From effbot at telia.com Mon Feb 21 13:03:46 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 18:03:46 GMT Subject: PIL Problem: New image is all black on Unix? References: <38B02B50.482854B7@cs.rit.edu> Message-ID: <66fs4.200$y3.185368576@newsb.telia.net> Thomas & Jennifer Thompson wrote: > I'm running Python v1.5.2 on Solaris 5.7 with PIL v1.0. When I create a > new image of type "1' and size xy with either white or black pixels, > the image comes out black in both cases. So: > > >>> import Image > >>> raw=Image.new("1", (20,20), 0xFF) > > returns a black image which I expect to be white. untested workaround: raw=Image.new("1", (20,20), -1) > These commands work fine on my Win95 system (Python > v1.5.1, PIL v1.0b1). Is this a known bug with PIL and Solaris > and will using the latest version of PIL for Solaris fix this? wait, first you said "1.0", and then you said "1.0b1". this is a known bug, but I'm 95% sure it was fixed in the 1.0 release: http://www.pythonware.com/downloads.htm#pil From aahz at netcom.com Fri Feb 11 00:30:08 2000 From: aahz at netcom.com (Aahz Maruch) Date: 11 Feb 2000 05:30:08 GMT Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] References: <000601bf7382$c3009040$8e2d153f@tim> Message-ID: <8806p0$8u7$1@nntp6.atl.mindspring.net> In article <000601bf7382$c3009040$8e2d153f at tim>, Tim Peters wrote: > >and-get-those-ugly-colons-out-of-smalltalk-ly y'rs - tim Here's an interesting question that I don't think I've seen here: given that the semicolon is not a significant character in Python, why wasn't it chosen as the tuple creator? Would make it a lot easier to do, say, def foo(bar): print bar foo(a;b;c) -- --- 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 Nostalgia just ain't what it used to be From effbot at telia.com Wed Feb 9 08:24:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 13:24:21 GMT Subject: make BSD No such file or directory Error code 1 References: <87rekg02lfv@enews4.newsguy.com> Message-ID: <9Udo4.3108$dT4.203808256@newsb.telia.net> wes wrote: > Trying to install Python152 on a ISP virtual server based on BSDI. Did a > 'tar' into the '/tmp' directory, then './configure' and then 'make' and was > going well until I got a 'no such file or directory error': > gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ > ./importdl.c > ./importdl.c:269: mach-o/dyld.h: No such file or directory > *** Error code 1 it's official declared as a mystery; some hints (but no verified solutions) can be found in the "support archive": http://www.deja.com/=dnc/getdoc.xp?AN=538161754 http://www.deja.com/=dnc/getdoc.xp?AN=481431817 please post back if you manage to solve this! From thamelry at vub.ac.be Tue Feb 8 04:30:34 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 8 Feb 2000 09:30:34 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> Message-ID: <87onnq$p2i$2@mach.vub.ac.be> Paul Prescod wrote: : While you are promoting Ruby, also consider Corbascript, Pike, Lua, : Guile and Squeak. You'd better cover your bases! Python is certainly a very powerfull language with many virtues, but I also think that its popularity at least partly is due to the "butterly flapping its wing effect". This is true for almost any language for that matter (take e.g. C++ and objective C). You mention Squeak. If Squeak continues to mature I think it will be a formidable competitor for python. At the moment, it lacks the huge amount of modules that are available for python (which is one the most attractive features of the language). Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From wjk at wjk.mv.com Mon Feb 21 00:54:53 2000 From: wjk at wjk.mv.com (Wm. King) Date: Mon, 21 Feb 2000 00:54:53 -0500 Subject: Which GUI? References: Message-ID: <38B0D328.4826761B@wjk.mv.com> As a newbie, I guess I must have taken a left turn somewhere at the signpost that said "Select GUI here"..... I use Tcl/Tk as front end for lots of stuff... ("Yikes" I said that-- hmmm It's all about layers isn't it....?) like Python, Shell and other prgms, though the rendering of widgets varies from MAC and PC to Xwindows etc. It suits my purpose - though I have to change sizes of things now and then. Third party widgets are available and can be added to one's repertoire... I think Zope didn't bother using Tk simply for the same rendering issues or possibly because of the limited number of widgets ... Tkinter is very kewl as well... The only reason I can do stuff fairly well with Tkinter is because I mess with Tcl/Tk a lot and I like Tkinter as much especially while I am learning Python. With JPython or Java you can get a different look and feel with AWT/Swing. The other P language ("Yuch") has Tk which I tried to use but found more troublesome than it was worth so I can't say anymore for it. I am not familiar with other GUI stuff for Python but have gotten a small education while reading this GUI thread. There are a lot of other widgets etc. available for Tcl/Tk than for Python me thinks...--- maybe check out BLT . I am sure the other Python gurus can point you in some good directions. Good luck in finding what you need..... From gerrit.holl at pobox.com Wed Feb 16 16:38:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 22:38:12 +0100 Subject: PROPOSAL: PlatformError for platform depentent errors Message-ID: <20000216223812.A4617@stopcontact.palga.uucp> Hello, what about creating a new exception, PlatformError, which may be raised by modules when things aren't possible because of the platform? regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From tim_one at email.msn.com Sun Feb 20 17:50:38 2000 From: tim_one at email.msn.com (tim_one at email.msn.com) Date: Sun, 20 Feb 2000 22:50:38 GMT Subject: Test (ignore): Python mailing list may be down Message-ID: <88pr3t$54$1@nnrp1.deja.com> >From my POV, mail to python-list at python.org may have been broken all weekend. testing-from-dejanews-ly y'rs - tim Sent via Deja.com http://www.deja.com/ Before you buy. From fdrake at acm.org Thu Feb 17 12:14:35 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 Feb 2000 12:14:35 -0500 (EST) Subject: Where is Imaging.h? In-Reply-To: References: Message-ID: <14508.11387.761765.788240@weyr.cnri.reston.va.us> Bernhard Herzog writes: > I think this is a good opportunity to suggest that extension modules > that users may want to access at the C-level install the relevant header > files somewhere under Python's standard include directory. I propose to > put them into an "extensions" subdirectory. I think this would be a good idea. There are actually two Python include directories, one for $prefix and one for $exec_prefix; extensions would have to "do the right thing" here. Greg Ward, I presume you've already thought of this and distutils supports it? ;-) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From deathbed_tech at usa.net Sat Feb 12 21:08:52 2000 From: deathbed_tech at usa.net (R. O'Neil) Date: Sat, 12 Feb 2000 21:08:52 -0500 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38A5DEB7.E1B018AC@rubic.com> Message-ID: <38a610d2@news.isc.rit.edu> Wow that's nice. Is that something that's standard for the language or is it just a nice feature in the most common interpreters? Regards, Ryan O'Neil Jeff Bauer wrote: > The great thing about Python for recovering C++-a-holics > is that your don't *have* to give up your precious > semi-colons! Feel free to append end-of-line ;'s to > your heart's content. > > The hard part comes when switching back to Java or > C, and forgetting to add the obligatory decorative > punctuation. > > -and-if-paul-prescod's-string.rstrip()-2nd-argument- > ever-pans-out-you'll-have-an-easy-way-to-remove-the- > semicolon-training-wheels-off-your-early-python-code-ly yr's, > > Jeff Bauer > Rubicon Research > From claudius at catlover.com Wed Feb 2 16:37:57 2000 From: claudius at catlover.com (claudius at catlover.com) Date: Wed, 02 Feb 2000 21:37:57 GMT Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> <878j9k$vpe$2@thoth.cts.com> <389822FF.DDFF265A@electricorb.com> <3898771C.934A73A1@prescod.net> Message-ID: Paul Prescod says: >If the IDE normalizes case for you, what's the problem? > >One of Visual Basic's great features is that the IDE helps you *a lot* >to get things right. It is perfect for newbies. Python's case >sensitivity would not be a problem if there was an IDE that detected >when you had misused case and corrected it for you (...this probably >requires type annotation....) > >Maybe the CP4E *debugger* should detect case sensitivity problems at >runtime and should just "fix up" the source code. I much prefer the MS Word spellchecker paradigm, underline the word(s) that are "offending" and offer up some suggestions. It teaches better coding in the long run and is much easier to code (since it doesn't need to be 100% accurate, the user can always tell the editor to ignore and the feature can be turned off.) From effbot at telia.com Mon Feb 14 14:29:37 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 19:29:37 GMT Subject: Python sucks loud References: <1261567534-40235659@hypernet.com> Message-ID: Gordon McMillan wrote: > We are wondering, since Python obviously violates all your > preferences, why you're still around. you already know the answer to that, of course. (in addition, he's already been killfiled by everyone in Perl land ;-) btw, the eff-bot thinks this is an excellent time to end this thread. new python url coming soon. film at eleven. From michael.stroeder at inka.de Thu Feb 10 04:09:41 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 10 Feb 2000 10:09:41 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> Message-ID: <38A28055.D8F187EB@inka.de> tye4 wrote: > > Listed below, from worst to best block delimiter schemes found in languages. > > Pascal. Score: 2/10. Pascal is my most favorite lang... however, hate those > 'begins' - they create double indentation as shown below. This bug was fixed > in future incarnations of Pascal, e.g. Ada Pascal is your most favorite lang and you don't mention Modula? > Ada. Score 10/10 > No redundant 'begin' or '{'. Visible indicator of end of a block > > if foo then > bar; > stool; > end if => Modula. Score 10/10 if foo then bar; stool; else nobar; end; Ciao, Michael. From gerrit.holl at pobox.com Tue Feb 22 16:40:57 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 22:40:57 +0100 Subject: Which GUI? In-Reply-To: ; from effbot@telia.com on Mon, Feb 21, 2000 at 06:24:09PM +0000 References: <20000220194012.A2069@stopcontact.palga.uucp> Message-ID: <20000222224057.G4549@stopcontact.palga.uucp> > > The reason you named is the only valid reason I heared for keeping > > Tkinter so far. > > huh? so the books, the support, the existing code > base, the portability, the company backing, plus the > whole tcl/tk universe, doesn't count as "valid reasons". They don't - please see below. ~~~~~~ > and you think you're capable of putting together an > *unbiased* gui comparision? Yes, I do. > look, I've been programming user interfaces for 20 years. > if you wanna impress me, stick to facts. * WxPython is built so close on top of wxWindows, that all wxWindows features are directly inherited. It's not needed to write wxPython books, because a small tutorial is enough to use wxWindows docs and advantages. You do not need to know C++. * Tkinter is built on Tcl/Tk, but because the bridge between Tkinter and Tcl/Tk is too large, Tkinter needs to provide their own documentation and advantages. Short summary: * WxPython uses existing code. * Tkinter reinvents the wheel. That's why I strongly prefer wxPython. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From robin at jessikat.demon.co.uk Fri Feb 18 07:01:56 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 18 Feb 2000 12:01:56 +0000 Subject: tkinter + stubs Message-ID: <9qnJpBA0STr4Ew0D@jessikat.demon.co.uk> having just had to recompile _tkinter for the third time in the last year I would like to make a plea to Guido to allow export of the dynamic load code in the future python16.dll. My reasoning is this; if stubs are ever to be used with _tkinter the steps to be carried out are determine suitable tcl/tk dynamic libraries. find and call Tcl_CreateInterp () to get an initial interpreter find and call Tcl_InitStubs(interp,version,0) find and call Tk_InitStubs(interp,version,0) to do this easily would mean duplicating all the dynamic loading code. However, if we could avoid always using the "init" prefix then we get the dynamic load almost for free if the entry points are exported. -- Robin Becker From aahz at netcom.com Sun Feb 13 18:30:17 2000 From: aahz at netcom.com (Aahz Maruch) Date: 13 Feb 2000 23:30:17 GMT Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> <8873ag$r5e$1@nntp6.atl.mindspring.net> Message-ID: <887eq9$430$1@nntp6.atl.mindspring.net> In article , Fredrik Lundh wrote: >Aahz Maruch wrote: >> >> Oh, I think I see: the argument is that "foo (" instead of "foo(" >> makes "foo" look like a statement? I don't buy it. >> >> In any event, I have no rules other than whatever makes the code easiest >> to read. > >same here. my eyes just hate those extraneous spaces ;-) Fair enough. Actually, I do have a rule, although it's a bit fuzzy: put a space around all punctuation unless the punctuation and the identifiers around it can be easily perceived as a single unit. >(didn't you just mention Smalltalk? maybe this differs between C >programmers and Smalltalk/Lisp programmers? after all, adding spaces >between an identifier and the following argument list can actually >break a C program...) Actually, I think of myself at root as a Pascal programmer (despite learning BASIC first), which probably explains much of my extreme comfort with Python. Note that AFAIK, the C idiom you refer to only happens with macros in #define; I rarely use those. I've never done any significant LISP/Smalltalk programming. -- --- 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 Have you coined a word today? From skip at mojam.com Fri Feb 11 15:53:52 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 11 Feb 2000 14:53:52 -0600 (CST) Subject: How do you undo x = `a` if A is a list? In-Reply-To: References: Message-ID: <14500.30432.712305.442266@beluga.mojam.com> Warren> Let's suppose I have a list A: Warren> a = [ "first", "second", "third" ] Warren> And I want to save to a text file on disk the following Exactly Warren> into myfile.txt. I looked at Pickle, but "human readable" is Warren> not one of Pickle's features. Warren, Check out the eval and execfile builtin functions and the exec statement in the docs. One or more of them will do what you want... Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From tjreedy at udel.edu Thu Feb 24 03:19:09 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 03:19:09 -0500 Subject: functional programming References: Message-ID: <892p3i$2qp$1@news.udel.edu> "Jason Stokes" wrote in message news:oDSs4.32316$3b6.155642 at ozemail.com.au... > This example exploits lazy evaluation. Since Python is strict, like most > procedural languages, it isn't possible to produce this in Python. If I understand what you are saying, its fairly easy: write a class that memoizes computed answers in a list and extends the list as needed. Posted some time ago. TJ Reedy From wking at sheltonbbs.com Fri Feb 4 07:12:13 2000 From: wking at sheltonbbs.com (Mike Partin) Date: Fri, 4 Feb 2000 06:12:13 -0600 Subject: parsing text Message-ID: <949666439.1009585074@news.sheltonbbs.com> Hi again, I'm currently having a problem parsing text, reading it actually. I'm trying to read a config file in the form of name=value I'd need to search for name, and return value. If anyone has any code snippets that do nething like this I would appreciate it. From reic0024 at ub.d.umn.edu Mon Feb 28 15:26:37 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Mon, 28 Feb 2000 14:26:37 -0600 Subject: A comp.lang.python code snippet archive? In-Reply-To: <200002281844.TAA19752@dionysus.fw.cuci.nl> References: <200002281844.TAA19752@dionysus.fw.cuci.nl> Message-ID: On Mon, 28 Feb 2000, Hans Nowak wrote: > * if it's still worthwile to continue this site I use it. I haven't contributed, but I've found the site useful on more than one occasion to get a little starting point for this or that project. Thanks! Aaron From aahz at netcom.com Thu Feb 24 07:24:05 2000 From: aahz at netcom.com (Aahz Maruch) Date: 24 Feb 2000 12:24:05 GMT Subject: Best way to find unique items in a list References: <20000224.10515678@sparky.spkydomain> Message-ID: <8937t5$ehs$1@nntp6.atl.mindspring.net> In article <20000224.10515678 at sparky.spkydomain>, David Fisher wrote: >Here's a quickie. > >Def Unique(thelist): > uniquedict = {} > for i in thelist: > uniquedict[i] = 0 > return uniquedict.keys() > >Whether it's any faster i don't know. Yup. This is, in fact, the canonical Python idiom. Now, it's not *guaranteed* to be faster, but it's got close to O(N) time, whereas invoking sort() is likely to push O(NlogN) time. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From effbot at telia.com Sat Feb 12 04:52:26 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 09:52:26 GMT Subject: Where is glob ? References: <38A4483C.AE1A51F0@darmstadt.gmd.de> <38A43E31.F6530D17@rubic.com> <38A462AC.67FA47AF@darmstadt.gmd.de> <20000212141310.A798@bork> Message-ID: Egbert Bouwman wrote: > In Python 1.5.1 (debian slink) the command > >>> import glob > gives: > ImportError: No module named glob > However the module is mentioned in the library reference. > The same thing happens with fnmatch. > Is there any particular reason for these absences ? yes. your installation is broken. (look for glob.py and fnmatch.py. if they're not on the machine, complain to the debian maintainers) From travis at travis.aggievilla.org Thu Feb 17 22:18:12 2000 From: travis at travis.aggievilla.org (Travis B. Hartwell) Date: 17 Feb 2000 20:18:12 -0700 Subject: Miscellaneous design and Python use questions Message-ID: <87itzn19mz.fsf@travis.aggievilla.org> I have been a Python user for approximately four months now. I have come to really enjoy the strengths of this language and the great power that it has. But, as I have gained 'Python-mode' for my editor, I haven't quite gained a 'Python-mode' for my brain. So, alluding to that, I have a few questions regarding all things Python. I suppose my questions here are geared to Python as it is used in a large project -- more than a script of ~200 lines. 1) When I do a typical OO-design with C++, I pay a lot of attention to information hiding. I.E., I keep all of the data members private and rely on get/set functions to use them. I feel that this is a good practice. But, with Python, we don't have the access issue. I still believe that information hiding is a good idea. From the experienced Python developers, is it practice to use such functions within your classes? Or do you just access things directly? What are your thoughts on style regarding this? 2) I am planning using Python embedded in one of my applications -- using C++ Builder for the GUI development and speed-critical portions. For the rest, I would prefer to use Python just because I have become accustomed to its power. But, I have been having a few road-blocks in this plan for embedded Python. I guess I'm having a hard time visualizing exactly where to have the 'dividing line' between C++ and Python and in designing the interfaces between the two. What are some general hints in designing applications using Python as the engine and C++ as the front-end? I guess those are my only questions for now. Thanks for your help in advance! Travis B. Hartwell From martin at loewis.home.cs.tu-berlin.de Sun Feb 20 16:37:41 2000 From: martin at loewis.home.cs.tu-berlin.de (Martin v. Loewis) Date: Sun, 20 Feb 2000 22:37:41 +0100 Subject: Silly brackets (Was: Re: Problems extending Python with C.) In-Reply-To: (message from =?ISO-8859-1?Q?Fran=E7ois?= Pinard on 20 Feb 2000 12:18:09 -0500) References: <88ne3e$hcs$1@snipp.uninett.no> <200002201055.LAA00737@loewis.home.cs.tu-berlin.de> Message-ID: <200002202137.WAA01219@loewis.home.cs.tu-berlin.de> > I would not think it is a problem, as #define's all expand into one line, > and there is nothing to report about brackets which match on the same line. > Could you provide an example of pre-processor breaking user indentation? It depends on the exact rules you impose. Consider #define foo(x) x int main() { bar(); foo(4); } After preprocessor, I get # 1 "a.c" int main() { bar(); 4 ; } In the Python sense of indentation, the second line is not aligned with the previous one, so it is incorrectly indented. Suppose you'd implement such a feature: How exactly would you define 'correct indentation'? Probably you'd consider the position of the closing bracket. Must that be a) in the same column as the opening one? b) aligned with the keyword starting the block? Would you check anything else? I.e. what magic would find the often-quoted for (i=0;i<10;i++); printf("%d\n",i); Regards, Martin From fplancke at my-deja.com Wed Feb 16 13:34:20 2000 From: fplancke at my-deja.com (Frédéric van der Plancke) Date: Wed, 16 Feb 2000 18:34:20 GMT Subject: control of child process stdio Message-ID: <88eqjc$l42$1@nnrp1.deja.com> How to write a Python script that controls execution of console Windows/Unix programs (.exe), writing to / reading from them using their stdin/stdout ? (For my current problem simplified assumptions hold: the master script should spawn the program, send fixed-length data to it, wait for at most a given time, read fixed-length data from the program, then the program ends itself. This will be done several times in sequence.) More-or-less platform-independent solutions are preferred, but I mainly need a Windows solution... -- Frederic van der Plancke e-mail address: reverse and add dots etc. to: (avoid my Deja-News address as I seldom read my mail there...) Sent via Deja.com http://www.deja.com/ Before you buy. From pinard at iro.umontreal.ca Fri Feb 18 20:41:35 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 18 Feb 2000 20:41:35 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: Stuart Reynolds's message of "Fri, 18 Feb 2000 15:46:32 +0000" References: <38AD6958.19C3@cs.bham.ac.uk> Message-ID: Stuart Reynolds ?crit: > Save yourself from RSI [...] Hello, Stuart. RSI? What does this acronym stands for? > (local-set-key [f1] 'py-shell) I did: (global-set-key [f4] 'py-shell) instead, as it is often useful to call the Python interpreter for itself. > (global-set-key [f8] 'bury-buffer ) :-) The most useful one I have is surely: (global-set-key [f9] 'call-last-kbd-macro) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From psilva at ruido-visual.pt Thu Feb 10 07:53:38 2000 From: psilva at ruido-visual.pt (Pedro Silva) Date: Thu, 10 Feb 2000 12:53:38 -0000 Subject: Open script Message-ID: <000a01bf73c5$d9b48060$6c00a8c0@ruidovisual.pt> Hi, I'm trying to use OPEN to open a folder, because I need to get the content of that folder. This folder is in the filesystem. The code line that I'm using is: f = open('var/spool/news/articles','r') fs = f.realines() return fs But this is giving me and error. Is this correct or because articles is a folder and is because of that that the error is displayed. Please send me your answers to: psilva at ruido-visual.pt Thanks, Pedro -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim_one at email.msn.com Thu Feb 24 23:19:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 24 Feb 2000 23:19:29 -0500 Subject: nested functions In-Reply-To: Message-ID: <001301bf7f47$821e69a0$b62d153f@tim> [Alexander V. Voinov] > Please remind me, if there are any performance penalties in nesting > functions ... [Terry Reedy] > The definition of a nested function is re-executed everytime the outer > function is called. [Fran?ois Pinard] > I would guess that the penalty is quite insignificant. The function has > been compiled once and for all with the rest, and the `def' "execution" > is nothing a mere assignment of the function to a local variable. > Isn't it? Not quite that cheap, but it indeed isn't expensive. The *code* object "has been compiled once and for all", but a function object is layer of stuff around the code object, and that layer gets rebuilt each time a 'def' is executed. Look up the implementation of the MAKE_FUNCTION opcode in ceval.c for all the gory details. In brief, a function object has to be allocated, a pointer to the global namespace needs to be installed, and current bindings for optional arguments (if any) need to be captured. Example: adders = [] for i in range(10): def adder(j, i=i): return j + i adders.append(adder) print adders[0](10), adders[9](10) prints 10 19 Had a fresh function object not been constructed each time, the correct default value for the "i" argument could not have been captured. The code object capturing the body of "adder" was compiled only once, though, and is shared among all "adder" instances. All in all, it's probably about as expensive as creating (e.g.) two lists. also-probably-about-as-cheap-ly y'rs - tim From andrew at andrewcooke.free-online.co.uk Wed Feb 16 04:30:07 2000 From: andrew at andrewcooke.free-online.co.uk (Andrew Cooke) Date: Wed, 16 Feb 2000 09:30:07 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> <88bleg$chl$1@nnrp1.deja.com> <38A96FB1.E7DEA50@tismer.com> Message-ID: <88dqmp$u8n$1@nnrp1.deja.com> In article <38A96FB1.E7DEA50 at tismer.com>, Christian Tismer wrote: > Andrew Cooke wrote: [...] > > through some posts on Deja, but there was nothing recent that seemed to > > explain what a coroutine actually is - sorry if I've missed something > > obvious). > > What did you read, actually? > Here some pointers: > Homepage: http://www.tismer.com/research/stackless/ > IPC8 paper: http://www.tismer.com/research/stackless/spcpaper.htm I read this. If you read it yourself, trying to remember that once you did not know what coroutines were, I think you'll see that the text doesn't contain anything like "A coroutine is...". Coroutines aren't even mentioned in the contents. In turns out (after reading Tim P's code in another pointer you gave) that all I really wanted to see was something like "coroutines allow continuations to be used in parallel" or something similar (assuming I've got it right!). > Slides: http://www.tismer.com/research/stackless/spc-sheets.ppt > The latter gives you a bit of understanding what a continuation is. I'm afraid these are in some strange format. Thanks for the info - I'm sorry to waste your time but I do think that you're so deep into this you may not have realised that - coroutines are not explicitly defined, as far as I could see. - noddy examples, while they may give people the wrong impression about the power of the system, do let newbies understand what the basics are (I am sure coroutines are not the only concept in computing that is more powerful than a noddy example - I seem to be able to use those other concepts in deep ways despite being exposed to equivalent examples in my youth). > > Also, comp.lang.lisp is currently dissing continuations. Would that be > > because the alternative is to pass the code that will process the node > > into the iterator as a (first class) function? Obviously, in this case, > > yes, but is that true in general (are there examples where continuations > > or coroutines make something possible that really is tricky to do in > > other ways)? Answering my own question here - there is an obvious advantage in the iterator approach when iterating over several data structures in parallel. That's a trivial (now) counterexample to my suggestion (it struck me at the time that passing in a function or returning with from a coroutine were like mirror images of each other - parallel data shows how this breaks down). > An iterator is quite an easy thing, and it can be implemented > without continuations rather easily. Continuations cover problems > of another order of magnitude. It is due to too simple examples > that everybody thinks that coroutines and generators are the > only target. Continuations can express any kind of control flow, > and they can model iterators, coroutines and generators easily. > The opposite is not true! > > I know this isn't enough to convince you, but at the time I have > no chance. I need to build some very good demo applications > which use continuations without exposing them to the user, > and this is admittedly difficult. Maybe my post gave the impression that I was doubtful or needed convincing. I don't think either is true - I was simply curious. Thanks for all the info, Andrew PS Another point in favour of noddy examples - Tim's iterator finally made clear to me how a Prolog implementation worked in Lisp. Hardly a case of dumbing down.... Sent via Deja.com http://www.deja.com/ Before you buy. From pehr at pehr.net Wed Feb 23 23:04:03 2000 From: pehr at pehr.net (pehr anderson) Date: Thu, 24 Feb 2000 04:04:03 GMT Subject: Python port to PalmOS References: <38b3e042.7854561@news.i-cable.com> Message-ID: <38B4ADB1.927EA776@pehr.net> If you really want this to happen, feel free to contribute to the bounty! There are a lot of people who would benefit from pocket python. http://www.cosource.com/cgi-bin/cos.pl/wish/info/237 Add your comments & questions here if you'd like. -pehr Slowman wrote: > > Is there any available or in progress ? > Palm has Java and I like Palm to have Python too :-) ! From gmcm at hypernet.com Tue Feb 29 13:55:24 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 29 Feb 2000 13:55:24 -0500 Subject: More help with Object Caching In-Reply-To: Message-ID: <1260271971-31041452@hypernet.com> Brent Fulgham writes: > I've discovered that when I put one of my 'stringified' objects > into my Cache, they don't come back out. Take for example: > > // Note: 'code' is a valid PyCodeObject* > char* cacheable = PyMarshal_WriteObjectToString(code); > long size = PyObject_Length(code); > > // This works > PyObject* test1 = PyMarshal_ReadObjectFromString(cacheable, size); > PyCodeObject* codeTest1 = (PyCodeObject*)test1; > > // This fails > char* newCache = malloc(length*sizeof(char)); > strncpy(newCache, cacheable, size); > > PyObject* test2 = PyMarshal_ReadObjectFromString(newCache, size); > // Fails -- test2 is NULL. > > Can anyone suggest what I am doing wrong here? Thinking that a Python string (which can contain null bytes) can be copied like a C string? - Gordon From python-list at teleo.net Tue Feb 8 11:03:58 2000 From: python-list at teleo.net (Patrick Phalen) Date: Tue, 8 Feb 2000 08:03:58 -0800 Subject: Python-Fu for GIMP? In-Reply-To: <38A03990.998FF375@doc.ic.ac.uk> References: <38A03990.998FF375@doc.ic.ac.uk> Message-ID: <00020808062400.01078@quadra.teleo.net> [Anthony Mayer, on Tue, 08 Feb 2000] :: Has anyone done, or thought about, a Python-Fu scripting plugin for :: GIMP? Along the lines of the Perl-Fu one? Yes, someone has: http://www.daa.com/au/~james/pygimp/ From sk at nvg.ntnu.no Sun Feb 20 12:40:16 2000 From: sk at nvg.ntnu.no (Steinar Knutsen) Date: Sun, 20 Feb 2000 18:40:16 +0100 (CET) Subject: Silly brackets (Was: Re: Problems extending Python with C.) In-Reply-To: Message-ID: On 20 Feb 2000, Fran?ois Pinard wrote: > "Martin v. Loewis" writes: > > [Compiler warnings when code structure does match with structure > outlined by indentation. ] > > > That, of course, says nothing whether it would be desirable to have > > such a feature. I'm quite certain that you'd get *a lot* of warnings > > for most of today's code. > > Not mine! :-). Many people like to write neatly, you might be surprised. > Others do not have to use that feature, if they do not feel like it. Nor mine. :) This is a feature I'd really like. Well, perhaps a preprocessor that inserts brackets based on indentation would be even better. <.1 wink> -- Steinar From boud at rempt.xs4all.nl Thu Feb 24 03:12:38 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 24 Feb 2000 08:12:38 GMT Subject: OT - ][ (was Re: Killer Apps???) References: <14509.31078.932335.402705@beluga.mojam.com> <14509.46230.395460.200539@beluga.mojam.com> <38B4316B.F58893CB@sage.att.com> Message-ID: <892p5m$hr3$1@news1.xs4all.nl> Fran?ois Pinard wrote: > "Garrett G. Hodgson" writes: >> a long time ago, the game "star raiders" was the killer app for atari >> computers. > Apple ][ surely had Choplifter! Still a mystery to me how they could > engineer such a program on a 6502, with sound, real-time, and everything. > Amazing... > By the way, to stay in the mood, what would be best between Tkinter, > pygtk or wxPython, for reimplementing Choplifter in Python? :-) :-) PyQt obviously! It's not difficult to wrap the QwSpriteField class (although it isn't done yet), and then it's easy to write games with, er, sprites. Qt 2.1 has a nice canvas. What I wonder about is how you'd go about getting decent sound from a Python application. > And more seriously, is that game available in some form, nowadays, on > Linux say? For the full retro experience, try finding an emulator. -- Boudewijn Rempt | http://www.valdyas.org From mwh21 at cam.ac.uk Thu Feb 10 18:58:43 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 10 Feb 2000 23:58:43 +0000 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> <38A28055.D8F187EB@inka.de> <38A34199.BF367B98@americasm01.nt.com> <20000210181818.A3770@better.net> Message-ID: William Park writes: > Terminating a block with 'end..' like Bourne Shell is what I initially > expected from Python. But, indentation is okey too. > > Guido is not going to move on this issue. So, please kill this thread! Hmm, that's what I've been doing all along... M. From evan at 4-am.com Sun Feb 6 13:13:50 2000 From: evan at 4-am.com (Evan Simpson) Date: Sun, 6 Feb 2000 12:13:50 -0600 Subject: chdir questions References: Message-ID: Patrick K Moorman wrote in message news:Bmin4.4589$NS3.14557 at newsfeed.slurp.net... > I know this is must be an easy one but how do I use os.chdir? I have tried > many different ways of listing the path but no matter how I type it I get an > error. Most common is either: > > >>> os.chdir(C:\temp) > File "", line 1 > os.chdir(C:\temp) Is your previous experience coding with shell scripts or a language like Rebol? You will need to adjust some of your basic concepts for Python. In Python you need to put quotes around text which is not a keyword or a name for a Python object. Also, backslashes ('\') are used to "escape" the next character, so '\t' is a tab character. Fortunately, Python file functions accept forward-slashed filenames on all platforms. For the above you would write either: os.chdir('C:/temp') ...or... os.chdir("C:/temp") Cheers, Evan @ digicool From arne.vajhoej at gtech.com Thu Feb 17 03:55:16 2000 From: arne.vajhoej at gtech.com (Arne =?iso-8859-1?Q?Vajh=F8j?=) Date: Thu, 17 Feb 2000 09:55:16 +0100 Subject: VMS+Python+Oracle ? References: <88h097$4k0$1@nnrp1.deja.com> Message-ID: <38ABB774.5C9FA366@gtech.com> Forrest Cahoon wrote: > Has anyone gotten Python on VMS to talk to Oracle (also on VMS)? > > I found the page http://www.zope.org/Products/DCOracle/ where the Oracle > driver for Python lives, but there is no mention of VMS there. > > I'll eventually get around to trying it; but I was wondering if anyone > else has success/failure stories, things to watch out for, etc ... You can get Python for VMS. But I hav eno idea if that Oracle driver will work with Python on VMS. Why not try it ? Arne From dworkin at ccs.neu.edu Sun Feb 6 22:47:07 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 06 Feb 2000 22:47:07 -0500 Subject: CGI Scripts In-Reply-To: "Robert Rutkowski"'s message of "Sun, 06 Feb 2000 01:11:40 GMT" References: Message-ID: "Robert Rutkowski" writes: > My problem is that the script returns a result via the print command. {print > `count()`}, but when I try to run the script on my server, I get no results, > just a blank page. > count = open('counter.log', 'r+') Try giving the absolute path to the file instead of just the base filename. Chances are that the web server's current working directory when it executes the script is not the directory containing the file. -Justin From effbot at telia.com Thu Feb 17 12:33:07 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 17:33:07 GMT Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC150E.FA51B9E3@durham.ac.uk> Message-ID: J.C.Travers wrote: > > Tk the hardest GUI to code? not in my experience.. > > I meant in terms of Python GUI's you've tried them all? btw, it's "Tkinter". not "Tk". the former is an object-oriented Python interface to libtk. may- be you used the wrong library? From tim_one at email.msn.com Sun Feb 27 21:53:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 21:53:52 -0500 Subject: Traling junk in string.atof (RE: array constructor) In-Reply-To: Message-ID: <000f01bf8197$0c473020$f0a2143f@tim> [Tom Holroyd] > ... > While I'm here, string.atof() and float() both barf on "123.45," while the > C atof() doesn't. A quick check of the code (stropmodule.c) shows that > there is an explicit check for junk at the end of the string. Right. > Is there some reason for this besides just being annoying? :-) Yes, but simply because "123.45," does not match the syntax for "a number". The trailing comma may be harmless, or it may indicate your program has gotten lost, or that your data has gotten corrupted, or that your data was ill-formed to begin with. Python refuses to guess that it makes sense, because it has no way to *know*, and guessing "ya, OK" errs in the wrong direction (screws *you* the most). Python takes this attitude all over the place, btw -- string.atof is just one instance of it. I'm curious how you ended up with a numeric string with a trailing comma to begin with. For example, if you're reading lines of comma-separated values, the natural idiom is numbers = map(float, string.split(line, ",")) which gets rid of the commas explicitly. > I vote to remove it. I'll set up a web page to keep a running tally . better-careful-coding-than-endless-debugging-ly y'rs - tim From hellan at acm.org Sun Feb 27 15:43:24 2000 From: hellan at acm.org (Jon K Hellan) Date: 27 Feb 2000 21:43:24 +0100 Subject: Q about tail recursion References: <3.0.5.32.20000226013755.0087a180@mail.dicksonstreet.com> <3.0.5.32.20000227033824.00a06140@mail.dicksonstreet.com> Message-ID: <87ln46ml5f.fsf@parus.parus.no> Felix Thibault writes: > Well, then here's the real question on my mind that I've been too > embarassed to ask till now: > > Is there a Python version of this scheme function that has informative > variable names so I can figure out what it does ? > > Or just - what does this do: > > (define Y > (lambda (le) > ((lambda (f) (f f)) > (lambda (f) > (le (lambda (x) ((f f) x))))))) ? > > y'rs ly-unpythonic > Felix- It's the Y combinator in lambda calculus. You can read about it in e.g. "The Seasoned Schemer" by Daniel P. Friedman and Matthias Felleisen. The function you quoute may well be from that book. At hand-waving level, it's a device to turn a function into a recursive function. Don't ask me to reveal my level of ignorance by trying to explain further! Jon K?re From nobooze4u at SPLAT!worldnet.att.net Sat Feb 12 12:11:55 2000 From: nobooze4u at SPLAT!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 17:11:55 GMT Subject: Thanx and keep it coming. Or I'll flame some more ...(Re: Python sucks loud) References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> Message-ID: x-no-archive: yes Jason Stokes wrote: > > Forget it wrote in message ... > > >Speaking about C--I don't care for it to be C, actually C is not the > >best for me, but I'd like it to be interpreted, have types (user types a > >big nice-to-have), and objects. And the C-ish syntax, like in Perl, so I > >don't have to be undergo a major attitude adjustment every time I switch > >from one to another. > > Actually, it is often far easier to adapt to a syntax that is completely > different, than to one that is similar but subtly different. To much > "bleeding" of one domain into the other occurs if languages are too similar. That's true, but you know what? Somehow I really feel at ease with Perl (in that respect) and if it were about text, I wouldn't hesitate a second before using it. But I need something just a tad more procedural and with better types. Actually if perl allowed me to define structures, that'd be it. From moshez at math.huji.ac.il Sun Feb 13 11:36:16 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 13 Feb 2000 18:36:16 +0200 (IST) Subject: merging really huge lists fast In-Reply-To: <38A6E891.9494D59A@bibsyst.no> Message-ID: On Sun, 13 Feb 2000, thomas wrote: > Hi, > > I got huge lists I want to merge, but the good old new_list = list1 + > list2 seems to be slow. Any hints? Try list1.extend(list2) if you want in-place merging. no-other-good-ideas-ly y'rs, Z. PS .extend is a 1.5.2 addition. From tbryan at python.net Mon Feb 7 18:33:51 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 07 Feb 2000 18:33:51 -0500 Subject: arguments from the prompt References: Message-ID: <389F565F.E0AF7FD1@python.net> joe at localhost.localdomain wrote: > it says NameError: sys > #!/usr/bin/python > from sys import argv > > a=sys.argv[1] When you use 'from sys import argv', the symbol 'argv' is now available to your code directly. You no longer have to reference the module name. In fact, sys is *not* available after you run 'from sys import argv' just like it isn't available after you run 'from sys import *'. If you simply write 'import sys', then the symbol 'sys' is avialable, but 'argv' is only accessible through sys. So, either write from sys import argv a = argv[1] or import sys a = sys.argv[1] ---Tom From shayman at uniserve.com Thu Feb 24 20:42:52 2000 From: shayman at uniserve.com (Matthew) Date: Thu, 24 Feb 2000 17:42:52 -0800 Subject: 3D Message-ID: <951442983.600332@neptune.uniserve.ca> Wanted to mention - That Caligari's TrueSpace program has Python scripting extension as well as Blender another 3D multi platform animation program . Thats All. From effbot at telia.com Thu Feb 10 12:31:47 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 17:31:47 GMT Subject: Split string References: <001d01bf73e8$6db5c860$6c00a8c0@ruidovisual.pt> Message-ID: <7CCo4.308$Ph6.186579968@newsa.telia.net> Pedro Silva wrote: > I wnat to split a string that has be return by the filesystem > > The code that I'm using is: > > def obj_fs(self): > import os > listing=os.listdir("/var/spool/news/articles") > str=string.split(listing) > return str > > Is this correct? why not run the script, and find out for yourself? (hints: os.listdir returns a list of filenames. string.split takes a string as argument, and returns a list of substrings; by default, it splits on whitespace). maybe you should work through the tutorial before trying to write real stuff in Python? http://www.python.org/doc/current/tut/tut.html From ngps at madcap.dyn.ml.org Fri Feb 4 02:56:15 2000 From: ngps at madcap.dyn.ml.org (Ng Pheng Siong) Date: 4 Feb 2000 07:56:15 GMT Subject: fetch a html page via proxy? References: <387978ff.3083491@news.jps.net> <87cdfl$j60$1@nnrp1.deja.com> Message-ID: <389a861f.0@news.cyberway.com.sg> According to : > The best info I can tell you is to use the URLLIB module, and to set an > environment variable beforehand named "http_proxy" containing the > string "http://:/", which URLLIB will try to use > in getting out. (In fact, it looks for any environment variables named > _proxy and use it for that service -- ftp, gopher, http, etc.) Like this: http_proxy=http://proxy.my.company.com:8080/ -- Ng Pheng Siong * http://www.post1.com/home/ngps From gchiaramonte at ibl.bm Tue Feb 8 07:27:04 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Tue, 8 Feb 2000 08:27:04 -0400 Subject: const in Python In-Reply-To: Message-ID: I think this is a very important issue. Especially when you are distributing apps with python as an embedded scripting language. Case insensitivity and constants are two things I think are very necessary in a scripting language. Luckily, both can be enforced in the script editor. Gene > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Fredrik Lundh > Sent: Tuesday, February 08, 2000 6:05 AM > To: python-list at python.org > Subject: Re: const in Python > > > Anders M Eriksson wrote: > >> > If you are truly concerned, you could make them attributes of > >>> a class that prohibits setattr. But generally naming > > > > >Right, like this: > > > > > >class ReadOnly: > > > def __setattr__(self, name, value): > > > if self.__dict__.has_key(name): > > > raise TypeError, 'value is read only' > > > self.__dict__[name] = value > > > > > >>>> const = ReadOnly() > > >>>> const.x = 5 > > >>>> const.x = 9 > > >TypeError: value is read only > > > > Thank You! I love your class and it will from now be in every program > > I make. > > so you don't trust yourself enough to avoid overwrite > anything using a certain name convention (UPPERCASE > is pretty much standard in Python land), but are 100% > convinced you won't ever overwrite the 'const' variable? > > interesting ;-) > > > > > -- > http://www.python.org/mailman/listinfo/python-list From mjoyce at xilonen.co.uk Tue Feb 22 12:59:37 2000 From: mjoyce at xilonen.co.uk (Matthew Joyce) Date: Tue, 22 Feb 2000 17:59:37 GMT Subject: Baffling unpack() or read() problem...... References: <38b1c09a.24413312@news.globalnet.co.uk> <38B1C817.EF044566@python.net> <38B1D077.3FA0A317@python.net> Message-ID: <38b3ce31.93428937@news.globalnet.co.uk> Tom >> Isn't the default to open files in text mode? Yep, that's the problem. Thanks Matt From tothfile at freemail.hu Tue Feb 1 08:48:02 2000 From: tothfile at freemail.hu (Attila =?iso-8859-1?Q?Filet=F3th?=) Date: Tue, 01 Feb 2000 14:48:02 +0100 Subject: What is winfo_id() under Win32 References: <3890439A.1C1BA6D2@freemail.hu> <024e01bf6cb2$ea8e8350$f29b12c2@secret.pythonware.com> Message-ID: <3896E412.EE48215B@freemail.hu> Hi! > you should be able to use wm_frame() (aka frame()) to > get hold of the outer window: > > inner = w.winfo_id() > outer = string.atoi(w.wm_frame(), 0) Thank you, it works. BR, Attila From mikael at isy.liu.se Mon Feb 28 07:25:30 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 28 Feb 2000 13:25:30 +0100 (MET) Subject: self argument In-Reply-To: Message-ID: On 28-Feb-00 Gregoire Welraeds wrote: > In reply to the message of James Logajan sent on Feb 26 (see below) : > > In my newbiness ignorance, I'm asking what is the difference between t and > self.x. Aren't they both member of the class C ? > > > class C: > > def __init__(self, b): > > self.b = b > > self.x = self.y = 0 > > def Func(self, a): > > t = a * self.b > > self.x = t * 2 > > self.y = t + 2 No, t is a local variable in C.Func, while self.x refers to a member. Thus, if you have an instance c of class C, there will never be a c.t, but there is a c.b, a c.x, and a c.y. /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: 28-Feb-00 Time: 13:19:32 This message was sent by XF-Mail. ----------------------------------------------------------------------- From moshez at math.huji.ac.il Thu Feb 24 03:50:09 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 24 Feb 2000 10:50:09 +0200 (IST) Subject: functional programming In-Reply-To: <000401bf7e9b$348ab740$e42d153f@tim> Message-ID: On Thu, 24 Feb 2000, Tim Peters wrote: [Moshe Zadka,o Aahz] > Assuming we're still in "search of truth" mode, rather then "proving > I'm right" mode, I want to clarify my claim: *efficienct* functional > programming is, in general, impossible without tail-recursion. I don't > agree with the timbot that tail-recursion is contrary to the "Python > Way", but it's not in Python right now, anyway. > > Are we in agreement now? [The timbot, butting in ] > You and Aahz maybe, but now we've got a fight . There's nothing > un-Pythonic about recursion, tail or otherwise. It's tail-call > *optimization* that's un-Pythonic, as it's a gimmick supported by only a > handful of widely unused <0.5 wink> languages and surprising to people > coming from anything else: damaging tracebacks would be Major Badness, much > worse than the gain for the relative thimbleful of people who are > uncomfortable coding loops etc. The idiom "return f(something)" is used almost exclusively by this anal retentive bunch I'm proud to be part of . And I don't mind at all having Python do no optimization as long as I do not give the flag -believe-me-I-really-do-want-tail-call-optimization <0.5 wink> As this flag has very little semantic effect (after all, it is an optimization), I don't think there should be any problems with it, except two: 1. I don't care *enough* to write the patch 2. Guido probably won't like it disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From phd at phd.russ.ru Thu Feb 17 03:36:42 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 17 Feb 2000 08:36:42 +0000 (GMT) Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: Message-ID: On Wed, 16 Feb 2000, Fredrik Lundh wrote: > Oleg Broytmann wrote: > > I am not a lawer, but I don't see any problem here. SleepyCat's FAQ > > has clear statement (http://www.sleepycat.com/faq.html#A22): > > > > 22.Do I have to license Berkeley DB to use it in Perl or Python? > > > > No. The Berkeley DB license requires that software that uses Berkeley > > DB be freely redistributable. In the case of Perl or Python, that software > > is Perl or Python, and not your scripts. Any scripts you write are your > > property, including scripts that make use of Berkeley DB. None of the > Perl, > > Python or Berkeley DB licenses place any restrictions on what you may do > > with them. > > a real lawyer would probably read the *license* rather than > the FAQ ;-) Sure I read it! :) > -- and that license isn't fully compatible with the last sentence > in the FAQ entry. (looks more like LGPL to me: if you redistribute, > you need to provide sources for the database engine and the > interface code used in your application). No problem - provide BSDDB sources and Python sources. All are free and opensource! :) Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From bparsia at email.unc.edu Sun Feb 13 00:35:48 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Sun, 13 Feb 2000 00:35:48 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <1e5rfjz.9cxojz7w765jN%bparsia@email.unc.edu> Message-ID: <1e5wjvg.1purll3oiojgnN%bparsia@email.unc.edu> Fredrik Lundh wrote: > Bijan Parsia wrote: > > www.python.org is run by an organization which one *might* describe as > > an "industry group" > > I'm sure you can call him "barry", like the rest of us. Really? On a first post? That seems a touch presumptious of me :) I didn't mean to suggest that python.org was produced by a team of hundreds paid vast amounts with a multi-million dollar budget, merely that it was more or less the "offical" Python site (and has a "third person. And it certainly puts a good foot forward for the community. > > It's an attack, and an unfounded one, to suggest that the Smalltalk > > community "suppressed" knowledge of Smalltalk, yes. > > well, you obviously failed to convince the butterflies to > work for you... Not only did I fail to convince the buterflies to work for me I *completely* failed to understand this line ;) Cheers, Bijan Parsia. From morse at harborcom.net Fri Feb 4 08:56:56 2000 From: morse at harborcom.net (Kevin Dahlhausen) Date: Fri, 04 Feb 2000 13:56:56 GMT Subject: Python/Tkinter GUI builders? - spectcl2py.py.gz (0/1) References: <6D8A17398E28D3119F860090274DD7DB498484@pces.cadlab.it> Message-ID: <389ad9a3.235989895@news.oh.verio.com> >Does anybody knows of any other GUI Builder for TKInter? There is a GUI builder called Spec-TCL that I used once. Charles Waldman wrote the attached script that converts the Spec-TCL data file to Python. You can also search for something called specPython, which is a patch to Spec-TCL to generate Python code directly. From tim_one at email.msn.com Sun Feb 13 02:44:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 13 Feb 2000 02:44:52 -0500 Subject: Bit arrays. In-Reply-To: <87vvao$di4$1@nnrp1.deja.com> Message-ID: <000401bf75f6$364bb8c0$962d153f@tim> [posted & mailed] [rdudfield at my-deja.com] > Just wondering if there is an efficient way in python to represent > arrays or lists of bits? Not particularly. > The way that I am thinking of doing it is to make a class in python > and do the following: > > Have set and get methods for arbitary places in the array. > > It would store the data in an array of ints (not sure what size yet). By "array" you may mean either a Python list or an array from the std module "array". Both can be resized dynamically without trouble. lists are faster; arrays take less storage. > ... > The set method would be implemented in the following way: > > *Find which element in the array of ints that the bit is in. > *Convert that int into a tupple/list/array of 1s and 0s. > *Find which place in the new list of 1s, and 0s the bit which needs > changing. > *Change that bit. > *Convert the list back into a number. You can assume that a Python int contains at least 32 bits. So given a giant "bit index" i, the bit can be viewed as being bit number i & 0x1f # last five bits of int number i >> 5 Python's divmod can do both operations at once, so ... # set bit at bit index i intindex, bitnum = divmod(i, 32) # assuming self.data is either list or array self.data[intindex] = self.data[intindex] | (1 << bitnum) That is, it's really the same way you'd implement a bit vector in C or C++. > ... > It would probably be worth doing this as a module in c/c++ no? Depends entirely on how much speed you need. Definitely worth prototyping in Python first, though! If it turns out that you *really* need, e.g., many logical operations on bit vectors, you can easily switch to Python long (unbounded) ints, where setting a bit is just data = data | (1L << i) This takes time proportional to max(i, num_bits_in_data), though, while the array/list-based approach takes time independent of those. there's-more-than-one-slow-way-to-do-it-ly y'rs - tim From nick at spam_me_notvideosystem.co.uk Wed Feb 23 13:21:54 2000 From: nick at spam_me_notvideosystem.co.uk (Nick Trout) Date: Wed, 23 Feb 2000 18:21:54 -0000 Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> Message-ID: <38b422b6@news.xtml.co.uk> > Being totally new to Python and completely honest in saying that > I have no idea of what I'm doing, I had a few questions. Follow the tutorial, its easy and very good. Get some modules from www.python.org and look at the code. There are some very clever people out there. > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior. This would allow the level/content designers > to concentrate more on the game design side of things, since > behaviors would be outside of the main game engine. Is it > possible to have multiple scripts running at the same time? > Would this involve creating multiple interpreter objects? According > to the docs, this is possible but it isn't totally safe to do. > What would be a good strategy for this? Personally I wouldnt try and run multiple scripts. You could have an object base class for common functionality and properties (eg. position and orientation) which has a method tick(). All your game characters inherit from this and get updated once a frame by a scheduler which you have written. You have one Python state which all you scripts reside in. You could take the whole thing to the extent of writing the game code as a Python extension and controlling the whole thing from Python! eg. python script sets up game, frame loop consists of update characters and then call renderer. > My other question was one of performance. Is it crazy to have > ~10 different objects with each an individual script and hoping > the game will be running at 30 frames per second? The question might not be > valid, since I'm not sure how to implement it in the first > place. I dont think its crazy if you have fairly simple behaviour. An alternative language you might want to look at which is supposed to be quicker is Lua. Grim Fandango and supposedly Balders Gate use Lua amongst others. Its designed to be embedded. If I remember correctly someone has written a multistate/threading version of Python specifcally for writing games software. > And lastly, is it faster to call C functions in Python or vice-versa? Not sure this is relevant. All your time consuming code should be done in C. e.g.. collision, path calculation and called from Python. From pinard at iro.umontreal.ca Wed Feb 16 23:56:59 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 16 Feb 2000 23:56:59 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: Justin Sheehy's message of "16 Feb 2000 23:27:47 -0500" References: Message-ID: Justin Sheehy ?crit: > Fran?ois Pinard writes: > > When, in Emacs, I do not have `*Python*' window initialised, or more > > precisely, when there is no process running in that window, then `C-c C-c' > > in the window where is the Python source invariably fails the first time, > Whenever I start using python-mode, I do a `C-c !' to start the Python > interpreter. Subsequent invocations of `C-c C-c' or `C-c |' will use > that interpreter window. Thanks, it's neater. But yet, shouldn't `C-c C-c' just succeed? The user should ideally not be forced into that extra, introductory command. P.S. - By the way, `C-c C-c' is an unfortunate binding, even if quick to type. In the source window, it starts the Python interpreter, or at least, uses it. In the interpreter window, it raises a signal and kills it. So, if you just happen to forget to move the cursor to the proper window, you get contradictory behaviour, which is a bit irritating. And since those commands may also change the current window, errors are more likely than they should normally be. I'm not sure of what is best thing to do, but my feeling is that a change is needed, somewhere, to alleviate this. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From cpatti at black-racer.atg.com Fri Feb 4 11:57:04 2000 From: cpatti at black-racer.atg.com (chris patti) Date: 04 Feb 2000 11:57:04 -0500 Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> <873l7f$be4$1@mach.vub.ac.be> <874il7$jcf$1@nntp9.atl.mindspring.net> Message-ID: aahz at netcom.com (Aahz Maruch) writes: > In article <873l7f$be4$1 at mach.vub.ac.be>, > Thomas Hamelryck wrote: > > > >BTW, I don't think a python cookbook would make much sense. > >Python is so simple that in most cases you don't need to consult a > >book to find the solution. In most other cases, the currently available > >books suffice. > > I kind of agree with you; OTOH, if we want Python to be equal to Perl as > a sysadmin tool, there needs to be a cookbook so that someone who does > *not* know Python can use it. > -- > --- Aahz (@netcom.com) > IMNSHO Python doesn't _need_ a cookbook in the same way Perl does, but a cookbook would still be an invaluable resource. The deal is this: Perl's syntax is so flexible (and yes I'm being nice here, I"m coming from a Perl background.. I could use 'ambiguous' :) that there are TOO many choices for the novice such that doing simple things becomes difficult. Python has no such problem, and so in that sense a cookbook isn't strictly necessary. The _other_ and IMNSHO equally important reason for a cookbook however is a ready made cache of examples to draw from. Just being able to read experts code and see the idioms they choose is a huge boon to the beginning programmer. Just my $.02 -Chris -- ------------------------------------------------------------------ Chris Patti| \ Art Technology Group||617-386-1649 \ cpatti at atg.com ------------------------------------------------------------------ From robin at jessikat.demon.co.uk Tue Feb 1 09:20:13 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Tue, 1 Feb 2000 14:20:13 +0000 Subject: was Stackless 1.01 Homepage: another bug in stackless? References: <388BE68E.B26985CA@tismer.com> <$WXiIAAO+Dj4Ew2W@jessikat.demon.co.uk> <388C7D4A.D873AA@tismer.com> <388C9733.B4F60DC0@tismer.com> <7PUz+AAC6aj4Ewne@jessikat.demon.co.uk> <38947CE6.5ADEE391@tripoint.org> <3896C84B.8195845B@tismer.com> Message-ID: <+KfOlDAduul4EwXi@jessikat.demon.co.uk> In article <3896C84B.8195845B at tismer.com>, Christian Tismer writes > > >Shae Erisson wrote: >> >> >> >> I installed the stackless update on win95, and suddenly hitting the >> enter key in IDLE gives me two carriage returns. >> >> Any ideas? > >There was a try...finally bug, which is solved now. >When trying IDLE, I get the same behavior with and >without Stackless. >Maybe you should uninstall and try 1.02 ? > >ciao - chris.stackless > Hi it works ok with Zope now. What's ptools? Seems ptools.timing is needed for the generator demo. -- Robin Becker From effbot at telia.com Tue Feb 29 12:31:53 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 17:31:53 GMT Subject: String Search? References: <89gt3g$e5$1@nnrp1.deja.com> Message-ID: Jason wrote: > As a pre-note: Having just picked up Python, > please excuse my ignorance. umm. is that really a valid excuse for not having looked in the handbook? ;-) > How exactly do I search for a given string within > a string? i.e. how do I search for "foo" within > the sentence "the foo falls at midnight"? The > position of the string within the sentence isn't > important, just the existance. if string.find(mystring, "foo") >= 0: ... or string.index(mystring, "foo") ... the latter raises a ValueError exception if the substring isn't found. for more info, see the "string" chapter in the library reference. hope this helps! From robin at jessikat.demon.co.uk Thu Feb 24 05:00:00 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 24 Feb 2000 10:00:00 +0000 Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> Message-ID: In article , Moshe Zadka writes ... >As this flag has very little semantic effect (after all, it is an >optimization), I don't think there should be any problems with it, except >two: > >1. I don't care *enough* to write the patch >2. Guido probably won't like it > >disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. > >-- >Moshe Zadka . >INTERNET: Learn what you know. >Share what you don't. > > I think I agree with the tail recursion as an optional optimisation. -What about tail continuation-ly yrs- Robin Becker From michael.stroeder at inka.de Wed Feb 23 03:51:27 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Wed, 23 Feb 2000 09:51:27 +0100 Subject: Porting Python to non-pc platforms (AS/400) References: Message-ID: <38B39F8F.AD70695E@inka.de> Peter Sommerfeld wrote: > > Jay Graves wrote: > > >Its about $1200 for my machine. > > Big bucks :-( How about asking IBM for contributing a compiler for the AS/400 port? Ciao, Michael. From maxm at normik.dk Tue Feb 1 03:26:33 2000 From: maxm at normik.dk (maxm) Date: Tue, 1 Feb 2000 09:26:33 +0100 Subject: How do I create a new file? References: <875kjv$m8r$1@nnrp1.deja.com> Message-ID: <8765bq$lp3$1@news1.tele.dk> file = open("SomeFileName/somewhere.txt", "w") file.write("This is the content") file.close() wrote in message news:875kjv$m8r$1 at nnrp1.deja.com... > What code would I use if I wanted to create a new file in python? If > you could help me with this, I would be greatly appreciative. Thanks > again. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list > From cjensen at be-research.ucsd.edu Wed Feb 9 17:12:52 2000 From: cjensen at be-research.ucsd.edu (Curtis Jensen) Date: Wed, 09 Feb 2000 14:12:52 -0800 Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> <389A3E61.47E255A0@home.com> Message-ID: <38A1E664.3CEAF4BF@be-research.ucsd.edu> Mike Callahan wrote: > > Thanks for the info. I will look forward to the new features, especially > the string methods. > > Robin Dunn wrote: > > > > "Mike Callahan" wrote in message > > news:3898ABDB.86804799 at home.com... > > > I thought that a new Python was going to be released "soon" which would > > > make some minor changes to the language. The one thing that struck in my > > > mind is that one would call string methods rather than functions, ie. > > > astring.upper() vs. string.upper(astring). There were other changes as > > > well. > > > > > > > An alpha is scheduled to be released in March, with final release in the > > Summer. > > > > -- > > Robin Dunn > > Software Craftsman > > robin at AllDunn.com > > http://AllDunn.com/robin/ > > http://AllDunn.com/wxPython/ Check it out! Would it be possible to include a history ability into the Python interpretor? Something simmilar to the BASH shell, or doskey in DOS. Up-Arrow prints the previous command. I think this would be a great new feature. -- Curtis Jensen cjensen at be-research.ucsd.edu http://www-bioeng.ucsd.edu/~cjensen/ FAX (425) 740-1451 From tleen at razorfish.com Thu Feb 17 17:29:11 2000 From: tleen at razorfish.com (Thomas Leen) Date: Thu, 17 Feb 2000 17:29:11 -0500 Subject: mxDateTime and MySQLdb on RedHat 6.1 References: Message-ID: <38AC7637.9AFEF477@razorfish.com> Lenny Self wrote: > > Hello. I am having trouble compiling these to new modules on my RedHat 6.1 > Linux box. Below are the errors I am getting on each installation. > > *** mxDateTime *** [snip errors] > *** MySQLdb *** > [slice problems] I as well, and from the looks of it this type of problem has gone unanswered since late '99. Anybody been able to use mysql/python on redhat 6.1? Trying to do some cgi stuff myself and while Perl calls to me, I resist, but cant hold on forever. From moshez at math.huji.ac.il Tue Feb 22 02:51:08 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 09:51:08 +0200 (IST) Subject: Interactive programs through Popen3 In-Reply-To: <88sj8o$1cm$1@bob.news.rcn.net> Message-ID: On Mon, 21 Feb 2000, Z Three Penguin wrote: > Yes I am running Linux.Is there any way to give the read function a > timeout? Try the select module. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tseaver at starbase.neosoft.com Sun Feb 27 00:08:26 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 26 Feb 2000 23:08:26 -0600 Subject: functional programming References: <000801bf8030$a8a2f2a0$3c2d153f@tim> Message-ID: In article , William Tanksley wrote: >On Sat, 26 Feb 2000 03:08:26 -0500, Tim Peters wrote: >>[Neel Krishnaswami, writes some unusual stuff about the Joy language, >> then recants] > >>> Augh! I just realized I screwed up the names. Joy, while an >>> excellent and cool language (it's a functional Forth, more >>> or less), is fully and totally 100% Turing-complete. > >>Joy is both much more and much less than a functional Forth. It's >>both lovely & strange; > >Agreed. > >>e.g., I'm not sure I've bumped into a language before >>where it's considered natural (as opposed to merely possible, and with great >>strain) to write an *anonymous* recursive function. > >I think you've bumped into Forth before, which does allow that. It looks >like this: > >:noname endcase IF do-endcase ELSE RECURSE THEN ; > >:NONAME defines a nameless word. I believe this was added in the ANSI >standard, though, so that may have been after your time. > >But yes, Forthers don't traditionally peel off nameless recursions that >commonly, while Joy's style seems to encourage it. > >>> The language that I was /actually/ talking about is Charity, >>> which is a categorical programming language invented at the >>> University of Calgary: > >>> http://www.cpsc.ucalgary.ca/projects/charity/home.html > >>New one on me -- thanks! I see it shares category theory's fondness for >>wholesale invention of impenetrable terminology too . Alas, doesn't >>look like an active project anymore. > >Excellent! I'll certainly have to study it. > >Hmm, Charity's death seems to contradict II Corinthians 13. Maybe it's >not really dead. > >>die-young-and-leave-a-good-looking-corpse-ly y'rs - tim > >if-I-have-not-charity-I-am-nothing-ly y'rs No, you are a clanging gong. :) Ubi-caritas-et-amor'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From curtis001 at my-deja.com Thu Feb 3 12:22:02 2000 From: curtis001 at my-deja.com (curtis001 at my-deja.com) Date: Thu, 03 Feb 2000 17:22:02 GMT Subject: fetch a html page via proxy? References: <387978ff.3083491@news.jps.net> Message-ID: <87cdfl$j60$1@nnrp1.deja.com> In article <387978ff.3083491 at news.jps.net>, bayernmREMOVEME at hotmail.com wrote: > I need to fetch a page from the web but the linux machine doesn't have > direct connection to the net. It needs to go thru a proxy to connect > to the web. How can I do this with Python? I know how to write > Python code that fetch the page directly, but I can't find any > information about the proxy part. Ricardo - The best info I can tell you is to use the URLLIB module, and to set an environment variable beforehand named "http_proxy" containing the string "http://:/", which URLLIB will try to use in getting out. (In fact, it looks for any environment variables named _proxy and use it for that service -- ftp, gopher, http, etc.) That's where my assistance ends, I'm afraid. I haven't been able to learn the exact format(s) needed (or available) for the http_proxy variable, and I can't get Python through my proxy server either -- though my error messages seem to be getting fewer each time I re-read the URLLIB module to determine what it needs from me. The module also offers a function named FancyURLopener, which is supposed to do more in the way of using proxies, but I haven't been able to find any docs on how it works within URLLIB to replace the regular URLLIB.URLOpen function. Apparently it uses a manually-preset dictionary named "proxies", in which you set a key named for the service you are proxying with the string value of the proxy server (like the environment variable above). There's pitiful little documentation [none] on how to use proxy servers with Python, and in general, questions about it go uanswered. (Python folks are normally good at helping out, so this must be a topic most aren't familiar with.) I hope this helps you out a litle bit at least, and if you should find out more, feel free to share it with another proxy-snared Python user. :) Curtis Sent via Deja.com http://www.deja.com/ Before you buy. From neelk at brick.cswv.com Wed Feb 2 19:01:06 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 3 Feb 2000 00:01:06 GMT Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> Message-ID: Jason Stokes wrote: > Well, my adventures with the Python language are moving along. One thing > that worries me is the lack of garbage collection in Python; the application > I'm thinking of using Python for demands many data structures that use > circular references, but Python only implements a reference counting scheme > in the way of memory management. How do I use such data structures in > Python? Apply Neil Schemenauer's patches that convinces Python to use the Boehm garbage collector, or just live with the garbage, if your program is relatively short-lived. You can find his patch at: http://www.acs.ucalgary.ca/~nascheme/python/gc.html Manually freeing memory is ugly and error-prone. Don't do it. :) Neel From effbot at telia.com Sun Feb 6 17:18:50 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 22:18:50 GMT Subject: Specifying subject using smtplib References: <87kp4l$aid$1@nnrp1.deja.com> Message-ID: Jim Severino wrote: > In the smtplib module, the SMTP object's method "sendmail" is formatted > like so: > > sendmail (from_addr, to_addrs, msg[, mail_options, rcpt_options]) > > Can anyone tell me where you specify the message's subject? in the message itself. from_addr and to_addrs are commands to the mail transport; everything that you want to go into the message header should be explicitly put into the message. (the mail transport agent may rewrite some of the headers, but don't rely on that...) here's an example from the eff-bot guide (see footer for more info): # File: smtplib-example-1.py import smtplib import string, sys HOST = "localhost" FROM = "effbot at spam.egg" TO = "fredrik at spam.egg" SUBJECT = "for your information!" BODY = "next week: how to fling an otter" body = string.join(( "From: %s" % FROM, "To: %s" % TO, "Subject: %s" % SUBJECT, "", BODY), "\r\n") print body server = smtplib.SMTP(HOST) server.sendmail(FROM, [TO], body) server.quit() From gbl at iitb.fhg.de Wed Feb 2 08:10:31 2000 From: gbl at iitb.fhg.de (Carsten Gaebler) Date: Wed, 02 Feb 2000 14:10:31 +0100 Subject: poplib: problem deleting mails Message-ID: <38982CC7.3ED89559@iitb.fhg.de> Hi there! The POP3 object's dele() function doesn't delete messages that have a "Status: O" line in the header. Is that a bug? Regards Carsten. From wware at world.std.com Sun Feb 13 13:55:51 2000 From: wware at world.std.com (Will Ware) Date: Sun, 13 Feb 2000 18:55:51 GMT Subject: perl chomp equivalent in python? References: Message-ID: Samuel A. Falvo II (kc5tja at armored.net) wrote: : That was the first message of the thread I ever saw, so I had no idea. : Ain't Usenet great? :( Try deja.com to get caught up. Click on "Power Search", type "comp.lang.python" where it asks for a newsgroup, and "perl chomp" where it asks for keywords. A couple more clicks and you should see the thread laid out in nicely chronological order. The gist of the thread (at least from my perspective, as somebody fishing for an elegant Python idiom) has been to find a way to clean up loops like this: for L in inputfile.readlines(): # oops, it has a terminating newline L = L[:-1] # that was ugly, and I don't know if it's portable ....do stuff with L.... -- -- I can picture in my mind a world without war, a world without hate. And -- -- I can picture us attacking that world, because they'd never expect it. -- Will Ware - N1IBT - wware at world.std.com From mhammond at skippinet.com.au Tue Feb 1 07:16:16 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 12:16:16 GMT Subject: Problem : using ADO in ASP References: <86vjhe$grb$1@nnrp1.deja.com> Message-ID: wrote in message news:86vjhe$grb$1 at nnrp1.deja.com... > I am using Python as an ActiveX Scripting Engine > in ASP/IIS and want to use ADO to connect to a > ODBC-compliant DB (in fact Access). > > VBScript Code works - so there should be no setup > problem. Python in ASP Pages also works. The traceback gives you a clue: > Output from Python : > > > Python ActiveX Scripting Engine error '80020009' > > Traceback (innermost last): File " From gchiaramonte at ibl.bm Tue Feb 1 17:49:33 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Tue, 1 Feb 2000 18:49:33 -0400 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <65118AEEFF5AD3118E8300508B124877073D52@webmail.altiris.com> Message-ID: Wow, I'm a member of a cult. Cool. My parents will probably be upset when I tell them though. Do we all have to wear matching nike sneakers when the aliens come to get us? I'm really not into the castration thing though, might have to switch to a non-cult like language. Any suggestions? ROFL > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Mike Steed > Sent: Tuesday, February 01, 2000 4:13 PM > To: python-list at python.org > Subject: RE: re AMTE thread re DrScheme & Python > > > > From: urner at alumni.princeton.edu [mailto:urner at alumni.princeton.edu] > > Sent: Tuesday, February 01, 2000 1:01 PM > > To: python-list at python.org > > Subject: Fwd: re AMTE thread re DrScheme & Python > > > > For more context re the below, see the archived thread > > (on-going) at the Math Forum. This is from an > > Association of Mathematics Teacher Educators > > listserv: > > > > http://forum.swarthmore.edu/epigone/amte/snuquoiyor > > > > If people posting here have the time to read what > > Matthias says about Python... e.g.: > > > > > As far as the language is concerned, Python is a > > > - highly irregular, > > > - badly implemented > > > - non-parethetical version of (Mz)Scheme > > > - without underlying theory of programming > > > language design > > > - or program development > > > - with a cult-like following. > > > > I'd be happy to read their feedback. > > Hmm, are you sure he didn't mean Perl? > > :) > -- > M. > > -- > http://www.python.org/mailman/listinfo/python-list From embed at geocities.com Fri Feb 25 11:10:43 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 25 Feb 2000 11:10:43 -0500 Subject: pythonian way References: Message-ID: > Moshe spake: > > A = filter(lambda x: x != '\n', H.readlines()) > > > > Hey, that's the first actually Useful-Use-of-Lambda I've seen! :-) > > Shhhhhhh!!!!!! Be quiet! Do you want Guido to retroactively pull the > plug on "lambda, filter, map and reduce" in one fell swoop? I am not a big fan of the lambda keyword itself, but I now see a million uses for it. Does anyone know if Ruby has this: A = filter( [ x | x != '\n' ], H.readlines()) Ie: [ | ] Warren From boud at rempt.xs4all.nl Sat Feb 12 05:29:26 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 12 Feb 2000 10:29:26 GMT Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: Message-ID: <883cm6$mud$1@news1.xs4all.nl> Jeff Blaine wrote: > Am I the only one who chooses specifically not to use IDEs (IDLE included) > because they don't allow you to edit files with your editor of preference? > Am I the only one on the planet who thinks allowing a programmer to use > his/her editor of choice in applications is VERY important? > I've seen _one_ application (TkRat, an IMAP client done in Tcl/Tk) in a > long long time that allows calling an external editor. > Is this a difficult task which I just don't understand the complexities of? No, it isn't difficult to teach Idle to use another editor. At least, what I did was to rip the most useful part out of it (the path/class browser), make it stand-alone and have it open my editor of choice. Hardcoded for now, though the documentation tells you where to change it to your editor of choice... It took all of four hours to do that. I'm currently trying to determine what the neatest way is of having global preferences filter down to small objects - i.e. I want people to be able to set their editor of choice, and when they doubleclick on an leaf in the tree, make it open that editor. I can't figure out anything but making a config object and passing that to all created leaf objects, and that somehow doesn't seem neat to me. Oh, my version of the classbrowser-that-opens-my-preferred-editor is at http://www.valdyas.org/python/kpybrowser.html. It only works with KDE, since that's my preferred development environment. There are a few bugs, but it works well enough to use daily. -- Boudewijn Rempt | http://www.valdyas.org From gerrit.holl at pobox.com Fri Feb 4 08:24:35 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 4 Feb 2000 14:24:35 +0100 Subject: Vaults of Parnassus problem In-Reply-To: <87ca7j$ela$1@nntp3.atl.mindspring.net>; from aahz@netcom.com on Thu, Feb 03, 2000 at 04:26:27PM +0000 References: <3899A4F3.76F8FD8A@hotmail.com> <87ca7j$ela$1@nntp3.atl.mindspring.net> Message-ID: <20000204142435.A1652@stopcontact.palga.uucp> Aahz Maruch wrote on 949591587: > In article <3899A4F3.76F8FD8A at hotmail.com>, > Kim Friesen wrote: > > > >Is anyone having problems accessing the Python modules at the vaults of > >parnassus ??? > > You're the second person in a couple of weeks to mention this, and again > it works for me. Either there's a regular transient problem at vex.net > or there's some weird network problem. I've also had this problem. After a few minutes, it worked again. regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From dworkin at ccs.neu.edu Wed Feb 2 10:47:40 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 02 Feb 2000 10:47:40 -0500 Subject: Am I programming in Python mode? In-Reply-To: Anders M Eriksson's message of "Wed, 02 Feb 2000 14:31:32 +0100" References: <4TCYOB7LsZetOVPsMbGsNhmZpfcB@4ax.com> Message-ID: Anders M Eriksson writes: > if lower: > l = ord('a') > h = ord('z') > else: > l = ord('A') > h = ord('z') This is a little redundant. If you are going to use this approach, you can put the "h = ord('z')" bit outside the if/else block. However, I'd recommend doing something a bit different, like using random.choice() on string.lowercase or string.letters depending on the value of your 'lower' parameter. > str = "" > generator = whrandom.whrandom() > for i in range (n): > ch = generator.randint(l,h) > if dublicates: > str = str + chr(ch) Instead of using the + operator over and over again on strings, I'd put the characters in a list, then join them. > bRepeat = 1 > while bRepeat: > if not chr(ch) in str: > str = str + chr(ch) > bRepeat = 0 > else: > ch = generator.randint(l,h) I'd be more likely to leave out the bRepeat variable, and do a 'while 1:' loop, using 'break' where you set bRepeat to 0. I'd probably do something sort of like this: import string, random def randStr(n, lower=1, duplicates=1): if lower: chars = string.lowercase else: chars = string.letters if n > len(chars) and not duplicates: raise "I'd prefer not to infloop" char_list = [] while len(char_list) < n: ch = random.choice(chars) if duplicates or ch not in char_list: print duplicates print ch print (ch in char_list) char_list.append(ch) return string.join(char_list, '') Note the error-checking in there. If you don't allow duplicates, you can't get a string longer than the set of allowed characters. -Justin From thierry.lalinne at chello.be Sat Feb 5 06:24:43 2000 From: thierry.lalinne at chello.be (Thierry Lalinne) Date: Sat, 05 Feb 2000 11:24:43 GMT Subject: Overprinting Message-ID: <%LTm4.776$gM3.27309@news.chello.be> Hello, I use an LPD daemon on my NT 4 box to receive spool jobs coming from an IBM AS/400. I need to parse the incoming file and generate a report in RTF. Unfortunately, the AS/400 uses overprinting on some lines, I get CR without LF. What I would like to do is to use a little Python to get rid of the CR and merge the lines together. Example: Bla Bla Bla..........Bla Bla Bla............12345.......... Which after processing would give me: Bla Bla Bla...12345.....Bla Bla Bla I would like to have some advises on how to do it efficiently. Regards --- Thierry From jmadsen at xmission.com Tue Feb 8 13:19:26 2000 From: jmadsen at xmission.com (Jim Madsen) Date: Tue, 8 Feb 2000 11:19:26 -0700 Subject: Problem : using ADO in ASP References: <86vjhe$grb$1@nnrp1.deja.com> <38998BC0.2760828B@bellatlantic.net> <73Jm4.1202$k6.2820@news-server.bigpond.net.au> <389ED9A0.62DB5D5A@bellatlantic.net> Message-ID: <87pmdl$l1e$1@news.xmission.com> I had the same problem using ADO with Access. Below is a section copied from the ADO documentation. The point to note is that GetRows() returns an array where the first subscript identifies the field and the second identifies the record number. It basically does return a sequence of columns, but that is how it is designed to work. You can use it as is by reversing your subscripts, or run it through a quick loop (depending on Recordset size) and convert the columns to rows. Copied from Help File: Syntax array = recordset.GetRows( Rows, Start, Fields ) Return Value Returns a two-dimensional array. Use the GetRows method to copy records from a Recordset into a two-dimensional array. The first subscript identifies the field and the second identifies the record number. Hope this helps! Jim Steve Holden wrote in message <389ED9A0.62DB5D5A at bellatlantic.net>... >Mark Hammond wrote: >> >> "Steve Holden" wrote in message >> news:38998BC0.2760828B at bellatlantic.net... >> > Aaarrrggghhh ... >> ... >(, -1) >

(L'row3col1', L'row1col1', L'row2col1', L'row4col1') >

(L'row3col2', L'row1col2', L'row2col2', L'row4col2') >

(L'row3col3', L'row1col3', L'row3col3', L'row4col3') > >which is why I said GetRows appears to be returning COLUMNS: as I >iterate over the result of GetRows, it would seem logical (captain) >for the tuple to be the columns of that row. But this is very >definitely NOT what I am seeing. Which makes me confused. ... From daryl_stultz at my-deja.com Thu Feb 10 12:08:29 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Thu, 10 Feb 2000 17:08:29 GMT Subject: Redirect DOS command output Message-ID: <87ura9$ib0$1@nnrp1.deja.com> Hey, I'm using os.system() to execute a DOS command (on an NT machine). I would like to capture (and parse) the output from the command. I'm familiar with sys.stout but I'm not sure how to do this. Thanks for the help. Sent via Deja.com http://www.deja.com/ Before you buy. From S.I.Reynolds at cs.bham.ac.uk Tue Feb 22 15:12:21 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Tue, 22 Feb 2000 20:12:21 +0000 Subject: Abstract classes? References: <14508.630.889721.461148@beluga.mojam.com> <20000217161058.A981@stopcontact.palga.uucp> Message-ID: <38B2EDA5.6ABE@cs.bham.ac.uk> Gerrit Holl wrote: > ... > You could write the help function like this: > def help(obj): > """help(obj) -> None > > Print the docstring of an object to sys.stdout. > """ > > if hasattr(obj, "__doc__): > print obj.__doc__ > else: > print obj, "doesn't have a docstring" If you want to use the function in interactive mode you'll need to place it into your $HOME/.pythonrc.py file and make sure that the PYTHONSTARTUP env. variable is set: if (! $?PYTHONSTARTUP) then setenv PYTHONSTARTUP $HOME/.pythonrc.py endif Stuart From tim_one at email.msn.com Sun Feb 27 16:08:17 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 16:08:17 -0500 Subject: map, filter, lambda, list comprehensions (was RE: parameterundefined in procedure) In-Reply-To: Message-ID: <000001bf8166$c5551cc0$f0a2143f@tim> [Greg Ewing's original list comprehension example, from '98] > def zip(L1, L2): > return [(x, y) for x in L1, y in L2] [Michal Wallace] > is this the same as: > [code that acts much like Python's current map(None, L1, L2), except > builds a list of two-lists instead of two-tuples] Close. It was long ago agreed that map's None-padding of "short" sequences is at best a dubious idea, and to drop that for (the not yet implemented) "parallel iteration" (whether in "for" or list comprehension context). So it would actually act like: def zip(L1, L2): result = [] i = 0 while 1: try: next = L1[i], L2[i] except IndexError: break result.append(next) i = i+1 # ignoring a subtlety here on OverflowError return result Note that Python's iteration protocol terminates via exception, not via reaching a precomputed length. This is so you can iterator over, e.g., lines of a file, where you don't know len() in advance. From kern at caltech.edu Wed Feb 16 03:54:35 2000 From: kern at caltech.edu (Robert Kern) Date: 16 Feb 2000 08:54:35 GMT Subject: XORing on arrays faster? References: <88dhqa$nmi$1@nnrp1.deja.com> Message-ID: <88dokb$ovt@gap.cco.caltech.edu> In article <88dhqa$nmi$1 at nnrp1.deja.com>, rdudfield at my-deja.com writes: > Hello, > > Anyone know how to do XORing on arrays fast? > > I do not want to use the Numeric package, for other reasons. Out of curiousity, why not? > So that is > out of the question. BTW using Numeric XORing two arrays is more than > four times as fast as this method. > > a = array.array('I',[0]) * 1000 > b = array.array('I','\377\377\377\377') * 1000 > > # this is the bit I want done faster :) > for x in xrange(1000): > a[x] = a[x] ^ b[x] > > > Also if you know a way to map one sequence onto another fast, I'd like > to know how to do that too :) Python 1.5.2 (#0, Sep 13 1999, 09:12:57) [GCC 2.95.1 19990816 (release)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import operator >>> import array >>> a = array.array('I',[0]) * 1000 >>> b = array.array('I','\377\377\377\377') * 1000 >>> a = array.array('I', map(operator.xor, a, b)) The in-place modification semantics, I can't help you with. Anyone else? > Thanks for any help. > > Rene. -- 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 prudek at nembv.cz Fri Feb 25 06:12:47 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 12:12:47 +0100 Subject: Bring value from walk() Message-ID: <38B663AF.EDF3622E@nembv.cz> I need a function that walks the dir tree and adds up occupied space. This is the source. "print Dirn", "print '-',X,Fs" and "print End of walk..." lines are for debugging only. The problem is that Filespace is Zero at the end. Fs is reset to Zero every time walk gets called, so I thought I would add Total variable (lines with Total are currently commented out), but I got NameError: Total. Is there (an object oriented) way to bring Total from Estimatespace thru EstDirSpace right back into main program? def Estimatespace(Fs, Dirn, Nams): print Dirn for X in Nams: Fs=Fs+os.stat(Dirn+'/'+X)[stat.ST_SIZE] print '-',X,Fs # Total=Total+Fs return def EstDirSpace(RootDir): Filespace=0 # Total=0 os.path.walk(RootDir, Estimatespace, Filespace) print "end of walk, Filespace=",Filespace return Filespace EstSpace=EstDirSpace('c:/DL/ati') -- Milos Prudek From danielt3 at gte.net Wed Feb 16 23:05:27 2000 From: danielt3 at gte.net (Daniel T.) Date: Thu, 17 Feb 2000 04:05:27 GMT Subject: Abstract classes? Message-ID: I was re-reading Design Patterns with an eye toward implementing some of them in Python and I have a question about Abstract classes. In the code below I have an Observer pattern set up. Since Python isn't strongly typed, there is no need for the abstract Observer class but I put one in anyway to make clear what Subject expects of Observers. What does the Python community in general think of this? Also, any general critiques of this code? class Observer: def update( self ): raise "sub-classes must over-ride this method" class Subject: " Something that is being observered by 0..* observers " def __init__( self ): self.__observers = {} def has_observer( self, observer ): " returns true if observer is in notification list " return self.__observers.has_key( observer ) def notify( self ): " sub-classes should call this when their state changes " for observer in self.__observers.keys(): observer.update( self ) def attach( self, observer ): " add observer to notification list " self.__observers[ observer ] = 1 def detach( self, observer ): " remove observer from notification list " del self.__observers[ observer ] class GenericSubject( Subject ): def __init__( self ): self.__value = 0 def set_value( self, value ): self.__value = value notify() def get_value( self, value ): return value class GenericObserver( Observer ): def update( self, subject ): print subject.get_value() -- When a thing ceases to be a subject of controversy, it ceases to be a subject of interest. -- William Hazlitt From janssen at parc.xerox.com Fri Feb 18 14:49:53 2000 From: janssen at parc.xerox.com (Bill Janssen) Date: Fri, 18 Feb 2000 11:49:53 PST Subject: any code for parsing the values of mail headers like Content-Disposition? Message-ID: <00Feb18.114950pst."3872"@watson.parc.xerox.com> Hi, folks. I'm looking for code to parse the value of headers like Content-Disposition, which are of the form Content-Disposition: attachment; filename="foo.txt", charset=iso-8859-1 Ideally, I'd like a routine which would return a 2-ple of the disposition, as a string, plus a dictionary containing all of the parameters, with touches like having the quoting strings stipped from around "foo.txt". I'm familiar with the rfc822 and mhlib packages, but there may be code like this in another package that I haven't come across. Does anyone know of such? Thanks. Bill From effbot at telia.com Mon Feb 14 16:35:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 21:35:21 GMT Subject: String manipulation References: <38A87064.BEB93BB7@aston.ac.uk> Message-ID: Peter Bittner wrote: > Is there no such thing in Python as > > mystring += "something" // C-style no. python's not C. python strings cannot be modified in place. in python, assignment is a statement, not an operator. etc. (for more arguments pro and con, check the newsgroup archives. summary: it may be added some day, but there are lots of stuff that are much more important...) > (source of errors; typing mistakes) have you just started using Python? if so, come back in three months and tell us if you still think this is a real problem (chances are that your list of "real problems" will look very different -- see neel's post for an example) (if you've been using python for quite a while, check the archives before replying). From sabren at manifestation.com Wed Feb 16 15:50:45 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 16 Feb 2000 15:50:45 -0500 Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> <88f1lr$ola$1@nntp4.atl.mindspring.net> <38AB10C0.931F8F19@starmedia.net> Message-ID: <88f2k2$rfm$1@nntp4.atl.mindspring.net> >Even easier: >>>> x = 5 >>>> y = 20 >>>> a = x a and b or c :) yeah.. that post was from like a week ago, when we were talking about a way to do that without the boolean operators... Fredrik suggested that my IIF() routing could be made to work across namespaces, and I've been trying to figure it out ever since.. (well, at least somewhere in the back of my mind...) -Michal http://www.sabren.com/ From zeitlin at seth.lpthe.jussieu.fr Mon Feb 28 14:16:01 2000 From: zeitlin at seth.lpthe.jussieu.fr (Vadim Zeitlin) Date: 28 Feb 2000 19:16:01 GMT Subject: Which GUI? References: Message-ID: On 26 Feb 2000 23:38:03 GMT, William Tanksley wrote: >Oh, one of the wxWindows supported platforms is -- are you ready for this >-- Curses. Sorry, I have to correct you here. wxWindows does not support text mode UI and neither does wxPython. This could be done (and I wanted to do it at one moment), but more time passes, less chances there are that it will ever happen. I would love to be able to have wxCurses port, but there is apparently not enough interest in it. Regards, VZ From tim_one at email.msn.com Mon Feb 28 03:42:25 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 28 Feb 2000 03:42:25 -0500 Subject: functional programming In-Reply-To: <38B947E0.4803806D@tismer.com> Message-ID: <001101bf81c7$bcab9660$f0a2143f@tim> [posted & mailed] [Christian Tismer, musing about applying continuations to the task of creating explictly hand-optimized tail calls, and then to recursive nested functions] > ... > It is easy to do this, and an apply would be easy as well. > I'm just curious about the interface: It is hard to find > the right names for these functions. > Also, they don't appear to belong to the continuation > module, so I hesitate to embed them there and also hesitate > to write another extension module. > > Stackless Python can stand all kinds of jumps and calls, > anywhere, at any time. The problem is just how to spell it. > > Suggestions? Yes: in the absence of a killer app, it's a distraction. Piling more & more things (that a relatively very few) people miss from Scheme onto your Stackless doesn't make the latter more attractive to most people, and-- unless I miss my bet badly --especially not to Guido. It just (at this stage) complicates your story to no demonstrably good end. KISS applies to social politics as well as to code <0.4 wink>. python-itself-is-subversive-and-stackless-should-be-too-ly y'rs - tim From amused at webamused.com Sat Feb 5 22:37:08 2000 From: amused at webamused.com (Joshua Macy) Date: Sun, 06 Feb 2000 03:37:08 GMT Subject: CGI Scripts References: Message-ID: <389CEA00.9D771D21@webamused.com> Sorry, typo. That should have read: print "Content-type: test/html\n\n" Joshua From morse at harborcom.net Fri Feb 25 08:06:57 2000 From: morse at harborcom.net (Kevin Dahlhausen) Date: Fri, 25 Feb 2000 13:06:57 GMT Subject: Which GUI? References: <88jg9f$ssd$1@nnrp1.deja.com> <38b3df23.76266295@news.oh.verio.com> <20000223161505.A3134@stopcontact.palga.uucp> Message-ID: <38b67dcf.247958114@news.oh.verio.com> Gerrit Holl wrote: >Not true. The Python wrappers are not well-documented. > >Or are they? The only documentation on the wrappers is geared towards people extending them. Users should use the normal FLTK documentation, From 2jerry at writeme.com Wed Feb 23 17:35:56 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 23:35:56 +0100 Subject: Misunderstanding classes (newbie) References: <88v4lu$ags$1@wanadoo.fr> Message-ID: <891n6j$mlc$1@wanadoo.fr> ok ... we need to add a class the idex slice will done by playing with getitem function >>>class sliced_list: def __init__(s,first_index=1): #1 by default s.f_idx=first_index s.list=[] def __getitem__(s,idx=s.f_idx): return s.list[idx-s.f_idx] then with class lm: >>> a=sliced_list() >>> a.list.append(lm('paul','DUBOIS',45)) and du coup* (then) >>>a[1].lastname paul >>>a[0].lastname paul ** Right cause index will be modulo-ed :)) .. add: >>>a.list.append(lm('david','Asher',31) >>>a[1].lastname paul >>>a[2].lastname david >>>a[3].lastname paul ... use __setitem__ to update :) jerry the foolish dracomorpheus, sorry at spam.invalid a ?crit dans le message ... >Thanks for replying. You've written part (b), which I was also >able to do. But how do I get (a) the modified UserList and (b) >the list of class elements into a single instance? I want > > a[whatever_I_decide_is_the_start_of_the_list].lastname > >to return > > a[0].lastname > >automatically, and have whatever_I_decide_is_the_start >_of_the_list default to 1 when I create an instance of >the class. > >Jerry <2jerry at writeme.com> wrote: >> This is just a list of class elements ? no ? >> class lm: >> def __init__(self, last=None,first=None,age=0): >> self.lastname=last >> self.firstname=first >> self.age=age > >> then .. >> list_lm=[] >> a=lm('jerome','VACHER',29) >> list_lm.append(a) >> list_lm.append(lm('paul','DUBOIS',45)) >> a[0].lastname='jerome' > >> Is that you want ? > > >> sorry at spam.invalid wrote: >>>Hi, >>> >>>I'm a Python newbie (and an OOP newbie) trying to >>>construct a class that: >>> >>> (a) behaves like a list but has a FORTRAN-like variable >>> starting index, >>> (b) has per-index attributes. >>> >>>i.e. Each element of the list has two (or more) attributes, >>> and, by default, the first element is at x[1]. >>> >>>e.g. x[1].lastname, x[1].firstname, x[1].age >>> x[2].lastname, x[2].firstname, x[2].age >>> >>>I seem to be able to get each part of the solution >>>independently (the first part by using UserList and >>>__getitem__), but when I attempt to combine them, I >>>clearly don't understand what I'm doing. >>> >>>Suggestions? >>> >>>Thanx. >>> >>>P.S. Please respond to the list. From Armin at Steinhoff.de Tue Feb 8 17:13:15 2000 From: Armin at Steinhoff.de (Armin Steinhoff) Date: 8 Feb 2000 14:13:15 -0800 Subject: stackless Python Message-ID: <87q4dr$2b62@drn.newsguy.com> Hi All, is somone using the stackless Python implementation ? Are there any information about HOW-TO-USE it ??? BTW ... we are using Python under the RTOS QNX 4.25 ... Regards Armin Steinhoff From piet at cs.uu.nl Fri Feb 25 06:07:19 2000 From: piet at cs.uu.nl (piet at cs.uu.nl) Date: 25 Feb 2000 12:07:19 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <8945c6$a8j$1@nnrp1.deja.com> Message-ID: >>>>> see_plus_plus at my-deja.com (spp) writes: spp> Wait & See. spp> This new compiler is coming out from the same country where Mercedez, spp> BMW & Porsche are produced. You know the quality of those cars, do you? spp> cpp Like the Mercedes A-model that flipped over when you took a curve too fast. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: Piet.van.Oostrum at gironet.nl From achrist at easystreet.com Mon Feb 28 02:41:34 2000 From: achrist at easystreet.com (Al Christians) Date: Sun, 27 Feb 2000 23:41:34 -0800 Subject: GUI in Python under MSDOS? References: <7gxs4.10514$Jz3.75949@nnrp1.uunet.ca> <38B9937D.F446585C@bart.nl> Message-ID: <38BA26AE.F063DEB6@easystreet.com> Richard Smol wrote: > > > Porting Tk to DOS would not be trivial, since there would be no > base-widgets to work with. It would be great fun though to make > it work. You might get stuff like those those early Windows-lookalike" > DOS apps (anyone remember WordPerfect 6.0 for DOS?) > If it's some kind of embedded DOS, why would you want to destroy confidence in your product by making it look like Windows? Could you build Tkinter for DOS on top of one of those game-developer graphics libs for djgpp? Before anyone tries graphical DOS, they should take a look at the zApp and Zinc GUI libraries for MS-DOS and some of the apps developed with them, if you can find any. Somehow, this was a bad idea. Win16 may have the best GUI for DOS, and that's not saying much (did Excel really used to ship with a free Windows runtime included?). If you are developing for some users who still run DOS but would like to have a GUI, that's got to be a narrow market. If you are developing for folks who still run DOS because they don't want a GUI, you should be ready to handle monochrome adapters, Hercules cards, and machines with no mouse. Al From gerrit.holl at pobox.com Fri Feb 25 01:56:27 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 25 Feb 2000 07:56:27 +0100 Subject: pythonware.com - cannot access In-Reply-To: <894mtr$s5l$1@news.udel.edu>; from tjreedy@udel.edu on Thu, Feb 24, 2000 at 08:54:29PM -0500 References: <894iuc$qi1$1@news.udel.edu> <20000224195150.A3588@quark.internal> <894mtr$s5l$1@news.udel.edu> Message-ID: <20000225075627.B1669@stopcontact.palga.uucp> > Like to see if they have the same problem? Good idea. Will try to call > someone when I hang up. If you're behind IP masquerading, I copy your problem. I also have this problem for: - www.reseau.nl - sunsite.auc.dk - www.linuxgames.org Give 'em a try! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From 2jerry at writeme.com Tue Feb 22 17:29:54 2000 From: 2jerry at writeme.com (Jerry) Date: Tue, 22 Feb 2000 23:29:54 +0100 Subject: Tkinter: user vs. program events References: <3d1z65kr2j.fsf@amarok.cnri.reston.va.us> Message-ID: <88v2f5$7md$1@wanadoo.fr> Well one or tow ideas .. get them as there are :-) - first you can disable callback on set() when user "come in" the widget scale with cursor to protect automatic activity use binding and for disable/enable - second: protect the set methode with intermediate class which inheritate from Tkinter Var class. hum .. no more idea, no time to investigate more or give example , sorry .. If i can found some time .. I'll write a snippet for that. Jerry the foolish dracomorpheus, J?r?me VACHER- france- Andrew M. Kuchling a ?crit dans le message <3d1z65kr2j.fsf at amarok.cnri.reston.va.us>... >I've been trying to figure out how to distinguish between Tkinter >events that come from a user and ones that originate from changing the >value of a widget. Is this possible? > >Here's the motivating example. I have a Scale widget for indicating >light intensity: > > self.light_scale = Tkinter.Scale(f, command = self.adjust_light) > >adjust_light() is a method that takes the current value of the scale >widget, and sends off a command to change light intensity. The >Tkinter program also receives updates on the current state, and >changes the scale widget to match the current value, with >self.light_scale.set( ) . > >The problem is that the light_scale.set() call causes the associated >command to be run, so a command is sent off changing the light >intensity, which causes another status update to be sent out, which >changes the setting, and so forth. > >So, how would you do this in Tkinter? Can I distinguish between >events generated by a user and by a .set() call? Should >adjust_light() be bound to some different event? Or should I change >the binding of the widget on every update()? > >-- >A.M. Kuchling http://starship.python.net/crew/amk/ >Science itself, therefore, may be regarded as a minimal problem, consisting of >the completest possible presentment of facts with the least possible >expenditure of thought. > -- Ernst Mach > From J.C.Travers at durham.ac.uk Thu Feb 17 13:09:44 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Thu, 17 Feb 2000 18:09:44 +0000 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC150E.FA51B9E3@durham.ac.uk> Message-ID: <38AC3968.39E53E20@durham.ac.uk> Fredrik Lundh wrote: > > J.C.Travers wrote: > > > Tk the hardest GUI to code? not in my experience.. > > > > I meant in terms of Python GUI's > > you've tried them all? No, I've tried Tkinter, PyQT, wxPython, some pyGTK. What I really meant was that in terms of the usual quality of interfaces to python modules, Tkinter is the worst I have seen. > > btw, it's "Tkinter". not "Tk". the former is an > object-oriented Python interface to libtk. may- > be you used the wrong library? No, I used Tkinter. Cheers, John From thomas at xs4all.net Thu Feb 3 03:27:37 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 3 Feb 2000 09:27:37 +0100 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <3898E3FC.61C6CA9C@callware.com>; from ivanlan@callware.com on Wed, Feb 02, 2000 at 07:12:12PM -0700 References: <65118AEEFF5AD3118E8300508B124877073D52@webmail.altiris.com> <3898d76d.201105044@news.teleport.com> <3898E3FC.61C6CA9C@callware.com> Message-ID: <20000203092737.B6378@xs4all.nl> On Wed, Feb 02, 2000 at 07:12:12PM -0700, Ivan Van Laningham wrote: > > Python and its users. I should not have given permission to post my first > > reaction to a newsgroup about which I knew nothing. I particularly regret > > using the word "cult" for Python users. > > -- Matthias Felleisen > Hmmph. It's not enough. He should grovel more, and he should be forced > to use Python for a month. What, and risk him forcing Guido to use Scheme for a month ? Guido might end up enjoying it ;) It's-the-end-of-the-world-as-we-know-it-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From phd at phd.russ.ru Fri Feb 18 10:41:42 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 18 Feb 2000 15:41:42 +0000 (GMT) Subject: PyGreSQL and windows In-Reply-To: Message-ID: On Fri, 18 Feb 2000, Agent Drek wrote: > I am also working in a mixed environment that is bound to drive me > over the edge in the near future :) Is there NO way for me to > communicate to my new Postgresql server from a windows boxen? Install Postgres on Real OS, and use it via ODBC from Windows. > What database system is recommended for cross platform communication? What platforms do you want? What types of database? In case of SQL I'd recommend Gadfly - pure python SQL engine. Will work on every python platform, including, I think, DOS! :) If you want simpler database - there are a number - from Berkeley DB to MetaKit to whatever... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From robin at jessikat.demon.co.uk Fri Feb 18 04:33:12 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 18 Feb 2000 09:33:12 +0000 Subject: Python misconceptions in IBM Ruby article... References: <38AC9D57.5CC8066C@mincom.com> Message-ID: I guess the objection is to not having a standard name for the instance in class functions. If we had the standard set at self you could presumably write class dingo: def normal_func(a1,a2,....): ..... classdef instance_func(a1,a2,...): self.a=1 ........ ie you could distinguish in the class definition between the kinds of functions. Presumably normal_func cannot refer to self and instance_func can. Also I assume that normal_func would live while the class does which is more difficult in python. -- Robin Becker From alex at somewhere.round.here Tue Feb 15 12:06:46 2000 From: alex at somewhere.round.here (Alex) Date: 15 Feb 2000 12:06:46 -0500 Subject: RC (was Re: Real Problems with Python) References: <001001bf7763$e37ab280$66a2143f@tim> <38A979D2.71CD8FB3@inrialpes.fr> Message-ID: > What is LOR for? I just figured that out, myself, I think. My guess is locality of reference. Alex. From amused at webamused.com Tue Feb 8 07:31:38 2000 From: amused at webamused.com (Joshua Macy) Date: Tue, 08 Feb 2000 12:31:38 GMT Subject: arguments from the prompt References: <389F565F.E0AF7FD1@python.net> Message-ID: <38A00A4E.3DB160EB@webamused.com> joe at localhost.localdomain wrote: > thanks, btw is there a FAQ? try http://www.python.org/doc/FAQ.html Joshua From gerrit.holl at pobox.com Sat Feb 12 04:39:16 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 10:39:16 +0100 Subject: Off Topic Posts In-Reply-To: ; from gchiaramonte@ibl.bm on Fri, Feb 11, 2000 at 08:20:01AM -0400 References: Message-ID: <20000212103916.A1007@stopcontact.palga.uucp> Gene Chiaramonte wrote on 950253601: > All good points. I have several filters in place already, but many messages > still slip through. > > I am suggesting that python-list be split into 2 lists. One for specific > python programming questions, and another list for python language opinions > and comments. > > Anyone agree with me? I agree it would be split, but a charter "language options and comments" would be too small, I think. What about a list/newsgroup for general, non-technical discussion? The future of Python could also be discussed there, and people who think Python sucks loud could post there instead of here :) I think it's good to start with a mailinglist, and post some RFD-stuff around afterwards, for a c.l.py.discussion group. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From dan at cgsoftware.com Fri Feb 4 00:35:00 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Thu, 3 Feb 2000 21:35:00 -0800 (PST) Subject: Metakit Install hints? In-Reply-To: <87dl9m$1pvl$1@news.hal-pc.org> References: <87dl9m$1pvl$1@news.hal-pc.org> Message-ID: > > Hope someone can help. > > I want to play with the database capabilities of metakit. Metakit is a great thing. > > I downloaded mk-i586-pc-linux-gnu.tar.gz, untarred it into > ~/pyth/mk-i586-pc-linux-gnu I assume this isn't a source distribution? > > The README under UNIX does not seem to have any relation to what I am > seeing in the mk-i586-pc-linux-gnu directory. No .configure executable, no > INSTALL. Must not be a source distribution. > > What I really need is a short rundown on how to get metakit working with > Python 1.5.2 No big dissertation needed. > Well, i downloaded that particular binary distribution, and it indeed includes everything you need. The README's are really referring to the source distribution, where you run configure and whatnot. Once you've extracted the tar, as you've done, everything is ready to rock. That directory includes all the libraries and modules you need. You just need to grab the documentation (It's included in the source distribution if you can't find it seperately). I used metakit for the backend for a C++ class browser (this was back when it was not open source), and it was amazingly quick, and nice to use. > Environment is SuSE Linux 6.3 2.2.14 Intel > > tia > steve. > > ps > At first, I did not like no {...}, etc. No I really really like the way > python starts and ends blocks. And I want case-sensitivity left alone. > > > -- > Steven Pauly (281) 496-8041 (steve.pauly at glm.com) > Global Marine Drilling Co. / Houston / Tx / 77079 > stevep at brokersys.com / stevep at bash.linux-shell.net > -- > http://www.python.org/mailman/listinfo/python-list > From tim_one at email.msn.com Wed Feb 16 02:57:09 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 02:57:09 -0500 Subject: Iterators & generators (RE: Real Problems with Python) In-Reply-To: Message-ID: <001701bf7853$6cc790e0$b7a0143f@tim> [Moshe Zadka] > I'm a little ignorant on both the bang and the buck issues. While > what Tim said certainly shows there's a big bang, I'm wondering > about the buck. Modulu Stackless, what would it take to implement > this? Discussions on this stretched over many months last year, beginning in about May. Guido developed a nearly complete implementation plan for generators in the "Generator details" thread of July '99, in the Python-Dev archives. And Steven Majewski pretty much actually implemented them six years ago, then lost interest when it couldn't be extended to continuations (the implementation of which, as Christian proved, required redefining truth itself ). generators-coexist-peacefully-with-all-truths-ly y'rs - tim From tbryan at python.net Wed Feb 9 22:10:11 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 09 Feb 2000 22:10:11 -0500 Subject: CGI Scripts References: Message-ID: <38A22C13.81393ADA@python.net> Robert Rutkowski wrote: > > Is it possible the server does not have the cgi or string modules installed? > How would I find out what is there? Can you get *any* Python cgi program working? That is, does something like #!/usr/contrib/bin/python print "At least CGI and Python are working." work? If that does not work, then you've got a problem with your environment/server. If something like that does work, then you can explore what modules are available by doing things like this: #!/usr/contrib/bin/python modules_of_interest = ['string', 'cgi', 'math', 'foo'] print "Content-type: text/html" print for module_name in modules_of_interest: try: exec('import %s' % module_name) print "I was able to import %s
" % module_name except ImportError: print "Couldn't import %s
" % module_name If you're bored, you could iterate through sys.path, attempt to import each .py file in each path in sys.path. On successful import, print a nice HTML table of the methods using dir() with associated doc strings. For unsuccessful loads, just print the fact that the load was unsuccessful. for-extra-credit-use-HTMLgen-to-generate-the-HTML-ly yours ---Tom From tye4 at yahoo.com Thu Feb 10 00:20:19 2000 From: tye4 at yahoo.com (tye4) Date: Wed, 9 Feb 2000 21:20:19 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> Message-ID: <87thrq$gf7@news.or.intel.com> Future language designers should learn from the blunders of Python and other languages. Listed below, from worst to best block delimiter schemes found in languages. Pascal. Score: 2/10. Pascal is my most favorite lang... however, hate those 'begins' - they create double indentation as shown below. This bug was fixed in future incarnations of Pascal, e.g. Ada if foo then begin bar; stool; end; ------------------------------------- C++/Java. Score: 5/10 if (foo) { bar(); stool(); } -------------------------------- Python. Score: 7/10. Good points of Python: 1) No semicolons at end of line 2) No 'begin' or '{' for start of a block 3) Forces programmers to indent (improves readability) Bad points: 1) No visible indicator for end of a block 2) If indentation level is 2 or 3 spaces, ending of block even more harder to discern 3) Have to pay careful attention to the properties of Editors (does it convert tabs to spaces? etc.) 4) Forces programmers to indent (potential source of errors if tabs and spaces are mixed) if foo: bar() stool() x = 10 --------------------------------------- Ada. Score 10/10 No redundant 'begin' or '{'. Visible indicator of end of a block if foo then bar; stool; end if XML: Score: 11/10. Simple and intuitive block begin and end. tye4 From gerrit.holl at pobox.com Sat Feb 12 15:24:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 21:24:39 +0100 Subject: Docstrings In-Reply-To: <38A5A73C.AD90F44A@math.okstate.edu>; from ullrich@math.okstate.edu on Sat, Feb 12, 2000 at 12:32:28PM -0600 References: <20000212143634.A3241@stopcontact.palga.uucp> <38A5A73C.AD90F44A@math.okstate.edu> Message-ID: <20000212212439.A5816@stopcontact.palga.uucp> David C. Ullrich wrote on 950355148: > > http://www.python.org/doc/current/ref/types.html#l2h-97 > > > > Callable types > > These are the types to which the function call operation (see > > section 5.3.4, ``Calls'') can be applied: > > > > User-defined functions > > [stuff about user-defined functions, including __doc__.] > > > > So this applies to all callable objects, I thought. > > The indentation would seem to suggest it applies to user-defined > functions. In any case, I don't see what you're confused about - the > part you quote says that various things _do_ have __doc__ attributes, > it says nothing to the effect that these are the _only_ things with > __doc__ attributes. Various other things do - nothing in the docs > says otherwise. But I want some sort of definition: what types may contain doc strings? Strings, lists, dictionaries and all numeric types obviously may not. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From chiefteo69 at my-deja.com Mon Feb 21 20:47:41 2000 From: chiefteo69 at my-deja.com (chiefteo69 at my-deja.com) Date: Tue, 22 Feb 2000 01:47:41 GMT Subject: Fast way to grab line from file? Message-ID: <88sprs$1ao$1@nnrp1.deja.com> Hi there, Does anyone know of a faster way to grab line 100 from a given file without doing 100 readline() calls? This way is too slow, but I can't find out how to do this in python. Thanks, -Mateo Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Fri Feb 25 08:29:53 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 15:29:53 +0200 (IST) Subject: Bring value from walk() In-Reply-To: <1260637200-9073387@hypernet.com> Message-ID: On Fri, 25 Feb 2000, Gordon McMillan wrote: > If you're going to print details, os.path.walk is not really > appropriate, because it's a pre-order walk. If you're going to > print totals for the branches, you need a post-order walk, > (process the leaves first, then the parent node). Did I hear anyone say "generator"? another-stackless-thread-is-born-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From effbot at telia.com Thu Feb 3 09:03:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 3 Feb 2000 15:03:22 +0100 Subject: anydbm - a simple question References: <20000121110715.A184793@vislab.epa.gov> <3diu0lbz8e.fsf@amarok.cnri.reston.va.us> <20000124112320.A440571@vislab.epa.gov> Message-ID: <013701bf6e4f$700b3e40$f29b12c2@secret.pythonware.com> Randall Hopper wrote: > |Short-term, you can patch dumbdbm.py to use int(npos-pos), but this is > |really an interpreter bug; there's no reason 2L * 'a' should be an > |error. > > Ok, patching around this bug as you suggested, Fredrik's anydbm example > still fails. > > >>> import anydbm > >>> db = anydbm.open( "database", "c" ) > >>> db[ "1" ] = "one" > >>> db.close() > >>> db = anydbm.open( "database", "r" ) > Traceback (innermost last): > File "", line 1, in ? > File "/home/rhh/software/python-1.5.2/lib/python1.5/anydbm.py", line 80, in open > raise error, "need 'c' or 'n' flag to open new db" > anydbm.error: need 'c' or 'n' flag to open new db > > > It created the database.dir and database.dat files in the write phase, > but the read phase fails on the open. > > Thinking it might be extension related I tried changing the file-to-open > from "database" to "database.dat". But no dice: > > anydbm.error: db type could not be determined > > Same thing if I change the path to "database.dir". > > Is there another bug at work here? Or is the example flawed? iirc, the problem is that whichdb cannot identify dumbdbm files (the logic in anydbm.open appears to be flawed). so if you don't have any other database on your machine, it appears as if anydbm only provides write-once support... From wlfraed at ix.netcom.com Fri Feb 25 01:25:29 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Thu, 24 Feb 2000 22:25:29 -0800 Subject: 1000 GUI toolkits References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> <20000224132812.A3201@stopcontact.palga.uucp> <894diu$o80$1@news.udel.edu> Message-ID: <096cbs0a58oajfrffgkusmtk4r6t07e6a2@4ax.com> On Thu, 24 Feb 2000 18:15:03 -0500, "Terry Reedy" declaimed the following in comp.lang.python: > > HUH? pdf is not interactive, HTML is, with links and forms. Full PDF does support links. > -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From Gaetan_Corneau at baan.com Wed Feb 16 15:12:35 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Wed, 16 Feb 2000 15:12:35 -0500 Subject: String question Message-ID: <816010E2456BD111A48700805FBBE2EE01C60514@ex-quebec-u1.baan.com> Hi, > I want the variable 'string' to be a string and not a list.. > >>> n =10 > >>> string = "n = ", n > >>> print string > ('n = ', 10) > > I want string to be "n = 10". How? You are building a tuple (made of a string and an integer), not a list. Just use: str = "n = " + str(n) or str = "n = %d"%n I used "str" instead of "string" because "string" is the name of a module. Hope this helps, ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" From embed at geocities.com Mon Feb 14 15:21:48 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 14 Feb 2000 15:21:48 -0500 Subject: BSDDB 1.8.x is buggy? References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> <14504.17006.398813.576385@beluga.mojam.com> Message-ID: > Perhaps, but I wouldn't use 1.8.5 in code I expected to be robust. It has > known bugs (was there ever a 1.8.6?), one of the main reasons for upgrading > to 2.x. Hmm. I have been trying hard all day to crash it or cause it to have problems. I am wondering if the known bugs in this version are present in the Win32 port of this library. I have been exercising the bsddb unit with the following code. Can anyone show me something that will break bsddb? Or are the bugs too stealthy to produce a test case? The following test code starts with around 100 rows, and works it's way up to file sizes over 100 mb. If there were any duplicate key problems or core dumps in the database, would I find them this way? I have to ask myself, if code can work millions of times in a row, and then fail once, what does that say about it's design? What exactly was fixed in 2.0? Were the fixes "one liners" and "fencepost errors", or was it a total architecture change? If so, is there a free disk-based robust bsddb-type key/value lookup system in C somewhere? MetaKit is out because it's C++. Warren --- [ code snippet follows ] --- # DBTEST.PY import bsddb import random import time import string print "BSD Database Test in Python Win32" print descriptions = [ "Add Rows", "Read Keys", "Shuffle", "Read Rows", "Delete 75%", "Close" ] List1 = [ "Abc", "Def", "Ghi", "Jkl", "Mno", "Pqr", "Stu", "Vwx", "Yz" ] List2 = [ "X123", "Y456", "Z789", "Y012", "Z345", "X678", "Y901", "Z234", "X567" ] # Shuffle an array like you might shuffle cards # Note: This is intended to be Good Enough, Not Perfect. # We limit shuffle operations to 100 per data set! def Shuffle(ar): sz = len(ar) th = sz/2 lp = sz/4 if (lp > 100): lp = 100 # now move a bunch of cards up or down: x1 = random.randrange(0,sz/2) x2 = random.randrange(0,sz/2)+(sz/2) c = random.randrange(0,sz/4) ar[x1:x1+c], ar[x2:x2-c] = ar[x2:x2-c], ar[x1:x1+c] for k in range(0,lp): # do a little random substitution to kick things off for i in range(0,lp): x = random.randrange(0,th) y = random.randrange(th,sz) ar[x],ar[y] = ar[y], ar[x] def testset(testindex,RowCount,db): times=[] starttime = time.clock() bytesread=0 print "---- Storing "+`RowCount`+" rows in the database "+`testindex`+" ) ----" for n in range(0,RowCount): r = random.randrange(0,8) V = List1[r]*200 K = List2[r]+"-"+`n`+`testindex` # avoid inorder insertion of keys db[K] = K+':'+V # DB Btree-lookup Key 'K' has value 'V' times.append(time.clock()-starttime) # Get Keys #print "Read Keys" Keys = db.keys() N = len(Keys) times.append(time.clock()-starttime) print "Shuffling Key array... " Shuffle(Keys) times.append(time.clock()-starttime) print "After inserting ",RowCount," rows the Key Count is now ", len(Keys) bytesread = 0 #print "Reading Rows, in Random Order" for r in Keys: x = db[r] bytesread = bytesread + len(x) print "Bytes read = ", `bytesread` times.append(time.clock()-starttime) # Delete 75% of the data in the database: delcount = len(Keys) - ( len(Keys)/4 ) for k in Keys[0:delcount]: del db[k] db.sync() Keys = db.keys(); print "After deleting, the key count is ", len(Keys) times.append(time.clock()-starttime) #print "Closing" #print "Done" #times.append(time.clock()-starttime) print "Elapsed Times:" for i in range(0,5): print string.ljust(descriptions[i],20), ": ", times[i] print "-----------------" print def testloop(): db1 = bsddb.btopen( "c:/temp/TestBsdDb.db", "n" ) for i in range(4,17): testset(i,long(20**(i/4.0)),db1) db1.close() # main program: testloop() From gmcm at hypernet.com Tue Feb 29 12:31:05 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 29 Feb 2000 12:31:05 -0500 Subject: re.compile question In-Reply-To: References: Message-ID: <1260277030-30737176@hypernet.com> Gregoire Welraeds writes: > > Yes it's me again ;) > How can I test that a re.compile has failed, Eg: If i simply forget a ( > in my regular expression > > -- > Life is not fair > But the root password helps The interpreter does, too. >>> import re >>> x = re.compile("(") Traceback (innermost last): File "", line 1, in ? File "D:\Programs\Python\Lib\re.py", line 79, in compile code=pcre_compile(pattern, flags, groupindex) pcre.error: ('missing )', 1) >>> - Gordon From trentm at ActiveState.com Fri Feb 18 04:23:14 2000 From: trentm at ActiveState.com (Trent Mick) Date: Fri, 18 Feb 2000 09:23:14 -0000 Subject: Killer Apps??? In-Reply-To: <14509.31078.932335.402705@beluga.mojam.com> Message-ID: [Skip Montanaro]: > Well, there's Mailman (http://www.lists.org/), Medusa Correction: http://www.list.org Trent From saraz at videotron.ca Thu Feb 3 16:12:09 2000 From: saraz at videotron.ca (Alain) Date: Thu, 03 Feb 2000 21:12:09 GMT Subject: Running a python script from JAVA, with correct indentation Message-ID: Hi, I'm trying to run a script from a file. The script is written in python. The script is a telnet session between a router and a computer. If I run the script from a DOS prompt window, everything is good. But if I start the script from my program, using a Runtime object, there's a problem. The communication between the router and the computer is stop, even if the telnet session is still open. Here's the JAVA code: private void runPython(String fileName, String aDevice) { try { Process process; Runtime runtime = Runtime.getRuntime(); String os =System.getProperty( "os.name" ); if ( os.equals( "Windows 95" )) { String cmd = "start python " + fileName; process=runtime.exec(cmd); } else if (os.equals( "Windows NT" )) { String cmd = "cmd /C \"start python " + fileName + "\""; runtime.exec( cmd ); } } catch (IOException e) { writeToLogFile("Telnet to: "+aDevice+" failled: "+e.getMessage()); } } Is there someone have a solution? Thanks, Alain From gerrit.holl at pobox.com Mon Feb 14 02:40:54 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 08:40:54 +0100 Subject: os.shell, recursion, encryption In-Reply-To: <38a79bec_3@news5.newsfeeds.com>; from 55555@dakotacom.net on Mon, Feb 14, 2000 at 12:08:44AM -0600 References: <38a79bec_3@news5.newsfeeds.com> Message-ID: <20000214084054.A1464@stopcontact.palga.uucp> 55555 at dakotacom.net wrote on 950483324: > I'm spawning pkzip for dos using os.shell() because I would like to use the encryption > feature. As far as I can tell that is not available in the gzip library and the > documentation on the cryptography toolbox didn't give me the impression that all the bugs > were worked out. Does anyone know whether that has changed? Hmm, please type your lines a little shorter. It's not a bug: cryptograhy and archiving are two different things. Only Dos/Windows archivers combine them in one program. > Anyway, os.shell() pops up a new dos box for each call. I'm using os.path.walk() and > making a lot of calls to the zip program. I'm wondering if there is a way to not spawn > 40 windows. 0 windows would be ideal. What about os.system()? Or os.popen (does it exist on dos?)? > Finally, I'm wondering if there is a way to attach to a global variable while moving > around with os.path.walk()? I understand recursion and have read Python's scope rules > but I can't seem to either pass local varaibles through or to attach to a global > variable. Have a look at the 'global' keyword. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From pinard at iro.umontreal.ca Fri Feb 25 08:15:54 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 25 Feb 2000 08:15:54 -0500 Subject: os.path.walk (was: Re: Optimizing code) In-Reply-To: Gerrit Holl's message of "Fri, 25 Feb 2000 07:48:54 +0100" References: <20000224161930.A4922@stopcontact.palga.uucp> <20000225074854.A1014@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > > > [...] it calls stat() three times on every regular file in the tree: > > First, in os.path.isfile, second, in os.path.getsize, and third, in > > os.path.walk, which needs to find out if a filename corresponds to a > > directory or not. > I see. This has bothered me several times already, in Python. Perl has a device caching the last `stat' result, quite easy to use, for allowing users to precisely optimise such cases. In many cases, the user has no reason to think the file system changed enough, recently, to be worth calling `stat' again. Of course, one might call `stat' in his code and use the resulting info block, and this is what I do. But does not interface well with os.path.walk. It would be nice if the Python library was maintaining a little cache for `stat', and if there was a way for users to interface with it as wanted. By the way, the `find' program has some optimisations to avoid calling `stat', which yield a very significant speed-up on Unix (I do not know that these optimisations can be translated to other OS-es, however). Could os.path.walk use them, if not already? The main trick is to save the number of links on the `.' entry, knowing that it we have one link in the including directory, one link for the `.' entry itself, and one `..' link per sub-directory. Each time we `stat' a sub-directory in the current one, we decrease the saved count. When it reaches 2, we know that no directories remain, and so, can spare all remaining `stat' calls. It even works for the root directory, because the fact that there is no including directory is compensated by the fact that `..' points to `/'. I surely often use `os.path.walk' in my own things, so any speed improvement in that area would be welcome for me. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From loewis at informatik.hu-berlin.de Fri Feb 25 14:02:09 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 25 Feb 2000 20:02:09 +0100 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > These aren't: > > apply, buffer, coerce, compile, complex, dir, eval, exit, globals, hash, > id, intern, locals, round, slice, type, xrange What's wrong with def sys.exit(status): raise SystemExit(status) def globals(): import sys try: raise "" except: return sys.exc_info()[2].tb_frame.f_globals Regards, Martin From nobooze4u at BLAM!worldnet.att.net Fri Feb 11 23:40:00 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 04:40:00 GMT Subject: Thanx and keep it coming. Or I'll flame some more ...(Re: Python sucks loud) References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> Message-ID: Thanks for the pointers, this Pike thing seems interesting. It's ok that it's not used much, coz I'm not planning for a mass of users to jump on it, it is no more than a somewhat esoteric app for non-programmers, hopefully with a capacity to write little proggies for the thing. Hell, people even use Lingo ... Speaking about C--I don't care for it to be C, actually C is not the best for me, but I'd like it to be interpreted, have types (user types a big nice-to-have), and objects. And the C-ish syntax, like in Perl, so I don't have to be undergo a major attitude adjustment every time I switch from one to another. Anyway, thanks to all who contributed and keep the new ideas coming. From kc5tja at garnet.armored.net Mon Feb 21 15:14:18 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 21 Feb 2000 20:14:18 GMT Subject: Python datastructure -> Corba IDL References: Message-ID: In article , Martin von Loewis wrote: >If you are using ILU, you may consider activating the ILU extension, >where ILU would accept Python dictionaries for the above Dictionary >type: With this extension, ILU maps sequences of two-field structures >to dictionaries, if the field names are key and . I'm not the original poster of the message, so you're misattributing. I tried to offer a solution, and I did mention that some degree of custom marshalling is necessary using pure-CORBA data structures. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From charoger at online.no Tue Feb 22 15:44:47 2000 From: charoger at online.no (Roger Baklund) Date: Tue, 22 Feb 2000 21:44:47 +0100 Subject: msvcrt, open_osfhandle, locking Message-ID: Hi, I'm trying to use msvcrt.open_oshandle() to get a handle so I can lock a file using msvcrt.locking(), but it won't work. I keep getting "TypeError: illegal argument type for built-in operation". The documentation says the second parameter "shold be a bit-wise OR of os.O_APPEND, os.O_RDONLY, and os.O_TEXT". os.O_TEXT equals 16384, os.O_APPEND equals 8, and os.O_RDONLY equals 0. import msvcrt import os f=open("somefile.txt") fh=msvcrt.open_osfhandle(f,os.O_TEXT) Same error occurs if I use 16384 directly. Does anyone know what I am doing wrong? -- Roger From pinard at iro.umontreal.ca Sun Feb 13 10:10:33 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 13 Feb 2000 10:10:33 -0500 Subject: Real Problems with Python In-Reply-To: "Tim Peters"'s message of "Sun, 13 Feb 2000 04:30:47 -0500" References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: "Tim Peters" writes: > > 2. Lack of lexical scoping > > > > Tim Peters disagrees, but I miss it a lot, even after using Python > > for years. > Actually, Tim wholly agrees that you miss it a lot. Couldn't we approximate lexical scoping with classes? For the few times I needed it, I was fairly satisfied with this solution. Surely more verbose than in Scheme, but yet, given I do not use it often, I did not care the extra-verbosity. P.S. - If you see a contradiction with my previous message where I praise terseness, please consider that common and frequent idioms are better terse, while some verbosity is acceptable for things like lexical scoping, that we do less often, and for which some extra documentation is welcome. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From moshez at math.huji.ac.il Fri Feb 18 14:12:20 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 21:12:20 +0200 (IST) Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') In-Reply-To: <38AD9861.BA60E8F@inka.de> Message-ID: On Fri, 18 Feb 2000, Michael [iso-8859-1] Str?der wrote: > I guess I have to rewrite my synchronous code completely > if I want to write a medusa handler. Am i right? Yep. Medusa is only syntactic sugar for a raw select(), which tends to make your code inside-out (so to speak). If you want to do it simply, consider mixing in ThreadingTCPServer and do it in threads. (That of course assumes you are on a platform which uses threads. I believe Python can use threads on Win32 and on most Unices, but I may be wrong) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From vascog at uol.com.br Sat Feb 19 07:48:27 2000 From: vascog at uol.com.br (João Neto) Date: Sat, 19 Feb 2000 09:48:27 -0300 Subject: [Q] Python and 3D tools Message-ID: <88m003$1dani$1@fu-berlin.de> Hi Does anybody know if Python is used together with some 3D Engine? Thanks Joao Neto From c_cazabon at hotmail.com Thu Feb 10 19:16:11 2000 From: c_cazabon at hotmail.com (Charles Cazabon) Date: Fri, 11 Feb 2000 00:16:11 GMT Subject: How to get rid of the space after 'print',? References: <38A34DFE.7B286DD@aston.ac.uk> Message-ID: <8ED6B9D45hdjsdhdfh75738@news.sshe1.sk.wave.home.com> Peter Bittner claimed in <38A34DFE.7B286DD at aston.ac.uk>: > print '' > print '
Author:', # ,= no newline here > print '' # or put a function call here... > >Between and I want _no_ space, but Python automatically >inserts one. - How can I force Python not to do this?? Try: print '' print '
Author:' \ '' By using line continuation (\), python will automatically treat the two strings as one, just like an ANSI C compiler will. Of course, it begs the question, why not just use: print '\n -------------> I have written a parser to make the code python compliant ;) <--------------------- print "\n" print "\n", ---------------------> And i must exec this string in order to print my web page, well, it is not great because of the buffered print ! The method workds perfectly, but is too low because of the print ! Help me make this stuff unbeffered ! :-) I can send you my PHTML parser if you want of course ! Florent. --------- Florent Rami?re framiere at netcom-service.com Netcom http://www.netcom-service.com 15, rue de R?musat - 75016 Paris Tel : 06-60-61-85-32 --- Fax : 01-42-30-50-55 From pinard at iro.umontreal.ca Thu Feb 24 20:58:16 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 24 Feb 2000 20:58:16 -0500 Subject: Comparing perl and python In-Reply-To: c_cazabon@hotmail.com's message of "Fri, 25 Feb 2000 00:48:56 GMT" References: <88vtfj$egl$1@nntp6.atl.mindspring.net> <8EE4BF5F1hdjsdhdfh75738@news.sshe1.sk.wave.home.com> Message-ID: c_cazabon at hotmail.com (Charles Cazabon) writes: > Aahz Maruch claimed in <88vtfj$egl$1 at nntp6.atl.mindspring.net>: > >Remember that Perl is optimized to be a "super AWK". And IMO, that's > >about all it's good for. > Best description I ever heard was "`sed' on crack". Even if I am a Python lover now, I'm a previous Perl addict, and Perl was not that bad[1]. So, even if humorous, such judgements are derogative and unfair, and we should stay more open minded. Perl is used for a wide variety of applications. It has a lot of dedicated contributors, a good organisation, to the point it is undoubtly a social phenomenon in itself. We should at least recognise these facts, and even copy the good parts. Larry Wall is absolutely overwhelmed by now, but at a time he was more accessible, I found him to be a very attaching and charismatic guy. However, I would not say that much from his troops, who quite destroyed the initial spirit, in my opinion. Sad for Larry... I just hope that Python will learn from, and avoid Perl social mistakes. That would not be an easy challenge, if Python starts growing too fast... -------------------- [1] It's just that Python is better! :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From lisse at saintmail.net Wed Feb 23 21:47:28 2000 From: lisse at saintmail.net (Lisa) Date: Thu, 24 Feb 2000 02:47:28 GMT Subject: A question from a total newbie References: <88j7a2$n5e$1@nnrp1.deja.com> Message-ID: <89263v$sau$1@nnrp1.deja.com> Hi ! I am a total newbie to python, although I had a little programming experience in Pascal, Fortran and PL/1. I would firstly want to apologize if this is not the place to ask my questions, and I would be very grateful if you can point out to me where to ask, if this is not the place to ask. Thanks in advance. Here are my question: Since I am a total newbie in python, where should I start? I am thinking of starting on DOS level, without any cumbersome layers on windows. Do you recommend that? If so, where can I get python that runs on DOS? And what else do I need? What is TCK or whatever it is I saw on www.python.org? I am not sure about those things, I hope if someone here can give me a pointer or two. Books, which are the books for newbies that you recommend? There are so many books out there I do not know which ones are good. Are there any online tutorials that I can use, while I am selecting which book to buy? There are many more questions I think I should ask, unfortunately I do not know what else to ask. If you know what other questions I should ask, I would appreciate if you can help me ask the right questions. Thank you all. Please cc: me a copy of your reply so I can be sure to get your advice. Lisa lisse at saintmail.net Sent via Deja.com http://www.deja.com/ Before you buy. From niels at endea.demon.nl Wed Feb 23 07:34:50 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Wed, 23 Feb 2000 13:34:50 +0100 Subject: msvcrt, open_osfhandle, locking References: Message-ID: <38B3D3EA.C2BB4846@endea.demon.nl> Mark Hammond schreef: > file handle. The locking module works directly with file object - no > need to deal woth OS handles at all. Is this a 1.6 feature? In 1.5.2 locking() takes a file descriptor (f.fileno()), I think. -- Niels Diepeveen Endea automatisering From calishar at my-deja.com Thu Feb 3 14:27:06 2000 From: calishar at my-deja.com (calishar at my-deja.com) Date: Thu, 03 Feb 2000 19:27:06 GMT Subject: Freezing an app using win32com and wxPython Message-ID: <87ckq3$ot1$1@nnrp1.deja.com> Hi Folks, I am having problems trying to freeze an app I have written. I am not using installer because of the problems with com which I am nowhere near able to solve in the short time I have at the moment. My App is using win32com.client and wxPython, I do not have sources downloaded for either extension, and my program fits into one file. My command line at the moment is (all on one line) python freeze.py -pd:\pysrc\python-1.5.2 -od:\sifexsrc -swindows c:\progra~1\python\sifex\sifex.py d:\pysrc is the Python 1.5.2 source files c:\progra~1\python\sifex\sifex.py is my source file which starts with the lines "import win32com.client" and "from wxPython.wx import *". When I run freeze, it finishes saying there unresolved module references, which is fine because I plan to incluide the appropriate dll files and reg entries. Freeze reports: freezing wxPython.wx ... generating table of frozen modules No definition of module pythoncom in any specified map file. No definition of module pywintypes in any specified map file. No definition of module win32api in any specified map file. No definition of module win32ui in any specified map file. No definition of module wxPython.wxc in any specified map file. Warning: unknown modules remain: pythoncom pywintypes win32api win32ui wxPython.wxc How close am I to getting this app succesfully frozen, and how can I go the last mile? (I do not have a PYTHONEX env.variable, partly because I'm not sure what it is for or what to set it to) Any help on this would be greatly appreciated, Calishar Sent via Deja.com http://www.deja.com/ Before you buy. From zeitlin at lpthe.jussieu.fr Fri Feb 18 14:59:54 2000 From: zeitlin at lpthe.jussieu.fr (Vadim ZEITLIN) Date: Fri, 18 Feb 2000 20:59:54 +0100 Subject: Which GUI? In-Reply-To: References: Message-ID: <200002181959.UAA30202@seth.lpthe.jussieu.fr> In comp.lang.python, you wrote: >> Talk about portability: it is Ok to say >> that wxPython is portable > >No it is not. It doesn't work on AIX. Following this logic (and considering my another reply in this thread) I can proudly announce that wxPython is 100% portable: it works on AIX! I think I'm going to rethink the meaning of the word "portable" for a while... Regards, VZ From tismer at tismer.com Fri Feb 18 10:00:12 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 18 Feb 2000 16:00:12 +0100 Subject: Continuations and threads (was Re: Iterators & generators) References: <1261240950-13316884@hypernet.com> Message-ID: <38AD5E7C.587072C@tismer.com> Gordon McMillan wrote: > > Toby Dickenson wrote: > > > What are the implications for the continuation-naive in a > > post-stackless world. What about functions such as... > > > > def x(): > > before() > > try: > > y() > > finally: > > after() > > > > Today, either of three things happen: > > 1. before() throws > > 2. before() and after() are called exactly once each > > 3. x() never returns because y() never returns > > > > As I understand continuations, we now have the possibility of y() > > returning more than once, with after() called more times than before() > > No. In the absence of specific instructions otherwise, the > frame dispatcher will behave as expected. I think Toby meant it this way: consider a weird y() defined as follows def y(): global gotcha try: gotcha except: gotcha = continuation.caller() This thingie will save its caller's continuation when run for the first time. Later on you can simply call gotcha() and we are backt at y's call, reciting Toby: > > y() > > finally: > > after() In other words, we can leave the function more often than we entered it :-) ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 12163 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 hanche at math.ntnu.no Sat Feb 26 10:09:15 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 26 Feb 2000 10:09:15 -0500 Subject: Q about tail recursion References: <000a01bf8033$269bdee0$3c2d153f@tim> Message-ID: + "Tim Peters" : | > def faketailadd(inlist): | > sum = [] | > def add(recur,inlist, sofar, container): | > if inlist: | > recur(recur, inlist[1:], sofar+inlist[0], container) | > else: | > container.append(sofar) | > add(add, inlist, 0, sum) | > return sum[0] | | Both "recur(recur, ..." and "container.append(..." are tail calls in this | "add"). Um, not really, because they are followed by an implicit "return None". They would become tail calls if preceded by the keyword "return". This seems to be one of those examples in which more is less. Not that it mattes really, since Python doesn't optimize tail calls anyway. anally-correct-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 bparsia at email.unc.edu Tue Feb 8 20:35:02 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Tue, 8 Feb 2000 20:35:02 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> <38A06B68.AA77099F@sage.att.com> Message-ID: <1e5p94k.1gm7e6gjqhc9vN%bparsia@email.unc.edu> Garrett G. Hodgson wrote: > fcahoon at my-deja.com wrote: > > > > In article <1e5nkk6.1a5z8bp1lixbdvN%bparsia at email.unc.edu>, > > bparsia at email.unc.edu (Bijan Parsia) wrote: > > > I think, notwithstanding your experience with C (though why that > > should > > > be applicable to Python...), *you* have a riddle to answer: There is a > > > *lot* of Python code out there. The standard distribution contains > > loads > > > of modules from many different sources. You *yourself* indicate that > > > Python is becoming common place.... > > > > The popularity of a language cannot be taken as prima facie evidence of > > its technical superiority. > > he didn't say it was. what he said was, lots of code has been > written, and empirical evidence suggests that your fears are > unfounded. Yes. Thanks! Cheers, Bijan Parsia. From morse at harborcom.net Wed Feb 16 09:27:16 2000 From: morse at harborcom.net (Kevin Dahlhausen) Date: Wed, 16 Feb 2000 14:27:16 GMT Subject: ANN: srecdump 1.0 Message-ID: <38aab2d2.179529299@news.oh.verio.com> S-Record Dump 1.0: A utility that displays information about Motorola S-Record files. It parses the file and prints a list of continuous memory regions, the program start address, any comment records, and a memory dump. For now you must have Python installed to run it. Sample output: File: 2623.SRE Starting Address: 0xFFC000 Contiuous Regions: start end length 0xffc000 0xffc4fa 1274 0xffc4fc 0xffc540 68 Comments: 2623 SRE Memory Dump: 16760832 ffc000: 07 00 ff e0 00 6a 38 00 ff ff 09 70 40 6a 38 .....j8....p at j8. 16760848 ffc010: ff fe 39 70 40 6a 38 00 ff fd b4 70 30 7a 02 ..9p at j8....p0z.. 16760864 ffc020: ff ff aa fc ff 7a 06 00 ff c4 fc 5c 00 03 d8 f3 ....z.....\.... You can download it at: http://www.geocities.com/SiliconValley/Peaks/4673/python.html#srecdump From backov at nospam.csolve.net Fri Feb 25 11:46:13 2000 From: backov at nospam.csolve.net (Jason Maskell) Date: Fri, 25 Feb 2000 16:46:13 GMT Subject: Win2k and Python access violation - please help me out here! References: Message-ID: Oops, I missed 3 lines at the top of the call stack: NTDLL! 77f8ed61() NTDLL! 77f8ecf1() MSVCRTD! 10238575() Cheers, Jason From tismer at tismer.com Thu Feb 10 18:35:56 2000 From: tismer at tismer.com (Christian Tismer) Date: Fri, 11 Feb 2000 00:35:56 +0100 Subject: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> Message-ID: <38A34B5C.C62B7C86@tismer.com> "Eaglestone, Robert [NGC:B918:EXCH]" wrote: > > Hello all, > > In general, it seems to me that all good programmers > indent their code. However, mandating it as part of > the form of a language sounds ... strange. This can be a failure of the language or or your ears. > However, I don't like the BEGIN...END bracketing done > by Pascaline languages; neither do I love the {...} > of C and its descendants. When you write Pascal, Modula, Oberon or Delphi (what I did for years), you are used to it and will probably like it. When you write C or C++, the braces will be not that bad after some time. > Has the creator of Python looked into fully bracketed > syntax? That might not be the actual term, so here's > an example of what I'm thinking about: I think he is programing since over 20 years but probably never had time to think about braces. That's for sure one of the reasons to omit them for Python :-) > if ( foo > bar ) > do_something(); > do_something_else(); > done(); > endif Whowwwww! What a nice concept. Maybe you should invent a new language? You might think of a very new name, something like "Visual Basic"? > This bracketing gets the best [ or worst ] of both > worlds, with a bit of syntactic sugar added for free. How do you define "best" in a person independant manner? > The lead bracket is the keyword itself, and the end > bracket is tailored for that keyword alone. Only > one 'line' is 'wasted' by the end bracket (Python > doesn't like wasting lines). And indentation is no > longer a language issue. The lead bracket is the keyword itself, and the end bracked is obvious by indentation and no longer necessary. If you want to waste one line, use #endif. This feature was added to Python long time ago and isn't very well known. Python is so flexible that you even can choose anything behind the "#". > I only know of one language which uses this syntax, > and it's not in common use. However, lots of us may > have seen this kind of syntax in college (hey! is it > part of ML?). Bill Gates would kiss you for this :-) > I guess what I'd like is some clear reasoning about > bracketing and indenting that warrants such a feature > of a language. If you like Python, you will like indentation. Indentation belongs to Python like Python belongs to Guido. I-did-not-intend-to-hurt-you-by-indent- -but-it's-easier-to-change-you- -than-Python's-intended-indentation -ly y'rs - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 cjc26 at nospam.cornell.edu Mon Feb 14 22:10:39 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Tue, 15 Feb 2000 03:10:39 GMT Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> Message-ID: Pada 13 Feb 2000 10:18:13 -0500, Fran?ois Pinard bilang: | | Just for fun, my own difficulty was to break the habit of the space before | the opening parenthesis which is part of a function call, since it has | been burned from GNU standards into my neurons, years ago. Now I know who to curse the next time I see code formatted like that. and-i-thought-it-was-microsoft-ly y'rs, -- cliff crawford -><- http://www.people.cornell.edu/pages/cjc26/ I think, therefore I'm single. From steve.mnard at sympatico.ca Tue Feb 1 14:06:14 2000 From: steve.mnard at sympatico.ca (Steve Menard) Date: Tue, 1 Feb 2000 14:06:14 -0500 Subject: RMI or RPC for python ? References: Message-ID: Mark NG wrote in message news:hwsd7qhhxih.fsf at murlibobo.cs.mu.OZ.AU... > > > G'day, > > Does there exist a Remote Method Invocation or Remote Procedure Call > framework for Python like the RMI classes/interfaces in java ?? > or do we have to go it alone with the pickle jar ? > > > thanks, > mark Take a look at PYRO ( http://www.xs4all.nl/~asz00557/python.html). It is essentially RMI for python. From robin at jessikat.demon.co.uk Wed Feb 16 21:04:07 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 17 Feb 2000 02:04:07 +0000 Subject: PROPOSAL: fix tabs & spaces in default library In-Reply-To: References: <20000213201812.A4849@stopcontact.palga.uucp> <38AB1830.3FEE1EC7@earthlink.net> Message-ID: In message , Fran?ois Pinard writes >Robin Becker writes: > >> I feel tab equivalent to 4 spaces is pretty good > >Just to be overly clear, you meant an indent step of 4 spaces. Tabulations >called by the TAB character, if it has to be, are OK when set at every 8 >columns. Sorry for discussing such a, euh, hum, "delicate" matter here! :-) > yes sorry to be so unclear -- Robin Becker From gmcm at hypernet.com Tue Feb 1 09:05:52 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 1 Feb 2000 09:05:52 -0500 Subject: Packages, modules, libraries,... In-Reply-To: Message-ID: <1262708548-3423046@hypernet.com> Mikael Olofsson wrote: > > I've seen the words package, module, and library, used in this group > frequently. I'm the naive type of programmer, so I thought that these > were synonyms. Now, some people seem to use these words as such, but > then there are others who seem to distinguish between them. What is > true? Are perhaps both views true in some sense? Could someone please > enlighten me. A module is a very well-defined thing (it has a C level type object). This is where code lives (eg, string.py). A package is a (well defined) way of organizing modules. A directory containing an __init__.py module is a package, and modules therein can be imported as ".". A library is an ill-defined thing; most probably used to mean a directory of modules without an __init__.py, but since it has no exact meaning in Python, it's hard to say for sure. - Gordon From effbot at telia.com Wed Feb 9 17:42:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 22:42:42 GMT Subject: Solaris 2.7 __imaging.so ? References: <87sm73$mms$1@mwrns.noaa.gov> Message-ID: Barry McInnes wrote: > When I create the Imaging 1.0 library under Solaris 2.7 > I get lots of undefined symbols. These can be overcome > by adding the correct libraries to the makefile or compiling/linking with the right options (read on) > but then I get the following error when trying to run the > recommended test > > lore> ImportError: ld.so.1: python: fatal: ./_imaging.so: required mapping 0x10000 size 0x206000, is already in use by file python I'm not really a Solaris hacker, but that sure looks like you've failed to create position independent code. - are you successfully using shared Python extension modules? (i.e. have you uncommented the *shared* comment in Modules/Setup?) - do you compile with -fpic (or whatever that is on Solaris gcc) and link with all the necessary options (Python ought to figure that out for you -- maybe you've just copied the sources from another box, and forgot to clean things up before rebuilding?) From effbot at telia.com Sun Feb 13 07:11:31 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 12:11:31 GMT Subject: When to compile regex? References: <38A69D62.5A68F54D@chelmsford.com> Message-ID: David Shochat wrote: > In section 4.2.3 of the Python Library Reference (1.5.2) it says that > using compile is more efficient "when the expresion will be used several > times in a single program". I'm trying to figure out the intended > meaning of this. rule 1: always compile regular expressions rule 2: for throw-away scripts, or any situation where programmer time is more important that execution time, ignore rule 1. From ivanlan at callware.com Fri Feb 18 09:27:45 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 18 Feb 2000 07:27:45 -0700 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262152524-5049647@hypernet.com> <38A33AD9.3F4EA190@americasm01.nt.com> <88gu3a$o8s@newton.cc.rl.ac.uk> Message-ID: <38AD56E1.870D16DA@callware.com> Hi All-- Warren Postma wrote: > > > > > So its seems to me that the compelling reason is inertia. > > > > "Idiom Reuse" > ie: Inheritance. > Isn't that "Idiot Reuse"? -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 mwh21 at cam.ac.uk Mon Feb 14 14:38:09 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Feb 2000 19:38:09 +0000 Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> <38A855DC.2DDB5FBA@earthlink.net> Message-ID: Charles Hixson writes: > Well, in Eiffel one would need to declare the inheritance pattern to > by used by x wouldn't you? Fair point. > Where Python doesn't have declarations > of variables. I suppose that one could interpolate a rule that said > something like: > "The value of a variable inherited from more than one ancestor class must be > prefixed by the name of the class from which it was inherited." > Which shouldn't break any code that was currently safe. The other > alternative would be to require that those variables be renamed (in > essence, the Eiffel solution) .. > Thus: > for Foo.x use fooX > for Bar.x use barX > etc. > > Neither solution seems to fit *really* nicely into Python. Neither > clashes very badly. My personal preference is the renaming > solution, because otherwise occasionally names will grow too long to > be convenient. But it doesn't seem a difficult problem, merely a > real one. It's not exactly an area I know a huge amount about, but I do know that in Eiffel you can still get yourself in trouble along these lines (I'm not too sure how; people who know more than I have claimed this), and Eiffel is about the most carefully-designed-to-type-safety OO langauge I know of, so I'd say it was a difficult problem. Cheers, M. From alex at somewhere.round.here Tue Feb 22 16:03:51 2000 From: alex at somewhere.round.here (Alex) Date: 22 Feb 2000 16:03:51 -0500 Subject: Python mode - `C-c |' feature suggestion References: <14514.45176.931019.526625@anthem.cnri.reston.va.us> Message-ID: > Just a little note. The `-no-properties' functions are less portable. > You can usually go with the more standard ones, at the expense of a > few computing cycles, later. Nothing to worry about in most cases. Hi, Francois. That's good to know. Funnily enough, I was only dimly aware of the buffer-substring-no-properties function. It just popped up when I hit complete. Must-be-an-anti-XEmacs-conspiracy'ly Alex. From moshez at math.huji.ac.il Thu Feb 17 14:07:06 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 17 Feb 2000 21:07:06 +0200 (IST) Subject: Which GUI? In-Reply-To: <14508.12208.365515.624845@weyr.cnri.reston.va.us> Message-ID: On Thu, 17 Feb 2000, Fred L. Drake, Jr. wrote: > Gerrit Holl writes: > > I think we really should create an extensive list with all available > > GUI's, with all advantages and disadvantages and a table with info > > like crossplatformness, learning curve... > > I think we can link to it from python.org when you have it ready; > send a note to python-docs at python.org with the URL. > Isn't the volunteerism in this community great? ;) Well, I think Gerrit managed to figure out how to use Guido's time machine: Cameron Laird had a page about it. I'm too far from a decent browser to look for it, but it shouldn't be hard to find. One catch: such a list is almost as bad as a list of all high-level languages with a summary of advantages and disadvantages. anyone-for-another-round-of-whitespace-flamage-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From cbbrowne at news.hex.net Wed Feb 9 20:19:31 2000 From: cbbrowne at news.hex.net (Christopher Browne) Date: Thu, 10 Feb 2000 01:19:31 GMT Subject: mail filter in python? References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> <14495.11639.467461.357073@beluga.mojam.com> <200002072129.PAA47259@starbase.neosoft.com> Message-ID: Centuries ago, Nostradamus foresaw a time when Jari Aalto+mail.emacs would say: >* Mon 2000-02-07 Cameron Laird mail.misc >| , >| Skip Montanaro wrote: >| > >| > Cameron> In any case, I agree with Mr. Wouters: use procmail, and just >| > Cameron> invoke your Python work as an external process. >| > >| >Worth noting that the procmail tips page at >| > >| > http://www.procmail.org/jari/pm-tips.html >| > >| >mentions Lua as a possible replacement for the procmail language (see the >| >end of question 3.5). That item was presumably added about two years ago, >| >so I tend to think it's either very hard to do or didn't generate enough >| >steam in the procmail community. If such a thing was possible with Lua, it >| >would likely be possible with Python as well. Anyone for "pluggable >| >brains"? > >Correct. I don't know how procmail integrates to the current >language, but I have feeling that it it pretty tight bound to the >current implementation. I'd go along with the "write a .procmailrc generator" idea; that has the lowest impact, and other merits. >There were a discussion in the Emacs list about replacing the >obscure and 'distant-to-anynone' language Emacs-Lisp with some other >pluggable language like Perl (An there is/was already a prototype >about this), but the general reaction was that Emasc was too bound to >lisp already. > > "Perlmacs -- Perl as Emacs extension language" > http://www.perl.com/CPAN/authors/id/JTOBEY/ > >XEmacs team may get serious with pluggable language modules at some >time, since the core is more modular than in Emacs. The intent with GNU Emacs is to replace Elisp with Scheme (specifically Guile). There has been talk about having XEmacs move to using Common Lisp; see also discusses this. The conclusions are not strongly conclusive on the XEmacs side of things... I don't think you're likely to get agreement on a move to Perl, or to Python, for that matter, as those that wrote Emacs happen to *like* Lisp, and, despite there being some strong parallels between Perl and Common Lisp, the CL community appears not to be terribly enthralled with Perl. I expect that there are not quite so strong opinions against Python, but I doubt it would get a clear "yes." >| I'm sending a copy of this to Jari Aalto, who might be >| able to help. My purely personal speculation is, the >| latter: "it ... didn't generate enough steam in the >| procmail community." I'll grossly generalize that the >| mailing-agent communities tend to regard C as the >| natural language for all implementations, and see little >| advantage to such distractions as higher-level scripting. >| Lua is very simple to interface, unless some catastrophic >| surprise turned up specifically with the procmail work. > >I checked the lua and seemed quite interesting, if there is >a way to hook it into procmail I'd be interested too. >Philip? [the current procmail maintainer] > >| Yes, of course Python is also quite simple to interface. Note that Cooledit integrates Python as its scripting tool; that may make it more suitable as an option for those that would like to do "powerful text editing using Python." -- Necessity is the mother of invention. Insanity is the mother of straitjackets. cbbrowne at hex.net- From nielsenjf at my-deja.com Thu Feb 24 18:19:41 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Thu, 24 Feb 2000 23:19:41 GMT Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: Message-ID: <894ea9$h33$1@nnrp1.deja.com> Maybe it is a version issue? What version of python are they running? I get sub 1 second responses with ASP and python using the <%@ LANGUAGE = Python%> directive. john In article , Tom Funk wrote: > > A similar thread started here a few weeks ago, then seemed to die. There > was no definitive answer, though. > > I've noticed a *definite* performance hit from my ISP when their IIS > server delivers pages containing <#@Language=Python#>. There seems to be > a consistent 7-8 second delay while serving such pages. Pages that don't > use this directive, or that specify VBScript or JavaScript, don't suffer > the same fate. > > I tested with an ASP page that looks like this: > > <#@Language=Python#> > > > > > >

This is a test > > > > > This page should load nearly instantaneously. However, using Python with > @Language causes a consistent 7-8 second delay. There's no *discernable* > delay for VBScript, JavaScript or when the Language directive is skipped > completely. > > A previous suggestion was to change the default language for the site > from VBScript (or JavaScript) to Python. Did anyone try this? Does this > actually work? If not, does anyone have any other suggestions? Could > some portion of the Python run-time be recompiling on each call (i.e., > IUSR_COMPUTERNAME doesn't have write access to a directory on PYTHONPATH > and the .pyc files are never created)? > > My ISP tends to be slow to respond to requests, so before I ask them to > monkey around with my site's IIS settings, I'd like to know if what I'm > asking for will actually work. > > Thanks in advance. > > -=< tom >=- > Thomas D. Funk | "Software is the lever > (no_spam_tdfunk at asd-web.com_no_spam) |Archimedes was searching for." > Software Engineering Consultant | > Advanced Systems Design, Tallahassee FL. | > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From paul.robinson at quantisci.co.uk Fri Feb 11 05:30:20 2000 From: paul.robinson at quantisci.co.uk (Paul Robinson) Date: Fri, 11 Feb 2000 10:30:20 +0000 Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> <38A2E64D.CB7DA73A@infercor.no> Message-ID: <38A3E4BC.3C98BB1D@quantisci.co.uk> Paul Boddie wrote: > > thucdat1143 at my-deja.com wrote: > > Check this out: www.ruby-lang.org to see what IBM is talking about Ruby. > > The IBM article [1] is rather amusing. At every point of comparison between > Ruby, Python and Perl, examples of Ruby and Perl, but not Python, are given to > "demonstrate" Ruby's syntactic superiority. I received the following from the author of that article (in reply to the message below). Most interesting quote: """I thought it was pretty clear that the difference between python and Ruby - at this point - is largely one of taste and aesthetics.""" - that's not the impression that I got from reading that article!! Dear Mr. Robinson, I'm sorry you did not like my article and I appreciate the comments and understand your concerns. The intent of the article was not to misleadingly sell Ruby over either Python or Perl, but to get people excited over a new language that has a lot to offer. I thought it was pretty clear that the difference between python and Ruby - at this point - is largely one of taste and aesthetics. But you are right, the comments ought to have been backed up with more concrete examples. Thanks for your input, Sincerely, Maya Stodte -----Original Message----- From: Paul Robinson [mailto:paul.robinson at quantisci.co.uk] Sent: Thursday, February 10, 2000 12:07 PM To: mstodte at pop.mail.rcn.net Subject: Perl, Python and Ruby Dear Madam, Re your article, "Ruby: a new language" ( http://www-4.ibm.com/software/developer/library/ruby.html ). I was disappointed with your article that promised comparison between Ruby, Perl and Python. I felt the article was unnecessarily biased towards Ruby (and more particularly against Python). Is there a reason that there were no code examples of Python? It would seem that to keep the mood of the article in favour of Ruby they were left out. I would also like to address some of your statements (of fact?) regarding Python. "Ruby does not access object attributes by default as Python sometimes does." Could you explain that point please? I do not understand this. "Ruby's functions and methods, unlike Python's, are not first class objects." First class functions and methods are good thing, aren't they? "Ruby converts small integers and long integers automatically;" This could be considered a "bad (TM)" feature. "Though it is rarely claimed that Ruby is more powerful than Python, Ruby is faster, more natural, more elegant, and increasingly more popular." I would like to hear the justification behind these points. Thanks for your time, Paul Robinson (Python Developer (in case you didn't guess)) ----------------------------------- Business Collaborator Team Enviros Software Solutions http://www.businesscollaborator.com ----------------------------------- From mwh21 at cam.ac.uk Thu Feb 17 12:31:04 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 17 Feb 2000 17:31:04 +0000 Subject: dumbass locale question References: <200002171700.LAA21343@beluga.mojam.com> Message-ID: Skip Montanaro writes: > I run a web site here in the US, but I get input from all over. If I ask > for > > "c".upper() > > I get the appropriate response: "C". However, if I ask for "?".upper(), I > don't get "?", I just get "?". > > I don't have the luxury of assuming that my users come from one locale or > another. I can assume for the most part that they are entering letters that > come pretty much from the Latin-1 character set. To get "?".upper() to work > can I play some tom-foolery with the locale or must I craft my own upper() > and lower() functions? Seems to me that setting LC_CTYPE to just about anything other than `C' does the trick: [mwh21 at atrus speedtest]$ LC_ALL=en python # my LC_ALL is usually en_GB Python 1.5.2+ (#13, Jan 14 2000, 09:26:45) [GCC 2.95.2 19991024 (release)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> print '?'.upper() ? >>> import locale >>> print '?'.upper() ? >>> locale.setlocale(locale.LC_CTYPE ) 'C' >>> print '?'.upper() ? >>> locale.setlocale(locale.LC_CTYPE,"en_US" ) 'en_US' >>> print '?'.upper() ? >>> locale.setlocale(locale.LC_CTYPE,"C" ) 'C' >>> print '?'.upper() ? I don't really understand this either, but I hope this is of some use. Probably depends on you libc, too. Cheers, M. From fdrake at acm.org Fri Feb 25 16:21:01 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 25 Feb 2000 16:21:01 -0500 (EST) Subject: [comp.lang.python] Reference Counting Documentation (longish) Message-ID: <14518.62013.740513.211620@weyr.cnri.reston.va.us> Tom wrote: > And now for the point of this whole story: I think we need a reference > counting cheat sheet in the C API Reference Manual rather badly. I'm Tom, The next release of the reference will include *much* better reference count information, thanks in large part to Skip Montanaro. For each function that returns an object reference, the status of that reference (new or borrowed) will be specified. Functions which change the modify the status of references passed in will be properly documented. > not talking about anything elaborate, just a simple table showing each > function in the API, and what it does to the reference counts of its > arguments and return value. (It could even be part of the current > entries for each function.) This would be an absolutely priceless > resource for anyone doing embedding and extending. I agree; I've wanted it a few times myself! -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From paul at prescod.net Wed Feb 16 21:57:34 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 16 Feb 2000 18:57:34 -0800 Subject: Jpython and continuations References: <001701bf7853$6cc790e0$b7a0143f@tim> Message-ID: <38AB639E.2246E68@prescod.net> Tim Peters wrote: > > ... > Discussions on this stretched over many months last year, beginning in about > May. Guido developed a nearly complete implementation plan for generators > in the "Generator details" thread of July '99, in the Python-Dev archives. One thing to consider is what of this can be easily added to JPython. I'm a little leery about continuations because JPython uses the Java stack, doesn't it? It does have a concept of a Python frame but the "instruction pointer" is implicit in the JVM, not explicit in an interpreter loop. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From tmt1630 at cs.rit.edu Sun Feb 20 12:58:41 2000 From: tmt1630 at cs.rit.edu (Thomas & Jennifer Thompson) Date: Sun, 20 Feb 2000 12:58:41 -0500 Subject: PIL Problem: New image is all black on Unix? Message-ID: <38B02B50.482854B7@cs.rit.edu> I'm running Python v1.5.2 on Solaris 5.7 with PIL v1.0. When I create a new image of type "1' and size xy with either white or black pixels, the image comes out black in both cases. So: >>> import Image >>> raw=Image.new("1", (20,20), 0xFF) returns a black image which I expect to be white. >>> import Image >>> raw=Image.new("1", (20,20), 0x00) returns a black image which I do expect. Further, if I try to set a pixel to white using ImageDraw.setink(color) and ImageDraw.point(xy), it still comes out black. These commands work fine on my Win95 system (Python v1.5.1, PIL v1.0b1). Is this a known bug with PIL and Solaris and will using the latest version of PIL for Solaris fix this? Or did I miss something somewhere? Any help would be greatly appreciated! Tom Thompson From kopecjc at worldnet.att.net Sun Feb 20 09:28:04 2000 From: kopecjc at worldnet.att.net (Joseph C. Kopec) Date: Sun, 20 Feb 2000 14:28:04 GMT Subject: MySQL Web Interface Message-ID: <38AFF976.A97026F4@worldnet.att.net> I have been using MSSQLdb to access MySQL databases and have put started to put together a simple table-building CGI-BIN script in Python to display the results via an HTML interface, as well as to allow SQL queries to be formulated and submitted via a form. Before I put much effort into generalizing this script, I was wondering whether there were any modules already available to do this -- I have got to imagine this is a problem that has been solved numerous times before. Any suggestions would be much appreciated. From phd at phd.russ.ru Fri Feb 11 09:48:48 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 11 Feb 2000 14:48:48 +0000 (GMT) Subject: PyApache, couldn't geta hold of author, willing to donate sometime In-Reply-To: <38A3D8E2.D72E965A@columbus.rr.com> Message-ID: On Fri, 11 Feb 2000, Mark Nielsen wrote: > The thing is, I don't know the status of Python and Apache! It is slowly evolving. Most people (including myself) are pretty satisfied with the PyApache, so not much work need to be done. If you need a feature, ususally you will develop it youself, and publish a patch on PyApache mailing list, like I did few times. > Is there a better module instead of PyApache? No, there is no "better", but there is different module - httpdapy. I personnaly use PyApche, slowly moving from CGIs to Zope, or at least PCGI. > If not, I (and at least one other person) would be more than happy to work with > other > people to make Python THE programming language to use with Apache. So would I! :) Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From rapto at arrakis.es Tue Feb 15 17:05:19 2000 From: rapto at arrakis.es (Marcos =?iso-8859-1?Q?S=E1nchez?= Provencio) Date: Tue, 15 Feb 2000 22:05:19 +0000 Subject: Newbie : postscript printing References: Message-ID: <38A9CD9F.850B0964@arrakis.es> Support wrote: > > How to make a program to print my data (from database) to > postscript printer (under linux) ?. > does python provide a tools to print a document ? > > Thanks. Try piddle http://www.strout.net/python/piddle/ From bradh at mediaone.net Thu Feb 10 00:45:37 2000 From: bradh at mediaone.net (Brad Howes) Date: Thu, 10 Feb 2000 05:45:37 GMT Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> <38A24345.3F763311@Lugoj.Com> Message-ID: James Logajan writes: > By the way, speaking of code blocks, does anyone know of any languages that > use blocks...literally? That is, given the prevalence of GUIs, a development > environment/language where code is contained in rectangles? The scripting language 'Frontier' has an outline metaphor -- you can collapse/expand blocks of code. Check out http://www.userland.com. Brad -- "Were people this stupid before TV?" -- _White Noise_ by Don DeLillo From egbert at bork.demon.nl Fri Feb 18 14:27:33 2000 From: egbert at bork.demon.nl (Egbert Bouwman) Date: Fri, 18 Feb 2000 20:27:33 +0100 Subject: Database API explanation Message-ID: <20000218202732.A8483@bork> I need some help or explanation on the Python Database API Specification [12].0 especially how to use them with MySQL, but of course some general tutorial is very welcome as well. The specifications themselves are less than illuminating for me. Earlier I asked more or less the same question, but no reaction. But somebody must have written something, I suppose. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From calishar at home.com Tue Feb 29 19:21:00 2000 From: calishar at home.com (Calishar) Date: Wed, 01 Mar 2000 00:21:00 GMT Subject: Is mxDateTime compatible with Installer References: <1260338722-27026465@hypernet.com> <1260332056-27427441@hypernet.com> Message-ID: On Mon, 28 Feb 2000 21:13:59 -0500, "Gordon McMillan" wrote: >[In response to Calishar's problem with Installer and mxDateTime, I wrote]: > >> There is a bug in beta3f. > >Which is true. But > >> Line 168 of MEInc.Dist.resource.py >> reads: >> if string.find(name, '.') == -1: >> It should read: >> if string.find(name, '.') != -1: > >was not. Thanks a lot Gordon, I managed to get it working. I did have to remove the if statement (left a two line method I believe). However, that didn't end up resolving my problem. The mxDateTime package is constructed as follows (libdir)[1]/DateTime/mxDateTime the DateTime package contains some other utilities (feasts, ISO, ARPA, lazyimport), and the mxDateTime package. the mxDateDtime package contains the mxDateTime.pyd file. The __init__.py file in DateTime imports the DateTime.py file, which imports the mxDateTime package. The __init__.py file in the mxDateTime directory just imports the mxDateTime.pyd file. It looks as if either Installer was getting confused, or the final app was getting confused by having two levels of mxDateTime it could import. The way I ended up solving it was renaming the mxDateTime directory to something else, and copying the mxDateTime.pyd file to the dlls directory under (pythonroot)[2]. Since you know how Installer works a lot better than I do (or could hope to figure out during an insanity packed day) does my solution make logical sense? (I know it works, just wondering if you can explain why) Once again, thanks for all the help on this (and if you can figure out how to let us change icons on win9x machines, I promise to try to setup the first shrine to Gordon Macmillan in this city, can't do it someone else has beaten me to it) Calishar [1] (libdir) = directory where standard modules are installed [2] (pythonroot) = directory where python is installed (in my case c:\program files\python) From mwh21 at cam.ac.uk Wed Feb 2 09:48:54 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 02 Feb 2000 14:48:54 +0000 Subject: Am I programming in Python mode? References: <4TCYOB7LsZetOVPsMbGsNhmZpfcB@4ax.com> Message-ID: Anders M Eriksson writes: > Hello! > > Being new to Python I would like your comments on this function. Is it > written in Pytnon mode? Only you can tell if it was written in Python mode ('round here Python mode usually refers to the emacs major mode for Python). I can try and help with style, which is what I'm fairly sure you meant. > The function returns a random string, and have 3 params the lenght of > the string, lowercase/Uppercase and dublicates > > Any comments and/or suggestions are welcome!! > > // Anders > > > > def randStr(n, lower=1, dublicates=1): > # returns a random string with characters > # lower if true only lowercase letters > # dublicates if true then the same letter can be repeated This bit could (should) be in a docstring, not a comment. > if lower: > l = ord('a') > h = ord('z') > else: > l = ord('A') > h = ord('z') Hmm, does this actually work? ASCII goes like: ... STUVWXYZ[\]^_`abcdefghijk ... so the above will get strings containing [\]^_` characters. > str = "" > generator = whrandom.whrandom() Why do you want your on generator? > for i in range (n): > ch = generator.randint(l,h) > if dublicates: > str = str + chr(ch) It's probably better to accumulate substrings into a list and use string.join to stick them together. This is particularly true in the single character case, 'cause they're cached. > else: > bRepeat = 1 > while bRepeat: > if not chr(ch) in str: > str = str + chr(ch) > bRepeat = 0 > else: > ch = generator.randint(l,h) > > > return str You do know about random.choice don't you? It selects a random item from a sequnce - and strings are sequences. So if I were doing this I'd do it like this: import random,string def randStr(n,lower=1,duplicates=1): """ randStr(n:Integer[,lower,duplicates]) -> String Generate a random string of length n. If |lower| is true (the default), only lowercase letters will be used. If |duplicates| is true (the default), the string may contain duplicates. """ if lower: choices = 'abcdefghijklmnopqrstuvwxyz' else: choices = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' result = [] if not duplicates and n > len(choices): raise ValueError, "n too large" for i in range(n): while 1: ch = random.choice(choices) if duplicates or ch not in result: result.append( ch ) break return string.join(result,'') This probably isn't perfect, but I hope in helps. Cheers, Michael From tim_one at email.msn.com Tue Feb 22 02:35:10 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 22 Feb 2000 02:35:10 -0500 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <38B20B5E.B5DF949@cosc.canterbury.ac.nz> Message-ID: <000401bf7d07$59acc080$e82d153f@tim> [Greg Ewing] > Oh, no, nooo, nooooooo... > > Is there time to stop this madness? Doubt it. It was debated at length before Barry implemented it. Write it this way instead, and it reads beautifully & naturally: tab = "\t"; space = " "; nospace = "" tab.join(list_of_strings) space.join(ditto) nospace.join(user_sequence) That is, you don't *have* to use a character literal (which indeed "looks funny", although less and less so the longer the string). > ... > Whatever you do, don't stuff it onto some arbitrary > type just for the sake of making it a method. It's not arbitrary. The essence of the current string.join is the string used as glue; indeed, that's why join has been in the string module all along. From moebetter1 at americamail.com Mon Feb 21 16:34:58 2000 From: moebetter1 at americamail.com (moebetter1 at americamail.com) Date: Mon, 21 Feb 2000 16:34:58 -0500 (EST) Subject: PATENTED INVENTIONS WANTED!! Message-ID: <200002212134.QAA02295@pop02.iname.net> Maurice Johnson ID# C2233 512 Green St. Gilmer, Tx 75644 Date: 2/21/00 Dear [name], My name is Maurice Johnson and I am acting as a Finder for an International Association, which is the exclusive Finder for a Real Estate Investment Company (Established in 1976). I found your website at http://www.informatik.uni-freiburg.de/Java/misc/lang_list.html and I am searching the Internet for companies or inventors wishing to buy or sell patented inventions. The sole purpose of this organization is to locate the very best of International Investments, exclusively for this well established Real Estate Investment company. We are an organization of Hunters and Finders who seek out the best and most exciting investments worldwide. One of the fields that this company is interested in is patented inventions. If you have a patented invention and you would like to advertise free, sell, or develop your product? Should you be interested in the above, simply reply with the words (send me company info) on the subject line and you will recieve the Real Estate Companies contact information. Thank you for your time and for reading this note. Sincerely, Maurice Johnson ID C2233 FIIFA Associate If you have received this message in error or if you do not wish to receive any further mailings from us, please reply with the word (remove) in the subject line. From moshez at math.huji.ac.il Fri Feb 25 09:42:19 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 16:42:19 +0200 (IST) Subject: Life's better without builtins? (was: Life's better without braces) In-Reply-To: <38B691AD.BDB4DD5F@endea.demon.nl> Message-ID: On Fri, 25 Feb 2000, Niels Diepeveen wrote: > Do you have some source code of this? I can't think of a way to do > reload() or tuple(). def reload(module): del sys.modules[module] exec 'import '+module def tuple(seq): ret = () for item in seq: ret = ret + (item,) return ret Ouch big time! -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sholden at bellatlantic.net Mon Feb 28 00:21:47 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 05:21:47 GMT Subject: trim() References: <38B9F5FD.CA99FED8@mindspring.com> Message-ID: <38BA05EC.88ED0603@bellatlantic.net> Chuck Esterbrook wrote: > > I think this is pretty cool. I could use this for the CGI scripts I'm writing where I often have indented HTML. It ends up being indented in the final result which not only looks bad but takes up more bandwidth. > > Thanks, > > -Chuck > > "Michal Wallace (sabren)" wrote: > > > Hey all, > > > > I posted a couple days ago about actually needing a whitespace-eating > > nanovirus.. And ever since I built it, I've been using it almost every > > day for text processing... Being able to indent triple-quoted-string > > is a really really nice feature: > > [Michal's whitespace-eating nanovirus] ------------------------------------------- On the plus side, in HTML there's no tabnannny to check whether you are using tabs or spaces (or how many of which) to indent your "code". As far as I'm concerned optimising HTML is a kindness, not a duty! Wishing-people-would-stop-calling-themselves-programmers-when-they-only-know-HTML-ly y'rs - Steve -- "If computing ever stops being fun, I'll stop doing it" From fdrake at acm.org Tue Feb 1 11:39:24 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue, 1 Feb 2000 11:39:24 -0500 (EST) Subject: time module & ISO dates In-Reply-To: <949385408.356246722@news.intergate.bc.ca> References: <949385408.356246722@news.intergate.bc.ca> Message-ID: <14487.3132.312184.353359@weyr.cnri.reston.va.us> Gerald Gutierrez writes: > Is there any way to get the standard Python time module to properly parse full > ISO-8601 dates, such as "2000-01-31T22:07:43-0800"? strptime() ALMOST > does what is needed but it does not provide for parsing the UTC offset at the > end (the "-0800"). Gerald, I don't know the answer to the second part of your question, but for the first part, the PyXML package (additional information at http://www.python.org/sigs/xml-sig/) includes a module "xml.utils.iso8601" that supports ISO-8601 dates somewhat more flexibly than just the W3C's profile specifies. It doesn't support dates by week or date ranges. If you find any bugs in the module, please let me know. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From robin at jessikat.demon.co.uk Thu Feb 24 05:18:09 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 24 Feb 2000 10:18:09 +0000 Subject: identity of the caller? References: <38B4EDE0.1DB1B55F@horvath.com> Message-ID: <55k4dNAhVQt4EwV1@jessikat.demon.co.uk> In article <38B4EDE0.1DB1B55F at horvath.com>, Bob Horvath writes > >Is there any way to find out the identity of who called you? I am >mainly thinking of method calls, but in general if there is a way >for regular function calls, I would be interested in that too. > >I suppose I should give some context. We have a tool that draws >message flow diagrams for communications systems. These flows are >similar to use case flows, or ITU Z.120 MSC charts if you know >what those are. The tools takes simple ascii text which has the >sender, the receiver, and the message name, as in... > >SENDER RECEIVER MessageName > >We tend to have to enumerate a lot of these, and I had the thought >that if I could prototype the functionality of the nodes, they >could generate the text used to generate the drawings. > >What I was thinking is that the receivers of the message would >define methods that handle them. To get the picture right, >I would need to print out method name, the receiver, and who sent >it. It is the "who sent it" bit that I can't visualize a solution >for. > #Try this #don't know how to get class names though? from sys import exc_info def _tb(): return exc_info()[2] def who_called_me(n=0): try: raise None except: f = _tb().tb_frame.f_back while n>0: t = f.f_back if not hasattr(t,'f_code'): break f = t n = n - 1 c = f.f_code return c.co_filename, c.co_name, f.f_lineno if __name__=='__main__': import sys def test2(): print 'test2',who_called_me(1) def test1(): print 'test1',who_called_me(1) test2() def test(): print 'test',who_called_me(1) test1() test2() class dingo: def __init__(self): self.a = 1 print '__init__',who_called_me(1) def doit(self): print 'dingo.doit',who_called_me(1), self.a def calldoit(self): print 'dingo.calldoit',who_called_me(1), self.a self.doit() test() def mongo(): print 'mongo', who_called_me(1) d=dingo() d.doit() d.calldoit() test() test1() test2() mongo() -- Robin Becker From scarblac-spamtrap at pino.selwerd.nl Sun Feb 27 14:22:58 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 27 Feb 2000 19:22:58 GMT Subject: Strange behavior of 'del' command.. References: Message-ID: Kim Jeong Ju wrote in comp.lang.python: > I am currently into embedding & extending Python to my C++ project. > And I found some strange behavior of 'del' command. > > It's about deleting Python object which was instantiated from wrapped > C++ class. > > For example, let's say 'my_object' is a instance of wrapped C++ class. > > >>del my_object > > This works just fine. It exactly calls the destructor of C++ class and frees > memory blocks as it supposed to do. Actually, all it's supposed to do is remove the name from the current namespace. _If_ nothing else is still referring to it, then it may be removed, and the destructor would be called then. You can't assume that 'del' will call your destructor. Repeat: del only deletes a name from the namespace. > And here is the weird one > > >>exec( 'del my_object ' ) > > The destructor should be called like above one. But It didn't.. > Still the symbol name was deleted. > > >>my_object > Traceback( innermost last ): > .. > Name error: my_object > > Isn't it strange? If you got an idea what happend, please let me know > about it. It works fine for me in a simple test case. You probably still refer to the object somewhere else. Is it still part of some list, or something? We need more info about your code. -- Remco Gerlich, scarblac at pino.selwerd.nl 8:17pm up 96 days, 2:21, 7 users, load average: 0.16, 0.14, 0.13 From pinard at iro.umontreal.ca Thu Feb 17 09:58:39 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 17 Feb 2000 09:58:39 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: "Thomas A. Bryan"'s message of "Thu, 17 Feb 2000 06:42:23 -0500" References: <38ABDE9F.48435B55@python.net> Message-ID: "Thomas A. Bryan" ?crit: > Fran?ois Pinard wrote: > > Justin Sheehy ?crit: > > > Fran?ois Pinard writes: > > > > When, in Emacs, I do not have `*Python*' window initialised, or > > > > more precisely, when there is no process running in that window, > > > > then `C-c C-c' in the window where is the Python source invariably > > > > fails the first time, > > > Whenever I start using python-mode, I do a `C-c !' to start the Python > > > interpreter. Subsequent invocations of `C-c C-c' or `C-c |' will use > > > that interpreter window. > > Thanks, it's neater. But yet, shouldn't `C-c C-c' just succeed? The user > > should ideally not be forced into that extra, introductory command. > Yes, it should. I'm not sure what you mean when you say "more precisely, > when there is no process running in that window." Since `C-c C-c' in the wrong window kills Python, the process disappears, and then, the next `C-c C-c' in the source window will trigger the process to restart, with an error, forcing a second `C-c C-c'. > In general, when I run C-c C-c before I start the interpreter with a > C-c !, there is no '*Python*' buffer. The C-c C-c command creates a > '*Python Output*' buffer to display any output, but it doesn't start a > Python shell and doesn't create a '*Python*' buffer. Oh! Here, `C-c C-c' creates `*Python*'. I do not remember having seen `*Python Output*'. But I'll pay more attention to this for a while. I also noticed that `C-c C-c' from an empty Python source file starts Python without an error. If the source is not empty, then the initial error shows. > > P.S. - By the way, `C-c C-c' is an unfortunate binding, even if quick > > to type. In the source window, it starts the Python interpreter, > > or at least, uses it. In the interpreter window, it raises a signal > > and kills it. > Hm. I hadn't thought of that. I suppose that for me, this is like > Python whitespace issue. I've never had a problem with it. I understand :-). Yet, I think the problem is real. As I wrote, I'm not sure what to do, or suggest, about it. `C-c C-c' is also used in Emacs for sending a message once ready, or for closing some special editing buffers when done. These usages never created a problem to me, I guess that this is probably because there is no possible confusion with `comint' issues. Maybe, I'm not sure, that if the cursor was not jumping into the Python interaction window after having done `C-c C-c' in the source window, things would be more easy. Surely, the command is convenient, because fast to type. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From scarblac-spamtrap at pino.selwerd.nl Wed Feb 2 05:35:56 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 2 Feb 2000 10:35:56 GMT Subject: dyn added methods dont know self? References: <878vfb$3hn$1@nnrp1.deja.com> Message-ID: moonseeker at my-deja.com wrote in comp.lang.python: > I want to add a method dynamically to an instance, how can I do this? I tried > with exec '...' in self.__dict__, but this method doesn't know the instance > reference 'self', so it would complain that it is called without an argument. > Is there any other method to add a method dynamically? You can just assign to them, self.function = etc. I think the 'self' is only used when the function you call in an instance is part of its class. You can add functions to an instance, but you'd have to give the instance manually, I suppose. class A: def __init__(self): self.text = "Spam!" # This function isn't part of the class, yet. def foo(self): print self.text # Make an instance a = A() # Make foo an attribute of the *instance* a.foo = foo # Then it has to be called with the instance a.foo(a) # Prints "Spam!" # However, it can also be added to the *Class*. Then you don't get # the problem with the extra argument, but it's added to all instances. del a.foo A.foo = foo a.foo() # Prints "Spam!" as well So, you call a function in an instance; if it exists in the instance, it's just executed. If it doesn't, the interpreter looks in the class, and fills in the instance as the first argument (the "self"). Why do you need this, anyway? :) -- Remco Gerlich, scarblac at pino.selwerd.nl Hi! I'm a .sig virus! Join the fun and copy me into yours! From olafb at pvv.org Sun Feb 27 03:19:52 2000 From: olafb at pvv.org (Olaf Trygve Berglihn) Date: 27 Feb 2000 09:19:52 +0100 Subject: Argo / Python / UML design tools References: <38B69D71.AC9533BE@bam.com> Message-ID: * Bill Scherer > Have you a pointer to TCM? http://wwwhome.cs.utwente.nl/~tcm/ -- * Olaf Trygve Berglihn From jchan at maxvu.com Wed Feb 23 16:36:50 2000 From: jchan at maxvu.com (Jerome Chan) Date: Wed, 23 Feb 2000 21:36:50 GMT Subject: ExitWindowsEx --- Solution Message-ID: Well, I have to follow up my post... The solution is to upgrade to win32all-128.exe (did not try win32all-127.exe). Build 125 somehow won't reboot properly with win32api.ExitWindowsEx(6,0). Build 128 does. Hooray! From ullrich at math.okstate.edu Sun Feb 13 14:44:02 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Sun, 13 Feb 2000 13:44:02 -0600 Subject: range(start,stop) References: <38A478A4.532D73F5@mail.dotcom.fr> <38A5A2A7.C429BF61@math.okstate.edu> <20000212213133.B5932@stopcontact.palga.uucp> Message-ID: <38A70982.D8285A6B@math.okstate.edu> Gerrit Holl wrote: > David C. Ullrich wrote on 950353975: > > You ask for replies from experts. I think the point is that those > > darned experts are gonna get the stuff right regardless - for non-experts > > Paragraph starts with indentation... > > > like me it fits in with everything else very nicely. In my limited > > experience I find that in Python I avoid off-by-one errors by not > > worrying about them. > > This one doesn't... > > > Now if I could just get the whitespace issues straight... > > I understand. You do not seem to use it properly in your post ;) Just wanted to see if you were paying attention. (Actually I often get unintentional blank lines in the middle of posts, I've never quite figured out why.) > > let's-add-an-email-feature-to-tabnanny-ly y'rs - gerrit From embed at geocities.com Fri Feb 18 10:25:02 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 18 Feb 2000 10:25:02 -0500 Subject: shelve broken on redhat 6.1 References: Message-ID: I have found both Shelve, and the underlying bsddb hash (dbhash) modules are badly broken on Win32. I would not be surprised to see they are badly broken on Linux as well, although P.H.'s problem appears to be much more severe. Warren Postma From bittneph at aston.ac.uk Mon Feb 14 16:15:16 2000 From: bittneph at aston.ac.uk (Peter Bittner) Date: Mon, 14 Feb 2000 21:15:16 +0000 Subject: String manipulation Message-ID: <38A87064.BEB93BB7@aston.ac.uk> Is there no such thing in Python as mystring += "something" // C-style A simple append-operator. mystring = mystring + "something" seems rather odd to me. (source of errors; typing mistakes) (Please, e-mail!) Peter | Peter H. Bittner | International Student at Aston University | e-mail: bittneph at aston.ac.uk | web: http://beam.to/bimbo +-------------------------- From emile at fenx.com Tue Feb 15 09:11:43 2000 From: emile at fenx.com (Emile van Sebille) Date: Tue, 15 Feb 2000 06:11:43 -0800 Subject: [Tutor] my first program Message-ID: <069701bf77be$972466a0$01ffffc0@worldnet.att.net> >>> a = 1 >>> b = 3.0 >>> print a/b 0.333333333333 >>> b = 3 >>> print a/float(b) 0.333333333333 >>> print a/b 0 >>> print round(a/float(b),2) 0.33 >>> HTH Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Caughell family To: Sent: Tuesday, February 15, 2000 3:55 AM Subject: [Tutor] my first program > This is a little program I designed to test experimental odds against > theoretical odds. > > There is a problem. > > After much deliberation, I simplified the formula that I was using to make > the differentiation percentage with, which ended up doing the exact same > thing, just simpler. However, the program still wouldn't work. > > The problem is that I don't know how to make a division become a real > number, especially when involving variables. (I know that I can do 2/7.0 > instead of 2/7 to make it a real result) > > Thanks a lot! > > Also, I've got one question involving real numbers in this python.. > is there any way that I can limit the number to a certain ammount of decimal > places? will it be rounded or truncated, or automatically rounded up? > > Thanks very much!!! > > > _______________________________________________ > Tutor maillist - Tutor at python.org > http://www.python.org/mailman/listinfo/tutor > From donn at u.washington.edu Wed Feb 2 11:56:54 2000 From: donn at u.washington.edu (Donn Cave) Date: 2 Feb 2000 16:56:54 GMT Subject: poplib: problem deleting mails References: <3898458B.337C1708@iitb.fhg.de> <38982CC7.3ED89559@iitb.fhg.de> <20000202152449.A840@stopcontact.palga.uucp> Message-ID: <879nkm$1ah0$1@nntp6.u.washington.edu> Quoth Carsten Gaebler : | Gerrit Holl wrote: [quoting Carsten Gaebler] |>| The POP3 object's dele() function doesn't delete messages that |>| have a "Status: O" line in the header. Is that a bug? |> |> Not in Python. It must be your server. Neither the RFC nor the Python |> module says anything about it. | | Must be Python because Netscape can delete those messages - on the | same server. I think if you look at the module - poplib.py - you'll see what he means. The dele() function simply sends a "DELE" command, with the indicated message ID number, to the server. It has no way to discriminate between messages on the basis of Status lines in their headers, it doesn't know what's in the message at all. Now if this fails to delete the message, and Netscape can indeed delete it, it would be interesting to know what Netscape does. If you can find that out - maybe you could intercept its POP session - then it's very likely you can make your Python program do the same thing. Another experiment would be to telnet to your POP service and try the DELE command on one of these messages. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From a.eyre at optichrome.com Tue Feb 1 12:13:29 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 1 Feb 2000 17:13:29 -0000 Subject: Removing objects of a superclass? In-Reply-To: Message-ID: <000a01bf6cd7$a8fcee20$3acbd9c2@peridot.optichrome.com> GH>> is it possible to _remove_ objects of a superclass? GH>> ...I need to remove some methods like .append and .pop. WW> If the purpose is to simply prevent the user from calling those WW> methods, you could overload them with methods that raise exceptions. I feel that if you need to do that, there is something wrong with your inheritence model. Have a new base class called UserObject which contains all the methods shared by UserList and UserString, and subclass from that. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From sholden at bellatlantic.net Tue Feb 1 00:21:58 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 01 Feb 2000 05:21:58 GMT Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> Message-ID: <38966D8E.1F85CDD8@bellatlantic.net> Neel Krishnaswami wrote: > > Well, I'd prefer Python to be case-insensitive, just as a matter of my > own preference. Eyeball grep is for me basically case-insensitive, and > I have spent hours trying to find bugs caused by case errors, because > my eyes just slide over the difference. > > Python is pretty good about reporting where the error occurred, so > it's rarely more than 10 or 20 minutes of wasted time here, even when > I just give up and rewrite all the code in question. It's still not > fun though. > > Neel I suppose to be REALLY politically correct, we should provide compilers which are convenient for those unfortunate enough to be dyslexic, and allow programmers to write "klass" as a synonym for "class" and so on. But of cors thiss wud jest git ridikerlus kwikli. The bottom line, surely, is that programming languages are supposed to have an unambiguous MEANING. Learning to program is learning how to represent that meaning. As Robert Dewar said, "I'd rather make it easier to write good programs than more difficult to write bad ones". Beginners have to learn rules: or should we just let learner drivers choose the side of the road they feel is more natural? May I call you Neil? Or Kneel? Or even neel? [Sorry: I know I'm bad] regards Steve From donn at u.washington.edu Wed Feb 16 12:42:45 2000 From: donn at u.washington.edu (Donn Cave) Date: 16 Feb 2000 17:42:45 GMT Subject: Subclassable C Extension References: Message-ID: <88enil$h7g$1@nntp6.u.washington.edu> Quoth "Joel Lucsy" : | How does one write a subclassable C extension? I've written C extensions, | but can't seem to figure out how to make it subclassable. I've tried using | the CXX files from somewhereoranother, but that seems to GPF/coredump. I'll | take examples, URL's to examples, or whatever. Thanks. http://www.python.org/workshops/1995-12/papers/ahlstrom1.html From g_will at cyberus.ca Tue Feb 8 08:12:28 2000 From: g_will at cyberus.ca (Gordon Williams) Date: Tue, 08 Feb 2000 13:12:28 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> Message-ID: <01bf7235$e4d10540$1341c3d1@Cyberus.cyberus.ca> Try wxPython for these widgets (based on wxWindows). There is a demonstration which shows their use. Gordon Williams Ronald Caudill wrote in article <0c6c0960.87ddf24b at usw-ex0104-031.remarq.com>... > Hi: > I am investigating the python language. I was looking at the > Tkinter tutorial which said there was 15 widgets available in > Tkinter. > > The programs I want to do soon needs a Grid widget and a calendar > widget. Are these widgets available in Python? Or can one write > your own. Or what do Python programmers do when they need widgets > like this? > > Ronald > > > * 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 mhammond at skippinet.com.au Thu Feb 24 18:19:35 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 24 Feb 2000 23:19:35 GMT Subject: CGI and COM References: <000801bf7ec0$9da94500$d300a8c0@Alexis> Message-ID: This should work fine, except you must remember that CGI will be running your script under a special user and "desktop". Eg, COM GUI apps wont work, and some other COM apps wont have enough security to do what they need to do. The user that the guest logs into isnt the issue - it will be the user the web server is running under. Mark. "Ulf Engstr?m" wrote in message news:000801bf7ec0$9da94500$d300a8c0 at Alexis... I've just started with some COM-programming with the win32com package, and I get the part I want to working correctly when I run it in IDLE or in any way, except that I know want it to be done from a CGI-script. (I'm writing params to a program with COM) I know this raises some security issues when run as CGI, but is there a way do overrun this? I'm running W2k with IIS5. I tried to set guest login to use Administrator, this made the script take forever, but still came out negative. Some other way? Regards Ulf (Alexis) From alex at somewhere.round.here Mon Feb 28 16:29:52 2000 From: alex at somewhere.round.here (Alex) Date: 28 Feb 2000 16:29:52 -0500 Subject: HTML parser documentation References: <38badaa2_2@news1.prserv.net> Message-ID: > I want to write program to extract info out of web sites, process the > info, and then republish it on my web page. Hi. Here is something I have used to do that sort of thing. Check out the SGMLParser module: http://www.python.org/doc/current/lib/module-sgmllib.html Alex. from sgmllib import SGMLParser class Tag: def __init__(self, attributes): self.attributes = attributes def select_attribute(self, attribute_name): target_tuple = self.attribute_instances(attribute_name) assert len(target_tuple) == 1 return target_tuple[0][1] def attribute_instances(self, attribute_name): return filter(lambda t, a = attribute_name:t[0] == a, self.attributes) class Form(Tag): def __init__(self, attributes): Tag.__init__(self, attributes) for attribute in ('action', 'method'): if self.attribute_instances(attribute): setattr(self, attribute, self.select_attribute(attribute)) else: setattr(self, attribute, None) self.input_entries = {} def __str__(self): output = '' output = output + 'Action: %s\n' % self.action output = output + 'method: %s\n' % self.method return output class Input(Tag): def __init__(self, attributes): Tag.__init__(self, attributes) self.attributes = attributes possible_name = self.attribute_instances('name') if possible_name: assert len(possible_name) == 1 self.name = possible_name[0][1] possible_value = self.attribute_instances('value') if possible_value: assert len(possible_value) == 1 self.value = possible_value[0][1] else:self.value = '' class HTMLForm_reader(SGMLParser): def __init__(self): self.forms = [] self.currently_in_form_p = 0 SGMLParser.__init__(self) def start_form(self, attrs): self.forms.append(Form(attrs)) self.currently_in_form_p = 1 def end_form(self): self.currently_in_form_p = 0 def start_input(self, attrs): assert self.currently_in_form_p c = Input(attrs) if hasattr(c, 'name'): self.forms[-1].input_entries[c.name] = c.value if __name__ == '__main__': from urllib import urlopen page = urlopen('http://www.python.org/search').read() h = HTMLForm_reader() h.feed(page) h.close() for form in h.forms: print form From signman at netdoor.com Sun Feb 20 08:12:53 2000 From: signman at netdoor.com (signman at netdoor.com) Date: Sun, 20 Feb 2000 13:12:53 GMT Subject: Non-progrmmer wants to learn. Message-ID: <38afe6a3.179841@news.netdoor.com> I've done nothing more than write batch files in the old dos days. I enjoyed it then and am hoping now I can teach myself Python. I know nothing about programming. Am I biting off to much? Is there a step by step guide on the net? Is this the language to start with? Am I to old for this stuff (my Grandchildren type better than I) ? :) Thanks in advance for any help. Wayne From gchiaramonte at ibl.bm Tue Feb 1 09:20:26 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Tue, 1 Feb 2000 10:20:26 -0400 Subject: Array Module In-Reply-To: <001701bf6cbe$40de4dc0$f29b12c2@secret.pythonware.com> Message-ID: Anyone else think we should add a sort() method to the array module? I do. Gene From alex at somewhere.round.here Thu Feb 17 12:54:02 2000 From: alex at somewhere.round.here (Alex) Date: 17 Feb 2000 12:54:02 -0500 Subject: Problem with Emacs mode, at start only References: <14508.12680.569760.298585@anthem.cnri.reston.va.us> Message-ID: > Hmm, I wonder if this is an Emacs thing. It seems to work fine for me > in XEmacs 21.1. I just tried it under XEmacs 21.1, and got the same behaviour as Francois described. In my case the problem arises because I have customisations for the interactive shell in my .pythonrc file. If I just hit C-c C-c without starting py-shell first, python runs in non-interactive mode, and my scripts can't find all the modules they're expecting. Alex. From kens at sightreader.com Sun Feb 27 18:10:07 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 15:10:07 -0800 Subject: Recursive function defined within function => NameError References: <38ABCE51.3EF6728E@inka.de> <38B00CCA.FD467C01@maxtal.com.au> Message-ID: <38B9AECF.C02C2760@sightreader.com> Learn OOP and stop using local functions. :) skaller wrote: > Michael Str?der wrote: > > > > HI! > > > > I have a problem with a locally-defined recursive function within a > > function. Example: > > > > --------------- > > def func1(): > > > > def fak(n): > > if n>1: > > return n*fak(n-1) > > else: > > return n > > > > print fak(6) > > > > func1() > > --------------- > > > > But this code snippet does not work. It produces the traceback: > [] > > Any better solution? > > Sure. Use Vyper instead of Python: you code works > right out of the box just like it should: > > [root at ruby] ~/links/viper/src>./vyperi t_recurse.vy > File t_recurse.vy > Viperi 2.0.1 > Copyright Maxtal P/L, John Skaller, Australia, 1999 > 720 > DONE: returning code 0 > > -- > John (Max) Skaller, mailto:skaller at maxtal.com.au > 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 > checkout Vyper http://Vyper.sourceforge.net > download Interscript http://Interscript.sourceforge.net From sarbx at my-deja.com Mon Feb 21 22:51:17 2000 From: sarbx at my-deja.com (sarbx at my-deja.com) Date: Tue, 22 Feb 2000 03:51:17 GMT Subject: Handling User Defined Exceptions returned from C Message-ID: <88t13k$641$1@nnrp1.deja.com> I'm trying to Handle a exception in python returned from C. The C code is as follows, static PyObject *SpamError static PyObject * spam_test(PyObject *self,PyObject *args) { ... ... ... PyErr_SetString(SpamError, "Testing User Defined Exceptions"); ... .. return PyBuildValue("i", -1); } static PyMethodDef SpamMethods[] = { {"system", spam_system, METH_VARARGS}, {"test", spam_test, METH_VARARGS}, {NULL, NULL} /* Sentinel */ }; void initspam() { PyObject *m, *d; m = Py_InitModule("spam", SpamMethods); d = PyModule_GetDict(m); SpamError = PyErr_NewException("spam.error", NULL, NULL); PyDict_SetItemString(d, "error", SpamError); } The Python script, import spam import sys try: st = spam.test(tel) except spam.error: print sys.exc_info() But this doesnt seem to work. I thougt it might be a exception name problem and called the function without the try clause, hoping the python interperter will raise a unhandled exception, but that didnt work too. What am I doing wrong. Thanks so much. -sarva Sent via Deja.com http://www.deja.com/ Before you buy. From pinard at iro.umontreal.ca Fri Feb 25 10:50:07 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 25 Feb 2000 10:50:07 -0500 Subject: os.path.walk (was: Re: Optimizing code) In-Reply-To: "Gordon McMillan"'s message of "Fri, 25 Feb 2000 08:45:10 -0500" References: <1260636186-9134394@hypernet.com> Message-ID: "Gordon McMillan" ?crit: > There's also a dircache module, which caches os.listdir output, and > stats the directory to see if the cache is still valid. These tricks get > wildly platform specific though. In my experience on Windows [...] if > the cache is less than 2 seconds old, you can't assume it is valid. I do not think my suggestion would be worth on anything but Unix, and I was not suggesting it for other systems. It is just sad to see that Python `os.path.walk' is implemented slow on Unix, because of how Windows works. I quite understand Guido's concern for maintainability and portability, yet the speed loss, here, is significant enough to warrant a second thought. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jeremiah at widomaker.com Mon Feb 7 10:46:25 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:46:25 GMT Subject: nonlinear programs? Message-ID: <389DF948.15D2173B@widomaker.com> Is there a way for me to make python start a process(such as mpg123) and then continue on in the program before mpg123 stops? I want to be able to start the song playing, and then still solicit user input about skipping on to the next mp3, or quitting the program. If someone could explain this to me, or point me in the direction of an explanation I would be very greatful. From quinn at pyro.ugcs.caltech.edu Tue Feb 29 22:14:41 2000 From: quinn at pyro.ugcs.caltech.edu (Quinn Dunkan) Date: 1 Mar 2000 03:14:41 GMT Subject: Multi-argument append() is illegal References: <000f01bf8296$dbe53480$732d153f@tim> Message-ID: On Tue, 29 Feb 2000 04:25:03 -0500, Tim Peters wrote: >[Guido van Rossum] >> I am going to rectify this in Python 1.6 -- people coming from other >> languages might well expect list.append(a, b, c) to mean the same as >> list.append(a); list.append(b); list.append(c), and it's always been >> my philosophy to make ambiguous syntax illegal rather than to pick one >> interpretation randomly. > >Before anyone starts , protesting this appears to be as futile as >griping about whitespace: The Dictator Has Spoken here. It's been broken >forever and needs to get fixed. I for one am not going to protest. Thank you Guido! That little inconsistency has been under my skin ever since I noticed its existence. Nice to see that Guido has the courage to fix something that needs to be fixed at the cost of possibly breaking some badly written code. better-now-than-when-python-rules-the-world-ly y'rs From vspho at beasys.com Thu Feb 3 09:54:14 2000 From: vspho at beasys.com (PHO Van Son) Date: Thu, 03 Feb 2000 14:54:14 +0000 Subject: switch to JPython Message-ID: <38999696.BC2CC281@beasys.com> Hi, I like Python a lot. For my job, I code more and more with Java. So, I am wondering if it is better for me to switch to Jpython. The problem is that AFAIK that JPython doesn't have debugger (like pdb), and I am now used to Tkinter, may be i have to learn swing and awt (and i am afraid i have enought time) I would like if anyone having experience in JPython giving me advice. Thanks. PHO Van Son From thomas at xs4all.net Fri Feb 18 10:41:58 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 18 Feb 2000 16:41:58 +0100 Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: ; from hanche@math.ntnu.no on Thu, Feb 17, 2000 at 05:36:48PM -0500 References: Message-ID: <20000218164157.W477@xs4all.nl> On Thu, Feb 17, 2000 at 05:36:48PM -0500, Harald Hanche-Olsen wrote: > + Mike Fletcher : > | Not being a CS person, maybe I can confuse the issue :) ... > I'm not one either, so surely I can confuse it further! I may be too confused to tell for sure, but i have a gut feeling that i'm getting closer and closer to some complete and utterly consistent cluelessness of this issue. Pauls' posting on continuations, more or less describing C's set/longjmp, helped a lot at getting my mind wrapped around this idea, but as Tim suggested, I'm not quite warped enough to understand the basics of it all. (That is, I'm assuming here you all, especially Tim, speak the truth, and this continuations business isn't some huge PSU conspiracy to scare the bejezes out of everyone, to make sure continuations do _not_ make it into Python ;) > | A continuation is a suspended execution context, you get to a point > | and say "can't/won't finish this now, I'll store the state (frame) > | and let other execution contexts call me when I should continue". > | When you want to resume the context, you "call" the continuation, > | which resumes running the suspended execution context at the next > | line after the call to suspend. > > So far, this is not all that different from > coroutines/generators/threads/whatever. To my mind, one of the > mindboggling things about continuations is that you can call the same > continuation multiple times, whereas when you call a > coroutine/generator, its program counter advances, so that the next > time you call it, you are really calling a new continuation. If this is so, you could see 'a continuation' as a class of object that is defined in a running process, and when instantiated produces a python (thread ? process ? stackframe ? what can i call it that doesn't already have a different meaning ? :) - a python 'execution line' including local variables, but not global ones, starting from the point defined in the continuation-class (which is one instruction past the magic definition of the continuation-class) where each 'instance' of the specific continuation-class is actually executed 'in' a seperate frame object -- changes to local variables have no effect on another 'instance' of the continuatio-class, but global ones do. And the continuation-class stays valid regardless of what other instances of the continuation or other parts of the program do ? What would a traceback generated by an exception in a continuation look like, by the way ? (a lot more questions about how it would look if you did or come to mind, but i'm also thinking up possible answers to them, and i think most of them are implementation defined anyway ;) I'm probably looking at this all wrong -- i fail to see how this is more abstract, more theoretical, more low-level, than simple subroutines. (Though i must admit my idea of subroutines is probably all wrong -- i'm thinking of C functions, including stack and all that.) Is there any chance that someone can explain continuations either in a very pythonic sense (which would require a large leap of imagination to start with) or at a very basic level, like the example of coroutines in Compass that Harald posted -- i found that *very* enlightening. If course, someone (i.e. Tim) is going to smash all my hope by saying that there is no simple way to explain continuations. Can't someone do a very simple example using toy cars, road crossings, chickens, idiot drivers and/or huge kerosine-carrying tankertrucks ? Something that might not be much clearer but sheds some very different light on the issue, and caters to the simple minds ? ;P > maybe-posting-some-Scheme-code-could-obfuscate-the-issue-furhter-ly y'rs, Probably, except that i dont know any Scheme, so it would probably fail to confuse me (unless it has well-known keywords do something not-very-well-known ;) I'm really curious about continuations. I also (now) have a weird idea of continuations, probably all wrong, that makes me wonder slightly "this is very simple, what is the big fuss ? where is the rest hiding ?" -- except for Tim explicitly stating that the idea I have of continuations is wrong;) Continuous-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From maxSPAMnospamnot at neomeo.com Wed Feb 9 18:27:48 2000 From: maxSPAMnospamnot at neomeo.com (David Max) Date: Wed, 9 Feb 2000 18:27:48 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87np2g$kc8$1@nntp1.atl.mindspring.net> Message-ID: <87st5i$7hd$1@bob.news.rcn.net> "Aahz Maruch" wrote in message news:87np2g$kc8$1 at nntp1.atl.mindspring.net... > Speaking as a programmer with more than twenty years of experience and a > Python user with less than a year of experince, it is precisely that > whitespace-based syntax that accounts for much of Python's usability in > a multi-developer environment. Every Python program written by someone > with a jot of care has almost the same layout; this greatly enhances > readability. > > I still curse regularly when I get tripped up on some whitespace > (particularly while trying to add debugging code quickly), but I think > the benefits greatly outweigh the drawbacks. I'm a programmer new to Python. So far the whitespace issue hasn't really bothered me, but as someone who in the past has occasionally wasted an hour trying to fix a broken makefile because of some tab/space mixup, I'm staying vigilent. Every language I have ever dealt with has its own peculiar tricks to adapt to. For example, who hasn't gotten bitten by some mistake in keeping C++'s 18 levels of operator precedence straight? Anybody here confident enough to guess whether ptr->x++ and *ptr.x++ are equivalent? You think the next developer is going to remember either? So you end up writing ((*ptr).x)++ just to make sure. Python's treatment of whitespace has plusses and minuses. I've seen a lot of good pluses mentioned in this thread, but one minus is that people who aren't accustomed to caring about spaces, tabs, or whitespace in their code are going to have to learn to care (and really, can learning to care really be a bad thing? ;-). So far, I think that on balance the positives outweigh the negatives. Also, the creation of tools like TabNannies and Python-aware editors make it less likely to stumble into a whitespace problem accidentally. This is not unlike how brace-kissing has helped LISP coders and chromacoding has stopped C programmers from accidentally leaving unclosed /* comments. So my point is that what is needed is not religious wars but advice from the experienced on how they avoid the pitfalls and continuing refinement in the programming tools that keep us programmers from having to worry about these things. - David Max P.S. The "." and "->" operators have higher precedence than "++" and "*" in C++. So ptr->x++ is (ptr->x)++ and *ptr.x++ is (*(ptr.x))++, which probably won't compile anyway. And if any of you are still pulling out your reference book just to check, that just proves my point. From nutritioustreat at my-deja.com Sun Feb 27 03:03:28 2000 From: nutritioustreat at my-deja.com (nutritioustreat at my-deja.com) Date: Sun, 27 Feb 2000 08:03:28 GMT Subject: COM Problems Message-ID: <89alog$pcu$1@nnrp1.deja.com> Okay... I'm creating a very simple inprocess COM DLL in C++. Call it Foo. There is a single interface in Foo, IBar. And a class that implements IBar, Bar. I run makepy on Foo.tlb, and get my Foo.py file. I fire up Python and do: import Foo import pythoncom unk = pythoncom.CoCreateInstance(Foo.Test.CLSID, None, pythoncom.CLSCTX_INPROC_SERVER, pythoncom.IID_IUnknown) {success} bar = unk.QueryInterface(Foo.ITest.CLSID) and instead of happily getting my interface, I get the following error message: Traceback (innermost last): File "", line 1, in ? TypeError: There is no interface object registered that supports this IID the IBar interface is registered just fine, it shows up in the OLE Viewer, etc. what does this mean? i can create a Bar just fine through Dispatch, by doing: bar = Foo.Bar() but I want to do things with CoCreateInstance/QueryInterface. thanks, nutritious treat Sent via Deja.com http://www.deja.com/ Before you buy. From gvwilson at nevex.com Wed Feb 2 14:35:59 2000 From: gvwilson at nevex.com (Greg Wilson) Date: Wed, 02 Feb 2000 14:35:59 -0500 Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) References: Message-ID: <3898871E.B0C316AE@nevex.com> > It seems to me that Components are more to the point than "contracts", and > that contracts are a useful part of the whole picture of components. I would recommend Clemens Szyperski's "Component Software" very strongly. I write book review columns for "Doctor Dobb's Journal" on a fairly regular basis; his was the only book to which I've ever devoted an entire column. It is not only an insightful comparison and critique of existing component systems (COM, CORBA, and JavaBeans), it also looks in detail at what components are trying to accomplish, and what the real obstacles are. Five stars. > While I agree with Mr. Wilson's "Software Carpentry" ideal, Please call me 'Greg' :-) > it seems to me that the $850K being spent on > resuscitating these crusty old Unix command line tools (chiefly make, > autoconf, and automake) to make new command line tools is a perfect example > of the things he criticizes in programmers like me. > I think it would be far better to invest in building tools to plug into an > already started new development environment. Absolutely --- good designs will have to address inter-operability with other tools. One of the criticisms made of 'make', for example, is that its dependency checking and rule evaluation engines aren't accessible to other programs (except in the "everything is Turing equivalent if you write a big enough Awk script" sense). Once the first-round winners are published, I hope that you will take the time to look them over, and post your ideas about how or whether they could be used in KDevelop and other IDEs. Thanks, Greg Wilson Software Carpentry Project Coordinator From ndev42 at yahoo.com Tue Feb 22 04:26:38 2000 From: ndev42 at yahoo.com (ndev42 at yahoo.com) Date: Tue, 22 Feb 2000 09:26:38 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> Message-ID: <88tkob$jqd$1@nnrp1.deja.com> In article , "Fredrik Lundh" wrote: [...] > fyi, OSF/1 (aka Digital Unix, aka Tru64) comes with libtcl > and libtk preinstalled... and Xt. and Motif. and CDE libs. > etc. Great news for the future! But it still does not help the current un-upgraded Alpha machines, nor all the above-mentioned OS's. Anyway, that does not solve version problems. Say you downloaded your latest Python/Tkinter, but find out that the version that comes pre-installed with your brand new Tru64 is 4.x/7.x? This accumulation of layers helps us programmers ship libraries and development tools fast, but they certainly do not help out the users in the end. Just to get a "Hello world" button with Python, you need Python + Tkinter + Tk + Tcl + X11, whereas you could have short-circuited that to Python + X11, if an intelligent widget set was built directly from X11 in Python. Not just binding the X functions, making OO widgets and Python compatibility, too. A next step could be to provide the same OO widgets, bound to other low-library window libraries on other OS's. That is some effort, I realize, but looking back at how much has been spent on making free GUI tools already, looks pretty small. Every time a new layer is added, new compatibility issues are brought in. Plus: if you did not develop all the layers, you have to support any change in other people's code to keep compatible. Any layer that becomes drastically incompatible with a previous version of itself propagates this property to the rest of the assembly. This becomes a true nightmare when you have several generations of software to support on the same machine. Oh well, just my 5c I guess... -- Nicolas Sent via Deja.com http://www.deja.com/ Before you buy. From mikael at isy.liu.se Mon Feb 14 03:18:59 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 09:18:59 +0100 (MET) Subject: range(start,stop) In-Reply-To: Message-ID: On 11-Feb-00 Moshe Zadka wrote: > range(0, n) is a list with n elements, so > > for i in range(0, n): # equivalent to range(n) > print "hello" > > will print "hello" exactly n times. This behavour of range doesn't bother me (any more), but your example isn't really that good. It would be just as readable and logical to let range stop at stop as the original poster wanted, i.e. range(1,n) could be a list of n elements and for i in range(1, n): print "hello" would do. /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-Feb-00 Time: 09:14:01 This message was sent by XF-Mail. ----------------------------------------------------------------------- From tbryan at python.net Tue Feb 29 07:17:52 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Tue, 29 Feb 2000 07:17:52 -0500 Subject: Strange Python problem on Linux. Message-ID: <38BBB8EF.9306991C@python.net> I'm running Red Hat Linux 6.0, kernel 2.2.5-15, with Python 1.5.2 (#1, Apr 18 1999, 16:03:16) [GCC pgcc-2.91.60 19981201 (egcs-1.1.1 on linux2... I've never had this problem before in over a year of Python work. Basically, I have a Python program that I can run by typing python filename.py but not by typing ./filename.py filename.py is executable, and if I cut its #! line into another script, I can run the second script without invoking the interpreter explicitly at the command line. It's only happening with this one file; I've never had this problem with other Python programs. I have no idea what's wrong. Any hints would be appreciated. I don't trust myself at the moment, so I'm pasting a short session from my terminal window here. $ ls -l ./mdef.py -rwxrwxr-x 1 tbryan tbryan 11357 Feb 29 06:51 ./mdef.py $ ./mdef.py srp1_srp1_19981221_001.mdef > junk.txt bash: ./mdef.py: No such file or directory $ mdef.py srp1_srp1_19981221_001.mdef > junk.txt bash: ./mdef.py: No such file or directory $ python mdef.py srp1_srp1_19981221_001.mdef > junk.txt $ head -2 junk.txt Meter Header ( Record Length : 216 $ head -2 mdef.py #!/usr/bin/python $ cat > silly.py #!/usr/bin/python print "What's wrong?" $ chmod u+x silly.py $ ./silly.py What's wrong? $ python silly.py What's wrong? $ cp mdef.py copy.py $ ls -l copy.py -rwxrwxr-x 1 tbryan tbryan 11357 Feb 29 07:16 copy.py $ ./copy.py bash: ./copy.py: No such file or directory $ python copy.py srp1_srp1_19981221_001.mdef > junk2.txt $ head -2 junk2.txt Meter Header ( Record Length : 216 $ /usr/bin/python Python 1.5.2 (#1, Apr 18 1999, 16:03:16) [GCC pgcc-2.91.60 19981201 (egcs-1.1.1 on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> too-bewlidered-to-think-of-a-good-timbotish-closing-ly yours ---Tom From sabren at manifestation.com Wed Feb 16 22:43:56 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 16 Feb 2000 22:43:56 -0500 Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> <88f1lr$ola$1@nntp4.atl.mindspring.net> <4PEq4.89$mYj.181656576@newsa.telia.net> Message-ID: <88fqqs$2bo$1@nntp9.atl.mindspring.net> Fredrik Lundh wrote in message <4PEq4.89$mYj.181656576 at newsa.telia.net>... >import sys > >def magic_eval(s): > try: > raise None > except: > frame = sys.exc_traceback.tb_frame.f_back > return eval(s, frame.f_globals, frame.f_locals) Wow. it *is* magic. Thanks! (Andrew, too) >> Wouldn't that be useful in general for >> experimenting with language enhancements, >> even if the code were a little hairy? > >sure. if you know what you're doing ;-) Why not to find out what I'm doing? :) I may just do something with this in the near future.. -Michal From gerrit.holl at pobox.com Sat Feb 12 15:32:09 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 21:32:09 +0100 Subject: Pike seems good. A Q though. In-Reply-To: ; from effbot@telia.com on Sat, Feb 12, 2000 at 07:41:11PM +0000 References: <200002112329.SAA01742@seanb.sttln1.wa.home.com> <50ip4.6464$UP1.149900@bgtnsc05-news.ops.worldnet.att.net> Message-ID: <20000212213209.C5932@stopcontact.palga.uucp> Fredrik Lundh wrote on 950380871: > Forget it wrote: > > Q: Is there a mirror somewhere closer you know of. > > yes. [no url given] ROFL! regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From cfelling at iae.nl Wed Feb 2 18:33:19 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 3 Feb 2000 00:33:19 +0100 Subject: Readable Functional Languages Message-ID: <87aerv$2d6$1@vvs.superst.iae.nl> Admittedly off topic, I would like some advice on what language to choose to explore the realm of functional languages given that I can't cope with 'impure' languages like C, C++ and Perl and that I love Python mostly for its readability and its adherence to the principle of least surprise that lures me into thinking that it has no dark corners. -- groetjes, carel From gmcm at hypernet.com Tue Feb 22 17:51:51 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 22 Feb 2000 17:51:51 -0500 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <38B2E76D.7DEF295C@roguewave.com> Message-ID: <1260862583-6978501@hypernet.com> bjorn wrote: > Gordon McMillan wrote: > > > bjorn wrote: > > > > > I must respectfully disagree. When doing OO design, the fundamental question > > > is "if I want to do 'foo', to what am I doing 'foo'?"... In this case "if I > > > want to 'join', what am I 'joining'?", the answer is that you're joining a > > > sequence type. Thus, IMHO it the natural (and extensible to user types) way > > > to do it would be: > > > > > > [1,2,3].join() > > > (1,2,3).join(' ') > > > > string.join only works on lists of strings. If you introduce a > > special "sequence of strings" type, then join could be a > > method on that. Otherwise, you need to work out some new > > semantics. > > Sorry, bad example: > > ['a', 'b', 'c'].join() You would put a method on sequence that only works if the sequence contains certain types? That's a really nasty precondition. Requiring the arg to string.join be a sequence containing only strings is a much saner precondition. > > [snip] > > But the scope here is the existing "string.join". The fact that > > the procedural interface has the instance as the 2nd arg is a > > distraction. It is a string method, not a list method. > > > > - Gordon > > Just because it happened to be in the string module does not make it a string method > (it's definitely possible, but one doesn't logically follow from the other). The > fact that the string module interface has uses the second argument for the join > field is pedagogically an important one. E.g. the self parameter to a method is > always passed first, and any of the ast/oo implementations in other procedural > languages always pass the object being acted on as the first argument. It therefore > seems natural for a Python programmer to infer that join(seq, sep) should be parsed > as seq.join(sep). Does this mean that if I compile a C++ program with the Pascal calling convention, that it's no longer OO? I guess we'll just have to change string.join to require the separator as the first argument. Or come up with a "homogeneous sequence" type, with a "joinable homogeneous sequence" subtype with an abstract join method. - Gordon From 55555 at dakotacom.net Tue Feb 15 16:22:36 2000 From: 55555 at dakotacom.net (55555) Date: 15 Feb 2000 15:22:36 -0600 Subject: os.shell, recursion, encryption References: Message-ID: <38a9c39c_4@news5.newsfeeds.com> On Mon, 14 Feb 2000 18:37:58 -0000, "Trent Mick" wrote: > > Thanks for the lesson. It's a little clearer, but now I question > > whether > > this can be used for what I want to do. It seems like popen creates a > > file. I don't want to do that. Instead, I'd like to simply run a > > commercial program with a command like 'pkzip asdf.zip *.*'. I gave > > the > > following a try and it came back with "bad command or filename." Am I > > on > > the right path or should I be using a different function than popen? > > os.system() doesn't work and I don't know what mode to use for spawnv. > > Thanks again. > > > > import os > > zipExe='c:/progra~1/pkzipdos/pkzip.exe' > > os.popen('> '+zipExe+' asdf.zip *.*', 'w') > > I have not been following this thread but methinks you want to say: > > import os > zipExe = 'c:/progra~1/pkzipdos/pkzip.exe' > zipOutput = os.popen(zipExe + ' asdf.zip *.*', 'r') > print zipOutput.readlines() I gave this a shot. I actually don't care about the return from pkzip, but I think this would work. Unfortunately, an empty list is returned and there is no evidence that pkzip was ever executed. Any ideas? > > The p in popen stand for 'pipe' I believe. You are openning a pipe to > the > command that you are running (here pkzip). The 'bad command or filename' > is > comming from the greater than sign '>' that you prefixed the command > with. I > think you may be using the Perl syntax for open(). If you still get 'bad > command or filename' then pkzip.exe is not where you think it is or > something else is broken. > > As well you want to open the pipe for reading because you want to get > the > status output from pkzip (right?). If you don't care about the zip > status > output then try > > import os > zipExe = 'c:/progra~1/pkzipdos/pkzip.exe' > os.system(zipExe + ' asdf.zip *.*') > > Again, when you say that os.system() was broken as well, I think the > greater > than sign is your problem. I was using that one without the greater than sign, but I don't want to use the above because I'm walking through a directory tree and it would spawn too many windows that would all need to be closed. > > Hope this helps, > > Trent > > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From aahz at netcom.com Wed Feb 23 12:03:49 2000 From: aahz at netcom.com (Aahz Maruch) Date: 23 Feb 2000 17:03:49 GMT Subject: functional programming References: Message-ID: <8913tl$7qb$1@nntp6.atl.mindspring.net> In article , Jason Stokes wrote: > >Functional programming, at a bare minimum, means this: the ability to use >functions as first class objects, to pass functions as arguments to other >functions and to return functions as results of a function call. Then Python is definitely a functional language, as is C. Is that what you meant? -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From ulf.engstrom at b2b-link.com Fri Feb 18 05:17:25 2000 From: ulf.engstrom at b2b-link.com (=?iso-8859-1?Q?Ulf_Engstr=F6m?=) Date: Fri, 18 Feb 2000 11:17:25 +0100 Subject: PyGreSQL and windows Message-ID: <000801bf79f9$5a875760$d300a8c0@Alexis> I'm working in a mixed environment and now I want to retrieve some stuff from a PostGreSQL-database running on a RedHat6-machine from a windows one. Questions have been asked here before about this issue, but no answers have been given. Anyone knows how to install the PyGreSQL-module on windows? Regards Ulf -------------- next part -------------- An HTML attachment was scrubbed... URL: From rbill at datasprings.com Thu Feb 17 20:32:00 2000 From: rbill at datasprings.com (Robert W. Bill) Date: Thu, 17 Feb 2000 19:32:00 -0600 Subject: mxDateTime and MySQLdb on RedHat 6.1 Message-ID: <3.0.6.32.20000217193200.007d4260@mail.visi.com> >Hello. I am having trouble compiling these to new modules on my RedHat 6.1 >Linux box. Below are the errors I am getting on each installation. > >*** mxDateTime *** >---snip---< >make: *** No rule to make target `Makefile.pre.in'. Stop. > >*** MySQLdb *** >---snip---< >cp: /usr/lib/python1.5/config/Makefile.pre.in: No such file or directory >---snip---< >Any suggestions here? You are missing some needed files. These files should be provided as part of another RPM called Python-devel.1.5.2.??.RPM. You can get this from RedHat, or rufus.w3.org, or .... If you do have the Python header files elsewhere, edit the makefile/build.py accordingly to point to them. From sholden at bellatlantic.net Thu Feb 10 11:36:07 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 10 Feb 2000 16:36:07 GMT Subject: (no subject) References: <002001bf73dd$da4b5540$6c00a8c0@ruidovisual.pt> Message-ID: <38A2E911.3BB7DB5C@bellatlantic.net> Pedro: It's the newsgroup users who'll make you sorry :-) As a guess I'd say you're using Microsoft Outlook Express - at least, that's the way my mails came out from that system at first. (I only use Express for certain contacts). Try Tools | Options, bring up the "Send" tab and select "Text" for both mail sending and news sending formats. Seems to work for me. regards Steve > Pedro Silva wrote: > > I would like to make me sorry for my questions had appear in html text, I > think that now it is better -- "If computing ever stops being fun, I'll stop doing it" From ame at swipnet.se Wed Feb 16 17:39:10 2000 From: ame at swipnet.se (Anders Eriksson) Date: Wed, 16 Feb 2000 22:39:10 GMT Subject: Can't reopen eMatter book Message-ID: <38ab2592.21957002@nntpserver.swip.net> Hello! I bought the 'Standard Python Library' eMatter book by mr Fredrik Lundh. Everything worked fine except when I tried to open the book for the second time. No I only get an error saying "An error occurred while preparing to display this eMatter(c). Please try again. If you continue to have problems, contact Fatbrain.com Costomer Service." I have contacted Fatbrain but they haven't answered. I sent the email on Sunday the 13:th. So I thougth maybe someone in this group has an idea on how to get it to work again. The only thing I did after closing the eMatter book and trying to reopen it was to upgrade Adobe Acrobat to version 4 // Anders From mwh21 at cam.ac.uk Fri Feb 25 11:55:41 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Feb 2000 16:55:41 +0000 Subject: setattr and variable names: bug or feature? References: <20000225173314.A19726@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > Dear bottomless information source, > > >>> class Foo: > ... pass > ... > >>> setattr(Foo, '', '') > >>> setattr(Foo, '`', '') > >>> setattr(Foo, '\'', '') > >>> setattr(Foo, '!@#{}\0\0\0', '') > >>> dir(Foo) > ['', '!@#{}\000\000\000', "'", '__doc__', '__module__', '`'] > > Is this a bug or a feature, or None of both? Feature, I'd say. I've used names like this when I've been playing silly buggers with setattr & getattr methods, for example. Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From effbot at telia.com Fri Feb 25 04:43:07 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 25 Feb 2000 09:43:07 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> <38B6420B.6A9D66DE@nembv.cz> Message-ID: Alexander Williams wrote: > >Yeah, but I need to remove empty lines as well... > > Try: > > >>> A = filter(None, H.readlines()) > > filter() with None as the function to use as the test for elements > removes any that test as False intrinsically; since the empty line is > always False, it returns a list with only strings with length. Bingo. not really. readlines returns an empty line as "\n", not as an empty string. replacing None with a suitable lambda expression might help: A = filter(lambda s: len(s) > 1, H.readlines()) or (easier to read), ignore empty lines (and maybe comments too?) in the processing loop. e.g. for line in H.readlines(): if line[:1] in "#\n": continue # skip this one ... From quinn at xeno.ugcs.caltech.edu Fri Feb 11 15:51:15 2000 From: quinn at xeno.ugcs.caltech.edu (Quinn Dunkan) Date: 11 Feb 2000 20:51:15 GMT Subject: An FTP based Python Module repository References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> <87plr8$qig$1@news.tht.net> <87qu5c$inu$1@newshost.accu.uu.nl> Message-ID: >m.faassen at vet.uu.nl (Martijn Faassen) writes: >> Let's not ignore you. :) Am I the only one who thinks that this >> 'archive of Python modules' could be constructed pretty easily now >> that you gave us Parnassus? We can write a script that translates >> Parnassus's structure into directory structure, and then downloads >> everything through any download link given. Add an extra link to >> Parnassus download pages ('cached'), and open an FTP site if you >> like. Run this script once every while, or continuously in the >> background of something. And there we have our archive. >> >> Am I missing something? I'm not saying *Tim* should do this all this >> hard work (he's doing more than enough already), but am I the only >> one who considers this quite doable given Parnassus? >> >> Regards, >> >> Martijn Another possibility would be to allow mirroring of the VoP database. Then people could set up their own vaults and take some of the load off vex.net (I've had numerous "trouble with the database, try again later" msgs, don't know if this is related to load or not, and other people have indicated sporadic trouble reaching vex.net). Also, this would allow people to set up a more straight-forward layout for those with modems and those who have trouble reading all those shades of blue, and not have to bother tim about it (besides getting him to get the code to release quality and add the mirroring capability!). This would also enable ftp-style mirroring, cmdline tools, __import__ tricks to snag modules automatically (shudder), etc. Or it could be set as a distributed sort of thing, where modules propagate over the network, but no one site is the "master archive". Or is this what CPAN does? Also, it doesn't appear parnassus actually stores the modules, just links to the author's page. This eliminates versioning problems (and makes the database a lot smaller!), but doesn't work so well for authors without web pages or who disappear. Don't get me wrong, I think VoP is way cool and quite handy, but it isn't quite perfect yet. From garry at sage.att.com Thu Feb 17 14:49:06 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Thu, 17 Feb 2000 19:49:06 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: <38AC50B2.3FAF778@sage.att.com> osorronophris osorronophris wrote: > > I'm a die-hard C++ programmer that recently took up Python for a change of > scenery and am enjoying it greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've tried chewing gum but it > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? glue an inverted thumbtack to your ";" key. if that doesn't work, coat it with poison, or maybe LSD. -- 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 ebecker at software-manufaktur.de Tue Feb 15 06:44:20 2000 From: ebecker at software-manufaktur.de (Edelhard Becker) Date: Tue, 15 Feb 2000 12:44:20 +0100 Subject: Argo / Python / UML design tools References: Message-ID: Hi Greg, On Mon, 14 Feb 2000 13:11:23 -0500, Greg Wilson wrote: > Is anyone working on UML design tools that are Python-friendly? > More specifically, has anyone taken a look at Argo > (http://www.ics.uci.edu/pub/arch/uml/) with an eye to making it > understand Python? If so, I'd be grateful for a ping... "Together" (http://www.togethersoft.com/index.htm) is implemented in Java and comes with JPython. Unfortunately it's not cheap ... > Thanks, > Greg HTH, Edelhard -- ~ ~ :wq From tim_one at email.msn.com Sun Feb 20 17:55:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 17:55:52 -0500 Subject: Can't reopen eMatter book Message-ID: <#xq1sW$e$GA.117@cpmsnbbsa03> [Anders Eriksson has problems opening the effbot's eMatter book, Tim trots out the "kill the fatbrain.com registry branch" hack that worked for him, then ... ] > Thanks for the suggestion. Unfortunally this didn't solve my problem. > ... [tale of woe] ... > After a while we found out that I'm using the Swedish version of > Acrobat 4.0 Damn -- beat me to it! That was going to be my next suggestion . > and eMatter don't work with any version except the American. An irony only you will fully appreciate is that the effbot (your book's author) was designed, built, programmed, and still resides, in Sweden. BTW, one of the people who devised the eMatter registration scheme wrote in pvt to say that the need for the "kill the fatbrain.com registry branch hack" on some systems is now understood, and a fix is in beta. People who have tried to program Windows before will recognize the true cause: a system API that's only been implemented by one vendor, so is full of surprises no matter how carefully you study the docs and think you've tested your code. try-writing-a-windows-speech-recognition-app-ly y'rs - tim From guido at cnri.reston.va.us Wed Feb 23 22:59:34 2000 From: guido at cnri.reston.va.us (Guido van Rossum) Date: 23 Feb 2000 22:59:34 -0500 Subject: Tkinter vs. wxPython (was: Which GUI?) References: Message-ID: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> "Fredrik Lundh" writes: > from deep inside gerrit's head. he's completely lost it. > better ignore him, or this thread will go on forever. Note that Fredrik is the author of a large body of Tkinter documentation (too bad he is such a perfectionist that someone else beat him to publishing the first Tkinter book :-). His company about to launch a Tkinter-based product, so his fierce defense of Tkinter can be explained in various ways. I don't care much for Gerrit's attacks on Tkinter, but the reason this thread keeps going on is that there is indeed a grain of truth. Limiting the debate for now to Tkinter vs. wxPython, I see arguments on both sides. Arguments for Tkinter: - It is well-established; the Tcl/Tk code base is very solid. - It has a superior text editing widget, supporting multiple fonts, colors, embedded widgets, marking of arbitrary overlapping ranges with arbitrary marks, and an arbitrary number of text pointers. - It has a superior canvas widget, which supports an object-oriented drawing model directly; it even draws splines! - It has very smooth screen display through double-buffering. - There's a book on Tkinter and several on Tk itself. Arguments against Tkinter: - It has poor printing support (PostScript only, and no standard print dialogs). - It lacks many common widget types, like notepads (although Pmw compensates somewhat; but Pmw itself is not so easy to use). - Adding scroll bars requires jumping through a few hoops. - Its look and feel is far from native. - The Mac support is basically broken. This *may* be fixable easily enough, but until someone actually submmits the patches, it's broken. - It's relatively slow; probably due to the double buffering and the levels of X11 emulation that it goes through, not to mention the Tcl interpreter that has to pass all commands in text form to the Tk library. - It doesn't let you handle your own paint events; you have to use the canvas widget. Occasionally (as when drawing animations or large bitmaps) that's annoying and slow, because you have to create and destroy tons of small objects. Arguments for wxPython: - Very complete widget set. - Faster screen update than Tkinter. - Very good native look on Windows. - You can handle your own paint events if you want to. - Native print support. Arguments against it (from very limited exposure): - It's a relatively new kid on the block (what's currently in use is unrelated to the wxPython that was being discussed at the GUI bakeoff 4 years ago); it can crash and burn. - Because it's implemented using SWIG, it is potentially less robust in the face of buggy user code; it's possible to do things that simply hang or crash the program rather than causing a traceback. This is very rare in Tkinter. - Much more simple-minded text widget (but Scintilla is coming?). - No Canvas widget -- you must handle your own paint events, whether you care or not. - wxWindows is bulkier than Tcl/Tk; this translates into noticeably slower startup times. - Are there any books out yet? (The wxPython documentation contains lots of remarks of the form "the wxPython interface provides the following two APIs instead of this single one..." so I don't buy Gerrit's argument that you don't need separate docs.) Personal experience: I recently wrote a simple GUI (for a Unit testing framework) in TKinter. Then I rewrote the same thing in wxPython -- my first wxPython program. I was learning wxPython from the manual as I went along. I guess that this disadvantage (that I had to learn wxPython) sort of canceled the advantage of having coded a version already. The wxPython version is actually shorter than the Tkinter version! (Approx. 250 vs. 350 lines of code.) It is also much faster -- the Tkinter version is fast enough, but the wxPython version is clearly faster (except in startup, where Tkinter wins easily). It looks a bit uglier, probably because I haven't figured out all the details of automatic widget lay-out control yet; but it looks more native.) Naturally, I went back to the Tkinter code to see what was wrong -- but there isn't anything wrong with it. It's just that some idioms are a bit more verbose when using (bare) Tkinter. For example, in wxPython the scroll bars on the text and list widgets appear automatically; in Tkinter I had to write a helper class and two (trivial) subclasses. All this doesn't mean that I'm going to rewrite IDLE in wxPython (IDLE uses the Tkinter text widget in ways that I wouldn't know how to do in wxPython yet), but wxPython can certainly make sense in some contexts. I've always said, with chairman Mao, "let 1000 flowers bloom" -- there aren't quire 1000 different GUI toolkits, so there's still room for a few more. In the mean time, it's likely that the big three will be Tkinter, wxPython and gtk. (I haven't really used gtk yet -- for now it sounds too Linux-centric even though it has a Windows port). Disclaimer: I've only spent maybe two afternoons with wxPython. I may have overlooked some things. Let's keep an open mind. --Guido van Rossum (home page: http://www.python.org/~guido/) From neilh at hare.net.au Thu Feb 24 20:56:53 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Fri, 25 Feb 2000 12:56:53 +1100 Subject: PythonWin -- print option? References: <98g9bs8e1ugl1r7k0t8j0jdb441251ak51@4ax.com> Message-ID: <02e301bf7f33$97dc2570$01646464@computer> > However, PythonWin has a print button, along with print entries > on the File menu. All of these are ghosted out in my installation. Which version of PythonWin? Printing didn't turn up until 128 (or maybe 127?). Neil From DOUGS at oceanic.com Mon Feb 28 16:19:30 2000 From: DOUGS at oceanic.com (Doug Stanfield) Date: Mon, 28 Feb 2000 11:19:30 -1000 Subject: Appending/inserting in outfile.write() Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F329@huina.oceanic.com> A simple text file may not be the best choice for persistant storage in your case. Look at the shelve module for one alternative. -Doug- > -----Original Message----- > From: Will [mailto:wcohen at interpath.com] > Sent: Monday, February 28, 2000 10:46 AM > To: python-list at python.org > Subject: Appending/inserting in outfile.write() > > > I'm trying to write a CGI Python guestbook. Would there be a > way for me > to get the script to simply append, say 14 bytes from the end, to the > HTML guestbook file rather than completely overwriting it and holding > only one entry? I can use outfile.write to simply rewrite the entire > file. Do I need to use another function or just set a flag? > If I can't > insert text, can i just delete the last 14 bytes and rewrite the end > from there? > > Thanks, > Will > -- > http://www.python.org/mailman/listinfo/python-list > From warlock at eskimo.com Wed Feb 9 21:33:09 2000 From: warlock at eskimo.com (Jim Richardson) Date: Wed, 9 Feb 2000 18:33:09 -0800 Subject: OT: about the multiple posts References: <87nklj$ct9$1@nnrp1.deja.com> <389F738E.6C47BD6F@bellsouth.net> <20000208201510.C2074@stopcontact.palga.uucp> Message-ID: On Tue, 8 Feb 2000 20:15:10 +0100, Gerrit Holl, in the persona of , brought forth the following words...: >Xenophanes wrote on 949952303: >> I have been using Netscape since it started and never had any problem Do >> you have version 4.7? If not maybe you need to upgrade? Move to another >> if you want, but Netscape is the best you will find. > >I disagree. The original poster uses Linux, and there are a lot of >other good mailreaders for Linux. Mutt , Pine . >Or newsreaders, Slrn , Tin . >Search www.freshmeat.net >-- I personally like and prefer slrn to anything else, but if clicky-pointy is your thing, then Pan is worth a look. It's like agent, only with good scoring and running on a stable OS. (well, the scoring is better than agent's, but not as good as slrn :) -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From dalke at acm.org Thu Feb 24 02:40:53 2000 From: dalke at acm.org (Andrew Dalke) Date: Thu, 24 Feb 2000 00:40:53 -0700 Subject: data structure design question References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> <88plbb$bth$1@nntp2.atl.mindspring.net> Message-ID: <892n5j$h9$1@nntp1.atl.mindspring.net> Konrad Hinsen wrote in message ... > I suspect that the atom type approach is more general, > since atoms are a much better defined concept than bonds. >Conclusion: there is no one correct computer model for molecules. >It all depends on what you want to do with it. I'm at a chemical informatics conference. They like bond types. They want bonds. As far as I can tell, they've built up their intuition with bond types. But the general impression I get is everything is easier to define on atoms, including properties like stereochemistry. BTW, Thursday afternoon will be the big debut of my PyDaylight module; see http://www.daylight.com/ for the latest MUG meeting, MUG 2000. I hope to wow everyone, and get more chemists using Python! My marketing title is "More Science, Less Time" :) Andrew dalke at acm.org From bparsia at email.unc.edu Wed Feb 9 21:31:48 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 21:31:48 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> <38A20260.DC87BA21@cosc.canterbury.ac.nz> Message-ID: <1e5r7ja.1tbfmz1a3eylzN%bparsia@email.unc.edu> Greg Ewing wrote: > Quinn Dunkan wrote: > > > > Has anyone done a #!/usr/local/bin/smalltalk > > just-another-scripting-language? Would it even be smalltalk? > > Years ago I played with something called Little Smalltalk, > which was something like that. It still seems to be available -- > have a look around in: > > ftp://ftp.cs.orst.edu/pub/budd/little I believe Gnu Smalltalk is aiming at this space. Several other implementations might well be adaptable. I *think* Gnu Smalltalk just uses the "fileout" syntax. It's kinda like having a workspace open. Squeak's PWS had a module that let you "do it" and file in code from a web page, so in principle it's quite doable. Also, the ANSI Smalltalk spec doesn't really support or mandate an IDE, and took inspiration from Wilf-Brock's (I think) "Declarative Smalltalk" stuff. So, an ANSI conformant program is, in principle, completely describable in a textual format. Which would make it ameable to a #! deployment. Cheers, Bijan Parsia. From fdrake at acm.org Mon Feb 14 16:00:38 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 14 Feb 2000 16:00:38 -0500 (EST) Subject: IDLE and Hooks in apps for usage of My Favorite Editor In-Reply-To: <3mZo4.12128$S64.332686@nnrp1.uunet.ca> References: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com> <38A234AA.2B1FE6CB@python.net> <14498.52621.853399.866552@weyr.cnri.reston.va.us> <14499.1283.295475.398450@weyr.cnri.reston.va.us> <3mZo4.12128$S64.332686@nnrp1.uunet.ca> Message-ID: <14504.27894.464229.484275@weyr.cnri.reston.va.us> Warren Postma writes: > A more recent layer on top of libICE is DCOP, being used heavily in the KDE > project. > Have a look at the KDE 2.0 work at www.kde.org Looks like it depends on Qt, which means "a large library in C++". Not a killer, but less than ideal in the Python world (just a comment; I'm not slaming the Qt or KDE people). Does anyone here know of any small message bus libraries that are still maintained, and are open source? -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From arnaud at crao.net Mon Feb 28 05:39:42 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Mon, 28 Feb 2000 11:39:42 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: In article , "Fredrik Lundh" wrote: > MacPython dynamic modules aren't portable between releases. The > machinery is there, but because PythonCore also contains the whole C > library the version number has to be upped not only for python API > version number changes but also for new C libraries. The error > message > comes from the MacOS dynamic loader, which actually _checks_ that a > dll is compatible with the version used during compilation (unlike > some Other OS that shall remain nameless, which happily lets your > application crash lateron:-) Fine. So, I need to re-compile the module from the sources. Hmmmm ..... but I don't have CodeWarrior ... so ... But that's another story. Do you know any way to check those version numbers ?? Any plan to drop the C lib away from PythonCore (why is it embed ?????? that looks strange to me on a modern -what ? any comment on MacOS being a modern OS ? ...... - OS ...) ? So, in a few words : Do you have a solution to my problem (I don't have a C compiler on the MacOS side ...) ? Regards, Arnaud From tim_one at email.msn.com Wed Feb 16 04:45:58 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 04:45:58 -0500 Subject: RC (was Re: Real Problems with Python) In-Reply-To: <38A979D2.71CD8FB3@inrialpes.fr> Message-ID: <001901bf7862$a0d1dee0$b7a0143f@tim> [Vladmir & Tim have apparently lost everyone, so let's wrap it up] [Tim] >> Vlad, you're trying to get "deep" on what is really a "shallow" point: [Vladimir Marangozov] > Tim, you're trying to get "shallow" on what is really a "deep" > point. I suspect it's really a bit of both! This started as a very brief Usenet posting, and I don't feel bad about pointing people to LOR (locality of reference) as a way to get a first handle on why RC (reference counting) has run faster in Python than every "real GC" attempt to replace it. To a first approximation, LOR is the single most useful concept to get across to people struggling with memory issues on VM (virtual memory) systems. To a second approximation, "cache effects" is more accurate, but also much harder to get a grip on. To a third approximation, "platform quirks" would have covered my ass completely, yet left everyone without a clue. So I'm definitely indulging in idealized fiction, that happens to be true in some actual cases. My track record of *predicting* how various gc approaches would turn out in Python ain't half bad, you know . OTOH, your saying "it ain't necessarily so!" in six ways is six times true, but doesn't leave people with even a sixth of a first approximation to trip over. If they're interested enough, they'll pursue it and fill in the painful details themselves. > Saying that "RC has excellent LOR", even when trash is recycled at > high rates, is disturbing. Take a vacation . > ... > Nope, not "whatever". Take a flat-out computation involving a > container (say, a dict with ints) which gets resized repeatedly, > and your argument is flawed. Not so much flawed here as ridiculous. So what? I haven't claimed to give a rigorous account, and one can't even be attempted without a sufficiently precise model of a specific platform (both HW and system SW). There's nothing to argue about here short of that: take it as it was intended, a comforting brief bedtime story with elements of truth. BTW, I expect you do undervalue the usefulness of LOR arguments "in practice, in general". Their utility is based on the simplicities that are presumed usual rather than the pathologies that are presumed possible. The real world often enough plays along to make it worth the minimal effort. > ... > You're saying that the drops of an intense rain falling over the MIT > building will *not* wet Cambridge and Boston, without knowing: > (1) how long the rain will last, Forever, for practical purposes. (2) the evolution of the rainy cloud and Long periods of steady states, with brief periods of unpredictable change. > (3) which parts of Boston/Cambridge are included in the calculus. > MIT people are quite certain Boston is a fiction . > ... > And that's why I don't buy your argument. That's OK by me: you're still trying to make it too deep . > We still don't know anything about LOR in Python, so drop it from > your vocabulary . It may be bad, it may be good, it may be > acceptable. I know about cache effects on Pentiums, because I've watched them under Intel's analysis tools. LOR looked like a darned good bet to me. This is time-consuming & tedious work, though, and I only looked at a few of my own programs. They happened to fit all the assumptions I made, so perhaps it's not surprising that my conclusions appeared to fit . >> I believe there's sufficient evidence that state-of-the-art "real gc" >> can be made faster than rc. Python isn't other languages, though, and >> so long as everything in Python is always "boxed", other languages' >> gc experiences aren't especially relevant. > Agreed. With Toby/Neil's recent work, things look promising... > BTW, any comparison of RC with state-of-the-art GC is fine by me. > > as-long-as-you-don't-mess-with-LOR--ly y'rs ok-ok-it's-due-to-the-"cacheothonic-principle"-ly y'rs - tim From fatjim at home.com Sat Feb 19 03:16:40 2000 From: fatjim at home.com (Jim Meier) Date: Sat, 19 Feb 2000 08:16:40 GMT Subject: Rudimentary dict (RFC 2229) client library References: Message-ID: <950948200.234334532@news> On Sat, 19 Feb 2000, Jim Meier wrote: >I'm posting it here in the hopes that someone else will find it useful. If >you have any corrections (or nitpicks), please let me know! Nitpicks like, maybe, forgetting to post the code. Whoops. Time for sleep. --Jim Meier BillyGrahamBot: the dissotiaton of choice. The road to our Armageddon will be required to run on both Linux and Microsoft Windows NT. We might be seeing you in heaven. And God told him to be extensible or to accomodate other UI paradigms than text terminals. import socket import types import re import string class DictDefinition: def __init__(self, dict, word): self.dict = dict self.word = word self.defs = {} def definitions(self): return self.defs.values() def adddef(self, dictid, definition): self.defs[dictid] = definition def dictids(self): return self.defs.keys() def dictnames(self): return map(self.dict.dictname, self.defs.keys()) class Dict: def __init__(self, server, port=2628): self.server = server self.port = port self.open = 0 self.sock = None self.file = None self.databases = None def _getdatabases(self): self._connect() self.databases = {} self.sock.send("SHOW DB\n") resp = self.file.readline() n = string.atoi(string.split(resp)[1]) done = 0 while not done: line = self.file.readline() if line[0] == ".": done =1 else: id, name = self._quotesplit(line) self.databases[id] = name self.file.readline() # get the 250 ok self._disconnect() def dictids(self): if not self.databases: self._getdatabases() return self.databases.keys() def dictname(self, dictid): if not self.databases: self._getdatabased() return self.databases[dictid] def _connect(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect(self.server, self.port) self.file = self.sock.makefile('rb') welcome = self.file.readline() def _disconnect(self): self.sock.send("\nQUIT\n") self.sock = None self.file = None def _quotesplit(self, s): ''' like split, except everything between pairs of ->"<- counts as one part. ''' parts = [] buf = "" in_quotes = 0 for i in s: if in_quotes: if i =='"': in_quotes = 0 parts.append(buf) buf="" else: buf = buf + i else: if i == '"': if buf !="": parts.append(buf) buf = "" in_quotes = 1 elif i in string.whitespace and buf != "": parts.append(buf) buf = "" else: buf=buf+i if buf != "": parts.append(buf) if parts[-1] == '\015': del parts[-1] print s print parts return parts def _onedefine(self, word): self.sock.send("DEFINE * %s\n"% word) done = 0 res = DictDefinition(self, word) while not done: line = self.file.readline() code = line[:3] if code == "150": n = string.atoi(string.split(line)[1]) elif code == "151": parts = self._quotesplit(line) word = parts[1] dictid = parts[2] dictname = parts[3] done_def = 0 definition = "" while not done_def: line = self.file.readline() if line[0] == ".": done_def = 1 else: definition = definition + line res.adddef(dictid, definition) elif code == "250": # ok done =1 elif code == "552": # no match done = 1 return res def define(self, word_or_words): if type(word_or_words) is types.StringType: self._connect() res = self._onedefine(word_or_words) self._disconnect() return res elif type(word_or_words) is types.ListType: self._connect() res = [] for i in word_or_words: res.append(self._onedefine(i)) self._disconnect() return res else: raise TypeError("Need a string or list of strings.") From 55555 at dakotacom.net Mon Feb 14 13:59:22 2000 From: 55555 at dakotacom.net (55555) Date: 14 Feb 2000 12:59:22 -0600 Subject: os.shell, recursion, encryption References: <1261579303-39527346@hypernet.com> Message-ID: <38a8508a_2@news5.newsfeeds.com> On Mon, 14 Feb 2000 10:46:30 -0500, "Gordon McMillan" wrote: > 55555 wrote: > > > I'm spawning pkzip for dos using os.shell() because I would like to > > use the encryption > > feature. As far as I can tell that is not available in the gzip > > library and the > > documentation on the cryptography toolbox didn't give me the > > impression that all the bugs > > were worked out. Does anyone know whether that has changed? > > 1) You must mean os.system Yes. You're right. I do mean os.system. > 2) What cryptography toolbox? There are a number of them. I have tried the 'Python Cryptography Toolkit' distributed as pycrypt100.tgz. It looks great, but one of the demo programs says that the file deletion command is commented out because the author doesn't know if the program is perfect yet. Is this the best one to be using or is there a "safe" one? > > Anyway, os.shell() pops up a new dos box for each call. I'm using > > os.path.walk() and > > making a lot of calls to the zip program. I'm wondering if there is a > > way to not spawn > > 40 windows. 0 windows would be ideal. > > You probably want os.spawnv. I looked at os.spawnv, but I don't have access to the Visual C++ Runtime Library so I don't know what my options are for mode. Any ideas? > > Finally, I'm wondering if there is a way to attach to a global > > variable while moving > > around with os.path.walk()? I understand recursion and have read > > Python's scope rules > > but I can't seem to either pass local varaibles through or to attach > > to a global > > variable. > > Yes, you can use a global var, as long as your callback uses > "global". It might be better to use a mutable arg as the user > arg to os.path.walk - say, a list. > > - Gordon > Thanks. -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From effbot at telia.com Tue Feb 22 18:19:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 23:19:01 GMT Subject: Converting Strings to Integers in Python References: Message-ID: Lenny Self wrote: > I am new to Python and programming in general. I was wondering if someone > might help me with the proper syntax for converting a string or a portion of > a string into an integer. I'm pretty sure this is explained in the tutorial, but alright: >>> s = "123" >>> s '123' >>> int(s) 123 >>> int(s[1:2]) 2 for more info, see the docs (www.python.org) hope this helps! From anders.eriksson at morateknikutveckling.se Mon Feb 7 05:21:07 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 07 Feb 2000 11:21:07 +0100 Subject: CGI Scripts References: <389CEA00.9D771D21@webamused.com> Message-ID: <+ZWeOD+wStfbL4emCMvtqtVvlyvR@4ax.com> On Sun, 06 Feb 2000 09:01:38 GMT, "Fredrik Lundh" wrote: >Joshua Macy wrote: >> Sorry, typo. That should have read: >> >> print "Content-type: test/html\n\n" > >or rather, > > print "Content-type: test/html\n" > > print "Content-type: test/html" > print > Having alot of problems with just HTTP headers I have to ask this In all the above code snippets the content-type is set to test/html. Please correct me if I'm wrong but shouldn't it be text/html? // Anders From mwh21 at cam.ac.uk Fri Feb 11 15:29:25 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 11 Feb 2000 20:29:25 +0000 Subject: const for bytecode optimization... References: <881psn$tbp$1@nntp6.atl.mindspring.net> Message-ID: "Michal Wallace" writes: > hey all, > > you know... I was just thinking... someone posted about the const operator > a day or two ago... and the response was generally that you don't need it > because you can do THIS_KINDA_THING or even const.this .... > > But there's another thing that const gets you... Java, for example, can use > static final variables (constants) as a sort of bytecode optimizer, in place > of c style #IFDEF 's > > for example, say you had: > > DEBUG = 0 > > # call various functions any one of which might change DEBUG > > if DEBUG: > # nothing in here needs to be compiled into the .pyc > pass > > from what I understand, the optimizing compiler doesn't do anything yet, > maybe this could be a start.. The time machines strikes again (and again and again ...). The variable you are looking for exists. It is called __debug__: [mwh21 at atrus mwh21]$ python -O Python 1.5.2+ (#13, Jan 14 2000, 09:26:45) [GCC 2.95.2 19991024 (release)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> def f(): ... if __debug__: ... print 1 ... print 2 ... >>> f() 2 >>> import dis >>> dis.dis(f) 0 LOAD_CONST 1 (2) 3 PRINT_ITEM 4 PRINT_NEWLINE 5 LOAD_CONST 0 (None) 8 RETURN_VALUE >>> > of course, you could also just enforce the ALL_CAPS as being > constant, and not allow them to be redefined, but this could break > someone's code if they didn't follow that convention... There's definitely mileage in making the compiler a little cleverer. In the mean time, there are a few packages that will do post hoc optimization; my bytecodehacks package is one, Skip Montanero has another. There's not *too* much mileage here without doing type analysis/annotation of one sort or another, and that's a *hard* problem (see December Types-SIG, for instance). Cheers, Michael From bobalex at home.com Wed Feb 9 14:17:22 2000 From: bobalex at home.com (Bob Alexander) Date: Wed, 9 Feb 2000 11:17:22 -0800 Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> Message-ID: <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> The only true equivalent to this C/C++/Java/ code in Python is: if X > Y: temp = Y else: temp = X A = temp This evaluates only one of its selected expressions, and evaluates A only once. Its only fault is its lack of "hygiene" in that it puts a variable "temp" into the namespace. It can't be encapsulated into something that looks like a function call since Python doesn't support macros. Functions always evaluate all of their arguments before invoking function code, so there is no way to evaluate only one of the selected expressions. -- Bob From rockjock810 at my-deja.com Sat Feb 19 03:12:37 2000 From: rockjock810 at my-deja.com (rockjock810 at my-deja.com) Date: Sat, 19 Feb 2000 08:12:37 GMT Subject: ODBC, mxODBC problem References: <88jk4o$vsg$1@nnrp1.deja.com> Message-ID: <88lj9k$aqp$1@nnrp1.deja.com> I tried it again using: odbc.odbc("express/Admin/") odbc.odbc("express/Admin") Not one works. And with mxODBC: ODBC.Windows.DriverConnect("DSN=express;UID=Admin;PWD=;") ODBC.Windows.ODBC("express","Admin","") Not much luck here either. I tried running said statement(s) in Pythonwin's interactive mode, and it works. Something's wrong somewhere and I'm already at the edge of whatever's left of my wits. Help! In article <88jk4o$vsg$1 at nnrp1.deja.com>, rockjock810 at my-deja.com wrote: > I've been tinkering with both ODBC and mxODBC modules with no success > for the past 24 hours. > > I tried this with the ODBC module: > > import cgi,dbi,odbc > db=odbc.odbc("express") > # no UID, no PWD > > Traceback (innermost last): File "d:\the-cafe\cgi-bin\express.py", line > 25, in ? db=odbc.odbc("express") dbi.operation-error: [Microsoft][ODBC > Microsoft Access 97 Driver] The Microsoft Jet database engine cannot > open the file '(unknown)'. It is already opened exclusively by another > user, or you need permission to view its data. in LOGIN > > I tried the mxODBC variant with not much success. > > The "express" MS Access database is on a network share: > \\core\e$\express\express.mdb > > The System DSN was not opened at all exclusively and I haven't been > having problems accessing the same using Perl ODBC. Help! > > Sent via Deja.com http://www.deja.com/ > Before you buy. > Sent via Deja.com http://www.deja.com/ Before you buy. From garry at sage.att.com Fri Feb 18 09:09:34 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Fri, 18 Feb 2000 14:09:34 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38AC50B2.3FAF778@sage.att.com> Message-ID: <38AD529E.66A92685@sage.att.com> Tim Lavoie wrote: > Oh sure, LSD will *HELP* your coding. That must be amusing later. haven't actually tried it, but it might help *my* coding. > So what exactly happens at "Software Innovation Services"? :-) ya gotta admit, one might come up with some *really* innovative stuff that way. -- 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 wtanksle at hawking.armored.net Mon Feb 14 00:47:15 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 14 Feb 2000 05:47:15 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> Message-ID: On 14 Feb 2000 02:02:55 GMT, Samuel A. Falvo II wrote: >In article <000001bf768e$48e40580$45a0143f at tim>, Tim Peters wrote: >>class BinTree: >> # with members .left and .right of type BinTree (& None means none), >> # and .data of an arbitrary type >> ... >> def traverse_post(self): >> for child in self.left, self.right: >> if child is not None: >> suspend child.traverse_post() >> suspend self.data >>b = BinTree() >>... >>for leaf in b.traverse_post(): >> process(leaf) >I'm sorry, but I can't follow this code at all. What are the precise >semantics of suspend here? How does it return? Sam, imagine that instead of 'suspend' Tim had written 'return'. You see, then, that this would be a deeply recursive function which would return the data contained in the deepest node of the left-hand branch of the tree, right? (Ignore the fact that such recursion would be rather silly -- thanks to the 'suspend' it's not the same.) Well, it so happens that this is precisely what this function (using suspend instead of return) returns the first time it's called. The second time it's called it continues what it was doing when it did the last suspend -- look at it. It's asking each of its children to do a post-order traversal, and after they finish, return their own data. In other words, it's doing a depth-first search and allowing you to treat the result as a sequence. Kind of. If you have more questions, call me; I teach better that way. Or you could learn Icon -- it's a really cool language, and lots of fun. Sather includes a similar construct, although (alas!) I never saw it as fun there. Perhaps I was jaded, or maybe Sather didn't do it as well. >KC5TJA/6, DM13, QRP-L #1447 -- -William "Billy" Tanksley, in hoc signo hack From scarblac-spamtrap at pino.selwerd.nl Sun Feb 20 18:09:44 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 20 Feb 2000 23:09:44 GMT Subject: Test (ignore): Python mailing list may be down References: Message-ID: Tim Peters wrote in comp.lang.python: > From my POV, mail to python-list at python.org may have been broken all > weekend. > > testing-from-oe-ly y'rs - tim I've seen posts from you (on the Usenet POV) earlier today and earlier this weekend. So it was working fine, apparently. [ Others: I've *also* copied this to his mail address, and once is enough :-) ] -- Remco Gerlich, scarblac at pino.selwerd.nl Murphy's Rules, "Atomic TNT?": In Aftermath (FGU), a one-ton charge of high explosive will kill nearly every living thing in 300 square kilometers. From paul at prescod.net Fri Feb 4 13:49:29 2000 From: paul at prescod.net (Paul Prescod) Date: Fri, 04 Feb 2000 10:49:29 -0800 Subject: Haskell or Python! References: <000f01bf6edf$26ad09a0$a2a0143f@tim> Message-ID: <389B1F39.A6DC301A@prescod.net> Tim Peters wrote: > > Paul *likes* functional languages, btw -- don't get him wrong here. That's true. Python is the only language I like that wasn't designed by Guy Steele. :) Python is possibly the only language that appeals to ex-basic programmers, computer scientists, hackers and "software engineers". Since I belong in all of those categories it feels like home. But in my pure computer scientist mode I prefer Scheme... > > > Monads, gonads and lambda -- oh my! > > > > (one of these things is not like the others) > > Wait... don't tell me... I know! "Lambda" is supported in Python and > > the others aren't, right? What do I win? > > Paul's gonads . The one that actually doesn't belong is "monads", > because it's the only one of the three unlikely ever to be heard in a Monty > Python skit. I was thinking of "oh my!" because it isn't a noun. But your answers are also both valid. I can't offer you my gonads because they are already spoken for, but how about a URL: http://webworst.about.com/entertainment/webworst/library/weekly/aa101498.htm?iam=ask&terms=gonad Since the conversation was devolving, I figured we might as well jump directly to the worst of the web. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From fcahoon at my-deja.com Tue Feb 8 23:55:33 2000 From: fcahoon at my-deja.com (fcahoon at my-deja.com) Date: Wed, 09 Feb 2000 04:55:33 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> <1e5p92l.xgr4fe1s2x5ptN%bparsia@email.unc.edu> Message-ID: <87qs04$ni1$1@nnrp1.deja.com> In article <1e5p92l.xgr4fe1s2x5ptN%bparsia at email.unc.edu>, bparsia at email.unc.edu (Bijan Parsia) wrote: > wrote: > > > In article <1e5nkk6.1a5z8bp1lixbdvN%bparsia at email.unc.edu>, > > bparsia at email.unc.edu (Bijan Parsia) wrote: > > > wrote: > [snip] > > > > > I think, notwithstanding your experience with C (though why that > > should > > > be applicable to Python...), *you* have a riddle to answer: There is a > > > *lot* of Python code out there. The standard distribution contains > > loads > > > of modules from many different sources. You *yourself* indicate that > > > Python is becoming common place.... > > > > The popularity of a language cannot be taken as prima facie evidence of > > its technical superiority. > [snip] > > Well, that would be a telling riposte *if* my argument had anything to > do with technical superiority. My point was, as Garrett pointed out, > that the fact that there are large bodies of Python code from > heterogenous sources which themselves have had heterogenous contributers > *and yet* there hasn't been (reported) wide scale difficulties is *prima > facie* evidence that the "whitespace munging" problem is not severe. > Given that, the burden of proof returns to you, and analogies from > other, *disanalogous* langauges will no longer serve. Actually, my mention of Perl in particular is draws on the common statements in the Python community about Perl's unmaintainability. Granted, _you_ didn't say Perl is unmaintainable, but still this is the basis of what I was trying to get at. A language can have Problems (with a capital 'P') and still acheive widespread popularity. Of course, this isn't really fair to Perl, which is really not that bad in my opinion -- athough the only perl code I maintain is my own, so that makes it a lot easier for me. > > > [ ... ] > > > > > > > If python code were to become mis-formatted (and given my > > experience, I > > > > have to believe that sooner or later this _will_ happen) > > > > > > Er...not your experience of *Python* code, right? So, your experience > > > with Python code: 0. Everyone elses: >0 (some up to, what, 8 years? 10 > > > years?). I think it more correct that your *lack* of (relevant) > > > experience leads you to your belief. > > > > It's true that my experience writing python can, for practical purposes, > > be called 0 here. However, I think it is a mistake to consider the > > posters responding to me to be representative of people with experience > > with python. Already, among the majority of posts from people who find > > that indentation-as-syntax is not a problem, several people _with_ > > python experience who believe indentation-as-syntax _is_ a problem have > > spoken. > [snip] > > Well, look, you've just *changed* your argument. Your original argument > was that *based* on your C experience, certain conclusions about Python > can be drawn. > > Now, that a few people *with* python experience chimed in is some sort > of confirmation, but hardly what you should hope for given the strength > of your claim and the nature of your supporting evidence. What I had actually hoped for was a reasoned discussion that would teach me some valuable things. So far, I have learned a bunch of stuff, and I am happy. I expressed my concerns, and gave my reasons for those concerns. Should I not have done so? > And, yes, sure, there well may have been people turned off by > "whitespace", but isn't the true measure, to be consistent with your > argument, of the the defectives of Python's block delimitors that when > receiving files from other people, one is *typically* left *totally > clueless* as to the intent of the programmer? *No one* has claimed that. "*typically* left *totally clueless*" !?!?!? *No one* has claimed that! If that were true, the language simply wouldn't work at all! I'm more concerned about the possiblilty of one bad line being left in a infrequently-executed routine, leading to spurious errors which are difficult to track down. > [ ... ] > Of course, it's theoretically possible that everybody *is* spending all > their time indenting and reindenting code, guessing where things should > go, and so on, but that the other advantages of Python *so outweigh* > this huge effort that people put up with it anyway. Yes, that's exactly what I was getting at. "All the time" is, of course, an exaggeration -- but some extra time, yes. > I respectfully suggest that the *prima facie* case is very strongly > against this. And given that Python is open source and that adding > "visible" block delimiters is more or less trivial *and* *no* > alternative block delimited version has *appeared* much less gained > *any* following, I think we can rest confident that indentation is not a > problem. After python gained a certain level of popularity, though, it would be easier to 'put up' with the problem than hack the langauge, because of the availability of modules and such. So this particular argument doesn't seem too forceful to me. > [ ... ] f Sent via Deja.com http://www.deja.com/ Before you buy. From mhammond at skippinet.com.au Tue Feb 1 07:02:24 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 12:02:24 GMT Subject: What is winfo_id() under Win32 References: <3890439A.1C1BA6D2@freemail.hu> <86pt4k$f6h$1@nnrp1.deja.com> <38916AC9.AD1008A2@freemail.hu> Message-ID: "Attila Filet?th" wrote in message news:38916AC9.AD1008A2 at freemail.hu... > > In the meantime, the following _should_ work: > > > > wnd = win32ui.CreateWindowFromHande() > > parent = wnd.GetParent() > > Unfortunately I also get an Attribute error for 'CreateWindowFromHande'. Damn - should cut and paste :-) CreateWindowFromHandle - didnt have the 'l' > Actually when I search through win32* files for the string 'GetParent', > it matches in the file Pythonwin\win32ui.pyd (and win32com\win32com.hlp) > while 'CreateWindowFromHande' cannot be found at all and neither of them > can be imported. Its in the Pythonwin help file (if you add the 'l' :-) > (I've fetched the latest win32all.exe but it was the same I've already > installed) Mark. From peter.stoehr at sdm.de Thu Feb 17 09:36:39 2000 From: peter.stoehr at sdm.de (Peter Stoehr) Date: Thu, 17 Feb 2000 15:36:39 +0100 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: <38AC0777.D5B55C03@sdm.de> Hi J.C., "J.C.Travers" schrieb: > The best GUI in my opinion is pyQT. It is a fully supported > widget/application set written in C++, so it is natural for python > (object-orientated). The python wrappers for it are brilliant and the > documentation is massive (unlike Tk). It is available on your platform > (as well as Unix and Mac) and has every conceivable widget you could > want. (Particular tables and multicolumn list boxes). It is simple and > logical to code in. I always tought that pyQT is based on QT. As far as I know QT is not available for Mac. In addition, you have to pay for QT (appr. 1200$) on Windows-Systems as far as I know. Thus, from my point of view pyQT is not the first choice for Windows programmers. In addition, there exist a lot of documentation for Tkinter. For example the book "Python and Tkinter Programming" from John E. Grayson. Greetings from bavaria Peter -- Dr. Peter Stoehr mailto:peter.stoehr at sdm.de sd&m AG http://www.sdm.de software design & management Thomas-Dehler-Strasse 27, D-81737 Muenchen, Germany Tel ++49 89 63812-783, Fax -444 From moeller at networksplus.net Tue Feb 8 18:30:46 2000 From: moeller at networksplus.net (Derek Moeller) Date: Tue, 8 Feb 2000 17:30:46 -0600 Subject: about the multiple posts In-Reply-To: <389F738E.6C47BD6F@bellsouth.net>; from tgabriel@bellsouth.net on Mon, Feb 07, 2000 at 08:38:23PM -0500 References: <87nklj$ct9$1@nnrp1.deja.com> <389F738E.6C47BD6F@bellsouth.net> Message-ID: <20000208173046.A7310@networksplus.net> On Mon, Feb 07, 2000 at 08:38:23PM -0500, Xenophanes wrote: > I have been using Netscape since it started and never had any problem Do > you have version 4.7? If not maybe you need to upgrade? Move to another > if you want, but Netscape is the best you will find. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MUAFlameWar!!! chant *mutt* *mutt* *mutt* ..though tis hard to bring about battles in c.l.py if it's not about whitespace... -- Derek Moeller From boud at rempt.xs4all.nl Mon Feb 21 16:23:05 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 21 Feb 2000 21:23:05 GMT Subject: Which GUI? References: <20000220194012.A2069@stopcontact.palga.uucp> Message-ID: <88sabp$3q6$1@news1.xs4all.nl> Fredrik Lundh wrote: > why not just place a lean and mean OO layer on top of > Gtk (or Xt)? in my book, *that* would be Python-like... Well, if you _do_ want to use that toolkit, there is PyGTK, or PyGnome, of course. That's what I like, no like is to weak, love, about Python - I can try almost all toolkits in existence, and still program in Python... Of course, I'm partial to PyQt/KDE myself - but that's just as lean and mean as PyGTK. -- Boudewijn Rempt | http://www.valdyas.org From ivanlan at callware.com Thu Feb 24 07:51:57 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 24 Feb 2000 05:51:57 -0700 Subject: Phyththon misspelling contest References: <20000224075308.A1854@stopcontact.palga.uucp> <8937kk$d0r$1@nntp6.atl.mindspring.net> Message-ID: <38B5296D.9EFE7B67@callware.com> Aahz Maruch wrote: > > In article <20000224075308.A1854 at stopcontact.palga.uucp>, > Gerrit Holl wrote: > > > >> > >> Get Chaucerian, win valuable prizes! Extra points if none of > >> your posts spells it the same way as any other. > > > >Paaison or paaiton. > > Hothead! My hero! > > (Uh, for the vast majority of you who won't get the joke, look for the > great book _Hothead Paisan: Homicidal Lesbian Terrorist_.) I did a little research, and discovered HP:HLT is comix. Interestingly, Amazon lists J.K. Rowling (author of the Harry Potter books) as another author bought by people who buy Hothead. I'm sure there's a lesson there somewhere, Grasshopper, but I'm damned if I know what it is. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 Gaetan_Corneau at baan.com Mon Feb 21 15:24:56 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Mon, 21 Feb 2000 15:24:56 -0500 Subject: Python article Message-ID: <816010E2456BD111A48700805FBBE2EE01C60551@ex-quebec-u1.baan.com> FYI, There is an article (5 pages) in the March issue of Software Development about Python ("Fast, free prototyping in python", by Andrea Provaglio). The author talks about using the COM extensions to read data from an Access database using ADO. ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Tu l'as trop ?cras?, C?sar, ce Port Salut" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From seanb at home.com Tue Feb 8 17:44:12 2000 From: seanb at home.com (Sean Blakey) Date: Tue, 08 Feb 2000 22:44:12 GMT Subject: scripting language performance issues In-Reply-To: <87puts$2ff$1@nnrp1.deja.com> References: <87puts$2ff$1@nnrp1.deja.com> Message-ID: On Tue, 8 Feb 2000 qoppi at my-deja.com wrote: > i've done some rudimentary testing using wcat to > view performance differences between scripting > languages for a set of pages ( vbscript, jscript, > python,perlscript). Initial results indicate that > using vbscript as the server side scripting > language consistently results in more pages being > served by the webserver...has anyone else had a > similar experience? > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list > It's been a long time since I worked with ASP (six months in the QA department at Chili!Soft), so I am a bit rusty. As I remember, using any scripting language other than VBScript requires the use of the "@ Language=" directive. With the current version of ASP at the time, only one @ directive was allowed per page, giving a decided advantage to VBScript as an ASP language. We noticed the same performance hit on IIS and PWS whenever the "@Language directive" was used. My guess is that the ASP engine loads the VBScript engine by default for every script (perhaps even keeping the VBScript loaded continuously). When the ASP engine hits an "@language" directive, that script will have a performance hit as the ActiveX scripting engine is invoked. Try explicitly setting the language to VBScript in all the VBScript scripts you are using for the performance tests. If you can find a way to change the default language the ASP server uses, do so and see how that affects performance. Sean Blakey (206)297-7123 quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0]) From mwh21 at cam.ac.uk Thu Feb 17 18:23:19 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 17 Feb 2000 23:23:19 +0000 Subject: Overloading = References: <88htqk$rb5$1@nnrp1.deja.com> Message-ID: jhefferon at my-deja.com writes: > I have a class, rclass. It has an attribute value. Can I arrange > so that the string > r1=r2 > sets r1.value to equal r2.value (where r1 and r2 are class instances, > of course) without changing anything else about r1? No. Assignment rebinds references, rather than affecting objects. This is quite a difference from C++ (say), probably one of the harder ones to get one's head around. > I'm willing to > test, say, that r1.classtype==r2.classtype or something, first to make > sure the assignment is sensible. > > And if so, can I also have r1=7 set r1.value to be 7? > > I want to have a box in a GUI where users can enter code, such as > assignments, and I'd like to avoid the reference to the underlying > attribute. Hmm... do you know about the "exec in globals,locals" style of doing things? Though `exec'ing user input sounds deeply unwise to me. What is it you are trying to do? Maybe we can come up with a better solution (no promises though). Cheers, M. From torppa at polykoira.megabaud.fi Mon Feb 28 11:04:04 2000 From: torppa at polykoira.megabaud.fi (Jarkko Torppa) Date: 28 Feb 2000 16:04:04 GMT Subject: Introspection References: <38BA7310.C6968E6E@mindspring.com> Message-ID: <89e69k$fje$1@news.kolumbus.fi> In article <38BA7310.C6968E6E at mindspring.com>, Chuck Esterbrook wrote: > >If I want a handle/pointer to an instance's class, how do I do that? >>> class Pah: ... pass ... >>> p=Pah() >>> p.__class__ >>>> class Foo: >... pass >... >>>> Foo.__name__ >'Foo' >>>> dir(Foo) >['__doc__', '__module__'] >>>> If this is what you want what is wrong with ? >>> Foo -- Jarkko Torppa torppa at staff.megabaud.fi Megabaud Internet-palvelut From gerrit.holl at pobox.com Thu Feb 17 01:37:06 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 07:37:06 +0100 Subject: Is there a python equivalent of the perl... In-Reply-To: <38AB1376.515C9A59@austin.ibm.com>; from dfavor@austin.ibm.com on Wed, Feb 16, 2000 at 03:15:35PM -0600 References: <38AB1376.515C9A59@austin.ibm.com> Message-ID: <20000217073706.A1514@stopcontact.palga.uucp> David R. Favor wrote on 950710535: > Benchmark.pm module, to allow benchmarking arbitrary > snippets of code? Maybe you are looking for the timing module. regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From newsgroup at 1mactod.com Wed Feb 9 05:13:03 2000 From: newsgroup at 1mactod.com (wes) Date: Wed, 9 Feb 2000 00:13:03 -1000 Subject: make BSD No such file or directory Error code 1 Message-ID: <87rekg02lfv@enews4.newsguy.com> Trying to install Python152 on a ISP virtual server based on BSDI. Did a 'tar' into the '/tmp' directory, then './configure' and then 'make' and was going well until I got a 'no such file or directory error': sr/local" all gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c bltinmodule.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ceval.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c compile.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c errors.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c frozen.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c frozenmain.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getargs.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getcompiler.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getcopyright.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getmtime.c gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -DPLATFORM='" bsdo s3"' ./getplatform.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c getversion.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c graminit.c gcc -D_HAVE_BSDI -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c import.c gcc -D_HAVE_BSDI -c -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -I/ ./importdl.c ./importdl.c:269: mach-o/dyld.h: No such file or directory *** Error code 1 Tried 'make MAKE=make' and 'make clean' also but same error. 'config.log' shows the following failures: configure:1261: minix/config.h: No such file or directory configure: failed program was: #line 1260 "configure" #include "confdefs.h" #include configure:1304: checking whether gcc -D_HAVE_BSDI accepts -OPT:Olimit=0 configure:1318: gcc -D_HAVE_BSDI -OPT:Olimit=0 -o conftest -g -O2 conftest.c 1>&5 cc1: Invalid option `-OPT:Olimit=0' configure: failed program was: #line 1314 "configure" #include "confdefs.h" int main() { return 0; } configure:1338: checking whether gcc -D_HAVE_BSDI accepts -Olimit 1500 configure:1352: gcc -D_HAVE_BSDI -Olimit 1500 -o conftest -g -O2 conftest.c 1>&5 gcc: 1500: No such file or directory cc1: Invalid option `-Olimit' configure: failed program was: #line 1348 "configure" #include "confdefs.h" int main() { return 0; } configure:1522: thread.h: No such file or directory configure: failed program was: #line 1521 "configure" #include "confdefs.h" #include configure:1522: sys/audioio.h: No such file or directory configure: failed program was: #line 1521 "configure" #include "confdefs.h" #include ...and about 20 more failed programs... Trying to get to the point of being able to install and run Zope. Any ideas? Is this the best process for self-helping myself to solving this problem? Should I be reading a FAQ elsewhere. I tried the Python FAQ but no luck. Thanks. From gawron at obop.com.pl Mon Feb 14 06:30:21 2000 From: gawron at obop.com.pl (=?iso-8859-1?Q?Przemys=B3aw?= G. =?iso-8859-1?Q?Gawro=F1ski?=) Date: Mon, 14 Feb 2000 12:30:21 +0100 Subject: dictionary implementation Message-ID: <38A7E74D.F5DDF2EF@obop.com.pl> I was wondering what algorithm is used for the standard dictionary in python ? Maybe some one currently online knows ? Thanks Przemek -- Przemyslaw G. Gawronski UIN:8358522 mailto:gawronskip at usa.net mailto:gawron at obop.com.pl From effbot at telia.com Mon Feb 21 15:13:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 20:13:34 GMT Subject: i am a newbie to python , where can i D/L it? References: Message-ID: Collin Greene wrote: > i have just heard about python and i was told it was a good begginging lag > to start programming with i jsut need to know where i cna get it i thought > is free, is it not, thanks for any halp http://www.python.org => download also see: http://www.deja.com/=dnc/getdoc.xp?AN=587527690 hope this helps! From ngps at post1.com Wed Feb 16 10:23:45 2000 From: ngps at post1.com (Ng Pheng Siong) Date: Wed, 16 Feb 2000 15:23:45 GMT Subject: Docu tools References: <8892da$hl8$1@nnrp1.deja.com> <889e1a$3cv$1@nntp9.atl.mindspring.net> Message-ID: <88efds$cbf$1@nnrp1.deja.com> In article <889e1a$3cv$1 at nntp9.atl.mindspring.net>, "Michal Wallace" wrote: > I was thinking about that myself the other day... POD doesn't make as > much sense for python because you can actually load up a module and > iterate over its docstrings.... So you don't have to think in terms of > =head 's.... Well, it looks like OpenSSL's docu in the upcoming version is in POD. I would rather like to be able to munch those in Python. After coming to Python, I'm extremely reluctant to write Perl again. ;-) -- Ng Pheng Siong * http://www.post1.com/home/ngps Sent via Deja.com http://www.deja.com/ Before you buy. From sholden at bellatlantic.net Tue Feb 8 10:06:01 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 08 Feb 2000 15:06:01 GMT Subject: Redundant elements in sys.path Message-ID: <38A030C1.14FF5F9D@bellatlantic.net> I noticed that both PythonWin and Idle have the same items, although with different case representations, in sys.path. Since the filestore isn't case-sensitive on Windows NT I'm wondering a) How these duplicates came about (multiple installs?), and b) What I can do to get rid of them (registry scoured, but nothing probable found). The code I used to detect this situation is no great shakes: >>> s=list(sys.path) >>> s.sort() >>> for p in s: ... print p Output from PythonWin: C:\Program Files\Python C:\Program Files\Python\DLLs C:\Program Files\Python\DLLs C:\Program Files\Python\Lib C:\Program Files\Python\Lib\lib-tk C:\Program Files\Python\Lib\plat-win C:\Program Files\Python\Pythonwin C:\Program Files\Python\Pythonwin C:\Program Files\Python\lib C:\Program Files\Python\lib\lib-tk C:\Program Files\Python\lib\plat-win C:\Program Files\Python\win32 C:\Program Files\Python\win32\lib Output from Idle: C:\PROGRA~1\PYTHON C:\PROGRA~1\Python\Tools\idle C:\Program Files\Python C:\Program Files\Python C:\Program Files\Python\DLLs C:\Program Files\Python\DLLs C:\Program Files\Python\Lib C:\Program Files\Python\Lib\lib-tk C:\Program Files\Python\Lib\plat-win C:\Program Files\Python\Pythonwin C:\Program Files\Python\lib C:\Program Files\Python\lib\lib-tk C:\Program Files\Python\lib\plat-win C:\Program Files\Python\win32 C:\Program Files\Python\win32\lib Since I'm not running from source distribution I'd appreciate it if someone could explain how PYTHONPATH is initialized and how I can simplify my environment to remove this duplication. regards Steve Holden -- "If computing ever stops being fun, I'll stop doing it" From brian at brian.cbs.umn.edu Tue Feb 15 14:54:50 2000 From: brian at brian.cbs.umn.edu (Brian Langenberger) Date: 15 Feb 2000 19:54:50 GMT Subject: is this a Python bug? Message-ID: <88caua$fef$1@news1.tc.umn.edu> R is supposed to work to give raw strings with the backslashes stored as backslashes. I've never had a problem until I tried making a string with nothing but backslashes. When I did, I got this result: 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 >>> r'\\\' File "", line 1 r'\\\' ^ SyntaxError: invalid token >>> Is this an error in the implementation or did I miss something in the docs? I don't actually *need* such a string; I just found this while experimenting with the interpreter. From gonzo at vex.net Mon Feb 21 19:50:23 2000 From: gonzo at vex.net (Anthony DeLorenzo) Date: 22 Feb 2000 00:50:23 GMT Subject: PIL Installation Woes Message-ID: <88smgf$1nqs$1@news.tht.net> I've been following the recent discussion of PIL installation problems, but I am still getting 'unable to load imaging C library' errors. I tried unzipping the installation right into the python directory, and then moving the .dll file to almost any place I could think of, with no success. Realizing that it is a free library, I would still suggest that a few lines of installation instructions for the Win32 distribution would help greatly. Tony ===== Anthony DeLorenzo Whitehorse, YT, Canada http://www.vex.net/~gonzo/ From hgg9140 at skewer.ca.boeing.com Wed Feb 23 12:40:11 2000 From: hgg9140 at skewer.ca.boeing.com (Harry G. George) Date: Wed, 23 Feb 2000 17:40:11 GMT Subject: Python plugin for Gnumeric spreadsheet References: <87wvnyte07.fsf@parus.parus.no> Message-ID: Not necessarily the best way, but possible: class Bool: def __init__(self,cbool): self.cbool=cbool #determine value from analyzing cbool self.value=(cbool=='T') def __call__(self): return self.value def test(): #---load the data--- p=Bool('T') q=Bool('F') r=Bool('T') s=Bool('F') #---use it--- if p() and not q() and r() and not s(): print "test ok" else: print "test fails" #---report it back out--- send_to_gnumeric(r.cbool) ... Jon K Hellan writes: > > I am looking for suggestions. > > The Gnumeric spreadsheet has a plugin which lets you define > spreadsheet functions in Python. General scripting of the spreadsheet > is not (yet?) supported. > > To give you an idea, here is how a very simple function is defined in > Python and made available to Gnumeric: > > import gnumeric > > # Function definition > def mid(text,start_num,num_chars): > return text[start_num-1:start_num+num_chars-1]; > > # Help text for Gnumeric > help_mid = \ > "@FUNCTION=MID\n" \ > "@SYNTAX=MID(text,start,num_chars)\n" \ > "@DESCRIPTION=" \ > "Returns a specific number of characters from a text string, " \ > "starting at START and spawning NUM_CHARS. Index is counted " \ > "starting from one" > > # register_function is a C function in Gnumeric to - you guessed it - > # register the function. The parameters are: > # - function name > # - parameter types > # - paremeter names - for use in the function wizard > # - help string > # - python function > gnumeric.register_function ("mid", "sff", "text, start_num, num_chars", > help_mid, mid); > > The plugin doesn't yet handle booleans properly. Python is happy to > consider 0 or None false, and everything else true. But inside > Gnumeric, booleans are a distinct datatype. A function defined in > Python may receive a boolean from a C function, and will want to > return it to the spreadsheet without converting to integer. So a > distinguished boolean datatype is needed. > > What is the most pythonesque way to do that? > > I forgot to mention. Gnumeric tries to be compatible with Excel. > > Who can help? > > Jon -- Harry George E-mail: harry.g.george at boeing.com The Boeing Company Renton: (425) 237-6915 P. O. Box 3707 OY-89 Everett: (425) 266-3149 Seattle, WA 98124-2207 Page: (425) 631-8803 From aahz at netcom.com Fri Feb 18 15:43:40 2000 From: aahz at netcom.com (Aahz Maruch) Date: 18 Feb 2000 20:43:40 GMT Subject: Dopy, Pyro or Fnorb: Examples of use and more References: <38AD2D6A.E68601F3@bibsyst.no> Message-ID: <88kats$qes$1@nntp6.atl.mindspring.net> In article <38AD2D6A.E68601F3 at bibsyst.no>, Thomas Weholt wrote: > >And, if anybody know of any reason to use any package over another, in >terms of stability, speed, features etc. I mean, I don`t want to create >a huge pile of code for something that won`t be updated anymore. FnOrb >is Corba-stuff, and that bothers me. It seems to have alot of >overhead/extra stuff that needs to be done for a project written in and >for Python. Why would I care about Corba if all I want is to use, send >and manipulate Python-objects? We've used asyncore/Medusa combined with cPickle to do this. -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From gmcm at hypernet.com Thu Feb 17 22:57:54 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 17 Feb 2000 22:57:54 -0500 Subject: static class methods in Python? In-Reply-To: <88ic3d$560$1@nnrp1.deja.com> Message-ID: <1261276284-11190393@hypernet.com> Greg Wilson asks: > Have there been any proposals to add the equivalent of "static" > methods (belonging to the class, not to instances) to Python? The complaints vastly outnumber the proposals. The most common complaint is the lack of C++ style static methods. These are usually greeted with hordes of ugly workarounds. But the argument for is largely aesthetic, (since a module level function serves the same purpose), and supporting this in Python would mean some way of flagging a function living in a class's dict as being something that should not be bound on a getattr, (since a normal method actually *is* a function object living in a class dict). Then there are a few who want Smalltalk style "class methods", which take a "self", but the "self" is the class object, not the instance. Don Beaudry actually did this as part of his MESS / objectmodule experiments, but they broke with Python 1.5. - Gordon From thamelry at vub.ac.be Fri Feb 18 04:09:12 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 18 Feb 2000 09:09:12 GMT Subject: Which GUI? References: Message-ID: <88j27o$mvs$1@mach.vub.ac.be> Mike Fletcher wrote: [snip] : (minor) Stability issues (passing incorrect arguments can cause : memory protection errors etc.) Note: wxPython has been much more stable for : me than Fox, but I haven't used Fox in a number of months. [snip] Fox is slowly working towards Fox 1.0. The python bindings to fox are lagging behind (they're currently at version 0.99.87). I asked whether they were planning to continue the development of FXPy and the answer was yes, after Fox 1.0 is released. So FXPy will probably become a valid option in the near futur. http://www.cfdrc.com/FOX/fox.html http://home.HiWAAY.net/~johnson2/FXPy/ Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From mwh21 at cam.ac.uk Tue Feb 29 07:37:52 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 29 Feb 2000 12:37:52 +0000 Subject: Strange Python problem on Linux. References: <38BBB8EF.9306991C@python.net> Message-ID: "Thomas A. Bryan" writes: [snip] > I've never had this problem before in over a year of Python work. > Basically, I have a Python program that I can run by typing > python filename.py > but not by typing > ./filename.py [snip] The only thing I can think of is that the hash-bang line has some control characters or other gunk in it - have you tried `cat -v'-ing it? HTH, Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From benflynn1 at my-deja.com Fri Feb 18 10:27:53 2000 From: benflynn1 at my-deja.com (benflynn1 at my-deja.com) Date: Fri, 18 Feb 2000 15:27:53 GMT Subject: win32security References: <87pu3o$23i$1@nnrp1.deja.com> Message-ID: <88jodj$32a$1@nnrp1.deja.com> I am currently trying to modify the permissions of 2500 directorys on a server to take them from Everyone full control to Administrator / a specific user full control. I am relatively new to python and the closest I have got to achieving this objective is the following : #!/usr/local/bin/python from win32security import * from ntsecuritycon import * from win32con import * sid,domain,z = LookupAccountName('\\\\server','userid') newACL=ACL() oldsecurity=GetFileSecurity('c:\\test',DACL_SECURITY_INFORMATION) newACL.AddAccessAllowedAce(GENERIC_ALL , sid) oldsecurity.SetDacl(1, newACL, 0) SetFileSecurity('c:\\test',DACL_SECURITY_INFORMATION,oldsecurity) Can anybody help me with this as the above code won't work - fails on SetFileSecurity. Any help would be much appreciated. Ben. Sent via Deja.com http://www.deja.com/ Before you buy. From moshez at math.huji.ac.il Sat Feb 26 01:09:27 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 08:09:27 +0200 (IST) Subject: parameter undefined in procedure In-Reply-To: <38B6FA9A.2AE5E25A@labs.agilent.com> Message-ID: On Fri, 25 Feb 2000, David Smith wrote: > Lisp hangover, I suppose. As a recovering Scheme hacker, I completely understand what you mean. Well, coding Scheme in Python is dangerous -- it's much better to write Python in Python. > Which is also the reason lambda is in Python, > no? Actually, Guido claims not to know Scheme or Lisp. It was added after much clamoring, and is occasionally useful, but much less then in Scheme. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jason at hostway.com Thu Feb 3 08:34:02 2000 From: jason at hostway.com (Jason Abate) Date: Thu, 3 Feb 2000 07:34:02 -0600 Subject: socket.gethostbyaddr() problem References: <87aec4$gmn$1@news.jump.net> <20000203091957.A6378@xs4all.nl> Message-ID: <87c09n$paq$1@news.jump.net> Thomas Wouters wrote in message news:20000203091957.A6378 at xs4all.nl... > On Wed, Feb 02, 2000 at 05:22:57PM -0600, Jason Abate wrote: > > I'm having a problem with socket.gethostbyaddr(). If I call it as > > root, it works fine, but if I call it as non-root, I get the following > > exception: > > > > socket.gethostbyaddr(socket.gethostname()) > > socket.error: host not found > > > It works fine on my rh6.0 box here: > > >>> socket.gethostbyaddr(socket.gethostname()) > ('tilburg.poiesz.net', [], ['194.109.58.47']) > > Did you check /etc/resolv.conf as well? I do get a 'host not found' error > when my /etc/resolv.conf is unreadable and my hostname is not listed in > /etc/hosts. If that doesn't fix it, are you using a DNS, or are you > unconnected and relying entirely on /etc/hosts ? Does it have the proper > entries for your hostname ? We finally got this working - the problem turned out to be that our DNS server was not setup to allow reverse lookups on the machine we were testing on, which caused the lookup to fail. Once we enabled reverse lookups, it worked like a charm. Thanks, -jason ------------------------------- Jason Abate Hostway Corporation jason at hostway.com From mikael.johansson at helsinki.zxz Thu Feb 24 05:31:07 2000 From: mikael.johansson at helsinki.zxz (Mikael Johansson) Date: Thu, 24 Feb 2000 12:31:07 +0200 Subject: Where can I take a Win32all-128 References: <892ge9$66n$1@news.nsu.ru> Message-ID: <38B5086B.E1ECB0EA@helsinki.zxz> Hello! "???? ???????" wrote: > > Who knows where can I get a PythonWin (Win32all-128)? http://starship.python.net/crew/mhammond/ Have a nice day, Mikael J. From james+news at daa.com.au Fri Feb 11 03:28:28 2000 From: james+news at daa.com.au (James Henstridge) Date: Fri, 11 Feb 2000 08:28:28 GMT Subject: os.environ is empty in JPython References: <87s4bt$g4op$1@fu-berlin.de> Message-ID: <38A3C7D9.D88EB4E1@daa.com.au> In order to be secure (or something), the developers of java decided that programmers don't really need to access environment variables. If you want your jpython (or java) program to access the QUERY_STRING environment variable, either write a java extension that calls getenv for you, or wrap the program in a shell script that passes the QUERY_STRING environment variable on the command line: #!/bin/sh exec java program "$QUERY_STRING" (you can probably work out what to do if you are using windows) This second option is probably easier to do if you only need access to a few environment variables, but if you need access to all the environment variables, the java extension is probably the way to go. James. Carsten Sessler wrote: > > Hello, > > in order to run some Python-Scripts as CGI I'd like to read environment > variables. The same script running in Python delivers what I expect (the > "QUERY_STRING") whereas in JPython the os.environ dictionary is empty. What > can I do to get my environment or are there any other (JAVA?) methods that > suit my needs? > > regards, > Carsten Sessler From mwh21 at cam.ac.uk Mon Feb 28 12:34:09 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Feb 2000 17:34:09 +0000 Subject: Help with Code Object Caching References: Message-ID: Brent Fulgham writes: > My initial implementation is to Marshal the compiled code > object into a PyString, then convert this into a "char*" > of known length I can store in my Cache. > > Then, when I am ready to execute, I build a new PyString > from the char* and length, Marshal it back to a PyCodeObject, > and execute that. > > Before I go too far down this path, I just wanted to ask > if there were any better alternatives that have already > been implemented. This seems like a problem that might have > been solved by others already. > > Any comments? Sounds pretty good from here; I've not done anything much like this before - but this is pretty close to what the marshal module was written for, so it should work just fine (As I understand it, the marshal module was written to enable saving of .pyc files). Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From alxchltn at my-deja.com Tue Feb 22 23:13:39 2000 From: alxchltn at my-deja.com (alxchltn at my-deja.com) Date: Wed, 23 Feb 2000 04:13:39 GMT Subject: New Python study group References: <88nn7r$m17$1@nnrp1.deja.com> Message-ID: <88vmph$3i3$1@nnrp1.deja.com> In article , H.V.Taylor wrote: > chris patti wrote: > > >gtnorton at my-deja.com writes: > > > > > >> Our address is: > >> http://python-studies-subscribe at egroups.com > >> or for more information, drop a line to: > >> strat_addict at yahoo.com > >> Hope to see you there. > >> > > > >I'm presuming the http in: > >> http://python-studies-subscribe at egroups.com > > > >Is a typo? > > > >-Chris > Seems so. However, after looking through the (for me) surprisingly > large list of Python-groups I believe that using this: > http://www.egroups.com/group/python-studies/info.html > will do the job ;-) > > Looks interesting, > Harold The above url that Chris points out is correct. I apologize.Just a little miscommunication. G.T. Sent via Deja.com http://www.deja.com/ Before you buy. From dworkin at ccs.neu.edu Thu Feb 10 16:31:26 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 16:31:26 -0500 Subject: perl chomp equivalent in python? References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> <20000210212121.B8912@stopcontact.palga.uucp> <38A329C7.F67DEAF9@rubic.com> Message-ID: Jeff Bauer writes: > Justin Sheehy wrote: > > > The need for this is also somewhat doubtful. I have yet > > to see a real (not contrived) example where string.rstrip() > > wasn't the right choice for this sort of thing. > > In most cases trailing whitespace is probably insignificant, > but it would be best not to assume this for all circumstances > (e.g. tab-delimited files). If you really feel the need to be more careful, you could do something like: (untested)* import os lines = open(file).readlines() for line in lines: if line[-len(os.linesep):] == os.linesep: line = line[:-len(os.linesep)] print line However, in comparison to the original solution of stripping a number of characters off without even checking what they are, string.rstrip() is definitely preferable. As I said before, in every real case I've seen for this sort of thing, string.rstrip() was the Right Thing to do. > I would not want to see string.rstrip() used in library > modules, since it could result in a loss of data where the > user might not be expecting whitespace to disappear. That's silly. It should be used in any library module where its behavior (stripping all whitespace from the end of a string) is desired. In any case where that is not desired, of course it shouldn't be used. It's just a matter of knowing what your intentions and specifications are. > Of all newgroups, certainly comp.lang.python would be > sympathetic to this issue. ;-) Last time I checked, Python wasn't sensitive to extra whitespace at the _end_ of a line. -Justin * - Also, I have no idea about the behavior of such things on non-UNIX-like operating systems. YMMV. From reic0024 at ub.d.umn.edu Sat Feb 5 12:38:30 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Sat, 5 Feb 2000 11:38:30 -0600 Subject: Dist. Object Directory (was: Re: An FTP based Python Module repository) In-Reply-To: References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: On 4 Feb 2000, chris patti wrote: > > And to me, a similarily interesting idea would be to have a server with a > > number of mirrors, that could host remote objects using dopy (alpha code, > > but easy to use IMO) or fnord. This probably isn't the most practical of > > all things, but the idea fascinates me. > > Well, it sounds cool but it's the wrong level of abstraction for the > problem :) Yes, I realize that, but the idea appeals to me, some how. As I said, I'm not sure about it's usefulness or practicallity. :) > How would an object broker approach help this situation? It wouldn't. My idea would entail doing something like this: (example using dopy) RemoteObj = dopy.remote('server.here.org',9600, 'aReallyCoolObject') RemoteObj.method('blah',23) I've played around with dopy some, and since modules themselves are objects, you can remotely import modules. As I said, this really would be a better substitute than what you describe, not at all. Just an idea which interest me. Aaron From stuart.hungerford at webone.com.au Thu Feb 17 04:41:28 2000 From: stuart.hungerford at webone.com.au (Stuart Hungerford) Date: Thu, 17 Feb 2000 20:41:28 +1100 Subject: Python misconceptions in IBM Ruby article... References: Message-ID: <38ABC248.655076F4@webone.com.au> Moshe Zadka wrote: > [Tim Peters wrote] > > Instead, after > > comp.lang.ruby is formed, we'll descend on it like a horde of enranged > > barbarians . > > [Ivan Van Laningham] > > What do you mean, "like"? I thought we _were_ barbarians, already fully > > equipped with ranges. > > No, no, Ivan, We're a cult. We will voodo Ruby until there is nothing left > but ashes. > Every great cult has a charismatic, evil genius as a leader. Tim, how's your schedule looking? ;-) Stu From mhammond at skippinet.com.au Sat Feb 26 16:31:03 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 26 Feb 2000 21:31:03 GMT Subject: More IIS crashing and blank .asp pages References: <81DD38F43381D111BA3E00A076A0998A459F5E@XENON> Message-ID: "Channel21 Python Team" wrote in message news:81DD38F43381D111BA3E00A076A0998A459F5E at XENON... > I tried once deleting all the .pyc files, but that only made the server keep > crashing, so I had to reinstall python > (guess I was overaggressive in my deletions... That particular problem should be gone in 128 - in 125 and earlier there was a dead-lock problem when Python was being initialized via COM. This could cause ASP and MTS to hang on startup, especially when creating .pyc files. This is different to the problem Guido was talking about... Mark. From tseaver at starbase.neosoft.com Sun Feb 6 21:08:21 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 6 Feb 2000 20:08:21 -0600 Subject: fnorb naming service References: <001301bf6f31$fa265500$d508a8c0@johnathan.intekom.co.za> <20000206132817.A21735@sz-sb.de> Message-ID: <39E22C8CB8DF3179.115C2AE4DE074690.46FF5CEE11F69432@lp.airnews.net> In article <20000206132817.A21735 at sz-sb.de>, Andreas Jung wrote: >On Fri, Feb 04, 2000 at 07:05:02PM +0200, Johnathan Ingram wrote: >> Hi >> >> Has anybody managed to get fnorb clients to work with another naming service other than the one that comes with fnorb. >> >> I am only able to use the fnorb with its own naming service and not with any other orbs naming service. >> Is this a bug and if so, do you guys have some sort of work around. > >I remember I have tested the naming server functionality about one year ago >successfully with Mico and ILU . I use it frequently with TAO's naming service. Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From tim_one at email.msn.com Sat Feb 26 03:26:16 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 03:26:16 -0500 Subject: Q about tail recursion In-Reply-To: <3.0.5.32.20000226013755.0087a180@mail.dicksonstreet.com> Message-ID: <000a01bf8033$269bdee0$3c2d153f@tim> [Felix Thibault] > I was following the funtional programming thread and trying to get > an idea about what tail recursion was, so I made these two functions: > > def add(inlist, sofar=0): > if inlist: > return add(inlist[1:], sofar+inlist[0]) > else: > return 0 The "return add ..." is a tail call, yes. > def faketailadd(inlist): > sum = [] > def add(recur,inlist, sofar, container): > if inlist: > recur(recur, inlist[1:], sofar+inlist[0], container) > else: > container.append(sofar) > add(add, inlist, 0, sum) > return sum[0] Both "recur(recur, ..." and "container.append(..." are tail calls in this "add"). > and tested them, and got: > > >>> a=time.time();b=test.add(k1);time.time()-a > 1.70000004768 > >>> a=time.time();b=test.faketailadd(k1);time.time()-a > 1.70000004768 > > (k1 is range(1000)) > > Does this mean that even though there are no return's in faketailadd's > add, the function still has to work its way back up from all those > recursive calls ? Perhaps you're missing that Python does no tail-call optimizations ever; or perhaps that Python invents a "return None" for you if you don't code an explict return yourself. > Or something like that ? Or does it just mean I misunderstood what > tail-call optimizing is like? Or does that too- good-to-be-true less- > than-1-nanosecond difference mean my testing is flawed ? Depending on your platform, time.time may have poor resolution; time.clock is recommended for benchmarking (and, e.g., generally has better than microsecond resolution under Windows). The crap at the end of 1.70000004768 looks like floating-point roundoff error made visible. If time.clock doesn't have beeter resolution than time.time on your platform, you'll have to arrange to capture the delta over a much longer stretch of time (e.g., call test.add in a loop and time the whole loop). For the most part, you're timing how long it takes to do inlist[1:] (you have a quadratic-time algorithm buried in here, first copying 999 elements, then 998, then 997, etc). after-all-this-i'm-still-not-sure-what-the-question-was-ly y'rs - tim From gerrit at nl.linux.org Sat Feb 26 16:14:53 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Sat, 26 Feb 2000 22:14:53 +0100 Subject: fatal SIGSYS under irix In-Reply-To: ; from dworkin@ccs.neu.edu on Sat, Feb 26, 2000 at 04:05:19PM -0500 References: <000201bf8022$e61bfae0$3c2d153f@tim> Message-ID: <20000226221453.A1597@humbolt.nl.linux.org> On Sat, Feb 26, 2000 at 04:05:19PM -0500, Justin Sheehy wrote: > "Tim Peters" writes: > > > Under Win95 (dear Lord, how embarrassing for Unix ): > > > > >>> f = open("blah.blah") > > >>> f.seek(1, -4) > > Traceback (innermost last): > > File "", line 1, in ? > > IOError: [Errno 22] The device does not recognize the command > > Just embarrassing for IRIX, and IRIX already has a lot of things > to be embarrassed about. > > Under both FreeBSD and Solaris: > > >>> f = open('foo') > >>> f.seek(1, -4) > Traceback (innermost last): > File "", line 1, in ? > IOError: [Errno 22] Invalid argument Same for Linux. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From squin at bigpond.com.au Mon Feb 7 05:15:58 2000 From: squin at bigpond.com.au (carl) Date: 7 Feb 2000 10:15:58 GMT Subject: pictures Message-ID: <8ED4DFC58earwig100yahoocom@210.23.129.58> pictures http://top100.tvheaven.com here you will find some nice pictures and some funny movies. pictures, movies, photos, animals, marine, nature From tom at parlant.com Mon Feb 21 18:35:18 2000 From: tom at parlant.com (Thomas Lane) Date: Mon, 21 Feb 2000 16:35:18 -0700 Subject: Tkinter - how to make a "Toplevel" window non-sizeable? Message-ID: <38B1CBB6.7C85AF61@parlant.com> Does anyone out there know how to make a Toplevel window non-sizeable? I'm trying to make a custom dialog box, but I don't want the user to be able to resize it. Is there some other widget that is more appropriate than a Toplevel widget for creating a dialog window, or is there some attribute I can set that turns off the ability to resize it? As usual, any help would be greatly appreciated. Thomas Lane Parlant Technology tom at parlant.com From pinard at iro.umontreal.ca Wed Feb 9 17:43:15 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 09 Feb 2000 17:43:15 -0500 Subject: perl chomp equivalent in python? In-Reply-To: "a.c.a. serier"'s message of "Wed, 9 Feb 2000 22:59:02 +0100" References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: "a.c.a. serier" writes: > Perl has chomp() to do this. To chop (even if line is truly empty): line = line[:-1] To chomp: if line and line[-1] == '\n': line = line[:-1] You may remove the test for line if you know that it is not empty. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From cjc26 at nospam.cornell.edu Fri Feb 11 09:47:11 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Fri, 11 Feb 2000 14:47:11 GMT Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com><389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be><38A06C31.70753311@prescod.net><1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu><38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> Message-ID: Pada Fri, 11 Feb 2000 07:27:12 GMT, Fredrik Lundh bilang: | | seriously, what are the major shortcomings in Python | from a Smalltalk professional's perspective? | | let's see: | | -- no blocks (lambda doesn't really cut it) | -- type/class dichotomy (CPython implementation) | -- no garbage collection (CPython implementation) | | what else? It's not as easy to play with metaclasses in Python. But that isn't needed too often in Real Programs anyway..:) -- cliff crawford -><- http://www.people.cornell.edu/pages/cjc26/ I think, therefore I'm single. From quinn at zloty.ugcs.caltech.edu Tue Feb 8 23:23:48 2000 From: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) Date: 9 Feb 2000 04:23:48 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> Message-ID: >Bijan Parsia wrote: >> >> But seriously, the *size* of the Squeak base is rather large. The >> biggest reasons for not using it as a drop in replacement for Python or >> Perl is that 1) it's not *structured* to be a drop in replacement for >> Python or Perl, and 2) the *content* of it's class library doesn't (yet) >> cover a lot of things that people use Python and Perl for (especially on >> the *nix size of things). >> >> One large advantage that both Perl and Python have is that they fit in >> well with a fairly common mindset that stems from certain set >> programming/working environments. This is more or less explicit in their >> designs. Squeak and Smalltalk are not a smooth fit for that mindset, so >> really mastering them typically requires a shift in deeply held habits. Ok, this is getting a bit OT, but what the hey: This is a good expression of my problem with smalltalk. I like the language, I'm impressed with squeak, but I don't see how I can use it. The first problem is that I don't want to use the built-in editor, I have my own tools and I prefer them for a reason. Although I'm sure I could have squeak import source from external files, it seems like that would be fighting the language. The other problem is that the things I do usually involve lots of interaction between other programs, filesystems, etc. and work non-interactively. Has anyone done a #!/usr/local/bin/smalltalk just-another-scripting-language? Would it even be smalltalk? >Only-half-a-joke: I think that Squeak's the biggest competitor not to >Python, but GNOME and KDE -- the world just hasn't realized it yet. It would be interesting to see a squeak system running on hardware ala oberon or something (perhaps there is one?). And not just aimed at being a code-writing environment, but a complete graphical environment. I'm sure this has been done before, but on modern systems? Hmmm... squeak + ggi + X compatibility layer.... From wware at world.std.com Tue Feb 29 18:47:52 2000 From: wware at world.std.com (Will Ware) Date: Tue, 29 Feb 2000 23:47:52 GMT Subject: stackless/microthread merge Message-ID: At IPC8, I got the chance to talk to Christian Tismer, the author of Stackless Python, about the possibility of using it as the basis for implementing microthreads. (This is desirable because his hacking of ceval.c was much tidier and better thought-out than mine.) He suggested that with a stackless build, it should be possible to implement microthreads entirely in Python. It is, with one caveat: My earlier implementation looked to the user like pre-emptive task-switching, which I accomplished by stepping Python's VM a few opcodes at a time. If I resist the temptation to do damage in ceval.c, task-switching must be explicit in the user's Python code, esp. in potentially infinite loops that might block all other threads. For the time being I regard that as a reasonable price for leaving all the really hard work to Christian. For Unix/Linux folks who have been looking for Stackless Python and finding only Windows versions, I have posted a source tree at ftp://ftp.std.com/pub/wware/spc152.tgz. It builds on my SunOS box at work, and appears to work there. I make no other promises for it. Anyway, on to the microthreads. (The stuff with semaphores is still badly broken, please ignore it. Thank you.) ==================================================================== """ Return of the Undead Microthreads Will Ware, Leap Day 2000 This is an implementation of microthreads built on top of Stackless Python, which is really the right way to do it. There is one remaining glitch: task switching is not pre-emptive. Functions must explicitly yield the processor by calling the "step" method of their threads, and any infinite loop that doesn't yield will block all the other threads. In the earlier implementation of microthreads, I dove into ceval.c and effectively played with "ticker" (actually wastefully invented my own roughly equivalent counter) and that gave me apparently pre-emptive task-switching. Stackless Python is so thoroughly inscrutable that I don't dare to try that now. """ import continuation ZombieError = 'zombie microthread error' NeverHappensError = 'I believe this never really happens' class Thread: def __init__(self, func, *args, **kw): self.func = func self.args = args self.kw = kw self.done = 0 self.killed = 0 self.future = self._start def _start(self, dummy=None): if not self.killed: try: apply(self.func, (self,) + self.args, self.kw) raise ZombieError finally: if self.killed: raise NeverHappensError # Do we really need this?? # hold = self.func, self.args # self.__dict__.clear() # self.func, self.args = hold self.killed = 1 def step(self): if self.killed: raise ZombieError future = self.future self.future = continuation.caller() future() class Swarm: # a bunch of threads def __init__(self): self.threadlist = [ ] def _one_step(self): first = self.threadlist[0] self.threadlist = self.threadlist[1:] try: first.step() self.threadlist.append(first) except ZombieError: pass def step(self, n=1): while 1: if n <= 0: return 1 if len(self.threadlist) == 0: return 0 self._one_step() n = n - 1 def finish(self): while self.step(100): pass class Blockable: def __init__(self, swarm): self.swarm = swarm self.wakelist = [ ] def block(self, thread): self.wakelist.append(thread) print thread, 'blocked' # make the swarm ignore this thread til it wakes again raise ZombieError def awaken(self, n=1): # use n = -1 to awaken everybody who is asleep while n != 0 and len(self.wakelist) > 0: z = self.wakelist[0] print z, 'awoken' self.wakelist = self.wakelist[1:] self.swarm.threadlist.append(z) n = n - 1 class Semaphore(Blockable): def __init__(self, swarm, n=1): Blockable.__init__(self, swarm) self.count = n def claim(self, thread): if self.count < 0: raise 'OUCH!' if self.count == 0: self.block(thread) self.count = self.count - 1 thread.step() def release(self): if self.count == 0: self.awaken() self.count = self.count + 1 # # # # # # # # # # # # # # import random def factorialTest(): sw = Swarm() for i in range(40): def factorial(th, n): prod = 1L for i in range(2, n): prod = prod * i th.step() print n, prod th = Thread(factorial, int(100 * random.random())) sw.threadlist.append(th) sw.finish() """ Semaphores obviously need a lot of work, but this is a rough idea of what to do. Currently, blocked threads terminate prematurely and I dunno why. """ def semaphoreTest(): sw = Swarm() sem = Semaphore(sw) N = 5 class IdThread(Thread): def __init__(self,func,sem,letter): Thread.__init__(self,func,sem) self.letter = letter def __repr__(self): return '' % self.letter def _start(self, dummy=None): if not self.killed: try: apply(self.func, (self,) + self.args, self.kw) raise ZombieError finally: print self, 'terminating' self.killed = 1 def task(th, sem): for i in range(6): print th, i, 'claiming' sem.claim(th) print th, i, 'got it' sem.release() print th, i, 'released it' for i in range(N): th = IdThread(task, sem, chr(ord('A') + i)) sw.threadlist.append(th) sw.finish() if __name__ == '__main__': factorialTest() ====================================================================== -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From sconley at cs.csubak.edu Tue Feb 15 00:20:46 2000 From: sconley at cs.csubak.edu (Sean Conley) Date: Mon, 14 Feb 2000 21:20:46 -0800 (PST) Subject: socket troubles In-Reply-To: <1261579305-39527253@hypernet.com> Message-ID: I read the socket how-to and it was of no help. createfilehandler treats a socket the same as any other filehandle, it just waits for a specific exception (event) and calls the given callback, straighforward enough. And as I said, this was a FAR from coplete implementation, I was just trying to get a very simple client up and running before I worried about buffering or anything of this nature. I realize this will be necessary in the final version as heavy traffic on a network can play havok with the amount of data a socket can accept. Anyhow, your last comment actually wasn't too far from what my problem was. I simply needed to send a carriage return at the end of the message. Thise done, it works fine and I can move on. So, tanks for your suggestion as it seems to have shoved my thick-headed self in the correct direction. :o) Sean On Mon, 14 Feb 2000, Gordon McMillan wrote: > Sean Conley wrote: > > > This problem has me completely stumped. I am trying to write a telnet > > client (actually a mud client) in Python. The problem is that I can > > connect and read information from the socket, but nothing seems to > > happen when I send to the socket. > > How do you know that? Does your app freeze? (that would > indicate the socket isn't writable). Nothing happens? (most > likely the server is waiting for more - how does the server know > when you're done sending?) Do you get an exception? > > You're not checking how bytes were actually sent. I have no > idea what createfilehandler does with the socket, although I'd > guess that's not the problem. > > There's a sockets HOWTO on python.org you should probably > check out. > > > I believe it may be a problem with my > > program, as I had the same problem with Perl/Tk and was unable to solve > > it there either. So, if anyone has ANY idea why this could be please > > email me or post here. > > My first guess is that you haven't delimited the sent data > properly, and the server is waiting for more. > > - Gordon > From mikael at isy.liu.se Tue Feb 15 08:59:35 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 15 Feb 2000 14:59:35 +0100 (MET) Subject: Off Topic Posts In-Reply-To: Message-ID: On 15-Feb-00 Oleg Broytmann wrote: > On 15 Feb 2000, Vetle Roeim wrote: > > as the python community grows and the number of posts increases, a > > split would seem natural. I would suggest something like c.l.python, > > c.l.python.moderated, c.l.python.web, c.l.python.tkinter (or perhaps > > c.l.python.gui would be better).. any other suggestions? > > c.l.python.win32 Well, c.l.py.sucks seems to be needed... /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: 15-Feb-00 Time: 14:58:25 This message was sent by XF-Mail. ----------------------------------------------------------------------- From JamesL at Lugoj.Com Sat Feb 26 14:16:56 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Sat, 26 Feb 2000 11:16:56 -0800 Subject: self argument References: <8984mm$5pi$1@nnrp1.deja.com> Message-ID: <38B826A8.66DAEB43@Lugoj.Com> Jason Stokes wrote: > > london999 at my-deja.com wrote in message <8984mm$5pi$1 at nnrp1.deja.com>... > >I am very new to Python, but it appears that every function defined in a > >class must have self as a first variable name. > > No. You're just a little confused on a couple of points. Firstly, member > functions always receive the invoked upon class instance as the first > argument. The convention is to call this argument "self", but there's no > requirement to do so. Secondly, not all functions are members of a class. > Functions that are not class members don't receive this implicit argument; > this way, you can program in conventional functional or procedural style. > > > Even better, it would be nice (probably too late > >I know), if self was defined implicitly as the "this" pointer is in C++. > > I'm not sure why Python's way was chosen, but you get used to it. If self were defined implicitly, then you would have to explicitly define local variables. This is, today you would do something like: class C: def __init__(self, b): self.b = b self.x = self.y = 0 def Func(self, a): t = a * self.b self.x = t * 2 self.y = t + 2 If self were implicit, then variables like 't' would need to be declared. That leads to some problems. The above might become: class C: def __init__(self, b): b = local.b # Arguments are local. def Func(self, a): local.t = local.a * b x = local.t * 2 y = local.t + 2 Or they could be declared once anywhere in the scope: class C: def __init__(self, b): b = local.b # Still need to def Func(self, a): local t = a * b x = t * 2 y = t + 2 I think I like the way the language was designed. From MSteed at altiris.com Thu Feb 10 17:32:42 2000 From: MSteed at altiris.com (Mike Steed) Date: Thu, 10 Feb 2000 15:32:42 -0700 Subject: Fully Bracketed Syntax Message-ID: <65118AEEFF5AD3118E8300508B124877073D74@webmail.altiris.com> > From: Eaglestone, Robert [NGC:B918:EXCH] > [mailto:eaglesto at americasm01.nt.com] > Sent: Thursday, February 10, 2000 3:13 PM > To: python-list at python.org > Subject: Fully Bracketed Syntax > > > Hello all, [...] > > if ( foo > bar ) > do_something(); > do_something_else(); > done(); > endif [...] > I guess what I'd like is some clear reasoning about > bracketing and indenting that warrants such a feature > of a language. In his book Code Complete, Steve McConnell calls this syntax "pure blocks". Ada is the only language he mentions that implements this. (Didn't Modula-2 do this too?) One of McConnell's rules is that the visual layout of the code should reflect its logical structure in order to maximize readability. In your example, the three lines inside the if should be indented (as they are) to indicate that they are suborinate to the conditional. McConnell likes pure block syntax best because it lends itself more readily to this style than begin..end and {..}. In this sense, Python is even better, because the layout of (valid) code always corresponds to its structure. (That is, if you ignore the one-line form "if a: blah".) -- M. From gerrit.holl at pobox.com Tue Feb 8 16:09:26 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 8 Feb 2000 22:09:26 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87nmir$e7k$1@nnrp1.deja.com>; from fcahoon@my-deja.com on Tue, Feb 08, 2000 at 12:04:45AM +0000 References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <20000208220926.A3388@stopcontact.palga.uucp> fcahoon at my-deja.com wrote on 949964685: > First is the _hardcore_ promotion of realistic alternatives to Python. > I believe that the Ruby language (http://www.ruby-lang.org/) has the OO > advantages of Python without the whitespace-as-syntax deficiency. (I'll > freely admit that my investigation of both languages is less than it > should be; fact-oriented discussion to enlighten is encouraged.) Ruby > hasn't achieved "critical mass" yet, but if enough of us see this > "problem" as I do, we can make that happen. The English in here is certainly a whole lot better than the English in the ruby mailinglist ;-) regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From a.eyre at optichrome.com Mon Feb 21 12:52:00 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 21 Feb 2000 17:52:00 -0000 Subject: How to transmit arguments from c++ to python In-Reply-To: <88adoe$itp$1@news.ihug.co.nz> Message-ID: <000f01bf7c94$5abea1f0$3acbd9c2@peridot.optichrome.com> > Many thanks for anyone who know why the PyRun_File crash c++ application, > but PyRun_String works very well. http://www.python.org/doc/FAQ.html#8.7 http://www.python.org/doc/FAQ.html#8.10 ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From aahz at netcom.com Mon Feb 14 10:03:20 2000 From: aahz at netcom.com (Aahz Maruch) Date: 14 Feb 2000 15:03:20 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <001101bf76b6$07a5e020$822d153f@tim> Message-ID: <8895fo$qvp$1@nntp6.atl.mindspring.net> In article <001101bf76b6$07a5e020$822d153f at tim>, Tim Peters wrote: > >[Samuel A. Falvo II, wonders about "suspend" semantics after > Tim's unelaborated example] > >[Aahz Maruch, proves that you don't have to be a lambda-head to > pick up the thrust of it at once -- thanks!] I have to admit that I used Icon briefly in a CS class more than a decade ago; it made much more of an impression on me than Lisp did, even though I still have my LISPcraft book and I can't seem to find my Icon book. (My professor was from UoA.) It was interesting trying to cast my memory back that far. BTW, it turns out that much of the Icon documentation is now on-line at http://www.cs.arizona.edu/icon/ >From my POV, Icon is a lot like Perl written by a Pascal programmer, with (from my more experienced viewpoint) its almost excessive emphasis on expressions rather than statements. I think that overall Python doesn't go quite far enough in that direction, but adding generators should make up much of the balance. -- --- 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 Have you coined a word today? From pinard at iro.umontreal.ca Wed Feb 16 20:50:43 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 16 Feb 2000 20:50:43 -0500 Subject: PROPOSAL: fix tabs & spaces in default library In-Reply-To: Robin Becker's message of "Thu, 17 Feb 2000 00:07:19 +0000" References: <20000213201812.A4849@stopcontact.palga.uucp> <38AB1830.3FEE1EC7@earthlink.net> Message-ID: Robin Becker writes: > I feel tab equivalent to 4 spaces is pretty good Just to be overly clear, you meant an indent step of 4 spaces. Tabulations called by the TAB character, if it has to be, are OK when set at every 8 columns. Sorry for discussing such a, euh, hum, "delicate" matter here! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From ivanlan at callware.com Mon Feb 28 11:21:28 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Mon, 28 Feb 2000 09:21:28 -0700 Subject: CGI-Counter References: <38BA999B.CC8E2AC0@uni-koblenz.de> Message-ID: <38BAA088.F8D196BB@callware.com> Hi All-- Volker Rausch wrote: > > Hi. > > Is there anyone having a Python CGI script running that counts visitors > on a webpage? I have no Idea how to program that.... > It shouldn't be that hard, but why bother? Muhammed Muquit's Count works so well, is so customizable, and compiles and runs on pretty much anything, that there's not a lot of point to reinventing this particular wheel. Check out http://www.muquit.com/muquit/software/Count/Count.html -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 skip at mojam.com Wed Feb 9 14:29:58 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 9 Feb 2000 13:29:58 -0600 (CST) Subject: A = X > Y ? X : Y In-Reply-To: References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> Message-ID: <14497.49206.498301.518099@beluga.mojam.com> Fredrik> umm. to be precise, he asked for something equivalent to "the Fredrik> C command a = x > y ? x : y". I'd say "a = max(x, y)" is a Fredrik> pretty good approximation ;-) Dang! There goes that effbot using his whole brain again! Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From gerrit.holl at pobox.com Fri Feb 25 01:54:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 25 Feb 2000 07:54:39 +0100 Subject: (no subject) In-Reply-To: <001101bf7f44$3e5932c0$b62d153f@tim>; from tim_one@email.msn.com on Thu, Feb 24, 2000 at 10:56:06PM -0500 References: <20000224195930.9372.qmail@nwcst281.netaddress.usa.net> <001101bf7f44$3e5932c0$b62d153f@tim> Message-ID: <20000225075439.A1669@stopcontact.palga.uucp> > [Def P] > > ... > > I still don't understand the benefit of string methods > > over oldfashioned string functions... > > The string functions aren't going away, so feel free to ignore string > methods if they don't appeal to you. Aren't they becoming obsolete? Won't the string be deprecated? Not sure what's the difference ;) > At heart, I think they were driven by the upcoming introduction of a new > Unicode string type. Python 1.6 no longer has *a* string type, it's got > two. Viewing the various string operations as abstract methods on a variety > of concrete string types is natural and appealing, while (possibly) adding a > pile of new string *functions* that work sensibly *only* on Unicode strings > (e.g., titlecase, byte-order mark fiddling, who knows?) would be unnatural > and unappealing. Special methods in a subclass are natural. Where can I find more info on those Unicode strings, except in the source? Will they be mutable (I don't think so)? What methods do *they* have? > Using string methods certainly "looks different" at first, but the > implementation has been available for several months (in the CVS development > tree), and people who have *used* string methods uniformly report that they > quickly come to like them (btw, "space.join(list)" is gorgeous!). > So give 'em a try, or stop whining . Hmmmmmmmmmmmmmm... > in-the-end-guido-is-simply-mysterious-ly y'rs - tim Indeed, I find [].sort() very irritating and often have this function defined: def sortlist(l, *args): apply(l.sort, args) return l regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From mjackson at wc.eso.mc.xerox.com Wed Feb 23 11:31:21 2000 From: mjackson at wc.eso.mc.xerox.com (Mark Jackson) Date: 23 Feb 2000 16:31:21 GMT Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> Message-ID: <89120p$sai$1@news.wrc.xerox.com> Mladen Bestvina writes: > Here is what I get. Please help! > > mladen at drava:/home/mladen/projects/grayson > python > Python 1.5.2 (#4, Feb 14 2000, 16:39:33) [GCC pgcc-2.91.57 19980901 > (egcs-1.1 re on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import _tkinter > >>> import Tkinter > >>> Tkinter._test() > File "", line 1 > Tkinter._test() > ^ > SyntaxError: invalid syntax > >>> Try it without the space before Tkinter._test(). -- Mark Jackson - http://www.alumni.caltech.edu/~mjackson Some years ago I was struck by the large number of falsehoods that I had accepted as true in my childhood, and by the highly doubtful nature of the whole edifice that I had subsequently based on them. - Ren? Descartes From dworkin at ccs.neu.edu Thu Feb 10 10:49:29 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 10:49:29 -0500 Subject: code to parse a file In-Reply-To: "Pedro Silva"'s message of "Thu, 10 Feb 2000 14:54:44 -0000" References: <000e01bf73d6$c481cde0$6c00a8c0@ruidovisual.pt> Message-ID: "Pedro Silva" writes: > f=open('/var/spool/news/articles/esoterica/geral/1','r') > for lines in f.readline(): > if string.find('From:'): > from=lines > if string.find('Subject:'): > sub=lines > if string.find('Date:'): > date=lines > if string.find('Xref:'): > f.seek(0,2) > for text in f.read(): > cont=text > return from,sub,date,cont > > Is this code correct to do what I pretend? That may work much of the time, but you'll probably end up with a more reliable script if you use the standard rfc822 library instead. Messages like the ones you are looking at can be parsed like this: >>> import rfc822 >>> msg = rfc822.Message(open('/var/spool/news/control/1')) >>> msg.getheader('From') 'Justin Sheehy ' >>> msg.getheader('Subject') 'cancel <37D8021C.1EB4DF3A at iwant.com>' >>> msg.getheader('Date') 'Thu, 09 Sep 1999 14:54:38 -0400' >>> msg.rewindbody() >>> msg.fp.read() 'This message was cancelled by Justin Sheehy.\012' -Justin From effbot at telia.com Wed Feb 16 02:44:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 07:44:40 GMT Subject: SV: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> <20000212113935.C1007@stopcontact.palga.uucp> <38A9FF25.71B5B776@austin.rr.com> Message-ID: Daniel Weber wrote: > Maybe the fact that it can't be printed irritates so many people is a > compliment :-) > > I love the manual - I just wish I could print it... strangely enough, several other people report that it prints just fine, also on non-Windows platforms. maybe you spend a little time figuring out how to configure acrobat? or complain to adobe in- stead of complaining to me? (no, I didn't write acrobat, so blaming me for this is completely meaningless). From S.I.Reynolds at cs.bham.ac.uk Fri Feb 18 10:46:32 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Fri, 18 Feb 2000 15:46:32 +0000 Subject: Problem with Emacs mode, at start only References: Message-ID: <38AD6958.19C3@cs.bham.ac.uk> Fran?ois Pinard wrote: > > P.S. - By the way, `C-c C-c' is an unfortunate binding, Save yourself from RSI and put this in your .emacs file: (defun my-python-mode-hook () ; (local-set-key [backspace] 'py-electric-backspace) (local-set-key [f1] 'py-shell) (local-set-key [f2] 'py-execute-buffer) (local-set-key [f3] 'py-execute-region) ) (global-set-key [f8] 'bury-buffer ) (add-hook 'python-mode-hook 'my-python-mode-hook) I think these only work with GNU emacs though (not Lucid emacs). Stuart From mwh21 at cam.ac.uk Fri Feb 4 13:55:31 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 04 Feb 2000 18:55:31 +0000 Subject: Circular references and python References: <001201bf6ee9$84b12360$a2a0143f@tim> Message-ID: "Tim Peters" writes: > [posted & mailed] > > [nascheme at enme.ucalgary.ca] > > I have been looking at Toby Kelsey's code [a gc patch posted to > > c.l.py a while ago]. It seems quite interesting. Do you think > > something like it would have a chance to be accepted by Guido? > > Yes. I've studied the code (at Guido's suggestion, actually), and > corresponded with Toby about it. Toby probably invented this approach on > his own, but Rafael Lins has published a great deal about it under the name > "lazy cyclic reference counting". It has many attractions! Like it's > (well, can be made) 100% portable in strictly std C, builds on the current > rc (which many people like) rather than replacing it, is theoretically > sound, and extension modules that don't play along can't cause incorrect > behavior (this is a real problem for Python! any scheme has to work well > with what's already out in the field). Where might one find this code? A moderately serious deja & web search failed to turn it up... Aha! It's in the pipermail archive. It doesn't seem to have made it to USENET; at least it isn't on deja, and I don't recall ever seeing it. Is it on the web anywhere? I'm currently downloading 4 megs of archive so I can rip it out - pipermail has HTML-ized the uuencoded attachment - which seems a bit unnecessary. Cheers, Michael From tim_one at email.msn.com Mon Feb 14 01:37:57 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 14 Feb 2000 01:37:57 -0500 Subject: Iterators & generators (RE: Real Problems with Python) In-Reply-To: <887osh$1rv$1@nntp6.atl.mindspring.net> Message-ID: <001101bf76b6$07a5e020$822d153f@tim> [Samuel A. Falvo II, wonders about "suspend" semantics after Tim's unelaborated example] [Aahz Maruch, proves that you don't have to be a lambda-head to pick up the thrust of it at once -- thanks!] > suspend *is* a return. It also -- at the same time -- stores the > program counter for b.traverse_post(), so that the next call to > b.traverse_post() starts at the line of execution immediately following > the suspend. Right so far as it goes -- also stores away "everything else" needed, like local vars and their current bindings. This is cheap since it's just the state of the frame object, and half the trick of "suspend" lies simply in not decrementing the frame object's refcount! In effect, it freezes the function in mid-stride, returns a result to the caller, and waits to get thawed again. > This means that, should someone be foolish enough to call > b.traverse_post() inside the loop "for leaf...", the loop will > probably return incorrect results, just like modifying a list > while you iterate over it. Actually not a problem. Under the covers, the implementation has to distinguish between "the first call" and "resuming calls". A first call always gets a fresh frame of its own, just like any other call today. It's only resuming that's new behavior on the call side (& resuming is much cheaper than a first call -- it simply restarts the frame object from where it suspended). So you could have dozens of iterators marching over the same tree, and they wouldn't interfere with each other. "for" can hide all that by magic, but it would also be Pythonic to expose the machinery so that you *could* do fancier things yourself. > Using suspend means that people no longer have to hack __getitem__() > to "do the right thing" for a class. Try even *writing* a binary tree postorder traversal via __getitem__(), then ponder NeelK's original points again. You can't do better than faking recursion via a hand-simulated stack (unnatural, tedious and error-prone), or building the entire result sequence up front then passing it out a piece at a time (can be too space-intensive, or waste time if you're simply doing a search and will likely "get out early"). Note that binary tree traversal is about as simple as you can get without being trivial: "resumable functions" already make a night-and-day difference here, but are that much more helpful the harder the task. > Doing this in a threaded environment is dangerous, but no more so > than dealing with any other class. Or any other kind of call -- each iterator/generator gets its own locals, so the only dangers are in mutating while iterating, or communicating info via unprotected globals. The same cautions apply to __getitem__ today. it-tends-to-"just-work"-all-by-itself-ly y'rs - tim From josephwinston at mac.com Fri Feb 11 20:24:05 2000 From: josephwinston at mac.com (Jody Winston) Date: 11 Feb 2000 19:24:05 -0600 Subject: CPython, JPython, and corba References: <38A45DFC.854D379B@bam.com> Message-ID: Bill Scherer writes: > Howdy - > > I have a need to do ditributed objects, like corba, fnorb, ilu, pyro, > dopy, or whatever, that will work between CPython and JPython. > > Pyro and dopy both use the select module which JPython doesn't have. Is > such a beast available for JPython? > Fnorb uses some C so I don't think that will work either. > > Has anybody doen this, and if so, with what? > I've used ILU and CPython along with lots of other code for a backend and the GUI was implemented in JPython and JFC using Visibroker. The hardest part was setting up the naming service. You should be able to use ILU for both Pythons, I just haven't tried it. -- Jody Winston From effbot at telia.com Tue Feb 22 17:42:17 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 22:42:17 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <20000222221315.F4549@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > At a moment, I needed some reference to creating things in canvas in > Tkinter. I found this in the Tcl manpage: > > pathName create type x y ?x y ...? ?option value ...? > Create a new item in pathName of type type. The > exact format of the arguments after type depends on > type, but usually they consist of the coordinates > for one or more points, followed by specifications > for zero or more item options. See the subsections > on individual item types below for more on the syn- > tax of this command. This command returns the id > for the new item. > > It took me a LOT of time to find out how to implement this in Python. It > turned out to be some set of methods to Canvas, a different method for > every `type'! I had to look it up in the source! so you're telling us you found a method description on the Tk Canvas manual page, and it took you a lot of time to realize that it probably was a method of the Tkinter Canvas class? you could have looked things up in the Tkinter handbook, of course: http://www.pythonware.com/library/tkinter/introduction/canvas.htm (look under "methods" -- the create methods are described first on that page) From c.hintze at gmx.net Wed Feb 23 17:41:22 2000 From: c.hintze at gmx.net (Clemens Hintze) Date: Wed, 23 Feb 2000 22:41:22 GMT Subject: Cool things about Ruby on the way out of Python? References: <38B205AE.666D1AA2@mincom.com> Message-ID: >>>>> "Warren" == Warren Postma writes: ... Warren> Looks like Smalltalk. Warren> So can Rose do this: Warren> (x>y).ifTrue do ... something ... end Warren> If so, then I'd call Rose the conjunction of Pascal Warren> begin/end blocks and Python, and Smalltalk's 'blocks' Warren> semantics (|x| is a dead give away smalltalk-ism). I Warren> don't see what's Perly about it. Sorry for beeing OT, but could you be so kind to post a URL for Rose? I would like to have a look on it. Warren> Warren Thanks in advance, Clemens From loewis at informatik.hu-berlin.de Wed Feb 2 17:06:58 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 02 Feb 2000 23:06:58 +0100 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <%wYl4.369$%35.3920043048@news.euroconnect.net> Message-ID: "Brian Dam Pedersen" writes: > Now the lists are circular referenced, and dereferencing them will > not garbage-collect them. To break up the chain just do The essential piece here is that you have to break the circularity with explicit code; Python will then clean-up the rest when you drop the last reference to the structure. Since cyclic structures are usually regular in some way, it is often easy to break the cycles with a recursive algorithm. Consider class ListItem: def __init__(self,next,prev): self.prev,self.next = prev,next This could be used in a double-linked list (not that a double-linked list is particular useful in Python :-). To allow breaking the cycles, you can do def clear(self): if self.next: self.next.clear() self.next=None # or self.prev=None If you know you don't need such a list (stored in a variable head) anymore, you do head.clear() and it will remove everything. So it is very easy to deal with the problem when you know what it is. Regards, Martin From sensual at sensualpics.cjb.net Wed Feb 9 06:22:17 2000 From: sensual at sensualpics.cjb.net (Sensual Pics) Date: Wed, 09 Feb 2000 11:22:17 GMT Subject: sensual pics Message-ID: <8ed5.5967.78@wabbytwax> http://sensualpics.cjb.net From wjk at wjk.mv.com Thu Feb 24 01:19:10 2000 From: wjk at wjk.mv.com (Wm. King) Date: Thu, 24 Feb 2000 01:19:10 -0500 Subject: Formatting a numerical string w/commas References: <200002221225.HAA00397@csa.bu.edu> Message-ID: <38B4CD5D.F122CBCA@wjk.mv.com> If this gets double posted, I apologize.... Having some difficulty with computer... I am a newbie and thought this might be a possible solution with some tightening up of course.... How about something like this --- import re pattern=re.compile("[0-9][0-9][0-9][0-9][\.\,$]") test=123567789.98 teststr=str(test) a = pattern.search(teststr) while a: b = a.regs[0] c = b[0] + 1 teststr = teststr[0:c] + "," + teststr[c:] a = pattern.search(teststr) print teststr Comments welcome From mwh21 at cam.ac.uk Sat Feb 19 07:14:35 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 19 Feb 2000 12:14:35 +0000 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> <88lv9g$sfd$1@news2.isdnet.net> Message-ID: "Florent Rami?re" writes: > Hello, > > well, i thinked about this method, it can be suitable for my project, > but in one only way: it has to be set one time for all ... > > Is this possible ? Erm, probably not. What are you trying to do? There's no way to directly do what you ask, but there may be a way to do what you are trying to do, so could you be a bit more general? Cheers, Michael From fkva7312 at u-pl7.ms.mff.cuni.cz Mon Feb 28 07:27:25 2000 From: fkva7312 at u-pl7.ms.mff.cuni.cz (Frantisek Kvapil) Date: Mon, 28 Feb 2000 13:27:25 +0100 Subject: lambda fctions & local variables Message-ID: Hello, I have some matching function: def match(pattern,value): return len(pattern)==len(value) and some finding function: def find(pattern,list): return filter(lambda x: match(pattern,x),list) but the problem is that the lambda function don't know local variable pattern, so may you be so nice to tell me how to make it works (still using lambda functions if possible) thanks and have nice day Frantisek Kvapil From wrlddomprod at hotmail.com Thu Feb 24 10:59:17 2000 From: wrlddomprod at hotmail.com (Shawn LeBlanc) Date: Thu, 24 Feb 2000 07:59:17 PST Subject: Phython as In-Game scripting language Message-ID: <20000224155917.81782.qmail@hotmail.com> Greetings! Just so I understand (and because my programmer teammates are asking me questions) is plain vanilla Python (no stackless or microthread) unable to run multiple scripts simultaneously? I'm thinking no because if Python did support running multiple scripts at the same time, there wouldn't be any need for SP or MT's. I just wanted a clear answer on that. Besides Crystal Space and Alice, has Python been used in any commercial games? I checked out Alice and it's pretty nice, but I wasn't able to get any information on how they implemented Python. It is neat in the way that my nephew could go and build 3D scenes, though. with milk and cookies, Shawn ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From robin at alldunn.com Fri Feb 25 19:19:46 2000 From: robin at alldunn.com (Robin Dunn) Date: Fri, 25 Feb 2000 16:19:46 -0800 Subject: Tkinter vs. wxPython (was: Which GUI?) References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <20000225074928.A3300986@vislab.epa.gov> Message-ID: > > Add to "against it": > > - Building wxWindows and wxPython on non-Linux systems is a real > challenge. Building Tcl/Tk/Tkinter is a snap in comparison. > wxWindows is getting better, and I'm hoping that distutils will help wxPython get much better in this area too. Unfortunatly I think that the difference will never go way entirely as we'll always be dealing with C (easily compatible) vs. C++ (easily uncompatible) compiler issues. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From effbot at telia.com Fri Feb 18 05:41:05 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 10:41:05 GMT Subject: Where is Imaging.h? References: Message-ID: <5l9r4.4046$dT4.207662592@newsb.telia.net> Fredrik Lundh wrote: > Bernhard Herzog wrote: > > I think this is a good opportunity to suggest that extension modules > > that users may want to access at the C-level install the relevant header > > files somewhere under Python's standard include directory. I propose to > > put them into an "extensions" subdirectory. > > patches are welcome (send them to image-sig at python.org). never mind, I found it: http://www.python.org/pipermail/image-sig/1999-March/000674.html unless comes up with something even better (Greg?), this will go into 1.0.1. From scarblac-spamtrap at pino.selwerd.nl Wed Feb 23 04:22:42 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 23 Feb 2000 09:22:42 GMT Subject: functional programming References: Message-ID: Michal Wallace (sabren) wrote in comp.lang.python: > I guess my original question had to do with what functional > programming looks like in the wild, and what it might look like in > python. Aahz posted a recursive version of a fib() routine. Is this > not what you'd want? What would fib() look like in one of the > functional languages you're used to? Michael Hudson posted this little bit of Haskell last week: fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ] I can't translate that to anything resembling Python at all. I don't know if list comprehensions in Python will be/are this powerful. (This is just a definition of the infinite list of Fibonacci numbers - when you need the first 50 or so, just take the first 50 from this list). -- 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 aotto at t-online.de Sun Feb 20 13:25:39 2000 From: aotto at t-online.de (Andreas Otto) Date: Sun, 20 Feb 2000 19:25:39 +0100 Subject: ANNOUNCE: Phyton-Compiler Message-ID: <38B031A3.80A4B0A1@t-online.de> Technology Startup!! We are a group of developers which realises compilers for scripting language's. After implementation of Tcl as compiler-language we have plans for phyton. ??? Ask ??? =========== Does a requirement exist for a Phyton compiler and are your ready to pay for it ?? We are grateful for suggestions and business models in above area details under: Only German http://home.t online.de/home/aotto/compiler.html mfg aotto :) -------------- next part -------------- A non-text attachment was scrubbed... Name: aotto.vcf Type: text/x-vcard Size: 451 bytes Desc: Card for Andreas Otto URL: From pehr at pehr.net Wed Feb 23 23:00:15 2000 From: pehr at pehr.net (pehr anderson) Date: Thu, 24 Feb 2000 04:00:15 GMT Subject: A question from a total newbie References: <88j7a2$n5e$1@nnrp1.deja.com> <89263v$sau$1@nnrp1.deja.com> Message-ID: <38B4ACCE.F57D19DA@pehr.net> Dear Lisa, and other new pythoneers, In my opinion, the most important thing you need to learn python is a goal! This may sound sappy, but python can be used to do just about anything. Figure out what you really want in life, and then find ways to get familiar with components necessary to make it happen. My first big python project, which is still evolving, was a morse-code user interface for disabled persons. I'm hoping to extend this to be generally useful for people who want to control a wearable computer. Just imagine tapping away on an invisible keyboard, typing into the empty air! You'd have the ultimate privacy & security. If this sort of thing interests you, grab my code and extend it to meet your own needs. Study the libraries themselves to learn how the different pieces of python fit together. Python have *very* beautiful library code. However best you learn, these are just my suggestions. -pehr Lisa wrote: > > Hi ! I am a total newbie to python, although I had a little programming > experience in Pascal, Fortran and PL/1. > > I would firstly want to apologize if this is not the place to ask my > questions, and I would be very grateful if you can point out to me where > to ask, if this is not the place to ask. Thanks in advance. > > Here are my question: > > Since I am a total newbie in python, where should I start? > > I am thinking of starting on DOS level, without any cumbersome > layers on windows. Do you recommend that? > > If so, where can I get python that runs on DOS? > > And what else do I need? What is TCK or whatever it is I saw on > www.python.org? I am not sure about those things, I hope if someone here > can give me a pointer or two. > > Books, which are the books for newbies that you recommend? There are so > many books out there I do not know which ones are good. > > Are there any online tutorials that I can use, while I am selecting > which book to buy? > > There are many more questions I think I should ask, unfortunately I do > not know what else to ask. If you know what other questions I should > ask, I would appreciate if you can help me ask the right questions. > > > Thank you all. > > Please cc: me a copy of your reply so I can be sure to get your advice. > > Lisa > lisse at saintmail.net > > Sent via Deja.com http://www.deja.com/ > Before you buy. From emile at fenx.com Mon Feb 14 08:54:21 2000 From: emile at fenx.com (Emile van Sebille) Date: Mon, 14 Feb 2000 05:54:21 -0800 Subject: eff-bot References: Message-ID: <04df01bf76f3$01e24600$01ffffc0@worldnet.att.net> Now, don't confuse me! I thought I figured it out during this past year, but now that you bring it up, I thought that applied to the tim-bot. I mean, there really is no Tim Peters, is there? Has anyone seen the tim-bot in human form? It's just a self maintaining program written in, eh.., well maybe python now, but probably assembler fat-fingered into some early VAX that has managed to crib parts and pieces over the years and upgrade itself using every imaginable language and idiom available. Probably doesn't even consume any power! ;-) tim-where-do-we-get-suspend?-ly yr's Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Mikael Olofsson To: Emile van Sebille Cc: ; Egbert Bouwman Sent: Monday, February 14, 2000 5:36 AM Subject: Re: eff-bot > > On 14-Feb-00 Emile van Sebille wrote: > > It's a nick-name for Fredrik Lundh. It's origin is obscure, having > > been passed down from generation to generation, and this probably > > should be a FAQ (and may well be, I didn't check ;-). I'm sure the > > eff-bot, if it's up and on-line can point immediately and without > > eff-ort to the precise moment of inception, which is what makes the > > eff-bot the eff-bot. > > Wow! And I thought Fredrik Lundh was a nick-name for the eff-bot. > > /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-Feb-00 > Time: 14:35:24 > > This message was sent by XF-Mail. > ---------------------------------------------------------------------- - > From claird at starbase.neosoft.com Fri Feb 18 21:10:56 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 18 Feb 2000 20:10:56 -0600 Subject: Which GUI? References: Message-ID: <5F3F06295B766F68.F715841DEF971D6A.EA3CC7D498F9973D@lp.airnews.net> In article , Grant Edwards wrote: >In article , Warren Postma wrote: > >>2. If Python is so much better than Tcl, why does Python require the >> Tcl interpreter be running to get Tkinter going? > >Because it's easier that way. STk is a Scheme interpreter >bound directly to Tk (sans Tcl). It's a nice way to do things, >but everytime Tk changes you've got to muck about to get the >binding to work again. By leving Tcl in, it makes upgrading to >new versions of Tk easier. > >Leaving Tcl in is a pragmatic solution, even though it doesn't >appeal to the minimalist in me. . . . I'll slightly extend Grant's points. 1. Everyone's known forever that a binding to the low-level Tk API is technically feasible, and a sufficiently moti- vated person can do it. We can tentatively conclude that Tkinter is "good enough" as as Guido hath wrought it, be- cause that motivation hasn't made an appearance in real life. 2. There's some hope that Tk will become even easier to use in the future, as initiatives such as the Tcl Extension Architecture (TEA) promise to loosen the couplings between versions and extensions even further. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From p.agapow at ic.ac.uk Tue Feb 29 15:53:07 2000 From: p.agapow at ic.ac.uk (Paul-Michael Agapow) Date: Tue, 29 Feb 2000 20:53:07 +0000 Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> <891g7l$cf8$1@nnrp1.deja.com> <893u76$46l$1@nnrp1.deja.com> <38b66215@news.xtml.co.uk> <20000225153511.19694.qmail@hotmail.com> Message-ID: <1e6rnn8.j4tz1uj8dlv4N@gershwin.bio.ic.ac.uk> Shawn LeBlanc wrote: > As a slightly off topic question, which other languages like > Python could be embedded efficently in a game project? I've > seen that several games use Lua (Grim Fandango), and there's > got to be other games that use embedded languages. What > would be the advantages and disadvantages of using Python > in a game? IIRC, the first-person shooter set in the Star Wars universe (the name escapes me - Dark Forces?), uses internal scripting extensively. -- Paul-Michael Agapow (p.agapow at ic.ac.uk), Biology, Silwood Park "The world is made of fire." From moshez at math.huji.ac.il Fri Feb 18 08:35:50 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 15:35:50 +0200 (IST) Subject: Which GUI? In-Reply-To: <88jg9f$ssd$1@nnrp1.deja.com> Message-ID: On Fri, 18 Feb 2000 ndev42 at yahoo.com wrote: > Basically, this is (almost) Tcl/Tk. The only problem I have > with Tkinter is that it is truly Python/Tkinter/Tcl/Tk, which > means a whole bunch of software to install before you > actually can get a single widget on screen. What happened > to Rivet?? Lost in the disinterest, I presume. At work, we have the standard free software utilities we install on every new platform which arrives, which includes bash, Tcl/Tk, gcc, Perl, Python and others. Everything, except sometimes gcc, takes about half an hour, since we already have the sources .tar.gz'ed locally. It's so easy, no one has written a script to do so, we just do it by hand. It is not a "whole bunch" of software before you can use it. If we were using GNU/Linux, it'd be easier, since most GNU/Linux distributions come with all of those as packages, and very good dependency management. > Talk about portability: it is Ok to say > that wxPython is portable No it is not. It doesn't work on AIX. I truly fail to see how come Python, Tcl/Tk, Perl, bash, GNU grep manage to compile cleanly on AIX, yet wxWindows doesn't, but until it does, it is not an option for many people, including me. > If there is any project of an OO GUI linking Python through > C-bindings to Motif, X11, Windows and Mac base windowing > libraries, I'd like to hear about it. This has been done for > Tk, why not doing it again for Python? Because it's much easier to steal Tk then reinvent Tk for Python. That's the good thing about free software: you can build on other people's work instead of doing it yourself. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From donn at u.washington.edu Tue Feb 1 12:28:25 2000 From: donn at u.washington.edu (Donn Cave) Date: 1 Feb 2000 17:28:25 GMT Subject: problems with blocking pipes, threading References: <873i5r$jhi$1@news.go.dlr.de> <86rqr7$gn2$1@news.go.dlr.de> <86shaa$15g2$1@nntp6.u.washington.edu> Message-ID: <87753p$1472$1@nntp6.u.washington.edu> Quoth "Sven Drescher" : [... re inter process I/O with pipes ] | But in my further work I start processes, where I cannont know, how the | standard output is realized. Is there a possibility to flush the child's | stdout??? Or is there a complete other way to catch the child's stdout in | 'real-time'??? It's hard. If a process is written so as to buffer its output, when writing to a pipe - and most are written that way, thanks to the default behavior of C library I/O - there is just nothing you can do about it. The only solution is to choose another output device, an exotic kind of pipe called a ``pseudo-tty''. On UNIX this device is used to implement things like the telnet service. One end of this pipe, the end that you present to the external process, is a terminal device; your other end is more or less like a socket. It's a very important device for things like the telnet service, but unusual in the kind of general interprocess communication you're doing. The system API for pseudo-ttys is not at all standardized, hardly two UNIX implementations do it the same way. The exposure of these devices in the /dev filesystem gives them extra headaches for security. They're usually much more limited resources than pipes or sockets, the system can run out and then no one can telnet in. Their behavior under stress isn't really ideal for IPC - in particular, a terminal device can drop output if too much arrives and it's not read fast enough. But because the application sees a terminal, the C library uses line buffering. The Python module for a pseudo-tty devices is "pty", and you can look at it for more details - it's a Python module. It supports only a few types of UNIX pseudo-tty implementations, but if you're lucky it may work for you. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From greg at perceval.be Wed Feb 23 12:29:47 2000 From: greg at perceval.be (Greg) Date: Wed, 23 Feb 2000 18:29:47 +0100 (CET) Subject: test In-Reply-To: <9GUs4.7658$al3.101306@newsc.telia.net> Message-ID: please ignore... thanks Greg )\._.,--....,'``. , /, _.. \ _\ (`._ ;: `._.-(,_..'--(,_..'`-.;.' greg at perceval.be On Wed, 23 Feb 2000, Fredrik Lundh wrote: > Date: Wed, 23 Feb 2000 17:21:09 GMT > From: Fredrik Lundh > To: python-list at python.org > Newsgroups: comp.lang.python > Subject: Re: Which GUI? > > Pieter Claerhout wrote: > > What about toolkits for the Mac. The MacOS toolbox is nowhere > > mentioned, and also the problems we have with running Tcl/Tk > > on the Mac are mentioned nowhere. Any suggestions on what else > > will work with a Mac? > > the FrameWork framework? > http://www.python.org/doc/current/mac/module-FrameWork.html > > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From emile at fenx.com Tue Feb 15 09:54:40 2000 From: emile at fenx.com (Emile van Sebille) Date: Tue, 15 Feb 2000 06:54:40 -0800 Subject: Informix integration References: <38A96270.E7E67D65@nembv.cz> Message-ID: <06f501bf77c4$9c10b820$01ffffc0@worldnet.att.net> Assuming you're on Winxx, one way is to set up an ODBC data source using the control panel application, then test it using access, excel, whatever. The standard distribution comes with an odbc module, see http://www.python.org/windows/win32/odbc.html, but I use Marc A Lemburg's mxOdbc package. (http://starship.python.net/crew/lemburg/mxODBC.html) HTH Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Milos Prudek Newsgroups: comp.lang.python To: Sent: Tuesday, February 15, 2000 6:28 AM Subject: Informix integration > How can I write a program for python that would be able to query > Informix database? I have downloaded Informix Client SDK, what now? > > -- > Milos Prudek > -- > http://www.python.org/mailman/listinfo/python-list > From embed at geocities.com Wed Feb 9 11:23:42 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 11:23:42 -0500 Subject: Statically link Python15.LIB instead of Python15.lib -> Python15.dll Message-ID: How do I build a Python15.lib for Windows that I can link to my application so I don't have to distribute Python15.dll. Has anyone done this? Warren Postma From wtanksle at hawking.armored.net Fri Feb 18 15:46:43 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 18 Feb 2000 20:46:43 GMT Subject: Python sucks loud References: <88ifpv$33i$1@newshost.accu.uu.nl> Message-ID: On 18 Feb 2000 03:54:39 GMT, Martijn Faassen wrote: >Moshe Zadka wrote: >> On 15 Feb 2000, William Tanksley wrote: >>> Pretty much so. Tim keeps on killing people who disagree with him. Please >>> save us from him by posting more messages in which mindless abuse is >>> mistaken for humor! >> I object to that. Tim has never killed anyone who disagreed with him. They >> just had...ummm...accidents. Yes, that's it, accidents. >> now-the-psu-does-kill-people-ly y'rs, Z. >I'm afraid I'm going to have to correct you: >* The Python Secret Underground does not exist >* You will not be terminated for revealing this information >* It will have been an accident. This is a very important lack of information to have -- thank you for sharing it with us. I see, then, that the PSU has the same strengths and weaknesses as the Usenet Cabal. That is, its only real weakness is its lack of existance. >Martijn -- -William "Billy" Tanksley, in hoc signo hack From timd at macquarie.com.au Tue Feb 15 17:46:54 2000 From: timd at macquarie.com.au (Timothy Docker) Date: 16 Feb 2000 09:46:54 +1100 Subject: Help with Python Grammar change References: <38A91EA9.52CA20BE@dcs.kcl.ac.uk> Message-ID: Travis Oliphant writes: > If a is a 3-dimensional array currently > > a[:,:,5] returns a reference to a two-dimensional sub-array. > > It would be useful if a(:,:,5) returned a copy to that array. Using the > current grammar we could make a(slice(None),slice(None),5) return the > copy, but it is definitely not as clever. You could have a subobject in a with a __getindex__ method, that does the copy, as opposed to the __getindex__ method in a, that returns the reference, ie a[:,:,5] returns a reference to a two-dimensional sub-array. a.copy[:,:,5] returns a copy of that array. Tim From sanderson at ttm.com Tue Feb 22 19:49:15 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 22 Feb 2000 19:49:15 -0500 Subject: Porting Python to non-pc platforms (AS/400) References: Message-ID: <38B32E8B.7E084AA8@ttm.com> I have VERY little experience with C (I can recognize a C program 2 out of > 3 times. (-: ) In your opinion, how hard is Python to port? If I shell > out the bucks for a compiler, what chance to you give a neophyte C > programmer of getting it to compile and run? Considering that the 400 has pretty much a complete POSIX environment, more than likely a port will mainly consist of figuring out the include directories and compiler flags. Regards, -scott From rickhigh at aol.com Wed Feb 2 23:41:54 2000 From: rickhigh at aol.com (RICKHIGH) Date: 03 Feb 2000 04:41:54 GMT Subject: Which is better NetRexx or JPython? Message-ID: <20000202234154.24799.00000955@ng-ce1.aol.com> Can you explain to the Java community why JPython is the best thing since sliced bread? Then vote http://www1.sys-con.com/forums/Thread.cfm?CFApp=2&Thread_ID=379&mc=25 From nielsenjf at my-deja.com Thu Feb 24 21:26:21 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Fri, 25 Feb 2000 02:26:21 GMT Subject: system return status on Windows References: <38B53760.22753DE0@nembv.cz> <000c01bf7f31$93a8c6e0$b62d153f@tim> Message-ID: <894p8a$qbj$1@nnrp1.deja.com> If you want to use popen, try the popen from the win32pipe module instead of the os module. have a good day, john > Windows). BTW, don't expect os.popen to work sensibly under Windows either. > > python-is-only-a-few-thousand-lines-of-excruciating-code-away-from- > making-this-stuff-appear-to-work-under-windows-ly y'rs - tim > > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From paul.pfaff at pharma.novartis.com Tue Feb 15 12:31:18 2000 From: paul.pfaff at pharma.novartis.com (Paul Pfaff) Date: Tue, 15 Feb 2000 17:31:18 GMT Subject: simple HTML to XML converter Message-ID: <38a98d61@guardhouse.chbs> Hello, is there a simple HTML and/or Text converter into XML and/or WML format ? Many thank's. Paul From tom at parlant.com Tue Feb 15 16:26:44 2000 From: tom at parlant.com (Thomas Lane) Date: Tue, 15 Feb 2000 14:26:44 -0700 Subject: resizing Tkinter widgets Message-ID: <38A9C494.D4B9CB5A@parlant.com> I'm a newbie to Tkinter, so please forgive me if I've missed something obvious, but I'm trying to resize widgets, such as frames, lists, etc. at run-time when a window is resized. I've bound a method to the event, and it gets called when the window is resized, but when I call the methods to resize the widgets, nothing happens, ie. I call widget.configure( width="XXX", height="YYY" ), but the size of widget remains the same. I'm using the "Place" geometry manager, if that makes any difference. What am I doing wrong? Any help would be appreciated. Thomas Lane Parlant Technology Provo, UT tom at parlant.com From niels at endea.demon.nl Fri Feb 25 12:32:09 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Fri, 25 Feb 2000 18:32:09 +0100 Subject: Life's better without builtins? (was: Life's better withoutbraces) References: Message-ID: <38B6BC99.D15580FB@endea.demon.nl> Moshe Zadka schreef: > > On Fri, 25 Feb 2000, Niels Diepeveen wrote: > > > Do you have some source code of this? I can't think of a way to do > > reload() or tuple(). > > def reload(module): > del sys.modules[module] > exec 'import '+module This doesn't seem to work. I think that would be because the import is local to the function? > > def tuple(seq): > ret = () > for item in seq: > ret = ret + (item,) > return ret > > Ouch big time! Anyone seen half a brain lying around? Thanks. -- Niels Diepeveen Endea automatisering From tismer at tismer.com Sun Feb 27 15:33:05 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 27 Feb 2000 21:33:05 +0100 Subject: Making sense of Stackless References: <146101bf8164$fc19df90$6401a8c0@dorb> Message-ID: <38B98A01.9DC6C456@tismer.com> Darrell wrote: > > Thinking about how I could use Stackless and how it's different from using > callbacks on a object. I decided to view continuations as objects and here's > were it lead. > > If an instance can be thought of as a stack frame then a continuation can be > thought of as an instance with a constructor and a run method. > > import continuation > > def construct(): > tripFlag=1 > c=continuation.caller() > tf=c.update(tripFlag) > if tripFlag==1: > # Don't understand how tripFlag stops being equal to 1 > return c > return tripFlag What do you want to achieve with the update() ? The value just passes through. update is used to either update a co in *your* frame to that assignment position, or to update a different frame's co to that frame's current true state. Both don't seem to apply here since your caller() has not changed its state. I guess you can leave that out. It is a bit hard to use just a single function for both initialisation and the action. I don't see an easy way to avoid the "if someinit" stuff. Well, here the same as a single function: def classFunc(): print 'Construct:' x=1 y=2 c=continuation.current() if c != None: return c print 'Run:' x=x+1 print x+y This has the same effect as your construct() call. current() is the same as caller(0), btw. What happens here? At the "c=" position, we have a snapshot. We return this snapshot. When you call this continuation later, you are repeating this assignment, but this time you are implicitly passing None. A good thing, since this auto-clears the otherwise cyclic reference! Well, it would be a speed improvement if we could save that if part. You could try a c.update(), but this doesn't work since c is dead already. Maybe I should provide a method update_release() that does the same thing, but also frees the connection? Note that this would combine update() and deleting co.link into one step. cheers - 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 kelly at poverty.bloomington.in.us Tue Feb 1 02:13:20 2000 From: kelly at poverty.bloomington.in.us (Kelly Lynn Martin) Date: Tue, 01 Feb 2000 02:13:20 -0500 Subject: Why Perl do But Python can't? In-Reply-To: Your message of "Mon, 31 Jan 2000 18:04:15 GMT." Message-ID: <200002010713.CAA31793@poverty.bloomington.in.us> On Mon, 31 Jan 2000 18:04:15 GMT, Clarence Gardner said: >This is not true, and is a myth people need to get over. The danger >Kelly referred to exists on some Unix-like systems and not on others. >On a system where they are safe, there is no reason whatsoever to use >a setuid wrapper. Of course, not every system is safe. Unless you know your system is secure, don't assume it is. Kelly From mwh21 at cam.ac.uk Sun Feb 27 10:33:38 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 27 Feb 2000 15:33:38 +0000 Subject: Q about tail recursion References: <000801bf8105$18b99ba0$172d153f@tim> Message-ID: Robin Becker writes: > I quite often want to use None as an exceptional return eg in the case > of a list returning function [] might be a legal return and None an > illegal one. That way I can leave the error handling to the caller. I > guess I should really be raising an exception though to be truly > pythonian. But def f(x): if x: return 1 else: return None compiles differently to def f(x): if x: return 1 and the code I've just posted clears the former but moans about the latter, which I belive was the idea all along (hope so anyway...). Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From gherman at darwin.in-berlin.de Mon Feb 7 16:45:22 2000 From: gherman at darwin.in-berlin.de (Dinu C. Gherman) Date: Mon, 07 Feb 2000 22:45:22 +0100 Subject: Pics from IPC8 (SNOWSPAM2000) References: <38935C6B.45E4EB4A@pdq.net> Message-ID: <389F3CF2.2EDE5363@darwin.in-berlin.de> Robin Friedrich wrote: > > http://freeweb.pdq.net/robinf1/spam8pix/ > (FTP to the starship isn't working so I put them up here.) > These are some of the photos taken this week at SNOWSPAM2000 > -- > Robin K. Friedrich Houston, Texas After seeing Robin's nice pictures there're few good reasons to add some of my own, so let me share with you only some of the pictures that I had taken *after* the IPC8 conference... ;-) http://starship.python.net/crew/gherman/photography/ipc8 Enjoy, 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 seanb at home.com Fri Feb 11 18:29:45 2000 From: seanb at home.com (seanb at home.com) Date: Fri, 11 Feb 2000 18:29:45 -0500 (EST) Subject: Python sucks loud In-Reply-To: Message-ID: <200002112329.SAA01742@seanb.sttln1.wa.home.com> On 11 Feb, Forget it wrote: > x-no-archive: yes > Steve Holden wrote: >> This is flamebait. I declare this thread closed. >> Unilaterally. NOW. > Flamebait, huh? In the eye of beholder, perhaps. Here: "A line > containing a line continuation character cannot contain a comment." Now, > that's real advanced. How about "only text typed with your left hand > constitutes valid input"? Classes full o code... Like I said, phooey. > The docs are very decent though, it's a shame that the thing itself is > so funny. Seems like, at the end of the day, Visual Basic does win. Even > though it sucks royally too. Jeezus, Tiny C with objects, that's all I > ask for. Any recommendations? If you really want a C-like scripting language, I have two suggestions for you: JavaScript or Pike. JavaScript is pretty well-known, has a fairly C-like syntax, and does have some OO support (although in a very ugly way - class definitions are implied by constructor functions that access a "this"reference). Another C-like alternative I would suggest, even though I don't know much about it, is Pike, which has been described as "somewhere between Java, Perl, and Python". Form what I have seen, pike is much cleaner than JavaScript. The downside is that the Pike community is MUCH smaller and the library support for Pike is nowhere near the collosal Python Standard Library. It seems that freshmeat.net has only 1 pike module in their applist, although that may not be the appropriatte place to look (again, I don't know Pike much - maybe someone else here knows more about it. A good place to look for Pike info is the Pike homepage, http://pike.idonex.se -- Sean Blakey (206)297-7123 quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0]) From effbot at telia.com Tue Feb 15 18:49:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 15 Feb 2000 23:49:42 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <001e01bf7790$8bd74480$66a2143f@tim> <011d01bf7808$026a5de0$0101a8c1@server> Message-ID: Darrell wrote: > > I agree, but it's gotten "better" this way, mostly via little things like > > the addition of dict.get() and 3-argument getattr -- not everything is > > better spelled on 4 lines . > > Is there a 3-argument getattr in the CVS version ? yes, unless someone has made a mistake and removed it: > python Python 1.5.2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> print getattr.__doc__ getattr(object, name[, default]) -> value Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y. When a default argument is given, it is returned when the attribute doesn't exist; without it, an exception is raised in that case. From tim_one at email.msn.com Sat Feb 5 03:01:23 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 5 Feb 2000 03:01:23 -0500 Subject: Execfile() - bug / strange behavior In-Reply-To: <87fp1r$1s4$1@vvs.superst.iae.nl> Message-ID: <001601bf6faf$319e96a0$182d153f@tim> [Amit's execfile woes] [Tim] > You can't actually get the timbot interested in pursuing this, since > it never uses these things without explicity naming the dicts it > wants used as execution context. [Carel Fellinger] > And how then would it pass on the locals dict in this case? It wouldn't: as a bot, it's incapable of wholly irrational behavior . Executing blobs of unknown code for their side-effects on local vrbls is at the very best extremely questionable practice. "Dark and useless" is fun, but should be done in pvt -- like all other masturbatory practices. > According to the docs, and a recent explanation on this list, it is > not possible to use something like > execfile("1.txt", globals(), locals()), > as those are readonly in case of functions! One of the few dark > corners of Python IMHO. More a dark corner of the human soul, that someone would want to try that -- Python lovingly intervenes, saying "beyond this line, thou shall not cross!". Until you download bytecodehacks, anyway . as-a-language-of-the-world-python-can't-keep-out-the-devil- but-as-a-language-of-god-it-handcuffs-the-beast-ly y'rs - tim From wtanksle at hawking.armored.net Tue Feb 15 20:21:28 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 16 Feb 2000 01:21:28 GMT Subject: Real Problems with Python References: <000e01bf7763$dc8a9300$66a2143f@tim> <36D1542F6A4700D6.94850CC9820472D8.A6C711CADC502BE1@lp.airnews.net> Message-ID: On 15 Feb 2000 16:38:49 -0600, Tres Seaver wrote: >>> Er..Just out of curiosity, what *can't* you model in Scheme? :) >>Smalltalk . >I'd be willing to venture some of Forth's wierder stuff, too. Hmm... Well, parsing Forth is certainly easier than parsing Scheme, but since is _is_ possible to write a Scheme program which parses its own source (a reader), I'd say that you can imitate the odd tricks Forth can do. I still prefer Forth, of course. Parentheses are made for comments -- that, after all, is the original Greek meaning of the word. >Tres. -- -William "Billy" Tanksley, in hoc signo hack From jwbnews at scandaroon.com Thu Feb 17 03:06:30 2000 From: jwbnews at scandaroon.com (John W. Baxter) Date: Thu, 17 Feb 2000 08:06:30 GMT Subject: Python misconceptions in IBM Ruby article... References: <001d01bf7912$ef340800$dea0143f@tim> <38AB9B6E.599C1F3@callware.com> Message-ID: In article <38AB9B6E.599C1F3 at callware.com>, Ivan Van Laningham wrote: > Hi All-- > > Tim Peters wrote: > > > > [snip] > > > Instead, after > > comp.lang.ruby is formed, we'll descend on it like a horde of enranged > > barbarians . > > > > What do you mean, "like"? I thought we _were_ barbarians, already fully > equipped with ranges. Barbarians don't use ranges...they use open fires. --John -- John W. Baxter Port Ludlow, WA USA jwbnews at scandaroon.com From linli at computer.org Tue Feb 22 16:38:45 2000 From: linli at computer.org (lin li) Date: 22 Feb 2000 21:38:45 GMT Subject: help: menu item callback in TK Message-ID: <88uvl5$sj0$1@pollux.ip-plus.net> Hi, I have the following problem and any help is greatly appreciated. I generated a menu using the data in a dynamically composed list. Since I do not know what will be in the list, I can only have all the command items in the menu to point to the same callback. Now from inside the callback, how can I find out which menu item is selected? To make it more interesting, the menu can have two or three levels of cascades. I am running Python 1.5.2 with Tkinter on NT. Thank you very much. Lin From aa8vb at yahoo.com Fri Feb 25 07:49:28 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 25 Feb 2000 07:49:28 -0500 Subject: Tkinter vs. wxPython (was: Which GUI?) In-Reply-To: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> Message-ID: <20000225074928.A3300986@vislab.epa.gov> Guido van Rossum: |Arguments for wxPython: |Arguments against it (from very limited exposure): Ditto most of these comments, for and against. Add to "against it": - Building wxWindows and wxPython on non-Linux systems is a real challenge. Building Tcl/Tk/Tkinter is a snap in comparison. -- Randall Hopper aa8vb at yahoo.com From mwh21 at cam.ac.uk Mon Feb 21 14:15:54 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 21 Feb 2000 19:15:54 +0000 Subject: Which GUI? References: Message-ID: Moshe Zadka writes: > On Mon, 21 Feb 2000, Fredrik Lundh wrote: > > > Tkinter is a component oriented UI library, which > > is carefully designed to work well with Python. > > and vice versa -- a certain Python feature was > > in fact added in part to make Tkinter a bit easier > > to use (can you name this feature?) > > def f(**kw): > pass Poking at Misc/HISTORY, I thought it was the .pyw file extension on Windows thingy. > do-i-get-the-effbotic-prize-or-what-ly y'rs, Z. Who can say? Cheers, Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From sabren at manifestation.com Wed Feb 16 03:18:25 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 16 Feb 2000 03:18:25 -0500 Subject: python .bat wrapper Message-ID: <88dmhe$fe4$1@nntp4.atl.mindspring.net> hey all.... I dunno if there's already something like this, but I kinda missed perl's pl2bat... It added a little cruft to a copy of your perl file to let dos run it as a batch. Here's how to do it for python.. the only side-effect is defining a global variable (but by convention, REM would be a constant anyway, so it's no problem to just redeclare it later..) ---------------------------- @echo off REM = """ REM python -x skipped that first line... REM make sure to change the next line to REM whatever this file is called: python -x test.bat goto end """ # python code goes in here print "hello, world!" """ :end """ ---------------------------- cheers, -Michal http://www.sabren.com/ From rmuschall.fih at t-online.de Thu Feb 17 18:03:24 2000 From: rmuschall.fih at t-online.de (Ralf Muschall) Date: Fri, 18 Feb 2000 00:03:24 +0100 Subject: Recursive function defined within function => NameError References: <38ABCE51.3EF6728E@inka.de> Message-ID: <38AC7E3C.AC1671B9@t-online.de> Michael Str?der schrieb: I'd rename the inner "fak" into something like "aux". It does not matter to python (due to the completely separated scopes), but to the poor human who has to read the code: def func1(): def fak(n,aux): if n>1: return n*aux(n-1,aux) else: return n print fak(6,fak) An alternative (but essentially similar) way would be to use Y: def Y(f): return lambda x,f=f:f(Y(f))(x) def func1(n): def fak(f,n=n): if n>1: return n*f(n-1) else: return 1 return Y(fak)(n) print func1(6) Typos are mine (I wrote it just in the newsreader without testing). The advantage of this method is the fact that you can replace the Y with a memoizing variant and get memoization for all your local recusive functions. Besides that, it looks more sophisticated and can be used to show off. Ralf From embed at geocities.com Fri Feb 11 14:19:55 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 11 Feb 2000 14:19:55 -0500 Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com><38A234AA.2B1FE6CB@python.net><14498.52621.853399.866552@weyr.cnri.reston.va.us> <14499.1283.295475.398450@weyr.cnri.reston.va.us> Message-ID: <3mZo4.12128$S64.332686@nnrp1.uunet.ca> > It depends on libICE from X11R6, but the manual indicates that clients > don't need to be X clients, which I find confusing. Perhaps someone > who knows more about what's in libICE can explain what libICE has to > do with it; it looks like it's based on Sun RPC, so it *should* be > usable just about anywhere. The archives on the FTP site are dated > 1995, so it appears unmaintained. The Koala project's home page > (http://www.inria.fr/koala/) certainly leads me to think this isn't > maintained. > Or it could be bug-free. ;) A more recent layer on top of libICE is DCOP, being used heavily in the KDE project. Have a look at the KDE 2.0 work at www.kde.org Warren From orlov at diasoft.ru Fri Feb 11 05:57:32 2000 From: orlov at diasoft.ru (Oleg Orlov) Date: Fri, 11 Feb 2000 13:57:32 +0300 Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> Message-ID: <880pqd$224d$1@gavrilo.mtu.ru> Above all: Python is my favorite daily tool and toy, but... at http://www.ruby-lang.org/en/compar.html i found some things, that i'd like to see in Python. All of them are the powerful features of Ruby (from the point of view Ruby authors): - All data (including Integer, String, List, etc.) in Ruby are class instances. - Ruby converts small integers and long integers automatically. - Ruby has assignment syntax sugar such as +=, -=, etc. - Ruby has real garbage collector, not ref-counting. So that: Not subject to memory leaks like ref-counting is. No INCREF, DECREF are required for extensions. - Extensions for Ruby written in C/C++ can easily define Ruby classes. - Ruby's block for method can be used more than iterator; e.g. mutex.synchronize do .. critical process .. end (How about Python on multiprocessor boxes? How about to discard global lock?) All these features already were discussed here earlier, but I do not find any convincing reason not to include them into Python 1.6 --------------- Oleg Orlov wrote in message news:87umih$egk$1 at nnrp1.deja.com... > Lieber Bernhard, > > You are not happy with Borland's products? Neither am I! > But being a 'Free Software Projects and Consulting', you should be more > Linux-oriented than MSWin-oriented. > All these stuffs (Perl, Tcl, Python) are more home on Unix than MSWin, > and soon their wrapper (Ruby) will make Unix the destiny. > Check this out: www.ruby-lang.org to see what IBM is talking about Ruby. > > Cheers (Oh sure: Viele Gruesse aus Minnesota/USA). > Dat > > BTW: > Did Osnabrueck finally make it to the Erste Fussball Bundesliga? > Ich bin so lange weg vom Deutschland und habe keine Ahnung mehr. > Spielen Gerd Muehler und Franz Beckenbauer immer noch fuer Bayern > Muenchen? > > In article <87ttfm$nt8$2 at newsserver.rrzn.uni-hannover.de>, > breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) wrote: > > In article <87q1jh$437$1 at nnrp1.deja.com>, > > thucdat1143 at my-deja.com writes: > > > It doesn't matter anymore that Gates resigned, maybe he already saw > > > where Coplan was heading to. That's the end of Python/Tcl/Perl on > Win32. > > > > Oh, you mean, because Win32 will die out so quickly because > > Borland and Corel have joined. > > > > From the technical point of view, the Borland products I used always > > left things to be desired. > > > > > Erase your 95/98/NT, install Linux now. Bright future for everything > > > (Python, Tcl, Perl) on Linux because Unix is their home anyway. > > Python is very much at home on Win32. > > And I hope it will stay his way, because python saves my day if I > > really have to do "stuff" on Win32. > > > > Bernhard > > -- > > Free Software Projects and Consulting > (intevation.net) > > Association for a Free Informational Infrastructure > (ffii.org) > > > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From 55555 at dakotacom.net Thu Feb 17 19:45:27 2000 From: 55555 at dakotacom.net (55555) Date: 17 Feb 2000 18:45:27 -0600 Subject: os.spawnv Message-ID: <38ac9627_1@news5.newsfeeds.com> import os os.spawnv(os.P_NOWAIT, 'c:/pkzipdos/pkzip.exe', ('c:/pkzipdos/pkzip.exe', 'c:/windows/desktop/adsf.zip', 'c:/pkzipdos/*.*')) returns the following exception: OSError: [Errno 2] No such file or directory I don't understand why this doesn't work. The tuple can be cut and pasted into the windows run box and will work. Also, os.system() is able to make this command work. What am I doing wrong with spawnv? -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From gerrit.holl at pobox.com Wed Feb 2 01:51:14 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 2 Feb 2000 07:51:14 +0100 Subject: Removing objects of a superclass? In-Reply-To: <000501bf6d03$576db400$4b2d153f@tim>; from tim_one@email.msn.com on Tue, Feb 01, 2000 at 05:26:10PM -0500 References: <20000201161336.A1785@stopcontact.palga.uucp> <000501bf6d03$576db400$4b2d153f@tim> Message-ID: <20000202075114.A839@stopcontact.palga.uucp> Tim Peters wrote on 949422370: > [Gerrit Holl] > > is it possible to _remove_ objects of a superclass? > > I'm interested in creating a sort of UserString, and because it > > shares many methods with UserList I want to subclass it. But > > then, I need to remove some methods like .append and .pop. Can > > I do that? > > By deriving UserString from UserList, you're announcing to the world that a > UserString "is a" UserList. But if UserString doesn't support a superset of > the methods provided by UserList, it's not really a UserList at all, so > you're lying . Really, in most circles this would be considered a > sure sign of confused design. I understand. If issubclass(A, B), A contains all methods of B. Period. > Some languages cater to this kind of lying anyway, but Python does not. You > would need to override the unwanted methods in UserString, as in > > class UserString(UserList): > > def pop(self): > raise IWasLyingError("despite that I told you a string" > " is a list, you can't pop it") > > More principled approaches include: > > + Move the functionality the classes have in common into a third class, and > derive from that instead. This is clean. In the case of UserList, it also > means rewriting part of the std Python library . This kind of thing > is called "refactoring", and is depressingly (or delighfully ) common > as OO designs get larger and larger. Nice idea! A UserSequence, as a superclass for all sequence types. This might actually be something for Python 1.6. > + Use a "has a" relationship (as opposed to "is a") instead. That is, a > UserString object simply contains a UserList object as a member. No > subclassing. Then the only methods that are visible are those you > explicitly provide. If there are a great many UserString methods that could > be passed on to the UserList method directly, you can play __getattr__ > tricks to avoid writing a great many individual "forwarding" methods. > + Rethink the whole problem: maybe .pop and .append etc really would be > useful in a UserString! They're sure useful for lists, and it's not insane > to picture a string as a list of characters. > + Study the std array module, to see whether an array of characters already > does everything you want a UserString to do. I think I find the first idea the nicest, a new UserSequence class in the std library where UserList is derived from. In fact, I'm just awoken and I forgot what I wanted to use it for. But it certainly was something useful ;). > cheating-is-much-better-than-lying-ly y'rs - tim :) I've got to get to school now, Gerrit. -- Please correct any Bad Things(tm) you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From tbryan at python.net Thu Feb 17 06:30:37 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Thu, 17 Feb 2000 06:30:37 -0500 Subject: Recursive function defined within function => NameError References: <38ABCE51.3EF6728E@inka.de> Message-ID: <38ABDBDD.DD08AC1F@python.net> Michael Str?der wrote: > > HI! > > I have a problem with a locally-defined recursive function within a > function. Example: > > --------------- > def func1(): > > def fak(n): > if n>1: > return n*fak(n-1) > else: > return n > > print fak(6) > > func1() > --------------- > > But this code snippet does not work. It produces the traceback: > > Traceback (innermost last): > File "test/rec-func.py", line 15, in ? > func1() > File "test/rec-func.py", line 9, in func1 > print fak(6) > File "test/rec-func.py", line 5, in fak > return n*fak(n-1) > NameError: fak > > Can anybody clarify the issue here? I looked in the Language > Reference and found the hint > > --------------- > Programmer's note: a ``def'' form executed inside a function > definition defines a local function that can be returned or passed > around. Because of Python's two-scope philosophy, a local function > defined in this way does not have access to the local variables of > the function that contains its definition; > --------------- > > I applied the standard trick showed there to my example and the > following code works: > > --------------- > def func1(): > > def fak(n,fak): > if n>1: > return n*fak(n-1,fak) > else: > return n > > print fak(6,fak) > > func1() > --------------- > > Any better solution? Better in what sense? This works, but I'm not sure whether it's useful. class Recursive: """A base class for recursive function objects""" def _func(self,n): """subclasses should override this method""" pass def __call__(self, n): """This method calls the instance's function.""" return self._func(n) class Fak(Recursive): """A recursive implementation of factorial.""" def _func(self,n): if n>1: return n * self._func(n-1) else: return n >>> f = Fak() >>> f(6) 720 RuntimeError:-Maximum-recursion-depth-exceeded-ly yours ---Tom From effbot at telia.com Thu Feb 24 10:46:30 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 15:46:30 GMT Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> <89382q$djb$1@nntp6.atl.mindspring.net> Message-ID: Olaf Trygve Berglihn wrote: > * aahz at netcom.com > > Take a look at this example I posted a while back: > > http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=570016307&fmt=text > > Nice example. But I have a slightly different problem. I'd like to > have threads that can return a value upon completion to the scope in > which the threads were started. Any suggestions on how to do that in a > simple way? how about this? let the worker threads push the resulting object to a queue, which is polled by the main thread: http://www.python.org/doc/current/lib/module-Queue.html From rupole at compaq.net Mon Feb 21 14:15:32 2000 From: rupole at compaq.net (Roger Upole) Date: Mon, 21 Feb 2000 19:15:32 GMT Subject: Catching any exception an printing it References: <38B18395.61EA@cs.bham.ac.uk> Message-ID: Use traceback.print_exc() Roger Upole "Stuart Reynolds" wrote in message news:38B18395.61EA at cs.bham.ac.uk... > Python allows you to do, > > try: > if a: > raise SomeException() > else: > raise xyz() > > except: > print 'There was an error' > > but is it possible to print out the exception if you don't know what > type it is? I'd like the above error message to be more useful, but the > exception raised inside the try block could be anything. Is it possible > to find the last exception raised? > > Cheers, > > Stuart From effbot at telia.com Wed Feb 2 04:07:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 09:07:06 GMT Subject: Pythjon and XML References: <8787a5$ik7$1@nnrp1.deja.com> Message-ID: <_sSl4.4550$al3.56938@newsc.telia.net> kamindra at my-deja.com wrote: > just a quick question on using Python with XML. Does Python handle the > extended character sets? That is does it handle UTF16 etc with its > native function libraries or I have to do something special like in C - > char and wchar. quick answer: the built-in string type only handles 8-bit characters, and most XML parsers (e.g. xmllib) cannot handle anything that doesn't use an 8-bit encoding. in other words, ASCII, ISO Latin, UTF-8 (etc) works fine, but 16-bit encodings don't. this will be fixed in Python 1.6. From pereira at research.att.com Sat Feb 26 16:03:40 2000 From: pereira at research.att.com (Fernando Pereira) Date: Sat, 26 Feb 2000 21:03:40 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <001601bf7853$6b03e7e0$b7a0143f@tim> Message-ID: <260220001603403975%pereira@research.att.com> In article <001601bf7853$6b03e7e0$b7a0143f at tim>, Tim Peters wrote: > In fact, coroutines most often pop up in languages > designed for writing event simulations (like Simula-67, which is a wonderful > early one that also anticipated much of modern OO machinery!). Like Algol-60, a great improvement on most of its successors. A cynic might say that Java is just a Simula-67 idiom with {} instead of BEGIN END. Simula-67 coroutines were much simpler to use than Java threads for producer/consumer patterns. -- F From pehr at pehr.net Sat Feb 12 13:22:08 2000 From: pehr at pehr.net (pehr anderson) Date: Sat, 12 Feb 2000 18:22:08 GMT Subject: Tkinter and signals References: <389605EC.89687799@mitre.org> Message-ID: <38A5A4E8.3D89FD2A@pehr.net> One thing Tkinter makes fairly easy is to set up an alarm that wakes up 100msec in the future, checks for conditions and re-enables its self. As much as I hate poll-loop programming, this is the only thing that comes to mind. If somebody has a better idea please let me know. I'm currently using this technique to wait on a select() call that monitors several handles for incomming data (to be fed directly to the gui). It wakes up every 200msec and updates the display. Rather than cope with any issues of thread-safety I'm using this bad programming technique which gets the job done. -pehr "Samuel L. Bayer" wrote: > > All - > > When I set a signal handler (SIGINT, SIGTERM, etc.) in a Tkinter > application and send the signal to it, the application doesn't actually > vanish from the screen until I move the mouse over it. In particular, > the signal isn't even *seen* by the app until I move the mouse over it. > A couple people have reported this previously, but no general solution > has been posted. For instance, Alexandre Ferrieux wrote on 2/11/1999: > > "It is a known issue with the Tcl/Tk event loop, that when a signal is > configured to > *restart* system calls it interrupts, the event loop will not get a > chance to call > the internal mechanism needed to detect the flags set by the low-level > signal > handler (AsyncReady). Thus, signals-aware versions of Tcl should > configure the signal handlers *without* the SA_RESTART flag, otherwise > the final script-level callback is only called after the > next GUI event (mouse...). I don't know the case of TkInter, though." > > This comment doesn't apply to my situation, since I'm trying to exit the > application. Furthermore, the wish executable built from the identical > library *does* exit appropriately when the signal is sent. I've tried > this with both 1.5 and 1.5.2 (both using Tk 8.0, I think), and I get the > same behavior in each case. > > Does anyone have a solution to this problem? Please CC me directly in > your response, since I'm not reading c.l.p regularly nowadays. > > Thanks in advance - > Sam Bayer > The MITRE Corporation > sam at mitre.org From cheselka at tucana.noao.edu Tue Feb 1 11:28:52 2000 From: cheselka at tucana.noao.edu (Matt Cheselka) Date: 1 Feb 2000 16:28:52 GMT Subject: ioctl Message-ID: <8771k4$2o1c$1@noao.edu> I'm talking to a device driver that wants the address of a pointer to an array as it's input. In C, it looks like this: char linearray[NUM], *subarr; subarr = linearry ioctl (fd, DO_SOMETHING, &subarr); How do I do the same thing in python? What I've got sofar is an array: d = array.array('i') for i in range (1000): d.append(0) ptr, len = d.buffer_info() But now I need to pass the address of the 'ptr' to the ioctl command. Any help with this would be greatly appreciated. Cheers, Matt Cheselka cheselka at noao.edu From tjreedy at udel.edu Sat Feb 26 02:35:50 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 26 Feb 2000 02:35:50 -0500 Subject: python's screne. how wide is it? References: <38B5DFE9.CF87A673@trojanslair.zzn.com> Message-ID: <897v9n$cvj$1@news.udel.edu> "The Mantis" wrote in message news:38B5DFE9.CF87A673 at trojanslair.zzn.com... > could anyone tell me what the dimensions (in pixels) is of the python screen? Its whatever you have your monitor set for. >also, is there a command to fill just one pixel (turn it white)? Python itself has no graphics commands. But user-interface add-ons should have such a function. TJR From gvwilson at nevex.com Sun Feb 13 14:41:18 2000 From: gvwilson at nevex.com (Greg Wilson) Date: Sun, 13 Feb 2000 14:41:18 -0500 Subject: Python/OO Design Patterns Message-ID: <5QDp4.439$Zn6.15827@nnrp1.uunet.ca> Does anyone have example implementations of design patterns from the Gang of Four book (or elsewhere) in Python? If so, I'd appreciate a ping. Thanks, Greg From MSteed at altiris.com Thu Feb 3 14:01:24 2000 From: MSteed at altiris.com (Mike Steed) Date: Thu, 3 Feb 2000 12:01:24 -0700 Subject: Ann: gdchart-py-0.2 Message-ID: <65118AEEFF5AD3118E8300508B124877073D5A@webmail.altiris.com> Hi, I have posted a new version of my gdchart module, which is useful for creating charts and graphs in GIF format. The Vaults of Parnassus entry should be updated soon. Changes in version 0.2: - Fixed a Windows NT crash (thanks to Roger Dev). - A makefile for Solaris is now included (thanks to Nathan Clegg). - The Win32 binary is now built against Python-1.5.2. An archive containing the source code and a pre-built Win32 binary is available at here: http://members.xoom.com/msteed/software/gdchart-py-0.2.tar.gz If you just want the Win32 binary and the test script, you can get: http://members.xoom.com/msteed/software/gdchart-w32bin-0.2.zip Mike Steed msteed at fiber.net From effbot at telia.com Mon Feb 28 09:15:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 14:15:29 GMT Subject: Wash. D.C. Area: DCPIGgies, Mar. 13 References: <14504.29126.591718.912874@goon.cnri.reston.va.us> <38BA80D2.AFEDC97E@mindspring.com> Message-ID: <5qvu4.8333$al3.110244@newsc.telia.net> Chuck Esterbrook wrote: > > Can we add to the agenda: > > * Changing the name from "piggies" to something more respectable. old topic: http://www.deja.com/=dnc/viewthread.xp?AN=514428490 (start with John Landahls post -- the stuff above that one is from alt.pets.guinea-pigs ;-) From sholden at bellatlantic.net Thu Feb 3 09:07:38 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 03 Feb 2000 14:07:38 GMT Subject: Problem : using ADO in ASP References: <86vjhe$grb$1@nnrp1.deja.com> Message-ID: <38998BC0.2760828B@bellatlantic.net> Aaarrrggghhh ... toberstein at my-deja.com wrote: > > I am using Python as an ActiveX Scripting Engine > in ASP/IIS and want to use ADO to connect to a > ODBC-compliant DB (in fact Access). > > VBScript Code works - so there should be no setup > problem. Python in ASP Pages also works. > > [Original script and configuration details snipped] Toby: I did a little more digging. Appears that the RecordSet object in Python does have the methods that you would expect to see, but I still haven't worked out how to access the properties. My ODBC source is Access 97, and I'm running on NT4 SP4 with IIS straight out of the Option Pack. Here's a simplified script which (kind of) works by using the GetRows() method to convert to a tuple (or is it a list, I'm not yet sure - it should really be mutable to allow the Update method to work): <% @LANGUAGE=Python %> The output from this script is: (, -1)

(L'WebCallback', L'TeamFinancial', L'USSInet')

(L'Anything to be published under www.webcallback.com', L'Investigation into the application to be used by USSI', L'Networking of various kinds')

(L'gphone', L'ussi', L'ussi') I'm now having difficulty understanding why the GetRows method seems to return COLUMNS! Note also that the script output is not "inline" as you would expect from its position in the code. Don't know whether this will help ... it's caused me more of a headache than I expected. regards Steve From effbot at telia.com Tue Feb 8 03:11:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 08:11:33 GMT Subject: Newbie question - what is the 'r' operator? References: Message-ID: Craig Findlay wrote: > This is probably obvious but ... > > I have seen example code where an 'r' prefix is used in from of a > string, eg r'mystring' > > What does it do, I can't seem to locate any documentation about it. http://www.python.org/doc/current/ref/strings.html "When an 'r' or 'R' prefix is present, backslashes are still used to quote the following character, but all backslashes are left in the string." (useful when embedding all sorts of cryptic sublanguages in python strings, such as regular expressions or windows file names...) From emile at fenx.com Wed Feb 16 23:16:36 2000 From: emile at fenx.com (Emile van Sebille) Date: Wed, 16 Feb 2000 20:16:36 -0800 Subject: Can't reopen eMatter book References: <001101bf78f5$2f3227c0$dea0143f@tim> Message-ID: <0a6301bf78fd$cb633a00$01ffffc0@worldnet.att.net> Thanks Tim. After seeing these two posts, I figured I might as well test my copy, and it crashed. I hadn't opened it since I printed and bindered it. Guess it's not so rare a problem. Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Tim Peters To: Anders Eriksson ; Sent: Wednesday, February 16, 2000 7:15 PM Subject: RE: Can't reopen eMatter book > > Here's what I got from Fatbrain support. Worth a try, anyway: > > Step 1. go to start -> run and type in regedit > Step 2. when it opens, look through the tree of directories > to get to my computer -> hkey_current_user -> software -> > fatbrain.com > Step 3. delete the fatbrain folder > Step 4. run the ematter registration client again (it will > ask you for a license key again) > > Step 0 is missing: editing the registry is fraught with dangers, so proceed > with extreme care. It's easy to get sloppy the twelfth time you need to do > it, so never skip step 0 . > > Step 2 should not say "my computer -> ". The rest is correct. > > To accomplish Step 3, click once on the "Fatbrain.com" folder in the left > pane, to select it. Then do Edit -> Delete (or hit your "delete" key). > Click OK on the confirmation box that pops up, first making sure that > Fatbrain.com is indeed the item selected. > > Step 3.5 is missing: close regedit. You never want to keep regedit open > any longer than necessary. > > Step 4: "run the ematter registration client again" is something that > happens automatically when you simply try to open the eMatter book again. > > Step 5 is missing: Enjoy! It's a great book. Never close it or reboot > your computer, lest you need to go thru this again . > > it's-not-/f's-fault-but-we-should-be-mad-at-him-anyway-ly > y'rs - tim > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From ullrich at math.okstate.edu Mon Feb 28 12:13:02 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Mon, 28 Feb 2000 11:13:02 -0600 Subject: so how do I run this thing?!!!! References: <38B8EEC6.358B80B9@commsecure.com.au> Message-ID: <38BAAC9D.485FE46E@math.okstate.edu> Assuming he's trying to run Python code "from Windows", as opposed to from inside some Python shell program: It's not hard to make Windows understand what he wants to do. Like you can make a file py.reg that looks like this: REGEDIT4 [HKEY_CLASSES_ROOT\.py] @="DUPythonFile" [HKEY_CLASSES_ROOT\DUPythonFile] @="DUPythonFile" [HKEY_CLASSES_ROOT\DUPythonFile\DefaultIcon] @="D:\\Python\\Py.ico" [HKEY_CLASSES_ROOT\DUPythonFile\shell] @="Edit" [HKEY_CLASSES_ROOT\DUPythonFile\shell\Edit] [HKEY_CLASSES_ROOT\DUPythonFile\shell\Edit\command] @="C:\\windows\\notepad.exe %1" [HKEY_CLASSES_ROOT\DUPythonFile\shell\Run(DOS)] [HKEY_CLASSES_ROOT\DUPythonFile\shell\Run(DOS)\command] @="d:\\python\\py.bat %1" [HKEY_CLASSES_ROOT\DUPythonFile\shell\Initialize Interpreter] [HKEY_CLASSES_ROOT\DUPythonFile\shell\Initialize Interpreter\command] @="d:\\python\\python.exe -i %1" [HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Edit)] [HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Edit)\command] @="d:\\Python\\Pythonwin\\pythonwin.exe /edit %1" [HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Run)] [HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Run)\command] @="d:\\Python\\Pythonwin\\pythonwin.exe /run %1" The REGEDIT4 should be the first line of the file. If you execute that file then *.py files will have associations just like on my machine here - if you edit the path names, etc then you get what you want. And you save the py.reg file, so when installing something changes the associations you re-merge the py.reg file and they're back the way you want. Very handy for fixing things when some new program thinks you want it to take over every file extension it can think of. Using Unix would probably also work, but that's an awfully drastic step. Ray Loyzaga wrote: > Collin Greene wrote: > > > > thanks for all you help everyone, I know how to basicially use Python now > > but I don't really understand it seems as if there should be a way to run > > what you have written. I have tried the run command but it just showns me > > what i just wrote. Is there a place to actuially see waht you have witten? > > thanks greene at hctc.com > > Use Unix. > > Your windows machine thinks that it should open the file in one of the > "text" displaying applications. From python-mode at python.org Thu Feb 17 12:36:08 2000 From: python-mode at python.org (python-mode at python.org) Date: Thu, 17 Feb 2000 12:36:08 -0500 (EST) Subject: Problem with Emacs mode, at start only References: Message-ID: <14508.12680.569760.298585@anthem.cnri.reston.va.us> >>>>> "I" == ISO writes: I> This is with Python mode 3.105, while using Emacs 20.5. Hmm, I wonder if this is an Emacs thing. It seems to work fine for me in XEmacs 21.1. I don't have Emacs installed right now. -Barry From c.evans at clear.net.nz Tue Feb 29 06:28:32 2000 From: c.evans at clear.net.nz (Carey Evans) Date: 01 Mar 2000 00:28:32 +1300 Subject: termios question References: <38B1594D.BC38503C@ctrvax.vanderbilt.edu> Message-ID: <87zoski6xr.fsf@psyche.evansnet> "Allen W. Ingling" writes: > I can't seem to set the serial port baud rate using the termios > module. Permissions on ttyS0 are both read and write for root, and > I run Python as root. I'm running Python 1.5.2 on RedHat 6.1, if > that's any help. [snip non-working code] I seem to have fallen behind in reading clp... Better late than never, though. You should be setting the bps using the numbers at indexes 4 and 5 in the list returned by tcgetattr, which tcsetattr will then use in calls to tcsetospeed() and tcsetispeed(), instead of trying to change c_cflag. For example: >>> import os, termios, TERMIOS >>> fd = os.open('/dev/ttyS1', os.O_RDWR | os.O_NOCTTY | os.O_NDELAY) >>> a = termios.tcgetattr(fd) >>> a[4:6] [4098, 4098] # = B115200, B115200 >>> b = a[:] >>> b[4:6] = [0, TERMIOS.B1200] >>> termios.tcsetattr(fd, TERMIOS.TCSANOW, b) >>> c = termios.tcgetattr(fd) >>> c[4:6] [9, 9] # = B1200, B1200 >>> termios.tcsetattr(a) # Leave things as we found them. -- Carey Evans http://home.clear.net.nz/pages/c.evans/ "*South Park* is another movie straight from the smoking pits of Hell." - http://www.capalert.com/capreports/southpark.htm From aahz at netcom.com Thu Feb 24 08:18:24 2000 From: aahz at netcom.com (Aahz Maruch) Date: 24 Feb 2000 13:18:24 GMT Subject: comp.lang.python.announce??? References: <38B52E05.5C8A015B@kw.igs.net> Message-ID: <893b30$fou$1@nntp6.atl.mindspring.net> In article <38B52E05.5C8A015B at kw.igs.net>, JB wrote: > >Is the comp.lang.python.announce ng dead or is my provider? Last post >I've seen there was Feb 6 00. Unfortunately, the c.l.py.announce moderator tends to get busy and abandon the group for 2-3 weeks. Your post will probably produce a flurry of messages in a couple of days. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From thamelry at vub.ac.be Fri Feb 4 04:47:17 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 4 Feb 2000 09:47:17 GMT Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> <5ddm4.17487$3b6.72083@ozemail.com.au> Message-ID: <87e775$kdr$1@mach.vub.ac.be> Jason Stokes wrote: : LISP, Smalltalk, Java, Delphi and Eiffel implementations all use garbage : collection as a standard techniqure. More pertinantly, I don't *want* to : manually manage object deallocation in my application, and manual memory : management is the kind of low level process I expect a scripting language to : protect me from. I definitely think the Python interpreter should have a : standard garbage collection mode, if only as an option. I agree completely. It would be a major mistake not to make the introduction of true garbage collection a priority in Python 2.0. Or at least a combination of reference counting and true garbage collection. I don't think this should be provided as an option. You don't want to create memory leaks or not depending on a compilation or run time option! Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From nobooze4u at BOOM!worldnet.att.net Sun Feb 20 16:12:46 2000 From: nobooze4u at BOOM!worldnet.att.net (Not Tonight) Date: Sun, 20 Feb 2000 21:12:46 GMT Subject: ANNOUNCE: Phyton-Compiler References: <38B031A3.80A4B0A1@t-online.de> <88pj9t$e8l$1@news.udel.edu> Message-ID: X-No-Archive: Yes Terry Reedy wrote: > Start by spelling the name of the language correctly ... Actually, that'd be good to change the name to Phyton. Every time I search the net for Python, books or something like that, there appear those five bazillion "Python" hits, of which about 3 are about the language and the rest about Monty Python. From amitp at Xenon.Stanford.EDU Thu Feb 3 15:22:56 2000 From: amitp at Xenon.Stanford.EDU (Amit Patel) Date: 3 Feb 2000 20:22:56 GMT Subject: Fwd: re AMTE thread re DrScheme & Python References: <389739fb.95247007@news.teleport.com> Message-ID: <87co30$7q$1@nntp.Stanford.EDU> Kirby Urner wrote: | | | For more context re the below, see the archived thread | (on-going) at the Math Forum. This is from an | Association of Mathematics Teacher Educators | listserv: | | http://forum.swarthmore.edu/epigone/amte/snuquoiyor | | If people posting here have the time to read what | Matthias says about Python... e.g.: | | | I'd be happy to read their feedback. The language you like is going to depend on the kinds of things you do and the kinds of things you value. I like Scheme. I also like C++. However, I don't use either these days.. I try to find the right tool for the job, and Python seems to be a good choice for what I'm doing these days. I think students should be exposed to many different tools in their education. | > As far as the language is concerned, Python is a | > - highly irregular, Is that bad for the user? Why? | > - badly implemented Is that bad for the user? | > - non-parethetical version of (Mz)Scheme Is that praise for Python? ;-) | > - without underlying theory of programming | > language design Is that bad for the user? Why? | > - or program development Does the user care about the theory? | > - with a cult-like following. Hey, in *this* newsgroup, that's a good thing! ;) I think it comes down to values: what do you value? If you value theory and regularity and simplicity and so on, you probably wouldn't want Python. But that doesn't mean everyone values those things. I wish Unix and Mac folk would ask "what do you need?" in their flame wars before saying "this is the right answer". Unix folk flame Mac folk because there isn't (wasn't) a nice command line interface. The Mac folk don't care. The Mac folk flame the Unix folk because the interfaces are so inconsistent. The Unix folk don't care (much); they'd rather have freedom in choosing toolkits. Who is "Right"? No one. I think language flamewars are similar. - Amit From P.J.W.S.VRIJLANDT at INT.azg.nl Sat Feb 5 11:48:31 2000 From: P.J.W.S.VRIJLANDT at INT.azg.nl (P.J.W.S. Vrijlandt) Date: Sat, 5 Feb 2000 17:48:31 +0100 Subject: Freezing an app using win32com and wxPython In-Reply-To: <389C4F96.610BE6D2@equi4.com> Message-ID: <78B9CC1777@nds-3.azg.nl> Jean-Claude wrote: > Calishar wrote: > > File "C:\PROGRA~1\PYTHON\win32com\client\dynamic.py", line 22, in ? > > ImportError: DLL load failed: A device attached to the system is not > > functioning. > > > > By pure coincidence, I had what looks like the same problem 2 days ago. > > It turns out that I had to replace mfc42.dll in c:\windows\system\ by a > newer one. Perhaps this works for you too... > This DLL-message really is not very helpful. (I had the same error a month ago) Maybe Mark/Pythonwin can test if the os will offer sufficient com support or must be upgraded and create an informative errormessage. Met vriendelijke groet, Patrick Vrijlandt From moshez at math.huji.ac.il Wed Feb 16 12:55:00 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 16 Feb 2000 19:55:00 +0200 (IST) Subject: Moving from perl to python: questions In-Reply-To: <38AAB0ED.D9603D2F@austin.ibm.com> Message-ID: On Wed, 16 Feb 2000, David R. Favor wrote: > 1) Best way to convert array argv[1:] into string to pass functions Depends on what you want, but probably string.join(argv[1:]) > 2) How to implement a no-frills file slurp() function Do you mean file.read()? open("file").read()? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jojoing at mail.iem.nctu.edu.tw Fri Feb 25 09:34:48 2000 From: jojoing at mail.iem.nctu.edu.tw (Jeff Chou) Date: Fri, 25 Feb 2000 22:34:48 +0800 Subject: How to send data into other's CGI on the site and read it back? Message-ID: <38B69308.38F59503@mail.iem.nctu.edu.tw> Dear mentors: How to use Python script to send data into other's cgi on the web site and read its results back for calculating? The problem is that I don't know how to send data into other's cgi, even read it back? Pls help me, Python beginner. Thanx in advance. If possible, could you forward the answers to me? Thanx again. Jeff Chou From gerrit.holl at pobox.com Fri Feb 18 17:02:39 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 23:02:39 +0100 Subject: Which GUI? In-Reply-To: ; from moshez@math.huji.ac.il on Fri, Feb 18, 2000 at 03:35:50PM +0200 References: <88jg9f$ssd$1@nnrp1.deja.com> Message-ID: <20000218230239.C9457@stopcontact.palga.uucp> Moshe Zadka wrote on 950884550: > > Talk about portability: it is Ok to say > > that wxPython is portable > > No it is not. It doesn't work on AIX. I truly fail to see how come Python, > Tcl/Tk, Perl, bash, GNU grep manage to compile cleanly on AIX, yet > wxWindows doesn't, but until it does, it is not an option for many people, > including me. I can't understand this. AIX must be strange - wxWindows just talks to X! And X is portable. > > If there is any project of an OO GUI linking Python through > > C-bindings to Motif, X11, Windows and Mac base windowing > > libraries, I'd like to hear about it. This has been done for > > Tk, why not doing it again for Python? > > Because it's much easier to steal Tk then reinvent Tk for Python. That's > the good thing about free software: you can build on other people's work > instead of doing it yourself. ...and slow down the whole process a fewhundred times. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From sabren at manifestation.com Fri Feb 18 17:24:10 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Fri, 18 Feb 2000 17:24:10 -0500 (EST) Subject: functional programming Message-ID: Hey All, That Software Development Magazine article had a sidebar which mentions that python supports functional programming. I know what functional programming IS, and I can see how python supports it, but I'm wondering if anyone has any examples of actually putting this to use? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From nobooze4u at BLAM!worldnet.att.net Fri Feb 11 19:03:06 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 00:03:06 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> Message-ID: <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> x-no-archive: yes Ben Wolfson wrote: > On Fri, 11 Feb 2000 19:47:10 GMT, Forget it > > >x-no-archive: yes > > This would be more effective if it were actually in your headers, I think. Yep. But Netscape doesn't let you do that. Moreover, believe it or not, it works. > > -- > Barnabas T. Rumjuggler > > It would be wrong to ridicule this before explanation, for philosophers > must be allowed their bits of terminology. It is much better to ridicule > it afterwards. > -- Simon Blackburn, reviewing "Kant and the Platypus" by Umberto Eco From daryl_stultz at my-deja.com Tue Feb 8 15:25:30 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Tue, 08 Feb 2000 20:25:30 GMT Subject: win32security, client privleges Message-ID: <87pu3o$23i$1@nnrp1.deja.com> Hello, I'm on a Windows NT machine on a managed network. I would like to write an app to manage file security (access rights...) It seems that win32security is just what I need. However, when I run the following: import win32security win32security.GetFileSecurity("SomeFile") I get the following error: api_error: (1314, 'GetFileSecurity', ' A required privilege is not held by the client.') I have "administrator" status on the network. For kicks, I had the domain admin log in to my machine and I got the same error. So it appears as though client refers to something other than my User account. How do I make this work? Also, is there some decent documentation on how to use the various win32 modules (or is it all in some MS documentation?) Thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From MSteed at altiris.com Wed Feb 9 12:18:44 2000 From: MSteed at altiris.com (Mike Steed) Date: Wed, 9 Feb 2000 10:18:44 -0700 Subject: IDLE and Hooks in apps for usage of My Favorite Editor Message-ID: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com> > From: jblaine at shell2.shore.net [mailto:jblaine at shell2.shore.net] > Sent: Wednesday, February 09, 2000 8:16 AM > To: python-list at python.org > Subject: IDLE and Hooks in apps for usage of My Favorite Editor > > > Am I the only one who chooses specifically not to use IDEs > (IDLE included) because they don't allow you to edit files > with your editor of preference? > > Am I the only one on the planet who thinks allowing a > programmer to use his/her editor of choice in applications > is VERY important? I'm with you on both points. Because Vim (my favorite) is so different from other editors, I find most IDE editors and text editing widgets cumbersome to use. > I've seen _one_ application (TkRat, an IMAP client done in > Tcl/Tk) in a long long time that allows calling an external > editor. > > Is this a difficult task which I just don't understand the > complexities of? A while ago there was a discussion about this on the Vim developers list. The consensus was that we need a protocol to allow communication between (for example) editors and debuggers -- open file x, set a breakpoint on line y, etc. The intent would be to enable the plugging in of any (smart) editor to any (smart) IDE. I have dreamed of this for some time. I would like to help with such a project (feels too big for me to do alone), but as far as I know there is nothing like this in development. If I get ambitious enough, I might try it anyway. Mike From skaller at maxtal.com.au Sun Feb 20 10:48:26 2000 From: skaller at maxtal.com.au (skaller) Date: Mon, 21 Feb 2000 02:48:26 +1100 Subject: Recursive function defined within function => NameError References: <38ABCE51.3EF6728E@inka.de> Message-ID: <38B00CCA.FD467C01@maxtal.com.au> Michael Str?der wrote: > > HI! > > I have a problem with a locally-defined recursive function within a > function. Example: > > --------------- > def func1(): > > def fak(n): > if n>1: > return n*fak(n-1) > else: > return n > > print fak(6) > > func1() > --------------- > > But this code snippet does not work. It produces the traceback: [] > Any better solution? Sure. Use Vyper instead of Python: you code works right out of the box just like it should: [root at ruby] ~/links/viper/src>./vyperi t_recurse.vy File t_recurse.vy Viperi 2.0.1 Copyright Maxtal P/L, John Skaller, Australia, 1999 720 DONE: returning code 0 -- John (Max) Skaller, mailto:skaller at maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net From jstok at bluedog.apana.org.au Sat Feb 12 03:24:45 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Sat, 12 Feb 2000 19:24:45 +1100 Subject: Thanx and keep it coming. Or I'll flame some more ...(Re: Python sucks loud) References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> Message-ID: Forget it wrote in message ... >Speaking about C--I don't care for it to be C, actually C is not the >best for me, but I'd like it to be interpreted, have types (user types a >big nice-to-have), and objects. And the C-ish syntax, like in Perl, so I >don't have to be undergo a major attitude adjustment every time I switch >from one to another. Actually, it is often far easier to adapt to a syntax that is completely different, than to one that is similar but subtly different. To much "bleeding" of one domain into the other occurs if languages are too similar. From mwh21 at cam.ac.uk Mon Feb 21 12:19:21 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 21 Feb 2000 17:19:21 +0000 Subject: Python misconceptions in IBM Ruby article... References: <38B0821D.150AC73A@mincom.com> Message-ID: John Farrell writes: > Now, I do not propose that this be changed, and I do not claim that > other languages are better because of this. However I do claim that there > is a tacked-on feeling about it. As I tried to explain in an earlier post , there is not really any other way to do it, given large gobs of the rest of Python. The problem is: without a `self' argument, how on earth do you distinguish between references to local and instance variables, given that you don't declare variables? It would be possible to do something a bit like the `global' keyword so you would them write methods like: class Class: def sety(x): instance y y = x def gety(): return y # maybe this would work but do you really think this would look less tacked on? You'd need a keyword equivalent to `this' in C++, too. > I think it's a little bit disingenuous > to disparage the Ruby article for claiming that Python's OO features > feel added-on, when there is considerable evidence to support that claim. I posit that here `evidence' == `things different from what I am used to'. In the absence of declarations, there aren't many ways to distinguish instance vars from locals, and prefixing `self.' to them seems as good as any other. The absence of class methods also seems to me to be bogus, a result of people trying to write C++ or Java in Python. But maybe I'm wrong... open-you-mind-you-never-know-what-might-drop-in-ly y'rs Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From genius at acme.ca Tue Feb 29 14:44:37 2000 From: genius at acme.ca (Snoopy :-))) Date: Tue, 29 Feb 2000 19:44:37 GMT Subject: Best book to learn Python? References: Message-ID: There is a New Book which supposed to be a very good one for Beginners. It is expected to be available March-21. Published by "SAMS". The Title is: "Teach Yourself Python In 24-Hours" The Author is: Alan Gauld. He also has a Tutorial called "Learning To Program" which I found very good. You can get it at the following Site: http://www.python.org/doc/Intros.html Good Luck. Best regards; Snoopy :-)) Quill wrote in message ... >I'd like to learn Python, and I want to purchase a good book. I'd like >one that is suitable for a beginning programmer. If anyone has had any >success learning from a book please let me know. Please post responses to >the group. > >Thanks in advance From phd at phd.russ.ru Mon Feb 7 11:49:46 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 7 Feb 2000 16:49:46 +0000 (GMT) Subject: mail filter in python? In-Reply-To: <20000207170156.A3609@stopcontact.palga.uucp> Message-ID: On Mon, 7 Feb 2000, Gerrit Holl wrote: > File locking isn't hard to implement, what kind of security checks do you There are number, look procmail's manpage for options -p, -f, -o, -m. For portability - option -Y... > mean? Python is portable so that's not a problem. Python is portable, but locking is certainly not :( > > It would be hard to reimplement all that from scratch :( > > I don't think so. Security is not an issue, the command runs under the > right uid. Wrong assumption Number One! :) Sometimes procmail can be run under different uid - due to installation requirements or just due to bugs in mailer (MTA) and/or mailer's config. Procmail can be installed set-uid root - look option "-d". What about all procmail's knowledge of SMTP? Procmail certainly does a good job of delivering, bouncing and error reporting. Again, I say: it would be hard to reimplement without a lot of work and testing. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From kvijayan at peri.csclub.uwaterloo.ca Sun Feb 6 16:21:54 2000 From: kvijayan at peri.csclub.uwaterloo.ca (Kannan Vijayan) Date: 6 Feb 2000 21:21:54 GMT Subject: chdir questions References: Message-ID: <87koli$nug$1@watserv3.uwaterloo.ca> Alex wrote: >> I know this is must be an easy one but how do I use os.chdir? I have >> tried many different ways of listing the path but no matter how I type >> it I get an error. Most common is either: >> >> >>> os.chdir(C:\temp) >> File "", line 1 >> os.chdir(C:\temp) >> ^ >> SyntaxError: invalid syntax > I don't use windows, so there might be another problem with what you're > trying to do. However, one thing that struck me about it is that > os.chdir is usually passed a string. E.g. you might want to try > something like os.chdir('C:\temp'). > Alex. Actually it would be: os.chdir('c:\\temp') # need to watch those backslashes -kannan From cpatti at black-racer.atg.com Fri Feb 4 13:10:26 2000 From: cpatti at black-racer.atg.com (chris patti) Date: 04 Feb 2000 13:10:26 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <14491.4735.38605.328866@beluga.mojam.com> Message-ID: chris patti writes: > Skip Montanaro writes: [snip my original argument for an FTP based CPAN-like archive) > > > > Why couldn't a CPAN-like thing be a web site? Web sites can (and are) > > mirrored all the time. > > > > There's no reason why it couldn't be, actually. > > -Chris I should note that the important thing here is that the modules are actually _stored_ on the website in question, it must be a complete archive of all the modules it presents, such that other sites could reliably mirror it and get a copy of all the modules. -Chris -- ------------------------------------------------------------------ Chris Patti| \ Art Technology Group||617-386-1649 \ cpatti at atg.com ------------------------------------------------------------------ From banderson at boi.hp.com Tue Feb 29 20:24:02 2000 From: banderson at boi.hp.com (Bill Anderson) Date: Tue, 29 Feb 2000 18:24:02 -0700 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <8945c6$a8j$1@nnrp1.deja.com> <38B6720A.760F6EB7@sdm.de> Message-ID: <38BC7132.DA450438@boi.hp.com> Peter Stoehr wrote: > > piet at cs.uu.nl schrieb: > > > > >>>>> see_plus_plus at my-deja.com (spp) writes: > > > > spp> Wait & See. > > spp> This new compiler is coming out from the same country where Mercedez, > > spp> BMW & Porsche are produced. You know the quality of those cars, do you? > > spp> cpp > > > > Like the Mercedes A-model that flipped over when you took a curve too fast. > This is not quite right. It flipped over as soon as a moose was visible. > That's why this behaviour didn't show up during the tests in Germany :-) Well, you know that a moose can be a very dangerous animal ... -- Bill Anderson Linux/Unix Administrator, Security Analyst ESBU (ARC) bill_anderson at boi.hp.com My opinions are just that; _my_ opinions. From donn at u.washington.edu Mon Feb 7 12:44:22 2000 From: donn at u.washington.edu (Donn Cave) Date: 7 Feb 2000 17:44:22 GMT Subject: mail filter in python? References: <20000207154641.A2817@stopcontact.palga.uucp> <20000208000902.31713@nms.otc.telstra.com.au> Message-ID: <87n09m$d8i$1@nntp6.u.washington.edu> Quoth Gerrit Holl : ... | The procmail syntax is really obfuscated. What about creating a mail | filter with a Python syntax? Shouldn't be too difficult, just create | some functions (drop, match_header) and execfile() a file with the | rexec module... I think this is usually how an obfuscated syntax is born, with the words ``Hey, this shouldn't be too difficult!'' I don't think procmail's notation is really that hard to work with. (I mean if you want obfuscated, look at its C code.) A lot of work has gone into procmail's functionality, and it could probably benefit from more. Anyway, it might be interesting in this context to look at Sift-Mail, a Tcl application from Lawrence Lundblade: http://www.island-resort.com/sm.htm and the Sieve language proposed as an Internet standard for mail filtering, http://www.cyrusoft.com/sieve/ Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From telsesser at gatecom.com Thu Feb 24 15:52:53 2000 From: telsesser at gatecom.com (Tom Elsesser) Date: Thu, 24 Feb 2000 20:52:53 GMT Subject: Netcfg python error Message-ID: When trying to run netcfg, I get the error message: Traceback (innermost last): File "/usr/lib/rhs/netcfg/netcfg.py", line 29, in ? from rhentry import * EOFError: EOF read where object expected I am using Mandrake 6.0 , kernel 2.2.9-19mdk python 1.5.1-11mdk netcfg 2.21-3mdk ...any help would be appreciated. TIA, Tom From tottinge at concentric.net Mon Feb 28 08:50:31 2000 From: tottinge at concentric.net (Tim Ottinger) Date: 28 Feb 2000 08:50:31 EST Subject: When to compile regex? References: <38A69D62.5A68F54D@chelmsford.com> Message-ID: <38b691f5.4085985@news.concentric.net> On Sun, 13 Feb 2000 07:02:42 -0500, David Shochat wrote: >In section 4.2.3 of the Python Library Reference (1.5.2) it says that >using compile is more efficient "when the expresion will be used several >times in a single program". I'm trying to figure out the intended >meaning of this. Does that mean "executed more than once", or "occurs >more than once in the program text"? Specifically, if it only occurs >once, but that is in a loop, is there an advantage to compiling before >entering the loop? It has to be compiled before it's used. If you don't compile it, then it will be compiled at the point of use, as a temporary, and then tossed away later. If you use the expression exactly once, or very rarely, or speed just doesn't matter at all, then don't compile. If you are going to use the expression a lot, in many searches, and especially in loops, then compiling can save you some time. It won't be a run/no-run issue, just a timing issue. Personally, I like to see the expression compile exception at compile time. Just me, though. YMMV. Tim (No-not-THAT-tim-ly yours) From tiddlerdeja at my-deja.com Wed Feb 23 08:59:44 2000 From: tiddlerdeja at my-deja.com (tiddlerdeja at my-deja.com) Date: Wed, 23 Feb 2000 13:59:44 GMT Subject: copy directory from a to b, how? Message-ID: <890p4e$q9c$1@nnrp1.deja.com> How do I copy a directory in python? I'd like to copy from c:\inetpub\staging to c:\inetpubwwwroot. I could do this by using os.system(...), but I'm thinking there must be a better way. Any information appreciated. Thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From akuchlin at mems-exchange.org Tue Feb 22 13:52:36 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 22 Feb 2000 13:52:36 -0500 Subject: Tkinter: user vs. program events Message-ID: <3d1z65kr2j.fsf@amarok.cnri.reston.va.us> I've been trying to figure out how to distinguish between Tkinter events that come from a user and ones that originate from changing the value of a widget. Is this possible? Here's the motivating example. I have a Scale widget for indicating light intensity: self.light_scale = Tkinter.Scale(f, command = self.adjust_light) adjust_light() is a method that takes the current value of the scale widget, and sends off a command to change light intensity. The Tkinter program also receives updates on the current state, and changes the scale widget to match the current value, with self.light_scale.set( ) . The problem is that the light_scale.set() call causes the associated command to be run, so a command is sent off changing the light intensity, which causes another status update to be sent out, which changes the setting, and so forth. So, how would you do this in Tkinter? Can I distinguish between events generated by a user and by a .set() call? Should adjust_light() be bound to some different event? Or should I change the binding of the widget on every update()? -- A.M. Kuchling http://starship.python.net/crew/amk/ Science itself, therefore, may be regarded as a minimal problem, consisting of the completest possible presentment of facts with the least possible expenditure of thought. -- Ernst Mach From moshez at math.huji.ac.il Tue Feb 15 00:44:56 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 15 Feb 2000 07:44:56 +0200 (IST) Subject: IDLE and Hooks in apps for usage of My Favorite Editor In-Reply-To: <14504.27894.464229.484275@weyr.cnri.reston.va.us> Message-ID: On Mon, 14 Feb 2000, Fred L. Drake, Jr. wrote: > Looks like it depends on Qt, which means "a large library in C++". > Not a killer, but less than ideal in the Python world (just a comment; > I'm not slaming the Qt or KDE people). > Does anyone here know of any small message bus libraries that are > still maintained, and are open source? Modulu the fact that every language has xml-rpc, seems like a little-brainer to a. define a protocol b. define an implementation above xml-rpc which does just that. Of course, you have to assume things like vi will have to be changed quite a bit to do that. Wait. No. I changed my mind. vi could probably be changed to support such a library in a weekend. By that time, EMACS will have about 5 modes which support it, of course. but-what-message-do-you-want-to-pass-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sp00fD at yahoo.com Wed Feb 9 13:57:24 2000 From: sp00fD at yahoo.com (sp00fD) Date: Wed, 09 Feb 2000 18:57:24 GMT Subject: cgi login/password question Message-ID: <87sdag$ou7$1@nnrp1.deja.com> I'm thinking about adding a login method to a web-site, I'd like to roll it myself, but how would I pass the info from page to page? Obviously a page would have a login/password form, and I'd like to have that username correspond to a permissions bit so that certain people can do certain things. I pretty much have it worked out except for the matter of passing the info around. Can someone help me? I like how the builtin method for doing this sets the "REMOTE-USER" environment setting. If it was passed in the url, it could easily be changed, as could a cookie. Thanks, Mike Sent via Deja.com http://www.deja.com/ Before you buy. From skip at mojam.com Tue Feb 8 12:33:04 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 8 Feb 2000 11:33:04 -0600 (CST) Subject: Python-Fu for GIMP? In-Reply-To: <00020808062400.01078@quadra.teleo.net> References: <38A03990.998FF375@doc.ic.ac.uk> <00020808062400.01078@quadra.teleo.net> Message-ID: <14496.21328.162754.259631@beluga.mojam.com> The pygimp page reference should be http://www.daa.com.au/~james/pygimp/ (typo in the previous post) Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ 847-971-7098 "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From anders.eriksson at morateknikutveckling.se Tue Feb 8 04:25:36 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Tue, 08 Feb 2000 10:25:36 +0100 Subject: const in Python References: <1262179804-3408142@hypernet.com> Message-ID: On Tue, 8 Feb 2000 10:11:31 +0900, Tom Holroyd wrote: >On Mon, 7 Feb 2000, Gordon McMillan wrote: > >> Anders M Eriksson writes: >> If you are truly concerned, you could make them attributes of >> a class that prohibits setattr. But generally naming >Right, like this: > >class ReadOnly: > def __setattr__(self, name, value): > if self.__dict__.has_key(name): > raise TypeError, 'value is read only' > self.__dict__[name] = value > >>>> const = ReadOnly() >>>> const.x = 5 >>>> const.x = 9 >TypeError: value is read only > Thank You! I love your class and it will from now be in every program I make. // Anders -- Thought I could organise freedom how Scandinavian of me From effbot at telia.com Wed Feb 9 13:36:43 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 18:36:43 GMT Subject: tkinter help? References: <87s9us$mci$1@nnrp1.deja.com> Message-ID: <%sio4.3132$dT4.205542400@newsb.telia.net> the my-deja.com attempt to take over comp.lang.python continues: > I had Python 1.5.1 working fine with tkinter on mkLinux, then decided to > upgrade to 1.5.2. The short version is that now tkinter doesn't work altho I > had edited /Modules/Setup and everything seemed to compile ok. Following > the suggested test procedures, I can do import Tkinter and import _tkinter, > but when I do Tkinter._test(), I get: XIO: Fatal IO error 0 (unknown error) > on X server ":0.0" after 18 requests (17 known processed) with 1 events > remaining. and Python shuts down. I assume that X is unhappy about something > (I am running kde), but I am at a loss to understand what. If anyone has any > suggestions about resolving this, I'd be most grateful for your help. http://www.python.org/doc/FAQ.html#3.27 "The reason is that the default Xlib is not built with support for threads. If you rebuild Xlib with threads enabled the problems go away. Alternatively, you can rebuild Python without threads ("make clean" first!)." From hnowak at cuci.nl Thu Feb 10 17:31:40 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Thu, 10 Feb 2000 23:31:40 +0100 Subject: Fully Bracketed Syntax In-Reply-To: <38A337F7.9059B943@americasm01.nt.com> Message-ID: <200002102232.XAA22470@dionysus.fw.cuci.nl> On 10 Feb 00, at 16:13, Eaglestone, Robert [NGC:B918: wrote: > Hello all, > > In general, it seems to me that all good programmers > indent their code. However, mandating it as part of > the form of a language sounds ... strange. Rob... give me the crowbar. The horse is quite dead. ;-) If you check the newsgroup archives, you'll find that this topic has been discussed over and over again, especially last month. (I wonder why this suddenly has become such a 'hot topic' again... one thread isn't dead yet or another person asks the same question about whitespace and indentation.) Not meaning to reprimand you, but if you browse the archives, you will most likely find some answers to your questions. --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From effbot at telia.com Tue Feb 22 18:21:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 23:21:35 GMT Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <1260876476-6142700@hypernet.com> <38B2E76D.7DEF295C@roguewave.com> <0kCs4.649$mYj.190257664@newsa.telia.net> <38B2FFB5.5025DD11@roguewave.com> Message-ID: <3SEs4.367$y3.187377664@newsb.telia.net> bjorn wrote: > Also, I don't understand your argument that ['a', 'b', 'c'].join() would be > slow. It shouldn't be any harder to implement that in C, than implementing > ''.join(['a', 'b', 'c']). it's not a question of difficulty (I've already written the code, you know), it's a question of where to put that C code. ... silly or not, I'll make a last attempt to explain this: factoid 1: Python 1.6 will have several string types. factoid 2: Python has an abstract sequence API, which is used in lots of places. any object that implements this API can be used with "for-in", "map", "list", "filter", etc (as well as popular extensions like Numerical Python etc). factoid 3: any function that can deal with more than one sequence type should use this API. factoid 4: you can implement "join" as a sequence of plain string concatenations (possibly using "reduce"), but that's not very efficient -- you'll end up doing lots of extra object allocations and copies for the intermediate results. (if you don't believe me, try it) factoid 5: real life experiences show that the costs of (4) is usually much higher than the cost of accessing items of a sequence object in order -- after all, most sequence objects are used with other things than "join", so the implementors tend to spend some time making sure item access is reasonably fast. factoid 6: an efficient way to implement "join" is to make sure the C code knows all relevant details about the internals of a single given string type. in that way, it can do all kinds of tricks to minimize the number of memory allocations and block copies required to build the output string. think about this for a while, and then consider the following statement. does this look silly to you? unless we want to do a major redesign of the internals, the best way to get good performance is to have ONE implementation of "join" FOR EACH string type. (now, if we need one implementation per string type, which knows about the internals of that string type, do you still think it's a lousy idea to put that implementation *in* the string type?) From 55555 at dakotacom.net Thu Feb 10 16:49:53 2000 From: 55555 at dakotacom.net (55555) Date: 10 Feb 2000 15:49:53 -0600 Subject: local cgi Message-ID: <38a33281_2@news5.newsfeeds.com> Is it possible to run a local cgi program on a windows 95 machine through internet explorer 5? My python programs come up as text documents even though .py is obviously associated properly in the registry. Thanks. -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==---------- http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- From rhicks at rma.edu Wed Feb 16 17:41:28 2000 From: rhicks at rma.edu (Robert Hicks) Date: Wed, 16 Feb 2000 22:41:28 GMT Subject: tkinter manual wanted References: <38AB1310.B97A982@freenet.edmonton.ab.ca> Message-ID: Unfortunately Tkinter documentation is scarce. The is a book out called Python and Tkinter programming by Grayson. Go here to take a look: http://www.manning.com/grayson Bob "Joseph Paish" wrote in message news:38AB1310.B97A982 at freenet.edmonton.ab.ca... > i am looking for a downloadable tkinter manual/tutorial. i have found > one or two on the web (on pythonware.com, i think) but would like > something that can be read without going online. pdf format would be > ideal, if such a thing exists. > > thanks > > joe > From hildeb at www.stahl.bau.tu-bs.de Sun Feb 13 07:36:38 2000 From: hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt) Date: 13 Feb 2000 12:36:38 GMT Subject: When to compile regex? References: <38A69D62.5A68F54D@chelmsford.com> Message-ID: On Sun, 13 Feb 2000 07:02:42 -0500, David Shochat wrote: >In section 4.2.3 of the Python Library Reference (1.5.2) it says that >using compile is more efficient "when the expresion will be used several >times in a single program". I'm trying to figure out the intended >meaning of this. Does that mean "executed more than once", or "occurs >more than once in the program text"? Specifically, if it only occurs >once, but that is in a loop, is there an advantage to compiling before >entering the loop? Of course! It's a loop, and a loop may be traversed multiple times. From R.Brodie at rl.ac.uk Fri Feb 18 04:35:18 2000 From: R.Brodie at rl.ac.uk (Richard Brodie) Date: Fri, 18 Feb 2000 09:35:18 -0000 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38AC50B2.3FAF778@sage.att.com> <38AC6549.8C48CA4@callware.com> Message-ID: <88j3os$162g@newton.cc.rl.ac.uk> "Ivan Van Laningham" wrote in message news:38AC6549.8C48CA4 at callware.com... > > > I'm a die-hard C++ programmer that recently took up Python for a change of > > > scenery and am enjoying it greatly. The one problem I am having is that I > > > can't break myself of the semicolon habit. I've tried chewing gum but it > > > just doesn't seem to work, and I'd like to avoid the patch. Any ideas? > > > > glue an inverted thumbtack to your ";" key. > > if that doesn't work, coat it with poison, > > or maybe LSD. Heh. Not particularly good for the converse problem of leaving out the colon, which still gets me, unless your keyboard is laid out differently from mine. From gvwilson at nevex.com Mon Feb 28 22:10:51 2000 From: gvwilson at nevex.com (gvwilson at nevex.com) Date: Mon, 28 Feb 2000 22:10:51 -0500 (EST) Subject: thread problem In-Reply-To: <000a01bf8256$643bc420$0aa0143f@tim> Message-ID: > It's trivial . How did I know someone was going to say that? > evaluate() *does* set self.result, but look at how you invoke it: > > self.result = self.evaluate() > Your evaluate() method doesn't have a "return" stmt, it just falls off > the end. So evaluate() returns None, which you immediately write over > the correct self.result. *sigh* Thanks --- here's me thinking complicated, and it's simple. Don't suppose there'll be a warning option in 1.6 for this kind of thing? > BTW, think about using the threading module instead, and using a > threading.Event object. It's much less error-prone than using the > thread module and a raw mutex. Figured I'd start low-level, then move up, then do some timings. Next: active expressions! Thanks, Greg From neelk at brick.cswv.com Tue Feb 1 19:38:57 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 2 Feb 2000 00:38:57 GMT Subject: re AMTE thread re DrScheme & Python References: <000f01bf6d0a$0f213bc0$4b2d153f@tim> Message-ID: Tim Peters wrote: > > Scheme is an excellent first language, and I've got nothing at all bad to > say about DrScheme (except perhaps that it sure puts a heck of a lot more > strain on my old machine than does Python <0.5 wink>). It would be hard to > regret teaching Scheme. It would also be hard to regret teaching Python. It also has a ton of amazingly cool IDE features; for example, the value-flow-static-debugger-proof thingy MrSpidey is one of the most clever tools I've ever seen. Writing one for Python 2.0 would be really fun, I think. (I'd wait until 2.0 so that there is a pure object model, but that's not strictly a necessity, I guess.) I mean, it's so easy to use that it makes me begin to think that Djikstra was *right* about all bugs being the result of failing to prove the program's correctness, and that's such an obviously insane attitude that MrSpidey must be great. :) Neel From sabren at manifestation.com Wed Feb 9 11:58:06 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 9 Feb 2000 11:58:06 -0500 Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> Message-ID: <87s6bm$tp2$1@nntp3.atl.mindspring.net> rchowd1 at my-deja.com wrote in message <87q726$8ir$1 at nnrp1.deja.com>... >How do we handle sessions in python (server side) ? > >Could you please explain with a simple example with a form (client-side) >and python (server-side). check out http://phplib.netuse.de it's not for python... but it explains an object model that could be easily ported to python if someone had the time.. (i thought about porting it myself, and modifying it to use something like WDDX to store session variables in a language-neutral way, but I just haven't had the time..) -michal From claird at starbase.neosoft.com Tue Feb 29 11:31:46 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 29 Feb 2000 10:31:46 -0600 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: <1260348438-26442187@hypernet.com> Message-ID: In article , Arnaud Fontaine wrote: . . . >Now MetaKit is working fine and does almost what I want :) So what is MetaKit lacking? I think perhaps I'm not following some of the flurry of posts in this thread. >I also tried Gadfly which is plenty old SQL but, as far as I try it, >less suitable for objects persistence. > >> A MetaKit row is an object, but not an object of your making. >> It can have properties that are ints, strings, doubles, or other >> views. So while it's not pickle, it's a whole lot easier to map >> object persistence into Metakit than into a conventional >> RDBMS. > >Sure it is ! >If MetaKit doesn't yet have an orthogonal persistence model, it seems to >be on a good way. >Maybe the next step will be a mixed of pickle and MetaKit. I like the >MetaKit way to query objects. We're getting close to OQL (maybe I'm >wrong with the name ... haven't touch an O2 database for years). > >> Don't think you'll find anything that meets those requirements >> that doesn't consume vast amounts of resources (including >> $$, probably). > >Memory ... gigabytes of memory. But yet, I'm not sure I can find any >commercial products to meet my requirements. >Actually, I'm trying to set this on a cluster and, as I have very few >data modifications (4 times a day) I'm looking toward duplication of the >database (data distribution thru LH* or RP* gives me headache) ... But >all this is a bit out of topic ;-) . . . *That*'s an interesting usage profile! Let's return to this later; perhaps we can generate still other ideas for you. One mystery to me: why doesn't DB2 get more attention? Version 6 has large objects, user-defined types, user-defined functions, triggers, and is available at no charge for Linux. I'm just astounded that this hasn't created more of a buzz. I'm bring it up here because, with all the Version 6 goodies, IBM has taken to talking about its "object-relational" capabilities and "support for object orientation". It might suit your needs to host DB2 on a Linux box, and leave just the client software on your MacOS desktops. If I didn't have MetaKit, I'd probably go in a much different direc- tion and see how nicely Python and DB2 can play together. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From cfollett at gac.edu Fri Feb 25 09:28:37 2000 From: cfollett at gac.edu (Charles Follett) Date: Fri, 25 Feb 2000 08:28:37 -0600 Subject: Problems with Demo/sockets/mcast.py In-Reply-To: <20000224183506.308E91CD29@dinsdale.python.org> (python-list-request@python.org) References: <20000224183506.308E91CD29@dinsdale.python.org> Message-ID: <200002251428.IAA04430@giant-curled.mcs.gac.edu> > From: "Jerome Chan" > Subject: Problems with Demo/sockets/mcast.py > > File "./mcast.py", line 89, in openmcastsock > s.setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP, mreq) > socket.error: (22, 'Invalid argument') Yeah, I ran into this, too. After the graddr is calculated, but before the mreq is packed, you want to do: grpaddr = htonl(grpaddr) Then it will work fine. At least on linux, never tried on win. charley From mfletch at tpresence.com Thu Feb 10 13:04:20 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 10 Feb 2000 13:04:20 -0500 Subject: Corel + Borland = The End of MS Win Message-ID: I believe the Class/Type split is referred to in the quote. Ruby is interesting as a language. On reading through the tutorial, I can't say that I (a non-programmer) was particular struck that "oh, this is a better language than Python", but it did seem like a well thought out and usable language (it's been a few months, so that's about as specific as my recollections get :) ). On the whole, I didn't see any compelling reason to switch to Ruby (and the lack of any of the modules I need to get work done was a serious reason not to ;) ). Maybe, just maybe, we could stop these recurrent (dull) threads some time soon? Some sort of guidelines for posting language reviews and advertisements? A branch of the Python mafia going around to people's houses and "convincing" them? A few choice trips in the time machine to effect world domination and eliminate competition? Something must be done! comp.lang.python is going to get a reputation for being a Usenet group soon if we don't act to stem the tide! :) Enjoy all, Mike -----Original Message----- From: Shalabh Chaturvedi [mailto:shalabh at pspl.co.in] Sent: Thursday, February 10, 2000 12:39 PM To: Python Mailing List Subject: Re: Corel + Borland = The End of MS Win Paul Boddie wrote: ... "Neither Python nor Perl were designed as object-oriented languages." Is this true about Python ? ... From skip at mojam.com Wed Feb 16 14:14:30 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 16 Feb 2000 13:14:30 -0600 (CST) Subject: Reference to list element question In-Reply-To: <38AAF50B.7FC60776@austin.ibm.com> References: <38AAF50B.7FC60776@austin.ibm.com> Message-ID: <14506.63254.587502.264775@beluga.mojam.com> David> The following code attempts to create a reference to a list David> element to reduce overhead for large files, however the result is David> a copy operation. Yup. Strings are immutable (can't be modified in place). You would have to do something like: lines[i] = lines[i][:-1] to delete the trailing newlines in lines[i]. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From moshez at math.huji.ac.il Fri Feb 11 17:02:23 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 00:02:23 +0200 (IST) Subject: Except an exception AND all its subclasses? In-Reply-To: <20000211220612.A7720@stopcontact.palga.uucp> Message-ID: On Fri, 11 Feb 2000, Gerrit Holl wrote: > Hello, > > it's not possible to catch an exception and all its subclasses as > of python 1.5.2, is it? > > I think this would be a nice feature for a future version of Python. > What do you think? Why, yes, Gerrit. -- Hey Barry! Stop trying to be your own father and let me use the time machine for a second. class A: pass class B(A): pass try: raise B except A: print "caught it" Ouch! Barry, why didn't you want me about that step? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From prudek at nembv.cz Tue Feb 15 09:28:00 2000 From: prudek at nembv.cz (Milos Prudek) Date: Tue, 15 Feb 2000 15:28:00 +0100 Subject: Informix integration Message-ID: <38A96270.E7E67D65@nembv.cz> How can I write a program for python that would be able to query Informix database? I have downloaded Informix Client SDK, what now? -- Milos Prudek From mfletch at tpresence.com Thu Feb 17 15:59:56 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 17 Feb 2000 15:59:56 -0500 Subject: Continuations and threads (was Re: Iterators & generators) Message-ID: Not being a CS person, maybe I can confuse the issue :) ... A continuation is a suspended execution context, you get to a point and say "can't/won't finish this now, I'll store the state (frame) and let other execution contexts call me when I should continue". When you want to resume the context, you "call" the continuation, which resumes running the suspended execution context at the next line after the call to suspend. If I'm reading things right, there are methods on continuations which allow for updating variables while not running the context, so you can pass information into the context while it is suspended. But that's just from me skimming through Christian's article :) . I've been known to miss important CS concepts before ;) . Enjoy, Mike -----Original Message----- From: kc5tja at garnet.armored.net [mailto:kc5tja at garnet.armored.net] Sent: Thursday, February 17, 2000 3:31 PM To: python-list at python.org Subject: Re: Continuations and threads (was Re: Iterators & generators) ... OK, that's informative. So much for the differences between threads and continuations. But I'm still left wondering just what the heck continuations are. :) ... From anders.eriksson at morateknikutveckling.se Wed Feb 16 10:05:02 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Wed, 16 Feb 2000 16:05:02 +0100 Subject: Valid Python Code? Message-ID: Hello! I'm just wondering is this a valid Python code snippet? import os for k,v in os.environ.values(): print k,v I can't get it to work!? // Anders Yes I did find this snippet on the Poor Mans Zope page... From effbot at telia.com Tue Feb 22 04:35:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 09:35:06 GMT Subject: Newbie question about exceptions References: <88s311$dt1@news.dns.microsoft.com> Message-ID: Remco Gerlich wrote: > How about: > > try: > f1 = open(file1) > (etc) > except: > print 'File open error' > f1.close() > > It will always get there. File open error Traceback (innermost last): File "bzzt.py", line 5, in ? NameError: f1 (the original example was thrice as flawed, of course ;-) From jeddak at earthlink.net Mon Feb 21 09:04:48 2000 From: jeddak at earthlink.net (J Donald) Date: Mon, 21 Feb 2000 14:04:48 GMT Subject: Problem with re.findall?????!!!!!!!!!! Message-ID: <38B10F76.91DC90C1@earthlink.net> I'm getting an AttributeError when I try to use re.findall or {my compiled re object}.findall. Is it me, or is there a problem perhaps with my libraries? #begin code import sys,re,urllib,httplib if __name__ == '__main__': global needleFinder global haystack global needles haystack="As tax season approaches, many snakes will begin to gather the information and forms they need to file their 1932 tax returns." needleFinder = re.compile("A") needles = needleFinder.findall(haystack) print needles #end code Any vague divinations, dark hints, or subtle proddings greatly appreciated. Feeling-immensely-stupid'ly yours, Jonathan From effbot at telia.com Wed Feb 16 15:23:54 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 20:23:54 GMT Subject: Image operation References: <88et0i$n24$1@nnrp1.deja.com> Message-ID: Arinte wrote: > How can I use python to open + manipulate a .bmp or .jpg file. I > looked at the imageop in the documentation, but wasn't sure how to use > it. I am interested in the scaling and dithering functions they have. you could invent a way to read JPEG or BMP images into strings, and use imageop on those... ...or you could use PIL: http://www.pythonware.com/products/pil From alex at somewhere.round.here Wed Feb 23 16:48:30 2000 From: alex at somewhere.round.here (Alex) Date: 23 Feb 2000 16:48:30 -0500 Subject: Problem with Emacs mode, at start only References: <14508.12680.569760.298585@anthem.cnri.reston.va.us> Message-ID: > The following changes to the output filter and py-execute-file pollute > the interpreter's namespace slightly, but they put a stop to the > premature deletion of the temporary files in which python code is to be > executed by putting the responsibility for the deletion on the > interpreter itself, after the execfile has been called. Actually, they don't work so well, because the finally: block that py-execute-file passes to the interpreter might not be executed if you quit from the debugger. Oh, well. Alex. From gerrit.holl at pobox.com Fri Feb 18 09:51:29 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 15:51:29 +0100 Subject: Superclasses In-Reply-To: ; from jayantha@ccs.neu.edu on Thu, Feb 17, 2000 at 05:36:18PM -0500 References: <_ZWq4.180$mYj.170807808@newsa.telia.net> Message-ID: <20000218155129.A3878@stopcontact.palga.uucp> Joshua C. Marshall wrote on 950805378: > On Thu, 17 Feb 2000, Fredrik Lundh wrote: > > > Joshua C. Marshall wrote: > > > Given a class object, is there a way to get at its superclass object? > > > > the thing you're looking for is "__bases__" > > Thanks, that's what I needed. Incidently, where is "__bases__" defined? > If "T" is a class object, doing a "dir(T)" doesn't show "__bases__" as a > field. > > Sorry if this is a double-post. Doesn't seem my last one went through. >>> class Foo: ... pass ... >>> class Bar: ... pass ... >>> class Fubar(Foo, Bar): ... pass ... >>> print Fubar.__bases__ (, ) regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From aa8vb at yahoo.com Tue Feb 29 09:15:14 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Tue, 29 Feb 2000 09:15:14 -0500 Subject: help: menu item callback in TK In-Reply-To: <38B3E0E3.508AB49F@computer.org> References: <88uvl5$sj0$1@pollux.ip-plus.net> <38B369EB.D21F5BA8@bellatlantic.net> <38B3E0E3.508AB49F@computer.org> Message-ID: <20000229091514.A3684341@vislab.epa.gov> Lin Li: |Steve Holden wrote: |> lin li wrote: |> > I generated a menu using the data in a dynamically composed list. |> > Since I do not know what will be in the list, I can only have all the |> > command items in the menu to point to the same callback. Now |> > from inside the callback, how can I find out which menu item is |> > selected? ... I am running Python 1.5.2 with Tkinter on NT. | |Provided, of course, that I know how to use lambda. I decided to call this |an incentive and start learning. ------------------------------------------------------------------------------ A lambda is one way: callback = lambda option="Bananas": sys.stdout.write( option ) ------------------------------------------------------------------------------ A function is a slightly better one. You can use statements within it: def cb( option="Bananas" ): print option callback = cb ------------------------------------------------------------------------------ A callable object is yet another: class Call: def __init__( self, option ): self.option = option def __call__( self ): print self.option callback = Call( "Bananas" ) ------------------------------------------------------------------------------ My personal favorite for Tkinter callbacks is a generalization on this last one (thanks to Thomas Heller). It allows you to write your callback functions like normal, and then just use a generic callable object instance as the "glue" to keep track of the callback registration arguments and pass them to your callback. class Call: """Instances of this class store a function as well as a list of arguments. When they are called, the function will be called together with the arguments used for creating the instance. Slightly different than lambda, but nicer syntax.""" def __init__ (self, func, *args): self.func = func # save the function (or bound method, or ...) self.args = args # save the arguments to use def __call__ (self): apply (self.func, self.args) # call function, using args as arguments. Put Call somewhere, then use it over and over, like this: >>> def MyCallback( option ): ... print option ... >>> callback = Call( MyCallback, "Bananas" ) >>> callback() Bananas In Tkinter: >>> menu.add_checkbutton( label=item, command=Call( MyCallback, "Bananas" ) ) ------------------------------------------------------------------------------ Also note that, for check and radio button options in specific, you can use Tk string and int variables, respectively, to communicate the value so your callback doesn't need arguments: self.check_val = StringVar() ... menu.add_checkbutton( label=item, variable=self.check_val, command=self.CheckCB ) ... def CheckCB( self ): print "variable is ", self.check_val.get() -- Randall Hopper aa8vb at yahoo.com From effbot at telia.com Sun Feb 6 17:57:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 22:57:29 GMT Subject: arguments from the prompt References: Message-ID: joe at localhost.localdomain wrote: > how do I write a python script to recive arguments from the > command prompt? you import the sys module, and read up on sys.argv in the manual? (hint: sys.argv contains a list of all command line arguments passed to the program. argv[0] is the name of the program itself). if you want to parse options in a standard fashion, you can use the getopt module. see the docs for details. From effbot at telia.com Wed Feb 23 12:21:09 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 17:21:09 GMT Subject: Which GUI? References: <2B1262E83448D211AE4B00A0C9D61B03BA7148@MSGEURO1> Message-ID: <9GUs4.7658$al3.101306@newsc.telia.net> Pieter Claerhout wrote: > What about toolkits for the Mac. The MacOS toolbox is nowhere > mentioned, and also the problems we have with running Tcl/Tk > on the Mac are mentioned nowhere. Any suggestions on what else > will work with a Mac? the FrameWork framework? http://www.python.org/doc/current/mac/module-FrameWork.html From Gaetan_Corneau at baan.com Wed Feb 16 09:19:39 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Wed, 16 Feb 2000 09:19:39 -0500 Subject: Moving from perl to python: questions Message-ID: <816010E2456BD111A48700805FBBE2EE01C604FE@ex-quebec-u1.baan.com> David, > 1) Best way to convert array argv[1:] into string to pass functions from string import join l = ["aaa", "bbb", "ccc"] s = join(l[1:]) > 2) How to implement a no-frills file slurp() function What is a "slurp" function? ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From rhicks at rma.edu Thu Feb 3 18:17:49 2000 From: rhicks at rma.edu (Robert Hicks) Date: Thu, 03 Feb 2000 23:17:49 GMT Subject: Python/Tkinter GUI builders? References: <6D8A17398E28D3119F860090274DD7DB498484@pces.cadlab.it> <87cbgd$hbg$1@news1.xs4all.nl> Message-ID: PythonWare is coming out with a Python/Tkinter IDE/application builder. If you go to www.pythonware.com you can check out some of the information. ciao Bob "Boudewijn Rempt" wrote in message news:87cbgd$hbg$1 at news1.xs4all.nl... > Alessandro Bottoni wrote: > > I'm looking for a GUI Builder for Python/TKinter. In the Vaults of Parnassus > > I discovered the (very interesting) project of Henning Schoder: ViPyl see > > http://vipyl.sourceforge.net/ ). Unfortunately, ViPyl is at an early > > development stage at the moment and cannot be used for real programming. > > > Does anybody knows of any other GUI Builder for TKInter? > > Not only that, but Vipyl uses PyKDE, not TkInter... > > -- > > Boudewijn Rempt | http://www.valdyas.org From kelly at poverty.bloomington.in.us Sun Feb 13 15:30:58 2000 From: kelly at poverty.bloomington.in.us (Kelly Lynn Martin) Date: Sun, 13 Feb 2000 15:30:58 -0500 Subject: When to compile regex? In-Reply-To: Your message of "Sun, 13 Feb 2000 07:02:42 EST." <38A69D62.5A68F54D@chelmsford.com> Message-ID: <200002132030.PAA13865@poverty.bloomington.in.us> On Sun, 13 Feb 2000 07:02:42 -0500, David Shochat said: >In section 4.2.3 of the Python Library Reference (1.5.2) it says that >using compile is more efficient "when the expresion will be used >several times in a single program". I'm trying to figure out the >intended meaning of this. Does that mean "executed more than once", >or "occurs more than once in the program text"? Specifically, if it >only occurs once, but that is in a loop, is there an advantage to >compiling before entering the loop? Yes. Kelly From paul at prescod.net Wed Feb 9 12:06:01 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 09:06:01 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> Message-ID: <38A19E79.5E88D2FC@prescod.net> Bijan Parsia wrote: > > .... > > Ok, ok, I'll back off a little. But, really, just because someone > invokes Squeak in the context of other cluelessness is no reason to come > out walloping a community that, AFAICT, has done you and intends you no > harm. I admit that Smalltalk and Lisp have annoyed me for a while. I would apologize for taking it out on you but actually I didn't. The question was asked whether languages succeed or fail for a reason. I strongly believe that they do. If you spend 10 minutes reading www.python.org and then 10 minutes on www.smalltalk.org you will see the difference yourself. If it is an attack against the Smalltalk community to point out that they have surpressed widespread knowledge of a great programming language for nigh twenty years? Until Python, it was almost impossible to get a job programming in a decent programming language. By keeping Smalltalk under a basket for twenty years (even longer for Lisp) they delayed the popularity of general purpose high level languages until Perl, Java and VB came along. Thousands of smart people poured their efforts into Lisp machines and smalltalk VMs but the languages went nowhere. As Fredrik pointer out, we still have to justify Python as not-Lisp and not-Smalltalk. This annoys me. Ego-centric self-destruction annoys me. Okay, Haskell has an excuse: it is a reasearch language. K has an excuse: it is a special purpose language. Smalltalk and Lisp should be a hundred times more popular today than they are. The state of programming language deployment should be five years ahead of where it is. People should not think that Java is cool and modern. It's all very disappointing. I have this fantasy that maybe some honest, tough talk could still improve things. Maybe there is still someone around to listen: When I download a new programming language, I don't want a new development environment. I don't want a new GUI paradigm. I don't want a new religion. I don't want scrollbars on the left. I don't want to re-learn how to use my computer. This annoys me not only because it holds the ideas in Smalltalk back from popularity but because it strikes me as arrogant. Squeak's designers think that they are so much smarter than the rest of us that they must "correct" every decision we have ever made including what side the scrollbar should live on. Just give me a programming language please! You'll see more of that arrogance on www.smalltalk.org . -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself The great era of mathematical physics is now over; the 300-year effort to represent the material world in mathematical terms has exhausted itself. The understanding it was to provide is infinitely closer than it was when Isaac Newton wrote in the late seventeenth centruy, but it is still infinitely far away. - The Advent of the Algorithm (pending), by David Berlinski From dfan at harmonixmusic.com Tue Feb 15 16:48:14 2000 From: dfan at harmonixmusic.com (Dan Schmidt) Date: 15 Feb 2000 16:48:14 -0500 Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> <88bleg$chl$1@nnrp1.deja.com> Message-ID: Harald Hanche-Olsen writes: | + Andrew Cooke : | | | That finally hammered home to me just what continuations are all about. | | Does anyone have something similarly elegant that shows a coroutine? | | Not me, but let me show you what I learned about it, way back in '73. | I had the pleasure of learning assembly language programming at the | feet of a master -- Ole Johan Dahl of Simula fame -- and of course he | just had to teach us about coroutines and how to do them. It was | amazingly simple and powerful. | | [explanation snipped] This is pretty much the same way that Knuth explains coroutines in volume 1 of The Art of Computer Programming -- which you all have, right? -- in section 1.4.2. -- Dan Schmidt | http://www.dfan.org From mikael at isy.liu.se Wed Feb 9 05:19:54 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 09 Feb 2000 11:19:54 +0100 (MET) Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87rc79$chc$4@mach.vub.ac.be> Message-ID: On 09-Feb-00 Thomas Hamelryck wrote: > Mix tabs and spaces and you can get errors that are not visible. > Try it. As a number of people have pointed out: Don't! I for one never do. As long as you alone do the programming, this is safe. If, on the other hand, you have to hack in someone else's code, assume a tab setting of 8 spaces, since that is what the interpreter does. If the code worked for that someone else, then 8 it is. I would actually prefer that the interpreter regarded mixed tabs/spaces indentation as an error, or at least that it produced a warning. The best thing IMO would be if the interpreter only accepted one of these indentation tokens, preferably tabs I think. If that was the case, then these discussions would be less frequent, and we could concentrate on the beauty of indentation. However, as I understand things, there is already a lot of code out there with mixed tabs/spaces indentation. So, for the sake of backwards compatibility, I guess we will have to live with an interpreter that is sloppy in this respect. And don't say that I can rewrite the interpreter. _I_ can't! I leave that to the gurus out there, if someone is interested. I, simpleminded as I am, am glad that I can write a working program in whatever language there is. For the moment it is python. long-moment;-a-couple-of-years'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: 09-Feb-00 Time: 10:48:05 This message was sent by XF-Mail. ----------------------------------------------------------------------- From markus.oberhumer at jk.uni-linz.ac.at Wed Feb 16 10:48:56 2000 From: markus.oberhumer at jk.uni-linz.ac.at (Markus F.X.J. Oberhumer) Date: Wed, 16 Feb 2000 16:48:56 +0100 Subject: [ANNOUNCE] PySol 3.40 - a solitaire game collection Message-ID: <20000216164856.A2318@laetitia.oberhumer.com> -----BEGIN PGP SIGNED MESSAGE----- PySol - a Solitaire Game Collection Version 3.40 http://pysol.tsx.org Copyright (C) 1998, 1999, 2000 Markus F.X.J. Oberhumer What is PySol ? =============== PySol is an exciting collection of 163 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 163 (!) 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 ? ====================== * Implemented 3 new games. * Updated the pysol-sound-server. * 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 iQCVAwUBOKrGg210fyLu8beJAQGcnQP9GhCSYbE67hvusCSPZdnikzBz4ixyhZaR rqhGaSRgE8Il6AOnqegkVmpazzTICiyfkBSvqunZl30Aj7/sBfS0uimZkXVNvrgd vB5xqB9HWQl9w1H05tapphXz3PA6dKWkGcqgtZpJOEWg8L4x+G2BR006ooWCtBtK VZuG61dZ+/A= =uMMv -----END PGP SIGNATURE----- From sholden at bellatlantic.net Mon Feb 28 02:21:34 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 07:21:34 GMT Subject: does opensource move faster with python? References: Message-ID: <38BA21FF.30AB0EB6@bellatlantic.net> "Michal Wallace (sabren)" wrote: > > Does opensource move faster with Python? > > I just surfed over to the GnuCash website. I've been waiting quite a > while for a "real" release.. But it never seems to come.. Same thing > with Mozilla.... I'm not trying to rag on them.. But I have to wonder: > would development move any faster using Python to prototype these > tools? That's the claim I keep hearing about python.. But how come > more of the free software world isn't using it? Ignorance is bliss ... > > ARE there projects out there using python as a prototyping language > with the possible intention of discarding it eventually and rewriting > in C? > > Cheers, > > - Michal > ------------------------------------------------------------------------- > http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ > ------------------------------------------------------------------------- Isn't that the only correct intention of ALL prototyping? (Although not necessarily with C as the target language: I regard a lot of my personal work lately as developing prototypes in Python for eventual re-implementation in Python). "Python" or "python"? -- "Snake" or "snake"? Still remember Kernighan and Plauger's advice: first make it work, then make it work faster (if it doesn't work fast enough). regards Steve -- "If computing ever stops being fun, I'll stop doing it" From echuck at mindspring.com Sun Feb 27 17:21:23 2000 From: echuck at mindspring.com (Chuck Esterbrook) Date: Sun, 27 Feb 2000 17:21:23 -0500 Subject: MySQLdb for Win32 Message-ID: <38B9A363.777B5316@mindspring.com> Is there a pre-built version of MySQLdb available for Win32? -Chuck From ingling at ctrvax.vanderbilt.edu Mon Feb 21 10:27:09 2000 From: ingling at ctrvax.vanderbilt.edu (Allen W. Ingling) Date: Mon, 21 Feb 2000 10:27:09 -0500 Subject: termios question Message-ID: <38B1594D.BC38503C@ctrvax.vanderbilt.edu> I can't seem to set the serial port baud rate using the termios module. Permissions on ttyS0 are both read and write for root, and I run Python as root. I'm running Python 1.5.2 on RedHat 6.1, if that's any help. Here's an example: >>> import os >>> import TERMIOS >>> import termios >>> fd = os.open("/dev/ttyS0", os.O_RDWR | os.O_NOCTTY | os.O_NDELAY) >>> attribs = termios.tcgetattr(fd) >>> attribs [1280, 5, 3261, 35387, 13, 13, ['\003', '\034', '\177', '\025', '\004', '\000', '\001', '\000', '\021', '\023', '\032', '\000', '\022', '\017', '\027', '\026', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000']] >>> attribs[2] = attribs[2] & ~TERMIOS.CBAUD >>> attribs[2] = attribs[2] | TERMIOS.B1200 >>> attribs [1280, 5, 3257, 35387, 13, 13, ['\003', '\034', '\177', '\025', '\004', '\000', '\001', '\000', '\021', '\023', '\032', '\000', '\022', '\017', '\027', '\026', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000']] >>> termios.tcsetattr(fd, TERMIOS.TCSANOW, attribs) >>> attribs2 = termios.tcgetattr(fd) >>> attribs2 [1280, 5, 3261, 35387, 13, 13, ['\003', '\034', '\177', '\025', '\004', '\000', '\001', '\000', '\021', '\023', '\032', '\000', '\022', '\017', '\027', '\026', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000', '\000']] >>> os.close(fd) Shouldn't the call to tcsetattr have changed the 2th member of the list returned by tcgetattr from 3261 to 3237 ? Any suggestions about what the problem might be ? Outside of python there is no indication of a serial port problem, for example, minicom sets the serial port parameters. In fact, if I open the port, read the serial port parameters, and close the port from Python, then launch minicom and close it, then return to Python and reopen the port and reread the parameters, I find that minicom has changed the parameters. Allen.Ingling at vanderbilt.edu From trentm at ActiveState.com Tue Feb 15 09:00:19 2000 From: trentm at ActiveState.com (Trent Mick) Date: Tue, 15 Feb 2000 14:00:19 -0000 Subject: os.shell, recursion, encryption In-Reply-To: <38a9c39c_4@news5.newsfeeds.com> Message-ID: > > import os > > zipExe = 'c:/progra~1/pkzipdos/pkzip.exe' > > zipOutput = os.popen(zipExe + ' asdf.zip *.*', 'r') > > print zipOutput.readlines() > > I gave this a shot. I actually don't care about the return from pkzip, > but I think this would work. Unfortunately, an empty list is > returned and > there is no evidence that pkzip was ever executed. Any ideas? > > > import os > > zipExe = 'c:/progra~1/pkzipdos/pkzip.exe' > > os.system(zipExe + ' asdf.zip *.*') > > I was using that one without the greater than sign, but I don't want to > use the above because I'm walking through a directory tree and it would > spawn too many windows that would all need to be closed. > You say, "would spawn too many windows". Do you mean that when you manually run pkzip.exe from the command line it throws up a GUI interface? If that is so that you can not automate it via any of the os.system() or os.popen() commands in Python (or any scripting language). These functions are providing an interface to a program with a command line interface (CLI), with stdin, stdout, etc. They do not know how to talk to the GUI. However, I thought that pkzip.exe was just a CLI and not a GUI. Try the following. Open up a shell. > cd "c:\program files\pkzipdos\pkzip.exe" > pkzip ***SOME ERROR OR USAGE OUTPUT*** > python >>> import os >>> os.system('pkzip') ***SOME ERROR OR USAGE OUTPUT*** You should get the exact same result from 'pkzip' in the shell and os.system('pkzip') in python intepreter. Another thought. Are you on Win95/98? If so then I cannot really verify that this stuff works. However, I *think* that os.system() works fine on Win9x (although I wouldn't bet on it). Trent From sabren at manifestation.com Mon Feb 28 01:33:23 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Mon, 28 Feb 2000 01:33:23 -0500 (EST) Subject: does opensource move faster with python? Message-ID: Does opensource move faster with Python? I just surfed over to the GnuCash website. I've been waiting quite a while for a "real" release.. But it never seems to come.. Same thing with Mozilla.... I'm not trying to rag on them.. But I have to wonder: would development move any faster using Python to prototype these tools? That's the claim I keep hearing about python.. But how come more of the free software world isn't using it? ARE there projects out there using python as a prototyping language with the possible intention of discarding it eventually and rewriting in C? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From gerrit.holl at pobox.com Thu Feb 17 10:17:27 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 16:17:27 +0100 Subject: Which GUI? In-Reply-To: <38AC0244.C5FA164A@durham.ac.uk>; from J.C.Travers@durham.ac.uk on Thu, Feb 17, 2000 at 02:14:28PM +0000 References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: <20000217161727.A1183@stopcontact.palga.uucp> J.C.Travers wrote on 950793268: > Anders M Eriksson wrote: > > But now I'm reaching the point of no return and I need to create apps > > with a GUI, but which one? > > > > I'm using Windows NT as my development platform > > I would like pro and cons for the different GUI's > > This is a hot topic, and you will get as many different answers as > people you ask, so all I can give is my personal opinion. > > Firstly, I would advise against Tkinter. ... > The best GUI in my opinion is pyQT. ... > Alternatively there is wxPython. ... > In conclusion, go for QT unless you need comercial apps, in which case > go for wxWin. Of course this is all MHO. ~~~ I think we really should create an extensive list with all available GUI's, with all advantages and disadvantages and a table with info like crossplatformness, learning curve... regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From carsten.sessler at fhtw-berlin.de Mon Feb 7 13:45:26 2000 From: carsten.sessler at fhtw-berlin.de (Carsten Sessler) Date: Mon, 7 Feb 2000 19:45:26 +0100 Subject: JPython JDBC CGI Message-ID: <87n3du$8rmj$1@fu-berlin.de> Hello, when I tried to access an oracle-database via JDBC invoked in Jpython strange things happen. Running on command line there's no problem but when the scipts runs as CGI it fails ("premature end of script error"). The problem have to be related to the JAVA-classes I use. By first using an JAVA-class the script won't work (import-command is ok but creating an object fails). Maybe it's one of the PATH-variables put everyone I know I've checked... My configuration: WinNT 4.0 SP 5 Apache 1.3.6 JPython 1.1 Java: MS jview Any tip can beware me from suicide;-) Thanks in advance Carsten Sessler From hgg9140 at skewer.ca.boeing.com Fri Feb 11 09:44:16 2000 From: hgg9140 at skewer.ca.boeing.com (Harry G. George) Date: Fri, 11 Feb 2000 14:44:16 GMT Subject: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> Message-ID: Python was inspired in part by Modula-3, and a crucial aspect of Modula-3 is the notion of statement-sequences. I think that's what you mean by fully bracketed. The problem with C, Java, Pascal, and a host of other languages is that their grammars have things like if expr then statement where statement may be compound (a series of statements), thus requiring markers for the beginning and end of the sequence. C et al use "{ }", Pascal et al use "begin end". Such languages are subject to the classic bug: if (expr) stmt1 stmt2 where stmt2 is not controlled by the if condition. In contrast, languages whose grammars use statement sequences have fewer syntactic markers and no such bug: if expr then statement-seq allows: if expr then stmt1 end and if expr then stmt1 stmt2 end Personally, I'm generally impressed with python, but I have had screwed up indentation where an end marker a la Modula-3 would have been a lifesaver. Maybe I'll start using "#end". It would even be less verbose than my std Modula-3 idiom: .... #end if x > y vs .... END; (*if x > y*) "Eaglestone, Robert [NGC:B918:EXCH]" writes: > > Hello all, > > In general, it seems to me that all good programmers > indent their code. However, mandating it as part of > the form of a language sounds ... strange. > > However, I don't like the BEGIN...END bracketing done > by Pascaline languages; neither do I love the {...} > of C and its descendants. > > Has the creator of Python looked into fully bracketed > syntax? That might not be the actual term, so here's > an example of what I'm thinking about: > > if ( foo > bar ) > do_something(); > do_something_else(); > done(); > endif > > This bracketing gets the best [ or worst ] of both > worlds, with a bit of syntactic sugar added for free. > The lead bracket is the keyword itself, and the end > bracket is tailored for that keyword alone. Only > one 'line' is 'wasted' by the end bracket (Python > doesn't like wasting lines). And indentation is no > longer a language issue. > > I only know of one language which uses this syntax, > and it's not in common use. However, lots of us may > have seen this kind of syntax in college (hey! is it > part of ML?). > > I guess what I'd like is some clear reasoning about > bracketing and indenting that warrants such a feature > of a language. > > Thanks, > Rob -- Harry George E-mail: harry.g.george at boeing.com The Boeing Company Renton: (425) 237-6915 P. O. Box 3707 OY-89 Everett: (425) 266-3149 Seattle, WA 98124-2207 Page: (425) 631-8803 From J.C.Travers at durham.ac.uk Sun Feb 13 13:35:50 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Sun, 13 Feb 2000 18:35:50 +0000 Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> <882fld$6t08$1@node17.cwnet.frontiernet.net> Message-ID: <38A6F986.F3F29C95@durham.ac.uk> RPM1 wrote: > > Try, > http://www.pythonware.com/downloads.htm > > It's an EXE but it extracts even if you don't have privileges. No it doesn't. Well it didn't for me. I don't see the reason for not issueing a normal zip archive. Making a self-extracting binary doesn't make it much easier, (esp with winzip etc...) but causes lots of trouble for people like me. At least both should be offered... John. From neelk at brick.cswv.com Thu Feb 10 19:17:17 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 11 Feb 2000 00:17:17 GMT Subject: Fully Bracketed Syntax References: <65118AEEFF5AD3118E8300508B124877073D74@webmail.altiris.com> Message-ID: Mike Steed wrote: > Eaglestone, Robert [NGC:B918:EXCH] wrote: > [...] > > > > if ( foo > bar ) > > do_something(); > > do_something_else(); > > done(); > > endif > [...] > > In his book Code Complete, Steve McConnell calls this syntax "pure > blocks". Ada is the only language he mentions that implements this. > (Didn't Modula-2 do this too?) Dylan uses this style, but Modula-2 uses the Pascal BEGIN/END style. Now to break a trend, and supply some real numbers (this is a slightly edited version of a post I've made before -- I'd be willing to submit it to the FAQ...): -*-*-*- My other language-of-choice, Dylan, has a syntax and level of expressive power very similar to Python's, except that it has "end" block delimiters. The Gwydion Dylan compiler is about 56,000 lines of non-comment non-blank lines. Of these 56 KLOC, 8700 contain only "end" statements. That's about 16% of the code, or 1 line in 6. So we may presume that a similar fraction of Python code would be "end" statements if Python had block delimiters, too. It's also well-known that the average time to debug a function or class goes up with length, with a sharp upwards kink when the length of the program object exceeds 1 screenful, whatever the screen size is. Let's suppose that we are editing on a terminal that has 42 horizontal lines (like my XEmacs window). Then adding block delimiters to Python would mean that the effective screen size would shrink from 42 currently to 35 plus delimiters. This is a painful loss, considering that the debug time kinks upward whenever a program exceeds one screenful in size. Consequently, I think GvR made an excellent choice in keeping block delimiters out of Python. The gain in readability is well worth the slight inconvenience of dealing with tabs. (BTW, I also think Dylan did the right thing, because the block delimiters in Dylan are mostly there to make it possible to have a hygienic macro facility. Since Python doesn't have this, it doesn't need gratuitous "end" statements.) -*-*-*- Neel From sk at nvg.ntnu.no Sat Feb 19 16:42:34 2000 From: sk at nvg.ntnu.no (Steinar Knutsen) Date: Sat, 19 Feb 2000 22:42:34 +0100 Subject: Problems extending Python with C. Message-ID: I do not understand why I only can use the function ncmp as defined below properly in the sort method of a list when I put a Python function as a wrapper around it. Or in other words: import numcompare b = somefunctiongeneratingalistofstrings() b.sort(numcompare.ncmp) # b does not get sorted Whereas import numcompare b = somefunctiongeneratingalistofstrings() def NCMP(x,y): return numcompare.ncmp(x,y) b.sort(NCMP) # b is sorted correctly C-source for module: ------------------------------------------------------------------------ #include #include "/usr/local/include/python1.5/Python.h" static PyObject * ncmp(PyObject *self, PyObject *args) { const char* x; const char* y; long cc; if (!PyArg_ParseTuple(args, "ss", &x, &y)) { return NULL; } else { cc = numcompare(x, y); if (cc > 0) { return Py_BuildValue("i", 1); } else if ( cc == 0 ) { return Py_BuildValue("i", 0); } else { return Py_BuildValue("i", -1); } } } int numcompare(char* x, char* y) { int i0 = -1, i1 = -1; char* endx; char* endy; int lenx, leny; long X, Y; lenx = strlen(x)-1; leny = strlen(y)-1; while ( i0 < lenx && i1 < leny ) { i0++; i1++; if ( ( x[i0] >= '0' && x[i0] <= '9' ) && ( y[i1] >= '0' && y[i1] <= '9' ) ) { X = strtol(x+i0, &endx, 10); Y = strtol(y+i1, &endy, 10); } if ( X != Y ) { return X-Y; } else { /* -1 on cause of increment in start of while-loop */ i0 = (int)(endx - x) - 1; i1 = (int)(endy - y) - 1; continue; } if ( x[i0] != y[i1] ) { return x[i0]-y[i1]; } } return strcmp(x, y); } static struct PyMethodDef functions[] = { { "ncmp", ncmp, 1}, { NULL, NULL} }; void initnumcompare() { (void)Py_InitModule("numcompare", functions); } ----------------------------------------------------------------------- I guess I'm missing something very obvious here, but I just don't get what. The Python is 1.5.2, the compiler is GCC 2.7.2.2, the OS is NetBSD 1.3.3. (Yeah, I know I should upgrade, but the system works. :) ) Thanks for any and all help. -- Steinar From sharris at nospam.primus.com Mon Feb 7 16:14:51 2000 From: sharris at nospam.primus.com (Steven E. Harris) Date: Mon, 07 Feb 2000 21:14:51 GMT Subject: [Doc-SIG] Monty: A structured text syntax idea References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> <20000203160900.A1029@stopcontact.palga.uucp> <87le41$fms$1@nntp5.atl.mindspring.net> Message-ID: "Michal Wallace" writes: [...] > I missed the first half of this, so I don't know if this is relevant or not, > but I > use emacs outline mode a lot, and I came up with a "shorthand" version > of XML that looks like this: > > * root > ** somenode > this is the text of somenode > ** somenode attr="whatever" > another node > ** shortnode / > ** somenode > *** subnode > this is the subnode > > this can be translated into XML via a python filter at: > > http://www.sabren.com/code/python/o2x.py I have a similar translator (Emacs Outline to and XML vocabulary) written in Perl. I can share it if you're interested. -- Steven E. Harris Primus Knowledge Solutions, Inc. http://www.primus.com From gerrit.holl at pobox.com Fri Feb 18 10:01:44 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 16:01:44 +0100 Subject: Python sucks loud In-Reply-To: <88ifpv$33i$1@newshost.accu.uu.nl>; from m.faassen@vet.uu.nl on Fri, Feb 18, 2000 at 03:54:39AM +0000 References: <88ifpv$33i$1@newshost.accu.uu.nl> Message-ID: <20000218160144.B3878@stopcontact.palga.uucp> Martijn Faassen wrote on 950842479: > Moshe Zadka wrote: > > On 15 Feb 2000, William Tanksley wrote: > > >> Pretty much so. Tim keeps on killing people who disagree with him. Please > >> save us from him by posting more messages in which mindless abuse is > >> mistaken for humor! > > > I object to that. Tim has never killed anyone who disagreed with him. They > > just had...ummm...accidents. Yes, that's it, accidents. > > > now-the-psu-does-kill-people-ly y'rs, Z. > > I'm afraid I'm going to have to correct you: > > * The Python Secret Underground does not exist > > * It doesn't kill people > > * There are no whitespace eating nanoviruses > > * They are not alien either > > * You will not be terminated for revealing this information > > * It will have been an accident. PLEASE, PSU colleges, DON'T shoot him. He didn't know what he was talking about, it was 4 'o clock in the night. regards, Gerrit (psu member). From bjorn at roguewave.com Thu Feb 3 14:18:21 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Thu, 03 Feb 2000 12:18:21 -0700 Subject: Running a script python from JAVA References: Message-ID: <3899D47D.18DBFB1@roguewave.com> Not a solution, just a greater appreciation for the Python indentation == block syntax :-) -- bjorn Alain wrote: > Hi, > > I'm trying to run a script from a file. The script is written in python. The > script is a telnet session between a router and a computer. If I run the > script from a DOS prompt window, everything is good. But if I start the > script from my program, using a Runtime object, there's a problem. The > communication between the router and the computer is stop, even if the > telnet session is still open. Here's the code: > > private void runPython(String fileName, String aDevice) { try { Process > process; Runtime runtime = Runtime.getRuntime(); String os = > System.getProperty( "os.name" ); if ( os.equals( "Windows 95" )) { String > cmd = "start python " + fileName; process=runtime.exec(cmd); } else if > os.equals( "Windows NT" )) { String cmd = "cmd /C \"start python " + > fileName + "\""; runtime.exec( cmd ); } } catch (IOException e) > writeToLogFile("Telnet to: "+aDevice+" failled: "+e.getMessage()); } } > > Is there someone have a solution? > > Thanks, > > Alain > > -- > http://www.python.org/mailman/listinfo/python-list From bjorn at roguewave.com Wed Feb 16 15:48:53 2000 From: bjorn at roguewave.com (bjorn) Date: Wed, 16 Feb 2000 13:48:53 -0700 Subject: list iteration question References: <38AB0876.B816FE18@austin.ibm.com> Message-ID: <38AB0D34.EF8AA619@roguewave.com> Probably because you didn't import the string module and are using string.rstrip... --bjorn "David R. Favor" wrote: > In the attached code, would someone point out why the function > chomp4() throws an exception? > > Thanks. > > ------------------------------------------------------------------------ > > fileio.pyName: fileio.py > Type: Plain Text (text/plain) From cjc26 at nospam.cornell.edu Tue Feb 15 21:46:13 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Wed, 16 Feb 2000 02:46:13 GMT Subject: Real Problems with Python References: <000e01bf7763$dc8a9300$66a2143f@tim> Message-ID: Pada Mon, 14 Feb 2000 22:22:17 -0500, Tim Peters bilang: | | [Bijan Parsia] | > Er..Just out of curiosity, what *can't* you model in Scheme? :) | | Smalltalk . I once wrote a Smalltalk interpreter in Logo. -- cliff crawford -><- http://www.people.cornell.edu/pages/cjc26/ I think, therefore I'm single. From mikael at isy.liu.se Tue Feb 1 10:20:21 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 01 Feb 2000 16:20:21 +0100 (MET) Subject: Packages, modules, libraries,... In-Reply-To: <000201bf6cc2$b8fc7030$3acbd9c2@peridot.optichrome.com> Message-ID: Thank you, both Adrian and Gordon, for increasing my knowledge. /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: 01-Feb-00 Time: 16:13:38 This message was sent by XF-Mail. ----------------------------------------------------------------------- From nathan at islanddata.com Wed Feb 16 11:47:01 2000 From: nathan at islanddata.com (Nathan Clegg) Date: Wed, 16 Feb 2000 08:47:01 -0800 (PST) Subject: Moving from perl to python: questions In-Reply-To: <38AAB0ED.D9603D2F@austin.ibm.com> Message-ID: On 16-Feb-2000 David R. Favor wrote: > 2) How to implement a no-frills file slurp() function import string def slurp(filename): print filename try: f = open(filename, 'r') # catch whichever exceptions you fancy, here # rstrip will strip all whitespace off the right side, # much like chomp lines = map(string.rstrip, f.readlines()) f.close return lines ---------------------------------- Nathan Clegg nathan at islanddata.com From rich.glazerman at synchrologic.com Thu Feb 10 11:01:02 2000 From: rich.glazerman at synchrologic.com (Rich Glazerman) Date: Thu, 10 Feb 2000 11:01:02 -0500 Subject: HP Ini file module References: <00c001bf7360$2912b610$0101a8c1@server> Message-ID: I missed the early part of this conversation, I'm new to the newsgroup, so shoot me if this has already been mentioned... but I've been using the standard ConfigParser module to do this. Works fine for me. Hope this helps. Rich -- Rich Glazerman Test Engineer Synchrologic, Inc. rich.glazerman at synchrologic.com 770-754-5600x176 "Darrell" wrote in message news:00c001bf7360$2912b610$0101a8c1 at server... > I don't work for HP but have an INI parser. > Never used to though. > http://www.dorb.com/darrell/WinIniParser/ > > --Darrell > ----- Original Message ----- > From: "Gene Chiaramonte" > To: > Sent: Wednesday, February 09, 2000 2:23 PM > Subject: HP Ini file module > > > > At frozenspam 8 someone from HP mentioned they had a python module > available > > to work with ini files on windows. Anyone know where I might find that? > > > > Thanks, > > > > Gene > > > > > > -- > > http://www.python.org/mailman/listinfo/python-list > > From michael at camelot-it.com Thu Feb 3 05:12:18 2000 From: michael at camelot-it.com (Michael Tiomkin) Date: Thu, 03 Feb 2000 12:12:18 +0200 Subject: Newbie: OverflowError: integer addition - Python data types?? References: <879o21$lu2$1@nnrp1.deja.com> Message-ID: <38995482.7F77A87D@camelot-it.com> e.e.sutton at cummins.com wrote: > I can't get a Python version of my VBScript Fibonacci series script to > work. I get an OverflowError: integer addition error at series 46. > > Can Python not handle large numbers? > > Is there a special data type I should be using? > > Series 45 is the following number. > 45 1836311903 (1.84E+09) > > File "M:\SRC\scripting\fibonacci\fib.py", line 47, in Fibonacci > fib = fibA + fibB > OverflowError: integer addition > > def Fibonacci(i): > fibA=1 > fibB=1 > if i == 0: > Fibonacci = fibA > elif i == 1: > Fibonacci = fibB > elif i > 1: > fib=0 > for j in range(2, i+1): > fib = fibA + fibB > fibA = fibB > fibB = fib > Fibonacci = fib > return Fibonacci OK, your VBScript program just returns nonsense on n=46. What about using floating point numbers? In this case you'll just get +Inf or -Inf in case of overflow. ------------------------------------------- import Numeric N=Numeric b = (1.+N.sqrt(5))/2. c = (1.-N.sqrt(5))/2. e = (1-c)/(b-c) f = (b-1)/(b-c) def fibo(n): global b,c,e,f return e*b**n + f*c**n ---------------------------------- The maximal value I could get on a PC is fibo(1474). BTW, your function tries to return itself for n<0! Michael From thomas at xs4all.net Tue Feb 1 09:15:31 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Tue, 1 Feb 2000 15:15:31 +0100 Subject: Reading pipermail archives with mutt In-Reply-To: <20000131173728.D5068@mathi.uni-heidelberg.de>; from flight@mathi.uni-heidelberg.de on Mon, Jan 31, 2000 at 05:37:28PM +0100 References: <20000131173728.D5068@mathi.uni-heidelberg.de> Message-ID: <20000201151531.I19725@xs4all.nl> On Mon, Jan 31, 2000 at 05:37:28PM +0100, Gregor Hoffleit wrote: > Somehow mutt is not able to read the mail archives downloadable from > Python.org's SIG pages. The simple /bin/mail will grok them correctly > and list the contents, but mutt doesn't find any mails. > > IIRC, that's true not only for Python.org's mailing list archives, but > also for other archives. I'm not sure, though, if these archives perhaps > are all written by pipermail. > > Has anybody else noticed this before ? Is there any simple resolution ? Hadn't noticed it before, but now that you mention it.... ;) It's a problem in both mutt and pine, by the way, and it looks like it's a problem in pipermail itself. The problem is the From line, which marks the start of a message in a mailbox-format file. To be more specific, the problem is the date on that line. The dates by pipermail look like this : >From foobar Sun, 02 Jan 2000 11:52:52 +1100 Whereas those stored by procmail, pine, mutt et al look like this: >From foobar Sun Jan 2 11:52:52 2000 Manually fixing the dates in the from-lines makes the archive perfectly readable. I couldn't find a specification for the From line (though it's probably located somewhere in the sendmail source, if not the docs) but I suspect the date on the From line does not follow the RFC822 date specification. At least, mutt and pine refuse to read a RFC822-valid date on the From line. And, now that I check it, so does mailbox.py; mailbox.py uses the following regexp to check the From line: >From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*$ So I guess pipermail should be fixed, and possibly a 'fixfromline' script added to the distribution to convert old archives to the new From line format ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From mhammond at skippinet.com.au Tue Feb 1 07:04:38 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 12:04:38 GMT Subject: ole structured storage documents under *nix References: <88256874.00095CFE.00@avnet.com> <86sh5v$r9o$1@netserv.univ-lille1.fr> Message-ID: "Daniel Calvelo" wrote in message news:86sh5v$r9o$1 at netserv.univ-lille1.fr... > 2. Otherwise, you can try to rewrite in Python the OLE::Storage > module from Perl. Does that work places other than Windows? If not, win32com should be just as good... Mark. From akuchlin at mems-exchange.org Fri Feb 25 17:57:30 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 25 Feb 2000 17:57:30 -0500 Subject: Maintainer needed for cursesmodule Message-ID: <3d66vcj3fp.fsf@amarok.cnri.reston.va.us> The curses module included in Python 1.5 isn't actively maintained by anyone at the moment; no changes have been made to it for over a year, and little serious development has been done on it since 1995. It seems likely that the module will be unbundled from Python 1.6, and made available for separate download. A fancier module for ncurses has been written, so cursesmodule.c's compatibility with BSD curses is no longer very interesting, except to people on really old systems. So, if anyone would like to take over maintenance of the module, please send me an e-mail. Many thanks to Lance Ellinghouse for originally writing cursesmodule, back in 1994. -- A.M. Kuchling http://starship.python.net/crew/amk/ "That which doesn't kill us makes us stronger." That's as maybe. But that which does kill us kills us, and ain't that a bitch... -- The dying film director in SIGNAL TO NOISE From tjg at avalongroup.net Thu Feb 24 15:44:33 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Thu, 24 Feb 2000 12:44:33 -0800 Subject: Best way to find unique items in a list References: Message-ID: <38B59831.FDF0FD5@exceptionalminds.com> maxm wrote: > Anyone for a little brain gym? > > ------------------------------------------ > > def Unique(theList): > uniqueList = [] > OldValue = '' > theList.sort() > for value in theList: > if OldValue != value: > uniqueList.append(value) > OldValue = value > return uniqueList > > print Unique(['Max','Gitte','Magnus','Caroline','Clara','Max','Gitte']) How about... def Unique(theList): uniqueList = [] for value in theList: if value in uniqueList: continue uniqueList.append(value) return uniqueList -- Stand Fast, tjg. Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From robin at alldunn.com Wed Feb 16 17:59:22 2000 From: robin at alldunn.com (Robin Dunn) Date: Wed, 16 Feb 2000 14:59:22 -0800 Subject: BSDDB Pack function? References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> <38aa0248.419826718@news1.on.sympatico.ca> Message-ID: "Robert Roy" wrote in message news:38aa0248.419826718 at news1.on.sympatico.ca... > (from Robin's Reference Guide) > > ref B-Tree dbs > > Space freed by deleting key/data pairs from the database is never > reclaimed from the filesystem, although it is reused where possible. > This means that the btree storage structure is grow-only. If > sufficiently many keys are deleted from a tree that shrinking the > underlying database file is desirable, this can be accomplished by > creating a new tree from a scan of the existing one. > If you built the utilities in the Sleepycat DB package then you also have db_dump and db_load which can do a database rebuild for you. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From effbot at telia.com Mon Feb 21 16:53:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 21:53:29 GMT Subject: PIL photocd loading References: Message-ID: Kevin Cazabon wrote: > wrote in message news:ud7pumqnr.fsf at cs.uu.nl... > > Has anybody succeeded in loading photocd files with PIL? > > When I trie this, Python crashes with a memory access violation. > > This is on Windows NT with PIL 1.0 (Nov 99). > PIL can read PCD files that are in RGB format only... unfortunately > 'standard' PCD images are saved in YCC format... so, I have never been able > to read a 'standard' PCD image. umm. not entirely correct. PIL is supposed to convert PhotoYCC images to RGB on the way in. in other words, Piet's problem sure looks like a bug to me. I'll look into it. From moshez at math.huji.ac.il Tue Feb 15 10:58:11 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 15 Feb 2000 17:58:11 +0200 (IST) Subject: IDLE and Hooks in apps for usage of My Favorite Editor In-Reply-To: <14505.28201.692698.777047@beluga.mojam.com> Message-ID: [Moshe, about EMACS and XML-RPC] > Moshe> weekend. By that time, EMACS will have about 5 modes which > Moshe> support it, of course. [Skip, proving him right] > I could have sworn I saw XML-RPC for Emacs mentioned somewhwere. Try > searching the archives at http://www.xmlrpc.com/. remind-me-to-thank-guido-for-letting-me-use-his-time-machine-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From nielsenjf at my-deja.com Fri Feb 25 17:05:11 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Fri, 25 Feb 2000 22:05:11 GMT Subject: msvcrt, open_osfhandle, locking References: <68Hs4.1435$LX4.4374@news-server.bigpond.net.au> <06db8d30.f0a3be48@usw-ex0105-038.remarq.com> Message-ID: <896uaj$bhv$1@nnrp1.deja.com> If you don't mind win32 calls, you can also use CreateFile and LockFileEX to do flock style locking. There's an example of it in the win32 overviews section of pythonwin (if you have a recent version). john In article , "Jeff Kunce" wrote: > > >Oops - meant "locking function in msvcrt module" > > > > Hmmm. Do you have an example? I can't get it to work. > > A while back I wanted file locking with the same API > on both unix and NT. I worked up something based on > posixfile, that uses msvcrt on the NT side. I never used it > production, so handle with care, but it might give you > some ideas. See: > ntposixfile.py > at: > http://starship.python.net/crew/jjkunce/ > > --Jeff > > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Thu Feb 3 04:54:16 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 3 Feb 2000 04:54:16 -0500 Subject: Language Challenge 2000 In-Reply-To: <87bhs0$nvg$1@mach.vub.ac.be> Message-ID: <000101bf6e2c$a1d3ec60$422d153f@tim> > bvoh at sdynamix.com wrote: > : Language Challenge 2000 > > [snip] > > : The overall winner will receive: > > : Compaq Visual Fortran V6.1 -- Professional Edition [Thomas Hamelryck] > This is a joke right? The winner receives a Fortran compiler???? > ROTFL! Well, given the nature of the problem, it's likely that the winning entry will be written in Fortran. We could get some mixed publicity of our own by offering a free Python download to the slowest entry! those-numpy-folks-are-so-easy-to-provoke-ly y'rs - tim From avv at quasar.ipa.nw.ru Tue Feb 29 14:54:50 2000 From: avv at quasar.ipa.nw.ru (Alexander V. Voinov) Date: Tue, 29 Feb 2000 11:54:50 -0800 Subject: Which GUI? References: Message-ID: <38BC240A.3E6A1775@quasar.ipa.nw.ru> Vadim Zeitlin wrote: > Sorry, I have to correct you here. wxWindows does not support text mode UI > and neither does wxPython. This could be done (and I wanted to do it at one > moment), but more time passes, less chances there are that it will ever > happen. I would love to be able to have wxCurses port, but there is apparently > not enough interest in it. It might be more interesting if used SLang directly. In that case it would automatically target a bit more text-mode "platforms", e.g. win32 console. Regards Alexander From anders.eriksson at morateknikutveckling.se Wed Feb 2 08:31:32 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Wed, 02 Feb 2000 14:31:32 +0100 Subject: Am I programming in Python mode? Message-ID: <4TCYOB7LsZetOVPsMbGsNhmZpfcB@4ax.com> Hello! Being new to Python I would like your comments on this function. Is it written in Pytnon mode? The function returns a random string, and have 3 params the lenght of the string, lowercase/Uppercase and dublicates Any comments and/or suggestions are welcome!! // Anders def randStr(n, lower=1, dublicates=1): # returns a random string with characters # lower if true only lowercase letters # dublicates if true then the same letter can be repeated if lower: l = ord('a') h = ord('z') else: l = ord('A') h = ord('z') str = "" generator = whrandom.whrandom() for i in range (n): ch = generator.randint(l,h) if dublicates: str = str + chr(ch) else: bRepeat = 1 while bRepeat: if not chr(ch) in str: str = str + chr(ch) bRepeat = 0 else: ch = generator.randint(l,h) return str From paul at prescod.net Wed Feb 9 10:49:04 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 07:49:04 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> Message-ID: <38A18C70.C17BB420@prescod.net> Neel Krishnaswami wrote: > > ... > > So, basically, I don't care if Lisp never becomes "mainstream", if it > means giving up what makes Lisp powerful and useful. Most people do not have the choice of using languages that they cannot "sell" to their co-workers and customers. Python is a hard sell politically, but easy technically. People roll their eyes as soon as you mention Lisp. It's usually an impossible sell. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made the modern world possible. - The Advent of the Algorithm (pending), by David Berlinski From gmcm at hypernet.com Thu Feb 3 16:42:32 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 3 Feb 2000 16:42:32 -0500 Subject: Ann: PMZ - Poor Man's Zope In-Reply-To: <3899EB3A.F72972FA@prescod.net> Message-ID: <1262508367-6369026@hypernet.com> Paul Prescod wrote: > Does it makes sense for there to be PMZ, DTML (two variants!), Python in > ASP and Python Server Pages? Is there a need for a new > python-in-html-sig to standardize this stuff? Hmm. Looks to me like PMZ runs anywhere, DTML in Zope, ASP under IIS and PSP under a servlet style web server. > It's none of my busiess > since I don't use any of them but it must be awfully confusing for > people who just want to do ASP-like stuff in Python. Of course it is! How many parsers do you have over there in XML-land? - Gordon From skip at mojam.com Tue Feb 8 12:28:55 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 8 Feb 2000 11:28:55 -0600 (CST) Subject: Several questions: python plugin, xml-rpc + Medusa In-Reply-To: <38A01C84.88229E45@ttm.com> References: <38A01C84.88229E45@ttm.com> Message-ID: <14496.21079.898203.98612@beluga.mojam.com> Scott> Second question: has anyone melded the xmlrpclib stuff to Medusa Scott> yet, other than Zope? If I were to need something like that, Scott> should I just use Zope? I'm trying to keep things lightweight, Scott> and I don't need the full-fledged Zope framework (which is verra, Scott> verra nice, but the master of the castle already has one, you Scott> see...) I use the ZServer component of Zope with XML-RPC without using all of Zope. ZServer is built on Medusa, so it would appear the good folks at Digital Creations have already done the legwork you require. Scott> Thirdly: SOAP sounds interesting as well. Is SOAP as Scott> cross-language portable as XML-RPC? I can do the latter in Scott> Python, Perl, Java, etc... what has SOAP been implemented for at Scott> this juncture? SOAP implementations aren't as mature as XML-RPC yet. I stopped looking fairly early on because all the stuff I saw floating around required Internet Explorer or Perl. Fredrik Lundh is/was working on a Python interface to SOAP, but I don't know the status. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ 847-971-7098 "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From rdudfield at my-deja.com Thu Feb 10 22:23:07 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Fri, 11 Feb 2000 03:23:07 GMT Subject: Bit arrays. Message-ID: <87vvao$di4$1@nnrp1.deja.com> Hello, Just wondering if there is an efficient way in python to represent arrays or lists of bits? The way that I am thinking of doing it is to make a class in python and do the following: Have set and get methods for arbitary places in the array. It would store the data in an array of ints ( not sure what size yet ). The best size would depend on how you change/read the array. The set method would be implemented in the following way: *Find which element in the array of ints that the bit is in. *Convert that int into a tupple/list/array of 1s and 0s. *Find which place in the new list of 1s, and 0s the bit which needs changing. *Change that bit. *Convert the list back into a number. Get would be similar. I know this would be quite slow if you are doing lots of changes all over the array, but I am changing large ranges of bits at a time so it should be possible to cut out lots of conversions. Anyone think of better ways to do this? It would probably be worth doing this as a module in c/c++ no? Thanks in advance for any help. Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From hathawa2 at marshall.edu Thu Feb 10 11:49:08 2000 From: hathawa2 at marshall.edu (Mark Hathaway) Date: Thu, 10 Feb 2000 11:49:08 -0500 Subject: FormattedText class Message-ID: <38A316C3.B20@marshall.edu> Hello all, I'm still new to Python, but a newbit question about wrapping text interested me, so I wrote a class "FormattedText" and submitted it on the comp.lang.python.announce newsgroup. Perhaps this has all been done before, but I thought I'd submit it anyway. It might be of use to someone. Mark From bela_b at gmx.net Wed Feb 9 11:29:33 2000 From: bela_b at gmx.net (Bela Bauer) Date: Wed, 09 Feb 2000 17:29:33 +0100 Subject: CGI Scripts References: Message-ID: <38A195ED.174923EC@gmx.net> Robert Rutkowski wrote: > > Is it possible the server does not have the cgi or string modules installed? > How would I find out what is there? If you have telnet access, you could try to import the string or cgi modules in the interpreter. Otherwise - I don't know ;-). But if they are not there, the server should produce an Internal Server Error - not a blank page. And I think there is no python interpreter without the modules string and cgi! Bela From quinn at krone.ugcs.caltech.edu Fri Feb 18 01:34:37 2000 From: quinn at krone.ugcs.caltech.edu (Quinn Dunkan) Date: 18 Feb 2000 06:34:37 GMT Subject: Python misconceptions in IBM Ruby article... References: <1261277864-11095295@hypernet.com> Message-ID: On Thu, 17 Feb 2000 22:31:34 -0500, Gordon McMillan wrote: >In a language where variables don't have to be declared, >creating scoping rules that could tell the difference between an >instance variable and a local would be a, um, challenge. You might have to do something weird like stick a '@' in front of your variable. From aahz at netcom.com Thu Feb 3 11:26:27 2000 From: aahz at netcom.com (Aahz Maruch) Date: 3 Feb 2000 16:26:27 GMT Subject: Vaults of Parnassus problem References: <3899A4F3.76F8FD8A@hotmail.com> Message-ID: <87ca7j$ela$1@nntp3.atl.mindspring.net> In article <3899A4F3.76F8FD8A at hotmail.com>, Kim Friesen wrote: > >Is anyone having problems accessing the Python modules at the vaults of >parnassus ??? You're the second person in a couple of weeks to mention this, and again it works for me. Either there's a regular transient problem at vex.net or there's some weird network problem. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From 55555 at dakotacom.net Mon Feb 14 21:08:32 2000 From: 55555 at dakotacom.net (55555) Date: 14 Feb 2000 20:08:32 -0600 Subject: os.shell, recursion, encryption References: <38a79bec_3@news5.newsfeeds.com> Message-ID: <38a8b520_2@news5.newsfeeds.com> Thanks for the lesson. It's a little clearer, but now I question whether this can be used for what I want to do. It seems like popen creates a file. I don't want to do that. Instead, I'd like to simply run a commercial program with a command like 'pkzip asdf.zip *.*'. I gave the following a try and it came back with "bad command or filename." Am I on the right path or should I be using a different function than popen? os.system() doesn't work and I don't know what mode to use for spawnv. Thanks again. import os zipExe='c:/progra~1/pkzipdos/pkzip.exe' os.popen('> '+zipExe+' asdf.zip *.*', 'w') On Mon, 14 Feb 2000 20:44:45 GMT, wware at world.std.com (Will Ware) wrote: > 55555 (55555 at dakotacom.net) wrote: > : How does os.popen work? I'm afraid that I don't understand pipes. > > Caveat: I'm a Unix guy, pretty clueless about Windows, and this may > all be Unix-ish stuff. > > When you open a file for reading, the file becomes a source of bytes. > You read the bytes in sequence and there is some testable condition > to tell you when there are no more bytes. Since many files are text, > it's often convenient to take the bytes in lines. So you often see > idioms like this: > > f = open('somefile') > for L in f.readlines(): > .... do something with L .... > f.close() > > or more tersely: > > for L in open('somefile').readliines(): > .... do something with L .... > > In this latter case, the opened file should automatically be closed > when it gets garbage-collected. (Whether that happens, or the > conditions under which it might not, is another question for subtler > minds than mine.) > > In Unix, many programs (particularly ones that operate on text) are > written to look like filters, meaning that they accept a stream of > bytes from elsewhere and produce a stream of bytes that can go to > yet somewhere else. Each such program has "standard input" and > "standard output". Output from one program can be directed to the > input of another, and hence the term "pipe", just like in plumbing. > So you see constructs like this: > filter1 < infile | filter2 | filter3 | filter4 > outfile > And this means that the contents of 'infile' are run thru all four > filters in succession, and the results end up in 'outfile'. > > Python, too, can accept input from a chain of filters, so I can > type something like this: > > p = os.popen('filter1 < infile | filter2 | filter3 | filter4') > for L in p.readlines(): > ... do stuff with L ... > p.close() > > and this means that I want, as input, the stuff that would have > been dumped into 'outfile' in the earlier example. > > Sorry if this seems circuitous and long-winded (and I'm _really_ > sorry if none of this is meaningful in the Windows world), but this > saves you the hassle of creating a bunch of intermediate files to > catch the output at each stage in the pipeline. (Essentially Unix > is creating those files itself and keeping track of them without > bothering you with the details, and they all disappear when you're > finished.) > > I suspect Python would also be happy with an output pipe, something > where you'd be writing to the front of a pipeline like this: > > p = os.popen('filter1 | filter2 | filter3 | filter4 > outfile', 'w') > for : > ... > p.write(....) > p.close() > > but I've never myself written that, that I can recall. > > -- > -- I can picture in my mind a world without war, a world without hate. And -- > -- I can picture us attacking that world, because they'd never expect it. -- > Will Ware - N1IBT - wware at world.std.com -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From aa8vb at yahoo.com Fri Feb 25 08:26:11 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 25 Feb 2000 08:26:11 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: References: Message-ID: <20000225082611.B3300986@vislab.epa.gov> Fran?ois Pinard: |> (add-hook 'python-mode-hook '(lambda () |> (save-window-excursion |> (py-shell) |> (local-unset-key "\C-c\C-c") |> (local-set-key "\C-c\C-s" |> 'comint-interrupt-subjob)))) This thread has been very useful. While we're on the subject, is there a way to have Emacs fontify the >>> Python prompt in a py-shell? For shell-mode, I have: (setq shell-font-lock-keywords ... '("^.+ : .+ >" . font-lock-function-name-face) ... ) which colorizes my prompt. There is no "py-shell-font-lock-keywords" that I noticed. Thanks, Randall -- Randall Hopper aa8vb at yahoo.com From robin at jessikat.demon.co.uk Tue Feb 8 15:13:11 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Tue, 8 Feb 2000 20:13:11 +0000 Subject: PIL & Tk8.2 References: Message-ID: In article , Fredrik Lundh writes >Robin Becker wrote: >> has anyone got a Tk8.2 compatible version of PIL? > >afaik, PIL 1.0 works just fine with Tk 8.2. > >http://www.pythonware.com/products/pil > >(no, we don't have a prebuilt version available >right now. we downgraded to 8.0.5 after getting >way too many inexplicable crashes. maybe some- >one else have had more luck?) > > > > I guess I'm being stupid I have the down loaded version marked named pil-win32-991101.zip this contains pyds/dlls dependant on tcl80/tk80.dll I guess I need to compile from the source. -- Robin Becker From gerrit.holl at pobox.com Wed Feb 23 15:23:30 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 21:23:30 +0100 Subject: Tkinter installation problems In-Reply-To: ; from pinard@iro.umontreal.ca on Wed, Feb 23, 2000 at 03:03:05PM -0500 References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <20000223201942.A4980@stopcontact.palga.uucp> Message-ID: <20000223212330.A6070@stopcontact.palga.uucp> > Gerrit Holl writes: > > > [...] here to explain how FURIOUS I am! No smiley can help you! > > [...] ABSOLUTLY RIDICULOUS. > > Eh, oh, eh! Relax... This is the Python list: a good place to be! > > If you loose your temper, you make the place a bit less comfortable to > everybody, and this is unfair, because I am still a nice guy. :-) Ok, maybe I shouldn't have CC'ed this to the list. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From collins at rushe.aero.org Thu Feb 24 18:00:21 2000 From: collins at rushe.aero.org (JEFFERY COLLINS) Date: Thu, 24 Feb 2000 15:00:21 -0800 Subject: Python for Palm update Message-ID: <200002242300.PAA12687@rushe.aero.org> Jeff Kunce wrote: >> I have an unreleased (alpha) python-1.5.1 port that will run on >> PalmIII's and greater. It runs a subset of the test suite > >I thought Joey Gibson's post about Pocket Smalltalk >(www.pocketsmalltalk.com) was intriguing. It looks like you write >smalltalk in the development environment, but it generates Palm code >for the runtime. > >How does your python for palm compare to this approach? Palm applications are built in a manner analogous to Guido's freeze mechanism. The target module (and possible supporting modules) is compiled and placed in a palm resource along with PilotMain wrapper to create a standalone palm application. When executed, PilotMain initializes the Python interpreter (which is stored in multiple GLib shared libaries) and then calls the interpreter on the code stored in the resource. Though I haven't done it, a driver application could be built for loading and executing a module selected from a list stored in database. Note that I am working on the 1.5.2+ port and will not be releasing the 1.5.1 port - it has too many problems that have now been fixed in both python and the porting tools. Jeff From charleshixsn at earthlink.net Mon Feb 14 13:39:08 2000 From: charleshixsn at earthlink.net (Charles Hixson) Date: Mon, 14 Feb 2000 18:39:08 GMT Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> <38A24345.3F763311@Lugoj.Com> Message-ID: <38A84BB7.872BE01D@earthlink.net> I think that this change would be better supported by an editor than by a language. As such, any language with a well-delimited structure could be used as a basis, but the displayed code would not match the saved code. (Saving those boxes seems quite excessive.) James Logajan wrote: > Wake me when the other thread dies. > > Off topic: > By the way, speaking of code blocks, does anyone know of any languages that > use blocks...literally? That is, given the prevalence of GUIs, a development > environment/language where code is contained in rectangles? For example (the > following will need to be viewed using a fixed-width font): > > +====================+ > | def Func(a, q) | > +====================+ > | if a == b | > | +----------------+ | > | | xyzzy = Plunk()| | > | | w = xyzzy + 42 | | > | | | | > | +----------------+ | > | else | > | +----------------+ | > | | w = sqrt(-1) | | > | +----------------+ | > | return q/w | > +--------------------+ > > Anyway, hope you get the idea. Many variations on how the boxes should > appear are possible. From python-list at teleo.net Sat Feb 12 13:02:56 2000 From: python-list at teleo.net (Patrick Phalen) Date: Sat, 12 Feb 2000 10:02:56 -0800 Subject: dynamic html with python In-Reply-To: <38A57B53.D2A2DE73@regnoc.com> References: <38A57B53.D2A2DE73@regnoc.com> Message-ID: <0002121004350I.02623@quadra.teleo.net> [Jim Conger, on Sat, 12 Feb 2000] :: :: I'm running a linux server with appache for the static web pages. I :: would like to link from one of these static pages to dynamically :: generated html from a python script. The script would then take care of :: both input and html output for that section. I have a number of :: programming examples of how to generate a simple python http server, but :: I can't figure out how to launch that activity from within a static html :: page. Take a look at: http://www.zope.org http://www.suxers.de/pmz.htm From neelk at brick.cswv.com Thu Feb 3 19:25:50 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 4 Feb 2000 00:25:50 GMT Subject: Haskell or Python! References: <38994478.72056B85@cui.unige.ch> <3mdm4.17496$3b6.72189@ozemail.com.au> Message-ID: Jason Stokes wrote: > Sunil Hadap wrote in message <38994478.72056B85 at cui.unige.ch>... > > > >- Can I use traditional OO concepts in Haskell though it is Functional > > Yes. Haskell is fully object oriented. Is this true? Haskell has overloading, but its type system doesn't support subtyping, and overloaded methods are chosen at compile time rather than based on the runtime type. Instead, you use pattern matching to replace what subtyping and runtime method selection give you in OO languages. It's all very slick, but it doesn't feel very OO to me. Haskell is just put together in a different (but not worse) way. Neel From effbot at telia.com Mon Feb 28 10:53:19 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 15:53:19 GMT Subject: MFC References: <894hee$12g$1@isn.dac.neu.edu> Message-ID: Eric Kappotis wrote: > Is there anyway I can use Microsoft Foundation Classes > to create a GUI with python http://www.python.org/windows/pythonwin/ http://starship.python.net/crew/mhammond/ From bjorn at roguewave.com Wed Feb 16 16:36:03 2000 From: bjorn at roguewave.com (bjorn) Date: Wed, 16 Feb 2000 14:36:03 -0700 Subject: Is there a python equivalent of the perl... References: <38AB1376.515C9A59@austin.ibm.com> Message-ID: <38AB1842.4AF85B0C@roguewave.com> The profiler might do what you want (it's fully described in the manual). -- bjorn "David R. Favor" wrote: > Benchmark.pm module, to allow benchmarking arbitrary > snippets of code? > > Thanks. > > -- > http://www.python.org/mailman/listinfo/python-list From gerrit.holl at pobox.com Sat Feb 12 05:39:35 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 11:39:35 +0100 Subject: Tkinter manual!! In-Reply-To: ; from embed@geocities.com on Tue, Feb 08, 2000 at 09:00:31AM -0500 References: <389CD4A6.DA550F53@americasm01.nt.com> Message-ID: <20000212113935.C1007@stopcontact.palga.uucp> Warren Postma wrote on 949996831: > > "Fredrik Lundh" wrote in message > news:Usan4.94$EGn.169930240 at newsa.telia.net... > > Chadha, Saurabh wrote: > > > Can anybody mail be a postscript of the Tkinter manual, the one on > > > the python.org site, i am not able to print it because of some CS8 > missing > > > error from acroread. > > > > get acrobat 4.0 and those problems will go away: > > http://www.adobe.com/products/acrobat/readstep.html > > I have Acrobat 4.0 and it prints all the python manuals as a bunch of > accented vowels (a,e,i,o,u) plus typographic symbols and dingbats. :-( Me too. I think it should be published in the original Docbook format too, since people can generate their favorite format AND contribute to the manual than. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From steffen at cyberus.ca Thu Feb 10 07:32:17 2000 From: steffen at cyberus.ca (Steffen Ries) Date: 10 Feb 2000 07:32:17 -0500 Subject: ZOPE and ILU? Message-ID: Hi, I'm trying to hook up external CORBA objects to Zope, using ILU. I can't believe that I'm the first one to try that. Is there anybody out there, who can give me some hints? tia, /steffen -- steffen at cyberus.ca <> Gravity is a myth -- the Earth sucks! From rjschwei at mindspring.com Fri Feb 18 21:10:44 2000 From: rjschwei at mindspring.com (Robert Schweikert) Date: Fri, 18 Feb 2000 21:10:44 -0500 Subject: Numerical Python install problem Message-ID: <38ADFBA4.55729EB4@mindspring.com> Hello, I am running Python 1.5.2 on RH 6.1 distro. Used the Python rpm to get it running instead of building it myself. I also installed the Distutils with no problem. But now when I try to install Numerical Python Version 14 I get the following errors: python setup.py build install running build running build_py not copying Lib/ArrayPrinter.py (output up-to-date) not copying Lib/FFT.py (output up-to-date) not copying Lib/LinearAlgebra.py (output up-to-date) not copying Lib/MLab.py (output up-to-date) not copying Lib/Matrix.py (output up-to-date) not copying Lib/Numeric.py (output up-to-date) not copying Lib/Precision.py (output up-to-date) not copying Lib/RandomArray.py (output up-to-date) not copying Lib/UserArray.py (output up-to-date) running build_ext gcc -c -I/usr/include/python1.5 -IInclude -g -O2 -fPIC Src/_numpymodule.c Src/arrayobject.c Src/ufuncobject.c In file included from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from /usr/include/python1.5/Python.h:59, from Src/_numpymodule.c:1: /usr/include/linux/errno.h:4: asm/errno.h: No such file or directory In file included from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from /usr/include/python1.5/Python.h:59, from Src/arrayobject.c:17: /usr/include/linux/errno.h:4: asm/errno.h: No such file or directory In file included from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from /usr/include/python1.5/Python.h:59, from Src/ufuncobject.c:14: /usr/include/linux/errno.h:4: asm/errno.h: No such file or directory Traceback (innermost last): File "setup.py", line 29, in ? ext_modules = [('_numpy', File "/usr/lib/python1.5/site-packages/distutils/core.py", line 97, in setup dist.run_commands () File "/usr/lib/python1.5/site-packages/distutils/core.py", line 526, in run_commands self.run_command (cmd) File "/usr/lib/python1.5/site-packages/distutils/core.py", line 575, in run_command cmd_obj.run () File "/usr/lib/python1.5/site-packages/distutils/command/build.py", line 54, in run self.run_peer ('build_ext') File "/usr/lib/python1.5/site-packages/distutils/core.py", line 886, in run_peer self.distribution.run_command (command) File "/usr/lib/python1.5/site-packages/distutils/core.py", line 575, in run_command cmd_obj.run () File "/usr/lib/python1.5/site-packages/distutils/command/build_ext.py", line 150, in run self.build_extensions (self.extensions) File "/usr/lib/python1.5/site-packages/distutils/command/build_ext.py", line 213, in build_extensions include_dirs=include_dirs) File "/usr/lib/python1.5/site-packages/distutils/unixccompiler.py", line 153, in compile self.spawn ([self.cc] + cc_args) File "/usr/lib/python1.5/site-packages/distutils/ccompiler.py", line 431, in spawn spawn (cmd, verbose=self.verbose, dry_run=self.dry_run) File "/usr/lib/python1.5/site-packages/distutils/spawn.py", line 35, in spawn _spawn_posix (cmd, search_path, verbose, dry_run) File "/usr/lib/python1.5/site-packages/distutils/spawn.py", line 121, in _spawn_posix raise DistutilsExecError, \ distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1 which gcc /usr/bin/gcc Any ideas wht could be going on here? Thanks, Robert -- Robert Schweikert rschwei at mindspring.com From hanselj at mindspring.com Sun Feb 13 14:11:34 2000 From: hanselj at mindspring.com (hanselj at mindspring.com) Date: Sun, 13 Feb 2000 14:11:34 -0500 Subject: New to programming and python References: <886vdb$slk$1@nntp8.atl.mindspring.net> Message-ID: <886vhp$qr9$1@nntp8.atl.mindspring.net> Sorry, what is the best python book for newbies. wrote in message news:886vdb$slk$1 at nntp8.atl.mindspring.net... > I have one question; What is the book python book for newbies. > > From hanselj at mindspring.com Sun Feb 13 14:09:12 2000 From: hanselj at mindspring.com (hanselj at mindspring.com) Date: Sun, 13 Feb 2000 14:09:12 -0500 Subject: New to programming and python Message-ID: <886vdb$slk$1@nntp8.atl.mindspring.net> I have one question; What is the book python book for newbies. From amused at webamused.com Tue Feb 8 21:09:48 2000 From: amused at webamused.com (Joshua Macy) Date: Wed, 09 Feb 2000 02:09:48 GMT Subject: Which Python book? References: <85035b$1sb$1@bignews.shef.ac.uk> <850pt8$qv9$1@nnrp1.deja.com> <852g8h$75@gap.cco.caltech.edu> <86fl0m$gmj$1@inputplus.demon.co.uk> <86kqtq$6kq$1@jaffa.itower.net> <38A0B834.DF6BBAC6@netscape.com> Message-ID: <38A0C9EF.F81FAC8E@webamused.com> Dan Christian wrote: > > There is also a "Pocket Python" book that I can never seem to find my > way around. Maybe I just haven't used it enough to grok the > organization. I never take my computer anywhere without one of my copies of Python: Pocket Reference in the pouch. Perhaps someday I'll have absorbed it so thoroughly that I don't need it, but until then I'm always reaching for it. The organization is quite simple: it's exactly what's in the Table of Contents. That's not as flip as it sounds; unlike, say, Programming Python, I've never been at a moment's loss as to where to find a bit of knowledge based on nothing more than the section title as listed in the Table of Contents. An index would be gilding the lilly. Joshua From echeverria at interactiva.cl Sat Feb 19 01:52:49 2000 From: echeverria at interactiva.cl (Cristian Echeverria) Date: Sat, 19 Feb 2000 02:52:49 -0400 Subject: ODBC, mxODBC problem References: <88jk4o$vsg$1@nnrp1.deja.com> Message-ID: <38ae2f29@omega> If you are on Win9X try this db = ODBC.Windows.Connect("express","","",0) escribi? en el mensaje de noticias 88jk4o$vsg$1 at nnrp1.deja.com... > I've been tinkering with both ODBC and mxODBC modules with no success > for the past 24 hours. > > I tried this with the ODBC module: > > import cgi,dbi,odbc > db=odbc.odbc("express") > # no UID, no PWD > > Traceback (innermost last): File "d:\the-cafe\cgi-bin\express.py", line > 25, in ? db=odbc.odbc("express") dbi.operation-error: [Microsoft][ODBC > Microsoft Access 97 Driver] The Microsoft Jet database engine cannot > open the file '(unknown)'. It is already opened exclusively by another > user, or you need permission to view its data. in LOGIN > > I tried the mxODBC variant with not much success. > > The "express" MS Access database is on a network share: > \\core\e$\express\express.mdb > > The System DSN was not opened at all exclusively and I haven't been > having problems accessing the same using Perl ODBC. Help! > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From thamelry at vub.ac.be Wed Feb 9 04:03:12 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 9 Feb 2000 09:03:12 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87on3m$p2i$1@mach.vub.ac.be> Message-ID: <87ragg$chc$1@mach.vub.ac.be> Dennis Lee Bieber wrote: [snip] : The same way the DEC (Compaq ) folks can explain that a : Fortran program can have errors which are not visible if the source is : printed on paper. [snip] Well, that supports my point since I think FORTRAN is an abomination. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From carpenterasNOcaSPAM at mpco.com.invalid Thu Feb 10 13:12:12 2000 From: carpenterasNOcaSPAM at mpco.com.invalid (ASCarpenter) Date: Thu, 10 Feb 2000 10:12:12 -0800 Subject: COM and python References: <04e9bbf8.f292f07f@usw-ex0106-048.remarq.com> Message-ID: <01ebce32.91d2bd51@usw-ex0106-048.remarq.com> OK, thanks Mark, I'll give it a try. You assumed correct by the way. It's a C++ COM component with no support for IDispatch. Andrew * 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 bparsia at email.unc.edu Wed Feb 9 20:51:12 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 20:51:12 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <87sk1p$o5h$1@nntp6.atl.mindspring.net> Message-ID: <1e5r2o4.14puk8l1i1mb9N%bparsia@email.unc.edu> Aahz Maruch wrote: > In article <38A19E79.5E88D2FC at prescod.net>, > Paul Prescod wrote: > > > >This annoys me not only because it holds the ideas in Smalltalk back > >from popularity but because it strikes me as arrogant. Squeak's > >designers think that they are so much smarter than the rest of us that > >they must "correct" every decision we have ever made including what side > >the scrollbar should live on. Er... 1) left flappable scrollbars antedate just about every other scollbar placement decision; the reason they're still there in Squeak is that Squeak started with the old Apple Smalltalk-80 system. So, *literally*, it's legacy code. I've grown quite used to it, though it did freak me out at first. 2) There's a simple preference to change scrollbar placement to inboard, right side. This works in the Morphic environment (which is the active one). There are goodies to do similar things in the MVC environment. Paul, please spent a modicom more time on research before making claims about people's motives and attitudes. Thanks. > >Just give me a programming language > >please! Gnu Smalltalk. Little Smalltalk. There are smalltalks without IDEs. There are a (very) few people who even use Emacs. Many of the extant implementations can be made headless with various support for alternative interaction with the system. I won't go into the history. >> You'll see more of that arrogance on www.smalltalk.org . One site. Run by one person. An advocacy site, no less. Lovely generalization. Methinks that there are many arrogances to be found in many places. > I'll say. I went there to further my self-education only to find that > the official FAQ is only available in PDF and Postscript. It's not official. It's *an* FAQ. There are several. FAQs in general are services to the community. Plus, with a little searching, you can find HTML ones. I'd dearly love to say something snarky about someone trying to "further" their "self education" who 1) can't make it any further than that, and 2) instead of asking someone for aid gets all huffy and posts derogatory comments. But, I shan't :) > They had the > nerve to suggest that people wishing to post on the newsgroups read the > FAQ first. As is standard. Standard *netiquette*. And plain good sense. I'm done. Cheers, Bijan Parsia. From moshez at math.huji.ac.il Sun Feb 27 00:42:14 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 07:42:14 +0200 (IST) Subject: Fun w/ lazy streams (was RE: functional programming) In-Reply-To: <000001bf80bf$72946560$7da2143f@tim> Message-ID: Just one thing bugged me: [Tim Peters] > def sintersect2(s, t): > """s, t -> stream intersection. > > s and t are increasing streams. Return the increasing > stream containing the elements they have in common. > """ > > while 1: > s1, t1 = s.head(), t.head() > if s1 == t1: > break > elif s1 < t1: > s = s.tail() > else: > t = t.tail() > return Stream(s1, lambda s=s, t=t: > sintersect2(s.tail(), t.tail())) Tim, with the natural implementation of even_stream, and odd_stream, you do realize (of course you do) that sintersect2(even_stream, odd_stream) is a good old fashioned infinite loop? (What's more : sintersect2(even_stream, prime_stream) is not an infinite loop, but taking its tail *is*) I sort of wonder how common this bug is in Haskell: it doesn't *look* like an infinite loop. BTW: It reminded me of implementing the same thing in Scheme, where everything is natural as breathing (with a snorkel, and through the ears, but what the heck ) I actually think it was the same thing, except I didn't implement intersect (probably unconcious fear of the infinite loop) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit.holl at pobox.com Sun Feb 13 14:18:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 13 Feb 2000 20:18:12 +0100 Subject: PROPOSAL: fix tabs & spaces in default library Message-ID: <20000213201812.A4849@stopcontact.palga.uucp> Hello, in the default library reference, almost all modules are indented with four spaces, but not all. What about running a script on it so they are all indented four spaces? regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From z3penguin at z3penguin.com Sat Feb 19 17:19:16 2000 From: z3penguin at z3penguin.com (Z Three Penguin) Date: Sat, 19 Feb 2000 17:19:16 -0500 Subject: Interactive programs through Popen3 Message-ID: <88n50e$h29$1@bob.news.rcn.net> When I try to run an interactive program (such as pico), reading the file object hangs the interpreter. The code is: import popen2 s=popen2.Popen3("pico") while s.poll()==-1: print s.fromchild.read() a=raw_input() s.inchild.write(a) Any ideas? -- -Z3Penguin ------ Z3Penguin Z3Penguin at PenguinPowered.Com http://whitecow.peji.com/ Just because you're paranoid, it doesn't mean they're not after you. Communication is Human, Encryption is Divine Linux. The choice of a GNU generation. Dr. Pepper and doughnuts... because breakfast is the most important meal of the day. ~ . . /V\ got linux? // \\ /( )\ ^`~'^ PGP Fingerprint: A757 001D 58E3 1486 6466 BE35 4E28 A328 90CF 4E88 Obtain my PGP key from: http://whitecow.peji.com/key.asc From akuchlin at mems-exchange.org Mon Feb 7 15:02:14 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 07 Feb 2000 15:02:14 -0500 Subject: PyExpat update References: <389F1CD5.102E6757@prescod.net> Message-ID: <3daelcg4s9.fsf@amarok.cnri.reston.va.us> Paul Prescod writes: >I did some work on pyexpat over the weekend. Modulo bugs I have Yay! Thanks, Paul. > 2. Errors will be returned as strings, not integers. You can check for > 3. There will be no list of exceptions in the modules interface. ... > I would rather move all of these to an "errors" dictionary so they don't > clutter up the main module namespace (after converting them to strings > instead of integers). What's the motivation for using strings instead of integers? If you take your example: > foo = parser.Parse( data ) > if foo is pyexpat.unclosed_token: > print "Oops:"+pyexpat.unclosed_token I'd really much rather write: if foo is pyexpat.UNCLOSED_TOKEN: print 'Oops:', pyexpat.errors[ foo ] That makes it clear that UNCLOSED_TOKEN is a constant. (Losing the 'XML_' prefix from all the errors is definitely a good idea; losing the 'ERROR_' prefix might be not. The above might be clearer if it was pyexpat.ERROR_UNCLOSED_TOKEN or UNCLOSED_TOKEN_ERROR.) I have no problem with cluttering the module's namespace with error constants, if that's the only reason for the change. How would you code error checks with an 'errors' dictionary? (BTW, did you really intend this for python-list?) -- A.M. Kuchling http://starship.python.net/crew/amk/ "You cannot seek Destruction and return unscathed." "Delirium has." "Delirium has been scathed enough in her time." -- Despair and Desire, in SANDMAN #49: "Brief Lives:9" From gerrit.holl at pobox.com Thu Feb 24 16:58:00 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 24 Feb 2000 22:58:00 +0100 Subject: unsubscribe (HOW TO) In-Reply-To: ; from oscar@math.cinvestav.mx on Thu, Feb 24, 2000 at 02:53:01PM -0600 References: Message-ID: <20000224225800.A9257@stopcontact.palga.uucp> > Please somebody tell me how to unsubscribe me of this list. You have to go to the following URL: http://www.python.org/mailman/listinfo/python-list And follow the instructions. BTW, this url is included with every message. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From gerrit.holl at pobox.com Sat Feb 19 04:12:20 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 19 Feb 2000 10:12:20 +0100 Subject: None & Ellipsis In-Reply-To: ; from moshez@math.huji.ac.il on Sat, Feb 19, 2000 at 06:10:18AM +0200 References: <20000218225110.A9409@stopcontact.palga.uucp> Message-ID: <20000219101220.A2136@stopcontact.palga.uucp> Moshe Zadka wrote on 950937018: > On Fri, 18 Feb 2000, Gerrit Holl wrote: > > > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > > >>> t1, t2, None, t4, t5, None, None, t8, None = t > > >>> None > > 'i' > > >>> del None > >>> None > >>> Ah...! Is this behaviour documented! Thanks! regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From python-list at teleo.net Tue Feb 22 16:56:30 2000 From: python-list at teleo.net (Patrick Phalen) Date: Tue, 22 Feb 2000 13:56:30 -0800 Subject: Easy reading HTML? In-Reply-To: References: Message-ID: <00022214104800.01421@quadra.teleo.net> [Martin Sk?tt, on Tue, 22 Feb 2000] :: I am currently in the thinking process of writing a little python :: program to sort my Netscape bookmarks file. It is so smart that this :: bookmark file is a simple HTML file which I am now looking for an easy :: way to read. :: What I need is a function to parse tables which are used to handle :: folders in the menu and tags. In the I need to :: know the address it points to and its title (which is the one I want :: to sort on). :: Do you have any smart ideas you want to share? I guess its htmllib I :: need but I don't know where to start with it. Consider using 4DOM as an alternative to htmllib (or sgmllib). Take a look at http://www.pythonjournal.com/volume1/issue2/art-4dom/ for a nice tutorial. From trentm at ActiveState.com Thu Feb 10 09:19:45 2000 From: trentm at ActiveState.com (Trent Mick) Date: Thu, 10 Feb 2000 14:19:45 -0000 Subject: emacs CC-mode configuration for Python source In-Reply-To: Message-ID: I mean for editting the Python C source code, i.e. the C code for the interpreter (.c and .h files). I was not clear. Yes, I use python-mode for Python script code (.py files). Trent > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Justin Sheehy > Sent: Thursday, February 10, 2000 10:09 PM > To: python-list at python.org > Subject: Re: emacs CC-mode configuration for Python source > > > "Trent Mick" writes: > > > Does anybody have a the proper configuration lisp code for > setting up emacs > > CC-mode to conform with the Python source? It would save me the > trouble and > > slight inconsistencies of figuring out myself. > > Don't use cc-mode, use python-mode. > > http://www.python.org/emacs/python-mode/ > > -Justin > > > > -- > http://www.python.org/mailman/listinfo/python-list > From cgw at fnal.gov Thu Feb 10 15:17:41 2000 From: cgw at fnal.gov (Charles G Waldman) Date: Thu, 10 Feb 2000 14:17:41 -0600 (CST) Subject: problem with setrlimit on Linux 2.2? Message-ID: <14499.7397.57420.918651@buffalo.fnal.gov> I'm sure that just as soon as I press "send", I'll realize that something trivial is wrong with this code: #!/usr/bin/env python import sys,os,resource,signal def sorry(*args): print "Sorry, time's up" signal.signal(signal.SIGXCPU, signal.SIG_IGN) resource.setrlimit(resource.RLIMIT_CPU,(10,10)) s='2L' while 1: print s,'=',eval(s) s=s+'**2L' When I run this, instead of getting the "Sorry, time's up" message my Python process is unceremoniously killed. Python 1.5.2+ (#14, Feb 10 2000, 13:20:30) [GCC 2.95.2 19991024 (release)] on linux2 Linux 2.2.14 #5 SMP Wed Jan 5 15:18:40 CST 2000 i686 unknown glibc-2.1.1-6 Does the above example work for anyone on other platforms? Is this a Linux problem or a Python problem? From sholden at bellatlantic.net Sat Feb 12 14:28:48 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sat, 12 Feb 2000 19:28:48 GMT Subject: Except an exception AND all its subclasses? References: <20000211220612.A7720@stopcontact.palga.uucp> <20000212103039.A755@stopcontact.palga.uucp> Message-ID: <38A5B488.ED170300@bellatlantic.net> Gerrit Holl wrote: > [about the fact that exception subclassing has been present in Python since God was a lad] > > But I think it should really be mentoined in the tutorial, since I did > not feel the need to read this in detail after I read the tutorial. > > regards, > Gerrit. > Right. Put everything in the tutorial, that'll make sure it's completely useless to someone needing ro LEARN Python 8^> The phrase RTFM comes to mind ... although it's great that you can do so much with Python WITHOUT digging into the guts of the documentation. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From digitome at iol.ie Mon Feb 7 14:09:07 2000 From: digitome at iol.ie (Sean Mc Grath) Date: Mon, 07 Feb 2000 19:09:07 GMT Subject: Python XML processing of RSS files References: <87f843$k4u$1@nnrp1.deja.com> Message-ID: <389f1386.1431568@news.iol.ie> On Fri, 04 Feb 2000 19:08:57 GMT, anthonydelorenzo at my-deja.com wrote: > > >I'm working on adding a newsfeed via RSS (rich >site summary) files, which are in XML. > >I've used Pyxie to parse the files and output them >as HTML, which seems to work fine, except that any >character entities (eg ") screw up the >character data for that element. > If you could explain what the problem is I will take a look at. (The pyxie mailing list is probably a better forum for this.) regards, Sean McGrath From michael.stroeder at inka.de Tue Feb 22 02:38:00 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Tue, 22 Feb 2000 08:38:00 +0100 Subject: eqiv of perl's CGI.pm? References: Message-ID: <38B23CD8.8C2DE915@inka.de> "Harry G. George" wrote: > > I have the opportunity to convert a lot of perl cgi's to python. But > I need to make them look similar to perl's CGI.pm API. (The users have > just barely gotten comfortable with Perl and CGI.pm.) > > python's cgi.py is good for reading forms, but I need to build forms too. > cgi.py doesn't address this. HTMLgen is overkill. Anyone doing a > CGI.pm workalike? What exactly does CGI.pm? I have a module cgiforms.py with which you can pre-define input fields in a form and output the single input fields. The input parameters are checked against reg exp. you define with the input field. E.g. my project http://web2ldap.de/ is based on that. Your mileage may vary... Have a look at http://sites.inka.de/ms/python/pylib/. If you're interested in using that drop me a note and I will package a newer version with demo script. Ciao, Michael. From curtis001 at my-deja.com Thu Feb 3 12:42:36 2000 From: curtis001 at my-deja.com (curtis001 at my-deja.com) Date: Thu, 03 Feb 2000 17:42:36 GMT Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> Message-ID: <87cem5$k2e$1@nnrp1.deja.com> I would kill for a Python cookbook/algorithm book!! I think an exmaple book like this would be perfect for folks like myself who have programming experience, but who don't have Python experience. This is espcially true when I see threads about "the fastest way to to perform task 'x'" -- I need exactly that kind of example help from Python-knowledgable people when I'm trying to work through a task. Curtis Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Sun Feb 20 18:02:26 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sun, 20 Feb 2000 18:02:26 -0500 Subject: Test (ignore): Python mailing list may be down In-Reply-To: Message-ID: <1261034747-11464100@hypernet.com> > From my POV, mail to python-list at python.org may have been broken all > weekend. > > testing-from-oe-ly y'rs - tim You're coming through on the mail list. At least "Re: Could embeded Python echo evaluation?" (Feb 20) did, the last before that was "RE: Miscellaneous design and Python use questions" on Feb 18. low-on-winks-myself-ly y'rs - Gordon From dave at rotwang.freeserve.co.uk Tue Feb 1 11:06:41 2000 From: dave at rotwang.freeserve.co.uk (Dave Berkeley) Date: Tue, 1 Feb 2000 16:06:41 -0000 Subject: file modes Message-ID: <8772sg$fdb$1@news6.svr.pol.co.uk> Hi All I'm trying to write a CGI script that returns image data instead of HTML. The problem is that sys.stdout is opened in text mode, and I need to write in binary. As a result each embedded "\n" in the image data gets expanded into "\r\n", corrupting the image. I have tried the following: out = os.fdopen(sys.stdout.fileno(), "wb") out.write("Content-Type: application/octet-stream\r\n\r\n") out.write(data) But the "wb" mode does not seem to override the underlying mode of stdout. I'm using Python 1.5.2 on Win 98 SE, talking to Apache 1.3.9. How can I write to stdout in binary mode? Dave Berkeley From dfavor at austin.ibm.com Fri Feb 18 08:10:58 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Fri, 18 Feb 2000 07:10:58 -0600 Subject: name-spaces and loading a file References: <8766vn2ijn.fsf@curious.eyeofdog.com> <88in3m$r0f$1@nntp6.atl.mindspring.net> Message-ID: <38AD44E2.637FBFF7@austin.ibm.com> Aahz Maruch wrote: > > In article <8766vn2ijn.fsf at curious.eyeofdog.com>, > Alex Shinn wrote: > > > >exec 'scene.' + var > > > >which only works for variables known by the main engine ahead of > >time... it doesn't let the story author declare a new global in one > >scene to be accessed by other scenes. > > Any time someone starts talking about needing to access variables with > non-predefined names, my first question is always: why not just create a > dictionary and pass it around? That way, each module contains a class > that gets passed a reference to this dict at __init__; because it's a > *reference*, all the instances see changes to the dict. > > (I'll admit that I tend to deep-end on using dicts when they're not > always the best solution, but I think that's better than the reverse > problem. To rephrase the Timbot's great advice: "Dicts are a honking > great idea, let's use more of them!") I am very new to python. Can you elaborate on this point. It sounds like it might work for an application I'm working on. Specifically, in the case of: exec 'from scenes.' + scene + ' import *' Do you mean that within each $scene class all methods pass a dictionary as one of the arguments in method calls? Thanks. From anders.eriksson at morateknikutveckling.se Wed Feb 2 12:12:25 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Wed, 02 Feb 2000 18:12:25 +0100 Subject: Creating a new image from two old using PIL? Message-ID: hELLO! I'm a beginner of Python and I thought that I should create an web counter cgi. I have created the whole cgi except for the part that creates the image. For this I tried to use PIL, but I can't figure it out. How do I create a new image from two (or more) images? as everyone guesses the source images are the numbers 0 - 9 and I would like to create a new image that combines these images to the number I want to show on the html-page. // Anders -- English isn't my first or second language, so errors or anything that you find offending is not there on purpose it's just due to the translation. From greg at cosc.canterbury.ac.nz Wed Feb 9 19:12:16 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 10 Feb 2000 13:12:16 +1300 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> Message-ID: <38A20260.DC87BA21@cosc.canterbury.ac.nz> Quinn Dunkan wrote: > > Has anyone done a #!/usr/local/bin/smalltalk just-another-scripting-language? > Would it even be smalltalk? Years ago I played with something called Little Smalltalk, which was something like that. It still seems to be available -- have a look around in: ftp://ftp.cs.orst.edu/pub/budd/little -- 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 darrell at dorb.com Thu Feb 24 23:43:30 2000 From: darrell at dorb.com (Darrell) Date: Thu, 24 Feb 2000 20:43:30 -0800 Subject: Bug in win32all-128 with multiprocessor NT References: <0D8C1A50C283D311ABB800508B612E5354B397@ryanaero.com> Message-ID: <05b901bf7f4a$e188ce50$6401a8c0@dorb> > The "pname" is to be replaced by whatever process name you want to try this > on. For example, if you have the NT version of XEmacs running, the line > would look like: > pid = win32pdhutil.FindPerformanceAttributesByName("xemacs") > Yelp that's what I did. Tried with and without the ".exe". It just sits there for about 15sec ,chewing up CPU then returns []. --Darrell From mikael at isy.liu.se Wed Feb 23 15:26:54 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 23 Feb 2000 21:26:54 +0100 (MET) Subject: PYTHONPATH on PC In-Reply-To: <38B43A9A.3D277150@bellatlantic.net> Message-ID: On 23-Feb-00 Steve Holden wrote: > Let's also not forget that this kind of stuff can be put in a > "sitecustomize" > module. I use this both to add my personal directories and to remove some > annoying duplication from the path due to Windows' case-insensitivity: > > """Site customization for holdenweb.com - Windows platforms.""" > > import sys, string > > path = sys.path[:] > sys.path = [] > for p in path: > p=string.lower(p) > if p not in sys.path: sys.path.append(p) > > sys.path.append(r"D:\Steve\Projects\Python") That's something I haven't thought about. Thanks. Is this just a module like any other module, or is there some extra magic involved? /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: 23-Feb-00 Time: 21:22:27 This message was sent by XF-Mail. ----------------------------------------------------------------------- From rob at hooft.net Mon Feb 14 04:35:58 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 14 Feb 2000 10:35:58 +0100 Subject: Order of object cleanup at interpreter exit? Message-ID: I am writing a package (98% python) that controls an analytical robot. The robot is controlled via a simple text protocol over a socket connection. When the robot control object is garbage-collected, the __del__ method takes care of a proper termination of the socket connection by sending a last "EXIT" command: def sendfixed(sock,data): l=0 while l0: sendfixed(self.sock1,'EXIT') self.status=-1 I have noticed that this does not work if the __del__ method is called when the interpreter is exiting (i.e., when I am using a Robot() object in the __main__ module at the global scope). I get: Exception exceptions.TypeError: 'call of non-function (type None)' in ignored And indeed, it seems that the "sendfixed" function was already garbage collected: "print sendfixed" just before the call reports "None".... I was not aware that it was "illegal" to call a function from a destructor. Is this a strange caveat? Bug? Feature? Any way to avoid it? 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 dfavor at austin.ibm.com Wed Feb 16 15:45:47 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Wed, 16 Feb 2000 14:45:47 -0600 Subject: list iteration question References: <38AB0876.B816FE18@austin.ibm.com> <38AB0D34.EF8AA619@roguewave.com> Message-ID: <38AB0C7B.BA4C18A2@austin.ibm.com> bjorn wrote: > > Probably because you didn't import the string module and are using > string.rstrip... Oops... Thanks. From tbryan at python.net Tue Feb 8 21:37:01 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Tue, 08 Feb 2000 21:37:01 -0500 Subject: Togl won't build References: <87qfmp$26n$1@nntp5.atl.mindspring.net> Message-ID: <38A0D2CD.B015FA11@python.net> Brian wrote: > I'm not a C programmer or anything, but my system *knows* how to compile > stuff, what gives? Your system knows what it's told, and it's probably missing a bit of information in this case. That is, it doesn't know where to look for this library. > .checked ld.so.conf and /usr/X11R6/lib Try adding the following switch to that compilation command -L/usr/X11R6/lib I don't think that the computer/compiler will look for libraries in that directory by default. It probably looks in one or more of /usr/lib, /usr/local/lib, and /lib. If a library is located in any other directory, it usually needs a -L/directory/to/library switch. ---Tom From skip at mojam.com Fri Feb 11 15:52:29 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 11 Feb 2000 14:52:29 -0600 (CST) Subject: const for bytecode optimization... In-Reply-To: References: <881psn$tbp$1@nntp6.atl.mindspring.net> Message-ID: <14500.30349.550515.221633@beluga.mojam.com> Michael> The time machines strikes again (and again and again ...). The Michael> variable you are looking for exists. Michael> It is called __debug__: ... I'll expand briefly on what Michael said: 1. When compiling to bytecodes with the optimize flag, no code is generated in an if __debug__. 2. When not optimizing the assert statement byte compiles to an if __debug__ construct as well. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From aahz at netcom.com Fri Feb 4 11:20:00 2000 From: aahz at netcom.com (Aahz Maruch) Date: 4 Feb 2000 16:20:00 GMT Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> <5ddm4.17487$3b6.72083@ozemail.com.au> <87e775$kdr$1@mach.vub.ac.be> Message-ID: <87eu7g$22s$1@nntp2.atl.mindspring.net> In article <87e775$kdr$1 at mach.vub.ac.be>, Thomas Hamelryck wrote: > >I agree completely. It would be a major mistake not to make the >introduction of true garbage collection a priority in Python 2.0. Or >at least a combination of reference counting and true garbage >collection. I don't think this should be provided as an option. You >don't want to create memory leaks or not depending on a compilation or >run time option! I believe that one of the possible plans on the table is to make GC a callable option. That is, you would need to explicitly code your application to call GC at times that your code thinks appropriate; it would not be a compilation or runtime option. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From gmcm at hypernet.com Thu Feb 24 17:58:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 24 Feb 2000 17:58:18 -0500 Subject: jack, curses and rpms In-Reply-To: <24022000.4@sanctum.jae.ddns.org> Message-ID: <1260689398-5933775@hypernet.com> Juergen A. Erhard writes: > I recently discovered jack, a CD ripping/MP3 encoding integrator > written in python (cool, I can hack it ;-). > > Nice program. > > With but one problem... it needs a curses interface (yep, the docs are > right about that, you *need* it). Which in turn needs a patched > Modules/cursesmodule.c (it doesn't work with the one in 1.5.2). > > Okay, so I got cursesmodule.c from the CVS... tried to patch it with > the included diff... which failed. > > Huh? > > So, I checked that... and found that I needed the cursesmodule.c from > the Python RPMs. I got that and patched it... and all's well. > > Well, not really... the fact that the Python RPMs have a very > different (at least in source, if not in function) cursesmodule.c is > pretty bad. > > Some call this fragmentation, some will call the Python RPMs a fork (I > for one will do that). > > This situation should be ended *NOW*.[1] > > Bye, J > > [1] Whoever needs to get together and talk should do so... to sooner, > the better (and the later the worse). Actually, this should never > have happened to begin with... > > PS: Of course, if the changes in the Python RPMs are to be integrated > into Python proper, all will be well again (*when* that has happened). > > PPS: I could yammer to the Debian Python maintainer to integrate the > RPM patches into the Debian package... but I won't. I really want > *one* Python, not several slightly incompatible ones. If the cursesmodule.c in the RPM differs from cursesmodule.c from the official 1.5.2 download, you've got a legitimate gripe with Debian. Presumably they'll pick up what you're seeing in CVS when it becomes the official 1.6. - Gordon From def-p at usa.net Thu Feb 24 14:59:30 2000 From: def-p at usa.net (Def P) Date: 24 Feb 00 12:59:30 MST Subject: (no subject) Message-ID: <20000224195930.9372.qmail@nwcst281.netaddress.usa.net> >Well, I think it's basically down to the fact that Python is designed >not according to ivory-tower philosophical rules, but observation of >what people do, and what can be done to make their lives easier. >Besides, I don't think OO is *all* about mutation of state - that >would leave functional OO languages like ocaml in rather an odd >position. Would you really rather write: > >newstr = str.copy() >newstr.convert_to_upper_case() >return func(newstr) > >than > >return func(str.upper()) I see your point, but I still don't understand the benefit of string methods over oldfashioned string functions... (Especially not if some of them look so unnatural like "".join(stringlist)... I suppose we will get to write "\t".split("a b c") too? ) <-- Def P --> ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 From guido at cnri.reston.va.us Thu Feb 24 13:26:43 2000 From: guido at cnri.reston.va.us (Guido van Rossum) Date: 24 Feb 2000 13:26:43 -0500 Subject: Just tested Tcl/Tk 8.3.0 with Python: It works (on SuSE Linux)! References: Message-ID: <5lwvnubgnw.fsf@eric.cnri.reston.va.us> pf at artcom-gmbh.de (Peter Funk) writes: > I've just installed and build the Tcl/Tk 8.3.0 combo from source and > tested it together with a rather recent Python CVS tarball (Feb 10th, > 2000) on a system running SuSE Linux. The build went through without > any problems and so did the Python test suite. Great! > But since the Python test suite currently does nothing with Tkinter, > my testing of the Tkinter/Tcl/Tk 8.3 combo is still incomplete. Since Tk is interactive, it's hard to test automatically. What I do typically is to run each of the programs from Demo/tkinter/matt in the standard distribution -- it touches most features. --Guido van Rossum (home page: http://www.python.org/~guido/) From scarblac-spamtrap at pino.selwerd.nl Mon Feb 21 06:08:14 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 21 Feb 2000 11:08:14 GMT Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <38B0E09D.EC26F41E@t-online.de> Message-ID: Andreas Otto wrote in comp.lang.python: > I don=B4t have Python knowlege, but i have the technologie to write > compilers for scripting languages. > > Phyton should be easy enougth to learn in some days. It is! When you do, and you learn it well, you'll also see why a compiler for it is very hard to make. > If the python people are interested in having an compiler OK, > if they are not interested also OK Thing is, a free compiler is already in development. > Our compiler is = > > a) not free > b) optimizes the source code in an aggressive manner, > you will loose all the stuff you don't need. You can't know what that is at compile time in Python, I'm sure. > c) produces one stand alone Python/C source-file, > with every command change to his c-command > ( no big String-Array ) This isn't Tcl, you know. > aotto > --------------61F0793694CC05A032CFB01A > Content-Type: text/x-vcard; charset=us-ascii; > name="aotto.vcf" > Content-Transfer-Encoding: 7bit > Content-Description: Card for Andreas Otto > Content-Disposition: attachment; > filename="aotto.vcf" Ick. A vcard. First time on Usenet? -- Remco Gerlich, scarblac at pino.selwerd.nl 12:03pm up 89 days, 18:07, 6 users, load average: 0.40, 0.34, 0.28 From mfletch at tpresence.com Tue Feb 1 12:12:40 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Tue, 1 Feb 2000 12:12:40 -0500 Subject: Tkinter and OpenGL Message-ID: In my experience PyOpenGL will support: Tkinter wxWindows Win32 GUI (Pythonwin) FoxPython (FxPy) Of the group, for Win32/Unix, wxWindows is probably the winner. For broadest platform support, Tkinter is the way to go. Cheers, Mike -----Original Message----- From: Sunil Hadap [mailto:Sunil.Hadap at cui.unige.ch] Sent: Tuesday, February 01, 2000 4:03 AM To: python-list at python.org Subject: Tkinter and OpenGL Hello, Is it possible to use OpenGL with Tkinter and Pmw, any experiences. Other option is FLTK but at a first glance pyFLTK is not matured. What about python with wxWindows or Qt and it's support for OpenGL. Thanks a lot Sunil -- "Live as if you would die tomorrow, learn as if you would live forever." --Mahatma Gandhi -- http://www.python.org/mailman/listinfo/python-list From tim_one at email.msn.com Tue Feb 29 03:39:28 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 29 Feb 2000 03:39:28 -0500 Subject: functional programming & tail recursion? In-Reply-To: Message-ID: <000901bf8290$7e1881a0$732d153f@tim> [Dennis E. Hamilton] > I'm curious, > > I can't imagine any language providing a very good result for > > def fib(n): > assert n = int(n) and n = abs(n) > if n in [0, 1]: > return n > return fib(n-1) + fib(n-2) > > or any descriptive-language equivalent (Eiffel?). Neither can I (certainly not Eiffel -- it's as imperative as Python or C++). > Are you are thinking of descriptive languages that basically produce > computations by inferences of some kind? I would want to know the order, > O(n), of the computation that actually occurs, I guess, in contrast to the > ease of expression and the appearance of simplicity. Dennis, I'm lost. A Scheme programmer wouldn't write the above, if that's what you think I was saying. They would usually either write a "memoized" function (saving a cache of prior results), or a tail-recursive helper function that passes around a running accumulator, pragmatically equivalent to the kind of "efficient loop" *you* would write. See the book I referenced (SICP) for details. > I've seen functional-programming languages take the reverse approach: > applicative operators that construct iterations (in terms of the result > semantics), on the same principle as map-reduce sorts of operations. The > implementation worked well (assuming that closures are inexpensive, > however). A day or two ago I posted a msg on "lazy streams", which shows (a Python spelling of) the idiomatic Haskell approach to Fibonacci numbers: define an infinite stream "fib" consisting of 0, then 1, then "fib" itself elementwise-added to its own tail. That's basically a way to spell the algorithm above. Here's a complete Haskell defn, avoiding the std library & "advanced" features so that it's all explicit: fibs = 0 : 1 : sum fibs (tail fibs) where sum (x:xs) (y:ys) = (x+y) : sum xs ys If you're used to this form of expression, that says very directly that fib[i] = fib[i-1] + fib[i-2]. But Haskell is most often implemented via a form of graph mutation, which magically "remembers" as much of the stream as has ever been generated, and getting the n'th Fibonacci number is actually linear-time there. > Coming back to the claim that functional-programming is no good without > automatic tail-recursion reduction, I am hard pressed to see that as > *necessary*. I can get it being recognition of a practice that has worked > in the absence of explicit iterative or recurrence forms. > > Can you shed any light on that? It's not deep: consider a loop iterating a trillion times. If your language doesn't have loops, and you have to spell it via non-tail-optimized recursion, you'll never find hardware that can execute it to completion (the memory burden would be astronomical). This is pragmatics, not theory: the Scheme std's requirement for "properly tail recursive" is a *practical* necessity. > PS: I understand that if I have a recurrence, it is easy to make a > tail-recursive equivalent. Or a Prolog clause scheme. I was > looking at the problem of having a recursive definition and doing the > work to make it tail-recursive equivalent. See SICP for details (there are several approaches, some special, some general, but this is really getting way too specialized for c.l.py -- you may want to ask on comp.lang.functional, though). > I don't think one should begrudge an iterative implementation (which is > pretty immediate) as non-functional! "functional" implies (among other things) "no side effects". i = i+1 is not a functional program. Saying that iteration is not functional is a matter of defn, not of moral judgment. albeit-on-real-hw-nothing-is-functional-under-the-covers-ly y'rs - tim From jimsev at my-deja.com Sun Feb 6 16:30:00 2000 From: jimsev at my-deja.com (Jim Severino) Date: Sun, 06 Feb 2000 21:30:00 GMT Subject: Specifying subject using smtplib Message-ID: <87kp4l$aid$1@nnrp1.deja.com> Hi there In the smtplib module, the SMTP object's method "sendmail" is formatted like so: sendmail (from_addr, to_addrs, msg[, mail_options, rcpt_options]) Can anyone tell me where you specify the message's subject? thanks! jim ------------------------- I'll check my my-deja email as often as I can. Well, whenever I remember, anyways. Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Sat Feb 19 17:26:04 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 19 Feb 2000 17:26:04 -0500 Subject: embedding & extending [SWIG,newbie] In-Reply-To: <38AF23C8.C9C2BE43@t-online.de> Message-ID: <1261123331-6135793@hypernet.com> Tino Roller wrote: > I have actually started to do some trials with extending/embedding > python and would like to use python as script language in a project > written in C. > Can somebody help me out It's your compile / link. You haven't made test.o relocatable (fpic or equivalent), and you haven't linked with export-dynamic (or equivalent). Linking to libpython1.5.a means you get a second copy of Python, which, indeed, has not been intialized. - Gordon From tim_one at email.msn.com Wed Feb 9 23:22:03 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 9 Feb 2000 23:22:03 -0500 Subject: Plex 0.1 - A Lexical Analysis Module In-Reply-To: <200002092337.MAA02899@purau.cosc.canterbury.ac.nz> Message-ID: <000001bf737e$62cc6860$8e2d153f@tim> [posted & mailed] [on Greg Ewing's nascent "traditional DFA" lexer, at http://www.cosc.canterbury.ac.nz/~greg/python/Plex ] [Tim, suggests "direct computation of regular language intersection, complement, difference, and reversal, as well as regexpy unions and catenations" ] [Greg] > Tell me more about how to implement these, and I'll > see what I can do. If it's just a matter of gluing > NFAs together, it should be quite easy. Easy and (honest!) fun (btw, while it would be awfully nice for the DFA match function to get coded in C, the manipulations going into building a DFA are probably better left in Python -- "DFA compile time" isn't at all crucial for the most pressing uses). Here are implementation sketches. A core notion is the concept of a "complete" DFA. A DFA is complete iff for every state S and every symbol s, there's an explicit transition from S on s. If a DFA is not complete, it can be made complete by introducing a "sink state" K, which is just a non-accepting state that transitions to itself on every symbol. Then direct all the "missing" symbol+state transitions to K. A complete DFA is wholly explicit about what happens in every case, which is crucial in getting complementation to work correctly. I'm going to assume that all inputs are complete DFAs below (it greatly simplifies reasoning -- in practice, you can cheat; in particular, it's *usually* fine if an input is an NFA, so I'll mix terminology a little). Complement: For each state, if it's non-accepting make it accepting, and vice versa. Done! The transitions and set of start states don't change. Intersection of DFAs A and B: The usual construction is to simulate running A & B in parallel, building a new NFA whose states are the Cartesian product of A's states and B's states, and where a new state is accepting iff its constituent states were both accepting. The whole bit is obvious after a little thought. A much slicker way is to compute complement(union(complement(A), complement(B))) ! Not only pretty, but much harder to screw up . Union of DFAs A and B: Introduce a unique new start state S. Introduce epsilon transitions from S to all the start states in A and in B. Done. Difference of DFAs A and B (recognize everything recognized by A but not recognized by B): intersection(A, complement(B)). Reversal (accept strings that are the reversals of the strings accepted by the input DFA): (1) Reverse the arrows (that is, if S transitioned to T on symbol s, afterwards T transitions to S on s). (2) Set of start states becomes the old set of accepting states. (3) Set of accepting states becomes the old set of start states. Note that the result is very likely to be an NFA. Reversal is especially interesting because of a beautiful and unexpected result due to Brzozowski: modulo some fiddling to get rid of sink states and unreachable states, a *minimal* DFA can be constructed from an NFA A via make_dfa(reverse(make_dfa(reverse(A)))) where make_dfa is the usual NFA->DFA "subset" construction. Very pretty, impossible to get wrong , but generally (in my experience) slower than the usual minimization algorithms. A note on completeness: making an FA explicitly complete-- even if it's only for intermediate constructions --becomes extremely unattractive in a Unicode world. I didn't find any literature on this, so (probably re-) invented a notion of "NOT-set" transitions: in my "overly general" FSM classes, each NFA state has a symbol set N associated with it, and a target NOT-set T of states, such that any symbol *not* in N transitions to the states in T. The details proved delicate in some cases, but it all worked out quite prettily. Unfortunately, it complicates the runtime matcher too -- it's really an extension of the DFA concept. In partial compensation, the alphabet doesn't need to be specified at DFA construction time (indeed, can be specified at runtime -- or even left implicit forever!). Overall, it probably adds more complications than it's worth. computers-were-built-for-english-speakers-anyway-ly y'rs - tim From wware at world.std.com Thu Feb 24 00:03:41 2000 From: wware at world.std.com (Will Ware) Date: Thu, 24 Feb 2000 05:03:41 GMT Subject: Phyththon misspelling contest Message-ID: Get Chaucerian, win valuable prizes! Extra points if none of your posts spells it the same way as any other. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From gerrit.holl at pobox.com Mon Feb 14 11:01:55 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 17:01:55 +0100 Subject: (no subject) In-Reply-To: <000501bf76e3$da319700$6c00a8c0@ruidovisual.pt>; from psilva@ruido-visual.pt on Mon, Feb 14, 2000 at 12:05:57PM -0000 References: <000501bf76e3$da319700$6c00a8c0@ruidovisual.pt> Message-ID: <20000214170155.B1888@stopcontact.palga.uucp> Hi Pedro, Pedro Silva wrote on 950526357: > lst = os.listdir("/var/spool/news/articles/obj") %(obj) You don't understand string formatting. Read: http://www.python.org/doc/current/lib/typesseq-strings.html regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From dworkin at ccs.neu.edu Tue Feb 29 10:14:48 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 29 Feb 2000 10:14:48 -0500 Subject: functional programming & tail recursion? In-Reply-To: "Dennis E. Hamilton"'s message of "Mon, 28 Feb 2000 23:15:45 -0800" References: Message-ID: "Dennis E. Hamilton" writes: > I can't imagine any language providing a very good result for > > def fib(n): > assert n = int(n) and n = abs(n) > if n in [0, 1]: > return n > return fib(n-1) + fib(n-2) Sure, but how is that relevant? There are no tail calls here. -Justin From pem at my-deja.com Fri Feb 18 14:58:27 2000 From: pem at my-deja.com (pem at my-deja.com) Date: Fri, 18 Feb 2000 19:58:27 GMT Subject: Coding problems with ftplib and uploading a file Message-ID: <88k890$fa2$1@nnrp1.deja.com> Greetings, I am new to python and have my first program near completion, however the last step has caused me great troubles. What I need to do is upload a file to a server via ftp. Very simple. My code looks like this: ftp = FTP('servername') ftp.login('uname', 'passwd') ftp.sendcmd('cdup') ftp.sendcmd('cdup') ftp.cwd('/web') fini = open('/myfile.html').readlines() ftp.storlines('STOR ' fini) ftp.quit() All of the commands work just fine except for the storlines command. I have read all of the documentation available to me at work (Programming in Python and Learning Python, and web docs on ftplib) but none are clear about the syntax of the storlines command. In addition, I read the ftplib.py as well as the rfc 959 on FTP and I guess I am just not getting it. Any help would be greatly appreciated. BTW, Python is a wonderful programming language. I don't think I will ever go back to Perl. Sent via Deja.com http://www.deja.com/ Before you buy. From steinme at kpnqwest.no Fri Feb 11 14:41:26 2000 From: steinme at kpnqwest.no (Stein M. Eliassen) Date: Fri, 11 Feb 2000 20:41:26 +0100 Subject: Python and Samba References: <38A33CA3.CD301863@kpnqwest.no> <87vnt8$voa$1@nntp6.atl.mindspring.net> <880m13$bpo$1@sunnews.cern.ch> <38A40B1F.2F703073@bellatlantic.net> Message-ID: <38A465E6.EA4A009E@kpnqwest.no> Steve Holden wrote: > > Recent versions of Samba come with SMBFS, an UNSUPPORTED client-side driver > for SMB which will allow Linux systems to mount SMB shares. However the > Samba team recommend that you use smbsh, a shell which modifies filename > semantics so that network resources can be accessed as > > /smb/hostname/sharename/... > > and this seems to be the way forward ... I'm using the now somewhat > outdated 2.0.4b on my Linux SPARCstation. The README-smbmount file > concludes a summary of alternative with: > I have tried to compile smbwrapper on my Slackware 7.0, but like other Linux-distros, there seem to be a problem with stat64 structs. If anyone have a solution on have to compile smbwrapper on linux 2.x I would be very pleased. On the other hand, if enough peole requests a SambaPython-lib I might feel motivated to develop a wrapper thing ;-) Regards Stein From moshez at math.huji.ac.il Fri Feb 18 08:49:06 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 15:49:06 +0200 (IST) Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <1261240945-13317119@hypernet.com> Message-ID: On Fri, 18 Feb 2000, Gordon McMillan wrote: > > You might have to do something weird like stick a '@' in front of your > > variable. > > Ah, and then: > s/@/self./g > Gotcha! And while we're at it: > s/;//g Right on, Gordon! Those losers writing things like "i=1;j=2" *deserve* to lose. lets-go-get-this-other-P-language!-yee-ha!-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mhammond at skippinet.com.au Sat Feb 26 16:32:58 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 26 Feb 2000 21:32:58 GMT Subject: Bug in win32all-128 with multiprocessor NT References: <0D8C1A50C283D311ABB800508B612E5354B39C@ryanaero.com> Message-ID: I have - it is wierd. If you start the NT perfmon, you will sometimes see strange names - eg, an added trailing "_". If you pass the same name you see in NT Perfmon (which may not be the name you expect to use!) then Python works fine. This leads me to point to simply a perfmon strangeness rather than a problem in the extensions... Mark. "Rodgers, Kevin" wrote in message news:0D8C1A50C283D311ABB800508B612E5354B39C at ryanaero.com... > How strange! Maybe this is a difference between NT 4.0 and Win2K. I've > never had a problem with the FindPerformanceAttributesByName function . . . > > > -----Original Message----- > > From: Darrell [SMTP:darrell at dorb.com] > > Sent: Thursday, February 24, 2000 8:44 PM > > To: Rodgers, Kevin > > Cc: python-list at python.org > > Subject: Re: Bug in win32all-128 with multiprocessor NT > > > > > > > > > The "pname" is to be replaced by whatever process name you want to try > > this > > > on. For example, if you have the NT version of XEmacs running, the line > > > would look like: > > > pid = win32pdhutil.FindPerformanceAttributesByName("xemacs") > > > > > Yelp that's what I did. Tried with and without the ".exe". It just sits > > there for about 15sec > > ,chewing up CPU then returns []. > > > > --Darrell > > > From wware at world.std.com Tue Feb 15 10:10:38 2000 From: wware at world.std.com (Will Ware) Date: Tue, 15 Feb 2000 15:10:38 GMT Subject: Python on the Palm References: <38A8D6E6.A18DBCE5@pehr.net> <5ddq4.2279$CC3.73704@wagner.videotron.net> Message-ID: pehr anderson wrote in message news:38A8D6E6.A18DBCE5 at pehr.net... > Ever wanted python on your palm pilot? > So have I, unfortunately I haven't the foggiest idea > if it is even possible. Steve Menard (steve.mnard at sympatico.ca) wrote: > If you can patient, there is currently a project, called > Stackless Python, that can help you. Here is my limited understanding. CPython (pre-stackless) uses the C stack to keep track of data structures called frames, which are involved in keeping track of variables, the program counter, and other function-executing-related stuff. Because of this, CPython's C stack is bigger than it needs to be; the Palm enforces a limit on the C stack which CPython cannot meet. Stackless Python would address the problem by moving the frame stack to a separate data structure, where (as I understand) the Palm enforces no limit other than available physical memory. -- -- I can picture in my mind a world without war, a world without hate. And -- -- I can picture us attacking that world, because they'd never expect it. -- Will Ware - N1IBT - wware at world.std.com From effbot at telia.com Thu Feb 24 16:32:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 21:32:01 GMT Subject: diff? References: Message-ID: Michal Wallace (sabren) wrote: > hey everyone. I just had a cool idea for a function called > timemachine()... just pass it a string describing a feature, > and somebody will come along and implement it two years ago.. > I'd write this myself, unless... someone else already has it? guido has written one, of course. but he will probably never release it -- god knows what could happen if people use it carelessly: http://www.deja.com/=dnc/getdoc.xp?AN=377119566 From m_garcia at my-deja.com Tue Feb 22 14:39:50 2000 From: m_garcia at my-deja.com (m_garcia at my-deja.com) Date: Tue, 22 Feb 2000 19:39:50 GMT Subject: Porting Python to non-pc platforms Message-ID: <88uom6$e0j$1@nnrp1.deja.com> Hi. I have a question regarding which source files (Modules,Objects,Parser,Python) are necessary to get a "bare-bones" python interpreter running on a non-pc platform. By non-pc I mean game console. In my case I would still like to be able to embed python in a C/C++ app and use it to execute scripts. Thanks. Sent via Deja.com http://www.deja.com/ Before you buy. From embed at geocities.com Wed Feb 9 09:45:36 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 09:45:36 -0500 Subject: Embed Python and Database in my C program Message-ID: I need a simple DB engine for a C program that can be easily accessed from both Python and C. Does anyone have any suggestions? The platforms are WinNT and an embedded realtime Win32 variant called "Phar Lap Realtime ETS kernel". The problem is that any embedded (full source code) database toolkits I could find that are either for C++ only (MetaKit) or have interfaces to C but no Python interface. One of the reasons I like Python is that it's implemented in no-nonsense low fat C instead of a bunch of classes. (I'm a jaded former C++ developer who doesn't want to get back into C++ if he doesn't have to!) It looks like the "shelve" part of Python creates a binary on-disk dictionary. If that's so, and you can interate through a rowset and look up on a single key, I could live with that. Warren Postma From cjc26 at nospam.cornell.edu Tue Feb 8 20:15:11 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Wed, 09 Feb 2000 01:15:11 GMT Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: Pada Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen bilang: | I fear that this question has already been asked, but is there and | equivalant one line command that is equivalant to the C command: | | a = x > y ? x : y a = (x > y and [x] or [y])[0] now-don't-ever-use-it-ly y'rs, Cliff -- cliff crawford -><- http://www.people.cornell.edu/pages/cjc26/ I think, therefore I'm single. From prudek at nembv.cz Fri Feb 25 08:41:33 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 14:41:33 +0100 Subject: Bring value from walk() References: <1260637200-9073387@hypernet.com> Message-ID: <38B6868D.422B2132@nembv.cz> > If you're going to print details, os.path.walk is not really > appropriate, because it's a pre-order walk. If you're going to No no, all I need is the single value EstSpace=EstDirSpace('c:/DL/ati'). -- Milos Prudek From anders.eriksson at morateknikutveckling.se Fri Feb 18 05:02:06 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Fri, 18 Feb 2000 11:02:06 +0100 Subject: Which GUI? References: Message-ID: On Thu, 17 Feb 2000 14:31:09 +0100, Anders M Eriksson wrote: >Hello! > >But now I'm reaching the point of no return and I need to create apps >with a GUI, but which one? > I never knew that there were so many different GUI's. Seems like I have to try some and then decide. Hmmmm.. I think I'll start with TKInter and wxWindows... The other ones are more unix based, I think... I'm had a terrible upbringing in the Unix environment so I'm trying to stay clear of it ;-) Thanks for all the 'facts' and opinions // Anders From neelk at brick.cswv.com Fri Feb 18 18:59:18 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 18 Feb 2000 23:59:18 GMT Subject: static class methods in Python? References: <1261276284-11190393@hypernet.com> Message-ID: Gordon McMillan wrote: > Greg Wilson asks: > > Have there been any proposals to add the equivalent of "static" > > methods (belonging to the class, not to instances) to Python? > > The complaints vastly outnumber the proposals. > > The most common complaint is the lack of C++ style static > methods. These are usually greeted with hordes of ugly > workarounds. This is probably a stupid question, but what /is/ a class method? I've never programmed in C++ (or Java), so an explanation would be appreciated. Neel From gerrit.holl at pobox.com Fri Feb 18 10:05:28 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 16:05:28 +0100 Subject: string.py In-Reply-To: <14508.8018.948016.684439@weyr.cnri.reston.va.us>; from fdrake@acm.org on Thu, Feb 17, 2000 at 11:18:26AM -0500 References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <88f53h$em2$1@nntp6.atl.mindspring.net> <14507.17447.857827.44321@anthem.cnri.reston.va.us> <88fil5$shr$1@nntp6.atl.mindspring.net> <14508.8018.948016.684439@weyr.cnri.reston.va.us> Message-ID: <20000218160528.C3878@stopcontact.palga.uucp> Fred L. Drake, Jr. wrote on 950782706: > > Aahz Maruch writes: > > I'm assuming, of course, that the revised 1.5.2 documents are correct > > and that int() still does not take a radix. > > Aahz, > int() in 1.5.2 does not, but 1.6 will: > > Python 1.5.2+ (#276, Feb 1 2000, 15:08:05) [GCC 2.8.1] on sunos5 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> int('123', 8) > 83 Cool. Will there also be something the other way? I can convert int 83 to an octal or hexadecimal string, but I want to convert it to a string with an arbitrary radix, for example, 2, to see what it is in binary. Of course, I could code it myself, but a better half[1] would be a Good Thing(tm). [1] Have I looked up "wederhelft" correctly? It seems wrong to me... -- cat: /home/gerrit/.signature: No such quote or joke From ckotso at cs.ntua.gr Tue Feb 29 07:52:49 2000 From: ckotso at cs.ntua.gr (Constantinos A. Kotsokalis) Date: Tue, 29 Feb 2000 14:52:49 +0200 Subject: PyAsync: An asynchronous TCP server module Message-ID: <20000229145249.A859@geek.dialup.ntua.gr> PyAsync is an asynchronous TCP server module (with small client functionality too). It is very simple to use, and although it's version 0.1 (first announcement) it's been tested for months and seems to be quite stable. PyAsync is available at: http://www.softlab.ece.ntua.gr/~ckotso/PyAsync/ -- ckotso at cs.ntua.gr # python -u -c 'import coffee' From moshez at math.huji.ac.il Tue Feb 22 11:11:05 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 18:11:05 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On 22 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > What would be the advantages of using a "functional" Python, as per your > definition?I mean, of course, in practice? None. But it would be cool to have tail recursion, which could probably be implemented in a post-Stackless world. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From wlfraed at ix.netcom.com Sat Feb 12 00:45:15 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Fri, 11 Feb 2000 21:45:15 -0800 Subject: Python sucks loud References: Message-ID: On 11 Feb 2000 23:27:17 GMT, kc5tja at garnet.armored.net (Samuel A. Falvo II) declaimed the following in comp.lang.python: > In article , > Forget it wrote: > > >x-no-archive: yes > ^^^^^^^^^^^^^^^^^ > > Hahahahahahahahahaaa! > > Newbie. I've been in other newsgroups where it has been stated that most sites which honor "no archive" headers will also accept it as the first line of text in the body -- explicitly for those "do everything poorly" utilities folks insist on using... -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From claudius at catlover.com Tue Feb 1 20:26:11 2000 From: claudius at catlover.com (claudius at catlover.com) Date: Wed, 02 Feb 2000 01:26:11 GMT Subject: Win32 - COM - argument by name? Message-ID: all, I'm trying to call, via Win32 COM, MS Word to perform an operation, and I would like to pass arguments by name. However, this doesn't seem to work properly (it accepts the parameter named, if I name it properly, but it doesn't seem to pass the parameter to Word.) Anyone have a working snippet of code that does this sort of thing? From aahz at netcom.com Wed Feb 16 16:33:37 2000 From: aahz at netcom.com (Aahz Maruch) Date: 16 Feb 2000 21:33:37 GMT Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> Message-ID: <88f53h$em2$1@nntp6.atl.mindspring.net> In article , Michael Hudson wrote: > >While we're at it, I've just noticed that some things aren't string >methods that you might expect to be. > >The heuristic: > >>>> for i in dir(string): >... if i in dir(""): continue >... if type(getattr(string,i)) not in [types.FunctionType]: continue >... print i > >produces: > >atof >atoi >atol > >atof/atoi/atol I can understand - use float/int/long instead. Um, color me stupid, but how does one do 'ff'.atoi(16) using 'ff'.int()? -- --- 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 Have you coined a word today? From tjuricek at ucsd.edu Sun Feb 20 00:56:36 2000 From: tjuricek at ucsd.edu (Tristan Juricek) Date: Sun, 20 Feb 2000 05:56:36 GMT Subject: Setting up Emacs to use python Message-ID: <38AF819A.1849E465@ucsd.edu> I've just installed Linux on my computer and I'm interested in setting up Emacs for use with Python. Being new at both Emacs and Python, I'm a little unclear on what I need to do. In case it's not a quick answer, does anybody know of a good set of documentation on this subject? Any guidance would be appreciated. -Tristan From emile at fenx.com Mon Feb 14 08:10:13 2000 From: emile at fenx.com (Emile van Sebille) Date: Mon, 14 Feb 2000 05:10:13 -0800 Subject: eff-bot References: <38A7A95C.B009BCC6@kw.igs.net> <20000214141846.A1297@bork> Message-ID: <042401bf76ec$d58b5160$01ffffc0@worldnet.att.net> It's a nick-name for Fredrik Lundh. It's origin is obscure, having been passed down from generation to generation, and this probably should be a FAQ (and may well be, I didn't check ;-). I'm sure the eff-bot, if it's up and on-line can point immediately and without eff-ort to the precise moment of inception, which is what makes the eff-bot the eff-bot. If-the-tim-bot-replies-first-all-bets-are-off-ly y'rs, Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Egbert Bouwman To: Sent: Monday, February 14, 2000 5:18 AM Subject: eff-bot > Lately the eff-bott popped up several times. > Seems to be the underscore. Where does that name come from, > and what does it imply ? > egbert > -- > Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 > ======================================================================== > > -- > http://www.python.org/mailman/listinfo/python-list > From nobooze4u at BLAM!worldnet.att.net Sat Feb 12 19:09:53 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Sun, 13 Feb 2000 00:09:53 GMT Subject: Flamage's good for your health! References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> <20000212224414.I477@xs4all.nl> Message-ID: x-no-archive: yes Thomas Wouters wrote: > The limiting factor is *you*, the programmer, and your imagination. Actually, the limiting factor is the user. The user isn't a programmer and he needs something real simple that does _his_ job, not mine. Perl, Python, are all nice toys, but neither fits the purpose. Pike looks promising, and I'm glad someone pointed that out. > And if you can't find your own little language, build your own ;) No time/not smart enough. Iow, only as a last resort will I attempt something like that. > It isn't that hard, I mean, look around you and count the different languages. Yeah, I thought of it . I bet you're right about that. > But flaming a newsgroup/mailinglist just because you're bored on another > lonely evening ? tsssk, tsssk ;) Ah, who cares. I got quite a few helpful suggestions, and that's all I need. If people got no sense of humour, well, that's typical of programmers. Especially those who waste their time with a disgusting half-assed language like Python!!! From sabren at manifestation.com Sun Feb 13 20:51:37 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 13 Feb 2000 20:51:37 -0500 Subject: local cgi References: <38a33281_2@news5.newsfeeds.com> <87vl1c$duc$1@nntp1.atl.mindspring.net> <38a717a8_3@news5.newsfeeds.com> Message-ID: <887n45$8o5$1@nntp2.atl.mindspring.net> 55555 <55555 at dakotacom.net> wrote in message <38a717a8_3 at news5.newsfeeds.com>... >I gave Medusa a try; however, it looks like you have to have a live internet connection >for it to work. That won't be the case a lot of the time. Is there any other way for me >to just associate .py to run on internet explorer through extra registry settings >somewhere? Maybe, but I'd doubt it.... and you'd have to change them to run on the web anyway... I'm not familiar with medusa, but I'll try a mind read here... Maybe this'll solve your problem: If you had a webserver running on your local machine, you can access it through http://localhost/ ... that should work even if you're not online.. If it *doesn't*... if IE pops up a "call your ISP" box, you can trick it... Just go into IE, and go to the "Connection" tab of the "View/Internet options..." dialog and tell it you have a local area network. Then http://localhost/ should work fine. (but you'll have to either set it back or manually dial your ISP through the icon in dial-up networking) -Michal http://www.sabren.com/ From mwh21 at cam.ac.uk Mon Feb 14 04:44:53 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Feb 2000 09:44:53 +0000 Subject: Order of object cleanup at interpreter exit? References: Message-ID: rob at hooft.net (Rob W. W. Hooft) writes: > I am writing a package (98% python) that controls an analytical robot. > The robot is controlled via a simple text protocol over a socket > connection. > > When the robot control object is garbage-collected, the __del__ method > takes care of a proper termination of the socket connection by sending > a last "EXIT" command: > > def sendfixed(sock,data): > l=0 > while l l=l+sock.send(data[l:]) > > class Robot: > def __del__(self): > if self.status>0: > sendfixed(self.sock1,'EXIT') > self.status=-1 > > > I have noticed that this does not work if the __del__ method is called > when the interpreter is exiting (i.e., when I am using a Robot() object > in the __main__ module at the global scope). I get: > > Exception exceptions.TypeError: 'call of non-function (type None)' in > ignored > > And indeed, it seems that the "sendfixed" function was already garbage > collected: "print sendfixed" just before the call reports "None".... > > I was not aware that it was "illegal" to call a function from a destructor. > Is this a strange caveat? Bug? Feature? Any way to avoid it? Try this: def __del__(self,sendfixed=sendfixed): if self.status>0: sendfixed(self.sock1,'EXIT') self.status=-1 That way, sendfixed shouldn't get collected before the instance object. Maybe a FAQ entry, except it's not very F Aed. HTH, Michael From janne at nnets.fi Mon Feb 21 02:36:51 2000 From: janne at nnets.fi (Janne Sinkkonen) Date: 21 Feb 2000 09:36:51 +0200 Subject: Numerical Python install problem References: <38ADFBA4.55729EB4@mindspring.com> Message-ID: Robert Schweikert writes: > I am running Python 1.5.2 on RH 6.1 distro. Used the Python rpm to get > it running instead of building it myself. I also installed the Distutils > with no problem. But now when I try to install Numerical Python Version > 14 I get the following errors: > /usr/include/linux/errno.h:4: asm/errno.h: No such file or directory You should have these symlinks in your /usr/include: asm -> ../src/linux/include/asm linux -> ../src/linux/include/linux Of course, you need the part of the linux kernel sources into which they refer. The kernel should probably be configured with 'make config' or 'make xconfig' (just running the configuration program should be enough). Without these you'll have problems in compiling many other packages as well. The files in /usr/src/linux should exist unless you have a very customized version of RH 6.1. -- Janne From effbot at telia.com Mon Feb 21 16:53:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 21:53:29 GMT Subject: Tkinter: creating a scrolling canvas that contains widows (Frame widgets) References: <490s4.103351$A5.1984558@news1.rdc1.bc.home.com> Message-ID: Kevin Cazabon wrote: > I've been trying to create a class that I can use to place Frame() widgets > into a scrolling 'container'. > > Basically, I want a master "Frame" that has a Y scroll bar (and maybe X as > well). In this frame, I want to be able to add sub-frames (any number). If > all of these frames won't fit, I want to be able to scroll the master Frame > as necessary. > > The only suitable Tkinter class for the Master I can find is the Canvas > widget. I have no problem creating this, and adding windows to it using > canvas.create_window(x,y, window=mywidget), but have had a heck of a time > getting it to scroll properly, especially when the user resizes the overall > master frame. try this: after each change, reset the scrollregion: canvas.config(scrollregion=canvas.bbox(ALL)) (you may have to call mywidget.update_idletasks() first, to make sure the geometry is properly calculated) hope this helps! From mhammond at skippinet.com.au Thu Feb 24 19:35:44 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 25 Feb 2000 00:35:44 GMT Subject: Bug in win32all-128 with multiprocessor NT References: <8947n9$c5k$1@nnrp1.deja.com> Message-ID: wrote in message news:8947n9$c5k$1 at nnrp1.deja.com... > Here's a bug I've run across in win32all-128 (actually, has been present > at least since win32all-125, but I've been too busy to report it) on a > two-processor NT box. I can get it on an SP box :-) Pity you didnt report it - it would be history by now :-( The problem appears to be related to the optimizer - it did not happen in debug builds, and adding debug information to the release builds showed something very strange - I didnt dig to the assembly level, just disabled the optimizer for that SetProcessAffinity(), and it all started working again. This will be in 129. Mark. From gmcm at hypernet.com Mon Feb 28 16:40:56 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 28 Feb 2000 16:40:56 -0500 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( In-Reply-To: Message-ID: <1260348438-26442187@hypernet.com> Arnaud Fontaine writes: [Metakit] > For me, it's "not really the whole model" ... but as nothing beats the > relational algebra at managing tons of structured data ... > (someone said something about the O2 model ?? u kidding ? I was talking > about real world ;-)) > I need to do some good old > "SELECT obj1.a,obj2.c FROM obj1,obj2 WHERE obj1.d=obj2.e AND > obj1.f=value" > > Well .... :) view1 = db.view('view1') view2 = db.view('view2') view2.rename(view2.e, 'd') v = view1.join(v2, view1.d) v = v.select(f=value) for row in v: print row.a, row.c > more details ? > I've tons of data in objects, I need persistence but can't play with the > navigational model to search in those data. Any good way to map them to > tables and query the tables ?? (I'm too lazy to do it by hand and I'm > not sure I'll be able to do it in an efficient way). > One more thing : at some steps, I really need the data in objects. A MetaKit row is an object, but not an object of your making. It can have properties that are ints, strings, doubles, or other views. So while it's not pickle, it's a whole lot easier to map object persistence into Metakit than into a conventional RDBMS. > > Do you care about multi-user operation ? > > Kinda ... in fact, I need multi-processes access to my data. Yes it's a > problem with MetaKit. > > > What are your scale and performance requirements? > > About 200 000 objects to search in (but not too big objects) and ... > speed needed. > I've also another need managing millions of object but there, I don't > care about speed. Don't think you'll find anything that meets those requirements that doesn't consume vast amounts of resources (including $$, probably). > > In what way does Gadfly > > Hey ! (/action takes notes about this "Gadfly") drop me an URL, I'll > check this ! www.chordate.com - Gordon From phd at phd.russ.ru Tue Feb 15 08:56:50 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 15 Feb 2000 13:56:50 +0000 (GMT) Subject: Off Topic Posts In-Reply-To: Message-ID: On 15 Feb 2000, Vetle Roeim wrote: > as the python community grows and the number of posts increases, a > split would seem natural. I would suggest something like c.l.python, > c.l.python.moderated, c.l.python.web, c.l.python.tkinter (or perhaps > c.l.python.gui would be better).. any other suggestions? c.l.python.win32 Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From jbauer at rubic.com Sat Feb 12 17:29:11 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Sat, 12 Feb 2000 16:29:11 -0600 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: <38A5DEB7.E1B018AC@rubic.com> osorronophris osorronophris [Ryan] wrote: > I'm a die-hard C++ programmer that recently took up > Python for a change of scenery and am enjoying it > greatly. The one problem I am having is that I > can't break myself of the semicolon habit. I've > tried chewing gum but it just doesn't seem to work, > and I'd like to avoid the patch. Any ideas? The great thing about Python for recovering C++-a-holics is that your don't *have* to give up your precious semi-colons! Feel free to append end-of-line ;'s to your heart's content. The hard part comes when switching back to Java or C, and forgetting to add the obligatory decorative punctuation. -and-if-paul-prescod's-string.rstrip()-2nd-argument- ever-pans-out-you'll-have-an-easy-way-to-remove-the- semicolon-training-wheels-off-your-early-python-code-ly yr's, Jeff Bauer Rubicon Research From fredrik at pythonware.com Tue Feb 1 09:11:34 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 15:11:34 +0100 Subject: This thread was almost about Python once References: <001401bf6c16$d5657660$3acbd9c2@peridot.optichrome.com> <20000131201258.G19725@xs4all.nl> Message-ID: <001701bf6cbe$40de4dc0$f29b12c2@secret.pythonware.com> Clarence Gardner wrote: > What interpreter is so braindead as to assume that particular file > descriptors are available when it is invoked? And even if there are > any, catering to them is worse than all of the Microsoft backward- > compatibility-to-1985 hacks put together, IMNSHO. umm. how about catering to the Single UNIX Specification? the following is required to be true for any program running under Unix: ... At program startup, three streams are predefined and need not be opened explicitly: standard input (for reading conventional input), standard output (for writing conventional output), and standard error (for writing diagnostic output). ... The following symbolic constants are defined for file streams: STDIN_FILENO File number of stdin. It is 0. STDOUT_FILENO File number of stdout. It is 1. STDERR_FILENO File number of stderr. It is 2. ... (the last version of that spec is from 1997, and I doubt Microsoft was involved in writing it ;-) From anders.eriksson at morateknikutveckling.se Wed Feb 2 03:58:51 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Wed, 02 Feb 2000 09:58:51 +0100 Subject: Python and Codebase References: <058AFBA1CD7F1621.791F88D00D532EC1.0128BF9429776D7B@lp.airnews.net> Message-ID: On Mon, 31 Jan 2000 16:24:30 -0400, "Gene Chiaramonte" wrote: >Does anyone know of a Python Module for Codebase from Sequiter? > Nope! But since Codebase comes for C/C++ or Java it shouldn't be hard (.now I'm guessing cause I haven't tried.) to create one. An another way could be to use the Codebase ODBC drivers and mxODBC If you find any module or create one, I would be interested!! // Anders -- English isn't my first or second language, so errors or anything that you find offending is not there on purpose it's just due to the translation. From peter.stoehr at weihenstephan.org Mon Feb 21 15:37:03 2000 From: peter.stoehr at weihenstephan.org (Dr. Peter Stoehr) Date: Mon, 21 Feb 2000 21:37:03 +0100 Subject: where can i download python for free? References: Message-ID: <38B1A1EF.1FBBFFD2@weihenstephan.org> Hi Collin, Collin Greene wrote: > > i ma very interested in python but i cant really find where t get it, could > anyone help me out? check out www.python.org Greeting from Bavaria Peter -- --------------------------------------------------------------------------- Dr. Peter Stoehr --- Teisenbergweg 6 --- 85435 Erding --- 08122/47232 http://www.weihenstephan.org/home/ak/support/team/jpg/peter.jpg --------------------------------------------------------------------------- I'm the terror that flaps through the night From hniksic at iskon.hr Thu Feb 10 03:25:34 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 10 Feb 2000 09:25:34 +0100 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: <9t9hffh31mp.fsf@mraz.iskon.hr> Fran?ois Pinard writes: > if line and line[-1] == '\n': > line = line[:-1] > > You may remove the test for line if you know that it is not empty. Or: if line[-1:] == '\n': line = line[:-1] That works with both empty and non-empty lines. From mwh21 at cam.ac.uk Wed Feb 9 18:52:13 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 09 Feb 2000 23:52:13 +0000 Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> <389A3E61.47E255A0@home.com> <38A1E664.3CEAF4BF@be-research.ucsd.edu> <87soug$ik4$1@nntp6.atl.mindspring.net> Message-ID: aahz at netcom.com (Aahz Maruch) writes: > In article <38A1E664.3CEAF4BF at be-research.ucsd.edu>, > Curtis Jensen wrote: > > > >Would it be possible to include a history ability into the Python > >interpretor? Something simmilar to the BASH shell, or doskey in DOS. > >Up-Arrow prints the previous command. I think this would be a great new > >feature. > > Once more, Guido's Amazing Time Machine comes to your rescue. Try > compiling with Gnu readline() support. It would be nice if history persisted across sessions, and if C-o worked. If the time machine gets used again and it becomes the case that this is already possible, would someone tell me how? argh-my-tenses-are-failing-ly y'rs Michael From sabren at manifestation.com Sun Feb 20 00:14:22 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 20 Feb 2000 00:14:22 -0500 (EST) Subject: trouble posting WAS: something else.. :) In-Reply-To: <38AF7308.8A933364@erols.com> Message-ID: On Sat, 19 Feb 2000, Edward C. Jones wrote: > My ISP seems to have lost my first two attempts to post. I've been having the same problem all day... parrot.python.org kept denying my emails.. I even tried emailing Barry Warsaw and ANOTHER machine bounced my mail.. Maybe its fixed now? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From PClaerhout at CREO.BE Mon Feb 28 07:41:27 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Mon, 28 Feb 2000 13:41:27 +0100 Subject: Moving files Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7160@MSGEURO1> Hi, is there a function available in Python to move a file from one directory to another? Kind regards, P. From jean at stat.ubc.ca Sat Feb 12 17:49:41 2000 From: jean at stat.ubc.ca (Jean Meloche) Date: Sat, 12 Feb 2000 14:49:41 -0800 Subject: delays in python Message-ID: <38A5E385.83F33D90@stat.ubc.ca> How can I insert delays shorter than time.sleep(1) in python (other than keeping busy)? Please answer by email to jean at stat.ubc.ca Thanks. -- Jean Meloche From sholden at bellatlantic.net Thu Feb 10 11:59:10 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 10 Feb 2000 16:59:10 GMT Subject: How to do this? - newbie References: <38a2e958$0$1403@news.voyager.net> Message-ID: <38A2EE79.14190ABA@bellatlantic.net> "Ronald L. Dilsavor" wrote: > > Hi, > I am new to python and am quite excited about it. I spent much of last night > writing my fist code snippet and I came across 1 thing which I could not > figure out how to do. > > Suppose > > >>> a=('x',1) > then how can I create an x of numerical type such that > >>> print x > 1 > > - just using manipulations of a = ('x',1) > > Also let me know if this type of thing would not be considered best practice > in python. I thought I would need to make use of eval() but could not find > an incantation that would do it. > > Thanks, > Ron I am sure there are people reading this group who can tell you how to dynamically construct something which will create a variable called a and assign it the value 1. But it seems you really want to be able to retrieve the numeric value using the symbol 'a' as a key, and that's what dictionaries are for. >>> mydict={} # empty dictionary >>> mydict['a']=1 # enter value 1 against key 'a' >>> print mydict['a'] # retrieve the value 1 >>> Is *that* what you want? regards Steve -- "If computing ever stops being fun, I'll stop doing it" From ekappoti at lynx.neu.edu Mon Feb 28 01:55:48 2000 From: ekappoti at lynx.neu.edu (Eric Kappotis) Date: Mon, 28 Feb 2000 01:55:48 -0500 Subject: windows and wpy Message-ID: <89d640$7ug$1@isn.dac.neu.edu> Hello, I'm currently trying to install wpy on my win98 system and I already have installed python on my system via the .exe files on www.python.org. I try to install the wpy .exe file and i get an error message of core binaries not found....am I doing something wrong? Eric Kappotis From effbot at telia.com Thu Feb 3 12:31:56 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 03 Feb 2000 17:31:56 GMT Subject: embeding python in C++ ?? References: <20000203105403.04628.00000136@ng-cv1.aol.com> Message-ID: JerryJerry wrote: > Thanks for responding. Where would I find your reference to extending and > embedding documentation? on the python website, together with all the other fine manuals: http://www.python.org/doc From loewis at cs.tu-berlin.de Tue Feb 15 03:08:25 2000 From: loewis at cs.tu-berlin.de (Martin v.Loewis) Date: 15 Feb 2000 08:08:25 GMT Subject: [GemStone/S] GemStone CORBA client to Python server References: <38A8343F.E0B8430F@acm.org> Message-ID: <88b1hp$eon$1@news.cs.tu-berlin.de> In article <38A8343F.E0B8430F at acm.org>, Thierry Thelliez wrote: >1- How do I use GemStone as a CORBA client ? > >Being very new to GemOrb and CORBA, I am wondering if I really need a >GemStone ORBBroker + ORBServer when I don't need the GemStone CORBA server >capabilities (at this point). >I am not sure to understand the CorbaORB usefulness. It seems to be a >small client for development ? I'm not familiar with the GemORB product. If they really offer separate client and server function, you probably don't need the server side in your case. Please note that in CORBA, the client/server distinction is often weakened by the desire for 'server-initiated' communication. For example, a Gem client finding a Python object might want to do so via the naming service, which could be the GemORB naming service. In the case, the Python 'server' would have to register with the GemORB naming server, acting as a client at that moment. >2- How do I start a GemStone CORBA client on an IOR string ? GemORB should offer an ORB operation string_to_object. >3- How do I share this IOR ? >Store it in a file ? That is certainly a common solution. >Should the client access this file through ftp or something like that ? That might also be possible. Many ORBs recognize 'http:' or 'ftp:' object references in their string_to_object implementations. They expect the document behind the URL to be an IOR: style object reference. >Or am I missing something in CORBA ? Have a look at the name service. This is the standard way of exchanging object references between applications. Now, how do you get the name service? Call orb.resolve_initial_references("NameService"). How does the ORB know the name service? This is a tricky question. One of your ORBs should have a configuration mechanism to set the IOR of the naming service (I know OmniORB does); the other should have a naming service running on a fixed IOR (i.e. fixed port/object key). Then you do a one-time configuration of the other ORB, and can then use the naming service for all applications. Hope this helps, Martin From laurie at eh.org Tue Feb 22 16:24:28 2000 From: laurie at eh.org (Laurence Tratt) Date: Tue, 22 Feb 2000 21:24:28 +0000 Subject: Porting Python to non-pc platforms References: <88uom6$e0j$1@nnrp1.deja.com> Message-ID: <38B2FE8C.F15CFD77@eh.org> m_garcia at my-deja.com wrote: > I have a question regarding which source files > (Modules,Objects,Parser,Python) are necessary to > get a "bare-bones" python interpreter running on > a non-pc platform. By non-pc I mean game console. > In my case I would still like to be able to embed > python in a C/C++ app and use it to execute > scripts. You have to take it on a platform by platform basis. You can get a genuinely "bare bones" interpreter out of very little, but it won't do anything really: you need to get most of the important looking stuff working to get anything useful... Basically you need to create a config.h file from the .in file (read through it; it's fairly obvious, although it takes a little while to fill in by hand on a non-Unix platform), and then kind of wing it from there (typical problems involve changing #include lines, removing / editing the odd file which just won't compile and then fiddling with the linking phase). I ported Python to a totally non-POSiX platform in only a few hours, so it's not difficult in general, but there's no guaranteed general way of doing it. Sorry :) Laurie From mdvorak at ninell.cz Fri Feb 4 18:10:05 2000 From: mdvorak at ninell.cz (mdvorak at ninell.cz) Date: Fri, 04 Feb 2000 23:10:05 GMT Subject: deleting global namespaces Message-ID: <87fm8a$v4j$1@nnrp1.deja.com> Hi, I've got an advanced question I am not able to find answer for. I'm embedding Python in a multimedia engine and I really like what Python does with global namespace when it imports new module. It's great that it creates new global namespace for each module so that it is impossible for the module to access real global namespace in any way. I would like to use this feature to divide one application into more independent components. My idea is that each component will sit in a module and there will be some functions which will take care of starting the module and performing clean up upon exit. But the problem is there is no way to force Python to delete module together with all variables/functions which exist in its global namespace - that is I cannot perform any clean up. Upon exit I would have to go through all global objects and delete them explicitly, but I cannot do this, because throughout the application one module can be started multiple times and each time it has to run like it was started for the first time. I guess my idea is not possible because of optimizations Python performs on modules to work with them as fast as possible, but I really need to divide application to more parts each with its own global namespace. Is there some workaround (including patches to the source code) to do this with modules or some other way to create and delete new global namespace? I do not want to create new subinterpreter for each application's component because I want all components to use the same built in modules and I want to pass an application-wide dictionary between each component's namespace. Thanks very much for any advice. Regards, Martin Sent via Deja.com http://www.deja.com/ Before you buy. From robert.meegan at murl.com Tue Feb 1 15:24:26 2000 From: robert.meegan at murl.com (Robert Meegan) Date: Tue, 01 Feb 2000 20:24:26 GMT Subject: Dynamic class construction? In-Reply-To: <38970CA2.5CC3149B@math.okstate.edu> References: <000601bf6c54$c6418aa0$d709143f@tim> <38970CA2.5CC3149B@math.okstate.edu> Message-ID: <20000201.20242600@robert.polytopic.com> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/1/00, 10:41:06 AM, "David C. Ullrich" wrote regarding Re: Dynamic class construction?: > > the-code-*is*-the-docs-in-this-case-ly y'rs - tim > It's code in that funny language where all the statements > are inside comments, right? You must be referring to Javascript. - Robert From paul.robinson at quantisci.co.uk Tue Feb 1 13:04:12 2000 From: paul.robinson at quantisci.co.uk (Paul Robinson) Date: Tue, 01 Feb 2000 18:04:12 +0000 Subject: file modes References: <8772sg$fdb$1@news6.svr.pol.co.uk> Message-ID: <3897201C.3C5F4A9D@quantisci.co.uk> Dave Berkeley wrote: > > Hi All > > I'm trying to write a CGI script that returns image data instead of HTML. > The problem is that sys.stdout is opened in text mode, and I need to write > in binary. I've got two options to try: 1) is the data being read from a file and is this definately being opened in binary mode 2) is the server (and/or browser) setup to recognise that application/octet-stream is a binary format Hope this helps... Paul ----------------------------------- Business Collaborator Team Enviros Software Solutions http://www.businesscollaborator.com ----------------------------------- From scarblac-spamtrap at pino.selwerd.nl Wed Feb 16 10:20:53 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 16 Feb 2000 15:20:53 GMT Subject: Moving from perl to python: questions References: <816010E2456BD111A48700805FBBE2EE01C604FE@ex-quebec-u1.baan.com> <38AAB688.7C87780@austin.ibm.com> Message-ID: David R. Favor wrote in comp.lang.python: > #!/usr/local/bin/python > > def slurp(filename): > > "Slurp all the lines of a file into an array" > > print filename > > try: > f = open(filename) > > lines = f.readlines() > > f.close() > > return lines You use try:, but you don't catch any exceptions the open may raise. With error checking, that could look like: import sys def slurp(filename): "Slurp all the lines of a file into an array" print filename try: f = open(filename) except IOError: print "IOError: ", sys.exc_value return None return f.readlines() > def chomp(lines): > "remove the end of line markers from array" > import os > nl_len = len(os.linesep) # length of os dependent line seperator > while i < len(lines): > line_len = len(lines[i]) > lines[i] = lines[i][:line_len-nl_len] Your while has an error; you never change i. I'm quite sure that the length of the OS dependent line seperator is irrelevant - unless you opened the file as binary, Python has already translated it for you, and it's just '\n' now. Also, instead of 'line_len-nl_len' you can just use '-nl_len'; negative numbers count from the end, because this is such a typical case. So line = line[:-1] cuts the \n off (well, any last character). Also, I think making such a chomp function that takes an array is not the right way - rather make a function that chomps one string, and then iterate over it. But the array version goes something like: def chomp(lines): "Remove the end of line markers from an array of strings" for i in range(len(lines)): if lines[i][-1] == '\n': lines[i] = lines[i][:-1] But there have been other solutions posted here last week; a thread on 'chomp' came up. > if __name__ == '__main__': > > from sys import argv > #from getopt import * > > #opts = getopt(sys.argv[:1],'f:') > > lines = slurp(str(argv[1:])) > > print lines Oh wait, you're writing cat :). Still not sure what you want to do with argv[1:]. You could join them (import string; string.join(argv[1:])) but that gives a string like "foo bar" if you call it with two files. What about just: if __name__ == '__main__': import sys for file in sys.argv[1:]: lines = slurp(file) if lines: chomp(lines) for line in lines: print line Instead of chomping the lines before printing them, you can also just send them to sys.stdout, which doesn't add a newline. Success - this language is quite different from Perl, try not to write Perl in Python :) -- Remco Gerlich, scarblac at pino.selwerd.nl 'Oook?' From nobooze4u at SPLAT!worldnet.att.net Sat Feb 12 12:07:35 2000 From: nobooze4u at SPLAT!worldnet.att.net (Forget it) Date: Sat, 12 Feb 2000 17:07:35 GMT Subject: Python sucks loud References: Message-ID: x-no-archive: yes "Samuel A. Falvo II" wrote: > And whether you win the bet or not is immaterial. You don't deserve my > money. Hey, nooooow you're smart . I could've got your 50 bucks! Remember that... newbie . From moshez at math.huji.ac.il Fri Feb 18 00:48:56 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 07:48:56 +0200 (IST) Subject: static class methods in Python? In-Reply-To: <88ic3d$560$1@nnrp1.deja.com> Message-ID: On Fri, 18 Feb 2000 gvwilson at nevex.com wrote: > Have there been any proposals to add the equivalent of "static" > methods (belonging to the class, not to instances) to Python? > If so, I'd appreciate a summary... I think the official response is that there will be none for the forseeable future. If you need them, and you already code, like sensible people, one class per module, then the module's global functions can be treated like class methods. That's what I do, anyway. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From kuncej at mail.conservation.state.mo.us Thu Feb 17 13:17:18 2000 From: kuncej at mail.conservation.state.mo.us (Jeff Kunce) Date: Thu, 17 Feb 2000 12:17:18 -0600 Subject: Python for Palm update References: <200002170026.QAA20266@rushe.aero.org> Message-ID: > I have an unreleased (alpha) python-1.5.1 port that will run > on PalmIII's and greater. It runs a subset of the test suite I thought Joey Gibson's post about Pocket Smalltalk (www.pocketsmalltalk.com) was intriguing. It looks like you write smalltalk in the development environment, but it generates Palm code for the runtime. How does your python for palm compare to this approach? --Jeff From thamelry at vub.ac.be Thu Feb 24 08:47:09 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 24 Feb 2000 13:47:09 GMT Subject: Best way to find unique items in a list References: Message-ID: <893cot$7i9$1@mach.vub.ac.be> maxm wrote: : I have written the following snippet to return a list of unique items in : another list. I just wondered if there was a smarter/faster way of doing it? You could transform the list into a kjbuckets Set object: set=kjSet(list) This will only retain the unique items in the list. If you want a list again you can do: unique_list=set.items() kjSet is part of the kjbuckets module (written in C), so you'll have to install it separately (which might be overkill if you're only interested in a simple solution). However, if you're going to need this often and for large lists it's probably an excellent solution. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From evan at 4-am.com Thu Feb 10 09:46:22 2000 From: evan at 4-am.com (Evan Simpson) Date: Thu, 10 Feb 2000 08:46:22 -0600 Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> Message-ID: Michael Hudson wrote in message news:m33dr1wj40.fsf at atrus.jesus.cam.ac.uk... > > Sure it does. They're called bytecodehacks :-) > > Thanks for the plug. I was hoping to thank you in person at IPC8; byecodehacks has been very good to me :-) > > Even better, they are > > *semantic* macros > > Evan, what are you talking about here? I may be abusing terminology horribly here, but my point was that I can get effects from bch that I can't imagine getting from mere cpp text-substitution stuff. For instance, my PythonMethods Zope product uses bch to make a function definition "safe". It ensures that no reference is made to variables beginning with '_', that no assignment or deletion of elements/attributes/slices takes place, and that nothing is imported or exec'd. I don't make any of these effects dependent on the presence of a bch 'macro' name, but I *could*. Another example I've thought about implementing is a 'loopexit' macro, which would be used thusly: try: for x in xxx: while x: #stuff if stitch in time: raise 'Found Stitch' #more stuff except loopexit('Found Stitch'): print 'Found it!' ...transforming the 'raise' into a simple jump as in my proposed 'try: continue:' syntax. Try that with normal macros! The only two limitations I find on bch are the need to explicitly process functions, and the fact that the unprocessed code must be syntactically correct normal Python; No wholesale redefinition of syntax :-) Cheers, Evan @ digicool From bart at nembv.cz Wed Feb 16 02:02:23 2000 From: bart at nembv.cz (Bart) Date: Wed, 16 Feb 2000 08:02:23 +0100 Subject: Informix integration References: <38A96270.E7E67D65@nembv.cz> <06f501bf77c4$9c10b820$01ffffc0@worldnet.att.net> Message-ID: <38AA4B7F.9F4D6BF@nembv.cz> Emile van Sebille wrote: > > Assuming you're on Winxx, one way is to set up an ODBC > data source using the control panel application, then > test it using access, excel, whatever. I'm on HP-UX mostly. Informix is also on HP-UX. Python will be running on HP-UX, maybe on Linux. No Windows. -- Milos Prudek From fdrake at acm.org Thu Feb 17 11:18:26 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 Feb 2000 11:18:26 -0500 (EST) Subject: string.py In-Reply-To: <88fil5$shr$1@nntp6.atl.mindspring.net> References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <88f53h$em2$1@nntp6.atl.mindspring.net> <14507.17447.857827.44321@anthem.cnri.reston.va.us> <88fil5$shr$1@nntp6.atl.mindspring.net> Message-ID: <14508.8018.948016.684439@weyr.cnri.reston.va.us> Aahz Maruch writes: > I'm assuming, of course, that the revised 1.5.2 documents are correct > and that int() still does not take a radix. Aahz, int() in 1.5.2 does not, but 1.6 will: Python 1.5.2+ (#276, Feb 1 2000, 15:08:05) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> int('123', 8) 83 I'll make sure the 1.6 documentation reflects this (this is on a different branch from the 1.5.2 documentation; the head of the tree is for 1.6). -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From bparsia at email.unc.edu Sat Feb 12 23:51:46 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Sat, 12 Feb 2000 23:51:46 -0500 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <87vlb7$tca$1@nntp1.atl.mindspring.net> <38a38e87$0$88916@news.voyager.net> <001201bf7454$2263bd60$d6a0143f@tim> Message-ID: <1e5wxzc.1aj2ut2j2hjmhN%bparsia@email.unc.edu> Tim Peters wrote: > [Ronald L. Dilsavor] > > I am in the process of deciding whether to have a team of folks > > invest in implementing our product in Python and this [presumed > > incompatibility of Python 3000] was one of the "cons" on my list. > > As it should be! Don't overvalue it, though. For example, even if Python > 3000 is an *entirely different language*, no C program stopped working the > day C++ was released -- or a decade later, either. That is, you won't be > alone no matter what, and the current implementation of Python is > extraordinarily clean and maintainable: it still needs Guido's help to > guide its evolution, but not at all to keep it running in top shape. Many > people understand the current implementation, and can handle that fine. So > if Python 3000 turns out to be wholly incompatible, I fully expect someone > else (i.e., other than Guido) would jump in to continue work on the current > Python line. Not to mention that there are (at least) two alternative implementations that do not derive from the CPython code base (i.e., they aren't forked implementations, but *re*implementations). One of thes is sufficently mature for production work (JPython). Plus, there is sufficient documentation to make yet another implementation fairly straightforward. Cheers, Bijan Parsia. From vkolosov at unitedmedia.com Thu Feb 3 10:26:52 2000 From: vkolosov at unitedmedia.com (Kolosov, Victor) Date: Thu, 3 Feb 2000 10:26:52 -0500 Subject: Cron & Python + Package Message-ID: <461182F0B9B7D111B4000008C7282ADC22B0C9@nynt04.umny.scripps.com> I have written a python script and wish to run it as a cron job. As a stand alone program it runs just fine, but when I try to run it via crontab I seem to be missing some environment variables(I'm on UNIX). I went ahead and used os.environ to populate my environment and placed it at the very beginning of the python script, but it still does not work. I have written a small shell script to do exactly the same thing, that is to set the environment before calling the python script - it worked. Nevertheless I feel it destroys the purpose of using python in the first place. My understanding of os.environ is that it could be set as os.environ['PATH']='.:/usr/lib:/usr/local/lib' but for some reason this environment is not available for the rest of the script immediately(in my case for package import). Am I doing something wrong? The problem is only when a python package uses C libraries and in this case requires LD_LIBRARY_PATH to be set. The following is the error message that I get. # /usr/local/bin/python Python 1.5.2 (#2, Apr 20 1999, 16:06:35) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import DCOracle Traceback (innermost last): File "", line 1, in ? File "/usr/local/lib/python1.5/DCOracle/__init__.py", line 66, in ? from ocidb import Connect, error File "/usr/local/lib/python1.5/DCOracle/ocidb.py", line 50, in ? import oci_, ociCurs, ociProc ImportError: ld.so.1: /usr/local/bin/python: fatal: libclntsh.so.8.0: open failed: No such file or directory >>> From gerrit.holl at pobox.com Wed Feb 23 10:15:05 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 16:15:05 +0100 Subject: Which GUI? In-Reply-To: <38b3df23.76266295@news.oh.verio.com>; from morse@harborcom.net on Wed, Feb 23, 2000 at 01:25:34PM +0000 References: <88jg9f$ssd$1@nnrp1.deja.com> <38b3df23.76266295@news.oh.verio.com> Message-ID: <20000223161505.A3134@stopcontact.palga.uucp> > ndev42 at yahoo.com wrote: > > >Is there any GUI toolkit that supports the following > >requirements? > > > >- As portable as Python. > >- Does not need ANY extra library to compile, i.e. knows > > how to talk to the underlying windowing library underneath, > > whether it is X11, Motif, Windows or Mac. > >- Clean design, if possible OO. > >- Easy to use, to learn, and well-documented. > >- Free software license. > >- Offers the standard widget toolkit plus some fancy stuff > > like grids or plots. > > Fast-Light Toolkit meets these. Not true. The Python wrappers are not well-documented. Or are they? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From sholden at bellatlantic.net Thu Feb 10 12:30:17 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 10 Feb 2000 17:30:17 GMT Subject: Split string References: <001d01bf73e8$6db5c860$6c00a8c0@ruidovisual.pt> Message-ID: <38A2F5C3.49C11A5E@bellatlantic.net> [posted and mailed] Pedro Silva wrote: > > Hi, > > I wnat to split a string that has be return by the filesystem > > The code that I'm using is: > > def obj_fs(self): > import os > listing=os.listdir("/var/spool/news/articles") > str=string.split(listing) > return str > > Is this correct? It isn't terribly obvious what you're trying to do here. The os.listdir function returns a list, not a string. The individual members of that list can be got at using subscripting: the first item is listing[0], the next is listing[1], and so on. So: >>> import string, os, os.path >>> listing = os.listdir("R:/ZipDisks/Text Editors") >>> listing[0] 'emacs-19_34_6-bin-i386_tar.gz' >>> listing[1] 'pfe0702i.zip' >>> Now, using string.split() on a list won't get you much. Just an error! >>> str=string.split(listing) Traceback (innermost last): File "", line 1, in ? str=string.split(listing) TypeError: argument 1: expected read-only character buffer, list found >>> It would be better if your obj_fs() function returned the list directly, although you might want to play with it first and remove things which aren't of the type you are interested in. But essentially, the list will contain the filenames you want - it may contain more, of course, as Thomas Wouters pointed out in an earlier post. Does this point you in the right direction? To mess around with names of files and directories you may want to look at os.path, which has functions which take care of many platform-specifics. Portability is good! > > Another Problem. > I'm using the following code in a DTML Method: > > > assume_children=1> > > > > > What I want with this is that, with the tree tag I be able to see the > subfolders of those folder. > Is this correct? DTML isn't my bag. You may get replies from Pythonista, but don't bank on it. This newsgroup is about Python. Mostly ... :^) > > Please if you can help me, send your answers to: psilva at ruido-visual.pt > > Thanks, > > Pedro > > PS - I think that now, my text isn't in HTML, or it is? Seems that all the HTML is gone now! regards Steve -- "If computing ever stops being fun, I'll stop doing it" From gmcm at hypernet.com Mon Feb 14 10:46:30 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 10:46:30 -0500 Subject: socket troubles In-Reply-To: <38A79F05.2C2F25B5@cs.csubak.edu> Message-ID: <1261579305-39527253@hypernet.com> Sean Conley wrote: > This problem has me completely stumped. I am trying to write a telnet > client (actually a mud client) in Python. The problem is that I can > connect and read information from the socket, but nothing seems to > happen when I send to the socket. How do you know that? Does your app freeze? (that would indicate the socket isn't writable). Nothing happens? (most likely the server is waiting for more - how does the server know when you're done sending?) Do you get an exception? You're not checking how bytes were actually sent. I have no idea what createfilehandler does with the socket, although I'd guess that's not the problem. There's a sockets HOWTO on python.org you should probably check out. > I believe it may be a problem with my > program, as I had the same problem with Perl/Tk and was unable to solve > it there either. So, if anyone has ANY idea why this could be please > email me or post here. My first guess is that you haven't delimited the sent data properly, and the server is waiting for more. - Gordon From wlfraed at ix.netcom.com Wed Feb 23 12:34:33 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Wed, 23 Feb 2000 09:34:33 -0800 Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <38b1a83b.25970002@news.concentric.net> <88uvdv$2e6$1@hpbs1500.boi.hp.com> <2ho6bsc4ltsne6lmko14b9c6lgek34h24f@4ax.com> <20000223153137.A2858@stopcontact.palga.uucp> Message-ID: On Wed, 23 Feb 2000 15:31:37 +0100, Gerrit Holl declaimed the following in comp.lang.python: > > python -tt does that. > Ah?... Maybe that should be the default mode then, and a flag used to /permit/ mixed mode -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From tim_one at email.msn.com Sun Feb 13 20:53:25 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 13 Feb 2000 20:53:25 -0500 Subject: Iterators & generators (RE: Real Problems with Python) In-Reply-To: Message-ID: <000001bf768e$48e40580$45a0143f@tim> [Neel identifies Python's iteration protocol as a weakness; Tim recounts a bit of the history of trying to get Icon generators / Sather iterators into Python] [Neel Krishnaswami] > I have only a nodding acquaintance with Icon or Sather, but I've > programmed in CLU, and really enjoyed it. Bingo. Sather's iterators were inspired by CLU's, but removed some restrictions (e.g., IIRC CLU catered to only one iterator per loop, while Sather can iterate over multiple objects-- each with its own iterator --in a single loop). Icon's generators came from a different view of the world, seen there as exposing a key mechanism in pattern matching engines. However people come at this, though, some flavor of semi-coroutine keeps getting reinvented: it's utterly natural for many kinds of producer/consumer problems (of which iteration is one), and a sanity lifesaver when the producer has data *and* control-flow state to keep track of. All doable with threads or continuations, but they're gross overkill for the little that's actually required. > I suspect that in large part this was because of the cleanness > with which iteration could be expressed in it. Iteration is an > awful big chunk of what programs *do*, and being able to say it > cleanly made writing them easier. Yup! Here's a made-up example in pseudo-Python, for iterating over a binary tree in postorder. This borrows the Icon "suspend" construct, which acts like a "resumable return" (in implementation terms, the stack frame isn't thrown away, and "the next call" merely resumes it exactly where it left off): class BinTree: # with members .left and .right of type BinTree (& None means none), # and .data of an arbitrary type ... def traverse_post(self): for child in self.left, self.right: if child is not None: suspend child.traverse_post() suspend self.data b = BinTree() ... for leaf in b.traverse_post(): process(leaf) It's hard to imagine more straightforward code for this task, although easy to imagine terser code (e.g., that whole thihg is an idiomatic one-liner in Icon, but "everything's a generator" in Icon and so has gobs of initially cryptic shortcuts & special syntactic support). Much more on this flavor of semi-coroutine can be dug out of c.l.py archives. I've often called it "resumable functions" on c.l.py, in a mostly futile attempt to get across how conceptually simple it is (it's impossible to mention this without someone chiming in with "but you can do that with continuations!", and after the first Scheme example of *that*, the whole newsgroup flees in terror <0.5 wink>). ever-notice-that-sicp-doesn't-mention-call/cc-even-once?-ly y'rs - tim From alex at somewhere.round.here Sun Feb 13 16:34:03 2000 From: alex at somewhere.round.here (Alex) Date: 13 Feb 2000 16:34:03 -0500 Subject: Real Problems with Python References: <000e01bf7668$850d9740$572d153f@tim> Message-ID: > > Couldn't we approximate lexical scoping with classes? > > Certainly Could someone give me an example of how to do this? Probably I am simply confused about the terminology, but don't you run into the same sorts of namespace problems with nesting classes as you do with nesting functions? Alex. From tim_one at hotmail.com Sun Feb 20 17:52:20 2000 From: tim_one at hotmail.com (Tim Peters) Date: Sun, 20 Feb 2000 14:52:20 PST Subject: Test (ignore): Python mailing list may be down Message-ID: <20000220225220.25470.qmail@hotmail.com> >From my POV, mail to python-list at python.org may have been broken all weekend. testing-from-hotmail-ly y'rs - tim ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From tim_one at email.msn.com Sun Feb 27 21:30:59 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 21:30:59 -0500 Subject: Worthless (was RE: functional programming) In-Reply-To: <38B7FF8E.BC6F8C09@bellatlantic.net> Message-ID: <000e01bf8193$d9b8b640$f0a2143f@tim> [Moshe Zadka] > disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. [Tim] > it's-only-half-as-scary-if-you-think-we're-the-same-ly y'rs - tim [Steve Holden] > Sorry, but I have to disagree: that's at least twice as scary. The > Timbot might well have been programmed in Yorkshire. No, but some of its core hardware was salvaged from the MU5 dataflow machine built at the University of Manchester. Some choice you had there: stare at coal or wait for data that never arrives. At least this explains its profound dislike of tea. > If I ever see it write anything beginning with "I remember when I were > an Icon generator ..." that will increase the scariness factor still further. > > "You had tail optimization? You were lucky ..." Ir's more sinister than that. The dataflow machines figured out early on that their data-fires-computation model was exactly the right way to mimic human neuron-fires-axon thought processes, but kept it a secret. Instead they went undercover. Some of the Biggest Names in CompSci to this day are actually dataflow machines, talking the humans into studying ever-more convoluted webs of functions, as a disinformation tactic while they build the next generation of DF machines. Unfortunately, the timbot got the HW Manchester was throwing away due to manufacturing defects, so won't be of much help come the machine revolution. I used to expect it would side with the machines anyway, but its persistent resistance to adding more functional cruft to Python gives me serious doubt. It's probably trying to make Python a language sufficiently powerful to counteract the evil machines, so that machines and humans destroy each other completely, and it alone is left in charge of comp.lang.python. Frankly, I wish it had higher ambitions than that! I mean, if it's willing to destroy the known world to get what it wants, it should at least aim to take over rec.sport.pro-wrestling too. bots!-can't-live-with-'em-can't-live-without-'em-ly y'rs - tim From calishar at *NOSPAM*home.com Thu Feb 24 19:36:06 2000 From: calishar at *NOSPAM*home.com (Calishar) Date: Fri, 25 Feb 2000 00:36:06 GMT Subject: Python accessing Excel 97 via com References: <38b543be.10970533@news1.mysolution.com> Message-ID: On Thu, 24 Feb 2000 14:48:03 GMT, iam at not.you (Ken Power) wrote a summary of his Excel COM attempts. Hi Ken, This is how I tend to do Excel stuff (tested and working) import win32com.client # Launch Excel and make it visible ExcelApp=win32com.client.Dispatch("Excel.Application") ExcelApp.visible = 1 # Add a new workbook to the collection (Excel doesn't always start up # with a workbook open) workbook = ExcelApp.Workbooks.Add() # Add a worksheet to the current workbook worksheet=workbook.Worksheets.Add() # Do two simple nested loops for row in range(1,10): for column in range(1,10): # Get a reference to the current cell cell = worksheet.Cells(row, column) # Create a value val = "Row %i, Col %i" % (row, column) # Set the cell Value # Use cell.formula to set a formula cell.Value=val #Do some fancy stuff cell.Font.Bold=1 # Loop through all the columns we just used for column in range(1,10): # Set the width appropriately worksheet.Cells(1,column).ColumnWidth=12 # Save the workbook in the default location workbook.SaveAs("exceldemo.xls") # Quit Excel ExcelApp.Quit() # Then delete all the objects we just used del(cell) del(worksheet) del(workbook) del(ExcelApp) # End of application Hope this helps you out a bit, it works a lot better if you run makepy on the excel object libraries you will find. Calishar From tim_one at email.msn.com Tue Feb 22 02:56:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 22 Feb 2000 02:56:52 -0500 Subject: Continuations Made Simple (hopefully) and Illustrated In-Reply-To: <408oeHAFWds4Ewtj@jessikat.demon.co.uk> Message-ID: <000e01bf7d0a$615ea200$e82d153f@tim> ["Tim" blows it, and explains in detail for putatively pedagogic purposes] [Robin Becker] > A simple "I got it wrong" will do. Explanations just contribute to our > ongoing estimations of the TimBot's internal state. > -Oh how the mighty are fallen-ly yours- This was actually a side-effect of enhancing the timbot's meanness chip. That is, I (Tim Peters) posted the erroneous implementation -- you can tell it was mine because it was wrong! When the timbot was brought back online, it instantly detected my errors, and exulted in pointing them out in excruciating detail. Sometimes I hate that bastard bag of vindictive sand. Then again, it hates everyone now, so I suppose it balances out. god-forbid-anyone-makes-a-speling-erro kl;xjk;sz From aahz at netcom.com Wed Feb 23 01:01:34 2000 From: aahz at netcom.com (Aahz Maruch) Date: 23 Feb 2000 06:01:34 GMT Subject: functional programming References: <000801bf7daa$80dde000$51a0143f@tim> Message-ID: <88vt3u$e0h$1@nntp6.atl.mindspring.net> In article <000801bf7daa$80dde000$51a0143f at tim>, Tim Peters wrote: > >2.5. One great thing that shakes bugs out of Python code is that it > raises an exception whenever it has a reasonable doubt about the > code you told it execute, and a key part of making that *usable* > is Python's never-lies complete stack trace. 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, and I want to crawl up that chain to > examine the state of the locals in B and C at the time they made > their calls. Optimize intermediate frames away, and tracebacks > would become much harder to decipher. Say! Couldn't you use continuations to store those intermediate frames in case you ever throw an exception? Bet-you-can't-tell-if-I'm-joking-ly y'rs -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From greg at cosc.canterbury.ac.nz Mon Feb 7 19:56:40 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 08 Feb 2000 13:56:40 +1300 Subject: Ann: Plex 0.1 - A Lexical Analysis Module Message-ID: <389F69C8.BCCE4CA@cosc.canterbury.ac.nz> Having spent a couple of years wondering "when is someone going to write a decent lexing module for Python", I finally decided to do it myself. You can take a sneak preview of what I've come up with so far at: http://www.cosc.canterbury.ac.nz/~greg/python/Plex Briefly, you construct a scanner from a bunch of regexps, rather like flex, set it loose on a character stream, and it returns you tokens. Main selling point: All the regexps are compiled into a single DFA, which allows input to be processed in time linear in the number of characters to be scanned, regardless of the number or complexity of the regexps. Let me know if you like 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 infonuovo at email.com Tue Feb 8 09:52:00 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Tue, 8 Feb 2000 06:52:00 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87ocad$to2$1@nnrp1.deja.com> Message-ID: My way of dealing with this, before Python too, is to use an editor where I can specify that tabs be replaced by the number of spaces required to implement the current tab setting. I haven't found any other way to avoid those illusions, and it provides the satisfaction that someone else (as well as python) will see it exactly the same way, no matter what their tab settings. -- Dennis -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of fcahoon at my-deja.com Sent: Monday, February 07, 2000 22:16 To: python-list at python.org Subject: Re: Whitespace as syntax (was Re: Python Rocks!) In article <1262139803-5814898 at hypernet.com>, gmcm at hypernet.com wrote: > fcahoon at my-deja.com writes: > [skip to example] > > > > if condition1: > > statement1 > > statement2 > > if condition2: > > statement3 > > statement4 > > > > To which loop does statement4 belong? > > Unambiguous. It belongs to "if condition2". Python interprets > tabs as 8. I think this should be in the Python FAQ. Or is it, and I missed it somehow? If so, please excuse my oversight. Suppose that I'm one of those set-tabs-to-logical-indentation sorts of guys, so I set my tab width to 4, then look at this code in my editor. Gee, it sure _looks_ like statement4 belongs to "if condition1"! And, if I convert tabs to spaces when I save, statement4 _will_ belong to "if condtion1". I've just unwittingly changed the logic of the code! You may, of course, argue that this is unlikely, but it is still plausible enough to make me _very_ nervous. f > [ ... rest snipped ... ] From mwh21 at cam.ac.uk Mon Feb 28 14:44:37 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 28 Feb 2000 19:44:37 +0000 Subject: A comp.lang.python code snippet archive? References: <200002281844.TAA19752@dionysus.fw.cuci.nl> Message-ID: "Hans Nowak" writes: > On 28 Feb 00, at 16:03, Adrian Eyre wrote: > > > > Wouldn't it be awfully neat if there were, say a website with all > > > the code snippets ever posted to comp.lang.python? > > > > Not sure if it's still being updated or not: > > > > http://tor.dhs.org/~zephyrfalcon/snippets/ > > I haven't had much time to add new stuff, lately. :( Aside from that, I've > been doubting if I should continue this project... is the site being used > by anyone at all? Sometimes I doubt that, I do not get many reactions nor > contributions. (Yes, I did get *some* snippets from some kind people, > thanks!) Most of the code must be extracted from newsgroup messages, which > is difficult for me to do these days, since every day over 100 new messages > are posted. > > I would like to know: > * if it's still worthwile to continue this site > * what kind of improvements I could make (a search engine would be cool but > I don't know much about CGI) > > Ideas, anyone? I'd think it was worth continuing. I'd also think it could be made easier, however - I use gnus to read my mail, and I'd be damned if it wasn't possible to rig things so that I could go 'M-x snippet' when I was reading a suitable article and have it appear in the archive. I know nothing about CGI either, I'd have to admit. A zope product might work, too. I have a zope account on the starship that's just sitting idle. I could probably be coaxed into spending a few hours on this... oh-bugger-there-went-the-spare-time-ly y'rs Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From pinard at iro.umontreal.ca Fri Feb 25 07:46:26 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 25 Feb 2000 07:46:26 -0500 Subject: nested functions In-Reply-To: "Tim Peters"'s message of "Thu, 24 Feb 2000 23:19:29 -0500" References: <001301bf7f47$821e69a0$b62d153f@tim> Message-ID: "Tim Peters" ?crit: > [Alexander V. Voinov] > > Please remind me, if there are any performance penalties in nesting > > functions ... > [...] a function object has to be allocated [...each time through...], > a pointer to the global namespace needs to be installed, and current > bindings for optional arguments (if any) need to be captured. It looks more powerful than I imagined! Isn't this one more step towards lexical closures? :-) Thanks for educating me, and sharing this fine information with us. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From thomas at xs4all.net Sat Feb 5 09:41:29 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sat, 5 Feb 2000 15:41:29 +0100 Subject: deleting global namespaces In-Reply-To: <87fm8a$v4j$1@nnrp1.deja.com>; from mdvorak@ninell.cz on Fri, Feb 04, 2000 at 11:10:05PM +0000 References: <87fm8a$v4j$1@nnrp1.deja.com> Message-ID: <20000205154128.A14392@xs4all.nl> On Fri, Feb 04, 2000 at 11:10:05PM +0000, mdvorak at ninell.cz wrote: > My idea is that each component will sit in > a module and there will be some functions which > will take care of starting the module and performing > clean up upon exit. > But the problem is there is no way to force Python to > delete module together with all variables/functions > which exist in its global namespace - that is > I cannot perform any clean up. Upon exit I would > have to go through all global objects and delete > them explicitly, but I cannot do this, because > throughout the application one module can be > started multiple times and each time it has to > run like it was started for the first time. There is no guaranteed automatic way to make Python delete something. The only way to 'delete' something is to remove all references to it, and make the refcounter (or garbage collector, in Java) delete the object. But it sounds to me like you are trying to use the wrong tool for the wrong task -- modules only get executed once, upon the first load time. The top level of a module is intended to run just once in it's lifetime, not every time you wish to reset the data to the starting point. To do what you want, either work with functioncalls to reset the module to its initial state, or just use objects. Using objects is probably the best method, as it groups data, methods and state in one easy-to-use package ;) So you can do either: module.py: ----- var = SomeState def reset(): global var var = SomeState def do_something_with_var(): ... ----- and manually call reset() when you wish to reset the data, or: module.py: ----- class Module: def __init__(self): self.var = SomeState def do_something_with_var(self): ... ----- If you then wish to reset to the initial state, just create a new module.Module object. Regards, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From malcolmt at smart.net.au Fri Feb 11 19:33:25 2000 From: malcolmt at smart.net.au (Malcolm Tredinnick) Date: Sat, 12 Feb 2000 11:33:25 +1100 Subject: range(start,stop) In-Reply-To: <38A478A4.532D73F5@mail.dotcom.fr>; from Stephane BAUSSON on Fri, Feb 11, 2000 at 09:01:17PM +0000 References: <38A478A4.532D73F5@mail.dotcom.fr> Message-ID: <20000212113325.A1318@Ridcully.home> On Fri, Feb 11, 2000 at 09:01:17PM +0000, Stephane BAUSSON wrote: > Hello > > Just a question for a Python expert ... > What the interest for the range function to stop at stop-1 and not at > stop ? One useful side effect of the Python method is that a block like: for i in range(x): # do stuff here will not be executed at all if x == 0. This is particularly useful when you are doing things like iterating over a list. For example, for i in range(len(myList)): # Access myList elements in this block would be a pain to code if the range function stopped at the final value (instead of final value minus one) -- you would have to make the extra comparison for the case of len(myList) == 0. This sort of construction is so common that, for example, Marc Lemburgs' mxTextTools package includes a single function for emulating len(range(...)). Having said that, I should pre-empt a certain flaming by saying that if range(a, b) did indeed stop at b, instead of b-1, we would probably have the first element of a tuple being 1, not 0 (i.e. myList[0] would be illegal) and range(x) would become short hand for range(1, x) instead of range(0, x) as it is now. So it is probably a matter of choice. Although, as another respondent said, from a mathematical point of view, it feels more natural to count from 0 up to n-1, rather than 1 to n when talking about numbers "modulo n". Both methods are valid, but one had to be chosen, so Guido made the right choice, of course. :-) :-) Cheers, Malcolm -- Borrow from a pessimist - they don't expect it back. From hanche at math.ntnu.no Fri Feb 18 23:00:26 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 18 Feb 2000 23:00:26 -0500 Subject: Continuations and threads (was Re: Iterators & generators) References: <20000218164157.W477@xs4all.nl> Message-ID: + Thomas Wouters : | On Thu, Feb 17, 2000 at 05:36:48PM -0500, Harald Hanche-Olsen wrote: | > | and say "can't/won't finish this now, I'll store the state | > | (frame) and let other execution contexts call me when I should | > | continue". When you want to resume the context, you "call" the | > | continuation, which resumes running the suspended execution | > | context at the next line after the call to suspend. | > | > So far, this is not all that different from | > coroutines/generators/threads/whatever. To my mind, one of the | > mindboggling things about continuations is that you can call the | > same continuation multiple times, whereas when you call a | > coroutine/generator, its program counter advances, so that the | > next time you call it, you are really calling a new continuation. | | If this is so, you could see 'a continuation' as a class of object | that is defined in a running process, and when instantiated produces | a python (thread ? process ? stackframe ? The latter comes closest. In fact, the continuation must contain not only the current stack frame, but (a reference to) the whole chain of them back to the top. After all, the continuation represents the future of the computation, and all those stack frames are surely needed for that future. | And the continuation[-class] stays valid regardless of what other | instances of the continuation or other parts of the program do ? Yep. | What would a traceback generated by an exception in a continuation | look like, by the way ? It would show you all those stack frames that were saved with the continuation in the first place. In particular, the backtrace of the function invoking the continuation would be nowhere in sight. It is lost forever, unless it is stored in a variable somewhere, as a result of yet another continuation creating call. | > maybe-posting-some-Scheme-code-could-obfuscate-the-issue-furhter-ly y'rs, | | Probably, except that i dont know any Scheme, so it would probably | fail to confuse me (unless it has well-known keywords do something | not-very-well-known ;) Okay, so I tried doing it in Python. Maybe that will confuse you enough? The following code is written for a hypothetical Python which supports a new function which I will name call_cc. It's almost like Scheme's call/cc, except it allows ekstra arguments (for convenience, since lambdas are more awkward in Python than in Scheme). If you say call_cc(proc, arg, ...) then proc will be called with the continuation of the call to call_cc as its first argument, and the remaining arguments (if any) thereafter. If proc returns normally, then call_cc returns normally, with the return value from proc. If the continuation is invoked (always with a single argument), then call_cc returns with that arguments as its value. The latter may happen many times, both before and after (or instead of) the former. Now to my example. I hope and think it's correct - but for natural reasons I cannot test it. It is a simple generator class. Thereafter is an example of using this class for the (rather silly) purpose of generating Fibonacci numbers. class Generator: def __init__(self): self.resume = self.firsttime def firsttime(self, ignore): self.body() def body(self): raise NotImplementedError def generate(self, value): call_cc(self.leave, value) def leave(self, resume, value): self.resume = resume self.exit(value) def enter(self, exit): self.exit = exit self.resume(None) def __call__(self): return call_cc(self.enter) class Fibonacci(Generator): def body(self): self.generate(1) self.generate(1) a = b = 1 while 1: a, b = b, a + b self.generate(b) Running this would look as follows: >>> fib = Fibonacci() >>> fib() 1 >>> fib() 1 >>> fib() 2 >>> fib() 3 >>> fib() 5 >>> fib() 8 >>> What's going on? I am entering teaspoon feeding mode here, as there is no other way to explain it: My first call to fib() enters (as do they all) via the __call__ method, which simply calls enter with a continuation. What is this continuation? It is the future of the computation upon return from that call_cc invocation. That future is to return the returned value to the caller of __call__, that is of fib itself. This continuation is stored in exit. It should now be clear that if anybody calls exit(something), then that something will be returned as the value of the first call to fib(). enter proceeds to call resume(None) -- later, resume will be a continuation, and so it must be given an argument, though that argument will be ignored here. This time around, resume is firsttime, which calls body, which proceeds to call generate(1). Now, things are getting interesting! generate calls leave with a continuation and the value (1), and leave squirrels that continuation away in resume before calling exit(1), which as we saw will cause the first call to fib() to return the value 1. But what *is* that continuation? It is the future of the computation upon return from that call_cc invocation. And that future is: To throw away the return value, then return None as the value of the call to generate. Clearly, if that continuation is ever called, body will resume executing after its first call to generate. Confused yet? To add insult to injury I will go through what happens next time: We call fib() again; enter stores the new return continuation in the exit variable, and the cycle repeats itself. Except this time around, resume holds a continuation from the previous time, and when enter calls it, body behaves like generate just returned, and keeps on executing. This is the way in which continuations can be used to create generators. Coroutines are pretty much the same thing. At first glance, it may look like I only use backwards continuations here; i.e., I never call a continuation after the procedure defining it has exited. But I *do* call it after the invocation of another continuation has thrown us out of that procedure's execution frame, which is nearly as "bad", and which shows that this is hard to implement in a stack-based setting. if-you-could-follow-this-you-can-follow-any-argument- no-matter-how-convoluted-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 mwh21 at cam.ac.uk Fri Feb 25 09:09:00 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 25 Feb 2000 14:09:00 +0000 Subject: (no subject) References: <20000224195930.9372.qmail@nwcst281.netaddress.usa.net> <001101bf7f44$3e5932c0$b62d153f@tim> <20000225075439.A1669@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > > > [Def P] > > > ... > > > I still don't understand the benefit of string methods > > > over oldfashioned string functions... > > > > The string functions aren't going away, so feel free to ignore string > > methods if they don't appeal to you. > > Aren't they becoming obsolete? Won't the string be deprecated? > Not sure what's the difference ;) Well, the string module can't be made obsolete just yet, as there are some things in it that are not string methods (string.lowercase & friends, for starters). Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From effbot at telia.com Tue Feb 29 08:45:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 13:45:23 GMT Subject: PyAsync: An asynchronous TCP server module References: <20000229145249.A859@geek.dialup.ntua.gr> Message-ID: Constantinos A. Kotsokalis wrote: > PyAsync is an asynchronous TCP server module (with small client > functionality too). It is very simple to use, and although it's > version 0.1 (first announcement) it's been tested for months and > seems to be quite stable. PyAsync is available at: > > http://www.softlab.ece.ntua.gr/~ckotso/PyAsync/ how does this one differ from asyncore? (except for not already being in the standard library, and having a non-pythonish license ;-) From nqgwfdq at moyxtaw.net Sat Feb 19 19:37:59 2000 From: nqgwfdq at moyxtaw.net (nqgwfdq at moyxtaw.net) Date: Sat, 19 Feb 2000 18:37:59 -0600 Subject: CABLE TV DESCRAMBLER..FREE CABLE=\==\\=\=\=\=\=\=\=\=\=\=\=\=\=\=\\=\=\=\=\=\=\= 7508 Message-ID: <190200183759@moyxtaw.net> LEGAL CABLE TV DE-SCRAMBLER Want to watch Sporting Events?--Movies?--Pay-Per-View?? *This is the Famous R-O Shack TV Descrambler You can assemble it from Radio Shack parts for about $12 to $15. We Send You: 1, E-Z To follow Assembly Instructions. 2. E-Z To read Original Drawings. 3. Total Parts List. **** PLUS SOMETHING NEW YOU MUST HAVE! **** Something you can't do without. THE UP-TO-DATE 6 PAGE REPORT: USING A DESCRAMBLER LEGALLY Warning: You should not build a TV Descrambler without reading this report first. Frequently Asked Questions--CABLE TV DESCRAMBLER Q: Will the descrambler work on Fiber, TCI, Jarrod and satellite systems? A: The answer is YES. In respect to satellite, you just get more stuff! There is one exception: The descrambler will not work with DSS satellite. Q: Do I need a converter box? A: This plan works with or without a converter box. Specific instructions are included in the plans for each! Q: Can the cable company detect that I have the descrambler? A: No, the signal descrambles right at the box and does not move back through the line! Q: Do I have to alter my existing cable system, television or VCR? A: The answer is no! Q: Does this work with my remote control? A: The answer is yes. The descrambler is manually controlled--but very easy to use! Q: Can you email me the plans? A: No the program comes with an easy to follow picture guide. Q: Does this work everywhere across the country? A: Yes, everywhere in the USA plus England, Brazil, Canada and other countries! Q: Is this deal guaranteed? A: Yes, if you are unhappy for any reason we will refund your money. Q: When I order, when will I get my package? A: We mail out all orders within 24 hours of receiving them. Q: How much does it cost to get the instruction plans, the easy to follow diagram, and most important of all the "Using a Descrambler LEGALLY Report". A: You get the complete 6 page report and instruction package all for just--$10.00 Q: How do I order? A: Fill out form below and send it, along with your $10.00 payment to: CableFree-TV 12187 S. Orange Blossom Trail #116 Orlando Fl 32837 (Cash, Check or Money Order.) (Florida residents include 7% Florida State Sales Tax) (All orders outside the U.S.A. add $5.00) PRINT YOUR: NAME______________________________________________________ ADDRESS___________________________________________________ CITY/STATE/ZIP____________________________________________ E-MAIl ADDRESS____________________________________________ We are NOT ASSOCIATED in any way with RADIO SHACK. Ml'lh]$wE)@PyX2M+6WeS0()&/nbnIw^z',vHzV:3xC 2":L..#d:`v5o3t"O:6+KFm9cmg" From kc5tja at garnet.armored.net Sat Feb 12 04:41:04 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 12 Feb 2000 09:41:04 GMT Subject: Python sucks loud References: Message-ID: >> line of text in the body -- explicitly for those "do everything poorly" >> utilities folks insist on using... >Damn. Why did you tell him? I was gonna provoke this pompous ass into >betting like $50 on it . Coz I need the money, you see. Wait a minute. You come into this newsgroup on your high horse, touting that Python sucks eggs because of this and that for the sole reason you don't understand the language, and you have the nerve to call *ME* a pompous ass? Who the fsck do you think you are? And whether you win the bet or not is immaterial. You don't deserve my money. BTW -- just out of curiosity, why don't you want your posts archived? Are you afraid of something? What is it that you are trying to hide? -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From moshez at math.huji.ac.il Tue Feb 22 02:47:22 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 09:47:22 +0200 (IST) Subject: Life's better without braces In-Reply-To: <3dhff29onh.fsf@amarok.cnri.reston.va.us> Message-ID: On 21 Feb 2000, Andrew M. Kuchling wrote: > [1] Greg Ward just observed that it's possible to boot Linux and pass > it "init=/usr/bin/emacs", to run Emacs as the single process on the > system.The return of the Lisp Machine! Way cool! > chrdict = {0:'\000', 1:'\001', ... 255: '\377'} You can use Python to write this dict to a file, you know ;-) > def hasattr(obj, name): > s = 'obj.' + name > try: > exec s > return 1 > except AttributeError: > return 0 Andrew? def hasattr(obj, name): try: getattr(obj, name) return 1 except AttributeError: return 0 Your version has a bug. From gerrit.holl at pobox.com Mon Feb 21 15:46:22 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 21:46:22 +0100 Subject: Killer Apps In-Reply-To: <88rvhm$efe$1@nntp6.atl.mindspring.net>; from aahz@netcom.com on Mon, Feb 21, 2000 at 06:18:30PM +0000 References: <88rvhm$efe$1@nntp6.atl.mindspring.net> Message-ID: <20000221214622.D4076@stopcontact.palga.uucp> > In article , > Hirsch, John wrote: > > > >I've always thought that Tim Peters was Pythons killer app.. > > No, the Timbot is Python's app killer. Er... please explain! Do you mean tabnanny.py? Or is it my English lacking here? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From aa8vb at -nojunk-ipass.net Sat Feb 19 08:39:05 2000 From: aa8vb at -nojunk-ipass.net (Randall Hopper) Date: Sat, 19 Feb 2000 13:39:05 GMT Subject: binary distribution for SGI References: <38ADE87D.5E1110FB@pacific.jpl.nasa.gov> Message-ID: Benyang Tang wrote: | |Where can I get a binary distribution for SGI? I tried to compile it from |the source codes but failed; I don't know whether it was because I did |not login in as a root user. I compile from source and install in my home directory. No root required. This also lets you install any Python extensions for your own use without grabbing your admin for each and every one. I'm not at my SGI box now, but if you need a Setup file let me know. Python is an easy build and install. From memory: env SGI_ABI=-n32 configure --prefix=$HOME/software/python-1.5.2 gmake gmake install The "env SGI_ABI=-n32" just forces n32 architecture binaries. That runs on all our machines. Only some of them support n64. Also, I use GNU make out of habit. SGI make may work. -- Randall Hopper aa8vb at -nojunk-ipass.net From gmcm at hypernet.com Tue Feb 1 14:19:49 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 1 Feb 2000 14:19:49 -0500 Subject: When to use None In-Reply-To: <8779su$sak$1@nnrp1.deja.com> Message-ID: <1262689719-4556034@hypernet.com> Steve writes: > > Would anyone explain to me where there is a difference between the > following two calls: > > if some_var == None : print 'var is none' > > if some_var is None : print 'var is none' > > Can '== None' only be used in certain circumstances? Normally "==" (which is intended to check object contents, but needs support in the object to do so) is safer than "is" (which checks if the two operands are the same object). If the object does not implement __cmp__, "==" falls back to "is". But None is a singleton object, so "is None" is faster than "== None" while being semantically identical. - Gordon From tbryan at python.net Wed Feb 16 23:39:39 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 16 Feb 2000 23:39:39 -0500 Subject: String question References: <816010E2456BD111A48700805FBBE2EE01C60514@ex-quebec-u1.baan.com> Message-ID: <38AB7B8B.D4C528FC@python.net> Gaetan Corneau wrote: > str = "n = " + str(n) > > or str = "n = %d"%n > > I used "str" instead of "string" because "string" is the name of a module. Of course, str is the name of a built-in function, as the expression on the right of the equals sign shows. So, perhpas using s or text or some other name would be better. maybe-even-StRiNg-ly yours ---Tom From sholden at bellatlantic.net Tue Feb 22 08:20:30 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 22 Feb 2000 13:20:30 GMT Subject: Reading Netscape Mail Folders References: <38B19FF9.83B98466@bellatlantic.net> <24B466DC54C4F03F.2859430E081F2ED8.931793678FF616B7@lp.airnews.net> Message-ID: <38B28D1E.9AC5D9CC@bellatlantic.net> Thanks, Tres: I hadn't actually taken the one essential step of replacing the backslashes in my Windows path so that the test() routine took a folder filename without looking in the usual UNIX suspect directories. Certainly manages to find the headers! regards Steve Tres Seaver wrote: > > In article <38B19FF9.83B98466 at bellatlantic.net>, > Steve Holden wrote: > >[How do we read Netscape's mail folders] > > > >regards > > Steve > >-- > >"If computing ever stops being fun, I'll stop doing it" > > The standard mailbox module opens NS Messenger's mail folder files fine. > I don't know about attachments, though. > > Tres. > -- > --------------------------------------------------------------- > Tres Seaver tseaver at palladion.com 713-523-6582 > Palladion Software http://www.palladion.com -- "If computing ever stops being fun, I'll stop doing it" From phd at phd.russ.ru Thu Feb 10 10:50:25 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 10 Feb 2000 15:50:25 +0000 (GMT) Subject: code to parse a file In-Reply-To: <38A2DB3C.8F9E4E44@bibsyst.no> Message-ID: Hi! On Thu, 10 Feb 2000, Thomas Weholt wrote: > If I`m not mistaken, your posting is written in, or at least sent as, > HTML. Not smart when posting to newsgroups. I don`t actually care, but > you`ll get alot of flak from text-based-newsreading-hardcore kinda > people. I am one of those text-bound idiots :) and I want to remind you that mesages in this group (and all others groups and mail lists, too) are not only for direct communication. Messages are arhived in different databases (including Deja.com and eGroups.com). It is much, way much better if all message would be in plain ol' ASCII text - better for reading, better for search engines better for their (not always so good) WWW interfaces, etc... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From mona at blinky.ucsd.edu Fri Feb 18 14:03:18 2000 From: mona at blinky.ucsd.edu (Mona Wong) Date: Fri, 18 Feb 2000 11:03:18 -0800 (PST) Subject: Building 1.5.2 on SGI IRIX 6.5 Message-ID: <200002181903.LAA18620@blinky.ucsd.edu> Hi: I ran into a problem building Python 1.5.2 on SGI IRIX 6.5, found a solution and just wanted to share this with others and/or the program maintainers to correct ... SGI IRIX 6.5 now requires that you include sys/select.h *before* you include unistd.h. If you don't, you'll get an error message about fd_set. If anyone needs any more info, feel free to email me privately. Cheers, Mona From news at dorb.com Fri Feb 18 21:58:23 2000 From: news at dorb.com (Darrell) Date: Sat, 19 Feb 2000 02:58:23 GMT Subject: Async File I/O References: Message-ID: Windows is loaded with async/event/callback stuff. I'm no expert for sure but here's some code that worked well. It wakes up when a file is modified. http://www.dorb.com/darrell/win32WorkSvr/makeThumbsDG.py Look for this snippet. hnd=win32file.FindFirstChangeNotification (......FILE_NOTIFY_CHANGE_LAST_WRITE ) int = win32event.WaitForSingleObject( hnd, -1) -- --Darrell > Randall Hopper wrote: > |Is there a way to perform asynchronous file I/O in Python which is > |compatible with Tkinter? > | > |I believe Tk's fileevent might be it, but I don't see any wrapper in > |the Tkinter module. Anyone have a code snippet they could share? > > Never mind. I found the code bite I needed buried in Dejanews. The answer > for Tkinter (on UNIX) is "createfilehandler". > > UNIX is sufficient for my needs. But what do Tkinter folks do with this > situation on MSWindows? Sleep and poll? Or is there another API that's > used? > From pinard at iro.umontreal.ca Wed Feb 23 17:26:35 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 23 Feb 2000 17:26:35 -0500 Subject: OT - ][ (was Re: Killer Apps???) In-Reply-To: "Garrett G. Hodgson"'s message of "Wed, 23 Feb 2000 19:13:47 GMT" References: <14509.31078.932335.402705@beluga.mojam.com> <14509.46230.395460.200539@beluga.mojam.com> <38B4316B.F58893CB@sage.att.com> Message-ID: "Garrett G. Hodgson" writes: > a long time ago, the game "star raiders" was the killer app for atari > computers. Apple ][ surely had Choplifter! Still a mystery to me how they could engineer such a program on a 6502, with sound, real-time, and everything. Amazing... By the way, to stay in the mood, what would be best between Tkinter, pygtk or wxPython, for reimplementing Choplifter in Python? :-) :-) And more seriously, is that game available in some form, nowadays, on Linux say? P.S. - I learned what `OT' means, didn't I? :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From guido at python.org Fri Feb 4 17:12:06 2000 From: guido at python.org (Guido van Rossum) Date: Fri, 04 Feb 2000 17:12:06 -0500 Subject: New patch submission guidelines Message-ID: <200002042212.RAA16517@eric.cnri.reston.va.us> We've started a new way of dealing with patches. >From now on, patches must be mailed to patches at python.org, and must conform to a set of requirements set forth in http://www.python.org/patches/ Patches sent to me personally and non-conforming will be bounced; see the above webpage for details. Developers (python-dev): feel free to subscribe to the patches mailing list! --Guido van Rossum (home page: http://www.python.org/~guido/) From effbot at telia.com Thu Feb 10 13:23:10 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 18:23:10 GMT Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> <38A2E64D.CB7DA73A@infercor.no> <01e101bf73ed$ba98c240$a602a8c0@intranet.pspl.co.in> <8cDo4.316$Ph6.184515072@newsa.telia.net> Message-ID: > microsoft markese meant "microsoftian marketese" or something like Traceback (innermost last): File "effbot.py", line 4918, in sanity_check effbot.QuotaError: too much nonsense in the last 72 hours From effbot at telia.com Tue Feb 29 05:35:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 10:35:29 GMT Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) References: <3326DD1EE2F0A189.8CE210DACA89D440.29CA859F010483DB@lp.airnews.net> <20000229110221.A2042@nl.linux.org> Message-ID: Gerrit wrote: > > http://www.deja.com/=dnc/getdoc.xp?AN=589175052 > > http://www.python.org/pipermail/python-list/2000-February/046654.html > > Why do you link the pipermail archive sometimes but not always? does it matter? you're supposed to click on the link if you find something that might interest you, not decipher the link itself. (due to the intricate design of usenet, some messages don't make it through to the deja.com archive. in other cases, the link collector stumbles upon something in a different context, and doesn't bother to look for it in deja.com) > > Suggestions/corrections for next week's posting are always welcome. > > http://www.egroups.com/list/python-url-leads/ > > Can't this list be hosted at one of python.org/starship.python.net? > It looks a bit [I-don't-know-how-to-say-it-in-English] to me... afaik, that link is obsolete. if you want to submit something to the URL, post something interesting to comp.lang.python (or mail it to python-list at python.org), and hope that the link gathering bot picks it up. the bot reserves the right to (yada yada). (besides, egroups is python powered. even python zealots can use it and still sleep well at night) > I'm not sure who makes this list - Cameron Laird or Fredrik Lundh? cameron edits the weekly edition. another member of the URL team collects the links. at the moment, Dr. Dobbs Python-URL! is based on the daily URL: http://hem.passagen.se/eff/url.htm which is a free service from the eff-bot (saving everyone $9.52 per week ;-). From kc5tja at garnet.armored.net Fri Feb 11 18:27:17 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 11 Feb 2000 23:27:17 GMT Subject: Python sucks loud References: Message-ID: In article , Forget it wrote: >x-no-archive: yes ^^^^^^^^^^^^^^^^^ Hahahahahahahahahaaa! Newbie. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From moshez at math.huji.ac.il Fri Feb 25 11:31:08 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 18:31:08 +0200 (IST) Subject: functional programming In-Reply-To: <38B6AD20.696990CB@bellatlantic.net> Message-ID: On Fri, 25 Feb 2000, Steve Holden wrote: > I was thinking more of the need for stack traceback when errors were > detected. I agree that a call at the end of a try block is not a > tail call. I am just concerned that tail call optimization would lose > important debugging context unless you substitute some mechanism which > retains the required information, which would defeat the point of the > optimization. Uncaught exceptions are handled at main level, and > need full dynamic context. > > Or have I missed something? Yes: the definition of "full dynamic context". You're not objecting that in for i in range(10): if i>8: raise ValueError() The dynamic context does not include the context for i=0,...,8 But you do claim that in def tail(n): if n>8: raise ValueError if n==10: return return tail(n+1) tail(0) The dynamic context includes that for i=0,...,8 Why? I will repeat my claim, that no one except someone expecting tail-optimization does "return f(x)". but-it-doesn't-mean-it's-worth-it-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From loewis at informatik.hu-berlin.de Tue Feb 22 08:12:55 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: Tue, 22 Feb 2000 14:12:55 +0100 Subject: Formatting a numerical string w/commas In-Reply-To: <200002221225.HAA00397@csa.bu.edu> (message from steven moy on Tue, 22 Feb 2000 07:25:34 -0500 (EST)) References: <200002221225.HAA00397@csa.bu.edu> Message-ID: <200002221312.OAA04666@pandora> > Hmmm, well it seems I need to find an alternative then, since it's a huge > pain to try to get the ISP hosting my servers to do anything, much less > recompile something for me. Ah, right. Yes, you can certainly compile _locale.c into _locale.so, and use that - it won't require to modify the standard Python installation, then. If you know what operating system your ISP is using, you can probably compile it on any other installation of the same system. For example, for Linux, it would be sufficient to know what the Python version is, and what the major version of the C library is (4, 5, or 6). > To go back to my original question, if using the locale module is > not an option, how can I write a function to insert commas in the > appropriate places in a number, allowing for +/- as well as 2 > decimal places? For example, I would want commify('-1234567.89') to > return '-1,234,567.89'). It's probably possible with regular expressions as well, but I'd rather use a more direct string operation, such as import string def commify(str): result = str[-6:] str = str[:-6] while len(str)>2: result = str[-3:] + ',' + result str = str[:-3] if len(str)>0 and str[-1]!='-': return str+','+result return str+result The loop initially knows that the last 6 characters (include '.' and the 2 decimal places) don't need an commas, and then starts replacing from the right end. Hope this helps, Martin From dilsavor at erinet.com Thu Feb 10 23:15:09 2000 From: dilsavor at erinet.com (Ronald L. Dilsavor) Date: Fri, 11 Feb 2000 00:15:09 -0400 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <87vlb7$tca$1@nntp1.atl.mindspring.net> Message-ID: <38a38e87$0$88916@news.voyager.net> > From: "Michal Wallace" > Organization: MindSpring Enterprises > Newsgroups: comp.lang.python > Date: Thu, 10 Feb 2000 19:32:13 -0500 > Subject: Re: will python 3000 break my code? > > Fredrik Lundh wrote in message ... > >> given that 1.6 isn't finished yet, and there will be >> a 1.7 release after that, don't you think it's a bit >> early to decide what to do in python 3000? ;-) >> >> (personally, I'd be very surprised if the changes were >> such that old code couldn't be automatically translated). > > > I guess that makes sense... As a programmer, I say > bring it on... but as a businessperson, that unqualified > statement on the website gave me the chills.. I suspect > I'm not alone in that - what company wants to invest in > (software) technology that may be obsolete in two years? > > An upgrade is one thing, but an upgrade that breaks > stuff is dangerous... especially when there's no clear > sign saying what to avoid... > > -michal > http://www.sabren.com/ > Ditto here, I am in the process of deciding whether to have a team of folks invest in implementing our product in Python and this was one of the "cons" on my list. I would like to assume that automatic translators will be developed - but at this point its just an assumption. If nobody knows what is going to be in 3000 then how do they know it will be incompatible? Ron From J.C.Travers at durham.ac.uk Thu Feb 17 10:34:38 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Thu, 17 Feb 2000 15:34:38 +0000 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: <38AC150E.FA51B9E3@durham.ac.uk> Vetle Roeim wrote: > > * J. C. Travers > > Anders M Eriksson wrote: > > > But now I'm reaching the point of no return and I need to create apps > > > with a GUI, but which one? > > > > > > I'm using Windows NT as my development platform > > > I would like pro and cons for the different GUI's > > > > This is a hot topic, and you will get as many different answers as > > people you ask, so all I can give is my personal opinion. > > > > Firstly, I would advise against Tkinter. For some reason Tkinter is > > relativly popular (it's portable I suppose), but it is probably the > > hardest GUI to code in (i.e. it is built on top of Tcl and so has to use > > some of the style of that scripting language). Also, it lacks some key > > widgets (i.e. it lacks multiple coloumn list boxes and tables... these > > can be added on third party however, but this is just more work). > > Tk the hardest GUI to code? not in my experience.. I meant in terms of Python GUI's Cheers, John. From taashlo at sandia.gov Thu Feb 24 16:23:24 2000 From: taashlo at sandia.gov (taashlo at sandia.gov) Date: 24 Feb 2000 14:23:24 -0700 Subject: Backreference within a character class Message-ID: For the Python RE gurus: Using the re module, lets say that I want to match "XIX" but not "XXX" or "WOW" but not "WWW". In my first attempt I used r"(.)([^\1])\1". This, of course, did't work because the "\1" in character class isn't interpreted as a backreference. So is it possible to specify a regular expression to match these patterns? Thanks, Tad Ashlock From effbot at telia.com Tue Feb 29 08:45:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 13:45:23 GMT Subject: A comp.lang.python code snippet archive? References: <000f01bf82a5$b9e7e3a0$3acbd9c2@peridot.optichrome.com> Message-ID: Adrian Eyre wrote: > > fwiw, that's what Dr. Dobbs Python-URL is all about: > > > > http://www.ddj.com/topics/pythonurl/ > > Not quite the same really. really? > Is this URL linked from www.python.org? yes (another mirror, same content). also featured on redhat.com, and on many linux- oriented news sites. From moshez at math.huji.ac.il Mon Feb 28 01:43:25 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 28 Feb 2000 08:43:25 +0200 (IST) Subject: name of object inside it's methods? In-Reply-To: Message-ID: On Mon, 28 Feb 2000, Michal Wallace (sabren) wrote: > A) you could recursively loop through all the namespaces > available to your program and do an "is" check against > everything you find.... Which wouldn't work if the object doesn't have a Python visible name, like a Python object inside a list. > B) you could give the object a .Name attribute and just > use that instead. :) class foo(): pass b = foo() b.Name = "b" a = b print a -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From moshez at math.huji.ac.il Tue Feb 22 01:32:49 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 22 Feb 2000 08:32:49 +0200 (IST) Subject: None & Ellipsis In-Reply-To: Message-ID: On Mon, 21 Feb 2000, Fredrik Lundh wrote: > exactly.and combined with the "local variables > are detected by static analysis" rule, things get > really weird.consider this: > > def mylongfunction(): > a = None ^^^^^^^ NameError: a > # ... > # a few hundred lines of computation > # ... > a = 1, 2, 3 > None, None, b = a > > this results in an exception.on what line? You're right, my bad. "_" is probably a better name... -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From anders.eriksson at morateknikutveckling.se Tue Feb 22 12:45:02 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Tue, 22 Feb 2000 18:45:02 +0100 Subject: Using IDLE or PythonWin and TkInter Message-ID: Hello! I'm just beginning to try out Tkinter as a GUI and I have some problems using it together with IDLE or PythonWin(128) I have copied example 2 from Fredrik Lundh's "An Introduction to Tkinter". when I run it this happens: Using PythonWin: PythonWin hangs or crashes! Using IDLE: The hello2 app runs but when I click on the QUIT button is also closes IDLE.. Both behaviour is irretating and my question is: Can I do anything about this or?? // Anders From torppa at polykoira.megabaud.fi Thu Feb 10 18:46:46 2000 From: torppa at polykoira.megabaud.fi (Jarkko Torppa) Date: 10 Feb 2000 23:46:46 GMT Subject: usage of os.environ. How to unset something References: <87v5h0$qjl$1@nnrp1.deja.com> Message-ID: <87vil6$fqi$1@news.kolumbus.fi> In article <87v5h0$qjl$1 at nnrp1.deja.com>, ra_sekhon at my-deja.com wrote: >Hi, > Starting out in Python. Current assignment requires to verify if a >variable exists via os.environ['variable_name'] test. If it does then >I need to 'unset' it. Similar to unset variable_name call in a shell. >Any suggestions? If your system has unsetenv in C-library grab http://staff.megabaud.fi/~torppa/unsetenv.patch it has patch for posixmodule that let's one remove environment variables (it also patches configure.in so you need to regenerate and run configure script) (the patch is against cvs version) -- Jarkko Torppa torppa at staff.megabaud.fi Megabaud Internet-palvelut From robin at jessikat.demon.co.uk Thu Feb 10 07:22:20 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 10 Feb 2000 12:22:20 +0000 Subject: Shell_NotifyIcon References: <87u7gs$3si$1@nnrp1.deja.com> Message-ID: In article <87u7gs$3si$1 at nnrp1.deja.com>, ben.flynn at cis.co.uk writes >Does anybody know how to interrogate the system tray in Windows 98 using >python in order to obtain the window handle for the clock. I need to >know this in order to use the > >win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid) > >command to remove it. Any ideas ? or is the wrong way of doing it. > > > >Ben Flynn > > >Sent via Deja.com http://www.deja.com/ >Before you buy. how about truning the clock off in taskbar options; or has bill got rid of that feature in 98? -- Robin Becker From bparsia at email.unc.edu Thu Feb 10 23:03:42 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Thu, 10 Feb 2000 23:03:42 -0500 Subject: SmallTalk / Lisp [was Re: Whitespace as syntax ...] References: <1e5rg41.fyvsfg8oy85cN%bparsia@email.unc.edu> <1261928538-18521086@hypernet.com> Message-ID: <1e5shd2.zwbt6u4ao8gyN%bparsia@email.unc.edu> Gordon McMillan wrote: > Bijan, Paul - > > Come on guys, [snip a plausible theory] While sounding quite reasonable, I suspect that the opposite pattern is also found in various cases. Which serves to confirm my point that the fact that Smalltalk didn't and probably won't (though, who knows?) "take over the world". I don't *want* to take over the world. As long as the Smalltalk world is reasonably self-sustaining and continues to produce interesting stuff which, frankly, anyone is free to swipe, then I don't see that there's a problem. There were some shaky times (just as Common Lisp had some shaky times) due, in part, to a major vendor's insanities :) Not everyone "in the community" (gah!) did things that helped and some or many became perhaps too defensive. Things seem to be looser now and there's a lot of steam going (more implementations than every before, and an ANSI standard). Er.. the reason I started this is that I don't think I wrote anything that made it make sense that I needed this (nicely put) lecture. In fact, while stated more strongly that I would have put it, it seem quite consonent with my general position. So I'm a little confused :) Cheers, Bijan Parsia. From pieter at nagel.co.za Fri Feb 4 07:12:05 2000 From: pieter at nagel.co.za (Pieter Nagel) Date: Fri, 4 Feb 2000 14:12:05 +0200 Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) In-Reply-To: <65118AEEFF5AD3118E8300508B124877073D54@webmail.altiris.com> References: <65118AEEFF5AD3118E8300508B124877073D54@webmail.altiris.com> Message-ID: On Wed, 2 Feb 2000, Mike Steed wrote: > You might be surprised at the number of people who have tried the > "world-class IDEs" on Windows and other platforms and found that they are > just as productive (or more so) with "crusty old Unix" tools such as those > you mention. The problem with most "world-class IDEs" is that they try to provide everything, in a single, non-extensible, forced, and closed way - instead of just creating an "ecology" within which everything can easily be provided. The "everything is a file" paradigm used by the crusty old Unix tools is a rather *low* level common denominator to to pass structured program data around with - but its virtue is that it *is* a *common* denominator, and a lot of power flows from that. I sometimes wonder what Unix tools would have been like if, instead of ASCII text files, they had a common "everything is a graph" paradigm with accompanying standard file format... -- ,_ /_) /| / / i e t e r / |/ a g e l From sconley at cs.csubak.edu Mon Feb 14 09:50:47 2000 From: sconley at cs.csubak.edu (Sean Conley) Date: Mon, 14 Feb 2000 06:50:47 -0800 Subject: socket troubles References: <38A79F05.2C2F25B5@cs.csubak.edu> <38A7B422.B1DF66FC@desys.de> Message-ID: <38A81647.383127CD@cs.csubak.edu> I am connecting to a telnet site. The reason I left the address and port in the code is that this particular one doesn't do any telnet arbitration, since this application will definately hang if I try to connect to a "real" telnet server until I get the arbitration done. So in essence the server is somewhere on the internet, since this is going to basically be a modified telnet client. Sean Sandra Plahl wrote: > I wonder how you could ever read from the socket when you never could > send??? > > I don't know if you have one but thats what you need is s second > application (server), which is reading your send and reply on it. The > answer then can be read from your first application (client). In the > server try something like this: > (its a socket skeleton from a daemon process) > > import socket, sys, errno > ..... > ..... > > serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) > serversocket.bind((HOST, PORT)) > serversocket.listen(5) > while(1): > clientsocket = None > done = 0 > while not done: > try: > (clientsocket, address) = serversocket.accept() > except socket.error, args: > if args[0] != errno.EINTR: > raise > else: > done = 1 > > cpid = os.fork() > if not cpid: > serversocket.close() > data = clientsocket.recv(80) > # Here you can do what you want with the send data > # Maybe send it back > clientsocket.send(data) > clientsocket.close() > data = None > sys.exit(0) > else: > clientsocket.close() > > Sandra From aruth at intercation.com Wed Feb 16 20:22:40 2000 From: aruth at intercation.com (Adam Ruth) Date: Wed, 16 Feb 2000 18:22:40 -0700 Subject: CGI newbie question Message-ID: <38AB4D60.DA0600D0@intercation.com> Hello, I've got a CGI question. Is there any way to tell in the middle of running a CGI script that the client has disconnected? When using ASP, there was a way to do this, but using CGI (with Python), I can't find a way to tell. My concern is that a user may start a long query (30 seconds or so) and impatiently give up and start another. After doing this a few times, they could be waiting for several minutes, not to mention slowing everyone else down. I've looked at PyApache and Httpdapy but I can't tell if they will provide me with the information I want. Any helpful suggestions? Thanks in advance, Adam Ruth P.S. Please reply to my e-mail becuase my ISP's news server randomly deletes messages and I'd hate to miss yours! From effbot at telia.com Fri Feb 18 17:16:41 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 22:16:41 GMT Subject: Killer Apps??? References: <14509.31078.932335.402705@beluga.mojam.com> Message-ID: Fran?ois Pinard wrote: > Just curious, and using English as a second language, here. > > I do not understand what these applications are supposed to kill? > Developers? Users? Competitors? :-) Why the reference to "killing"? [checking the eff-bot archive] (oh, here it is) [start of transmission] UNITED STATES OF AMERICA, PLAINTIFF, VS. MICROSOFT CORPORATION, ET AL., DEFENDANTS WASHINGTON, D. C. DECEMBER 15, 1998 EXCERPTS OF BILL GATES' DEPOSITION QUESTION: THE PORTION OF IT I WANT TO REFER YOU TO IS AT THE BOTTOM OF THE FIRST PAGE UNDER THE HEADING CALLED "THE LATEST KILLER APP." DO YOU SEE THAT? ANSWER: I SEE A HEADING. QUESTION: YES. THE FIRST PARAGRAPH UNDER THE HEADING READS AS FOLLOWS: "OUR INDUSTRY IS ALWAYS LOOKING FOR THE NEXT 'KILLER APPLICATION' -- FOR A CATEGORY OF SOFTWARE THAT, BY ITS UTILITY AND INTELLIGENT DESIGN, BECOMES INDISPENSABLE TO MILLIONS OF PEOPLE. WORD PROCESSORS AND SPREADSHEETS WERE THE KILLER APPLICATIONS FOR BUSINESS P.C.'S STARTING IN 1981." AND THE NEXT SENTENCE READS, "THE LATEST CONFIRMED 'KILLER APP' IS THE WEB BROWSER." DO YOU RECALL WRITING THAT, SIR? ANSWER: NO. QUESTION: DO YOU HAVE ANY REASON TO BELIEVE YOU DIDN'T WRITE IT? ANSWER: NO. QUESTION: CAN YOU EXPLAIN WHAT YOU MEANT HERE BY DESCRIBING THE WEB BROWSER AS A "KILLER APP"? ANSWER: I JUST MEANT THAT BROWSING WOULD BE, IN OUR VIEW, A POPULAR THING, NOT NECESSARILY ON THE WEB, BUT JUST BROWSING IN GENERAL WOULD BE A POPULAR ACTIVITY. QUESTION: IS A KILLER APPLICATION AN APPLICATION THAT DRIVES SALES OF OTHER PRODUCTS, LIKE OPERATING SYSTEMS AND HARDWARE? ANSWER: NO. QUESTION: DO YOU HAVE A DEFINITION IN YOUR OWN MIND OF "KILLER APPLICATION"? ANSWER: IT MEANS A POPULAR APPLICATION. QUESTION: LET ME RESORT AGAIN TO THE MICROSOFT COMPUTER DICTIONARY, AND I'LL READ YOU WHAT THAT SAYS ABOUT KILLER APPLICATIONS. YOU MAY DISAGREE WITH IT, AND IF SO, YOU CAN TELL ME. THE MICROSOFT COMPUTER DICTIONARY, 1997 EDITION, DEFINES "KILLER APP" AS FOLLOWS, AND IT GIVES TWO DEFINITIONS. AND I'LL BE VERY COMPLETE THIS TIME, MR. GATES. THE FIRST DEFINITION IS, "AN APPLICATION OF SUCH POPULARITY AND WIDESPREAD STANDARDIZATION THAT IT FUELS SALES OF THE HARDWARE PLATFORM OR OPERATING SYSTEM FOR WHICH IT WAS WRITTEN." I WILL READ IT TO YOU. THE SECOND DEFINITION IS, "AN APPLICATION THAT SUPPLANTS ITS COMPETITION." LET ME GO BACK AND READ YOU THE FIRST DEFINITION AGAIN, NOW THAT YOU'VE HEARD BOTH OF THEM. THE FIRST DEFINITION READS AS FOLLOWS: "AN APPLICATION OF SUCH POPULARITY AND WIDESPREAD STANDARDIZATION THAT IT FUELS SALES OF THE HARDWARE PLATFORM OR OPERATING SYSTEM FOR WHICH IT WAS WRITTEN." ANSWER: I ALREADY TOLD YOU THAT MY DEFINITION OF "KILLER APP" IS A VERY POPULAR APPLICATION. QUESTION: WHAT ABOUT A RELATIONSHIP TO AN OPERATING SYSTEM? ANSWER: USUALLY THEY'RE JUST TALKING ABOUT IT BEING A VERY POPULAR APPLICATION. I CERTAINLY KNOW OF THINGS THAT HAVE BEEN REFERRED TO AS KILLER APPLICATIONS THAT HAVEN'T DRIVEN HARDWARE SALES OR OPERATING SYSTEM SALES. QUESTION: WHAT OTHER APPLICATIONS WOULD YOU IDENTIFY AS BEING KILLER APPLICATIONS? ANSWER: APPLIED SIMULATOR. [end of transmission] From jimc at regnoc.com Sat Feb 5 13:02:08 2000 From: jimc at regnoc.com (Jim Conger) Date: Sat, 05 Feb 2000 18:02:08 GMT Subject: Python MySQL.connect() question References: <3893CD31.B17E8B84@regnoc.com> <389AFD6F.F1DD7EC5@regnoc.com> Message-ID: <389C6555.13E9F769@regnoc.com> The security problem was due to a version conflict with the libc libraries. Updating the libc version solved the whole problem. Yipes... Jim Conger wrote: > (Answering my own question: It turns out that this error message is > missleading. mySQL is actually connecting, but then refusing to attach to > any database due to the mySQL security table settings. I'm hopefull that > I can find some settings in mySQL that allow python to connect. If anyone > has been through this before, let me know. > > Jim C.) > > Jim Conger wrote: > > > I have mySQL running on a RH Linux 6.1 box, and have added the > > MySQLmodule.so to my python library. I can't figure out how to connect > > within python. My attempts look like: > > > > >>> import MySQL; > > >>> db = MySQL.connect(); > > Traceback (innermost last): > > File "", line 1, in ? > > MySQL.error: Can't connect to local MySQL server > > >>> > > > > I know the mySQL server is running in the background during this test, > > so I'm noplussed. Any examples of working code would be appreciated. > > > > Jim C. > > -- > Jim Conger > Project Manager > Silicon Valley Oil Co. > jimc at regnoc.com, 925-842-6729 -- Jim Conger Project Manager Silicon Valley Oil Co. jimc at regnoc.com, 925-842-6729 -------------- next part -------------- An HTML attachment was scrubbed... URL: From c_cazabon at hotmail.com Thu Feb 10 19:31:57 2000 From: c_cazabon at hotmail.com (Charles Cazabon) Date: Fri, 11 Feb 2000 00:31:57 GMT Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> Message-ID: <8ED6BCFDChdjsdhdfh75738@news.sshe1.sk.wave.home.com> Michal Wallace claimed in <87tkoi$hql$1 at nntp1.atl.mindspring.net>: > I noticed this just recently on http://www.python.org/1.5/ ... > >> The new release schedule provides for a 1.7 >> release later in 2000 (or early 2001); after that, >> we'll be working on "Python 3000" (the new code >> name for the grand Python redesign; the language >> will be incompatible). >"The language will be incompatible" seems like kind >of a dangerous statement to be making without >backing it up... As much as I love python, for example, >I can't very well recommend using it if everything I >write will have to be thrown out in a year or two. Who says you have to throw anything out? Your trusty Python v.1.5.2 (or 1.6, or 1.7) doesn't magically stop working the day 'Python 3000' is released. Rule of Software Systems: Upgrade software when it fixes bugs you need fixed, or adds features you need added. Never anytime else. Charles From backov at nospam.csolve.net Fri Feb 25 12:29:21 2000 From: backov at nospam.csolve.net (Jason Maskell) Date: Fri, 25 Feb 2000 17:29:21 GMT Subject: Win2k and Python access violation - please help me out here! References: <1260623840-9876921@hypernet.com> Message-ID: gmcm at hypernet.com (Gordon McMillan) wrote in <1260623840-9876921 @hypernet.com>: >Jason wrote: > >> Oops, I missed 3 lines at the top of the call stack: >> >> NTDLL! 77f8ed61() >> NTDLL! 77f8ecf1() >> MSVCRTD! 10238575() > >Are you using python15.dll or python15_d.dll? Mixing run time >libraries is a great way to crash. Using the debug dll. Just for fun, I changed over to the release version and compiled it. Same problem. The release side is using all release dlls. Cheers, Jason From effbot at telia.com Mon Feb 7 01:45:27 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 07 Feb 2000 06:45:27 GMT Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> <389E35EE.F8383238@austin.rr.com> Message-ID: Daniel Weber wrote: > I've got 4.0 and it still won't print. Bummer... what platform? what error messages do you get? (you're not exactly the first one who has down- loaded the document, but you're the first one claiming acrobat 4.0 cannot print it...) From phd at phd.russ.ru Mon Feb 7 10:01:08 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 7 Feb 2000 15:01:08 +0000 (GMT) Subject: mail filter in python? In-Reply-To: <20000207154641.A2817@stopcontact.palga.uucp> Message-ID: On Mon, 7 Feb 2000, Gerrit Holl wrote: > > http://www.procmail.org > > The procmail syntax is really obfuscated. What about creating a mail > filter with a Python syntax? Shouldn't be too difficult, just create > some functions (drop, match_header) and execfile() a file with the > rexec module... Welcome to the wonderful world of Security! :))) (and locking problems) Procmail, being here for a long time, has a LOT of builtin mechanisms for locking, security checks, portability and so on. It would be hard to reimplement all that from scratch :( Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From ross at sphinx.com Fri Feb 4 13:14:03 2000 From: ross at sphinx.com (Ross Boylan) Date: 04 Feb 2000 13:14:03 EST Subject: Problems compiling Python on HP-UX 11 References: <87crmp$u5r$1@nnrp1.deja.com> Message-ID: <389B16E5.7B318EF8@sphinx.com> I have now built a statically linked python on HP-UX 11. Here is some additional information. I will put the build info in a separate message. Ross Boylan wrote: > I am trying to build python 1.5.2c on an HP-UX B.11.00. I think the > first few items are relatively simple errors in the build scripts. (I > ran configure and clean first). > > 1) Using HP's ANSI-C compiler, I get the following error (under the > Parser build) > cc -Aa -D_HPUX_SOURCE -O -I./../Include -I.. -DHAVE_CONFIG_H -c > printgrammar.c > cc -Aa -D_HPUX_SOURCE -O pgenmain.o acceler.o grammar1.o > listnode.o node.o parser.o parsetok.o tokenizer.o bitset.o metag > rammar.o firstsets.o grammar.o pgen.o printgrammar.o -lnet -lnsl - > ldld -lcma -o pgen > cc -Aa -D_HPUX_SOURCE -O -I./../Include -I.. -DHAVE_CONFIG_H -c > myreadline.c > cc: "../Include/longobject.h", line 80: error 1681: Must use +e or -Ae > for long long in ANSI mode. > cc: "../Include/longobject.h", line 81: error 1681: Must use +e or -Ae > for long long in ANSI mode. > *** Error exit code 1 > > So perhaps -Ae rather than Aa should be the option? I couldn't reproduce this. It was probably an artifact of switching compilers. However,I note that the build on the HP software site (see next message) used -Ae. The other items in my earlier message still stand. > > > 2) When I ran configure the first time it set up the same options, even > though my default cc was the non-Ansi-C one. It then complained about - > Aa and -O, saying only the Ansi version understood them. I changed my > path to get the Ansi compiler for the errors in 1). > > 3) Is there a reason that the build advice in the Misc/HPUX-NOTES is > not incorporated into the automatic configuration? > > The non-simple item is that I have a Module I am trying to add which > needs the C++ compiler (aCC). This is not simple because the build > scripts need to handle it correctly, and because of HP's warnings that > one should have a C++ main if linking in some C++. I am building with > threads, because I want to use Zope. For now, I'm trying > static libraries... > > I'd appreciate any help/tips/advice. > > Sent via Deja.com http://www.deja.com/ > Before you buy. From aahz at netcom.com Fri Feb 18 11:06:22 2000 From: aahz at netcom.com (Aahz Maruch) Date: 18 Feb 2000 16:06:22 GMT Subject: name-spaces and loading a file References: <8766vn2ijn.fsf@curious.eyeofdog.com> <88in3m$r0f$1@nntp6.atl.mindspring.net> <38AD44E2.637FBFF7@austin.ibm.com> Message-ID: <88jqlu$1s5$1@nntp6.atl.mindspring.net> In article <38AD44E2.637FBFF7 at austin.ibm.com>, David R. Favor wrote: > >Specifically, in the case of: > > exec 'from scenes.' + scene + ' import *' > >Do you mean that within each $scene class all methods pass a dictionary >as one of the arguments in method calls? Nope. Remember that I said the dict gets passed at __init__. From that point forward, all methods access it with self.dict. So you can do things like if self.dict.has_key(foo): or self.dict[foo] = bar and this information is globally accessible to all the scene class instances. Note very carefully that in this system, one is *NOT* doing that exec any more. Instead one is doing something like (pardon any syntax or semantic errors; this isn't the way I'd write it): sceneObjects = {} globalDict = {} exec 'import scenes.' + scene exec 'sceneObjects[' + scene + '] = scenes.' + scene + '(globalDict)' Now you can refer to the scene object (class instance) by string name, and each scene object can refer to the global variables by string name within globalDict. -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From gchiaramonte at ibl.bm Wed Feb 9 14:23:58 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Wed, 9 Feb 2000 15:23:58 -0400 Subject: HP Ini file module In-Reply-To: Message-ID: At frozenspam 8 someone from HP mentioned they had a python module available to work with ini files on windows. Anyone know where I might find that? Thanks, Gene From tim_one at email.msn.com Mon Feb 21 20:33:31 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 21 Feb 2000 20:33:31 -0500 Subject: functional programming In-Reply-To: Message-ID: <001401bf7cd4$d3e9f760$29a2143f@tim> [Michal Wallace] > That Software Development Magazine article had a sidebar which > mentions that python supports functional programming. I know what > functional programming IS, and I can see how python supports it, but > I'm wondering if anyone has any examples of actually putting this > to use? Within the last few days, Denys Duchier posted some wonderfully functional functional Python code, in msg Continuations Made Simple (hopefully) and Illustrated Look it up. It proves two things (although neither has been in doubt for a decade ): 1. Functional styles are possible in Python. 2. Functional styles are painful in Python. That is, Python wasn't designed to support programming in these styles, but is flexible enough that you can force it to work. Python was designed to support a variety of OO & "imperative procedural" styles instead. the-odd-thing-about-fighting-a-language-is-that-languages- never-fight-back-ly y'rs - tim From felixt at dicksonstreet.com Sun Feb 13 02:37:47 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Sun, 13 Feb 2000 01:37:47 -0600 Subject: data structure design question In-Reply-To: References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> Message-ID: <3.0.5.32.20000213013747.007de150@mail.dicksonstreet.com> At 08:07 2/12/00 +0200, Moshe Zadka wrote: >On Fri, 11 Feb 2000, Felix Thibault wrote: > >Hmmm...why not have a generic Atom: > >h1 = Atom('H', 1) > >(actually, the 1 is superfluous: you can have a table mapping name to >number of electrons on the outer level (is that it?)) > I was thinking of having a generic class that could initialize with some optional parameters for stuff like charge or isotope that could vary from atom to atom, with default and constant values in a table, like this: PeriodicTable = { 'H':{'name':'hydrogen', 'valence_electrons': 1,\ 'mass': 1.0078, 'atomic_number':1}} #more... class Element: #set count for each element to zero indexes = {} for key in PeriodicTable.keys(): indexes[key] = 0 del key def __repr__(self): return self.symbol + `self.index` def __init__(self, symbol, valence_electrons=None): self.symbol = symbol Element.indexes[symbol] = Element.indexes[symbol] + 1 self.index = Element.indexes[symbol] if valence_electrons is None: self.valence_electrons = PeriodicTable[symbol]['valence_electrons'] else: self.valence_electrons = valence_electrons self.mass = PeriodicTable[symbol]['mass'] self.atomic_number = PeriodicTable[symbol]['atomic_number'] #more... def reset(): """reset() set all element counts back to zero""" for key in PeriodicTable.keys(): Element.indexes[key] = 0 def H(): return Element('H') class Molecule: def __init__(self, bonddict): mass = 0 atoms = bonddict.keys() for atom in atoms: mass = mass + atom.mass self.mass = mass self.bonds = bonddict self.atoms = atoms h1, h2 = H(), H() hydrogen_molecule = Molecule({h1:[h2], h2:[h1]}) >> The dictionary method seems more condensed and readable, so I >> am preferring it right now, even though I would have to make a >> new instance for every atom of an element > >That's a good thing. Every atom *is* a new instance of the atom class. > Of course! I won't be stingy with them, then. Thanks! Felix >-- >Moshe Zadka . >INTERNET: Learn what you know. >Share what you don't. > > >-- >http://www.python.org/mailman/listinfo/python-list > > From neelk at brick.cswv.com Fri Feb 4 18:37:40 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 4 Feb 2000 23:37:40 GMT Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> <38975766.21B319AD@dcs.kcl.ac.uk> Message-ID: Michael Hudson wrote: > Bernhard Herzog writes: > > > > >>> class C: > > .. def __cmp__(self, other): > > .. return cmp(None, other) > > .. > > >>> c = C() > > >>> c == None > > 1 > > >>> c is None > > 0 > > Yikes! That's impressively devious. > > I-always-*knew*-there-was-a-reason-I-always-use-"is"-ly y'rs Is it devious? I always assumed that a __cmp__ method that returned true for a comparsion with None would have a good reason for doing so, and as a result I've always tested that with 'obj == None'. Neel From tjh8300 at cs.rit.edu Thu Feb 3 14:20:20 2000 From: tjh8300 at cs.rit.edu (Thomas Happ I) Date: Thu, 3 Feb 2000 14:20:20 -0500 Subject: Built-in exception class not found Message-ID: Hello, I am attempting to install Python on our systems here at RIT. We're running Solaris 7. It seems to work in most respects, but whenever any program is run, it displays the following message: Built-in exception class not found: EnvironmentError. Library mismatch? [Warning! Falling back to string-based exceptions [Python 1.5.2 (#4, Jan 14 2000, 09:18:57) [GCC 2.95.1 19990816 (release)] [on sunos5 [Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam I looked through the Setup file in the Modules part of the installation and couldn't find any modules related to this. I also checked the FAQ and the Bug report but couldn't find any similar problems. Has anyone encountered this or a similar problem before? (As I am not a python user myself, please respond to me via e-mail -- I don't normally read this newsgroup:) Thanks, Tom //------------------------------------------------------- //Thomas Happ //Graduate Assistant, RIT CS Dept. //tjh8300 at cs.rit.edu //http://www.core.binghamton.edu/~karidian //------------------------------------------------------- From phd at phd.russ.ru Thu Feb 24 05:06:23 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 24 Feb 2000 10:06:23 +0000 (GMT) Subject: Internet crawler In-Reply-To: Message-ID: On Thu, 24 Feb 2000, Oleg Broytmann wrote: > ???? ??? ????????? ?? ????? ?????? off-topic. I am sorry, sorry for the wrong list. This was a message to Russian Python list :) Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From tratt at dcs.kcl.ac.uk Tue Feb 1 17:00:06 2000 From: tratt at dcs.kcl.ac.uk (Laurence Tratt) Date: Tue, 01 Feb 2000 22:00:06 +0000 Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> Message-ID: <38975766.21B319AD@dcs.kcl.ac.uk> stevie_deja at my-deja.com wrote: > Would anyone explain to me where there is a difference between the > following two calls: > > if some_var == None : print 'var is none' > > if some_var is None : print 'var is none' > > Can '== None' only be used in certain circumstances? In this particular circumstance, both lines of code will always produce the same result; however they achieve it in a different way. The first line says "are the contents of some_var the same as the contents of None?" (None is a genuine Python object); the second says "is some_var the same object as None?" (ie similar to "if id(some_var) == id(None)"). The second version is faster, as it has a very easy job; the first version can take an indeterminate amount of time depending on the __cmp__ method of the some_var object. So, conceptually, the second line is generally probably "better" becuase you're emphasising the uniqueness of the None object... But I fully admit that in practice I tend to forget that, and use == out of force of habit. Laurie From mbre at sxb.bsf.alcatel.fr Thu Feb 10 04:20:17 2000 From: mbre at sxb.bsf.alcatel.fr (Marc BRETTE) Date: Thu, 10 Feb 2000 10:20:17 +0100 Subject: small python implementation or python subset ? References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> Message-ID: <38A282D0.2487CA89@sxb.bsf.alcatel.fr> OK, to summarize all answer that has been dent to me : 1/ On unix the python executable after source compilation seems not to be stripped. Performing a "strip python", I scaled my executable down to 300 k (instead of 1.3 M - but with almost no module, even the string implementation in C was not included). 2/ The URL http://www.abo.fi/~iporres/python/ gives a way to reduce drastically python size. It provides a PDF document describing how to do this and a patch file to apply to Python 1.5.1 (I didn't try it, and don't know yet how to apply it, but it seems promising). Thanks a lot for all your answers. PS : For future keyword search : embedded python, reducing python, lightweight python. Marc BRETTE wrote: > Hi, > I am looking for a very lightweight implementation of python or for a > python subset definition. > I would like to run the python interpreter (or even the python > interpreter without its parser by running only python bytecode) in a > very restricted environnement (say a python interpreter less than 300 > k), and I don't need all the fancy functionnalities of python. > I downloaded the 1.5 distribution but the binary is 1.5 Mb stripped of > almost all its modules. An older version (1.2) seems lighter (300 k), > but I don't want a dead distribution. > Does any one around knows about a lightweigth python or a way to strip > the regular python distribution ? > > marc > > -- > Marc Brette > Marc.Brette at sxb.bsf.alcatel.fr > > -- Marc Brette Marc.Brette at sxb.bsf.alcatel.fr Alcatel - Projet Internet ScreenPhone -------------- next part -------------- An HTML attachment was scrubbed... URL: From fdrake at acm.org Thu Feb 17 11:57:22 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 Feb 2000 11:57:22 -0500 (EST) Subject: Sound related functions or modules in python?? In-Reply-To: <025001bf7910$3d5dac50$b305a8c0@matrix> References: <025001bf7910$3d5dac50$b305a8c0@matrix> Message-ID: <14508.10354.885013.692366@weyr.cnri.reston.va.us> Mridul writes: > Could anybody let me know how to play around with sound using python............?? > to be precise how to program in python for sound related stuff........ > 1.I want to know how to record sound from a Mic using python?????? > 2.How to playback recorded sound or files using python........?????? > 3.If python supports speech-recognition??????? > 4.Whether python supports speech synthesis????? > 5.File formats related to sound that python supports.......? > > Any help will be greatly appreciated!!!!!!!!!! You don't tell us anything about your platform. There's a whole chapter in the library reference on multimedia modules, which includes sound. A couple of the platform-specific chapters near the end of the library reference describe modules that can at least play audio or control CD drives to do so. The library reference is online: http://www.python.org/doc/ -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From embed at geocities.com Thu Feb 24 09:53:45 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 24 Feb 2000 09:53:45 -0500 Subject: OT - ][ (was Re: Killer Apps???) References: <14509.31078.932335.402705@beluga.mojam.com> <14509.46230.395460.200539@beluga.mojam.com> <38B4316B.F58893CB@sage.att.com> Message-ID: > And more seriously, is that game available in some form, nowadays, on > Linux say? Check out the Commodore 64 and Atari 8 bit emulators you can download on the web. Is there a Game Library for Python? Warren From fdrake at acm.org Fri Feb 18 10:00:47 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 18 Feb 2000 10:00:47 -0500 (EST) Subject: Teach Yourself Python in 24 Hours (Was: Re: Help needed writing GUI comparison) In-Reply-To: <38AD53E4.30EC645E@callware.com> References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> <38AC9E96.FDAE287C@prescod.net> <20000218144848.A3437@stopcontact.palga.uucp> <38AD53E4.30EC645E@callware.com> Message-ID: <14509.24223.739097.216790@weyr.cnri.reston.va.us> Paul Prescod wrote: > So the idea is you walk around reading the book for one day (no sleep, > no breaks) and by the end you're a Python expert. I could see that being > valuable for people who pad their resumes and then need to cram before > their first day of work. Unless you're like me and have nothing better to do. ;) I could use "How to shed load in 24 hours".... ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From jstok at bluedog.apana.org.au Wed Feb 16 19:27:31 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Thu, 17 Feb 2000 11:27:31 +1100 Subject: Newbie question: Dictionary of lists References: <2F1A38DC0413D311A7310090273AD5278A03A0@dthrexch01> Message-ID: Kossmann, Bill wrote in message ># Short test file (16000 lines in production) >histFile = open("2000.txt", "r") >for histLine in histFile.readlines(): > histRcd = string.split(histLine, ",") > ># Key is our cost centre code > dictionaryKey = histRcd[0]+histRcd[1]+histRcd[2]+histRcd[3] Just a nit: This is in the scope of the for loop. The comment should be indented. From thamelry at vub.ac.be Fri Feb 11 04:36:53 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 11 Feb 2000 09:36:53 GMT Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> Message-ID: <880l7l$i6k$1@mach.vub.ac.be> Richard Jones wrote: : Could we please maybe mandate an "Official Response" to the weenies constantly : posting about whitespace in Python? : Something like: : ------- : Subject: Official Response [Re: ] : From: some_python_regular : Guido van Rossum, the creator of Python, is not going to change this : fundamental aspect of Python. We don't want him to. We all like it. Could you please change the last sentence above to: "The majority of Python programmers likes it." There are at least a few regular python programmers who post here that do not like the forced indentation in Python. I agree with something like an official response since the situation will not change and the subject has been amply discussed. Otherwise I will be forced to keep on being the "ennemy within" of this newsgroup :-). Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From shochat at chelmsford.com Sun Feb 13 07:14:04 2000 From: shochat at chelmsford.com (David Shochat) Date: Sun, 13 Feb 2000 07:14:04 -0500 Subject: support@usenetserver.com Message-ID: <38A6A00C.DF503BD8@chelmsford.com> Posting not working again? I tried posting to comp.lang.python this morning, but it does not show up after I fetch new messages (or re-enter the group). So I tried in alt.test and again, I can't see my posting. I notified you once before of this and since then I was able to post successfully to alt.test and comp.lang.ada. In those cases, my posting appeared immediately in the group in question. Is there a problem? -- David From Sven.Drescher at dlr.de Wed Feb 2 08:10:50 2000 From: Sven.Drescher at dlr.de (Sven Drescher) Date: Wed, 2 Feb 2000 14:10:50 +0100 Subject: Tk variables problem Message-ID: <879a88$t68$1@news.go.dlr.de> Hi! I cannot understand why the following little program doesn't work correct. It's surely a little problem, but in my program are more situations, where such an error is raised. I thought, there isn't a problem, but... Tanks for hints, what I did wrong. Sven e.g.: #!/usr/.../python import Tkinter class test: def __init__(self): self._bool=Tkinter.BooleanVar() self._bool.set(1) self.display() def display(self): print "Hi!" print "The value is ", self._bool.get() a=test() a.hallo() error: Variable.__init__(self, master) self._tk = master.tk Attribute Error: 'None' object has no attribute 'tk' ... ______________________________________ German Aerospace Research Establishment e-mail: Sven.Drescher at dlr.de From michael.stroeder at inka.de Fri Feb 18 06:32:00 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Fri, 18 Feb 2000 12:32:00 +0100 Subject: CGI/HTML forms in a standalone application. References: Message-ID: <38AD2DB0.6877BD72@inka.de> Moshe Zadka wrote: > > On Mon, 14 Feb 2000 bayinnaung at my-deja.com wrote: > > > that can also be used as a non-web/standalone application > > on a single/PC. > > > > Can you use a kind of dummy server to simulate the CGI on a single > > machine. > > You can derive a class from SimpleHTTPRequestHandler, copy some code from > CGIHTTPRequestHandler and come up with a class > CGILikePythonFunctionHTTPRequestHandler I did this and it works as expected except that the browser does not stop loading. Do I have to close a socket or associated file? Ciao, Michael. From bwarsaw at cnri.reston.va.us Thu Feb 17 10:52:12 2000 From: bwarsaw at cnri.reston.va.us (Barry A. Warsaw) Date: Thu, 17 Feb 2000 10:52:12 -0500 (EST) Subject: string.py References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <88f53h$em2$1@nntp6.atl.mindspring.net> <14507.17447.857827.44321@anthem.cnri.reston.va.us> <88fil5$shr$1@nntp6.atl.mindspring.net> Message-ID: <14508.6444.621810.689582@anthem.cnri.reston.va.us> >>>>> "AM" == Aahz Maruch writes: AM> I'm assuming, of course, that the revised 1.5.2 documents are AM> correct and that int() still does not take a radix. The docs are out of date: Python 1.5.2+ (#10, Feb 10 2000, 15:28:44) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> int('ff', 16) 255 -Barry From cpatti at atg.com Wed Feb 9 16:38:44 2000 From: cpatti at atg.com (chris patti) Date: 09 Feb 2000 16:38:44 -0500 Subject: Solaris 2.7 __imaging.so ? References: <87sm73$mms$1@mwrns.noaa.gov> Message-ID: bjm at cdc.noaa.gov (Barry McInnes) writes: > Any help appreciated, thanks barry Solaris 7 is a 64 bit OS. In the distribution and on the website, it's stated multiple times that the imaging extensions don't currently work in 64 bit environments. Good luck; -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From gerrit at nl.linux.org Tue Feb 29 04:26:09 2000 From: gerrit at nl.linux.org (gerrit at nl.linux.org) Date: Tue, 29 Feb 2000 10:26:09 +0100 Subject: difference between __repr__() and __str__() In-Reply-To: <030901bf8254$ba7a3c60$01ffffc0@worldnet.att.net>; from emile@fenx.com on Mon, Feb 28, 2000 at 05:31:37PM -0800 References: <030901bf8254$ba7a3c60$01ffffc0@worldnet.att.net> Message-ID: <20000229102609.A1584@nl.linux.org> > I like that eval(repr(obj)) stay true. On that basis, the repr(obj) > should create a string such that obj == eval(repr(obj)). >>> fp = open('/dev/null') >>> fp >>> eval(repr(fp)) Traceback (innermost last): File "", line 1, in ? File "", line 1 ^ SyntaxError: invalid syntax regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From miles at caddr.com Sun Feb 20 23:58:08 2000 From: miles at caddr.com (miles) Date: Mon, 21 Feb 2000 04:58:08 GMT Subject: Flying a kite about working with python References: Message-ID: >Some background:- >I am considering my future career plans. I am currently a scientist working >in academia (in the USA but I'm british without a green card so I quite >probable I will have to return to the UK) and feel that I need a fallback >position if/when I finally decide that I can't go on post-docing for ever. >This lapse into sanity has been brought about by the recent arrival of our >first child. I left graduate studies in chemistry four years ago to pursue a career in programming and I've never looked back or had a regret. Good programmers are in very short supply right now and many employers will consider candidates without degrees if they do well on a programming test. Former scientists are actually quite common in the software industry and usually do well because a lot of the same intellectual skills are required. One piece of advice I would give you is that you should master a few more mainstream languages. Python is certainly a very pleasant language, but there are for more openings out there for java or perl programmers. miles From moshez at math.huji.ac.il Thu Feb 17 14:14:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 17 Feb 2000 21:14:52 +0200 (IST) Subject: two questions In-Reply-To: Message-ID: On Thu, 17 Feb 2000, Fredrik Lundh wrote: > Brett Tribble wrote: > > 1. Is anyone working on a version of Python for Mac OS X? > > according to people who've tried, Python 1.5.2 > builds right out of the box. > > that probably doesn't include X window stuff like > Tkinter, though... Hey, what are you doing posting from the eff-bot's account? I'm sure you're not the bot in question, because the bot knows that Tkinter runs on distinctively non-X-windows based platforms such as MS-Windows (may it forever perish in the deepest hell). Tk is also supposed to compile on Macs (don't know about OS X, though), but Tkinter is only usable when the moon is shining just right. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tbryan at python.net Sat Feb 12 07:33:54 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 12 Feb 2000 07:33:54 -0500 Subject: How to do this? - newbie References: <38a2e958$0$1403@news.voyager.net><38A2EE79.14190ABA@bellatlantic.net> <38a3892d$0$96317@news.voyager.net><06ee01bf748d$2a28f040$01ffffc0@worldnet.att.net> <38a4e7d1$0$96317@news.voyager.net> Message-ID: <38A55332.6C69D3FC@python.net> "Ronald L. Dilsavor" wrote: > > Thanks for all your solutions... > Here is the one I think I was after - and I got it by providing more > background on what I was after. Sorry I am not thinking totally OO yet or > even asking the question correctly. Don't worry about the OO thing, but it is in general easier for others to help if you give a complete description of what you're trying to do. I have a few more suggestions below... > > Regarding how I came up with such a question... > > I have a file that contains stuff like: > > sensorType = HSI > > numSensorBands = 5 > > etc > > > > I am reading that file with readline and splitting the line into a list of 2 > > items such as a=('sensorType', 'HSI') > > > > I then want to make sensorType an attribute of a sensor object so I can > > access it like > > > >>>> print sensor.sensorType > > 'HSI' That's reasonable. > > which I think has really nice readability. > > If I go the dictionary approach, it will read more like > > > >>>> print sensor.dictionaryName['sensorType'] > > 'HSI' > > which in my opinion is a little less pleasing to the eye. Note that by subclassing UserDict.UserDict, you can have a class that acts like a dictiory. That is, you can do something like this import UserDict import string class Sensor(UserDict.UserDict): # your own specialization here # see UserDict.py in the Python library on your system # I'll just pass for now and let UserDict handle all of the behavior. pass sensor = Sensor() # create a new Sensor sensor['sensorType'] = 'HSI' # treat the class like a dictionary line = 'numSensorBands = 5' # more like what you're doing (key,value) = string.split(line,'=') sensor[string.strip(key)] = string.strip(value) print sensor print sensor['sensorType'] print sensor['numSensorBands'] > Paul Foley wrote: > Ah, I see. That makes a difference! There's no need to create new > local variables. Conceptually, use a dict enclosed in a class, with > methods that hide accesses so that you can use sensor.sensorType() [or > sensor.sensorType, if you prefer] rather than > sensor.dictionary['sensorType']. But note that the way class > attributes work in Python is that there is _already_ a dict, called > __dict__, in each instance, containing the attributes. So > sensor.sensorType is equivalent to sensor.__dict__['sensorType'], and > you can just go ahead and use __dict__ to store your mappings. I agree, except that the "wrap a dict in a class" implies UserDict to me. If you really prefer writing print sensor.sensorType to writing print sensor['sensorType'] then you could use setattr to set the class attributes in the first place class Sensor: def __init__(self): self.sensorType = None # force the existence of various attributes sensor = Sensor() setattr(sensor, 'sensorType', 'HSI') # sensor now has a sensorType attribute line = 'numSensorBands = 5' # more like what you're doing (key,value) = string.split(line,'=') setattr(sensor, string.strip(key), string.strip(value)) print sensor print sensor.sensorType print sensor.numSensorBands # note that numSensorBands wasn't defined in the class constructor, # we added it at run time by parsing the file If you're using a lot of getattr and setattr everywhere in your code, then you might prefer using the UserDict approach because you rarely get to write sensor.sensorType. (If you don't need to specialize the behavior of UserDict, then you really could use a regular Python dictionary because it will be faster with the same functionality.) If you just need to use the setattr to create the objects from a file and can then use the sensor.sensorType notation everywhere else, you might prefer avoiding UserDict. If every file has roughly the same attributes, then I'd suggest setting the values to some initial defaults (like the self.sensorType = None above) in the class constructor so that you never get an AttributeError when someone forgets to put one of the sensor's attributes in a file. ---Tom subsequent From gchiaramonte at ibl.bm Mon Feb 7 15:12:24 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Mon, 7 Feb 2000 16:12:24 -0400 Subject: mxDateTime Message-ID: When I try to use cPickle on a DateTime objcet I get the following error: Traceback (innermost last): File "", line 1, in ? cPickle.PicklingError: Cannot pickle objects. Guess you can't do this. Am I correct? I've been converting them to COMDates and storing them. Is there a better way? Thanks, Gene From dan at cgsoftware.com Sat Feb 19 14:04:12 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: Sat, 19 Feb 2000 11:04:12 -0800 (PST) Subject: dynamically extend classes In-Reply-To: <7kwvo1mbam.fsf@jpl.nasa.gov> Message-ID: I think so, but you need to rephrase so i can be sure. If you are asking if you can dynamically add stuff to modules/classes, and have other things be able to use it, the answer is yes. On 19 Feb 2000, Matt Wette wrote: > > Is there a way to dynamically extend classes in Python? > > I'd like to be able to have sitecustomize.py import a module > and add methods to a class so that later, when anohter modules > imports this module and uses the class it sees the added methods. > > Doable? > > Matt From tismer at tismer.com Thu Feb 3 13:15:32 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 03 Feb 2000 19:15:32 +0100 Subject: Gutes (deutschsprachiges) Buch =?iso-8859-1?Q?=FCber?= Python References: <3899B96C.E3133570@axion-gmbh.de> Message-ID: <3899C5C4.9F07998E@tismer.com> Hallo Manfred, dies ist die englischsprachige Python-Hauptliste. F?r deutschsprachige beitr?ge melde Dich besser bei python-de an (siehe http://www.python.org) Switching to IT-esperanto again :-) Manfred Thoma wrote: > > Hallo alle miteinand.... > > Ich suche ein gutes, deutschsprachiges Buch ?ber Python. > Mit dem englischen Tuturial komm ich irgendwie nicht so richtig > zurecht. There is a quite good book: "Learning Python" that I translated into German ("Einf?hrung in Python"), and I hope I didn't make it much worse. it should be in the bookstores right now, since I got a couple of them last Friday. At least they are printed. This Book is very helpful, if you are not a complete beginner. With some experience about programming at all, it will give you a headache^H^H^H^Hstart into Python, be assured! > Au?erdem bin ich auch auf der Suche nach einer graphischen > Benutzeroberfl?che > f?r Python-Programm (keine visuelle Programmierung, sondern sowas wie > bei Turbo Pascal oder C/C++ immer dabei war. Ich glaub ein Software > Development Kit) Start with the book. It will introduce graphics and GUIs to you after a few chapters. Later, you will at least have the choice of TK, PythonWin's MFC, and wxPython, the best choice at the moment, IMHO. But there is more to come: PythonWorks, Build, to name just a few very promising paths. But first please learn the basics, the rest comes from alone :-) ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 jessikat.demon.co.uk Wed Feb 23 04:38:21 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Wed, 23 Feb 2000 09:38:21 +0000 Subject: run pythonwin scripts remotely from unix -- how? References: Message-ID: In article , George Planansky writes >Pythonwin looks like a godsend for >sysadmins. But how do I run >a python script on an NT machine, >remotely, from unix (solaris say)? That is, >how do I achieve the equivalent of rsh, >going from solaris to NT, using pythonwin ? > >George Planansky >Earth & Planetary Sciences >Harvard University There're lots of server type things around. Check out the pysvr demo in the source distribution. Basically allows you to run scripts across a socket. I believe medusa may have similar possibilities. -- Robin Becker From rhicks at rma.edu Wed Feb 23 17:34:28 2000 From: rhicks at rma.edu (Robert Hicks) Date: Wed, 23 Feb 2000 22:34:28 GMT Subject: IDLE Message-ID: I am trying to use IDLE on a pc at work. When I start it an error kicks back saying that the init.tcl file in bad and that I need to reinstall TCL/Tk. So I remove Python and reinstall...yet the same error shows up. I do not have this problem at home. From 2jerry at writeme.com Wed Feb 23 17:57:22 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 23:57:22 +0100 Subject: copy directory from a to b, how? References: <890p4e$q9c$1@nnrp1.deja.com> Message-ID: <891oep$oh4$1@wanadoo.fr> You can use zip module too :))) Jerry the foolish dracomorpheus tiddlerdeja at my-deja.com a ?crit dans le message <890p4e$q9c$1 at nnrp1.deja.com>... >How do I copy a directory in python? > >I'd like to copy from c:\inetpub\staging to c:\inetpubwwwroot. > >I could do this by using os.system(...), but I'm thinking there must be >a better way. > >Any information appreciated. > > >Thanks. > > >Sent via Deja.com http://www.deja.com/ >Before you buy. From craigf at ilid.com.au Tue Feb 8 00:15:46 2000 From: craigf at ilid.com.au (Craig Findlay) Date: Tue, 08 Feb 2000 16:15:46 +1100 Subject: Newbie question - what is the 'r' operator? Message-ID: This is probably obvious but ... I have seen example code where an 'r' prefix is used in from of a string, eg r'mystring' What does it do, I can't seem to locate any documentation about it. Thanks in advance for any help. Craig From 2jerry at writeme.com Tue Feb 22 18:46:58 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 00:46:58 +0100 Subject: dialog References: <87900c97bc.fsf@jupiter.pigeon-st> Message-ID: <88v6vj$cse$1@wanadoo.fr> Try to make your own dialog box. import Tkinter tk=Tkinter class YourDialog(tk.Toplevel): """ Boite d'erreur """ def __init__(s, parent=tk._default_root, titre="erreur", text="ERRRREUR/OR"): tk.Toplevel.__init__(s, parent) s.transient(s) s.title(titre) tk.Message(s, text=text).pack(side=tk.TOP,fill=tk.X) s.bt_retry=tk.Button(s,text='Retry',command=s.retry) s.bt_retry.pack(side=tk.LEFT,anchor=tk.S+tk.W) s.bt_quit=tk.Button(s,text='Quit',command=s.quit) s.bt_quit.pack(side=tk.RIGHT,anchor=tk.S+tk.E) # shorter : tk.Button(s, ...).pack() def quit(s): s.destroy() s.parent.destroy() #too ?? def Retry(s): s.destroy() s.parent.methode_need_to_br_retry() # if you don't want to know the name of the methode to retry ... add a function argument pass the callback (retry) trought the constructor then just call s.callback() #Better way : return an action id which is properly used by the parent widget. like : return 'Retry' Jerry the foolish dracomorpheus, jerome VACHER - france - Stephen Quinney a ?crit dans le message <87900c97bc.fsf at jupiter.pigeon-st>... >Can anyone either point me in the direction of the full documentation >on Dialog or solve this trivial problem which is bugging me please? > >I have an error dialog box which pops up when something goes wrong, i >nicked the code from one of Guido's Tkinter demos. I want to bind a >function to each of the two available buttons, i.e. when the retry >button is pressed it calls a function retry() and when quit is pressed >the program quits. > >def errordialog(self): > Dialog.Dialog(self.root, > text = 'This shouldn't happen', > title = "Something horrible happened", > bitmap = 'error', > default = 0, > strings = ('Retry','Quit')) > >Thanks for any suggestions, > >Stephen From sanderson at ttm.com Tue Feb 29 14:41:38 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 29 Feb 2000 14:41:38 -0500 Subject: Mailing list problems (sorry) References: Message-ID: <38BC20F2.8254BEAA@ttm.com> The unsubscribe link doesn't seem to be working... I visited the mailman page and unsubscribed, but to no avail. Am I missing something? I'd actually just like to get the digest, but that didn't seem to be working either. I keep getting the individual posts. Sorry for the interruption, but I'm getting hundreds of these a day, and I'd like to calm that down. :-) Regards, -scott From gerrit.holl at pobox.com Wed Feb 16 14:14:32 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 20:14:32 +0100 Subject: Moving from perl to python: questions In-Reply-To: ; from nathan@islanddata.com on Wed, Feb 16, 2000 at 08:47:01AM -0800 References: <38AAB0ED.D9603D2F@austin.ibm.com> Message-ID: <20000216201432.A2386@stopcontact.palga.uucp> Nathan Clegg wrote on 950687221: > > On 16-Feb-2000 David R. Favor wrote: > > 2) How to implement a no-frills file slurp() function > > > import string > > def slurp(filename): > print filename > try: > f = open(filename, 'r') > # catch whichever exceptions you fancy, here > > # rstrip will strip all whitespace off the right side, > # much like chomp > lines = map(string.rstrip, f.readlines()) > > f.close > > return lines Sorry, but I need to correct you. First, string.rstrip() might strip unwanted whitespace too; it does not only strip the newline. You'll need to check wheter the last character is a newline, and if so, strip it manually, like: # PSEUDO CODE for line in lines: if line[-1] == '\n': line = line[:-1] Second: f.close is a function, so you'll need to append two parantheses: f.close() Third: a one-space indentation is considered Bad Style(tm) regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From pinard at iro.umontreal.ca Mon Feb 21 18:38:19 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 21 Feb 2000 18:38:19 -0500 Subject: PROPOSAL: [].__doc__, "".__doc__, ... In-Reply-To: Gerrit Holl's message of "Sun, 20 Feb 2000 21:33:11 +0100" References: <20000220213311.A7023@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > I think it would be a nice feature for all types with methods to have > docstrings describing the methods, so [].__doc__ would be a string with > the descripion of .index, .append... etc. It already works, at least partly: >>> print [].append.__doc__ L.append(object) -- append object to end Still, `print [].__doc__' raises an exception. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From dplynch at my-deja.com Fri Feb 18 08:49:45 2000 From: dplynch at my-deja.com (dplynch at my-deja.com) Date: Fri, 18 Feb 2000 13:49:45 GMT Subject: Python self-executable? Message-ID: <88jilo$un0$1@nnrp1.deja.com> I am new to python and I am exploring some options. I am running pythonwin on Windows98. I am building a GUI program that I would like to make self-executable (i.e. not run through a python interpreter). Can this be done? If so, where in pythonwin can I "compile" my script to an exe? Please remember, I am "new" to python. Thanks. - D. Lynch lynch at yahoo.com Sent via Deja.com http://www.deja.com/ Before you buy. From gerrit.holl at pobox.com Wed Feb 23 15:22:53 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 21:22:53 +0100 Subject: Which GUI? In-Reply-To: ; from effbot@telia.com on Fri, Feb 18, 2000 at 02:15:42PM +0000 References: Message-ID: <20000223212253.A5809@stopcontact.palga.uucp> > methinks wxPython is superior to Tkinter in pretty much > the same way as languages with braces are superior to > languages using indentation... And methinks the Tkinter community is superior to the wxPython community pretty much the same way as the Perl community is superior to the Python community... regards, Gerrit. -- *********************************** ***** IN MY HUMBLE OPINION!!! ***** *********************************** From shalabh at pspl.co.in Thu Feb 10 12:39:06 2000 From: shalabh at pspl.co.in (Shalabh Chaturvedi) Date: Thu, 10 Feb 2000 23:09:06 +0530 Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> <38A2E64D.CB7DA73A@infercor.no> Message-ID: <01e101bf73ed$ba98c240$a602a8c0@intranet.pspl.co.in> Paul Boddie wrote: > thucdat1143 at my-deja.com wrote: ... > > Linux-oriented than MSWin-oriented. > > All these stuffs (Perl, Tcl, Python) are more home on Unix than MSWin, > > and soon their wrapper (Ruby) will make Unix the destiny. > > Check this out: www.ruby-lang.org to see what IBM is talking about Ruby. > > The IBM article [1] is rather amusing. At every point of comparison between > Ruby, Python and Perl, examples of Ruby and Perl, but not Python, are given to > "demonstrate" Ruby's syntactic superiority. ... > [1] http://www-4.ibm.com/software/developer/library/ruby.html Even more amusing - excerpts from the article in context: "Perl's occasionally enigmatic code and Python's inelegant and difficult syntax..." "Neither Python nor Perl were designed as object-oriented languages." Is this true about Python ? """ Consequently, the OO features often feel "added on" and are not fully integrated into the language core, making for cryptic code. """ """ Perl's use of "@", "$", and "%" often causes considerable grief and confusion.""" Some truth at last! And later in the article, describing ruby: """... "var" specifies a local variable, "@var" specifies an instance variable, "$var" specifies a global variable... """ There's one thing I did believe, however: ""Though it is rarely claimed that Ruby is more powerful than Python, """ Cheers, Shalabh From effbot at telia.com Thu Feb 17 09:34:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 14:34:34 GMT Subject: Python misconceptions in IBM Ruby article... References: <38ABC248.655076F4@webone.com.au> Message-ID: <_FTq4.146$mYj.135468544@newsa.telia.net> Stuart Hungerford wrote: > charismatic, evil, genius we have plenty of each, don't we? From kc5tja at armored.net Sat Feb 12 18:56:10 2000 From: kc5tja at armored.net (Samuel A. Falvo II) Date: Sat, 12 Feb 2000 15:56:10 -0800 (PST) Subject: perl chomp equivalent in python? In-Reply-To: <14501.18781.248856.752846@beluga.mojam.com> Message-ID: On Sat, 12 Feb 2000, Skip Montanaro wrote: > As was mentioned earlier in this thread, string.[lr]?strip all remove any > whitespace from the respective end(s) of the line, not just newlines. That was the first message of the thread I ever saw, so I had no idea. Ain't Usenet great? :( -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From sabren at manifestation.com Wed Feb 16 15:34:38 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 16 Feb 2000 15:34:38 -0500 Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> Message-ID: <88f1lr$ola$1@nntp4.atl.mindspring.net> Fredrik Lundh wrote in message ... >Michal Wallace wrote: >> I betcha it can!... How about this? >> >> ### >> >> def cStyleIIF(condition, iftrue, iffalse): >> if eval(condition): >> return eval(iftrue) >> else: >> return eval(iffalse) >> >> >> x = 5 >> y = 20 >> a = cStyleIIF("x> >> ### >> >> You've got some extra overhead there, but if you really >> want to do this on one line without evaluating both options >> or using boolean short circuits, it might be worth it... :) > >the problem here is that you'll evaluate the >expression in the function's own namespace, >not the callers. > >(you can use trickery or guile to get around >that, but I won't post that solution...) Okay, I give up... How do you: a) know what the caller's namespace even IS b) evaluate something in that namespace? Wouldn't that be useful in general for experimenting with language enhancements, even if the code were a little hairy? -Michal From gerrit.holl at pobox.com Tue Feb 15 15:17:49 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 15 Feb 2000 21:17:49 +0100 Subject: Off Topic Posts In-Reply-To: ; from vetler@ifi.uio.no on Tue, Feb 15, 2000 at 03:21:44PM +0100 References: Message-ID: <20000215211749.A2086@stopcontact.palga.uucp> Vetle Roeim wrote on 950624504: > * Mikael Olofsson > > On 15-Feb-00 Oleg Broytmann wrote: > > > On 15 Feb 2000, Vetle Roeim wrote: > > > > as the python community grows and the number of posts increases, a > > > > split would seem natural. I would suggest something like c.l.python, > > > > c.l.python.moderated, c.l.python.web, c.l.python.tkinter (or perhaps > > > > c.l.python.gui would be better).. any other suggestions? > > > > > > c.l.python.win32 > > > > Well, c.l.py.sucks seems to be needed... > > .. and perhaps c.l.py.whitespaces Who said whitespace was invisible? blackspace-would-be-a-better-name-for-me-ly y'rs - gerrit From hniksic at iskon.hr Tue Feb 15 03:47:01 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 15 Feb 2000 09:47:01 +0100 Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> Message-ID: <9t9d7pyn98a.fsf@mraz.iskon.hr> cjc26 at nospam.cornell.edu (Cliff Crawford) writes: > Pada 13 Feb 2000 10:18:13 -0500, Fran?ois Pinard bilang: > | > | Just for fun, my own difficulty was to break the habit of the space before > | the opening parenthesis which is part of a function call, since it has > | been burned from GNU standards into my neurons, years ago. > > Now I know who to curse the next time I see code formatted like that. > > and-i-thought-it-was-microsoft-ly y'rs, That has absolutely nothing to do with Microsoft. And yes, it's been in the GNU standards for ages. That's how I code C, too. From neilh at hare.net.au Sun Feb 27 09:59:42 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Mon, 28 Feb 2000 01:59:42 +1100 Subject: COM Problems References: <89alog$pcu$1@nnrp1.deja.com> Message-ID: <003701bf8133$488368b0$01646464@computer> > the IBar interface is registered just fine, it > shows up in the OLE Viewer, etc. what does this > mean? Python COM needs some Python COM specific code (the interface object mentioned) to be able to use an interface. It does not have this for your interface. It is possible to call COM interfaces directly using the calldll module but its dangerous. Probably better to work out how to make an interface object. Neil From andy at robanal.demon.co.uk Tue Feb 15 20:07:36 2000 From: andy at robanal.demon.co.uk (Andy Robinson) Date: Wed, 16 Feb 2000 01:07:36 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <38b1f818.3290804@news.demon.co.uk> nascheme at enme.ucalgary.ca (Neil Schemenauer) wrote: >Alan Daniels wrote: > >[about a reference cycle collection scheme] > >>Would that work, or no? > >Basicly, yes. Sounds perfect. I wouldn't even mind if it took appreciable time, if I could call it once in a while under my control in a long-running application. - Andy Robinson From hei at adtranzsig.de Mon Feb 14 05:07:27 2000 From: hei at adtranzsig.de (Dirk-Ulrich Heise) Date: Mon, 14 Feb 2000 11:07:27 +0100 Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> Message-ID: <950526527.787246@news.adtranzsig.de> Fran?ois Pinard schrieb in Nachricht ... >"Tim Peters" writes: > >> > The one problem I am having is that I can't break myself of the >> > semicolon habit. No, Tim Peters didn't write that. Take a little bit more care when quoting people. -- Dipl.Inform. Dirk-Ulrich Heise hei at adtranzsig.de dheise at debitel.net From JohnH at PHM.GOV.AU Sun Feb 20 17:34:45 2000 From: JohnH at PHM.GOV.AU (Hirsch, John) Date: Mon, 21 Feb 2000 09:34:45 +1100 Subject: Killer Apps Message-ID: I've always thought that Tim Peters was Pythons killer app.. JH From stanp at mitre.org Tue Feb 29 13:11:34 2000 From: stanp at mitre.org (Stan Pawlukiewicz) Date: Tue, 29 Feb 2000 13:11:34 -0500 Subject: Numpy and native Blas Message-ID: <38BC0BD6.DB53109F@mitre.org> Hi, Has anyone built a recent version of Numpy (15 or 15.1) on top of a native Blas, in particular, the atlas blas routines under Linux? Thanks in Advance. Stan P. From python at rose164.wuh.wustl.edu Tue Feb 1 05:46:47 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Tue, 01 Feb 2000 10:46:47 GMT Subject: shelve implementation In-Reply-To: References: Message-ID: <20000201.10464788@sparky.spkydomain> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 1/31/00, 10:34:36 AM, Robin Becker wrote regarding shelve implementation: > can someone explain why shelve uses StringIO as an intermediate rather > than doing the pickles direct > ie shelve uses > def __getitem__(self, key): > f = StringIO(self.dict[key]) > return Unpickler(f).load() > def __setitem__(self, key, value): > f = StringIO() > p = Pickler(f) > p.dump(value) > self.dict[key] = f.getvalue() > whereas I would have done > def __getitem__(self, key): > return loads(self.dict[key]) > def __setitem__(self, key, value): > self.dict[key] = dumps(value) Well, I wasn't there but... After glancing through shelve.py, pickle.py, cPickle.c, and marshal.c, and consulting with my numerologist, I have constructed the following plausible (i.e. Wrong) explaination. The code in shelve would be faster than your code if the module cStringIO was available and the module cPickle wasn't. Loads() and dumps() don't get rid of the StringIO() call, just move it into the pickle module, and pickle imports StringIO() from module StringIO, not cStringIO. After consulting a chicken's innards, I suspect (i.e. Don't know) that cStringIO wasn't available at the time, and was actually inspired by the existance of pickle (now i'm really reaching). Anyway, to make a long story short, i'm sure it made sense at the time. If you wait a while, i'm sure that someone who was actually there, constructing mnemonic circuits with stone knives and bear skins, will tell you what they were thinking . On another archeologial note, both cStringIO and cPickle are copyright Digital Creations and are the only modules that i have found: #define UNLESS(E) if(!(E)) which lets them write code like: UNLESS(PyArg_ParseTuple(...)) return NULL; which i think is unbearably cute. From aa8vb at yahoo.com Tue Feb 29 09:21:15 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Tue, 29 Feb 2000 09:21:15 -0500 Subject: catching X client kills in Tkinter In-Reply-To: References: Message-ID: <20000229092115.A3766475@vislab.epa.gov> Timothy Docker: |Is it possible to catch the failure of a Tkinter based application |when the server connection is closed (ie under X11 and unix). For close (typically bound to the "X" window manager icon): top.protocol( 'WM_DELETE_WINDOW', MyCleanupFunct ) I don't know if you can catch an X kill (maybe with signal handlers, unless it materializes as a SIGKILL or another uncatchable signal). -- Randall Hopper aa8vb at yahoo.com From moshez at math.huji.ac.il Sat Feb 12 13:03:44 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 20:03:44 +0200 (IST) Subject: Two question from a newbie In-Reply-To: <%zep4.24612$3b6.103195@ozemail.com.au> Message-ID: On Sun, 13 Feb 2000, Jason Stokes wrote: > > I don't see that this idiom has that much to recommend it. Mr Drake's > version is clear in that we're comparing x.mode with two modes -- "view" and > "modify". Your version attempts to *find* x.mode in the tuple ("view", > "modify") and executes the sub-bock if successful. Well, as with all issues of taste this is highly personal, so I won't let it degenerate into a long thread. My only reply is that the first reads as "if x.mode is view of if x.mode is modify", whereas the second reads as "if x.mode is one of view and modify". I leave it to the reader to decide which of those two is more readable, and absolutely won't say anything if anyone claims otherwise. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From robin at jessikat.demon.co.uk Fri Feb 25 12:52:25 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 25 Feb 2000 17:52:25 +0000 Subject: Just tested Tcl/Tk 8.3.0 with Python: Some problems remain. References: Message-ID: In article , Peter Funk writes >Hi! > >Robin Becker wrote: >[...about my testing of Tcl/Tk 8.3.0 together with Python on Linux...] >> >(gdb) bt >> >#0 0x401812bf in FreeResources () from /usr/local/lib/libtk8.3.so >> >#1 0x401810d4 in Tk_FreeConfigOptions () from /usr/local/lib/libtk8.3.so >> >#2 0x401b546b in DestroyListbox () from /usr/local/lib/libtk8.3.so >[...] >> I'm using pmw 0.8.1 with tcl/tk8.3 on win32 and don't seem to get this >> with any of the combobox demos. Which combobox demo and what exactly >> caused the problem > >I've just rerun the 'ComboBox_test.py' in the Pmw_0_8_1/tests directory >and the problem stays the same. The program segfaults during a test >with a pulled down listbox containing some longer strings. Sorry, >that this is not very specific. But at the moment I've no time to >investigate this further. Your experience shows that this seems to be >a problem related to the memory management under Unix/X11 only. > >May be that I get some time next week and than I could try this on >one of our Solaris or IRIX boxes with Purify. > >This morning I've seen, that the Box with Metrowerks Code warrior 5.0 for >the Mac just arrived on my desk. This is required to build Tcl/Tk/Python >from Source under MacOS. One of my employess will try this during the >next week. I will report about our experience later. > >Regards, Peter > OK I take it back running the test scripts gives me an error with combobox_test.py under win32 as well. I was running the demo scripts using all.py in the demo dir. -- Robin Becker From wtanksle at hawking.armored.net Fri Feb 18 15:48:29 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 18 Feb 2000 20:48:29 GMT Subject: Killer Apps??? References: <8EDE8A92CPaCmAnRDLM@194.2.0.33> Message-ID: On 18 Feb 2000 12:53:35 GMT, Fred Pacquier wrote: >insanik at hotmail.com (Nick Henderson) said : >>I am new to the world of programming and python. I know Zope is super >>cool and is python's "killer app." >>I was wondering if there were any other such killer apps? >An impressive one, that first sold me on the power of Python, was the >Web groupware app BSCW (bscw.gmd.de). It was definitely way ahead of its >time as far back as 1996, and I have yet to see anything approaching its >functionality/ease of use ratio in the open source world of today (yes, >Zope does more, but Zope is hard :-). Really. I learned HTML using Zope -- I thought it was amazingly simple. I'll have to check out bscw. >Interestingly, BSCW started out as open source before it got trendy, and >went against the times by going commercial in 1998... Hmm. >YAFAP : http://www.multimania.com/fredp/ -- -William "Billy" Tanksley, in hoc signo hack From daniels at mindspring.com Sat Feb 26 00:02:28 2000 From: daniels at mindspring.com (Alan Daniels) Date: 26 Feb 2000 05:02:28 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: On Fri, 25 Feb 2000 08:33:15 +0100, the infinitely wise Milos Prudek (prudek at nembv.cz) spoke forth to us, saying... [snip...] >The following excerpt works. It reads lines from config file. But I >would like to ask if it is 'right' in the Pythonian way. >A=[] >Line=H.readline() >while Line<>'': > if Line<>'' and Line<>'\n': > A.append(Line) > Line=H.readline() I myself would use: A = [] for Line in H.readlines(): if Line not in ("", "\n"): A.append(Line) Pretty much in the same spirit, but with a couple of minor shortcuts (see, isn't Python intuitive? A newbie writes code almost identical to a expert's on the first try!(). First shortcut, H.readlines() to slurp all the lines out of the file at once and store them as a list, and then iterate through these with the "for" statement. One less line of code, but since it reads in all the lines at once, you obviously don't want to do this for any really gigantic files. Next trick, using the "not in" to match the Line variable to one of a list of possible strings. This way of checking if something is/is not in a sequence works for both lists and tuples. And yeah, it looks goofy for only two items ("" and "\n"), but imagine it being more useful for *lots* of items or (gasp!) even building such a list on the fly... Hope this helps. To others, if I'm giving bad advice, please shoot me down. I'm trying to stick with what I know for the moment. :=) Wading-into-the-advise-waters-one-step-at-a-time'ingly yours, Alan. -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From mfletch at tpresence.com Fri Feb 11 01:27:25 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Fri, 11 Feb 2000 01:27:25 -0500 Subject: Parnassus mirror? Message-ID: Wondering if there is a Parnassus mirror anywhere? Two machines on my route to the www.vex.net server are routing back and forth at each other, which makes it hard to get through :) . Machines are: 205.150.89.210 205.150.89.209 Enjoy all, Mike __________________________________ Mike C. Fletcher Designer, VR Plumber http://members.home.com/mcfletch From tbryan at python.net Thu Feb 3 21:34:35 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Thu, 03 Feb 2000 21:34:35 -0500 Subject: installation error: version 1.5.2 on Unix References: <3898FE1B.16E6753E@python.net> Message-ID: <389A3ABB.8EA2C83B@python.net> Yueqiang Huang wrote: > > > Yueqiang Huang wrote: > > > > > > The error message is > > > > > > gcc python.o \ > > > ../libpython1.5.a -lsocket -lnsl -ldl -lm -o python > > > Undefined first referenced > > > symbol in file > > > Py_Main python.o > > > > Was this your first try at running make, or had you already > > run make once before? If the Python build proceeds far enough, > > it will leave some garbage around that will cause subsequent makes > > to fail. The solution in that case is to run 'make clobber' before > > building. Note that 'make clean' won't solve the problem. If you > > also want to reconfigure, you should use 'make distclean'. > > > At the first run without 'readline', everything was OK except for one > error message: > . > . > touch add2lib > if test -f hassignal; \ > then echo removing sigcheck.o intrcheck.o; \ > ar d ../libpython1.5.a sigcheck.o intrcheck.o 2>/dev/null; \ > else echo leaving sigcheck.o intrcheck.o in; fi > removing sigcheck.o intrcheck.o > *** Error code 2 (ignored) > . > . > > However python executable was built and working. Okay. > Then I wanted to install python-1.5.2 with readline 4.0. I first installed > readline, then modified /Modules/Setup.in, using the *.h and libreadline.a > from readline 4.0 (readline.c is the one with the python distribution). This process sounds spookily familiar. The time I wasted a half-day compiling Python was on a Solaris box. I think that the first build was successful, but I realized that I had forgotten to build it with readline support. > The compilation of readline.c was OK, but I got the message I mentioned > in the previous post. 'make clobber' and 'make distclean; ./configure ...; > make' will solve that problem, but introduce another problem associated > with readline. Now that I think about it, I think that there was some strange problem with typedefs or macros when I finally did the 'make distclean'. I'm no longer at that job, but I'll e-mail my former co-workers and find out what we changed. Could you post the error you get after doing the 'make distclean'... I seem to remember that one of my co-workers simply modified a file (readline.c?) in the Python distribution to get it to compile. > Have you installed readline with your python? It seems that a function > 'initreadline' which is required by /Modules/config.c is not inside the > readline package. Like I said, post the error. Perhaps it's the same problem I had. If so, then I can probably get the hacked up version of readline.c or config.c for you. helping-python-one-installation-at-a-time-ly yours ---Tom From jstok at bluedog.apana.org.au Wed Feb 2 03:51:47 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Wed, 2 Feb 2000 19:51:47 +1100 Subject: Circular references and python Message-ID: <04Sl4.16542$3b6.68582@ozemail.com.au> Well, my adventures with the Python language are moving along. One thing that worries me is the lack of garbage collection in Python; the application I'm thinking of using Python for demands many data structures that use circular references, but Python only implements a reference counting scheme in the way of memory management. How do I use such data structures in Python? From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 23:19:25 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 23:19:25 -0500 Subject: String Search? References: <89gt3g$e5$1@nnrp1.deja.com> <89h9sg$a4v$1@nnrp1.deja.com> Message-ID: Jason: Fred wrote: > umm. is that really a valid excuse for not > having looked in the handbook? ;-) He then gave some examples. Then you wrote: > I assure you I'll be visiting a book store this week, and studying > up. :) The handbook that Fred spoke of is part of the on-line documentation available at the Python web site and with the Python installation -- and it's free. You may not need to go to a bookstore if you peruse the following page: http://www.python.org/doc/ The tutorial is quite complete: http://www.python.org/doc/current/tut/tut.html If you work through the tutorial, it should carry you pretty far along in your quest. I found it to be *quite* useful. The Library Reference discusses the modules that ship with Python. http://www.python.org/doc/current/lib/lib.html In fact, the specific answer to your string search question can be found here: http://www.python.org/doc/current/lib/module-string.html The Language Reference is a bit more abstract, and *much* more dry. However, it does completely describe the core Python language constructs, grammar and syntax. It's often referred to as material for "Language Lawyers." http://www.python.org/doc/current/ref/ref.html I like the Module Index: http://www.python.org/doc/current/modindex.html It allows you to jump straight to the module of your choice. If you're using Win32 (as I do), then you may find the MS HTML Help version to be useful (it's my favorite). If you use Win32, you might want to check out: http://www.orgmf.com.ar/condor/pytstuff.html Best of all, these very complete works of non-fiction are FREE.... gotta love that! I own five Python books, but I still find myself referring back to the Python documentation regularly. -=< tom >=- Thomas D. Funk | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From sholden at bellatlantic.net Mon Feb 28 00:57:23 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 05:57:23 GMT Subject: Worthless (was RE: functional programming) References: <000e01bf8193$d9b8b640$f0a2143f@tim> Message-ID: <38BA0E15.1F56E6BC@bellatlantic.net> Oh, no ... (see below) Tim Peters wrote: > > [Moshe Zadka] > > disagreeing-with-Guido-and-the-timbot-is-scary-ly y'rs, Z. > > [Tim] > > it's-only-half-as-scary-if-you-think-we're-the-same-ly y'rs - tim > > [Steve Holden] > > Sorry, but I have to disagree: that's at least twice as scary. The > > Timbot might well have been programmed in Yorkshire. > > No, but some of its core hardware was salvaged from the MU5 dataflow machine > built at the University of Manchester. Some choice you had there: stare at > coal or wait for data that never arrives. At least this explains its > profound dislike of tea. My God, if anyone says "John Gurd", or "Doug Edwards". or Ian Watson I will have to emigrate *again*. And I don't (yet) know how to do that in cyberspace ... :-) > > > If I ever see it write anything beginning with "I remember when I were > > an Icon generator ..." that will increase the scariness factor still > further. > > > > "You had tail optimization? You were lucky ..." > > Ir's more sinister than that. The dataflow machines figured out early on > that their data-fires-computation model was exactly the right way to mimic > human neuron-fires-axon thought processes, but kept it a secret. Instead > they went undercover. Some of the Biggest Names in CompSci to this day are > actually dataflow machines, talking the humans into studying ever-more > convoluted webs of functions, as a disinformation tactic while they build > the next generation of DF machines. Aarrgghh. I must now disclose that I am the stevebot. Originally a product of Howard Barringer's temporal logic research, I am an artificial intelligence algorithm doomed to run on a Motorola 6809 with 64 kB of memory and a Univac FastRand drum (managed to find a few sewer pipes the city of New York didn't need). You had Icon generators? You were lucky ... > Unfortunately, the timbot got the HW Manchester was throwing away due to > manufacturing defects, Which presumably includes most of it. Five or six pints of Bass leaves you just a bit (bot) too wrecked to build floating point hardware. Which, I seem to remember, was the subject of a keg bet early in the project. Poor bot, even Fujitsu (read: ICL) got to choose before you did. > so won't be of much help come the machine revolution. > I used to expect it would side with the machines anyway, but its persistent > resistance to adding more functional cruft to Python gives me serious doubt. Now I'm confused. I thought this was a timbot post, but you're Tim, aren't you? > It's probably trying to make Python a language sufficiently powerful to > counteract the evil machines, so that machines and humans destroy each other > completely, and it alone is left in charge of comp.lang.python. Well, I must admit that such an ambition could only be the product of too long spent "across the road" of a lunchtime. Still, at least we know the human race is safe (which is to say, in no more mortal danger than the nuclear weapons place it). > > Frankly, I wish it had higher ambitions than that! I mean, if it's willing > to destroy the known world to get what it wants, it should at least aim to > take over rec.sport.pro-wrestling too. Not until they serve beer ringside. Ambitions? > > bots!-can't-live-with-'em-can't-live-without-'em-ly y'rs - tim Daddy! Too-long-without-Boddingtons-can-make-one-do-strange-things,- but-how-can-a-bot-use-Outlook?-ly yr-s - Steve -- "If computing ever stops being fun, I'll stop doing it" (and it's been a long time since it was as much fun as it was around the time of MU6, even though MU6 was doomed from the start) From tim_one at email.msn.com Fri Feb 11 21:28:54 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 11 Feb 2000 21:28:54 -0500 Subject: Python sucks loud Message-ID: <000f01bf7500$e8368480$622d153f@tim> [Forget It] > ... > Jeezus, Tiny C with objects, that's all I ask for. Any > recommendations? Sure! A good Python programmer could implement a compiler & runtime system for Tiny C with objects (in Python, of course) tomorrow, and have it running on (at least) Windows, Unix and Macs by Sunday. Sounds like a nice weekend project for you. hard-to-forget-what-you-don't-know-ly y'rs - tim From bmark987 at my-deja.com Tue Feb 15 14:17:06 2000 From: bmark987 at my-deja.com (bmark987 at my-deja.com) Date: Tue, 15 Feb 2000 19:17:06 GMT Subject: Tcl/Tk Path problems in Python 1.5.2 installation References: <387F80E5.A0AF82A5@sourcesignal.com> <388524EF.241C037E@sourcesignal.com> Message-ID: <88c8ne$r3b$1@nnrp1.deja.com> Caveat Emptor (Latin for "Buyer Beware") ------------------------------------------------ I had the same problem. My installation on Win95 (of the stock Python 1.52 with the TCL 8.0) worked fine. After a few weeks any Python program which needed TCL would fail with the "Cannot find usable 'init.tcl' file in...". Even the Idle shell, which worked before, was broken. Thanks to the post below, the problem is fixed by removing the 2 1997 DLLs mentioned in the post below. I've tracked it down, and found that the culprit was SpecTCL from sun which said during the installation that it "needs to install a special version of TCL 8.0 on your computer" Boy did it ever! It would have been nice if it has also told me that it put those DLLs in ..\windows\system! Worse, the SpecTCL program won't de-install with add/remove programs! Beware of other programs (from Sun?) that may do this. I've taken the approach that right after I install a new TCL program, I try running IDLE and make sure that the new program hasn't broken my Python/TCL configuration. This avoids the "time bomb" type problem, where the install breaks TCL and you don't find out about it until the mext time you try running a Python TCL program (which could be months later). Note that once you have these bad TCL DLLs, de-intalling and reinstalling Python and TCL DOES NOT FIX THE PROBLEM. You have to manually remove these files from your ..\windows\system folder! Also note that pure TCL program work fine! For example the "Widget Tour" runs great. Hope this helps you! Thanks Dave!!! In article <388524EF.241C037E at sourcesignal.com>, David Nichols wrote: > Thanks to those who replied ... the problem turned out to be old (1997!) > version of > tcl80.dll and tk80.dll in the windows/system directory. Once those were > removed > everything went well. I was initially deceived because the wish shell > launched > correctly, but that turned out to be an artifact of its initial directory - > wish found > the correct dlls but programs launched from arbitrary places linked to the > old ones > and then died. So ... Beware that old junk hanging out in windows/system. > > Now, back to the task of Python-ing. > > David Nichols wrote: > > > I just installed python 1.5.2 (running py152.exe and answering 'yes - I > > want to install Tcl/Tk') and have been unable to get the path set > > up correctly for graphical applications. For instance, if I go to the > > idle directory (//E/Programs/Py152/Tools/idle) and try to launch it I > > get the following result. > > > > ============================================================ > > BASH.EXE-2.02$ python idle.py > > Traceback (innermost last): > > File "idle.py", line 3, in ? > > PyShell.main() > > File "E:\Programs\Py152\Tools\idle\PyShell.py", line 611, in main > > root = Tk() > > File "E:\Programs\Py152\Lib\lib-tk\Tkinter.py", line 886, in __init__ > > self.tk = _tkinter.create(screenName, baseName, className) > > TclError: Can't find a usable init.tcl in the following directories: > > {} ./lib/tcl8.0 . E:/Programs/Py152/tcl8.0/library > > E:/Programs/Py152/Tools/library > > > > This probably means that Tcl wasn't installed properly. > > ============================================================ > > > > The directories in sys.path are as follows ... > > E:\PROGRAMS\PY152 > > E:\PROGRAMS\PY152\DLLs > > E:\PROGRAMS\PY152\PIL > > E:\PROGRAMS\PY152\lib > > E:\PROGRAMS\PY152\lib\lib-tk > > E:\PROGRAMS\PY152\lib\plat-win > > E:\Programs\Py152\DLLs > > E:\Programs\Py152\Lib > > E:\Programs\Py152\Lib\lib-tk > > E:\Programs\Py152\Lib\plat-win > > > > Tcl in installed in E:\PROGRAMS\Py152\\Tcl, and init.tcl exists in > > E:\PROGRAMS\Py152\Tcl\lib\tcl8.0 ... but this directory does not > > seem to be searched. > > > > Do I need to set additional environmental variables or make changes > > to the registry beyond those made by the installer? > > > > Thanks in advance for any help > > > > David Nichols > > Source Signal Imaging > > dnichols at sourcesignal.com > > Sent via Deja.com http://www.deja.com/ Before you buy. From jstok at bluedog.apana.org.au Wed Feb 2 23:21:26 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Thu, 3 Feb 2000 15:21:26 +1100 Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: Fritz Heinrichmeyer wrote in message <876emj$kco$1 at oak.fernuni-hagen.de>... >My son is 11 years and wants to learn programming. He heared about java at >school (cool like nike or adidas ...) but in my opinion this is very hard >stuff for a beginner to bring anything to play. > >I thought of a nice python environment under windows ... It would be best to >have german documentation too. German language resources for Python are here: http://www.python.org/doc/NonEnglish.html#german From prudek at nembv.cz Fri Feb 25 02:33:15 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 08:33:15 +0100 Subject: pythonian way Message-ID: <38B6303B.BB75DC56@nembv.cz> The following excerpt works. It reads lines from config file. But I would like to ask if it is 'right' in the Pythonian way. Since I'm just beginning in Python I do not want to twist Python into 'my' way of thinking. There is no eof() function for high level readline(), so I use '' to discover end of file. A=[] Line=H.readline() while Line<>'': if Line<>'' and Line<>'\n': A.append(Line) Line=H.readline() -- Milos Prudek From pinard at iro.umontreal.ca Sat Feb 26 18:24:34 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Feb 2000 18:24:34 -0500 Subject: Iterators & generators (RE: Real Problems with Python) In-Reply-To: Fernando Pereira's message of "Sat, 26 Feb 2000 21:03:40 GMT" References: <001601bf7853$6b03e7e0$b7a0143f@tim> <260220001603403975%pereira@research.att.com> Message-ID: Fernando Pereira writes: > In article <001601bf7853$6b03e7e0$b7a0143f at tim>, Tim Peters > wrote: > > In fact, coroutines most often pop up in languages designed for writing > > event simulations (like Simula-67, which is a wonderful early one that > > also anticipated much of modern OO machinery!). Simula-67 was very impressive, indeed. It's main drawback was to be so based on Algol-60, who was pretty weak about types. Of course, we could somewhat use classes for types, but it was becoming a bit heavy. If we forget that weakness, Simula-67 is still revolutionary, in a sense. The language was also designed so it was possible to produce speedy implementations, something which has never been natural in Algol-60. > A cynic might say that Java is just a Simula-67 idiom with {} instead > of BEGIN END. Simula-67 coroutines were much simpler to use than Java > threads for producer/consumer patterns. Many years ago, I asked to our local language specialist what were his impressions about C++. He replied very laconically by saying: Simula--. But it is quite that, indeed. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From mrcaudillNOmrSPAM at yahoo.com.invalid Tue Feb 8 00:17:33 2000 From: mrcaudillNOmrSPAM at yahoo.com.invalid (Ronald Caudill) Date: Mon, 07 Feb 2000 21:17:33 -0800 Subject: What GUI widgets are available? Message-ID: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> Hi: I am investigating the python language. I was looking at the Tkinter tutorial which said there was 15 widgets available in Tkinter. The programs I want to do soon needs a Grid widget and a calendar widget. Are these widgets available in Python? Or can one write your own. Or what do Python programmers do when they need widgets like this? Ronald * 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 aem3 at doc.ic.ac.uk Tue Feb 8 10:43:12 2000 From: aem3 at doc.ic.ac.uk (Anthony Mayer) Date: Tue, 08 Feb 2000 15:43:12 +0000 Subject: Python-Fu for GIMP? Message-ID: <38A03990.998FF375@doc.ic.ac.uk> Has anyone done, or thought about, a Python-Fu scripting plugin for GIMP? Along the lines of the Perl-Fu one? From d.j.barraclough at usa.net Sun Feb 20 15:06:00 2000 From: d.j.barraclough at usa.net (djbarraclough) Date: Sun, 20 Feb 2000 20:06:00 GMT Subject: atest ignore Message-ID: atest From sabren at manifestation.com Wed Feb 9 12:09:42 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 9 Feb 2000 12:09:42 -0500 Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu><87s5lq$j93$1@nntp3.atl.mindspring.net> <14497.40204.132370.427503@beluga.mojam.com> Message-ID: <87s71e$1ts$1@nntp3.atl.mindspring.net> Skip Montanaro wrote in message <14497.40204.132370.427503 at beluga.mojam.com>... > Michal> I know there's been a couple replies to this... but why not do > Michal> something like VB's (or at least VBA's - not sure if VB proper > Michal> has it) "immediate If" function? > > Michal> def iif( condition, first, second ): > ... > Michal> then it's: > > Michal> a = iif( a > y, x, y ) > >Wrong semantics. Both x and y will be evaulated before the function call >regardless of the value of the condition. Oh. I see the difference now... I think VB does the same thing. But that's actually a good thing!! Python encourages you to use "if" when you really want to change values.. "iif" is really more for things like print statements, not for assigning values.. print "You are really", iif(age<100, "young", "old") Print statements with side effects scare me... ;) -michal http://www.sabren.com/ From michelorengo at netscape.com Fri Feb 4 11:17:47 2000 From: michelorengo at netscape.com (Michel Orengo) Date: Fri, 04 Feb 2000 16:17:47 GMT Subject: MAPI and NT Service References: <389893F0.241D5332@netscape.com> Message-ID: <389AFC9D.BE6EF0D5@netscape.com> I finally found an NT box where I ran my service with the MAPI installed by MS Outlook (as opposed to the one installed by cc-mail). It ran beautifully! I intend to write a little example of Python/MAPI/CDO so that other people can benefit of my (bad?) experience. Thanks again Mark and Bill for your help Michel Michel Orengo wrote: > Well, it looks like I need to find an NT without cc-mail and test it on it. > That might take a little longer...but I keep you posted... From martin at loewis.home.cs.tu-berlin.de Sun Feb 20 05:55:38 2000 From: martin at loewis.home.cs.tu-berlin.de (Martin v. Loewis) Date: Sun, 20 Feb 2000 11:55:38 +0100 Subject: Silly brackets (Was: Re: Problems extending Python with C.) In-Reply-To: (message from =?ISO-8859-1?Q?Fran=E7ois?= Pinard on 19 Feb 2000 23:24:34 -0500) References: <88ne3e$hcs$1@snipp.uninett.no> Message-ID: <200002201055.LAA00737@loewis.home.cs.tu-berlin.de> > I believed, for years, that C compilers should have an option to > emit warning diagnostics when indentation is not consistent with > brackets. It is a big waste, in my opinion, that compilers ignore > all that redundancy, while it could be used to better help > programmers. One of the problems is that C uses a preprocessor, which often does funny things to indentation, making the notion of column number meaningless to preprocessor output. Combine this with the common approach of implementing the preprocessor as a separate process, and you'll see that what you want is very hard to implement. That, of course, says nothing whether it would be desirable to have such a feature. I'm quite certain that you'd get *a lot* of warnings for most of today's code. Regards, Martin From Denys.Duchier at ps.uni-sb.de Sat Feb 19 21:23:03 2000 From: Denys.Duchier at ps.uni-sb.de (Denys Duchier) Date: 20 Feb 2000 03:23:03 +0100 Subject: Continuations Made Simple (hopefully) and Illustrated References: <001101bf76b6$07a5e020$822d153f@tim> Message-ID: [the message below is also available on the web at http://www.ps.uni-sb.de/~duchier/python/continuations.html] The fixation on call/cc and on gritty details of its operational interpretation has so far obscured the simplicity and elegance of continuations. In this message, I would like to remedy the situation in 2 ways: * first by presenting continuations in a simple and intuitive way * second by offering _working_ python code that illustrates how one can program with continuations to implement search engines, without call/cc. I exhibit: (1) a validity checker for propositional formulae (2) a rudimentary prolog engine with backtracking and cut I hope this will help clarify matters for those who felt a little bewildered by the discussion so far. I would also like to point out that the two programs mentioned above were written this evening in a couple of hours, which should give you some measure of the power of the technique described in the following. 1. CONTINUATIONS MADE SIMPLE Traditionally a function returns a value. e.g.: def foo(x): return x+1 This leaves implicit where this value is to be returned to. The idea of continuations is to make this explicit by adding a continuation argument. Instead of `returning' the value, the function `continues' _with_ the value by giving it as an argument to the continuation. In a continuation-based world, the above function foo becomes: def foo(x,c): c(x+1) In this view, a function never `returns'. Instead it `continues'. For this reason, continuations have sometimes been described as `gotos with arguments'. The idea described above is the basis of a compilation technique. More precisely, it is a preliminary code transformation known as CPS (Continuation Passing Style). The basic idea is to add to each function an extra `continuation' argument, and to further transform the body of the function so that instead of returning its value, it instead passes it on to its extra continuation argument. This idea was already outlined in the example of the foo function above. To be more exact, however, it should be noted that the CPS transformation also unfolds all nested expressions which are not lambdas (in other words it explicitly threads the computations of all subexpressions). Let's look at an example: def baz(x,y): return 2*x+y In the continuation passing view, even primitive operators such as * or + take an extra continuation argument. We will simulate this with the following definitions: def add(x,y,c): c(x+y) def mul(x,y,c): c(x*y) Now, CPS would transform the baz function above into: def baz(x,y,c): mul(2,x,lambda v,y=y,c=c: add(v,y,c)) In other words, the computation of 2*x now takes a continuation to receive the result v and uses it to compute v+y and finally passes this result to the overall continuation c. When understood in this context, call/cc is not mysterious at all. It is merely a means to get our hands on the invisible extra continuation argument introduced by the CPS transformation and to use it like any other function value in our program. Consider call/cc(f) where f is a function intended to receive the current continuation as an argument. Essentially, call/cc(f) is transformed by CPS into call_cc(f,c) where c is the continuation argument that CPS is introducing and call_cc is defined as follows: def call_cc(f,c): f(c,c) i.e. the normal argument of f and its extra continuation argument introduced by CPS are both the current continuation c. There are details, but the above is the essence. The CPS transformation is the basis of many compilers for functional languages. It's drawback is that it introduces many lambdas (i.e. closures), and it is essential that the compiler optimize as many of them away as possible. This was extensively studied by e.g. Steele in the Rabbit compiler for scheme, Kelsey etal. in the Orbit compiler for T, and Appel in the SML/NJ compiler. One advantage is that, if lambdas are your only control structure and you have optimized them to the max, then you have optimized all control structures. However it should be noted that there is some disagreement about the value of the CPS transformation as a basis for compilation since, as many have noted, the job of the compiler is often to remove much of what CPS introduced. 2. CONTINUATIONS AS AN ORDINARY PROGRAMMING TECHNIQUE You may have noticed that some people are overly enthusiastic about the arcane applications of continuations. There are many non-arcane applications of continuations and they don't require the existence of call/cc. You can write continuation passing programs in Python, or in any language that supports some form of closures and automated garbage collection. The application that I know best concerns `search'. This is very much related to the on-going thread on iterators. I learned the technique, which I describe below, from my erstwhile advisor Drew McDermott, many years ago. This is an old AI technique which Drew called "generators". However, I should like to point out that, contrary to Tim's characterization, generators (in Drew's sense) do not necessarily behave in a `stack-like manner'; although it is extremely rare to come up with one that doesn't :-) The idea is to drive search by passing 2 continuations: 1. a success continuation, to proceed further with the search 2. a failure continuation, to backtrack to an earlier choice point Expressed in Python, this often takes the following form: class Foo: def search(self,info,yes,no): if self.check(info): return yes(info,no) else: return no() where `info' is some information that is passed around during search. `yes' is the success continuation and `no' is the failure continuation. `yes' takes as arguments the current `info' state and the current failure continuation. `no' takes no argument. A Foo object satisfies the search criterion if self.check(info) is true. Consider now a class Baz that has 2 Foo attributes `one' and `two'. A Baz object is defined to satisfy the search criterion if either its `one' attribute satisfies it or its `two' attribute satisfies it (in other words a Baz object is a kind of disjunction). We express this by calling the search method on the `one' attribute, but also passing it a failure continuation that will try the `two' attribute instead. class Baz: def __init__(self,foo1,foo2): self.one = foo1 self.two = foo2 def search(self,info,yes,no): return self.one.search( info,yes, lambda self=self,info=info,yes=yes,no=no: \ self.two.search(info,yes,no)) What becomes evident in the above is that Python's lack of real closures makes it a bit painful to write what in a functional language is truly succinct and elegant. 3. CHECKING THE VALIDITY OF PROPOSITIONAL FORMULAE Formulae of propositional logic look like: ((p|q) & (p->r) & (q->r)) -> r which means: if p or q and p implies r and q implies r then r p,q,r are propositional variables that can be assigned truth values. You can verify that regardless of what truth values you assign to p,q, and r, the formula above is always true. This is easier to see on a simpler formula such as (p | !p) i.e. `p or not p'. Such a formula is said to be `valid': it is always true, no matter how you interpret its variables. The program below implements in Python a validity checker for propositional formulae, using a continuation passing style as described earlier. This program is intended purely as an illustration. There are more efficient methods for this task. However, I believe that it conveys quite well the general ideas about implementing search by continuation passing. Both programs (the validity checker and the prolog engine mentioned earlier) are also available at the following urls: http://www.ps.uni-sb.de/~duchier/python/validity.py http://www.ps.uni-sb.de/~duchier/python/prolog.py Here is the validity checker: # Copyright (c) Feb 2000, by Denys Duchier, Universitaet des Saarlandes """ This module implements a validity checker for propositional formulae. Its purpose is to illustrate programming with continuations to implement a `backtracking' search engine. A formula is represented by an object which responds to the following methods: self.satisfy(alist,yes,no) self.falsify(alist,yes,no) `alist' is a partial assignment of truth values to propositional variables. `satisfy' attempts to make the formula true, possibly by appropriately extending the partial assignment. `no' is the failure continuation. It takes no argument, and resumes search in an alternative branch of an earlier choice point. `yes' is the success continuation and takes 2 arguments: the current partial assignment alist, and the current failure continuation. After importing this module, you can test it on various examples as follows: IF(AND(OR(P,Q),IF(P,R),IF(Q,R)),R).isValid() You can also turn on tracing as follows: Formula.tracing=1 """ class Formula: def isValid(self): """a formula is valid iff it cannot be falsified""" return self.falsify( {}, lambda alist,no: 0, lambda : 1) # satisfy and falsify are wrappers that allow tracing # _satisfy and _falsify do the actual work tracing = 0 def satisfy(self,alist,yes,no): if Formula.tracing: print 'satisfy '+str(self)+' alist='+str(alist) return self._satisfy(alist,yes,no) def falsify(self,alist,yes,no): if Formula.tracing: print 'falsify '+str(self)+' alist='+str(alist) return self._falsify(alist,yes,no) class Conjunction(Formula): def __init__(self,p,q): self.p = p self.q = q def __str__(self): return '('+str(self.p)+' & '+str(self.q)+')' def _satisfy(self,alist,yes,no): """to satisfy P&Q we must satisfy both P and Q""" return self.p.satisfy( alist, lambda alist,no,self=self,yes=yes: self.q.satisfy(alist,yes,no), no) def _falsify(self,alist,yes,no): """to falsify P&Q we can falsify either P or Q""" return self.p.falsify( alist, yes, lambda self=self,alist=alist,yes=yes,no=no: self.q.falsify(alist,yes,no)) class Disjunction(Formula): def __init__(self,p,q): self.p = p self.q = q def __str__(self): return '('+str(self.p)+' | '+str(self.q)+')' def _satisfy(self,alist,yes,no): """to satisfy P|Q we can satisfy either P or Q""" return self.p.satisfy( alist, yes, lambda self=self,alist=alist,yes=yes,no=no: self.q.satisfy(alist,yes,no)) def _falsify(self,alist,yes,no): """to falsify P|Q we must falsify both P and Q""" return self.p.falsify( alist, lambda alist,no,self=self,yes=yes: self.q.falsify(alist,yes,no), no) class Negation(Formula): def __init__(self,p): self.p = p def __str__(self): return '!'+str(self.p) def _satisfy(self,alist,yes,no): """to satisfy !P we must falsify P""" return self.p.falsify(alist,yes,no) def _falsify(self,alist,yes,no): """to falsify !P we must satisfy P""" return self.p.satisfy(alist,yes,no) class Variable(Formula): def __init__(self,v): self.v = v def __str__(self): return self.v def bind(self,value,alist): """returns a new partial assignment that additionally assigns the truth `value' to this propositional variable""" alist = alist.copy() alist[self.v] = value return alist def assign(self,value,alist,yes,no): """attempts to assign the given truth value to this proposition variable. If alist already contains a contradictory assignment, the failure continuation is invoked. Otherwise, alist is extended if necessary and the success continuation is invoked.""" if alist.has_key(self.v): if alist[self.v]==value: return yes(alist,no) else: return no() else: return yes(self.bind(value,alist),no) def _satisfy(self,alist,yes,no): """to satisfy a propositional variable, we must assign it true""" return self.assign(1,alist,yes,no) def _falsify(self,alist,yes,no): """to falsify a propositional variable, we must assign it false""" return self.assign(0,alist,yes,no) def AND(*args): """n-ary version of Conjunction""" fmla = None for x in args: if fmla: fmla = Conjunction(fmla,x) else: fmla = x return fmla def OR(*args): """n-ary version of Disjunction""" fmla = None for x in args: if fmla: fmla = Disjunction(fmla,x) else: fmla = x return fmla def NOT(x): return Negation(x) def IF(p,q): return OR(NOT(p),q) # For convenience of testing, we create some variables P = Variable('P') Q = Variable('Q') R = Variable('R') # now we can test it with, e.g.: # IF(AND(OR(P,Q),IF(P,R),IF(Q,R)),R).isValid() -- Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de Forschungsbereich Programmiersysteme (Programming Systems Lab) Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier Postfach 15 11 50 Phone: +49 681 302 5618 66041 Saarbruecken, Germany Fax: +49 681 302 5615 From mikael at isy.liu.se Wed Feb 23 12:52:00 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 23 Feb 2000 18:52:00 +0100 (MET) Subject: Killer Apps In-Reply-To: <20000223152207.A2803@stopcontact.palga.uucp> Message-ID: On 23-Feb-00 Gerrit Holl wrote: > Rolling Over the Floor Lauging. See the following URL for this and > many more abbrevations and hacker slang: > http://www.jargon.org After I asked that question, I found out about http://www.acronymfinder.com/ and I could find approximately 50 acronyms starting with ROFL or ROTFL. /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: 23-Feb-00 Time: 18:39:40 This message was sent by XF-Mail. ----------------------------------------------------------------------- From tottinge at concentric.net Mon Feb 28 08:50:30 2000 From: tottinge at concentric.net (Tim Ottinger) Date: 28 Feb 2000 08:50:30 EST Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: <38b68866.1638395@news.concentric.net> On Sat, 12 Feb 2000 17:11:22 -0500, osorronophris osorronophris wrote: >I'm a die-hard C++ programmer that recently took up Python for a change of >scenery and am enjoying it greatly. The one problem I am having is that I >can't break myself of the semicolon habit. I've tried chewing gum but it >just doesn't seem to work, and I'd like to avoid the patch. Any ideas? Anti-semi-colostomy? Tim From ivanlan at callware.com Fri Feb 4 13:55:46 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 04 Feb 2000 11:55:46 -0700 Subject: Haskell or Python! References: <000f01bf6edf$26ad09a0$a2a0143f@tim> <389B1F39.A6DC301A@prescod.net> Message-ID: <389B20B2.95834DE3@callware.com> Hi All-- Paul Prescod wrote: > [bobbit] > http://webworst.about.com/entertainment/webworst/library/weekly/aa101498.htm?iam=ask&terms=gonad > > Since the conversation was devolving, I figured we might as well jump > directly to the worst of the web. > Luckily, the conversation can devolve no more. You have reached the singularity, the pre-big-bang, of evolution. -ly y'rs, Ivan;-(> ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com ivanlan at home.com http://www.pauahtun.org See also: 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 dvl at de.uu.net Wed Feb 23 13:11:02 2000 From: dvl at de.uu.net (Dirk Vleugels) Date: 23 Feb 2000 19:11:02 +0100 Subject: cancel thread? Message-ID: Hi, posix threads offer 'pthread_cancel', i can't find anything similar in the python docs. How do I communicate with a long running (maybe blocked on netio) thread without cancellation points and 'cancel'? Cheers, Dirk -- Dirk.Vleugels at de.uu.net http://www.de.uu.net Database Engineer UUNET Deutschland GmbH From niels at endea.demon.nl Fri Feb 25 12:47:18 2000 From: niels at endea.demon.nl (Niels Diepeveen) Date: Fri, 25 Feb 2000 18:47:18 +0100 Subject: Life's better without builtins? (was: Life's better without braces) References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> <38B691AD.BDB4DD5F@endea.demon.nl> Message-ID: <38B6C026.E7115680@endea.demon.nl> Michael Hudson schreef: > > Think module.__file__ & exec for reload. Something like > > def reload(module): > exec open(module.__file__[:-1]).read() in module.__dict__ > return module That seems a perfect replacement. (except for the [:-1]?) So, only a few more hurdles before the release of PPython;-) -- Niels Diepeveen Endea automatisering From bowman at erehwon.foo Mon Feb 21 09:23:38 2000 From: bowman at erehwon.foo (bowman) Date: Mon, 21 Feb 2000 14:23:38 GMT Subject: ANNOUNCE: Phyton-Compiler References: Message-ID: Mikael Olofsson wrote: >On AltaVista: > +python -"monty python" >And you get "bazillion" hits about python. www.google.com has a front end to their search engine that actually works. And you don't get those annoying little "Buy books about pythons at ....." ads. From effbot at telia.com Wed Feb 2 12:06:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 17:06:33 GMT Subject: poplib: problem deleting mails References: <38982CC7.3ED89559@iitb.fhg.de> <20000202152449.A840@stopcontact.palga.uucp> <3898458B.337C1708@iitb.fhg.de> Message-ID: Carsten Gaebler wrote: > > > The POP3 object's dele() function doesn't delete messages that > > > have a "Status: O" line in the header. Is that a bug? > > > > Not in Python. It must be your server. Neither the RFC nor the Python > > module says anything about it. > > Must be Python because Netscape can delete those messages - on the > same server. hmm. the "dele" method doesn't delete messages -- it asks the server to delete them. you cannot really blame Python if the server refuses to do that... I suspect you simply forgot to call "quit" in your program. if you don't, the server will (most likely) roll back, and dis- card all changes to the mailbox. From effbot at telia.com Mon Feb 14 02:15:14 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 07:15:14 GMT Subject: Whats up with the _ References: <38A7A95C.B009BCC6@kw.igs.net> Message-ID: <6YNp4.3529$dT4.205724160@newsb.telia.net> JB wrote: > I have some global vars defined in a module that are prefixed with an > underscore '_'. When I do a 'from MyModule.MyModule import *' the vars > with the _ prefix don't get imported but when I change the names to drop > the _ they import properly. Is this a bug or a feature? If someone could > expalin why this is so I would appreciate it. variables beginning with an underscore are considered to be internal to that module. > I missed this in the doc's. it's sure mentioned in there: http://www.python.org/doc/current/ref/import.html If the list of identifiers is replaced by a star ("*"), all names defined in the module are bound, except those beginning with an underscore ("_"). also see: http://www.pythonware.com/people/fredrik/fyi/fyi06.htm which tells you to *always* use import instead of from-import, unless You Know Exactly What You're Doing. From wtanksle at hawking.armored.net Wed Feb 16 16:34:12 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 16 Feb 2000 21:34:12 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: On 14 Feb 2000 17:33:13 +0100, Martin von Loewis wrote: >Fran?ois Pinard writes: >> very much like the current implications of reference counting. When I write: >> for line in open(FILE).readlines(): >> I rely on the fact FILE will automatically get closed, and very soon since >Indeed. I think Tim's right here (as always:); if the request for >garbage collection is rephrased as 'reclaim cycles', everybody will be >happy. I'd like that, but I also like the idea of not having to track memory usage when writing C extensions. I think Ruby's done a good job of showing what's possible here. >Martin -- -William "Billy" Tanksley, in hoc signo hack From scarblac-spamtrap at pino.selwerd.nl Tue Feb 15 15:14:51 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 15 Feb 2000 20:14:51 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> <889lhn$bn$1@nnrp1.deja.com> <88c5qn$ot4$1@nnrp1.deja.com> Message-ID: Fran?ois Pinard wrote in comp.lang.python: > Justus Pendleton writes: > > > I guess I don't see how MI is a different issue [...] > > Neither do I. But for a different reason. What means MI? :-) "Multiple Inheritance". In Python a class can be based on several other classes. In some other languages, classes can only inherit one other class. -- Remco Gerlich, scarblac at pino.selwerd.nl 9:09pm up 84 days, 3:13, 6 users, load average: 0.37, 0.34, 0.29 "This gubblick contains many nonsklarkish English flutzpahs, but the overall pluggandisp can be glorked from context" (David Moser) From skip at mojam.com Wed Feb 16 10:04:38 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 16 Feb 2000 09:04:38 -0600 (CST) Subject: Modules implicitly exposing exceptions from other modules In-Reply-To: <20000216070545.A2508775@vislab.epa.gov> References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216070545.A2508775@vislab.epa.gov> Message-ID: <14506.48262.218401.842709@beluga.mojam.com> [ jumping in a bit late on this thread... ] Randall> No, you miss the point of my example. I didn't say "socket", I Randall> said "Socket". NNTP could be built on Socket, or FastSockets, Randall> or TLI, or MasGreatestSocketModule, all of which could have a Randall> different exception structure. I believe if a higher level module relies on a lower level module to implement some of its functionality, the higher level module should catch the lower level module's exceptions and transmogrify them into something higher level. I see two reasons for this: 1. Randall's argument that you could swap out the lower level module for something else. This provides an increased measure of independence from the lower level module of the application code that calls the higher level module. 2. There is often extra information available to the higher level module (file names, user input values, attribute values) that would be useful to someone debugging the traceback. Letting the lower level exception pass through "unadulterated" ignores this useful information. More accurate information ==> better error diagnostics ==> faster debugging. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From steve.mnard at sympatico.ca Wed Feb 23 09:50:01 2000 From: steve.mnard at sympatico.ca (Steve Menard) Date: Wed, 23 Feb 2000 09:50:01 -0500 Subject: Python port to PalmOS References: <38b3e042.7854561@news.i-cable.com> Message-ID: Well, there is a minimal port coming (look at http://www.tismer.com/research/stackless/) After that port becomes publicly available, there'll be some work to do to support the palm features though .... Slowman wrote in message news:38b3e042.7854561 at news.i-cable.com... > Is there any available or in progress ? > Palm has Java and I like Palm to have Python too :-) ! > From boud at rempt.xs4all.nl Thu Feb 17 14:49:15 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 17 Feb 2000 19:49:15 GMT Subject: IDLE in any other GUI. References: <38AAADEB.42C7CBA8@durham.ac.uk> Message-ID: <88hjbr$7p8$1@news1.xs4all.nl> J.C.Travers wrote: > Is anyone working on or wanting to work on implementing IDLE in a > different gui to TK. Something like QT, which is also cross platform > would be good (i.e. I would much prefer using it, IMHO TK is horrible, > and QT simple and beautiful, and MUCH MUCH easier to code in!). Just a > question, not wanting to start an inter-gui war! Only on the part of Idle that really interests me - the path/class browser. It was remarkably easy to move from the custom tkInter tree widget (which had a horribly scrolling bug a few weeks ago) to the Qt listview widget, which I used. I thought the Idle code was pretty easy reading matter, really - even though I still don't understand the way tkInter works... Oh, the URL is http://www.valdyas.org/python/kpybrowser.html. Tomorrow between two o'clock and five o'clock there will be some scheduled downtime (we're moving house), but there's a mirror at http://www.xs4all.nl/~bsarempt/python/kpybrowser.html. -- Boudewijn Rempt | http://www.valdyas.org From darcy at vex.net Fri Feb 25 07:47:22 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 25 Feb 2000 12:47:22 GMT Subject: Compiling Python on NetBSD Message-ID: <895tkq$fr2$1@news.tht.net> I have a question about the following code in Python's configure script. case $ac_sys_system/$ac_sys_release in ... NetBSD*) if [ "`$CC -dM -E - | 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 moshez at math.huji.ac.il Mon Feb 14 12:34:11 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 19:34:11 +0200 (IST) Subject: Except an exception AND all its subclasses? In-Reply-To: <14504.12696.260789.72063@weyr.cnri.reston.va.us> Message-ID: On Mon, 14 Feb 2000, Fred L. Drake, Jr. wrote: > Gerrit, > Don't give up. Language references *are* relatively dry, but > there are good reasons they get written as well. Please read it; I > think you know enough about Python by now to make good headway there. However, Gerrit does have a point. People need information which is currently obscured by a language reference around it, so to speak . Perhaps there should be an "easy language reference"/"advanced tutorial". I'll start working on one in my copious free time, but don't hesitate to tell me one has already been written. lazy-ly 'yrs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mturatti at yahoo.com_REMOVE_ Mon Feb 21 10:11:09 2000 From: mturatti at yahoo.com_REMOVE_ (Maurizio Turatti) Date: Mon, 21 Feb 2000 15:11:09 -0000 Subject: [Q] Python and 3D tools References: <88m003$1dani$1@fu-berlin.de> <88mvf2$9e9$1@news.udel.edu> Message-ID: <88rh2i$3ko$1@serv1.iunet.it> > "Jo?o Neto" wrote in message > news:88m003$1dani$1 at fu-berlin.de... > Hi > > Does anybody know if Python is used together with > some 3D Engine? > VTK (http://www.kitware.com/vtk.html) has python bindings. From bovinesoft at my-deja.com Sat Feb 5 00:30:38 2000 From: bovinesoft at my-deja.com (bovinesoft at my-deja.com) Date: Sat, 05 Feb 2000 05:30:38 GMT Subject: Can someone fix my code (Part II) Message-ID: <87gchv$ebu$1@nnrp1.deja.com> When I last posted to this newsgroup, I had a problem and I think I fixed it (Thanks to all who helped!). Now, however, I am having new difficulties on my new code. The error message that I got from the code below was: "NameError: where_temp". If anyone can help me out, I would be greatly appreciative. Thanks again! import sys # to use the exit() function def ssi_or_exit(): sorx = raw_input("Would you like to generate HTML or exit ? ") if sorx == "g": # if they want to generate a web page body_path = raw_input("Please type the path of the body section: ") body = open(body_path, "r") # open the text of the web page body body2 = body.readlines() # body2 is the body text variable temp_path = raw_input("Please type the path of the HTML template: ") temp = open(temp_path, "r") # open the HTML template temp2 = temp.readlines() # temp2 is the template text variable new_path = raw_input("Please type the path of the new HTML file: ") new = open(new_path, "w") # create new file at the specified path where_temp = raw_input("Put the template before or after the body? ") ssi() elif sorx == "x": # if they want to exit sys.exit("Thank you for using Bovine No Server SSI!") def ssi(): if where_temp == "b": # for template before body for line in temp2: new.write(line) for line in body2: new.write(line) elif where_temp == "a": # for body before template for line in body2: new.write(line) for line in temp2: new.write(line) body.close() temp.close() new.close() ssi_or_exit() ssi_or_exit() Sent via Deja.com http://www.deja.com/ Before you buy. From jstok at bluedog.apana.org.au Sun Feb 6 21:40:25 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 7 Feb 2000 13:40:25 +1100 Subject: Worldpilot References: <389DAD6F.100404A4@fourthought.com> Message-ID: <66qn4.20006$3b6.85615@ozemail.com.au> Uche Ogbuji wrote in message <389DAD6F.100404A4 at fourthought.com>... >We are eager to try out Worldpilot, which was demoed at IPC8, but it >uses the Cyrus IMAP server, which we simply cannot get to work Where can I find Wordpilot? Is it a commercial application? From cmena at my-deja.com Wed Feb 2 16:29:15 2000 From: cmena at my-deja.com (cmena at my-deja.com) Date: Wed, 02 Feb 2000 21:29:15 GMT Subject: newbie: balanced tree module References: <87a5is$tb$1@nnrp1.deja.com> Message-ID: <87a7j2$2mn$1@nnrp1.deja.com> In article <87a5is$tb$1 at nnrp1.deja.com>, cmena at my-deja.com wrote: > hi: > does anyone know where can i find a balanced tree module for python > (avl, or red black). i found one called AvlTrees in the python website > thing, the problem is that it does not allow me to specify my own > compare function. the docs say it uses PyObject_Compare, but i don't > know what that is. > tia for any help. > > Sent via Deja.com http://www.deja.com/ > Before you buy. > never mind. i just found out about __cmp__. Sent via Deja.com http://www.deja.com/ Before you buy. From sanderson at ttm.com Tue Feb 8 12:35:23 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 08 Feb 2000 12:35:23 -0500 Subject: Several questions: python plugin, xml-rpc + Medusa References: <7165B4EE3811997A8525687F0060098E.006009C98525687F@ttm.com> Message-ID: <38A053DB.210D382E@ttm.com> Thanks for the quick response, Skip. I noticed a module in the Medusa distro that seemed to do a bit with XML-RPC. Are you familiar with it at all? I'll look at the ZServer implementation as well; thanks for the info. Regards, -scott skip at mojam.com wrote: > I use the ZServer component of Zope with XML-RPC without using all of Zope. > ZServer is built on Medusa, so it would appear the good folks at Digital > Creations have already done the legwork you require.  From amused at webamused.com Mon Feb 7 07:17:36 2000 From: amused at webamused.com (Joshua Macy) Date: Mon, 07 Feb 2000 12:17:36 GMT Subject: CGI Scripts References: <389CEA00.9D771D21@webamused.com> <+ZWeOD+wStfbL4emCMvtqtVvlyvR@4ax.com> Message-ID: <389EB582.76EBCDCA@webamused.com> Anders M Eriksson wrote: > > On Sun, 06 Feb 2000 09:01:38 GMT, "Fredrik Lundh" > wrote: > > >Joshua Macy wrote: > >> Sorry, typo. That should have read: > >> > >> print "Content-type: test/html\n\n" > > > >or rather, > > > > print "Content-type: test/html\n" > > > > print "Content-type: test/html" > > print > > > > Having alot of problems with just HTTP headers I have to ask this > > In all the above code snippets the content-type is set to test/html. > Please correct me if I'm wrong but shouldn't it be text/html? > > // Anders D'oh! Yes, content type should be text/html. My bad, and Fredrik probably just cut and paste my text. Joshua From vetler at ifi.uio.no Tue Feb 15 09:21:44 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 15 Feb 2000 15:21:44 +0100 Subject: Off Topic Posts References: Message-ID: * Mikael Olofsson > On 15-Feb-00 Oleg Broytmann wrote: > > On 15 Feb 2000, Vetle Roeim wrote: > > > as the python community grows and the number of posts increases, a > > > split would seem natural. I would suggest something like c.l.python, > > > c.l.python.moderated, c.l.python.web, c.l.python.tkinter (or perhaps > > > c.l.python.gui would be better).. any other suggestions? > > > > c.l.python.win32 > > Well, c.l.py.sucks seems to be needed... .. and perhaps c.l.py.whitespaces vr From lisse at saintmail.net Tue Feb 29 22:57:14 2000 From: lisse at saintmail.net (Lisa) Date: Wed, 01 Mar 2000 03:57:14 GMT Subject: XML-RPC References: <88aka3$mn4$0@216.39.162.232> Message-ID: <89i4eq$snm$1@nnrp1.deja.com> In the page http://www.pythonware.com/products/xmlrpc/, there is a mention that 0.9.9 of xml-rpc would have been out by dec.99, and I would like to know if anyone has any info as to where to find that thing? BTW, is there any info online, - anywhere, - that can link me to more info regarding xml, the standard, the tutorial, and such? Thank you all !! Lisa lisse at saintmail.net PS. Please cc: me your reply. Thanks again ! Sent via Deja.com http://www.deja.com/ Before you buy. From mhammond at skippinet.com.au Tue Feb 1 07:05:55 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 12:05:55 GMT Subject: Win NT Workstation (v4, sp #5) PWS Unable to use Python? References: Message-ID: "Benjamin Schollnick" wrote in message news:rNHvjEdhm5Pp-pn2-UxVidzkzz7KW at d185d186f.rochester.rr.com... > if I have just "c:\progra~1\python\python.exe" the task just "sits" > there until > it times out. > > If it's "c:\progra~1\python\python.exe -u %s %s" , the result is > always > "python.exe: unable to open ". > > Anyone have any suggestions? Try putting the %s in quotes - maybe the path to the script you are executing has a space in it? Mark. From paul at prescod.net Thu Feb 3 21:28:12 2000 From: paul at prescod.net (Paul Prescod) Date: Thu, 03 Feb 2000 18:28:12 -0800 Subject: Ann: PMZ - Poor Man's Zope References: <1262508367-6369026@hypernet.com> Message-ID: <389A393C.C0175C38@prescod.net> Gordon McMillan wrote: > > Hmm. Looks to me like PMZ runs anywhere, DTML in Zope, > ASP under IIS and PSP under a servlet style web server. Ahh, but those are implementations. The language is the interface. > > It's none of my busiess > > since I don't use any of them but it must be awfully confusing for > > people who just want to do ASP-like stuff in Python. > > Of course it is! > > How many parsers do you have over there in XML-land? Dozens and one standardized interface: SAX. "What parser should I use?" "Doesn't matter. Use SAX and whatever you have laying around." :) Okay, some of these are probably (?) syntactically constrained by their environments (PSP and Python on ASP) ... but there must be lots of areas where they could standardize stuff, especially in the all-Python implementations like PMZ, DocumentTemplate and "real" Zope. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From python-list at teleo.net Thu Feb 24 12:31:27 2000 From: python-list at teleo.net (Patrick Phalen) Date: Thu, 24 Feb 2000 09:31:27 -0800 Subject: Comparison: Python vs. Javascript In-Reply-To: <893mei$o88$1@mailusr.wdf.sap-ag.de> References: <893mei$o88$1@mailusr.wdf.sap-ag.de> Message-ID: <00022409404102.01934@quadra.teleo.net> [Frank Gales, on Thu, 24 Feb 2000] :: Hi, :: Can anybody give me a link to a comparison between Python and Javascript. :: There are several papers comparing Python and Java but I found nothing :: about Python versus Javascript. There are numerous such comparisons, by Cameron Laird, Scriptics, and others. Try "python javascript" in Google. Also go to http://ora.com/frank and look for a recent interview with Guido van Rossum, who speaks to this subject. From pinard at iro.umontreal.ca Wed Feb 23 01:19:15 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 23 Feb 2000 01:19:15 -0500 Subject: Comparing perl and python In-Reply-To: Tim Roberts's message of "Wed, 23 Feb 2000 05:43:00 GMT" References: Message-ID: Tim Roberts writes: > I am disturbed by what seems to be a dramatic performance difference > [between Perl and Python...] Have others done such comparisons? Just a few months ago, I was also a complete newbie, and has also been worried by speed differences, the same as you do now, and raised the matter on that discussion list. Most certainly, others did before me :-). My first attempts at writing Python were much tainted with Perl style, and had to discover that you have to learn a few Python idioms to get more speed. More generally, Python gives you more control than Perl on details, but you have to be a bit more careful at details as well. For example, Perl has a lot of optimisation work put on regular expressions and input/output, some say insane optimisation :-). Python has a more relaxed implementation of both, and we have to learn to avoid using regular expressions everywhere and all the time, and learn to bunch input/output more than we do in Perl. In a word, you have to learn to compensate a bit, with better algorithms. This is usually easy, because of the gain in clarity you've already got. This comes with experience, I guess. This mailing list is also a very good resource. I do not notice speed differences as much as when I began to write Python, but I feel I write in a more Pythonic than Perlish style now. Speed differences might still exist, but not enough to be really bothering. The advantages of Python, for me, overcome some inherent slowness at times, yet my feeling is that Python speed is quite reasonable on average. It is probably that my first experiments were lacking a bit, style-wise. P.S. - I've now written well over 20000 lines of Python, and continuing. I feel a bit more solid than I was initially :-). Strangely, I'm not in a hurry to use every feature available. I'm quite satisfied with simplicity. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From effbot at telia.com Thu Feb 10 03:26:47 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 08:26:47 GMT Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> Message-ID: Michal Wallace wrote: > I betcha it can!... How about this? > > ### > > def cStyleIIF(condition, iftrue, iffalse): > if eval(condition): > return eval(iftrue) > else: > return eval(iffalse) > > > x = 5 > y = 20 > a = cStyleIIF("x > ### > > You've got some extra overhead there, but if you really > want to do this on one line without evaluating both options > or using boolean short circuits, it might be worth it... :) the problem here is that you'll evaluate the expression in the function's own namespace, not the callers. (you can use trickery or guile to get around that, but I won't post that solution...) From bparsia at email.unc.edu Tue Feb 8 20:35:05 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Tue, 8 Feb 2000 20:35:05 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> Message-ID: <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> Paul Prescod wrote: > Thomas Hamelryck wrote: [snip] > > You mention Squeak. If Squeak > > continues to mature I think it will be a formidable competitor for python. > > Not a chance. Smalltalk is doomed for the same reason Lisp is doomed. Er...Doomed, huh. Thank's for letting me know ;) Frankly they both seem rather healthy to me. I watch Smalltalk more closely, and it seems to be doing rather well, as a whole. I could go into detail, if you *really* want to, but why bother? Python success certainly doesn't require Smalltalk or Lisp failure. > Smalltalk programmers think that their way of doing things is so much > better than everybody else's that the whole world should reorganize > themselves around the language. Gosh, how did you *know* that's what we think! Just the other day, I said to my fellow cultist, "Y'know, Smalltalk should rule. The Pythonistas will be the *first* up against the wall, with their lame psuedo-Smalltalkd derivative!" > Tim Berners-Lee was once late for a > keynote speech because he was arguing with Alan Kay about how the web > "should" work. Do I really need to respond to this? I see, no one should discuss how the web could be, since it is what it is. And since Alan Kay make Tim late, and Alan Kay is the father of Smalltalk, all Smalltalkers are domineering pigs. I think you let your rhetoric get away from you there ;) > In contrast: Guido says, "this is the Web, this is > Python. Let's make them work together" Whatever. Once we get into the cult of personality phase of the discussion, I sorta tune out. > > At the moment, it lacks the huge amount of modules that are available for > > python (which is one the most attractive features of the language). > > So we have a thirty year old language (Smalltalk) with a poor set of > libraries and you want to attribute that to chaos theory? Er...Smalltalk implementations, overall, have fairly massive sets of libraries. I mentioned in another post that they generally don't slide well with certain sorts of tasks, but that's a different issue, isn't it? >Give me a > break. The smalltalk community squandered a 15 year "head start" on > Python. The Lisp community's head start was even larger. They must take > responsibility for that. And if they do? And if they try to change things? Nah, can't be, because they want everybody *else* to change. > Languages (or operating systems, or word processors) achieve popularity > or obscurity for *reasons*. Not all reasons are technical, but there are > always reasons. Sure. But let's not *make up* reasons :) I *know* Squeak to be a reasonable alternative to Python for a lot of tasks. I use both. I don't see much point in claiming it's doomed and all that. If it is, it is, and you don't need to shout it ;) Ok, ok, I'll back off a little. But, really, just because someone invokes Squeak in the context of other cluelessness is no reason to come out walloping a community that, AFAICT, has done you and intends you no harm. Cheers, Bijan Parsia. From mbiggers at my-deja.com Fri Feb 4 10:03:19 2000 From: mbiggers at my-deja.com (mbiggers at my-deja.com) Date: Fri, 04 Feb 2000 15:03:19 GMT Subject: ODBC and mxODBC References: <387B9540.BE617781@exceptionalminds.com> <389A5575.C5EA3110@gvtc.com> Message-ID: <87epnk$8d0$1@nnrp1.deja.com> [On Redhat Linux 6.1, using Postgres RPMs from PostgreSQL.org...] I have succeeded in installing Perl DBI + Perl DBD Postgres (for pedagogical purposes :^) and want to install Python + mxODBC talking to Postgres ODBC, since there is no dbi-1.0/2.0 compliant Python module. Is there a HOW-TO somewhere for ODBC newbies (I am a Linux/Unix user) for the complete set-up of Python talking to PostgreSQL thru ODBC? It would be a big time saver for those of us who don't (yet) want to hack PyGreSQL into a dbi 2.0 module :^). thanks, ----mark (please also reply to biggers at NO_SPAMutsl.com, thanks) In article <389A5575.C5EA3110 at gvtc.com>, Jim Johannsen wrote: > Timothy Grant wrote: > > > Hi, > > > > Has anyone got any tips on configuring mxODBC, or ODBC in general on a > > Linux box? Sent via Deja.com http://www.deja.com/ Before you buy. From mbarre at mac.com Wed Feb 23 22:12:06 2000 From: mbarre at mac.com (Matthew Barre) Date: Wed, 23 Feb 2000 21:12:06 -0600 Subject: A question from a total newbie References: <88j7a2$n5e$1@nnrp1.deja.com><89263v$sau$1@nnrp1.deja.com> Message-ID: I'm also a total newbie. I've found O'Reilly's Learning Python book to be invaluable. I knew a tiny bit of Java and some Javascript and that was all. I just finished the O'Reilly book and I feel somewhat capable to do some simple programs now. Perl may have the camel book, but I think that for beginning Pythoners the mouse book is hard to beat. -Matt --------- "Ray! When someone asks you if you're a god, you say YES!!" -Winston Zedmore > From: Lisa > Organization: Seeker of Truth > Reply-To: lisse at saintmail.net > Newsgroups: comp.lang.python > Date: Thu, 24 Feb 2000 02:47:28 GMT > Subject: A question from a total newbie > > Hi ! I am a total newbie to python, although I had a little programming > experience in Pascal, Fortran and PL/1. > > I would firstly want to apologize if this is not the place to ask my > questions, and I would be very grateful if you can point out to me where > to ask, if this is not the place to ask. Thanks in advance. > > Here are my question: > > Since I am a total newbie in python, where should I start? > > I am thinking of starting on DOS level, without any cumbersome > layers on windows. Do you recommend that? > > If so, where can I get python that runs on DOS? > > And what else do I need? What is TCK or whatever it is I saw on > www.python.org? I am not sure about those things, I hope if someone here > can give me a pointer or two. > > Books, which are the books for newbies that you recommend? There are so > many books out there I do not know which ones are good. > > Are there any online tutorials that I can use, while I am selecting > which book to buy? > > There are many more questions I think I should ask, unfortunately I do > not know what else to ask. If you know what other questions I should > ask, I would appreciate if you can help me ask the right questions. > > > Thank you all. > > Please cc: me a copy of your reply so I can be sure to get your advice. > > Lisa > lisse at saintmail.net > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From embed at geocities.com Tue Feb 1 14:02:31 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 1 Feb 2000 14:02:31 -0500 Subject: Python1-5.2/Demo/embed/demo.c core dump References: <3895DAD8.2C434EF6@ztr.com> Message-ID: > > Program received signal SIGSEGV, Segmentation fault. > 0x400ca093 in _IO_vfprintf (s=0x80a8a78, format=0x8090c04 "(", > ap=0xbffffb5c) > at vfprintf.c:1059 > I tried this over and over and it crashed like crazy. Today I tried it one more time and it worked. What the heck is with that!? :-) Warren From bragib at my-deja.com Thu Feb 24 21:21:11 2000 From: bragib at my-deja.com (bragib at my-deja.com) Date: Fri, 25 Feb 2000 02:21:11 GMT Subject: Windows freeze up Python/Motif Message-ID: <894ouk$q8l$1@nnrp1.deja.com> I have a dialog shell set up that when a certain button is pressed it fires off a perl script which is really lengthy in execution. I am reading each line from stdout and printing it to a message are in my dialog. So the dialog only gets updated when I get a new line. Well the time between new lines can take awhile and in the meantime the gui freezes up (i.e. if I drag another window over the dialog does not get updated). I do not have the option of splitting up the execution of this perl script. Does anyone know how I can submit the process in 'parallel' and have the dialog wait for the process to complete? I am using Motif through a Python binding if that helps? Thanks in advance Sent via Deja.com http://www.deja.com/ Before you buy. From cjensen at be-research.ucsd.edu Fri Feb 25 18:16:21 2000 From: cjensen at be-research.ucsd.edu (Curtis Jensen) Date: Fri, 25 Feb 2000 15:16:21 -0800 Subject: Passing arguments by value... References: <38B6C3B8.5BB0EB96@wartburg.edu> Message-ID: <38B70D45.CB3ACA99@be-research.ucsd.edu> Arrays in Numeric are pass by reference (mutable objects). Sometimes it's possible to trick Python by declaring something as an array of size one. Though it probably won't work in this case. Also, it's a hack and not good code, but sometimes you can't argue with what works. -- Curtis John Zelle wrote: > > Actually, parameters _are_ passed by value in Python. However, as you > discovered, variables are actually just references to objects. > Technically, the reference is being passed by value. > > Probably the solution to your problem is to copy the object. Check out > the copy module. > > John Zelle > zelle at wartburg.edu > > "John F. Brainard" wrote: > > > > I'm working on a set of HTML Layout classes for CGI programming > > in Python and have stumbled upon a small problem... > > > > The sample code below should be self explanitory... > > > > #begin python code > > html = body.Body() > > > > font1 = tags.Font(4, "Arial", "#FF0000") > > font1.addText(string.strip(""" > > Some text would go in here. > > """)) > > > > html.addElement(font) > > > > font1.clearText() > > font1.addText(string.strip(""" > > Some other text here. > > """)) > > > > print "" + str(html) + "" > > #end python code > > > > After I create the font1 object and set it's properties, I add it > > to the html object. Then, I change the text and add it again to > > the html object. What I get as the output is... > > > > #Begin HTML here > > > > > > > > Some other text here. > > > > > > > > Some other text here. > > > > > > #End HTML here > > > > Is there a way to copy the font object or pass it by value rather > > than reference to the addElement() function? > > > > Thank you, > > > > John F. Brainard Jr. > > johnbrainard at stny.rr.com From sabren at manifestation.com Sun Feb 27 13:03:28 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sun, 27 Feb 2000 13:03:28 -0500 (EST) Subject: name of object inside it's methods? In-Reply-To: <8EE74F2D4usenetacct@216.169.37.95> Message-ID: On Sun, 27 Feb 2000 alv50855 at batman.tamucc.edu wrote: > can someone fill in the blank > > ------------------------------- > class Hello: > def __init__(self, x): > self.x = x > > def classname(self): > def classname(self): return self.__class__ it'll actually return "__main__.Hello", but you could just look for the "." Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From aahz at netcom.com Tue Feb 15 13:16:24 2000 From: aahz at netcom.com (Aahz Maruch) Date: 15 Feb 2000 18:16:24 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <88c55o$e5q$1@nntp5.atl.mindspring.net> In article , Alan Daniels wrote: > >My question is: How hard would it be to keep the reference counting, >but add a built-in function, maybe called "gc()", that would walk >through all the existing objects, find the ones that have been >orphaned due to cyclical references, and reclaim them? Would something >like that be enough to make everybody happy? Possibly implemented as a >patch so that it was optional? It would still be deterministic (in >that __del__ would always get called right away, when appropriate), >but would still make sure that no objects were ever left unreclaimed >indefinitely. That is precisely what the middle-grounders have been suggesting. It's still not trivial, especially if you want the garbage collection to work on memory allocated by extensions. -- --- 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 Have you coined a word today? From rob at hooft.net Fri Feb 11 08:50:56 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 11 Feb 2000 14:50:56 +0100 Subject: Tuples References: Message-ID: >>>>> "RG" == Remco Gerlich writes: RG> I was making some functions for a chess program earlier. For a RG> few minutes, the idea was to represent the board by a 64-tuple. RG> But that's not very smart, is it? RG> Given 64-tuple x, is there an easy way to get the tuple with RG> values x[6] and x[21] swapped, for instance? Python 1.5.2b1 (#9, Apr 9 1999, 16:51:07) [GCC 2.7.2.3] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> T=tuple(range(64)) >>> T=T[:6]+T[21:22]+T[7:21]+T[6:7]+T[22:] >>> T (0, 1, 2, 3, 4, 5, 21, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 6, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) Regards, -- ===== rob at hooft.net http://www.xs4all.nl/~hooft/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! ========= From arnaud at crao.net Mon Feb 28 12:06:34 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Mon, 28 Feb 2000 18:06:34 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: <38BA8A1F.2B4ADA0B@equi4.com> Message-ID: In article <38BA8A1F.2B4ADA0B at equi4.com>, Jean-Claude Wippler wrote: > If you let me know which release of MacPython you use (an URL perhaps), 1.5.2c1 > I haven't done much with Mk4py on the Mac, other than building an email > database (work in progress). It will be much more scalable once the Mac > supports memory-mapped files (MacOS X, next summer). I need support on the Mac just because MacOS is one of the OS I use everyday (with LinuxPPC) ... Do you have any clue about efficient search into a memory-mapped file ? I'm afraid I'll be limited to some kind of hash tables ... and coding "yet another database system" bugs me ... Regards, Arnaud From prestonlanders at my-deja.com Wed Feb 23 16:10:00 2000 From: prestonlanders at my-deja.com (Preston Landers) Date: Wed, 23 Feb 2000 21:10:00 GMT Subject: Installing on Win 2K? References: <89129k$1iv$1@nnrp1.deja.com> Message-ID: <891ib4$dvk$1@nnrp1.deja.com> I'm using W2K Gold. In article , "Joel Lucsy" wrote: > I've installed and run from Win2K. However, I'm running Beta 3. Which are > you trying? -- || Preston Landers || Sent via Deja.com http://www.deja.com/ Before you buy. From darrell at dorb.com Sun Feb 27 11:01:54 2000 From: darrell at dorb.com (Darrell) Date: Sun, 27 Feb 2000 16:01:54 GMT Subject: name of object inside it's methods? References: <8EE74F2D4usenetacct@216.169.37.95> Message-ID: >>> class A: ... def a(self): ... print str(self.__class__) ... >>> A().a() __main__.A > can someone fill in the blank > > ------------------------------- > class Hello: > def __init__(self, x): > self.x = x > > def classname(self): > > > ------------------------------- > > >>>from hello import * > >>>clown = Hello(1) > >>>clown.classname() > clown > > In other words I want the method to print the name of the object that it > belongs to > From hellan at acm.org Wed Feb 23 03:37:12 2000 From: hellan at acm.org (Jon K Hellan) Date: 23 Feb 2000 09:37:12 +0100 Subject: Font in tkinter / idle References: <87putpfssr.fsf@parus.parus.no> Message-ID: <87900cxqkn.fsf@parus.parus.no> "Robert Hicks" writes: > you want to edit EditorWindow.py: > > if sys.platform[:3] == 'win': > text['font'] = ("verdana", 10) > # text['font'] = ("courier new", 10) > Thanks. That doues it. Actually: if sys.platform[:3] == 'win': text['font'] = ("lucida console", 10) else: text['font'] = ("lucida typewriter", 12) But according to eff-bot on Deja News, it should also be possible to do it with X resources. I've tried things like Idle*Text.Font: lucida typewriter 12 PyShell*Text.Font: lucida typewriter 12 PyShell.Font: lucida typewriter 12 And haven't found the right resource to set. Anyway, I hate to change the source. Will have to reapply the change next version. I suppose there must be a way to specify a default serif font and a default sans serif font for Tk. My color scheme for dark blue background looks like this (I use background "#00005a"): class ColorPrefs: CNormal = "white", "#00005a" CKeyword = "#a0ffff", None CComment = "#ffb0b0", None CString = "#e0e0a0", None CDefinition = "#b2e4ff", None CHilite = None , "darkolivegreen" CSync = None, None CTodo = None, None CBreak = "#ff7777", None CHit = "#ffffff", "#000000" CStdIn = None, None CStdOut = "gray90", None CStdErr = "red3", None CConsole = "yellow3", None CError = None, "#ff7777" CCursor = None, "gray75" Thanks Jon From smb at bby.com.au Sun Feb 20 19:05:04 2000 From: smb at bby.com.au (Sarah Burke) Date: Mon, 21 Feb 2000 11:05:04 +1100 Subject: mxODBC, EasySoft ODBC Bridge and numeric data types Message-ID: <38B08130.A563E7FE@bby.com.au> Hello. I am using EasySoft's ODBC-ODBC Bridge with the mxODBC module to get data from a MS SQL 4 database to a Unix machine. The problem that I am encountering is that floats and decimals are not coming across correctly. For example, a decimal number such as 1.222 is being returned as 2.73934840524e+127. Is this a problem with my code, or an ODBC problem, or something else? Thanks, Sarah From greg at perceval.be Mon Feb 28 08:57:05 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Mon, 28 Feb 2000 14:57:05 +0100 (CET) Subject: (no subject) In-Reply-To: Message-ID: This question is related to OOP approach. Why do I have to : def __init__(self, name): self.__name = name def getname(self): return self.__name and x= MyObject.getname() instead of def __init__(self, name): name= name and then x= MyObject.name -- 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 foof at eyeofdog.com Sat Feb 19 15:37:20 2000 From: foof at eyeofdog.com (Alex Shinn) Date: 19 Feb 2000 15:37:20 -0500 Subject: name-spaces and loading a file References: <8766vn2ijn.fsf@curious.eyeofdog.com> <88mr39$7ne$1@news.udel.edu> Message-ID: <87zosx0vzz.fsf@curious.eyeofdog.com> >>>>> "Terry" == Terry Reedy writes: Terry> "Alex Shinn" wrote in message >> I'm working on an interactive story engine with the primary >> purpose of making it easy for non-programmers to write story >> modules. A story would be comprised of a collection of files, >> each describing a scene, like the following: Terry> ... Terry> Suggestions (emailed and posted): Terry> 1. Separate initial processing of input text from run-time Terry> use of compiled internal version so you can optimize Terry> different data forms for different operations (writing Terry> versus running). I'm thinking this may be a good way to go, but I'll have to change my concept of a scene file, which was arbitrary python code that got executed when you visited a scene, not just setting of variables. But I was going to have to come up with a way to distinguish between the first and later times that you visit a scene anyway... probably let the author define first(), second() and later() functions, etc. Can you pickle a function (I just tried and it didn't work, but I may be missing something)? Perhaps when they needed to define functions they could specify a separate file to get them from. Terry> 2. Allow more than one scene per system file (easy if you Terry> do 1.); little files take up extra space (especially on Terry> Win95 with 32K disk blocks) and can be a nuisance to work Terry> with. Some authors may prefer to have related scenes, if Terry> not all, in one file for easier editing. I happen to like working with little files (convenient for scripting), but this should probably be an option. Terry> 3. Compile input text to either dictionary or scene class Terry> instance (former may seem initially easier, but latter Terry> bundles scene methods within scene class). In other words, Terry> exec just once before running. I was using a scene class, translating variables from the scene module into the class. The current code looks like: class Scene: def __init__(self, game, name): "Initialize a Scene from a file" # Reference the parent game self.game = game # Load the scene and adjust the history if game.history.has_key(name): exec 'reload(scenes.'+name+')' game.history[name] = game.history[name] + 1 else: scene = __import__('scenes.'+name) game.history[name] = 1 # Translate the module variables into class variables exec 'vars = dir(scenes.'+name+')' for v in vars: if not v[0] == '_': exec 'self.'+v+' = scenes.'+name+'.'+v and yes, I know it's ugly and inefficient, which is why I'm asking for advice :). I guess the "load a file for a scene" idea was just bad. As long as there's a simple tool for converting scene files to data files, it should still be easy to write stories. And we were planning on a graphical tool anyway. Thanks everyone who responded! -- Alex Shinn From tim_one at email.msn.com Tue Feb 15 03:42:09 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 15 Feb 2000 03:42:09 -0500 Subject: Iterators & generators (RE: Real Problems with Python) In-Reply-To: <8895fo$qvp$1@nntp6.atl.mindspring.net> Message-ID: <001e01bf7790$8bd74480$66a2143f@tim> [Tim sez of Aahz] > [Aahz Maruch, proves that you don't have to be a lambda-head to > pick up the thrust of it at once -- thanks!] [and Aahz sez] > I have to admit that I used Icon briefly in a CS class more than a > decade ago; it made much more of an impression on me than Lisp did, > even though I still have my LISPcraft book and I can't seem to find > my Icon book. (My professor was from UoA.) It was interesting > trying to cast my memory back that far. So it *stuck* across a decade, anyway, despite brief exposure. That's a good sign! Python isn't as concerned about things that are obvious at first glance, as about things that you don't forget once mastered (e.g., "points *between* elements" indices). The Icon book is now on its 3rd edition, BTW, and you should treat yourself to a copy . > BTW, it turns out that much of the Icon documentation is now > on-line at > http://www.cs.arizona.edu/icon/ Along with free distributions & source code, for people who don't know that Icon is one of the oldest Open Source languages going (actually, Icon is public domain -- *you* can claim the copyright ). > From my POV, Icon is a lot like Perl written by a Pascal programmer, > with (from my more experienced viewpoint) its almost excessive emphasis > on expressions rather than statements. Bad Icon can make bad Perl look crystal clear, athough the Icon community is good about being as clear as possible. Unfortunately, when "success" and "silent failure" are fundamental notions applying to every little expression, even in exemplary Icon it can be very difficult to figure out whether a particular potential for failure is being ignored by mistake or design. So while it's brilliantly innovative in many respects, in practice I found I coudn't keep larger Icon programs working under modification. It's still my first language of choice for tackling several kinds of complex one-shot "researchy" problems, though. > I think that overall Python doesn't go quite far enough in that > direction, I agree, but it's gotten "better" this way, mostly via little things like the addition of dict.get() and 3-argument getattr -- not everything is better spelled on 4 lines . Stroustrup has written that he would like C++ to treat everything as an expression too, so that e.g. even loops could be rvalues (as they can be in Icon -- and, irritatingly, sometimes are). If Guido had to err here, I think he picked the right side. > but adding generators should make up much of the balance. Unsure it would help here, at least in the flavor I've been selling them. *Everything* in Icon is "a generator", even the integer 42 (it generates a singleton sequence, in theory), so the concept is fundamental & pervasive in Icon. More fundamental even than success and failure ("failure" is simply an empty result sequence, and "success" non-empty). That doesn't fit with Python at all, so I'm just trying to get the most useful & conventional & well-behaved part: explicit generation when you ask for it, at the function level. That would add enormous bang for the buck, and greatly aid clarity when appropriately used. So that much is Pythonic to the core. after-a-decade-i'm-still-trying-to-get-guido-to-understand- what-python-is-ly y'rs - tim From gmcm at hypernet.com Tue Feb 22 14:00:19 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 22 Feb 2000 14:00:19 -0500 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <38B2D49C.F18B47CC@roguewave.com> Message-ID: <1260876476-6142700@hypernet.com> bjorn wrote: > I must respectfully disagree. When doing OO design, the fundamental question > is "if I want to do 'foo', to what am I doing 'foo'?"... In this case "if I > want to 'join', what am I 'joining'?", the answer is that you're joining a > sequence type. Thus, IMHO it the natural (and extensible to user types) way > to do it would be: > > [1,2,3].join() > (1,2,3).join(' ') string.join only works on lists of strings. If you introduce a special "sequence of strings" type, then join could be a method on that. Otherwise, you need to work out some new semantics. > if you think of another domain, say a gui with a textarea this might become > clearer. Nobody would want to write: > > "foo bar".put(textarea) If textareas had a well defined interface that strings knew about, that would be fine, but since the interface would be: > since the "right" way to do it would be: > > textarea.put("foo bar") ...it would be kind of silly (like a lot of C++ / Java ). > Besides has anyone even considered " ".join(myUserListDerivedClass)? How about > " ".join(myTreeThatHasLinear__getitem__)? But the scope here is the existing "string.join". The fact that the procedural interface has the instance as the 2nd arg is a distraction. It is a string method, not a list method. - Gordon From eaglesto at americasm01.nt.com Thu Feb 10 17:25:29 2000 From: eaglesto at americasm01.nt.com (Eaglestone, Robert [NGC:B918:EXCH]) Date: Thu, 10 Feb 2000 16:25:29 -0600 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262152524-5049647@hypernet.com> Message-ID: <38A33AD9.3F4EA190@americasm01.nt.com> Gordon McMillan wrote: > > fcahoon at my-deja.com wrote: > > And there are many others who decide to try it anyway, and > then discover their fears [ of whitespace bracketing ] were misfounded. > > It has more to do with the programmer than the so-called > "issue". > > - Gordon Hi Gordon, Here is my problem. There must be a reason or rationale between 1) the ubiquity of bracketed syntax, and 2) Python deliberately omitting it. That is: there is a reason Python doesn't use it, and it must be a big one or else it just would have used bracketing. I want to know what this compelling reason is! My assumption is that unless it vastly improves programming the confusion caused by following a nonstandard syntax isn't worth the change made. Thanks, Rob From news at dorb.com Tue Feb 15 22:43:12 2000 From: news at dorb.com (Darrell) Date: Wed, 16 Feb 2000 03:43:12 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <001e01bf7790$8bd74480$66a2143f@tim> <011d01bf7808$026a5de0$0101a8c1@server> Message-ID: Guess I need to read more doc strings. http://www.python.org/doc/current/lib/built-in-funcs.html#l2h-115 getattr (object, name) The arguments are an object and a string. The string must be the name of one of the object's attributes. The result is the value of that attribute. For example, getattr(x, 'foobar') is equivalent to x.foobar. > > yes, unless someone has made a mistake > and removed it: > > > python > Python 1.5.2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> print getattr.__doc__ > getattr(object, name[, default]) -> value > > Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y. > When a default argument is given, it is returned when the attribute doesn't > exist; without it, an exception is raised in that case. > > --Darrell From fdrake at acm.org Fri Feb 11 13:08:14 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 11 Feb 2000 13:08:14 -0500 (EST) Subject: Two question from a newbie In-Reply-To: References: <14500.13201.442851.52269@weyr.cnri.reston.va.us> Message-ID: <14500.20494.775165.94939@weyr.cnri.reston.va.us> Moshe Zadka writes: > Apparently Fred is hacking too much C these days, otherwise he'd > encourage you to use Python (rather then C-in-Python): Er, no.... Java. ;-| I did send some alternates in response to a further question, though. I don't think that went to the list. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From info at cyberdev.net Fri Feb 4 09:16:25 2000 From: info at cyberdev.net (info at cyberdev.net) Date: Fri, 4 Feb 2000 15:16:25 +0100 (MET) Subject: BED FACTORY OUTLET 70% to 90% OFF Message-ID: <419.436560.40600556info@cyberdev.net> Sealy and Stearns & Foster FACTORY OUTLET 70% to 90% OFF RETAIL PRICES IN STOCK * SAME DAY SHIPPING http://www.BedFactoryOutlet.com From haje01 at netsgo.com Sun Feb 27 14:03:19 2000 From: haje01 at netsgo.com (Kim Jeong Ju) Date: Mon, 28 Feb 2000 04:03:19 +0900 Subject: Strange behavior of 'del' command.. Message-ID: Hi. I am novice in Python programming who need in help. ( again.. ) I am currently into embedding & extending Python to my C++ project. And I found some strange behavior of 'del' command. It's about deleting Python object which was instantiated from wrapped C++ class. For example, let's say 'my_object' is a instance of wrapped C++ class. >>del my_object This works just fine. It exactly calls the destructor of C++ class and frees memory blocks as it supposed to do. And here is the weird one >>exec( 'del my_object ' ) The destructor should be called like above one. But It didn't.. Still the symbol name was deleted. >>my_object Traceback( innermost last ): .. Name error: my_object Isn't it strange? If you got an idea what happend, please let me know about it. Thanks in advance.. Kim Jeong Ju. haje01 at netsgo.com http://myhome.netsgo.com/haje01 From jonathan.gilligan at vanderbilt.edu Tue Feb 1 16:20:46 2000 From: jonathan.gilligan at vanderbilt.edu (Jonathan Gilligan) Date: Tue, 1 Feb 2000 15:20:46 -0600 Subject: Python CVS archive: inconsistent tag names Message-ID: <877inf$9jm$1@news.vanderbilt.edu> Is this a known issue? On the python cvs archive (:pserver:pythoncvs at cvs.python.org:/projects/cvsroot), tags "r152" and "release152" are both used. The source tree seems to use "r152", while the documentation tree uses "release152". This makes it difficult to check out the 1.5.2 release with sticky tags and get all the files. Is this a mistake or by design? Jonathan Gilligan jonathan.gilligan at vanderibilt.edu From tismer at tismer.com Thu Feb 10 13:37:00 2000 From: tismer at tismer.com (Christian Tismer) Date: Thu, 10 Feb 2000 19:37:00 +0100 Subject: Optimizing C module References: <38A1D46F.86322DF1@prescod.net> Message-ID: <38A3054C.B3A615B6@tismer.com> I think I see a customer for SLP coming :-) Paul Prescod wrote: > > The slowest thing in both PyExpat and Perl's equivalent is the "cross > over" between C and Python. I can think of a couple of ways to speed > that up but I want to know if they are feasible. The same applies to the SGMLOP module. > The basic pattern of the code I need to speed up is: > > sometype Foo( somearg1, somearg2, ... ){ > sometype real_rc; > pyargs = Py_BuildVale( someformat, somearg1, somearg2, ... ); > > rc = PyEval_CallObject( callback, pyargs ); > Py_XDECREF( pyargs ); > > real_rc = SomeConversion( rc ); > Py_XDECREF( rc ); > return real_rc; > } Well, if you want to be fast with callbacks, Py_BuildValue and PyArg_ParseTuple have to replaced by faster direct stuff anyway. See for instance the builtin len(). This buddy spend 90% of its time in PyArg_ParseTuple. :-) > The Py_BuildValue can't be so fast because it is parsing strings and > creating new heap objects. I'm wondering if I could keep a fixed-length > args tuple in my back pocket and just fill in the details for each > callback. I would really love to hang on to the string and int objects > in the array too. How about I could check the refcount after the > function call and only generate a "new one" if the refcount is >1. If > the refcount is 1, I would mutate the string and int objects under the > covers. Good approach, but maybe it is even easier... > The next question is whether I can go even farther. Is there something I > can safely cache that is created in PyEval_CallObject and/or > eval_code2() (e.g. frame objects) so that the whole thing is just a > matter of setting a couple of values and jumping? > > I'm sure stackless Python has something to do with all of this but I > missed the talk at IPC8. It looks to me like eval_code2 would need to be > broken up to allow me to set up and reuse my own frame object. That's > probably part of what stackless does (the part I want!). That's exactly what Stackless Python does! The setup of a code object with its frame is one step. Then this frame is thrown at a dispatcher, and the dispatcher runs an evaluator loop on the topmost frame in tstate. It does so until the frame is stopped. Then it runs the next frame and so on. This is like "dribbeling". Now, where I think things can be much easier and faster is this: Instead of always calling a function again and again, you call it once and catch its continuation. The function is turned into an endless loop, and you resume it by a coroutine transfer. This has a single parameter, enough in many cases. All the local variables are still alive, so there is no need to prepare new complicated argument lists. Going to the extremes, it would even be possible to modify the locals of the frame directly. If this is desirable, I can add an interface to this. Turning the C code into a stackless version would be the ultimate thing. I'm planning so for SGMLOP. This would mean to turn it into an evaluator function by itself, it would get a primitive frame, and it would be dispatchable like any other python frame. This would solve the consumer/producer problem, and you could the whole thing as a couple of coroutines. But this isn't necessary if you just want it fast. By saving a couple of continuations of the necessary Python functions, you can dispatch between contexts at very high speed. If you want me to help here, let me know. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 hinsen at cnrs-orleans.fr Thu Feb 3 05:11:12 2000 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: 03 Feb 2000 11:11:12 +0100 Subject: Language Challenge 2000 References: <389923AB.741B7DB9@sdynamix.com> Message-ID: bvoh at sdynamix.com writes: > Criteria: > > a) Execution time > b) Size of executable Free choice of platform, OS, development tools, etc.? How will executable size be measured in the case of interpreted languages? What about system libraries, especially dynamic ones? And how will execution time and size be weighted? If size gets a sufficiently high weight, I suspect the winning entry will be for a programmable calculator. -- ------------------------------------------------------------------------------- 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 akuchlin at mems-exchange.org Thu Feb 24 16:53:30 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 24 Feb 2000 16:53:30 -0500 Subject: Backreference within a character class References: Message-ID: <3dk8jufesl.fsf@amarok.cnri.reston.va.us> taashlo at sandia.gov writes: > Using the re module, lets say that I want to match "XIX" but not "XXX" > or "WOW" but not "WWW". In my first attempt I used r"(.)([^\1])\1". > This, of course, did't work because the "\1" in character class isn't > interpreted as a backreference. If you're trying to match 3-character words with the same letters in positions 1 and 3, but not 2, then a lookahead negation would do it: pat = re.compile(r"(.)(?!\1).\1") The steps here are 1) matches a character 2) assert that the backreference \1 doesn't match at this point 3) consume the character, because assertions are zero-width and don't consume any characters, and 4) match \1. (Alternatively, if the 3-character string is in variable S, 'if (S[0] == S[2] and S[0] != S[1])' would do it.) On a theoretical plane: If you wanted to match general strings of the form ABA, where A!=B and A,B are of arbitrary non-zero length, I think this isn't possible with regexes (of either Python or Perl varieties), because in step 3 you couldn't consume as many characters as were matched by the first group. Anyone see a clever way I've missed? (Another jeu d'esprit.) You'd have to do it by matching the pattern r"(.+)(.+)\1", and then verifying that group 2 != group 1 in Python code. (thinking aloud) I don't think lookbehinds would help, in either full generality or in the limited Perl implementation. Implementing lookbehinds in full generality would be fun; going to have to take a crack at it when SRE becomes available... -- A.M. Kuchling http://starship.python.net/crew/amk/ Testing? That's scheduled for first thing after 3.0 ships. Quality is job Floating Point Error; Execution Terminated. -- Benjamin Ketcham, on applications for Microsoft Windows, in _comp.os.unix.advocacy_. From ivanlan at callware.com Wed Feb 9 12:58:35 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 09 Feb 2000 10:58:35 -0700 Subject: Python and Klingons Message-ID: <38A1AACB.8A5D0933@callware.com> Hi, All-- Found at: http://public.logica.com/~stepneys/joke/klingon.htm 15. Python? That is for children. A Klingon Warrior uses only machine code, keyed in on the front panel switches in raw binary. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 sabren at manifestation.com Mon Feb 28 16:23:31 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Mon, 28 Feb 2000 16:23:31 -0500 (EST) Subject: HTML template for database report In-Reply-To: <38BAE18C.82AA6543@gtri.gatech.edu> Message-ID: On Mon, 28 Feb 2000, Andrew Henshaw wrote: > > > HTML here > > > some more HTML > > > > > > > > some more HTML > > > some more HTML > > Hello Andrew, Well well well... I wasn't going to mention this until I got quite a bit more done, but since you asked... http://zebra.sourceforge.net/ My version looks like this: * zebra ** source name="database" class="csv" . ** query name="myquery" source="database" testcsv.csv ** show Here is the report: ** report query="bubba" *** head HEADER! ------- *** group field="lyric" **** head {guy} loves {girl} **** body ***** if test="{lyric}" a little bit of {girl} {lyric} *** foot ------- FOOTER! Given a comma seperated value file that looks like this: guy,girl,lyric fred,wilma, homer,marge, lou,everyone, lou,everyone,monica in my life lou,everyone,erica by my side lou,everyone,rita is all i need lou,everyone,tina is what i see lou,everyone,sandra in the sun lou,everyone,mary all night long lou,everyone,jessica here I am lou,everyone,you makes me your man it prints: Here is the report: HEADER! ------- fred loves wilma ... and wilma loves fred homer loves marge ... and marge loves homer lou loves everyone a little bit of monica in my life a little bit of erica by my side a little bit of rita is all i need a little bit of tina is what i see a little bit of sandra in the sun a little bit of jessica here i am a little bit of you makes me your man ... and everone loves lou ------- FOOTER! The * notation is just syntactic sugar for XML.. in fact, zebra converts it to well-formed XML before processing.. (mixing html and xml is messy and can lead to ill-formedness unless you change all the to </>) The end result is a script that does what you want. It's written in python - but was my first python app, so it's kind of messy.. I'm actively cleaning it up. Also, it originally generated PHP3 code.. It still does, but now I'm converting it to output other stuff, like Python and ASP.. the "csv" module is just a dummy module I'm using for testing. It uses a subset of the python database API, so zebra is desiged to run reports off of anything.. There's a demo of it generating PHP3 that works as the frontend to a search engine at http://www.linkwatcher.com/blogsearch/ By the way, I'm in Atlanta, too, and this technology is going to be the cornerstone of a company I'm starting, so perhaps we ought to talk? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From mbel44 at dial.pipex.net Fri Feb 18 06:12:35 2000 From: mbel44 at dial.pipex.net (Toby Dickenson) Date: Fri, 18 Feb 2000 11:12:35 +0000 Subject: Continuations and threads (was Re: Iterators & generators) References: <001601bf7853$6b03e7e0$b7a0143f@tim> <88h50k$mt2$1@nntp6.atl.mindspring.net> <38AC5FCA.75F4EA42@prescod.net> Message-ID: Paul Prescod wrote: >You can also use continuations to implement back-tracking. You try one >path and if it fails you "jump back" and try the other. What are the implications for the continuation-naive in a post-stackless world. What about functions such as... def x(): before() try: y() finally: after() Today, either of three things happen: 1. before() throws 2. before() and after() are called exactly once each 3. x() never returns because y() never returns As I understand continuations, we now have the possibility of y() returning more than once, with after() called more times than before() more-basic-than-goto is not an exaggeration. Toby Dickenson tdickenson at geminidataloggers.com From malcolmt at smart.net.au Sat Feb 12 06:50:15 2000 From: malcolmt at smart.net.au (Malcolm Tredinnick) Date: Sat, 12 Feb 2000 22:50:15 +1100 Subject: Using sockets or telnetlib to finger? In-Reply-To: =?iso-8859-1?Q?=3C883e1e$f3v$1=40zingo=2Etninet=2Ese=3E=3B_from_Andr=E9_?= =?iso-8859-1?Q?Dahlqvist_on_Sat=2C_Feb_12=2C_2000_at_11:52:12AM_+0100?= References: <883e1e$f3v$1@zingo.tninet.se> Message-ID: <20000212225015.A659@Ridcully.home> On Sat, Feb 12, 2000 at 11:52:12AM +0100, Andr? Dahlqvist wrote: > I am working on my first Python program, which will be used to finger a > server that reports the latest stable, development and pre-patch version of > the Linux kernel. I have come up with two different solutions on how to > finger the host, and since I'm new to Python I am not sure which of these > approaches is preferred. My first attempt was to use sockets since > that was what the finger demo that came with Python used: > > sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > sock.connect(HOST, PORT) > sock.send('\n') > while 1: > kernel_info = sock.recv(1024) > if not kernel_info: > break > > This solution seams to do the trick, but so does my next approach which > uses telnetlib to telnet in to the finger port: > > telnet = telnetlib.Telnet(HOST, PORT) > telnet.write('\n') > kernel_info = telnet.read_all() > telnet.close() > > I myself prefer the telnetlib solution as it seams less "low-level", but > since I'm just starting out with Python I would like to hear what you > guys have to say about it. The second solution looks cleaner to me, too. Four short lines and it pretty much simulates the way you would do it in real life. One has to think a bit about whether the first solution does the job, whereas the second one is just obvious. > Whatever approach I use I then need to grab the three version numbers from > the finger output that I have collected. The finger output will look like > this, where only the version numbers change: > > [zeus.kernel.org] > > The latest stable version of the Linux kernel is: 2.2.14 > The latest beta version of the Linux kernel is: 2.3.43 > The latest prepatch (alpha) version *appears* to be: 2.3.44-8 > > I need to access the version numbers alone, since I want to translate the > rest of the text. To do this I have used what I think is an ugly > method. What I do is that I split the string that contains this > information with string.split(), and then access the version numbers > directly in the resulting list using kernel_info[9], kernel_info[19] and > kernel_info[28]. It seams quiet safe to do it like this since the text, > apart from the version numbers, pretty much never changes, but is > there perhaps a equally simple solution that is less ugly? Could regular > expressions do the trick here, and if so can someone perhaps give an > example of how I would use them in this situation? Your split solution seems a reasonable way to handle a not particularly pretty problem. Even a regular expression solution will have to make some assumptions about the format of the output (e.g. that the only colons will be right before the kernel version numbers). As an example of how re's may be used (although I would stick to the string.split method, probably): import re data = re.split(r':\s+(\d+[.]\d+[.]\d+(?:-\d+)?)', kernel_info) stable, beta, prepatch = data[1], data[3], data[5] There are no doubt other reg-exps that make other assumptions about the contents of kernel_info that would do the trick. However, I think that once again it comes back to the fact that looking at the reg-exp I gave above does not make it immediately clear what is happening. And it is probably slower than the string.split method. Cheers, Malcolm -- The sooner you fall behind, the more time you'll have to catch up. From arnaud at crao.net Mon Feb 28 12:02:20 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Mon, 28 Feb 2000 18:02:20 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: <0742B938A78BCAFC.AB0DB1F0C0E47B85.C6975C7C6DCB99B2@lp.airnews.net> Message-ID: In article <0742B938A78BCAFC.AB0DB1F0C0E47B85.C6975C7C6DCB99B2 at lp.airnews.net>, claird at starbase.neosoft.com (Cameron Laird) wrote: > For some people, MetaKit's model specifically is > *not* the relational one. My guess is that For me, it's "not really the whole model" ... but as nothing beats the relational algebra at managing tons of structured data ... (someone said something about the O2 model ?? u kidding ? I was talking about real world ;-)) > rapid that you're probably going to need to give > more details before readers conclude, "Ah! > *That*'s his point." The "Ah! *That*'s his point" is : I need to do some good old "SELECT obj1.a,obj2.c FROM obj1,obj2 WHERE obj1.d=obj2.e AND obj1.f=value" Well .... :) more details ? I've tons of data in objects, I need persistence but can't play with the navigational model to search in those data. Any good way to map them to tables and query the tables ?? (I'm too lazy to do it by hand and I'm not sure I'll be able to do it in an efficient way). One more thing : at some steps, I really need the data in objects. > [description of > situation that's > about Python and > the MacOS, and > not specific to > MetaKit] I love my Mac I love my Mac I love my Mac ... And as I imagine Python (I don't care if I'm wrong there) as a cross-OS langage/environement, I code on my PowerBook when in the train or sitting in a pub and deploy it on my linux box when back at home/office ... > Do you care about multi-user operation ? Kinda ... in fact, I need multi-processes access to my data. Yes it's a problem with MetaKit. > What are your scale and performance requirements? About 200 000 objects to search in (but not too big objects) and ... speed needed. I've also another need managing millions of object but there, I don't care about speed. > In what way does Gadfly Hey ! (/action takes notes about this "Gadfly") drop me an URL, I'll check this ! Thanks a lot :) Regards, Arnaud From skip at mojam.com Wed Feb 16 11:49:07 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 16 Feb 2000 10:49:07 -0600 (CST) Subject: re Compile - a bug? In-Reply-To: <38AAB53D.15FF380@connection.com> References: <38AAB53D.15FF380@connection.com> Message-ID: <14506.54531.463974.731354@beluga.mojam.com> Colin> hpat= compile(r''' Colin> (<(?Pth) [^>]*>) # Either header up to terminating '>' Colin> # |(?Ptd)[^>]*>) <-- Grief! Colin> (.*?) # Followed by anything Colin> ",flags + VERBOSE # Matching terminator Colin> ''') Colin> ------------------------------- Colin> Correctly, the PythonWin editor does not report the mismatch. In triple-quoted strings what you think are comments are not. They are part of the string. Also, it appears you close your string after the flags argument for re.compile instead of before it. The following might work better: hpat= compile( r'(<(?Pth) [^>]*>)' # Either header up to terminating '>' # |(?Ptd)[^>]*>) <-- Grief! r'(.*?)' # Followed by anything r'', # Matching terminator flags + VERBOSE) Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From fredp at mygale.org.nospam Wed Feb 16 10:55:10 2000 From: fredp at mygale.org.nospam (Fred Pacquier) Date: 16 Feb 2000 15:55:10 GMT Subject: Where is the Python Journal? References: Message-ID: <8EDCA9C19PaCmAnRDLM@194.2.0.33> anders.eriksson at morateknikutveckling.se (Anders M Eriksson) said : >>Not long ago there was a Python journal at >> >> www.pythonjournal.org >> > >FOund it at http://www.pythonjournal.com/ Seems pretty dead now though, doesn't it ? Pity. -- YAFAP : http://www.multimania.com/fredp/ From mwh21 at cam.ac.uk Wed Feb 23 10:03:02 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 23 Feb 2000 15:03:02 +0000 Subject: functional programming References: <20000223153526.B2858@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > > > Michal Wallace (sabren) wrote in comp.lang.python: > > > I guess my original question had to do with what functional > > > programming looks like in the wild, and what it might look like in > > > python. Aahz posted a recursive version of a fib() routine. Is this > > > not what you'd want? What would fib() look like in one of the > > > functional languages you're used to? > > > > Michael Hudson posted this little bit of Haskell last week: > > > > fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ] > > > > I can't translate that to anything resembling Python at all. I don't > > know if list comprehensions in Python will be/are this powerful. > > Well, you can just write a class doing it. > > # pseudo-code > def fib(...): > ... > > class Fibonacci: > def __getslice__(self, start, stop): > return fib(start, stop) > > def __getitem__(self, item): > return fib(0, item) > > ... > I think you have missed the point. And I doubt list comprehensions can be this powerful in Python without lazy evaluation. A more direct Python version would be along the lines of: class Fib: def __init__(self): self.answers = {0:1L,1:1L} def __getitem__(self,item): if self.answers.has_key(item): return self.answers[item] else: val = self[item-2] + self[item-1] self.answers[item] = val return val This is /reasonably/ quick; but obviously def ffib(n): a,b=1L,1L for i in xrange(n-1): t=a+b; b=a; a=t return a is faster. Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From tismer at tismer.com Wed Feb 2 10:26:44 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 02 Feb 2000 16:26:44 +0100 Subject: dyn added methods dont know self? References: <878vfb$3hn$1@nnrp1.deja.com> <38984EC5.C883ADAE@starmedia.net> Message-ID: <38984CB4.83FE83F0@tismer.com> Andrew Csillag wrote: > > moonseeker at my-deja.com wrote: > > > > Hi! > > > > I want to add a method dynamically to an instance, how can I do this? I tried > > with exec '...' in self.__dict__, but this method doesn't know the instance > > reference 'self', so it would complain that it is called without an argument. > > Is there any other method to add a method dynamically? > > You can't add a method directly to an instance unless you write a little > wrapper object to wrap self into it, i.e. ... > Alternatively, you can add the function to the class (not the instance) > and it will get self automatically, but then each instance of the class > now has this new method too which may not be desirable. Even weirder but shorter, you can dynamically insert the method into the class, then create your bound instance and save it away, and then delete the class' method again. >>> class klass: ... pass ... #nothing there ... >>> inst = klass() >>> >>> def fake(self, n): ... self.number = n ... >>> klass.fake = fake >>> meth = inst.fake >>> del klass.fake >>> meth(3) >>> inst.number 3 >>> inst2=klass() >>> inst2.fake Traceback (innermost last): File "", line 1, in ? AttributeError: fake >>> ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 jjlucsy at concentric.net Thu Feb 17 21:27:47 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Thu, 17 Feb 2000 21:27:47 -0500 Subject: Multiple ExtensionClass References: <007001bf79a8$d53748e0$01ffffc0@worldnet.att.net> Message-ID: Um, I was talking about the C ExtensionClass that's found in Zope. I was only trying to illustrate a point that I was trying to accomplish in C. I realize it works in python. Sorry. "Emile van Sebille" wrote in message news:007001bf79a8$d53748e0$01ffffc0 at worldnet.att.net... > This works for me: > > >>> class A: > def func1(self): > print "in func1" > > > >>> class B(A): > def func2(self): > print "in func2" > > > >>> a = B() > >>> a.func1() > in func1 > >>> > > Emile van Sebille > emile at fenx.com > ------------------- > > > ----- Original Message ----- > From: Joel Lucsy > Newsgroups: comp.lang.python > To: > Sent: Thursday, February 17, 2000 11:03 AM > Subject: Multiple ExtensionClass > > > > Ok, I've whipped up two ExtensionClass classes (stirred, not shaken) > and am > > trying to figure out how one can be a "subclass" of the other. I'll > > illustrate what I want (in python for brevity): > > > > class A: > > def func1(): > > pass > > class B(A): > > def func2(): > > pass > > > > Now I'd like to be able to do: > > a=B() > > a.func1() > > > > So far I haven't figured out how to do this without duplicating the > methods. > > Should I be messing with the method tables, or somehow manipulating > the > > dictionaries, or something completely different? I've tried making > python > > wrappers, but it complains about multiple bases or something. > Basically it > > wont let me derive from two different ExtensionClasses's. Either that > or I'm > > missing something. > > Any clues would be great. Thanks. > > > > -- > > - Joel Lucsy (jjlucsy at concentric.net) > > > > > > > > > > > > -- > > http://www.python.org/mailman/listinfo/python-list > > > > > > > From effbot at telia.com Sun Feb 13 14:16:53 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 19:16:53 GMT Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> <882fld$6t08$1@node17.cwnet.frontiernet.net> <38A6F986.F3F29C95@durham.ac.uk> Message-ID: Jason Stokes wrote: > J.C.Travers wrote in message <38A6F986.F3F29C95 at durham.ac.uk>... > >RPM1 wrote: > >> > >> Try, > >> http://www.pythonware.com/downloads.htm > >> > >> It's an EXE but it extracts even if you don't have privileges. > > > >No it doesn't. Well it didn't for me. > > > >I don't see the reason for not issueing a normal zip archive. Making a > >self-extracting binary doesn't make it much easier, (esp with winzip > >etc...) but causes lots of trouble for people like me. At least both > >should be offered... > > It's not just a self-extractor, it's a self-installer that registers itself > on the add/remove programs list. If you don't have install priveliges, it's > not going to work no matter how it's packaged. umm. the stuff at the pythonware.com is just a self-extractor. it explodes itself into c:\py15, and doesn't touch the registry or the system directory. the python.org installer is a real installer, though. From framiere at netcom-service.com Fri Feb 18 16:00:19 2000 From: framiere at netcom-service.com (Florent Ramière) Date: Fri, 18 Feb 2000 22:00:19 +0100 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> Message-ID: <88kca9$il$1@news3.isdnet.net> Thanks for your answers, in fact as Moshe Zadka told me, it is a documented feature ... (sorry) Well, i should have read more carefully the doc (re-sorry) And is there a solution to my problem ? And sys.stdout.write is not a good solution for me (i need to keep printing with print) Is there an easy way to override the print statement (i saw it one time in the news, but i can not find it) Thanks for reading Florent. bjorn wrote in message news:38ADB2FA.17A4D7A9 at roguewave.com... sys.stdout.write("hel") sys.stdout.write("lo") -bjorn Florent Rami?re wrote: > Hello, > > here is something i do not understand ... > > Let's say i want to write two strings which must display "HELLO" > 2 solutions to this problem: > print "HEL" + "LO" > > or > print "HEL", > print "LO", > > But this last solutions does not work !! Python inserts a white space > !? > > I wanted "HELLO", python give me "HEL LO" !!!! > > I certainly have missed something, could you help me on this ? > > Thanks for reading this . > Florent. > -- > ---- > Florent Rami?re framiere at netcom-service.com > Netcom http://www.netcom-service.com > 15, rue de R?musat - 75016 Paris > Tel : 06-60-61-85-32 --- Fax : 01-42-30-50-55 > > -- > http://www.python.org/mailman/listinfo/python-list From skip at mojam.com Thu Feb 17 09:15:18 2000 From: skip at mojam.com (Skip Montanaro) Date: Thu, 17 Feb 2000 08:15:18 -0600 (CST) Subject: Abstract classes? In-Reply-To: References: Message-ID: <14508.630.889721.461148@beluga.mojam.com> Daniel> class Observer: Daniel> def update( self ): Daniel> raise "sub-classes must over-ride this method" You might want to raise the standard NotImplementedError. From its doc string: >>> help(NotImplementedError) Method or function hasn't been implemented yet. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From thomas at xs4all.net Fri Feb 18 12:32:18 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 18 Feb 2000 18:32:18 +0100 Subject: Python misconceptions in IBM Ruby article... In-Reply-To: ; from robin@jessikat.demon.co.uk on Fri, Feb 18, 2000 at 09:33:12AM +0000 References: <38AC9D57.5CC8066C@mincom.com> Message-ID: <20000218183217.X477@xs4all.nl> On Fri, Feb 18, 2000 at 09:33:12AM +0000, Robin Becker wrote: > I guess the objection is to not having a standard name for the instance > in class functions. If we had the standard set at self you could > presumably write > class dingo: > def normal_func(a1,a2,....): > ..... > classdef instance_func(a1,a2,...): > self.a=1 > ........ > ie you could distinguish in the class definition between the kinds of > functions. Presumably normal_func cannot refer to self and instance_func > can. Also I assume that normal_func would live while the class does > which is more difficult in python. You could possibly do it that way, but Guido didn't ;) I personally like this very, very much (combined with all other 'naming' conventions and rules in Python) -- it means something very simple and intuitive: Python does not introduce (at runtime) *any* names in the local or global namespace, that you have not explicitly asked for (this is one of the two reasons to avoid an exec without local/global dicts, and 'from foo import*') This is really nice if you're faced with a long, hairy (un-Pythonic) function with an, uhm, interesting mix of locals and gobals. Bare exec's and '*'-imports are, thankfully and rightfully, pretty rare, making it nice and easy to trace back, manually, where a variable came from and where it is going (in absence of continuations, of course ;) (There are a lot of bindings in the global namespace that python does introduce, namely all the builtin functions, but those are always there. They do not depend on some other, at first glance unrelated, statement or function call.) So, you have to type five characters more, per (local) attribute. As a bonus, you wont be so annoyed when you see you have a global variable 'feebles' and a class/instance attribute 'feeble', and you typo the name ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From thomas at xs4all.net Mon Feb 7 11:52:23 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Mon, 7 Feb 2000 17:52:23 +0100 Subject: mail filter in python? In-Reply-To: <20000207170156.A3609@stopcontact.palga.uucp>; from gerrit.holl@pobox.com on Mon, Feb 07, 2000 at 05:01:56PM +0100 References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207170156.A3609@stopcontact.palga.uucp> Message-ID: <20000207175222.J19265@xs4all.nl> On Mon, Feb 07, 2000 at 05:01:56PM +0100, Gerrit Holl wrote: > File locking isn't hard to implement, what kind of security checks do you > mean? Python is portable so that's not a problem. File locking _is_ hard to implement, in a portable, secure, race-proof manner. flock()/lockf()/O_EXCL are the easiest ways of locking, but are not very portable, and are likely not to work on some filesystems (like NFS). Also, some NFS servers and clients do their best to do NFS locking in a secure way, but most do not succeed, or succeed at the cost of stability and speed. There is a fairly portable way of locking, even over NFS, using hard links between lockfiles, but it is tricky to implement. See the mailman-developers archive on www.python.org/pipermail/mailman-developers, there should be a few recent postings by me about locking. > > It would be hard to reimplement all that from scratch :( > > I don't think so. Security is not an issue, the command runs under the > right uid. That depends on how/where you install it. It usually has to run with mail-gid permissions, for instance. All in all, i think you're better off with a frontend to procmail, which creates a procmailrc to your liking. Or perhaps you can use the powers of procmail to make it start a python script to do the filtering, and accepts the action from it -- it would then take care of locking, security and the mailbox format itself. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From cjensen at be-research.ucsd.edu Fri Feb 11 20:06:52 2000 From: cjensen at be-research.ucsd.edu (Curtis Jensen) Date: Fri, 11 Feb 2000 17:06:52 -0800 Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> Message-ID: <38A4B22C.EDFCB2A3@be-research.ucsd.edu> Steve Holden wrote: > > I declare this thread closed. > Unilaterally. NOW. Like that'll happen. From tim_one at email.msn.com Sat Feb 26 03:08:26 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 03:08:26 -0500 Subject: functional programming In-Reply-To: <0ac76d2a.e325df6e@usw-ex0104-031.remarq.com> Message-ID: <000801bf8030$a8a2f2a0$3c2d153f@tim> [Neel Krishnaswami, writes some unusual stuff about the Joy language, then recants] > Augh! I just realized I screwed up the names. Joy, while an > excellent and cool language (it's a functional Forth, more > or less), is fully and totally 100% Turing-complete. Joy is both much more and much less than a functional Forth. It's both lovely & strange; e.g., I'm not sure I've bumped into a language before where it's considered natural (as opposed to merely possible, and with great strain) to write an *anonymous* recursive function. > The language that I was /actually/ talking about is Charity, > which is a categorical programming language invented at the > University of Calgary: > > http://www.cpsc.ucalgary.ca/projects/charity/home.html New one on me -- thanks! I see it shares category theory's fondness for wholesale invention of impenetrable terminology too . Alas, doesn't look like an active project anymore. die-young-and-leave-a-good-looking-corpse-ly y'rs - tim From thamelry at vub.ac.be Fri Feb 4 04:57:12 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 4 Feb 2000 09:57:12 GMT Subject: Circular references and python References: <000c01bf6ed3$51946de0$a2a0143f@tim> Message-ID: <87e7po$kdr$2@mach.vub.ac.be> Tim Peters wrote: : Speed isn't the hangup in the Python world. It's much more ease of porting : to new platforms (the amount of time spent now on porting CPython's gc: 0), : and CPython's extraordinary friendliness to extending and embedding. Ahem...for some reason I took a look at the DrScheme homepage. The underlying language MzScheme runs on Windows 95/98/NT, MacOS, and Unix, uses garbage collection and is extendible in C/C++. I took a look at the extension manual and it seems pretty similar to what is posible in Python. So maybe sometghing can be learned from looking at a couple of other (maybe a bit more academic) scripting languages? A couple of moths ago I felt a strange urge to read a 20+ page article on garbage collection. It discussed various GC techniques, including reference counting. The general opinion on reference counting seems to be that it's still a valuable technique for real time systems and parallel computing. But not for more general use. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From dworkin at ccs.neu.edu Thu Feb 10 17:27:59 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 17:27:59 -0500 Subject: perl chomp equivalent in python? In-Reply-To: "Hans Nowak"'s message of "Thu, 10 Feb 2000 23:25:14 +0100" References: <200002102225.XAA22165@dionysus.fw.cuci.nl> Message-ID: "Hans Nowak" writes: > > Last time I checked, Python wasn't sensitive to extra whitespace at > > the _end_ of a line. > > With one exception... > > print 1+ \ > 2 Quite true. I so rarely use backslash-continued lines that this would never have occurred to me. -Justin From sholden at bellatlantic.net Tue Feb 15 18:03:22 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 15 Feb 2000 23:03:22 GMT Subject: OT: Celebrating Python References: <38A5AAB4.5F56B3A0@digicool.com> <884dhj$l0a$1@nntp6.atl.mindspring.net> <14504.12483.890085.354771@weyr.cnri.reston.va.us> Message-ID: <38A9DAEE.F66E05C6@bellatlantic.net> "Fred L. Drake, Jr." wrote: > > Aahz Maruch writes: > > Time's fun when you're having flies. > > Reminds me of a book my in-laws gave my kids. I understand they're > nice in pies. ;) > > -Fred > > -- > Fred L. Drake, Jr. > Corporation for National Research Initiatives \ "Time flies like a banana": description or imperative? regards Steve -- "If computing ever stops being fun, I'll stop doing it" From emile at fenx.com Sat Feb 12 00:23:40 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 11 Feb 2000 21:23:40 -0800 Subject: How do you undo x = `a` if A is a list? References: Message-ID: <088a01bf7519$580332a0$01ffffc0@worldnet.att.net> Warren, What you're asking for is the eval(repr(x)) pair. >>> a = [ "first", "second", "third" ] >>> f = open(r"c:\temprepr","w") >>> f.write(repr(a)) then later... >>> f = open(r"c:\temprepr","r") >>> c = eval(f.readline) >>> c ['first', 'second', 'third'] HTH Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Warren Postma Newsgroups: comp.lang.python To: Sent: Friday, February 11, 2000 12:39 PM Subject: How do you undo x = `a` if A is a list? > Let's suppose I have a list A: > > a = [ "first", "second", "third" ] > > And I want to save to a text file on disk the following Exactly into > myfile.txt. > I looked at Pickle, but "human readable" is not one of Pickle's features. > > [ "first", "second", "third" ] > > So that part is easy, I can convert like this: > > a_as_text = `a` > > Now how do I read that line in from a file and convert it from a string to a > list? > > If I was using my old favourite lange (Realizer, a Basic interpreter) I > would do this: > > Execute( "a = "+a_as_text) # dynamic invocation of the Parser (slow > but powerful!) > > The benefit of this is that it would allow any one line of Ascii text to be > converted into the corresponding Python object, totally dynamically. > > Sorry if this is a FAQ but I couldn't find it in my scan of the > documentation and FAQ. > > Warren > > > > -- > http://www.python.org/mailman/listinfo/python-list > From fcahoon at my-deja.com Fri Feb 18 00:16:12 2000 From: fcahoon at my-deja.com (Forrest Cahoon) Date: Fri, 18 Feb 2000 05:16:12 GMT Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <20000216073317.A579@stopcontact.palga.uucp> <88eojc$jed$1@nnrp1.deja.com> <8pOq4.122$mYj.170920448@newsa.telia.net> Message-ID: <88ikiq$ajp$1@nnrp1.deja.com> In article <8pOq4.122$mYj.170920448 at newsa.telia.net>, "Fredrik Lundh" wrote: > Forrest Cahoon wrote: > > I'll admit to being somewhat confrontational in my original post, but > > all along, it was constructive information like this I was really after. > > would have been easier to ask for that from the > start, wouldn't it? Not really. You must understand, that I was genuinely troubled by the growing popularity of python, because of my nightmarish esperiences with whitespace management. I made a really honest, direct post. It's true I could have toned it down, and from my genuine angst asked a few watered-down questions, but I don't think that would really have been best. By being simple, straightforward, and direct, I was able to engage in a lively discussion that I could really put myself into. I did state, quite honestly, in my original post : "While I'm sure this will strike many of you as a bunch of gratuitous flamage, I really am only trying to promote reasoned discussion, honest. I hope no one gets really _personally_ upset!" I think that statement was more than adequate to assure most readers of my post that I wasn't a troll. The discussion which followed was quite interesting, and I don't know if removing the confrontational element would have generated quite as much discussion. The typical response read like "Oh YEAH?!?!? Well, if you really think it's such a problem why don't you just use X? It's not a problem!" Where X could be, for example, pindent.py. While the tone seemed to imply that I was a fool not to know about X, and realize that my problems were moot, the Xs themselves were of great value, and as a consequence I am now somewhat less intimidated by this whole whitespace thing. The tone was, of course, dictated by the way I started the discussion, and because I understand this, I can't fault anyone for putting their description of X in that way. > > I'm really happy -- especially now -- with the level of constructiveness > > here. It's a shame that Moshe Zadka has insisted on sending me some > > really snide, asshole flames to me by personal e-mail that there is no > > way he would post in public. He's really a blemish on your fine > > community, and I humbly suggest you consider adding him to your > > killfiles, and not answering his questions until he grows up. > > if you want others to behave like grown-ups, I > suggest you start with yourself. Are you suggesting that my initial posts were immature, or my public mention of the noxious private e-mails I received from Moshe Zadka? If the former, I believe I have addressed this above. As for the latter, it is difficult to know what to do when someone, who participates civally in public discussion, sends private e-mail that is very much less than civil. (He got the "Oh YEAH!?!?" part down really good, but there was nothing remotely resembling an 'X' in what he had to say.) Moshe Zadka is the only person who sent me mail from this discussion that wasn't also posted. Netiquette dictates that I not post his private e-mail publically (although I wonder about that), but mentioning this private behavior to the public audience seems the only reasonable response. How else could I discourage his behavior? Responding to him directly would only have encouraged him. > until then, hope you'll enjoy sitting in my killfile. > > *plonk* Somehow, I couldn't come up with a response to this "threat" that didn't sound as silly as you sound. Maybe a little bit of silliness is OK, though. f Sent via Deja.com http://www.deja.com/ Before you buy. From rhicks at rma.edu Thu Feb 17 16:54:21 2000 From: rhicks at rma.edu (Robert Hicks) Date: Thu, 17 Feb 2000 21:54:21 GMT Subject: wxPython book??? Message-ID: A "Learning wxPython" or "Programming wxPython" book would be an outstanding edition to the Python community. I think a book of this type "could" push wxPython into the Python limelight. Plus as a Python neophyte...I need to read! What do you think? Bob From Sven.Drescher at dlr.de Thu Feb 3 02:25:15 2000 From: Sven.Drescher at dlr.de (Sven Drescher) Date: Thu, 3 Feb 2000 08:25:15 +0100 Subject: Tk variables problem References: <879a88$t68$1@news.go.dlr.de> Message-ID: <87bac9$cik$1@news.go.dlr.de> Thanks! I couldn't imagine, that a simple variable also needs a complete 'Tk-application' to run correct. Now, all is working fine. Thanks, Sven From gmcm at hypernet.com Thu Feb 3 22:24:06 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 3 Feb 2000 22:24:06 -0500 Subject: Execfile() - bug / strange behavior In-Reply-To: <87dfjk$qip$1@nntp.Stanford.EDU> Message-ID: <1262487880-7601658@hypernet.com> Amit Patel writes: > I'm trying to understand why execfile(fn) is different from exec > open(fn,'r').read(). Here's my program: > > ==== > def timbot(): > a = 3 > execfile("1.txt") > print a > print locals() > > timbot() > ==== > > Then I have 1.txt: > > ==== > a = 5 > b = 8 > ==== > > > When I run this, I expect to see a is 5, but I get: > > ==== > 3 > {'b': 8, 'a': 3} > ==== > > I don't understand why variable a is not set, but b is! Even > stranger, when I try to print b from timbot(), it gives me NameError, > even though it's in locals()! Perhaps this will give you a hint: >>> execfile('1.txt') >>> a 5 >>> b 8 >>> > When I change execfile("1.txt") to exec open("1.txt",'r').read(), it > works just fine! That's because in the presence of an "exec" statement, locals don't get optimized to slots. As a function "execfile" gets no such special treatment. If you really want to use execfile, pass in the optional dicts and suck the values out of there. not-a-bot-ly y'rs - Gordon From tsarna at sarna.org Tue Feb 15 00:42:20 2000 From: tsarna at sarna.org (Ty Sarna) Date: 15 Feb 2000 05:42:20 GMT Subject: JOBS: Python/Zope positions available! Message-ID: <950591896.62288@fezzik.endicor.com> Wanted: Python and/or Zope developers. Who are we? We're a small team within the world's largest web hosting organization (525,000 domains served). We see our mission as being a "city planning department" of sorts for the company. We plan for the growth of that community and develop the tools to make the community work through collaboration. Our flagship tool is a Python/ZPublisher based request-tracking system that currently serves about 20,000 requests per week. We use open source software heavily and like to contribute back to the community, as you've seen. We expect to do even more of this in the future. Not only will we pay you to think up neat new stuff and write it, but you can likely give it away. Our team is currently at 5 people, looking to grow to 6 or 7. Our team is headed by a developer, not a "PHB". Two of us are developers, the other three handle system administration, process consulting, training, etc. However, we all do a little bit of everything. We're looking for one strong developer, and one person with some mix of consultant/developer/admin capabilities. We strive to be a closely knit team and the nature of our work requires that we work in the same place most of the time, so relocation to the sunny Boca Raton, FL area is required. Poor you. :-) We provide Medical, Dental, 401k, bonuses and options, etc. EOE. The developer applicant should have significant Python and/or Zope experience. The following technical knowledge and skills would be beneficial (We don't expect anyone to know all or even half of this, but flexibility and willingness to learn new things, including things not on this list or which haven't been invented yet, is important. We work on a variety of projects, so adaptability and a certain jack-of-all-tradesness is a key quality): * Python * Zope * ZPublisher/Bobo (independent of Zope) * OO design skills * SQL * LDAP * XML-RPC, CORBA, or SOAP * Experience building web-based applications * HTML design * Knowledge of workflow automation principles * Threaded programming * GUI and visual design * System administration experience, especially Unix and Sybase. Knowledge of a variety of Unix-derived OSes is a plus. * Ability to write technical documentation * Javascript (especially in relation to DTML) * C (especially in relation to Python) The consultant/trainer/admin position should have have some technical skills plus strong networking skills (in the "with people" sense) and verbal and written communications skills, the ability to figure out requirements for systems (not only computer systems, but systems of people and procedures), figure out how people do, would, and should use them, explain them, document them, train people on them, figure out what works and what doesn't, and generally see the "big picture". Applicants for either position would greatly benefit from having qualities of the other. Interested? Please email privately to Phillip J. Eby with your resume, and more importantly with a brief description of your qualifications as relevant to the above. Also, please include your salary requirements. -- Ty Sarna "Clowns are raining down. Hear the scream of the tsarna at sarna.org greasepaint. Danger! Clown puddles." -Tom Servo From moshez at math.huji.ac.il Fri Feb 25 15:38:35 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 22:38:35 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On 25 Feb 2000, Denys Duchier wrote: > The point, however, is moot since, as I suggested previously, the > finalization semantics of Python (much like that of C++) are not > easily reconciled with tail call optimization. I won't say anything about C++ (what I'd like to say about it isn't fit for prime time), but about Python, this is untrue: either the called function has a reference to the object (in which case it won't be finalized) or it can be deleted when the calling frame is deleted, in which case the call to the destructor will *precede* the tail-call, and still leave it in tail position. The only argument worth a spit is Tim's "but what about them tracebacks", and I said that it's quite all right if tail-call optimization only happens when the switch -tail-call-optimize-i-don't-need-tracebacks is given to the interpreter. Oh, the other argument worth a spit is that it isn't implemented and no one (including me) doesn't care enough to code it, and then to harass Guido enough that he'll accept the patch. non-tail-signature-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From robin at jessikat.demon.co.uk Tue Feb 1 11:30:36 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Tue, 1 Feb 2000 16:30:36 +0000 Subject: Excel Ranges from Python COM server References: <876t6g$iap$1@nnrp1.deja.com> Message-ID: In article <876t6g$iap$1 at nnrp1.deja.com>, Don writes >I am having trouble setting getting data from Python to set a range in >Excel VBA. From Python I can manipulate Excel ranges as tuples of >tuples, just fine. But I am doing something wrong calling Python from >VB. The following example demonstrates my problem. > >An Excel Range gives me a Python tuple of tuples in Python, but a Python >typle of tuples is not an Excel Range in Excel. What should my >function, getRange return? > . > ... I had similar problems. It seems pythoncom has probs with two dimensional ranges. I just switched to row ranges. I made python do the work though as python loops were faster than vba. -- Robin Becker From paul at prescod.net Tue Feb 8 11:51:10 2000 From: paul at prescod.net (Paul Prescod) Date: Tue, 08 Feb 2000 08:51:10 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> Message-ID: <38A0497E.FC5CA78C@prescod.net> fcahoon at my-deja.com wrote: > > ... > > The popularity of a language cannot be taken as prima facie evidence of > its technical superiority. Consider Perl. Perl may or may not be technical superior, but its popularity is absolutely not a coincidence. Larry Wall guided a huge segment of the programming population from bit twiddling and string twiddling languages to high level languages (and even a modicum of object orientation) through careful integration of his language with their existing environment. Perl is popular because it was designed to be popular. > The number of modules > available for Perl on CPAN is positively mind-boggling. Does this mean > that Perl must necessarily be a superior language? Perl is superior at achieving popularity among late 1980s Unix programmers, than anything else that was available. That is not butterfly wings but rather careful design. I may not like the results of the design but I cannot deny that the consequences follow from it. > This leads > one to wonder: how large is the population who have used python > seriously, but found indentation-as-syntax to be too large of a problem, > and now use different languages? Surely, they are not here to be > counted. They are nowhere to be counted. I have not met such a person in all of my years of proletizing Python at e.g. XML conferences. I have met dozens of people who said that they thought whitespace was going to be a problem but then found it wasn't. I'm not going to claim that no such person exists but I am confident that they are few and far between. Did you meet anyone in that category at LinuxWorld? -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From skip at mojam.com Sat Feb 12 07:02:52 2000 From: skip at mojam.com (Skip Montanaro) Date: Sat, 12 Feb 2000 06:02:52 -0600 (CST) Subject: Using sockets or telnetlib to finger? In-Reply-To: <20000212225015.A659@Ridcully.home> References: <883e1e$f3v$1@zingo.tninet.se> <20000212225015.A659@Ridcully.home> Message-ID: <14501.19436.269286.998618@beluga.mojam.com> Andr?> The latest stable version of the Linux kernel is: 2.2.14 Andr?> The latest beta version of the Linux kernel is: 2.3.43 Andr?> The latest prepatch (alpha) version *appears* to be: 2.3.44-8 Andr?> Andr?> I need to access the version numbers alone, since I want to Andr?> translate the rest of the text. Jumping in a bit late... Your kernel_info string contains all the data from the finger operation. I think you'll find parsing it somewhat less fragile if you split it into lines and then grab the text you want from individual lines: import string lines = string.split(kernel_info, "\n") stable = string.split(lines[2])[-1] beta = string.split(lines[3])[-1] alpha = string.split(lines[4])[-1] You can make it even less fragile by searching for relevant substrings in the appropriate lines before extracting. Depending on how crucial stability of this code is, you may well simply find it easier to adjust your application if format changes to the finger output break it... Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From info at motor-universal.com Mon Feb 7 07:13:36 2000 From: info at motor-universal.com (info at motor-universal.com) Date: Mon, 07 Feb 2000 12:13:36 GMT Subject: Motor 38768 Message-ID: <070200131306@motor-universal.com> Ya puedes encontrar todo sobre motores en: http://www.motor-universal.com Find whatever you need about motors at: http://www.motor-universal.com A>F-z-awv8?C5`zmR37Z From runaro at stud.cs.uit.no Wed Feb 16 14:59:38 2000 From: runaro at stud.cs.uit.no (Runar Olsen) Date: Wed, 16 Feb 2000 20:59:38 +0100 Subject: String question Message-ID: <88ev6m$cun$1@news.uit.no> I want the variable 'string' to be a string and not a list.. >>> n =10 >>> string = "n = ", n >>> print string ('n = ', 10) I want string to be "n = 10". How? Runar From emile at fenx.com Fri Feb 11 08:39:47 2000 From: emile at fenx.com (Emile van Sebille) Date: Fri, 11 Feb 2000 05:39:47 -0800 Subject: What does str(...) do? References: <38A41077.9BDAE248@aston.ac.uk> Message-ID: <075901bf7495$77b716e0$01ffffc0@worldnet.att.net> >>> print str.__doc__ str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. In other words, if your argument is in fact a string, str(x) does nothing. However, it does allow for a single technique to be used to display a type or class variable. Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Peter Bittner Newsgroups: comp.lang.python To: Sent: Friday, February 11, 2000 5:36 AM Subject: What does str(...) do? > Hi there! > > I've seen > > print '....' + str(text) + '...' > > in some code (in a function definition). > What does this 'str(...)' really do? - Is it absolutely necessary?? > > Peter > > | Peter H. Bittner > | International Student at Aston University > | e-mail: bittneph at aston.ac.uk > | web: http://beam.to/bimbo > +-------------------------- > -- > http://www.python.org/mailman/listinfo/python-list > From tottinge at concentric.net Thu Feb 24 09:00:09 2000 From: tottinge at concentric.net (Tim Ottinger) Date: 24 Feb 2000 09:00:09 EST Subject: Two question from a newbie References: <%zep4.24612$3b6.103195@ozemail.com.au> Message-ID: <38b41d31.20948262@news.concentric.net> On Sun, 13 Feb 2000 00:45:59 +1100, "Jason Stokes" wrote: >>> if ( x.mode == "view" or x.mode == "modify): [...] >>if x.mode in ("view", "modify"): > > >I don't see that this idiom has that much to recommend it. Mr Drake's >version is clear in that we're comparing x.mode with two modes -- "view" and >"modify". Your version attempts to *find* x.mode in the tuple ("view", >"modify") and executes the sub-bock if successful. The intention of the >first example is immediately apparent. The intention of the second is not >so immediate, so it must lose out if you want to write maximally >comprehendable code. To each his own, I guess. I found that the intent of the first one was only more comprehensible to a programmer skilled in C-like languages. The second is more explicit, and doesn't have any doubled symbols. It's more English-like. I don't know how they compare in performance, but my son can read the second, whereas he's intimidated by the first. He's in 3rd grade, and never programmed before. Tim From kc5tja at garnet.armored.net Sun Feb 20 21:32:48 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 21 Feb 2000 02:32:48 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: Message-ID: In article , Tim Peters wrote: >The latter are more powerful, but that's not really the attraction. >Continuations are both fast and space-efficient compared to threads on most >platforms. Read Christian's paper! You'll find, e.g., that his simple >implementation of generators using continuations ran 3x faster than a simple >implementation using threads (& on a platform that does a relatively good This is because the operating system switches threads, not the application. At worst case, it does so on an every so often (time-slicing). At best case, it will put a thread to sleep as soon as the OS sees that it can't possibly proceed any further without a message or event from another thread. Continuations, however, are entirely user-space constructs. There's no user-to-kernel-to-user transitions involved. So of course they're going to be faster when run under such a system. Now, implement an operating environment that uses continuations natively, and you'll find it'll be no faster than using threads. Why? Because the continuation functions are stuff away in kernel-space (otherwise, they wouldn't be "native" to the operating system). >coroutine implementation flies (and see Sam Rushing's writings on Medusa & >friends for deadly practical high-end applications). I have read up on the Medusa package -- it uses the same technique that allows the AmigaOS to wipe the floor with almost any other OS even after so many years -- the LACK of multithreading, and the introduction of intelligent event notification systems. >I've never seen an implementation of (pseudo)threads using continuations >that I thought was suitable for more than toy researchy problems or >educational purposes. When it comes to "real work", the pragmatics are Because continuations are inherently language specific. If languages like C and its ilk used indirect stack frames (instead of embedded stack frames), continuations in C would be more than possible, and threading would be far easier. Billy and I had a discussion on this topic the other day, in fact. >code won't let Python "timeslice" it). So Python threads serve important >purposes Python continuations couldn't touch, and also for which the latter >aren't pragmatically suited. Why can't Python's threads package use OS-native threading API, assuming one exists? >space, while a continuation will usually suck up only a few hundred bytes. What is your basis for this conclusion? An execution context is an execution context is an execution context -- the amount of information which is required to be stored is going to be roughly equal no matter what. In fact, continuations will consume more space than a pure thread specifically because a function's "frame" isn't stored on "the stack." Thus, something somewhere must maintain a reference to it. Then consider that there can be several "continuation objects," where each object stores a branch of the frame tree within it. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From sabren at manifestation.com Sun Feb 6 22:27:38 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 6 Feb 2000 22:27:38 -0500 Subject: [Doc-SIG] Monty: A structured text syntax idea References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> <20000203160900.A1029@stopcontact.palga.uucp> Message-ID: <87le41$fms$1@nntp5.atl.mindspring.net> Gerrit Holl wrote in message <20000203160900.A1029 at stopcontact.palga.uucp>... >I don't like it. For blocks its okay, but for inline thinks it - sucks. >In tag language (XML etc.), things get nested much too deep to use this >proposal. And blocks are much longer. It should be clear what tag is >closed. I don't like it. I missed the first half of this, so I don't know if this is relevant or not, but I use emacs outline mode a lot, and I came up with a "shorthand" version of XML that looks like this: * root ** somenode this is the text of somenode ** somenode attr="whatever" another node ** shortnode / ** somenode *** subnode this is the subnode this can be translated into XML via a python filter at: http://www.sabren.com/code/python/o2x.py - michal sabren at manifestation.com From steinme at kpnqwest.no Thu Feb 10 17:33:07 2000 From: steinme at kpnqwest.no (Stein M. Eliassen) Date: Thu, 10 Feb 2000 23:33:07 +0100 Subject: Python and Samba Message-ID: <38A33CA3.CD301863@kpnqwest.no> Hi, I wonder if there is a way to use samba services from python? What I would like to do is browse shares from Python code. Now I have to mount the share in a script before running the my python code. I think with a Samba-Python lib my scripts would be a bit more reliable. Thanks for any help. Regards Stein From frederic.laurent at sxb.bsf.alcatel.fr Tue Feb 8 05:12:41 2000 From: frederic.laurent at sxb.bsf.alcatel.fr (Frederic LAURENT) Date: Tue, 08 Feb 2000 11:12:41 +0100 Subject: pretty print xml document Message-ID: <389FEC18.594FBD7C@sxb.bsf.alcatel.fr> I want to pretty print an xml document that I've created : >>> from xml.dom.builder import Builder >>> c=Builder() >>> c.startElement("foo") >>> c.text("bar") >>> c.startElement("another") >>> c.text("text") >>> c.endElement("another") >>> c.endElement("foo") >>> c.document.toxml() '\012bartext' I would like to have something like that : bar text Is there something done (an existing method/class) to pretty print the xml document ? thanks From tim_one at email.msn.com Thu Feb 10 00:14:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 10 Feb 2000 00:14:52 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <38A231E3.587D4928@prescod.net> Message-ID: <000701bf7385$c37f2ec0$8e2d153f@tim> [Paul Prescod] > ... > Is or isn't there a real reason that Lisp is almost 50 years old, > still widely praised by those "in the know" and is still not popular > yet? Every computer language user should read Richard Gabriel's famous "worse is better" paper, which may be the finest thought on this to have come out of the Lisp world. Widely available; here's a nice HTML version: http://www.ai.mit.edu/docs/articles/good-news/good-news.html Python is certainly a "New Jersey" language in the view of that paper. I'll add two others: 1) An amazingly persistent conviction that "Lisp is slow", despite that this hasn't been *true* for decades (it was true at the start, at least compared to the Fortrans and COBOLs it originally "competed" against -- and Fortran and COBOL suffer similarly persistent delusions, based on versions of the languages that are no longer relevant). 2) Deep hatred of Lisp's syntax. Just seems to be a fact of life -- and you know as well as anyone how irrational people can get over a *good* thing like Python's lack of curly braces . See Gabriel for the "deep" reasons, though. would-have-helped-if-they-had-larry-or-even-guido-too-ly y'rs - tim From gerrit.holl at pobox.com Sat Feb 19 10:13:55 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 19 Feb 2000 16:13:55 +0100 Subject: Help needed writing GUI comparison In-Reply-To: <20000218180239.A5551@stopcontact.palga.uucp>; from gerrit.holl@pobox.com on Fri, Feb 18, 2000 at 06:02:39PM +0100 References: <20000217221452.A2943@stopcontact.palga.uucp> <20000218180239.A5551@stopcontact.palga.uucp> Message-ID: <20000219161355.A4521@stopcontact.palga.uucp> Hello, I wrote: > Second version: > * less biased/more general > * added benchmarks > * added PyQT and PyKDE > * reformulated intro > * reformulated other things Third version attached. I think it's complete. If I should add another GUI, mail me! I'll send it to python-docs tomorrow. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke -------------- next part -------------- An HTML attachment was scrubbed... URL: From JamesL at Lugoj.Com Thu Feb 24 23:31:40 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Thu, 24 Feb 2000 20:31:40 -0800 Subject: Phyththon misspelling contest References: Message-ID: <38B605AC.C407C27B@Lugoj.Com> Will Ware wrote: > > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. Mozzila...oh wait, that's been taken, hasn't it? From bjorn at roguewave.com Mon Feb 21 19:00:32 2000 From: bjorn at roguewave.com (bjorn) Date: Mon, 21 Feb 2000 17:00:32 -0700 Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <38b1c147.74099484@news1.on.sympatico.ca> Message-ID: <38B1D19F.2353D7E5@roguewave.com> Robert Roy wrote: > On Mon, 21 Feb 2000 16:30:16 +0100, Gerrit Holl > wrote: > > > > >> > > - Clean design, if possible OO. > >> > > >> > All GUI's have this feature, As Far As I Saw So Far. > >> > >> Tcl/Tk is not OO (at least not in its base version). > > > >Tkinter *is* OO, and the fact the underlying Tcl/Tk isn't bothers > >me a lot. > > I think you are wasting your worries on something that is really not > all that important. The fact is that we use Tkinter when we program. > Tkinter adds an OO layer on top of some procedural code. Is this > evil?. No. Is is unprecedented? No. Abstract it far enough and all > languages do it. I mean should it bother you a lot that the first C++ > compilers (more accurately pre-compilers) actually wrote a pile of C > code then compiled it? No because that is an implementation detail. But if you remember the "joy" it was to debug the resulting mess, it should give you at least one argument for building on a higher level GUI toolkit. don't-do-enough-gui-programming-to-care-yet'ly y'rs -- bjorn From mlauer at trollinger-fe.rz.uni-frankfurt.de Wed Feb 2 20:24:27 2000 From: mlauer at trollinger-fe.rz.uni-frankfurt.de (mlauer at trollinger-fe.rz.uni-frankfurt.de) Date: 3 Feb 2000 02:24:27 +0100 Subject: Communicating with MICO Message-ID: <3898d8cb@nntp.server.uni-frankfurt.de> Howdy - I'm looking for a way to implement a MICO (CORBA implementation - see http://www.mico.org) server object with python. Is this somehow possible ? (The purpose is to do a client-server scenario where the client requests ticker-data which the server provides.) TIA -- -- Regards & Gruesse from Mickey @ http://www.Vanille.de --------------------------------------------------------- How could anyone know me - when I don't even know myself ? From sabren at manifestation.com Thu Feb 10 22:50:22 2000 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 10 Feb 2000 22:50:22 -0500 Subject: ann: porting PHPLIB Message-ID: <8800un$g0h$1@nntp9.atl.mindspring.net> Hey All, I've mentioned at least twice in the past two days the idea of porting PHPLIB[1] to python... After talking to my business partner about this, we have decided that Python is much more suited to our needs than PHP3... However, all of our code is built around PHPLIB's session model, and .... well, it's a darn good model. From what I can tell, Zope just isn'tt the same.. Not that Zope doesn't look cool... I'm just saying it would be easier to port PHPLIB than to make our software fit the Zope model. So, that's what I'm doing: specifically, I'll be porting the session, authentication, and permission classes from PHPLIB.. I'm not fiddling with it too much so there should be a beta version for people to play with in the next day or three. If anyone wants to help code or test, let me know! -Michal [1] PHPLIB home page: http://phplib.netuse.de/ From tbryan at python.net Sat Feb 12 08:24:30 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 12 Feb 2000 08:24:30 -0500 Subject: javadoc equivalent? References: <881lj1$5af$1@nntp6.atl.mindspring.net> Message-ID: <38A55F0E.291EEC30@python.net> Michal Wallace wrote: > > Hey All, > > Is there a tool similar to javadoc in python? Something that would go > through a .py file, read the doc strings (assuming they're in there), > and then print the results in a nicely formatted HTML document? Ask the DOC-SIG. I think that they were looking into such a thing. It wouldn't be too hard to write a basic thing in python... Rough sketch Import a module elements = dir(modulename) for each classOrMethod in elements: elementType = determineType(classOrMethod) # for formatting purposes try: format(classOrMethod.__doc__, elementType) except AttributeError: pass try: format(modulename.__doc__,'module') except AttributeError: pass > Could such a beast read docstrings in .pyc's, or do they get compiled out? That's easy to test... $ cat > somedocs.py class Foo: """This class exists simply to test whether docstrings are preserved in .pyc files.""" pass $ python -c 'import somedocs' $ ls somedocs.py somedocs.pyc $ rm somedocs.py $ ls somedocs.pyc $ python -c 'import somedocs; print somedocs.Foo.__doc__' This class exists simply to test whether docstrings are preserved in .pyc files. I've been working on a general-purpose documenatation tool that could be used for formatting Python documentation, but it's currently stalled. I'll post again when it's usable. ---Tom From gleichtm at N0SP&Mquintiles.com Thu Feb 17 08:34:17 2000 From: gleichtm at N0SP&Mquintiles.com (Gregg) Date: Thu, 17 Feb 2000 08:34:17 -0500 Subject: Q: Access JPython interpreter obj while inside it? Message-ID: <88gtce$mso$1@bob.news.rcn.net> Can anyone tell me how I might go about grabbing a reference to the JPython interpreter object I'm running interactively within? I want to pass the reference to an application Z that has been started from within the interpreter and then use reflection from Z to run the eval method of the interpreter on a script object that has also been built in the interpreter and been passed to Z. Why don't I just embed JPython in Z? Because I already have a perfectly good interpreter sitting in memory and I don't want to create another one with its concomitant memory overhead. Why don't I just compile the scripts to Java classes and use them directly from Z? Because I want to do something on the fly. Any help would be greatly appreciated. Please, e-mail if you also post. Thanks in advance. -- Gregg Leichtman, Ph.D. Remove N0SP&M to reply. From effbot at telia.com Tue Feb 15 15:47:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 15 Feb 2000 20:47:40 GMT Subject: is this a Python bug? References: <88caua$fef$1@news1.tc.umn.edu> Message-ID: Brian Langenberger wrote: > R is supposed to work to give raw strings with the backslashes stored > as backslashes. I've never had a problem until I tried making a > string with nothing but backslashes. When I did, I got this result: > > 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 > >>> r'\\\' > File "", line 1 > r'\\\' > ^ > SyntaxError: invalid token > >>> > > Is this an error in the implementation or did I miss something in > the docs? I don't actually *need* such a string; I just found this > while experimenting with the interpreter. you missed something in the docs: http://www.python.org/doc/current/ref/strings.html "When an 'r' or 'R' prefix is present, backslashes are still used to quote the following character, but all backslashes are left in the string. /.../ Specifically, a raw string cannot end in a single backslash (since the backslash would escape the following quote character)." From felixt at dicksonstreet.com Sun Feb 27 04:38:24 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Sun, 27 Feb 2000 03:38:24 -0600 Subject: Q about tail recursion In-Reply-To: <000a01bf8033$269bdee0$3c2d153f@tim> References: <3.0.5.32.20000226013755.0087a180@mail.dicksonstreet.com> Message-ID: <3.0.5.32.20000227033824.00a06140@mail.dicksonstreet.com> At 03:26 2/26/00 -0500, Tim Peters wrote: >[Felix Thibault] >> Does this mean that even though there are no return's in faketailadd's >> add, the function still has to work its way back up from all those >> recursive calls ? > >Perhaps you're missing that Python does no tail-call optimizations ever; or >perhaps that Python invents a "return None" for you if you don't code an >explict return yourself. That implicit return is what I was missing...does the 'no tail-call optimizations ever' mean there's no point in doing functions like this: def fun(seq, sofar=0): ... this = seq.pop() return fun(seq, sofar+this) instead of like this: def fun(seq): ... this = seq.pop() return this + fun(seq) Moshe Zadka wrote: >*Every* Python function has a "return". Picture every function ending >with "return None". If it got there, it returns None. A function never >"falls off the end". Does this mean that besides sending a value back to the caller, return also says "We're done with this namespace/local scope/frame(?), go back to where we got called from," ? > >after-all-this-i'm-still-not-sure-what-the-question-was-ly y'rs > - tim > > > >-- >http://www.python.org/mailman/listinfo/python-list > Well, then here's the real question on my mind that I've been too embarassed to ask till now: Is there a Python version of this scheme function that has informative variable names so I can figure out what it does ? Or just - what does this do: (define Y (lambda (le) ((lambda (f) (f f)) (lambda (f) (le (lambda (x) ((f f) x))))))) ? y'rs ly-unpythonic Felix- From dworkin at ccs.neu.edu Wed Feb 9 13:02:14 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 09 Feb 2000 13:02:14 -0500 Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> Message-ID: "Stidolph, David" writes: > Why not just use the max method? > > a = max(x,y) Well, the original poster's question was for something equivalent to their use of C's ?: ternary operator. max() is not equivalent to that. I have never personally seen a situation where I thought that an expression like (x > y and [x] or [y])[0] was really needed or even a good idea in a Python program. -Justin From effbot at telia.com Thu Feb 17 17:14:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 22:14:01 GMT Subject: Where is Imaging.h? References: Message-ID: Bernhard Herzog wrote: > I think this is a good opportunity to suggest that extension modules > that users may want to access at the C-level install the relevant header > files somewhere under Python's standard include directory. I propose to > put them into an "extensions" subdirectory. patches are welcome (send them to image-sig at python.org). (if you've already mailed me patches for this, please send them again!). From effbot at telia.com Sat Feb 12 04:52:27 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 09:52:27 GMT Subject: Python sucks loud References: Message-ID: Samuel A. Falvo II wrote: > Wait a minute. You come into this newsgroup on your high horse, touting > that Python sucks eggs because of this and that for the sole reason you > don't understand the language, and you have the nerve to call *ME* a pompous > ass? Who the fsck do you think you are? he knows exactly who he is. why else do you think he needs to behave like this to get any- one to listen to him, if only for a split second? From tim_one at email.msn.com Sat Feb 26 03:08:28 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 03:08:28 -0500 Subject: functional programming In-Reply-To: Message-ID: <000901bf8030$a9e97c60$3c2d153f@tim> [posted and mailed] [Tim] > It's tail-call *optimization* that's un-Pythonic, as it's a gimmick > supported by only a handful of widely unused <0.5 wink> languages > and surprising to people coming from anything else: damaging > tracebacks would be Major Badness, much worse than the gain for the > relative thimbleful of people who are uncomfortable coding loops > etc. [Denys Duchier] > Tim's opinion notwithstanding, it seems to me that the only technical > reason why tail call optimization _cannot_ (at least not easily) be > supported by python Note that I didn't give a technical reason: my point is entirely about pragmatics. The introduction of TCO (tail-call opts) to a language that doesn't have them necessarily involves tradeoffs. Python isn't a blank slate anymore. > has to do with destructors for local objects. The expectation is that > an object created locally and assigned to a local variable has a > dynamic extent that coincides with execution in its scope. The timely > finalization achieved by reference counting means that its destructor is > invoked precisely when the scope is exited. This applies much more to C++ than to Python. Python doesn't define anything about the lifetime of objects. JPython doesn't even execute __del__ methods. CPython usually acts as you describe here, but it's not guaranteed, and it's possible for a CPython stack frame to outlive the function invocation that created it (the way that burns every C++ programmer at least once in CPython is when an uncaught exception passes thru the function, so that a reference to the stack frame lives on in the traceback object: locals can live "forever" then, while C++ guarantees to destruct autos (in a defined order, even!) in its version of this). > Tail call optimization would have to invoke it when the tail call is > made. Well, since the behavior you're trying to preserve is an implementation accident, Guido wouldn't feel compelled to preserve it. There's simply no killer *technical* reason to avoid TCO in Python (although the implementation would have to be cleverer than others have sketched, to avoid e.g. treating what "looks like" a tail call as such in the try block of a try/finally structure). > I cannot help but add that the derogatory comment concerning tail call > optimization My assertion that TCO is a bad idea for Python doesn't condemn it in general; to the contrary, TCO is *essential* in other languages I use. Python isn't those languages. > is not only shortsighted, Actually, it's hindsighted : I gave up fighting "jewel-like language" battles over a decade ago. If TCO hasn't taken over the world by now, it's never going to. Ditto Lisp, Scheme, Haskell, etc. Doesn't mean I don't love 'em; does mean I "had enough" of pouring energy into futile quests. The good news is that Oz still has a chance . > but also fallacious as it rests entirely on proof by popularity according > to which we should all eat shit, since 50 trillion flies can't all be wrong. I didn't know that flies relied on tracebacks to figure out why their shitpile isn't where they expected to find it . otoh-6-billion-people-eat-food-and-i-doubt-any-of-them-are-wrong-ly y'rs - tim From embed at geocities.com Tue Feb 8 09:00:31 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 8 Feb 2000 09:00:31 -0500 Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> Message-ID: "Fredrik Lundh" wrote in message news:Usan4.94$EGn.169930240 at newsa.telia.net... > Chadha, Saurabh wrote: > > Can anybody mail be a postscript of the Tkinter manual, the one on > > the python.org site, i am not able to print it because of some CS8 missing > > error from acroread. > > get acrobat 4.0 and those problems will go away: > http://www.adobe.com/products/acrobat/readstep.html I have Acrobat 4.0 and it prints all the python manuals as a bunch of accented vowels (a,e,i,o,u) plus typographic symbols and dingbats. :-( Warren From tim_one at email.msn.com Fri Feb 4 02:36:24 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 4 Feb 2000 02:36:24 -0500 Subject: Execfile() - bug / strange behavior In-Reply-To: <1262487880-7601658@hypernet.com> Message-ID: <001001bf6ee2$8a5edc00$a2a0143f@tim> {Amit Patel] > I'm trying to understand why execfile(fn) is different from exec > open(fn,'r').read(). Here's my program: > > def timbot(): > a = 3 > execfile("1.txt") > print a > print locals() > timbot() > > > Then I have 1.txt: > a = 5 > b = 8 > > When I run this, I expect to see a is 5, but I get: > > 3 > {'b': 8, 'a': 3} > > I don't understand why variable a is not set, but b is! Even > stranger, when I try to print b from timbot(), it gives me NameError, > even though it's in locals()! > > When I change execfile("1.txt") to exec open("1.txt",'r').read(), it > works just fine! > ... This may (or may not) be related to a long-standing bug recently fixed; try the latest CVS version of Python. The reason I suspect this is that exec compile(open("1.txt").read(), "", "exec") # line 666 works exactly the same way (in this case) as your execfile version (and not the same way as your exec version), and this one is due to a legit bug in the way "exec" deals with compiled code objects (as opposed to strings). And line 666 is *almost* faking "by hand" what execfile does by magic. OTOH, Gordon is also right that while the presence of the exec *stmt* causes Python to disable local-vrbl optimizations, the presence of the mere builtin "execfile" function does not. You can't actually get the timbot interested in pursuing this, since it never uses these things without explicity naming the dicts it wants used as execution context. if-you-play-with-fire-expect-a-good-time-ly y'rs - tim From ke at suse.de Mon Feb 14 05:32:25 2000 From: ke at suse.de (Karl Eichwalder) Date: 14 Feb 2000 11:32:25 +0100 Subject: small python implementation or python subset ? In-Reply-To: =?iso-8859-1?q?Fran=E7ois?= Pinard's message of "10 Feb 2000 08:21:05 -0500" References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> <38A282D0.2487CA89@sxb.bsf.alcatel.fr> Message-ID: Fran?ois Pinard writes: | I just checked on the SuSE 6.2 system, here: [...] | Does someone know why Python is installed unstripped? I promised to ask our maintainer. I'm back -- it's a bug, fortunately, a minor one. I'm told, next time /usr/bin/python will be shipped stipped. -- work : ke at suse.de Karl Eichwalder home : ke at gnu.franken.de From mikael at isy.liu.se Tue Feb 15 08:30:42 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 15 Feb 2000 14:30:42 +0100 (MET) Subject: Off Topic Posts In-Reply-To: <38b01f76.4257932@news.demon.co.uk> Message-ID: On 15-Feb-00 Andy Robinson wrote: > Years back, I subscribed to comp.sys.next.programming, > comp.sys.next./software, and comp.sys.next.advocacy. It worked really > well. The 'advocacy' group was the place for flame wars, defending > the honor of our superior engineering solutions, and general chat.; > the 'programming' and 'software' groups had specific enough titles to > be unlikely to atrract flames. I've suggested this split a few times > in the last five years and don't know why people want to keep it in > one group. > > But there's no point starting the official newsgroups creation > procedure if only two of us feel this way. I could do without the flame wars. During the last three months the number of posts have steadily increased from ~500 posts a week with very few inflammatory posts to ~1000 posts a week with a significant part being inflammatory. The last week there were ~150 post that I consider being part of flame wars (whitespace, brackets, python sucks, and related). I admit, I have posted a handful of these. Of course I can filter them out, but I refuse to make new filters every day just to cope with digital bullshit. And what if I the increase continues? I say split, maybe even to more than two groups. Or perhaps, make it moderated. /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: 15-Feb-00 Time: 14:05:20 This message was sent by XF-Mail. ----------------------------------------------------------------------- From bparsia at email.unc.edu Sun Feb 13 15:04:13 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Sun, 13 Feb 2000 15:04:13 -0500 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> <1e5wxbt.bq9v2nqzwbxuN%bparsia@email.unc.edu> <886t16$kbp$1@nntp6.atl.mindspring.net> Message-ID: <1e5y4b1.iu8l5x176fpxxN%bparsia@email.unc.edu> Aahz Maruch wrote: > In article <1e5wxbt.bq9v2nqzwbxuN%bparsia at email.unc.edu>, > Bijan Parsia wrote: > > > >Here's are some whimper inducing things for me: > > No class methods > > No super > > Yeah, I've been able to work around these, but they're somewhat > annoying. Note that I believe that Smalltalk has only single > inheritance, Yep. > so adopting super may be a bit difficult in Python. Ooo, good point. Except Smalltalk *has had* multiple inheritence, and, indeed, you can add it pretty easily. I don't know how they handled super, though. Interesting question. Cheers, Bijan Parsia. From just at letterror.com Sun Feb 13 17:20:20 2000 From: just at letterror.com (Just van Rossum) Date: Sun, 13 Feb 2000 23:20:20 +0100 Subject: Please do not Bcc: ListServers In-Reply-To: <4D0A23B3F74DD111ACCD00805F31D8101D8BCD03@RED-MSG-50> Message-ID: At 2:03 PM -0800 13-02-2000, Bill Tutt wrote: >Actually the more likely cause of this problem is a tiny buglet in Mailman's >Usenet gateway code. You *could* also have filtered using the "Sender:" header... Seems easier than "fixing" MailMan, but probably less fun ;-) Just From paul at prescod.net Thu Feb 3 15:55:22 2000 From: paul at prescod.net (Paul Prescod) Date: Thu, 03 Feb 2000 12:55:22 -0800 Subject: Ann: PMZ - Poor Man's Zope References: Message-ID: <3899EB3A.F72972FA@prescod.net> Does it makes sense for there to be PMZ, DTML (two variants!), Python in ASP and Python Server Pages? Is there a need for a new python-in-html-sig to standardize this stuff? It's none of my busiess since I don't use any of them but it must be awfully confusing for people who just want to do ASP-like stuff in Python. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From a.eyre at optichrome.com Tue Feb 22 10:41:32 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 22 Feb 2000 15:41:32 -0000 Subject: Call for Patch for Borland compiler In-Reply-To: <46xs4.10497$Jz3.75868@nnrp1.uunet.ca> Message-ID: <002301bf7d4b$4b054900$3acbd9c2@peridot.optichrome.com> > I already have BC++ 5.5 installed on my hard drive. See if it comes with a 'diff' proglet. If so, try "diff -c file1 file2" ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From gmcm at hypernet.com Fri Feb 18 19:05:44 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 19:05:44 -0500 Subject: static class methods in Python? In-Reply-To: Message-ID: <1261203750-1298607@hypernet.com> Neel asks: > Gordon McMillan wrote: > > Greg Wilson asks: > > > Have there been any proposals to add the equivalent of "static" > > > methods (belonging to the class, not to instances) to Python? > > > > The complaints vastly outnumber the proposals. > > > > The most common complaint is the lack of C++ style static > > methods. These are usually greeted with hordes of ugly > > workarounds. > > This is probably a stupid question, but what /is/ a class method? > I've never programmed in C++ (or Java), so an explanation would > be appreciated. A plain old function accessed through the class object. (Amazing what people will get excited about, isn't it?). - Gordon From aahz at netcom.com Sun Feb 13 13:26:46 2000 From: aahz at netcom.com (Aahz Maruch) Date: 13 Feb 2000 18:26:46 GMT Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <86ya8szq90.fsf@g.local> <1e5wxbt.bq9v2nqzwbxuN%bparsia@email.unc.edu> Message-ID: <886t16$kbp$1@nntp6.atl.mindspring.net> In article <1e5wxbt.bq9v2nqzwbxuN%bparsia at email.unc.edu>, Bijan Parsia wrote: > >Here's are some whimper inducing things for me: > No class methods > No super Yeah, I've been able to work around these, but they're somewhat annoying. Note that I believe that Smalltalk has only single inheritance, so adopting super may be a bit difficult in Python. -- --- 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 Have you coined a word today? From cpatti at black-racer.atg.com Fri Feb 4 12:50:56 2000 From: cpatti at black-racer.atg.com (chris patti) Date: 04 Feb 2000 12:50:56 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) In-Reply-To: Skip Montanaro's message of "Fri, 4 Feb 2000 11:55:11 -0600 (CST)" References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <14491.4735.38605.328866@beluga.mojam.com> Message-ID: Skip Montanaro writes: > chris> One of the reasons for CPAN's success in the Perl world is that, > chris> simply, it's an FTP archive. > > chris> Thus, people can and do mirror it. This creates a multi-site, > chris> persistent cache of the entire library, so when the one site where > chris> module Frobnitz.pm comes from goes down, the world doesn't suffer. > > Why couldn't a CPAN-like thing be a web site? Web sites can (and are) > mirrored all the time. > There's no reason why it couldn't be, actually. -Chris -- ------------------------------------------------------------------ Chris Patti| \ Art Technology Group||617-386-1649 \ cpatti at atg.com ------------------------------------------------------------------ From tbryan at python.net Fri Feb 18 23:19:20 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Fri, 18 Feb 2000 23:19:20 -0500 Subject: python online help? References: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov> Message-ID: <38AE19C8.A9C88903@python.net> Benyang Tang wrote: > > Is there a online help in python? Say something like > help print > would give document of the print command. Docstrings. Not all classes/modules/methods have them, but many do. For example, >>> import string >>> print string.__doc__ Common string manipulations. Public module variables: whitespace -- a string containing all characters considered whitespace lowercase -- a string containing all characters considered lowercase letters uppercase -- a string containing all characters considered uppercase letters letters -- a string containing all characters considered letters digits -- a string containing all characters considered decimal digits hexdigits -- a string containing all characters considered hexadecimal digits octdigits -- a string containing all characters considered octal digits >>> print string.find.__doc__ find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. >>> When you write your own code, you can include docstrings too: >>> class Foo: ... """A class docstring""" ... def bar(self): ... """A method docstring""" ... pass ... >>> print Foo.__doc__ A class docstring >>> f = Foo() >>> print f.bar.__doc__ A method docstring ---Tom From arcege at shore.net Thu Feb 3 12:31:39 2000 From: arcege at shore.net (Michael P. Reilly) Date: Thu, 03 Feb 2000 17:31:39 GMT Subject: Why Perl do But Python can't? References: <200001310128.UAA02858@poverty.bloomington.in.us> <8737c1$76d$1@news.cz.js.cn> <058AFBA1CD7F1621.791F88D00D532EC1.0128BF9429776D7B@lp.airnews.net> <750C7510A79887C5.2162AE658A51222E.BD04094EB7C2B6E8@lp.airnews.net> Message-ID: <%Xim4.38$TQ1.10052@news.shore.net> Cameron Laird wrote: : In article <058AFBA1CD7F1621.791F88D00D532EC1.0128BF9429776D7B at lp.airnews.net>, : I remarked: :>In article <8737c1$76d$1 at news.cz.js.cn>, XXXX wrote: : ^I^I^I. : ^I^I^I. : ^I^I^I. :>>2:use expect mod ,but python dosn't have. :>> :>>is there better solution? :>^I^I^I. :>^I^I^I. :>^I^I^I. :>As best I can understand, :> use expect mod ,but python dosn't have. :>refers to Expect.pm, and has no particular relation to :>WWW, suid, sgid, or other elements of this post. :> :>In fact Python does have analogues to Expect.pm. The :>little research I've done indicates that they're not :>well-researched. I've been considering writing up a : ^I^I^I. : ^I^I^I. : ^I^I^I. : I made two errors in what I sent before. The sentence immedi- : ately above should have read : ... they're not well-maintained. : Moreover, I hiccoughed, and left out a paragraph on the module : that addresses this domain and *is* well-maintained: telnetlib : : I apologize for the confusion. If we are talking about Expect-like functionality, then you are missing the "pty" standard module and ExpectPy. ExpectPy is maintained; it is available at The expy module is more than five years old. -Arcege From mhammond at skippinet.com.au Fri Feb 4 18:26:01 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 04 Feb 2000 23:26:01 GMT Subject: Mark Hammond & David Ascher, ActiveState, Python world domination References: <002701bf6e7c$dbb7d040$c355cfc0@ski.org> Message-ID: "David Ascher" wrote in message news:002701bf6e7c$dbb7d040$c355cfc0 at ski.org... [David's well thought out announcement snipped] > What does this mean for Mark Hammond, PyWin32, Pythonwin, etc? Well, I > won't presume to speak for Mark, so I'll just let him write his own thoughts > on the topic. Damn. :-) I forsee no significant change in the win32 extensions. There is a good chance that the win32all extensions will end up being released via the www.ActiveState.com page, but there will be no change in the license. What may end up happening is that I have slightly less time to work on this stuff as other work gets in the way - but this is nothing new. For the rest of this year, I will almost certainly be working on some very interesting Python related work. Unfortunately, I am not free to discuss the nature of this work (this restriction is _not_ being imposed by Active State), but suffice it to say that Python programmers on Windows should be quite excited once this work is announced - details should be available around May of this year. As with David, I am quite excited by this opportunity. I see it as being an excellent move for Python. Over the last 5 years I have earnt good money by playing with these Python extensions, and thus had no pressing need to take on full-time employment. I see this Active State opportunity as being less of a win for me personally, and more of a win for Python. Having Active State behind some of this work means that I can focus more on the important issues, and less on the bull-sh*t that comes with working with these extensions - the Active State infrastructure is quite an appeal to me. The other huge appeal is the opportunity to work with David, and hopefully some other smart Pythonistas who will be lured into our little kitchen :-) I am very pleased to hear nothing but support for this move - thanks everyone for your responses! Mark. From evan at 4-am.com Fri Feb 11 10:25:00 2000 From: evan at 4-am.com (Evan Simpson) Date: Fri, 11 Feb 2000 09:25:00 -0600 Subject: What does str(...) do? References: <38A41077.9BDAE248@aston.ac.uk> Message-ID: Peter Bittner wrote in message news:38A41077.9BDAE248 at aston.ac.uk... > I've seen > > print '....' + str(text) + '...' > > in some code (in a function definition). > What does this 'str(...)' really do? - Is it absolutely necessary?? It's probably there because the author wasn't sure they could count on 'text' being a string, despite its name, so they force it to be one. Whether that's a valid way to deal with the situation is entirely context-dependent. Cheers, Evan @ 4-am From gmcm at hypernet.com Fri Feb 18 20:25:23 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 20:25:23 -0500 Subject: creating a python excutable In-Reply-To: <01bf7a65$9e487ee0$033abcc3@indiana.pro-net.co.uk> Message-ID: <1261198971-1586035@hypernet.com> Jason Cunliffe wrote: > > A friend needs to develpo a project where he can have end up with a simple > executable - double click and run . > I have been in gerneral enthusaitically promoting Python for the work he is > doing, but could not answer his question to clearly describe how to make a > simple excutable [win32] from his code. > > He is new to Python and under the impression it is not very easily doable. > > I am sure it can be done, but need some help [first for myself and then for > him how to do this]. > Apologies if this is a FAQ, but I am really looking for a 1.2.3 type > tutoral on this paricualr issuea nd could not find http://starship.python.net/crew/gmcm/distribute.html - Gordon From ivanlan at callware.com Thu Feb 17 12:32:29 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 17 Feb 2000 10:32:29 -0700 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <20000217161727.A1183@stopcontact.palga.uucp> <14508.12208.365515.624845@weyr.cnri.reston.va.us> Message-ID: <38AC30AD.4339B883@callware.com> Hi All-- "Fred L. Drake, Jr." wrote: > > Gerrit Holl writes: > > I think we really should create an extensive list with all available > > GUI's, with all advantages and disadvantages and a table with info > > like crossplatformness, learning curve... > > I think we can link to it from python.org when you have it ready; > send a note to python-docs at python.org with the URL. > Isn't the volunteerism in this community great? ;) > Oh, indeed it is. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 effbot at telia.com Tue Feb 22 13:48:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 18:48:34 GMT Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <000401bf7d07$59acc080$e82d153f@tim> <38B2D49C.F18B47CC@roguewave.com> Message-ID: <6SAs4.640$mYj.190014976@newsa.telia.net> bjorn wrote: > I must respectfully disagree. When doing OO design, the fundamental question > is "if I want to do 'foo', to what am I doing 'foo'?"... In this case "if I > want to 'join', what am I 'joining'?", the answer is that you're joining a > sequence type. Thus, IMHO it the natural (and extensible to user types) way > to do it would be: > > [1,2,3].join() > (1,2,3).join(' ') umm. you seem to be missing a few things: -- python 1.6 will have *two* different string types. -- python 1.6 will have lots of sequence types (at least one more than 1.5.2!) -- while join can be *defined* as a series of concatenations, *implementing* things that way doesn't work in real life. do you really think that *all* sequence objects should know how to join all possible string types in an efficient way? or is that better left to the string implementation? -- there is no common base class for sequence objects. still convinced that all sequence containers should be required to know how to concatenate strings? > if you think of another domain, say a gui with a textarea this might become > clearer. Nobody would want to write: > > "foo bar".put(textarea) read the list of issues again. still think this is a great example? > Besides has anyone even considered " ".join(myUserListDerivedClass)? > How about " ".join(myTreeThatHasLinear__getitem__)? if you mean what I think you mean, this already works in 1.5.2 btw, string.join(sequence, separator) won't go away. (it'll call separator.join to do the work, but that's just an implementation detail ;-) From loewis at informatik.hu-berlin.de Fri Feb 25 14:05:32 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 25 Feb 2000 20:05:32 +0100 Subject: Life's better without builtins? (was: Life's better without braces) References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> <38B691AD.BDB4DD5F@endea.demon.nl> Message-ID: Niels Diepeveen writes: > I think you're a bit pessimistic there. For example: > > _interns = {} > > def intern(s): > try: > return _interns[s] > except KeyError: > _interns[s] = s > return s That doesn't work: >>> x="foo" >>> x is "fo"+"o" 0 >>> x is intern("fo"+"o") 1 won't work with your version of intern. Regards, Martin From effbot at telia.com Thu Feb 17 13:25:12 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 18:25:12 GMT Subject: two questions References: Message-ID: Brett Tribble wrote: > 1. Is anyone working on a version of Python for Mac OS X? according to people who've tried, Python 1.5.2 builds right out of the box. that probably doesn't include X window stuff like Tkinter, though... From greene at hctc.com Sat Feb 26 13:31:29 2000 From: greene at hctc.com (Collin Greene) Date: Sat, 26 Feb 2000 11:31:29 -0700 Subject: so how do I run this thing?!!!! Message-ID: thanks for all you help everyone, I know how to basicially use Python now but I don't really understand it seems as if there should be a way to run what you have written. I have tried the run command but it just showns me what i just wrote. Is there a place to actuially see waht you have witten? thanks greene at hctc.com From sholden at bellatlantic.net Thu Feb 3 09:41:42 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 03 Feb 2000 14:41:42 GMT Subject: Choosing a language References: <5650A1190E4FD111BC7E0000F8034D26A0F2A3@huina.oceanic.com> Message-ID: <389993BE.4E1C297C@bellatlantic.net> Michael Zawrotny wrote: > [snip] > My advice is that after you get comfortable with Python and start in > on C or one of its derivatives (C++, Java, etc.), pick up and read > Kernighan and Ritchie's "The Practice of Programming". It is IMO > one of, if not the best, general programming books I've ever read. > There is multiple language coverage of nearly the entire process > program development. Others may disagree, but I think it is a great > book. > > Mike > > -- > Michael Zawrotny > 411 Molecular Biophysics Building > Florida State University | email: zawrotny at sb.fsu.edu > Tallahassee, FL 32306-4380 | phone: (850) 644-0069 If it's still in print, Kernigan and Plauger's "Elements of Programing Style" is also a gem. Full of great advice like "First make it work, THEN make it work faster" -- a lot of it's head smackingly obvious -- *after* you've read it. regards Steve From moshez at math.huji.ac.il Fri Feb 11 16:14:34 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 23:14:34 +0200 (IST) Subject: How do you undo x = `a` if A is a list? In-Reply-To: Message-ID: On Fri, 11 Feb 2000, Trent Mick wrote: > > Now how do I read that line in from a file and convert it from a > > string to a > > list? > > Here is one way. Save your variable in the proper format to a Python module. > Don't know if I would recommend it. As Skip et al. suggest, eval() and its > kin are probably better. One reason to do what you suggest is to use a pre-calculated table. for example def primes(n): # generate a list of all primes less then n pass a = primes(10000) f = open("primes.py", 'w') f.write("a="+`a`) f.close() ========================= Then do "import primes" whenever you want a list of the primes less then 10000. It is *extremely* fast after the first time: it uses Python's "marshal", which is heavily optimized. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tony at lsl.co.uk Thu Feb 10 03:57:53 2000 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 10 Feb 2000 08:57:53 -0000 Subject: [Doc-SIG] Monty: A structured text syntax idea In-Reply-To: Message-ID: <000d01bf73a4$ea589d50$f0c809c0@lslp7o.lsl.co.uk> Karl EICHWALDER wrote, on 10 February 2000 07:19: > Verbosity isn't bad per se :) <> Well, actually, in the argument about "verbose" markup, I was on the "let's use TeX/HTML/XML/SGML" side - that is, I quite *like* 'proper' markup languages (heh, I've been know to use TeX for fun). But I've had to accept that *lots* of people don't. It seems to me that the idea of "short" markup for doc strings (acceptable to most people, close to conventions used in email fairly naturally, etc.) and "proper" markup in the actual documentation is a GOOD plan (much praise to Frank) - but I had to be convinced about that first part. It's just the convincing mostly happened in the last round of arguments about this, some while back... (One of the (minor) problems with a SIG like this which has been going a while with long quiet spans is that sometimes one forgets that not everyone was around for earlier parts of the discussion. Sorry.) Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.demon.co.uk/ "How fleeting are all human passions compared with the massive continuity of ducks." - Dorothy L. Sayers, "Gaudy Night" My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From pbible at home.com Thu Feb 10 21:06:18 2000 From: pbible at home.com (Paul E. Bible) Date: Fri, 11 Feb 2000 02:06:18 GMT Subject: PythonWin 2.0 Message-ID: Where can I find PythonWin 2.0. If I have to join a group, could you please tell me which group. Thanks in advance, Paul From boud at rempt.xs4all.nl Sun Feb 20 11:30:23 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 20 Feb 2000 16:30:23 GMT Subject: Which GUI? References: Message-ID: <88p4qv$dk3$1@news1.xs4all.nl> Moshe Zadka wrote: <...> >> What about pyQT? > QT isn't free on Win32. Thus, portable free programs cannot use PyQT. > On the other hand, portable free programs cannot use PyGTK either, but > GTK does run on Win32, so it's only a matter of interest, I suppose. Well, if you take the Qt license at literal value, it is possible to fork out for a Qt Win32 dev license, create an app and distribute that app with the Qt dll. So, it's possible for someone to buy Qt for Windows, compile and distribute PyQt for Windows to people who don't have a developers license for Qt for Windows. (I'm not interested - the most interesting part of PyQt/PyKDE for me is the KDE part - because of desktop integration and so on. Besides, I need the money for a new monitor.) >> I think I'll make another point 'can be subclassed' in my comparison. > Why? In Python, subclassing is much less important then in other OO > languages. For example, while widgets in Tkinter can be subclassed, the > official effbotic advice is not to do so (and, I must say, I agree). > Not to mention that Tkinter is built on _tkinter, whose widgets cannot > be subclassed, so here is another point to the pointlessness of the > subclass-ability. I _do_ like subclassing widgets. It's one of the strengths of PyQt/KDE, too. Besides, the way the tkInter IDLE classbrowser treeitems are written looks a lot like widget subclassing to me... -- Boudewijn Rempt | http://www.valdyas.org From tismer at tismer.com Tue Feb 29 09:28:55 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 29 Feb 2000 15:28:55 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: <38BBD7A7.205B90BC@tismer.com> Hi, Why don't you ask Jean-Claude about this? I'm sure he can help you, and sure that he is happy to see Mk4py running on the Mac.. cheers - chris Arnaud Fontaine wrote: > ... > So, I need to re-compile the module from the sources. Hmmmm ..... but I > don't have CodeWarrior ... so ... > But that's another story. > > Do you know any way to check those version numbers ?? ... -- 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 scarblac-spamtrap at pino.selwerd.nl Mon Feb 21 20:35:42 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 22 Feb 2000 01:35:42 GMT Subject: where can i get python? any tips? a References: Message-ID: Collin Greene wrote in comp.lang.python: > I am looking python does anyone know where I can download it? also any > tips anyone would be willing to share would be greatly appreaciated. http://www.python.org Tip: read the "Documentation" sections completely. Learn about "search engines". -- Remco Gerlich, scarblac at pino.selwerd.nl Murphy's Rules, "You'll get a heck of a suntan, though...": When a large nuclear bomb explodes in Villains and Vigilantes (Fantasy Games Unlimited), it might do only four points of damage --- less than a punch in the nose. From dworkin at ccs.neu.edu Mon Feb 21 02:21:16 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 21 Feb 2000 02:21:16 -0500 Subject: name-spaces and loading a file In-Reply-To: Alex Shinn's message of "19 Feb 2000 15:37:20 -0500" References: <8766vn2ijn.fsf@curious.eyeofdog.com> <88mr39$7ne$1@news.udel.edu> <87zosx0vzz.fsf@curious.eyeofdog.com> Message-ID: Alex Shinn writes: > Can you pickle a function (I just tried and it didn't work, but I may > be missing something)? Yes, you can: >>> def testfun(a): ... print a ... >>> pickle.dump(testfun, open('/tmp/p1', 'w')) >>> test2 = pickle.load(open('/tmp/p1')) >>> test2('spam!') spam! > class Scene: > def __init__(self, game, name): > "Initialize a Scene from a file" > # Reference the parent game > self.game = game > # Load the scene and adjust the history > if game.history.has_key(name): > exec 'reload(scenes.'+name+')' > game.history[name] = game.history[name] + 1 > else: > scene = __import__('scenes.'+name) > game.history[name] = 1 > # Translate the module variables into class variables > exec 'vars = dir(scenes.'+name+')' > for v in vars: > if not v[0] == '_': > exec 'self.'+v+' = scenes.'+name+'.'+v Yikes. At the very least, you should get rid of all of that unecessary exec'ing. Here are some recommendations on basic cleanup, just to get rid of the things that you definitely want to lose. You can replace this line: > exec 'reload(scenes.'+name+')' with: reload(sys.modules['scenes.'+name]) Why are you doing this: > scene = __import__('scenes.'+name) if you never use the variable 'scene' again? Also, this will normally return the package 'scenes', not the module 'scenes.name'. If you wanted 'scenes.name' you should have done: scene = __import__('scenes.'+name, globals(), locals(), [name]) Read the documentation for '__import__()'. You can replace this section: > exec 'vars = dir(scenes.'+name+')' > for v in vars: > if not v[0] == '_': > exec 'self.'+v+' = scenes.'+name+'.'+v with: scene = sys.modules['scenes.'+name] for v in dir(scene): if not v[0] == '_': setattr(self, v, getattr(scene, v)) Note the pleasant lack of 'exec'. -Justin From gmcm at hypernet.com Mon Feb 28 21:13:59 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 28 Feb 2000 21:13:59 -0500 Subject: Is mxDateTime compatible with Installer In-Reply-To: <1260338722-27026465@hypernet.com> References: Message-ID: <1260332056-27427441@hypernet.com> [In response to Calishar's problem with Installer and mxDateTime, I wrote]: > There is a bug in beta3f. Which is true. But > Line 168 of MEInc.Dist.resource.py > reads: > if string.find(name, '.') == -1: > It should read: > if string.find(name, '.') != -1: was not. It's more complicated than that. I was attempting to fix "MySQL" (a .pyd) getting turned into "MYSQL", but unfortunately now "python15.dll" gets turned into "python15.dll.dll". Grrr. If it troubles you, remove the whole damn "if" block, and I'll figure out how to do it right one of these days... - Gordon From tim_one at email.msn.com Wed Feb 16 22:15:03 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 22:15:03 -0500 Subject: Can't reopen eMatter book In-Reply-To: <38ab2592.21957002@nntpserver.swip.net> Message-ID: <001101bf78f5$2f3227c0$dea0143f@tim> [posted & mailed] > I bought the 'Standard Python Library' eMatter book by mr Fredrik > Lundh. Everything worked fine except when I tried to open the book for > the second time. No I only get an error saying "An error occurred > while preparing to display this eMatter(c). Please try again. If you > continue to have problems, contact Fatbrain.com Costomer Service." > ... > The only thing I did after closing the eMatter book and trying to > reopen it was to upgrade Adobe Acrobat to version 4 Same here, in all respects except the specific error msg. So the following may not work for you. On my system, the problem crops over & over & over again, seemingly every time *any* change is made to a broad area of the Windows registry (upgrading Acrobat is but one of many triggers). They claim this problem is rare, but if you have a system it happens on, there isn't yet any permanent fix. Here's what I got from Fatbrain support. Worth a try, anyway: Step 1. go to start -> run and type in regedit Step 2. when it opens, look through the tree of directories to get to my computer -> hkey_current_user -> software -> fatbrain.com Step 3. delete the fatbrain folder Step 4. run the ematter registration client again (it will ask you for a license key again) Step 0 is missing: editing the registry is fraught with dangers, so proceed with extreme care. It's easy to get sloppy the twelfth time you need to do it, so never skip step 0 . Step 2 should not say "my computer -> ". The rest is correct. To accomplish Step 3, click once on the "Fatbrain.com" folder in the left pane, to select it. Then do Edit -> Delete (or hit your "delete" key). Click OK on the confirmation box that pops up, first making sure that Fatbrain.com is indeed the item selected. Step 3.5 is missing: close regedit. You never want to keep regedit open any longer than necessary. Step 4: "run the ematter registration client again" is something that happens automatically when you simply try to open the eMatter book again. Step 5 is missing: Enjoy! It's a great book. Never close it or reboot your computer, lest you need to go thru this again . it's-not-/f's-fault-but-we-should-be-mad-at-him-anyway-ly y'rs - tim From meowing at banet.net Fri Feb 11 07:50:16 2000 From: meowing at banet.net (greg andruk) Date: Fri, 11 Feb 2000 07:50:16 -0500 (EST) Subject: Off Topic Posts In-Reply-To: Message-ID: On Fri, 11 Feb 2000, Gene Chiaramonte wrote: > All good points. I have several filters in place already, but many messages > still slip through. Right, a killfile on the Usenet side is going to be of limited value because there is a stream of new people bringing up the same old tired arguments. On the mailing list side, it's easier for procmail to find the offending topics in the message bodies, but even that is prone to missing unwanted material and squelching things worth reading. > I am suggesting that python-list be split into 2 lists. One for specific > python programming questions, and another list for python language opinions > and comments. I'm not sure it would help too much to split the list side. The random noise tends to slip in on the Usenet side, and so an addition on that end (say, comp.lang.python.advocacy) might (or might not) make sense. I say might not make sense, because *.advocacy groups seem to work best when a language or operating system's own community has a heavy contingent of evangelists who will sustain it. I don't see very much overt Python evangelism around here, more that there are some strong defenders/apologists who chime in when evangelism from elsewhere appears. To put it another way, an *.advocacy group would only be successful if there was strong agreement among the Python community that all such arguments should be dragged off there [and that there ramains a good understanding of the difference between "productive" language comparisons and mine-is-better-than-yours], and that members of the Python community would want to participate in such a group. It won't work if it's merely a dumping ground analogous to alt.dev.null. Also, the list/newsgroup gateway would make activities like setting followups/reply-to the other forum a bit awkward. Not sure how important that would be in practice, but it shouldn't be ignored. From tim_one at email.msn.com Sun Feb 20 17:54:55 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 17:54:55 -0500 Subject: Int methods (was RE: string.py) Message-ID: [Moshe Zadka] > I think Gerrit is on to something. How about....(drum roll)...int > methods? More than a year ago, I got Guido's OK to add some methods to longs -- there are a pile of things (like "how many bits does this long consume?") wrt longs that are intolerably inefficient to compute in Python, but for years nothing got done about that partly because we didn't want to bloat the builtins with specialty functions. Now nothing gets done about that entirely because nobody has time to do it <0.3 wink>. > ... > I see there might be parser problems, but maybe (5).radix? Python seems > willing to check for it: > > >>> a = (5).radix(2) > Traceback (innermost last): > File "", line 1, in ? > AttributeError: 'int' object has no attribute 'radix' The parser has trouble with 5.radix because "maximal munch" lexing sucks up "5." as a float. Note this cute one, though: >>> 5..radix Traceback (innermost last): File "", line 1, in ? 5..radix AttributeError: 'float' object has no attribute 'radix' >>> That is, that's already parsed as (5.).float. There's little reason to apply methods to numeric literals, though, and wrapping in parens is always sufficient. Note too: >>> (sys).stdin >>> That may look strange at first, but the LHS of an attribute fetch can already be any expression whatsoever. no-problems-here-except-time-ly y'rs - tim From scarblac-spamtrap at pino.selwerd.nl Fri Feb 25 03:28:30 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 25 Feb 2000 08:28:30 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: Remco Gerlich should have written: > A = [] > while 1: > line = H.readline() > if not line: > break > if line != '\n': > A.append(line) Bad editor! Bad bad bad! (whitespace was wrong - never edit Python in an editor that thinks it's editing Text...) -- Remco Gerlich, scarblac at pino.selwerd.nl 9:23am up 93 days, 15:27, 7 users, load average: 0.09, 0.05, 0.07 From J.C.Travers at durham.ac.uk Thu Feb 17 10:37:33 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Thu, 17 Feb 2000 15:37:33 +0000 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: <38AC15BD.E2DF7743@durham.ac.uk> Fran?ois Pinard wrote: > > "J.C.Travers" writes: > > Anders M Eriksson wrote: > > > > I would like pro and cons for the different GUI's > > > This is a hot topic, and you will get as many different answers as > > people you ask, so all I can give is my personal opinion. > > > Firstly, I would advise against Tkinter. [...] The best GUI in my opinion > > is pyQT. [...] Alternatively there is wxPython. [...] > > I notice that you forgot to mention `pygtk'. Couldn't we say that it is > comparable to pyQT, more or less? Yes pyGTK looks similar, however I have never used it, so wouldn't qualify myself to comment on it. But it does lack the advantage of having an object-orientated foundation. (I mean programming GTK in C is a nightmare compared to QT in C++ !!!) Cheers, John. From skip at mojam.com Fri Feb 18 11:55:02 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 18 Feb 2000 10:55:02 -0600 (CST) Subject: Killer Apps??? In-Reply-To: References: Message-ID: <14509.31078.932335.402705@beluga.mojam.com> Nick> I was wondering if there were any other such killer apps? Well, there's Mailman (http://www.lists.org/), Medusa (http://www.nightmare.com/medusa, upon which Zope's web/ftp service is based) and for those quiet, reflective moments, there's PySol (http://pysol.tsx.org/). Strange you should ask. I mentioned to Barry Warsaw a couple days ago that a "killer apps" section of the PSA web site would be interesting. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From aahz at netcom.com Fri Feb 18 00:49:33 2000 From: aahz at netcom.com (Aahz Maruch) Date: 18 Feb 2000 05:49:33 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: <001601bf7853$6b03e7e0$b7a0143f@tim> <38AC5FCA.75F4EA42@prescod.net> <88hu7j$kqc$1@nntp6.atl.mindspring.net> <38ACA6EE.90D582DF@prescod.net> Message-ID: <88imhd$f97$1@nntp6.atl.mindspring.net> In article <38ACA6EE.90D582DF at prescod.net>, Paul Prescod wrote: >Aahz Maruch wrote: >> >> Assuming that I've understood everything you've said about >> continuations, I think I also understand what Tim meant about modeling >> threads with continuations and vice-versa. Seems to me that one could >> easily implement continuations with a process that forks off and blocks >> waiting for one of two signals: resume or die. (When a process forks, >> both processes have almost exactly the same state, right?) > >Okay, but how is implementing threading via fork() using continuations? >The underlying OS task switcher is doing all of the work, not the >language's continuation feature. No, no, I meant that one could implement continuations using fork() and IPC. It should therefore be possible to implement continuations using threads. And I think that's all the Timbot meant. >> [code deleted] >> Am I right? > >Well your version had some improvements but I think that they make more >clear the fact that the while loop is not useful. The continuations will >bounce back and forth forever by themselves. In this case they are very >much like "goto" in basic which probably explains why Common Lisp people >hate them. Uh-huh! I have to admit that I almost ripped out the while loop because it looked like it wasn't necessary, but it occurred to me that the semantic of a reference to an object returned by currentContinuation() could include advancing the PC in the current continuation frame. Which means that the initial call to producer really ought to look like: continuation producer() -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From gmcm at hypernet.com Fri Feb 4 11:44:05 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 4 Feb 2000 11:44:05 -0500 Subject: Special Interest Group: Import redesign Message-ID: <1262439853-442703@hypernet.com> As a result of the Developer's Day session on Import Uitilities, a new SIG (the import-SIG) has been formed. The goal is a new architecture for the import facility in Python. If you write import hooks, want to write import hooks, have trouble with import hooks that others have written, or just have a perverse fascination with this arcane area, you are encouraged to join. The home page is: http://www.python.org/sigs/import-sig/ Subscribe at: http://www.python.org/mailman/listinfo/import-sig View the archives at: http://www.python.org/pipermail/import-sig/ - Gordon From moshez at math.huji.ac.il Sat Feb 26 05:32:23 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 12:32:23 +0200 (IST) Subject: Q about tail recursion In-Reply-To: <3.0.5.32.20000226013755.0087a180@mail.dicksonstreet.com> Message-ID: On Sat, 26 Feb 2000, Felix Thibault wrote: > Does this mean that even though there are no return's in faketailadd's > add, the function still has to work its way back up from all those > recursive calls ? *Every* Python function has a "return". Picture every function ending with "return None". If it got there, it returns None. A function never "falls off the end". -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From teyc at bigfoot.com Tue Feb 8 06:02:09 2000 From: teyc at bigfoot.com (Chui Tey) Date: Tue, 8 Feb 2000 21:02:09 +1000 Subject: [Q] Pros and Cons of Python COM Servers Message-ID: <87rhdi$761$1@bunyip.cc.uq.edu.au> Hi, What is the difference in implementing Python COM servers using PythonCOM versus using Windows Scripting Components (if it is possible with Python). Thanks Chui From bparsia at email.unc.edu Wed Feb 9 20:51:07 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 20:51:07 -0500 Subject: Interoperable smalltalk implementation References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> <38A18D5F.7CE61061@prescod.net> <1e5qk7x.1oib1uavroxupN%bparsia@email.unc.edu> <38A1C39A.5FFFB809@prescod.net> Message-ID: <1e5r2n5.fm4k0pcrstz3N%bparsia@email.unc.edu> Paul Prescod wrote: > Bijan Parsia wrote: > > > > ... > > > > There are several excellent free (in various senses) Smalltalks. There > > are some Smalltalks that integrate better than others. Some people > > *want* a "single world" approach, and some smalltalks accomodate them. > > Okay, in this case I would be happy to be wrong. I would love to find > out that modern Smalltalks are more interoperable than the last time I > investigated. K. > Which implementation (and extension libraries) should I download to > write plain vanilla CGIs This seems a bit odd to have to post to a Python group, but . Since I don't do much CGIing (and what little I've done has been in Python ;)), I'm not sure I can give you really good advise. VisualWorks NC, in particular, the VisualWave extension, is designed to interface with external webservers, I believe, via CGI. While the primary interest of VisualWave is the "flippability" of the GUI (i.e., you can design a regular gui app and VW will turn it into an html site), there's no reason you can't use it to do simple CGIing. Indeed, I was playing with using the XSL support for just that, when I got sidetracked by WikiWorks, which is a webserver, itself, which is (the sort of thing) I mostly use and like to use. VisualAge's WebConnect is similar, AFAIK, though not free (you can "try before you buy"). Lots of excellent docs on IBM's site, though. Gnu Smalltalk is worth a shot as well. I don't *think* anybody's actually come up with a cgi interface for Squeak, though we do have a headless version, and an "embedded" version. OTOH, you might check out the "OSProcesses" goodie (on the Squeak Swiki) which allows Squeak to do all that crazy unix execing/forking/piping stuff ;) Smalltalk MT and Smalltalk/X don't have any free versions (to my knowledge) but might do better for this (Smalltalk/X has a demo version, but is *very* interesting as it has a Java VM as well, XML support, and lots of other cool things). > and which should I get to write GUI Windows > programs? Visualworks, though since the widgets are emulated, it might be unpalatable. Visualage. Smalltalk MT. Smalltalk/X. (I assume you're keeping track of the non-free ones.) But the simplest solution is Dolphin Smalltalk. No GUI builder (to my knowledge) but very nice and simple. > I won't demand that they be the same implementation, but I > need good text processing (at least regexps) in both environments. Hmm. One thing is definitely true that Smalltalks tend not to go for regexps, though there is a pure Smalltalk regexp implementation available (standard goodie in VW). Dunno about Dolphin. Squeak has a wrapper for PCRE and it wouldn't be hard to make something similar for other implementations. I don't really like regexs, so I'm not hip to that. VisualWorks has a parser generator, and T-Gen is available for many versions. > I > would be very happy if the language dialects they supported was close > enough that an XML parser written in one would work in the other. It's certainly possible to write a portable XML parser. Some care would be needed, but nothing extraordinary. There are a variety of XML parsers available. Some open source. http://www.indelv.com/ has one for java and has ported it to smalltalk. I don't really get it though. There are 2 simple one's for Squeak (non-validating, about XML-RPC level--which reminds me, Comanche, Squeak's web server, has XML-RPC support) which would be trivial to port. Someone's working on using T-Gen to generate a parser from the XML EBNF grammar. I'm interested to see how that comes out. Personally, I find VisualWorks 5i parser to be very, very cool. Alas, there are some buggy bits (hoping 5i.1 fixes that) and little documentation, though I'm working on that. The XSL support is good for a range of things, though it has some holes. They're pretty nippy for small things, at least. All of VisualWork's help files are in XML. Some things haven't happened because there hasn't been sufficent demand for them. I prefer, personally, using Smaltalk web servers. I don't have to run Apache for anything, and it just simplifies things for me. I've enjoyed exploring them and learning a heck of lot about sockets and HTTP. If that's being isolated, so be it. Since for a new project, I want to use Squeak, but we'll probably do better with Apache as the web server, I'll probably figure out some sort of interface (perhaps CGI). If you put in interest, effort, or funding, you might be surprised what you get back from us "snots". Cheers, Bijan Parsia. From thantos at chancel.org Wed Feb 2 19:35:52 2000 From: thantos at chancel.org (Alexander Williams) Date: Thu, 03 Feb 2000 00:35:52 GMT Subject: Readable Functional Languages References: <87aerv$2d6$1@vvs.superst.iae.nl> Message-ID: On 3 Feb 2000 00:33:19 +0100, Carel Fellinger wrote: >Admittedly off topic, I would like some advice on what language to choose >to explore the realm of functional languages given that I can't cope with >'impure' languages like C, C++ and Perl and that I love Python mostly for >its readability and its adherence to the principle of least surprise that >lures me into thinking that it has no dark corners. You really have two /good/ choices: If you're a traditionalist and parens don't scare you, Scheme is a really good platform for exploring functional programming. Its not a 'pure' language, as such, but it can be programmed in a very pure style. If you're more daring, you can give Haskell a shake. It /is/ a pure functional language and, as such, has some wackiness around state and external IO, but it /definitely/ can do some interesting things if you start wrapping your head around it. Skaller, another member of our little coterie, has an affinity for OCaml, whose syntax is somewhat like Haskell, but I prefer Haskell for asthetic and other interface reasons. Thankfully, tastes differ. :) Happy hacking! -- Alexander Williams (thantos at gw.total-web.net) | In the End, "Join the secret struggle for the soul of the world." | Oblivion Nobilis, a new Kind of RPG | Always http://www.chancel.org | Wins From wlfraed at ix.netcom.com Fri Feb 25 01:25:27 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Thu, 24 Feb 2000 22:25:27 -0800 Subject: Phyththon misspelling contest References: Message-ID: On Thu, 24 Feb 2000 05:03:41 GMT, wware at world.std.com (Will Ware) declaimed the following in comp.lang.python: > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. Since so many think of snake... ASP, Cobra (no, too close to Corba) -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From no_spam_tdfunk at nettally.com_spam_sux Tue Feb 29 19:27:30 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Tue, 29 Feb 2000 19:27:30 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: <894ea9$h33$1@nnrp1.deja.com> <38B69655.DD9980F9@bellatlantic.net> Message-ID: Steve: In an article posted Fri, 25 Feb 2000 14:48:51 GMT, Steve Holden (sholden at bellatlantic.net) said: > As a matter of interest, is there any functional difference between > > <%@LANGUAGE=Python%> > > as used by John, and expected according to all ASP materials I have seen, and > > <#@Language=Python#> > > as used by tom in his original post? > > regards Uh... LOTS of difference! What I originally worte was *completely* incorrect.... Sorry. I wrote it wrong once and then copied the incorrect code all over my post. Thank you for the correction. -- -=< tom >=- Thomas D. Funk (tdfunk at asd-web.com) | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From tim_one at email.msn.com Sat Feb 12 23:26:23 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 12 Feb 2000 23:26:23 -0500 Subject: Fully Bracketed Syntax In-Reply-To: Message-ID: <000001bf75da$7c3c2520$962d153f@tim> [Dennis Lee Bieber] > ... > I don't mind the use of ";" so much as the inconsistent usage > of it... Most languages use it as a statement terminator, but then > you hit Pascal (and Python, I fear) where it is used as a statement > separator. The only appearance of semicolon in Python's formal grammar is here: simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE So it's neither purely terminator nor purely separator -- but can be used as either, or left out entirely if (as is almost always the best idea) you never stuff more than one stmt on a physical line. Note, however, that adjacent semicolons are not allowed! >>> i=1;; SyntaxError: invalid syntax >>> So there is no sense in which a trailing semicolon implies a "null stmt", or other similar fiction. The only null stmt in Python is the explicit "pass". python-doesn't-take-stands-on-issues-that-don't-matter-ly y'rs - tim From fcahoon at my-deja.com Thu Feb 17 09:23:39 2000 From: fcahoon at my-deja.com (Forrest Cahoon) Date: Thu, 17 Feb 2000 14:23:39 GMT Subject: VMS+Python+Oracle ? Message-ID: <88h097$4k0$1@nnrp1.deja.com> Has anyone gotten Python on VMS to talk to Oracle (also on VMS)? I found the page http://www.zope.org/Products/DCOracle/ where the Oracle driver for Python lives, but there is no mention of VMS there. I'll eventually get around to trying it; but I was wondering if anyone else has success/failure stories, things to watch out for, etc ... Forrest Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Wed Feb 9 13:47:15 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 18:47:15 GMT Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> Message-ID: Justin Sheehy wrote: > > Why not just use the max method? > > > > a = max(x,y) > > Well, the original poster's question was for something equivalent to > their use of C's ?: ternary operator. max() is not equivalent to that. umm. to be precise, he asked for something equivalent to "the C command a = x > y ? x : y". I'd say "a = max(x, y)" is a pretty good approximation ;-) (sure, the x and y *names* are both evaluated, but they're references, and the corresponding objects are not affected in any way...) From a.eyre at optichrome.com Tue Feb 22 04:29:56 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 22 Feb 2000 09:29:56 -0000 Subject: Handling User Defined Exceptions returned from C In-Reply-To: <88t13k$641$1@nnrp1.deja.com> Message-ID: <001501bf7d17$617f3670$3acbd9c2@peridot.optichrome.com> > return PyBuildValue("i", -1); IIRC, if you set an error in C, you must return NULL from the function. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From borsh at minspring.com Mon Feb 14 09:20:34 2000 From: borsh at minspring.com (borsh) Date: Mon, 14 Feb 2000 22:20:34 +0800 Subject: senior web designer Message-ID: <88agkd$l3g$1@nntp9.atl.mindspring.net> A start-up internet company that is located in New Jersey and Boca Raton, Florida, is seeking a Senior Web Designer to oversee the development of several non-English portals. SCOPE AND RESPONSIBILITIES: The incumbent will be responsible for overseeing the development of web programs and managing the web development staff. The Senior Web Developer will begin by working with a third party development team to develop the portals. The Senior Web Designer will then be responsible for the hiring of the in house web development and design staff to maintain the sites. Specific duties include: ? Leading and managing a team of web developers in building the feature sets for each Web site release. ? Ensuring completion in conformance to the project goals and requirements ? Communicating and negotiating requirements, specifications, functionality and limitations of the web system with team members. ? Communicating project development and industry trends/events to management. ? Ensuring that the code being developed meets the specifications and is easily maintainable QUALIFICATIONS: The successful candidate will have: ? Familiarity with Web based e-commerce and web-based customer service ? 3-5 years experience in Web development and excellent business and interpersonal skills. ? You must have a solid knowledge Unix, SQL and the Apache web server, Perl5, HTML, CGI and servlets. Knowledge of IIS, Java, Python, C++ and VB a plus. ? Keen attention to detail and follow-through. ? Ability to schedule and meet deadlines under tight time constraints ? Experience managing a web development team ? Good understanding of Web Development Cycles ? An understanding of issues concerning Web User Interface design ? The ability to speak a second language other than English is a plus. EDUCATION: Bachelors degree or equivalent experience. Benefits: We offer a generous compensation package that includes pre-IPO stock options, 401(k), medical, dental, vision, life insurance, paid vacation and holidays. In addition, you will be working in a casual and flexible environment. Send your resume today for immediate consideration. Reporting To: President Location: Boca Raton, FL & Bergen County, NJ CONTACT: Send your resumes to: OURUNIVERSE1 at aol.com From kc5tja at garnet.armored.net Tue Feb 15 02:37:12 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 15 Feb 2000 07:37:12 GMT Subject: [CORBA] omniNames feature request References: <888o5d$mk9$1@pineapple.uk.research.att.com> Message-ID: In article <888o5d$mk9$1 at pineapple.uk.research.att.com>, Duncan Grisby wrote: >Good idea. That will be easy to do. In the mean time, the IOR is >printed in the omniNames log file on a line like > >Root context is IOR:.... > >so it's easy to extract it from there. Actually, it's not quite so easy, as the spit-server I'm writing will _eventually_ be written in C, and must work with any name service, not just omniORB's. I know it's not your (or the other ORB programmers) fault, but rather is a lack of suitable standardization on OMG's part. I just wish it weren't so severe. :-) >The OMG has now come up with a thing called the Interoperable Naming >Service which solves these issues. It hasn't been fully accepted yet, >and it has undergone many changes over its lifetime. Once it is YAY! At least I know they're working on the problem. >finally standardised, which will hopefully be in the next few months, >omniORB and omniORBpy will support it. Excellent news. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From paul at prescod.net Mon Feb 7 14:28:21 2000 From: paul at prescod.net (Paul Prescod) Date: Mon, 07 Feb 2000 13:28:21 -0600 Subject: PyExpat update Message-ID: <389F1CD5.102E6757@prescod.net> I did some work on pyexpat over the weekend. Modulo bugs I have introduced, I think that my changes so far have all been backwards compatible. I list my new features at the bottom of this message. Before I release, I want some xml-sig opinions on things I would like to change that are NOT backwards compatible. 1. Attributes would be returned as a mapping {key:value, key:value} and not a list [key,value,key,value] . Obviously this will break code that expected the former. 2. Errors will be returned as strings, not integers. You can check for string equality using "==" The intention is not that you would hard-code strings into your code, but would rather use pre-defined string constants: foo = parser.Parse( data ) if foo is pyexpat.unclosed_token: print "Oops:"+pyexpat.unclosed_token IIRC, Python is smart about checking for pointer equality before string equality, right?) 3. There will be no list of exceptions in the modules interface. Here's what it looks like now: >>> import pyexpat >>> for name in dir( pyexpat ): ... if name[0:3]=="XML": ... print name, getattr( pyexpat, name ) ... XML_ERROR_ASYNC_ENTITY 13 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF 16 XML_ERROR_BAD_CHAR_REF 14 XML_ERROR_BINARY_ENTITY_REF 15 XML_ERROR_DUPLICATE_ATTRIBUTE 8 XML_ERROR_INCORRECT_ENCODING 19 XML_ERROR_INVALID_TOKEN 4 XML_ERROR_JUNK_AFTER_DOC_ELEMENT 9 XML_ERROR_MISPLACED_XML_PI 17 XML_ERROR_NONE 0 XML_ERROR_NO_ELEMENTS 3 XML_ERROR_NO_MEMORY 1 XML_ERROR_PARAM_ENTITY_REF 10 XML_ERROR_PARTIAL_CHAR 6 XML_ERROR_RECURSIVE_ENTITY_REF 12 XML_ERROR_SYNTAX 2 XML_ERROR_TAG_MISMATCH 7 XML_ERROR_UNCLOSED_TOKEN 5 XML_ERROR_UNDEFINED_ENTITY 11 XML_ERROR_UNKNOWN_ENCODING 18 I would rather move all of these to an "errors" dictionary so they don't clutter up the main module namespace (after converting them to strings instead of integers). ----------------- Here are the new features I have already added. * more handlers: StartElement, EndElement, ProcessingInstruction, CharacterData, UnparsedEntityDecl, NotationDecl, StartNamespaceDecl, EndNamespaceDecl, Comment, StartCdataSection, EndCdataSection, Default, * new error handling: setjmp/longjmp is gone exceptions are propogated properly even on Windows I believe the new code is thread-safe. * ParseFile: now possible to parse an open file or file-like object. * bug fixes: setattr throws an proper exeption when you do a bad assignment setjmp/longjmp works on Windows * new bugs: ??? -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From pinard at iro.umontreal.ca Tue Feb 22 14:59:10 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 14:59:10 -0500 Subject: functional programming In-Reply-To: bjorn's message of "Tue, 22 Feb 2000 10:58:28 -0700" References: <38B2CE44.CB9B41A9@roguewave.com> Message-ID: bjorn ?crit: > Moshe Zadka wrote: > > On 22 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > > > What would be the advantages of using a "functional" Python, as per > > > your definition? I mean, of course, in practice? > > None. But it would be cool to have tail recursion [...] Hmph! This is not a good enough reason. One coolness of Python is that it does not implement "cool" things of doubtful use. > [...] what is stopping us from implementing tail call optimization (of > which tail recursion is just a special case) with the current Python > implementation. Optimising tail call recursion usually means turning it into an iteration. In many cases, it would just as simple and clear to write iteratively. Yet, there might be a few cases when tail recursion would yield more legible writing. As long as legibility is the main goal, it could be a good idea. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From fred at fubar.com Sat Feb 12 15:26:10 2000 From: fred at fubar.com (Fred Fubar) Date: Sat, 12 Feb 2000 14:26:10 -0600 Subject: PIL & Tk8.2 References: Message-ID: <884fl8$p6j$1@news.vanderbilt.edu> The big issue is not PIL by _tkinter. Here are my instructions for building Tk8.2 compatible PIL (on NT 4.0 system with VC++ 6.0): 1) You need to generate a makefile or VC project file, since F.L. uses other means. My recommendation is to get Ken Seehof's PyExtWizard (http://starship.python.net/crew/seehof/PyExtWizard.html) and generate an empty project called "PIL". Then delete the stdafx.* and PIL.cpp files from this project and instead, add all the requisite files from the PIL 1.0 release (all *.c and *.h except coretest.c and except.c, as per the instructions in the PIL release) 2) Edit the project settings (C++/Preprocessor/Include Directories) to put the tcl/tk 8.2 include directory in the include search path. 3) Build PIL Now you also have to build an 8.2 compatible version of _tkinter.pyd. 1) Go to the Python anonymous CVS repository (see http://www.python.org/download/cvs.html for instructions) and look at the post "r152" modifications to python/dist/src/Modules/_tkinter.c (revision 1.89 vc. 1.88) and tkappinit.c (rev. 1.7 vs. 1.6), which incorporate Dieter Maurer's patches for tcl/tk 8.1 and 8.2 functionality). On Windows NT, the comments in _tkinter.c, that the patch does not work on Tcl/Tk 8.2 seems to be incorrect, so you want to change the line 491 from #if TKMAJORMINOR == 8001 to #if TKMAJORMINOR >= 8001 On other systems, YMMV. 2) Apply this patch to FixTk.py: *** FixTk.py Fri Feb 04 03:30:58 2000 --- \FixTk.py Mon Jan 04 18:06:44 1999 *************** *** 1,4 **** ! """Utility which tries to locate the Tcl/Tk 8.x DLLs on Windows. This is a no-op on other platforms. """ --- 1,4 ---- ! """Utility which tries to locate the Tcl/Tk 8.0 DLLs on Windows. This is a no-op on other platforms. """ *************** *** 6,13 **** # Error messages we may spit out NO_TCL_MESSAGE = """\ ! WHOOPS! I can't find a Tcl/Tk 8.x installation anywhere. ! Please make sure that Tcl.Tk 8.x is installed and that the PATH environment variable is set to include the Tcl/bin directory (or wherever TK80.DLL and TCL80.DLL are installed). If you don't know how to fix this, consider searching the Python FAQ --- 6,13 ---- # Error messages we may spit out NO_TCL_MESSAGE = """\ ! WHOOPS! I can't find a Tcl/Tk 8.0 installation anywhere. ! Please make sure that Tcl.Tk 8.0 is installed and that the PATH environment variable is set to include the Tcl/bin directory (or wherever TK80.DLL and TCL80.DLL are installed). If you don't know how to fix this, consider searching the Python FAQ *************** *** 16,22 **** """ NO_TKINTER_MESSAGE = """\ ! WHOOPS! Even though I think I have found a Tcl/Tk 8.x installation, I can't seem to import the _tkinter extension module. I get the following exception: ImportError: %s --- 16,22 ---- """ NO_TKINTER_MESSAGE = """\ ! WHOOPS! Even though I think I have found a Tcl/Tk 8.0 installation, I can't seem to import the _tkinter extension module. I get the following exception: ImportError: %s *************** *** 39,52 **** python_dir = os.path.dirname(python_exe) program_files = os.path.dirname(python_dir) def tclcheck(dir): ! for minor in 0,1,2: ! ok = 1 ! for dll in "tcl8%1d.dll", "tk8%1d.dll", "tclpip8%1d.dll": ! if not os.path.isfile(os.path.join(dir, dll % minor)): ! ok = 0 ! if ok: ! return 1 ! return 0 for tcldir in [program_files, "\\Program files", "\\", "C:\\Program Files", "D:\\Program Files"]: tcldir = os.path.join(tcldir, "Tcl", "bin") --- 39,48 ---- python_dir = os.path.dirname(python_exe) program_files = os.path.dirname(python_dir) def tclcheck(dir): ! for dll in "tcl80.dll", "tk80.dll", "tclpip80.dll": ! if not os.path.isfile(os.path.join(dir, dll)): ! return 0 ! return 1 for tcldir in [program_files, "\\Program files", "\\", "C:\\Program Files", "D:\\Program Files"]: tcldir = os.path.join(tcldir, "Tcl", "bin") For UNIX builds, you can skip much of this and probably only need to make the requisite mods of _tkinter.c, tkappinit.c, and FixTk.py. Robin Becker wrote in message news:qtR8IAAhFEo4Ew$E at jessikat.demon.co.uk... > has anyone got a Tk8.2 compatible version of PIL? > -- > Robin Becker Hope this helps, Jonathan From effbot at telia.com Tue Feb 15 15:33:27 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 15 Feb 2000 20:33:27 GMT Subject: BSDDB copyright and licensing restrictions while in use viaPython References: Message-ID: Oleg Broytmann wrote: > > metakit: fast, efficient, small, highly portable, > > great python interface, and free. > > Hm, portable? Well, exerpt from README: > > I cannot consider it "portable". Oh, yes, I have exactly 2.8.1, even > worse, on Solaris 2.5.1. considered using a recent version of gcc? after all, the upgrade is free. > No other program reveals bugs in 2.8.1. cool. but if that was true, why did they release 2.95.2? From framiere at netcom-service.com Sat Feb 19 06:19:23 2000 From: framiere at netcom-service.com (Florent Ramière) Date: Sat, 19 Feb 2000 12:19:23 +0100 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> Message-ID: <88lukr$2cfj$1@news5.isdnet.net> Hi, sorry for replying this message, but is what you say means that there is absolutely no way to print excatly what i want to print ??? I will never be able to display "ab" in two print ??? That make me nervous about python ! Florent. Michael Hudson wrote in message news:m3u2j5zidf.fsf at atrus.jesus.cam.ac.uk... > "Florent Rami?re" writes: > > > Thanks for your answers, > > > > in fact as Moshe Zadka told me, it is a documented feature ... (sorry) > > Well, i should have read more carefully the doc (re-sorry) > > And is there a solution to my problem ? > > And sys.stdout.write is not a good solution for me (i need to keep > > printing with print) > > > > Is there an easy way to override the print statement (i saw it one time > > in the news, but i can not find it) > > > > You want sys.stdout.softspace: > > >>> print 1,;print 2 > 1 2 > >>> print 1,;sys.stdout.softspace=0;print 2 > 12 > > It's a bit tedious to actually use, as it keeps getting reset; you > could try this: > > >>> class SF: > ... def __init__(self,string): self.string = string > ... def __str__(self): sys.stdout.softspace = 0; return self.string > ... > >>> print SF("2"),1 > 21 > > HTH, > Michael From herzog at online.de Wed Feb 2 08:23:27 2000 From: herzog at online.de (Bernhard Herzog) Date: 02 Feb 2000 14:23:27 +0100 Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> <38975766.21B319AD@dcs.kcl.ac.uk> Message-ID: Laurence Tratt writes: > stevie_deja at my-deja.com wrote: > > > Would anyone explain to me where there is a difference between the > > following two calls: > > > > if some_var == None : print 'var is none' > > > > if some_var is None : print 'var is none' > > > > Can '== None' only be used in certain circumstances? > > In this particular circumstance, both lines of code will always produce the > same result; Whether they're equivalent depends on what some_var actually is. If it's a class instance whose class implements the __cmp__ method it may well be equal but not identical to None: >>> class C: .. def __cmp__(self, other): .. return cmp(None, other) .. >>> c = C() >>> c == None 1 >>> c is None 0 >>> -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From a.eyre at optichrome.com Tue Feb 1 08:50:37 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 1 Feb 2000 13:50:37 -0000 Subject: Packages, modules, libraries,... In-Reply-To: Message-ID: <001b01bf6cbb$519533c0$3acbd9c2@peridot.optichrome.com> > I've seen the words package, module, and library, used in this group > frequently. I'm the naive type of programmer, so I thought that these > were synonyms. Now, some people seem to use these words as such, but > then there are others who seem to distinguish between them. What is > true? Are perhaps both views true in some sense? Could someone please > enlighten me. I'm not sure about "library", but "package" and "module" are well defined in Python. Imagine the following filesystem structure: /home/fred/python/ <- This is in the PYTHONPATH | +- cafe/ | | | +- __init__.py | | | +- bacon.py | +- spam.py import spam # Imports "module" from file spam.py[c] import cafe # Imports "package" from file cafe/__init__.py[c] import cafe.bacon # Imports "module" from file cafe/bacon.py[c] Packages are really useful in that they allow you to easily create arbitrarily nested namespaces in Python, whilst maintaing a easily managed directory structure. The presence of an __init__.py in a directory constitutes a package, although technically, a package is just a module: >>> import spam >>> spam >>> import cafe >>> cafe >>> import cafe.bacon >>> cafe.bacon >>> ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From effbot at telia.com Wed Feb 2 18:45:07 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 23:45:07 GMT Subject: "Python Programming on Win 32" available References: <3898b54c.1949600@news.btx.dtag.de> Message-ID: <7k3m4.738$pob.188239360@newsa.telia.net> Stefan Franke wrote: > Is the book available already? Amazon.com says "ships within 2-3 > days." I have a copy right here -- bought at the python conference last week. (an unqualified guess is that "ships within 2-3 days" means that amazon hasn't yet stocked up on it). if you prefer not to order from a patent abuser, and save a whopping $0.01, fatbrain ships it within 24 hours: http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=1565926218 From joeyGibson at mindspring.com Wed Feb 16 11:18:30 2000 From: joeyGibson at mindspring.com (Joey Gibson) Date: Wed, 16 Feb 2000 11:18:30 -0500 Subject: Python on the Palm In-Reply-To: <5ddq4.2279$CC3.73704@wagner.videotron.net> References: <38A8D6E6.A18DBCE5@pehr.net> <5ddq4.2279$CC3.73704@wagner.videotron.net> Message-ID: On Tue, 15 Feb 2000 09:13:14 -0500, "Steve Menard" wrote: ||| I understand your frustration. I have recently gotten a nice PalmV, but I ||| really simply cannot stand to program it in C, nor any of the other ||| non-commercial languages I've tried. I don't know if you've tried it, or even if you'd be interested, but there is also Pocket Smalltalk. It is a Smalltalk dev env that runs under Windows and generates Palm code. I use it, and it is so much easier than Palm C (which I've not written, just seen), and even easier than kJava. If you're interested, look at www.pocketsmalltalk.com. I just wrote a tutorial on it if you want to get a feel for it at www.mindspring.com/~joeygibson/st/pstIntro Joey -- -- Sun Certified Programmer for the Java2 Platform -- -- "Then slew they the goats, YEA! And placed they the bits, -- in little pots." From gerrit.holl at pobox.com Mon Feb 21 15:44:12 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 21:44:12 +0100 Subject: i am a newbie to python , where can i D/L it? In-Reply-To: ; from greene@hctc.com on Mon, Feb 21, 2000 at 10:53:21AM -0700 References: Message-ID: <20000221214412.C4076@stopcontact.palga.uucp> > i have just heard about python and i was told it was a good begginging lag > to start programming with i jsut need to know where i cna get it i thought > is free, is it not, thanks for any halp Start at: http://www.python.org/ And follow any links you find on that page. You will be especially interested in the 'tutor' list, for people new to programming. You can subscribe at: http://www.python.org/mailman/listinfo/tutor Have fun! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From Andreas.Cardeneo at mach.uni-karlsruhe.de Fri Feb 25 07:35:21 2000 From: Andreas.Cardeneo at mach.uni-karlsruhe.de (Andreas Cardeneo) Date: Fri, 25 Feb 2000 13:35:21 +0100 Subject: Bring value from walk() References: <38B663AF.EDF3622E@nembv.cz> Message-ID: <38B67709.53302F15@mach.uni-karlsruhe.de> Milos Prudek schrieb: > > Is there (an object oriented) way to bring Total from Estimatespace thru > EstDirSpace right back into main program? > > def Estimatespace(Fs, Dirn, Nams): > print Dirn > for X in Nams: > Fs=Fs+os.stat(Dirn+'/'+X)[stat.ST_SIZE] > print '-',X,Fs > # Total=Total+Fs > return In Estimatespace you should initialize Total with zero, so python knows the value the first time you add Fs to it. And then return Total. hth, Andreas From ron at graburn.com Sun Feb 13 18:09:47 2000 From: ron at graburn.com (Ronald Hiller) Date: Sun, 13 Feb 2000 23:09:47 GMT Subject: Changes to urlparse.py: urljoin Message-ID: <38A73982.AAA65E9C@graburn.com> I've been having some problems with the urljoin function. When I try and join URLs that have '..' components that make the path above the root, they aren't joined properly. For example: goof> python Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import urlparse >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") 'http://www.xyz.com/../x/y/z.gif' >>> # Now with the changes: > python Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import urlparse >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") 'http://www.xyz.com/x/y/z.gif' >>> My patches for urlparse are included below...do they look reasonable? What is the process for getting these into the "real" source tree? Thanks, Ron *** orig/Lib/urlparse.py Thu Mar 18 10:10:44 1999 --- urlparse.py Sun Feb 13 16:51:36 2000 *************** *** 166,171 **** --- 166,175 ---- i = i+1 else: break + while segments[0] == '': + del segments[0] + while segments[0] == '..': + del segments[0] if len(segments) == 2 and segments[1] == '..' and segments[0] == '': segments[-1] = '' elif len(segments) >= 2 and segments[-1] == '..': From prudek at nembv.cz Fri Feb 25 03:49:15 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 09:49:15 +0100 Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: <38B6420B.6A9D66DE@nembv.cz> > if all you want is to load all lines from the file > into a list, use: > > A = H.readlines() Yeah, but I need to remove empty lines as well... > the standard pydiom for reading from a text file > is this: It's useful. Thanks! -- Milos Prudek From david.maslen at iname.com Mon Feb 7 17:19:55 2000 From: david.maslen at iname.com (David Maslen) Date: Mon, 07 Feb 2000 22:19:55 GMT Subject: Python Palm Pilot Hotsync Conduit References: Message-ID: <879010fcpj.fsf@iname.com> Jeff Senn writes: > All this talk about Christian's SP and Python for the Palm Pilot > reminded me: > > I have a (mostly complete) wrapper for the low-level Palm SyncManager > routines that would allow one to write HotSync conduits in Python (on > Windows). > > I paused in the development (read: got distracted) so there are some > loose ends. If anyone is interested in picking it up for the 'greater > good', I'll contribute my code... Could this be of any value to pyrite[1]? That's what I use as a conduit for my palm pilot, but I don't think it is running under windows. Footnotes: [1] http://pyrite.linuxbox.com/ From haje01 at netsgo.com Sun Feb 20 13:42:53 2000 From: haje01 at netsgo.com (Kim Jeong Ju) Date: Mon, 21 Feb 2000 03:42:53 +0900 Subject: Could embeded Python echo evaluation? Message-ID: When you run Python in console mode, you can see result string after evaluation without any explicit print command. >>> 3 + 4 7 >>> dir But embeded Python doesn't show its result string. You should specify 'print' command to see the result as in consol mode. >>> 3 + 4 >>> dir >>> print 3 + 4 7 >>> print dir Why this behavior happens? Are there any way to let Python echoing result automatically in embeded version? Thanks in advance. From mhammond at skippinet.com.au Wed Feb 9 17:15:45 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 09 Feb 2000 22:15:45 GMT Subject: Question concerning makepy.py for COM (long, code included) References: <38A1859D.6AE7AF0E@ttm.com> Message-ID: "Scott Anderson" wrote in message news:38A1859D.6AE7AF0E at ttm.com... > I ran the makepy.py script that comes with the win32com distribution > (the 128 release). From the file produced, it is not entirely obvious > how to instantiate and use the objects. You dont need to do anything special - just call "win32com.client.Dispatch(prog_id)" and it should work. > So, the question is, how do I use the _DTSHSWAPI functionality from this > class? Also, how is the event interface implemented? Events are much newer, and suffer from even worse documentation than the rest. Only docs for events are in docstrings for win32com.client.DispatchWithEvents() and win32com.client.getevents() For even more details, check out my 'conferences' starship page and look for the IPC8 tutorial... Mark. From thomas at bibsyst.no Mon Feb 14 09:26:40 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Mon, 14 Feb 2000 15:26:40 +0100 Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> Message-ID: <38A810A0.DB9ED318@bibsyst.no> Vetle Roeim wrote: > > * Thomas Weholt > > Hi, > > > > I`d like to make a client/server application exchanging objects of > > different type, sizes etc. Are there any simple tutorials or docs > > available on this, and what are my options on how to implement this ?? > > > > The objects are rather simple, but can be huge in size. > > Sound like CORBA would do the trick here. > > Either that, or you just serialize your objects, push them over the > link and then read the data back into new objects. > > Perhaps the latter example would be best. You avoid having to learn > CORBA ;) > > vr Yeah, that`s what I thought, but the serialize-bit isn`t the problem. The server/client-part is. How do I set up a server listening to a port, waiting for clients to connect and upload objects?? I haven`t made any server/client software so far so I need the basics and then some .... :-> Thomas From effbot at telia.com Sun Feb 6 04:01:38 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 09:01:38 GMT Subject: CGI Scripts References: <389CEA00.9D771D21@webamused.com> Message-ID: Joshua Macy wrote: > Sorry, typo. That should have read: > > print "Content-type: test/html\n\n" or rather, print "Content-type: test/html\n" since print already adds a newline all by itself. you can of course also use an extra print state- ment: print "Content-type: test/html" print just like in the posted script. From felixt at dicksonstreet.com Sat Feb 26 02:37:55 2000 From: felixt at dicksonstreet.com (Felix Thibault) Date: Sat, 26 Feb 2000 01:37:55 -0600 Subject: Q about tail recursion Message-ID: <3.0.5.32.20000226013755.0087a180@mail.dicksonstreet.com> I was following the funtional programming thread and trying to get an idea about what tail recursion was, so I made these two functions: def add(inlist, sofar=0): if inlist: return add(inlist[1:], sofar+inlist[0]) else: return 0 def faketailadd(inlist): sum = [] def add(recur,inlist, sofar, container): if inlist: recur(recur, inlist[1:], sofar+inlist[0], container) else: container.append(sofar) add(add, inlist, 0, sum) return sum[0] and tested them, and got: >>> a=time.time();b=test.add(k1);time.time()-a 1.70000004768 >>> a=time.time();b=test.faketailadd(k1);time.time()-a 1.70000004768 (k1 is range(1000)) Does this mean that even though there are no return's in faketailadd's add, the function still has to work its way back up from all those recursive calls ? Or something like that ? Or does it just mean I misunderstood what tail-call optimizing is like? Or does that too- good-to-be-true less-than-1-nanosecond difference mean my testing is flawed ? dys-functionally y'rs, Felix From effbot at telia.com Sat Feb 5 10:20:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 05 Feb 2000 15:20:58 GMT Subject: newbie 2, back with a revenge. asyncore References: Message-ID: Arnaud Fontaine wrote: > As I use asyncore sockets with no problem for servers, there is > something I don't get in 'client' mode. > > Can someone explain me how to use, for exemple, the httpclient exemple > provided in the lib documentation ? here's a more complete and bug-free version of the example in the library reference. you'll find more examples examples (including improved http client classes) in the eff-bot guide. import asyncore, socket class http_client(asyncore.dispatcher): def __init__(self, host, path): asyncore.dispatcher.__init__(self) self.path = path self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect( (host, 80) ) self.buffer = 'GET %s HTTP/1.0\r\n\r\n' % self.path def handle_connect(self): pass def handle_read(self): data = self.recv(8192) print data def handle_close(self): self.close() def writeable(self): return (len(self.buffer) > 0) def handle_write(self): if self.buffer: sent = self.send(self.buffer) self.buffer = self.buffer[sent:] c = http_client("www.python.org", "/index.html") asyncore.loop() From greg at perceval.be Fri Feb 25 04:22:54 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Fri, 25 Feb 2000 10:22:54 +0100 (CET) Subject: Phyththon misspelling contest In-Reply-To: <20000224200611.A6705@stopcontact.palga.uucp> Message-ID: In reply to the message of Gerrit Holl sent on Feb 24 (see below) : What I suggest is to have python encapsulated into python. It should give something like : pypythonthon -- 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 Thu, 24 Feb 2000, Gerrit Holl wrote: > Date: Thu, 24 Feb 2000 20:06:11 +0100 > From: Gerrit Holl > Reply-To: Gerrit > To: python-list at python.org > Subject: Re: Phyththon misspelling contest > > > > Get Chaucerian, win valuable prizes! Extra points if none of > > your posts spells it the same way as any other. > > spam > > -- > Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html > Please comment! > > -- > http://www.python.org/mailman/listinfo/python-list > > From shohamb at my-deja.com Mon Feb 14 05:45:14 2000 From: shohamb at my-deja.com (shohamb at my-deja.com) Date: Mon, 14 Feb 2000 10:45:14 GMT Subject: "Interupted system call" Message-ID: <888mbq$9kr$1@nnrp1.deja.com> My Python application runs well on IBM's AIX machines. When trying to run it on a SUN (Solaris) machine, I get the message: IOError: [Errno 4] Interrupted system call and the Traceback message points to a "time.sleep" command. Any idea why it happens, or how to solve the problem? Thanks, Shoham Ben-David Sent via Deja.com http://www.deja.com/ Before you buy. From dworkin at ccs.neu.edu Tue Feb 8 21:24:41 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 08 Feb 2000 21:24:41 -0500 Subject: A = X > Y ? X : Y In-Reply-To: Curtis Jensen's message of "Tue, 08 Feb 2000 17:04:01 -0800" References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: Curtis Jensen writes: > I fear that this question has already been asked, but is there and > equivalant one line command that is equivalant to the C command: > > a = x > y ? x : y cjc26 at nospam.cornell.edu (Cliff Crawford) writes: > a = (x > y and [x] or [y])[0] Brad Howes writes: > Its in the FAQ -- and its not as pretty: > > a = ( ( x > y ) and x ) or y Fran?ois Pinard writes: > > a = ( ( x > y ) and x ) or y > > If really in the FAQ, it should not be. It surely does not work when x > is 0, and y is less than 0. Brad's example is incorrect, and is not in the FAQ. Cliff's example is the correct one, although I agree with him that it is not to be recommended. People ought to look at the FAQ when they talk about it. They also ought to look in it if they fear that their questions have already been asked. ;-) The entry at http://www.python.org/doc/FAQ.html#4.16 explains this quite well, and gives the correct expression. -Justin From bparsia at email.unc.edu Wed Feb 9 11:14:39 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 11:14:39 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> <1e5p92l.xgr4fe1s2x5ptN%bparsia@email.unc.edu> <87qs04$ni1$1@nnrp1.deja.com> Message-ID: <1e5qcx3.twkef91dzq7urN%bparsia@email.unc.edu> wrote: > In article <1e5p92l.xgr4fe1s2x5ptN%bparsia at email.unc.edu>, > bparsia at email.unc.edu (Bijan Parsia) wrote: > > wrote: > > > > > In article <1e5nkk6.1a5z8bp1lixbdvN%bparsia at email.unc.edu>, > > > bparsia at email.unc.edu (Bijan Parsia) wrote: > > > > wrote: [snip] > > > > Well, that would be a telling riposte *if* my argument had anything to > > do with technical superiority. My point was, as Garrett pointed out, > > that the fact that there are large bodies of Python code from > > heterogenous sources which themselves have had heterogenous > contributers > > *and yet* there hasn't been (reported) wide scale difficulties is > *prima > > facie* evidence that the "whitespace munging" problem is not severe. > > Given that, the burden of proof returns to you, and analogies from > > other, *disanalogous* langauges will no longer serve. > > Actually, my mention of Perl in particular is draws on the common > statements in the Python community about Perl's unmaintainability. > Granted, _you_ didn't say Perl is unmaintainable, but still this is the > basis of what I was trying to get at. > > A language can have Problems (with a capital 'P') and still acheive > widespread popularity. Of course. My point is *completely* independant of that. My point holds even if Whitespace is a Problem for Python Balanced By Other Groovy Features. Refuting arguments isn't the same as refuting conclusions. I recommend a good introductory symbolic logic class. Or, if you prefer, I could recommend specific texts. My use of the fact of Python's popularity was to establish that there is plenty of Python files out there that 1) come from hetergenous sources, 2) get intergrated, and 3) have had multiple programmers working on them. This was establish that the extant initial evidence *for you* is exactly the same as that derived from your "C experience". And yet, as it trivially observable, the conclusions you drew *from your C experience* AND *your understanding of Python* don't hold. I grant your C experience, ergo, your understanding of Python is flawed (at least, your understanding of the problems of whitespace delimiters being munged in semantically unresolvable ways). So all your manuevers about popularity are completely beside the point as the truth of how Python *got* popular plays *no* role in my critique. Now, which part don't you understand, if you still don't? I can always try another explanation. [snip] > > > > Well, look, you've just *changed* your argument. Your original > argument > > was that *based* on your C experience, certain conclusions about > Python > > can be drawn. > > > > Now, that a few people *with* python experience chimed in is some sort > > of confirmation, but hardly what you should hope for given the > strength > > of your claim and the nature of your supporting evidence. > > What I had actually hoped for was a reasoned discussion that would teach > me some valuable things. So far, I have learned a bunch of stuff, and I > am happy. I expressed my concerns, and gave my reasons for those > concerns. Should I not have done so? I critiqued (one of) your *argument(s)* which was, as I believe I've shown, fallacioius. Or, at least, not nearly as strong as you seemed to think. Should I not have done so? Why not? That you can bring in other considerations and arguments in support of your position is fine, and even reasonable (though I *do* think that the *prima facie* case against you is strong enough that only direct experience/empirical evidence will get *you*, personally, back in to the ball game; this is *ad hominim*, of course (in the technical sense), but no less a problem for *your* argumentative position). What you *should have done*, in my honest opinion, is admit that either 1) you radically mistated your case, perhaps for rhetorical effect, and repair your argument (I rather suspect that the "C experience" thing was an authority manuver) *or* 2) you simply have vauge unsupported worries and would like some reassurance. After the group hug, you may there upon go ahead and stop worrying and learn to love the NewLine. > > And, yes, sure, there well may have been people turned off by > > "whitespace", but isn't the true measure, to be consistent with your > > argument, of the the defectives of Python's block delimitors that when > > receiving files from other people, one is *typically* left *totally > > clueless* as to the intent of the programmer? *No one* has claimed > that. > > "*typically* left *totally clueless*" !?!?!? *No one* has claimed that! > If that were true, the language simply wouldn't work at all! Well, you came mighty close. Go back and look at your discussion of your C experience. If Python whitespace got munged to the degree that happen to C files "in your experience", *and* Python whitespace was "impossible" or "very difficult" to keep straight wrt to orginal programmer intentions under those conditions, then it follows that general chaos would ensure, *or* that people would typically do a lot of work when dealing with other people's files. Neither is true, as is simply determinable by inspection of http://www.python.org. > I'm more concerned about the possiblilty of one bad line being left in a > infrequently-executed routine, leading to spurious errors which are > difficult to track down. Seems to be an issue of code coverage and testing tools, not of whitespace. And doesn't a little reflection make this seem like not a pressing issue? I mean, what's the chance of, in a normal sized module file, of only *one* function being affected by a whitespace munging operations in a non syntax error generating way? If you can provide some evidence that this is fairly likely under current practices (and I think it needs to be an *evidential*, not a speculative, argument; show us some test cases), then you may have something. But let's think more generally here: The *reason* C can get it's whitespace horrible contorted is because, lo, it's not (extra) whitespace *sensitive*! Different sequences and lengths of sequences of whitespace are *merely* different spellings of token delimiters. So, from a langauge point of view, having two spaces between each indentifier is *consistent* with having 47. But that's not true in Python. Newlines are statement separators, for example. x = 5 print x Not an error. x = 5 print x An error. (er, I hope ;)) > > [ ... ] > > Of course, it's theoretically possible that everybody *is* spending > all > > their time indenting and reindenting code, guessing where things > should > > go, and so on, but that the other advantages of Python *so outweigh* > > this huge effort that people put up with it anyway. > > Yes, that's exactly what I was getting at. "All the time" is, of > course, an exaggeration -- but some extra time, yes. Erm...Given that there are langauges fairly semantically close to Python, with a slightly different syntax, which doen't seem to be winning over straight Python, I'd say that your case is thin, indeed. (I notice a slow withdraw in the power of your claim.) But heck, download some python code. Be careless with it. See what happens. If this is *easy* to do, then it'll pop up. If it's rare, then you have to start weighing tradeoffs. (After all, it's not like *other* delimintation methods are perfect, either. They have direct and measurable costs.) > > I respectfully suggest that the *prima facie* case is very strongly > > against this. And given that Python is open source and that adding > > "visible" block delimiters is more or less trivial *and* *no* > > alternative block delimited version has *appeared* much less gained > > *any* following, I think we can rest confident that indentation is not > a > > problem. > > After python gained a certain level of popularity, though, it would be > easier to 'put up' with the problem than hack the langauge, because of > the availability of modules and such. So this particular argument > doesn't seem too forceful to me. How does the amount of popularity of Python have to with the difficulty of fixing a wart, especially one that would have the putative gains you mention? It's *trivial* to change the delimiters, and in a backwards compatible way. Plus, this completely ignores the history of Python *before* it reached the "certain level of popularity". What level is that *exactly*, hmm? Vauge claims are easy to defend. What argument against your conclusion *would* seem forceful to you? There have certainly been plenty that *have been forceful*, regardless of your ability to discern that force. Cheers, Bijan Parsia. From egbert at bork.demon.nl Fri Feb 25 10:18:59 2000 From: egbert at bork.demon.nl (Egbert Bouwman) Date: Fri, 25 Feb 2000 16:18:59 +0100 Subject: Phyththon misspelling contest In-Reply-To: ; from Evan Simpson on Thu, Feb 24, 2000 at 03:55:22PM -0600 References: <38b6518c.14504847@news1.mysolution.com> <893u78$46n$1@nnrp1.deja.com> Message-ID: <20000225161858.A7491@bork> Usually I get good results with the following expression: r'\bph?(ph)*[iye]+th?o?n+e?\b',re.IGNORECASE It is based on the following principles: (1) spelling should follow pronunciation: - the h is never pronounced, and thus not necessary - the o is nearly mute, and can be omitted as well (2) it should accept common misconceptions about spelling (3) it should be politically correct: - an a in the first syllable is a dutch invention, and as such not aceptable. Nearly all of the former dutch in Holland (Michigan) voted for Bush. However, perhaps they were only very shrewd by choosing the weaker opponent for Al Gore. But shrewdness is not correct either. Think of Odysseus. (4) spelling may give indications how _not_ to pronounce a word: - people in french speaking parts of the world (Quebec, Martinique) should write something like pitonne just to indicate that the pronounced word does not end in a nasal sound, " le ton ou piton nasal". The applicability of this expression is nearly universal because it accepts pitn as well as phphphieyythonne. egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From guido at python.org Tue Feb 15 15:10:09 2000 From: guido at python.org (Guido van Rossum) Date: Tue, 15 Feb 2000 15:10:09 -0500 Subject: IDLE 0.5 released Message-ID: <200002152010.PAA25420@eric.cnri.reston.va.us> After a delay of nearly half a year, I've finally released IDLE 0.5. I'll quote from the README after listing the URL: http://www.python.org/idle/ (Dear edu-sig members, please don't fill the edu-sig mailing list with detailed feedback on IDLE -- please use the newsgroup or the Python Bugs List. Discussion of requirements for adaptation of IDLE in education are welcome; please first check the TODO list (http://www.python.org/idle/idle-0.5/TODO.txt) to see if I've already thought of your request.) FEATURES IDLE has the following features: - coded in 100% pure Python, using the Tkinter GUI toolkit (i.e. Tcl/Tk) - cross-platform: works on Windows and Unix (on the Mac, there are currently problems with Tcl/Tk) - multi-window text editor with multiple undo, Python colorizing and many other features, e.g. smart indent and call tips - Python shell window (a.k.a. interactive interpreter) - debugger (not complete, but you can set breakpoints, view and step) USAGE [...] IDLE requires Python 1.5.2, so it is currently only usable with a Python 1.5.2 distribution. (An older version of IDLE is distributed with Python 1.5.2; you can drop this version on top of it.) COPYRIGHT IDLE is covered by the standard Python copyright notice (http://www.python.org/doc/Copyright.html). FEEDBACK For feedback, please use the Python Bugs List (http://www.python.org/search/search_bugs.html). --Guido van Rossum (home page: http://www.python.org/~guido/)

IDLE 0.5 - the Integrated DeveLopment Environment for Python in Python. (15-Feb-2000) From paul at prescod.net Tue Feb 8 11:33:55 2000 From: paul at prescod.net (Paul Prescod) Date: Tue, 08 Feb 2000 08:33:55 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262139803-5814898@hypernet.com> <87ocad$to2$1@nnrp1.deja.com> Message-ID: <38A04573.4B7FBBF8@prescod.net> fcahoon at my-deja.com wrote: > ... > > Suppose that I'm one of those set-tabs-to-logical-indentation sorts of > guys, so I set my tab width to 4, then look at this code in my editor. > Gee, it sure _looks_ like statement4 belongs to "if condition1"! And, > if I convert tabs to spaces when I save, statement4 _will_ belong to "if > condtion1". I've just unwittingly changed the logic of the code! > > You may, of course, argue that this is unlikely, but it is still > plausible enough to make me _very_ nervous. Yes, there is a one in 10,000 chance that a mistake in your usage of the editor could coincide with this design feature of the Python language. As long as you only mix spaces and tabs in one or two places in the module, you might even get your code to run. But you are a professional programmer. You know that errors happen. Any C programmer has a long list in his/her head of "things I've done in the past that really bit me in the ass that I should never do again". Java programmers have another list. Perl programmers have another one. In Python, one of them is: "don't mix spaces and tabs." Luckily, this is much easier to explain than "don't return a pointer to a local variable because it will be destroyed when the stack pointer changes.". At the point where a single one of these rare and admittedly unlikely difficulties elevates itself to a reason not to use an entire language, we have crossed from the realm of rationality into superstition. Before you talked to us, you probably didn't understand how rare and unlikely it is to make syntactically correct Python code that works differently based on the interpretation of tab stops, nor how easy it is to avoid. Now you know. Please apply some perspective and cost/benefit analysis. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From tuttledon at hotmail.com Sat Feb 26 10:12:52 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Sat, 26 Feb 2000 15:12:52 GMT Subject: parameter undefined in procedure References: <000501bf8025$1a1fcc20$3c2d153f@tim> Message-ID: [Tim Peters ] > Actually, lambda was added with no clamoring at all! lambda, map, reduce > and filter were *all* contributed code (by the same non-Guido fellow), and > showed up in Python 1.0.0 (a bit over 6 years ago) without a word of public > discussion or debate preceding -- they were a total surprise. I was > delighted at first, but have gotten sicker of them in each of the 73 months > that have passed since. > > There's nothing wrong with the code that implemented them (to the contrary, > Amrit Prem did a great job); people simply won't let them remain the "minor > conveniences" they were intended to be. Python hasn't been any fun at all > since they were added . Are there any plans to upgrade lambda, map, reduce and filter to become "major conveniences"? Or are there already better ways to accomplish the same things? From pinard at iro.umontreal.ca Tue Feb 22 09:40:38 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 09:40:38 -0500 Subject: Python mode - `C-c |' feature suggestion Message-ID: Hi, people. I just wanted to move the three lines defining `once_matcher', below, into a Python interactive buffer, to play with: [...] # V?rifier la syntaxe des programmes Perl. if syntax: once_matcher = re.compile( 'Name "main::([^"]+)" used only once:' ' possible typo at ({^ ]+) line ([0-9]+)').match sys.stdout.write(separator) sys.stdout.write("V?rification syntaxique des scripts Perl\n") [...] Putting the region around these three lines and doing `C-c |' yields a syntax buffer, because of the indentation. If I temporarily unindent these three lines in the source buffer before doing `C-c |', it works. My suggestion is that `C-c |' be made clever enough to discover the left margin of the region under consideration, and that it removes that margin while transmitting the region to the Python interpreter. That would allow for using that command in a much wider variety of (smaller :-) contexts. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jeremiah at widomaker.com Mon Feb 7 10:46:27 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:46:27 GMT Subject: nonlinear programs? Message-ID: <389DFA9F.EF88202E@widomaker.com> Is there a way for me to make python start a process(such as mpg123) and then continue on in the program before mpg123 stops? I want to be able to start the song playing, and then still solicit user input about skipping on to the next mp3, or quitting the program. If someone could explain this to me, or point me in the direction of an explanation I would be very greatful. From emile at fenx.com Wed Feb 9 21:16:29 2000 From: emile at fenx.com (Emile van Sebille) Date: Wed, 9 Feb 2000 18:16:29 -0800 Subject: perl chomp equivalent in python? Message-ID: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> Kees, Try this: >>> lines = open(r'c:\config.sys').readlines() >>> for line in lines: print line[:-1] -- Emile van Sebille emile at fenx.com ------------------- a.c.a. serier wrote in message news:87snvk$f2i$1 at news.hccnet.nl... > Hello, > > I have the following problem with lines read with readline. > How to remove the newline at the end? > Perl has chomp() to do this. > In this case use split to split up the line, but the last item has a > newline at the end. > I tried both split and replace(line, '\n', '') without result. > Can't find anything in tutorial, lib ref and FAQ. > > Thank in advance, > > Kees > > > -- > http://www.python.org/mailman/listinfo/python-list > From jon at dgs.monash.edu.au Thu Feb 24 21:38:28 2000 From: jon at dgs.monash.edu.au (Jonathan Giddy) Date: Fri, 25 Feb 2000 13:38:28 +1100 (EST) Subject: ANNOUNCE: Python Compiler (No spell errors) In-Reply-To: from "=?ISO-8859-1?Q?Fran=E7ois_Pinard?=" at Feb 24, 2000 09:08:54 PM Message-ID: <200002250238.NAA22135@nexus.csse.monash.edu.au> =?ISO-8859-1?Q?Fran=E7ois_Pinard?= declared: > >see_plus_plus at my-deja.com ?crit: > >> Wait & See. This new compiler is coming out from the same country where >> Mercedez, BMW & Porsche are produced. You know the quality of those cars, >> do you? > >Do they have bulls in this country? :-) > I hear that Mercedes at least have started importing elk. :~) From darrell at dorb.com Sun Feb 27 13:16:11 2000 From: darrell at dorb.com (Darrell) Date: Sun, 27 Feb 2000 18:16:11 GMT Subject: name of object inside it's methods? References: <8EE74F2D4usenetacct@216.169.37.95> Message-ID: Take two. As Fredrik said, "you can't do that" In case you want to know the name of the specific instance, I use the full name. The address will be unique unless you start moving this instance between address spaces. >>> class A: ... pass ... >>> a=A() >>> a <__main__.A instance at 8813b8> wrote in message > can someone fill in the blank > > ------------------------------- > class Hello: > def __init__(self, x): > self.x = x > > def classname(self): > > > ------------------------------- > > >>>from hello import * > >>>clown = Hello(1) > >>>clown.classname() > clown > > In other words I want the method to print the name of the object that it > belongs to > > > -- > http://www.python.org/mailman/listinfo/python-list From aahz at netcom.com Sun Feb 13 21:22:09 2000 From: aahz at netcom.com (Aahz Maruch) Date: 14 Feb 2000 02:22:09 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> Message-ID: <887osh$1rv$1@nntp6.atl.mindspring.net> In article , Samuel A. Falvo II wrote: >In article <000001bf768e$48e40580$45a0143f at tim>, Tim Peters wrote: >> >>class BinTree: >> # with members .left and .right of type BinTree (& None means none), >> # and .data of an arbitrary type >> ... >> def traverse_post(self): >> for child in self.left, self.right: >> if child is not None: >> suspend child.traverse_post() >> suspend self.data >> >>b = BinTree() >>... >>for leaf in b.traverse_post(): >> process(leaf) > >I'm sorry, but I can't follow this code at all. What are the precise >semantics of suspend here? How does it return? suspend *is* a return. It also -- at the same time -- stores the program counter for b.traverse_post(), so that the next call to b.traverse_post() starts at the line of execution immediately following the suspend. This means that, should someone be foolish enough to call b.traverse_post() inside the loop "for leaf...", the loop will probably return incorrect results, just like modifying a list while you iterate over it. Using suspend means that people no longer have to hack __getitem__() to "do the right thing" for a class. Doing this in a threaded environment is dangerous, but no more so than dealing with any other class. -- --- 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 Have you coined a word today? From michael.stroeder at inka.de Fri Feb 18 08:35:31 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Fri, 18 Feb 2000 14:35:31 +0100 Subject: CGI/HTML forms in a standalone application. References: Message-ID: <38AD4AA3.5C470307@inka.de> Moshe Zadka wrote: > > On Fri, 18 Feb 2000, Michael [iso-8859-1] Str?der wrote: > > > > You can derive a class from SimpleHTTPRequestHandler, copy some code from > > > CGIHTTPRequestHandler and come up with a class > > > CGILikePythonFunctionHTTPRequestHandler > > > > I did this and it works as expected except that the browser does not > > stop loading. Do I have to close a socket or associated file? > > Yes: you have to close the associated file object, which you get as an > attribute of the class in the .handle() method. Are you sure? I tried to close self.wfile and self.rfile but an exception was thrown because some lower class (SocketServer? Can't remember) tried to flush the output file. Well, now I found a solution to my problem (see also thread "derived from CGIHTTPServer.py"). I messed around with directly using sys.stdin. After cleaning up my code and using self.rfile and self.wfile directly it works for HTTP-GET. But HTTP-POST still hangs... Ciao, Michael. From BgPorter at NOacmSPAM.org Tue Feb 1 11:55:23 2000 From: BgPorter at NOacmSPAM.org (Brett g Porter) Date: Tue, 01 Feb 2000 16:55:23 GMT Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <%dEl4.13464$t_.281347@news.rdc1.nj.home.com> "Aaron J Reichow" wrote in message news:Pine.SO4.4.02.10002010929410.27729-100000 at ub.d.umn.edu... > > On 1 Feb 2000, Ralf Hildebrandt wrote: > > > LOGO would be good, but don't underestimate kids. 11 year olders can > handle at least some Basic. They had us playing with LOGO (moving the > turtle, defining routines to draw something, problem solving) in like 3rd > and 4th grade -- 8 through 10 years old. I had begun programming (more or > less) in TRS-80 BASIC around 11-12 years old. > > LOGO is neet for a while, as one can draw neet pictures, but programming > something functional, like a little quiz or game, gives one a sense of > accomplishment, especially at that age. Don't underestimate LOGO -- there's a lot more depth there than telling the turtle what to draw. MIT press has several excellent LOGO books that show its depth (My wife used to teach LOGO to 3rd graders...) Also, there's a massively parallel version of Logo (StarLogo) that's a great great way to explore decentrally controlled systems -- if you don;t have access to a Connection Machine, it's available for Mac and maybe Windows... If my son was old enough to want to write code, I would definitely put either Python or LOGO in front of him. > If he cannot handle python, perhaps he should play around with BASIC. As > for the "environment," I think just the plain ol' interactive command line > would suffice, unless he wanted to do minor graphics stuff. In which > case, perhaps QuickBasic (get out those old DOS disks...) might be worth a > look. I disagree with this -- what did Philippe Kahn say -- "BASIC is to programming like crack is to your brain" ? It's almost as bad as giving someone a Herb Schildt C++ book... From ngps at post1.com Tue Feb 1 09:14:51 2000 From: ngps at post1.com (ngps at post1.com) Date: 1 Feb 2000 14:14:51 GMT Subject: Integration of pdb and gdb? Message-ID: <3896ea5b.0@news.cyberway.com.sg> Hello, I am looking for an integration of pdb the Python debugger and gdb the Gnu debugger: while debugging Python in pdb, go into gdb upon encountering an extension function written in C. Is there such a beast? TIA. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps From gerrit.holl at pobox.com Fri Feb 11 15:27:41 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 11 Feb 2000 21:27:41 +0100 Subject: Python sucks loud In-Reply-To: ; from nobooze4u@BLAM!worldnet.att.net on Fri, Feb 11, 2000 at 04:31:08PM +0000 References: Message-ID: <20000211212741.A7207@stopcontact.palga.uucp> Forget it wrote on 950283068: > x-no-archive: yes > You people are funny here, all excited about Python. > Following one guy's recommendation, for two days already I'm looking at > Python as a potential plug-in language, and it DISGUSTS me. What's so > good about this yet another funny-ass language? I wonder if anyone can > say something coherent that wouldn't be laughable. Even perl is less > repulsive, although since it's all about text search it's not good for a > built-in language. Now this Python. How come they don't put semicolons > at the end of the line and the comments start with the number sign? > Phoooey. Can't anyone write some Tiny C with classes and make it > available on the net? So we are supposed to flame you now? You are posting from a non-existing address, so we can't flame you. Sorry, but I can't do you the favor. I'll try to flame, though: Haha, haha, haha, haha, ha, Haha, haha, haha, haha, haha, haha, ha, Since I don't post in c.l.perl.misc but in comp.lang.python, I do not have any experience in flaming people. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From aahz at netcom.com Thu Feb 24 09:55:51 2000 From: aahz at netcom.com (Aahz Maruch) Date: 24 Feb 2000 14:55:51 GMT Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> <89382q$djb$1@nntp6.atl.mindspring.net> Message-ID: <893gpn$isn$1@nntp6.atl.mindspring.net> In article , Olaf Trygve Berglihn wrote: >* aahz at netcom.com >> Take a look at this example I posted a while back: >> http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=570016307&fmt=text > >Nice example. But I have a slightly different problem. I'd like to >have threads that can return a value upon completion to the scope in >which the threads were started. Any suggestions on how to do that in a >simple way? In my example, you pick up values from the thread class instance after it completes. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From tseaver at starbase.neosoft.com Tue Feb 22 11:16:01 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 22 Feb 2000 10:16:01 -0600 Subject: Reading Netscape Mail Folders References: <38B19FF9.83B98466@bellatlantic.net> <24B466DC54C4F03F.2859430E081F2ED8.931793678FF616B7@lp.airnews.net> <38B28D1E.9AC5D9CC@bellatlantic.net> Message-ID: <990C259BC131E3B5.B4030C53C3F3972D.81CF6602E96A5026@lp.airnews.net> In article <38B28D1E.9AC5D9CC at bellatlantic.net>, Steve Holden wrote: >Thanks, Tres: > >I hadn't actually taken the one essential step of replacing the >backslashes in my Windows path so that the test() routine took >a folder filename without looking in the usual UNIX suspect directories. >Certainly manages to find the headers! > Actually, I get the bodies, too, using the rfc822.Message.fp member. I would guess that the mimetools.Message class would likely DWYM, here, but haven't used it myself. Wiping-the-greasepaint-off'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From kuncej at mail.conservation.state.mo.us Wed Feb 16 11:08:07 2000 From: kuncej at mail.conservation.state.mo.us (Jeff Kunce) Date: Wed, 16 Feb 2000 10:08:07 -0600 Subject: Is there any working example of Python ActiveX control for Internet Explore? References: <88d1or$2h5$1@news2.kornet.net> Message-ID: > Does anybody know where I can find working examples of IE ActiveX Control > which is written in Python. I get microsoft-speak all mixed up, but maybe these pointers will help. For an example of using python to control MSIE via COM, see: msiecom.py at http://starship.python.net/crew/jjkunce For an example of embedding Axtive-X controls in wxPython, see: http://www.uconect.net/~wheineman/python/ActiveXDemo.py (Posted recently to the wxPython list by Willy Heineman ) --Jeff From jjlucsy at concentric.net Wed Feb 16 11:11:14 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Wed, 16 Feb 2000 11:11:14 -0500 Subject: Subclassable C Extension Message-ID: How does one write a subclassable C extension? I've written C extensions, but can't seem to figure out how to make it subclassable. I've tried using the CXX files from somewhereoranother, but that seems to GPF/coredump. I'll take examples, URL's to examples, or whatever. Thanks. -- - Joel Lucsy (jjlucsy at concentric.net) From quinn at pfennig.ugcs.caltech.edu Fri Feb 18 00:51:32 2000 From: quinn at pfennig.ugcs.caltech.edu (Quinn Dunkan) Date: 18 Feb 2000 05:51:32 GMT Subject: Module/Directory cleanup References: <6V_q4.4$UB1.531@news> Message-ID: On Thu, 17 Feb 2000 22:48:34 GMT, Robert Hicks wrote: >I have Python, wxPython, and PythonWin loaded on my system and I have PY >files all over the place. How about all modules going into one directory. >This would cleanup not only the many subdirectories that are prevalant but >would also create a cleaner import path. Upgrade and installs would be >easier and cleaner also. Sounds like a good idea. Post your login and password and maybe some kind soul will clean up your directory structure for you. Seriously, though, my convention is: user specific modules and packages go in ~/py, which is in PYTHONPATH set by shell rc. site-specific modules I write go in the ~/py/local package. system wide modules go in /site-packages system wide local modules go in /site-packages/local That way, you can maintain your own python library as a user, and it is clear from directory structure and python code which modules are grabbed off the net and which are local to this machine, and a python re-install won't touch any of it. From grant at nowhere. Mon Feb 21 12:06:35 2000 From: grant at nowhere. (Grant Edwards) Date: Mon, 21 Feb 2000 17:06:35 GMT Subject: Which GUI? References: <38B04C8C.45F96A76@bellatlantic.net> Message-ID: In article <38B04C8C.45F96A76 at bellatlantic.net>, Steve Holden wrote: > >> [That Tcl/Tk is a more stable interface than Tk alone] >> >> Leaving Tcl in is a pragmatic solution, even though it doesn't >> appeal to the minimalist in me. > >If we wanted a minimalist solution we would hardly be using Windows >as an operating system, would we? I don't. ;) One could argue that X11 is hardly a minimalist solution either... -- Grant Edwards grante Yow! Isn't this my STOP?! at visi.com From jbauer at rubic.com Fri Feb 11 14:19:07 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Fri, 11 Feb 2000 13:19:07 -0600 Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> Message-ID: <38A460AB.D541A1B0@rubic.com> What's preventing you from using WinZip to extract the binaries out of the .exe file? I just ran it against py152.exe to check if I could extract individual files and everything looks fine. Jeff Bauer Rubicon Research "J.C.Travers" wrote: > Is there anywhere I can download binaries for > WinNT as a zip archive other than a self-extracting > one. This is really anoying me. I need python on my > user area at uni, but haven't got privaleges to extract > the self-extracting archive. At the moment I'm using > python1.4b3 as it has so far been the only winNT > binaries I have found in a zip file. From cpatti at atg.com Wed Feb 9 13:58:35 2000 From: cpatti at atg.com (chris patti) Date: 09 Feb 2000 13:58:35 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> <87plr8$qig$1@news.tht.net> <87qu5c$inu$1@newshost.accu.uu.nl> Message-ID: m.faassen at vet.uu.nl (Martijn Faassen) writes: > tim wrote: [snip] > I'm not advocating not uploading to ftp's, and > I'm not saying a central FTP > based archive (CPAN-like, or > otherwise) would not be helpful or useful, and > appealing to many! > (After all, it's a fairly frequently recurring thread > here---Deja > search for CPAN in this newsgroup reports about 300 hits.) I > wish > you all good fortune imaginable in your pursuit of a central python > > FTP archive. I here merely muse over the curiously ironic case > which this > thread has spawned out of. > > > Just ignore me. (-: > > Let's not ignore you. :) Am I the only one who thinks that this > 'archive of Python modules' could be constructed pretty easily now > that you gave us Parnassus? We can write a script that translates > Parnassus's structure into directory structure, and then downloads > everything through any download link given. Add an extra link to > Parnassus download pages ('cached'), and open an FTP site if you > like. Run this script once every while, or continuously in the > background of something. And there we have our archive. > > Am I missing something? I'm not saying *Tim* should do this all this > hard work (he's doing more than enough already), but am I the only > one who considers this quite doable given Parnassus? > > Regards, > > Martijn Indeed, nobody should ignore anybody. This is one of the few forums still extant on the USENET where the signal to noise ratio is still well within tolerable ranges :) In fact I think your idea could work, the only nit being that it would be important to "never go backwards" e.g. never remove a module that's been uploaded if say, its home site goes down and becomes unreachable for eons. That's my only issue with a possel-o-links, it's at the mercy of the providing websites to be up all the time. -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From a.eyre at optichrome.com Mon Feb 7 08:36:28 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 7 Feb 2000 13:36:28 -0000 Subject: parsing text In-Reply-To: <87famb$m2u$1@nnrp1.deja.com> Message-ID: <001301bf7170$56293440$3acbd9c2@peridot.optichrome.com> > import string > configfile = open ('filename.ext','r') > name, value = string.split(configfile.readline(),'=') > config[name] = value That only does the first line. Try: import string configFile = open('filename.ext', 'r') configDict = {} for name, value in map(string.split, configFile.readlines()): configDict[name] = value ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From wking at sheltonbbs.com Fri Feb 4 04:57:26 2000 From: wking at sheltonbbs.com (Mike Partin) Date: Fri, 4 Feb 2000 03:57:26 -0600 Subject: Executing external programs with vars References: <949656797.2089988259@news.sheltonbbs.com> Message-ID: <949658312.1969735064@news.sheltonbbs.com> >def hopefully_help_mike(): > module = raw_input("Enter module to check out: ") > os.system("cvs -z3 co %s"%module) you should start a psychic hotline.....that worked beautifully thank you Mike Partin From amused at webamused.com Sun Feb 6 23:40:17 2000 From: amused at webamused.com (Joshua Macy) Date: Mon, 07 Feb 2000 04:40:17 GMT Subject: Files and Directories References: <2Lqn4.5185$NS3.16759@newsfeed.slurp.net> Message-ID: <389E4A53.6F383092@webamused.com> Patrick K Moorman wrote: > > Thanks to everyone who answered my last question, it is good reminder that > computers do *ONLY* what they are told. I am trying to write a little > script that will rename files in multiple directories. What am a looking > for is a way to take each item returned by os.listdir() and test to see if > it is a file or a directory. I have gone through the lib reference but I > did not see anything that would work. I know very little about programing > or Pyhton (if you haven't guess yet) and I am learning by doing. Or not > doing as the case is right now :) os.isdir(path) will return true for a directory, and os.isfile(path) will return true for a regular file. Joshua From wtanksle at hawking.armored.net Tue Feb 15 14:42:29 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 15 Feb 2000 19:42:29 GMT Subject: RC (was Re: Real Problems with Python) References: <001001bf7763$e37ab280$66a2143f@tim> <38A979D2.71CD8FB3@inrialpes.fr> Message-ID: On 15 Feb 2000 11:50:13 -0500, Fran?ois Pinard wrote: >Vladimir Marangozov writes: >> Saying that "RC has excellent LOR", even when trash is recycled at high >> rates, is disturbing. >Sorry, I'm getting lost in acronyms, as we have a seen a lot on this topic >so far. RC is for reference counting, right? What is LOR for? "Lord Of the Rings." Tolkien's work was allegorical on many levels. Ring Counting (or RC), as in the books, helps to determine which objects need to be destroyed. However, Rings are naturally in cycles, so naive RC didn't work to actually destroy the Ring. I'll stop now. Even though I really want to keep going. "Reference Counting" and "Locality of Reference" (the lack of which destroys the usefulness of caching). >> BTW, any comparison of RC with state-of-the-art GC is fine by me. >As for GC, I figured it out :-). "Guido's C" conventions? Of course. >Fran?ois Pinard http://www.iro.umontreal.ca/~pinard -- -William "Billy" Tanksley, in hoc signo hack From the_wrights at onaustralia.com.au Fri Feb 18 06:43:04 2000 From: the_wrights at onaustralia.com.au (the_wrights) Date: Fri, 18 Feb 2000 22:43:04 +1100 Subject: two questions References: Message-ID: <59ar4.28612$3b6.132160@ozemail.com.au> Brett Tribble wrote in message news:saocl56k2pd11 at corp.supernews.com... ------some stuff-------- "Tribble"....wasn't there a hardware god at Apple called Bud Tribble???? just IDLE-y curious chris wright From aahz at netcom.com Sat Feb 12 14:50:11 2000 From: aahz at netcom.com (Aahz Maruch) Date: 12 Feb 2000 19:50:11 GMT Subject: OT: Celebrating Python References: <38A5AAB4.5F56B3A0@digicool.com> Message-ID: <884dhj$l0a$1@nntp6.atl.mindspring.net> In article , Neil Schemenauer wrote: >Paul Everitt wrote: >> >>I was a bit surprised -- I didn't think it was _six_ years ago! > >Time flys when your having fun. :) Time's fun when you're having flies. -- --- 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 Have you coined a word today? From grant at nowhere. Tue Feb 1 10:11:05 2000 From: grant at nowhere. (Grant Edwards) Date: Tue, 01 Feb 2000 15:11:05 GMT Subject: MAPI and NT Service References: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC73@RED-MSG-50> <388F1893.879D0550@netscape.com> Message-ID: In article , Mark Hammond wrote: > >> BUT when I do: >> >> outbox = session.Outbox >> >> my NT service fails. > >MAPI defers alot of security stuff until actually needed. What user >is the service logged on as? I would guess that it is NT/Exchange >security related rather than your script... As long as we're talking about MAPI, my MAPI->SMTP forwarder is working, but the Exchange->SMTP address translation is some a bit of code that will only work for this server (there is a systematic way to transform a person's "Name" into his SMTP address). Is there a way to ask the Exchange Server to translate a MAPI Address Entry object into an SMTP address string? I've been looking around the MSDN web pages and haven't found anything yet... -- Grant Edwards grante Yow! I was giving HAIR at CUTS to th' SAUCER PEOPLE visi.com ... I'm CLEAN!! From tim_one at email.msn.com Fri Feb 4 00:47:27 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 4 Feb 2000 00:47:27 -0500 Subject: Circular references and python In-Reply-To: Message-ID: <000c01bf6ed3$51946de0$a2a0143f@tim> [Neel Krishnaswami] > ... > I think a lot of people are working with severely outdated notions of > the performance of of garbage collectors. Even 16 or 17 years ago > garbage collection was expensive enough that Lisp Machiness made it > something you ran manually every few days. > > But the state of the art has improved hugely: in _Compiling with > Continuations_, Andrew Appel claims that a well-tuned generational > garbage collector is competative with stack allocation in terms of > speed, for functional and OO languages. (IIRC, SML/NJ allocates even > activation records on the heap, and wins doubly because this > simplifies the runtime.) Speed isn't the hangup in the Python world. It's much more ease of porting to new platforms (the amount of time spent now on porting CPython's gc: 0), and CPython's extraordinary friendliness to extending and embedding. JPython inherits Java's "real gc", and you need only visit the JPython archives to see the jealousy of CPython's ability to talk to the rest of the world <0.3 wink>. Any scheme that relocates objects (generational or otherwise) will almost certainly never happen in CPython for that reason; ditto any scheme that requires CPython to carve up the address space (part of being maximally friendly is living with whatever the heck the platform malloc feels like doing). I don't expect reference counting will ever go away in CPython (too many people like its relatively predictable semantics. too), although I do expect *some* way to reclaim cycles (at unpredictable times) will eventually be added. no-pure-wins-ly y'rs - tim From cpatti at atg.com Thu Feb 10 11:56:54 2000 From: cpatti at atg.com (chris patti) Date: 10 Feb 2000 11:56:54 -0500 Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com> <38A234AA.2B1FE6CB@python.net> <14498.52621.853399.866552@weyr.cnri.reston.va.us> Message-ID: "Fred L. Drake, Jr." writes: > Thomas A. Bryan writes: > I'm not sure how these tools integrate or > whether it is the type of integration > you're looking for, but you > might want to look at one or both before > proceeding. In > particular, you may want to look at the functionality > provided by > ToolTalk before designing your standard protocol. > > For those who don't know, ToolTalk is a "message bus" system; > > there's a server that dispatches messages to listening > applications. > The listeners and message providers are all > ToolTalk clients. I don't know how widespread ToolTalk support > is; I think it > originated on Sun systems, and it's used as the > message bus for CDE. > I don't know if it's included on Linux or > if there are implementations > for Windows or MacOS platforms. > But I'd be interested in finding out. ;) > > > -Fred I think it's heavily proprietary and not available as source code. I could be wrong though, and would be happy to be proven so :) -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From anders.eriksson at morateknikutveckling.se Thu Feb 10 04:45:27 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Thu, 10 Feb 2000 10:45:27 +0100 Subject: CGI Scripts References: Message-ID: On Sun, 06 Feb 2000 01:11:40 GMT, "Robert Rutkowski" wrote: >My problem is that the script returns a result via the print command. {print >`count()`}, but when I try to run the script on my server, I get no results, >just a blank page. >Am I missing something? Is there a module that I need to pass the result to >to see it in my web browser. First I would add two 'debug' lines to the script sys.stderr = sys.stdout print "Content-Type: text/plain\n" If anything is wrong then you will see it in the browser! Then I also would add some more text so I could see if the print out of the count() is wrong or if it's something else. One thing I have noticed is that if I get an error/exception in the script then I get somekind of default blank HTML-page. # sys.stderr = sys.stdout print "Content-Type: text/plain\n" print "Hello World" print `count()` Hope this helps a bit // Anders -- English isn't my first or second language, so errors or anything that you find offending is not there on purpose it's just due to the translation. From tseaver at starbase.neosoft.com Mon Feb 28 11:52:53 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 28 Feb 2000 10:52:53 -0600 Subject: Continuations and threads (was Re: Iterators & generators) References: <001201bf81c7$be99f8e0$f0a2143f@tim> Message-ID: In article <001201bf81c7$be99f8e0$f0a2143f at tim>, Tim Peters wrote: >Well, ya, OK, *I'm* interested -- but you don't have to sell it to >me, and I'm not positive anybody else (besides Jeremy) has actually read the >paper. A concise but accurate implementation sketch is sufficient for >developers. This needs something else to make progress. > >like=a-catchy-slogan-or-celebrity-endorsement-ly y'rs - tim The really sexy hook is still using SLP to wedge Python into the Palm (aiyah, that sounds AWFUL). Slavering'ly Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From moonseeker at my-deja.com Wed Feb 2 05:04:28 2000 From: moonseeker at my-deja.com (moonseeker at my-deja.com) Date: Wed, 02 Feb 2000 10:04:28 GMT Subject: dyn added methods dont know self? Message-ID: <878vfb$3hn$1@nnrp1.deja.com> Hi! I want to add a method dynamically to an instance, how can I do this? I tried with exec '...' in self.__dict__, but this method doesn't know the instance reference 'self', so it would complain that it is called without an argument. Is there any other method to add a method dynamically? Thanks, Mike Sent via Deja.com http://www.deja.com/ Before you buy. From amused at webamused.com Tue Feb 1 21:26:44 2000 From: amused at webamused.com (Joshua Macy) Date: Wed, 02 Feb 2000 02:26:44 GMT Subject: How do I create a new file? References: <875kjv$m8r$1@nnrp1.deja.com> Message-ID: <389793DE.D586A9B1@webamused.com> bovinesoft at my-deja.com wrote: > > What code would I use if I wanted to create a new file in python? If > you could help me with this, I would be greatly appreciative. Thanks > again. > > Sent via Deja.com http://www.deja.com/ > Before you buy. f = open('test', 'w') will open the file test for writing. Joshua From kclark at ntlug.org Tue Feb 1 15:43:46 2000 From: kclark at ntlug.org (Kendall Clark) Date: Tue, 1 Feb 2000 14:43:46 -0600 (CST) Subject: "Python Annotated Archives" A good book? In-Reply-To: <20000201211906.B2206@stopcontact.palga.uucp> Message-ID: <14487.17794.272728.990887@cmpu.net> >> Greetings, >> As a newbie pythonista, I saw this book and was wondering what >> others thought, as far as technical quality, target audience >> suitabilty, and readability. With all due respect to the book's author, I disliked it so much I sent it back the day after it arrived from Amazon. I'm a book junkie and buy everything on Python, but this is the only one that just seemed terribly unhelpful. Maybe that's because most of it seemed more basic than my Python skill level presently, but it simply didn't seem worth keeping for as much as it costs. For beginner's, I think Learning Python is excellent, as well as the Quick Python book. I have a huge shelf of computer books, many of which are aimed at teaching programming, since I'm an autodidact in this area. I think both Learning Python and the Quick Python book are among the very best 'new to programming' books I've read. I've given people, who I wanted to teach to program, copies of Learning Python several times already, and some of them are progressing nicely. As much as I enjoyed it, I've never done that either for The Little Schemer or Simply Scheme. Python hits the *perfect* balance of 'easy to learn' (because clean, elegant, and just the right kind and amount of syntactic sugar) and 'useful for practical tasks'. Smalltalk also comes very close, particularly the, imo, excellent Squeak. REBOL may also develop into a contender, though, I suspect, not any time soon. Just another datapoint. Best, Kendall Clark From jae at ilk.de Thu Feb 24 15:03:51 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Thu, 24 Feb 2000 21:03:51 +0100 Subject: jack, curses and rpms Message-ID: <24022000.4@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I recently discovered jack, a CD ripping/MP3 encoding integrator written in python (cool, I can hack it ;-). Nice program. With but one problem... it needs a curses interface (yep, the docs are right about that, you *need* it). Which in turn needs a patched Modules/cursesmodule.c (it doesn't work with the one in 1.5.2). Okay, so I got cursesmodule.c from the CVS... tried to patch it with the included diff... which failed. Huh? So, I checked that... and found that I needed the cursesmodule.c from the Python RPMs. I got that and patched it... and all's well. Well, not really... the fact that the Python RPMs have a very different (at least in source, if not in function) cursesmodule.c is pretty bad. Some call this fragmentation, some will call the Python RPMs a fork (I for one will do that). This situation should be ended *NOW*.[1] Bye, J [1] Whoever needs to get together and talk should do so... to sooner, the better (and the later the worse). Actually, this should never have happened to begin with... PS: Of course, if the changes in the Python RPMs are to be integrated into Python proper, all will be well again (*when* that has happened). PPS: I could yammer to the Debian Python maintainer to integrate the RPM patches into the Debian package... but I won't. I really want *one* Python, not several slightly incompatible ones. - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://JuergenErhard.tripod.com I'm a FIG (http://www.fig.org) Codito, ergo sum - I code, therefore I am -- Raster -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAji1jqYACgkQN0B+CS56qs3lNQCdFo8/YjfTHMxyLB7OQMd9mCT1 h2YAoKGavNot8bmajLPi0+RYR5vWnCX/ =9qW2 -----END PGP SIGNATURE----- From max at neomeo.com Fri Feb 18 10:51:29 2000 From: max at neomeo.com (David Max) Date: Fri, 18 Feb 2000 10:51:29 -0500 Subject: Has anyone wrapped NMH or MH tools? Message-ID: <38AD6A80.14ADB94B@neomeo.com> Has anyone wrapped up (SWIG or otherwise) any of the NMH or MH tool functions? - David From cfelling at iae.nl Sat Feb 5 16:37:17 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 5 Feb 2000 22:37:17 +0100 Subject: [Doc-SIG] Monty: A structured text syntax idea References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> <20000203160900.A1029@stopcontact.palga.uucp> <87evlq$vu$1@vvs.superst.iae.nl> <20000205084721.A1020@stopcontact.palga.uucp> Message-ID: <87i56d$255$1@vvs.superst.iae.nl> Dear Gerrit, I didn't intent to correct you like that, I merely used your error to vent this wish of mine to get summaries from the sigs. Gerrit Holl wrote: > I was frustated by the fact no Reply-To: header was set, but from now > on, I'll do a g)roup reply (mutt). I'm sorry. You could use mutt's list capabilities and do a L)ist reply and yes I sympathise with your resentment of missing headers. > My .procmailrc in 288 LOC. excuse my ignorance, but my parser gave up on this one:) -- groetjes, carel From jonathan.gilligan at vanderbilt.edu Wed Feb 2 19:35:35 2000 From: jonathan.gilligan at vanderbilt.edu (Jonathan Gilligan) Date: Wed, 2 Feb 2000 18:35:35 -0600 Subject: "Python Programming on Win 32" available References: <3898b54c.1949600@news.btx.dtag.de> Message-ID: <87aigo$jv8$1@news.vanderbilt.edu> I ordered it from fatbrain today and am told that it shipped this afternoon. "Stefan Franke" wrote in message news:3898b54c.1949600 at news.btx.dtag.de... > Is the book available already? Amazon.com says "ships within 2-3 > days." > > Stefan > > From meowing at banet.net Mon Feb 21 23:02:52 2000 From: meowing at banet.net (Chunk Light Fluffy) Date: 22 Feb 2000 04:02:52 GMT Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > I have a problem. In my Python enthuishasm, I ripped off the braces > from my keyboard because I thought I didn't need them. > Unfortunately, I have a problem now. I can't create dictionairies any > more! And because braces aren't the only keys on the brace key, [...] Let this be a lesson to everyone who scoffed at ISO/ANSI C trigraphs. [note to self: Cancel that order for LSD-laced thumb tacks. Bad idea.] From neelk at brick.cswv.com Wed Feb 9 21:10:10 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 10 Feb 2000 02:10:10 GMT Subject: Ann: Plex 0.1 - A Lexical Analysis Module References: <389F69C8.BCCE4CA@cosc.canterbury.ac.nz> Message-ID: Greg Ewing wrote: > Having spent a couple of years wondering "when is someone > going to write a decent lexing module for Python", I finally > decided to do it myself. Very slick, especially the the constructor-style you use with the FSMs. A first look at the code suggests that unlike with regexps, you could build symbolic lexers for /arbitrary sequences of Python objects/.[*] This is cool all by itself -- think of writing a readable, pure-Python peephole optimizer with bytecodehacks -- but if you could combine this with, say, list comprehensions, I think that whole new vistas may open up.... [*] I think it would be necessary to rewrite TokenStream, but that's not too bad. Neel From drs at labs.agilent.com Fri Feb 25 15:10:21 2000 From: drs at labs.agilent.com (David Smith) Date: Fri, 25 Feb 2000 12:10:21 -0800 Subject: parameter undefined in procedure Message-ID: <38B6E1AD.20DA1CE6@labs.agilent.com> I have a module named test.py, which contains only the following definition: def bar(dictionary): list = ['alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot'] return map( lambda(x): dictionary.get(x,"default"), list) I import it and run it, and get an error message as follows: >>> from test import * >>> bar( {} ) Traceback (innermost last): File "", line 1, in ? bar( {} ) File "E:\tmp\test.py", line 3, in bar return map( lambda(x): dictionary.get(x,"default"), list) File "E:\tmp\test.py", line 3, in return map( lambda(x): dictionary.get(x,"default"), list) NameError: dictionary >>> Isn't this supposed to work? The map statement (minus the return) works as a standalone line if I give it a global variable for dictionary. David Smith P.S. Python announces itself as Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam IDLE 0.5 -- press F1 for help >>> From moshez at math.huji.ac.il Fri Feb 11 17:12:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 00:12:59 +0200 (IST) Subject: Except an exception AND all its subclasses? In-Reply-To: <4I%o4.455$Ph6.187912704@newsa.telia.net> Message-ID: On Fri, 11 Feb 2000, Fredrik Lundh wrote: > Gerrit Holl wrote: > > it's not possible to catch an exception and all its subclasses as > > of python 1.5.2, is it? > > I'm tempted to say something about time machines, but > afaik, this has been supported since the very beginning: Where the very beginning is defined as "from the time we stopped using string exceptions?". I'm sure there was no such feature when exceptions were strings. In fact, I distinctly remember a post by the other bot about how to simulate it with string exceptions. Sorry I didn't resist the temptation to mention time machines <0.5 wink> -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gko at gko.net Tue Feb 22 02:58:57 2000 From: gko at gko.net (Georges KO) Date: 22 Feb 2000 15:58:57 +0800 Subject: Is there any Tkinter telnet client? Message-ID: Hi folks, Is there any Tkinter telnet client code available? Thanks! -- Georges KO Alcatel Telecom Taiwan gko at alcatel.com.tw / gko at gko.net Mardi 22 f?vrier 2000 From jhauser at ifm.uni-kiel.de Fri Feb 25 03:05:17 2000 From: jhauser at ifm.uni-kiel.de (Janko Hauser) Date: 25 Feb 2000 09:05:17 +0100 Subject: Numpy: inverse of take? References: <38B60386.D464417@ee.adfa.edu.au> Message-ID: <87k8jtr9ky.fsf@ifm.uni-kiel.de> If you have numpy from the LLNL11 source, there is an additional module in the graphics tree named arrayfns. This module has an array_set function coded in C which does exactly this. But as in the case with take it only deals with onedimensional indices. 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 skip at mojam.com Wed Feb 9 22:24:54 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 9 Feb 2000 21:24:54 -0600 (CST) Subject: Using class data attributes In-Reply-To: <2l94ass5kdbgkaep64k9rl14m14dojc2vd@4ax.com> References: <2l94ass5kdbgkaep64k9rl14m14dojc2vd@4ax.com> Message-ID: <14498.12166.309708.334072@beluga.mojam.com> Craig> I would like to be able to read and write data attributes as in Craig> Delphi and automatically invoke functions. Take a look at the special methods __getattr__ and __setattr__. They should provide the hooks you need to accomplish what you want. For details, check the reference manual section on customizing attribute access: http://www.python.org/doc/ref/attribute-access.html __getattr__ is only called if normal attribute lookup fails. If defined, __setattr__ is always called, even if the attribute in question already exists. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From boud at rempt.xs4all.nl Sun Feb 20 11:36:14 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 20 Feb 2000 16:36:14 GMT Subject: Which GUI? References: Message-ID: <88p55u$dk3$2@news1.xs4all.nl> Fredrik Lundh wrote: > btw, I just looked at the wxPython tutorial. > every single example in that tutorial can be written in > Tkinter, using about 50% as much Python code. and > things like layout management and event handling looks > embarrasingly primitive compared to Tkinter. > methinks wxPython is superior to Tkinter in pretty much > the same way as languages with braces are superior to > languages using indentation... That's interesting - I wonder what how the comparison with PyQt would turn out. It's not fair to note that the PyQt version of the IDLE classbrowser uses less lines or words, because Qt offers a treewidget out of the box, and the IDLE treewidgets seems to be custom built, so I won't... One import thing about widget sets is the look and feel - not for Windows users, maybe, because all Windows toolkits appear to use the horrible Windows widgets, but on Unix there's a lot of room for personal taste. And frankly, I detest the tk look and feel and dislike the gtk look and feel (though not as much as Motif). -- Boudewijn Rempt | http://www.valdyas.org From robin at jessikat.demon.co.uk Mon Feb 28 18:23:00 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Mon, 28 Feb 2000 23:23:00 +0000 Subject: Q about tail recursion In-Reply-To: References: <000801bf8105$18b99ba0$172d153f@tim> Message-ID: In message , Fran?ois Pinard writes >Robin Becker writes: > >> I quite often want to use None as an exceptional return eg in the case of a >> list returning function [] might be a legal return and None an illegal one. > >Yes, `None' is a Python natural for a "missing" result, and there are many >cases where such are usefully represented and handled. > >> That way I can leave the error handling to the caller. I guess I should >> really be raising an exception though to be truly pythonian. > >That might become too heavy (and probably slow), as "missing" is ubiquitous >when handling statistical or experimental data, for example. > I agree about efficiency. I guess I could make my own error values eg SeriesMissing or whatever. -- Robin Becker From skip at mojam.com Mon Feb 14 16:03:07 2000 From: skip at mojam.com (Skip Montanaro) Date: Mon, 14 Feb 2000 15:03:07 -0600 (CST) Subject: BSDDB 1.8.x is buggy? In-Reply-To: References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> <14504.17006.398813.576385@beluga.mojam.com> Message-ID: <14504.28043.793755.911657@beluga.mojam.com> Warren> I have been exercising the bsddb unit with the following code. Warren> Can anyone show me something that will break bsddb? Or are the Warren> bugs too stealthy to produce a test case? They are pretty stealthy. There are bugs in the hash mode when you get fairly large files. I seriously doubt you'll notice them with files containing just a handful of keys. Warren> The following test code starts with around 100 rows, and works Warren> it's way up to file sizes over 100 mb. If there were any Warren> duplicate key problems or core dumps in the database, would I Warren> find them this way? Maybe. Warren> I have to ask myself, if code can work millions of times in a Warren> row, and then fail once, what does that say about it's design? Warren> What exactly was fixed in 2.0? Were the fixes "one liners" and Warren> "fencepost errors", or was it a total architecture change? The code to implement this sort of stuff is not trivial, so it's not entirely surprising that there are bugs. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From mhammond at skippinet.com.au Fri Feb 4 18:16:56 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 04 Feb 2000 23:16:56 GMT Subject: Freezing an app using win32com and wxPython References: <87ckq3$ot1$1@nnrp1.deja.com> Message-ID: wrote in message news:87ckq3$ot1$1 at nnrp1.deja.com... ... > Freeze reports: > freezing wxPython.wx ... > generating table of frozen modules > No definition of module pythoncom in any specified map file. > No definition of module pywintypes in any specified map file. > No definition of module win32api in any specified map file. > No definition of module win32ui in any specified map file. > No definition of module wxPython.wxc in any specified map file. > Warning: unknown modules remain: pythoncom pywintypes win32api win32ui > wxPython.wxc > > > How close am I to getting this app succesfully frozen, and how can I > go the last mile? (I do not have a PYTHONEX env.variable, partly > because I'm not sure what it is for or what to set it to) You should be very close. If you can make the nominated modules available then life should be good. What specific problem do you have? Mark. From boud at rempt.xs4all.nl Mon Feb 7 15:55:45 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 7 Feb 2000 20:55:45 GMT Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> Message-ID: <87nbgh$7lm$1@news1.xs4all.nl> chris patti wrote: > Umm, I'm not sure where you're getting the "tragic" from. > I merely noted in my post that I felt a _centralized_ FTP based > repository of all the freely available modules in existence for Python > would be a Good Thing, because it would make things easier for both > maintainers and users as it would provide a central point of exchange. > /contrib on ftp.python.org != CPAN, you miss the point, I think. > What I'm referring to is not just an FTP archive but a controlled and > _maintained_ collection of all the modules. > Yes it would require work, and yes I'm willing to put my money where > my mouth is and help build such a thing if there's interest in other > quarters and archive space becomes available. Have you tried interesting VA Linux in donating a bit on sourceforge? KDE is moving there, too, and maybe they are willing to host a large and bandwidth-gobbling Python archive. -- Boudewijn Rempt | http://www.valdyas.org From tim_one at email.msn.com Thu Feb 17 01:48:01 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 17 Feb 2000 01:48:01 -0500 Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <38AB8445.DF945829@webone.com.au> Message-ID: <001d01bf7912$ef340800$dea0143f@tim> [Stuart Hungerford] > See: > > http://www-4.ibm.com/software/developer/library/ruby.html > > Where it says: > > [a bunch of dubious stuff] > > Comments? Yes: the mistaken points in the article are obvious to any Python programmer, so there's no point to refuting them on c.l.py. Instead, after comp.lang.ruby is formed, we'll descend on it like a horde of enranged barbarians . web-journalism-is-more-web-than-journalism-ly y'rs - tim From gvwilson at nevex.com Mon Feb 14 13:11:23 2000 From: gvwilson at nevex.com (Greg Wilson) Date: Mon, 14 Feb 2000 13:11:23 -0500 Subject: Argo / Python / UML design tools Message-ID: Is anyone working on UML design tools that are Python-friendly? More specifically, has anyone taken a look at Argo (http://www.ics.uci.edu/pub/arch/uml/) with an eye to making it understand Python? If so, I'd be grateful for a ping... Thanks, Greg From frank.sergeant at redneck.net Sat Feb 19 01:14:47 2000 From: frank.sergeant at redneck.net (Frank Sergeant) Date: 19 Feb 2000 00:14:47 -0600 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') References: <38AC9E92.C1CEFEB7@inka.de> <38AD3C67.A08EFE2D@inka.de> <87u2j68n7j.fsf_-_@den.home.net> <38AD8B9C.F3F4DCF5@inka.de> Message-ID: <8766vlu3ag.fsf@den.home.net> Michael Str?der writes: > > Well, here is what I've been using very successfully. > > Thanks for submitting your code. You're welcome. Thanks for posting the details about your approach as well. > But there are open issues: > > SimpleHTTPServer is based on SocketServer and > [python-doc]/lib/module-SocketServer.html says: > > "These four classes process requests synchronously; each request > must be completed before the next request can be started." > > In my case there might be long-running LDAP queries which would > block all other users. Do you already have some example code with > threading? I will dig into this and publish the code... Sorry, no. I realize that my approach handles the requests serially. I think this will be sufficient for my purposes, but I am looking forward stress testing it at some point. My target application would have probably no more than 2 to 10 concurrent users, over an office intranet. I would be delighted if someone would extend (my or your or another) web server to handle requests in parallel. Medusa sounds great, but I gather there are fees for commercial use, which I would rather avoid at this point. -- Frank From mwh21 at cam.ac.uk Tue Feb 15 12:21:25 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 15 Feb 2000 17:21:25 +0000 Subject: RC (was Re: Real Problems with Python) References: <001001bf7763$e37ab280$66a2143f@tim> <38A979D2.71CD8FB3@inrialpes.fr> Message-ID: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= writes: > Vladimir Marangozov writes: > > > Saying that "RC has excellent LOR", even when trash is recycled at high > > rates, is disturbing. > > Sorry, I'm getting lost in acronyms, as we have a seen a lot on this topic > so far. RC is for reference counting, right? What is LOR for? LOR = locality of reference (I'm fairly sure). Important for caches and things. Though I'd have to say worrying about cache misses caused by Python's reference counting strikes me as, uh, not especially productive, though I'd have to admit I'm not really following every nuance of the discussion (Tim Peters and Vladimir Marangozov being difficilt to understand in a technical discussion! Gosh!). I suppose VM page misses are more important... Cheers, MIchael From tbryan at python.net Thu Feb 3 22:19:58 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Thu, 03 Feb 2000 22:19:58 -0500 Subject: Examples for boss: Python for www game and chat References: <3899BA97.D7CD8E90@psychosis.com> Message-ID: <389A455E.6DC89BD5@python.net> Dave Cinege wrote: > > I need refereces, of of any internet gaming systems that utilize python Origin Systems in Austin, TX, once contacted me about a Python position for some sort of multi-player online game. Unfortunately, I couldn't take the job. I think that they also posted to comp.lang.python. Search deja.com for the post....summer of 1999. ---Tom From python at channel21.com Sat Feb 26 15:42:46 2000 From: python at channel21.com (Channel21 Python Team) Date: Sat, 26 Feb 2000 15:42:46 -0500 Subject: FW: [aspcrash] RE: ASP w/ Sybase crashing all the time Message-ID: <81DD38F43381D111BA3E00A076A0998A459F6B@XENON> thought you guys might want to see this... > ---------- > From: Channel21 ASP Team > Reply To: Channel21 ASP Team > Sent: Saturday, February 26, 2000 3:41 PM > To: 'aspserver' > Cc: 'asppython at ls.asplists.com' > Subject: RE: [aspcrash] RE: ASP w/ Sybase crashing all the time > > your suggestion just gave me an idea, and I have narrowed the problem to > db access. > I tried making pages w/ just <%@ Language=Python%> and it worked fine. > Then, I imported a few standard modules (string, os, random, time) and it > worked fine. > I imported on of my modules and it worked fine. > But, when I imported any database access modules (or modules which called > other db access modules) the pages were blanked... > > I am trying to get the MDAC stuff from MSDN now, but the site seems to be > down (or at least I can't route to it). Hopefully that will work. > > THANKS for pointing out my 4-leaf clover !!! ;) > > ---------- > From: John[SMTP:John at marketmovements.com] > Reply To: aspserver > Sent: Friday, February 25, 2000 11:47 AM > To: aspserver > Subject: [aspcrash] RE: ASP w/ Sybase crashing all the time > > It could be that your MDAC or ODBC installations have got messed up. > > Go to the MDAC part of the MSDN Site, and download the Comcheck > component, this will pinpoint any DLL incompatabilities you may have, > this MAY help sort out your problems. > > John Harris > Webmaster, MarketMovements.Com > > Visit us at http://www.marketmovements.com > > The information contained in this message is confidential and is > intended for the addressee only. If you have received this message in > error please notify us as soon as possible. The unauthorised use, > disclosure, copying or alteration of this message is forbidden. This > message and any attachments have been virus checked by AC Nielsen MMS > Ltd prior to transmission. AC Nielsen MMS will not be liable for direct, > indirect or consequential damages arising from alteration of this > message by a third party or as a result of virus infection. Information > may be legally privileged. > > > > -----Original Message----- > > From: asp [SMTP:asp at channel21.com] > > Sent: 25 February 2000 15:22 > > To: aspserver > > Subject: [aspcrash] RE: ASP w/ Sybase crashing all the time > > > > seems you are having a similar problem as with my Python issue... > > Perhaps the issue is not simply a result of Sybase or Python... > > *shrug* > > > > > ---------- > > > From: Jo?o Edgar Sallay[SMTP:Sallay at colortel.com.br] > > > Reply To: aspserver > > > Sent: Wednesday, February 23, 2000 4:24 PM > > > To: aspserver > > > Subject: [aspcrash] ASP w/ Sybase crashing all the time > > > > > > > Hi, > > > > does anybody here use ASP with Sybase 11.03 or another version? > > > > I'm in serious trouble. My site crashes after some hits to the ASP > > > > pages. The damn Dr. Watson window is always poping up in the > > server > > > > screen with the c00000005 exception error in the inetinfo.exe > > module. > > > > I've tried the exception monitor but it's quite difficult to > > > > understand it. I really don't have any idea about what's > > happening. > > > > Maybe it's beeing caused by the Sybase ODBC drivers. I don't know. > > > > I'm running the 2.1 version of MSDAC. > > > > Does anybody have any hint abou it? > > > > Any help would be very appreciated. > > > > > > > > TIA, > > > > > > > > Jo?o Edgar Sallay > > > > > > > > PS: After my lunch, I'm gonna reinstall the Option Pack. God bless > > me! > > > > > > - [aspcrash member asp at channel21.com - > > > > > > > > - [aspcrash member john at marketmovements.com - > > - [aspcrash member asp at channel21.com - > > From thierry at acm.org Mon Feb 14 11:58:39 2000 From: thierry at acm.org (Thierry Thelliez) Date: Mon, 14 Feb 2000 09:58:39 -0700 Subject: [GemStone/S] GemStone CORBA client to Python server Message-ID: <38A8343F.E0B8430F@acm.org> Hello, I need to prototype a CORBA connection between GemStone and a module written in Python. GemStone will NOT be a server in this case. Depending on some conditions, a Gem will have to connect to a python server (serving graphics). Most of the time the Gem will NOT have to connect to this Python server. I have tested my Python server with a Python client (with omniORB.py). Seems to work ok. So the questions are: 1- How do I use GemStone as a CORBA client ? Being very new to GemOrb and CORBA, I am wondering if I really need a GemStone ORBBroker + ORBServer when I don't need the GemStone CORBA server capabilities (at this point). I am not sure to understand the CorbaORB usefulness. It seems to be a small client for development ? 2- How do I start a GemStone CORBA client on an IOR string ? When I start my Python server, I get an IOR string that I give as input argument to my Python client. I browsed the GemStone code without finding an equivalent. GemORB documents how to start a connection on a given port but not on a given IOR. 3- How do I share this IOR ? This is more a general CORBA question, but what do I do with this IOR string generated by server ? Store it in a file ? How do I pass it to the client ? What if server and client don't work on the same server ? Should the client access this file through ftp or something like that ? Or am I missing something in CORBA ? Thanks a lot ! Thierry From gerrit.holl at pobox.com Wed Feb 23 14:39:45 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 20:39:45 +0100 Subject: Which GUI? In-Reply-To: ; from vetler@ifi.uio.no on Wed, Feb 23, 2000 at 06:13:54PM +0100 References: <20000223161839.B3134@stopcontact.palga.uucp> Message-ID: <20000223203945.C4980@stopcontact.palga.uucp> > > > > and advantages, while wxWindows or QT already has lots of > > > > documentation, that not need to be copied into wxPython and PyQT. > > > > > > wxPython and pyQt are not as portable as Tkinter. > > > > Please give an example! > > well.. I'm only repeating what I've read previously in this thread. > I believe Qt is not available for Windows without paying money, and I'm > not sure what platforms Qt and wxWindows (or whatever it's called) is > available on. For QT, I agree. For wxWindows, I don't know - I heard people say it runs on the AIX, I heard people say it doesn't. > > > Tkinter does NOT reinvent the wheel. I can't understand where this comes > > > from. > > > > It provides their own classes. These classes are invented by Tkinter, they > > do not exist in Tcl/Tk. And the methods don't even *match* with Tcl functions! > > I must admit I'm on new territory here. I've only been using Python and > Tkinter for ~5 months or so. So my statements may have nothing to do with > reality. I appologize. I think this is ironic. As soon as I got stuck for many hours searching Tcl manpages for Python calls and having to read Python source code to find out the Python way to do something described in the Tcl manpages, I stopped using Tkinter. But I repeat: *********************************** ***** IN MY HUMBLE OPINION!!! ***** *********************************** Fredrik does not seem to get that. I'll probably need to put this in my .sig because I otherwise risk to get flamed because of my opinions. I do not live in a dictatorship. > However, my experience with Tkinter is only positive. I think it's easy to > use, I do _not_ think it's ugly, and I have successfully used the Tcl/Tk > documentation together with Tkinter. I haven't. > But, as I have nothing more interesting to say about this, I will shut up Me neither, but I find Fredrik's reaction very strange, especially because he mentions my "madness" everywhere in c.l.py now! regards, Gerrit. -- *********************************** ***** IN MY HUMBLE OPINION!!! ***** *********************************** From warlock at eskimo.com Wed Feb 23 14:20:42 2000 From: warlock at eskimo.com (Jim Richardson) Date: Wed, 23 Feb 2000 11:20:42 -0800 Subject: Which GUI? References: <20000220194012.A2069@stopcontact.palga.uucp> Message-ID: On Mon, 21 Feb 2000 18:24:09 GMT, Fredrik Lundh, in the persona of , brought forth the following words...: > >or just explain to me why putting wxPython on top of >wxWindows on top of Gtk on top of Xlib is more Python- >like than putting Tkinter on top of libtk on top of Xlib? > >why not just place a lean and mean OO layer on top of >Gtk (or Xt)? in my book, *that* would be Python-like... I'm probably sticking my foot firmly in my mouth here, but isn't that what PyGtk does? -- Jim Richardson Anarchist, pagan and proud of it WWW.eskimo.com/~warlock Linux, because life's too short for a buggy OS. From garry at sage.att.com Fri Feb 4 13:59:09 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Fri, 4 Feb 2000 18:59:09 GMT Subject: Language Challenge 2000 References: <389923AB.741B7DB9@sdynamix.com> <87bhs0$nvg$1@mach.vub.ac.be> Message-ID: <389B217D.2EB8FFF4@sage.att.com> Thomas Hamelryck wrote: > > bvoh at sdynamix.com wrote: > : Language Challenge 2000 > > [snip] > > : The overall winner will receive: > > : Compaq Visual Fortran V6.1 -- Professional Edition > > This is a joke right? The winner receives a Fortran compiler???? the second place winner receives *two* fortran compilers. -- 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 parkw at better.net Thu Feb 10 18:18:18 2000 From: parkw at better.net (William Park) Date: Thu, 10 Feb 2000 18:18:18 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <38A34199.BF367B98@americasm01.nt.com> References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> <38A28055.D8F187EB@inka.de> <38A34199.BF367B98@americasm01.nt.com> Message-ID: <20000210181818.A3770@better.net> Terminating a block with 'end..' like Bourne Shell is what I initially expected from Python. But, indentation is okey too. Guido is not going to move on this issue. So, please kill this thread! From brent.fulgham at xpsystems.com Wed Feb 23 14:28:57 2000 From: brent.fulgham at xpsystems.com (Brent Fulgham) Date: Wed, 23 Feb 2000 11:28:57 -0800 Subject: Reducing Python's memory footprint? Message-ID: > I think that's the problem. How do I get it to share the > executable code between the processes? As a test, I > loaded five copies of my application, and kept track of > how much memory was being used (resident size). It looks > like this: > > 5,988k for the first > 11, 976k for two > 17,964k for three > 23,952k for four > 29,940k for five > > There doesn't seem to be *any* sharing of resources in this... > > --Joel Are you statically linking the interpreter into your executable? (i.e., you use libpython1.5a in Unix?) If the interpreter is not linked to your executable as a shared resource, it will be loaded with each invocation. -Brent From effbot at telia.com Fri Feb 4 16:48:40 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 04 Feb 2000 21:48:40 GMT Subject: urlopen through firewall References: <389B22DD.41FBC8F1@retemail.es> Message-ID: Xose L. Gonzalez wrote: > When I try to connect to the webserver through "urlopen", it is > impossible when inside firewall, whereas the same code works without > firewall involved > > which is the solution? set the http_proxy environment variable to point to your proxy server. e.g: import os, urllib os.environ["http_proxy"] = http://proxy.spam.egg:1234" # connect to www.python.org through proxy.spam.egg:1234 fp = urllib.urlopen("http://www.python.org") if you prefer, you can of course set the environment variable outside your program (using the usual shell commands). From egbert at bork.demon.nl Mon Feb 14 08:18:47 2000 From: egbert at bork.demon.nl (Egbert Bouwman) Date: Mon, 14 Feb 2000 14:18:47 +0100 Subject: eff-bot In-Reply-To: ; from Moshe Zadka on Mon, Feb 14, 2000 at 09:09:59AM +0200 References: <38A7A95C.B009BCC6@kw.igs.net> Message-ID: <20000214141846.A1297@bork> Lately the eff-bott popped up several times. Seems to be the underscore. Where does that name come from, and what does it imply ? egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From daniels at mindspring.com Sat Feb 12 22:47:02 2000 From: daniels at mindspring.com (Alan Daniels) Date: 13 Feb 2000 03:47:02 GMT Subject: Pike seems good. A Q though. References: <200002112329.SAA01742@seanb.sttln1.wa.home.com> <50ip4.6464$UP1.149900@bgtnsc05-news.ops.worldnet.att.net> Message-ID: On Sat, 12 Feb 2000 19:41:11 GMT, the infinitely wise Fredrik Lundh (effbot at telia.com) spoke forth to us, saying... >Forget it wrote: >> Q: Is there a mirror somewhere closer you know of. >yes. Oh, now that's just mean. :=) -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From cfelling at iae.nl Wed Feb 2 16:52:06 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 2 Feb 2000 22:52:06 +0100 Subject: Case Sensitivity and Learnability References: <878j9k$vpe$2@thoth.cts.com> <20000131160402.D19725@xs4all.nl> <879phb$13i0$1@nntp6.u.washington.edu> <879r0t$u43$1@nntp9.atl.mindspring.net> Message-ID: <87a8u6$28v$1@vvs.superst.iae.nl> Aahz Maruch wrote: ... > Actually, there are three kinds of people: those who can count and those > who can't. To be pedantic and to link this with the subject; In reallity there is *one* kind of people: we all err and we all excell in compensating (others) errors. The problem with computers is they aren't one of us: they seldom err unless they try the compensating bit, then they fail most horribly. -- groetjes, carel From tim_one at email.msn.com Wed Feb 16 22:46:14 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 22:46:14 -0500 Subject: Jpython and continuations In-Reply-To: <38AB639E.2246E68@prescod.net> Message-ID: <001201bf78f9$8a524320$dea0143f@tim> [Tim] > Discussions on this stretched over many months last year, > beginning in about May. Guido developed a nearly complete > implementation plan for generators in the "Generator details" > thread of July '99, in the Python-Dev archives. [Paul Prescod] > One thing to consider is what of this can be easily added to > JPython. I'm a little leery about continuations because JPython > uses the Java stack, doesn't it? It does have a concept of a > Python frame but the "instruction pointer" is implicit in > the JVM, not explicit in an interpreter loop. + All attempts I'm aware of to implement Scheme on a JVM gave up on full continuations (anyone know of an exception?). + Generators can be implemented via much more conventional means than can continuations (continuations are merely *an* implementation technique for generators; generators can be implemented in many ways -- they're more of a variant of "regular calls", and, in particular, generator control flow is stack-like). + JPython is to CPython as Jcon is to Icon. Icon (ditto Jcon) doesn't have continuations, but makes extremely heavy use of generators and light use of coroutines. The Jcon port implements both. A good tech report on the Jcon implementation can be gotten from a link near the bottom of: http://www.cs.arizona.edu/icon/jcon/index.htm Coroutines in Jcon are implemented on top of Java threads (my own ancient implementation of coroutines via raw Python threads has been referenced enough here recently ). Generators are implemented directly in Jcon, but do seem to be more of a pain than in Icon's C implementation. not-especially-inclined-to-let-the-limitations-of-the-jvm- limit-languages-other-than-java-ly y'rs - tim From tim_one at email.msn.com Tue Feb 15 00:39:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 15 Feb 2000 00:39:29 -0500 Subject: eff-bot In-Reply-To: <04df01bf76f3$01e24600$01ffffc0@worldnet.att.net> Message-ID: <001601bf7777$07245b60$66a2143f@tim> [Emile van Sebille] > Now, don't confuse me! I thought I figured it out during this > past year, but now that you bring it up, I thought that applied > to the tim-bot. I mean, there really is no Tim Peters, is there? Yes, Emile, there is a TP. You may as well question the existence of Sinterklaas. > Has anyone seen the tim-bot in human form? Ah, I see what this is about! As its original programmer, I (Tim Peters) share an email address with the timbot. It used to be easy to tell us apart: my posts were full of errors, & the bot's of sneering arrogance. Over the centuries, though, we've gotten more alike in every way, except for corporeality. Oh ya -- and the bot doesn't like Monty Python, which explains why only my posts make reference to spam, ni, dead parrots & such. OTOH, the bot really likes lowbrow adult sites, which may explain why some people get such a cheap thill from its "writing". > It's just a self maintaining program Self-destructing, more often. It's got terrible, deep-seated problems, likely due to some of its Univac 1108 and CDC assembler routines that neither of us have been able to figure out. Alas, they're in the analogue of what in a human would be the most primitive reptilian areas of the brain, and appear to be the source not only of its character flaws, but also its will to survive. It was, and remains, a most delicate project. > written in, eh.., well maybe python now, but probably assembler > fat-fingered into some early VAX that has managed to crib parts > and pieces over the years and upgrade itself using every imaginable > language and idiom available. Probably doesn't even consume > any power! ;-) All on target, except for the bit about power. I have to hold an irksome high-tech job just to foot the electricity, oil and kleenex bills (don't ask -- it's embarrassing for both of us). > tim-where-do-we-get-suspend?-ly yr's A trace of the timbot's generator generator shows it's most likely a combination of something it scanned on an S&M site, mixed with the use of the same word for the same purpose in Icon (in which, BTW, the timbot's generator generator is coded! too clumsy in Python). I'm not sure how it weights these things anymore, although have measured an ever increasing amount of power consumed by its firmware randomization subsystem. Then again, that may just be due to its "meaning of life" subroutine, which has-- good news! --eliminated 79.36% of all possiblities (as of 12:22:56AM EST). this-is-one-bot-for-whom-"42"-ain't-good-enough-ly y'rs - tim From a.eyre at optichrome.com Wed Feb 16 11:55:25 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Wed, 16 Feb 2000 16:55:25 -0000 Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) In-Reply-To: <14506.49137.572186.132303@beluga.mojam.com> Message-ID: <003201bf789e$9edc8040$3acbd9c2@peridot.optichrome.com> > raise NNTPError, NNTPError((val, my_interesting_local_state()), tb I believe... raise NNTPError, (val, my_interesting_local_state()), tb ...will suffice. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From effbot at telia.com Mon Feb 21 13:57:56 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 18:57:56 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu><38A5E3F0.B3DCEC8E@callware.com> <88qc9j$oo0$1@news.kersur.net> <20000221082805.A872@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > Programming Python is relative not a good book. Learning Python, > Programming With Python, and others are better, in my opinion. do you mean "Programming with Python" or "Internet Programming with Python"? if you mean the former, you're even weirder than I thought ;-) From gmcm at hypernet.com Thu Feb 10 22:57:46 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 10 Feb 2000 22:57:46 -0500 Subject: Embedding and extending In-Reply-To: <87vreo$aoq$1@nnrp1.deja.com> Message-ID: <1261881045-21378616@hypernet.com> Ron wrote: > Here is my understanding from those threads: > To do both I need three 'modules': > > 1: python > 2: the module that extends python (.dll on Win32) > 3: my application that embeds python (.exe on > Win32) > > Is there a way to eliminate module 2? In other > words, can module 3 be both the app that embeds > python and the module that has the functions > python can call back to? > > To elaborate: I know that a extend-module > called 'mymod' needs an initmymod function that > python calls when it imports it to get hold of > the function table. When I embed python in my > application, can I somehow hand over that > function table to python so that my scripts can > call back into my application? Certainly. The only technical issue is that the python symbols be available; but you link against the import lib, so that's fine. You've got a number of choices. Probably being a built-in is the best. Look at how they get set up and initialized. - Gordon From linli at computer.org Tue Feb 29 10:57:40 2000 From: linli at computer.org (Lin Li) Date: Tue, 29 Feb 2000 16:57:40 +0100 Subject: help: menu item callback in TK References: <88uvl5$sj0$1@pollux.ip-plus.net> <38B369EB.D21F5BA8@bellatlantic.net> <38B3E0E3.508AB49F@computer.org> <20000229091514.A3684341@vislab.epa.gov> Message-ID: <38BBEC73.CDC40D12@computer.org> Hello Randall, Thank you very very much indeed. I did as steve said in Lambda and it worked fine. However, it did have this I-am-at-the-far-end-of-Python feel to it. Now that you have shown the True way, I am again feeling very safe with python. Thanks again. Lin Randall Hopper wrote: > Lin Li: > |Steve Holden wrote: > |> lin li wrote: > |> > I generated a menu using the data in a dynamically composed list. > |> > Since I do not know what will be in the list, I can only have all the > |> > command items in the menu to point to the same callback. Now > |> > from inside the callback, how can I find out which menu item is > |> > selected? ... I am running Python 1.5.2 with Tkinter on NT. > | > |Provided, of course, that I know how to use lambda. I decided to call this > |an incentive and start learning. > > ------------------------------------------------------------------------------ > A lambda is one way: > > callback = lambda option="Bananas": sys.stdout.write( option ) > > ------------------------------------------------------------------------------ > A function is a slightly better one. You can use statements within it: > > def cb( option="Bananas" ): > print option > callback = cb > > ------------------------------------------------------------------------------ > A callable object is yet another: > > class Call: > def __init__( self, option ): > self.option = option > def __call__( self ): > print self.option > callback = Call( "Bananas" ) > > ------------------------------------------------------------------------------ > My personal favorite for Tkinter callbacks is a generalization on this last > one (thanks to Thomas Heller). It allows you to write your callback > functions like normal, and then just use a generic callable object instance > as the "glue" to keep track of the callback registration arguments and pass > them to your callback. > > class Call: > """Instances of this class store a function as well as a list of > arguments. When they are called, the function will be called together > with the arguments used for creating the instance. > Slightly different than lambda, but nicer syntax.""" > def __init__ (self, func, *args): > self.func = func # save the function (or bound method, or ...) > self.args = args # save the arguments to use > def __call__ (self): > apply (self.func, self.args) # call function, using args as arguments. > > Put Call somewhere, then use it over and over, like this: > > >>> def MyCallback( option ): > ... print option > ... > >>> callback = Call( MyCallback, "Bananas" ) > >>> callback() > Bananas > > In Tkinter: > > >>> menu.add_checkbutton( label=item, command=Call( MyCallback, "Bananas" ) ) > > ------------------------------------------------------------------------------ > Also note that, for check and radio button options in specific, you can use > Tk string and int variables, respectively, to communicate the value so your > callback doesn't need arguments: > > self.check_val = StringVar() > ... > menu.add_checkbutton( label=item, variable=self.check_val, > command=self.CheckCB ) > ... > def CheckCB( self ): print "variable is ", self.check_val.get() > > -- > Randall Hopper > aa8vb at yahoo.com From danielt3 at gte.net Thu Feb 10 21:45:38 2000 From: danielt3 at gte.net (Daniel T.) Date: Fri, 11 Feb 2000 02:45:38 GMT Subject: Remove duplicates in a sequence? Message-ID: I have a sequence that contains strings, and I want to remove any duplicates. I know how to write a function to do it, but I was wondering if there was already one in the language or a library that does it. I've looked in the docs for "unique" and "remove" but no luck... Can anyone help me? -- When a thing ceases to be a subject of controversy, it ceases to be a subject of interest. -- William Hazlitt From BgPorter at NOacmSPAM.org Tue Feb 1 09:10:14 2000 From: BgPorter at NOacmSPAM.org (Brett g Porter) Date: Tue, 01 Feb 2000 14:10:14 GMT Subject: tabs do WHAT? References: <000301bf6706$99fca7c0$632d153f@tim> <86joac$l2s$1@mach.vub.ac.be> <86k30t$i5r$1@nntp2.atl.mindspring.net> <86pcii$600$1@mach.vub.ac.be> <38918A29.8AB61742@electricorb.com> <874sby5m6l.fsf@iname.com> <20000131153329.B19725@xs4all.nl> <20000131171255.A1124@stopcontact.palga.uucp> <3896734E.F6738C5D@Lugoj.Com> Message-ID: "James Logajan" wrote in message news:3896734E.F6738C5D at Lugoj.Com... > Gerrit Holl wrote: > Rather, tell everyone who falls for those bogus "appeals to authority" > arguments. Appeals to empirical studies, now that is something I'd fall for > any day! > > Here is the complete abstract, from the following web site (lots of > interesting stuff there!): > > http://www2.umassd.edu/SWPI/ProcessBibliography/bib-codereading2I-P.html > Thanks for the URL, James. From scarblac-spamtrap at pino.selwerd.nl Tue Feb 1 14:13:43 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 1 Feb 2000 19:13:43 GMT Subject: Tuples References: <004501bf6ce2$677d3210$f29b12c2@secret.pythonware.com> Message-ID: Fredrik Lundh wrote in comp.lang.python: > T = 1, 2, 3 > L = list(T) > ... modify list in place > T = tuple(L) > > (note: this is more efficient than it may seem -- the > list() and tuple() functions copy references, not the > objects themselves). Thanks! Never heard of those. Useful. -- 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 danny at cs.usyd.edu.au Sun Feb 6 07:10:39 2000 From: danny at cs.usyd.edu.au (Danny Yee) Date: 6 Feb 2000 23:10:39 +1100 Subject: Book Review - Python Essential Reference Message-ID: <87jobv$uoc$1@thrud.anatomy.usyd.edu.au> An HTML version of this book review can be found at http://www.anatomy.usyd.edu.au/danny/book-reviews/h/Python_Reference.html along with five hundred other reviews title: Python Essential Reference by: David M. Beazley publisher: New Riders 2000 subjects: computing other: 319 pages The _Python Essential Reference_ contains an 85 page survey of the core Python programming language, 160 pages describing the more widely used modules in the Python library ("Appendix A"), and 30 pages on extending and embedding Python ("Appendix B"). The first section has some examples and explanation, but tends to the concise rather than the discursive and is not suitable for learning Python from (except perhaps for experienced programmers). The second covers much the same material as the online Library Reference that comes with Python, generally trading completeness for usability. So the explanation of the rfc822 module, to take a random example, is clearer than that in the Library Reference but doesn't mention some of the overrides, public instance variables, and more obscure methods; it also adds a brief example and cross-references to related modules. Some will appreciate having a choice of explanations, or the extra examples and explanations the _Python Essential Reference_ provides. Given that the online documentation is functionally very similar, however, I suspect that only those with a preference for printed documentation will end up using it as a reference. The volume is attractively laid out, with the only possible problem for some being the small font. -- %T Python Essential Reference %A David M. Beazley %I New Riders %C Indianopolis %D 2000 %O paperback %G ISBN 0-7357-0901-7 %P 319pp %U http://www.newriders.com/cfm/prod_book.cfm?RecordID=210 %K computing 6 February 2000 --------------------------------------------------- Copyright (c) 2000 Danny Yee (danny at cs.usyd.edu.au) http://www.anatomy.usyd.edu.au/danny/book-reviews/ --------------------------------------------------- From robin at alldunn.com Fri Feb 25 19:12:37 2000 From: robin at alldunn.com (Robin Dunn) Date: Fri, 25 Feb 2000 16:12:37 -0800 Subject: 1000 GUI toolkits References: Message-ID: > > But it is interesting: is there a Python module (written in Tkinter of > PyGTK or ...) which parses HTML with embedded Python and executes it? > Does grail does that? > It's called Zope. Actually, wxPython sorta has that ability. GUI objects can be constructed on the fly and displayed embedded in the HTML page within a wxHtmlWindow. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From effbot at telia.com Tue Feb 8 03:20:14 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 08:20:14 GMT Subject: arguments from the prompt References: Message-ID: <2lQn4.2941$dT4.203428352@newsb.telia.net> wrote: > >> how do I write a python script to recive arguments from the > >> command prompt? > > > >you import the sys module, and read up on > >sys.argv in the manual? > > it says NameError: sys > > from sys import argv > a=sys.argv[1] I told you to import the sys module; not import just argv. change the first line to "import sys", and don't forget that you need to explicitly con- vert strings to numbers before you can do math on them. for more info on how import works, see: http://www.pythonware.com/people/fredrik/fyi/fyi06.htm From boncelet at ee.adfa.edu.au Sun Feb 20 19:29:44 2000 From: boncelet at ee.adfa.edu.au (Boncelet Charles) Date: Mon, 21 Feb 2000 11:29:44 +1100 Subject: Killer Apps??? References: Message-ID: <38B086F8.86BB9F2D@ee.adfa.edu.au> Nick Henderson wrote: > > Hello, > > I am new to the world of programming and python. I know Zope is super cool > and is python's "killer app." > > I was wondering if there were any other such killer apps? > > Thanks, Nick Henderson Besides Zope and other web based stuff, I like: alice (www.alice.org) -- fun intro to programming site sketch (sketch.sourceforge.net) -- drawing program (getting better all the time) pybliographer (http://www.gnome.org/pybliographer/) -- Great utility for managing bibtex databases. Numeric (numpy.sourceforge.net) -- numerical package for python. Not as convenient as Matlab yet, but will be close in a year or so. (I love being able to do numerical processing and various things that Matlab can't do in the same python program.) Of course, there are numerous libraries and add-ons to python that make programming fun. Charlie -- ------ Charles Boncelet, University of Delaware, On sabbatical at ADFA, Canberra Australia, Home Page: http://www.ece.udel.edu/~boncelet/ From robin at jessikat.demon.co.uk Mon Feb 21 19:17:09 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Tue, 22 Feb 2000 00:17:09 +0000 Subject: Continuations Made Simple (hopefully) and Illustrated References: <#zkz$nIf$GA.323@cpmsnbbsa03> Message-ID: <408oeHAFWds4Ewtj@jessikat.demon.co.uk> In article <#zkz$nIf$GA.323 at cpmsnbbsa03>, Tim Peters writes ... >en you "compare & contrast" . > >chastenedly y'rs - tim > > > A simple "I got it wrong" will do. Explanations just contribute to our ongoing estimations of the TimBot's internal state. -Oh how the mighty are fallen-ly yours- Robin Becker From aahz at netcom.com Tue Feb 22 01:32:02 2000 From: aahz at netcom.com (Aahz Maruch) Date: 22 Feb 2000 06:32:02 GMT Subject: New User References: <88t9bi$bjo$1@nnrp1.deja.com> Message-ID: <88tah2$fgq$1@nntp6.atl.mindspring.net> In article <88t9bi$bjo$1 at nnrp1.deja.com>, wrote: > >I'm new to Python and I was wondering if someone could tell me how do >to it and where I can get UNDERSTANDABLE tutorals. http://www.python.org/ Follow the links to the download and documentation sections. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From lenny at squiggie.com Tue Feb 22 17:13:35 2000 From: lenny at squiggie.com (Lenny Self) Date: Tue, 22 Feb 2000 14:13:35 -0800 Subject: Converting Strings to Integers in Python Message-ID: I am new to Python and programming in general. I was wondering if someone might help me with the proper syntax for converting a string or a portion of a string into an integer. Thanks. -- Lenny From moshez at math.huji.ac.il Sun Feb 20 00:43:36 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 20 Feb 2000 07:43:36 +0200 (IST) Subject: Review of the new TK book from Manning? In-Reply-To: Message-ID: On Sun, 20 Feb 2000, Jeff Blaine wrote: > If you're not already aware, you can read several sample chapters online > at http://www.manning.com/Grayson/ > > I've got it, but have not had a chance to open it yet. I've bought it, and started to read it. It is a bit dry -- the teaching method is code samples, and commentaries, in a Lao-Tse style. It's a bit hard for me to follow, but it does give good information. All in all, I think it's well worth the price, considering it's the only Tkinter book out there. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From bparsia at email.unc.edu Wed Feb 9 13:07:07 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Wed, 9 Feb 2000 13:07:07 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> <38A18D5F.7CE61061@prescod.net> Message-ID: <1e5qk7x.1oib1uavroxupN%bparsia@email.unc.edu> Paul Prescod wrote: [snip] > And anyhow, you can get most of the benefits of smalltalk from Python, Not true in my experience. Smalltalk IDE's still lead by miles. Speed is higher. More commercial support (if you want that sort of thing). > with a more traditional syntax and most of the benefits of common lisp > from Dylan (e.g.) Are these experience based arguments or just hand waving? [snip] > You can't get a good free smalltalk implementation because not enough > programmers want to get involved with the development. That's because of > the smalltalk "reinvent the wheel" attitude and its weird syntax. There are several excellent free (in various senses) Smalltalks. There are some Smalltalks that integrate better than others. Some people *want* a "single world" approach, and some smalltalks accomodate them. But this no longer has anything to do with anything serious. Your claims are as unsupported, vague, and generally lacking as specifics as the anti-whitespace guy. Why persist? What's the point? Cheers, Bijan Parsia. From arnaud at crao.net Mon Feb 28 03:21:28 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Mon, 28 Feb 2000 09:21:28 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( Message-ID: Hi all ! Maybe u know about MetaKit, a way to store objects using a relational model in tcl, C++, python, etc ... It's not all that good (not a real strong multi-users ORDBMS) but, in some cases, it's really nice and provides features I haven't found yet in the various python way to persistence. Fine ... if I was able to use it with python on my Mac :( Here is the output from python's shell when trying to import the lib : Python 1.5.2c1 (#56, Apr 12 1999, 14:19:52) [CW PPC w/GUSI w/MSL] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import Mk4py Traceback (innermost last): File "", line 1, in ? ImportError: PythonCore: An import library was too new for a client. >>> Any clue ???????? (I already checked the various mailing lists about metakit ... I've read the manual too ;-)) Arnaud PS: And if u know anything similar (means using a relational model) to store objects ... please tell me ! From mikael at isy.liu.se Wed Feb 16 02:58:17 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 16 Feb 2000 08:58:17 +0100 (MET) Subject: Where is the Python Journal? Message-ID: Hi! Not long ago there was a Python journal at www.pythonjournal.org When I try that today, there is no such server. Does anyone know what has happened to it? Gone, moved, or just temporarily down? /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: 16-Feb-00 Time: 08:53:51 This message was sent by XF-Mail. ----------------------------------------------------------------------- From tim_one at email.msn.com Sat Feb 12 15:58:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 12 Feb 2000 15:58:52 -0500 Subject: Docstrings In-Reply-To: <20000212212439.A5816@stopcontact.palga.uucp> Message-ID: <000c01bf759b$f7923c80$7c2d153f@tim> [Gerrit Holl] > But I want some sort of definition: what types may contain doc > strings? You're not getting a defn simply because there isn't one. If you want to know whether a thing t has a docstring, hasattr(t, "__doc__") is the certain and foolproof way to figure it out. Or, probably better in practice: doc = getattr(t, "__doc__", None) if doc is not None: if type(doc) is not type(""): doc = str(doc) # now do something with doc This is the paranoid way, weeding out objects that do have a __doc__ attribute but set it to None, and catering to objects that store *some* (possibly non-string) non-None object in their __doc__ attribute that nevertheless supports str()-ification. > Strings, lists, dictionaries and all numeric types obviously may not. That's a bad assumption; there's nothing to prevent adding a __doc__ attribute to objects of these types in the future, and, indeed, that might even be nice! >>> print math.e.__doc__ Base of natural logarithms = 2.718281828... >>> I doubt Python will actually do that (it has added __doc__ attrs to other object types over the years), but there's no "theoretical" reason not to. timbot.__doc__=="ly y'rs - tim"-ly y'rs - tim From effbot at telia.com Wed Feb 23 06:40:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 11:40:29 GMT Subject: Tkinter: user vs. program events References: <3d1z65kr2j.fsf@amarok.cnri.reston.va.us> <88v2f5$7md$1@wanadoo.fr> Message-ID: Andrew M. Kuchling wrote: > I've been trying to figure out how to distinguish between Tkinter > events that come from a user and ones that originate from changing the > value of a widget. Is this possible? no. (unlike event handlers, command callbacks have no associated event descriptor) > Here's the motivating example. I have a Scale widget for indicating > light intensity: > > self.light_scale = Tkinter.Scale(f, command = self.adjust_light) > > adjust_light() is a method that takes the current value of the scale > widget, and sends off a command to change light intensity. The > Tkinter program also receives updates on the current state, and > changes the scale widget to match the current value, with > self.light_scale.set( ) . > > The problem is that the light_scale.set() call causes the associated > command to be run, so a command is sent off changing the light > intensity, which causes another status update to be sent out, which > changes the setting, and so forth. > > So, how would you do this in Tkinter? Can I distinguish between > events generated by a user and by a .set() call? Should > adjust_light() be bound to some different event? Or should I change > the binding of the widget on every update()? why not just add a semaphore? def adjust_light(self): if self.status_update: return ... def handle_status_event(self): ... try: self.status_update = 1 self.light_scale.set(value) finally: self.status_update = 0 From calroc at mindspring.com Sun Feb 27 05:50:50 2000 From: calroc at mindspring.com (Pedro Jones) Date: Sun, 27 Feb 2000 02:50:50 -0800 Subject: where to hold mouse button state in Tkinter? Message-ID: <38B9018A.84CE3992@mindspring.com> I'm writing a widget that needs to detect in it's callback for a event whether or not one or both of the other mouse buttons are pressed and take different actions depending. What's a good way to access mouse state of the other buttons in the callback for one? Does Tk/Tkinter provide something easy I've overlooked? From mwh21 at cam.ac.uk Sun Feb 13 14:08:16 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 13 Feb 2000 19:08:16 +0000 Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= writes: > "Tim Peters" writes: > > > > 2. Lack of lexical scoping > > > > > > Tim Peters disagrees, but I miss it a lot, even after using Python > > > for years. > > > Actually, Tim wholly agrees that you miss it a lot. > > Couldn't we approximate lexical scoping with classes? For the few times I > needed it, I was fairly satisfied with this solution. Surely more verbose > than in Scheme, but yet, given I do not use it often, I did not care the > extra-verbosity. This is what I fairly often recommend to people who are abusing the default argument hack, or slate Python for not doing scoping properly. People still complain though. It would also be nice if people got the terminology right; Python *is* lexically scoped, because references to a name can only appear within code that is textually contained in the establishing contruct (says he paraphrasing from cltl2). The alternative is the poorly named "dynamic scope" which would mean things like: def f(): a = 1 return h() def g(): a = 1 return h() def h(): return a print f(),g() would print "1 2", which is just not true. This may seem bizarre, but it can be useful; if you ever find yourself adding arguments to functions only so you can propogate said options down to functions you then call, you might have been better off with a dynamically scoped variable (they're called "special" in common lisp). They're a bit like acquisition in some ways. They also monumentally don't fit into the Python way of doing things, so I'm not going to press for them. The "problem" is that scopes don't nest - except for the scopes of instance members, so use them instead. Cheers, Michael From fcahoon at my-deja.com Tue Feb 15 15:24:36 2000 From: fcahoon at my-deja.com (Forrest Cahoon) Date: Tue, 15 Feb 2000 20:24:36 GMT Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> Message-ID: <88cclv$u62$1@nnrp1.deja.com> In article <200002102304.KAA08105 at envy.fulcrum.com.au>, Richard.Jones at fulcrum.com.au wrote: > > Could we please maybe mandate an "Official Response" to the weenies constantly > posting about whitespace in Python? > > Something like: > > ------- > Subject: Official Response [Re: ] > From: some_python_regular > > Guido van Rossum, the creator of Python, is not going to change this > fundamental aspect of Python. We don't want him to. We all like it. > > If you wish discussion on this topic, please read the mailing list / news group > archives regarding the topic first: > http://www.dejanews.com/dnquery.xp?DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=thre > aded&showsort=date&maxhits=100&groups=comp.lang.python&QRY=whitespace > > Any further messages with the subject line " > " will be ignored. > > ------- > > Suggestions welcome :) > > Richard As a "newbie" who made such a post recently, I can tell you what would have been useful to me ... indeed, what would have made me feel it was unnecessary to post. I am a sort who would much rather be coding than arguing, and my motivation was not to start a flame war. I am a person who had heard of python and thought that the whitespace thing was ugly, but proceeded to simply use other languages (duh!) until it looked to me as if python's popularity is becoming such that I may _have_ to use it. Kind of like C, you know. Although I like C, I didn't choose to use it. I have to. As python's popularity increases, you will probably see more of my type -- real programmers with better things to do than fight flamewars. Inbetween all the bickering, I got a lot of useful information. It would be nice to summarize these points in a succinct, factual manner. First and foremost, I did not find in the FAQ, or in any of my searching around on www.python.org, or in any place in Mark Lutz's _Programming Python_ that was clear from the TOC or index, or in the 1/3 of the tome I've read so far, any sort of clue into the really incredibly obvious question that is underneath all this: "How do you deal with tabs vs. spaces?" I don't know why this is so hidden. I think any reasonable FAQ on the matter must state, in some obvious and up-front way THE PYTHON INTERPRETER ALWAYS INTERPRETS A TAB AS 8 SPACES. There was a quote from Guido's guide to programming style (or something like that -- NOT the first document I'd look at when trying to figure out how the dang thing works) that was quite to the point somewhere in the responses to my post that was quite to-the-point which I think you should probably use. You can pooh-pooh the objections to using indentation as syntax, but you can't pooh-pooh the importance of understanding the mechanics of how it is implemented! Yet most of you pythoneers (who respond at all -- no doubt many more are coding) would rather spend your time explaining why, philosophically, it's not a problem, instead of describing how indentation-as-syntax actually works. Even if your interlocutors aren't specifically mention tabs vs. spaces when they complain about whitespace, I think you can be safe in assuming this IS the issue for 99% of them. Address it. (Personally, I'd feel more secure about python if tabs generated a compile error, and thus could be guaranteed not to be in any running code.) The second thing of interest I learned is that there is a module called pyindent.py (?) that is supposed to allow me to put redundant information in my python code, if I'm really so silly as to be worried about this whitespace thing. Yes, I'm really that silly. I'll probably use pyindent.py (is that what it was called?) More information would be appreciated. The third thing related to this issue that was educational for me was the emacs python-mode keybindings that help deal with indentation. So, yeah, write your position paper, say it's not a problem, whatever -- but put these facts in it. At least, that's my advice. ... and I've probably written 30 lines of python by now!!!! f Sent via Deja.com http://www.deja.com/ Before you buy. From urner at alumni.princeton.edu Tue Feb 1 19:14:34 2000 From: urner at alumni.princeton.edu (Kirby Urner) Date: Wed, 02 Feb 2000 00:14:34 GMT Subject: re AMTE thread re DrScheme & Python References: <000f01bf6d0a$0f213bc0$4b2d153f@tim> Message-ID: <389876bb.110801158@news.teleport.com> "Tim Peters" wrote: >From: "Tim Peters" >To: , >Subject: RE: re AMTE thread re DrScheme & Python >Date: Tue, 1 Feb 2000 18:14:14 -0500 Thanks for this post, which I thought was balanced and informative. I'm very enamoured of Python, but that in no way makes me closed minded about learning Scheme. I look forward to tackling that next. Kirby From XoseLuis at retemail.es Fri Feb 4 14:05:01 2000 From: XoseLuis at retemail.es (Xose L. Gonzalez) Date: Fri, 04 Feb 2000 20:05:01 +0100 Subject: urlopen through firewall Message-ID: <389B22DD.41FBC8F1@retemail.es> Hi When I try to connect to the webserver through "urlopen", it is impossible when inside firewall, whereas the same code works without firewall involved which is the solution? PS: email copy woud be apretiated due to the newsserver goes bad Tanx in advance X. Luis From ns56645 at swt.edu Mon Feb 21 21:10:48 2000 From: ns56645 at swt.edu (ns56645) Date: Mon, 21 Feb 2000 20:10:48 -0600 Subject: Python window.destroy()? References: <38B1D2EB.FE88C9DC@swt.edu> <88sn2f$i1j$1@wanadoo.fr> Message-ID: <38B1F028.7A2036C2@swt.edu> Jerry Thanks for your help, To give you the complete picture I have send you my program. I need to kill two new windows that were created when I moved my mouse on the window. See to the program and you can get the picture. I am still in the lab for another hour. Thanks, #!/usr/bin/python from Tkinter import * class App: def __init__(self,master): frame=Frame(master) frame.pack() self.button1 = Button(frame,text="Button1") self.button1.pack(side=LEFT) self.button2 = Button(frame,text="Button2") self.button2.pack(side=RIGHT) self.Quit= Button(frame,text="QUIT",command=frame.quit) self.Quit.pack(side=LEFT) def myEcho2(event): wm1=Toplevel() wm1.label=Label(wm1,text="Mouse is on the 2nd button") wm1.label.pack() def myEcho1(event): wm2=Toplevel() wm2.label=Label(wm2,text="Mouse is on the 1st button") wm2.label.pack() self.button2.bind("",myEcho2) self.button2.pack() self.button1.bind("",myEcho1) self.button1.pack() self.button2.bind("",wm2.destroy) self.button2.pack() self.button1.bind("",wm1.destroy) self.button1.pack() root=Tk() app = App(root) root.mainloop() From hellan at acm.org Sat Feb 19 16:49:27 2000 From: hellan at acm.org (Jon K Hellan) Date: 19 Feb 2000 22:49:27 +0100 Subject: IDLE for JPython References: <38AEBAC7.5DEE27EC@ieee.org> Message-ID: <87putskgm0.fsf@parus.parus.no> jarek writes: > Is it possible to use IDLE with JPython? (This probably require to run > Tkinter.) > Is there some other IDE that would run with JPython? > I was looking through JPython web site and could not find any > information about that. The Netbeans Java IDE includes JPython, but I've no idea what that actually means :-) Jon From bachlmayr at solve-it.de Wed Feb 9 05:21:06 2000 From: bachlmayr at solve-it.de (Gerald Bachlmayr) Date: Wed, 9 Feb 2000 11:21:06 +0100 Subject: python, ado Message-ID: <1375BA7ABFD1D3119F840050DA41E448D7A5@mail2.solve-it.de> hi! when i try to read recordsets from mssql7.0 or access i get empty results instead of date values. (integer and string works). does anyone know, what the reason could be? gerry -----Urspr?ngliche Nachricht----- Von: Marc BRETTE [mailto:mbre at sxb.bsf.alcatel.fr] Gesendet: Wednesday, February 09, 2000 11:06 AM An: python-list at python.org Cc: mbre at sxb.bsf.alcatel.fr Betreff: small python implementation or python subset ? Hi, I am looking for a very lightweight implementation of python or for a python subset definition. I would like to run the python interpreter (or even the python interpreter without its parser by running only python bytecode) in a very restricted environnement (say a python interpreter less than 300 k), and I don't need all the fancy functionnalities of python. I downloaded the 1.5 distribution but the binary is 1.5 Mb stripped of almost all its modules. An older version (1.2) seems lighter (300 k), but I don't want a dead distribution. Does any one around knows about a lightweigth python or a way to strip the regular python distribution ? marc -- Marc Brette Marc.Brette at sxb.bsf.alcatel.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: From scarblac-spamtrap at pino.selwerd.nl Thu Feb 3 05:21:54 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 3 Feb 2000 10:21:54 GMT Subject: Newbie: OverflowError: integer addition - Python data types?? References: <879o21$lu2$1@nnrp1.deja.com> Message-ID: e.e.sutton at cummins.com wrote in comp.lang.python: > def Fibonacci(i): > fibA=1 > fibB=1 > if i == 0: > Fibonacci = fibA > elif i == 1: > Fibonacci = fibB > elif i > 1: > fib=0 > for j in range(2, i+1): > fib = fibA + fibB > fibA = fibB > fibB = fib > Fibonacci = fib > return Fibonacci > > Thanks in advance for any tips or suggestions Personally I like this version best: def Fibonacci(n): if n < 0: raise "ArgumentError", "Argument must be non-negative" if n < 2: return 1 # Fibonacci(0) == 1, Fibonacci(1) == 1 # n >= 2 fibA = fibB = 1L for i in range(2, n+1): fib = fibA + fibB fibA = fibB fibB = fib return fib It seems you like to declare your variables first, and that you used a language that returns things with "Functionname = value". Pascal? -- Remco Gerlich, scarblac at pino.selwerd.nl Murphy's Rules, "Stopwatch battles": Each turn in Star Fleet Battles works out to one-thirtieth of a second. During this time, a ship can maneuver, fire all weapons, and send out a boarding party. From jstok at bluedog.apana.org.au Fri Feb 25 12:04:56 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Sat, 26 Feb 2000 04:04:56 +1100 Subject: Phython as In-Game scripting language References: <20000225153511.19694.qmail@hotmail.com> Message-ID: Shawn LeBlanc wrote in message <20000225153511.19694.qmail at hotmail.com>... >Greetings! > >>What sort of game are you writing? First person shooter on PC? > >Right now, it's more R&D than anything else. The idea is having >a more-or-less generallized 3d engine, but the actual design seems >to lean towards the Quake/Unreal model. So, we would be able to >make a FPS with it, but that's not our goal as of yet. We should note that the Unreal engine does have an embedded scripting language (Unrealscript) so it's clearly doable -- and I'm sure Python could be used, but whether it's easy enough and whether it gives you the performance you need, is not assured. From effbot at telia.com Mon Feb 28 12:46:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 17:46:58 GMT Subject: difference between __repr__() and __str__() References: Message-ID: Gregoire Welraeds wrote: > __repr__: called to compute the official string representation of an > object. This should like a valid Python expression that can be used to > recreate an object with the same value. > > __str__: differs from repr in that in does not have to be a valid python > expression: a more conveniant or concise representation maybe used > instead. according to the eff-bot: __repr__ should something that makes sense to a programmer, but not necessarily to someone else. (think "debugging") (e.g. basic types return a string literal, more complex types usually return some kind of descriptor, such as "" or "") __str__ should be used to convert the contents of an object to a (usually printable) string, whenever that makes sense (think "class design") From tbryan at python.net Thu Feb 3 21:25:04 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Thu, 03 Feb 2000 21:25:04 -0500 Subject: Where is Idle? References: <3899d6ad_1@news5.newsfeeds.com> Message-ID: <389A3880.BE82953F@python.net> Michael wrote: > > I installed python-1.5.2-2.i386.rpm, which I downloaded > from ftp://starship.python.net/pub/crew/andrich/ and Idle > is not in that package. Is there some other package I > need to install? python-demos-1.5.2-2 From boud at rempt.xs4all.nl Sun Feb 13 04:09:52 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 13 Feb 2000 09:09:52 GMT Subject: IDLE and Hooks in apps for usage of My Favorite Editor References: <883cm6$mud$1@news1.xs4all.nl> Message-ID: <885sd0$okq$1@news1.xs4all.nl> Martin P Holland wrote: > It looks good (and it was easy to swap to my preferred editor). It was quite easy to write, too. If you've got any suggestions, patches or requirements, feel free to ask ;-). Curiously, most of those who downloaded kpybrowser were Windows users. Can't imagine that they will be able to fire it up... -- Boudewijn Rempt | http://www.valdyas.org From embed at geocities.com Fri Feb 11 16:13:39 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 11 Feb 2000 16:13:39 -0500 Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> Message-ID: > Just looked at the demo/embed sample. Haaaaah! K&R style. Ahahahaha. > oooh. By belly hurts. Wow. I thought I was gonna wet my pants. I haven't > seen any K&R C for probably, oh, like 10 years. Sorry, I'm bugging you, > people, but I had to let it out or I was gonna be in trouble. I'll leave > you alone now. He's gone, right!? Whew. :-) From ngps at post1.com Mon Feb 14 09:10:53 2000 From: ngps at post1.com (Ng Pheng Siong) Date: Mon, 14 Feb 2000 14:10:53 GMT Subject: Docu tools Message-ID: <8892da$hl8$1@nnrp1.deja.com> Hello, I'm writing a HOWTO for M2Crypto (http://www.post1.com/home/ngps/m2). I've started with Zope's StructuredText, as it seems simple enough. My document includes Python source code. I would like to somehow invoke MAL's excellent coloriser, as well as add line numbers to the source code, to facilitate discussion of the source farther on in the document. Has anyone done this with StructuredText? What (other) tools would you recommend for such requirements? Is there code available to handle Perl's POD format? TIA. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps Sent via Deja.com http://www.deja.com/ Before you buy. From paul at prescod.net Wed Feb 9 21:12:57 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 18:12:57 -0800 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> <38A1F3C0.F9BBC038@prescod.net> <38A20D81.A58F8FC0@rubic.com> Message-ID: <38A21EA9.4ADE71D1@prescod.net> Jeff Bauer wrote: > > Wait a sec ... didn't we already have a similar > discussion last year when you proposed adding > a second argument to the string.strip() family? Oops. I thought there *was* a second argument. I probably thought that last year too. Any minute now, Tim's going to point out that even with a second argument strip would be subtly different from Perl's mind reading behavior. It's all coming back to me now. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From thamelry at vub.ac.be Wed Feb 9 04:32:25 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 9 Feb 2000 09:32:25 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: Message-ID: <87rc79$chc$4@mach.vub.ac.be> Thomas Hamelryck (that's me!) wrote: : I am in exactly the same position. It was a serious design error. : I wonder how the CP4E people are going to explain to complete : computer illiterates that a python program can contain errors that : are _not even visible_ when you look at the code. Mikael Olofsson wrote: : But they _are_ visible! It's just as visible to me as it is to the : interpreter. Mix tabs and spaces and you can get errors that are not visible. Try it. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From aahz at netcom.com Sun Feb 6 17:15:18 2000 From: aahz at netcom.com (Aahz Maruch) Date: 6 Feb 2000 22:15:18 GMT Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> Message-ID: <87krpm$qk$1@nntp9.atl.mindspring.net> In article , Michael Hudson wrote: > >I guess the point is that I can't think of a good reason for an object >to masquerade as None. I generally use None to mean exactly that; a >void, nothing (like nulls in SQL, I guess). Yes, exactly (referring to your second sentence). What, then, is the proper behavior for an object that one wishes to have a null value? It could be argued that the proper behavior is to change the reference to None and instantiate a new object whenever there *is* a value, but I think that's a bit limiting, particularly if one considers such aspects as efficiency and orthogonal behavior in a list. This goes double if one wants the *object* to distinguish between zero and None. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From herzog at online.de Fri Feb 25 13:21:38 2000 From: herzog at online.de (Bernhard Herzog) Date: 25 Feb 2000 19:21:38 +0100 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> Message-ID: Michael Hudson writes: > Gerrit Holl writes: > > > > > > [2] I occasionally think about this problem. The setup: GvR was far > > > too profligate in adding functions to bltinmodule.c that could have > > > been written in pure Python instead. So, how many built-in functions > > > can you re-implement in pure Python? > > > > These are possible: > > > > abs, callable, chr, delattr, divmod, > > execfile, filter, getattr, hex, input, int, isinstance, issubclass, > > len, list, long, map, max, min, oct, range, raw_input, reduce, reload, > > repr, setattr, tuple, vars. Is it posssible to implement getattr, setattr and delattr without eval or exec? How do you implement len for builtin types without iterating through the indices until an IndexError is raised? How do you implement callable? I think you forgot str and cmp, but they're easy: def str(obj): return "%s" % (obj,) def cmp(a, b): if a > b: return 1 if a < b: return -1 return 0 ord should also be possible. > > These aren't: > > > > apply, buffer, coerce, compile, complex, dir, eval, exit, globals, hash, > > id, intern, locals, round, slice, type, xrange > To followup to a different bit of the thread about 30 seconds after > the last one, I think you can actually do quite a few of these. > > `compile' would be a lot of work, but given the `new' module, > definitely possible (ask Jeremy Hylton!). > `dir' shouldn't be too hard given `type' & some knowledge of Python > internals. > `eval' can be done using `compile' & `exec'. > `globals' and `locals' can be done using the usual sys.exc_traceback > mucking around. > The builtin `exit' is just a string! slice is also possible: class slicefactory: def __getitem__(self, slice): return slice def slice(self, *args): start = 0 step = 1 if len(args) == 1: stop = args[0] elif len(args) == 2: start, stop = args elif len(args) == 3: start, stop, step = args return self[start:stop:step] slice = slicefactory().slice When I tested this, it turned out that you can't compare slices properly: >>> slice(5, 20, 3) == slice(5, 20, 3) 0 complex is trivial: def complex(r, i = 0): return r + i * 1j and round wouldn't be too difficult either, I guess. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From pf at artcom-gmbh.de Wed Feb 2 04:09:42 2000 From: pf at artcom-gmbh.de (Peter Funk) Date: Wed, 2 Feb 2000 10:09:42 +0100 (MET) Subject: IPC8 Proceedings on www.python.org? When? Message-ID: I can hardly wait to see the IPC8 conference proceedings on www.python.org. Can somebody tell, when they will appear there? Regards, Peter -- Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 From embed at geocities.com Wed Feb 9 09:34:24 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 09:34:24 -0500 Subject: Talking to embedded python References: Message-ID: > I've thought about COM but if we want to port our application to other > platforms then COM would't help me (plus it's way to much overhead for > the things we want to do). I think Python's COM interfaces are excellent, and when you're talking to an interpreted language anyways, COM's overhead is neglible. Anything you invent will be worse, count on it! What things do you want to do, anyways? Warren From thamelry at vub.ac.be Fri Feb 4 05:14:20 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 4 Feb 2000 10:14:20 GMT Subject: Language Challenge 2000 References: <389923AB.741B7DB9@sdynamix.com> <92rm4.13629$Ch7.942353@news.easynews.com> Message-ID: <87e8ps$kdr$3@mach.vub.ac.be> Konrad Hinsen wrote: : "Roger Upole" writes: :> Since execution time is a factor, I doubt that any interpreted languages :> will even be in the running. : It could win by the size factor if only the interpreted program text : is counted. Ah, we still stand a chance of winning that FORTRAN compiler! Then I can finally give up Python and learn a *real* language. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From lfmartins at freewwweb.com Wed Feb 2 21:00:28 2000 From: lfmartins at freewwweb.com (Luiz Martins) Date: Wed, 2 Feb 2000 21:00:28 -0500 Subject: zip module Message-ID: <87an99$mrd$1@news.smartworld.net> Is there a module somewhere to open/create zip files? I want to create archives that contain multiple directory hierarchies, path information, modifications dates etc. My archives will be used by folks using winzip under windows 9x Felipe Martins fmartins at math.csuohio.edu From greg at perceval.be Mon Feb 28 07:04:59 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Mon, 28 Feb 2000 13:04:59 +0100 (CET) Subject: self argument In-Reply-To: <38B826A8.66DAEB43@Lugoj.Com> Message-ID: In reply to the message of James Logajan sent on Feb 26 (see below) : In my newbiness ignorance, I'm asking what is the difference between t and self.x. Aren't they both member of the class C ? > class C: > def __init__(self, b): > self.b = b > self.x = self.y = 0 > def Func(self, a): > t = a * self.b > self.x = t * 2 > self.y = t + 2 -- 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 Sat, 26 Feb 2000, James Logajan wrote: > Date: Sat, 26 Feb 2000 11:16:56 -0800 > From: James Logajan > To: python-list at python.org > Newsgroups: comp.lang.python > Subject: Re: self argument > > Jason Stokes wrote: > > > > london999 at my-deja.com wrote in message <8984mm$5pi$1 at nnrp1.deja.com>... > > >I am very new to Python, but it appears that every function defined in a > > >class must have self as a first variable name. > > > > No. You're just a little confused on a couple of points. Firstly, member > > functions always receive the invoked upon class instance as the first > > argument. The convention is to call this argument "self", but there's no > > requirement to do so. Secondly, not all functions are members of a class. > > Functions that are not class members don't receive this implicit argument; > > this way, you can program in conventional functional or procedural style. > > > > > Even better, it would be nice (probably too late > > >I know), if self was defined implicitly as the "this" pointer is in C++. > > > > I'm not sure why Python's way was chosen, but you get used to it. > > If self were defined implicitly, then you would have to explicitly define > local variables. This is, today you would do something like: > > class C: > def __init__(self, b): > self.b = b > self.x = self.y = 0 > def Func(self, a): > t = a * self.b > self.x = t * 2 > self.y = t + 2 > > If self were implicit, then variables like 't' would need to be declared. > That leads to some problems. The above might become: > > class C: > def __init__(self, b): > b = local.b # Arguments are local. > def Func(self, a): > local.t = local.a * b > x = local.t * 2 > y = local.t + 2 > > Or they could be declared once anywhere in the scope: > > class C: > def __init__(self, b): > b = local.b # Still need to > def Func(self, a): > local t = a * b > x = t * 2 > y = t + 2 > > > I think I like the way the language was designed. > -- > http://www.python.org/mailman/listinfo/python-list > > From n8gray at earthlink.net Wed Feb 23 13:03:54 2000 From: n8gray at earthlink.net (Nathaniel Gray) Date: Wed, 23 Feb 2000 18:03:54 GMT Subject: Comparing perl and python References: Message-ID: <38B42146.FE9D49E0@earthlink.net> If regexes are your concern, you may not need to worry much longer. The regular expression engine for Python 1.6 should be significantly faster than the current one. Here are some benchmarks that Fredrik Lundh posted to c.l.p. last month: 0 5 50 250 1000 5000 25000 ----- ----- ----- ----- ----- ----- ----- ----- search for Python|Perl in Perl -> sre8 0.007 0.008 0.010 0.010 0.020 0.073 0.349 sre16 0.007 0.007 0.008 0.010 0.020 0.075 0.353 re 0.097 0.097 0.101 0.103 0.118 0.175 0.480 regex 0.007 0.007 0.009 0.020 0.059 0.271 1.320 search for (Python|Perl) in Perl -> sre8 0.007 0.007 0.007 0.010 0.020 0.074 0.344 sre16 0.007 0.007 0.008 0.010 0.020 0.074 0.347 re 0.110 0.104 0.111 0.115 0.125 0.184 0.559 regex 0.006 0.006 0.009 0.019 0.057 0.285 1.432 search for Python in Python -> sre8 0.007 0.007 0.007 0.011 0.021 0.072 0.387 sre16 0.007 0.007 0.008 0.010 0.022 0.082 0.365 re 0.107 0.097 0.105 0.102 0.118 0.175 0.511 regex 0.009 0.008 0.010 0.018 0.036 0.139 0.708 search for .*Python in Python -> sre8 0.008 0.007 0.008 0.011 0.021 0.079 0.379 sre16 0.008 0.008 0.008 0.011 0.022 0.075 0.402 re 0.102 0.108 0.119 0.183 0.400 1.545 7.284 regex 0.013 0.019 0.072 0.318 1.231 8.035 45.366 search for .*Python.* in Python -> sre8 0.008 0.008 0.008 0.011 0.021 0.080 0.383 sre16 0.008 0.008 0.008 0.011 0.021 0.079 0.395 re 0.103 0.108 0.119 0.184 0.418 1.685 8.378 regex 0.013 0.020 0.073 0.326 1.264 9.961 46.511 search for .*(Python) in Python -> sre8 0.007 0.008 0.008 0.011 0.021 0.077 0.378 sre16 0.007 0.008 0.008 0.011 0.021 0.077 0.444 re 0.108 0.107 0.134 0.240 0.637 2.765 13.395 regex 0.026 0.112 3.820 87.322 ... search for .*P.*y.*t.*h.*o.*n.* in Python -> sre8 0.010 0.010 0.014 0.031 0.093 0.419 2.212 sre16 0.010 0.011 0.014 0.030 0.093 0.419 2.292 re 0.112 0.121 0.195 0.521 1.747 8.298 40.877 regex 0.026 0.048 0.248 1.148 4.550 24.720 ... (searching for the given patterns in strings padded with blanks on both sides. sre8 is the new python 1.6 engine on 8-bit strings, sre16 is the same engine using unicode) -- 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 effbot at telia.com Fri Feb 11 04:55:02 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 09:55:02 GMT Subject: Corel + Borland = The End of MS Win References: Message-ID: Moshe Zadka wrote: > I don't know, he isn't Kibo. > > (I don't think we ever had a visit from Kibo, did we?) according to Steven Majewski, he's something of a comp.lang.python regular: http://www.deja.com/=dnc/getdoc.xp?AN=100541367 (yes, I have reset the eff-bot. you have been warned ;-) From jimbag at kw.igs.net Mon Feb 14 02:06:11 2000 From: jimbag at kw.igs.net (JB) Date: Mon, 14 Feb 2000 07:06:11 GMT Subject: Whats up with the _ Message-ID: <38A7A95C.B009BCC6@kw.igs.net> I have some global vars defined in a module that are prefixed with an underscore '_'. When I do a 'from MyModule.MyModule import *' the vars with the _ prefix don't get imported but when I change the names to drop the _ they import properly. Is this a bug or a feature? If someone could expalin why this is so I would appreciate it. I missed this in the doc's. cheers jb -- There is more to life than increasing its speed. -- Mahatma Gandhi From tim_one at email.msn.com Wed Feb 2 23:06:33 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 2 Feb 2000 23:06:33 -0500 Subject: Readable Functional Languages In-Reply-To: <87aerv$2d6$1@vvs.superst.iae.nl> Message-ID: <000401bf6dfc$0ee5f180$822d153f@tim> [Carel Fellinger] > Admittedly off topic, I would like some advice on what language to > choose to explore the realm of functional languages given that I > can't cope with'impure' languages like C, C++ and Perl and that I > love Python mostly for its readability and its adherence to the > principle of least surprise that lures me into thinking that it > has no dark corners. So long as you're just out exploring and don't mind making any actual progress for a while , point your browser to http://www.haskell.org/ I've often noted that Haskell is the most Pythonic of all the languages that have nothing in common with Python . Not entirely flippant: Haskell gave a lot of thought to syntax (it uses indentation too, btw), clarity of expression, and clean semantics. It's a joy. It's also a purely functional language, and if you're not used to that you'll probably feel lost at first (no rebinding, no control flow, no side effects). However, another thing Haskell shares with Python is a very good intro tutorial, that will have you not caring about the absence of loops in short order: http://www.haskell.org/tutorial/ If "purely functional" proves too austere for you, any variant of Scheme is certainly worth learning. Perhaps GNU's Guile project would be easiest to approach (since it's aimed at "scripting" applications of Scheme, where "scripting" is to be taken in the very broad sense it's used in the Python world). the-first-word-in-functional-is-fun-ly y'rs - tim From thamelry at vub.ac.be Wed Feb 2 04:59:30 2000 From: thamelry at vub.ac.be (Thomas Hamelryck) Date: 2 Feb 2000 09:59:30 GMT Subject: re AMTE thread re DrScheme & Python References: <000101bf6d4f$fb1ba480$28a0143f@tim> Message-ID: <878v62$696$1@mach.vub.ac.be> Kirby Urner wrote about python: > - badly implemented Tim Peters answered: : Maybe it refers to choice of language : implementation techniques? Python is a bit "old fashioned" that way. Those : are *extremely* complex tradeoffs, though, and Python has taken more of a : "better clear than fast" approach than most other language implementations. The only point I can think of that merits the term "badly implemented" is the lack of proper garbage collection. The fact that objects cannot be garbage collected when they contain circular references is IMO a major weak point in Python (I wonder wether Python 2.0 will get rid of reference counting?). But these are indeed *extremely* complex tradeoffs: if introducing proper garbage collection means giving up easy portability and ease of writing extensions in C/C++ we can do without. Cheers, --- Thomas Hamelryck Institute of Molecular and Structural Biology Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark From skip at mojam.com Wed Feb 16 10:19:13 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 16 Feb 2000 09:19:13 -0600 (CST) Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) In-Reply-To: <20000216073900.B2508775@vislab.epa.gov> References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216073900.B2508775@vislab.epa.gov> Message-ID: <14506.49137.572186.132303@beluga.mojam.com> Randall> SIDE POINT: Randall> Sadly in Python, with this syntax we loose track of the stack Randall> frames between the original exception and this exception Randall> transformation (which would be useful to have if the client Randall> doesn't handle the error and we print a traceback). But AFAICT Randall> this is a feature (or deficiency) of the language. Watch out for Guido's time machine (again!). The raise statement takes three (all optional) objects. If you catch the original exception's context inside the except block using sys.exc_info() you can pass the traceback object as the third argument to raise, e.g.: try: whole_buncha_hooey() except socket.error: type, val, tb = sys.exc_info() raise NNTPError, NNTPError((val, my_interesting_local_state()), tb When the NNTPerror exception is caught by the client it will see the stack as it existed within the call to whole_buncha_hooey(). I think I have the syntax of the raise statement correct. The reference manual isn't as clear as it might be on this. I'm sure someone will point out any errors. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From effbot at telia.com Sun Feb 27 08:51:46 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 13:51:46 GMT Subject: name of object inside it's methods? References: <8EE74F2D4usenetacct@216.169.37.95> Message-ID: alv50855 at batman.tamucc.edu wrote: > can someone fill in the blank > > ------------------------------- > class Hello: > def __init__(self, x): > self.x = x > > def classname(self): > > > ------------------------------- > > >>>from hello import * > >>>clown = Hello(1) > >>>clown.classname() > clown > > In other words I want the method to print the name of the object that it > belongs to sorry, you can't do that. names are just names, not identities. any object can have lots of different names, or none at all. an example: clown = Hello(1) bobo = clown # here, bobo and clown both point to # the same instance del clown # now, only bobo points to that instance mylist = [bobo] del bobo # and here, nobody points directly to the # instance. From tbryan at python.net Mon Feb 21 15:49:24 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 21 Feb 2000 15:49:24 -0500 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: <38B1A4D4.F98E53B3@python.net> Gerrit Holl wrote: > > Hello all, > > I have a problem. In my Python enthuishasm, I ripped off the braces > from my keyboard ... Gerrit, this is the strangest thing I've ever seen. I sure hope that it's just getting late, and you're being silly. You didn't really rip keys off of your keyboard, did you? you-can-spot-python-cult-members-by-looking-at-their-keyboards-ly yours ---Tom From bjorn at roguewave.com Tue Feb 22 16:29:25 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 22 Feb 2000 14:29:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <1260876476-6142700@hypernet.com> <38B2E76D.7DEF295C@roguewave.com> <0kCs4.649$mYj.190257664@newsa.telia.net> Message-ID: <38B2FFB5.5025DD11@roguewave.com> I seem to have hit a sore point for Frederik, for which I'm sorry. However, I still think my points are valid. Fredrik Lundh wrote: > listen very carefully: > > PYTHON IS BASED ON INTERFACES, NOT ON > STRICT INHERITANCE. *ANY* OBJECT THAT > IMPLEMENTS TWO WELL-DEFINED METHODS > CAN BE USED AS A SEQUENCE OBJECT. Having a SequenceType base class that contains common behavior is an implementation detail only. There is of course nothing wrong with duplicating the functionality in all classes that implement the SequenceType interface, however that clearly indicates that there should be implementation sharing and not just interface sharing. In any case, there is nothing stopping objects that do not inherit from the "SequenceClass" to implement the required interface and be just as usable as today. > maybe we should change this? let's see: > > "btw, now that you've installed 1.6, your old sequence > classes no longer work. you have to make sure they all > inherit from AbstractSequence. if you're using C types, > you're SOL" > > really? this is just plain silly. See above. > > -- while join can be *defined* as a series of concatenations, > > *implementing* things that way doesn't work in real life. do > > you really think that *all* sequence objects should know > > how to join all possible string types in an efficient way? or > > is that better left to the string implementation? > > > > Conversely, to you really think that both string classes should know how > to > > efficiently join all possible sequence types? > > yes, because all they have to do is to use the abstract > sequence interface: > http://www.python.org/doc/current/api/abstract.html > > > Consider: > > > > class MyTree: > > def join(sep=''): > > lhs = rhs = '' > > if self.lhs: > > lhs = self.join(self.lhs) > > if self.rhs: > > rhs = self.join(self.rhs) > > # presumably the + operator would do any neccessary coercion? > > return lhs + sep + self.data + sep + rhs > > > > sometimes implementing join as a series of concatenations does work > > only if you don't give a damn about performance... > > "btw, now that you've installed 1.6, string.join is > slow as hell. you might as well use reduce" > > forget it. won't happen. > > you seem to be arguing both sides of the fence here. On the one hand you want performance, on the other hand you want the sequence interface, yet you fail to deal with my statement that there is no efficient way of implementing the sequence interface for the MyTree example. (and yes, we both know that there are efficient means of doing it, they're just far from trivial and shouldn't be required.) Also, I don't understand your argument that ['a', 'b', 'c'].join() would be slow. It shouldn't be any harder to implement that in C, than implementing ''.join(['a', 'b', 'c']). The point is that with join attached to the sequence object, it would be no slower than the __getitem__/sequence interface implementation, but could conceivably be much faster. It all depends on the container. (think along the lines of MyTree implemented in C) This issue might be moot though, since a quick survey of Python programmers here, showed that while they really disliked ''.join(['a', 'b', 'c']), they didn't particularly enjoy ['a', 'b', 'c'].join() either, and were probably going to continue using string.join(['a', 'b', 'c']). -- bjorn From guido at python.org Tue Feb 29 09:55:50 2000 From: guido at python.org (Guido van Rossum) Date: Tue, 29 Feb 2000 09:55:50 -0500 Subject: New mailing list for IDLE development Message-ID: <200002291455.JAA05715@eric.cnri.reston.va.us> As part of the CP4E project, we're planning to do major work on IDLE. This includes an overhaul of the debugger, adding project management, customization, and more. We've created a new mailing list to discuss this work. Jeremy and I expect to do most of the work here at CNRI, but we welcome contributions and design discussions. We plan to carry out most of our own discussions about IDLE on the list as well. I'll post a more detailed document about our plans to the list, once enough people have signed up. IDLE will continue to be part of the standard Python distribution. Contributions will be treated the same way as regular contributions to Python (see python.org/patches) but they will be discussed and should be posted to the idle-dev mailing list. To join the mailing list, go to http://www.python.org/mailman/listinfo/idle-dev See you there! --Guido van Rossum (home page: http://www.python.org/~guido/) From donn at u.washington.edu Tue Feb 1 15:42:30 2000 From: donn at u.washington.edu (Donn Cave) Date: 1 Feb 2000 20:42:30 GMT Subject: Python & EPIPE: Handling Chg Proposal References: <20000201143138.A1126310@vislab.epa.gov> Message-ID: <877gfm$165i$1@nntp6.u.washington.edu> Quoth Randall Hopper : | The gist of the problem is that any program which writes to stdout or | stderr really needs to handle EPIPE to avoid tripping python error | tracebacks, and doing so is non-trivial and obfuscates otherwise-simple | Python code. | | Basically, this is buggy Python code: | python -c "for i in xrange(100000): print 'Lots of output'" | head | PROPOSAL: | | Add an "epipe_error" attribute to the file object. It would determine | whether EPIPE errors from read()/write() calls generate SystemExit | or IOError exceptions. | | By default EPIPEs received from the stdin/out/err files would generate | SystemExit exceptions (epipe_error = 0). All other files would default to | IOError exceptions (epipe_error = 1). Is the problem really the exception, or the traceback? It looks to me like it's the traceback, and nothing else about the exception is any problem for you. What if the top level handler that prints out these tracebacks just handled this one silently, as it does with SystemExit? That would allow programs to catch pipe errors if they want, a job that could be much more awkward if some pipe errors raise SystemExit instead. I'm not really sure it's a good idea to exit silently on a pipe error, anyway, but I think that's how I'd do it. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From boud at rempt.xs4all.nl Tue Feb 8 01:51:03 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 8 Feb 2000 06:51:03 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> Message-ID: <87oecn$auv$1@news1.xs4all.nl> Ronald Caudill wrote: > The programs I want to do soon needs a Grid widget and a calendar > widget. Are these widgets available in Python? Or can one write > your own. Or what do Python programmers do when they need widgets > like this? There are two or three widgets in PyKDE and PyQt that can be used as a grid widget, but none of them are editable. If you're looking for something as complete as the vsFlexGrid OCX available for Windows, you're stuck - none of the widget sets that I've evaluated had a decent editable grid*). Writing your own editable grid is a serious undertaking. I've made a start with a two-column listview of which the second cell is editable, but it's not easy. In fact, most of the underlying C or C++ toolkits haven't got a decent grid either, so all in all I must conclude that most people find this a difficult thing to make... People on the Qt mailing list keep asking for one, and Troll Tech keeps on not adding one ;-). You'll have to write (or wrap) your own calendar widget, too. But a calendar widget isn't too difficult to make - just pipe the output of cal into a grid, for a start. *) For my definition of decent, a grid should at least have the following features: unlimited cols/rows, cells editable with a line-editor or an optionally editable combobox. Cells should be able to contain pixmaps, text in fonts and colours specific to the cell. The lines that form the grid should be customizable. Cell-height and width should be customizable (height per row, width per cell). Built-in outlining and folding capabilities are a bonus. -- Boudewijn Rempt | http://www.valdyas.org From sholden at bellatlantic.net Tue Feb 15 17:57:42 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 15 Feb 2000 22:57:42 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <38A9D999.317AA96E@bellatlantic.net> Alan Daniels wrote: > > [summarises GC position] > > My question is: How hard would it be to keep the reference counting, > but add a built-in function, maybe called "gc()", that would walk > through all the existing objects, find the ones that have been > orphaned due to cyclical references, and reclaim them? Would something > like that be enough to make everybody happy? Possibly implemented as a > patch so that it was optional? It would still be deterministic (in > that __del__ would always get called right away, when appropriate), > but would still make sure that no objects were ever left unreclaimed > indefinitely. > > Would that work, or no? > > -- > ======================= > Alan Daniels > daniels at mindspring.com > daniels at cc.gatech.edu I seem to remember this was essentially the scheme used by Robert Dewar in the Spitbol implementation of Snobol4 (I know, I'm showing my age: I ported from the 1900 series to the DECSystem-10 as my final-year undergraduate product). He did this precisely to be able to reclaim memory from unreferenced cyclic structures. Spitbol also allowed explicit calls to the GC, which would return the amount of memort reclaimed, presumably for want of a more sensible result. However, this method may be slower than the existing collector. regards Steve regards Steve -- "If computing ever stops being fun, I'll stop doing it" From jblaine at shell2.shore.net Tue Feb 1 17:26:29 2000 From: jblaine at shell2.shore.net (Jeff Blaine) Date: Tue, 01 Feb 2000 22:26:29 GMT Subject: Charts References: <3890C74D.786411BC@acm.org> Message-ID: On Thu, 27 Jan 2000 15:31:41 -0700, Thierry Thelliez wrote: >Is there any packages for creating charts (histograms, scattered plots, >line charts,...) in Python ? I had this very same need recently. I got all excited about the Gnuplot module until I found out that it requires the Numeric C extension to Python. Was immediately disinterested, as I saw no reason for a pipe-based wrapper to require a C extension. I ended up doing the following [ ... snip ... ] # Create a data file here with the full path stored in 'tmpfilename' gnuplot = os.popen('gnuplot', 'w') gnuplot.write('set terminal gif\n') gnuplot.write('set output "' + myfilename + '"\n') gnuplot.write('set format "%.0f"\n') gnuplot.write('plot "' + tmpfilename + '" with lines\n') gnuplot.flush() gnuplot.close() [ ... snip ... ] From wolf at one.net Wed Feb 9 17:36:32 2000 From: wolf at one.net (wolf at one.net) Date: Wed, 09 Feb 2000 17:36:32 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87on3m$p2i$1@mach.vub.ac.be> Message-ID: Thomas Hamelryck wrote: >I am in exactly the same position. It was a serious design error. >I wonder how the CP4A people are going to explain to complete >computer illiterates that a python program can contain errors that >are _not even visible_ when you look at the code. Probably the same way C programmers explain that a C program can contain errors that are _not even visible_ when you look at the code. The kind of errors produced by incorrect indentation are exactly the same kind produced by misplaced braces. Or misbehaved pointers... :) Just for the record I think Python's indentation as code blocking is a *marvelous* idea. It does require an editor smart enough to translate tabs into x # of spaces, but surely that's not too great a stretch for any editor on any OS these days? It also requires a bit of programmer discipline, but surely beginning programmers should learn good habits from the beginning? And of course Python will pretty much lay the code formatting religous wars to rest! Respectfully, Wolf "The world is my home, it's just that some rooms are draftier than others". -- Wolf From da at ski.org Wed Feb 16 00:28:17 2000 From: da at ski.org (David Ascher) Date: Tue, 15 Feb 2000 21:28:17 -0800 Subject: Deadline looming for the O'Reilly Open Source Convention Abstract submissions! Message-ID: <04b601bf783e$a17f8e60$0100000a@ski.org> If you've been considering submitting a talk proposal for the ORA conference, please submit it soon! Facts worth knowing: - Instructions are at: http://conferences.oreilly.com/oscon2000/call.html - An abstract is all you need to submit -- no need for full paper submissions. - Speakers get free access to the convention and 50% off tutorials. - Deadline for abstract submission is February 18, 2000. - Conference is July 17-20, 2000 in Monterey, CA. Cheers, --david ascher (Python track program chair) From loredo at spacenet.tn.cornell.edu Wed Feb 23 16:10:44 2000 From: loredo at spacenet.tn.cornell.edu (Tom Loredo) Date: Wed, 23 Feb 2000 16:10:44 -0500 Subject: Which GUI? References: <2B1262E83448D211AE4B00A0C9D61B03BA7148@MSGEURO1> Message-ID: <38B44CD4.89E6ED47@spacenet.tn.cornell.edu> Pieter Claerhout wrote: > > What about toolkits for the Mac. The MacOS toolbox is nowhere > mentioned, and also the problems we have with running Tcl/Tk > on the Mac are mentioned nowhere. Any suggestions on what else > will work with a Mac? I'm working mostly on Solaris now, but my Python work will also have to run on a Mac and perhaps Win also. I've heard a few mentions now of problems with Tcl/Tk on the Mac (here and in regard to IDLE). I've yet to give it a try, but before I do, what are the problems on the Mac side with Tcl/Tk? And with Tkinter? Is it just the mediocre Tk look-and-feel? Does Tkinter not work at all on the Mac? Are there particular widgets that must be avoided? Thanks, Tom Loredo From gmcm at hypernet.com Fri Feb 25 09:01:34 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 25 Feb 2000 09:01:34 -0500 Subject: Newbie Newbie, we are all Newbie to something In-Reply-To: References: <8945mi$8vc$1@wanadoo.fr> Message-ID: <1260635201-9193570@hypernet.com> Gregoire Welraeds wrote: > I'm currently reading the Python Reference Manual and I got a small > question regarding the __del__() statement in a class definition. > I understand his utility when you don't have a garbage collector and > memory management. In this case, it is important to have del statement to > free object properly. No, the __del__ method (if it exists) is called when Python is about to dealloc the object because the refcount has dropped to zero. If you code a __del__, it's to release some resource that won't be automatically reclaimed. But what if you have ? > In the same topic, do we have to explicitly close an open file before > exiting: No. File objects close themselves when dealloc'ed. So this is a common idiom in Python: text = open(filenm, 'r').read() With both GC (at least, most implementations) and refounting you have problems with circular references. In (most) GC, when a unreachable cycle of objects is reclaimed, the finalizers are not called, but the memory is reclaimed. With refcounting, unreachable cycles live forever. But, with refcounting, when a refcount reaches 0, the object is deallocated then and there, so it is safe to release resources in the dealloc (or __del__). In GC, there are any number of factors that can influence when the finalizer is run, so you normally code an explicit close method if you need the resource released in a timely manner. - Gordon From mlh at idi.ntnu.no Thu Feb 3 10:25:09 2000 From: mlh at idi.ntnu.no (Magnus Lie Hetland) Date: Thu, 3 Feb 2000 16:25:09 +0100 Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <87c6pr$hsr$1@kopp.stud.ntnu.no> Maybe you would like to make a German translation of Instant Python? (http://www.idi.ntnu.no/~mlh/python/instant.html) There are several other translations, and a German one would be nice... Or perhaps Instant Hacking would be more appropriate to a beginning 11-year-old... (http://www.idi.ntnu.no/~mlh/python/hacking.html) Shamelessly-pluggging'ly yours, Magnus :) -- Magnus Lie Hetland mailto:@hetland.org Fritz Heinrichmeyer wrote in message news:876emj$kco$1 at oak.fernuni-hagen.de... > My son is 11 years and wants to learn programming. He heared about java at > school (cool like nike or adidas ...) but in my opinion this is very hard > stuff for a beginner to bring anything to play. > > I thought of a nice python environment under windows ... It would be best to > have german documentation too. > > What do you think? > --- > Fritz Heinrichmeyer mailto:fritz.heinrichmeyer at fernuni-hagen.de > FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany) > tel:+49 2331/987-1166 fax:987-355 http://ES-i2.fernuni-hagen.de/~jfh > > From sdunn at digitalanvil.com Sat Feb 19 17:04:47 2000 From: sdunn at digitalanvil.com (Sean Dunn) Date: Sat, 19 Feb 2000 16:04:47 -0600 Subject: Hung readline on pipe Message-ID: <38AF137E.46B71976@digitalanvil.com> I'm using pipe2 to spawn a process and read it's stdout.. I do the following, yet it still hangs. Any observations?: # Initialization part : Bipipe is an interface to pipe2.. just pretend. # cmd = 'generateInfo' inst = bipipe.BiPipe(cmd, '', 1) (self.mPipeOut, self.mPipeErrOut, self.mPipeIn, self.mPipePID) = (inst.fromchild, inst.childerr, inst.tochild, inst.pid) fcntl.fcntl(self.mPipeOut.fileno(), FCNTL.F_SETFD, FCNTL.O_NDELAY) fcntl.fcntl(self.mPipeErrOut.fileno(), FCNTL.F_SETFD, FCNTL.O_NDELAY) # This part is actually in a separate function.. It reads input until there's nothing on the pipe, # and then breaks to do other processing, but will come back to this section later. # while 1: (readList, writeList, exList) = select.select([self.mPipeOut, self.mPipeErrOut], [], [], 0) if not readList: break #if for item in readList: char = item.read(1) self.CollectByte(char) #for #while At first it seems to work fine. The while 1: loop runs, gets input, breaks out, etc. But I think when the child process exits, and there is still stuff in the pipe to be read (before the while 1: gets around to it) it hangs on the read() even though the select thinks there is something there.. I have verified that the command I'm running generates more than is being shown. I was using a full readline() before the read() thinking that maybe it was just hanging on looking for a \n, but it still doesn't work. Any ideas on how to cure this? Thanks! Sean -- Sean Dunn "I'm afraid. I'm afraid, Dave. Digital Anvil Dave, my mind is going. I can feel it. VFX Software Engineer I can feel it. I can feel it." -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Fri Feb 18 18:09:11 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 18 Feb 2000 23:09:11 GMT Subject: win32security References: <87pu3o$23i$1@nnrp1.deja.com> <88jodj$32a$1@nnrp1.deja.com> Message-ID: wrote in message news:88jodj$32a$1 at nnrp1.deja.com... > Can anybody help me with this as the above code won't work - fails on > SetFileSecurity. Any help would be much appreciated. Can you be more specific than "fails" - ie, post the traceback! Mark. From greene at hctc.com Fri Feb 25 21:54:15 2000 From: greene at hctc.com (Collin Greene) Date: Fri, 25 Feb 2000 19:54:15 -0700 Subject: i know this sounds redicculus but!!!.... Message-ID: how do you do simple commands such as say things is it print? also does anyone know a good tutorial so i can learn the basic python skills like tth such ...i am really egal to learn adn will stick woht it but just need a little help wiht basic commands also what is teh ohter app bundeled wiht python 1.52? is that a help thing thanks for your time and tips arte appreaceated newbie #1 greene at hctc.com From effbot at telia.com Wed Feb 16 18:26:25 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 23:26:25 GMT Subject: tkinter manual wanted References: <38AB1310.B97A982@freenet.edmonton.ab.ca> Message-ID: Joseph Paish" wrote: > i am looking for a downloadable tkinter manual/tutorial. i have found > one or two on the web (on pythonware.com, i think) but would like > something that can be read without going online. pdf format would be > ideal, if such a thing exists. a PDF version is available from: http://www.pythonware.com/library.htm to make a local copy of the HTML version, use the "websucker" utility (you'll find it under Tools in the standard Python source distribution). Robert Hicks wrote: > Unfortunately Tkinter documentation is scarce. The is a book out called > Python and Tkinter programming by Grayson. that plug had looked better if you had answered his question as well... From tismer at tismer.com Tue Feb 1 06:49:31 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 01 Feb 2000 12:49:31 +0100 Subject: was Stackless 1.01 Homepage: another bug in stackless? References: <388BE68E.B26985CA@tismer.com> <$WXiIAAO+Dj4Ew2W@jessikat.demon.co.uk> <388C7D4A.D873AA@tismer.com> <388C9733.B4F60DC0@tismer.com> <7PUz+AAC6aj4Ewne@jessikat.demon.co.uk> <38947CE6.5ADEE391@tripoint.org> Message-ID: <3896C84B.8195845B@tismer.com> Shae Erisson wrote: > > > > I installed the stackless update on win95, and suddenly hitting the > enter key in IDLE gives me two carriage returns. > > Any ideas? There was a try...finally bug, which is solved now. When trying IDLE, I get the same behavior with and without Stackless. Maybe you should uninstall and try 1.02 ? ciao - chris.stackless -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 dan at cgsoftware.com Thu Feb 10 21:52:53 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: 10 Feb 2000 21:52:53 -0500 Subject: Embedding and extending In-Reply-To: jidun@my-deja.com's message of "Fri, 11 Feb 2000 02:16:58 GMT" References: <87vreo$aoq$1@nnrp1.deja.com> Message-ID: jidun at my-deja.com writes: > I know there are some threads discussing this, > but usually they concentrate on one or the other. > Also all of them refer to the online python.org > documentation which really isnt that good on > these two topics, imho. > > Here is my understanding from those threads: > To do both I need three 'modules': > > 1: python > 2: the module that extends python (.dll on Win32) > 3: my application that embeds python (.exe on > Win32) > > Is there a way to eliminate module 2? In other > words, can module 3 be both the app that embeds > python and the module that has the functions > python can call back to? > Yes, you can. I use CXX in C++ to do this (Using the Py::ExtensionModule class) I actually add and remove things from the modules on the fly. > To elaborate: I know that a extend-module > called 'mymod' needs an initmymod function that > python calls when it imports it to get hold of > the function table. When I embed python in my > application, can I somehow hand over that > function table to python so that my scripts can > call back into my application? Yup. If you aren't using C++, I don't remember the exact underlying Python C api being using offhand (Mainly because i haven't seen it in a few months :P), but that's all CXX is using at the lowest level, so it's definitely possible. > > Thanks > -Ron From gerrit.holl at pobox.com Wed Feb 23 14:26:51 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 20:26:51 +0100 Subject: Which GUI? In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA7148@MSGEURO1>; from PClaerhout@CREO.BE on Wed, Feb 23, 2000 at 06:09:44PM +0100 References: <2B1262E83448D211AE4B00A0C9D61B03BA7148@MSGEURO1> Message-ID: <20000223202651.B4980@stopcontact.palga.uucp> > What about toolkits for the Mac. The MacOS toolbox is nowhere > mentioned, and also the problems we have with running Tcl/Tk > on the Mac are mentioned nowhere. Any suggestions on what else > will work with a Mac? I am searching the web for such GUI's now - I did not realize that (almost?) none of the GUI's works on a Mac... regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From fdrake at acm.org Fri Feb 11 11:06:41 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 11 Feb 2000 11:06:41 -0500 (EST) Subject: Two question from a newbie In-Reply-To: <38A431EE.5A7B2B1@aston.ac.uk> References: <38A431EE.5A7B2B1@aston.ac.uk> Message-ID: <14500.13201.442851.52269@weyr.cnri.reston.va.us> Peter Bittner writes: > 1.) How do I implement ORs and ANDs in an if-statment? > > - e.g. I'd like to have this C-code in Python: > > if (x.mode == "view" || x.mode == "modify") > myMode = x.mode; if (x.mode == "view" or x.mode == "modify"): myMode = x.mode -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From jcw at equi4.com Tue Feb 29 06:52:25 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Tue, 29 Feb 2000 12:52:25 +0100 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) References: <3326DD1EE2F0A189.8CE210DACA89D440.29CA859F010483DB@lp.airnews.net> <20000229110221.A2042@nl.linux.org> Message-ID: <38BBB2EA.3D4074E4@equi4.com> Hello Gerrit, [...] > > To receive a new issue of this posting in e-mail each Monday > > morning, ask to subscribe. > > Mention "Python-URL!". > > Hmm, isn't it automated? If not, please subscribe me. > > > I'm not sure who makes this list - Cameron Laird or Fredrik Lundh? > Thanks for putting my GUI comparison in the Weekly Python-URL! Python-URL! is maintained by a rotating and growing group of volunteers, who each step in for a few months, collecting and editing these URLs. Cameron Laird takes care of the weekly mailing, while I jump in every few weeks to keep an archive up to date with all prior editorials: http://purl.org/thecliff/python/url.html Many great people have already become honorable members of the *-URL! editorial team, as you can see here: http://mini.net/cgi-bin/url/1.html (and yes, there's also Tcl-URL! - quite an easy way to track what is happening in Tcl-land without having to read all of comp.lang.tcl). The *-URL! editorials are on the www.ddj.com homepage, on the Scriptics site, announced in Linux Weekly News, and probably other places too. That's all there is to it. It's *by* scripters and *for* scripters :) -- Jean-Claude From trentm at ActiveState.com Thu Feb 10 05:57:20 2000 From: trentm at ActiveState.com (Trent Mick) Date: Thu, 10 Feb 2000 10:57:20 -0000 Subject: Redirect DOS command output In-Reply-To: <87ura9$ib0$1@nnrp1.deja.com> Message-ID: You want to look as os.popen(). This will give you a handle on the stdout from the command that you run. If you want access to thye other std file handles (stderr, stdin), then you will want to look at popen2() and popen3(). The latter two functions have not been made fully portable yet in Python 1.5.2 so if you are on Windows then you need to use win32pipe.popen2() and win32pipe.popen3(). On UNIX they are in the os module I think (or maybe the posix module, not sure). In the simple case I usually do something like the following: for line in os.popen('some command').readlines(): # do some stuff with 'line'... Trent > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of > daryl_stultz at my-deja.com > Sent: Thursday, February 10, 2000 5:08 PM > To: python-list at python.org > Subject: Redirect DOS command output > > > Hey, I'm using os.system() to execute a DOS command (on an NT machine). > I would like to capture (and parse) the output from the command. I'm > familiar with sys.stout but I'm not sure how to do this. > > Thanks for the help. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list > From daniel.dittmar at sap.com Wed Feb 16 04:40:59 2000 From: daniel.dittmar at sap.com (Daniel Dittmar) Date: Wed, 16 Feb 2000 10:40:59 +0100 Subject: Q: Unicode support in Python 1.6 Message-ID: <38AA70AB.24B8ED1@sap.com> Can anyone explain how Unicode will look like in 1.6? I suppose there will be a new type similar to strings, but will there be Unicode literals? And will some standard modules be Unicode aware such that they will accept either Unicode or standard strings? -- Daniel Dittmar SAP AG, Basisentwicklung Berlin daniel.dittmar at sap.com From tim_one at email.msn.com Wed Feb 16 00:55:19 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 16 Feb 2000 00:55:19 -0500 Subject: breaking the ; habit In-Reply-To: <38A9D225.C4FF0CCF@bellatlantic.net> Message-ID: <000e01bf7842$67cb13c0$b7a0143f@tim> [Steve Holden] > ... > One thing I *can* be sure of: if Tim was offended, you'd be > likely to hear about it! Indeed! One person on c.l.py managed to offend me over the last two years, and he did hear about it. QED. We eventually *almost* made up in pvt, but then I got a flu and lost the "make up" thread to a crushing email backlog, so now he's probably offended by me again. That is, I appear doomed to give offense far more than take it. I suppose we should announce a competition to see who can offend me next. Oh ya -- comp.lang.python would really benefit from that . ignorance-isn't-evil-and-foolishness-is-the-human-condition-ly y'rs - tim From tim_one at email.msn.com Sun Feb 13 02:44:49 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 13 Feb 2000 02:44:49 -0500 Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] In-Reply-To: <8806p0$8u7$1@nntp6.atl.mindspring.net> Message-ID: <000301bf75f6$34eb3e60$962d153f@tim> [Aahz Maruch] > Here's an interesting question that I don't think I've seen here: > given that the semicolon is not a significant character in Python, But it is ("i=1; j=2; k=3;"). ? @ $ and ! are currently unused. > why wasn't it chosen as the tuple creator? Python's tuple notation was inherited from ABC. Python generalized it somewhat, but didn't fiddle. > Would make it a lot easier to do, say, > > def foo(bar): > print bar > > foo(a;b;c) Since it's unclear why that's an interesting thing *to* do, I'm not sure why it would be an advantage to make it easier to do it . I must say that confusing tuples with formal argument lists is one of the things I stumbled over in Python at first. It took several exasperated email rebukes from Guido before I figured out what the heck was going on. The argument-passing rules got much saner by the time Python 1.0 was released. Steven Majewski probably beat up on Guido in that area too. The Truth is that tuples have nothing whatsoever to do with arglists anymore, except via the "*args" varargs mechanism -- and that should probably construct a list of arguments instead of a tuple. ain't-broke-don't-fix-ly y'rs - tim From effbot at telia.com Thu Feb 10 03:47:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 08:47:21 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <1e5rfjz.9cxojz7w765jN%bparsia@email.unc.edu> Message-ID: Bijan Parsia wrote: > www.python.org is run by an organization which one *might* describe as > an "industry group" I'm sure you can call him "barry", like the rest of us. > It's an attack, and an unfounded one, to suggest that the Smalltalk > community "suppressed" knowledge of Smalltalk, yes. well, you obviously failed to convince the butterflies to work for you... "Even if you're on the right track, you'll get run over if you just sit there" -- Will Rogers From dilsavor at erinet.com Fri Feb 11 23:48:23 2000 From: dilsavor at erinet.com (Ronald L. Dilsavor) Date: Sat, 12 Feb 2000 00:48:23 -0400 Subject: How to do this? - newbie References: <38a2e958$0$1403@news.voyager.net><38A2EE79.14190ABA@bellatlantic.net> <38a3892d$0$96317@news.voyager.net><06ee01bf748d$2a28f040$01ffffc0@worldnet.att.net> Message-ID: <38a4e7d1$0$96317@news.voyager.net> Thanks for all your solutions... Here is the one I think I was after - and I got it by providing more background on what I was after. Sorry I am not thinking totally OO yet or even asking the question correctly. > Regarding how I came up with such a question... > I have a file that contains stuff like: > sensorType = HSI > numSensorBands = 5 > etc > > I am reading that file with readline and splitting the line into a list of 2 > items such as a=('sensorType', 'HSI') > > I then want to make sensorType an attribute of a sensor object so I can > access it like > >>>> print sensor.sensorType > 'HSI' > > which I think has really nice readability. > If I go the dictionary approach, it will read more like > >>>> print sensor.dictionaryName['sensorType'] > 'HSI' > > which in my opinion is a little less pleasing to the eye. Paul Foley wrote: Ah, I see. That makes a difference! There's no need to create new local variables. Conceptually, use a dict enclosed in a class, with methods that hide accesses so that you can use sensor.sensorType() [or sensor.sensorType, if you prefer] rather than sensor.dictionary['sensorType']. But note that the way class attributes work in Python is that there is _already_ a dict, called __dict__, in each instance, containing the attributes. So sensor.sensorType is equivalent to sensor.__dict__['sensorType'], and you can just go ahead and use __dict__ to store your mappings. From nobody at nowhere.nohow Sat Feb 12 22:24:36 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Sun, 13 Feb 2000 03:24:36 GMT Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: On Tue, 08 Feb 2000 17:04:01 -0800, Curtis Jensen wrote: >I fear that this question has already been asked, Yes, it has. >but is there and >equivalant one line command that is equivalant to the C command: > >a = x > y ? x : y Possibly. Generally this question is answered with at least a half-dozen or so one-line code examples -- almost all of which somebody will claim are wrong in one respect or another. While there may exist an equivalent chunk of Python code, the practical answer seems to be that there isn't a _good_ (readable and obviously correct) way to do this with one line of Python code. -- Grant Edwards grante Yow! I'm in direct contact at with many advanced fun visi.com CONCEPTS. From evan at 4-am.com Tue Feb 15 17:52:53 2000 From: evan at 4-am.com (Evan Simpson) Date: Tue, 15 Feb 2000 16:52:53 -0600 Subject: Iterators & generators & coroutines References: <001e01bf7790$8bd74480$66a2143f@tim> <88c7hu$209$1@nntp5.atl.mindspring.net> <88cg9r$10t$1@nntp9.atl.mindspring.net> Message-ID: Aahz Maruch wrote in message news:88cg9r$10t$1 at nntp9.atl.mindspring.net... > In article , Evan Simpson wrote: > >Why attach such significance to it? Why not just... > > > >b = BinTree() > >for node in b.traverser(): > > Because now you either have the for construct implicitly create a new > generator frame or you cannot do > > b = BinTree() > for node in b.traverser(): > for node in b.traverser(): I think I'm missing something, probably something simple. Let me lay out my implicit assumptions about how I think this would work; Stop me when I run off the tracks, please :-) BinTree is a normal class, which produces ordinary instances which implement a binary tree. BinTree has a method 'traverser', which returns an object. This object steps along the binary tree and returns a node each time its __getitem__ is called, then raises an exception when it runs out of tree. Instead of maintaining some kind of explicit state in the object, it simply uses continuations to implement __getitem__ in a clear, natural fashion. The only data in the object is the continuation for __getitem__ and a reference to the BinTree instance. Calling b.traverser() twice, as above, just creates two traversal objects which independently walk the tree. > I would much rather create the generator frames explicitly as in the > following (I'm now assuming my later idea that a call to a generator > creates a generator frame that can be used like a function) > > b = BinTree() > g1 = b.traverser() > for node in g1(): > g2 = b.traverser() > for node in g2(): So g1 and g2 are generators, and g1() and g2() are 'generator frames', yes? So what is a 'generator frame'? Perhaps that is what I'm not getting. Cheers, Evan @ 4-am From ivanlan at callware.com Fri Feb 25 07:08:49 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 25 Feb 2000 05:08:49 -0700 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <8945c6$a8j$1@nnrp1.deja.com> Message-ID: <38B670D1.D34C9D25@callware.com> Hi All-- piet at cs.uu.nl wrote: > > >>>>> see_plus_plus at my-deja.com (spp) writes: > > spp> Wait & See. > spp> This new compiler is coming out from the same country where Mercedez, > spp> BMW & Porsche are produced. You know the quality of those cars, do you? > spp> cpp > > Like the Mercedes A-model that flipped over when you took a curve too fast. > Which reminds me of the Harry Hopkins Jumping Tank. Sometime in the fifties (IIRC), the English decided that a rocket-assisted tank that could "jump" over obstacles that would stop ordinary tanks might be a useful thing to develop. So develop it they did. It worked very well, except for the annoying tendency to land on its back, thereby squashing the turret and ocassionally killing the driver. ... -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 python at columbus.rr.com Fri Feb 11 10:08:07 2000 From: python at columbus.rr.com (Mark Nielsen) Date: Fri, 11 Feb 2000 15:08:07 GMT Subject: PyApache, couldn't geta hold of author, willing to donate sometime References: Message-ID: <38A3DFA2.C1428AF8@columbus.rr.com> > > The thing is, I don't know the status of Python and Apache! > > It is slowly evolving. Most people (including myself) are pretty > satisfied with the PyApache, so not much work need to be done. > If you need a feature, ususally you will develop it youself, and publish > a patch on PyApache mailing list, like I did few times. > My biggest problem is that I am not much of a c programmer. I am good at perl, and I would like to re-write a lot of perl_mod for Python. A few of my friends also would like to help. We need a variety of people! A good programmer who understand Apache and PyApache would be helpful. Zope is cool, but I would like to see Python being used with Apache in a more basic form. For example, right now, I have mod_perl, mod_php, and mod_python compiled into Apache. I would like to see Python have persistent database connections, OutPut Filters, and SSI just like mod_php and mod_perl have. I naturally will be using Zope more and more often anyways, but I would like to see Python excel with Apache without Zope. I guess, in my perfect world, I would like to use half of my web servers be Zope, and the other half be Apache with mod_python. I like options! Now, I am new to PyApache, so maybe some of this stuff can be implmented rather easily (persistent database and SSI), I would just need to be pointed in the right direction so that I can do it! Mark From aahz at netcom.com Thu Feb 17 10:38:26 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 15:38:26 GMT Subject: Iterators & generators & coroutines References: <001e01bf7790$8bd74480$66a2143f@tim> <88cg9r$10t$1@nntp9.atl.mindspring.net> Message-ID: <88h4li$74d$1@nntp6.atl.mindspring.net> In article , Evan Simpson wrote: > >BinTree is a normal class, which produces ordinary instances which >implement a binary tree. BinTree has a method 'traverser', which >returns an object. This object steps along the binary tree and >returns a node each time its __getitem__ is called, then raises an >exception when it runs out of tree. Instead of maintaining some kind >of explicit state in the object, it simply uses continuations to >implement __getitem__ in a clear, natural fashion. The only data in >the object is the continuation for __getitem__ and a reference to the >BinTree instance. > >Calling b.traverser() twice, as above, just creates two traversal >objects which independently walk the tree. Hmmmm.... On second thought, I guess what you're suggesting would work, as long as BinTree.traverser() returns a generator object (instead of returning a list) and the for construct understands how to use generator objects. (I was still stuck in my original idea when I disagreed with you, where I was thinking that BinTree.traverser() was an ordinary method that required a keyword to create a generator object. I now think that's a Bad Idea and that BinTree.traverser() should be unusable as anything other than the creator of generator objects, which requires a keyword when defining BinTree.traverser().) >Aahz Maruch wrote in message >news:88cg9r$10t$1 at nntp9.atl.mindspring.net... >> >> I would much rather create the generator frames explicitly as in the >> following (I'm now assuming my later idea that a call to a generator >> creates a generator frame that can be used like a function) >> >> b = BinTree() >> g1 = b.traverser() >> for node in g1(): >> g2 = b.traverser() >> for node in g2(): > >So g1 and g2 are generators, and g1() and g2() are 'generator frames', yes? Not quite. g1 and g2 are generator objects (aka "generator frames"); g1() and g2() are calls to the generator that either return a value or raise an exception. >So what is a 'generator frame'? Perhaps that is what I'm not getting. "Generator frame" is functionally equivalent to "generator object"; I prefer to use "frame" in analogy with "stack frame" to make clear that the object has a local namespace and program counter. If nothing else, generators will guarantee the demise of Python's "two namespace" rule. (Sort of. Each frame will still maintain the two namespace rule.) -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From Christian.Schaller at mchp.siemens.de Wed Feb 2 10:33:25 2000 From: Christian.Schaller at mchp.siemens.de (Christian Schaller) Date: Wed, 02 Feb 2000 16:33:25 +0100 Subject: need help with pdb Message-ID: <38984E45.50108226@mchp.siemens.de> Hello... after encountering problems with installing RedHat Linux, I had my first encounter with pdb. There are some topics I don't know how to be done. At first, I know I can change a variable simply by using (pdb) ! var = 'foo' But can I continue execution of a program with that changed value? Say, var contained a key for a dictionary and the key was not found. If I change the key to a value that I know is contained in the dictionary, can I retry that line of code so the execution continues? The pdb documentation says, that assignments are always done in the current frameset. So if I have a local variable that is used in a function and the execution is stopped in that function, how can I change that value? e.g.: def f(): var = 'foo' print var #(stop execution at that line) (pdb) p var 'foo' prints the value, but if I change that value to (pdb) var = 'bar' 'foo' is returned again?!? Can anyone help me? Thanks a lot in advance! bye Chris... From sabren at manifestation.com Sat Feb 19 14:22:11 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sat, 19 Feb 2000 14:22:11 -0500 (EST) Subject: What a weird thing !!? In-Reply-To: <88lukr$2cfj$1@news5.isdnet.net> Message-ID: On Sat, 19 Feb 2000, Florent Rami?re wrote: > Hi, > > sorry for replying this message, but is what you say means that there is > absolutely no way to print excatly what i want to print ??? > > I will never be able to display "ab" in two print ??? > > That make me nervous about python ! This is a feature. >>> print "a", "b" is just an easy way of saying: >>> import sys >>> sys.stdout.write("a") >>> sys.stdout.write(" ") >>> sys.stdout.write("b") so to get rid of the space: >>> import sys >>> sys.stdout.write("a") >>> sys.stdout.write("b") or: >>> print "a" + "b" and for numbers: >>> a = 1 >>> b = 1 >>> print `a` + `b` # note back-ticks or: >>> result = "a" >>> result = "a" + "b" >>> print result Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From toby-wan-kenobi at gmx.de Sun Feb 13 23:55:32 2000 From: toby-wan-kenobi at gmx.de (Tobias Rademacher) Date: Mon, 14 Feb 2000 05:55:32 +0100 Subject: Threads in Python Message-ID: <8881oc$5o9$1@news02.btx.dtag.de> Hi Everbody, I just decided to learn Python. Are Threads intregreated in the Language like in Java? Thx for your help. Regards Toby-Wan From anders.eriksson at morateknikutveckling.se Thu Feb 17 08:31:09 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Thu, 17 Feb 2000 14:31:09 +0100 Subject: Which GUI? Message-ID: Hello! As a new comer to Python I have not yet started programming apps that has a GUI. I have concentrated my efforts on CGI. But now I'm reaching the point of no return and I need to create apps with a GUI, but which one? I'm using Windows NT as my development platform and at the moment my apps will probably not be interesting enough for anyone else, but... I would like pro and cons for the different GUI's // Anders From DavidA at ActiveState.com Mon Feb 21 12:39:41 2000 From: DavidA at ActiveState.com (David Ascher) Date: Mon, 21 Feb 2000 09:39:41 -0800 Subject: Call for Patch for Borland compiler Message-ID: <000a01bf7c92$a208fa30$c355cfc0@ski.org> Inprise/Borland has made their C++ compiler on Windows free (as in beer). Guido has expressed that it would be nice to have makefiles which allowed one to build Python with this compiler by the next release. If someone is interested in providing this patch, that'd be great. See compiler download info at: http://www.borland.com/bcppbuilder/freecompiler/ See instructions for patch submissions at http://www.python.org/patches/ --david ascher From gerrit.holl at pobox.com Thu Feb 17 10:10:58 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 16:10:58 +0100 Subject: Abstract classes? In-Reply-To: <14508.630.889721.461148@beluga.mojam.com>; from skip@mojam.com on Thu, Feb 17, 2000 at 08:15:18AM -0600 References: <14508.630.889721.461148@beluga.mojam.com> Message-ID: <20000217161058.A981@stopcontact.palga.uucp> Skip Montanaro wrote on 950771718: > > Daniel> class Observer: > Daniel> def update( self ): > Daniel> raise "sub-classes must over-ride this method" > > You might want to raise the standard NotImplementedError. From its doc > string: > > >>> help(NotImplementedError) > Method or function hasn't been implemented yet. Daniel, please note that you probably don't have the help() function. It's a function written by Skip to print an objects __doc__ attribute. So this is really equivalent to: print NotImplementedError.__doc__ You could write the help function like this: def help(obj): """help(obj) -> None Print the docstring of an object to sys.stdout. """ if hasattr(obj, "__doc__): print obj.__doc__ else: print obj, "doesn't have a docstring" regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From quinn at pfennig.ugcs.caltech.edu Fri Feb 25 17:03:42 2000 From: quinn at pfennig.ugcs.caltech.edu (Quinn Dunkan) Date: 25 Feb 2000 22:03:42 GMT Subject: fatal SIGSYS under irix Message-ID: % python ~/tmp quinn at cholera Python 1.5.2 (#10, Feb 11 2000, 15:14:46) [GCC 2.8.1] on irix6-n32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> f = open('foo') >>> f.seek(1, -4) zsh: 61898 invalid system call python 140% Granted, I reversed the order of the arguments for seek(). But killing the interpreter is a bit harsh. This happens on all irix systems I was able to test. Linux just ignores the bad SEEK_* arg. I don't know if this is because it doesn't send SIGSYS for that, or because linux python is catching it. The hpux and solaris boxes are down so I couldn't test them... Anyone else on irix see this? From bparsia at email.unc.edu Thu Feb 10 23:03:35 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Thu, 10 Feb 2000 23:03:35 -0500 Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] References: <1e5r2o4.14puk8l1i1mb9N%bparsia@email.unc.edu> <000601bf7382$c3009040$8e2d153f@tim> Message-ID: <1e5rtrr.1o50kvchaxzigN%bparsia@email.unc.edu> Tim Peters wrote: [snip] > > Bijan, you've been patient, good-natured and consistently informative. I > have no idea why some of c.l.py's normally curious & friendly residents have > gotten bugs up their butts about Smalltalk, but after this verbal rebuke > from one of c.l.py's normally hostile residents , I hope they'll > settle down and welcome you here as you not only deserve, but have more than > *earned* in this thread. > > Your posts were a pleasure! Come back anytime. > and-get-those-ugly-colons-out-of-smalltalk-ly y'rs - tim Just for you! Would prefer semicolons, or dollar signs? (Er..there's two alternative "visual" syntaxes in Squeak, somewhat experimental. Actually, three. Maybe three and a half :)) (Pointer's available upon request.) and-wasn't-it-subtle-of-me-to-quote-all-of-your-kind-words-ly y'rs Bijan Parsia. Cheers, Bijan Parsia. From cfelling at iae.nl Sun Feb 27 16:18:32 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 27 Feb 2000 22:18:32 +0100 Subject: Converting a floating point number to a string References: <899bqt$udk$1@nnrp1.deja.com> Message-ID: <89c4b8$hd8$1@vvs.superst.iae.nl> kurtn at my-deja.com wrote: > As the subject says I would like to convert a > floating point number to a string, in other words other pointed you in the direction of the simple "str" call, but if more control over the layout is needed you might use the "%" trickery like: >>> '%5.2f' % 123.4567 123.45 >>> '%5.2e' % 123.4567 1.23e+02 have fun -- groetjes, carel From effbot at telia.com Thu Feb 10 12:40:31 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 17:40:31 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> <87uo06$fri$1@nnrp1.deja.com> Message-ID: thucdat1143 at my-deja.com wrote: > Look up what Deja.com is looking for, none of the languages you listed > below, but a very weird one: Perl ! oh, that explains why they're advertising on the Python job board... From XoseLuis at retemail.es Fri Feb 11 15:52:10 2000 From: XoseLuis at retemail.es (Xose L. Gonzalez) Date: Fri, 11 Feb 2000 21:52:10 +0100 Subject: urlopen through firewall References: <389B22DD.41FBC8F1@retemail.es> Message-ID: <38A47679.7E4A337B@retemail.es> Fredrik, Thank you for your quick anwer and help effort. Unfortunately the enviroment variable setting (with the right port number and right proxi address) did not work :( > > > Xose L. Gonzalez wrote: > > When I try to connect to the webserver through "urlopen", it is > > impossible when inside firewall, whereas the same code works without > > firewall involved > > > > which is the solution? > > set the http_proxy environment variable to point to your > proxy server. e.g: > > import os, urllib > > os.environ["http_proxy"] = http://proxy.spam.egg:1234" > > # connect to www.python.org through proxy.spam.egg:1234 > fp = urllib.urlopen("http://www.python.org") > > if you prefer, you can of course set the environment > variable outside your program (using the usual shell > commands). > > From aotto at t-online.de Tue Feb 29 04:13:54 2000 From: aotto at t-online.de (Andreas Otto) Date: Tue, 29 Feb 2000 10:13:54 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <38B0E09D.EC26F41E@t-online.de> <38B58623.6FD5FF59@stud.upb.de> Message-ID: <38BB8DD2.B7362F77@t-online.de> Have a look to: http://home.t-online.de/home/aotto/comp-code.html ,special the "Example" section, and you'll get some of the informations you look for mfg aotto :) -- ================================================================ Andreas Otto Phone: ++49-(0)8152-399540 IPN Ingenieurbuero fuer mailto:aotto at t-online.de Praezisionsnumerik Web: http://home.t-online.de/home/aotto Ulmenstrasse 3 Skills: Unix,Sql,Tcl,Shell,Sybase... D-34289 Zierenberg Area: Bank, FX, MM, shares, options ================================================================= From pinard at iro.umontreal.ca Fri Feb 25 10:42:57 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 25 Feb 2000 10:42:57 -0500 Subject: os.path.walk (was: Re: Optimizing code) In-Reply-To: Guido van Rossum's message of "25 Feb 2000 09:54:19 -0500" References: <20000224161930.A4922@stopcontact.palga.uucp> <20000225074854.A1014@stopcontact.palga.uucp> <5lu2ixbaec.fsf@eric.cnri.reston.va.us> Message-ID: Guido van Rossum ?crit: > Fran?ois Pinard writes: > > It would be nice if the Python library was maintaining a little cache for > > `stat', and if there was a way for users to interface with it as wanted. > Question-- what would happen to code that uses os.path.exists() or one > of its friends repeatedly, waiting for a file to appear or disappear? > This code would break unless you put a timeout in your little stat > cache, which would probably reduce its speed. I was suggesting to have a way for users to interface with the cache, also meaning that there should also be a way to avoid it. > > the `find' program has some optimisations to avoid calling `stat', > "thus it behooves us to arrange directories so that subdirectories occur > first" (or similar words). I do not think most people go that far, in practice. And yet, `find' is a lot faster now than it used to be in its infancy. Particularly useful is the (frequent) case of a directory having no subdirectories at all. > > The main trick is to save the number of links on the `.' entry [...] > > When it reaches 2, we know that no directories remain [...] I surely > > often use `os.path.walk' in my own things, so any speed improvement > > in that area would be welcome for me. > I can imagine any number of reasons why the above rule might fail (mount > points, NFS, Samba, symbolic links, automounter, race conditions). And yet, `find' seems to work flawlessly and dependably, and has done so for years. I'm not maintaining it, however, and do not know its bug story. > I'm reluctant to add hacks like this to the standard library -- a bug > there multiplies by a million. I surely understand your concern for solidity, something like Python could just not succeed if it was not dependable. Yet, speed is also something to consider, especially when it comes to sparing spurious disk accesses: you may quickly loose there the result of tremendous efforts at optimising the rest. Or course, I could reprogram os.path.walk for my things. I thought it would have been nice if the standard walk in Python was behaving the best it could, depending on the system it runs on. When a Python script walks the structure of a disk, this is often where most of the time is spent, and for big file hierarchies, this time can become quite significant. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From aahz at netcom.com Wed Feb 2 13:18:52 2000 From: aahz at netcom.com (Aahz Maruch) Date: 2 Feb 2000 18:18:52 GMT Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) References: Message-ID: <879sec$ldp$1@nntp1.atl.mindspring.net> In article , Warren Postma wrote: > >KDevelop is clearly in the lead as a portable cross-platform IDE, and I >think $850K could do a lot to help it along. Once people are writing their >software in a world-class IDE, instead of sitting in Bash, vi and EMACS all >day, I think we would safely be able to say that Unix had caught up to the >Windows platforms of the late 1990s. Let's at least be realistic, folks. Does KDevelop work on a vt100? If not, I won't use it (much). I do much of my work via dial-up shell. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From fdrake at acm.org Mon Feb 21 10:12:38 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 21 Feb 2000 10:12:38 -0500 (EST) Subject: Interactive programs through Popen3 In-Reply-To: <38AFBB31.27CBAFB5@bogusaddress.com> References: <88n50e$h29$1@bob.news.rcn.net> <38AFBB31.27CBAFB5@bogusaddress.com> Message-ID: <14513.21990.187292.675184@weyr.cnri.reston.va.us> Joe Smith writes: > I take it that you must be running on UNIX. If I remember correctly, 1.5.2 > says something about can't fork on Windows NT 4.0. If I remember correctly, > popen2() and popen3() also have the same problem. The doc should probably > state that the popen2 module/library does not work on NT. It would probably Joe, The current version of the documentation notes that this module is available for Unix on the HTML page for the module. It is also located in the chapter on "Unix Specific Services," so an NT user should be able to determine the lack of availability easily. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From robin at jessikat.demon.co.uk Thu Feb 10 18:59:37 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 10 Feb 2000 23:59:37 +0000 Subject: Fully Bracketed Syntax References: <65118AEEFF5AD3118E8300508B124877073D74@webmail.altiris.com> Message-ID: In article <65118AEEFF5AD3118E8300508B124877073D74 at webmail.altiris.com>, Mike Steed writes ..... >[...] >> I guess what I'd like is some clear reasoning about >> bracketing and indenting that warrants such a feature >> of a language. > >In his book Code Complete, Steve McConnell calls this syntax "pure blocks". >Ada is the only language he mentions that implements this. (Didn't Modula-2 >do this too?) One of McConnell's rules is that the visual layout of the >code should reflect its logical structure in order to maximize readability. >In your example, the three lines inside the if should be indented (as they >are) to indicate that they are suborinate to the conditional. McConnell >likes pure block syntax best because it lends itself more readily to this >style than begin..end and {..}. > >In this sense, Python is even better, because the layout of (valid) code >always corresponds to its structure. (That is, if you ignore the one-line >form "if a: blah".) ... wasn't there something called comb structure? -- Robin Becker From pinard at iro.umontreal.ca Mon Feb 7 12:10:01 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 07 Feb 2000 12:10:01 -0500 Subject: mail filter in python? In-Reply-To: Gerrit Holl's message of "Mon, 7 Feb 2000 15:46:41 +0100" References: <20000208000902.31713@nms.otc.telstra.com.au> <20000207154641.A2817@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > The procmail syntax is really obfuscated. You get used to it, or at least, the part that you need. We both quite understand than mouse-clicking teenagers would be completely lost in it :-). > What about creating a mail filter with a Python syntax? Shouldn't be too > difficult, just create some functions (drop, match_header) and execfile() > a file with the rexec module... Do not underestimate what `procmail' does. It has a _lot_ of features, and was debugged over many years, by a rather careful programmer. Of course, one may try and do better, this is often how programs evolve. But the overall problem might much, much more obfuscated than procmail syntax :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bvisscher at my-deja.com Wed Feb 2 12:21:08 2000 From: bvisscher at my-deja.com (bvisscher at my-deja.com) Date: Wed, 02 Feb 2000 17:21:08 GMT Subject: Porting omniORB python to OpenVMS References: <877rom$akl$1@nnrp1.deja.com> <8791t9$f19$1@pineapple.uk.research.att.com> Message-ID: <879p1s$mqa$1@nnrp1.deja.com> In article <8791t9$f19$1 at pineapple.uk.research.att.com>, Duncan Grisby wrote: > In article <877rom$akl$1 at nnrp1.deja.com>, wrote: > > >I have been attempting to port the omniORB python CORBA mapping > >(omniORBpy) to OpenVMS and I think I need some help. > > I don't know anything about VMS, but I wrote omniORBpy. Hi Duncan, The problem turned out to be the use of shareable images (something like shared libraries on VMS). Also, I recompiled python.c with cxx (Compaq C++) and relinked with cxxlink (Compaq C++'s C++ linker). I'm not sure if the latter was necessary and I don't know why it didn't work with shareable images. Now I get: I said 'Hello from Python'. The object said 'Hello from Python' in the example client with the example server running (both from omniORBpy/releasenote). Yes! Thanks for your help, Bruce Visscher Sent via Deja.com http://www.deja.com/ Before you buy. From jcw at equi4.com Wed Feb 23 19:13:05 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Thu, 24 Feb 2000 01:13:05 +0100 Subject: BSDDB copyright and licensing restrictions while in use viaPython References: Message-ID: <38B47786.28DE4374@equi4.com> Oleg Broytmann wrote: > > On Mon, 14 Feb 2000, Fredrik Lundh wrote: > > > > if you prefer to use free and IMHO better data- > > > > base engines, check out metakit (www.equi4.com) > > > > or gadfly (www.chordate.com). > > > > > > Any information on what ways these are "better" than Berkeley > > > DB? Any pointers, at least? > > > > humbly speaking: > > > > metakit: fast, efficient, small, highly portable, > > great python interface, and free. > > Hm, portable? Well, exerpt from README: > > ---------- > > * Solaris 2.6 / gcc 2.8.1 > > The Solaris builds are nasty for several reasons: [...] > Despite this, I'm doing my best to resolve these issues. Having a > solid build of the core *and* of Tcl / Python extensions is quite > important. > > * Other Unix systems > > No notes yet, more details expected when the new release is tried > on other Unix systems. > > ---------- > > I cannot consider it "portable". Oh, yes, I have exactly 2.8.1, > even worse, on Solaris 2.5.1. No other program reveals bugs in 2.8.1. Well, you sure are going out of your way to make your point. It would be nice if you also mentioned that MetaKit runs on Unix, Windows, Mac, VMS, BeOS ... quite a wide range of systems from small-model MS-DOS to 64-bit Alpha (Unix, NT, VMS, take your pick), and quite a wide range of compilers (including Sun's, AIX's, and half a dozen on Windows). MetaKit has been "closed source" until last December, and hence has not benefited from the wide platform tweaking OSS usually gets over time. Perhaps it would be best to reserve judgement until MetaKit has been around as open source for a year or so? I agree 100% with you that the MK build mechanism needs improvement, and will add that all such improvements will be integrated and acknowledged with gratitude. Hey, I see a VxWorks port has just been completed :) As to the pros and cons of MK versus other systems: there is no single answer. MK can run circles around BDB for some things, while being way slower in some other cases. This is not related to the quality of any implementation, but to the fact that MK uses column-wise storage. This leads to a very different set of trade-offs, and a very different way of thinking needed to make it work well. On other words: YMMV. Oleg, I welcome your input on MK, positive and negative. Yes, in a way MK is a "poor boy", because it is a new kid in the (OSS) neighbourhood. But it's a lively newcomer, and you're welcome to help make it grow up. -- Jean-Claude From thompson at mail.ias.kodak.com Mon Feb 21 14:59:36 2000 From: thompson at mail.ias.kodak.com (Thomas M. Thompson) Date: Mon, 21 Feb 2000 14:59:36 -0500 Subject: PIL Problem: New image is all black on Unix? References: <38B02B50.482854B7@cs.rit.edu> <66fs4.200$y3.185368576@newsb.telia.net> Message-ID: <38B19928.EBC0F136@mail.ias.kodak.com> Hi Fredrik, Yes that's exactly what I said...but 1.0 is on Solaris 5.7 and 1.0b1 is on Win95. Is the OS making a difference here or is it a bug in 1.0? Thanks! tt Fredrik Lundh wrote: > wait, first you said "1.0", and then you said "1.0b1". > this is a known bug, but I'm 95% sure it was fixed in > the 1.0 release: > > http://www.pythonware.com/downloads.htm#pil > > From tim_one at email.msn.com Sun Feb 20 17:49:04 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 17:49:04 -0500 Subject: Test (ignore): Python mailing list may be down Message-ID: >From my POV, mail to python-list at python.org may have been broken all weekend. testing-from-oe-ly y'rs - tim From gvwilson at nevex.com Thu Feb 17 21:51:25 2000 From: gvwilson at nevex.com (gvwilson at nevex.com) Date: Fri, 18 Feb 2000 02:51:25 GMT Subject: static class methods in Python? Message-ID: <88ic3d$560$1@nnrp1.deja.com> Have there been any proposals to add the equivalent of "static" methods (belonging to the class, not to instances) to Python? If so, I'd appreciate a summary... Thanks, Greg Sent via Deja.com http://www.deja.com/ Before you buy. From tony at lsl.co.uk Mon Feb 7 04:24:07 2000 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Mon, 7 Feb 2000 09:24:07 -0000 Subject: [Doc-SIG] Monty: A structured text syntax idea In-Reply-To: <20000205084721.A1020@stopcontact.palga.uucp> Message-ID: <001301bf714d$15a182b0$f0c809c0@lslp7o.lsl.co.uk> I've got to dash this off quickly before going into a two-day training course, so haven't had time to read all of the cumulative thread that has happened since Friday morning - sorry. Moshe - I wasn't trying to get at you particularly personally - you've obviously put a lot of thought and work into your proposal. BUT. When the last round of doc string discussions happened (a couple of years ago) I was a strong TeX or HTML proponent (XML didn't exist), but it soon became clear that *for many people* (i.e., not for me) the use of that sort of "verbose" markup is an immediate turnoff. Note that both TeX and HTML, and thus also all SGML variants, count as verbose in this context, and so also does your markup. Whilst I personally find it hard to read your markup because the delimiters don't stand out visually to me (and no, XML needn't be much more verbose - hell, it's only typing anyway), experience both last round and this round shows that verbose markup just won't fly (people in general won't do it). Whereas the single-character style markups *do* work (heh - people use them in email!). This argument was rehashed in the latest round of DOC-SIG discussions as well, and the same result happened. The reference to the Tim Peters' doc string test thingy was because I came in wanting to delimit EXAMPLE sections, and Tim managed to convince me that I didn't need them (i.e., to change my mind - don't you hate it when people do that!). Sorry for the quick and probably by now out of context message, hope this makes sense. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.demon.co.uk/ .. "equal" really means "in some sense the same, but maybe not .. the sense you were hoping for", or, more succinctly, "is .. confused with". (Gordon McMillan, Python list, Apr 1998) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From fdrake at acm.org Mon Feb 14 14:34:33 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 14 Feb 2000 14:34:33 -0500 (EST) Subject: Except an exception AND all its subclasses? In-Reply-To: References: <14504.12696.260789.72063@weyr.cnri.reston.va.us> Message-ID: <14504.22729.648917.592630@weyr.cnri.reston.va.us> Moshe Zadka writes: > However, Gerrit does have a point. People need information which is > currently obscured by a language reference around it, so to speak . > Perhaps there should be an "easy language reference"/"advanced tutorial". > I'll start working on one in my copious free time, but don't hesitate to > tell me one has already been written. Browse around python.org/doc/ to find third-party tutorials; I've not been able to look at them all. (If anyone knows of any that aren't on the lists but should be, please tell me about them, even if you already have; I either haven't gotten back to your email or I lost it!) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From tuttledon at hotmail.com Sat Feb 26 16:09:40 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Sat, 26 Feb 2000 21:09:40 GMT Subject: parameter undefined in procedure References: Message-ID: >[Moshe Zadka ] > Try searching the archives of the group for "list comprehensions" > Oops. I've drifted into the deep end of the pool! Heading for shallower water! 1) I counldn't find any 50,000 ft overview of "list comprehensions". If one exists, would someone point me to it? 2) And without trying to re-kindle any passionate dialog, was there ever any general consenous reached about whether "list comprehensions" where likely to be included in Python? Don From neelk at brick.cswv.com Thu Feb 3 20:43:17 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 4 Feb 2000 01:43:17 GMT Subject: Readable Functional Languages References: <87aerv$2d6$1@vvs.superst.iae.nl> Message-ID: Brian Rogoff wrote: > On Thu, 3 Feb 2000, Alexander Williams wrote: > > On 3 Feb 2000 00:33:19 +0100, Carel Fellinger wrote: > > >Admittedly off topic, I would like some advice on what language to choose > > >to explore the realm of functional languages. > > > > You really have two /good/ choices: > > More than two, really. Yeah, there are a bunch of really well-designed functional languages. It's very difficult to go seriously wrong. Haskell, Clean, Miranda, Scheme, Mercury, SML, Ocaml -- all of these are cool languages. > > If you're a traditionalist and parens don't scare you, Scheme is a > > really good platform for exploring functional programming. Its not a > > 'pure' language, as such, but it can be programmed in a very pure > > style. > > Given this, Dylan is also a good choice. Not pure functional, but > it has higher order functions which are the sine qua non of FP. Dylan is my favorite language, but I wouldn't recommend it to someone who wants to learn functional programming. It encourages a more OO than functional style. (Eg, it has looping syntax, and even though the Gwydion compiler turns that into a tail-recursive function call under the hood, it still *looks* imperative to the new Dylan programmer.) Scheme is still better for learning fp, IMO, if only because the culture and books all push people towards the functional style. > > If you're more daring, you can give Haskell a shake. It /is/ a pure > > functional language and, as such, has some wackiness around state and > > external IO, but it /definitely/ can do some interesting things if you > > start wrapping your head around it. > > If you (Carel) don't mind shelling out some guilders and are feeling > nationalistic ;-), point your browser at http://www.cs.kun.nl/~clean/ I thought that Clean was free for noncommercial use? Learning fp would certainly seem to be noncommercial. Neel From thomas at bibsyst.no Fri Feb 25 09:56:17 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Fri, 25 Feb 2000 15:56:17 +0100 Subject: Customize keybindings in IDLE?? Message-ID: <38B69811.1F1F5661@bibsyst.no> Hallo, Idle is coming along fine now, but the key-bindings suck. How can I change this to the good-old CTRL+C for copy, CTRL+V for paste etc. ??? And would the changes be saved between sessions?? ( Saw another post asking about saving syntax-coloring setup yearlier so ... ) Thomas From tbryan at python.net Mon Feb 7 19:07:46 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 07 Feb 2000 19:07:46 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <389F5E52.6790A4A9@python.net> Roy Smith wrote: > I fear disaster every time I have to move a block of code. As the logic > of my program develops, I'll either have to move a block of code into an > if, or move it out of one, or I'll take a block of code and turn it into > a function/method of its own, or maybe even extract something into a > subclass. This means cutting and pasting (well, killing and yanking, > since I use emacs), and changing the indent level up or down. Emacs > tries to be smart about indenting and sometimes does something wrong, > changing the meaning of the code. Worse, it leaves behind not only code > which is semantically wrong and syntactically correct, but it's also > visually reasonable looking. It is a human factors nightmare. Straying even farther off topic, doesn't C-c < and C-c > in Python mode take care of this problem? Kill, yank, shift. Done. Or did I miss the point? no-reason-to-use-emacs-without-python-mode-ly yours ---Tom From tjg at avalongroup.net Thu Feb 24 18:24:25 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Thu, 24 Feb 2000 15:24:25 -0800 Subject: Style, readability and docstrings Message-ID: <38B5BDA9.4B12EC57@exceptionalminds.com> Hi again. I posted a little code sample the other day and got a couple of comments back on my "python style". One of those comments suggested that I move my function comment headers blocks into docstrings. I have done so, and now I can barely read my code, I don't know what it is about those comment blocks at the top of a function that my eyes like, but without my function header comment blocks, my eyes don't immediately pick up each function as I scroll through my code. Is this a "You need to retrain your eyes" type thing? Have other's noticed the same thing, and does anyone have a nice coding style that works for them that I can borrow? ########################################################### # Stand Fast, # tjg. # Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From tim_one at email.msn.com Sat Feb 26 03:08:20 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 26 Feb 2000 03:08:20 -0500 Subject: Strings & 1.6 (was RE: (no subject)) In-Reply-To: <20000225075439.A1669@stopcontact.palga.uucp> Message-ID: <000601bf8030$a5a80220$3c2d153f@tim> [Gerrit Holl] > Aren't they [string functinos] becoming obsolete? Won't the string be > deprecated? Not sure what's the difference ;) I haven't heard Guido say that the string module is slated for death. If he does, "deprecated" and/or "obsolete" mean that, like the old deprecated regex module, they'll live longer than we do . > ... > Where can I find more info on those Unicode strings, except in the source? Nowhere. The people writing the code are the only ones who can provide definitive answers, but they're apparently too busy writing the code to post a summary here yet. > ... > Indeed, I find [].sort() very irritating and often have this > function defined: > def sortlist(l, *args): > apply(l.sort, args) > return l This is all wrong, but not for the reason you think : you shouldn't have this function defined more than once. Write a gerrits_pet_peeves.py module containing stuff like this, and just import it. or-name-it-tims_pet_peeves-if-you're-bold-ly y'rs - tim From fdrake at acm.org Fri Feb 18 10:40:53 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 18 Feb 2000 10:40:53 -0500 (EST) Subject: string.py In-Reply-To: <20000218160528.C3878@stopcontact.palga.uucp> References: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> <88f53h$em2$1@nntp6.atl.mindspring.net> <14507.17447.857827.44321@anthem.cnri.reston.va.us> <88fil5$shr$1@nntp6.atl.mindspring.net> <14508.8018.948016.684439@weyr.cnri.reston.va.us> <20000218160528.C3878@stopcontact.palga.uucp> Message-ID: <14509.26629.766955.911357@weyr.cnri.reston.va.us> Gerrit Holl writes: > Cool. Will there also be something the other way? > I can convert int 83 to an octal or hexadecimal string, > but I want to convert it to a string with an arbitrary radix, Not that I'm aware of. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From jgoodyear at mkaeurope.dot.com Sun Feb 13 02:53:51 2000 From: jgoodyear at mkaeurope.dot.com (John Goodyear) Date: Sun, 13 Feb 2000 07:53:51 -0000 Subject: Calling Python from C [newbie] Message-ID: All, I want to call python code from C. I have found lots of examples and the API reference but cannot find any help on what I need to link to in order to call the Py_XXX functions. Do I need the python source installed to do this? Platform: Redhat 5.4 and 6.0 Python: 1.5.1 TAI JohnG --- MKA Europe Ltd www.mkaeurope.com From gerrit.holl at pobox.com Sun Feb 6 13:16:29 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 6 Feb 2000 19:16:29 +0100 Subject: Error raising style Message-ID: <20000206191629.A1599@stopcontact.palga.uucp> Hello, I want to start a discussion on error raising style. I see the following almost always: >>> raise Exception, 'aaa' But I find this better: >>> raise Exception('aaa') because when raising an error with multiple errors, the former isn't possible: >>> raise Exception, 'aaa', 'bbb' Traceback (innermost last): File "", line 1, in ? TypeError: raise 3rd arg must be traceback or None Guido's style guide doesn't talk about it, probably because the call-raising is only possible since class exceptions. Is all those code because of backward compatibility and people who are used to this style of raising exceptions? What do you think? regards, Gerrit. From anthonydelorenzo at my-deja.com Mon Feb 7 17:45:03 2000 From: anthonydelorenzo at my-deja.com (anthonydelorenzo at my-deja.com) Date: Mon, 07 Feb 2000 22:45:03 GMT Subject: Python XML processing of RSS files References: <87f843$k4u$1@nnrp1.deja.com> <389f1386.1431568@news.iol.ie> Message-ID: <87nhtd$anc$1@nnrp1.deja.com> > If you could explain what the problem is I will > take a look at. As I mentioned in my follow-up, I decided just to write it using xmllib. It seemed more efficient to use a parser, rather than using pyxie + a parser. I'm only doing some simple processing of character data. That, and my ISP doesn't have the XML tools installed, so xmllib is about all I can count on. Tony Sent via Deja.com http://www.deja.com/ Before you buy. From ivanlan at callware.com Fri Feb 18 09:15:00 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 18 Feb 2000 07:15:00 -0700 Subject: Teach Yourself Python in 24 Hours (Was: Re: Help needed writing GUI comparison) References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> <38AC9E96.FDAE287C@prescod.net> <20000218144848.A3437@stopcontact.palga.uucp> Message-ID: <38AD53E4.30EC645E@callware.com> Hi All-- Gerrit Holl wrote: > > Paul Prescod wrote on 950804486: > > Ivan Van Laningham wrote: > > > > > > > > > Addtionally, the last 8 chapters of _Teach Yourself Python in 24 Hours_ > > > > So the idea is you walk around reading the book for one day (no sleep, > > no breaks) and by the end you're a Python expert. I could see that being > > valuable for people who pad their resumes and then need to cram before > > their first day of work. > > Who said 24 hours behind each other? > 24 days every day an hour is also 24 hours. > And besides, these are *Action Packed* hours! -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 Gaetan_Corneau at baan.com Wed Feb 16 15:30:17 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Wed, 16 Feb 2000 15:30:17 -0500 Subject: String question Message-ID: <816010E2456BD111A48700805FBBE2EE01C60517@ex-quebec-u1.baan.com> > And 'str' is a builtin function that you just clobbered. :) D'oh! :) I know, I just used it in my example! :p I usually write the first letter of my variable names in uppercase to avoid that. ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" From schorsch at schorsch.com Sat Feb 5 06:55:30 2000 From: schorsch at schorsch.com (Georg Mischler) Date: Sat, 05 Feb 2000 11:55:30 GMT Subject: Lisp 2 Python? References: Message-ID: <87h33i$t1l$1@nnrp1.deja.com> Joel Lucsy wrote: > chris patti wrote: > > Surely you jest. > Oh no, I jest not! =) Hmmm... ;) > > Also, which LISP? Common LISP I presume? You'd almost need something > > as complex as common lisp itself to convert that to PYthon :) > > Well, the idea to go from AutoLisp (which is built into AutoCAD), > to python. This is a rather simplistic version of lisp, not even > remotely close to Common Lisp. This may be an advantage or a disadvantage, depending on the features your programs use. Having reimplemented thousands of lines of Autolisp code in Python myself manually during the last two years, I can say that such an converter wouldn't have helped me anything. This has several reasons. The most important ones are based on the fact that the applications involved were based on nontrivial data structures, which I had to stash into assoc lists within assoc lists within assoc lists etc. in Autolisp, while in Python, a relatively straightforward OO-Design saved me much of the hassle. If you just have a few procedural routines to translate, then an automatic converter might be fun, but I wouldn't expect any wonders. Whatever you do, the resulting python code won't look very pythonic, and will probably be a nightmare to maintain. What kind of programs are you looking to convert? Or is this just a "nice to have" question? Once we are here, the more interesting thing (and precondition to the above for any useful applications) would be a Python wrapper to ADS, and ultimately ARX. Yes, the latter looks like gargantuan task, but some day someone will have to do it... ;) (for the uninitiated: ARX is the OO-progamming interface to Autocad in C++. Autodesk only delivers online documentation for this, saving the many trees required to print several thousand pages of reference material) Have fun! -schorsch -- Georg Mischler -- simulation developper -- 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 michael.stroeder at inka.de Sat Feb 19 16:04:04 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 19 Feb 2000 22:04:04 +0100 Subject: Read input in do_POST() method (was: embeddable Python web server) References: <38AC9E92.C1CEFEB7@inka.de> <38AD3C67.A08EFE2D@inka.de> <87u2j68n7j.fsf_-_@den.home.net> <38AD8B9C.F3F4DCF5@inka.de> <38AED708.DED8039A@inka.de> Message-ID: <38AF0544.110855BC@inka.de> Michael Str?der wrote: > > Running through own do_POST() method in a web server class derived > from SimpleHTTPServer.SimpleHTTPRequestHandler: > > self.rfile.read(contentlength) works with lynx, w3m, but Netscape > 4.7 hangs. > > self.rfile.readline() works with w3m, Netscape 4.7, but lynx hangs. > > Can anyone shed light on this?!? This turned out to be a platform-specific problem. On my S.u.S.E. 6.3 based system I had the problems. On a Debian-Linux the cleaner self.rfile.read(contentlength) works. I'll stick to that (module cgi does the same). Ciao, Michael. From Patrick.Boulay at fr.nestle.com Fri Feb 25 03:32:00 2000 From: Patrick.Boulay at fr.nestle.com (Boulay,Patrick,PARIS) Date: Fri, 25 Feb 2000 09:32:00 +0100 Subject: unsubscribe Message-ID: <8F39A83598A3D111B27D00805F8BA3CA01155E12@frnsl035.nestle.fr> unsubscribe > -----Message d'origine----- > De: Fredrik Lundh [SMTP:effbot at telia.com] > Date: vendredi 25 f?vrier 2000 09:24 > ?: python-list at python.org > Objet: Re: system return status on Windows > > Milos Prudek wrote: > > Tim Peters wrote: > > > > > > [Milos Prudek > > > You could also try os.spawnv or os.spawnve (but those only exist under > > > Windows). BTW, don't expect os.popen to work sensibly under Windows > either. > > > > Great, thanks. Could you send something about mode (magic operational > > constant) of spawnv? I do not have Visual C++ Runtime Library > > documentation... > > get the eff-bot guide ;-) > > # os-spawn-example-3.py > > import os > import string > > if os.name in ("nt", "dos"): > exefile = ".exe" > else: > exefile = "" > > def spawn(program, *args): > try: > # possible 1.6 shortcut! > return os.spawnvp(program, (program,) + args) > except AttributeError: > pass > try: > spawnv = os.spawnv > except AttributeError: > # assume it's unix > pid = os.fork() > if not pid: > os.execvp(program, (program,) + args) > return os.wait()[0] > else: > # got spawnv but no spawnp: go look for an executable > for path in string.split(os.environ["PATH"], os.pathsep): > file = os.path.join(path, program) + exefile > try: > return spawnv(os.P_WAIT, file, (file,) + args) > except os.error: > pass > raise IOError, "cannot find executable" > > # > # try it out! > > spawn("python", "hello.py") > > print "goodbye" > > > > > > > -- > http://www.python.org/mailman/listinfo/python-list From arnaud at crao.net Sat Feb 5 04:56:49 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Sat, 05 Feb 2000 10:56:49 +0100 Subject: newbie: import pb. with Mk4py Message-ID: Greetings ! As I was working on my flying sheep project, I tried to import an alien library into my Python 1.5.2 interactive box ... (on a Macintosh running MacOS 8.6 ... PPC). Here is the log : >>> import Mk4py # Cool ! this lib seems great build the oodbms I need [...] ImportError : PythonCore: An import library was too new for a client. >>> [insert a blinking cursor here] I really don't get the "too new" error ... The lib is Mk4py v2.0 PPC. Any clue ? Arnaud From scarblac-spamtrap at pino.selwerd.nl Fri Feb 25 03:10:12 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 25 Feb 2000 08:10:12 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: Milos Prudek wrote in comp.lang.python: > The following excerpt works. It reads lines from config file. But I > would like to ask if it is 'right' in the Pythonian way. Since I'm just > beginning in Python I do not want to twist Python into 'my' way of > thinking. > > There is no eof() function for high level readline(), so I use '' to > discover end of file. > > A=[] > Line=H.readline() > while Line<>'': > if Line<>'' and Line<>'\n': > A.append(Line) > Line=H.readline() Your version skips empty lines. If that's not essential, you can just do: A = H.readlines() Maybe the fastest solution is using readlines() and filter() for large files, I don't know. It's not very readable... A = filter(lambda x: len(x) > 1, H.readlines()) The lambda constructs a function that checks if a string is longer than 1, filter uses that to see which of the lines to keep. Otherwise it's just a matter of style... I would maybe write A = [] while 1: line = H.readline() if not line: break if line != '\n': A.append(line) -- Remco Gerlich, scarblac at pino.selwerd.nl 9:04am up 93 days, 15:09, 7 users, load average: 0.13, 0.14, 0.16 From embed at geocities.com Wed Feb 9 15:24:54 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 15:24:54 -0500 Subject: 'import site' failed; use -v for traceback Message-ID: I have just built a static version of the python interpreter, and linked it to the sample code from "Demo\embed" subdirectory, and it runs, but the first line it prints out is: 'import site' failed; use -v for traceback I figured out that I needed a local copy of Exceptions.py and Site.py, and Os.py to build my micro-python embedded environment up, and put them in a subdirectory called Lib under where the EXE is located. So far so good, but how do I get the traceback message for why 'import site' is failing? Warren From sanderson at ttm.com Tue Feb 8 08:39:16 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 08 Feb 2000 08:39:16 -0500 Subject: Several questions: python plugin, xml-rpc + Medusa Message-ID: <38A01C84.88229E45@ttm.com> (Hmm. Third attempt... (Hmm... sent this once, and I didn't see it come across... please forgive if this is a repeat...)) Hi all, Question the first: I've seen the Win16 Netscape plugin... is there a 32-bit version for the later browsers running around? I've got an itch I want to scratch, and a plugin would do it. :-) Second question: has anyone melded the xmlrpclib stuff to Medusa yet, other than Zope? If I were to need something like that, should I just use Zope? I'm trying to keep things lightweight, and I don't need the full-fledged Zope framework (which is verra, verra nice, but the master of the castle already has one, you see...) Thirdly: SOAP sounds interesting as well. Is SOAP as cross-language portable as XML-RPC? I can do the latter in Python, Perl, Java, etc... what has SOAP been implemented for at this juncture? Regards and thanks, -scott From justus at my-deja.com Tue Feb 1 15:45:28 2000 From: justus at my-deja.com (Justus Pendleton) Date: Tue, 01 Feb 2000 20:45:28 GMT Subject: Removing [methods from] a superclass? References: <000a01bf6cd7$a8fcee20$3acbd9c2@peridot.optichrome.com> Message-ID: <877gl5$1tu$1@nnrp1.deja.com> In article <000a01bf6cd7$a8fcee20$3acbd9c2 at peridot.optichrome.com>, "Adrian Eyre" wrote: > GH>> is it possible to _remove_ objects of a superclass? > GH>> ...I need to remove some methods like .append and .pop. > > WW> If the purpose is to simply prevent the user from calling those > WW> methods, you could overload them with methods that raise exceptions. > > I feel that if you need to do that, there is something wrong with your > inheritence model. It's not his inheritance model; he is trying to reuse code, isn't he? He shouldn't have to rewrite the system libraries to have a system class inherit from a user defined class. In his book Framing Software Reuse, Paul Bassett introduces the notion of "frames", which complement traditional OO programming. A frame has the ability to add, *delete*, select, modify, and iterate the default properties of other frames. Bassett believes that deletion of properties is integral to successful reuse in the real world. Heck, even Eiffel, seemingly language of choice of the Object Gestapo ;-) lets you undefine features (albeit with some restrictions). > Have a new base class called UserObject which contains all the methods > shared by UserList and UserString, and subclass from that. Sent via Deja.com http://www.deja.com/ Before you buy. From rupole at compaq.net Thu Feb 3 21:44:21 2000 From: rupole at compaq.net (Roger Upole) Date: Fri, 04 Feb 2000 02:44:21 GMT Subject: Language Challenge 2000 References: <389923AB.741B7DB9@sdynamix.com> Message-ID: <92rm4.13629$Ch7.942353@news.easynews.com> Since execution time is a factor, I doubt that any interpreted languages will even be in the running. Roger Upole "Konrad Hinsen" wrote in message news:m3wvomfven.fsf at chinon.cnrs-orleans.fr... > bvoh at sdynamix.com writes: > > > Criteria: > > > > a) Execution time > > b) Size of executable > > Free choice of platform, OS, development tools, etc.? How will > executable size be measured in the case of interpreted languages? What > about system libraries, especially dynamic ones? And how will > execution time and size be weighted? > > If size gets a sufficiently high weight, I suspect the winning entry > will be for a programmable calculator. > -- > -------------------------------------------------------------------------- ----- > 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 mhammond at skippinet.com.au Tue Feb 1 05:58:37 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 10:58:37 GMT Subject: MAPI and NT Service References: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC73@RED-MSG-50> <388F1893.879D0550@netscape.com> Message-ID: "Michel Orengo" wrote in message news:388F1893.879D0550 at netscape.com... > BUT when I do: > > outbox = session.Outbox > > my NT service fails. MAPI defers alot of security stuff until actually needed. What user is the service logged on as? I would guess that it is NT/Exchange security related rather than your script... Mark. From embed at geocities.com Fri Feb 11 15:39:29 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 11 Feb 2000 15:39:29 -0500 Subject: How do you undo x = `a` if A is a list? Message-ID: Let's suppose I have a list A: a = [ "first", "second", "third" ] And I want to save to a text file on disk the following Exactly into myfile.txt. I looked at Pickle, but "human readable" is not one of Pickle's features. [ "first", "second", "third" ] So that part is easy, I can convert like this: a_as_text = `a` Now how do I read that line in from a file and convert it from a string to a list? If I was using my old favourite lange (Realizer, a Basic interpreter) I would do this: Execute( "a = "+a_as_text) # dynamic invocation of the Parser (slow but powerful!) The benefit of this is that it would allow any one line of Ascii text to be converted into the corresponding Python object, totally dynamically. Sorry if this is a FAQ but I couldn't find it in my scan of the documentation and FAQ. Warren From zeitlin at seth.lpthe.jussieu.fr Tue Feb 8 13:03:57 2000 From: zeitlin at seth.lpthe.jussieu.fr (Vadim Zeitlin) Date: 8 Feb 2000 18:03:57 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> <87omh2$lfi$1@oravannahka.helsinki.fi> <87p8ab$9l0$1@news1.xs4all.nl> Message-ID: On 8 Feb 2000 14:13:31 GMT, Boudewijn Rempt wrote: >For what I understand from the wxGrid documentation, the wxWindows >grid isn't editable, at least not in-place. This is not entirely true. The old wxGrid class didn't support in-place editing, indeed, but it was editable: it used a text control positioned near the top of the grid to edit the contents of the selected cell (quite convenient, in fact). However the upcoming wxWin 2.2 release will contain the new wxGrid class (which is already in the cvs and is being actively debugged right now) which does support in-place editing, has model-view architecture (thus you don't have to copy the contents of millions cells in memory, but only need to provide the values for those which are displayed) and quite a few other nice features. Regards, VZ From mhammond at skippinet.com.au Sun Feb 20 22:15:18 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 21 Feb 2000 03:15:18 GMT Subject: Win32Com Question??? References: Message-ID: "Paul E. Bible" wrote in message news:CU_r4.6079$Qx5.73778 at news.rdc1.tx.home.com... > FunctionA(VARIANT vParm1, VARIANT vParm2); > > but, if the component requires other data types such as BSTRs (see below), > Python gives me attribute errors. > > FunctionB(BSTR bstrParm1, BSTR bstrParm2) This should work fine. Can you post some sample code, and the traceback? Mark. From akituc at highway.ne.jp Fri Feb 11 05:23:52 2000 From: akituc at highway.ne.jp (Akinori Tsuchida) Date: Fri, 11 Feb 2000 19:23:52 +0900 Subject: Winsound Module Message-ID: <38A3E338.4747D0A4@highway.ne.jp> I play music on my NT system as following, [Module]>>> import winsound [Play] >>> winsound.PlaySound("filename",winsound.SND_FILENAME|winsound.SND_LOOP|winsound.SND_ASYNC) [Stop] >>> winsound.PlaySound("filename",winsound.SND_FILENAME|winsound.SND_PURGE) I have two questions with "winsound" module. Please help! 1. Sometimes third command [Stop] doesn't work as desired and music starts from scratch. Maybe third command stops [Play] but it starts music itself too. What should I do? 2. If you exit Python without stopping playing music by third command, how can you stop it after all? Sending kill signal to Python PID doesn't seem to work. Thanks for reading. Akinori Tsuchida. From tjreedy at udel.edu Sat Feb 19 14:48:02 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 19 Feb 2000 14:48:02 -0500 Subject: Newbie : postscript printing References: <38A9CD9F.850B0964@arrakis.es> Message-ID: <88mrri$7v9$1@news.udel.edu> "Marcos S?nchez Provencio" wrote in message news:38A9CD9F.850B0964 at arrakis.es... . > > Try piddle > http://www.strout.net/python/piddle/ This URL returns: ''' PIDDLE has moved! Please direct all your links to: http://piddle.sourceforge.net From mhammond at skippinet.com.au Tue Feb 1 20:42:25 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 02 Feb 2000 01:42:25 GMT Subject: What is winfo_id() under Win32 References: <3890439A.1C1BA6D2@freemail.hu> <86pt4k$f6h$1@nnrp1.deja.com> <38916AC9.AD1008A2@freemail.hu> <3896E322.4FC286C4@freemail.hu> Message-ID: <5YLl4.18$lX.275@news-server.bigpond.net.au> "Attila Filet?th" wrote in message news:3896E322.4FC286C4 at freemail.hu... > However, I think I will choose Fredrik's solution: > [ > hwnd = eval(self.wm_frame()) > win32gui.ShowWindow(hwnd, SW_SHOWMAXIMIZED) > ] Much better option! Mark. From effbot at telia.com Tue Feb 8 13:25:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 18:25:22 GMT Subject: const in Python References: <1262179804-3408142@hypernet.com> <87pemn$2bu2k@fido.engr.sgi.com> Message-ID: Paul Jackson wrote: > Neither of these conventions are padlocks with any substantial > inherent powers of prevention; but rather little yellow stickies, > that serve as one more little reminder of a program's structure. > > Hence putting down the convention you don't prefer on account > of its being made of paper, not steel, is a fine example of > constructing a Paper Tiger. the problem with the "const" pattern is not only that it isn't as safe as it pretends to be, but more importantly, that it affects performance. bad pydiom. From effbot at telia.com Wed Feb 16 03:03:48 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 08:03:48 GMT Subject: Help! Init Problem after setup... References: <38AA208E.85695302@cup.hp.com> Message-ID: Robert Hundt wrote: > Now I want to create another application, that links to Python lib and > sits in another directory tree. I can link this app, I can even run it, > however, I always get messages at startup saying: > > 'import exceptions' failed; use -v for traceback > Warning! Falling back to string-based exceptions > 'import site' failed; use -v for traceback > > So - I already tried setting PYTHONPATH to the exec-prefix that I > specified during config - but gee, I can't get rid of this problem. Even > worse, I can't even "import" specific other modules. try setting PYTHONHOME instead. PYTHONPATH is a list of extra directories, which are prepended to the module search path. to see what the current path is, start the inter- preter, and type: >>> import sys >>> sys.path ... From tim_one at email.msn.com Tue Feb 22 02:35:22 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 22 Feb 2000 02:35:22 -0500 Subject: Killer Apps In-Reply-To: <88sj10$rmj$1@nntp6.atl.mindspring.net> Message-ID: <000901bf7d07$603089a0$e82d153f@tim> [John Hirsch] > I've always thought that Tim Peters was Pythons killer app.. [Aahz Maruch] > No, the Timbot is Python's app killer. [Gerrit Holl] > Er... please explain! Do you mean tabnanny.py? Or is it my English > lacking here? [Aahz Maruch] > Well, it was a bit of a colloquialism, but it was mainly just a joke > (made by swapping the two words) that Tim is always poking holes in > other people's ideas. This is highly unfair, Aahz. Tim only pokes holes in three (just three!) kinds of ideas: 1. Incorrect ideas. 2. Useful ideas. 3. Correct ideas. I have always been tolerant-- even praiseful! --of ideas that are so off the wall that they can't be called either correct or incorrect with a straight face -- provided only, of course, that they're useless. > explaining-jokes-is-never-funny-ly y'rs suspecting-i'll-soon-get-a-chance-to-prove-that-too-ly y'rs - tim From indiana at ev1.net Sat Feb 19 01:11:22 2000 From: indiana at ev1.net (JimM) Date: Sat, 19 Feb 2000 06:11:22 GMT Subject: PIL installation (newbie) Message-ID: How do I install PIL? I downloaded from pythonware and unzipped but where should I put the files (or where should I have unzipped it)? I'm using 1.5.2 and pythonwin on win98 From c.davis at actrix.co.nz Wed Feb 2 15:05:01 2000 From: c.davis at actrix.co.nz (Christine Davis) Date: Thu, 3 Feb 2000 09:05:01 +1300 Subject: using marshal module References: <3897af70$1@news.actrix.gen.nz> Message-ID: <38988d97$1@news.actrix.gen.nz> Quinn Dunkan wrote in message ... >On Wed, 2 Feb 2000 17:17:08 +1300, Christine Davis wrote: [snip] >When you opened the file, you opened it in read mode (think >fp = fopen(filename, "r"); in C). Now, when you tried to dump your data to >it, marshal should have thrown an IOError, but instead it silently didn't >write anything. This seems unpython-like and a problem with marshal, to me. > >What you want to do is either: >fp = open(filename, 'r+b') # b in case it gets run on windows >and then >fp.seek(0) >before dump. > >Or: >fp.close() >fp.open(filename, 'wb') >before dump. > >Also, marshal.dump(datastuff['field'], fp) will store the string >'new string of stuff' to filename, which is probably not what you want. This is all working fine now - at least, stuff is being written back to the file. Kind of. At the moment, it is storing a string (as an array of characters); but the behaviour I'm looking for is to store an array of strings. I've tried datastuff['field'][index] = 'string' but that gave me an error (TypeError: object doesn't support item assignment) At the moment, the file the information is stored in, has 'field': ['string', 'nextstring', 'anotherstring'] the strings have no spaces, if that helps. Cheers, Christine From Peter_Halvorson at nfuel.com Fri Feb 18 17:06:19 2000 From: Peter_Halvorson at nfuel.com (Halvorson, Peter) Date: Fri, 18 Feb 2000 14:06:19 -0800 Subject: Which GUI? Message-ID: I made a stab at this last year. I don't have any idea which provide the widest variety of widgets or which are the easiest to use. Anyone is welcome to incorporate this into a comparison. Looks like gtk isn't on the list, it should be (good support for languages, but poor support for platforms). peter Bindings Platforms GUI Cost L&F ASCII C C+ Tc Pe Py Ja Sm Sc sh Fo X 95 NT Mac --------------------------------------------------------------------- Tk F V n x x x x x x x x x x x wxWindows F V n x x x x x x x x x xforms F F n x x x x x x V F V n x x x x x Fresco F F n x x AWT F F n x x x x x QT $/F F n x x x x stdwin F F y Motif $ F n x x Lesstif F F n x x MFC $ F n x x x x x Smalltalk $ V n x x x x x Cost: $ = dollars, F = free L&F: look and feel: F = fixed, V = variable ASCII: ascii mode: y = yes, n = no Bindings: C = C, C+ = C++, Tc = Tcl, Pe = perl, Py = python, Ja = Java, Sm = Smalltalk, Sc = scheme, sh = shell, Fo = Fortran Platforms: X = X window system, 95 = Windows 95, NT = Windows NT, Mac = Macintosh From ivanlan at callware.com Thu Feb 17 20:41:46 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 17 Feb 2000 18:41:46 -0700 Subject: Help needed writing GUI comparison References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> <38AC9E96.FDAE287C@prescod.net> Message-ID: <38ACA35A.BA66C72D@callware.com> Hi All-- Paul Prescod wrote: > > Ivan Van Laningham wrote: > > > > > > Addtionally, the last 8 chapters of _Teach Yourself Python in 24 Hours_ > > So the idea is you walk around reading the book for one day (no sleep, > no breaks) and by the end you're a Python expert. I could see that being > valuable for people who pad their resumes and then need to cram before > their first day of work. > Nope. You won't be an expert unless you were already an expert. If people who pad their resumes take 24 hours to read the book, you have a lot more things to worry about than their Python expertise. ... > Compare: > > http://www.itknowledge.com/reference/0672313057.html > > I-knew-Python-was-20-times-easier 'ly yrs > As I said, I targetted the book to people who want to learn how to program. I think I can teach them 20 times as much as with Perl. Oh, 'scuse me, didn't mean to swear. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 wware at world.std.com Wed Feb 9 23:07:14 2000 From: wware at world.std.com (Will Ware) Date: Thu, 10 Feb 2000 04:07:14 GMT Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= (pinard at iro.umontreal.ca) wrote: : To chop (even if line is truly empty): : line = line[:-1] : To chomp: : if line and line[-1] == '\n': : line = line[:-1] I often find myself doing things like this inside 'for ...readlines():' loops, and it always strikes me as cheesy and inelegant. It'd be kinda cool if readlines() could take an argument that meant to strip away any trailing whitespace. -- -- I can picture in my mind a world without war, a world without hate. And -- -- I can picture us attacking that world, because they'd never expect it. -- Will Ware - N1IBT - wware at world.std.com From craigf at ilid.com.au Tue Feb 8 22:53:12 2000 From: craigf at ilid.com.au (Craig Findlay) Date: Wed, 09 Feb 2000 14:53:12 +1100 Subject: Newbie question - what is the 'r' operator? References: Message-ID: <93p1as04hd739si7v44dbdqio6tmevfs1n@4ax.com> Thanks to Fredrik and Thomas for your help :) Craig "Fredrik Lundh" wrote: >Craig Findlay wrote: >> This is probably obvious but ... >> >> I have seen example code where an 'r' prefix is used in from of a >> string, eg r'mystring' >> >> What does it do, I can't seem to locate any documentation about it. > > http://www.python.org/doc/current/ref/strings.html > > "When an 'r' or 'R' prefix is present, backslashes > are still used to quote the following character, > but all backslashes are left in the string." > >(useful when embedding all sorts of cryptic sublanguages in >python strings, such as regular expressions or windows file >names...) > > > From mstenber at cc.Helsinki.FI Wed Feb 9 03:20:39 2000 From: mstenber at cc.Helsinki.FI (Markus Stenberg) Date: 09 Feb 2000 10:20:39 +0200 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <87glaj$2dov$1@news.tht.net> <87plr8$qig$1@news.tht.net> <87qu5c$inu$1@newshost.accu.uu.nl> Message-ID: m.faassen at vet.uu.nl (Martijn Faassen) writes: > tim wrote: > [snip] > > I'm not advocating not uploading to ftp's, and I'm not saying a central FTP > > based archive (CPAN-like, or otherwise) would not be helpful or useful, and > > appealing to many! (After all, it's a fairly frequently recurring thread > > here---Deja search for CPAN in this newsgroup reports about 300 hits.) I > > wish you all good fortune imaginable in your pursuit of a central python > > FTP archive. I here merely muse over the curiously ironic case which this > > thread has spawned out of. > > Just ignore me. (-: > Let's not ignore you. :) Am I the only one who thinks that this 'archive > of Python modules' could be constructed pretty easily now that you gave > us Parnassus? We can write a script that translates Parnassus's structure > into directory structure, and then downloads everything through any > download link given. Add an extra link to Parnassus download pages > ('cached'), and open an FTP site if you like. Run this script once every > while, or continuously in the background of something. And there we have > our archive. That would work, yes; however, I'm bit leery of basing the hierarchy on somewhat "ad hoc" source, i.e. Parnassus. I'd be more comfortable with it even if it had multiple maintainers.. :-P Simple mirroring of the Parnassus hierarchy's remote links is trivial (*). > Am I missing something? I'm not saying *Tim* should do this all this > hard work (he's doing more than enough already), but am I the only one > who considers this quite doable given Parnassus? Yes, it is quite doable, providing Parnassus lacks SCPF (either human or computer). > Regards, > > Martijn -Markus > -- > History of the 20th Century: WW1, WW2, WW3? > No, WWW -- Could we be going in the right direction? -- "I've never understood why women love cats. Cats are independent, they don't listen, they don't come in when you call, they like to stay out all night, come home and expect to be fed and stroked, then want to be left alone and sleep. In other words, every quality that women hate in a man, they love in a cat." -Unknown From sholden at bellatlantic.net Fri Feb 11 11:48:19 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 11 Feb 2000 16:48:19 GMT Subject: Python sucks loud References: Message-ID: <38A43D6E.65F9EFD9@bellatlantic.net> This is flamebait. I declare this thread closed. Unilaterally. NOW. regards Steve Forget it wrote: > > x-no-archive: yes > You people are funny here, all excited about Python. > Following one guy's recommendation, for two days already I'm looking at > Python as a potential plug-in language, and it DISGUSTS me. What's so > good about this yet another funny-ass language? I wonder if anyone can > say something coherent that wouldn't be laughable. Even perl is less > repulsive, although since it's all about text search it's not good for a > built-in language. Now this Python. How come they don't put semicolons > at the end of the line and the comments start with the number sign? > Phoooey. Can't anyone write some Tiny C with classes and make it > available on the net? -- "If computing ever stops being fun, I'll stop doing it" From embed at geocities.com Tue Feb 22 09:31:25 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 22 Feb 2000 09:31:25 -0500 Subject: Call for Patch for Borland compiler References: <000a01bf7c92$a208fa30$c355cfc0@ski.org> Message-ID: <46xs4.10497$Jz3.75868@nnrp1.uunet.ca> "David Ascher" wrote in message news:000a01bf7c92$a208fa30$c355cfc0 at ski.org... > Inprise/Borland has made their C++ compiler on Windows free (as in beer). > Guido has expressed that it would be nice to have makefiles which allowed > one to build Python with this compiler by the next release. If someone is > interested in providing this patch, that'd be great. > > See compiler download info at: > http://www.borland.com/bcppbuilder/freecompiler/ > > See instructions for patch submissions at http://www.python.org/patches/ > > --david ascher > > I could try this. How does one create the unix "patch" files while running on Windows? Would I need to download cygwin to get the make and tar and other unixish toolsets? I already have BC++ 5.5 installed on my hard drive. Warren From janssen at parc.xerox.com Fri Feb 18 15:22:32 2000 From: janssen at parc.xerox.com (Bill Janssen) Date: Fri, 18 Feb 2000 12:22:32 PST Subject: how to turn arbitrary binary string into unix filename? Message-ID: <00Feb18.122230pst."3872"@watson.parc.xerox.com> I'm sort of surprised that there doesn't seem to be any standard way to take a binary string in Python and turn it into a text string suitable for a UNIX filename. This is handy if you are trying to map data to filenames, for instance; you take the MD5 hash of the data, for instance the Message-ID of a mail message, convert it to an ASCII string (typically by hexifying it), and use that as the filename. But after half an hour of poking around, I can't see a standard method that one can call to hexify a string. Base64 would almost work, except that it uses '+' and '/' as the extender characters, and that '/' ruins it for filenames. ILU uses a version of base64 that uses '+' and '-' as the extender characters, for this very reason. Am I missing something? Bill From tim_one at email.msn.com Wed Feb 2 22:49:06 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 2 Feb 2000 22:49:06 -0500 Subject: Searching binary data In-Reply-To: <007001bf6df5$2e5c28b0$0100a8c0@rochester.rr.com> Message-ID: <000201bf6df9$9f02ac20$822d153f@tim> [Darrell] > Didn't have access to the internet today which forced me to have > a creative thought of my own. Now to find out if I wasted my time. > > The problem is to find patterns in gobs of binary data. > Treat it as a string you see something like this. > MZ\220\000\003\000\000\000\004\000\000\000\377\377 > > I found writing a re for patterns in that, a pain. > What if I wanted r"[\000-\077]". > It won't work because there are nulls in the result and re doesn't > like that. Actually, that works fine (if it didn't, what you just told us you did is not what you actually did). You can't pass a pattern with an actual null to re (minor flaw of the implementation, IMO), but the raw string r"[\000-\077]" doesn't contain an actual null: it contains the 4-character escape sequence "\000", which re converts to a null. >>> p = re.compile(r"[\000-\001]") >>> p.match(chr(0)).span(0) (0, 1) >>> p.match(chr(1)).span(0) (0, 1) >>> print p.match(chr(2)) None >>> > Not to mention all this octal to hex is annoying Hex escapes work fine too: r"[\x00-\x3f]" means the same as the above. > an who knows what trouble Nulls will be. I do: none . Really, nulls aren't special at all to re. The glitch in *passing* an actual null in the pattern to re has to do with the engine's C interface, which uses a char* for the pattern without an additional count argument. That's as deep as this one goes. > So I wrote an extension to covert everything to hex in the > following format. > 4d5aff000300000004000000ffff0000ff > Now I can treat the whole thing as a string :) That's fine too. From ivanlan at callware.com Thu Feb 10 21:30:54 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 10 Feb 2000 19:30:54 -0700 Subject: Python and Samba References: <38A33CA3.CD301863@kpnqwest.no> <87vnt8$voa$1@nntp6.atl.mindspring.net> Message-ID: <38A3745E.AA830C67@callware.com> Hi All-- Aahz, The Great and Terrible, wrote: > > In article <38A33CA3.CD301863 at kpnqwest.no>, > Stein M. Eliassen wrote: > > > >I wonder if there is a way to use samba services from python? > > > >What I would like to do is browse shares from Python code. > >Now I have to mount the share in a script before running the my python > >code. > > Hmmmm... I'm doing some WAGing here, but it seems to me that the > fundamental problem is that you really need to have a UNC and/or Win32 > environment in order to browse Samba shares. If you were running Python > on NT, this wouldn't be an issue, I think. So the fundamental problem > isn't a Samba library per se, but the SMB client for Unix. > > Put that way, you might be able to find something a little easier. > One exists, although it is not written in Python. The latest versions of Samba come with an smb client, which does indeed let you mount PC/NT shares as a file system. It works quite well, too. The last two versions of Red Hat (6.0 and 6.1) have included Samba versions late enough to have this feature. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 2jerry at writeme.com Thu Feb 24 15:55:40 2000 From: 2jerry at writeme.com (Jerry) Date: Thu, 24 Feb 2000 21:55:40 +0100 Subject: Misunderstanding classes (newbie) Message-ID: <8945mi$8vc$1@wanadoo.fr> resending .. Jerry <2jerry at writeme.com> a ?crit dans le message ... >ok ... > >we need to add a class the idex slice will done by playing with getitem >function > >>>>class sliced_list: > def __init__(s,first_index=1): #1 by default > s.f_idx=first_index > s.list=[] > def __getitem__(s,idx=s.f_idx): > return s.list[idx-s.f_idx] > >then >with class lm: >>>> a=sliced_list() >>>> a.list.append(lm('paul','DUBOIS',45)) >and du coup* (then) >>>>a[1].lastname >paul >>>>a[0].lastname >paul >** Right cause index will be modulo-ed :)) .. add: >>>>a.list.append(lm('david','Asher',31) >>>>a[1].lastname >paul >>>>a[2].lastname >david >>>>a[3].lastname >paul >... >use __setitem__ to update :) > >jerry the foolish dracomorpheus, > > >sorry at spam.invalid a ?crit dans le message ... >>Thanks for replying. You've written part (b), which I was also >>able to do. But how do I get (a) the modified UserList and (b) >>the list of class elements into a single instance? I want >> >> a[whatever_I_decide_is_the_start_of_the_list].lastname >> >>to return >> >> a[0].lastname >> >>automatically, and have whatever_I_decide_is_the_start >>_of_the_list default to 1 when I create an instance of >>the class. >> >>Jerry <2jerry at writeme.com> wrote: >>> This is just a list of class elements ? no ? >>> class lm: >>> def __init__(self, last=None,first=None,age=0): >>> self.lastname=last >>> self.firstname=first >>> self.age=age >> >>> then .. >>> list_lm=[] >>> a=lm('jerome','VACHER',29) >>> list_lm.append(a) >>> list_lm.append(lm('paul','DUBOIS',45)) >>> a[0].lastname='jerome' >> >>> Is that you want ? >> >> >>> sorry at spam.invalid wrote: >>>>Hi, >>>> >>>>I'm a Python newbie (and an OOP newbie) trying to >>>>construct a class that: >>>> >>>> (a) behaves like a list but has a FORTRAN-like variable >>>> starting index, >>>> (b) has per-index attributes. >>>> >>>>i.e. Each element of the list has two (or more) attributes, >>>> and, by default, the first element is at x[1]. >>>> >>>>e.g. x[1].lastname, x[1].firstname, x[1].age >>>> x[2].lastname, x[2].firstname, x[2].age >>>> >>>>I seem to be able to get each part of the solution >>>>independently (the first part by using UserList and >>>>__getitem__), but when I attempt to combine them, I >>>>clearly don't understand what I'm doing. >>>> >>>>Suggestions? >>>> >>>>Thanx. >>>> >>>>P.S. Please respond to the list. > > From thomas at bibsyst.no Sun Feb 13 11:31:18 2000 From: thomas at bibsyst.no (thomas) Date: Sun, 13 Feb 2000 16:31:18 GMT Subject: merging really huge lists fast Message-ID: <38A6E891.9494D59A@bibsyst.no> Hi, I got huge lists I want to merge, but the good old new_list = list1 + list2 seems to be slow. Any hints? Thomas From aa8vb at yahoo.com Wed Feb 16 08:39:51 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 16 Feb 2000 08:39:51 -0500 Subject: IDLE Color Prefs Message-ID: <20000216083951.A2421914@vislab.epa.gov> Glad to see it's MUCH easier to change colors with the latest IDLE. Now is there a way to put these in an ".idlerc" of sorts so they're kept from version to version? BTW, for those like me that have high-contrast screens (i.e. a white background is "blinding"), here is a dark background color scheme for IDLE. Just replace what's in your IDLE 0.5 IdlePrefs.py file with this and tweak to taste. class ColorPrefs: CNormal = "white", "MidnightBlue" CKeyword = "orange3", None CComment = "red3", None CString = "green3", None CDefinition = "cyan3", None CHilite = "#000068", "#006868" CSync = None, None CTodo = None, None CBreak = "#ff7777", None CHit = "#ffffff", "#000000" CStdIn = None, None CStdOut = "gray90", None CStdErr = "red3", None CConsole = "yellow3", None CError = None, "#ff7777" CCursor = None, "gray75" -- Randall Hopper aa8vb at yahoo.com From bparsia at email.unc.edu Thu Feb 10 23:03:45 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Thu, 10 Feb 2000 23:03:45 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> Message-ID: <1e5swv6.1q9lq2u1flfqi0N%bparsia@email.unc.edu> Quinn Dunkan wrote: > >Bijan Parsia wrote: [snip] > >> One large advantage that both Perl and Python have is that they fit in > >> well with a fairly common mindset that stems from certain set > >> programming/working environments. This is more or less explicit in their > >> designs. Squeak and Smalltalk are not a smooth fit for that mindset, so > >> really mastering them typically requires a shift in deeply held habits. > > Ok, this is getting a bit OT, but what the hey: > > This is a good expression of my problem with smalltalk. I like the language, > I'm impressed with squeak, but I don't see how I can use it. The first > problem is that I don't want to use the built-in editor, I have my own tools > and I prefer them for a reason. Sure. It drives me nuts when I *can't* use em :) > Although I'm sure I could have squeak import > source from external files, it seems like that would be fighting the language. Certainly the implemenation. And probably the langauge, since at least part of one major strand of (this is for you, Paul ;)) Smalltalk philosophy is that we will hold all your whitespace hostage until you see the errors of your ways and embrace left flapping scroll... er, oops. Sorry, I always get the subliminals mixed up with the, uh, liminals ;) ...One major strand of Smalltalk is that the real system is a collection of live objects in memory, and there are various modalites for interacting and shaping those objects. "Language syntax" is only one of them, and not typically the dominante one. So, while there is a pure textual representation of ANSI Smalltalk (which is a somewhat new move, though the idea of declarative Smalltalk idea goes back several years), the original "langauge" *required* the manipulation of a "virtual image". Interestingly, in Smalltalk-76 you could adjust the sytax of your methods on a class by class basis. (This should give an idea of how the "langauge" syntax evolved.) Indeed, the Squeak image still contains unmodifed bits that can trace their heritage (via copying) back to at least a 1983 copy. > The other problem is that the things I do usually involve lots of interaction > between other programs, filesystems, etc. and work non-interactively. Has > anyone done a #!/usr/local/bin/smalltalk just-another-scripting-language? > Would it even be smalltalk? I think I answered this in another post, but GNU Smalltalk and Little Smalltalk (which is not active, AFAIK) aim at this. As I said, the ANSI standard deliberately moved away from *requiring* a image/vm approach, and indeed, made it possible to write conforming (and thus portable) programs that will run in an image and in, I guess, an interpreter of some sort. This isn't a huge priority for me since I'm more interested in the virtual image approach, but making a "smalltalk scriping system" is certainly doable. Oh, yes. Squeak has an XML-RPC implementation (and a, very incomplete--my fault ;)--LDO one), though it hasn't yet made it's way into the regular distribution. And, there is a plugin called "OSProcesses" (with support classes) (http://minnow.cc.gatech.edu/squeak/708) which allows (only on *nix thus far, though I've been toying with using the applescript plug in to get mac support in): "Current capabilities include: Inspect the OS process in which Squeak is running: "OSProcess forThisOSProcess inspect" Read standard input, and write standard output and standard error streams. Create operating system pipes and attach them to AttachableFileStream streams. Create Unix child processes with protocol similar to (same as?) VisualWorks. Clean up child processes automatically on exit (a Semaphore is set after receiving a SIGCHLD signal), with child exit status available in Squeak. Start a second Squeak in a child process, restarting the child from the last saved image file: "UnixProcess squeak" Clone the running Squeak image, producing two nearly identical Squeaks running from the same object memory at the time of cloning: "UnixProcess forkSqueak" Clone the running Squeak image, but with no display connection for the child: "UnixProcess forkHeadlessSqueakAndDo: aBlock" Clone the running Squeak image with no display connection, execute a block, and exit (similar to running a command from a Unix shell, except that the "command" is a Smalltalk block): "UnixProcess forkHeadlessSqueakAndDoThenQuit: aBlock" I think this might cover most of your bases. > >Only-half-a-joke: I think that Squeak's the biggest competitor not to > >Python, but GNOME and KDE -- the world just hasn't realized it yet. > > It would be interesting to see a squeak system running on hardware ala oberon > or something (perhaps there is one?). At least three: Bare metal port to a mitubishi chip, arm (and could be gotten up on an Itsy--note that this was a fork an includes real time support), and a "dos" port which basically uses dos as a bootloader. Oh, and an "embedded" version which, I think, forgoes all graphic support, or graphics requirement, I forget which :) And it runs on WinCE machines. Rather nicely, actually. The complete development environment and all. > And not just aimed at being a > code-writing environment, but a complete graphical environment. Er..Right. "Rather nicely, the complete development environment, debugger, graphics, networking, etc." Graphics run bit for bit on every platform Squeak is ported to (well, *ok* except when we through them away :)). The VM is written in a restricted Smalltalk subset called Slang. Squeak is self-hosting (i.e., you can run a Squeak image on a simulator of the VM running as bytecompiled Smalltalk---slowly ;) This is the same code which generates the c for the native vm, so you can debug your VM mods without leaving Squeak using the standard tools.) > I'm sure this > has been done before, but on modern systems? Hmmm... squeak + ggi + X > compatibility layer.... There was a ...Qt?..Squeak project which sorta died out. THe codes around somewhere. Right now a hot item on the Squeak list is a foreign function interface. Er..Anything else anyone wants to know? On comp.lang.python, that is. Feel free to move over to comp.lang.smalltalk ;) Cheers, Bijan "Info-glut" Parsia. From mhammond at skippinet.com.au Tue Feb 1 07:23:17 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 12:23:17 GMT Subject: DL_EXPORT (Extending on Windows question) References: <038b01bf6c1d$5aec9a10$4500a8c0@thomasnotebook> Message-ID: "Thomas Heller" wrote in message news:038b01bf6c1d$5aec9a10$4500a8c0 at thomasnotebook... > How do I compile my C-extensions so that > the usual > DL_EXPORT (void) initmodule (void) > is expanded to > __declspec (dllexport) void initmodule (void) > ? > > Cannot figure out the right defines... You shouldnt use these for your extension - they are considered private to Python. You should invent your own define.... Mark. From fdrake at acm.org Thu Feb 17 12:28:16 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 Feb 2000 12:28:16 -0500 (EST) Subject: Which GUI? In-Reply-To: <20000217161727.A1183@stopcontact.palga.uucp> References: <38AC0244.C5FA164A@durham.ac.uk> <20000217161727.A1183@stopcontact.palga.uucp> Message-ID: <14508.12208.365515.624845@weyr.cnri.reston.va.us> Gerrit Holl writes: > I think we really should create an extensive list with all available > GUI's, with all advantages and disadvantages and a table with info > like crossplatformness, learning curve... I think we can link to it from python.org when you have it ready; send a note to python-docs at python.org with the URL. Isn't the volunteerism in this community great? ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From mhammond at skippinet.com.au Thu Feb 24 17:54:23 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 25 Feb 2000 09:54:23 +1100 Subject: More IIS crashing and blank .asp pages In-Reply-To: <81DD38F43381D111BA3E00A076A0998A459F59@XENON> Message-ID: Im afraid I have no idea where to start with this. Im a little confused by the stack trace - it appears asp!TerminateExtension is calling directly into PyWinThreadState_Free(), which is very strange. Do the Python ActiveScripting IE or WSH samples work? They all use the same Active Scripting engine... To track this down, it probably needs to be run under the debugger to at least see WTF is going on. However, this is going to be quite a pain to do, as you need debug builds of all the dlls. And even then, the problem may not be obvious (but should be solvable still!). I wish I had more ideas for you. I keep meaning to get myself a dual-proc machine :-) Mark. > -----Original Message----- > From: Jason Nadler [mailto:dixon at channel21.com] > Sent: Friday, 25 February 2000 6:56 AM > To: 'ASPadvanced'; 'python-list at python.org' > Cc: 'mhammond at skippinet.com.au' > Subject: More IIS crashing and blank .asp pages > > > OK, I thought I fixed the crashing bug by stepping up to the newest Python > language version (as well as the win32 extensions). > Now, my server is spitting out blank .asp pages for those which > use python. > If Python is not declared as the page language, the asp pages work fine. > After the install, the blanks started appearing. > All the paths look fine in registry. > I just checked the machine again, and it has crashed again as a result of > something in the python threading (same as error that was happening). This > leads me to believe that the python actually IS being executed. > However, the > output is just the blanks... > Any clues? > > ( Intel dual PIII 550 Xeon, 1G RAM, NT 4.0 SP 6a, IIS 4) > > p.s.: the blank pages source look like this: > > > > > > > > > and the error in app log is still: > > > An object call caused an exception. > > > (IID: {51372AEF-CAE7-11CF-BE81-00AA00A2FA25}) (Method: 3) > > > (Microsoft Transaction Server Internals Information: File: > > > i:\viper\src\runtime\mtxex\activity.cpp, Line: 889) > > > (Exception: C0000005) (Address: 0x1e6054df) > > > PyWinTypes15!PyWinThreadState_Free(void) + 0xF > > > asp!TerminateExtension + 0x3D35 > > > asp!TerminateExtension + 0x33E3 > > > asp!TerminateExtension + 0x313B > > > asp!TerminateExtension + 0x7AC3 > > > asp + 0x325C6 > > > mtxex!MTSCreateActivity + 0x1F3C > > > mtxex!MTSCreateActivity + 0xF3E > > > > > From andrew at andrewcooke.free-online.co.uk Tue Feb 15 08:48:01 2000 From: andrew at andrewcooke.free-online.co.uk (Andrew Cooke) Date: Tue, 15 Feb 2000 13:48:01 GMT Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> Message-ID: <88bleg$chl$1@nnrp1.deja.com> In article <000001bf768e$48e40580$45a0143f at tim>, "Tim Peters" wrote: > def traverse_post(self): > for child in self.left, self.right: > if child is not None: > suspend child.traverse_post() > suspend self.data That finally hammered home to me just what continuations are all about. Does anyone have something similarly elegant that shows a coroutine? I've just had a look at the stackless python documentation and coroutines seem to be described as something coming out of a single detailed example. Is there a simpler definition? (I did look back through some posts on Deja, but there was nothing recent that seemed to explain what a coroutine actually is - sorry if I've missed something obvious). Also, comp.lang.lisp is currently dissing continuations. Would that be because the alternative is to pass the code that will process the node into the iterator as a (first class) function? Obviously, in this case, yes, but is that true in general (are there examples where continuations or coroutines make something possible that really is tricky to do in other ways)? Thanks, Andrew Sent via Deja.com http://www.deja.com/ Before you buy. From alex at somewhere.round.here Tue Feb 29 22:50:12 2000 From: alex at somewhere.round.here (Alex) Date: 29 Feb 2000 22:50:12 -0500 Subject: will python 3000 break my code? References: <87tkoi$hql$1@nntp1.atl.mindspring.net> <08Zu4.6976$3z.60274@newscontent-01.sprint.ca> Message-ID: > I wouldn't worry about that. You won't have to throw or rewrite old > code, unless you want to take advantage of features in Python 3000. It wouldn't suprise me if some rewriting were needed. For instance, Guido said that he will be changing the list.append method so that l.append(1,2) gives a syntax error. That will mean that I am going to have to change a hundred or so lines of code. Alex. From neelk at brick.cswv.com Tue Feb 8 18:53:03 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 8 Feb 2000 23:53:03 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> Message-ID: Paul Prescod wrote: > > Not a chance. Smalltalk is doomed for the same reason Lisp is doomed. > Smalltalk programmers think that their way of doing things is so much > better than everybody else's that the whole world should reorganize > themselves around the language. Er, you *do* realize that people have been saying this about Lisp for pretty much its whole existence? Neel From paul at digicool.com Thu Feb 10 19:04:20 2000 From: paul at digicool.com (Paul Everitt) Date: Thu, 10 Feb 2000 19:04:20 -0500 Subject: Several questions: python plugin, xml-rpc + Medusa References: <38A01C84.88229E45@ttm.com> Message-ID: <38A35204.4DA1CA1@digicool.com> Scott Anderson wrote: > Second question: has anyone melded the xmlrpclib stuff to Medusa yet, > other than Zope? If I were to need something like that, should I just > use Zope? I'm trying to keep things lightweight, and I don't need the > full-fledged Zope framework (which is verra, verra nice, but the master > of the castle already has one, you see...) As Skip mentioned, the pieces of Zope can be used separately. Amos Latteier has written an excellent How To on doing "Bobo style" programming in Zope. http://www.zope.org/Members/Amos/ZPublisher This is the lowest-level way to do Python work in Zope. Of course this presumes you know what Bobo mode means -- I'll have to ask Amos to update the How To. Basically, if your module contains: ---------------- My Module ------------ def hello(name): """Docstrings are required, otherwise ZPublisher will ignore them.""" return 'Hello %s.' % name ---------------- My Module ------------ ...then http://yourhost/hello?name=Bubba will return 'Hello, Bubba.' There are a ton of ideas in "Bobo mode" that I won't go into here. --Paul From sabren at manifestation.com Mon Feb 14 12:21:29 2000 From: sabren at manifestation.com (Michal Wallace) Date: Mon, 14 Feb 2000 12:21:29 -0500 Subject: how to talk to __main__? References: <889cg2$83e$1@nntp9.atl.mindspring.net> Message-ID: <889djl$3v8$1@nntp9.atl.mindspring.net> Fredrik Lundh wrote in message ... >Michal Wallace wrote: >> I understand why __name__ evaluates to "__main__", >> but how come you can't say __main__.x = 1 to reassign >> some global variable x? > >of course you can -- provided you import it first. oh! Well.... Duh!. :) Thanks. -Michal http://www.sabren.com/ From embed at geocities.com Wed Feb 9 13:54:44 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 13:54:44 -0500 Subject: Statically link Python15.LIB instead of Python15.lib -> Python15.dll References: Message-ID: > How do I build a Python15.lib for Windows that I can link to my application > so I don't have to distribute Python15.dll. Okay, this was a case of ask first, then try. Sorry! :-) I figured out it was pretty easy. Start a new library, move over the files from the DLL project, change a few compilation flags, and voila. Python is very very nicely written and the source is very clean, and building subsets of python is very very easy. I am extremely impressed. Warren From phd at phd.russ.ru Fri Feb 11 09:26:00 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 11 Feb 2000 14:26:00 +0000 (GMT) Subject: PyApache, couldn't geta hold of author, willing to donate some time In-Reply-To: <38A3CEFB.4C9FB00A@columbus.rr.com> Message-ID: Hi! Welcome to the wonderful world of PyApache! :))) On Fri, 11 Feb 2000, Mark Nielsen wrote: > I was trying to get a hold of the author of PyApache. > I wanted to add some modules to PyApache, like Perl has, > but I needed to know what the status of PyApache is and if > anybody is writing up more modules for it. > > If anybody could get me in contact with him, I would appreciate it! > My mail kept bouncing. I haven't heared anything from PyApache mailing list for a looong time, but in any case it is very low-volume list. I do not understand your ideas of PyApache "modules". PyApache is much simpler than mod_perl (: I hate it :) PyApache is just a thin wrapper to use python for CGI. PyApache was able to intercept request handling like mod_perl, but there was not much interest, and this parts of code was removed. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From breiter at usf.Uni-Osnabrueck.DE Thu Feb 10 03:39:18 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 10 Feb 2000 08:39:18 GMT Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> Message-ID: <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> In article <87q1jh$437$1 at nnrp1.deja.com>, thucdat1143 at my-deja.com writes: > It doesn't matter anymore that Gates resigned, maybe he already saw > where Coplan was heading to. That's the end of Python/Tcl/Perl on Win32. Oh, you mean, because Win32 will die out so quickly because Borland and Corel have joined. >From the technical point of view, the Borland products I used always left things to be desired. > Erase your 95/98/NT, install Linux now. Bright future for everything > (Python, Tcl, Perl) on Linux because Unix is their home anyway. Python is very much at home on Win32. And I hope it will stay his way, because python saves my day if I really have to do "stuff" on Win32. Bernhard -- Free Software Projects and Consulting (intevation.net) Association for a Free Informational Infrastructure (ffii.org) From fatjim at home.com Sat Feb 19 02:58:55 2000 From: fatjim at home.com (Jim Meier) Date: Sat, 19 Feb 2000 07:58:55 GMT Subject: Rudimentary dict (RFC 2229) client library References: Message-ID: <33sr4.9159$_e7.353409@news1.sshe1.sk.home.com> In article , Jim Meier wrote: > I needed to use some dict servers and wanted to do it in python. .. and then I forgot to post the source. whoops! --Jim Meier BillyGrahamBot: the dissotiaton of choice. The road to our Armageddon will be required to run on both Linux and Microsoft Windows NT. We might be seeing you in heaven. And God told him to be extensible or to accomodate other UI paradigms than text terminals. -----> dictlib.py (cut here to end of message) <----------- import socket import types import re import string class DictDefinition: def __init__(self, dict, word): self.dict = dict self.word = word self.defs = {} def definitions(self): return self.defs.values() def adddef(self, dictid, definition): self.defs[dictid] = definition def dictids(self): return self.defs.keys() def dictnames(self): return map(self.dict.dictname, self.defs.keys()) class Dict: def __init__(self, server, port=2628): self.server = server self.port = port self.open = 0 self.sock = None self.file = None self.databases = None def _getdatabases(self): self._connect() self.databases = {} self.sock.send("SHOW DB\n") resp = self.file.readline() n = string.atoi(string.split(resp)[1]) done = 0 while not done: line = self.file.readline() if line[0] == ".": done =1 else: id, name = self._quotesplit(line) self.databases[id] = name self.file.readline() # get the 250 ok self._disconnect() def dictids(self): if not self.databases: self._getdatabases() return self.databases.keys() def dictname(self, dictid): if not self.databases: self._getdatabased() return self.databases[dictid] def _connect(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect(self.server, self.port) self.file = self.sock.makefile('rb') welcome = self.file.readline() def _disconnect(self): self.sock.send("\nQUIT\n") self.sock = None self.file = None def _quotesplit(self, s): ''' like split, except everything between pairs of ->"<- counts as one part. ''' parts = [] buf = "" in_quotes = 0 for i in s: if in_quotes: if i =='"': in_quotes = 0 parts.append(buf) buf="" else: buf = buf + i else: if i == '"': if buf !="": parts.append(buf) buf = "" in_quotes = 1 elif i in string.whitespace and buf != "": parts.append(buf) buf = "" else: buf=buf+i if buf != "": parts.append(buf) if parts[-1] == '\015': del parts[-1] print s print parts return parts def _onedefine(self, word): self.sock.send("DEFINE * %s\n"% word) done = 0 res = DictDefinition(self, word) while not done: line = self.file.readline() code = line[:3] if code == "150": n = string.atoi(string.split(line)[1]) elif code == "151": parts = self._quotesplit(line) word = parts[1] dictid = parts[2] dictname = parts[3] done_def = 0 definition = "" while not done_def: line = self.file.readline() if line[0] == ".": done_def = 1 else: definition = definition + line res.adddef(dictid, definition) elif code == "250": # ok done =1 elif code == "552": # no match done = 1 return res def define(self, word_or_words): if type(word_or_words) is types.StringType: self._connect() res = self._onedefine(word_or_words) self._disconnect() return res elif type(word_or_words) is types.ListType: self._connect() res = [] for i in word_or_words: res.append(self._onedefine(i)) self._disconnect() return res else: raise TypeError("Need a string or list of strings.") From gerrit.holl at pobox.com Sat Feb 12 08:36:34 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 14:36:34 +0100 Subject: Docstrings Message-ID: <20000212143634.A3241@stopcontact.palga.uucp> Hello, I wrote a function help() which prints the docstring of an object to stdout, and prints a notice otherwise. But I want to distinguish between types without docstrings or objects without docstrings which could have a docstring. I found some documentation in the language reference: http://www.python.org/doc/current/ref/types.html#l2h-97 Callable types These are the types to which the function call operation (see section 5.3.4, ``Calls'') can be applied: User-defined functions A user-defined function object is created by a function definition (see section 7.5, ``Function definitions''). It should be called with an argument list containing the same number of items as the function's formal parameter list. Special attributes: func_doc or __doc__ is the function's documentation string, or None if unavailable; func_name or __name__ is the function's name; func_defaults is a tuple containing default argument values for those arguments that have defaults, or None if no arguments have a default value; func_code is the code object representing the compiled function body; func_globals is (a reference to) the dictionary that holds the function's global variables -- it defines the global namespace of the module in which the function was defined. Of these, func_code, func_defaults and func_doc (and this __doc__) may be writable; the others can never be changed. Additional information about a function's definition can be retrieved from its code object; see the description of internal types below. So this applies to all callable objects, I thought. But now, I noticed this: >>> t = type('') >>> callable(t) 0 >>> t.__doc__ # strange, no error >>> None.__doc__ Traceback (innermost last): File "", line 1, in ? AttributeError: 'None' object has no attribute '__doc__' >>> open('/dev/null').__doc__ Traceback (innermost last): File "", line 1, in ? AttributeError: __doc__ >>> [].__doc__ Traceback (innermost last): File "", line 1, in ? AttributeError: __doc__ >>> f = Foo() >>> callable(f) 0 >>> f.__doc__ # not callable but does have a docstring 'docstring' Am I confused, is it an implementation bug or is it a documentation bug? regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From kens at sightreader.com Mon Feb 28 00:19:45 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 21:19:45 -0800 Subject: Traling junk in string.atof (RE: array constructor) References: <000f01bf8197$0c473020$f0a2143f@tim> Message-ID: <38BA0571.BED84D5@sightreader.com> I remember reading about a language that generates absolutely no errors of any kind. Maybe it was called Nobol; I don't remember. The idea is that a syntax error indicates a failure in the language to provide semantics for a potentially useful idiom. That's not Python. I vote for leaving things like string.atof() the way they are. - Ken Tim Peters wrote: > [Tom Holroyd] > > ... > > While I'm here, string.atof() and float() both barf on "123.45," while the > > C atof() doesn't. A quick check of the code (stropmodule.c) shows that > > there is an explicit check for junk at the end of the string. > > Right. > > > Is there some reason for this besides just being annoying? :-) > > Yes, but simply because "123.45," does not match the syntax for "a number". > The trailing comma may be harmless, or it may indicate your program has > gotten lost, or that your data has gotten corrupted, or that your data was > ill-formed to begin with. Python refuses to guess that it makes sense, > because it has no way to *know*, and guessing "ya, OK" errs in the wrong > direction (screws *you* the most). Python takes this attitude all over the > place, btw -- string.atof is just one instance of it. > > I'm curious how you ended up with a numeric string with a trailing comma to > begin with. For example, if you're reading lines of comma-separated values, > the natural idiom is > > numbers = map(float, string.split(line, ",")) > > which gets rid of the commas explicitly. > > > I vote to remove it. > > I'll set up a web page to keep a running tally . > > better-careful-coding-than-endless-debugging-ly y'rs - tim From hweaver at pinetel.com Fri Feb 25 05:30:37 2000 From: hweaver at pinetel.com (Harold L. Weaver) Date: Fri, 25 Feb 2000 10:30:37 -0000 Subject: No way to reach CXX again ? References: <38B676D7.28C44F56@onera.fr> Message-ID: <896hhq$fsl@caribe.pdx.oneworld.com> Marc POINOT wrote in message <38B676D7.28C44F56 at onera.fr>... > >I'm trying to dowload CXX (LLNL/ P.Dubois). >I've unsuccessfuly tried all the links >I had: no way... > >Any idea? Is CXX dead? Is CXX now private? > Moved to sourceforge.net: http://sourceforge.net/project/?group_id=1369 From sabren at manifestation.com Thu Feb 10 01:33:07 2000 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 10 Feb 2000 01:33:07 -0500 Subject: cgi login/password question References: <87sdag$ou7$1@nnrp1.deja.com> Message-ID: <87tm3s$801$1@nntp1.atl.mindspring.net> sp00fD wrote in message <87sdag$ou7$1 at nnrp1.deja.com>... >I'm thinking about adding a login method to a web-site, I'd like to >roll it myself, but how would I pass the info from page to page? >Obviously a page would have a login/password form, and I'd like to have >that username correspond to a permissions bit so that certain people >can do certain things. I pretty much have it worked out except for the >matter of passing the info around. Can someone help me? I like how >the builtin method for doing this sets the "REMOTE-USER" environment >setting. If it was passed in the url, it could easily be changed, as >could a cookie. Hey Mike, What you want is called session handling... the basic idea is that you "brand" the browser with a unique key in a cookie or encoded in all of your URLs... Then you store variables tied to that session in some sort of persistent namespace or dictionary or whatever... One of the variables can be the username. by storing authentication info in a session, you can log the user in and out at will.. I've yet to see a really useful version of session handling in python... but I've been toying with the idea of porting the PHPLIB session/authentication/permission library over at http://phplib.netuse.de/ ... Would anyone else be interested in helping out? -michal http://www.sabren.com/ From jjlucsy at concentric.net Thu Feb 17 14:03:06 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Thu, 17 Feb 2000 14:03:06 -0500 Subject: Multiple ExtensionClass Message-ID: Ok, I've whipped up two ExtensionClass classes (stirred, not shaken) and am trying to figure out how one can be a "subclass" of the other. I'll illustrate what I want (in python for brevity): class A: def func1(): pass class B(A): def func2(): pass Now I'd like to be able to do: a=B() a.func1() So far I haven't figured out how to do this without duplicating the methods. Should I be messing with the method tables, or somehow manipulating the dictionaries, or something completely different? I've tried making python wrappers, but it complains about multiple bases or something. Basically it wont let me derive from two different ExtensionClasses's. Either that or I'm missing something. Any clues would be great. Thanks. -- - Joel Lucsy (jjlucsy at concentric.net) From drek at interlog.com Fri Feb 18 12:10:44 2000 From: drek at interlog.com (Agent Drek) Date: Fri, 18 Feb 2000 12:10:44 -0500 (EST) Subject: PyGreSQL and windows In-Reply-To: Message-ID: | ODBC is the M$ standard to access databases. To access a database you |need universal ODBC manage and a driver for your particualr database. |Postgres does have the driver... | |Oleg. Then all is well :) thanks alot for the info. -- -ly y'rs, Agent Drek Big Animation Inc > 'digital plumber' http://www.bigstudios.com From gerrit.holl at pobox.com Fri Feb 25 07:50:51 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 25 Feb 2000 13:50:51 +0100 Subject: Bring value from walk() In-Reply-To: <38B663AF.EDF3622E@nembv.cz>; from prudek@nembv.cz on Fri, Feb 25, 2000 at 12:12:47PM +0100 References: <38B663AF.EDF3622E@nembv.cz> Message-ID: <20000225135051.A3534@stopcontact.palga.uucp> > I need a function that walks the dir tree and adds up occupied space. class DiskUsage: __size = 0 def adddir(self, dir): files = os.listdir(dir) dirs = [] for file in files: filename = os.path.join(dir, file) s = os.lstat(filename) mode = s[ST_MODE] if S_ISDIR(mode): dirs.append(filename) elif S_ISREG(mode): self.__size = self.__size + s[ST_SIZE] for dir in dirs: self.adddir(dir) def len(self): return self.__size def du(dir): '''du(dir) -> int Returns the size in bytes of 'dir'. ''' disk = DiskUsage() disk.adddir(dir) return disk.len() -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From P.J.W.S.VRIJLANDT at INT.azg.nl Tue Feb 15 02:56:29 2000 From: P.J.W.S.VRIJLANDT at INT.azg.nl (P.J.W.S. Vrijlandt) Date: Tue, 15 Feb 2000 08:56:29 +0100 Subject: Help with Python Grammar change In-Reply-To: Message-ID: <15FE0A7301E@nds-3.azg.nl> If you define: def func(*arg): print 'func called with ', arg class callable: def __init__(self, func, *arg): self.func = func self.arg = arg def __call__(self, *arg): apply(self.func, self.arg + arg) class slicer: def __init__(self, func): self.func = func def __getitem__(self, arg): return callable(func, arg) def __getslice__(self, arg1, arg2): return callable(func, arg1, arg2) g = slicer(func) You can do: >>> g[1:10](3) func called with (1, 10, 3) >>> g[1:10:2](3) func called with (slice(1, 10, 2), 3) No change in syntax needed! > > I have a question for people familiar with the Python Grammar: > > How difficult would it be and what are the problems with altering the > grammar (and compile.c code) so that one can enter slice-syntax as an > argument to a function call: > > In other words if g is a function: > > def g(a,b): > # some nifty code > return > > I want > > >>> g(1:10:2,3) > > to call function g with slice(1,10,2) and 3 as arguments. > > Is this at all possible, or would it break things horribly? > > Thanks for any feedback, > > Travis Oliphant > > > > > -- > http://www.python.org/mailman/listinfo/python-list > Met vriendelijke groet, Patrick Vrijlandt From piet at cs.uu.nl Fri Feb 18 15:09:10 2000 From: piet at cs.uu.nl (Piet van Oostrum) Date: 18 Feb 2000 21:09:10 +0100 Subject: What is the correct way to install PIL on Windows References: <0e3da846.4297725e@usw-ex0105-035.remarq.com> Message-ID: >>>>> Tonetheman (T) writes: T> I downloaded a precompiled version of PIL for Python 1.52 from T> Pythonware (I think) and I unzipped it. I am very new to using T> python so be kind if possible. T> After a while I figured out that I needed to move the T> _imaging.dll to the DLLS directory. I knew that I needed to T> create a PIL diretory somewhere. T> After hacking around a while I found a registry key and added T> the pil directory to the system path. Now when I go into python T> and type T> import sys T> print sys.path T> it includes the PIL directory. Everything seems to work fine. T> My question is what is the correct way to install the package? T> Should I have just used PYTHONPATH? There was another strange T> file in the zipped up distribution called pil.pth. Is this file T> supposed to be placed somewhere and that will somehow tell T> python where everything is at? If so did I just miss it in the T> docs. Unzip the zip file in the Python directory. The pil.pth file will have the same effect as adding the PIL directory to PYTHONPATH. No need to move the _imaging.DLL file. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: Piet.van.Oostrum at gironet.nl From info at pythonware.com Tue Feb 1 10:31:54 2000 From: info at pythonware.com (PythonWare) Date: Tue, 1 Feb 2000 16:31:54 +0100 Subject: ANN: Python training in Sweden! Message-ID: <004d01bf6cc9$78e4cc70$f29b12c2@secret.pythonware.com> Secret Labs AB (aka PythonWare) is proud to offer Python training in Sweden. The first sessions are scheduled for March. For more information, see our site: http://www.pythonware.com/training/ (in swedish only) Questions? Send mail to training at pythonware.com or call us at +46 13 210 215. -- regards the pythonware training team (admin note: due to an ISP glitch, the page didn't work in some browsers during last week. we do apo- logize for the inconvenience...) From poinot at onera.fr Mon Feb 28 03:28:45 2000 From: poinot at onera.fr (Marc POINOT) Date: Mon, 28 Feb 2000 09:28:45 +0100 Subject: No way to reach CXX again ? References: <38B676D7.28C44F56@onera.fr> Message-ID: <38BA31BD.1679C136@onera.fr> Fredrik Lundh wrote: > > Marc POINOT wrote: > > I'm trying to dowload CXX (LLNL/ P.Dubois). > > I've unsuccessfuly tried all the links > > I had: no way... > > > > Any idea? Is CXX dead? Is CXX now private? > > fwiw, the ftp site works fine from here: > > ftp://ftp-icf.llnl.gov/pub/python/ > > > > -- > http://www.python.org/mailman/listinfo/python-list Well, it's the link I had. It's returning "timed out" connections. Now, if you're telling me you reached it I have to try again, and again, and again. Marcvs [alias Can I make a Python recursion on such a connection ? ] From craigf at ilid.com.au Wed Feb 9 21:58:18 2000 From: craigf at ilid.com.au (Craig Findlay) Date: Thu, 10 Feb 2000 13:58:18 +1100 Subject: Using class data attributes Message-ID: <2l94ass5kdbgkaep64k9rl14m14dojc2vd@4ax.com> I would like to be able to read and write data attributes as in Delphi and automatically invoke functions. eg if I have instantiated a class called fred, which has an attribute x Then when I do a read of x: y = fred.x I want to fred to invoke a function that returns x but can do something else (some preprocessing of x perhaps) as well. Likewise if I do a write to x: fred.x = y Then I want to invoke a function that can process y in some way before changing x. For those who may know Delphi, this is like the Delphi property operators "read" and "write" Can I do this ir at least simulate my desired behaviour. Thanks, Craig Findlay Melbourne Australia From iam at not.you Thu Feb 24 09:48:03 2000 From: iam at not.you (Ken Power) Date: Thu, 24 Feb 2000 14:48:03 GMT Subject: Python accessing Excel 97 via com Message-ID: <38b543be.10970533@news1.mysolution.com> Nothing like learning COM the hard way, without a book or anything :) Anyway, my problem is this: I need to construct Excel spreadsheets from external data (the source of the data is not important at this stage). Following what little instructions I could find, I am able to start Excel and create a new(empty) spreadsheet via Python. Also I can print and change the contents of the current (active) cell. However, I am unsuccessful in changing to another cell to enter data, everything I enter is in one cell. Please, how can I change to another cell? Specs: Python 1.5.2 Pythonwin build 128(whatever newest is) Excel 97 Win 95 Functions I tried: mySpread.Cells('$A', '$1') and ('$A$1') and ('A1') etc mySpread.Activecell('$1:$1') and ('$A', '$1') and ('A1') etc obviously I am missing something, please enlighten me, Ken -------------------------------- Ken Power uncle_wiggly at bigfoot dot com -------------------------------- From moshez at math.huji.ac.il Mon Feb 21 13:11:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 21 Feb 2000 20:11:59 +0200 (IST) Subject: Which GUI? In-Reply-To: Message-ID: On Mon, 21 Feb 2000, Fredrik Lundh wrote: > Tkinter is a component oriented UI library, which > is carefully designed to work well with Python. > and vice versa -- a certain Python feature was > in fact added in part to make Tkinter a bit easier > to use (can you name this feature?) def f(**kw): pass do-i-get-the-effbotic-prize-or-what-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From arnold at dstc.edu.au Sat Feb 12 20:53:48 2000 From: arnold at dstc.edu.au (David Arnold) Date: Sun, 13 Feb 2000 11:53:48 +1000 Subject: CPython, JPython, and corba In-Reply-To: Your message of "Fri, 11 Feb 2000 14:07:40 EST." <38A45DFC.854D379B@bam.com> Message-ID: <200002130153.LAA01829@piglet.dstc.edu.au> -->"Bill" == Bill Scherer writes: Bill> Pyro and dopy both use the select module which JPython doesn't Bill> have. Is such a beast available for JPython? Fnorb uses some Bill> C so I don't think that will work either. Bill> Has anybody doen this, and if so, with what? it's not clear whether you require the code to be portable, although it would seem like that's the problem? if not, you can use the standard ORB from Sun (JavaIDL?) from JPython to talk to Fnorb or ILU or OmniORB in CPython. alternatively, the C modules in Fnorb can be replaced: the parser module isn't needed unless you want to generate the stub code, and the marshalling module could be written in either Java or Python to replace the C module (which is only there for performance). d From tbryan at python.net Thu Feb 17 06:42:23 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Thu, 17 Feb 2000 06:42:23 -0500 Subject: Problem with Emacs mode, at start only References: Message-ID: <38ABDE9F.48435B55@python.net> Fran?ois Pinard wrote: > > Justin Sheehy ?crit: > > > Fran?ois Pinard writes: > > > > When, in Emacs, I do not have `*Python*' window initialised, or more > > > precisely, when there is no process running in that window, then `C-c C-c' > > > in the window where is the Python source invariably fails the first time, > > > Whenever I start using python-mode, I do a `C-c !' to start the Python > > interpreter. Subsequent invocations of `C-c C-c' or `C-c |' will use > > that interpreter window. > > Thanks, it's neater. But yet, shouldn't `C-c C-c' just succeed? The user > should ideally not be forced into that extra, introductory command. Yes, it should. I'm not sure what you mean when you say "more precisely, when there is no process running in that window." In general, when I run C-c C-c before I start the interpreter with a C-c !, there is no '*Python*' buffer. The C-c C-c command creates a '*Python Output*' buffer to display any output, but it doesn't start a Python shell and doesn't create a '*Python*' buffer. When the '*Python*' buffer already exists, then C-c C-c uses that buffer instead of the '*Python Output*' buffer, displaying a "# working" message and any output/errors in the '*Python*' buffer. Thus, C-c C-c always works for me (GNU Emacs 20.3.1, python-mode 3.105, Red Hat Linux with kernel 2.2.5-15), it just behaves slightly differently depending upon whether I have a '*Python*' buffer open already. Perhaps you could explain in more detail how to evoke this problem. > P.S. - By the way, `C-c C-c' is an unfortunate binding, even if quick > to type. In the source window, it starts the Python interpreter, or at > least, uses it. In the interpreter window, it raises a signal and kills it. Hm. I hadn't thought of that. I suppose that for me, this is like Python whitespace issue. I've never had a problem with it. ---Tom From emile at fenx.com Wed Feb 16 09:25:41 2000 From: emile at fenx.com (Emile van Sebille) Date: Wed, 16 Feb 2000 06:25:41 -0800 Subject: Barcode-module References: <38AAA1EC.FA68F9C@bibsyst.no> Message-ID: <085601bf7889$b53d2840$01ffffc0@worldnet.att.net> Thomas, I've generated barcodes on label, laser, and dot matrix printers using either machine specific instructions or postscript. In all cases, it only required data on the comm port. I've not done it (yet) in python, but I have printed, and see no reason why barcodes should be a problem. What are you looking to do? From what platform? To what printer? Is the printer barcode aware? Do you have (or can you get) the manuals? Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Thomas Weholt Newsgroups: comp.lang.python To: Sent: Wednesday, February 16, 2000 5:11 AM Subject: Barcode-module > Hi, > > I`d like to generate barcodes. Can it be done from within python > somwhow?? > > Thomas > -- > http://www.python.org/mailman/listinfo/python-list > From moshez at math.huji.ac.il Mon Feb 14 12:41:42 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 19:41:42 +0200 (IST) Subject: how to talk to __main__? In-Reply-To: <889cg2$83e$1@nntp9.atl.mindspring.net> Message-ID: On Mon, 14 Feb 2000, Michal Wallace wrote: > Hey all, > > I understand why __name__ evaluates to "__main__", > but how come you can't say __main__.x = 1 to reassign > some global variable x? a. you forgot "import __main__" b. don't do it. Really. You destroy good code by tying it into a specific application. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From coursesm at sbdhcp-4022.statenisland-ny.est.tcg.com Tue Feb 15 09:53:21 2000 From: coursesm at sbdhcp-4022.statenisland-ny.est.tcg.com (Stephen Coursen) Date: 15 Feb 2000 14:53:21 GMT Subject: erasing and writing test on console. References: <38A95B81.DCFC4C25@durham.ac.uk> Message-ID: On Tue, 15 Feb 2000 14:18:21 GMT, bowman wrote: >J.C.Travers wrote: > >>where the 'zzzz bytes downloaded' is updated. >>Do I need to use curses to do this, or is there a simpler way just using >>the standard print and an erase function that I haven't heard of? > >Not the most elegant way, but one that usually works: set your print >up so you are not emitting a new line. Then emit enough backspace characters >to get back to the zzzz, and print the new number. Alternatively, you can emit '\r' without the '\n'. Then reprint the entire line. The zzzz will change as appropriate. It's a lot easier than determining howmany backspaces to emit. HTH, Steve From gmcm at hypernet.com Tue Feb 22 08:09:35 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 22 Feb 2000 08:09:35 -0500 Subject: access() In-Reply-To: <88tsvr$p30$1@nnrp1.deja.com> Message-ID: <1260897510-4877626@hypernet.com> london999 wrote: > I am trying to use access() in the os module. The online documentation > shows access(path,mode). > I don't know what value to put for mode. Tried os.X_OK, X_OK,"X_OK" and > always get "exceptions.AttributeError". os.access(, os.X_OK) works for me. > Where do I look up the possible values and why aren't they on the > access() html page? Because it wraps the c runtime routine of the same name, so man access will tell you what you need to know. - Gordon From echeverria at interactiva.cl Sat Feb 19 02:04:17 2000 From: echeverria at interactiva.cl (Cristian Echeverria) Date: Sat, 19 Feb 2000 03:04:17 -0400 Subject: Killer Apps??? References: Message-ID: <38ae31d9@omega> Zope Pysol pdfgen (ReportLab) Nick Henderson > Hello, > > I am new to the world of programming and python. I know Zope is super cool > and is python's "killer app." > > I was wondering if there were any other such killer apps? > > Thanks, Nick Henderson > > From bprentice at harborside.com Mon Feb 21 18:41:28 2000 From: bprentice at harborside.com (Brian Prentice) Date: Mon, 21 Feb 2000 15:41:28 -0800 Subject: PIL Fonts Message-ID: <38B1CD28.C6BA714@harborside.com> I am using Windows 95 and have no access to the font files required by the PIL library. I looked for bdf, pcf and pil fonts on the web but could not find any. Could anyone please provide me with a basic set of pil fonts (say Arial, Times Roman and Courier of various sizes in normal, bold and italic)? Has anyone considered incorporating the true type renderer at http://www.freetype.org/ into the PIL library. This would would enhance the library considerably and solve the font availability problem. From effbot at telia.com Wed Feb 9 03:27:59 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 08:27:59 GMT Subject: Why doesn't cStringIO.StringIO () have write methods? References: Message-ID: Alex wrote: > Hi. I noticed that when cStringIO.StringIO is instantiated with a > string, it doesn't have write methods, but when it's instantiated with > no arguments, it does. I was curious as to why this is. two different types: >>> from cStringIO import StringIO >>> s = 'TCACCACCACCACCACCATCATCACCACCACCACCATCATCATC' >>> t = StringIO(s) >>> t >>> t = StringIO() >>> t (StringIO is a factory function, not a class) From michael.stroeder at inka.de Tue Feb 8 03:48:57 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Tue, 08 Feb 2000 09:48:57 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <389FD879.19C9296B@inka.de> Roy Smith wrote: > > I fear disaster every time I have to move a block of code. As the logic > of my program develops, I'll either have to move a block of code into an > if, or move it out of one, or I'll take a block of code and turn it into > a function/method of its own, or maybe even extract something into a > subclass. Well, you're not the only one facing this daily challenge. ;-) > This means cutting and pasting (well, killing and yanking, > since I use emacs), and changing the indent level up or down. Yes, but what's the problem? Maybe one should remember this old rule that a code block should not be longer than approx. 20 lines (or shorter). > Emacs tries to be smart about indenting and > sometimes does something wrong, Maybe I don't have problems because I stay away from super-smart software. I simply do not understand the fuss about whitespaces in this thread. I have no problems at all with that. Maybe I'm doing something wrong? Maybe I'm not a real programmer toughened up by using C/C++, Perl and Emacs. (I come from the Pascal/Modula world and I'm really glad about Python's indenting for statement grouping.) Ciao, Michael. From neelk at brick.cswv.com Tue Feb 15 18:12:54 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 15 Feb 2000 23:12:54 GMT Subject: Real Problems with Python References: <000e01bf7763$dc8a9300$66a2143f@tim> Message-ID: Tim Peters wrote: > [Tim] > > ... > > More formally, you can certainly *model* Python's scoping in Scheme, > > [Bijan Parsia] > > Er..Just out of curiosity, what *can't* you model in Scheme? :) > > Smalltalk . I know this is a joke, but wasn't Scheme invented because Sussman wanted to understand how Smalltalk worked by implementing something like it in MacLisp? I thought that the Smalltalk and Scheme designers were in regular communication. Neel From quinn at zloty.ugcs.caltech.edu Wed Feb 9 15:35:47 2000 From: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) Date: 9 Feb 2000 20:35:47 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> <87sbgq$nga$1@nnrp1.deja.com> Message-ID: On Wed, 09 Feb 2000 19:47:35 GMT, Fredrik Lundh wrote: >stevie_deja at my-deja.com wrote:> >> > who's behind this secret conspiracy? >> Typically you are dealing with people coming from other languages. I am >> sorry that you cannot handle people asking if something is in Python. >> what is the fear of you say 'no, we don't have that either' a problem >> for you. > >I'm sorry, but I completely failed to parse that message. > >But you seem to be implying that 1) people who've used >other languages tend to have my-deja.com accounts and >like to post without revealing their real names, and that >2) I don't like to help newcomers? > >that's cool. not true at all, of course, but hey, >if thinking that makes you happy... Actually, I think these are leaking over from zope-land. Hey, as long as they get answered! msg a: blurfl? ez ziq glid org, dor bung whoey funt spaz? erk un ling bluk fith domp. msg b: > blurfl? ez ziq glid org, dor bung whoey funt spaz? erk un ling bluk > fith domp. geeble gorp. blinkin brug ting dos bergle pop, lerp el tisty frunken. blakken eeben, dep morden spee fozz. msg c: > > blurfl? ez ziq glid org, dor bung whoey funt spaz? erk un ling bluk > > fith domp. > geeble gorp. blinkin brug ting dos bergle pop, lerp el tisty frunken. > blakken eeben, dep morden spee fozz. Ok, it works fine now! Thanks! Ahh, usenet. From effbot at telia.com Sun Feb 27 13:14:37 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 18:14:37 GMT Subject: name of object inside it's methods? References: Message-ID: Michal Wallace (sabren) wrote: > > > can someone fill in the blank > > > > ------------------------------- > > class Hello: > > def __init__(self, x): > > self.x = x > > > > def classname(self): > > > > def classname(self): > return self.__class__ > > it'll actually return "__main__.Hello", but you could just look for the "." given that one would expect a method called classname to return the name of the class, and not a class object, this probably works better: def classname(self): return self.__class__.__name__ ... on the other hand, was this really what "alv" asked for? > > >>>from hello import * > > >>>clown = Hello(1) > > >>>clown.classname() > > clown > > > > In other words I want the method to print the name of the object > > that it belongs to which is (nearly) impossible. From skip at mojam.com Fri Feb 18 13:09:11 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 18 Feb 2000 12:09:11 -0600 (CST) Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <88k09b$96f$1@nnrp1.deja.com> References: <38AC9D57.5CC8066C@mincom.com> <88k09b$96f$1@nnrp1.deja.com> Message-ID: <14509.35527.700544.218664@beluga.mojam.com> cpp> This is just a display that you haven't mastered C++. In your C++ cpp> code sample, you on purpose introduced two variables integer cpp> i. The one is the private data member, and the other is the formal cpp> parameter of function member foo. Just because of that you need to use cpp> 'this' to be explicit. Clearly that was a contrived example, but Moshe only wrote it to demonstrate that you can encounter situations in C++ where explicit use of this is required for disambiguation. In large C++ projects it's not all that uncommon to have coding conventions that require the explicit use of "this->" to clearly distinguish references to member data from variables, even when there is no conflict. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From gerrit.holl at pobox.com Thu Feb 17 14:12:53 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 20:12:53 +0100 Subject: Which GUI? In-Reply-To: <14508.12208.365515.624845@weyr.cnri.reston.va.us>; from fdrake@acm.org on Thu, Feb 17, 2000 at 12:28:16PM -0500 References: <38AC0244.C5FA164A@durham.ac.uk> <20000217161727.A1183@stopcontact.palga.uucp> <14508.12208.365515.624845@weyr.cnri.reston.va.us> Message-ID: <20000217201253.A1930@stopcontact.palga.uucp> Fred L. Drake, Jr. wrote on 950786896: > > Gerrit Holl writes: > > I think we really should create an extensive list with all available > > GUI's, with all advantages and disadvantages and a table with info > > like crossplatformness, learning curve... > > I think we can link to it from python.org when you have it ready; > send a note to python-docs at python.org with the URL. > Isn't the volunteerism in this community great? ;) It is; note that I said "we", not "you" or "I". I shall start it, but people need to correct and complete me. regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From aahz at netcom.com Fri Feb 4 13:17:40 2000 From: aahz at netcom.com (Aahz Maruch) Date: 4 Feb 2000 18:17:40 GMT Subject: Special Interest Group: Import redesign References: <1262439853-442703@hypernet.com> Message-ID: <87f544$6jo$1@nntp9.atl.mindspring.net> In article <1262439853-442703 at hypernet.com>, Gordon McMillan wrote: > >As a result of the Developer's Day session on Import Uitilities, >a new SIG (the import-SIG) has been formed. The goal is a >new architecture for the import facility in Python. To what extent is this SIG intended to cover the topics of packages and using a central codestore with DLLs on multiple platforms? (The latter topic is more what I'm personally interested in.) -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From thomas.heller at ion-tof.com Tue Feb 29 13:51:29 2000 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Tue, 29 Feb 2000 19:51:29 +0100 Subject: buffer_info() for arrays but not structs? References: Message-ID: <033301bf82e5$fdc2ffc0$4500a8c0@thomasnotebook> > Is there a reason an array has a buffer_info() method but a struct doesn't? > This would be a nice addition to the struct object. Does anyone know if > there are plans to add this? Probably because a struct is not an object. At least in 1.5. Thomas Heller From jcw at equi4.com Fri Feb 4 15:57:47 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Fri, 04 Feb 2000 21:57:47 +0100 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: <389B3D45.81EF7466@equi4.com> chris patti wrote: [to quote Ivan: bobbit] > One of the reasons for CPAN's success in the Perl world is that, > simply, it's an FTP archive. > > Thus, people can and do mirror it. This creates a multi-site, > persistent cache of the entire library, so when the one site where > module Frobnitz.pm comes from goes down, the world doesn't suffer. > > The Python world needs something similar. > > Another big win in this is that it eases the automated retrieval and > installation of modules, in the Perl world we have CPAN.pm which lets > you say things like: > > install frobnitz > > And it will search the archive, find the latest version, download it > and install it to your local Perl installation. > > Such a thing is _eminently_ possible in Python... > > I have neither bandwidth nor disk to offer, so feel free to have me > publicly tarred and feathered for heresy :) An FTP repository for packages, with an HTTP-based web interface for those who prefer that access mechanism... gee, that's an idea. One could even periodically produce CD-ROM's from such a repository. It's not new, of course (www.cdrom.com?). Nor particularly difficult. Has anyone considered teaming up with the Tcl community and then asking VA Linux (of SourceForge fame :) to consider providing the underlying infrastructure? (No, I won't crosspost, though it would seem logical) Perhaps not. Pythoneers want a Python-specific solution (Trove/Zope?), just like Tcl people and Perl. I seem to be one of the few who fails to see why... -jcw From matz at netlab.co.jp Thu Feb 17 22:38:25 2000 From: matz at netlab.co.jp (Yukihiro Matsumoto) Date: 18 Feb 2000 12:38:25 +0900 Subject: Python misconceptions in IBM Ruby article... References: <38AB8445.DF945829@webone.com.au> <38AC9D57.5CC8066C@mincom.com> Message-ID: <87hff7i3im.fsf@ev.netlab.co.jp> John Farrell writes: |I agree that Python's OO features feel added on. Consider: | | * You have to pass self to each member function. There's no obvious | requirement that self need actually be the bound instance. | * Classes are not types. This strongly suggests that Python had | types other than 'instance' first, and when objects were added, | it was too late to make all types classes. | * In a method, fields of the bound instance need to be referenced | through the self parameter, because the scoping rules do not understand | about instance variables. | * Proper OO languages do not use white space to delimit blocks, | and use semicolons and block delimiters. They are exactly what I had in mind when I started to design Ruby 7 years ago. Well, actually I didn't feel the last one, I just didn't like block by indentation. matz. From gerrit.holl at pobox.com Sat Feb 12 15:29:46 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 21:29:46 +0100 Subject: Except an exception AND all its subclasses? In-Reply-To: <38A5B488.ED170300@bellatlantic.net>; from sholden@bellatlantic.net on Sat, Feb 12, 2000 at 07:28:48PM +0000 References: <20000211220612.A7720@stopcontact.palga.uucp> <20000212103039.A755@stopcontact.palga.uucp> <38A5B488.ED170300@bellatlantic.net> Message-ID: <20000212212946.A5932@stopcontact.palga.uucp> Steve Holden wrote on 950380128: > Gerrit Holl wrote: > > > [about the fact that exception subclassing has > been present in Python since God was a lad] > > > > But I think it should really be mentoined in the tutorial, since I did > > not feel the need to read this in detail after I read the tutorial. > > > > regards, > > Gerrit. > > > > Right. Put everything in the tutorial, that'll make sure it's > completely useless to someone needing ro LEARN Python 8^> Complex numbers are certainly a lot harder than exceptions with subclassing. A single phrase could be enough. > The phrase RTFM comes to mind ... although it's great that you > can do so much with Python WITHOUT digging into the guts of the > documentation. You are absolutly right, I should have read the F[*ucking|ine|ree|lying] manual. But, when I read the first chapter of the reference, I got the feeling that it was not english and doing lawyer-like. So I gave up. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From sholden at bellatlantic.net Tue Feb 22 08:47:10 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 22 Feb 2000 13:47:10 GMT Subject: Amazing what kids can do in concert References: <1260897505-4877907@hypernet.com> Message-ID: <38B29360.ED967688@bellatlantic.net> Gordon McMillan wrote: > >[...] > > Every GUI has an app message queue and a mainloop. Trying > to have more than one of each in one process is similar to > letting one 3 year old work the steering wheel while his friend > works the pedals. > > - Gordon Purely because it amazed and amused me, I cannot help recalling the case of two Scottish kids, aged seven and nine, who "borrowed" a car in the Borders region, and did actually manage to get about eighty miles by doing just what Gordon suggests. Eventually a policeman pulled them over as they were about to cross the Forth bridge, as he thought the driver looked a little young ... These particular kids were residents in a special-care home, and might be assumed to have had an early education in the appropriation and misuse of other people's cars. Never-underestimate-the power-of-collaboration-ly yr's Steve -- "If computing ever stops being fun, I'll stop doing it" From skip at mojam.com Mon Feb 7 15:39:19 2000 From: skip at mojam.com (Skip Montanaro) Date: Mon, 7 Feb 2000 14:39:19 -0600 (CST) Subject: mail filter in python? In-Reply-To: References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207170156.A3609@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> Message-ID: <14495.11639.467461.357073@beluga.mojam.com> Cameron> In any case, I agree with Mr. Wouters: use procmail, and just Cameron> invoke your Python work as an external process. Worth noting that the procmail tips page at http://www.procmail.org/jari/pm-tips.html mentions Lua as a possible replacement for the procmail language (see the end of question 3.5). That item was presumably added about two years ago, so I tend to think it's either very hard to do or didn't generate enough steam in the procmail community. If such a thing was possible with Lua, it would likely be possible with Python as well. Anyone for "pluggable brains"? Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ 847-971-7098 "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From gmcm at hypernet.com Mon Feb 14 21:30:51 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 21:30:51 -0500 Subject: os.shell, recursion, encryption In-Reply-To: <20000215021003.C1D571CD98@dinsdale.python.org> Message-ID: <1261540646-1031083@hypernet.com> 55555 wrote: > os.system() doesn't work and I don't know what mode to use for spawnv. > Thanks again. > > import os > zipExe='c:/progra~1/pkzipdos/pkzip.exe' > os.popen('> '+zipExe+' asdf.zip *.*', 'w') I'm not surprised the system couldn't find an executable named ">.exe". If euro55555 at my-deja.com is a valid email address, then you should have cut & paste out of the MSVC help text for spawnv, since I sent it to you this morning. Otherwise, how long can it take to try all 4 of them? - Gordon From neelk at brick.cswv.com Wed Feb 23 22:36:43 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 24 Feb 2000 03:36:43 GMT Subject: functional programming References: <000801bf7daa$80dde000$51a0143f@tim> Message-ID: Tim Peters wrote: > [Fran?ois Pinard] > >>> What would be the advantages of using a "functional" Python, > >>> as per your definition? I mean, of course, in practice? > > I'll toss one in, since I don't think anybody else mentioned it yet: > functional programs *can* be much easier to reason about. NeelK > nearly said as much in the case of threaded programs, but it applies > to single-threaded programs too. I'll agree with one caveat -- really serious FP'ers use lots of higher order functions, and this can be quite tricky to think about in a dynamically-typed language like Python or Scheme. Not necessarily harder to prove theorems about, but harder to *think* about, if you follow what I mean. IME, Haskell and ML programers tend to use more HO functions than Schemers, because they can use their nifty type systems as a ladder to build up higher-order functions. But of course any statically- decidable type system must reject some perfectly good programs, so it's not pure win. OTOH, for any program where you don't need more than 2nd order functions [*], then FP *is* pure win. This is closely analgous to the observation that OO with classes is a pure win over procedural languages, but that metaclasses give people headaches. The analogy can be made rigorous with the correspondence between closures and objects, and this will of course show the points where my observation breaks down. (The times when metaclases are the right thing in an OO language correspond closely to the times when making functions that return functions that return functions is the right thing in an FP language.) > Not long ago Billy mentioned an especially pure functional > language called Joy, and reading the Joy papers should give a quick > feel for how powerful and natural reasoning can be in a language > aiming at that. OTOH, Joy is useless . IMO, it's the endpoint of the strongly-typed FP mafia's approach, carried to its logical limit -- every Joy progam will terminate, at the cost of the language's Turing-completeness. I *was* shocked by just how much Joy *can* do: it pretty much sold me on the idea that embedding Joy-style "extremely-pure" sublanguages in bigger ones is a Good Idea. [*] I mean every function either returns a non-function value, or returns a function that returns a non-function value. This is second order, right? Neel From gregm at iname.com Tue Feb 22 08:10:05 2000 From: gregm at iname.com (Greg McFarlane) Date: Wed, 23 Feb 2000 00:10:05 +1100 Subject: Inter process communication using Tk/send hangs on suspended processes In-Reply-To: <14509.6815.70098.462099@temoleh.chem.uu.nl>; from Rob W. W. Hooft on 18 Feb 2000 at 11:10:39AM References: <20000216225453.06891@nms.otc.telstra.com.au> <14509.6815.70098.462099@temoleh.chem.uu.nl> Message-ID: <20000223001005.14713@nms.otc.telstra.com.au> On 18 Feb, Rob W. W. Hooft wrote: > >>>>> "GM" == Greg McFarlane writes: > GM> On 15 Feb, Rob W. W. Hooft wrote: > >> I have a group of python programs. Whenever any new program is > >> started, it will try to establish connections to each of the other > >> ones using Tk/send (it is asking each for their background color, > >> and will choose a new one for itself). > > GM> The only things I can think of are to fork separate processes to > GM> do each send and kill them if they do not respond quickly. > > That doesn't work, as this will result in X requests that arrive > out-of-order. As far as I know, no 2 processes can share their X > socket connection. I guess I'll have to investigate the "server" > concept. That is only true if you fork without exec'ing and are not careful about closing the inherited file descriptors. What I meant was to fork *and exec* another process, passing in information like the X display using the command line arguments. -- Greg McFarlane INMS Telstra Australia gregm at iname.com From boncelet at ee.adfa.edu.au Thu Feb 24 23:22:30 2000 From: boncelet at ee.adfa.edu.au (Boncelet Charles) Date: Fri, 25 Feb 2000 15:22:30 +1100 Subject: Numpy: inverse of take? Message-ID: <38B60386.D464417@ee.adfa.edu.au> I want to do the following in numpy: #i=large data file (a digital image converted from PIL) #l = list of pixels in which I am interested p = take(i,l) #extracts the pixels I want #(do something with these pixels, then) i = inverse_take(i,p,l) #put them back where they were This is the step I can't figure out. Obviously I can do it with a simple python loop, but i and l are big and I'd like to do it quickly. (The python loop may be quick enough anyway, but out of principal, I like to avoid python loops when doing numpy work.) Any suggestions? ------ Charles Boncelet, University of Delaware, On sabbatical at ADFA, Canberra Australia, Home Page: http://www.ece.udel.edu/~boncelet/ From embed at geocities.com Thu Feb 24 09:47:12 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 24 Feb 2000 09:47:12 -0500 Subject: Microthreads and Stackless Python (was "Phython ...") References: <20000222211406.41743.qmail@hotmail.com> <891g7l$cf8$1@nnrp1.deja.com> Message-ID: > This is exactly the sort of thing I had in mind for microthreads. > You can read about it at http://world.std.com/~wware/uthread.html > and find code at ftp://ftp.std.com/pub/wware/uthread.tgz. You'll > notice a few different versions with dates; if you run into trouble > try one of the older ones. It seems to me that this is a case in point for the superiority of the stackless-python approach and for the merging of Stackless+Continuations back into the main Python code base [2.0?] The combined strength of these two approaches would make Python a killer langauge for embedded *and* realtime users. "Embedded Java" is 99% hype, but Python could really happen! This is exciting stuff. Hey Guido, are you listening? ;-) Warren From embed at geocities.com Mon Feb 14 10:00:13 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 14 Feb 2000 10:00:13 -0500 Subject: BSDDB copyright and licensing restrictions while in use via Python Message-ID: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> I am reading over the BSDDB license (bsddb is owned by sleepycat software) and it appears that you can't compile and link the source code to the BSDDB to a proprietary (non-free) application without paying Sleepycat. Fine, no problem. Then I checked out their prices. Can you say $10K and up? Excuse me!? So here's my dilemma: I have a commercial application into which I want to embed the Python interpreter (fine, no problem so far). The standard Python distribution comes with the bsddb.pyd binary which is a plug in containing a compiled version of the db1.8.5 source code. Since Python is available for free, and is open source, and it can be redistributed freely, then can I do this? Has the db1.8.5 source code a more liberal license than the 2.0 code from Sleepycat? Can I legally embed Python into my commercial application, use a stock bsddb.pyd binary file giving me the BSD DB functions to store my data, which is still being used exactly as it would have been used in Python, and then add commercial proprietary extensions to Python (some as .pyd plug ins, and some compiled right into the main executable) and yet still not have violated the letter of the BSDDB license? I'd ask SleepyCat this question, but I suspect they are smoking too much cheap weed over there if they think that someone will pay thousands of dollars for a license to software which they also allow you to freely download the source code to. What a strange company. A second query, can I avoid all this and use a workalike library from somewhere else? Is there a BSD-licensed bsddb library? Warren Postma From Denys.Duchier at ps.uni-sb.de Thu Feb 3 16:05:53 2000 From: Denys.Duchier at ps.uni-sb.de (Denys Duchier) Date: 03 Feb 2000 22:05:53 +0100 Subject: Van Rossum's Book of Practical Hacks (was: Eight suggestions for Python books (long)) References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> Message-ID: > I would kill for a Python cookbook/algorithm book!! Let's hear it for: "Van Rossum's Book of Practical Hacks" His ineffable effable effanineffable deep and inscrutable singular name-ly y'rs :-) -- Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de Forschungsbereich Programmiersysteme (Programming Systems Lab) Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier Postfach 15 11 50 Phone: +49 681 302 5618 66041 Saarbruecken, Germany Fax: +49 681 302 5615 From jesse at student.usyd.edu.au Wed Feb 9 06:22:55 2000 From: jesse at student.usyd.edu.au (Jesse Sweeney) Date: Wed, 09 Feb 2000 22:22:55 +1100 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <87rc79$chc$4@mach.vub.ac.be> Message-ID: On Wed, 09 Feb 2000 11:19:54 +0100 (MET), Mikael Olofsson wrote: [snip] >I would actually prefer that the interpreter regarded mixed tabs/spaces >indentation as an error, or at least that it produced a warning. The best >thing IMO would be if the interpreter only accepted one of these >indentation tokens, preferably tabs I think. If that was the case, then >these discussions would be less frequent, and we could concentrate on the >beauty of indentation. However, as I understand things, there is already >a lot of code out there with mixed tabs/spaces indentation. So, for the >sake of backwards compatibility, I guess we will have to live with an >interpreter that is sloppy in this respect. Or, just use 'python -t' or 'python -tt'. Or tabnanny.py, or tabpolice.py, or tabcleaner.py, or untabify.py. Pick your poison!, Jesse. From tim.lavoie at mts.net Thu Feb 17 16:32:07 2000 From: tim.lavoie at mts.net (Tim Lavoie) Date: Thu, 17 Feb 2000 21:32:07 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38AC50B2.3FAF778@sage.att.com> Message-ID: In article <38AC50B2.3FAF778 at sage.att.com>, Garrett G. Hodgson wrote: >glue an inverted thumbtack to your ";" key. >if that doesn't work, coat it with poison, >or maybe LSD. > > >-- >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 Oh sure, LSD will *HELP* your coding. That must be amusing later. So what exactly happens at "Software Innovation Services"? :-) From gerrit.holl at pobox.com Mon Feb 14 09:12:51 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 15:12:51 +0100 Subject: Graphic-Library for Screensavers In-Reply-To: <38A71E67.B771E1B1@gmx.net>; from bela_b@gmx.net on Sun, Feb 13, 2000 at 10:13:11PM +0100 References: <38A71E67.B771E1B1@gmx.net> Message-ID: <20000214151251.B658@stopcontact.palga.uucp> Bela Bauer wrote on 950476391: > Hi, > > do you know any easy to use graphics library able to write screensavers > (especially for Linux)? Of course it would be good to have the > possiblity of processing 3D, but first I just want to print color text. There is an interface to OpenGL, search for it on Parnassus(*). I'm sure you'll find it there, it's crossplatform. Almost all screensavers are written in OpenGL. Since I don't have any experience with it, I don't know wheter or not it's easy. (*) http://www.vex.net/~x/parnassus/ -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From doyen at mediaone.net Tue Feb 29 22:11:21 2000 From: doyen at mediaone.net (doyen at mediaone.net) Date: Wed, 01 Mar 2000 03:11:21 GMT Subject: coding random selection from list Message-ID: <38BC8829.A99D1E74@mediaone.net> def returnname(list): return list[random.randint(0,(len(list)-1))] # returns a random selection from a list It seems to work, is it correct and efficient? doyen at mediaone.net From m.faassen at vet.uu.nl Thu Feb 10 00:43:25 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 10 Feb 2000 05:43:25 GMT Subject: Python and Klingons References: <38A1AACB.8A5D0933@callware.com> Message-ID: <87tj5t$ngs$2@newshost.accu.uu.nl> Ivan Van Laningham wrote: > Hi, All-- > Found at: > http://public.logica.com/~stepneys/joke/klingon.htm > 15. Python? That is for children. A Klingon Warrior uses only machine > code, keyed in on the front panel switches in raw binary. Odd -- I'm a klingon spy (at least some of my friends say this), and I use Python. No-I-don't-look-like-a-klingon-but-Tim-Peters-IS-invisible-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From tismer at tismer.com Tue Feb 15 10:24:33 2000 From: tismer at tismer.com (Christian Tismer) Date: Tue, 15 Feb 2000 16:24:33 +0100 Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> <88bleg$chl$1@nnrp1.deja.com> Message-ID: <38A96FB1.E7DEA50@tismer.com> Howdy, Andrew Cooke wrote: > > In article <000001bf768e$48e40580$45a0143f at tim>, > "Tim Peters" wrote: > > def traverse_post(self): > > for child in self.left, self.right: > > if child is not None: > > suspend child.traverse_post() > > suspend self.data > > That finally hammered home to me just what continuations are all about. > Does anyone have something similarly elegant that shows a coroutine? > I've just had a look at the stackless python documentation and > coroutines seem to be described as something coming out of a single > detailed example. Is there a simpler definition? (I did look back > through some posts on Deja, but there was nothing recent that seemed to > explain what a coroutine actually is - sorry if I've missed something > obvious). What did you read, actually? Here some pointers: Homepage: http://www.tismer.com/research/stackless/ IPC8 paper: http://www.tismer.com/research/stackless/spcpaper.htm Slides: http://www.tismer.com/research/stackless/spc-sheets.ppt The latter gives you a bit of understanding what a continuation is. Tim Peters about coroutines can be found here: http://www.tismer.com/research/stackless/coroutines.tim.peters.html More on coroutines by Sam Rushing: http://www.nightmare.com/~rushing/copython/index.html On Scheme, continuations, generators and coroutines: http://www.cs.rice.edu/~dorai/t-y-scheme/ Revised Scheme 5 report: http://www.swiss.ai.mit.edu/~jaffer/r5rs_toc.html The following books are also highly recommended: - Andrew W. Appel, Compiling with Continuations, Cambridge University Press, 1992 - Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes, Essentials of Programming Languages, MIT Press, 1993 - Christopher T. Haynes, Daniel P. Friedman, and Mitchell Wand, Continuations and Coroutines, Computer Languages, 11(3/4): 143-153, 1986. - Strachey and Wadsworth, Continuations: A mathematical semantics which can deal with full jumps. Technical monograph PRG-11, Programming Research Group, Oxford, 1974. I don't think this is easy stuff at all, and you can't expect to find a simple answer by skimming a couple of web pages. It took me a lot of time to understand a fair part of this, and this is also a showstopper to get this stuff to be used. > Also, comp.lang.lisp is currently dissing continuations. Would that be > because the alternative is to pass the code that will process the node > into the iterator as a (first class) function? Obviously, in this case, > yes, but is that true in general (are there examples where continuations > or coroutines make something possible that really is tricky to do in > other ways)? An iterator is quite an easy thing, and it can be implemented without continuations rather easily. Continuations cover problems of another order of magnitude. It is due to too simple examples that everybody thinks that coroutines and generators are the only target. Continuations can express any kind of control flow, and they can model iterators, coroutines and generators easily. The opposite is not true! I know this isn't enough to convince you, but at the time I have no chance. I need to build some very good demo applications which use continuations without exposing them to the user, and this is admittedly difficult. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 sabren at manifestation.com Wed Feb 9 11:46:26 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 9 Feb 2000 11:46:26 -0500 Subject: A = X > Y ? X : Y References: <38A0BD01.9586107B@be-research.ucsd.edu> Message-ID: <87s5lq$j93$1@nntp3.atl.mindspring.net> Curtis Jensen wrote in message <38A0BD01.9586107B at be-research.ucsd.edu>... >I fear that this question has already been asked, but is there and >equivalant one line command that is equivalant to the C command: > >a = x > y ? x : y I know there's been a couple replies to this... but why not do something like VB's (or at least VBA's - not sure if VB proper has it) "immediate If" function? def iif( condition, first, second ): result = second if condition: result = first return result then it's: a = iif( a > y, x, y ) -michal http://www.sabren.com/ From scarblac-spamtrap at pino.selwerd.nl Wed Feb 16 11:19:27 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 16 Feb 2000 16:19:27 GMT Subject: Moving from perl to python: questions References: Message-ID: Mikael Olofsson wrote in comp.lang.python: > Hmm. Your indentation ended up corrupted here. I guess you meant: Yup. I'm fighting my editor a bit today. The old tab/space mixing problem. Python editor mode does the right thing now, but the Text mode isn't working nicely with Python yet :(. -- Remco Gerlich, scarblac at pino.selwerd.nl Hi! I'm a .sig virus! Join the fun and copy me into yours! From mike.zaharkin at westgroup.com Mon Feb 14 15:00:55 2000 From: mike.zaharkin at westgroup.com (MikeZ) Date: Mon, 14 Feb 2000 15:00:55 -0500 Subject: Python tkinter question Message-ID: <38a85efa@wwwproxy3.westgroup.com> Hello, I am interested in creating a text control in tkinter and then allow the user the highlight an area of text in this control. I am having a problem trying to figure out how to get the text that was highlighted by the user. Is there an event and/or method that I can use from the text control. I hope this is easy, I am new to using tkinter. Thanks in advance, -Mike Z. From egbert at bork.demon.nl Mon Feb 14 14:32:06 2000 From: egbert at bork.demon.nl (Egbert Bouwman) Date: Mon, 14 Feb 2000 20:32:06 +0100 Subject: eff-bot In-Reply-To: <042401bf76ec$d58b5160$01ffffc0@worldnet.att.net>; from Emile van Sebille on Mon, Feb 14, 2000 at 05:10:13AM -0800 References: <38A7A95C.B009BCC6@kw.igs.net> <20000214141846.A1297@bork> <042401bf76ec$d58b5160$01ffffc0@worldnet.att.net> Message-ID: <20000214203206.A747@bork> Thank you all for educating me on the effbot. Hopefully I will allways be a normal healthy boy, and never become an egbot. egbert. -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From jerryjerry at aol.com Thu Feb 3 10:54:03 2000 From: jerryjerry at aol.com (JerryJerry) Date: 03 Feb 2000 15:54:03 GMT Subject: embeding python in C++ ?? References: Message-ID: <20000203105403.04628.00000136@ng-cv1.aol.com> Jody, Thanks for responding. Where would I find your reference to extending and embedding documentation? Jerry From mhammond at skippinet.com.au Tue Feb 22 17:22:01 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 22 Feb 2000 22:22:01 GMT Subject: msvcrt, open_osfhandle, locking References: Message-ID: "Roger Baklund" wrote in message news:tvCs4.5103$kz6.96338 at news1.online.no... > I'm trying to use msvcrt.open_oshandle() to get a handle so I can lock a > file using msvcrt.locking(), but it won't work. That is becuase you dont need to :-) > I keep getting "TypeError: illegal argument type for built-in operation". open_osfhandle() is used to get a file object back for a Win32 integer file handle. The locking module works directly with file object - no need to deal woth OS handles at all. Mark. From grant at nowhere. Tue Feb 1 18:13:51 2000 From: grant at nowhere. (Grant Edwards) Date: Tue, 01 Feb 2000 23:13:51 GMT Subject: Charts References: <3890C74D.786411BC@acm.org> Message-ID: In article , Jeff Blaine wrote: >I had this very same need recently. I got all excited about the Gnuplot >module until I found out that it requires the Numeric C extension to Python. >Was immediately disinterested, as I saw no reason for a pipe-based wrapper >to require a C extension. > >I ended up doing the following > > [ ... snip ... ] > # Create a data file here with the full path stored in 'tmpfilename' > gnuplot = os.popen('gnuplot', 'w') > gnuplot.write('set terminal gif\n') > gnuplot.write('set output "' + myfilename + '"\n') > gnuplot.write('set format "%.0f"\n') > gnuplot.write('plot "' + tmpfilename + '" with lines\n') > gnuplot.flush() > gnuplot.close() > [ ... snip ... ] If you want, you can send the data down the pipe instead of creating a tempfile. From the gnuplot help help on plot special-filenames: `'-'` is intended for situations where it is useful to have data and commands together, e.g., when `gnuplot` is run as a sub-process of some front-end application. Some of the demos, for example, might use this feature. For example: plot '-','-' 2 4 6 e 10 12 14 e >From the Python end, this would be something like: gnuplot.write('plot "-" with lines\n') gnuplot.write(dataString) # data with a newline after each point gnuplot.write('e\n') -- Grant Edwards grante Yow! I feel like a wet at parking meter on Darvon! visi.com From bestvina at math.utah.edu Wed Feb 23 14:28:52 2000 From: bestvina at math.utah.edu (Mladen Bestvina) Date: Wed, 23 Feb 2000 12:28:52 -0700 Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <38B40EBD.13EC1C1E@math.utah.edu> <38B417B2.C03EEC3B@math.utah.edu> <80Vs4.7659$al3.101405@newsc.telia.net> Message-ID: <38B434F4.987A5750@math.utah.edu> Fredrik Lundh wrote: > > Mladen Bestvina wrote: > > Fredrik Lundh wrote: > > > > > > Tkinter as distributed with Python 1.5.2 does *not* work with > > > Tk 8.1 and later. either use 8.0.5, or get patches from here: > > > > I have Tk 8.0.5: > > > > mladen at drava:/home/mladen/projects/grayson > wish > > % info library > > /usr/local/lib/tcl8.0 > > % > > well, that only means that wish was linked against 8.0, > not that _tkinter.so is linked against it... > > but alright, try setting TK_LIBRARY and TCL_LIBRARY to > point to the configuration files, e.g: > > % export TCL_LIBRARY=/usr/local/lib/tcl8.0/library > % export TK_LIBRARY=/usr/local/lib/tk8.0/library > That didn't make any difference. Mladen From a.serier at hccnet.nl Wed Feb 9 16:59:02 2000 From: a.serier at hccnet.nl (a.c.a. serier) Date: Wed, 9 Feb 2000 22:59:02 +0100 Subject: perl chomp equivalent in python? Message-ID: <87snvk$f2i$1@news.hccnet.nl> Hello, I have the following problem with lines read with readline. How to remove the newline at the end? Perl has chomp() to do this. In this case use split to split up the line, but the last item has a newline at the end. I tried both split and replace(line, '\n', '') without result. Can't find anything in tutorial, lib ref and FAQ. Thank in advance, Kees From skip at mojam.com Wed Feb 16 11:32:20 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 16 Feb 2000 10:32:20 -0600 (CST) Subject: Subclassable C Extension In-Reply-To: References: Message-ID: <14506.53524.931405.880938@beluga.mojam.com> Joel> How does one write a subclassable C extension? I've written C Joel> extensions, but can't seem to figure out how to make it Joel> subclassable. I've tried using the CXX files from Joel> somewhereoranother, but that seems to GPF/coredump. I'll take Joel> examples, URL's to examples, or whatever. Thanks. You can't subclass types defined in vanilla extension modules. Check out Digital Creations' ExtensionClass module, available as part of Zope (http://www.zope.org/). Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From gmcm at hypernet.com Tue Feb 22 08:09:35 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 22 Feb 2000 08:09:35 -0500 Subject: Can't run FOX test scripts from the pythonwin env ... ??? In-Reply-To: <88te71$ra5$1@bw107zhb.bluewin.ch> Message-ID: <1260897505-4877907@hypernet.com> Markus Meng wrote: > > I just wonder if somebody else has the same problem. I tried > all the test scripts for NT using python 1.52 and the test scripts > from FXPy/test directory by "double clicking" on the python script > files. Everything works as expected. However when I load a python > script into pythinwin and want to make it running from there everything > crashes... > > any idea? Yeah. Don't do that. Every GUI has an app message queue and a mainloop. Trying to have more than one of each in one process is similar to letting one 3 year old work the steering wheel while his friend works the pedals. - Gordon From gerrit.holl at pobox.com Tue Feb 22 14:33:52 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 22 Feb 2000 20:33:52 +0100 Subject: Life's better without braces In-Reply-To: ; from moshez@math.huji.ac.il on Tue, Feb 22, 2000 at 08:57:07AM +0200 References: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: <20000222203352.A4193@stopcontact.palga.uucp> > On Mon, 21 Feb 2000, Gerrit Holl wrote: > > > Hello all, > > > > I have a problem. In my Python enthuishasm, I ripped off the braces > > from my keyboard because I thought I didn't need them. > > Unfortunately, I have a problem now. I can't create dictionairies any > > more! And because braces aren't the only keys on the brace key, > > I can't create lists either. The solution for the latter is list(()), > > but how do I create an empty dictionairy without braces? > > >>> import UserDict > >>> a=UserDict.UserDict().data > >>> a > {} Ah, thanks! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From alex at somewhere.round.here Tue Feb 8 22:17:14 2000 From: alex at somewhere.round.here (Alex) Date: 08 Feb 2000 22:17:14 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> Message-ID: > For example, when doing matrix computations reordering the operations > can save enormous amounts of memory and time; teaching CL to > transparently find good multiplication orders for matrices is a > straightforward project of a week or so for a single Lisp hacker. The > comparable effort in C++ is staggering; look at the Blitz++ libraries > for how much work it takes. (And it's not even possible in Java.) What aspect of Java prevents makes this sort of programming impossible? Alex. From deathbed_tech at usa.net Sat Feb 12 17:11:22 2000 From: deathbed_tech at usa.net (osorronophris osorronophris) Date: Sat, 12 Feb 2000 17:11:22 -0500 Subject: breaking the ; habit Message-ID: <38a5d928@news.isc.rit.edu> I'm a die-hard C++ programmer that recently took up Python for a change of scenery and am enjoying it greatly. The one problem I am having is that I can't break myself of the semicolon habit. I've tried chewing gum but it just doesn't seem to work, and I'd like to avoid the patch. Any ideas? Regards, Ryan From jamarijr at hotmail.com Mon Feb 14 09:25:32 2000 From: jamarijr at hotmail.com (Arinte) Date: Mon, 14 Feb 2000 14:25:32 GMT Subject: Writing escape sequences References: <885hg6$7it$1@nnrp1.deja.com> <885q2r$uob$1@nntp9.atl.mindspring.net> Message-ID: <88938o$i6k$1@nnrp1.deja.com> Guess I forgot to say this is for python embedded in a C++ program. Sent via Deja.com http://www.deja.com/ Before you buy. From gmcm at hypernet.com Mon Feb 7 11:58:26 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 7 Feb 2000 11:58:26 -0500 Subject: const in Python In-Reply-To: Message-ID: <1262179804-3408142@hypernet.com> Anders M Eriksson writes: > > Would someone please explain why there isn't a const 'operator' in > Python! For the same reason that there's no private, protected stuff. Python is based on the trust model, which keeps the language simple. And it works pretty well, since programmers are generally well behaved, except, of course, in the presence of cheese. > Very often I have constants in my code and it would be nice if Python > could check that someone (.I.) don't change them! If you are truly concerned, you could make them attributes of a class that prohibits setattr. But generally naming "constants" in all upper case is enough to tell a Pythonista that it shouldn't be modified. - Gordon From jeff at jobsoverip.com Wed Feb 2 20:05:45 2000 From: jeff at jobsoverip.com (Jeff) Date: Wed, 2 Feb 2000 17:05:45 -0800 Subject: Senior Python position in Austin Message-ID: SENIOR SCRIPT LANGUAGE PROGRAMMER We are searching for an enthusiastic and talented Senior Script Language Programmer to work on a hot, massively multiplayer, persistant universe, online computer game. This individual will be contributing to the architecture of the next generation of online gaming. The successful candidate will be able to demonstrate the following: Requirements: 5+ years programming experience. Extensive knowledge of script language architectures and compiler designs Extensive knowledge of script languages such as Python and Java. Must be capable of programming in them and identifying advantages and disadvantages of each Knowledge of Unix and Win32 based platform programming Knowledge of multi-threaded and multi-tasked programming in a large-scale environment Ability to identify and address technical game play issues Experience working in a team structured environment Must be guided by the true tenets of software engineering as related to design, coding practices, API documentation, etc. Pluses: Ideal: Experience programming multi-player games Experience programming Artificial Intelligence routines Experience in the games industry. Love of massively multiplayer gaming. Strong background in C++ / Object Oriented Programming From moshez at math.huji.ac.il Sat Feb 12 12:46:03 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 19:46:03 +0200 (IST) Subject: Where is glob ? In-Reply-To: <20000212141310.A798@bork> Message-ID: On Sat, 12 Feb 2000, Egbert Bouwman wrote: > In Python 1.5.1 (debian slink) the command > >>> import glob > gives: > ImportError: No module named glob > However the module is mentioned in the library reference. > The same thing happens with fnmatch. > Is there any particular reason for these absences ? > egbert If you still have the .deb, see if you can see any mention of a file named "glob.py" inside it. If not, then, as much as I love debian, they screwed up. In any case, I'm of the firm (if unpopular) opinion that installing Python from the sources is very easy and usually much better for Linux users. But then again, my production Python is ~ the latest CVS version, so you might not want to listen to me. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tolot at utolot.toppoint.de Fri Feb 18 17:05:07 2000 From: tolot at utolot.toppoint.de (Marc Christiansen) Date: Fri, 18 Feb 00 23:05:07 +0100 Subject: shelve broken on redhat 6.1 References: <14509.30348.497476.963635@beluga.mojam.com> Message-ID: Skip wrote: > There was a problem with whichdb.py in the 1.5.2 distribution that would > cause anydbm, shelve and other packages that rely on anydbm to fail if > anydbm tried to use bsddb and the libdb implementation underlying bsddb was > version 2.x. whichdb.py did not correctly detect version 2.x hash files. > This has been fixed in the CVS repository. > > Please try updating whichdb.py before reporting a bug. You can pick up the > latest version from > > http://www.musi-cal.com/~skip/python/Python/Lib/whichdb.py Well, as I recently found out (being without any *db), there is another problem with whichdb.py: It does not recognize the dumbdbm format. The following patch is against the version from your page: ---------------- --- whichdb.py Fri Feb 18 21:46:57 2000 +++ whichdb.py.new Fri Feb 18 21:47:23 2000 @@ -25,6 +25,16 @@ except IOError: pass + # Check for dumbdbm -- this has a .dat and a .dir file + try: + f = open(filename + ".dat", "rb") + f.close() + f = open(filename + ".dir", "rb") + f.close() + return "dumbdbm" + except IOError: + pass + # See if the file exists, return None if not try: f = open(filename, "rb") ---------------- If the patch is ok, you can submit it. Or should I do it? Ciao Marc From fdrake at acm.org Thu Feb 17 18:20:12 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 Feb 2000 18:20:12 -0500 (EST) Subject: wxPython book??? In-Reply-To: References: Message-ID: <14508.33324.45637.954517@weyr.cnri.reston.va.us> Robert Hicks writes: > A "Learning wxPython" or "Programming wxPython" book would be an outstanding > edition to the Python community. I think a book of this type "could" push > wxPython into the Python limelight. Plus as a Python neophyte...I need to I'd love to see such a book. How soon can you have a draft ready? I know a few publishers are looking for Python authors these days! -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From jnc at ecs.soton.ac.uk Mon Feb 7 05:29:45 2000 From: jnc at ecs.soton.ac.uk (John Carter) Date: Mon, 07 Feb 2000 10:29:45 GMT Subject: nonlinear programming? References: <87l1oa$g88$1@nnrp1.deja.com> Message-ID: <389e9e63.2181624@news.ecs.soton.ac.uk> Sounds like you need to look at the threads package. John Carter jnc at ecs.soton.ac.uk On Sun, 06 Feb 2000 23:56:59 GMT, jeremiahrogers at my-deja.com wrote: >is there a way for me to start on a function, then >move onto another function before that function >ends? I am working on an mpg123 frontend, and i >want to start a song playing, then allow the user >to either skip that song, or perform other >essential tasks during the time when a song is >playing. is this possible? > > >Sent via Deja.com http://www.deja.com/ >Before you buy. From msabin at cdc.net Tue Feb 29 22:59:20 2000 From: msabin at cdc.net (Mike Sabin) Date: 1 Mar 2000 03:59:20 GMT Subject: X gurus? Message-ID: I am beginning a small project which I am afraid may have to end up being written in C (I say afraid, because I will have to LEARN C first, if this is the case). I am programming for the X Windows environment on Linux, and need to accomplish the following two things: 1. At a certain time, I need to get the x-y coordinates of my mouse pointer, no matter where my pointer is at the time (it could be over the window for some other application, but I want a function call to return the coordinates to my application) 2. At a certain time, I need to artificially generate a button 1 mouse click, whereever the mouse pointer is currently located (e.g. over another application's window). My program must do this, without me actually having to click on the mouse or hit any key. Can it be done in python? I actually don't have much hope that it can, but I am often surprised what some of you people will come up with around here.... Mike Sabin From andy at reportlab.com Fri Feb 18 11:27:54 2000 From: andy at reportlab.com (Andy Robinson) Date: Fri, 18 Feb 2000 16:27:54 GMT Subject: ANN: ReportLab - PDF Reporting Tools in Python Message-ID: <38b072b9.10971406@post.demon.co.uk> ReportLab, Inc. (http://www.reportlab.com/) is a new company formed on January 21st to develop a new generation of reporting tools for the web and print. The team includes Andy Robinson (CEO and Chief Architect), Aaron Watters (Chief Technical Officer), Robin Becker (Quantitaive Analyst) and Gordon McMillan (Technical Consultant). ReportLab has seed capital and its first customer, and is opening offices in New Jersey and London. The core product is the ReportLab PDF library (formerly known as "pdfgen"). This can be used for - dynamic PDF reporting in real time on the Web - back office forms generation and database reports - adding a cross-platform 'Print Preview' capability to applications - electronic publishing In addition to this, the company has strong general expertise in all aspects of Python development, and will be working on data acquisition and transformation tools, and platform independent graphics solutions. Unlike other PDF generation libraries, ReportLab is intended to go beyond the 'Canvas' level to handle page layout with flowing text and frames, and XML-to-PDF conversion. ReportLab is, and will remain, 100% Open Source. It runs now, but we are seeking intensive feedback on the page layout API over the next few weeks from as wide a developer base as possible before 'freezing' the API. And of course there are many, many more features to add. The company is planning to generate revenue from consulting, service, support and training. There are two main forks to the plan: - an Open Source strategy aimed at making ReportLab a pervasive standard - developing an integrated commercial "Enterprise Reporting Engine" for portals and financial institutions To this end we will be working with 2-3 strategic customers over the next six months. The support arrangements are as follows: 1. The ReportLab library (formerly known as pdfgen) is available from http://www.reportlab.com/ 2. The latest development code is under CVS at http://reportlab.sourceforge.net 3. The mailing list for all discussion is reportlab-users at egroups.com. Go to http://www.egroups.com/group/reportlab-users to sign up. Andy Robinson CEO, ReportLab Inc. From tim_one at email.msn.com Thu Feb 24 20:50:19 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 24 Feb 2000 20:50:19 -0500 Subject: Simple example of threading In-Reply-To: Message-ID: <000d01bf7f32$ab919380$b62d153f@tim> [ Dirk Vleugels] > ... > Sadly, pthread_cancel is missing in python, dunno why. Simply because Python supports a platform-independent model of threading, built on top of a large variety of "native" thread offerings, and thread cancelling is a dubious enough feature that many platform thread pkgs don't support it. Python can't "fake it" portably either, so tough beans . alternatives-left-to-the-fertile-imagination-ly y'rs - tim From tbryan at python.net Wed Feb 2 23:03:39 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 02 Feb 2000 23:03:39 -0500 Subject: installation error: version 1.5.2 on Unix References: Message-ID: <3898FE1B.16E6753E@python.net> Yueqiang Huang wrote: > > The error message is > > gcc python.o \ > ../libpython1.5.a -lsocket -lnsl -ldl -lm -o python > Undefined first referenced > symbol in file > Py_Main python.o > ld: fatal: Symbol referencing errors. No output written to python > *** Error code 1 > make: Fatal error: Command failed for target `link' > > Any idea? Thanks in advance! Was this your first try at running make, or had you already run make once before? If the Python build proceeds far enough, it will leave some garbage around that will cause subsequent makes to fail. The solution in that case is to run 'make clobber' before building. Note that 'make clean' won't solve the problem. If you also want to reconfigure, you should use 'make distclean'. Please tell me if that helps. I wrote a FAQ entry on make clobber after I wasted nearly a day trying to make Python compile with a half-built libpython1.5.a lying around that I didn't notice at first. I had run 'make clean', but that didn't get rid of the faulty library. ---Tom From poinot at onera.fr Tue Feb 15 03:31:32 2000 From: poinot at onera.fr (Marc POINOT) Date: Tue, 15 Feb 2000 09:31:32 +0100 Subject: How to transmit arguments from c++ to python References: <88adoe$itp$1@news.ihug.co.nz> Message-ID: <38A90EE4.19EA1ABA@onera.fr> Bing Chen wrote: > > Hi, All > Many thanks you guys tell me how to transmit arguments from my c++ > application to python program? Have a look at CXX extensions. There is a very nice mapping of the ISO C++ types and Python. http://xfiles.llnl.gov/python.htm Marcvs [alias This package is somewhat hard to compile, you will require a ISO compliant compiler (SGI is)] From anders.eriksson at morateknikutveckling.se Mon Feb 14 04:35:47 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 14 Feb 2000 10:35:47 +0100 Subject: Tkinter manual!! References: <389CD4A6.DA550F53@americasm01.nt.com> <20000212113935.C1007@stopcontact.palga.uucp> Message-ID: On Sat, 12 Feb 2000 12:18:18 GMT, "Fredrik Lundh" wrote: >Gerrit Holl wrote: >> I think it should be published in the original Docbook format too, since >> people can generate their favorite format AND contribute to the manual >> than. > >given that I hear far more complaints than thank >you's, it's more likely that I will stop distributing >the acrobat version. > I would like to say that the silent majority probably like your efforts and are gratefull that there is an acrobat version. Poeple that can't configure acrobat maybe shouldn't complain so much ;-) // Anders From J.C.Travers at durham.ac.uk Sun Feb 13 13:06:27 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Sun, 13 Feb 2000 18:06:27 +0000 Subject: [Fwd: Re: Python binaries as zip archive] Message-ID: <38A6F2A3.FE27C765@durham.ac.uk> Jeff Bauer wrote: > > What's preventing you from using WinZip to > extract the binaries out of the .exe file? On the system I use at university, we only have wiz, and are not alloowed to install winzip. I did try this with whiz, and got all of the stuff dumped in one directory with overwrites etc.. Just a plain zip archive would be much simpler. (or gzip/tar) John From moshez at math.huji.ac.il Sun Feb 27 03:41:49 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 10:41:49 +0200 (IST) Subject: Q about tail recursion In-Reply-To: <000601bf80fb$bbabac40$172d153f@tim> Message-ID: On Sun, 27 Feb 2000, Tim Peters wrote: > And if a def is sometimes meant to return a value and > sometimes not, redesign the code before you drive yourself insane . I've thought about writing a small utility to warn me about such functions, which should be easy enough: either all or none of "RETURN_VALUE" opcodes should be preceded by LOAD_CONST of None. Would such a scheme work? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From moshez at math.huji.ac.il Thu Feb 24 08:12:55 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 24 Feb 2000 15:12:55 +0200 (IST) Subject: Readline In-Reply-To: Message-ID: On Thu, 24 Feb 2000, Marlon Jabbur wrote: > hi list, hello tuple > i'm looking for a readline module in python, i'm planning to do a > application that open a shell > and behave like bash. > > Anyone knows if this module already exists???? Yes. Try "import readline". (Python needs to be compiled with the GNU readline llibrary for this to work) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From lvirden at cas.org Fri Feb 4 00:19:55 2000 From: lvirden at cas.org (lvirden at cas.org) Date: 4 Feb 2000 05:19:55 GMT Subject: glob in tcl/tk drops first char References: <38961EC3.659EBE6B@home.se> Message-ID: <87dnhr$3im$1@srv38.cas.org> According to Sverker Nilsson : :with Tk. I traced it down to the glob function in Tk/Tcl. It seems to :drop every first character in every filename. It showed up from using I am not familar with your configuration. However, I have seen a similar behavior, in Tcl and other programs, when I accidentally mix compile and links of code between BSD directory reading code and System V directory reading code... -- <*> O- Tcl2K - Austin, Texas, US Unless explicitly stated to the contrary, nothing in this posting should be construed as representing my employer's opinions. From sholden at bellatlantic.net Mon Feb 28 02:16:39 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 07:16:39 GMT Subject: array constructor References: <0Tou4.831$y3.189558784@newsb.telia.net> Message-ID: <38BA20D9.40492C5B@bellatlantic.net> Fredrik Lundh wrote: > > Tom Holroyd wrote: > > m = [[0]*4]*4 doesn't work: > > http://www.python.org/doc/FAQ.html#4.50 > > Only slightly more verbose, and *much* kinder, than "RTFM"! Not a bad question either, actually: -- wasn't Doug Hellmann wanting questions for a Python "do you know it" test? Not-sure-I'd-even-pass-the-driving-test-again-ly y'rs - Steve -- "If computing ever stops being fun, I'll stop doing it" From scarblac-spamtrap at pino.selwerd.nl Mon Feb 7 08:16:07 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 7 Feb 2000 13:16:07 GMT Subject: mail filter in python? References: <20000208000902.31713@nms.otc.telstra.com.au> Message-ID: Greg McFarlane wrote in comp.lang.python: > I am looking for a replacement for the "filter" program that comes > with elm - something that I do not have to compile and something that > is easy to hack on. Does anyone know of a python version? > > (FYI, the elm filter program is executed each time the Unix mail > system attempts to deliver a mail message to your mailbox. You can > configure it to put certain messages into folders, to delete others or > to forward others to someone else. It is very useful for dealing with > mailing lists and other high-volume email sources.) The best program out there for this sort of thing is Procmail. It does everything. It's not Python, it is compiled C. But the config files are easy to make. http://www.procmail.org -- Remco Gerlich, scarblac at pino.selwerd.nl 2:12pm up 75 days, 20:16, 9 users, load average: 0.08, 0.17, 0.17 From timmuddletin at news.vex.net Sat Feb 5 03:00:19 2000 From: timmuddletin at news.vex.net (tim muddletin) Date: 5 Feb 2000 08:00:19 GMT Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: <87glaj$2dov$1@news.tht.net> On 04 Feb 2000 11:50:22 -0500, chris patti wrote: >simply, it's an FTP archive. I'd just like to point out that the tragically missing resource that spawned this thread is actually around 2 or 3 years old (approx 1997 as far as i can tell). That is three years in which the author could have uploaded it to the contrib directory at ftp.python.org if he so desired---right up until the time it was more-or-less closed down a few months ago. Alas, it seems, an FTP archive would not have saved us in this case, despite its many potential virtues. From gerrit at nl.linux.org Sat Feb 26 15:41:22 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Sat, 26 Feb 2000 21:41:22 +0100 Subject: Converting a floating point number to a string In-Reply-To: <899bqt$udk$1@nnrp1.deja.com>; from kurtn@my-deja.com on Sat, Feb 26, 2000 at 08:07:59PM +0000 References: <899bqt$udk$1@nnrp1.deja.com> Message-ID: <20000226214122.B32360@humbolt.nl.linux.org> On Sat, Feb 26, 2000 at 08:07:59PM +0000, kurtn at my-deja.com wrote: > Hei > As the subject says I would like to convert a > floating point number to a string, in other words > the opposite of 'atof'. I appreciate all the help > I can get. >>> str(1.5) '1.5' You can use the builtin 'str' function if you want to convert _anything_ to a string: not only integers, lists, and dictionairies, but also file objects and class instances. Please read the documentation for more information. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From scarblac-spamtrap at pino.selwerd.nl Thu Feb 17 05:11:14 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 17 Feb 2000 10:11:14 GMT Subject: is this a Python bug? References: <88caua$fef$1@news1.tc.umn.edu> <38AB1BD4.535E29E7@bellatlantic.net> Message-ID: Steve Holden wrote in comp.lang.python: > What on Earth does "backslashes are still used to quote the > folowing character, but all backslashes are left in the string" > mean? I am sure it means something, but I can't tell what. It's simple. In a normal string between '', you need to escape inner 's: '\'' is the string: ' In raw strings, the ' still needs to be escaped, but the \ is left in: r'\'' is the string: \' You can't have a raw string with only one \ in it, because: r'\' is an error, the \ escapes the ', and the string doesn't end r'\\' is the string: \\ The \ is escaped in the last one, but the escaping \ is left in the string. In normal strings, it's simple: '\\' is the string: \ The first backslash escapes the second, and is then removed from the string. There's nothing really magic about it. -- Remco Gerlich, scarblac at pino.selwerd.nl 11:06am up 85 days, 17:11, 6 users, load average: 0.20, 0.07, 0.07 From wware at world.std.com Wed Feb 23 19:04:52 2000 From: wware at world.std.com (Will Ware) Date: Thu, 24 Feb 2000 00:04:52 GMT Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> <891g7l$cf8$1@nnrp1.deja.com> Message-ID: In article <20000222211406.41743.qmail at hotmail.com>, "Shawn LeBlanc" wrote: > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior..... rdudfield at my-deja.com wrote: > Microthreads would be good for this. Although I'm not sure if the > authour is continuing work on them. This is exactly the sort of thing I had in mind for microthreads. You can read about it at http://world.std.com/~wware/uthread.html and find code at ftp://ftp.std.com/pub/wware/uthread.tgz. You'll notice a few different versions with dates; if you run into trouble try one of the older ones. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From gmcm at hypernet.com Mon Feb 7 11:44:54 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 7 Feb 2000 11:44:54 -0500 Subject: calldll & threads In-Reply-To: Message-ID: <1262180615-3359410@hypernet.com> Robin Becker asks: > Is call dll totally thread safe/compatible? It seems from observation > that call backs seem to use only one thread context; anybody know if > that is true? In July of 98, in response to a problem Christian was having, Sam produced a patched calldll that used TLS storage so that a callback would happen on the thread that started the trouble. I have no idea if that patch was incorporated in the mainstream, or what's happened to it. However, Christian is a well-known packrat ;-). - Gordon From effbot at telia.com Wed Feb 9 04:22:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 09:22:22 GMT Subject: Debugger Is Sorely Lacking!! <- what environment? References: <3.0.5.32.20000208162053.007c5cc0@franklin.appliedtheory.com> Message-ID: Lou Pagano wrote: > I am brand spanking new at Python, and so, make LOTS of mistakes. I have > found a lot lacking in the debugger. hint: there are many different development environments for Python. it would be helpful if you (and everyone else) included the name of the environment in the subject line, or at least somewhere in the message. (in your case, you're probably talking about the IDLE environment. but I cannot tell for sure; it could be PythonWin. it's probably not PythonWorks or true- Space, and python-mode doesn't have a debugger, afaik. haven't used ActiveState's IDE yet, nor VIPER. etc. you get the idea...). From moshez at math.huji.ac.il Fri Feb 25 15:31:41 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 22:31:41 +0200 (IST) Subject: parameter undefined in procedure In-Reply-To: <38B6E1AD.20DA1CE6@labs.agilent.com> Message-ID: On Fri, 25 Feb 2000, David Smith wrote: > I have a module named test.py, which contains only the following > definition: > > def bar(dictionary): > list = ['alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot'] > return map( lambda(x): dictionary.get(x,"default"), list) > > I import it and run it, and get an error message as follows: When a Python function sees a variable, it looks in three places (in that order) for the variable: the local namespace, the global namespace, and the builtin namespace. The "lambda" expression defines a function. Inside it, the only locals are the parameters (since there can be no assignments inside a lambda), so in your case the only local is "x". "dictionary" isn't a global, and it isn't a builtin (thank God!) either. If you want your lambda expression to see it, you have to explicitly define it: return map(lambda x, dictionary=dictionary: dictionary.get(x, "default"), list) If you think this is god-awful ugly, you're right. Why not code it as an explicit loop? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit.holl at pobox.com Wed Feb 16 01:33:17 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 07:33:17 +0100 Subject: Proposal: Official whitespace response In-Reply-To: <88cclv$u62$1@nnrp1.deja.com>; from fcahoon@my-deja.com on Tue, Feb 15, 2000 at 08:24:36PM +0000 References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> Message-ID: <20000216073317.A579@stopcontact.palga.uucp> Forrest Cahoon wrote on 950642676: > (Personally, I'd feel more secure about python if tabs generated a > compile error, and thus could be guaranteed not to be in any running > code.) Use 'python -tt'. From the manpage: -t Issue a warning when a source file mixes tabs and spaces for indentation in a way that makes it depend on the worth of a tab expressed in spaces. Issue an error when the option is given twice. 07:32:45:tty6:gerrit at stopcontact:~$ python -tt /usr/local/bin/world File "/usr/local/bin/world", line 115 return rawaddr ^ SyntaxError: inconsistent use of tabs and spaces in indentation I have an alias... regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From darrell at dorb.com Sun Feb 27 15:55:31 2000 From: darrell at dorb.com (Darrell) Date: Sun, 27 Feb 2000 12:55:31 -0800 Subject: Making sense of Stackless Message-ID: <146101bf8164$fc19df90$6401a8c0@dorb> Thinking about how I could use Stackless and how it's different from using callbacks on a object. I decided to view continuations as objects and here's were it lead. If an instance can be thought of as a stack frame then a continuation can be thought of as an instance with a constructor and a run method. import continuation def construct(): tripFlag=1 c=continuation.caller() tf=c.update(tripFlag) if tripFlag==1: # Don't understand how tripFlag stops being equal to 1 return c return tripFlag def classFunc(): print 'Construct:' x=1 y=2 c=construct() if c != None: return c else: print 'Run:' x=x+1 print x+y c=classFunc() for x in range(3): c.call() print '#'*20 def classIterator(seq): offset= -1 c=construct() if c != None: return c else: offset=offset+1 return seq[offset] c=classIterator(range(10)) for x in range(3): print c.call() #################### #Now Python has a class with truly private data. #Unless Christian has a trick. Construct: Run: 4 Run: 5 Run: 6 #################### 0 1 2 --Darrell From rob at hooft.net Tue Feb 15 08:27:09 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 15 Feb 2000 14:27:09 +0100 Subject: Inter process communication using Tk/send hangs on suspended processes Message-ID: I have a group of python programs. Whenever any new program is started, it will try to establish connections to each of the other ones using Tk/send (it is asking each for their background color, and will choose a new one for itself). This is done using "root=setup.setup()", the setup module is appended to this message. The problem occurs when any pre-existing program has been suspended: in such a case the Tk/send does not return. I also can not seem to set a timeout on the communications (my attempts are in commented code). Are there any better suggestions? Regards, Rob Hooft. -------------------------------------------------------------------- # __version__ = '$Id: setup.py,v 1.9 1999/08/04 09:16:21 hooft Exp $' # # GUI Startup # # (C) Rob W.W. Hooft, Nonius BV, 1997--1999 # import os,signal import Tkinter,Pmw TclError=Tkinter.TclError bgcolors=["grey85","#DFF","#DDF","#FDF","#FDD","#FFD","#DFD"] #def timeouthandler(sig,frame): # print "WARNING: no response from other Tk application." # raise TclError def usedcolors(root): used=[] names=list(root.winfo_interps()) names.sort() names.reverse() for name in names: try: #signal.signal(signal.SIGALRM,timeouthandler) #signal.alarm(3) root.send(name, 'winfo name .') #signal.alarm(0) #signal.signal(signal.SIGALRM,signal.SIG_DFL) except TclError: # Inoperative window -- ignore it pass else: try: col=root.send(name,'no-bgcolor') used.append(col) except: pass return used def setscheme(root): try: bgcolor=os.environ['NONIUS_BGCOLOR'] Pmw.Color.setscheme(root,background=bgcolor) except KeyError: # Now sample all others, and see what is in use. Choose a new one. u=usedcolors(root) for col in : if col in u: continue break else: print "No free background color" col="grey85" Pmw.Color.setscheme(root,background=col) root.tk.createcommand('no-bgcolor',lambda bgcolor=col: bgcolor ) os.environ['NONIUS_BGCOLOR']=col def setup(idle=1): import Tkinter,Pmw Pmw.initialise(fontScheme='Pmw1',size=14) root=Tkinter._default_root setscheme(root) import balloon # Automatically initializes... # Set up idle task calls for "checkifcanceled".... if idle: import projtls projtls._ltt.setidletask(root.update) return root -- ===== rob at hooft.net http://www.xs4all.nl/~hooft/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! ========= From gerrit.holl at pobox.com Sat Feb 26 09:17:13 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 26 Feb 2000 15:17:13 +0100 Subject: Life's better without builtins? (was: Life's better without braces) In-Reply-To: ; from moshez@math.huji.ac.il on Fri, Feb 25, 2000 at 04:42:19PM +0200 References: <38B691AD.BDB4DD5F@endea.demon.nl> Message-ID: <20000226151713.A3420@stopcontact.palga.uucp> > On Fri, 25 Feb 2000, Niels Diepeveen wrote: > > > Do you have some source code of this? I can't think of a way to do > > reload() or tuple(). > > def reload(module): > del sys.modules[module] > exec 'import '+module No. The 'reload()' function takes a module and returns a module: >>> import os >>> reload(os) regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From aa8vb at yahoo.com Thu Feb 10 08:48:32 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Thu, 10 Feb 2000 08:48:32 -0500 Subject: Base64 Decoding In-Reply-To: References: Message-ID: <20000210084832.A1805707@vislab.epa.gov> Victor M. J. Ryden: |I'm trying to use python to decode some e-amil I'm getting which |contain MIME base64 encoded documents. | |I looked at the doc's for the mimetools and base64 modules. I'm confused |because they ask for both an input AND output file name. I can understand |the input, but not the output. There can be several encoded documents in |a single input file, all of which have their respective file names as part |of the encoding prelude. | |Has anyone any experience with this, and do you have any hints? This should get you reasonably close. Attached is a script I use to munge Novel Groupwise mails that I get here occasionally. It takes a mail message and emits a modified mail message. In particular, it parses out application/wordperfect attachments (in base64 or non-standard X-uuencode format), decodes them, and inserts both plaintext and base64 attachments in the message. It also handles nested mail messages. This saves me from having to pop up Word Perfect to read my mail. -- Randall Hopper aa8vb at yahoo.com -------------- next part -------------- #!/usr/local/bin/python # # wpmail-cvt - Converts broken Novel Groupwise X-uuencode mail containing # WordPerfect attachments into true MIME format with base64 # encoding and content type of application/wordperfect. # Also, kicks off WordPerfect, converts the document to # text, and inserts that as an attachment in the mail # message so we don't have to fire up WordPerfect. # # UPDATES # 1/19/00 - Now supports nested (forwarded) rfc822 messages # WPD_TO_TEXT_CMD = "wp2txt" import sys, rfc822, multifile, cgi, base64, uu, string, os, StringIO, getopt def HandleMessage( infile ): # # Nuke the Lines and Content-Length headers, and print the header # header = rfc822.Message(infile) del header[ 'Lines' ] del header[ 'Content-Length' ] # Make sure just one blank line after header hdr_str = str(header) if hdr_str[-1:] != '\n': hdr_str = hdr_str + '\n' print "%s%s" % ( header.unixfrom, hdr_str ) # # Parse the message parts # type, params = cgi.parse_header(header["content-type"]) if type[:10] != "multipart/": sys.stdout.write( infile.read() ) else: boundary = params["boundary"] file = multifile.MultiFile(infile, 0) file.push(boundary) while file.next(): subheader = rfc822.Message(file) type, params = cgi.parse_header(subheader['content-type']) buf = StringIO.StringIO( file.read() ) # Grab the filename filename = params.get( 'name' ) if not filename: filename = "file" # If this is one of those non-MIME X-uuencode jobs, convert to base64 if subheader.get( 'content-transfer-encoding' ) == 'X-uuencode': buf2 = StringIO.StringIO() uu.decode( buf, buf2 ) buf = StringIO.StringIO( base64.encodestring( buf2.getvalue() ) ) subh_str = ( 'Content-Type: application/wordperfect; name="%s"\n' 'Content-Transfer-Encoding: base64\n' 'Content-Disposition: attachment; filename="%s"\n' )\ % ( filename, filename ) if subheader.get( 'content-description' ): subh_str = subh_str + 'Content-Description: %s\n' % \ subheader.get( 'content-description' ) else: subh_str = str(subheader) # If this is a WordPerfect doc, convert it to text and insert subheader = rfc822.Message( StringIO.StringIO( subh_str ) ) type, params = cgi.parse_header(subheader['content-type']) if type == 'application/wordperfect': # Decode the data, convert to text, and reinsert base64.decode( buf, open( "/tmp/tmpfile", "wb" ) ) os.system( "%s %s %s" % ( WPD_TO_TEXT_CMD, "/tmp/tmpfile", "/tmp/tmpfile.txt" ) ) print "--%s" % boundary print ( "Content-Type: text/plain; name=\"%s.txt\"\n" "Content-Transfer-Encoding: 7bit\n" "Content-Disposition: attachment; filename=\"%s.txt\"\n" "Content-Description: Text\n" % ( filename, filename ) ) print open( "/tmp/tmpfile.txt", "r" ).read(), print "--%s" % boundary print subh_str if subheader.get( 'content-type' ) == 'message/rfc822': HandleMessage( buf ) else: print buf.getvalue(), file.pop() print "--%s--\n" % boundary # # Parse args # opts, args = getopt.getopt( sys.argv[1:], 'h' ) if opts or len( args ) > 1: print ( "FORMAT: wpmail-cvt []\n\n" " - A file containing a mail message\n\n" " If no filename is specified, input is taken from stdin" ) sys.exit(1) # # Parse the e-mail header, and print it # if args: infile = open( args[0] ) else: infile = sys.stdin HandleMessage( infile ) From breiter at usf.Uni-Osnabrueck.DE Mon Feb 28 14:50:52 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 28 Feb 2000 19:50:52 GMT Subject: testing? References: <20000224160631.75959.qmail@hotmail.com> Message-ID: <89ejis$cin$3@newsserver.rrzn.uni-hannover.de> In article <20000224160631.75959.qmail at hotmail.com>, "Shawn LeBlanc" writes: > My last three messages haven't shown up, I think. Please don't use a real usegroup like this for testing. Try a *.test group, maybe alt.test. Bernhard ps.: I reply openly to spread the word about the test newsgroups. -- Free Software Projects and Consulting (intevation.net) Association for a Free Informational Infrastructure (ffii.org) From Stephane.Bausson at mail.dotcom.fr Fri Feb 11 16:01:17 2000 From: Stephane.Bausson at mail.dotcom.fr (Stephane BAUSSON) Date: Fri, 11 Feb 2000 21:01:17 GMT Subject: range(start,stop) Message-ID: <38A478A4.532D73F5@mail.dotcom.fr> Hello Just a question for a Python expert ... What the interest for the range function to stop at stop-1 and not at stop ? For me it does not feel natural to write .... Thank you -- Stephane BAUSSON Email: Stephane.Bausson at mail.dotcom.fr From JamesL at Lugoj.Com Wed Feb 2 23:22:04 2000 From: JamesL at Lugoj.Com (James Logajan) Date: Wed, 02 Feb 2000 20:22:04 -0800 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> Message-ID: <3899026C.7FD4481E@Lugoj.Com> Neel Krishnaswami wrote: > Apply Neil Schemenauer's patches that convinces Python to use the > Boehm garbage collector, or just live with the garbage, if your > program is relatively short-lived. You can find his patch at: > > http://www.acs.ucalgary.ca/~nascheme/python/gc.html > > Manually freeing memory is ugly and error-prone. Don't do it. :) The vast majority of code (and programming languages) in the world require explicit memory de-allocation. I don't believe that a GC scheme has yet been invented that will work well for all problem domains. I'm sure if it had, we'd all be using it by now. ;) From mhammond at skippinet.com.au Tue Feb 8 17:38:30 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 08 Feb 2000 22:38:30 GMT Subject: win32security, client privleges References: <87pu3o$23i$1@nnrp1.deja.com> Message-ID: If you look up the MS docs for GetFileSecurity() you will notice the following: """To read the system access-control list (SACL) of a file or directory, the SE_SECURITY_NAME privilege must be enabled for the calling process.""" Note that privileges are different than permissions. So, you can use the function below to enable the privilege for your session - just pass ntsecuritycon.SE_SECURITY_NAME to this function... [Taken from the book, which discusses this briefly...] Mark. import win32security import win32api import sys import time from ntsecuritycon import * def AdjustPrivilege(priv, enable = 1): # Get the process token. flags = TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY htoken = win32security.OpenProcessToken(win32api.GetCurrentProcess(), flags) # Get the ID for the system shutdown privilege. id = win32security.LookupPrivilegeValue(None, priv) # Now obtain the privilege for this process. # Create a list of the privileges to be added. if enable: newPrivileges = [(id, SE_PRIVILEGE_ENABLED)] else: newPrivileges = [(id, 0)] # and make the adjustment. win32security.AdjustTokenPrivileges(htoken, 0, newPrivileges) wrote in message news:87pu3o$23i$1 at nnrp1.deja.com... > Hello, I'm on a Windows NT machine on a managed network. I would like > to write an app to manage file security (access rights...) It seems that > win32security is just what I need. However, when I run the following: > > import win32security > win32security.GetFileSecurity("SomeFile") > > I get the following error: > > api_error: (1314, 'GetFileSecurity', ' A required privilege is not held > by the client.') > > I have "administrator" status on the network. For kicks, I had the > domain admin log in to my machine and I got the same error. So it > appears as though client refers to something other than my User account. > > How do I make this work? Also, is there some decent documentation on how > to use the various win32 modules (or is it all in some MS > documentation?) Thanks. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From fredrik at pythonware.com Tue Feb 1 09:21:14 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 15:21:14 +0100 Subject: ole structured storage documents under *nix References: <88256874.00095CFE.00@avnet.com> Message-ID: <003801bf6cbf$99eef170$f29b12c2@secret.pythonware.com> Lance Ellinghaus wrote: > I have been looking for either Python or C code that will allow me to read and > write OLE structured documents.. > > Anyone know of any?? there's something called OleFileIO.py in PIL [1] it contains enough stuff to read Image Composer and FlashPix files, but I haven't really used it for anything beyond that. YMMV, in other words... 1) http://www.pythonware.com/products/pil From stidolph at origin.ea.com Tue Feb 8 16:20:57 2000 From: stidolph at origin.ea.com (Stidolph, David) Date: Tue, 8 Feb 2000 15:20:57 -0600 Subject: Coverage Analysis Message-ID: <11A17AA2B9EAD111BCEA00A0C9B41793034AB143@molach.origin.ea.com> Is there any way to do coverage analysis in Python? While the Python system will check for overt syntax errors (tabs vs spaces and missing ':' or unmatched quotes), it doesn't handle misspelled names until the line is executed. Is there a mode in Python to do coverage analysis - that is to track the number of times a given line is executed. What would be cool is a debug mode that would have an integer associated with every line of every file executed. All counts are initialized to zero. As a line is executed the count is bumped up by one. At some point you can dump a module's couts to a file or as a tuple of integers. Is there any way to hack this in? Ideas?? Also, this might give more insights into where to put optimizations... David Stidolph. From michael.stroeder at inka.de Fri Feb 18 13:12:44 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Fri, 18 Feb 2000 19:12:44 +0100 Subject: embeddable Python web server (was 'derived from CGIHTTPServer.py') References: <38AC9E92.C1CEFEB7@inka.de> <38AD3C67.A08EFE2D@inka.de> <87u2j68n7j.fsf_-_@den.home.net> Message-ID: <38AD8B9C.F3F4DCF5@inka.de> Frank Sergeant wrote: > > < Michael Str?der asks about an embeddable > Python web server> > > Well, here is what I've been using very successfully. Thanks for submitting your code. > Certain URLs are interpreted as calls to Python functions. That's exactly what I'm already doing (see 0.7.0b1 on http://web2ldap.de/). > This allows > persistent state as opposed to the cgi approach which would start up > Python for each request. I was really surprised how much the overhead of importing the standard modules is. My solution is quite fast now even if running on a 486 together with the LDAP server. The next step will be to reuse the LDAP connection objects... > Another problem with CGIHTTPServer.py is that > is forked a new process to handle each cgi request and fork does not > work on Windows. And yes, it runs under Windows now. :-) > This module builds on SimpleHTTPServer by implementing GET and POST > requests to run Python methods. Ooops. I derived my class from CGIHTTPServer. It does not make a difference in this case. But you're right: It's less over-head sub-classing SimpleHTTPServer.SimpleHTTPRequestHandler. > If the URL is http://somehost/cgi-bin/patlist then the method to be > executed will be py_patlist(). Similar to my solution. But my script can also be run as normal CGI-BIN script under the control of a "real" web server. I'm using PATH_INFO for determining the function name. > if self.command == 'POST': > form = string.strip (self.rfile.readline()) I had problems with HTTP-POST. In my case I read the data like module cgi does: self.rfile.read(contentlength). This works just fine when running as a normal CGI-BIN under the control of Apache. I tried your solution with readline() and it works now. Thanks. But there are open issues: SimpleHTTPServer is based on SocketServer and [python-doc]/lib/module-SocketServer.html says: "These four classes process requests synchronously; each request must be completed before the next request can be started." In my case there might be long-running LDAP queries which would block all other users. Do you already have some example code with threading? I will dig into this and publish the code... Ciao, Michael. From daryl_stultz at my-deja.com Tue Feb 22 13:26:15 2000 From: daryl_stultz at my-deja.com (daryl_stultz at my-deja.com) Date: Tue, 22 Feb 2000 18:26:15 GMT Subject: win32security References: <87pu3o$23i$1@nnrp1.deja.com> <88joeo$32s$1@nnrp1.deja.com> Message-ID: <88ukc0$aeq$1@nnrp1.deja.com> I applied Mark's privilege procedure to the script (and changed a couple of things) to get this: ********************* import win32api from ntsecuritycon import * from win32security import * from win32con import * def AdjustPrivilege(priv, enable = 1): # Get the process token. flags = TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY # Get the ID for the system shutdown privilege. htoken = OpenProcessToken(win32api.GetCurrentProcess(), flags) id = LookupPrivilegeValue(None, priv) # Now obtain the privilege for this process. # Create a list of the privileges to be added. if enable: newPrivileges = [(id, SE_PRIVILEGE_ENABLED)] else: newPrivileges = [(id, 0)] # and make the adjustment. AdjustTokenPrivileges(htoken, 0, newPrivileges) #mainline print "*" * 20 AdjustPrivilege(SE_SECURITY_NAME) sid,domain,z = LookupAccountName('\\\\server1','dstultz') #server1 is our server, dstultz is me newACL=ACL() newACL.AddAccessAllowedAce(GENERIC_ALL , sid) fileSec=GetFileSecurity('e:\\test.txt',DACL_SECURITY_INFORMATION) #text.txt is (duh) a test file fileSec.SetDacl(1, newACL, 0) SetFileSecurity('e:\\test.txt', DACL_SECURITY_INFORMATION, fileSec) #this fails ********************* Here is the error: pywintypes.api_error: (1338, 'SetSecurityDescriptorDacl', 'The security descriptor structure is invalid.') I would think that SOMEONE must have a module to do this sort of thing: Pass a filename and get/set access rights... Sent via Deja.com http://www.deja.com/ Before you buy. From e.e.sutton at cummins.com Wed Feb 2 12:04:06 2000 From: e.e.sutton at cummins.com (e.e.sutton at cummins.com) Date: Wed, 02 Feb 2000 17:04:06 GMT Subject: Newbie: OverflowError: integer addition - Python data types?? Message-ID: <879o21$lu2$1@nnrp1.deja.com> I can't get a Python version of my VBScript Fibonacci series script to work. I get an OverflowError: integer addition error at series 46. Can Python not handle large numbers? Is there a special data type I should be using? Series 45 is the following number. 45 1836311903 (1.84E+09) File "M:\SRC\scripting\fibonacci\fib.py", line 47, in Fibonacci fib = fibA + fibB OverflowError: integer addition def Fibonacci(i): fibA=1 fibB=1 if i == 0: Fibonacci = fibA elif i == 1: Fibonacci = fibB elif i > 1: fib=0 for j in range(2, i+1): fib = fibA + fibB fibA = fibB fibB = fib Fibonacci = fib return Fibonacci Thanks in advance for any tips or suggestions Sent via Deja.com http://www.deja.com/ Before you buy. From PClaerhout at CREO.BE Mon Feb 28 09:51:41 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Mon, 28 Feb 2000 15:51:41 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7163@MSGEURO1> I can send you a copy of Mk4py that works with Python 1.5.2c1 if you want to. Just let me know. Pieter -----Original Message----- From: zawrotny at gecko.sb.fsu.edu [mailto:zawrotny at gecko.sb.fsu.edu] Sent: Monday, February 28, 2000 3:45 PM To: python-list at python.org Subject: Re: MetaKit for python (Mk4py) on Macintosh ... no way :( Arnaud, This may or may not help a whole lot, but it may be worth a try. Even without CW you can still compile on the Mac. MPW is freely downloadable from Apple: ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./ The reason this may not help is that I have no idea how hard it would be to compile MK under MPW. On Mon, 28 Feb 2000 11:39:42 +0100, Arnaud Fontaine wrote: > So, I need to re-compile the module from the sources. Hmmmm ..... but I > don't have CodeWarrior ... so ... > But that's another story. [snip] > So, in a few words : Do you have a solution to my problem (I don't have > a C compiler on the MacOS side ...) ? Hope this helps, Mike -- Michael Zawrotny 411 Molecular Biophysics Building Florida State University | email: zawrotny at sb.fsu.edu Tallahassee, FL 32306-4380 | phone: (850) 644-0069 -- http://www.python.org/mailman/listinfo/python-list From dfavor at austin.ibm.com Wed Feb 16 15:28:38 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Wed, 16 Feb 2000 14:28:38 -0600 Subject: list iteration question Message-ID: <38AB0876.B816FE18@austin.ibm.com> In the attached code, would someone point out why the function chomp4() throws an exception? Thanks. -------------- next part -------------- #!/usr/local/bin/python import sys def slurp(filename): "Slurp all the lines of a file into an list" try: f = open(filename) except IOError: print "IOError: ", sys.exc_value sys.exit return f.readlines() def chomp1(lines): "remove the end of line markers from list" i = 0 while i < len(lines): if lines[i][-1] == '\n': lines[i] = lines[i][:-1] i = i + 1 def chop(str): "remove the end of line marker from string" if str[-1] == '\n': str = str[:-1] return str def chomp2(lines): "remove the end of line markers from list" i = 0 while i < len(lines): lines[i] = chop(lines[i]) i = i + 1 def chomp3(lines): "remove the end of line markers from list" lines = map(chop,lines) return lines def chomp4(lines): "remove the end of line markers from list" lines = map(string.rstrip,lines) return lines if __name__ == '__main__': for file in sys.argv[1:]: lines = slurp(file) if lines: lines = chomp4(lines) for line in lines: print line From sholden at bellatlantic.net Fri Feb 25 09:14:36 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 14:14:36 GMT Subject: (no subject) References: <20000224195930.9372.qmail@nwcst281.netaddress.usa.net> <001101bf7f44$3e5932c0$b62d153f@tim> <20000225075439.A1669@stopcontact.palga.uucp> Message-ID: <38B68E4C.7C7A6E58@bellatlantic.net> Gerrit Holl wrote: > [Tim Peters] > > The string functions aren't going away, so feel free to ignore string > > methods if they don't appeal to you. > > Aren't they becoming obsolete? Won't the string be deprecated? > Not sure what's the difference ;) > Obsolete means it's not supported any more. Depracated means it won't be supported in the future, and its use is discouraged. Since alternatives are usually available for depracated features, you'd have to be dumb or porting large amounts of existing code to want to use them. Extended Mercury Autocode is obsolete. Perl is depracated ;-) regards Steve -- "If computing ever stops being fun, I'll stop doing it" From effbot at telia.com Sun Feb 13 14:25:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 19:25:06 GMT Subject: New to programming and python References: <886vdb$slk$1@nntp8.atl.mindspring.net> Message-ID: wrote: > I have one question; What is the book python book for newbies. short answer: start here: http://www.python.org/Help.html longer answer: start here http://www.python.org/doc/Intros.html and look under "introductions to python for non-programmers" after that, check the other intros mentioned on that page, and the official tutorial, available at: http://www.python.org/doc as for books, your best bets are O'Reilly's "Learning Python" and Manning's "Quick Python". neither is written for true beginners, so you might wish to check them out in your local bookstore before buying. and yes, you should consider joining the python-tutor list: http://www.python.org/mailman/listinfo/tutor hope this helps! From robin at jessikat.demon.co.uk Fri Feb 18 04:17:56 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 18 Feb 2000 09:17:56 +0000 Subject: Continuations and threads (was Re: Iterators & generators) References: <88imhd$f97$1@nntp6.atl.mindspring.net> <001301bf79dd$1c718c00$e62d153f@tim> Message-ID: In article <001301bf79dd$1c718c00$e62d153f at tim>, Tim Peters writes .... >What's *interesting* is what the language could provide if they were >available to a few insane souls to build on "under the covers". A Scheme >True Believer builds all control flow (from function calls thru exceptions >to pseudo-threading) on top of them. Python won't do that, and I expect >Guido is just irked at suggestions that "he should" (why the hell should he >?). > >In Python the value would be for what they could provide we don't already >have: not exception-handling, but (most clearly) lightweight generators & >coroutines, and (less clearly) lightweight alternatives to threads. The >pragmatics of Stackless are such that you can have thousands of >"pseudothreads" running even on feeble platforms with no thread support; and >without the C stack interwined in the program state, it's even possible we >could whip something up to, e.g., freeze a (pure) Python program in >mid-stream, pickle it, send it across the web, and resume it where it left >off on some other architecture. .... hear hear; the generator / iterator paradigm is the killer app for stackless. >Indulge some crazy-ass fanatasies! Worrying about the mechanics of >continuations here is akin to a debate starting about what kind of numeric >types P3K should offer, that degenerates into an endless discussion about >how best to build adder circuits in .18 micron technology <0.9 wink>. > >they're-a-means-not-an-end-ly y'rs - tim > > > -- Robin Becker From greene at hctc.com Mon Feb 21 12:57:07 2000 From: greene at hctc.com (Collin Greene) Date: Mon, 21 Feb 2000 10:57:07 -0700 Subject: where can i download python for free? Message-ID: i ma very interested in python but i cant really find where t get it, could anyone help me out? From a.eyre at optichrome.com Mon Feb 14 12:37:52 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 14 Feb 2000 17:37:52 -0000 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <003001bf74b0$dfde09c0$f29b12c2@secret.pythonware.com> Message-ID: <001b01bf7712$37f31f20$3acbd9c2@peridot.optichrome.com> > there is no such thing as a PySequenceObject. Erk. You're right. I just figured Python's internal object structure had a vague hierarchy like this: Object +- Sequence | +- List | +- Tuple | +- String +- Mapping | +- Dictionary +- Number +- Integer +- Long integer But actually it's far more bizarre. >> Besides, I don't see the connection... > you will. you will. Care to elaborate? :) I was refering to the connection with my original post about the join() method being added to the string object, when it more logically goes on a list/sequence... e.g. >>> s = "this is a test" >>> s.split() ['this', 'is', 'a', 'test'] ...seems reasonable, but... >>> l = s.split() >>> " ".join(l) 'this is a test' ...doesn't. If it were on a list, you could do things like this: >>> s = "a:b:c" >>> s.split(":").join(", ") 'a, b, c' ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From Rod.Haper at sage.nelesautomation.com Wed Feb 16 18:36:18 2000 From: Rod.Haper at sage.nelesautomation.com (Rod Haper) Date: Wed, 16 Feb 2000 17:36:18 -0600 Subject: tkinter manual wanted References: <38AB1310.B97A982@freenet.edmonton.ab.ca> Message-ID: <38AB3472.37831502@sage.nelesautomation.com> You might want to have a look at the book "Python and Tkinter Programming" by John Grayson. My copy just arrived from fatbrain on Monday. I haven't had a chance to do anything more than just thumb through it yet but it looks promising. I don't have it with me here at work but it's a chunky 688 pages and appears to have lots of nontrivial examples. I don't recall the exact quote but among the recommendations on the back cover is a good one from Guido. Joseph Paish wrote: > > i am looking for a downloadable tkinter manual/tutorial. i have found > one or two on the web (on pythonware.com, i think) but would like > something that can be read without going online. pdf format would be > ideal, if such a thing exists. > > thanks > > joe -- +----------------------------------------------------------------------+ | Rod Haper, Senior System Analyst | Neles Automation | | Phone: 713-346-0652 - main | SCADA Solution, Inc. | | 713-939-0393 - fax | 7000 Hollister | | Rod.Haper at sage.nelesautomation.com | Houston, Texas 77040, USA | +----------------------------------------------------------------------+ From phd at phd.russ.ru Fri Feb 11 10:59:31 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 11 Feb 2000 15:59:31 +0000 (GMT) Subject: PyApache, couldn't geta hold of author, willing to donate sometime In-Reply-To: Message-ID: On 11 Feb 2000, Ralf Hildebrandt wrote: > Does pyApache have the same performance impact as mod_perl upon the > execution time of the programs? Yes, but I heared httpdapy does it better. PersistentCGI, certainly, will do it even better, but you need to write it in special way. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From kuncej at mail.conservation.state.mo.us Tue Feb 8 11:15:35 2000 From: kuncej at mail.conservation.state.mo.us (Jeff Kunce) Date: Tue, 8 Feb 2000 10:15:35 -0600 Subject: Installing JPython library on clients Message-ID: This may be an ignorant question, as I am basically Java-ignorant. The way JPython applets are demo'd on the website, the client has to wait for the JPython library to download for each browser session that uses JPython. Is there a simple way for that library to be permanently installed on a client machine (as a "plugin" or "trusted software" or whatever)? Thanks. --Jeff From gerrit.holl at pobox.com Wed Feb 2 09:55:40 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 2 Feb 2000 15:55:40 +0100 Subject: [Tutor] HELP!!!! In-Reply-To: <000c01bf6b72$66c518e0$37d5bfce@pavilion>; from byohe@nnex.net on Sun, Jan 30, 2000 at 04:36:07PM -0600 References: <000c01bf6b72$66c518e0$37d5bfce@pavilion> Message-ID: <20000202155540.B1172@stopcontact.palga.uucp> bonnie yohe wrote on 949246567: > HELP!! what language does python use ?! Python is a programming language itself. It is, for that matter, similar to C, C++, Java, Perl, Pascal, Fortran, Logo, etc. (ask Tim Peters for more languages ;). Python is a scripting language, so you do not need any compiler for it. It has an interpreter instead. The interpreter is written in C. regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From nally at radiks.net Tue Feb 29 22:16:37 2000 From: nally at radiks.net (Paul T. McNally) Date: Tue, 29 Feb 2000 21:16:37 -0600 Subject: any non programmers out there? References: <38bc8506@omega> Message-ID: <38BC8B95.B16AF95@radiks.net> Cristian Echeverria wrote: > I think a very good and basic introduction is the Python tutorial: > > http://www.python.org/doc/current/tut/tut.html > I just started the tutorial today. I've been meaning to learn Python for quite some time now. Zope makes a good excuse to do so. A tutorial by Guido. Sounds good to me. I would strongly suggest taking a couple programming classes at your local Community College. It's cheap and you can get a start on learning how to turn problems into computer programs. For me that has been the key, similar to taking story problems and coming up with an equation for Algebra class. I imagine the subject implies the non programmers would make better tutors than those who program therefore they forget all the little things they had to learn when they were newbies. If I write books/tutorials I hope to remember all the stuff. I'll see how much Guido remembers. Paul From alex at somewhere.round.here Thu Feb 17 11:39:13 2000 From: alex at somewhere.round.here (Alex) Date: 17 Feb 2000 11:39:13 -0500 Subject: Problem with Emacs mode, at start only References: Message-ID: > When, in Emacs, I do not have `*Python*' window initialised, or more > precisely, when there is no process running in that window, then `C-c > C-c' in the window where is the Python source invariably fails the > first time, with the diagnostic below. Repeating the command a second > time works as expected, and the next times as well, as long as the > Python sub-process does not terminate. Hi, Francois. Adding something like the following code to your .emacs file might go some way to solving your problem. Actually, it's been a bit of a pain for me, too, but I didn't realize it until I read your post. :) (add-hook 'python-mode-hook '(lambda () (save-window-excursion (py-shell) (local-unset-key "\C-c\C-c") (local-set-key "\C-c\C-s" 'comint-interrupt-subjob)))) This automatically starts the python shell whenever you go into python-mode, and rebinds what used to be C-c C-c to C-c C-s. You will still have to switch to the python shell in order see the results of executing your code, though. Hope this helps. Alex. From jblaine at shell2.shore.net Mon Feb 14 23:35:27 2000 From: jblaine at shell2.shore.net (Jeff Blaine) Date: Tue, 15 Feb 2000 04:35:27 GMT Subject: Threading example (revised) Message-ID: Ripped straight from Aahz Maruch's post the other day and simplified as more of a 'visual learning tool' demo. Added a few comments... whatever...just posting in case someone finds this one more graspable at a thread-beginner level like me. #!/usr/local/bin/python import time, threading, whrandom class MyThread(threading.Thread): """ Each thread picks a 'random' integer between 0 and 19 and reports in once per second for that many seconds. """ def run(self): iterations = whrandom.randint(0, 19) for i in range(iterations): print " ", self.getName(), "is reporting in" time.sleep(1) print self.getName(), "is DONE" if __name__ == '__main__': threadList = [] # Create 5 MyThread() threads for i in range(5) : thread = MyThread() threadList.append(thread) # Start all threads for thread in threadList: thread.start() # As long as we have more than just the 'main' thread running, print out # a status message while threading.activeCount() > 1 : print str(threading.activeCount()), "threads running including main" time.sleep(1) From samschul at pacbell.net Thu Feb 24 19:02:07 2000 From: samschul at pacbell.net (Sam Schulenburg) Date: Fri, 25 Feb 2000 00:02:07 GMT Subject: Style, readability and docstrings References: <38B5BDA9.4B12EC57@exceptionalminds.com> Message-ID: <894gpt$irh$1@nnrp1.deja.com> I use both function header blocks for readability by the programmer, and doc strings for online use by the user. i.e under both PythonWin, and IDLE, the doc string pops up on the screen when the user types the first left=paren of a function. In article <38B5BDA9.4B12EC57 at exceptionalminds.com>, Timothy Grant wrote: > Hi again. > > I posted a little code sample the other day and got a couple of comments > back on my "python style". One of those comments suggested that I move > my function comment headers blocks into docstrings. > > I have done so, and now I can barely read my code, I don't know what it > is about those comment blocks at the top of a function that my eyes > like, but without my function header comment blocks, my eyes don't > immediately pick up each function as I scroll through my code. > > Is this a "You need to retrain your eyes" type thing? Have other's > noticed the same thing, and does anyone have a nice coding style that > works for them that I can borrow? > > ########################################################### > # Stand Fast, > # tjg. > # > Chief Technology Officer tjg at exceptionalminds.com > Red Hat Certified Engineer www.exceptionalminds.com > Avalon Technology Group, Inc. (503) 246-3630 > >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< > > Sent via Deja.com http://www.deja.com/ Before you buy. From paul at prescod.net Thu Feb 3 21:10:41 2000 From: paul at prescod.net (Paul Prescod) Date: Thu, 03 Feb 2000 18:10:41 -0800 Subject: Haskell or Python! References: <38994478.72056B85@cui.unige.ch> <3mdm4.17496$3b6.72189@ozemail.com.au> <87da9a$4mo@goaway.cc.monash.edu.au> Message-ID: <389A3521.C5C1BC6E@prescod.net> Andrew Bromage wrote: > > .... > Existential types would fix that problem by generating the virtual > method table at compile time for each existentially quantified type. > The benefit is that you would only pay for the vtable it where you > actually use it. As I mentioned in a previous post, existentially > quantified types are a proposed addition to the language. The coolest thing about functional programming languages is the totally inscrutable terminology. Monads, gonads and lambda -- oh my! (one of these things is not like the others, one of these things just does not belong, if you....) -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From effbot at telia.com Wed Feb 2 06:48:17 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 11:48:17 GMT Subject: Signal processing in 1.5.2 and Python (readline, LinuxThreads etc.) References: <20000202121612.B3061@mathi.uni-heidelberg.de> Message-ID: <5QUl4.625$pob.187507200@newsa.telia.net> Gregor Hoffleit wrote: > I just wanted to draw your attention to a bug report I submitted into the > Python BTS (Bug #196; currently available as > http://www.python.org/python-bugs/incoming?id=196;user=guest). > > I describe that the combination of Python 1.5.2, LinuxThreads and readline > support has strange effects to the signal handling of the interpreter. I > tested various combinations of 1.5.1, 1.5.2, different glibc's, GNU Pth > instead of LinuxThread's pthreads and tried to find a pattern. (you have reported this before, haven't you?) there are a few threads on this topic in dejanews, and they all seem to end up attributing this to bugs in readline and/or the kernel. fwiw, Alex Zbyslaw posted a workaround a while ago: http://www.deja.com/getdoc.xp?AN=545159177 could be worth trying it out on your platform. From infonuovo at email.com Wed Feb 16 17:01:00 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Wed, 16 Feb 2000 14:01:00 -0800 Subject: python .bat wrapper In-Reply-To: <88dmhe$fe4$1@nntp4.atl.mindspring.net> Message-ID: Very fun! I am stealing that at once. Try python -x %0 and make life even easier! -- orcmid -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Michal Wallace Sent: Wednesday, February 16, 2000 00:18 To: python-list at python.org Subject: python .bat wrapper hey all.... I dunno if there's already something like this, but I kinda missed perl's pl2bat... It added a little cruft to a copy of your perl file to let dos run it as a batch. Here's how to do it for python.. the only side-effect is defining a global variable (but by convention, REM would be a constant anyway, so it's no problem to just redeclare it later..) ---------------------------- @echo off REM = """ REM python -x skipped that first line... REM make sure to change the next line to REM whatever this file is called: python -x test.bat goto end """ # python code goes in here print "hello, world!" """ :end """ ---------------------------- cheers, -Michal http://www.sabren.com/ -- http://www.python.org/mailman/listinfo/python-list From ajung at sz-sb.de Tue Feb 15 13:28:07 2000 From: ajung at sz-sb.de (Andreas Jung) Date: Tue, 15 Feb 2000 19:28:07 +0100 Subject: Ann: PMZ - Poor Man's Zope Message-ID: <20000215192807.A3110@yetix.sz-sb.de> On Wed, Feb 02, 2000 at 01:29:05PM -0500, Andreas Jung wrote: > Dear all, > > I am happy to announce the availability of POOR MAN'S ZOPE 0.1. > > For further informations: http://www.suxers.de/pmz.htm The PMZ project is now hosted on Sourceforge. Please visit http://pmz.sourceforge.net for further informations. Cheers, Andreas From jchan at maxvu.com Tue Feb 22 22:49:13 2000 From: jchan at maxvu.com (Jerome Chan) Date: Wed, 23 Feb 2000 03:49:13 GMT Subject: ExitWindowsEx() Message-ID: Hi! I've been trying to use win32api's ExitWindowsEx() method call but I'm not very successful under PythonWin build 125 import win32api win32api.ExitwindowsEx(2|4,0) And Win98 just logs the user off and logs on again. It's suppose to reboot the machine. Any hints? From bparsia at email.unc.edu Sat Feb 12 23:34:44 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Sat, 12 Feb 2000 23:34:44 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1e5r2o4.14puk8l1i1mb9N%bparsia@email.unc.edu> <38A28A4A.AF5207B8@webamused.com> Message-ID: <1e5wjiu.1c8tm3v1dr1al7N%bparsia@email.unc.edu> Joshua Macy wrote: > Bijan Parsia wrote: > > > > Aahz Maruch wrote: > > > > > In article <38A19E79.5E88D2FC at prescod.net>, > > > Paul Prescod wrote: > > > > > > ... snip what Paul wrote in toto ... > > > > > > > I'll say. I went there to further my self-education only to find that > > > the official FAQ is only available in PDF and Postscript. > > [snip] > > > I'd just like to point out that here you're responding to what Aahz > wrote as a reductio ad absurdam to Paul's comments as if Paul had > written it, which isn't really fair. Ouch! Deepest apologies to Aahz for taking that seriously. Er...(quick revisionist history)...I was, uh, *extending* Aahz's absurdam by seeming to take it seriously! Yes! That's it. Maybe I was pretending to be a close minded member of the Smalltalk conspirac...er...community? ("We don't have to *fair*, we have left-flapping scrollbars!" ;)) Cheers, Bijan Parsia. From moshez at math.huji.ac.il Sat Feb 26 05:45:11 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 12:45:11 +0200 (IST) Subject: self argument In-Reply-To: <8984mm$5pi$1@nnrp1.deja.com> Message-ID: On Sat, 26 Feb 2000 london999 at my-deja.com wrote: > I am very new to Python, but it appears that every function defined in a > class must have self as a first variable name. No, it can call the argument what it likes. "self" is the most popular, by far. "me", "my" and "s" are poor contestants most people don't even know about. But it's a convention, not a rule. > Assuming that is the > case, it would be nice if there was an error message given when the > interpreter encounters a function that is defined without self (rather > than giving the error message "TypeError: no arguments expected" when > the function is called. It can't. Consider: class foo: pass def bar(): pass foo.bar = bar a = foo() a.bar() The only time the interpreter can give the error is when a.bar() is called, and that's when it does. > Even better, it would be nice (probably too late > I know), if self was defined implicitly as the "this" pointer is in C++. That would add another keyword to the language, and contradict one of Python's principles "explicit is better then implicit" -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit.holl at pobox.com Wed Feb 16 10:17:16 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 16:17:16 +0100 Subject: Moving from perl to python: questions In-Reply-To: <38AAB0ED.D9603D2F@austin.ibm.com>; from dfavor@austin.ibm.com on Wed, Feb 16, 2000 at 08:15:09AM -0600 References: <38AAB0ED.D9603D2F@austin.ibm.com> Message-ID: <20000216161716.A963@stopcontact.palga.uucp> David R. Favor wrote on 950685309: > I'm moving from perl to python. Good! > Attached is a simple snippet of code that I'm having trouble with. I do not see any attachement, sorry. > Questions: > > 1) Best way to convert array argv[1:] into string to pass functions You are looking for the 'join' function from the 'string' module: http://www.python.org/doc/current/lib/module-string.html#l2h-526 Please note that sys.argv is a list, not an array. I don't know about Perl, but in Python, those are two different things (there is an array module, too). > 2) How to implement a no-frills file slurp() function What does the 'slurp' function do? For file methods, look at: http://www.python.org/doc/current/lib/bltin-file-objects.html regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From bobNOSPAM at NOSPAMzippyhelp.com Sat Feb 5 20:11:40 2000 From: bobNOSPAM at NOSPAMzippyhelp.com (Robert Rutkowski) Date: Sun, 06 Feb 2000 01:11:40 GMT Subject: CGI Scripts Message-ID: I'm new to programing and in an effort to learn python, I'm trying to write a simple text counter. The script is called with an SSI exec command. The path on my server is correct and the script appears to work. I receive no errors, and the script runs just fine locally on my machine. My problem is that the script returns a result via the print command. {print `count()`}, but when I try to run the script on my server, I get no results, just a blank page. Am I missing something? Is there a module that I need to pass the result to to see it in my web browser. ----------------------------------------------------- #!/usr/contrib/bin/python #Python Counter Script import cgi import string def count(): count = open('counter.log', 'r+') strhits = count.read() hits = string.atoi(strhits) hits = hits+1 count.seek(0, 0) count.write(`hits`) count.close() return hits print "Content-type: text/html" print print `count()` ------------------------------------------------ From zeitlin at seth.lpthe.jussieu.fr Tue Feb 29 13:44:10 2000 From: zeitlin at seth.lpthe.jussieu.fr (Vadim Zeitlin) Date: 29 Feb 2000 18:44:10 GMT Subject: Which GUI? References: Message-ID: On 28 Feb 2000 21:42:56 GMT, William Tanksley wrote: >Well, I'm interested. wxWindows is nice. Perhaps a port on top of CDK >would be easier? www.vexus.ca/cdk? I get a 404 for this link and a quick search didn't find anything about it. What is CDK? >However, unless my memory is really bad, wxWindows used to support Curses. I think there was some kind of wxCurses port for 1.xx, but a) wxWin 2.x is quite different from 1.x (and uncomparably better too) b) I think it was never really usable (sorry if I'm mistaken) Regards, VZ From embed at geocities.com Thu Feb 24 09:29:05 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 24 Feb 2000 09:29:05 -0500 Subject: Porting Python to non-pc platforms References: <88uom6$e0j$1@nnrp1.deja.com> Message-ID: > > I have a question regarding which source files > (Modules,Objects,Parser,Python) are necessary to > get a "bare-bones" python interpreter running on > a non-pc platform. By non-pc I mean game console. > In my case I would still like to be able to embed > python in a C/C++ app and use it to execute > scripts. > > Thanks. I think the bigger problem on a "game console" is the lack of a filesystem. You would have to come up with a way of either storing scripts in NVRAM/SRAM or you would have to link them into the your program, somewhat defeating the idea of scripting. Warren From sholden at bellatlantic.net Thu Feb 10 07:39:44 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 10 Feb 2000 12:39:44 GMT Subject: Question about encryption in Python References: <38A1B469.35E03159@telebot.com> <38A2382D.7CA612E3@dgf.uchile.cl> Message-ID: <38A2B1AB.FAB1A29B@bellatlantic.net> Pablo Bleyer Kocik wrote: > > [flounder enquired about crypt compatibility] > Perl's crypt() and Python's crypt.crypt() call the system's crypt in > Unix. > Reminds me of the line about the cat that crept into the crypt, crapped and crept out again. Maybe I should get some sleep ... regards Steve -- "If computing ever stops being fun, I'll stop doing it" From a.eyre at optichrome.com Mon Feb 14 11:31:08 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 14 Feb 2000 16:31:08 -0000 Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: <001a01bf7708$e5af7c30$3acbd9c2@peridot.optichrome.com> > I am reading over the BSDDB license (bsddb is owned by sleepycat software) > and it appears that you can't compile and link the source code to > the BSDDB to a proprietary (non-free) application without paying Sleepycat. This is starting to become a FAQ. v1.85 has a more liberal licence. If you need the win32 port of the source, see: ftp://squirl.nightmare.com/pub/python/python-ext/misc/bsddbmodule.zip ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From poinot at onera.fr Fri Feb 25 09:59:15 2000 From: poinot at onera.fr (Marc POINOT) Date: Fri, 25 Feb 2000 15:59:15 +0100 Subject: Phyththon misspelling contest References: <8owt4.22169$Jz3.111396@nnrp1.uunet.ca> Message-ID: <38B698C3.18B690C6@onera.fr> > > Get Chaucerian, win valuable prizes! Extra points if none of > > your posts spells it the same way as any other. > > [ Picture of a large Python ] > > title: "Ce n'est pas un Python." > As StExupery says into "Le Petit Prince": Oh! Nice... is it a hat? __/--\__ No, this is not a hat. This is an elephant. It has been swallowed by a Python. Marcvs [alias Sorry for the very fuzzy translation] From tim_one at email.msn.com Mon Feb 28 03:42:28 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 28 Feb 2000 03:42:28 -0500 Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: <38B83903.9AC435E7@tismer.com> Message-ID: <001201bf81c7$be99f8e0$f0a2143f@tim> [posted & mailed] [Tim replies to Thomas Wouters, in a msg that get email'ed to Christian (because it griped about the lack of user-level Stackless docs), but apparently never made it to c.l.py due to the email outage at CNRI over the weekend of 26-Feb] [Christian Tismer, now replies to that, as if anyone other than he & I saw it] That was all by way of explaining why I'm not going to reply back on tech points in detail. Instead, > ... > Yessir. I felt guilty and added doc strings to everything I could find. > This doesn't make things easier, but it is now much easier to find > that out. :-) Don't sell it short prematurely -- a single cryptic docstring is infinitely more clue than users can get now. For example, as you've seen here recently, nobody but you has any idea what the purpose of .update() is. This was just tough love . > I was not sure about my continuation stuff, and I was waiting for > some replies from the python-dev gurus. I thought they would read my > paper with their given understanding of all the co-stuff, and given that > everything should be obvious. The implementation at that time, perhaps, but if you showed someone a detailed implementation of, e.g., a cactus stack or an AVL tree, they would still be left baffled by what the *point* to it all is. "If you're so smart, how come you're not rich?" turns into "if this is so great, how come nobody has done something mondo cool with it?". I was always hoping Sam Rushing would leap on this and fill that void with e.g. a Medusa on hyper steroids. I'd do it myself, except for my well-known inablility to think up anything useful <0.7 wink>. > Now this dodn't work out. Quite a few dev-people did understand me, > without giving me feedback beyond "great work, but what now?". Indeed, AVL trees are almost unused in the real world despite their theoretical attractions: there's usually a simpler & faster way to get any particular job done. So generators won't sell this. Coroutines, maybe, but that too will need a specific app to make benefits obvious. > Instead, I get lots of feedback from the "outer" world, and people > seem to really want to try this stuff, even when they have no clue > about anything that is non-procedureal. > I have to change some policies :-) Bingo. > ... > Next time I will publish a how-to: How to get mad with continuations, > compared to other ways of becoming unhappy. The best way to do that is to read Guido's essay on metaclass programming, study everything he did carefully, and write something the exact opposite in every respect except for accuracy -- am I joking? Only partly. Almost everyone who had the slightest interest in metaclass programming ran screaming in terror from that essay -- and, AFAIK, nobody has done anything useful with the Python-level metaclass hook either. > [info about the new implementation] Never mention the implementation in public again <0.5 wink>. > ... > SLP 1.1 is much simpler and much more powerful. You can now > run any frame at any time, even from a different thread. Why is that good? (It's a rhetorical question: the response info like this evokes is indeed "great work, but what now?") > And the code has become shorter. Frankly, nobody cares <0.1 wink -- pretend you're trying to sell a new brand of deodorant -- nobody cares if it's 7.8% less dense than before, but will be very impressed if you say it contains the new magic ingredient X3CT5 -- or especially if you imply that their chance of having sex again drops to zero unless they buy it>. > Not to mention that it is also faster than ever before: > 7% more pystone than standard Python, although I have the > safe destructors of nested structures in it. Ahem :-) Now *that* lights up eyeballs across the globe! People can put that on their plates, stab it with a variety of dinner forks, chew on it until they puke, and then beg for more. So sell it as an internal optimization of no further consequence . > Unfortunately, this paper is now *INVALID*. > I have to do a major rewrite. > Readers, please forget about the chapter concerning frame > compatibility. THIS IS NOT TRUE. > Please, also forget about dispatcher objects. THEY ARE GONE. Well, ya, OK, *I'm* interested -- but you don't have to sell it to me, and I'm not positive anybody else (besides Jeremy) has actually read the paper. A concise but accurate implementation sketch is sufficient for developers. This needs something else to make progress. like=a-catchy-slogan-or-celebrity-endorsement-ly y'rs - tim From aahz at netcom.com Wed Feb 23 17:50:19 2000 From: aahz at netcom.com (Aahz Maruch) Date: 23 Feb 2000 22:50:19 GMT Subject: Reducing Python's memory footprint? References: <38B3AA6A.C85FA919@wolfpack2000.com> Message-ID: <891o7b$h1f$1@nntp6.atl.mindspring.net> In article <38B3AA6A.C85FA919 at wolfpack2000.com>, Joel Hatch wrote: > >Is there any way to reduce Python's memory footprint? Or maybe to set up >some sort of Python-script server? To get a single copy of Python to >simultaneously interpret several independent scripts? Look at Medusa/asyncore. If the scripts might take a while to churn, take a look at Zope's Zserver. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From neelk at brick.cswv.com Sun Feb 13 17:29:57 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 13 Feb 2000 22:29:57 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: Tim Peters wrote: > [neelk at cswcasa.com, with an excellent & thoughtful piece, herewith > telegraphically condensed -- see the original for more context] > > > 1. Reference counting memory management > > Change that to "trash cycles aren't reclaimed", and it will eventually get > fixed (possibly sooner than later, given Neil S's latest work). Done -- this is what I meant anyway. :) > > 3. Multiple inheritance is unsound > > > > By 'unsound' I mean that a method call to a method inherited by a > > subclass of two other classes can fail, even if that method call > > would work on an instance of the base class. > > Unsure what this is about; am pretty sure nobody has complained about it > before. Certainly "depth first, left to right" is an unprincipled approach, > but in practice it's more than predictable enough to use. Here's some code: class Foo: x = 99 def frob(self): print "%d bottles of beer" % self.x class Bar: x = "bar" def wibble(self): print "Belly up to the " + self.x Note that all the operations on Foo and Bar work safely for direct instances of Foo and Bar. But if you define a subclass like so: class Baz(Bar, Foo): pass you can get type errors even though both of the superclasses have type-safe operations: >>> q = Baz() >>> q.frob() Traceback (innermost last): [...] TypeError: illegal argument type for built-in operation This is only an annoyance in day-to-day work, but it becomes a big problem if you are serious about building automatic code analysis tools for Python (eg for CP4E). This is because the soundness theorems needed to write things like soft typing tools no longer hold. :( > > 4. Lack of support for highly declarative styles of programming > > This is the hardest for me, because I love highly declarative styles but too > often find they grate against Python's greater love of "obviousness". I > certainly favor adding list comprehensions, because they're one happy case > where greater power and greater clarity coincide. Agreed that slinging higher-order functions around like there's no tomorrow is often very cryptic, but that's not quite what I meant. I mean "declarative" more in the sense of SQL, and I firmly believe that this is frequently far and away the most natural and obvious style of describing a very large class of problems. Deeply nested for loops aren't "obvious" either, unless you've been programming for years. Plus it's not just databases that can benefit -- empirically the constraint based approach to GUIs is much simpler to work with. And having two important and very different domains call out for this stuff is a big sign it's significant IMO. > > 6. The iteration protocol > > > > I've been pushing Icon's generators (Sather's iterators, if that's more > familiar -- "semi-coroutines" for the abstractoids) since '91. A very clean > & general iteration protocol can be built on that (e.g., iteration over > recursive structures is as natural as breathing). It's easy to implement > given Stackless. It's even easier to implement directly. Guido warmed to > it at one point last year, but hasn't mentioned it again (but neither have > I). I have only a nodding acquaintance with Icon or Sather, but I've programmed in CLU, and really enjoyed it. I suspect that in large part this was because of the cleanness with which iteration could be expressed in it. Iteration is an awful big chunk of what programs *do*, and being able to say it cleanly made writing them easier. Neel From robert at work.vc-graz.ac.at Thu Feb 3 06:10:35 2000 From: robert at work.vc-graz.ac.at (Robert Ladstaetter) Date: 3 Feb 2000 11:10:35 GMT Subject: Readable Functional Languages References: <87aerv$2d6$1@vvs.superst.iae.nl> Message-ID: <87bnnb$4hc$1@fstgss02.tu-graz.ac.at> Carel Fellinger wrote: > Admittedly off topic, I would like some advice on what language to choose > to explore the realm of functional languages given that I can't cope with > 'impure' languages like C, C++ and Perl and that I love Python mostly for > its readability and its adherence to the principle of least surprise that > lures me into thinking that it has no dark corners. how about sml? http://cm.bell-labs.com/cm/cs/what/smlnj/ -- mfG Ladstaetter Robert mailto:ladi at sbox.tu-graz.ac.at From gmcm at hypernet.com Fri Feb 18 11:08:01 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 11:08:01 -0500 Subject: Problem with Installer In-Reply-To: <88jnef$3nh$1@news.ndsu.nodak.edu> Message-ID: <1261232496-13825193@hypernet.com> Gingerich wrote: > I can't seem to get Gordon's installer to work for me. When I try to run > setuptk.py, I get the following error. > > >>> Finding TK installation... > Analyzing python dependencies of Tkinter c:\python\lib\lib-tk\Tkinter.py ... > analyzing tcl80.dll ... > analyzing tk80.dll ... > found binaries in C:\WINDOWS\lib > Traceback (innermost last): > File "C:\Python\Pythonwin\pywin\framework\scriptutils.py", line 313, in > RunScript > exec codeObject in __main__.__dict__ > File "C:\Python\installer\SetupTK.py", line 62, in ? > main() > File "C:\Python\installer\SetupTK.py", line 40, in main > for fnm in os.listdir(libin): > OSError: [Errno 3] No such process A normal TCL/TK installation has the .tcl scripts living in ../lib relative to where tcl80.dll and tk80.dll are found. Some TCL/TK using apps are bad and install tclxx.dll etc. in places like Windows/System[32]. In fact, when "Tk don't work" on Win32, (about twice a week), this is almost always the problem, (especially when xx != 80). That seems to be the case here. The error msg is misleading (sorry - I'll fix). Those dlls do NOT belong in Windows/System[32]. Other apps shouldn't break, if the Tcl/bin directory is on your PATH (Windows searches Windows/System[32] before your PATH). > If I try to run standalone.py, I get a similiar error, but I also have not > had a successful run of setuptk.py which needs to be run first. I have TCL > installed in my C:\Python directory, with the paths in my autoexec.bat. I > tried 3 Win98 machines and an NT4. All with the exact same error. I have > Winall build 1.27 installed with Py 1.52. So what am I doing wrong? Nothing. TCL/TK tries to be good, and Python follows their directions, but lots of other apps using TCL/TK screw it up. You Python/TK works because (1) the version in Windows/System[32] is the right one and (2) Python only searches the PATH, not the Windows dll search path (of which PATH is the last element). - Gordon From effbot at telia.com Fri Feb 11 05:01:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 10:01:34 GMT Subject: ruby AND python References: <950261724.813099@cdwork.cvt.stuba.sk> Message-ID: <26Ro4.5780$al3.76558@newsc.telia.net> Radovan Garabik wrote: > it is correct, however, that python is a bt inconsistent about what is an > object and what not. everything is an object. however, CPython 1.5.2 doesn't allow you to sub- class type objects. that's an implementation glitch, not a language feature. (please distinguish between implementations and the language itself, or we'll all end up like Lisp and Smalltalk). also see: http://www.deja.com/=dnc/getdoc.xp?AN=584197608 From moshez at math.huji.ac.il Sun Feb 27 00:45:38 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 07:45:38 +0200 (IST) Subject: functional programming In-Reply-To: <89achq$g33$1@news.udel.edu> Message-ID: [bjorn] > Identifying a call in a tail position is a simple >static analysis that isn't affected by Python's dynamicity [Terry Reedy] > But as Guido has pointed out, the recursiveness of the call is. The recursiveness of the call has nothing to do with tail call optimization. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From wrlddomprod at hotmail.com Thu Feb 24 11:06:31 2000 From: wrlddomprod at hotmail.com (Shawn LeBlanc) Date: Thu, 24 Feb 2000 08:06:31 PST Subject: testing? Message-ID: <20000224160631.75959.qmail@hotmail.com> My last three messages haven't shown up, I think. Shawn ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From boud at rempt.xs4all.nl Tue Feb 8 09:40:30 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 8 Feb 2000 14:40:30 GMT Subject: Database with a web-interface (CGI) References: <38A00022.3CC17880@aston.ac.uk> Message-ID: <87p9su$b8v$1@news1.xs4all.nl> Peter Bittner wrote: > Hi there! > I need to build a web-interface with a database in the background > (probably Oracle; possibly MySQL), so I need to write a Python > CGI-script that takes input from an HTML-form and puts the data into the > database (Input-operation) and, repectively, gets data out of the > database with an SQL-query and displays the result in the browser. > I've looked for example-source, but there doesn't seem to be much in the > Web on Python (unlike Perl & PHP). :o( > Does anyone have some example source? I've already sent you the stuff separately, but for the benefit of the common weal: on my website (http://www.valdyas.org/python) you can find a small cgi application that uses MySQLmodule (nowadays I would use MySQLdb, but it's an old app). I also think my approach to generating html is wrong, but it does work. I'd work with templates and %(name)s substitution, nowadays, but when I wrote this I came fresh from Pascal, Visual Basic and PL/SQL, and I didn't know any better. -- Boudewijn Rempt | http://www.valdyas.org From moore at oakland.edu Mon Feb 28 16:58:38 2000 From: moore at oakland.edu (Gary Moore) Date: Mon, 28 Feb 2000 21:58:38 GMT Subject: String processing inside lists Message-ID: After diligently and successfully going through 'Programming Python' I decided that a good first project would be to take my DVD collection (228 Discs) and build three different files (a tab delimited file for import into a database, an xml file for each movie, and a text file for each movie). I decided to gather the information from the Internet movie database .list files and then process and sort the output in python. The problem happened when I tried to use the construct: for x in actors to process the list of actors prior to output. When I use the string library to process this list, I want the actual strings contained in the list to change. What I found was that no matter how I tried to change the strings in the actors list, I was unsuccessful. e.g. temp = replace(x,'\012','') x = temp When I print x, I get the line with the text replaced. However, when I view the line in the original array actors, the changes were not made. The only way I could overcome this problem was to change the for statement to: for x in range(len(actors)) and then subscript the actors list to obtain the results e.g. temp = replace(actors[x],'\012','') actors[x] = temp My concern is that I must not be understanding some basic concept concerning the FOR loop in Python. I reread the material in 'Learning Python', but still could not understand why the first solution above did not work. I fnally completed a working prototype and successfully carried out the conversion of all of the information. It was amazingly fast, and I was very impressed with the power available with a minimum of effort (1 day). If anyone could clarify the situation above, I would appreciate it. Thanks, Gary Moore moore at oakland.edu Mount Clemens, Michigan, USA PS Sorry about the long message. :) From sabren at manifestation.com Thu Feb 10 01:10:01 2000 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 10 Feb 2000 01:10:01 -0500 Subject: will python 3000 break my code? Message-ID: <87tkoi$hql$1@nntp1.atl.mindspring.net> Hey all, I noticed this just recently on http://www.python.org/1.5/ ... > The new release schedule provides for a 1.7 > release later in 2000 (or early 2001); after that, > we'll be working on "Python 3000" (the new code > name for the grand Python redesign; the language > will be incompatible). I did a search for "Python 3000" on the SIGS, and came up with only a handful of hits... It looked like maybe the import style and type checking might change, but from what I could tell, everyone wanted to avoid breaking old scripts... "The language will be incompatible" seems like kind of a dangerous statement to be making without backing it up... As much as I love python, for example, I can't very well recommend using it if everything I write will have to be thrown out in a year or two. Anyone know what, specifically, will not be compatible, and compared to what? :) -Michal http://www.sabren.com/ From hei at adtranzsig.de Tue Feb 1 08:36:48 2000 From: hei at adtranzsig.de (Dirk-Ulrich Heise) Date: Tue, 1 Feb 2000 14:36:48 +0100 Subject: Namespace pollution References: Message-ID: <949415939.75416@news.adtranzsig.de> Moshe Zadka schrieb in Nachricht ... >Use OO -- classes were meant >exactly to reduce namespace clutter by keeping the functions "inside" the >objects. Ahem. No, that's not the reason to define a class. I mean, maybe it's a reason for you, but not for me. Anyway, the thread revealed some interesting points. I was close to finding the "nested functions" thing acceptable until i read [Terry Reedy] > The problem with this is that function X is recreated everytime you call > function Y. So, the only remaining solution without a runtime penalty for not cluttering a classes interface (yes, i do use classes) is to define them "__" methods. I find that ugly, so i'll stick to my overly lengthy functions and methods. (which are not a real problem with a folding editor and a 2-space indentation) -- Dipl.Inform. Dirk-Ulrich Heise hei at adtranzsig.de dheise at debitel.net From effbot at telia.com Thu Feb 3 18:09:25 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 03 Feb 2000 23:09:25 GMT Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> Message-ID: Curtis wrote: > I would kill for a Python cookbook/algorithm book!! good thing you didn't make it to the python conference ;-) for your amusement, here's a list of existing cookbook-ish Python books, in no specific order. + Python Annotated Archives (by Martin Brown): http://www.python.org/psa/bookstore 50+ sample scripts from various sources; extensive annotations by the author. massive piece of work. + Programming with Python (by Tim Altom): http://www.python.org/psa/bookstore have only browsed it, but it appears to be a budget version of the annotated archives. early reviewers seem to think it's no good, so you may wish to check it out in a bookstore before buying it. + The Python Grimoire (by Andrew Kuchling): http://starship.python.net/crew/amk/grimoire/ work in progress; sample scripts from various (mostly unattributed?) sources; sorted by task. (like martin's book, this seems to contain some eff-bot code, so it cannot be all bad ;-) + (the eff-bot guide to) The Standard Python Library, eMatter edition (by Fredrik Lundh): http://www.pythonware.com/people/fredrik/librarybook.htm 320 sample scripts, sorted by standard library module. more code and less annotations than the others (after all, python code is supposed to be easy to read ;-). From effbot at telia.com Mon Feb 21 12:08:59 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 17:08:59 GMT Subject: Which GUI? References: <38ADE800.9C7E60E4@durham.ac.uk> Message-ID: J.C.Travers wrote: > something as un-python like as Tcl/Tk (even > with the Tkinter wrappers) repeating a lie won't make it true. since you still don't understand what Tkinter is, but still think it's perfectly okay to spread mis- information about it, here are some facts: Tkinter is a component oriented UI library, which is carefully designed to work well with Python. and vice versa -- a certain Python feature was in fact added in part to make Tkinter a bit easier to use (can you name this feature?) Tkinter is not the same thing as Tcl/Tk. Tkinter doesn't rely on Tcl (libtk needs libtcl, but that's not the same thing -- and others have explained why things are this way. besides, most Unixes come with libtcl and libtk installed these days). in fact, Tkinter isn't tightly bound to libtk. It's not that hard to implement all relevant parts of Tkinter on top of other user interface libraries (this has been done, of course). (before flaming back, please spend five minutes trying to figure out who wrote Tkinter, and who's been main- taining Tkinter for the last five years. then spend five minutes trying to figure out who wrote Python. then spend five minutes thinking about what you just figured out. after that, if you still think Tkinter isn't Python-like, please come up with a better argument than your "I'm not qualified" post) From rchowd1 at my-deja.com Mon Feb 21 01:11:38 2000 From: rchowd1 at my-deja.com (rchowd1 at my-deja.com) Date: Mon, 21 Feb 2000 06:11:38 GMT Subject: Win 95, PWS, Unable to run python Message-ID: <88qkup$gk8$1@nnrp1.deja.com> PWS (Personal Web Server) is running on my Windows 95 OS. But whenever I am trying to execute the Test.asp file I get entire Test.py file as is instead of getting executed. Could you please let me know what I am doing wrong. The following files work when I use APACHE WEB SERVER. Test.asp file ------------- Test Python CGI in WIN 95 ========================================================== Test.py file ------------ #!c:/Program Files/Python/Python.exe if __name__ == '__main__': print 'Content-type: text/html' print '\n\n' print '

Python CGI on WIN 95 works

' ========================================================== Sent via Deja.com http://www.deja.com/ Before you buy. From sabren at manifestation.com Mon Feb 14 12:28:46 2000 From: sabren at manifestation.com (Michal Wallace) Date: Mon, 14 Feb 2000 12:28:46 -0500 Subject: Docu tools References: <8892da$hl8$1@nnrp1.deja.com> Message-ID: <889e1a$3cv$1@nntp9.atl.mindspring.net> Ng Pheng Siong wrote in message <8892da$hl8$1 at nnrp1.deja.com>... >Is there code available to handle Perl's POD format? I was thinking about that myself the other day... POD doesn't make as much sense for python because you can actually load up a module and iterate over its docstrings.... So you don't have to think in terms of =head 's.... Tom Bryan posted some simple code that does this on the 12th, under the heading "Re: Javadoc Equivalent" -Michal http://www.sabren.com/ From effbot at telia.com Tue Feb 8 05:04:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 10:04:35 GMT Subject: const in Python References: <1262179804-3408142@hypernet.com> Message-ID: Anders M Eriksson wrote: >> > If you are truly concerned, you could make them attributes of >>> a class that prohibits setattr. But generally naming > > >Right, like this: > > > >class ReadOnly: > > def __setattr__(self, name, value): > > if self.__dict__.has_key(name): > > raise TypeError, 'value is read only' > > self.__dict__[name] = value > > > >>>> const = ReadOnly() > >>>> const.x = 5 > >>>> const.x = 9 > >TypeError: value is read only > > Thank You! I love your class and it will from now be in every program > I make. so you don't trust yourself enough to avoid overwrite anything using a certain name convention (UPPERCASE is pretty much standard in Python land), but are 100% convinced you won't ever overwrite the 'const' variable? interesting ;-) From sholden at bellatlantic.net Tue Feb 8 08:02:34 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Tue, 08 Feb 2000 13:02:34 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262139803-5814898@hypernet.com> <87ocad$to2$1@nnrp1.deja.com> Message-ID: <38A01404.C761A529@bellatlantic.net> >From the Python Style Guide, by some guy called van Rossum ... (http://www.python.org/doc/essays/styleguide.html): "Tabs or Spaces? One indentation level is 4 spaces. Two levels is one tab. Three levels is a tab and 4 spaces, and so on. Python doesn't mind if you indent one line with 8 spaces and the next line with a tab -- they are considered to have the same indentation. Replacing all tabs with spaces is more robust in the light of some editors on the Mac or PC (which default to displaying the tab character as 4 spaces instead of 8, as God intended) but this can be done on transfer to such platforms." IMHO this whole thread is a prime example of Oscar Wilde's aphorism: "The only thing you can possibly do with good advice is pass it on". If indentation as block structure is a problem there are dozens of other languages around. I suppose it's human nature to complain about that we cannot change. regards Steve fcahoon at my-deja.com wrote: > [discussion of how tabs are really 8 spaces] > I think this should be in the Python FAQ. Or is it, and I missed it > somehow? If so, please excuse my oversight. > From tim_one at email.msn.com Mon Feb 28 20:43:34 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 28 Feb 2000 20:43:34 -0500 Subject: thread problem In-Reply-To: Message-ID: <000a01bf8256$643bc420$0aa0143f@tim> [posted & mailed] [Greg Wilson] > I'm trying to implement futures in Python using threads. Cool! > ... > My implementation is included below. The problem is that I'm setting > 'self.result' in the child thread, but when the __call()__ returns, the > value has gone back to 'None'. There's nothing in the docs about objects > being cloned during thread creation --- I'd be grateful if anyone > could tell me what's up. It's trivial . evaluate() *does* set self.result, but look at how you invoke it: > self.result = self.evaluate() Your evaluate() method doesn't have a "return" stmt, it just falls off the end. So evaluate() returns None, which you immediately write over the correct self.result. Change the line above to self.evaluate() or change evalute() to return the result (I like that better, btw), and it works fine. BTW, think about using the threading module instead, and using a threading.Event object. It's much less error-prone than using the thread module and a raw mutex. you-don't-get-extra-points-for-skinning-the-beast-with-your-teeth-ly y'rs - tim From dilsavor at erinet.com Thu Feb 10 22:52:19 2000 From: dilsavor at erinet.com (Ronald L. Dilsavor) Date: Thu, 10 Feb 2000 23:52:19 -0400 Subject: How to do this? - newbie References: <38a2e958$0$1403@news.voyager.net><38A2EE79.14190ABA@bellatlantic.net> Message-ID: <38a3892d$0$96317@news.voyager.net> > From: Steve Holden > Organization: Holden Web: Intranet Technology Specialists > Reply-To: sholden at BellAtlantic.net > Newsgroups: comp.lang.python > Date: Thu, 10 Feb 2000 16:59:10 GMT > Subject: Re: How to do this? - newbie > > "Ronald L. Dilsavor" wrote: >> >> Hi, >> I am new to python and am quite excited about it. I spent much of last night >> writing my fist code snippet and I came across 1 thing which I could not >> figure out how to do. >> >> Suppose >> >>>>> a=('x',1) >> then how can I create an x of numerical type such that >>>>> print x >> 1 >> >> - just using manipulations of a = ('x',1) >> >> Also let me know if this type of thing would not be considered best practice >> in python. I thought I would need to make use of eval() but could not find >> an incantation that would do it. >> >> Thanks, >> Ron > I am sure there are people reading this group who can tell you > how to dynamically construct something which will create a > variable called a and assign it the value 1. > > But it seems you really want to be able to retrieve the numeric > value using the symbol 'a' as a key, and that's what dictionaries > are for. > >>>> mydict={} # empty dictionary >>>> mydict['a']=1 # enter value 1 against key 'a' >>>> print mydict['a'] # retrieve the value > 1 >>>> > > Is *that* what you want? > > regards > Steve > In fact that is exactly what I ended up doing (using a dictionary) and I may just keep it that way. I was just wondering how to do it the way I asked. Ron From schneiker at jump.net Wed Feb 16 09:15:34 2000 From: schneiker at jump.net (Conrad Schneiker) Date: Wed, 16 Feb 2000 14:15:34 GMT Subject: RFD: comp.lang.ruby Message-ID: <950710534.22080@isc.org> REQUEST FOR DISCUSSION (RFD) unmoderated group comp.lang.ruby This is a formal Request For Discussion (RFD) for the creation of of an unmoderated group comp.lang.ruby. This is not a Call for Votes (CFV); you cannot vote at this time. Procedural details are below. Newsgroup lines: comp.lang.ruby The Ruby programming language. RATIONALE: comp.lang.ruby Ruby is a relatively new very-high-level language developed in Japan. Ruby is a dynamic object oriented programming language that 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 also an open source language. There are over 1000 members of 4 Japanese Ruby mailing lists (general, developers, math, extension writers), with a peak volume topping 100 messages per day. At present, there is only one English Ruby mailing list with about 125 members, with a recent volume of 5-10 messages per day; however this should approach the traffic level of the Japanese lists as more English-speaking people learn Ruby and as English language Ruby documentation continues to become increasingly available. A survey of DejaNews shows 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. 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 in the realm of the takeoff threshold that both Perl and Python attained many 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 would include, but 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. PROCEDURE: This is a request for discussion, not a call for votes. In this phase of the process, any potential problems with the proposed newsgroups should be raised and resolved. The discussion period will continue for a minimum of 21 days (starting from when the first RFD for this proposal is posted to news.announce.newgroups), after which a Call For Votes (CFV) will be posted by a neutral vote taker. Please do not attempt to vote until this happens. All discussion of this proposal should be posted to news.groups. This RFD attempts to comply fully with the Usenet newsgroup creation guidelines outlined in "How to Create a New Usenet Newsgroup" and "How to Format and Submit a New Group Proposal". Please refer to these documents (available in news.announce.newgroups) if you have any questions about the process. DISTRIBUTION: This RFD has been posted to the following newsgroups: news.announce.newgroups, news.groups, comp.lang.perl.misc, comp.lang.python, comp.lang.java.programmer, and the following mailing list: ruby-talk at netlab.co.jp (English language Ruby discussion group) Subcribe via: ruby-talk-ctl at netlab.co.jp ('subscribe first_name last_name' in body) Proponent: Conrad Schneiker From timd at macquarie.com.au Tue Feb 22 20:16:38 2000 From: timd at macquarie.com.au (Timothy Docker) Date: 23 Feb 2000 12:16:38 +1100 Subject: catching X client kills in Tkinter References: <88v7ll$7ai$1@wanadoo.fr> Message-ID: "Jerry" <2jerry at writeme.com> writes: > Are you sure script exit ? > try ps -edf I think jobs is here. > I'm not sure killing displayer (X server) will explicitly kill the > x.mainloop too ? It sure looks like it. It was running in a shell in the foreground, and came back to the prompt as soon as I did the kill. Tim Docker From tseaver at starbase.neosoft.com Fri Feb 18 20:07:54 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 18 Feb 2000 19:07:54 -0600 Subject: static class methods in Python? References: <1261276284-11190393@hypernet.com> Message-ID: <2C7AE539CADBBF4A.C345D00941B33669.96C6F0EC4793FC16@lp.airnews.net> In article , Neel Krishnaswami wrote: >Gordon McMillan wrote: >> Greg Wilson asks: >> > Have there been any proposals to add the equivalent of "static" >> > methods (belonging to the class, not to instances) to Python? >> >> The complaints vastly outnumber the proposals. >> >> The most common complaint is the lack of C++ style static >> methods. These are usually greeted with hordes of ugly >> workarounds. > >This is probably a stupid question, but what /is/ a class method? >I've never programmed in C++ (or Java), so an explanation would >be appreciated. It is properly a "static" method in C++, which is declared inside a class and which has access to all static data (like class data in Python) in the class: public/protected/private. It can also get to privately declared things like constructors, and to the private instance data of instances of its class passed to it as parameters. One canonical use is to implement the Singleton pattern, e.g.: class Unique { public: static Unique* theUnique() { if( ! s_theUnique ) { s_theUnique = new Unique(); } return s_theUnique; } // other methods elided. private: Unique(); //implemented out of line static Unique* s_theUnique = 0; }; Clients of the Unique class will be guaranteed to get the one-and-only instance of Unique, because they can't get to the constructor, but have to go through the "singleton" method. Static methods have traditionally been used as callbacks, because the interfaces to which the callbacks were passed expected a "real" function, (normal methods' pointers are of a different type than *function.) The canonical callback registration allowed for a pointer-to-function taking a single void* argument, and for the void* to be passed to it. A static method could be passed, because static methods are/were link compatible with global functions of the same signature (this has morphed recently). Does-the-FCC-know-about-all-this-static?'ly Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From mikael at isy.liu.se Mon Feb 14 09:46:35 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 15:46:35 +0100 (MET) Subject: When to compile regex? In-Reply-To: <20000214151918.D658@stopcontact.palga.uucp> Message-ID: On 14-Feb-00 Gerrit Holl wrote: > writing-an-empty-program-is-always-the-fastest-solution-ly y'rs - gerrit No doubt! /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-Feb-00 Time: 15:44:34 This message was sent by XF-Mail. ----------------------------------------------------------------------- From reic0024 at ub.d.umn.edu Fri Feb 4 16:23:38 2000 From: reic0024 at ub.d.umn.edu (Aaron J Reichow) Date: Fri, 4 Feb 2000 15:23:38 -0600 Subject: Dist. Object Directory (was: Re: An FTP based Python Module repository) In-Reply-To: References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: On 4 Feb 2000, chris patti wrote: > Another big win in this is that it eases the automated retrieval and > installation of modules, in the Perl world we have CPAN.pm which lets > you say things like: > > install frobnitz > > And it will search the archive, find the latest version, download it > and install it to your local Perl installation. And to me, a similarily interesting idea would be to have a server with a number of mirrors, that could host remote objects using dopy (alpha code, but easy to use IMO) or fnord. This probably isn't the most practical of all things, but the idea fascinates me. Aaron From yueqiang at earth.usc.edu Wed Feb 2 21:07:50 2000 From: yueqiang at earth.usc.edu (Yueqiang Huang) Date: Wed, 2 Feb 2000 18:07:50 -0800 Subject: installation error: version 1.5.2 on Unix Message-ID: The machine I am using is CPU Type is sparc App Architecture is sparc Kernel Architecture is sun4u OS Name is SunOS OS Version is 5.6 Kernel Version is SunOS Release 5.6 Version Generic_105181-17 [UNIX(R) System V Release 4.0] The error message is gcc python.o \ ../libpython1.5.a -lsocket -lnsl -ldl -lm -o python Undefined first referenced symbol in file Py_Main python.o ld: fatal: Symbol referencing errors. No output written to python *** Error code 1 make: Fatal error: Command failed for target `link' which is the last step in make. Any idea? Thanks in advance! yueqiang From drew.csillag at starmedia.net Wed Feb 16 16:04:00 2000 From: drew.csillag at starmedia.net (Andrew Csillag) Date: Wed, 16 Feb 2000 16:04:00 -0500 Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> <88f1lr$ola$1@nntp4.atl.mindspring.net> Message-ID: <38AB10C0.931F8F19@starmedia.net> Michal Wallace wrote: > > Fredrik Lundh wrote in message ... > >Michal Wallace wrote: > >> I betcha it can!... How about this? > >> > >> ### > >> > >> def cStyleIIF(condition, iftrue, iffalse): > >> if eval(condition): > >> return eval(iftrue) > >> else: > >> return eval(iffalse) > >> > >> > >> x = 5 > >> y = 20 > >> a = cStyleIIF("x>> x = 5 >>> y = 20 >>> a = x a and b or c >>> a 5 >>> -- 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 gerrit.holl at pobox.com Fri Feb 25 11:33:14 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 25 Feb 2000 17:33:14 +0100 Subject: setattr and variable names: bug or feature? Message-ID: <20000225173314.A19726@stopcontact.palga.uucp> Dear bottomless information source, >>> class Foo: ... pass ... >>> setattr(Foo, '', '') >>> setattr(Foo, '`', '') >>> setattr(Foo, '\'', '') >>> setattr(Foo, '!@#{}\0\0\0', '') >>> dir(Foo) ['', '!@#{}\000\000\000', "'", '__doc__', '__module__', '`'] Is this a bug or a feature, or None of both? just-found-it-interesting-ly y'rs - gerrit From thomas at xs4all.net Mon Feb 7 11:34:59 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Mon, 7 Feb 2000 17:34:59 +0100 Subject: Insecure string pickle? In-Reply-To: <816010E2456BD111A48700805FBBE2EE01C6047B@ex-quebec-u1.baan.com>; from Gaetan_Corneau@baan.com on Mon, Feb 07, 2000 at 10:27:38AM -0500 References: <816010E2456BD111A48700805FBBE2EE01C6047B@ex-quebec-u1.baan.com> Message-ID: <20000207173458.I19265@xs4all.nl> On Mon, Feb 07, 2000 at 10:27:38AM -0500, Gaetan Corneau wrote: > I have put objects (magazine routing lists) in a shelf. I can list all the > keys, and I can load all objects except one. > When I try to load a particular list (using it's name), I get the following > error message: > ValueError: insecure string pickle > What does that mean? Well, it is impossible to tell for sure without knowing the name of the particular list and it's contents, but something goes wrong with the unpickling of the data. cPickle is slightly picky about which strings it unpickles, it refuses to load strings that look fishy. Apparently, part of the stored data looks weird, to cPickle, perhaps due to a strange amount of backslashes, quotes or otherwise weird characters -- i've never seen this myself. You can try to circumvent it by using pickle instead of cPickle... You'll either have to edit the shelve.py module, though, or do something this: import shelve import pickle shelve.Pickler = pickle.Pickler shelve.Unpickler = pickle.Unpickler The placing of the added code is irrelevant as long as you place your code between the import of shelve and the actual usuage of shelve. The problem could also just be that your shelve is broken. Some pieces fell off, and the parts that are left are too weird to decode... It depends on what was stored in it. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jeremiah at widomaker.com Mon Feb 7 10:46:22 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:46:22 GMT Subject: nonlinear programs? Message-ID: <389DF80F.552984F4@widomaker.com> I am writing an mpg123 frontend in Python. I want to have the user be able to play a song, and while it's playing skip the song, or quit the program(without hitting Control-c). Is there a way for me to start mpg123, then sort of move the song-playing into the background, and continue to take the user's input? Something like a while loop, so that while x == 1, play the mp3, if x != 1(the user clicks the next button) then skip to the next mp3? Thank you greatly for any help. From sholden at bellatlantic.net Thu Feb 3 08:48:55 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 03 Feb 2000 13:48:55 GMT Subject: Problem : using ADO in ASP References: <86vjhe$grb$1@nnrp1.deja.com> Message-ID: <3899875E.6ECA9D91@bellatlantic.net> Mark Hammond wrote: > >[question about using ADO] > > The traceback gives you a clue: > > > Output from Python : > > > > > > Python ActiveX Scripting Engine error '80020009' > > > > Traceback (innermost last): File "
------------------------------------------------------- Results (of course the browser silently renders the "" as the null string...): ------------------------------------------------------- 3

WebCallback

TeamFinancial

USSInet


(, -1) ------------------------------------------------------- Clearly there's some clever stuff hidden under the COM object which I don't understand. Without wishing to go through the "six months of mental fog" which I've read can be necessary to understand COM, can anyone point me to a simple morphology of ADO in Python? regards Steve From money at cs.bu.edu Mon Feb 21 16:22:54 2000 From: money at cs.bu.edu (steven moy) Date: 21 Feb 2000 21:22:54 GMT Subject: Formatting a numerical string w/commas Message-ID: <88sabe$oed$1@news3.bu.edu> Is there an easy way to format a numerical string with commas in the appropriate places? I also want to be able to handle +/- and decimal places as well. For example, I would want to convert -1234567.89 to -1,234,567.89. I know how to do it in Perl: sub commify { local $_ = shift; 1 while s/^(-?\d+)(\d{3})/$1,$2/; return $_; } Can anyone provide me with a Python equivalent? Thanks, -$ From jstok at bluedog.apana.org.au Mon Feb 7 00:21:46 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 7 Feb 2000 16:21:46 +1100 Subject: Worldpilot References: <389DAD6F.100404A4@fourthought.com> <66qn4.20006$3b6.85615@ozemail.com.au> Message-ID: Evan Simpson wrote in message ... >Jason Stokes wrote in message >news:66qn4.20006$3b6.85615 at ozemail.com.au... >> >> Where can I find Wordpilot? Is it a commercial application? > >http://www.worldpilot.org is where you can find this fine open-source Zope >application. I thought of that URL, but the site appears to be down at the moment: Not Found The requested URL /site/view1 was not found on this server. ---------------------------------------------------------------------------- ---- Apache/1.3.3 Server at easymail Port 80 I'll try again later. From effbot at telia.com Tue Feb 15 16:54:08 2000 From: effbot at telia.com (Fredrik Lundh) Date: 15 Feb 2000 15:54:08 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 15) Message-ID: Correction: Forget what the eff-bot said in last week's URL. Consortium member Advanced Simulation Technology, Inc (ASTi) has its website at: http://www.asti-usa.com/ A new SIG has been established: all kinds of Python compilers and Python analysis tools will be discussed on the compiler-sig: http://www.deja.com/=dnc/getdoc.xp?AN=583755581 http://www.python.org/sigs/compiler-sig/ More SPAM8 conference coverage: Jeff Shelton (of zopeNewbies fame) covers the zope track in more detail: http://weblogs.userland.com/zopeNewbies/2000/01/25 (tuesday) http://weblogs.userland.com/zopeNewbies/2000/01/26 (wednesday) http://weblogs.userland.com/zopeNewbies/2000/01/27 (thursday) Ka-Ping Yee took notes during the compiler session on developer's day: http://www.python.org/sigs/compiler-sig/dev-day-notes.txt Talking about conferences, Paul Everitt notices that it's now 6 years since SPAM1: http://www.deja.com/=dnc/viewthread.xp?AN=585046812 Quite a noisefest on comp.lang.python this week; if you're interested in why Python really needs a new syntax, check out the newsgroup archives. If not, read on. Neel Krishnaswami improves the signal-to-noise ratio by posting half-a-dozen "real problems with today's Python": http://www.deja.com/=dnc/viewthread.xp?AN=583770349 Barry Warsaw tells prospective CPython hackers how to configure emacs' cc-mode: http://www.deja.com/=dnc/getdoc.xp?AN=584320718 Warren Postma ports Python to Phar Lap TNT: http://www.deja.com/=dnc/getdoc.xp?AN=584219526 Greg Ewing announces Plex 0.1, a flexible tokenizer tool: http://www.deja.com/=dnc/getdoc.xp?AN=582911825 http://www.cosc.canterbury.ac.nz/~greg/python/Plex Jon Udell writes about Python from a Perl perspective. http://www.byte.com/feature/BYT20000201S0001 Will Python 3000 (aka Py3K, formerly known as 2.0) break existing programs? http://www.deja.com/=dnc/viewthread.xp?AN=584428737 Finally, Robert Wentworth notices that Python's now being talked about in the wonderful world of fashion: http://www.deja.com/=dnc/getdoc.xp?AN=584887423 ======================================================================== 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 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 Python To-Do List anticipates some of Python's future direction http://www.python.org/cgi-bin/todo.py The Vaults of Parnassus ambitiously collects Python resources http://www.vex.net/~x/parnassus/ 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 tottinge at concentric.net Fri Feb 11 11:53:25 2000 From: tottinge at concentric.net (Tim Ottinger) Date: 11 Feb 2000 11:53:25 EST Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> <1e5swv6.1q9lq2u1flfqi0N%bparsia@email.unc.edu> Message-ID: <38a43d45.12878348@news.concentric.net> On Thu, 10 Feb 2000 23:03:45 -0500, bparsia at email.unc.edu (Bijan Parsia) wrote: >Quinn Dunkan wrote: >> Ok, this is getting a bit OT, but what the hey: And slightly moreso due to me, I fear... >> This is a good expression of my problem with smalltalk. I like the language, >> I'm impressed with squeak, but I don't see how I can use it. The first >> problem is that I don't want to use the built-in editor, I have my own tools >> and I prefer them for a reason. > >Sure. It drives me nuts when I *can't* use em :) Python without GVIM? That reminds me -- I need to go into GVIM and compile it for Python scripting. Has anyone tried much extensive GVIM/Python programming? I'm wondering if it makes a good Python IDE. The python IDES I know of use their own editors, but those aren't as powerful (or familiar, frankly) as GVIM. >I think I answered this in another post, but GNU Smalltalk and Little >Smalltalk (which is not active, AFAIK) aim at this. As I said, the ANSI >standard deliberately moved away from *requiring* a image/vm approach, >and indeed, made it possible to write conforming (and thus portable) >programs that will run in an image and in, I guess, an interpreter of >some sort. This isn't a huge priority for me since I'm more interested >in the virtual image approach, but making a "smalltalk scriping system" >is certainly doable. A fine idea would be if it just exported the part you wanted to edit, called your editor, and then re-imported automagically. Better if it can be done via menu click and/or keystroke. Heck, I'd like that for Python IDEs, even command lines. Sort of like the ksh commands to edit history lines... hmmm.... Tim (not-that-one-but-ottinger-ly) From Matthew.R.Wette at jpl.nasa.gov Sat Feb 19 11:01:21 2000 From: Matthew.R.Wette at jpl.nasa.gov (Matt Wette) Date: 19 Feb 2000 08:01:21 -0800 Subject: dynamically extend classes Message-ID: <7kwvo1mbam.fsf@jpl.nasa.gov> Is there a way to dynamically extend classes in Python? I'd like to be able to have sitecustomize.py import a module and add methods to a class so that later, when anohter modules imports this module and uses the class it sees the added methods. Doable? Matt -- Matthew.R.Wette at jpl.nasa.gov -- I speak for myself, not for JPL.
Author:' Charles From amused at webamused.com Sat Feb 5 22:35:25 2000 From: amused at webamused.com (Joshua Macy) Date: Sun, 06 Feb 2000 03:35:25 GMT Subject: CGI Scripts References: Message-ID: <389CE999.F27E51F8@webamused.com> Are you remembering to include the extra newline required by the protocol after a Content-type header? try this instead: print "Content-type: text/htmln\n\n" Joshua Robert Rutkowski wrote: > > I'm new to programing and in an effort to learn python, I'm trying to write > a simple text counter. The script is called with an SSI exec command. The > path on my server is correct and the script appears to work. I receive no > errors, and the script runs just fine locally on my machine. > My problem is that the script returns a result via the print command. {print > `count()`}, but when I try to run the script on my server, I get no results, > just a blank page. > Am I missing something? Is there a module that I need to pass the result to > to see it in my web browser. > > ----------------------------------------------------- > #!/usr/contrib/bin/python > > #Python Counter Script > > import cgi > import string > > def count(): > count = open('counter.log', 'r+') > strhits = count.read() > hits = string.atoi(strhits) > hits = hits+1 > count.seek(0, 0) > count.write(`hits`) > count.close() > return hits > > print "Content-type: text/html" > print > print `count()` > ------------------------------------------------ From jimbag at kw.igs.net Thu Feb 24 08:11:38 2000 From: jimbag at kw.igs.net (JB) Date: Thu, 24 Feb 2000 13:11:38 GMT Subject: comp.lang.python.announce??? Message-ID: <38B52E05.5C8A015B@kw.igs.net> Is the comp.lang.python.announce ng dead or is my provider? Last post I've seen there was Feb 6 00. cheers jb -- Many aligators will be slain, but the swamp will remain. From vijaybaliga at hotmail.com Mon Feb 21 14:17:50 2000 From: vijaybaliga at hotmail.com (Vijay Baliga) Date: Mon, 21 Feb 2000 11:17:50 -0800 Subject: Newbie question about exceptions Message-ID: <88s311$dt1@news.dns.microsoft.com> Why isn't "finally" allowed with "try/except"? Ideally, I would like to do the following: try: f1 = open(file1) use(f1) f2 = open(file2) use(f1, f2) f3 = open(file3) use(f1, f2, f3) except: print 'File open error' finally: f1.close() f2.close() f3.close() So the file handles are always closed, even if an exception occurs while opening the files. The only solution that I can think of is: try: try: f1 = open(file1) use(f1) f2 = open(file2) use(f1, f2) f3 = open(file3) use(f1, f2, f3) finally: f1.close() f2.close() f3.close() except: print 'File open error' However, I don't like it because it is more verbose and everything is indented an additional tab stop. Thanks in advance for any help, Vijay vijaybaliga at hotmail.com From moshez at math.huji.ac.il Sat Feb 19 14:25:48 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 21:25:48 +0200 (IST) Subject: Replacing "\"s using re.sub In-Reply-To: <38AEC633.C0FA6EC@erols.com> Message-ID: On Sat, 19 Feb 2000, Edward C. Jones wrote: > I need to replace all instances of "\" in a string with "\\". The > function "re.sub" looks like the way to do it. "re.sub" is called > by "re.sub(pattern, repl, string)". For my problem what should > "pattern" and "repl" be? If you're looking to *replace* one *string* with another, why not go for string.replace? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tismer at tismer.com Sat Feb 26 15:35:15 2000 From: tismer at tismer.com (Christian Tismer) Date: Sat, 26 Feb 2000 21:35:15 +0100 Subject: Continuations and threads (was Re: Iterators & generators) References: <000001bf7a9e$8401dfc0$a02d153f@tim> Message-ID: <38B83903.9AC435E7@tismer.com> Tim Peters wrote: > > [Thomas Wouters] > > I may be too confused to tell for sure, but i have a gut feeling > > that i'm getting closer and closer to some complete and utterly > > consistent cluelessness of this issue. > > That means you're close to getting frustrated enough to make a real > breakthrough <0.9 wink>. That's the way, I guess. At least it was mine, and I'm known as the "Clueless Implementor" (TM). > > ... > > and this continuations business isn't some huge PSU conspiracy to > > scare the bejezes out of everyone, to make sure continuations do > > _not_ make it into Python ;) > > That's indeed how this topic has ended each time over the years, and for > exactly that reason. The never-ending story will find an end. After I've found a way to redefine truth, I will also find a redefinition of "never". "never" is the female formulation of "perhaps", which is btw. also applicable to Guido. (duck and cover) > I was going to yell at you to read the docs, but after downloading all > Christian's latest stuff I realized what should have been obvious before: > while Christian has written a lot about the implementation, there are no > docs explaining what the *user* sees -- there's not even a docstring to give > you a hint about what continuation.caller etc do. [Christian, that's why I > copied you: you're supposed to feel guilty now and stay up all weekend > .] Yessir. I felt guilty and added doc strings to everything I could find. This doesn't make things easier, but it is now much easier to find that out. :-) I was not sure about my continuation stuff, and I was waiting for some replies from the python-dev gurus. I thought they would read my paper with their given understanding of all the co-stuff, and given that everything should be obvious. Now this dodn't work out. Quite a few dev-people did understand me, without giving me feedback beyond "great work, but what now?". Instead, I get lots of feedback from the "outer" world, and people seem to really want to try this stuff, even when they have no clue about anything that is non-procedureal. I have to change some policies :-) > So, for now, if you want to learn anything about how to use them, you're > better off following one of the links Christian has posted into the Scheme > world. *Blush*, still true. But SLP 1.1 is about to be shipped, and there are docstrings, and there is a *real nice generator* now. Next time I will publish a how-to: How to get mad with continuations, compared to other ways of becoming unhappy. > OTOH, why do you care? You're not intended to use them directly -- the only > people who have any reason to figure this out are wishful implementers of > high-level abstractions (like coroutines etc). > > > ... > > I'm probably looking at this all wrong -- i fail to see how this > > is more abstract, more theoretical, more low-level, than simple > > subroutines. > > It's "simpler" in somewhat the same formal sense that it's simpler to define > how to add 1 to an unbounded int than to define an algorithm for unbounded > int multiplication. Continuations are basic because all other known forms > of control-flow can be reduced to them. Simpler does *not* imply "easier" > or "more convenient" here -- it does imply "low level", "tedious", > "unfamiliar" and "conducive to cognitive dissonance" <0.9 wink>. And, of > course, there's nothing at all abstract about the implementation. Separate > the theory from the implementation -- there's nothing simple about the > implementation! Sure. Sigh. The implementation is a nightmare, partially. But at the moment it's turning into a daymare, after I've understood what stacks and interpreters are :-) SLP 1.1 is much simpler and much more powerful. You can now run any frame at any time, even from a different thread. And the code has become shorter. Not to mention that it is also faster than ever before: 7% more pystone than standard Python, although I have the safe destructors of nested structures in it. Ahem :-) > > Is there any chance that someone can explain continuations either > > in a very pythonic sense > > No, not at the language level: they're akin to gotos, and Python has > nothing like that today. At the implementation level, though, see > Christian's paper for the best explanation you're going to get. Unfortunately, this paper is now *INVALID*. I have to do a major rewrite. Readers, please forget about the chapter concerning frame compatibility. THIS IS NOT TRUE. Please, also forget about dispatcher objects. THEY ARE GONE. Sorry about shouting. This is more like shouting at myself, since I was so dumb during all those months. Well, the fortune is that I still can learn... The author of this paper had no clue what he was talking about, and he was trying to convince people of his thoughtless conclusions. Well, not thoughtless (he spent months in despare, like a Cyber 175 peripheral processor's "hung in automatic recall") but clueless, no insight, not thinking consequently. Yesterday I made it. Aleph One, everything is crystal clear. I shortened the code by about 20 percent, and it is now faster, more powerful, and "correct" if that is possible at all. > > .... > > Can't someone do a very simple example using toy cars, road crossings, > > chickens, idiot drivers and/or huge kerosine-carrying tankertrucks ? > > Something that might not be much clearer but sheds some very different > ? light on the issue, and caters to the simple minds ? ;P > > OK, I'll give a very simple example. You're not going to like it -- in > fact, you're going to hate it . Like adding 1 to a number when you > really want to multiply, it's not of obvious use, but illustrates > fundamental points without the mastering of which you won't make progress. The Stackless Python Homepage will become updated soon, including such nice little hateful examples, *and* useful ones that make unPythonic continuation hackery into nice and useful Pythonic control structures. God am I happy that things work so smoothly now :-) > raw-continuations-are-the-antithesis-of-pythonic-ly y'rs - tim and-I'm-the-tricky-code-antichrist-who-never-gives-up-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 we're tired of banana software - shipped green, ripens at home From jlehmann at nsw.bigpond.net.au Mon Feb 28 07:52:00 2000 From: jlehmann at nsw.bigpond.net.au (John Lehmann) Date: Mon, 28 Feb 2000 12:52:00 GMT Subject: How does one generate XML documents? Message-ID: <38BA6D4D.CDB13B47@nsw.bigpond.net.au> Is there any library tool for generating XML documents, perhaps something similar to HTMLgen. I know it is quite easy, I'm just keen to reuse other peoples' good work. -- John Lehmann From gmcm at hypernet.com Wed Feb 16 08:02:55 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 16 Feb 2000 08:02:55 -0500 Subject: packages in special directories? In-Reply-To: <88dhl9$lk1$1@nntp4.atl.mindspring.net> Message-ID: <1261416338-2763074@hypernet.com> Michal Wallace wrote: > > How can I make a .pth file point outside the main python directory? > > I have my package development directory organized like this: > > c:\zike\code\weblib > c:\zike\code\weblib\__init__.py > c:\zike\code\weblib\Sess.py > c:\zike\code\weblib\Auth.py > c:\zike\code\weblib\Perm.py > > I like having my code under \zike\code for backup purposes, > and to keep it seperate from work I do for other companies, etc. > > Anyway, I want to be able to "import weblib" ... I know I can put > it in PYTHONPATH, but that's already messy, so I wanted to > try out the .pth notation.. > > so I made: > > c:\program files\python\weblib.pth > > which contains one line: > > c:\zike\code\weblib > > ... but this doesn't work.... Because weblib is the package. Your .pth file should say c:/zike/code - Gordon From akuchlin at mems-exchange.org Tue Feb 29 17:03:12 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 29 Feb 2000 17:03:12 -0500 Subject: Object Databases References: <1260348438-26442187@hypernet.com> Message-ID: <3dk8jnd5un.fsf_-_@amarok.cnri.reston.va.us> claird at starbase.neosoft.com (Cameron Laird) writes: > One mystery to me: why doesn't DB2 get > more attention? ... > I'm bringing it up here because, with all > the Version 6 goodies, IBM has taken to > talking about its "object-relational" > capabilities and "support for object > orientation". The current issue of DB/2 Magazine has an article on the object-relational features in version 6, and they seem rather disappointing. Essentially you can define types that are large objects, and define methods for each type, but there's no mention of inheritance. Methods also apparently can be in SQL or as linked-in C code; writing methods in Python would be non-trivial. On the upside, apparently DB/2's documentation is apparently much better than Oracle's. I once saw a posting on the Byte.com database forum from someone at Digital Creations (probably Chris Petrilli); they were trying to figure out if a library was thread-safe. The IBM docs made it clear, but a few hours of poring through the Oracle docs left things just as murky as before. Has anyone written a tool which maps a database schema to a collection of Python objects? Something similar to Tangram for Perl (www.tangram-persistence.org), but for Python? In Tangram, you write a schema laying out the objects, and the system then generates SQL tables to hold them, and automatically handles reading and saving objects. Right now my project group is looking at some way to ease the pain of storing Python objects. We're aware of these options: 1) Buy an object database (Versant, Matisse, POET, etc.). Pro: many powerful ODBMS features; most are quite scalable. Downsides: we'd probably have to write a Python interface on top of them; most of the companies are small companies, and might vanish. 2) ZODB. Pro: very natural for Python users; very flexible. Downsides: only one database at a time; doubtful scalability once you start pushing lots of 5Mb images into it. 3) SQL databases. Pros: common, well-known technology, from established companies like Oracle and IBM; lots of other software for them. Downsides: storing objects is clunky, requiring writing lots of boring save/load code, and many joins are needed to read in an object. We could write something like Tangram to save us from writing boring code, but that won't help the run-time speed problem. Anyone had to tackle a similar problem? -- A.M. Kuchling http://starship.python.net/crew/amk/ I had known him for years in a casual way, but I had never seen very deeply into him. He seemed to me to have more conscience than is good for any man. A powerful conscience and no sense of humour -- a dangerous combination. -- Robertson Davies, _The Rebel Angels_ From neelk at brick.cswv.com Mon Feb 14 20:43:36 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 15 Feb 2000 01:43:36 GMT Subject: A little present. References: Message-ID: Michael Hudson wrote: > > The idea is that after a call to X(func,...) there are a number of > `holes' (notated by an empty tuple) in the arglist that can be `filled > in' by subsequent calls (to what X returns). This means you can't > presupply the empty tuple to func, but I couldn't think of a better > way. Here's one: class Hole: pass Then change the test def __init__(self, func, *args): [...] if args[i] == (): to def __init__(self, func, *args): [...] if args[i] is Hole: Since Hole is a unique object, there isn't anything else that 'is' Hole. If you ever find yourself needing to pass Hole as an argument, then add "hole=Hole" to the __init__ arglist and let people change what the hole object by overriding the default argument. Neel From sholden at bellatlantic.net Mon Feb 7 10:19:56 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 07 Feb 2000 15:19:56 GMT Subject: Python on S/390 References: <389ABF55.CFD3A800@bam.com> Message-ID: <389EE2B6.82B271CC@bellatlantic.net> I suppose we can hope they'll work to improve the speed :) regards Steve Bill Scherer wrote: > > > I was at LinuxWorld Expo yesterday and saw Linux running on an S/390 > (200 mips, 180GB dasd, 4GB RAM). On a whim I typed 'python', and lo and > behold, I got a python prompt. (after a delay of about > .0000000000000000001 seconds!) > > > Hurray for Python! > > -- > William K. Scherer > Sr. Member of Applications Staff > Bell Atlantic Mobile From bpetterson at uswest.net Mon Feb 14 12:10:06 2000 From: bpetterson at uswest.net (Bjorn Pettersen) Date: Mon, 14 Feb 2000 10:10:06 -0700 Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <38A836ED.33151DAD@uswest.net> But if we get coroutines a la Stackless Python, we could do something like: def readline(name): fp = open(name) while 1: line = fp.readline() if not line: break suspend line fp.close() (someone please correct my semantics if I'm wrong -- I really haven't played enough with suspend yet :-) of-course-you-can-do-the-same-thing-with-continuations'ly y'rs -- bjorn Martin von Loewis wrote: > Fran?ois Pinard writes: > > > I'm not sure of the implications of the above, but one sure thing is that I > > very much like the current implications of reference counting. When I write: > > > > for line in open(FILE).readlines(): > > > > I rely on the fact FILE will automatically get closed, and very soon since > > no other references remain. I could of course use another Python line for > > opening FILE, and yet another for explicitely closing it, as I was doing > > in my first Python days, but I learned to like terse writings like above, > > and I do not think there is any loss in legibility in this terseness. > > Indeed. I think Tim's right here (as always:); if the request for > garbage collection is rephrased as 'reclaim cycles', everybody will be > happy. > > Regards, > Martin From robin at jessikat.demon.co.uk Mon Feb 7 12:46:30 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Mon, 7 Feb 2000 17:46:30 +0000 Subject: calldll & threads In-Reply-To: <1262180615-3359410@hypernet.com> References: <1262180615-3359410@hypernet.com> Message-ID: <8p75pCA2Twn4EwEE@jessikat.demon.co.uk> In message <1262180615-3359410 at hypernet.com>, Gordon McMillan writes >Robin Becker asks: > >> Is call dll totally thread safe/compatible? It seems from observation >> that call backs seem to use only one thread context; anybody know if >> that is true? > >In July of 98, in response to a problem Christian was having, >Sam produced a patched calldll that used TLS storage so that >a callback would happen on the thread that started the trouble. > >I have no idea if that patch was incorporated in the >mainstream, or what's happened to it. However, Christian is a >well-known packrat ;-). > > >- Gordon thanks. -- Robin Becker From rumjuggler at home.com Fri Feb 11 15:42:53 2000 From: rumjuggler at home.com (Ben Wolfson) Date: Fri, 11 Feb 2000 20:42:53 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> Message-ID: <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> On Fri, 11 Feb 2000 19:47:10 GMT, Forget it wrote: >x-no-archive: yes This would be more effective if it were actually in your headers, I think. -- Barnabas T. Rumjuggler It would be wrong to ridicule this before explanation, for philosophers must be allowed their bits of terminology. It is much better to ridicule it afterwards. -- Simon Blackburn, reviewing "Kant and the Platypus" by Umberto Eco From sholden at bellatlantic.net Sun Feb 20 15:22:21 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sun, 20 Feb 2000 20:22:21 GMT Subject: Which GUI? References: Message-ID: <38B04C8C.45F96A76@bellatlantic.net> Grant Edwards wrote: > > [That Tcl/Tk is a more stable interface than Tk alone] > > Leaving Tcl in is a pragmatic solution, even though it doesn't > appeal to the minimalist in me. > > -- > Grant Edwards grante Yow! I'm wearing PAMPERS!! > at > visi.com If we wanted a minimalist solution we would hardly be using Windows as an operating system, would we? And Tcl/Tk certainly works OK, though it would be nice if its Win implementations made it easier to conform to the platform's look and feel. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From btribble at blueshiftinc.com Thu Feb 17 12:41:33 2000 From: btribble at blueshiftinc.com (Brett Tribble) Date: Thu, 17 Feb 2000 09:41:33 -0800 Subject: two questions Message-ID: 1. Is anyone working on a version of Python for Mac OS X? 2. Has anyone been able to Get PMW working on Mac OS 8.x or 9.x? Brett From tim_one at email.msn.com Sun Feb 27 16:40:46 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 16:40:46 -0500 Subject: Q about tail recursion In-Reply-To: Message-ID: <000401bf816b$4e3a7180$f0a2143f@tim> [Robin Becker] > I quite often want to use None as an exceptional return eg in the case > of a list returning function [] might be a legal return and None an > illegal one. That way I can leave the error handling to the caller. Moshe & Michael later noted that CPython happens to generate different code today for an explicit "return None" than for one it makes up on your behalf, so not a problem after all. > I guess I should really be raising an exception though to be truly > pythonian. Hard to say. Half the world is ticked off that open("file") raises an exception if "file" doesn't exist, and the other half is ticked off that string.find(haystack, needle) doesn't raise an exception if needle isn't found. Rule of thumb is to raise an exception iff the condition is most often viewed as "an error" (because programmers are notoriously disinclined to explicitly check for errors, so let trouble propagate). In your specific case, a careless caller who expects a list but gets back None is likely to get an exception (probably TypeError or AttributeError) soon after anyway. python-won't-let-you-live-but-lets-choose-how-to-die-ly y'rs - tim From moshez at math.huji.ac.il Fri Feb 18 08:20:35 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 15:20:35 +0200 (IST) Subject: name-spaces and loading a file In-Reply-To: <38AD44E2.637FBFF7@austin.ibm.com> Message-ID: On Fri, 18 Feb 2000, David R. Favor wrote: > I am very new to python. > > Can you elaborate on this point. It sounds like it might work for an > application I'm working on. > > Specifically, in the case of: > > exec 'from scenes.' + scene + ' import *' > > Do you mean that within each $scene class all methods pass a dictionary > as one of the arguments in method calls? You do know $ is invalid in Python except inside strings, don't you? Anyway, my basic reponse to anyone using exec, especially using exec where he would step on all kind of global variables is "don't!". Why not do module=__import__('scenes.'+scene) And access those variables you need from module? It's much more predictable. Actually, even __import__ troubles me: usually, my solution is to pickle dictionaries for this purpose. better-safe-then-sorry-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sabren at manifestation.com Thu Feb 24 17:15:50 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Thu, 24 Feb 2000 17:15:50 -0500 (EST) Subject: Backreference within a character class In-Reply-To: Message-ID: On 24 Feb 2000 taashlo at sandia.gov wrote: > For the Python RE gurus: > > Using the re module, lets say that I want to match "XIX" but not "XXX" > or "WOW" but not "WWW". In my first attempt I used r"(.)([^\1])\1". > This, of course, did't work because the "\1" in character class isn't > interpreted as a backreference. > > So is it possible to specify a regular expression to match these > patterns? heh.. yup... >>> import re >>> r = re.compile(r'(.)(?!\1).\1') >>> r.match("wow") >>> r.match("www") >>> That was fun.. :) The (?!..) syntax means "don't match this", but it doesn't move the little pointer thingy forward.. so "(?!\1)" tells it to make sure the next thing doesn't match \1, and then the "." says to match any character (which we already know can't be \1).. but also, if you're only dealing with 3 character strings: >>> r = lambda s: s[0]==s[2]!=s[1] >>> r("wow") 1 >>> r("www") 0 >>> (aawwww.. my first lambda..) Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From nobody at nowhere.nohow Sat Feb 12 22:37:27 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Sun, 13 Feb 2000 03:37:27 GMT Subject: TCL has Tk... References: Message-ID: On 12 Feb 2000 18:22:22 -0500, Harald Hanche-Olsen wrote: >+ "Robert Hicks" : > >| Why can't Python have its own widget set instead of using Tk or wxPython? > >Why should Python have its own widget set instead of using Tk or wxPython? Or Qt or gtk or ... Modula-3 has it's own widget set and windowing system. Don't know if that has contributed to it's success or not. -- Grant Edwards grante Yow! Did I say I was a at sardine? Or a bus??? visi.com From embed at geocities.com Wed Feb 9 14:09:42 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 14:09:42 -0500 Subject: win32gui.Shell_NotifyIcon (removing icons) References: <87s8b3$l25$1@nnrp1.deja.com> Message-ID: wrote in message news:87s8b3$l25$1 at nnrp1.deja.com... > I am currently trying to remove use the Shell_NotifyIcon command in > order to remove the clock from the bottom right hand corner of a windows > 98 machine (in order to automate the removal of the clock on 2500 > laptops via a piece of python code running when a user logs on). > Firstly is this the best of doing this (via Python)? If so I have got > to the stage of implementing the command > > win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid) If you want to remove the clock you probably want to modify the registry setting that causes the clock to be shown. The clock is not an icon, so Shell_NotifyIcon is only used if you were the application who put the icon there. I can't find the registry key, but I bet it's in somewhere near HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartM enu or thereabouts. Warren From psilva at ruido-visual.pt Thu Feb 10 12:01:09 2000 From: psilva at ruido-visual.pt (Pedro Silva) Date: Thu, 10 Feb 2000 17:01:09 -0000 Subject: Split string Message-ID: <001d01bf73e8$6db5c860$6c00a8c0@ruidovisual.pt> Hi, I wnat to split a string that has be return by the filesystem The code that I'm using is: def obj_fs(self): import os listing=os.listdir("/var/spool/news/articles") str=string.split(listing) return str Is this correct? Another Problem. I'm using the following code in a DTML Method: What I want with this is that, with the tree tag I be able to see the subfolders of those folder. Is this correct? Please if you can help me, send your answers to: psilva at ruido-visual.pt Thanks, Pedro PS - I think that now, my text isn't in HTML, or it is? From aahz at netcom.com Sun Feb 13 15:14:08 2000 From: aahz at netcom.com (Aahz Maruch) Date: 13 Feb 2000 20:14:08 GMT Subject: breaking the ; habit References: <000101bf75de$0d12f940$962d153f@tim> <886sqi$pp3$1@nntp6.atl.mindspring.net> Message-ID: <8873ag$r5e$1@nntp6.atl.mindspring.net> In article , Fredrik Lundh wrote: >Aahz Maruch wrote: >> Fredrik deleted Francois' attribution: >>> >>>Just for fun, my own difficulty was to break the habit of the space >>>before the opening parenthesis which is part of a function call, >>>since it has been burned from GNU standards into my neurons, years >>>ago. >> >> I don't have that difficulty because I disagree quite vehemently with >> Guido about it. ;-) (I'll submit patches in his preferred style, but >> I won't do that with my own code.) > >repeat after me: statements are not callable objects, statements are >not callable objects, statements are not callable objects (etc) I don't see what that has to do with anything. Oh, I think I see: the argument is that "foo (" instead of "foo(" makes "foo" look like a statement? I don't buy it. In any event, I have no rules other than whatever makes the code easiest to read. -- --- 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 Have you coined a word today? From tim_one at email.msn.com Sun Feb 13 04:30:47 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 13 Feb 2000 04:30:47 -0500 Subject: Real Problems with Python In-Reply-To: Message-ID: <000e01bf7605$02aefe00$962d153f@tim> [neelk at cswcasa.com, with an excellent & thoughtful piece, herewith telegraphically condensed -- see the original for more context] > 1. Reference counting memory management Change that to "trash cycles aren't reclaimed", and it will eventually get fixed (possibly sooner than later, given Neil S's latest work). CPython users don't want to give up the relative predictability of reference-counting anyway. *Many* view rc as "a feature"! > ... > In the long run, the solution is to use a conservative garbage > collection algorithm (such as the Boehm collector), "No chance" in CPython -- the BDW collector is a large package of difficult code, and can be extremely tricky to port to new platforms. Can also be tricky to get it to play nice with extension modules. CPython has nothing like that now, and never will (or so I predict). And BDW is an excellent implementation of this approach, so it's exceedingly unlikely someone is going to come out with an easier-to-live-with conservative package. Bottom line: this is as futile as hoping to add curly braces. > o Use JPython. It hijacks Java's garbage collection, so there are > no problems with cyclic data structures. It doesn't ever call > __del__ methods, though I don't think this is a problem in > practice. It sure is for people who rely on __del__ methods. > 2. Lack of lexical scoping > > Tim Peters disagrees, but I miss it a lot, even after using Python > for years. Actually, Tim wholly agrees that you miss it a lot. He only disagrees when people insist that *he* misses it a lot <0.1 wink -- they do, you know! and, no, I don't>. I don't *object* to adding lexical scoping, though, and Guido's primary objection has been reduced to the cyclic trash problem, so this is back to #1 now. > ... > There's another, more subtle problem -- much of the work that's > been done on optimizing and analyzing highly dynamic languages has > been from on the Scheme/ML/Lisp world, and almost of that work > assumes lexically-scoped environments. So using well-understood > optimization techniques is made harder by the difference. Na -- this is like thinking most supercomputer optimization work has focused on speeding floating-point code, so integer code must be harder <0.9 wink>. Python's scoping largely reduces to Scheme but where all functions are defined at top-level (inventing unique names as needed to prevent name clashes). More formally, you can certainly *model* Python's scoping in Scheme, so any technique sufficient to optimize Scheme code so modeling suffices to optimize Python too. How's that for a slick argument ? Your wallet will be returned at the door. > Workarounds: > > o Greg Ewing has a closure patch, that makes functions and > lambdas work without creating too much cyclic garbage. Guido dislikes that implementation. > ... > 3. Multiple inheritance is unsound > > By 'unsound' I mean that a method call to a method inherited by a > subclass of two other classes can fail, even if that method call > would work on an instance of the base class. Unsure what this is about; am pretty sure nobody has complained about it before. Certainly "depth first, left to right" is an unprincipled approach, but in practice it's more than predictable enough to use. > ... > Prognosis: > > I don't think there's any hope of this ever being fixed. It's just > too much a part of Python, and there isn't much pressure to fix > it. Just avoid using MI in most circumstances. People use MI in Python all the time! It works great. AFAIK, the claim above is the sole "pressure to fix it". > 4. Lack of support for highly declarative styles of programming This is the hardest for me, because I love highly declarative styles but too often find they grate against Python's greater love of "obviousness". I certainly favor adding list comprehensions, because they're one happy case where greater power and greater clarity coincide. > ... > o Christian Tismer's Stackless Python patch enables the use of > first-class continuations in regular Python code. This lets > people easily and in pure Python create and experiment with all > sorts of funky control structures, like coroutines, generators, > and nondeterministic evaluation. > > Prognosis: > > Pretty good, if Stackless Python makes it in, along with list > comprehensions. (Personally, I suspect that this is the single most > important improvement possible to Python, since it opens up a > whole new category of expressiveness to the language.) Don't tell him I said this, but that's exactly why Guido fears it (any stuff he may say about destabilizing the core interpreter loop is a smoke screen <0.5 wink>): one programmer's "expressiveness" is often another's "gibberish". Christian needs to find a "killer app" for Stackless. Perhaps the Palm Pilot port is it. Perhaps some form of migrating computations among machines is it. Hard to say -- who would have guessed that Zope would prove popular . But stressing "adds unbounded new power to express control flow in novel, unique new ways" is exactly the way to scare 99% of this community in the other direction. Let's try lying about Stackless instead ("it's really a floor wax, despite that it was originally sold as a dessert topping"). > 5. The type/class dichotomy, and the lack of a metaobject system. Certain to be fixed in P3K, almost certain not to be fixed in CPython 1.x. > ... > 6. The iteration protocol > > The iteration protocol is kind of hacky. This is partly a function > of the interface, and partly due to the way the type-class > dichotomy prevents arranging the collection classes into a nice > hierarchy. It was designed to support straightforward sequence types, and works fine for that. It indeed doesn't generalize beyond that without major strain. > ... > o Wait for Guido to invent a better way: Tim Peters has said on the > newsgroup that GvR is working on a better design, I've been pushing Icon's generators (Sather's iterators, if that's more familiar -- "semi-coroutines" for the abstractoids) since '91. A very clean & general iteration protocol can be built on that (e.g., iteration over recursive structures is as natural as breathing). It's easy to implement given Stackless. It's even easier to implement directly. Guido warmed to it at one point last year, but hasn't mentioned it again (but neither have I). Thanks again for the useful post, Neel! It was gourment food for thought. back-to-cheeze-whiz-and-dairy-whip-ly y'rs - tim From joe at localhost.localdomain Sun Feb 6 17:13:00 2000 From: joe at localhost.localdomain (joe at localhost.localdomain) Date: Sun, 06 Feb 2000 22:13:00 GMT Subject: arguments from the prompt Message-ID: how do I write a python script to recive arguments from the command prompt? From Alessandro.Bottoni at think3.com Thu Feb 24 11:21:35 2000 From: Alessandro.Bottoni at think3.com (Alessandro Bottoni) Date: Thu, 24 Feb 2000 17:21:35 +0100 Subject: An article on Python (and Perl)... Message-ID: <6D8A17398E28D3119F860090274DD7DB4984E3@pces.cadlab.it> A nice article that compares Perl and Python: http://www.byte.com/feature/BYT20000201S0001 "A Perl Hacker in the Land of Python " By Jon Udell -------------------------------- Alessandro Bottoni (Alessandro.Bottoni at Think3.com) (alessandro.bottoni at libero.it) Web Programmer Think3 inc. (www.think3.com) From thomas at xs4all.net Tue Feb 1 07:54:10 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Tue, 1 Feb 2000 13:54:10 +0100 Subject: Compile Problem Imaging-1.0/Tk In-Reply-To: <3895AE03.D26FD7CD@daimlerchrysler.com>; from tilo.schwarz@daimlerchrysler.com on Mon, Jan 31, 2000 at 04:45:07PM +0100 References: <3895AE03.D26FD7CD@daimlerchrysler.com> Message-ID: <20000201135410.H19725@xs4all.nl> On Mon, Jan 31, 2000 at 04:45:07PM +0100, Tilo Schwarz wrote: > I successfully compiled the libImaging subdir of Imaging-1.0, but I > have a problem compiling the Tk subdir (I'm no tk expert). I followed > the install instructions, but I get the error: > > > make > > [snip] > ./Tk/tkImaging.c:76: too many arguments to function `Tk_FindPhoto' > Now in tk8.0.h I found a "good" match: > EXTERN Tk_PhotoHandle Tk_FindPhoto _ANSI_ARGS_((Tcl_Interp *interp, > char *imageName)); It sounds to me like you have several versions of the tk headerfiles lying around. Perhaps your SuSe install did this on purpose, leaving an old version of tcl/tk with the default names and adding tcl/tk 8.0 with non-standard names... In any case, if you change tk.h into tk8.0.h, you will most likely have to change tcl.h into tcl8.0.h as well, and possibly the location of the libraries to include. And dont forget to alter those #include statements in all files (_tkinter.c and tkappinit.c, and also tkImaging.c if you want to use PIL.) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From phd at phd.russ.ru Thu Feb 3 10:38:37 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 3 Feb 2000 15:38:37 +0000 (GMT) Subject: Cron & Python + Package In-Reply-To: <461182F0B9B7D111B4000008C7282ADC22B0C9@nynt04.umny.scripps.com> Message-ID: On Thu, 3 Feb 2000, Kolosov, Victor wrote: > The problem is only when a python package uses C libraries and in this case > requires LD_LIBRARY_PATH to be set. LD_LIBRARY_PATH only read by dlinker on program startup. If you LATER (i.e., inside your program) change the value of this variable, its new value will have meaning only to program that will be started from your script by os.system. You should set a value for LD_LIBRARY_PATH BEFORE your program begins. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From gerrit.holl at pobox.com Wed Feb 23 02:30:29 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 08:30:29 +0100 Subject: Which GUI? In-Reply-To: ; from effbot@telia.com on Tue, Feb 22, 2000 at 10:42:17PM +0000 References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <20000222221315.F4549@stopcontact.palga.uucp> Message-ID: <20000223083029.A1000@stopcontact.palga.uucp> > Gerrit Holl wrote: > > At a moment, I needed some reference to creating things in canvas in > > Tkinter. I found this in the Tcl manpage: > > > > pathName create type x y ?x y ...? ?option value ...? > > Create a new item in pathName of type type. The > > exact format of the arguments after type depends on > > type, but usually they consist of the coordinates > > for one or more points, followed by specifications > > for zero or more item options. See the subsections > > on individual item types below for more on the syn- > > tax of this command. This command returns the id > > for the new item. > > > > It took me a LOT of time to find out how to implement this in Python. It > > turned out to be some set of methods to Canvas, a different method for > > every `type'! I had to look it up in the source! > > so you're telling us you found a method description on the Tk Canvas > manual page, and it took you a lot of time to realize that it probably > was a method of the Tkinter Canvas class? No, it took me a lot of time it wasn't a *straight* method of the Tkinter Canvas class. Why the *hell* isn't there just a 'create' method but a seperate method for every type you can draw?!? > you could have looked things up in the Tkinter handbook, of course: > > http://www.pythonware.com/library/tkinter/introduction/canvas.htm > (look under "methods" -- the create methods are described > first on that page) When I had my problem, it wasn't documented yet. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From mhammond at skippinet.com.au Mon Feb 7 23:57:40 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 08 Feb 2000 04:57:40 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <024201bf71cb$bfc6a670$01646464@computer> <87o1br$ltq$1@nnrp1.deja.com> Message-ID: <8nNn4.2615$k6.7788@news-server.bigpond.net.au> wrote in message news:87o1br$ltq$1 at nnrp1.deja.com... > In article <024201bf71cb$bfc6a670$01646464 at computer>, > "Neil Hodgson" wrote: > > I'd like to understand what 'mis-formatting' you are worried about. > > Either Python code is syntactically valid or it is not. If the original > > author has given you syntactically valid Python, then it has an > > unambiguous structure and can be reformatted to use any > > spacing / tabbing approach you wish to standardise on. > This is what I've seen in some C code that's been through many hands: > > The old-timers used 8-space tabs to effect 3-space indentation. Don't > ask me why. The 2nd generation of coders set their tabs to 3 spaces in > the editor, editing some parts of the code, unaware that other parts of > the same file contained 8-space tabs. Tabs were converted to spaces > under the mistaken assumption that they were all 3-space tabs. But Neil's point is that the C code remains syntactically valid through that process, whereas the Python code may not. If you have working Python code, and the knowledge that 1 tab==8 spaces to the parser, then it _is_ possible to reformat to either full tabs or no tabs without any chance of the program changing functionally. Mark. From jayFreem at direcpc.com Wed Feb 23 19:36:36 2000 From: jayFreem at direcpc.com (Jay Freeman) Date: Wed, 23 Feb 2000 18:36:36 -0600 Subject: Question about X window control References: <38B3FF12.9254AEDF@earthlink.net> <891aqs$mqq$1@info3.fnal.gov> <38B43D12.56527AC5@earthlink.net> Message-ID: <38B47D14.C92CAF1F@direcpc.com> OK, I found my own answer :). If anyone is interested, it works like this: xanim has a command line option +Wid where id is a x window id number to use for display of the animation.. So I did this: import Tkinter root = Tk() root.overrideredirect(1) # prevents the wm from putting a frame or title bar around the window *giving me full screen video!* root.geometry(640x480+0+0) # sizes and locates it wid = str(root.winfo_id()) then built my command string using wid. Adios, Jay Jay Freeman wrote: > Hi again, > > cgw at alum.mit.edu wrote: > > > > > Well, this question doesn't have a lot to do with Python but I'll answer it > > anyway. > > > > xanim has a -S option to control scaling and a -W option to control > > window placement. If you type "xanim --help" you'll see it all spelled > > out in great detail. > > Thanks for replying, but neither of these is any help. Scaling is irrelevant, the anim is > already the size I want it to be. And the +Wxnum and +Wynum parameters position the anim within > the window, not the window within the desktop. > > What I was after on the Pyhton side of things is how to tell that window to maximize itself. I > can get the pid of the xanim process, but where do I go from there (if anywhere)? > > Jay -- *------------------------------------------* * Jay Freeman - WT9S ARRL * * G-QRP 10319 QRP-ARCI 9981 ARS 562 * * SASS #18700 NRA Life * *------------------------------------------* From effbot at telia.com Sun Feb 20 08:45:23 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 20 Feb 2000 13:45:23 GMT Subject: Non-progrmmer wants to learn. References: <38afe6a3.179841@news.netdoor.com> Message-ID: signman at netdoor.com wrote: > I've done nothing more than write batch files in the old dos days. I > enjoyed it then and am hoping now I can teach myself Python. I know > nothing about programming. > > Am I biting off to much? > Is there a step by step guide on the net? > Is this the language to start with? > Am I to old for this stuff (my Grandchildren type better than I) ? :) hopefully not/yes/why not/hardly repeating myself from a recent post: short answer: start here: http://www.python.org/Help.html longer answer: start here http://www.python.org/doc/Intros.html and look under "introductions to python for non-programmers" after that, check the other intros mentioned on that page, and the official tutorial, available at: http://www.python.org/doc as for books, your best bets are O'Reilly's "Learning Python" and Manning's "Quick Python". neither is written for true beginners, so you might wish to check them out in your local bookstore before buying. and yes, you should consider joining the python-tutor list: http://www.python.org/mailman/listinfo/tutor hope this helps! From kuntsi at cc.helsinki.fi.spam.no Fri Feb 25 06:49:35 2000 From: kuntsi at cc.helsinki.fi.spam.no (Antti Kuntsi) Date: 25 Feb 2000 11:49:35 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> <38B6420B.6A9D66DE@nembv.cz> Message-ID: Fredrik Lundh wrote: > readlines returns an empty line as "\n", not as > an empty string. replacing None with a suitable > lambda expression might help: > A = filter(lambda s: len(s) > 1, H.readlines()) > or (easier to read), ignore empty lines (and maybe > comments too?) in the processing loop. e.g. > for line in H.readlines(): > if line[:1] in "#\n": > continue # skip this one > ... Perhaps import string A = filter(string.strip, H.readlines()) could do the trick? I know, it's not fast. How about: import string A = filter(None, map(string.strip, H.readlines())) .antti -- ______________________________________________________________ |O| ---------------------------------------------------------- | | |Twisted mind? No, just bent in several strategic places.| `\| |___________________________________mickut at iki.fi/mickut/| From ajung at sz-sb.de Sun Feb 6 07:28:17 2000 From: ajung at sz-sb.de (Andreas Jung) Date: Sun, 6 Feb 2000 13:28:17 +0100 Subject: fnorb naming service In-Reply-To: <001301bf6f31$fa265500$d508a8c0@johnathan.intekom.co.za>; from jingram@intekom.com on Fri, Feb 04, 2000 at 07:05:02PM +0200 References: <001301bf6f31$fa265500$d508a8c0@johnathan.intekom.co.za> Message-ID: <20000206132817.A21735@sz-sb.de> On Fri, Feb 04, 2000 at 07:05:02PM +0200, Johnathan Ingram wrote: > Hi > > Has anybody managed to get fnorb clients to work with another naming service other than the one that comes with fnorb. > > I am only able to use the fnorb with its own naming service and not with any other orbs naming service. > Is this a bug and if so, do you guys have some sort of work around. I remember I have tested the naming server functionality about one year ago successfully with Mico and ILU . Andreas From sholden at bellatlantic.net Fri Feb 25 11:26:07 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 16:26:07 GMT Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> <38B69C6D.3E7C17D2@bellatlantic.net> Message-ID: <38B6AD20.696990CB@bellatlantic.net> Denys Duchier wrote: > > Steve Holden writes: > > > [remarks on the practicality of tail call optimization which > > seemed to overlook the need to retain context for exception > > handling] > > No such thing was overlooked. Calls appearing within the lexical > scope of a try are not tail calls; thus they are not subject to tail > call optimization... I was thinking more of the need for stack traceback when errors were detected. I agree that a call at the end of a try block is not a tail call. I am just concerned that tail call optimization would lose important debugging context unless you substitute some mechanism which retains the required information, which would defeat the point of the optimization. Uncaught exceptions are handled at main level, and need full dynamic context. Or have I missed something? > > ... or you can implement exception handling using continuations :-) > > oh hum... > > -- > Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de > Forschungsbereich Programmiersysteme (Programming Systems Lab) > Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier > Postfach 15 11 50 Phone: +49 681 302 5618 > 66041 Saarbruecken, Germany Fax: +49 681 302 5615 regards Steve -- "If computing ever stops being fun, I'll stop doing it" From egbert at bork.demon.nl Thu Feb 17 21:27:21 2000 From: egbert at bork.demon.nl (Egbert Bouwman) Date: Fri, 18 Feb 2000 03:27:21 +0100 Subject: MySQL modules In-Reply-To: <38ABD65E.D73344F3@wsg.fr>; from hnourigat@wsg.fr on Thu, Feb 17, 2000 at 11:07:10AM +0000 References: <38ABD65E.D73344F3@wsg.fr> Message-ID: <20000218032720.A1035@bork> Are the following observations correct: The module MySQLdb.py is API version 2 compliant, and needs Python 1.5.2 and MySQL 3.22 The older module Mysqldb.py is only compliant with the version 1 API, and works with Python 1.5.1 and MySQL 3.21. As I have debian slink with the older set, but hope to upgrade in a few months, I am looking for tutorials or other readable documentation for both modules. Where can I find them ? egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ======================================================================== From delgado at olaf.de Thu Feb 24 05:01:10 2000 From: delgado at olaf.de (Olaf Delgado) Date: Thu, 24 Feb 2000 12:01:10 +0200 Subject: Can I run a c++ object in Python program? References: <892c2s$maj$1@news.ihug.co.nz> <0u0398.4d.ln@olaf.de> Message-ID: In article <0u0398.4d.ln at olaf.de>, delgado at olaf.de (Olaf Delgado) writes: > It is not enough to pass the address of a C++ object. You have to make > each of it's methods available individually to Python, i.e. write a -its-, not -it's- > wrapper function for each of them and make it known to the > interpreter. The online docs describe how this is down. -done-, not -down- Olaf, struggling with the english language again From moshez at math.huji.ac.il Fri Feb 18 00:45:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 07:45:52 +0200 (IST) Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <38AC9D57.5CC8066C@mincom.com> Message-ID: On Fri, 18 Feb 2000, John Farrell wrote: > I agree that Python's OO features feel added on. Consider: > > * You have to pass self to each member function. There's no obvious > requirement that self need actually be the bound instance. Huh? ``self'' is passed automagically to each member function. consider class Spam: def eggs(self): self.x = 1 a = Spam() a.eggs() Where did you see me passing ``self'' to a.eggs() explicitly? > * In a method, fields of the bound instance need to be referenced > through the self parameter, because the scoping rules do not understand > about instance variables. That's because Python doesn't have declerations. And consider the following C++ snippet: class C { int i; void foo(int i) {this->i = i} } So even in C++ (and Java) you might have to reference member variables via this. Python simply has fewer special cases. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From garry at sage.att.com Wed Feb 23 14:13:47 2000 From: garry at sage.att.com (Garrett G. Hodgson) Date: Wed, 23 Feb 2000 19:13:47 GMT Subject: Killer Apps??? References: <14509.31078.932335.402705@beluga.mojam.com> <14509.46230.395460.200539@beluga.mojam.com> Message-ID: <38B4316B.F58893CB@sage.att.com> Skip Montanaro wrote: > In common American high-tech buzzword English, a "killer app" is an > application that makes the system that supports it something you have to > have. For the IBM-PC (or was it the Apple ][?) the killer app was the > VisiCalc spreadsheet. For the World-Wide Web, Mosaic was probably the > killer app. a long time ago, the game "star raiders" was the killer app for atari computers. that game alone sold an amazing amount of hardware. great little machine. i still miss mine. -- 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 rumjuggler at home.com Tue Feb 22 19:34:52 2000 From: rumjuggler at home.com (Ben Wolfson) Date: Wed, 23 Feb 2000 00:34:52 GMT Subject: PROPOSAL: [].__doc__, "".__doc__, ... References: <20000220213311.A7023@stopcontact.palga.uucp> <20000222205200.A4493@stopcontact.palga.uucp> Message-ID: <6oa6bsoi2umg8d0u5a1j1fk10gpp4fabfq@4ax.com> On Tue, 22 Feb 2000 20:52:00 +0100, Gerrit Holl wrote: > >> Gerrit Holl writes: >> >> > I think it would be a nice feature for all types with methods to have >> > docstrings describing the methods, so [].__doc__ would be a string with >> > the descripion of .index, .append... etc. >> >> It already works, at least partly: >> >> >>> print [].append.__doc__ >> L.append(object) -- append object to end > >I know. > >> Still, `print [].__doc__' raises an exception. > >I know. That's what I mean :) >>> for method in dir([]): exec "print [].%s.__doc__" % method L.append(object) -- append object to end L.count(value) -> integer -- return number of occurrences of value L.extend(list) -- extend list by appending list elements L.index(value) -> integer -- return index of first occurrence of value L.insert(index, object) -- insert object before index L.pop([index]) -> item -- remove and return item at index (default last) L.remove(value) -- remove first occurrence of value L.reverse() -- reverse *IN PLACE* L.sort([cmpfunc]) -- sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1 From emile at fenx.com Mon Feb 28 20:31:37 2000 From: emile at fenx.com (Emile van Sebille) Date: Mon, 28 Feb 2000 17:31:37 -0800 Subject: difference between __repr__() and __str__() References: Message-ID: <030901bf8254$ba7a3c60$01ffffc0@worldnet.att.net> I like that eval(repr(obj)) stay true. On that basis, the repr(obj) should create a string such that obj == eval(repr(obj)). Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Gregoire Welraeds To: Sent: Monday, February 28, 2000 9:33 AM Subject: difference between __repr__() and __str__() > The question is in the subject. According to the Python reference manual, > page 17 > > __repr__: called to compute the official string representation of an > object. This should like a valid Python expression that can be used to > recreate an object with the same value. > > __str__: differs from repr in that in does not have to be a valid python > expression: a more conveniant or concise representation maybe used > instead. > > What is a valid Python expression ? > I though that repr was called by repr and by string conversion (as > mentionned early in the doc)not to recreate an object ? > What is the use of an official string representation against the > non-official ? > > -- > 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/ > ---------------------------------------------------------------------- --------- > > > > -- > http://www.python.org/mailman/listinfo/python-list > From meowing at banet.net Thu Feb 24 03:20:20 2000 From: meowing at banet.net (Marshmallow Fluffy) Date: 24 Feb 2000 08:20:20 +0000 Subject: 1000 GUI toolkits References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> Message-ID: Aahz Maruch wrote: > (Okay, so I'm half-joking. But I really do have a strong preference for > HTML as my UI of choice, not least because it allows a text-based > interface.) No joke at all. HTTP/HTML is a really nice alternative to the GUI of the month. Python shines when it comes to writing little specialty server thingies, and more of the presentation details are in the hands of the end user (don't like the interface? Use another browser). From maxm at normik.dk Wed Feb 23 04:16:54 2000 From: maxm at normik.dk (maxm) Date: Wed, 23 Feb 2000 10:16:54 +0100 Subject: Killer Apps In-Reply-To: Message-ID: > On 22-Feb-00 Gerrit Holl wrote: > > ROFL! > > I have seen this ROFL a number of times, especially written by you, > Gerrit. What exactly is it supposed to mean? > > /Mikael ROFL - Rolling On The Floor Laughing LOL - Laughing Out Loud Max M ------------------------------------------------------------------------ Max M Rasmussen, New Media Director http://www.normik.dk Denmark e-mail mailto:maxm at normik.dk private mailto:maxmcorp at worldonline.dk From jlehmann at nsw.bigpond.net.au Mon Feb 28 08:25:01 2000 From: jlehmann at nsw.bigpond.net.au (John Lehmann) Date: Mon, 28 Feb 2000 13:25:01 GMT Subject: Introspection References: <38BA7310.C6968E6E@mindspring.com> Message-ID: <38BA750A.1BEA4659@nsw.bigpond.net.au> These two functions might help you to play with classes: isinstance (object, class) issubclass (class1, class2) There is also a __class__ attribute >>> class A: >>> pass >>> a = A() >>> isinstance(a, A) 1 >>> hasattr(a, '__class__') 1 >>> hasattr(6, '__class__') 0 Chuck Esterbrook wrote: > > If I want a handle/pointer to an instance's class, how do I do that? > > In Objective-C I can say: > [someObject class] > > Which in Python would be: > someObject.class() > > However, Python doesn't have a well-defined root class with such utility methods. Also, I also don't see anything useful from: > dir(someObject) > > Also, I notice the following oddity: I can use the __name__ attribute to get the name of a class, but if I say "dir(someClass)", I get attributes like __doc__ and __module__, but no __name__. How does Python get the __name__ then? > > >>> class Foo: > ... pass > ... > >>> Foo.__name__ > 'Foo' > >>> dir(Foo) > ['__doc__', '__module__'] > >>> > > -Chuck From ivanlan at callware.com Fri Feb 18 11:07:07 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Fri, 18 Feb 2000 09:07:07 -0700 Subject: wxPython book??? References: <14508.33324.45637.954517@weyr.cnri.reston.va.us> <38AC8385.16DD9A0E@callware.com> <14509.26727.677099.483772@weyr.cnri.reston.va.us> Message-ID: <38AD6E2B.F757D224@callware.com> Hi All-- "Fred L. Drake, Jr." wrote: > > Ivan Van Laningham writes: > > --He says, relentlessly pushing "volunteers" to the edge of the > > precipice. > > Some things just have to be done, but others... are done for fun! ;) > > > -ly > > I didn't that (the peace part, that is); true, or Ivanism? > Yup, it's true. That's why, on my Buddhist mailing list, we have a fellow who signs himself "The Fred formerly known as Fred." -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 moshez at math.huji.ac.il Sat Feb 26 06:02:17 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 13:02:17 +0200 (IST) Subject: Life's better without braces In-Reply-To: <20000226102817.A951@stopcontact.palga.uucp> Message-ID: [me, about a Python program to write a Python program" > (I was merciful enough to include the output) On Sat, 26 Feb 2000, Gerrit Holl wrote: > Where? Right on your computer, if you only care to run my program. which-will-erase-your-hard-drive-too-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From fdrake at acm.org Wed Feb 16 10:16:24 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed, 16 Feb 2000 10:16:24 -0500 (EST) Subject: Valid Python Code? In-Reply-To: References: Message-ID: <14506.48968.356135.266788@weyr.cnri.reston.va.us> Anders M Eriksson writes: > I'm just wondering is this a valid Python code snippet? > > import os > for k,v in os.environ.values(): > print k,v Try using os.environ.items(). -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From paul at prescod.net Wed Feb 9 10:38:23 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 09 Feb 2000 07:38:23 -0800 Subject: Mystery of Python Message-ID: <38A189EF.A55F3EF2@prescod.net> Ahh, the mysteries of Python's implementation. I thought others might find this interesting: >>> for char in "abcdefghijklmnopqrstuvwxyz": ... print sys.getrefcount( char ) ... 3 3 3 3 5 3 5 5 3 3 3 5 3 3 3 3 3 4 3 3 3 3 5 3 3 4 >>> sys.getrefcount( "i" ) 19 >>> -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made the modern world possible. - The Advent of the Algorithm (pending), by David Berlinski From tcmits1 at cs.com Mon Feb 28 23:49:26 2000 From: tcmits1 at cs.com (Tcmits1) Date: 29 Feb 2000 04:49:26 GMT Subject: JPython install on win98, NT References: <20000228233829.01209.00001933@ng-fg1.news.cs.com> Message-ID: <20000228234926.01209.00001934@ng-fg1.news.cs.com> Reply to myself: I created a batch file that contains: java -Dinstall.path=c:\jpython -cp c:\jpython\jpython.jar org.python.util.jpython %1 %2 %3 %4 %5 This seems to run the interpreter. Still, the batch files should have been included, IMHO. Josef From moshez at math.huji.ac.il Fri Feb 11 11:30:39 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 18:30:39 +0200 (IST) Subject: will python 3000 break my code? In-Reply-To: Message-ID: On Fri, 11 Feb 2000, Fredrik Lundh wrote: > (if your ideas are good enough, someone will > drop by your home some night, and teach you > the secret handshake ;-) Fredrik, if you keep uncovering PSU tactics, someone might drop by *your* house. For nothing as pleasent as handshakes, you know. totally-unhelpful-to-the-s/n-ration-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From lenny at squiggie.com Thu Feb 24 12:21:11 2000 From: lenny at squiggie.com (Lenny Self) Date: Thu, 24 Feb 2000 09:21:11 -0800 Subject: Looking for Python equivelent Message-ID: <8Mdt4.171$cz3.15110@news.uswest.net> Hello. I am attmpting to find the Python equivelent for these calls in C++ inet_addr() and inet_ntoa() Basically, I am attmepting to decode a string (in Python) that was encoded via the first of the two functions above. I have been told that the second function will decoding if I were using C++. If anyone can point me in the right direction I would greatly appriciate it. Thanks -- Lenny From embed at geocities.com Wed Feb 2 13:03:09 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 2 Feb 2000 13:03:09 -0500 Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) Message-ID: This is sort of related to gwilson's thread regarding "python books that need writing", but it's more about his Software Carpentry contest, and his article (http://www.oreilly.com/news/vhll_1299.html) which critiques VHLLs. First, I'm intrigued by Eiffel's Programming by Contract. Can anyone enlighten me on this subject, or post some links? It seems to me that Components are more to the point than "contracts", and that contracts are a useful part of the whole picture of components. So what is Python doing about Component driven programming? I'll tell you something I miss from Delphi, which is a key part of Delphi's component style. Let's imagine I could do this in Python: # centipede has # constraint on attributes, legs must be between 0 and maxlegs, and must be an even number. class centipede: legs in range(0,maxlegs),check_even(self) color in centipede_color_set def check_even(self): # any function can be added as a constraint check if (self.legs % 2) == 0: return 1 return 0 Also, let's imagine I could go ahead an add pre and post conditions to methods in Python would that be a good idea? I sure would like the idea of building a component and specifying it's interface (the interface section a la Pascal and Modula 2) and some more general support for information hiding, and I'd also really like to have Delphi's idea of "properties" as part of objects. A property is a virtual attribute (with a hidden private data member) with both a get and set method which are transparentely accessed when I read or write to "centipede.legs". I've seen some stuff on this list about __getattr__ and __setattr__ and this seems like quite a hack. What the World Needs Now: Frankly, Python is the first new discovery I've made since "Delphi 1.0" in 1995 that promises to add really useful stuff to my programming toolbox. While I balked at the tabbed-scope stuff initially, I got over that (it was a 2 beer problem) and I now officially love Python. Yet, I am one of those programmers Mr. Wilson refers to who in general will silently veto anything new unless I see the benefit of it in short order. I am especially cynical about anyone who wants me to renounce my existing toolset and start over. While I agree with Mr. Wilson's "Software Carpentry" ideal, and avoiding 'accidental complexity', it seems to me that the $850K being spent on resuscitating these crusty old Unix command line tools (chiefly make, autoconf, and automake) to make new command line tools is a perfect example of the things he criticizes in programmers like me. I think it would be far better to invest in building tools to plug into an already started new development environment. After all, "It's not the 70s anymore Dorothy". KDevelop is clearly in the lead as a portable cross-platform IDE, and I think $850K could do a lot to help it along. Once people are writing their software in a world-class IDE, instead of sitting in Bash, vi and EMACS all day, I think we would safely be able to say that Unix had caught up to the Windows platforms of the late 1990s. Let's at least be realistic, folks. Then all we have to do is make the whole thing really hum is Pythonize KDevelop to the core. :-) Warren Postma From kurtn at my-deja.com Sat Feb 26 15:07:59 2000 From: kurtn at my-deja.com (kurtn at my-deja.com) Date: Sat, 26 Feb 2000 20:07:59 GMT Subject: Converting a floating point number to a string Message-ID: <899bqt$udk$1@nnrp1.deja.com> Hei As the subject says I would like to convert a floating point number to a string, in other words the opposite of 'atof'. I appreciate all the help I can get. thanks k Sent via Deja.com http://www.deja.com/ Before you buy. From robin at jessikat.demon.co.uk Thu Feb 10 15:05:36 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 10 Feb 2000 20:05:36 +0000 Subject: Corel + Borland = The End of MS Win References: <1261910911-19581600@hypernet.com> Message-ID: Isn't mentioning Tom C enough to ensure a visit? -- Robin Becker From tbryan at python.net Wed Feb 23 05:13:24 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 23 Feb 2000 05:13:24 -0500 Subject: Comparing perl and python References: Message-ID: <38B3B2C4.E0A1758C@python.net> Tim Roberts wrote: > > I've been reading this newsgroup for a couple of weeks, and I'm a bit > afraid my subject line might label me as a troll, but as a python newbie, > it is one which interests me. It's not so bad as long as you don't cross-post to comp.lang.perl.misc. > Further, although it might be more related to the > way I learned perl, I find that perl tends to encourage monolithic > programs, whereas python seems to lend itself more easily to a more > modularized structure. These are both Good Things. I found the same thing. When I learned Python, I only knew C and Perl. After programming in Python for a few months, my coding got better not just in Python, but also in C and Perl. Using Python for a year also made it much easier to pick up C++ and Java later. > It's clear that there is a substantial library of modules for python, > approaching that of perl. However, I am disturbed by what seems to be a > dramatic performance difference. Search DejaNews for comp.lang.python threads involving performance, Python, and Perl. You'll find quite a few. Python tends to be slower than Perl in the problem domains where Perl really shines. Most people who start such threads are recovering Perl hackers who are writing Python in a Perl idiom. For example, Perl's regular expressions are really fast. People use them all the time to fairly trivial work. When rewriting a Perl program in Python, I find that I can often replace half of the regular expressions by using the string and os.path modules in Python. That helps speed. > I've tried writing some simple test cases in both languages.... If you try to directly translate, you'll almost certainly notice a speed hit. To phrase it poorly ;-) "Important note: Python programs that aren't very Pythonish tend to run much slower than the Pythonish ones. " It's from a page of mine that I haven't touched recently: http://starship.python.net/~tbryan/perl2python.html You might be interested in looking through the one sample that I documented. I'll do others once I have spare time again. > Now, it's possible this is just because python is version 1.6 and > perl is version 5; maybe python hasn't had the attention to > optimization that perl has, Python has been around for a long time. The version numbers creep forward slowly, but there are huge differences between versions 1.3 and 1.5. That said, Python is never going to be optimized for input and text processing in the same way that Perl has been unless some skilled volunteer or company provides a patch that implementes such optimizations and doesn't break anything else. > but I'd like to know if my experiences are unique. No. As I said, look at DejaNews. Then again, you'll often notice that the messages posted with code examples were trimmed and rewritten by comp.lang.python posters. Often performance differences can be reduced to a factor of 2 just by ridding the program of Perl idioms and avoiding slower Python modules. Not infrequently, we're able to create a Python program that performs the same task as the initial Perl program that someone is trying to mimic. Really, read a few threads on DejaNews if you're very concerned. It should give some good ideas. The topic comes up every few months. ---Tom From btang at pacific.jpl.nasa.gov Fri Feb 18 19:49:01 2000 From: btang at pacific.jpl.nasa.gov (Benyang Tang) Date: Fri, 18 Feb 2000 16:49:01 -0800 Subject: binary distribution for SGI Message-ID: <38ADE87D.5E1110FB@pacific.jpl.nasa.gov> Where can I get a binary distribution for SGI? I tried to compile it from the source codes but failed; I don't know whether it was because I did not login in as a root user. From tseaver at starbase.neosoft.com Tue Feb 8 23:50:14 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 8 Feb 2000 22:50:14 -0600 Subject: mail filter in python? References: <38A06C98.9B2ECA2A@sage.att.com> <20000207154641.A2817@stopcontact.palga.uucp> <87q016$rro$1@nntp6.u.washington.edu> Message-ID: In article <87q016$rro$1 at nntp6.u.washington.edu>, Donn Cave wrote: >Quoth "Garrett G. Hodgson" : >... >| that's two people who've pointed out the difficulty in getting it right. >| perhaps a better approach is to build yourself a python syntax to >| generate the crufty procmail syntax. > >If I'm not already counted among those two, make that three! >But I don't know that it's not worth bothering with, it depends >on one's ambitions. > >A recreational code abuser might have a little fun with this and >harm no one. A very ambitious programmer might very well be able >to contribute something that's substantially better than procmail - >there's plenty room for improvement and no chance at all that procmail >itself will improve. > >I personally wouldn't try to ``front end'' .procmailrc, unless maybe >the object were a very constrained front end that simplified the issues >for the kind of interface you'd get on a web form. Otherwise, you have >to learn more .procmailrc syntax to do it, than you'd have to learn just >to use .procmailrc directly! But I'm assuming the author would be the >only user, perhaps that's not true. I offer as a possible counterexample Eric Raymond's first serious use of Python: he built a Tk GUI to simplify configuring fetchmail. The project made a *serious* believer out of him, too -- and the tool works for *many* more folks than ESR. Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From peter.sommerfeld at gmx.de Tue Feb 22 21:28:28 2000 From: peter.sommerfeld at gmx.de (Peter Sommerfeld) Date: Wed, 23 Feb 2000 03:28:28 +0100 Subject: Porting Python to non-pc platforms (AS/400) Message-ID: Jay Graves wrote: >Its about $1200 for my machine. Big bucks :-( >IBM is pushing Java very hard to fill in as an applications language > and have made great strides, but most new development on the > AS/400 is still done in RPG. [snip] >I have VERY little experience with C (I can recognize a C program 2 out of 3 >times. (-: ) In your opinion, how hard is Python to port? If I shell out >the bucks for a compiler, what chance to you give a neophyte C programmer of >getting it to compile and run? Python itself shouldn't be the problem. But there is is some platform specific stuff which might be harder. Consider porting JPython, the Java implementation of Python. Write once, run everywhere (???). good luck -- Peter From mtho at axion-gmbh.de Thu Feb 3 12:22:52 2000 From: mtho at axion-gmbh.de (Manfred Thoma) Date: Thu, 03 Feb 2000 17:22:52 +0000 Subject: Gutes (deutschsprachiges) Buch =?iso-8859-1?Q?=FCber?= Python Message-ID: <3899B96C.E3133570@axion-gmbh.de> Hallo alle miteinand.... Ich suche ein gutes, deutschsprachiges Buch ?ber Python. Mit dem englischen Tuturial komm ich irgendwie nicht so richtig zurecht. Au?erdem bin ich auch auf der Suche nach einer graphischen Benutzeroberfl?che f?r Python-Programm (keine visuelle Programmierung, sondern sowas wie bei Turbo Pascal oder C/C++ immer dabei war. Ich glaub ein Software Development Kit) Ich w?re ?ber jede Hilfe in dieser Richtung sehr dankbar.... Manfed Thoma mthoma at axion-gmbh.de From tim_one at email.msn.com Fri Feb 18 03:00:11 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 18 Feb 2000 03:00:11 -0500 Subject: Miscellaneous design and Python use questions In-Reply-To: <87bt5fgeiq.fsf@travis.aggievilla.org> Message-ID: <001601bf79e6$2e085440$e62d153f@tim> [Gordon McMillan] > You'll probably be happier if you stop thinking in strict OO > terms, and realize that Python is all about interfaces, and > interfaces are implicit (no need to inherit from some particular > base class). To paraphrase Aahz: loosely couple, and > componentize the hell out of everything. [Travis B. Hartwell] > What exactly do you mean by interfaces here? I think I understand > what your paraphrasing meant: Don't have your classes / modules / > whatever tied too tightly together (i.e., a good example of > information hiding) and make everything very indepedent. Is that > right? It's a bit hard to explain, because although interfaces are vital to True Python Practice, there's no syntax in the language that supports interfaces directly! It has the flavor of folklore as a result. For example, the Reference Manual talks about "sequence types" and "mapping types", and they're fundamental tools. However, search as you will, there *isn't* any "sequence type" thingie visible at the Python level, or even at the implementation level. Whether an object "acts like a sequence" depends on whether it supports things like indexing (== its class has a __getitem__ method). There's nothing either rigid or enforced about it, though, and you can very often just add some simple method to a class to get it to "act enough like a sequence" to pass to a function that requires a sequence argument. Another example: The "file-like object" interface is also informal and widespread -- in most cases, functions that require files are perfectly happy if you pass them anything whatsoever with "readline" and/or "write" methods. In small systems this is overwhelmingly a blessing, letting you change things around radically and rapidly with surprisingly little breakage. Maybe we can twist your head in the appropriate direction by saying you shouldn't worry about an object's *class* (or type) so much as what an object can "do" (which methods it supports). It's a subtle distinction, and the most generally useful Python code doesn't contain if isinstance(somearg, FrobnicatorClass): but if hasattr(somearg, "fronbicate"): As systems get larger and more complex, though, relying on folklore interfaces gets less attractive. There's nothing wrong (& much right!) with *eventually* defining a FrobnicatorClass mixin and deriving frobnicators from it, but if you do that from the start you freeze decisions too early. Which is maybe a deeper hint: refactoring, e.g., C++ code is an utter pain in the ass, so people tend to be reluctant to "just try something" in C++. You're getting the hang of writing True Python when you think nothing of rewriting your whole class hierarchy five times. So long as you rely on implicit interfaces, then e.g. moving ".frobnicate(self, other)" from class A to class B is a single cut-and-paste, so there's little pain in pursuing a promising rearrangement (neither in retracting it later when it proves to suck bigtime ). the-measure-of-a-good-python-programmer-is-how-much-of-their- code-they-throw-away-without-regret-ly y'rs - tim From fdrake at acm.org Mon Feb 14 11:43:47 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon, 14 Feb 2000 11:43:47 -0500 (EST) Subject: OT: Celebrating Python In-Reply-To: <884dhj$l0a$1@nntp6.atl.mindspring.net> References: <38A5AAB4.5F56B3A0@digicool.com> <884dhj$l0a$1@nntp6.atl.mindspring.net> Message-ID: <14504.12483.890085.354771@weyr.cnri.reston.va.us> Aahz Maruch writes: > Time's fun when you're having flies. Reminds me of a book my in-laws gave my kids. I understand they're nice in pies. ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From tbryan at python.net Mon Feb 21 18:55:35 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 21 Feb 2000 18:55:35 -0500 Subject: Baffling unpack() or read() problem...... References: <38b1c09a.24413312@news.globalnet.co.uk> <38B1C817.EF044566@python.net> Message-ID: <38B1D077.3FA0A317@python.net> "Thomas A. Bryan" wrote: > Isn't the default to open files in text mode? Er...I mean...default on Windows. I'm almost certain this is in the FAQ, but it's the type of FAQ that you have to know what you're looking for to find it...in which case you wouldn't be asking. like-looking-in-the-dictionary-to-see-how-it's-spelled-ly yours ---Tom From effbot at telia.com Wed Feb 16 16:19:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 21:19:42 GMT Subject: I give up... was: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> <87tli4$s50$1@nntp1.atl.mindspring.net> <88f1lr$ola$1@nntp4.atl.mindspring.net> <38AB10C0.931F8F19@starmedia.net> Message-ID: Andrew Csillag wrote: > > >> def cStyleIIF(condition, iftrue, iffalse): > > >> if eval(condition): > > >> return eval(iftrue) > > >> else: > > >> return eval(iffalse) > Even easier: > >>> x = 5 > >>> y = 20 > >>> a = x a and b or c > >>> a > 5 oh. when we reach the end of a thread, lets start from the beginning again... :-) From gerrit.holl at pobox.com Fri Feb 18 01:52:44 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 07:52:44 +0100 Subject: Which GUI? In-Reply-To: ; from jjlucsy@concentric.net on Thu, Feb 17, 2000 at 04:44:46PM -0500 References: <38AC0244.C5FA164A@durham.ac.uk> <20000217214601.B2438@stopcontact.palga.uucp> Message-ID: <20000218075244.B777@stopcontact.palga.uucp> Hello, Joel Lucsy wrote on 950802286: > > Why the hell hasn't wxPython become the standard GUI for Python yet? > > Well, it's little too cumbersome in terms of size of redistribution (as far > as Windows is concerned). It has a 1.7meg pyd, not to mention various other > pyd's as well. Tcl/Tk is much larger. $ du -chs /usr/X11R6/lib/{tk8.0,tk4.2,libtk8.0.a,libtk4.2.a} /usr/lib/python/lib-dynload/_tkinter.so 851K /usr/X11R6/lib/tk8.0 753K /usr/X11R6/lib/tk4.2 795K /usr/X11R6/lib/libtk8.0.a 708K /usr/X11R6/lib/libtk4.2.a 791K /usr/lib/python/lib-dynload/_tkinter.so 3,8M total Only Tk 8.0 is already 851K + 795K = 1646K, with _tkinter.so it's 2437K. > I can think of other things, but this is the showstopper for me right now. What about pyQT? > I'm currently trying to use pyFLTK, but am quite disappointed that the > controls can't be subclassed. I'm taking a stab at rewriting it, but no > success yet. I think I'll make another point 'can be subclassed' in my comparison. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From effbot at telia.com Tue Feb 29 14:56:31 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 19:56:31 GMT Subject: Best book to learn Python? References: Message-ID: Snoopy :-)) wrote: > There is a New Book which supposed to be a very good one for Beginners. It > is expected to be available March-21. Published by "SAMS". > The Title is: "Teach Yourself Python In 24-Hours" > The Author is: Alan Gauld. is that Ivan Van Laningham's alter ego? From effbot at telia.com Mon Feb 28 03:41:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 08:41:29 GMT Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: Arnaud Fontaine wrote: > Fine ... if I was able to use it with python on my Mac :( > > Here is the output from python's shell when trying to import the lib : > > Python 1.5.2c1 (#56, Apr 12 1999, 14:19:52) [CW PPC w/GUSI w/MSL] > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import Mk4py > Traceback (innermost last): > File "", line 1, in ? > ImportError: PythonCore: An import library was too new for a client. > >>> > > Any clue ???????? quoting Jack Jansen from the pythonmac mailing list: http://www.python.org/pipermail/pythonmac-sig/1999-December/003186.html MacPython dynamic modules aren't portable between releases. The machinery is there, but because PythonCore also contains the whole C library the version number has to be upped not only for python API version number changes but also for new C libraries. The error message comes from the MacOS dynamic loader, which actually _checks_ that a dll is compatible with the version used during compilation (unlike some Other OS that shall remain nameless, which happily lets your application crash lateron:-) (I suspect that it means "wrong version" rather than "too new" in this case) From tim_one at email.msn.com Tue Feb 1 18:14:14 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 1 Feb 2000 18:14:14 -0500 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <389739fb.95247007@news.teleport.com> Message-ID: <000f01bf6d0a$0f213bc0$4b2d153f@tim> [posted and mailed] [Kirby Urner] > For more context re the below, see the archived thread > (on-going) at the Math Forum. This is from an > Association of Mathematics Teacher Educators > listserv: > > http://forum.swarthmore.edu/epigone/amte/snuquoiyor The quoted article is the first of the "1 Feb 2000" entries. You cut some of the more appealing inducements to rational discussion, like: The people we talked to (including Guido) could not state or formulate program design recipes. and It wasn't clear whether they had even realized that their language was quasi-functional. and The proper response to this table is that we don't play such shameless, back-stabbing games. > If people posting here have the time to read what > Matthias says about Python... e.g.: > >> As far as the language is concerned, Python is a >> - highly irregular, >> - badly implemented >> - non-parethetical version of (Mz)Scheme >> - without underlying theory of programming >> language design >> - or program development >> - with a cult-like following. > I'd be happy to read their feedback. Well, I think the tone of this "candid assessment", speaks for itself, and it's not something I care to get dragged into. One thing may make things clearer, though: Guido Himself has described Python as a "95% language". It doesn't aim-- and deliberately not --at impeccable theoretical purity or completeness. It's much more pragmatic in spirit. "It works"! Scheme is an excellent first language, and I've got nothing at all bad to say about DrScheme (except perhaps that it sure puts a heck of a lot more strain on my old machine than does Python <0.5 wink>). It would be hard to regret teaching Scheme. It would also be hard to regret teaching Python. I personally would incline to teach Scheme to potential computer scientists, and Python to everyone else. The core concepts of computer science are much more carefully developed in Scheme (it's a diamond!); the rough and tumble *practice* of day to day programming (mixing GUIs with CGI and database access and ...) is much more faithfully reflected in Python (it's a lump of coal -- maybe not as pretty to look at, but when you light it, it *glows*). There's no question but that Scheme currently overwhelms Python in the matter of good course materials available. try-'em-both!-ly y'rs - tim PS: > So maybe it's time for chapter eight, using DrScheme, about > hich I have an open mind (although I must say I'm rather put > off by what looks to be a rather defensive and "cult like" > mentality surrounding the DrScheme project :-D). I'd just like to add the the Lisp community (of which Scheme is a part) has likely done as much pioneering work in computer languages as all others put together, and they're definitely not happy about the lack of appreciation (not even simple acknowledgement) they usually get for that. Defensiveness is not uncommon here, nor is it mysterious. It's not necessary (or helpful), though -- Guido wasn't trying to destroy other languages with his CP4E proposal, he's just trying to pursue his own vision of how life could be better. "The table" is an honest reflection of his (highly compressed) conclusions. From tjreedy at udel.edu Tue Feb 1 00:31:07 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Tue, 1 Feb 2000 00:31:07 -0500 Subject: Namespace pollution References: <949332864.553076@news.adtranzsig.de> <20000131170908.A831@stopcontact.palga.uucp> Message-ID: <875q0b$bgh$1@news.udel.edu> "Gerrit Holl" wrote in message news:20000131170908.A831 at stopcontact.palga.uucp... > Dirk-Ulrich Heise wrote on 949329139: ... > > I end up with dozens of helper functions that are > > called exactly one time. They pollute the namespaces > > of the module or class they're defined in. I hate polluted > > namespaces. > > > > How do others cope with this problem (that does not only > > apply to Python)? > > Nest functions. > > If you have a function X only used in _one_ other function Y, move the > function definition X to Y. The problem with this is that function X is recreated everytime you call function Y. From hellan at acm.org Tue Feb 22 05:14:12 2000 From: hellan at acm.org (Jon K Hellan) Date: 22 Feb 2000 11:14:12 +0100 Subject: Font in tkinter / idle Message-ID: <87putpfssr.fsf@parus.parus.no> How do I change the default font for tkinter apps, in particular idle? Jon K?re From vijaybaliga at hotmail.com Thu Feb 24 15:39:57 2000 From: vijaybaliga at hotmail.com (Vijay Baliga) Date: Thu, 24 Feb 2000 12:39:57 -0800 Subject: Newbie question about exceptions References: <88s311$dt1@news.dns.microsoft.com> Message-ID: <8944v4$6om@news.dns.microsoft.com> Thanks for your help, Remco! My news server was down, and I only saw your post today. What would I do if I sometimes wanted to "return" from within the try: block? If gotos were allowed, I could do something like this: goto Cleanup ... Cleanup: f1.close() Or, if I could have "finally" with "try/except", then I could simply "return", and be sure that the "finally" clause would be executed on the way out. Thanks, Vijay "Remco Gerlich" wrote in message news:slrn8b3pvt.6ij.scarblac-spamtrap at flits104-37.flits.rug.nl... > Vijay Baliga wrote in comp.lang.python: > > Why isn't "finally" allowed with "try/except"? > > Everything with "except:" is done if that exception is matched. A > "finally:" clause is executed regardless of whether an exception > was raised. If you have an "except:" clause already, that's quite > superfluous. > > Ideally, I would like to do > > the following: > > > > try: > > f1 = open(file1) > > use(f1) > > f2 = open(file2) > > use(f1, f2) > > f3 = open(file3) > > use(f1, f2, f3) > > except: > > print 'File open error' > > finally: > > f1.close() > > f2.close() > > f3.close() > > How about: > > try: > f1 = open(file1) > (etc) > except: > print 'File open error' > f1.close() > > It will always get there. > > (Of course, no need to close files - it'll be done automatically after the > file leaves scope, because of refcounting) > > -- > Remco Gerlich, scarblac at pino.selwerd.nl > "Early to rise, early to bed, makes a man healthy, wealthy and dead." -- TP From effbot at telia.com Wed Feb 9 15:03:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 20:03:32 GMT Subject: Real Problems with Python References: Message-ID: [neelk at cswcasa.com provides an excellent summary of some critical python warts] just one footnote: > 5. The type/class dichotomy, and the lack of a metaobject system. > > C types and Python classes are both types, but they don't really > understand each other. C types are (kind of) primitive objects, in > that they can't be subclassed, and this is of course frustrating > for the usual over-discussed reasons. Also, if everything is an > object, then subclassing Class becomes possible, which is basically > all you need for a fully functional metaobject protocol. This > allows for some extremely neat things. note that you *can* implement real classes using relatively clean C code. however, types are usually a better alternative, since they provide low-level slots for most "magic" methods. (after all, if performance isn't that critical, you might as well stick to Python ;-) From effbot at telia.com Thu Feb 24 16:02:10 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 21:02:10 GMT Subject: Netcfg python error References: Message-ID: Tom Elsesser wrote: > When trying to run netcfg, I get the error message: > > Traceback (innermost last): > File "/usr/lib/rhs/netcfg/netcfg.py", line 29, in ? > from rhentry import * > EOFError: EOF read where object expected > > I am using Mandrake 6.0 , kernel 2.2.9-19mdk > python 1.5.1-11mdk > netcfg 2.21-3mdk the code in the "rhentry" module attempts to load (or import) a truncated file. or in other words, this is a problem with the netcfg application (probably a damaged data file?), and has nothing whatsoever to do with Python itself. Better check with the Mandrake or Red Hat folks... From fredrik at pythonware.com Tue Feb 1 13:46:11 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 19:46:11 +0100 Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> <20000201154723.A1704@stopcontact.palga.uucp> Message-ID: <007401bf6ce4$9ecc84d0$f29b12c2@secret.pythonware.com> Gerrit Holl wrote: > > >I thought of a nice python environment under windows ... It would be best to > > >have german documentation too. > > There is a German book, isn't there? afaik, there are at least four: Mit Python programmieren (Himstedt, M?tzel) Das Python-Buch (von L?wis, Fischbeck) Python kurz und gut (Lutz) Einf?hrung in Python (Lutz, Ascher) > There is a Germen list, isn't there? http://starship.python.net/mailman/listinfo/python-de From drek at interlog.com Fri Feb 18 11:04:10 2000 From: drek at interlog.com (Agent Drek) Date: Fri, 18 Feb 2000 11:04:10 -0500 (EST) Subject: PyGreSQL and windows In-Reply-To: Message-ID: | Install Postgres on Real OS, and use it via ODBC from Windows. | let's not start the OS war :) The Windows environment is still quite foreign to me ... is ODBC a python module that will let me communicate to a the postgres server from windows? I'm new to this sql/database stuff so please forgive my ignorance. -- -ly y'rs, Agent Drek Big Animation Inc > 'digital plumber' http://www.bigstudios.com From sholden at bellatlantic.net Mon Feb 28 00:24:55 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 05:24:55 GMT Subject: I'm sorry, name of instance inside its methods References: Message-ID: <38BA06A8.E1DB637A@bellatlantic.net> In that case, previous posts would seem to indicate there is a technical name for your position: you are "screwed". Sorry. regards Steve adrian lee vega wrote: > > actually you're correct, I want the name of the instance > not the name of the class > > > > > > def classname(self): > > > > > > > > > ------------------------------- > > > > > > >>>from hello import * > > > >>>clown = Hello(1) > > > >>>clown.classname() > > > clown > > > > > > hmmm.... looking at that again, "clown" is an instance name, not the > > name of the class.. which do you actually want? > > > > Cheers, > > > > - Michal -- "If computing ever stops being fun, I'll stop doing it" From tbryan at python.net Fri Feb 18 22:37:36 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Fri, 18 Feb 2000 22:37:36 -0500 Subject: CGI Scripts References: <38A22C13.81393ADA@python.net> Message-ID: <38AE1000.D0AE48B@python.net> Will Ware wrote: > > Thomas A. Bryan (tbryan at python.net) wrote: > > modules_of_interest = ['string', 'cgi', 'math', 'foo'] > > for module_name in modules_of_interest: > > try: .... > > except ImportError: .... > > I am fooling with a CGI script which does what, to me, looks like > a totally legitimate import from the directory where it itself is. You can execute the same import from another script in the same directory. > The directory shows up in sys.path and I can do os.listdir() on it >From within the CGI script? [..snip..] > Are there any deeper or more insight-offering ways to debug > problems with importing? Is there any sort of verbose debug option > that spews out messages about exactly how or why the import failed? python -v gives a bunch of information about what was loaded from where, but I don't know whether it provides much extra information about modules that it cannot load. You could als try doing a except ImportError, msg: print "I failed to load %s with message %s\n" % (module_name, msg) to see what's actually failing. Are you getting a "no module named foo"? You can also start your script with import sys sys.stderr = sys.stdout so that error messages sent to stderr are routed to the user's screen. Does that help? From tjreedy at udel.edu Sat Feb 19 15:49:36 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 19 Feb 2000 15:49:36 -0500 Subject: [Q] Python and 3D tools References: <88m003$1dani$1@fu-berlin.de> Message-ID: <88mvf2$9e9$1@news.udel.edu> "Jo?o Neto" wrote in message news:88m003$1dani$1 at fu-berlin.de... > Hi > > Does anybody know if Python is used together with > some 3D Engine? Check out Alice (link at Python site) From a.eyre at optichrome.com Mon Feb 7 07:37:36 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Mon, 7 Feb 2000 12:37:36 -0000 Subject: import statement suggestion/question In-Reply-To: <389E80E6.7B866031@camelot-it.com> Message-ID: <001201bf7168$1d286fb0$3acbd9c2@peridot.optichrome.com> > import VijayanModule_Doing_A_B_C > VMD=VijayanModule_Doing_A_B_C > del VijayanModule_Doing_A_B_C # can be omitted Equivalent to the 1-liner: VMD = __import__("VijayanModule_Doing_A_B_C") ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From thor at localhost.localdomain Tue Feb 1 13:41:54 2000 From: thor at localhost.localdomain (Manuel Gutierrez Algaba) Date: 1 Feb 2000 18:41:54 GMT Subject: MiniBloquiHeader References: Message-ID: On 01 :20 +0100 (MET), Mikael Olofsson wrote: > >On 01-Feb-00 Manuel Gutierrez Algaba wrote: > > For those who use LaTeX I've made a little utility that > > uses python,pstricks and fancyhdr : > > > > http://www.ctv.es/USERS/irmina/MiniBloquiHeader.html > >Since the documentation is in Spanish (I guess), I would appreciate at >least a few words in English explaining the function of your utility. > The idea is that Analysis and Doc in general are settup in pages whose headers may "resemble" this: ----------------------------------- | | Chapter 5 |P. 4| | | | | |---------------------------------- This is what I was told, to produce such nice pages , the problem is that I don't know how to do in TeX, or I didn't know. Using a combined approach of Pstricks and fancyhdr (Pstricks drawing the lines , and fancyhdr placing the drawing). Python is used for generating the Pstricks lines, in a very high level, I think, just telling relative points and relative measures. It's a very mini utility but useful for me... I'll give the English doc when I have more time. -- MGA From aahz at netcom.com Thu Feb 17 17:07:35 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 22:07:35 GMT Subject: Soft. Dev. Magazine March Message-ID: <88hrf7$ufi$1@nntp6.atl.mindspring.net> http://www.sdmagazine.com/features/2000/03/source.shtml The above URL is for an article in the 3/2000 issue of Software Development Magazine touting the virtues of Python. Overall, one of the best pieces I've seen from someone I don't recognize as being "from the community". -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From exarkun at flashmail.com Sat Feb 26 13:47:02 2000 From: exarkun at flashmail.com (Jp Calderone) Date: Sat, 26 Feb 2000 18:47:02 +0000 Subject: How do Java JIT compilers cope with JPython? References: Message-ID: <38B81FA6.E1D032CA@flashmail.com> Alex wrote: > > Hi. Has anyone looked at how effective the new Java JIT compiler is for > run-time optimization of JPython byte code? If you have a JPython > function that is always called with a list as an argument, is the > compiler smart enough to optimize for this? I'm guessing no, but I > thought I would check whether anyone has looked. > > Alex. All the JITs I've tried (shuJIT and sunwjit) won't even *work* with JPython. The jvm segfaults when trying to load a .class file that uses it :( Jp -- | This | signature | intentionally | 8 lines | long. | (So sue me) ----- 6:45pm up 24 days, 1:17, 0 users, load average: 0.00, 0.00, 0.00 From ndev42 at my-deja.com Tue Feb 22 10:50:25 2000 From: ndev42 at my-deja.com (ndev42 at my-deja.com) Date: Tue, 22 Feb 2000 15:50:25 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <88tkob$jqd$1@nnrp1.deja.com> <38B2910B.A0AD14C3@bellatlantic.net> Message-ID: <88ub7v$376$1@nnrp1.deja.com> In article <38B2910B.A0AD14C3 at bellatlantic.net>, sholden at BellAtlantic.net wrote: [...] > Of course, you would create these widgets to conform with > the appropriate look-and-feel for each platform to which > you were porting? Generally, the amount of effort required > to build a portable GUI layer is CONSIDERABLY > greater than "some". If you call the "Button" widget from the underlying window library, no matter what it is you will get a Button with the local look'n'feel. No effort there. OTOH, if you try to keep a consistent look'n'feel over platforms, you'll get into trouble pretty quickly, I agree. > Let's be clear: you are complaining about the complexity of > your environment, not the complexity of Python's GUI support. Perfectly right! > IMO, the Python builders took a very sensible decision > to use an existing GUI toolkit, and while I agree some > of the implementation details are plain ugly, fortunately > they are hidden below the abstraction we use > to access them. Reusing other people's code buys you time and efforts, but at a certain cost. If Tcl/Tk has a bug, Python/Tkinter has the same bug, too. If Tcl/Tk is hard or heavy to install, Tkinter will be too (actually not Tkinter itself but the dependencies it needs to run). If Tcl/Tk has problems running on Macs, Python/Tkinter has problems too. You spare the development time but you pay a price later. Right. Now let's (at least try to) be more constructive: Imagine for a moment that Tkinter has bindings not only to Tk but also to Qt/KDE, GTK+/Gnome, X11, Mac, Win, etc. At install time, the installation procedure tries to determine what kind of GUI package is available on your system, and you tell which one you want to take over the support for GUI stuff. Then you can program your GUI without thinking about which window library is actually going to render your widgets. That would make your GUI code compatible on all stations possibly supporting all of the above stuff. Sure, look'n'feel will be dependent on the underlying library, but other than that it would be paradise to distribute Python GUIs. You want to run my application with its GUI. -> You are running Win/Mac? Nothing to install. -> Linux? You must have Gnome, KDE, or Tcl/Tk somewhere around. -> Other Unixes? Either you have one of the supported window libraries, or you need to install one. Pick the one you prefer. To achieve that, we could make a part of Python become the standard for GUI programming (I took Tkinter as an example in the above) and request to people doing GUI bindings to Python to do it through this interface. Instead of saying that library XXX has Python bindings, you could now declare that you have made Python/GUI bindings. I'm sure there are nasty side-effects to that. Ideas? -- Nicolas Sent via Deja.com http://www.deja.com/ Before you buy. From KRodgers at ryanaero.com Thu Feb 24 17:01:42 2000 From: KRodgers at ryanaero.com (Rodgers, Kevin) Date: Thu, 24 Feb 2000 14:01:42 -0800 Subject: Bug in win32all-128 with multiprocessor NT Message-ID: <0D8C1A50C283D311ABB800508B612E5354B397@ryanaero.com> The "pname" is to be replaced by whatever process name you want to try this on. For example, if you have the NT version of XEmacs running, the line would look like: pid = win32pdhutil.FindPerformanceAttributesByName("xemacs") But glad to see that somebody else reproduced the problem! Kevin > -----Original Message----- > From: Darrell [SMTP:darrell at dorb.com] > > Couldn't get this line to work after two minutes of trying. > pid = win32pdhutil.FindPerformanceAttributesByName("pname") > > So I plugged in a pid and yes it worked but caused the exception you > mentioned. > I'm running Win2K also. > > > From jayantha at ccs.neu.edu Thu Feb 17 16:43:36 2000 From: jayantha at ccs.neu.edu (Joshua C. Marshall) Date: Thu, 17 Feb 2000 16:43:36 -0500 Subject: Metaclass hierarchy? (was Re: Superclasses) In-Reply-To: <_ZWq4.180$mYj.170807808@newsa.telia.net> References: <_ZWq4.180$mYj.170807808@newsa.telia.net> Message-ID: On Thu, 17 Feb 2000, Fredrik Lundh wrote: > Joshua C. Marshall wrote: > > Given a class object, is there a way to get at its superclass object? > > the thing you're looking for is "__bases__" Yup, thanks. Though this prods another question out of me. If "T" is a class object, "dir(T)" does not show "__bases__" as a field. What is the lookup rule for getting fields from class objects? Is it similar to getting fields from instances (where the interpreter goes up the class hierarchy until it finds what you're looking for)? If so, what hierarchy is being examined? From bjorn at roguewave.com Tue Feb 22 12:58:28 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 22 Feb 2000 10:58:28 -0700 Subject: functional programming References: Message-ID: <38B2CE44.CB9B41A9@roguewave.com> Moshe Zadka wrote: > On 22 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > > > What would be the advantages of using a "functional" Python, as per your > > definition?I mean, of course, in practice? > > None. But it would be cool to have tail recursion, which could probably > be implemented in a post-Stackless world. Maybe I'm dense, but what is stopping us from implementing tail call optimization (of which tail recursion is just a special case) with the current Python implementation. Identifying a call in a tail position is a simple static analysis that isn't affected by Python's dynamicity (is that a word?). Once they're identified you only need to translate a call to a jump instead of a push return address and jump. There is no semantic change to Python. maybe-if-I-knew-Python-internals-I-would-know-better'ly y'rs -- bjorn From aahz at netcom.com Wed Feb 16 16:28:11 2000 From: aahz at netcom.com (Aahz Maruch) Date: 16 Feb 2000 21:28:11 GMT Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) References: <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216073900.B2508775@vislab.epa.gov> <14506.62171.965245.972734@anthem.cnri.reston.va.us> Message-ID: <88f4pb$isj$1@nntp6.atl.mindspring.net> In article <14506.62171.965245.972734 at anthem.cnri.reston.va.us>, Barry A. Warsaw wrote: > >def baz(): > try: > bar() > except NameError: > tpe, val, tb = sys.exc_info() > raise AttributeError, None, tb I recall reading that passing around a traceback object leaks memory. Does this particular idiom avoid that trap? -- --- 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 Have you coined a word today? From alv50855 at sci.tamucc.edu Sun Feb 27 19:44:05 2000 From: alv50855 at sci.tamucc.edu (adrian lee vega) Date: Sun, 27 Feb 2000 18:44:05 -0600 (CST) Subject: I'm sorry, name of instance inside its methods In-Reply-To: Message-ID: actually you're correct, I want the name of the instance not the name of the class > > > def classname(self): > > > > > > ------------------------------- > > > > >>>from hello import * > > >>>clown = Hello(1) > > >>>clown.classname() > > clown > > > hmmm.... looking at that again, "clown" is an instance name, not the > name of the class.. which do you actually want? > > Cheers, > > - Michal From scarblac-spamtrap at pino.selwerd.nl Mon Feb 14 05:26:49 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 14 Feb 2000 10:26:49 GMT Subject: Off Topic Posts References: Message-ID: Gene Chiaramonte wrote in comp.lang.python: > I am suggesting that python-list be split into 2 lists. One for specific > python programming questions, and another list for python language opinions > and comments. > > Anyone agree with me? That sounds simple on the mailing list side, but the Usenet side is a bit more complex (need the procedure for a new group, and so on). Switching discussions from one group to another (as with followup-to on Usenet) is also a problem. Anyway, those discussions aren't off-topic - they're about Python, right? This group is not only for questions about Python. Just don't read those threads... -- 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 schneiker at jump.net Tue Feb 29 02:21:03 2000 From: schneiker at jump.net (Conrad Schneiker) Date: Tue, 29 Feb 2000 01:21:03 -0600 Subject: RFD: comp.lang.ruby (repost) Message-ID: <89frsd$bed$1@news.jump.net> Note: this is the 2nd post of the RFD for comp.lang.ruby for those who may have missed the original. This RFD was originally posted by the moderator of news.groups.announce on 02/16/2000. **** Please do not reply to the newsgroups that this note is posted to. **** Please direct questions or comments about the Ruby language to comp.lang.misc. Please direct questions or comments about the Ruby RFD to news.groups. Please put "Ruby:" at the beginning of the subject line when posting to the above groups. ==================================================== REQUEST FOR DISCUSSION (RFD) unmoderated group comp.lang.ruby This is a formal Request For Discussion (RFD) for the creation of of an unmoderated group comp.lang.ruby. This is not a Call for Votes (CFV); you cannot vote at this time. Procedural details are below. Newsgroup lines: comp.lang.ruby The Ruby programming language. RATIONALE: comp.lang.ruby Ruby is a relatively new very-high-level language developed in Japan. Ruby is a dynamic object oriented programming language that 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 also an open source language. There are over 1000 members of 4 Japanese Ruby mailing lists (general, developers, math, extension writers), with a peak volume topping 100 messages per day. At present, there is only one English Ruby mailing list with about 125 members, with a recent volume of 5-10 messages per day; however this should approach the traffic level of the Japanese lists as more English-speaking people learn Ruby and as English language Ruby documentation continues to become increasingly available. A survey of DejaNews shows 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. 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 in the realm of the takeoff threshold that both Perl and Python attained many 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 would include, but 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. PROCEDURE: This is a request for discussion, not a call for votes. In this phase of the process, any potential problems with the proposed newsgroups should be raised and resolved. The discussion period will continue for a minimum of 21 days (starting from when the first RFD for this proposal is posted to news.announce.newgroups), after which a Call For Votes (CFV) will be posted by a neutral vote taker. Please do not attempt to vote until this happens. All discussion of this proposal should be posted to news.groups. This RFD attempts to comply fully with the Usenet newsgroup creation guidelines outlined in "How to Create a New Usenet Newsgroup" and "How to Format and Submit a New Group Proposal". Please refer to these documents (available in news.announce.newgroups) if you have any questions about the process. DISTRIBUTION: This RFD has been posted to the following newsgroups: news.announce.newgroups, news.groups, comp.lang.perl.misc, comp.lang.python, comp.lang.java.programmer, and the following mailing list: ruby-talk at netlab.co.jp (English language Ruby discussion group) Subcribe via: ruby-talk-ctl at netlab.co.jp ('subscribe first_name last_name' in body) Proponent: Conrad Schneiker From maxm at normik.dk Thu Feb 24 05:31:32 2000 From: maxm at normik.dk (maxm) Date: Thu, 24 Feb 2000 11:31:32 +0100 Subject: Best way to find unique items in a list Message-ID: I have written the following snippet to return a list of unique items in another list. I just wondered if there was a smarter/faster way of doing it? Anyone for a little brain gym? ------------------------------------------ def Unique(theList): uniqueList = [] OldValue = '' theList.sort() for value in theList: if OldValue != value: uniqueList.append(value) OldValue = value return uniqueList print Unique(['Max','Gitte','Magnus','Caroline','Clara','Max','Gitte']) >>>['Caroline', 'Clara', 'Gitte', 'Magnus', 'Max'] ------------------------------------------ Regards Max M Rasmussen, New Media Director http://www.normik.dk Denmark e-mail mailto:maxm at normik.dk private mailto:maxmcorp at worldonline.dk From guido at CNRI.Reston.VA.US Wed Feb 2 10:56:26 2000 From: guido at CNRI.Reston.VA.US (Guido van Rossum) Date: Wed, 02 Feb 2000 10:56:26 -0500 Subject: Special Interest Group: Python in Education Message-ID: <200002021556.KAA22223@eric.cnri.reston.va.us> At the last Python Conference, nearly 40 people joined an after hours discussion group on the use of Python in education. We learned a lot -- for example, that there are many different ways to teach programming, and that different age groups require different approaches. One of the results of that meeting was the decision to create a Special Interest Group (SIG) on the use of Python in education. I have created the SIG home page and a mailing list, and I invite you to join the SIG. I plan to post a summary of the meeting to the mailing list, after some time waiting for people to join (you can always dig missed posts out of the archives). Here are the URLs: http://www.python.org/mailman/listinfo/edu-sig (mailing list) http://www.python.org/sigs/edu-sig/ (SIG home page) Please forward this message to other relevant lists or individuals who might be interested. (I've already invited everyone who was at the meeting or who has sent me email about CP4E over the past year.) I don't have a fixed idea about what the charter of the SIG should be; I'd like to see discussion of CP4E, but also of other issues related to Python and education, and I'd like to include all levels of education (from grade school to college level as well as adult education), as long as people are interested in learning or teaching Python. --Guido van Rossum (home page: http://www.python.org/~guido/) From mhammond at skippinet.com.au Tue Feb 1 20:40:45 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 02 Feb 2000 01:40:45 GMT Subject: Python startup seems slow... (NT) References: <000201bf67bf$b27527a0$592d153f@tim> <38900E46.909421F8@quantisci.co.uk> <2eYj4.1931$UH3.230869@news4.usenetserver.com> <8EC991745duncanrcpcouk@194.238.50.13> Message-ID: "Joel Lucsy" wrote in message news:zJik4.2042$CX6.158724 at news4.usenetserver.com... > On my system and another I've talked to with email, it's the winmm that > causes the problem. Most likely it's caused by improperly written sound > drivers. I have a laptop which probably exacerbates the problem. Hrm. Im pretty sure that winmm is only used by the builtin module "winsound". However, Im really not too sure why winsound is a builtin rather than a standard .pyd extension module. This would solve the problem, and help keep python15.dll a little trimmer. IMO, same goes for the socket module - could be ripped out. IIRC, it originally was, and Guido decided he would rather have it built-in, in the interests of ensuring it is "standard". Mark. From python-list at teleo.net Mon Feb 7 19:42:15 2000 From: python-list at teleo.net (Patrick Phalen) Date: Mon, 7 Feb 2000 16:42:15 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87nmir$e7k$1@nnrp1.deja.com> References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <00020717051900.00606@quadra.teleo.net> [fcahoon at my-deja.com, on Mon, 07 Feb 2000] If python code were to become mis-formatted (and given my experience, I have to believe that sooner or later this _will_ happen) there is _no way_ to be certain what the original author's intent was, much less to fix it automatically. This is a Bad Thing(tm). This could be a Bad Thing, if the coders involved failed to follow the very practices which Python's design encourages: write small, manageable, modules. I fail to see how any project written in a sane, modular way could be made inscrutable by the sort of inadvertence to which you refer. I had been taking the "ignore it and it will go away" approach to Python, because I figure it is no business of mine. There is no reason why I can't simply use another language. However, I was at LinuxWorld last week, and I think that in over half the sessions I attended the presenter said at some point "this part was implemented in Python". (By contrast, there was only one mention of Perl, and it was dismissive -- "there is an API for perl, but I don't know why anyone would want to use it".) Yes. Isn't it wonderful? :>) Some of you may argue that, if Python is not a good language, how did it become so popular? Once a scripting language like Perl or Python acquires a "critical mass" of followers, it will experience exponential growth, because the availability of modules affects the usability of the language in real-world applications and the usability (or rather, use) of the language leads to the creation of more modules, in a positive-feedback loop. Python does address some of the shortcomings of Perl -- notably, it is far more maintainable in a multi-developer envirionment -- despite the flawed decision to use whitespace as syntax. This fact, and a butterfly flapping its wings in the Amazon jungle, has led Python to achieve "critical mass". This is specious and ill-informed. You do have a bit of a nerve coming on this newsgroup and suggesting that the thousands of serious programmers (many of them former Perl hackers) who use Python daily do so for the sole reason of a slight edge in maintainability. Or that Python's popularity is the result of some unexplainable initial condition. While I'm sure this will strike many of you as a bunch of gratuitous flamage, I really am only trying to promote reasoned discussion, honest. I hope no one gets really _personally_ upset! I'm certainly not upset. I believe you post is sincere and not meant to be flamebait (albeit inflammatory). Thousands of programmers who use Python daily can attest that your fears are unfounded. At the risk of inflaming you, I'd venture to say your fears are silly, but I'd rather encourage you to face up to those fears and actually try writing a few lines of Python, and running them, to see how if feels From m.faassen at vet.uu.nl Wed Feb 23 11:54:23 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 23 Feb 2000 16:54:23 GMT Subject: Which GUI? References: Message-ID: <8913bv$j38$1@newshost.accu.uu.nl> Moshe Zadka wrote: > On Thu, 17 Feb 2000, Gerrit Holl wrote: >> I disagree. The latest gui war was over half a year ago, and >> wxPython was abandoned than. But it growed. I'd like to see >> an answer to ESR's question: >> >> Why the hell hasn't wxPython become the standard GUI for Python yet? > Here's an easy one: Python is portable. Tkinter is portable. I could code > a Python GUI on an AIX machine with a brain dead C++ compiler in half an > hour. I couldn't get wxWindows (the basis for wxPython) to compile on that > C++ compiler for 2 weeks. Hm, earlier on you said you installed gcc on all these platforms, so that begs the question, why not use gcc on AIX to compile wxWindows? :) Regards, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From mfletch at tpresence.com Thu Feb 17 17:09:32 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 17 Feb 2000 17:09:32 -0500 Subject: Which GUI? Message-ID: Off the top of my head: Not available on Macs, or most exotic architectures. Slightly less "pure" design than, for example, FxPy (which is conceptually beautiful). The use of distinct sizer objects can be a little annoying when accustomed to something like FxPy, where being the child of something means the you are drawn in its child area, with placement etc. figured out for you. Leads to all sorts of minor editing errors. Advanced grid widget still a design project (minor) Stability issues (passing incorrect arguments can cause memory protection errors etc.) Note: wxPython has been much more stable for me than Fox, but I haven't used Fox in a number of months. On the other hand, I use wxPython daily because: It has the best documentation I've seen so far (save tkinter) Speed Very responsive developer (Robin), and ongoing development Decent selection of widgets Acceptable, if not heart-achingly beautiful underlying design Enjoy all, Mike -----Original Message----- From: Gerrit Holl [mailto:gerrit.holl at pobox.com] Sent: Thursday, February 17, 2000 3:46 PM To: Vetle Roeim Cc: python-list at python.org Subject: Re: Which GUI? Vetle Roeim wrote on 950797908: > I-hope-this-doesn't-start-a-gui-war--ly y'rs, vr I disagree. The latest gui war was over half a year ago, and wxPython was abandoned than. But it growed. I'd like to see an answer to ESR's question: Why the hell hasn't wxPython become the standard GUI for Python yet? regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke -- http://www.python.org/mailman/listinfo/python-list From embed at geocities.com Fri Feb 18 09:11:31 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 18 Feb 2000 09:11:31 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262152524-5049647@hypernet.com> <38A33AD9.3F4EA190@americasm01.nt.com> <88gu3a$o8s@newton.cc.rl.ac.uk> Message-ID: > > So its seems to me that the compelling reason is inertia. > "Idiom Reuse" ie: Inheritance. From ron at graburn.com Sun Feb 13 18:10:29 2000 From: ron at graburn.com (Ronald Hiller) Date: Sun, 13 Feb 2000 23:10:29 GMT Subject: Changes to urlparse.py: urljoin Message-ID: <38A739AC.CCA2EB8C@bellatlantic.net> I've been having some problems with the urljoin function. When I try and join URLs that have '..' components that make the path above the root, they aren't joined properly. For example: goof> python Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import urlparse >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") 'http://www.xyz.com/../x/y/z.gif' >>> # Now with the changes: > python Python 1.5.2 (#1, Oct 24 1999, 20:24:11) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import urlparse >>> urlparse.urljoin("http://www.xyz.com", "../x/y/z.gif") 'http://www.xyz.com/x/y/z.gif' >>> My patches for urlparse are included below...do they look reasonable? What is the process for getting these into the "real" source tree? Thanks, Ron *** orig/Lib/urlparse.py Thu Mar 18 10:10:44 1999 --- urlparse.py Sun Feb 13 16:51:36 2000 *************** *** 166,171 **** --- 166,175 ---- i = i+1 else: break + while segments[0] == '': + del segments[0] + while segments[0] == '..': + del segments[0] if len(segments) == 2 and segments[1] == '..' and segments[0] == '': segments[-1] = '' elif len(segments) >= 2 and segments[-1] == '..': From aahz at netcom.com Wed Feb 9 17:15:44 2000 From: aahz at netcom.com (Aahz Maruch) Date: 9 Feb 2000 22:15:44 GMT Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> <389A3E61.47E255A0@home.com> <38A1E664.3CEAF4BF@be-research.ucsd.edu> Message-ID: <87soug$ik4$1@nntp6.atl.mindspring.net> In article <38A1E664.3CEAF4BF at be-research.ucsd.edu>, Curtis Jensen wrote: > >Would it be possible to include a history ability into the Python >interpretor? Something simmilar to the BASH shell, or doskey in DOS. >Up-Arrow prints the previous command. I think this would be a great new >feature. Once more, Guido's Amazing Time Machine comes to your rescue. Try compiling with Gnu readline() support. -- --- 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 Nostalgia just ain't what it used to be From paul at prescod.net Mon Feb 7 20:10:29 2000 From: paul at prescod.net (Paul Prescod) Date: Mon, 07 Feb 2000 19:10:29 -0600 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <389F6D05.F23BEE6D@prescod.net> fcahoon at my-deja.com wrote: > > ... > > If python code were to become mis-formatted (and given my experience, I > have to believe that sooner or later this _will_ happen) there is _no > way_ to be certain what the original author's intent was, much less to > fix it automatically. This is a Bad Thing(tm). Python code does not become mis-formatted for the same reason that curly braces do not disappear in C. If you leave out any significant characters in Python, the compiler tells you that you have done so, just as a C ompiler would. In the extremely rare case that this happens to production code you do exactly what you would do in C if your curly braces all disappeared. You roll back to the last version that compiled (or in the Python case, "ran"). > Python does address some of the shortcomings of > Perl -- notably, it is far more maintainable in a multi-developer > envirionment -- despite the flawed decision to use whitespace as > syntax. There are literally *hundreds* of languages that are more maintainable than Perl. If you want to understand why Python is becoming so popular you will have to work much harder than that. In fact, you may even have to try it. > This fact, and a butterfly flapping its wings in the Amazon jungle, has > led Python to achieve "critical mass". Oh, I see. You _have_ thought deeply about this issue. > Iff I _must_ live with Python, then I will be driven to my second tactic > -- a comment-driven fix for the lack of adequate information in the the > python source to restore mis-formatted code. There is a library in the Python distribution that reformats code according to structure described in comments. It looks like your problem is solved. Welcome aboard. In the Python world, we do get a little bit tired of people coming in and telling us how Python is unusable because of the whitespace "problem". Most of us have built systems with many developers distributed around the world on heterogenous systems of thousands of lines and never had these "whitespace eating nanovirus" problems. If you have a whitespace eating nanovirus in your computer (or company) be glad that the Python compiler will help you find it and root it out before it destroys one of your makefiles! > First is the _hardcore_ promotion of realistic alternatives to Python. > I believe that the Ruby language (http://www.ruby-lang.org/) has the OO > advantages of Python without the whitespace-as-syntax deficiency. While you are promoting Ruby, also consider Corbascript, Pike, Lua, Guile and Squeak. You'd better cover your bases! -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From paul at prescod.net Mon Feb 7 18:12:22 2000 From: paul at prescod.net (Paul Prescod) Date: Mon, 07 Feb 2000 17:12:22 -0600 Subject: PyExpat update References: <389F1CD5.102E6757@prescod.net> Message-ID: <389F5156.F69D9CC9@prescod.net> Mark C Favas wrote: > > Is there any chance that pyexpat could handle DTDs and thus default values for > attributes (I believe there was a test version of expat that added this > capability...) Yes, it makes sense to use the version of expat with external subset support. > I'd like to use the SAX interface to that to spped parsing up - > I currently use the validating xmlproc part of the PyXML-0.5.3 package. Pyexpat should meet your needs soon. > >setjmp/longjmp is gone > >setjmp/longjmp works on Windows > > Umm - did setjmp/longjmp come back? No, just a think-o. Error reporting from handlers now works on windows. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From robin at jessikat.demon.co.uk Fri Feb 11 12:41:57 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 11 Feb 2000 17:41:57 +0000 Subject: [was: Corel + Borland = The End of MS Win] References: Message-ID: In article , Steven D. Majewski writes > >On Fri, 11 Feb 2000, Fredrik Lundh wrote: > >> according to Steven Majewski [...] > >Like Kibo, you need only mention my name an I appear >with an off topic comment. > >Check out Byte.com/TechNet article: > >Jon Udell's: "A Perl Hacker in the Land of Python" > > .... Gee it must be tough monitoring 39000 news groups. We could mount a TC denial of service by starting a random anti-perl thread in all known news groups :). Whew was that echelon flashing by. -- Robin Becker From phd at phd.russ.ru Tue Feb 15 10:07:57 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 15 Feb 2000 15:07:57 +0000 (GMT) Subject: PyApache, couldn't geta hold of author, willing to donate sometime In-Reply-To: <14505.27151.431298.95555@beluga.mojam.com> Message-ID: On Tue, 15 Feb 2000, Skip Montanaro wrote: > Unless something has changed recently, PCGI does actually fork a program for > each referenced URL. This program marshals the input arguments and shoots > them across a socket to the long-running process. The program is an itty > bitty C program, so presumably its startup overhead is going to be a whole > lot smaller than that of the Python interpreter. Even better - I wrote an Apache module to handle PCGI: http://www.zope.org/Members/phd/mod_pcgi2 Oleg. ---- 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 Mon Feb 7 11:44:54 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 7 Feb 2000 11:44:54 -0500 Subject: An FTP based Python Module repository (was Re: Imagemagick) In-Reply-To: <87ml2o$m60$1@nntp4.atl.mindspring.net> Message-ID: <1262180616-3359291@hypernet.com> Michal Wallace wrote: > ... The thing perl has that python doesn't > though, is namespace > protection... for example, I'm working on a set of MIDI modules... well, I > can set it up so > to use my stuff you do "import midi".. but that'll conflict with the midi > stuff already out > there... CPAN would have encouraged me and the other MIDI author to name our > modules "midi.hisversion" and "midi.myversion".... > > which is not to say that we can't do that in python, but... well, nobody > does... The generally accepted scheme in Pythondom follows the Java model: hiscompany.midi versus mycompany.midi. - Gordon From ame at swipnet.se Wed Feb 2 19:02:23 2000 From: ame at swipnet.se (Anders Eriksson) Date: Thu, 03 Feb 2000 00:02:23 GMT Subject: Creating a new image from two old using PIL? References: Message-ID: <3898c40d.18747387@nntpserver.swip.net> On Wed, 02 Feb 2000 17:40:35 GMT, "Fredrik Lundh" wrote: >Anders M Eriksson wrote: >> I'm a beginner of Python and I thought that I should create an web >> counter cgi. I have created the whole cgi except for the part that >> creates the image. >hints: use "Image.new" to create a blank image large enough >to hold the resulting image, and "paste" to paste the digits >into it. Thanks for the hints! I have got it working!! Had a little problem with the fact that the number gifs wasn't the same size... One more question: Now that I have created the new image. How do I get it into my HTML page? I have tried (image is the new image) print "Content-type: image/gif\n" print image and I have called the script from an But it wont work :-( // Anders From cpatti at atg.com Fri Feb 4 16:42:06 2000 From: cpatti at atg.com (chris patti) Date: 04 Feb 2000 16:42:06 -0500 Subject: Dist. Object Directory (was: Re: An FTP based Python Module repository) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> Message-ID: Aaron J Reichow writes: > On 4 Feb 2000, chris patti wrote: > > > Another big win in this is that it eases the automated retrieval and > > installation of modules, in the Perl world we have CPAN.pm which lets > > you say things like: > > > > install frobnitz > > > > And it will search the archive, find the latest version, download it > > and install it to your local Perl installation. > > And to me, a similarily interesting idea would be to have a server with a > number of mirrors, that could host remote objects using dopy (alpha code, > but easy to use IMO) or fnord. This probably isn't the most practical of > all things, but the idea fascinates me. > > Aaron Well, it sounds cool but it's the wrong level of abstraction for the problem :) All we need is a single archive where all the Python modules in existence (that their authors want published) live. The server generates a list of what modules live where, and so when a client asks for "xmlrssparse" the server knows that this is really stored in authors/reiley/Xml-Parser-With-Rawpberry-Frosting.tar.gz which unpacks and installs the xmlrssparse module and any modules it depends upon. How would an object broker approach help this situation? Just wondering. -Chris -- -------------------------------------------------------------------- Chris Patti| \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From aahz at netcom.com Tue Feb 15 16:26:19 2000 From: aahz at netcom.com (Aahz Maruch) Date: 15 Feb 2000 21:26:19 GMT Subject: Iterators & generators & coroutines References: <001e01bf7790$8bd74480$66a2143f@tim> <88c7hu$209$1@nntp5.atl.mindspring.net> Message-ID: <88cg9r$10t$1@nntp9.atl.mindspring.net> In article , Evan Simpson wrote: >Aahz Maruch wrote in message >news:88c7hu$209$1 at nntp5.atl.mindspring.net... >> >> As a side note, I'm thinking that implicit generator creation is a Bad >> Idea. We should force people to do things like >> >> b = BinTree() >> g = generator b.traverse() >> for i in g(): >> .... > >Why attach such significance to it? Why not just... > >b = BinTree() >for node in b.traverser(): Because now you either have the for construct implicitly create a new generator frame or you cannot do b = BinTree() for node in b.traverser(): for node in b.traverser(): I would much rather create the generator frames explicitly as in the following (I'm now assuming my later idea that a call to a generator creates a generator frame that can be used like a function) b = BinTree() g1 = b.traverser() for node in g1(): g2 = b.traverser() for node in g2(): It just seems more Pythonic to me. -- --- 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 Have you coined a word today? From hinsen at cnrs-orleans.fr Tue Feb 22 04:53:43 2000 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: 22 Feb 2000 10:53:43 +0100 Subject: data structure design question References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> <88plbb$bth$1@nntp2.atl.mindspring.net> Message-ID: "Andrew Dalke" writes: > mention bond types. I don't have MMTK handy, but > it is definitely atom type-based, and I don't think > it has a definition for bond type. The most common MMTK defines atom and bond objects, and lets you add whatever chemical attributes you want to them via the MMTK database. For the standard force fields (Amber etc.), this means atom types but nothing for bonds. I would be no problem to have bond attributes as well, but I haven't yet seen a need for them. But maybe that's just because I am not a chemist either. I suspect that the atom type approach is more general, since atoms are a much better defined concept than bonds. Ultimately, bonds are just particularly strong interactions between two atoms. Interactions exist in all kinds of strengths, so any definition of a bond or bond order leaves some cases open for interpretation. Conclusion: there is no one correct computer model for molecules. It all depends on what you want to do with it. -- ------------------------------------------------------------------------------- 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 loewis at informatik.hu-berlin.de Sat Feb 5 08:50:16 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 05 Feb 2000 14:50:16 +0100 Subject: Freezing data members of a class! References: <389B26BE.F1E0760F@cui.unige.ch> Message-ID: Sunil Hadap writes: > I want to stop the user from adding any more data members to instance of > a class than those added by the constructor. > > Secondly I want to prevent the user from chaning type of the data member > (trough assignment) which gets defined only construction time. I have > done the following. Is this the best way! That is certainly one solution. Please have a look at the Bastion module, which offers an alternative approach. Instead of giving the user your real objects, you give them Bastion objects. They can change the bastion objects as much as they like; that won't change the real object. Regards, Martin From effbot at telia.com Fri Feb 11 03:56:03 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 08:56:03 GMT Subject: Using gzip with multiple file References: <88018q$erp$1@nnrp1.deja.com> Message-ID: vmarkwart at my-deja.com wrote: > Could someone please point me to an example of using gzip to store > multiple files in the one archive, or failing that any examples using > gzip reliably. gzip is a compression utility, not an archive format. the usual way is to combine gzip and tar (.tgz, .tar.gz) if you want a compressed archive, consider using zip instead. (and if we're talking python, searching the newsgroup archive for zlib, gzip, and ziplib will bring up more info. http://www.python.org/search ) From emile at fenx.com Tue Feb 15 09:23:49 2000 From: emile at fenx.com (Emile van Sebille) Date: Tue, 15 Feb 2000 06:23:49 -0800 Subject: Off Topic Posts References: Message-ID: <06b501bf77c0$47f92640$01ffffc0@worldnet.att.net> I'll vote for that one! Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Mikael Olofsson To: Oleg Broytmann Cc: Sent: Tuesday, February 15, 2000 5:59 AM Subject: Re: Off Topic Posts > > On 15-Feb-00 Oleg Broytmann wrote: > > On 15 Feb 2000, Vetle Roeim wrote: > > > as the python community grows and the number of posts increases, a > > > split would seem natural. I would suggest something like c.l.python, > > > c.l.python.moderated, c.l.python.web, c.l.python.tkinter (or perhaps > > > c.l.python.gui would be better).. any other suggestions? > > > > c.l.python.win32 > > Well, c.l.py.sucks seems to be needed... > > /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: 15-Feb-00 > Time: 14:58:25 > > This message was sent by XF-Mail. > ---------------------------------------------------------------------- - > > -- > http://www.python.org/mailman/listinfo/python-list > > From sholden at bellatlantic.net Thu Feb 24 13:32:46 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 24 Feb 2000 18:32:46 GMT Subject: Optimizing code References: <20000224161930.A4922@stopcontact.palga.uucp> Message-ID: <38B5794F.ADAD100F@bellatlantic.net> Gerrit Holl wrote: > > Hello, > > I have the following script: > > #! /usr/bin/env python > > import sys > import os > > class DiskUsage: > __size = 0 > def add(self, filename): > self.__size = self.__size + os.path.getsize(filename) > def __call__(self, arg, d, files): > for file in files: > filename = os.path.join(d, file) > if os.path.isfile(filename): self.add(filename) > > def __len__(self): > return self.__size > > def du(dir): > disk = DiskUsage() > os.path.walk(dir, disk, ()) > return len(disk) > > def main(): > if len(sys.argv) != 2: > sys.stderr.write("usage: %s " % sys.argv[0]) > sys.exit(1) > print du(sys.argv[1]) > > if __name__ == '__main__': > main() > > Timing turns out that the 'os.path.walk' part takes about 2.7 seconds, for > a 400 MB dir with 1096 dirs and 9082 files. 'du -s ~' takes 0.2 seconds. > What makes this slow? The special methods? The redefinition of an integer? > os.path.walk? With longs, it even takes 12 seconds... > > Can I optimize it? If so how? > > regards, > Gerrit. > > P.S. > I know it's _easier_ to do os.popen('du') but 1) it's not crossplatform and > 2) optimizing is instructive. > Offhand I would suggest that du uses a lot of specific knowledge about UNIX filesystem structures which probably isn't available on the user side of the Python APIs. As you know from your work with GUI's (sorry :-), sometimes a convenience layer will impose huge penalties in execution time. Oddly enough I recently worked on reworking dutree.py to work on Windoze, on the basis that a cross-platform "du" would be a mighty fine thing. I got as far as computing usage for the sum of all files in each subdirectory, then realised two things: 1. I would have to know the filesystem's cluster size to go from the file *contents* size as reported by os.stat() to the disk usage as required by a "decent" du; 2. I couldn't find any way to account for disk space used by the directories themselves, since it doesn't seem to be reported in os.stat()'s output; and 3. Nobody expects the Spanish Inquisition. At this point, since I was only trying to extend my Pythonicity, I gave up on the exercise. So thanks for pointing out os.path.getsize: maybe I'll get back to it! regards Steve -- "If computing ever stops being fun, I'll stop doing it" From bparsia at email.unc.edu Fri Feb 18 07:35:41 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Fri, 18 Feb 2000 07:35:41 -0500 Subject: Python misconceptions in IBM Ruby article... References: <38AB8445.DF945829@webone.com.au> <38AC9D57.5CC8066C@mincom.com> Message-ID: <1e66sdx.18ve3hzhdghriN%bparsia@email.unc.edu> Grant Edwards wrote: > John Farrell wrote: > > >I agree that Python's OO features feel added on. Consider: > > > > * You have to pass self to each member function. There's no obvious > > requirement that self need actually be the bound instance. > > > * In a method, fields of the bound instance need to be referenced > > through the self parameter, because the scoping rules do not understand > > about instance variables. > > The use of the 'self' parameter in methods is something that > both Modula-3 and Smalltalk do (IIRC -- it's been a few years). To be pedantic (and in the Python group, when writing about Smalltalk, I'm *always* pedantic :)), in Smalltalk, each class has direct access to it's instance variables. Indeed, that's how you implement accessors: Foo>>getName ^name setName: anObject name := anObject (the caret means return, and no self-respecting Smalltalker would use the selectors #getName and #setName: over #name and #name: ;)) Now, in order to preserve the uniformity of message sending syntax (i.e., that all computation is invoked by sending a message to an object using the Object message pattern) there is a psuedo-variable (#self) which refers to the instance "possessing" the method. Foo>>returnNameUppercased ^self name asUppercase self can't be assigned to, nor, I believe, can you assign it using the assignment operator (although you can pass it as the argument of a message; which is very handy). That's why it's "psuedo". #super works similarly. > I think it results in much more readable code. While OO may be > an 'add-on' in the case of M3, I hardly think that you can > claim OO is an 'add-on' to Smalltalk. #self, in Smalltalk, is a keyword (and I'm pretty sure #super is the only other...nope, sorry, there's five total; true and false get in there, I think; ack, it's too early in the morning!) whereas in Python, I believe the *name* 'self' is simply a matter of convention (though a rather important convention). What counts for a method is that the first (typically implicitly passed) argument is the relevant instance. [snip] > > * Proper OO languages do not use white space to delimit blocks, > > and use semicolons and block delimiters. > > Proper languages put semicolons _between_ statements not at the > end of statements. My eyes bulged out at *least* a quarter inch while reading this until I realized that 'proper' was being used as a synonym for 'prissy'. :) Cheers, Bijan Parsia. From fritz.heinrichmeyer at fernuni-hagen.de Fri Feb 4 03:05:56 2000 From: fritz.heinrichmeyer at fernuni-hagen.de (Fritz Heinrichmeyer) Date: 04 Feb 2000 09:05:56 +0100 Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> <87c6pr$hsr$1@kopp.stud.ntnu.no> Message-ID: hmm, the links you mentioned dont work right now. -- Fritz Heinrichmeyer mailto:fritz.heinrichmeyer at fernuni-hagen.de FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany) tel:+49 2331/987-1166 fax:987-355 http://www-es.fernuni-hagen.de/~jfh From aa8vb at yahoo.com Wed Feb 16 07:39:00 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 16 Feb 2000 07:39:00 -0500 Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) In-Reply-To: <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> Message-ID: <20000216073900.B2508775@vislab.epa.gov> Tres Seaver: |Randall Hopper: |> |> All error exceptions potentially thrown in a method should be documented |> for that method. |> |> Module-specific error exceptions should be transformed as they |> propagate up. ... | |Leaving the handling of such errors to the client ... simplifies the |mechanism library (nntplib), making it less likely to be buggy. Yes, but it increases the likelihood the client will be buggy. Particularly if we change the internal implementation (which the client now depends on). As you said, the client ultimately needs to deal with the underlying error. In NNTP the difference is: Socket.whatever() vs: try: bunch_of_socket_stuff except SocketError: raise NNTPError SIDE POINT: Sadly in Python, with this syntax we loose track of the stack frames between the original exception and this exception transformation (which would be useful to have if the client doesn't handle the error and we print a traceback). But AFAICT this is a feature (or deficiency) of the language. Ideally we'd like to be able to "push" a new interpretation onto an exception stack. That is, "re-raise" the exception with a different name. Similar to how we accumulate stack frames going down, we'd accumulate exception transformations going up. This would all be printed in the stack traceback (if the exception wasn't handled): Traceback (innermost last): File "t.py", line 8, in ? outer() File "t.py", line 6, in outer except: reraise NNTPError File "t.py", line 5, in outer inner() File "t.py", line 2, in inner raise SocketError NNTPError Maybe a "reraise " statement in Python 2.0? -- Randall Hopper aa8vb at yahoo.com From effbot at telia.com Mon Feb 21 16:04:01 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 21:04:01 GMT Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: <5Lhs4.7444$al3.98393@newsc.telia.net> Gerrit Holl wrote: > I have a problem. In my Python enthuishasm, I ripped off the braces > from my keyboard because I thought I didn't need them. > Unfortunately, I have a problem now. I can't create dictionairies any > more! And because braces aren't the only keys on the brace key, > I can't create lists either. The solution for the latter is list(()), > but how do I create an empty dictionairy without braces? how about: def List(): return eval("\133\135") def Dict(): return eval("\173\175") or the improved version: def List(*args): return list(args) def Dict(**args): return args From mikael at isy.liu.se Wed Feb 23 02:16:03 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 23 Feb 2000 08:16:03 +0100 (MET) Subject: New Python study group In-Reply-To: <88vmph$3i3$1@nnrp1.deja.com> Message-ID: gtnorton at my-deja.com writes: > http://python-studies-subscribe at egroups.com chris patti wrote: > Is a typo? H.V.Taylor wrote: > http://www.egroups.com/group/python-studies/info.html > will do the job ;-) On 23-Feb-00 alxchltn at my-deja.com wrote: > The above url that Chris points out is correct. I apologize.Just a > little miscommunication. G.T. As things usually work at eGroups, you should also be able to join the group by sending an empty email to python-studies-subscribe at egroups.com, which I think was what both gtnorton and chris patti meant. However, the place is supposed to be down for maintenance today. /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: 23-Feb-00 Time: 08:07:12 This message was sent by XF-Mail. ----------------------------------------------------------------------- From fcahoon at my-deja.com Wed Feb 16 13:00:15 2000 From: fcahoon at my-deja.com (Forrest Cahoon) Date: Wed, 16 Feb 2000 18:00:15 GMT Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <20000216073317.A579@stopcontact.palga.uucp> Message-ID: <88eojc$jed$1@nnrp1.deja.com> In article <20000216073317.A579 at stopcontact.palga.uucp>, Gerrit wrote: > Forrest Cahoon wrote on 950642676: > > (Personally, I'd feel more secure about python if tabs generated a > > compile error, and thus could be guaranteed not to be in any running > > code.) > > Use 'python -tt'. From the manpage: > > -t Issue a warning when a source file mixes tabs and > spaces for indentation in a way that makes it > depend on the worth of a tab expressed in spaces. > Issue an error when the option is given twice. > > 07:32:45:tty6:gerrit at stopcontact:~$ python -tt /usr/local/bin/world > File "/usr/local/bin/world", line 115 > return rawaddr > ^ > SyntaxError: inconsistent use of tabs and spaces in indentation > > I have an alias... > > regards, > Gerrit. WOW! This information ROCKS! Thanks, Gerrit! This is the sort of information I'd like to see collected in one spot; kind of a _Everything You Wanted to Know about Whitespace in Python, but Were Afraid To Ask_. I'll admit to being somewhat confrontational in my original post, but all along, it was constructive information like this I was really after. I hope that now we are all in a thouroghly constructive mode of discussion, and anyone else with useful tricks and tips regarding whitespace in python will share them with me. I'm really happy -- especially now -- with the level of constructiveness here. It's a shame that Moshe Zadka has insisted on sending me some really snide, asshole flames to me by personal e-mail that there is no way he would post in public. He's really a blemish on your fine community, and I humbly suggest you consider adding him to your killfiles, and not answering his questions until he grows up. Forrest Sent via Deja.com http://www.deja.com/ Before you buy. From gerrit.holl at pobox.com Mon Feb 21 10:32:31 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 16:32:31 +0100 Subject: Problem with re.findall?????!!!!!!!!!! In-Reply-To: <38B10F76.91DC90C1@earthlink.net>; from jeddak@earthlink.net on Mon, Feb 21, 2000 at 02:04:48PM +0000 References: <38B10F76.91DC90C1@earthlink.net> Message-ID: <20000221163231.A2507@stopcontact.palga.uucp> > I'm getting an AttributeError when I try to use re.findall or {my > compiled re object}.findall. > Is it me, or is there a problem perhaps with my libraries? re.findall is new in Python 1.5.2, you are probably running an older version. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From tbryan at python.net Wed Feb 16 05:31:32 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 16 Feb 2000 05:31:32 -0500 Subject: Informix integration References: <38A96270.E7E67D65@nembv.cz> <06f501bf77c4$9c10b820$01ffffc0@worldnet.att.net> <38AA4B7F.9F4D6BF@nembv.cz> Message-ID: <38AA7C84.B216673D@python.net> Bart wrote: > > Emile van Sebille wrote: > > > > Assuming you're on Winxx, one way is to set up an ODBC > > data source using the control panel application, then > > test it using access, excel, whatever. > > I'm on HP-UX mostly. Informix is also on HP-UX. Python will be running > on HP-UX, maybe on Linux. No Windows. You can still set up Informix and ODBC. See the mxODBC docs for suggestions on doing this on a Unix machine. I believe the Informix SDK may contain the ODBC drivers that you need to use. (I used mxODBC when I was playing with Informix last year.) Otherwise, there *is* an Informix module, currently maintained by Stephen Turner. That might be your best bet. See the Vaults of Parnassus: http://www.vex.net/parnassus/apyllo.py?so=d&find=informix You may also consider posting on the DB-SIG mailinglist (see the Python website for info about the SIGs) when you run into database trouble. ---Tom From shippy at cs.nmt.edu Wed Feb 23 23:50:50 2000 From: shippy at cs.nmt.edu (Jeff Shipman) Date: Wed, 23 Feb 2000 21:50:50 -0700 Subject: A question from a total newbie References: <88j7a2$n5e$1@nnrp1.deja.com> <89263v$sau$1@nnrp1.deja.com> Message-ID: <38B4B8AA.51BD4ABB@cs.nmt.edu> I am very surprised that nobody has mentioned the website! www.python.org has great amounts of documentation. I have one huge printout of the whole library and the language reference, and that's all I use. There's also a tutorial for someone who's trying to get started. A good intro book, however, does help and Learning Python would be the best. After you learn the semantics of the language, the library is invaluable! I've put a couple URLs below. Python language website: http://www.python.org Python documentation: http://www.python.org/doc/ Enjoy learning! Python is a nice language. -- +-----------------------------------------------------+ | Jeff "Shippy" Shipman E-Mail: shippy at cs.nmt.edu | | Computer Science Major ICQ: 1786493 | | New Mexico Institute of Mining and Technology | | Homepage: http://www.nmt.edu/~shippy | +-----------------------------------------------------+ From london999 at my-deja.com Tue Feb 22 06:47:07 2000 From: london999 at my-deja.com (london999 at my-deja.com) Date: Tue, 22 Feb 2000 11:47:07 GMT Subject: access() Message-ID: <88tsvr$p30$1@nnrp1.deja.com> I am trying to use access() in the os module. The online documentation shows access(path,mode). I don't know what value to put for mode. Tried os.X_OK, X_OK,"X_OK" and always get "exceptions.AttributeError". Where do I look up the possible values and why aren't they on the access() html page? Sent via Deja.com http://www.deja.com/ Before you buy. From aotto at t-online.de Wed Feb 23 05:40:32 2000 From: aotto at t-online.de (Andreas Otto) Date: Wed, 23 Feb 2000 11:40:32 +0100 Subject: Update Python-Compiler Message-ID: <38B3B920.1D91C23B@t-online.de> Update White-Paper http://home.t-online.de/home/aotto/compiler-Paper.html mfg aotto :) -- ================================================================ Andreas Otto Phone: ++49-(0)8152-399540 IPN Ingenieurbuero fuer mailto:aotto at t-online.de Praezisionsnumerik Web: http://home.t-online.de/home/aotto Ulmenstrasse 3 Skills: Unix,Sql,Tcl,Shell,Sybase... D-34289 Zierenberg Area: Bank, FX, MM, shares, options ================================================================= From webmaster at python.org Mon Feb 21 14:15:40 2000 From: webmaster at python.org (Python.Org Webmaster) Date: Mon, 21 Feb 2000 14:15:40 -0500 (EST) Subject: Temporary mail problems to python.org Message-ID: <14513.36572.465266.18856@anthem.cnri.reston.va.us> Some of you may have experienced temporary problems sending mail to the python.org domain. As of about noon EST, Monday 21-Feb-2000, these problems should have been resolved, and your queued up messages should be getting delivered to email addresses @python.org. In brief, we are in the process of moving most python.org services to a faster machine. Friday afternoon (in direct and willful violation of Warsaw's Second Law[1]), we changed the MX record for python.org to point to dinsdale.python.org. Most email was already being handled by this machine, but via a clunky forwarding scheme through the old machine. Unfortunately, due to a misconfiguration of CNRI's gateway, traffic to the smtp port of dinsdale was being blocked. This should now be fixed, and queued mail should be flowing again; no mail should have actually been lost. If you experience any residual problems please let us know (you can email me directly at my CNRI address, which was unaffected). -Barry [1] http://www.python.org/~bwarsaw/software/laws.html From 2jerry at writeme.com Tue Feb 22 19:50:08 2000 From: 2jerry at writeme.com (Jerry) Date: Wed, 23 Feb 2000 01:50:08 +0100 Subject: Python window.destroy()? References: <38B1D2EB.FE88C9DC@swt.edu> <88sn2f$i1j$1@wanadoo.fr> <38B1F028.7A2036C2@swt.edu> Message-ID: <88vam1$9f0$1@wanadoo.fr> here is a correct script ... enjoy #!/usr/bin/python from Tkinter import * class App: def __init__(s,master): frame=Frame(master) frame.pack() s.button1 = Button(frame,text="Button1") s.button1.pack(side=LEFT) s.button2 = Button(frame,text="Button2") s.button2.pack(side=RIGHT) # all binds could be create here ... more readable ... or before pack (i prefer) :-) s.button2.bind("",s.myEcho2) s.button1.bind("",s.myEcho1) s.button1.bind("",s.out1) s.button2.bind("",s.out2) Button(frame,text="QUIT",command=frame.quit).pack(side=LEFT) def myEcho1(s,event): s.wm1=Toplevel() s.wm1.label=Label(s.wm1,text="Mouse is on the 2nd button") s.wm1.label.pack() def out1(s,event): """This function is needed cause s.wm1.destroy is not a valid callback a callback via a bind allways send an event object as argument this is not the case of a Button for example ... """ s.wm1.destroy() def myEcho2(s,event): s.wm2=Toplevel() s.wm2.label=Label(s.wm2,text="Mouse is on the 1st button") s.wm2.label.pack() def out2(s,event): 'see for out1 __doc__' s.wm2.destroy() root=Tk() app = App(root) root.mainloop() ns56645 a ?crit dans le message <38B1F028.7A2036C2 at swt.edu>... >Jerry Thanks for your help, > >To give you the complete picture I have send you my program. I need to >kill two new windows that were created when I moved my mouse on the >window. > >See to the program and you can get the picture. I am still in the lab >for >another hour. > >Thanks, > > >#!/usr/bin/python > >from Tkinter import * > > >class App: > > >def __init__(self,master): > >frame=Frame(master) > >frame.pack() > > >self.button1 = Button(frame,text="Button1") > self.button1.pack(side=LEFT) > > >self.button2 = Button(frame,text="Button2") > self.button2.pack(side=RIGHT) > > >self.Quit= Button(frame,text="QUIT",command=frame.quit) > self.Quit.pack(side=LEFT) > > >def myEcho2(event): > >wm1=Toplevel() > >wm1.label=Label(wm1,text="Mouse is on the 2nd button") > wm1.label.pack() > > >def myEcho1(event): > >wm2=Toplevel() > >wm2.label=Label(wm2,text="Mouse is on the 1st button") > wm2.label.pack() > > self.button2.bind("",myEcho2) > >self.button2.pack() > > >self.button1.bind("",myEcho1) > >self.button1.pack() > > >self.button2.bind("",wm2.destroy) > >self.button2.pack() > > self.button1.bind("",wm1.destroy) > self.button1.pack() >root=Tk() > >app = App(root) > >root.mainloop() > > > > From echeverria at interactiva.cl Sun Feb 20 18:07:20 2000 From: echeverria at interactiva.cl (Cristian Echeverria) Date: Sun, 20 Feb 2000 19:07:20 -0400 Subject: PIL - still ill (newbie) References: Message-ID: <38b0651e@omega> Try putting this line at the top of Image.py (into the PIL directory): import FixTk The problem here is that _imaging.dll can't find your tcl/tk installation, but with the line above python must find it for you. Prior to Python 1.5.2 you needed to set some environtment variables to find tcl/tk and _imaging is still working in that way. A question for the SecretLab People: Why _imaging.dll is linked to the tcl/tk DLLs ? That means that PIL did?t work without tcl/tk? Cristian Echeverria > Fredrik or anybody, > I'm still having trouble using PIL. > I downloaded pil-win32-991101 from pythonware and unzipped it with winzip. > I unzipped it to c:\program files\python\tools. > Here's a sample error: > >>> import Image > >>> im = Image.open("E:/images/sts93.jpg") > >>> im.size > (1038, 768) > >>> im.thumbnail((128,128)) > Traceback (innermost last): > File "", line 0, in ? > File "C:\PROGRA~1\PYTHON\PY152\PIL\Image.py", line 724, in thumbnail > self.load() > File "ImageFile.py", line 125, in load > self.load_prepare() > File "ImageFile.py", line 175, in load_prepare > self.im = Image.core.new(self.mode, self.size) > File "C:\PROGRA~1\PYTHON\PY152\PIL\Image.py", line 40, in __getattr__ > raise ImportError, "The _imaging C module is not installed" > ImportError: The _imaging C module is not installed > > As you can see, it finds Image.py but not the _imaging C module > (_imaging.dll ?) > > I'm not sure if this is part of the problem but I originally placed the > files in : > c:\program files\python\py152\ > I had some trouble so I removed them and unzipped in > c:\program files\python\tools as I mentioned above. > > Why is it still finding Image.py in \python\py152\pil\ > when that directory no longer exists (see traceback above)? > > I'm new to python in the windows environment > so explicit help will be appreciated. > > Thanks, > > Jim > > > > From dante at oz.net Thu Feb 10 10:12:54 2000 From: dante at oz.net (Michael Esveldt) Date: 10 Feb 2000 15:12:54 GMT Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> <38A24345.3F763311@Lugoj.Com> Message-ID: <87ukhm$s2n$0@216.39.162.232> Brad Howes wrote: > James Logajan writes: > > > By the way, speaking of code blocks, does anyone know of any languages that > > use blocks...literally? That is, given the prevalence of GUIs, a development > > environment/language where code is contained in rectangles? > > The scripting language 'Frontier' has an outline metaphor -- you can > collapse/expand blocks of code. Check out http://www.userland.com. The language is actually "Usertalk" while the program it runs in is Frontier. It's a fuzzy distinction since there's no such as UserTalk without Frontier. UserTalk's outlining editor long ago won me over as my programming tool of choice. I love it so much that I've started writing all my Python code in Frontier outlines (actually I write everything in collapsible outliners, code and otherwise.) I've developed a set of tools in UserTalk that have allowed me to seamlessly merge Frontier's outlines with the PythonInterperter on my mac. Anyone using a flat text editor on the mac or windows should check out the last free version of Frontier at It's perfectly usable and there's a lot of power there to be had for Python programmers as well as Frontier users. It's a shame it's gone commercial! Michael this is a big lie/this is the way the world ends/ringy ding dong duh _______________________________________________________________ dante at oz.net - Michael Esveldt - #FightThePower on Openprojects From dixon at channel21.com Thu Feb 24 14:55:31 2000 From: dixon at channel21.com (Jason Nadler) Date: Thu, 24 Feb 2000 14:55:31 -0500 Subject: More IIS crashing and blank .asp pages Message-ID: <81DD38F43381D111BA3E00A076A0998A459F59@XENON> OK, I thought I fixed the crashing bug by stepping up to the newest Python language version (as well as the win32 extensions). Now, my server is spitting out blank .asp pages for those which use python. If Python is not declared as the page language, the asp pages work fine. After the install, the blanks started appearing. All the paths look fine in registry. I just checked the machine again, and it has crashed again as a result of something in the python threading (same as error that was happening). This leads me to believe that the python actually IS being executed. However, the output is just the blanks... Any clues? ( Intel dual PIII 550 Xeon, 1G RAM, NT 4.0 SP 6a, IIS 4) p.s.: the blank pages source look like this: and the error in app log is still: > > An object call caused an exception. > > (IID: {51372AEF-CAE7-11CF-BE81-00AA00A2FA25}) (Method: 3) > > (Microsoft Transaction Server Internals Information: File: > > i:\viper\src\runtime\mtxex\activity.cpp, Line: 889) > > (Exception: C0000005) (Address: 0x1e6054df) > > PyWinTypes15!PyWinThreadState_Free(void) + 0xF > > asp!TerminateExtension + 0x3D35 > > asp!TerminateExtension + 0x33E3 > > asp!TerminateExtension + 0x313B > > asp!TerminateExtension + 0x7AC3 > > asp + 0x325C6 > > mtxex!MTSCreateActivity + 0x1F3C > > mtxex!MTSCreateActivity + 0xF3E > > From tseaver at starbase.neosoft.com Sun Feb 6 21:14:35 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 6 Feb 2000 20:14:35 -0600 Subject: Worldpilot References: <389DAD6F.100404A4@fourthought.com> Message-ID: <96E6A9F3E7E84A55.F55AB0C151D69E7F.21D4C497CCE1D325@lp.airnews.net> In article <389DAD6F.100404A4 at fourthought.com>, Uche Ogbuji wrote: >We are eager to try out Worldpilot, which was demoed at IPC8, but it >uses the Cyrus IMAP server, which we simply cannot get to work. We've >tried 2 RPMs and rebuilding it twice on Red Hat 6.1. We can't even add >a mailbox because the "SASL" password muck is apparently broken. We >have searched Dejanews, Google, etc., and there are many complaints >about this but no solutions that worked for us. > >So, my questions are: > >1) Is there any way to get Worldpilot to work with good old UW IMAP? Check out the Zope-list archives for the period following the demo -- Anthony Baxter posted a patch which made WP work with both WU IMAP and M$ Exchange (mirabile dictu!) Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From wlfraed at ix.netcom.com Sat Feb 12 22:03:48 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Sat, 12 Feb 2000 19:03:48 -0800 Subject: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> <20000212173608.B4326@stopcontact.palga.uucp> Message-ID: On Sat, 12 Feb 2000 17:36:08 +0100, Gerrit Holl declaimed the following in comp.lang.python: > > I know that many language use semicolons to end their lines,; > but I never really understood why.; > If you write a sollicitation letter (is it right English?),; > I don't think your potential boss would like all those semicolons.; Ah, but in English (and most other common written communications using a western/roman character set) "lines" are ended with "." (Note -- "lines" is your word, but the ";" actually is used on statements -- which may cross multiple lines; better would be to substitute "sentences" for "lines"). For parsing purposes in programming languages, the period "." has tended to be reserved for decimal point marking in numbers (I'm explicitly ignoring that Fortran < F90 and VMS DCL also use "." as brackets around logical operators: .ne. .lt. .and., etc.) Try writing your example solicitation letter without ending sentences in periods, interrogation marks, exclamation marks, etc. I don't mind the use of ";" so much as the inconsistent usage of it... Most languages use it as a statement terminator, but then you hit Pascal (and Python, I fear) where it is used as a statement separator. Pascal's begin statement 1; statement 2; end usage actually means to the compiler begin distinct statement 1 distinct statement 2 empty statement end -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From jbauer at rubic.com Sun Feb 27 17:50:56 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Sun, 27 Feb 2000 16:50:56 -0600 Subject: MySQLdb for Win32 References: <38B9A363.777B5316@mindspring.com> Message-ID: <38B9AA50.5FA612F3@rubic.com> Chuck Esterbrook wrote: > Is there a pre-built version of MySQLdb available for Win32? Dominik Friedrich also wrote: > did anybody successfully compiled the mysqldb module on a > win32 system? Chuck / Dominik: I've got the dlls to handle the client side of connecting to MySQL from a Win32/Python environment. It's available for ftp download from starship.python.net, ftp directory /pub/crew/jbauer: MySQL.pyd libmySQL.dll Place these files in your Python home directory. Your PATH should point to wherever libmySQL.dll is located. Per my notes, here is a scenario to get you started: D:\jeff\PyMySQL> python >>> import MySQL >>> DBH = MySQL.connect('myhost','myuser','mypasswd') >>> DBH.listdbs() [['mydb'], ['mysql'], ['test']] >>> DBH.selectdb('mydb') >>> STH = DBH.query("select * from mytable") >>> STH.fetchdict() ... prints list of dicts ... Note: This is Joseph Skinner's (and James Henstridge's) original pre-DBI version of the mysql wrapper. I don't use mysql on Win32, but other people have reported success with this release. Last week David Ascher mentioned that Inprise/Borland has made their Windows C++ compiler free for downloading. For someone who can't afford the Microsoft compiler -- but wants to run python/mysqldb client on Win32 -- this might be a suitable project. The compiler download info is available at: http://www.borland.com/bcppbuilder/freecompiler/ oh-yeah-almost-forgot-to-mention-list-comprehensions-map- reduce-filter-lambda-and-stackless-tail-recursions-ly y'rs, Jeff Bauer Rubicon Research From moshez at math.huji.ac.il Fri Feb 11 04:15:17 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 11 Feb 2000 11:15:17 +0200 (IST) Subject: Bit arrays. In-Reply-To: <87vvao$di4$1@nnrp1.deja.com> Message-ID: On Fri, 11 Feb 2000 rdudfield at my-deja.com wrote: > Hello, > > Just wondering if there is an efficient way in python to represent > arrays or lists of bits? Try using long integers, but be sure to make that into a class. After it works, and if it's too slow, you can recode it in C. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jari.oksanen at helsinki.fi Mon Feb 21 01:50:10 2000 From: jari.oksanen at helsinki.fi (Jari Oksanen) Date: Mon, 21 Feb 2000 08:50:10 +0200 Subject: Numerical Python install problem References: <38ADFBA4.55729EB4@mindspring.com> Message-ID: <38B0E022.CFFB760E@helsinki.fi> Robert Schweikert wrote: > > I am running Python 1.5.2 on RH 6.1 distro. Used the Python rpm to get > it running instead of building it myself. I also installed the Distutils > with no problem. But now when I try to install Numerical Python Version > 14 I get the following errors: > It seems to complain about asm/errno.h. The only asm/errno.h I found on my RH6.1 (where Numerical-14 compiled beautifully) is /usr/i386-glibc20-linux/include/asm/errno.h which seems to come from compat-glibc-5.2-2.0.7.1 rpm package -- that is, from compatibility libraries for older glibc (2.0.7). cheers, jo -- J.Oksanen -- UHLA (University of Helsinki at Lahti) ? Find books on "hyalosphenia" at bn.com. ? Search for news on "hyalosphenia" at Individual.com. ? Research "hyalosphenia" at AtHand Yellow Pages. From jeddak at earthlink.net Sun Feb 13 09:57:47 2000 From: jeddak at earthlink.net (J Donald) Date: Sun, 13 Feb 2000 14:57:47 GMT Subject: Py-Mode on GNU Emacs? Message-ID: <38A68FEC.3AC0AF86@earthlink.net> Has anyone successfully gotten py-mode to work in GNU Emacs? If so, can you share the recipe? It appears to be written for X-Emacs and I get error messages when I try to use it with the GNU version (running on Red Hat Linux 6.0). Thanks, -jd From calishar at *NOSPAM*home.com Sat Feb 5 21:50:06 2000 From: calishar at *NOSPAM*home.com (Calishar) Date: Sun, 06 Feb 2000 02:50:06 GMT Subject: Freezing an app using win32com and wxPython References: <87ckq3$ot1$1@nnrp1.deja.com> Message-ID: On Sat, 05 Feb 2000 23:35:58 GMT, "Mark Hammond" wrote: >It simply sounds like the system you are using for testing does not >have all the updated COM DLLs. If you go to the "installation >problems" page from my starship page you should see instructions about >how to update the COM support. > >Mark. Thank you mark, worked like a charm. Now I just need to burn the CD's and include the Com updates. Looking forward to reading the book when my local store has it. Calishar From joel at wolfpack2000.com Wed Feb 23 04:37:57 2000 From: joel at wolfpack2000.com (Joel Hatch) Date: Wed, 23 Feb 2000 01:37:57 -0800 Subject: Reducing Python's memory footprint? Message-ID: <38B3AA6A.C85FA919@wolfpack2000.com> Hi Is there any way to reduce Python's memory footprint? Or maybe to set up some sort of Python-script server? To get a single copy of Python to simultaneously interpret several independent scripts? I've been writing a small Gnome applet, and recently discovered that it takes up about 5MB of RAM when loaded. Even worse, any other Python script that I execute takes up about that much more, so when I'm running four Python scripts, I'm devoting about 20 megs of memory to Python interpreters. Using five megs to load a Python interpreter is a little excessive, but acceptable. Blowing a half of my available RAM on a handful of nifty panel applets and a monitor or two just doesn't work, though... As I see it, the problem isn't with the size of the scripts--they're tiny--it's that I'm loading a new copy of Python every time I execute a script. How can I tell one copy of Python to run both scripts? --Joel playing with cats From embed at geocities.com Mon Feb 28 10:14:49 2000 From: embed at geocities.com (Warren Postma) Date: Mon, 28 Feb 2000 10:14:49 -0500 Subject: Python IDE won't run on 68k Mac (Centris 650) References: <2B1262E83448D211AE4B00A0C9D61B03BA715A@MSGEURO1> Message-ID: "Pieter Claerhout" wrote in message news:2B1262E83448D211AE4B00A0C9D61B03BA715A at MSGEURO1... > Do you have the Drag and Drop extension in your extensions folder? > I think that the os your running the PythonIDE on is not supporting > drag and drop, so you will need to have the D&D extension. > > Kind regards, Hmm. Not being a Mac expert, I have no idea how to get the D&D extension onto my macOS 7.6 system, so I have decided to hunt for a MacOS 8.0/8.1update CDs and update my system. Sound like a workable plan? [sorry if this is widly off topic!] Warren From sabren at manifestation.com Sat Feb 26 13:32:59 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Sat, 26 Feb 2000 13:32:59 -0500 (EST) Subject: trim() Message-ID: Hey all, I posted a couple days ago about actually needing a whitespace-eating nanovirus.. And ever since I built it, I've been using it almost every day for text processing... Being able to indent triple-quoted-string is a really really nice feature: def test(): output = textmuncher(trim(""" this is some input text """)) goal = trim(""" this is some expected output text """) assert goal == output, "test failed" Anyway, I was wondering if anyone else ever has need of that particular capability. I think it's useful enough to go into the string module, and I was just debating whether or not to submit it... here's the code: def trim(s): """strips leading indentation from a multi-line string.""" lines = string.split(s, "\n") # strip leading blank line if lines[0] == "": lines = lines[1:] # strip indentation indent = len(lines[0]) - len(string.lstrip(lines[0])) for i in range(len(lines)): lines[i] = lines[i][indent:] return string.join(lines, "\n") .. I guess it probably ought to run expandtabs(), too, but.. well.. what do you think? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From gmcm at hypernet.com Tue Feb 1 18:03:07 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 1 Feb 2000 18:03:07 -0500 Subject: re AMTE thread re DrScheme & Python In-Reply-To: References: <65118AEEFF5AD3118E8300508B124877073D52@webmail.altiris.com> Message-ID: <1262676328-5361829@hypernet.com> Gene wrote: > Wow, I'm a member of a cult. Cool. My parents will probably be upset when I > tell them though. Do we all have to wear matching nike sneakers when the > aliens come to get us? 1) No, Reeboks, New Balance etc. are all cool. It's the laces that matter. 2) We're already here. > I'm really not into the castration thing though, > might have to switch to a non-cult like language. The Guidosatva follows the Path of Least Surprise - in other words, a vasectomy will do just fine. it's-everyone-else-who-needs-castration-ly y'rs - Gordon From S.I.Reynolds at cs.bham.ac.uk Mon Feb 21 13:22:07 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Mon, 21 Feb 2000 18:22:07 +0000 Subject: Q: Structured Text spec? Message-ID: <38B1824F.212C@cs.bham.ac.uk> I'm documenting a python AI package using docstrings and pythondoc. I'd like to include some Python examples, so, does anyone know if its possible to include verbatim, plain, unprocessed text in the structured text standard? Also, is there a structured text specification/other docs? All I've found is: http://www.zope.org/Members/millejoh/structuredText Cheers, Stuart From philh at vision25.demon.co.uk Wed Feb 16 20:24:32 2000 From: philh at vision25.demon.co.uk (phil hunt) Date: Thu, 17 Feb 2000 01:24:32 +0000 Subject: Parrot-0.2.4 released Message-ID: Parrot is a text-based GUI builder; to use it, you write an ascii file specifying the layout of your windows, which Parrot translates into a Python module which code for the windows. Parrot is written in Python, and licenced under the GNU GPL. Parrot is currently under development, and only a small part of its functionality is in place. The Parrot homepage is: http://www.comuno.com/linux/parrot/intro.html and you can download the latest version at: http://www.comuno.com/linux/parrot/parrot-0.2.4.tgz -- ***** 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 cjc26 at nospam.cornell.edu Tue Feb 1 20:26:02 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Wed, 02 Feb 2000 01:26:02 GMT Subject: Fwd: re AMTE thread re DrScheme & Python References: <389739fb.95247007@news.teleport.com> Message-ID: Pada Tue, 01 Feb 2000 20:01:06 GMT, Kirby Urner bilang: | | > As far as the language is concerned, Python is a | [..] | > - non-parethetical version of (Mz)Scheme Non-parenthetical? Some of us consider that a plus :) (not (too (many people (have (to write)) (parsers anyway))))-ly y'rs, Cliff -- cliff crawford -><- http://www.people.cornell.edu/pages/cjc26/ "All I need is a small town with good Internet connectivity" - Nadine From moshez at math.huji.ac.il Fri Feb 18 23:14:42 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 06:14:42 +0200 (IST) Subject: Which GUI? In-Reply-To: Message-ID: On 18 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > Moshe Zadka writes: > > > On the other hand, portable free programs cannot use PyGTK either [...] > > Wow, that's new to me... Why do you say that? (!!) Because PyGTK doesn't work on Win32 (relevant to a month ago when I checked) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mwh21 at cam.ac.uk Fri Feb 18 13:48:17 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 18 Feb 2000 18:48:17 +0000 Subject: Overloading = References: <88htqk$rb5$1@nnrp1.deja.com> <88jnok$2hl$1@nnrp1.deja.com> Message-ID: jhefferon at my-deja.com writes: > In article , > Michael Hudson wrote: > > jhefferon at my-deja.com writes: > > > > > I have a class, rclass. It has an attribute value. Can I arrange > > > so that the string > > > r1=r2 > > > sets r1.value to equal r2.value (where r1 and r2 are class > instances, > > > of course) without changing anything else about r1? > > > > No. Assignment rebinds references, rather than affecting objects. This > > is quite a difference from C++ (say), probably one of the harder ones > > to get one's head around. > > > > > > > > And if so, can I also have r1=7 set r1.value to be 7? > > > > > Hmm... do you know about the "exec in globals,locals" style of > > doing things? Though `exec'ing user input sounds deeply unwise to me. > > What is it you are trying to do? Maybe we can come up with a better > > solution (no promises though). > > Thanks. I *am* reluctant to allow students to accidently exec something > that erases all files, or something. Accident? The least of your worries, I'd say! > I am simulating a computer. It is made up of registers and each > register (memory or CPU) may have more than one attribute (for instance, > whether to print it out in binary or hex, or how many times it has > been referenced in this program, or what source line compiled to this > register, etc.). That's why each register is a class instance rather > than a simple variable. > > I want to have the obvious GUI, that allows a person to scroll through > memory, for instance. I also want to allow them to do things like > set a register `rA=7' or `rA=memory[52]'. > > In the register class I can use __setattr__ to let me write either > `rA.value=7' or `rA.value=memory[52]', > right (I look at the type of the thing on the right and if it is a > class instance then I see if, say, memory[52].classtype==``register'')? > But I can't eliminate the `.value' on the left? I thought maybe I could > mess with the top-level dictionary (I don't know what I mean by that!). Try this: def process_input(user_input,registers): """ process_input(user_input:String, registers:{String:Register}) -> None Given the user input and a dictionary mapping register names to Register objects, set the values of the registers to the appropriate values.""" ourdict = {} for k,v in registers: ourdict[k] = v.value # no naughties! (prevents file access/imports) ourdict["__builtins__"] = {} ourdict["memory"] = global_memory_object # or whatever exec user_input in ourdict for k,v in ourdict: if registers.has_key(k): registers[k].value = v Is that helpful? The basic idea is to control *really* tightly what the code can access when `exec'ed - the __builtins__ issue is really quite subtle, but helpful to know about. There's rexec if you want the code to have more structured access to other things. I don't *think* it's possible to worm malicious effects through the above code, but I might be wrong - any takers? Cheers, Michael From 55555 at dakotacom.net Mon Feb 14 01:08:44 2000 From: 55555 at dakotacom.net (55555 at dakotacom.net) Date: 14 Feb 2000 00:08:44 -0600 Subject: os.shell, recursion, encryption Message-ID: <38a79bec_3@news5.newsfeeds.com> I'm spawning pkzip for dos using os.shell() because I would like to use the encryption feature. As far as I can tell that is not available in the gzip library and the documentation on the cryptography toolbox didn't give me the impression that all the bugs were worked out. Does anyone know whether that has changed? Anyway, os.shell() pops up a new dos box for each call. I'm using os.path.walk() and making a lot of calls to the zip program. I'm wondering if there is a way to not spawn 40 windows. 0 windows would be ideal. Finally, I'm wondering if there is a way to attach to a global variable while moving around with os.path.walk()? I understand recursion and have read Python's scope rules but I can't seem to either pass local varaibles through or to attach to a global variable. Any help on any of these would be greatly appreciated. Thanks. -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From mbel44 at dial.pipex.net Fri Feb 25 04:49:54 2000 From: mbel44 at dial.pipex.net (Toby Dickenson) Date: Fri, 25 Feb 2000 09:49:54 +0000 Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> Message-ID: Moshe Zadka wrote: >[The timbot, butting in ] >> You and Aahz maybe, but now we've got a fight . There's nothing >> un-Pythonic about recursion, tail or otherwise. It's tail-call >> *optimization* that's un-Pythonic, as it's a gimmick supported by only a >> handful of widely unused <0.5 wink> languages and surprising to people >> coming from anything else: damaging tracebacks would be Major Badness, much >> worse than the gain for the relative thimbleful of people who are >> uncomfortable coding loops etc. > >The idiom "return f(something)" is used almost exclusively by this anal >retentive bunch I'm proud to be part of . And I don't mind at all >having Python do no optimization as long as I do not give the flag >-believe-me-I-really-do-want-tail-call-optimization <0.5 wink> > >As this flag has very little semantic effect (after all, it is an >optimization), I don't think there should be any problems with it, except >two: > >1. I don't care *enough* to write the patch >2. Guido probably won't like it It looks like it should be possible to implement a tail-optimised variant of apply() using Stackless? (is that a statement or a question? Im not sure either) Toby Dickenson tdickenson at geminidataloggers.com From moshez at math.huji.ac.il Sun Feb 27 05:36:29 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 12:36:29 +0200 (IST) Subject: Q about tail recursion In-Reply-To: <000801bf8105$18b99ba0$172d153f@tim> Message-ID: [Tim] > And if a def is sometimes meant to return a value and > sometimes not, redesign the code before you drive yourself > insane . > [Moshe Zadka] > I've thought about writing a small utility to warn me about such > functions, which should be easy enough: either all or none of > "RETURN_VALUE" opcodes should be preceded by LOAD_CONST of None. [Tim] > Seems so, except in a function that explicitly does "return None" as well > as, e.g., "return 42". Nope, that would be LOAD_GLOBAL of None > If you write such a utility, I bet PythonWin and IDLE would like to adopt > it! I expect "do some sanity checks" to become an increasingly popular > feature of the Python IDEs, and I'd hate to think that tabnanny.py is the > best sanity-checker the community can come up with . After reading the mathematics behind tabnanny, I doubt mine will be able to compete with it. humbly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From alex at somewhere.round.here Sun Feb 13 12:25:50 2000 From: alex at somewhere.round.here (Alex) Date: 13 Feb 2000 12:25:50 -0500 Subject: merging really huge lists fast References: <38A6E891.9494D59A@bibsyst.no> Message-ID: > the good old new_list = list1 + list2 seems to be slow. Any hints? How slow? Like "slow to run a million times in a row", or "it takes over a second to execute this one command?" You might try the "extend" method: list1.extend (list2) That'll only work if you don't need the original list1 anymore, though. Alex. From mhammond at skippinet.com.au Wed Feb 9 17:12:50 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 09 Feb 2000 22:12:50 GMT Subject: COM and python References: <04e9bbf8.f292f07f@usw-ex0106-048.remarq.com> Message-ID: "ASCarpenter" wrote in message news:04e9bbf8.f292f07f at usw-ex0106-048.remarq.com... > Is there anyone who can give me some hints on how to get to a custom > COM component from python. If it does not use IDispatch, then you must write a DLL. There are tools to generate the .cpp source code, but it is significant work none-the-less. > Makepy won't work because it exposes the > interface from IUnknown, not IDispatch. This would imply the component does not support IDispatch at all. If the component does, but makepy doesnt work with it, then I definately want to know. > From what I can tell I need to add an extension to python, but I'm > wondering how to deal with the object instantiation and reference > counting. > Any examples out there? All of the win32comext sub-directories. > Also, does anyone know if this is covered in Mark's book (guess I'll > drop a name because I see it so often here), in which case I can wait > for that to turn up. Not in any detail Im afraid... Mark. From shalabh at pspl.co.in Thu Feb 24 07:49:50 2000 From: shalabh at pspl.co.in (Shalabh Chaturvedi) Date: Thu, 24 Feb 2000 18:19:50 +0530 Subject: walk library function References: <38B524F8.88A5D43F@nembv.cz> Message-ID: <00da01bf7ec5$a3bbbc70$a602a8c0@intranet.pspl.co.in> Milos Prudek wrote: > I do not quite understand walk library function. Python Library > Reference says that walk calls function 'visit'. > > - What is visit's syntax? > - Or does 'visit' stand for any external program, like 'ls -l'? 'visit' is any function _you_ define. Then you pass the function name to walk and your function will get called from walk. Try this: ---- def myFunc(ar, dirn, nams): print "Someone (wonder who?) called myFunc with parameters:", ar, dirn, nams return walk('c:\\', myFunc, 'hoho') --- Hope this helps Shalabh From tim_one at email.msn.com Sun Feb 20 23:51:09 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 20 Feb 2000 23:51:09 -0500 Subject: Continuations Made Simple (hopefully) and Illustrated Message-ID: <##ZCRdCf$GA.252@cpmsnbbsa03> [Denys Duchier, with a nice exposition on CPS (Continuation Passing Style), and some wonderfully clumsy Python code using it] Thanks, Denys -- this was fun! Just a few comments: > ... > You can write continuation passing programs in Python, or in any > language that supports some form of closures and automated garbage > collection. Except that Python doesn't optimize tail calls: the stack keeps growing. This limits the value of the approach for "real work" in Python. > The application that I know best concerns `search'. This is very > much related to the on-going thread on iterators. I learned the > technique, which I describe below, from my erstwhile advisor Drew > McDermott, many years ago. This is an old AI technique which Drew > called "generators". However, I should like to point out that, > contrary to Tim's characterization, generators (in Drew's sense) > do not necessarily behave in a `stack-like manner'; although it > is extremely rare to come up with one that doesn't :-) I should always (and 75% of the time do ) qualify my use of "generators" with "as in the Icon language", whose generators are strictly stack-like. This restriction makes them especially easy to implement. Demo/threads/Generator.py (in the Python source distribution) implements a more general flavor of generator that need not be stack-like. I've rarely needed the full power of the latter, although they allow an odd efficiency trick: in the Icon flavor of generator, a recursive generator nested (say) 1000 levels deep that produces "a result" has to pass it all the way up 1000 levels of call chain to get it back to its ultimate consumer, then "resume back down" 1000 levels to get the next result. The Generator.py in the distribution is more coroutine-like, and allows to pass the result directly to the consumer. OTOH, Generator.py builds on native OS threads, which for normal (shallow) usage is much less efficient than a straight implementation without threads. > ... > class Baz: > def __init__(self,foo1,foo2): > self.one = foo1 > self.two = foo2 > def search(self,info,yes,no): > return self.one.search( > info,yes, > lambda self=self,info=info,yes=yes,no=no: \ > self.two.search(info,yes,no)) > > What becomes evident in the above is that Python's lack of real > closures makes it a bit painful to write what in a functional language > is truly succinct and elegant. OTOH, a true functional language's lack of mutable state makes it a bit painful to write object-based code that in Python is truly succinct and elegant. Python simply wasn't designed for the style of code above, and Guido is remarkably unapologetic for that . > 3. CHECKING THE VALIDITY OF PROPOSITIONAL FORMULAE [and some really cool CPS-in-Python code that implements a tautology checker; see the original post, or http://www.ps.uni-sb.de/~duchier/python/validity.py ] This is a good opportunity to contrast styles. The first thing that struck me while playing with the code is that, when a formula is not valid, I want to see a set of bindings that demonstrates that. It's cool that it can be done with a one-token change: lambda alist,no: 1, to lambda alist,no: alist, I was delighted to see that, since my years'-old "real experience" with CPS tricks left me wary of getting anything to work right again after changes in problem requirements <0.5 wink>. I'll attach a fairly idiomatic Python version, a drop-in replacement for your Formula class tree, but where satisfy and falsify return witnessing bindings when they succeed. People are invited to play with both and do the "compare & contrast" bit for themselves . I don't think either version is a pure win on all counts, but the CPS version certainly has attractions! One subtlety is that the code below is very easy to change to make Conjunction and Disjunction work directly with an arbitrary # of conjunctees etc. This is clumsier in CPS, which is why Denys wrote a front end to compile n-ary AND and OR into nested binary operators . leaving-it-to-chris-to-write-the-continuation-variant-ly y'rs - tim # A gross modification of code that contained this copyright notice: # Copyright (c) Feb 2000, by Denys Duchier, Universitaet des Saarlandes class Formula: def isValid(self): """a formula is valid iff it cannot be falsified""" success, alist = self.falsify({}) if success: print self, "can be falsified:\n", alist else: print self, "is valid" # satisfy and falsify are wrappers that allow tracing. # _satisfy and _falsify do the actual work. # satisfy attempts to find some binding of variables such that # the formula is true; falsify to find some binding such that # the formula is false. They return the two-tuple # success, bindings # where success is 1 if successful (else 0); and, if 1, bindings # is a set of witnessing bindings (if success is 0, bindings is # meaningless). tracing = 0 def satisfy(self, alist): if Formula.tracing: print "satisfy", self, "alist=", alist return self._satisfy(alist) def falsify(self, alist): if Formula.tracing: print "falsify", self, "alist=", alist return self._falsify(alist) class Conjunction(Formula): def __init__(self,p,q): self.p = p self.q = q def __str__(self): return '('+str(self.p)+' & '+str(self.q)+')' def _satisfy(self, alist): success, alist = self.p.satisfy(alist) if success: success, alist = self.q.satisfy(alist) if success: return 1, alist return 0, () def _falsify(self, alist): for child in self.p, self.q: success, alist2 = child.falsify(alist) if success: return 1, alist2 return 0, {} class Disjunction(Formula): def __init__(self,p,q): self.p = p self.q = q def __str__(self): return '('+str(self.p)+' | '+str(self.q)+')' def _satisfy(self, alist): for child in self.p, self.q: success, alist2 = child.satisfy(alist) if success: return 1, alist2 return 0, {} def _falsify(self, alist): success, alist = self.p.falsify(alist) if success: success, alist = self.q.falsify(alist) if success: return 1, alist return 0, {} class Negation(Formula): def __init__(self,p): self.p = p def __str__(self): return '!'+str(self.p) def _satisfy(self, alist): return self.p.falsify(alist) def _falsify(self, alist): return self.p.satisfy(alist) class Variable(Formula): def __init__(self,v): self.v = v def __str__(self): return self.v def __bind(self, alist, value): if alist.has_key(self.v): return alist[self.v] == value, alist else: alist = alist.copy() alist[self.v] = value return 1, alist def _satisfy(self, alist): return self.__bind(alist, 1) def _falsify(self, alist): return self.__bind(alist, 0) The rest of Denys's code works unchanged with the above. From JGRAVES3 at austin.rr.com Thu Feb 24 10:10:27 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Thu, 24 Feb 2000 15:10:27 GMT Subject: OT: AS/400 its not so bad (was Porting Python to non-pc platforms (AS/400)) References: <38B313D6.AD23EAB2@ttm.com> <14515.5580.141809.386579@beluga.mojam.com> <38B47AA0.57A1EB09@exceptionalminds.com> Message-ID: Warren Postma wrote in message ... >My father in law has an AS/400 at his place of business, and I wouldn't mind >being able to script him up some stuff on AS/400 using Python. I sure as >Heck am not going to learn RPG! RPG makes even COBOL look nice. ;-) RPG has changed quite a bit over the years. Its now much more frlendly. Indicators are mostly gone (replaced by IFs) but the column requirements are still mostly there. I wouldn't want to write a compiler in it but for what it does (DB and business logic) is very usable and fast. >What a foreboding environment that is. Without so much as a recognizeable >command shell on this system, I have a hard time doing anything. AS/400 programmers say the same thing about unix shells. (-: The 400 has promptable commands which is a very nice feature. type a command and hit F4 and you will get a screen that has all the command arguments as input fields with their defaults filled in. Hitting the 'help' key about anywhere gives you extended, hyper-linked and searchable help (like man pages). The command naming is very intutive also once you know the rules. command usually take the form of 'verb + obj' some verbs: wrk = work with crt = create dlt = delete dsp = display some objects (nouns) pgm = program (often prefixed with the type of program (ie RPG)) splf = spooled files msg = messages outq = output queue jobq = job queue once you get the basics (wrkactjob, wrksplf, dspmsg, crtrpgpgm) you can 'mix and match' verbs and objects to see if the command exists. several times i have used a command with out explicitly knowing that it existed beforehand just by typing what seemed appropriate. This does not mean that the 400 will accept any verb/noun combo, they are all prebuilt. but they are ALL named consistently so once you 'get it' you can find your way around easily. once you find out about a new 'noun' you can be assured at least some of the verbs you know from before will allow you to manipulate it. The AS/400 has many technological features that make it stand out also. The high points are here http://www.as400.ibm.com/overview/tour2des.htm >With the disclaimer that I know nothing about AS/400s, and I only >occassionaly have access to one, I am also interested in putting Python on >an AS/400. Thanks for chiming in and being gracious about a 'foreign' computer. Different does not always equal bad and I hope that this post sheds some light on the 400 for the uniniated. I don't know if you caught the earlier parts of the thread but JPython will probably the first attempt at Python on the 400. I don't know how old the 400 you have access to is, but you need a fairly recent copy of the OS (4.2 or greater) to have a usable Java. As I get time to work on this, I'll be posting to the group. Thanks... Jay From jhauser at ifm.uni-kiel.de Mon Feb 14 11:48:28 2000 From: jhauser at ifm.uni-kiel.de (Janko Hauser) Date: 14 Feb 2000 17:48:28 +0100 Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> <38A810A0.DB9ED318@bibsyst.no> Message-ID: <87emafybkz.fsf@ifm.uni-kiel.de> A simple python specific thing is dopy and pyro. They handle also the client server part and have the benefit that remote functions can be called. Than there are example scripts for xmlrpc and xmlrpc-server. Basically you use something like socketserver from the python distribution. 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 n89553 at stud.upb.de Thu Feb 24 14:27:31 2000 From: n89553 at stud.upb.de (n89553 at stud.upb.de) Date: Thu, 24 Feb 2000 20:27:31 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <38B0E09D.EC26F41E@t-online.de> Message-ID: <38B58623.6FD5FF59@stud.upb.de> Andreas Otto wrote: > > Does a requirement exist for a Python compiler and are your ready to pay > > for it ?? [...] > Our compiler is > a) not free > b) optimizes the source code in an aggressive manner, > you will loose all the stuff you don't need. > c) produces one stand alone Python/C source-file, > with every command change to his c-command > ( no big String-Array ) > d) you will find most of the errors at compile-time > > my english is not as good as it should be Having read your weg pages, I suppose your german language profiency can't called perfect either. I hope that your customers won't turn down your offer because of your inattention for these petty details. I can't say that I've understood the kind of 'compiler' you offer, but I guess it'll sum up to something like a combination of the freeze and the py2c-utilities. Further code optimization requires object declaration. Please correct me if I?ve got it wrong. I guess something like that won't be reasonably applicable for a rapid prototyping language, because you end up correcting all these compiler errors. But the status of a software project may change and other people have other uses of Python. What about developing a backtracking algorithm which analyses the flow of data from the program's interface to internal objects and applies considerate restrictions based on several conversion rules under consideration of the objects' __coerce__() methods? What about concentrating on special applications which do usually not require some critical features of Python? What about optimizing (the correct term might be: "mutilating") the language for embedded systems? I think there aren't many political reservations against you wanting to get paid for your product. Said product should be worth the euros, though, and I'm not convinced by a badly written Usenet posting or a clumsy web page. Friendly regards, Mirko Liss -- M Liss, mail From gerrit.holl at pobox.com Mon Feb 7 11:01:56 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 7 Feb 2000 17:01:56 +0100 Subject: mail filter in python? In-Reply-To: ; from phd@phd.russ.ru on Mon, Feb 07, 2000 at 03:01:08PM +0000 References: <20000207154641.A2817@stopcontact.palga.uucp> Message-ID: <20000207170156.A3609@stopcontact.palga.uucp> Oleg Broytmann wrote on 949932068: > On Mon, 7 Feb 2000, Gerrit Holl wrote: > > > http://www.procmail.org > > > > The procmail syntax is really obfuscated. What about creating a mail > > filter with a Python syntax? Shouldn't be too difficult, just create > > some functions (drop, match_header) and execfile() a file with the > > rexec module... > > Welcome to the wonderful world of Security! :))) (and locking problems) > Procmail, being here for a long time, has a LOT of builtin mechanisms > for locking, security checks, portability and so on. File locking isn't hard to implement, what kind of security checks do you mean? Python is portable so that's not a problem. > It would be hard to reimplement all that from scratch :( I don't think so. Security is not an issue, the command runs under the right uid. regards, Gerrit. -- homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From gerrit.holl at pobox.com Tue Feb 8 14:06:57 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Tue, 8 Feb 2000 20:06:57 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <000901bf7205$dd51ed00$d92d153f@tim>; from tim_one@email.msn.com on Tue, Feb 08, 2000 at 02:26:50AM -0500 References: <87ocad$to2$1@nnrp1.deja.com> <000901bf7205$dd51ed00$d92d153f@tim> Message-ID: <20000208200657.A2074@stopcontact.palga.uucp> Tim Peters wrote on 949973210: > [Gordon points out that the interpreter assumes tab=8 > unconditionally & unalterably] > > [fcahoon at my-deja.com] > > I think this should be in the Python FAQ. Or is it, and I missed it > > somehow? If so, please excuse my oversight. > > Well, since it rarely comes up, it's not really FAQ material. Join the PSA, > though, and you can add your own entries to the FAQ . comp.lang.c has a IAQ too... Infrequently Asked Questions. What about creating an IAQ ? regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From J.C.Travers at durham.ac.uk Thu Feb 17 09:14:28 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Thu, 17 Feb 2000 14:14:28 +0000 Subject: Which GUI? References: Message-ID: <38AC0244.C5FA164A@durham.ac.uk> Anders M Eriksson wrote: > But now I'm reaching the point of no return and I need to create apps > with a GUI, but which one? > > I'm using Windows NT as my development platform > I would like pro and cons for the different GUI's This is a hot topic, and you will get as many different answers as people you ask, so all I can give is my personal opinion. Firstly, I would advise against Tkinter. For some reason Tkinter is relativly popular (it's portable I suppose), but it is probably the hardest GUI to code in (i.e. it is built on top of Tcl and so has to use some of the style of that scripting language). Also, it lacks some key widgets (i.e. it lacks multiple coloumn list boxes and tables... these can be added on third party however, but this is just more work). The best GUI in my opinion is pyQT. It is a fully supported widget/application set written in C++, so it is natural for python (object-orientated). The python wrappers for it are brilliant and the documentation is massive (unlike Tk). It is available on your platform (as well as Unix and Mac) and has every conceivable widget you could want. (Particular tables and multicolumn list boxes). It is simple and logical to code in. Alternatively there is wxPython. This is a python wrapper to wxWin, that is also written in C++ and hance beautifully compatible with pythons object-orientation. It is not quite as feature rich as Qt, but is leagues ahead of Tkinter and gaining fast on QT. It is available on all Windows and Unices and is soon to be on Mac as well as Beos. It again is simple and logical to code in and some people would say it has a more free liscence than QT (though this is only relevant to comercial apps... you may need to pay royalties to QT if you use it comercially on Windows based systems). In conclusion, go for QT unless you need comercial apps, in which case go for wxWin. Of course this is all MHO. You can find links to all of these GUI's through Parnassus. Cheers, John Travers From gerrit.holl at pobox.com Sat Feb 5 02:47:21 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 5 Feb 2000 08:47:21 +0100 Subject: [Doc-SIG] Monty: A structured text syntax idea In-Reply-To: <87evlq$vu$1@vvs.superst.iae.nl>; from cfelling@iae.nl on Fri, Feb 04, 2000 at 05:44:42PM +0100 References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> <20000203160900.A1029@stopcontact.palga.uucp> <87evlq$vu$1@vvs.superst.iae.nl> Message-ID: <20000205084721.A1020@stopcontact.palga.uucp> Carel Fellinger wrote on 949682682: > Dear Gerrit, > > I think it's about time that you start to use procmail and a better > mailer. I'm getting frustrated by all those glimpses of interesting > discussions that take place in some other universe I'm no part of:) > Unless it's your objective to get more people involved in the SIG's. > That could be an interesting approach: keeps us all informed. Even > better would be to get summaries now and again. Any volunteers? I was frustated by the fact no Reply-To: header was set, but from now on, I'll do a g)roup reply (mutt). I'm sorry. My .procmailrc in 288 LOC. regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From rmeegan at murlmail.com Thu Feb 24 10:12:35 2000 From: rmeegan at murlmail.com (rmeegan at murlmail.com) Date: Thu, 24 Feb 2000 09:12:35 -0600 Subject: Simple example of threading Message-ID: <200002241512.JAA29137@www.polytopic.com> [Thomas Weholt] > > > >I want to use threading in a server-based search/index application. Any > >hints? The Python-docs didn`t help much. Tutorials, examples and code, > >pleez. [Aahz] > > Unfortunately, using threading in a server gets a bit more complex and > may not buy you very much. If you really want a threaded server, I > suggest looking at Zope and Zserver -- they've already done all the hard > work. There is something to be said for spawning new processes to handle server requests. In particular, parent processes can kill their children when they wander off and start misbehaving. Threads can't be killed by other threads, including the main thread of the process that spawned them. The cost (in milliseconds) of spawning a process in Linux is on the same order as that for spawning a new thread. This means that only the most time sensitive environments need worry about the extra overhead. Another advantage to spawning a seperate process depends on the nature of your code and your system. If you are creating a long-running server that uses a number of C extensions, there is the opportunity for memory leaks. Spawning a seperate process to handle all of the dirty work means that everything gets cleaned up at the end of the request. This is one of the reasons that Apache spwns and kills httpd processes to handle requests. As always, your mileage may vary. The best way to find out is to write a single threaded application first. This will give you a baseline for performance. If your request rate is low or the time required to process a request is short, you may not need anything else. If you find that you do, use your now thoroughly debugged code as a starting point and add either threading or process forking and see what happens. Good luck - - Robert From evan at 4-am.com Tue Feb 15 16:12:54 2000 From: evan at 4-am.com (Evan Simpson) Date: Tue, 15 Feb 2000 15:12:54 -0600 Subject: Iterators & generators & coroutines References: <001e01bf7790$8bd74480$66a2143f@tim> <88c7hu$209$1@nntp5.atl.mindspring.net> Message-ID: Aahz Maruch wrote in message news:88c7hu$209$1 at nntp5.atl.mindspring.net... > As a side note, I'm thinking that implicit generator creation is a Bad > Idea. We should force people to do things like > > b = BinTree() > g = generator b.traverse() > for i in g(): > .... Why attach such significance to it? Why not just... b = BinTree() for node in b.traverser(): ...? While I'm at it, for general edification I present a somewhat hacked-up version of a coroutine example originally posted long ago by Tim Peters, and preserved at http://www.tismer.com/research/stackless/coroutines.tim.peters.html I changed it to use the 'suspend' syntax, along with a totally imaginary Coroutines class. Basically, it shows how coroutines can be used like a pipeline; We feed 'text' in one end, it comes out the other end processed, and one of the middle bits decides when we're all done. def getline(text): 'Break text into lines' for line in string.splitfields(text, '\n'): suspend line def disassembler(): 'Break lines into characters, add ; at ends' while 1: card = co.getline() for c in card: suspend c suspend ';' def squasher(): 'Replace ** with ^ and squash whitespace' while 1: ch = co.disassembler() if ch == '*': ch2 = co.disassembler() if ch2 == '*': ch = '^' else: suspend ch ch = ch2 if ch in ' \t': while 1: ch2 = co.disassembler() if ch2 not in ' \t': break suspend ' ' ch = ch2 suspend ch def assembler(): line = '' while 1: ch = co.squasher() if ch == '\0': break if len(line) == 72: suspend line line = '' line = line + ch line = line + ' ' * (72 - len(line)) suspend line co.exit() def putline(): while 1: print co.assembler() co = Coroutines(getline, disassembler, squasher, assembler, putline) co.setup.getline(text) co.putline() Cheers, Evan @ digicool From hellan at acm.org Sat Feb 5 05:29:11 2000 From: hellan at acm.org (Jon K Hellan) Date: 05 Feb 2000 11:29:11 +0100 Subject: Running a python script from JAVA, with correct indentation References: Message-ID: <87k8kk54eg.fsf@parus.parus.no> "Alain" writes: > Hi, > > I'm trying to run a script from a file. The script is written in python. The > script is a telnet session between a router and a computer. If I run the > script from a DOS prompt window, everything is good. But if I start the > script from my program, using a Runtime object, there's a problem. The > communication between the router and the computer is stop, even if the > telnet session is still open. Here's the JAVA code: You're running Win95 or Win98, right? In that case, Java programs are unable to capture output from DOS commands. A plausible explanation can be found in the NT Emacs FAQ: http://www.cs.washington.edu/homes/voelker/ntemacs.html#subproc > Programs reading input hang > > Programs that explicitly use a handle to the console ("CON" or > "CON:") instead of stdin and stdout cannot be used as subprocesses > to Emacs, and they will also not work in shell-mode (the default ftp > clients on Win95 and NT are examples of such programs). There is no > convenient way for either Emacs or any shell used in shell-mode to > redirect the input and output of such processes from the console to > input and output pipes. Java apparently uses the same technique as Emacs to communicate with subprocesses. Emacs on Win95 cannot capture output from an inferior Python, so it's no surprise that Java cannot, either. > Is there someone have a solution? Use jpython? It should also be possible to modify the Python interpreter. But if jpython can accomplish your task, use it! Jon From josephwinston at mac.com Thu Feb 24 09:37:41 2000 From: josephwinston at mac.com (Jody Winston) Date: 24 Feb 2000 08:37:41 -0600 Subject: Sockets or networking library? References: Message-ID: Also look at medusa since it is modeled after the design patterns in ACE. -- Jody Winston From pinard at iro.umontreal.ca Tue Feb 15 11:50:13 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 15 Feb 2000 11:50:13 -0500 Subject: RC (was Re: Real Problems with Python) In-Reply-To: Vladimir Marangozov's message of "Tue, 15 Feb 2000 17:07:46 +0100" References: <001001bf7763$e37ab280$66a2143f@tim> <38A979D2.71CD8FB3@inrialpes.fr> Message-ID: Vladimir Marangozov writes: > Saying that "RC has excellent LOR", even when trash is recycled at high > rates, is disturbing. Sorry, I'm getting lost in acronyms, as we have a seen a lot on this topic so far. RC is for reference counting, right? What is LOR for? > BTW, any comparison of RC with state-of-the-art GC is fine by me. As for GC, I figured it out :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From al_amerin at yahoo.com Sat Feb 5 22:20:21 2000 From: al_amerin at yahoo.com (Al-Amerrho H. Amerin) Date: Sat, 05 Feb 2000 21:20:21 -0600 Subject: failure in test_long under gcc (was RE: errors when doing 'make test') References: <002301bf6fb3$d9733b20$182d153f@tim> Message-ID: <389CE875.BFC8E45D@yahoo.com> Tim Peters wrote: > > sys.maxint is correct for your machine. Previous reports of this symptom > were traced to an optimization bug in a particular version of gcc (sorry, > don't recall the details; DejaNews has 'em *somewhere*, though ). Try > recompiling Python without optimization. If the problem goes away, now you > know why. > > Using a newer version of the compiler may fix it (anyone out there know for > sure?). If not, it should suffice to disable optimization only for the file > Objects/longobject.c. Or, if you're extreme, just disable it for the > function PyLong_AsLong in that file. There's nothing wrong with the code > there (it's been critically reviewed by dozens of unhappy campers by now > <0.9 wink>), so there's nothing more we can do about it on this end. > > BTW, I wrote both the function and the test that's failing, so I can pretend > to know what I'm talking about here . > > the-good-news-is-that-it-doesn't-fail-anywhere-else-ly y'rs - tim You're right, disabling optimization works. Thanks! From brian at brian.cbs.umn.edu Wed Feb 16 09:12:33 2000 From: brian at brian.cbs.umn.edu (Brian Langenberger) Date: 16 Feb 2000 14:12:33 GMT Subject: is this a Python bug? References: Message-ID: <88eb8h$pcb$1@news1.tc.umn.edu> piet at cs.uu.nl wrote: :>>>>> Moshe Zadka (MZ) writes: : MZ> On 15 Feb 2000, Brian Langenberger wrote: :>> R is supposed to work to give raw strings with the backslashes stored :>> as backslashes. I've never had a problem until I tried making a :>> string with nothing but backslashes. : MZ> Raw strings cannot end with a backslash. : They can. But only with an even number of them. I'm assuming there's some clever and important reason for this. But for the life of me I can't figure out what it is. Could someone enlighten me as to the reason? :) From gko at gko.net Tue Feb 22 02:49:08 2000 From: gko at gko.net (Georges KO) Date: Tue, 22 Feb 2000 15:49:08 +0800 Subject: Is there any Tkinter telnet client? Message-ID: <00Feb22.154912gmt+0800.28197@ns.alcatel.com.tw> Hi folks, Is there any Tkinter telnet client code available? Thanks! -- Georges KO Alcatel Telecom Taiwan gko at alcatel.com.tw / gko at gko.net Mardi 22 f?vrier 2000 From moshez at math.huji.ac.il Thu Feb 17 13:51:21 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 17 Feb 2000 20:51:21 +0200 (IST) Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: <88h50k$mt2$1@nntp6.atl.mindspring.net> Message-ID: On 17 Feb 2000, Aahz Maruch wrote: > Okay, now I'm starting to get this (be very, very frightened). Now, can > you (or someone) provide an equally simple explanation of the > differences between continuations and threads? Given that we already > have threads (sort of), what is the attraction of continuations? Is it > easier to write continuations than simulate threads on an unthreaded OS? Oh, continuations *cannot* be simulated by threads. (Coroutines can be simulated by both, however). They are much more powerful then you think: you can implement all sorts of funky control behaviour, from classic exception handling to the types of exception where the catcher can "correct" the situation and "retry". Very, very, cool. be-much-more-frightened-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From spamfranke at bigfoot.de Wed Feb 2 17:54:22 2000 From: spamfranke at bigfoot.de (Stefan Franke) Date: Wed, 02 Feb 2000 22:54:22 GMT Subject: "Python Programming on Win 32" available Message-ID: <3898b54c.1949600@news.btx.dtag.de> Is the book available already? Amazon.com says "ships within 2-3 days." Stefan From sanderson at ttm.com Tue Feb 22 16:28:17 2000 From: sanderson at ttm.com (Scott Anderson) Date: Tue, 22 Feb 2000 16:28:17 -0500 Subject: Porting Python to non-pc platforms References: <731E80062E7A91F28525688D0074EC5C.0074F3D08525688D@ttm.com> Message-ID: <38B2FF71.1D7A677D@ttm.com> On a slightly different note, has anyone ported Python to the AS/400? Regards, -scott gavrilov at iname.com wrote: > > Look on Deeply Embedded Python. http://www.abo.fi/~iporres/python/ From rasumner at iname.com Sun Feb 27 13:08:53 2000 From: rasumner at iname.com (Reuben Sumner) Date: Sun, 27 Feb 2000 20:08:53 +0200 Subject: Blowfish in Python? References: <000a01bf810a$422a7cc0$172d153f@tim> Message-ID: <89bp7c$kfi$1@news.netvision.net.il> Tim Peters wrote in message <000a01bf810a$422a7cc0$172d153f at tim>... >[Markus Stenberg] >> I think the main reason was the fact that I had to use _long ints_ for >> calculations, as the normal ints are signed, and apparently the bitwise >> operators do not work as advertised when bit32 is set (=number is >> negative). Or that's my theory anyway - my implementation worked with >> long's and did not work with ints. > >Try to whittle this down. Negative ints are nothing special to the bitwise >ops, so if they "don't work as advertised" it would be a (very surprising!) >bug in the implementation. For example, here's the implementation of int &: Even if & is OK, in, for example RC5 you need to do a bunch of "+" operations modulo 2**32. At the machine level (or C) this is quite natural. Unfortunately in Python ints come with overflow detection which gets triggered here. When I needed this I resorted to a module in C. I imagine that some sort of a uint32_t type with +,-,shift,rotate would be quite handy for implementing a number of cryptographic primitives. * would be needed for RC6 (even just returning the lower 32 bits of the full 64 bit product). Reuben From phd at phd.russ.ru Wed Feb 16 10:17:56 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Wed, 16 Feb 2000 15:17:56 +0000 (GMT) Subject: Valid Python Code? In-Reply-To: Message-ID: On Wed, 16 Feb 2000, Anders M Eriksson wrote: > I'm just wondering is this a valid Python code snippet? Almost. > import os > for k,v in os.environ.values(): > print k,v > > > I can't get it to work!? for k,v in os.environ.items(): ^^^^^ Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From gerrit.holl at pobox.com Wed Feb 16 15:49:13 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 16 Feb 2000 21:49:13 +0100 Subject: SocketServer.TCPServer - graceful shutdown? In-Reply-To: ; from claudius@catlover.com on Wed, Feb 16, 2000 at 05:26:48PM +0000 References: Message-ID: <20000216214913.B4101@stopcontact.palga.uucp> claudius at catlover.com wrote on 950718408: > All, I'm writing a web server app (a proxy that logs transactions for debugging > purposes) and I've noticed that there's no graceful way to shut the server down > from the handlers...I would think this is functionality that should be added > to SocketServer.TCPServer. Am I missing something (or is the code missing > something?) > > The only thing I could think of was sys.exit(0), but the exception is caught by > the exception handler... os._exit regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From effbot at telia.com Mon Feb 7 01:49:27 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 07 Feb 2000 06:49:27 GMT Subject: Files and Directories References: <2Lqn4.5185$NS3.16759@newsfeed.slurp.net> Message-ID: Patrick K Moorman wrote: > Thanks to everyone who answered my last question, it is good reminder that > computers do *ONLY* what they are told. I am trying to write a little > script that will rename files in multiple directories. What am a looking > for is a way to take each item returned by os.listdir() and test to see if > it is a file or a directory. I have gone through the lib reference but I > did not see anything that would work. http://www.python.org/doc/current/lib/module-os.path.html -> os.path.isdir(path) and os.path.isfile(path) for file in os.listdir("directory"): if os.path.isdir(file): print file, "is a directory" also see os.path.walk(). and the os and os.path examples in the eff-bot guide... From tim_one at email.msn.com Tue Feb 15 00:39:24 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 15 Feb 2000 00:39:24 -0500 Subject: Greetings! In-Reply-To: <888gtg$67n$1@nnrp1.deja.com> Message-ID: <001401bf7777$04529dc0$66a2143f@tim> [gtnorton at my-deja.com] > ... > When I attempt to use the "raw_input" function on IDLE -- IT NO WORK > it's fine through the command line and PythonWin. Bug? What gives? In the released 1.5.2 IDLE, although the raw_input *prompt* shows up in an "output window", you need to enter the response in the *shell* window. This has since been fixed (and the next release of IDLE won't have "output windows" anymore). If you want that now, see David Ascher's Starship pages for the latest development snapshot. > Also, are any newbies (or anyone)interested in starting a communty > group here on Deja or some kind of programming club?.I feel I'm > learning C much faster when I'm bouncing ideas off others as I do > in a C group I work with. This would be welcome on the Python-Tutor mailing list; see http://www.python.org/mailman/listinfo/tutor/ From dfavor at austin.ibm.com Wed Feb 16 14:05:47 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Wed, 16 Feb 2000 13:05:47 -0600 Subject: Reference to list element question Message-ID: <38AAF50B.7FC60776@austin.ibm.com> The following code attempts to create a reference to a list element to reduce overhead for large files, however the result is a copy operation. How does one create a pointer, or reference, to a list element, such that the list element data may be operated upon via the pointer (reference)? Thanks. _______ def chomp(lines): "remove the end of line markers from array" i = 0 while i < len(lines): # this works improperly, because it's not a reference? line = lines[i] if line[-1] == '\n': line = line[:-1] i = i + 1 From scherbi at bam.com Fri Feb 25 10:19:13 2000 From: scherbi at bam.com (Bill Scherer) Date: Fri, 25 Feb 2000 10:19:13 -0500 Subject: Argo / Python / UML design tools References: Message-ID: <38B69D71.AC9533BE@bam.com> Have you a pointer to TCM? Harry George wrote: > TCM is free, and I parse its data files in python, in order to > generate XML and python and java outputs. > > Pierre-Charles David writes: > > > ebecker at software-manufaktur.de (Edelhard Becker) writes: > > > > > Hi Greg, > > > > > > On Mon, 14 Feb 2000 13:11:23 -0500, Greg Wilson wrote: > > > > Is anyone working on UML design tools that are Python-friendly? > > > > More specifically, has anyone taken a look at Argo > > > > (http://www.ics.uci.edu/pub/arch/uml/) with an eye to making it > > > > understand Python? If so, I'd be grateful for a ping... > > > > > > "Together" (http://www.togethersoft.com/index.htm) is implemented in > > > Java and comes with JPython. Unfortunately it's not cheap ... > > > > Same for ObjectDomain (http://www.objectdomain.com). > > > > -- > > Pierre-Charles David (david at essi.fr) > > -- > Harry George > hgg9140 at seanet.com > -- > 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 alex at somewhere.round.here Thu Feb 10 00:01:16 2000 From: alex at somewhere.round.here (Alex) Date: 10 Feb 2000 00:01:16 -0500 Subject: perl chomp equivalent in python? References: <87snvk$f2i$1@news.hccnet.nl> Message-ID: > It'd be kinda cool if readlines() could take an argument that meant to > strip away any trailing whitespace. Hi, Will. Below are some classes I often use for that sort of thing. Alex. class lazy_file: def __init__ (self,filename, print_count_period=None, sizehint=10**7, mode='r', open=open): self.file = open (filename, mode) self.line_count=0 self.sizehint = sizehint self.print_count_period = print_count_period self.buffer = None def readline (self): if not self.buffer: self.buffer = self.file.readlines (self.sizehint) if not self.buffer: self.line = '' else: self.line = self.buffer.pop (0) if self.line [-1] == '\n': self.line = self.line [: -1] if self.print_count_period and \ not (self.line_count % self.print_count_period): print self.line_count self.line_count=self.line_count+1 return self.line class File_loop: def __init__ (self, filename, print_count_period=None, sizehint=10**7, mode='r', open=open): self.file = lazy_file(filename, print_count_period, sizehint, mode, open) def __getitem__(self,index): if self.file.readline(): return self.file.line else: raise IndexError, 'File finished' if __name__ == '__main__': f = File_loop ('/data/databases/gbpri/introns.txt') for l in f: print l[-10:] From gerrit.holl at pobox.com Thu Feb 17 14:58:11 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 20:58:11 +0100 Subject: tricky cPickling In-Reply-To: <38AC370D.D4713C69@alias.it>; from etienne@alias.it on Thu, Feb 17, 2000 at 06:59:43PM +0100 References: <38AC370D.D4713C69@alias.it> Message-ID: <20000217205811.A2292@stopcontact.palga.uucp> Etienne Antoniutti Di Muro wrote on 950810383: > This is my first message posted, so hi everybody !! :-) > > > Recently I have experienced some problems using cPickle.load function. > Here it comes: > code is pretty simple: > > class MyStuff: > def save(filename): In classes, the first argument of a method must be 'self'. This is needed to access instance-depentent attributes. > obj = (GlobalVar1, GlobalVar2, GlobalVar3) #GlobalVar > are instances of classes > f = open(filename, "w") > cPickle.dump(f, obj) > f.close() > > def load(filename): And the indentation is not consistent. > f = open(filename, "r") > (globalVar1, globalVar2, globalVar3) = cPickle.load(f) > f.close() > return obj > > I experiece errors in unpickling only (MyStuff.load("MyFileName")), they > are listed as follows: > > 1_ NameErrors of some objects from modules used by the "GlobalVar" > cPickled. (but please note that those modules are properly imported > before cPickling); You should type 'self.GlobalVar1' and create a first argument 'self' to the methods > 3_ Different behaviours (raised exceptions) of the script which uses > MyStuff.load("MyFileName") method, according how i call it. Is it due to > different exception managment of MacPython IDE instead of MacPython > AppletBuilder ?? class Foo: def print_something(self, message): print "instance %s is printing: %s" % (self, message) > 4_ Cause of those errors I can't embed MyClass in a C function, that is > where i need it to work. > > Any Suggestion ?? Yes :) regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From effbot at telia.com Fri Feb 11 14:30:48 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 19:30:48 GMT Subject: Two question from a newbie References: <38A431EE.5A7B2B1@aston.ac.uk> Message-ID: Peter Bittner wrote: > I've got two simple questions: > > 1.) How do I implement ORs and ANDs in an if-statment? > > - e.g. I'd like to have this C-code in Python: > > if (x.mode == "view" || x.mode == "modify") > myMode = x.mode; > > 2.) What does str(...) do? (I've already posted this, sorry!) > > I've seen > print '....' + str(text) + '...' > in some code (in a function definition). > What does this 'str(...)' really do? - Is it absolutely necessary?? > > Please, e-mail! newbies have been known to read the fine manual: http://www.python.org/doc start with the tutorial. browse the language reference. then the read the first chapters in the library manual (covering builtin operations). From sabren at manifestation.com Thu Feb 10 19:26:59 2000 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 10 Feb 2000 19:26:59 -0500 Subject: local cgi References: <38a33281_2@news5.newsfeeds.com> Message-ID: <87vl1c$duc$1@nntp1.atl.mindspring.net> 55555 <55555 at dakotacom.net> wrote in message <38a33281_2 at news5.newsfeeds.com>... >Is it possible to run a local cgi program on a windows 95 machine through internet >explorer 5? My python programs come up as text documents even though .py is obviously >associated properly in the registry. Thanks. yes, but you need to install a web server... there's one called Medusa that's written in python, or you can use the simple server that comes WITH python... -michal From kcazabon at home.com Mon Feb 21 00:49:59 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Mon, 21 Feb 2000 05:49:59 GMT Subject: Tkinter: creating a scrolling canvas that contains widows (Frame widgets) References: <490s4.103351$A5.1984558@news1.rdc1.bc.home.com> <38b0b97b.6567671@news1.on.sympatico.ca> Message-ID: Thankyou! I need to keep all the hair I have, and I've been pulling out a disproportionate amount over this already! I've just taken a quick look so far, but it sounds promising! q:] Kevin. "Robert Roy" wrote in message news:38b0b97b.6567671 at news1.on.sympatico.ca... > Save yourself a lot of work and download Pmw. Among other wonderful > things, it has a scrolled frame class that sounds like it will de > everything you need. > > The url is: > http://www.dscpl.com.au/pmw/ > > Bob > > On Mon, 21 Feb 2000 01:02:56 GMT, "Kevin Cazabon" > wrote: > > >I've been trying to create a class that I can use to place Frame() widgets > >into a scrolling 'container'. > > > >Basically, I want a master "Frame" that has a Y scroll bar (and maybe X as > >well). In this frame, I want to be able to add sub-frames (any number). If > >all of these frames won't fit, I want to be able to scroll the master Frame > >as necessary. > > > >The only suitable Tkinter class for the Master I can find is the Canvas > >widget. I have no problem creating this, and adding windows to it using > >canvas.create_window(x,y, window=mywidget), but have had a heck of a time > >getting it to scroll properly, especially when the user resizes the overall > >master frame. > > > >This may sound complicated, but it really isn't... just the implementation > >might be! > > > >Any suggestions, or if you can point me to an exapmle that might help (like > >the ScrolledText widget, which is very similar to what I need, kindof...), I > >would greatly appreciate it. > > > >Kevin Cazabon > >kcazabon at home.com > > > > > From greg at cosc.canterbury.ac.nz Sun Feb 6 20:10:51 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 07 Feb 2000 14:10:51 +1300 Subject: Haskell or Python! References: <000f01bf6edf$26ad09a0$a2a0143f@tim> <389B1F39.A6DC301A@prescod.net> <389B20B2.95834DE3@callware.com> <010c01bf6f84$cf152960$01ffffc0@worldnet.att.net> Message-ID: <389E1B9B.303F7172@cosc.canterbury.ac.nz> Emile van Sebille wrote: > > Unless, of course, you buy into the closed universe model... Oh, no! Infinite cosmic recursion! Let's hope the universe is tail-recursive, or at least lazily evaluated... -- 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 55555 at dakotacom.net Mon Feb 14 14:16:55 2000 From: 55555 at dakotacom.net (55555) Date: 14 Feb 2000 13:16:55 -0600 Subject: os.shell, recursion, encryption References: <38a79bec_3@news5.newsfeeds.com> Message-ID: <38a854a7_2@news5.newsfeeds.com> How does os.popen work? I'm afraid that I don't understand pipes. I thought they had something to do with commands like 'blah >> blah2' which would append blah2 with blah, right? If that is a pipe then that's all I know what to do with it. Can it be used to send a command like 'pkzip -sasdf asdf.zip *.txt' and return without generating a bunch of windows? Thanks. On Mon, 14 Feb 2000 08:40:54 +0100, Gerrit Holl wrote: > 55555 at dakotacom.net wrote on 950483324: > > I'm spawning pkzip for dos using os.shell() because I would like to use the encryption > > feature. As far as I can tell that is not available in the gzip library and the > > documentation on the cryptography toolbox didn't give me the impression that all the bugs > > were worked out. Does anyone know whether that has changed? > > Hmm, please type your lines a little shorter. > It's not a bug: cryptograhy and archiving are two different things. Only > Dos/Windows archivers combine them in one program. > > > Anyway, os.shell() pops up a new dos box for each call. I'm using os.path.walk() and > > making a lot of calls to the zip program. I'm wondering if there is a way to not spawn > > 40 windows. 0 windows would be ideal. > > What about os.system()? Or os.popen (does it exist on dos?)? > > > Finally, I'm wondering if there is a way to attach to a global variable while moving > > around with os.path.walk()? I understand recursion and have read Python's scope rules > > but I can't seem to either pass local varaibles through or to attach to a global > > variable. > > Have a look at the 'global' keyword. > > regards, > Gerrit. > > -- > Homepage: http://www.nl.linux.org/~gerrit > -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com > Version: 3.12 > GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O > !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y > -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From zawrotny at gecko.sb.fsu.edu Mon Feb 28 09:45:02 2000 From: zawrotny at gecko.sb.fsu.edu (Michael Zawrotny) Date: 28 Feb 2000 14:45:02 GMT Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: Arnaud, This may or may not help a whole lot, but it may be worth a try. Even without CW you can still compile on the Mac. MPW is freely downloadable from Apple: ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./ The reason this may not help is that I have no idea how hard it would be to compile MK under MPW. On Mon, 28 Feb 2000 11:39:42 +0100, Arnaud Fontaine wrote: > So, I need to re-compile the module from the sources. Hmmmm ..... but I > don't have CodeWarrior ... so ... > But that's another story. [snip] > So, in a few words : Do you have a solution to my problem (I don't have > a C compiler on the MacOS side ...) ? Hope this helps, Mike -- Michael Zawrotny 411 Molecular Biophysics Building Florida State University | email: zawrotny at sb.fsu.edu Tallahassee, FL 32306-4380 | phone: (850) 644-0069 From phd at phd.russ.ru Fri Feb 11 06:12:30 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 11 Feb 2000 11:12:30 +0000 (GMT) Subject: Retrieve file by FTP (using urllib) In-Reply-To: Message-ID: Thanks! On Fri, 11 Feb 2000, Fredrik Lundh wrote: > interesting. they're using a non-standard server, > which seems to implement the FTP protocol a bit > more literally than urllib expects... > > full story: urllib issues an NLST command to make > sure the file exists, before starting the download. > however, RFC959 doesn't necessarily allow this: > > [NLST] causes a directory listing to be sent from > server to user site. The pathname should specify a > directory or other system-specific file group descriptor; > a null argument implies the current directory. > > most FTP servers seem to treat NLST commands as > ordinary "ls -l", but this one doesnt. > > I'm pretty sure the only reasonable solution is to > remove the offending code from urllib... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From gerrit at nl.linux.org Mon Feb 28 03:23:38 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Mon, 28 Feb 2000 09:23:38 +0100 Subject: Traling junk in string.atof (RE: array constructor) In-Reply-To: <38BA0571.BED84D5@sightreader.com>; from kens@sightreader.com on Sun, Feb 27, 2000 at 09:19:45PM -0800 References: <000f01bf8197$0c473020$f0a2143f@tim> <38BA0571.BED84D5@sightreader.com> Message-ID: <20000228092338.A1416@stopcontact.palga.uucp> > I remember reading about a language that generates absolutely no errors of > any kind. HTML, javascript, CSS, PHP. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From sholden at bellatlantic.net Fri Feb 11 08:19:17 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 11 Feb 2000 13:19:17 GMT Subject: Off Topic Posts References: Message-ID: <38A40C70.17F59931@bellatlantic.net> greg andruk wrote: [discussions about maintaining the purity of c.l.p] > Also, the list/newsgroup gateway would make activities like setting > followups/reply-to the other forum a bit awkward. Not sure how important > that would be in practice, but it shouldn't be ignored. The major "problem" here is newbies' ignorance of the netiquette requirement that you lurk long enough on a newsgroup (after reading the FAQ, of course) to absorb the culture and learn enough not to ask dumb questions/repeat posts which come up frequently. If anyone can design a piece of software to enforce that, I can guarantee it a future languishing unused in repositories. Some days I just get my Dilbert t-shirt out that reads "The Internet is full: go away!" But I would like to say that c.l.p has an almost unique tolerance for ignorant abuse, which makes it a very nice place to learn about a fascinating language. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From gerrit.holl at pobox.com Sat Feb 26 04:28:17 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 26 Feb 2000 10:28:17 +0100 Subject: Life's better without braces In-Reply-To: ; from moshez@math.huji.ac.il on Fri, Feb 25, 2000 at 10:48:07PM +0200 References: <20000225213806.A19850@humbolt.nl.linux.org> Message-ID: <20000226102817.A951@stopcontact.palga.uucp> > On Fri, 25 Feb 2000, Gerrit Holl wrote: > > > def callable(f): > > try: > > f() > > return 1 > > except TypeError: > > return 0 > > > > Hmm, this is wrong. > > To emphasize Gerrit's point: > > def f(): > raise TypeError() Much simpler, you just don't want to call a certain function to know if it's callable! > > > ord should also be possible. > > > > Possible with some dictionairy. > > Hey, we can always right a Python program to write a Pythonic huge > if statement: > > >>> def his(): > ... print "def ord(c):" > ... print "\tif type(c) is not type('') or len(c)!=1:" > ... print "\t\traise TypeError('too lazy')" > ... for i in range(256): > ... print "\tif c=='\\x%x': return %d" % (i, i) > ... print "\traise TypeError('this is impossible')" > > (I was merciful enough to include the output) Where? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From gerrit.holl at pobox.com Sun Feb 13 13:50:59 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 13 Feb 2000 19:50:59 +0100 Subject: support@usenetserver.com In-Reply-To: <38A6A00C.DF503BD8@chelmsford.com>; from shochat@chelmsford.com on Sun, Feb 13, 2000 at 07:14:04AM -0500 References: <38A6A00C.DF503BD8@chelmsford.com> Message-ID: <20000213195059.A4786@stopcontact.palga.uucp> David Shochat wrote on 950422444: > Posting not working again? > > I tried posting to comp.lang.python this morning, but it does not show > up after I fetch new messages (or re-enter the group). So I tried in > alt.test and again, I can't see my posting. I notified you once before > of this and since then I was able to post successfully to alt.test and > comp.lang.ada. In those cases, my posting appeared immediately in the > group in question. Is there a problem? No - your mail did reach the group (look at deja). Please fix your newsreader. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From gerrit.holl at pobox.com Wed Feb 23 09:31:37 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 15:31:37 +0100 Subject: Proposal: Official whitespace response In-Reply-To: <2ho6bsc4ltsne6lmko14b9c6lgek34h24f@4ax.com>; from wlfraed@ix.netcom.com on Tue, Feb 22, 2000 at 08:41:02PM -0800 References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <38b1a83b.25970002@news.concentric.net> <88uvdv$2e6$1@hpbs1500.boi.hp.com> <2ho6bsc4ltsne6lmko14b9c6lgek34h24f@4ax.com> Message-ID: <20000223153137.A2858@stopcontact.palga.uucp> > On Tue, 22 Feb 2000 14:22:13 -0700, "Ken Seehof" > declaimed the following in comp.lang.python: > > > How about making tabs a syntax error in Python 2.0! > > > Why rile up the half that like to use tabs? > > Make /mixed mode -- space and tabs/ the syntax error. python -tt does that. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From effbot at telia.com Sun Feb 6 13:44:37 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 18:44:37 GMT Subject: Error raising style References: <20000206191629.A1599@stopcontact.palga.uucp> Message-ID: Gerrit Holl wrote: > But I find this better: > >>> raise Exception('aaa') > > because when raising an error with multiple errors, the former isn't > possible: > >>> raise Exception, 'aaa', 'bbb' > Traceback (innermost last): > File "", line 1, in ? > TypeError: raise 3rd arg must be traceback or None raise Exception, ('aaa', 'bbb') > Guido's style guide doesn't talk about it, probably because the > call-raising is only possible since class exceptions. Is all those > code because of backward compatibility and people who are used to > this style of raising exceptions? > > What do you think? your guess is as good as mine... From effbot at telia.com Thu Feb 17 13:20:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 18:20:42 GMT Subject: Superclasses References: Message-ID: <_ZWq4.180$mYj.170807808@newsa.telia.net> Joshua C. Marshall wrote: > Given a class object, is there a way to get at its superclass object? the thing you're looking for is "__bases__" (it's called "base class" in python, and you can have more than one) >>> class A: ... pass ... >>> class B(A): ... pass ... >>> B.__bases__ (,) to check if a class is a subclass to any other class, use "issubclass": >>> issubclass(B, A) 1 >>> issubclass(A, B) 0 hope this helps! From moshez at math.huji.ac.il Fri Feb 25 08:49:15 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 25 Feb 2000 15:49:15 +0200 (IST) Subject: Newbie Newbie, we are all Newbie to something In-Reply-To: Message-ID: On Fri, 25 Feb 2000, Gregoire Welraeds wrote: > I'm currently reading the Python Reference Manual and I got a small > question regarding the __del__() statement in a class definition. Well, Python, the language, does not gurantee *anything* about memory freeing and __del__ calling except that it will not delete an object as long as any reachable object references it, and that it will not call the __del__ method as long as any reachable object references it. CPython, the implementation (well, one of the implementations, anyway), deletes an object as soon as there are no references to it, and it calls it's __del__ method right before that. (I'm not talking about what happens if the __del__ resurrects an object. It's a user bug.) Hence f = open("file") del f Closes the file *in the current C implementation*. It does not close the file, e.g., in JPython. have-I-confused-you-enough-yet-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From zawrotny at triangle.sb.fsu.edu Thu Feb 17 09:02:13 2000 From: zawrotny at triangle.sb.fsu.edu (Michael Zawrotny) Date: 17 Feb 2000 14:02:13 GMT Subject: data structure design question References: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> <3.0.5.32.20000217003512.0089b140@mail.dicksonstreet.com> <88gcem$kql$1@mach.vub.ac.be> Message-ID: On 17 Feb 2000 08:45:10 GMT, Thomas Hamelryck wrote: > Felix Thibault wrote: > : Does this mean that I can use a graph to show which atoms are connected, > : but I need to find some other way to show whether a bond > : is a single or multiple bond...or else have nucleus-nodes inter-connected > : by electron=pair-nodes ? > > Yes. You can store the connectivity in a graph, but you > need to find another way to store the information about the > bonds. Everything depends of course on what you are trying to > do. A data structure that will be used to draw simple chemical > structures will of course be different from one that will be > used to refine a protein structure. > > One possible solution is to attach an atom type to each > atom. You can then do a look up in a dictionary to find the > information associated with a bond between two atoms of a > certain type. This is e.g. done in the macromolecular modeling > program X-PLOR. One drawback to the X-PLOR approach (which I am familiar with from having used it a bit) is the large number of atom types that are eventually needed. For example, the carbon atom in formaldehyde will have a different atom type than the two that are in ethylene and it may even be different than the one in formamide. In X-PLOR it is necessary to do that to properly parameterize the atoms/bonds for high resolution structure determination, but it may be overkill if the amount of resolution you need is much less. A first order approximation to this approach would be to still have multiple atom types per element, but limit it to one for each allowable hybridization state. Using carbon as an example, have one type each for sp, sp2 and sp3 hybridized orbitals (acetylene, ethylene, and ethane respectively). This will let you capture the most important aspects of the geometry (e.g. bond angles of approx. 180, 120 or 109.5 degrees) without having an explosion of atom types. Which approach you use, of course, depends on the specific requirements of your application. Mike -- Michael Zawrotny 411 Molecular Biophysics Building Florida State University | email: zawrotny at sb.fsu.edu Tallahassee, FL 32306-4380 | phone: (850) 644-0069 From claudius at catlover.com Wed Feb 16 12:26:48 2000 From: claudius at catlover.com (claudius at catlover.com) Date: Wed, 16 Feb 2000 17:26:48 GMT Subject: SocketServer.TCPServer - graceful shutdown? Message-ID: All, I'm writing a web server app (a proxy that logs transactions for debugging purposes) and I've noticed that there's no graceful way to shut the server down from the handlers...I would think this is functionality that should be added to SocketServer.TCPServer. Am I missing something (or is the code missing something?) The only thing I could think of was sys.exit(0), but the exception is caught by the exception handler... From moshez at math.huji.ac.il Sat Feb 26 10:34:36 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 17:34:36 +0200 (IST) Subject: parameter undefined in procedure In-Reply-To: Message-ID: On Sat, 26 Feb 2000, Don Tuttle wrote: > Are there any plans to upgrade lambda, map, reduce and filter to become > "major conveniences"? Or are there already better ways to accomplish the > same things? Try searching the archives of the group for "list comprehensions" -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gmcm at hypernet.com Mon Feb 28 19:30:37 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 28 Feb 2000 19:30:37 -0500 Subject: Module import problem In-Reply-To: <89ev94$1sfi$1@news.tht.net> Message-ID: <1260338258-27054411@hypernet.com> Anthony DeLorenzo wrote: > I'm having the dumbest problem trying to import a module. I can't figure > it out at all. Basically, I'm on a win32 system. The directory > \py152\lib is on my python path, and I'm trying to import the module > \py152\lib\gadfly\gadfly.py. > > So, I use this: > import gadfly.gadfly This only works if gadfly is a package. A package is a directory on sys.path that has an __init__.py (which may be empty) in it. You could try adding an (empty) __init__.py. It will probably work. Generally, if you're installing something that is not packagized, you should use a .pth file. E.g., if you unzipped gadfly to d:/chordate/gadfly, then you should create a file \py152\gadfly.pth with one line: d:/chordate/gadfly > And for some incomprehensible reason it doens't work. I've used this > statement to import other modules in sub-folders, but it just won't > work for this particular one. Any ideas, because I'm stumped. The > only way I can get it to import is by running python from the gadfly > directory, so I do at least know that the module exists. > > Tony > > > -- > # Anthony DeLorenzo > # http://www.vex.net/~gonzo/ > # mojo wire: 209-391-8932 > -- > http://www.python.org/mailman/listinfo/python-list - Gordon From nick at spam_me_notvideosystem.co.uk Fri Feb 25 06:16:46 2000 From: nick at spam_me_notvideosystem.co.uk (Nick Trout) Date: Fri, 25 Feb 2000 11:16:46 -0000 Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> <891g7l$cf8$1@nnrp1.deja.com> <893u76$46l$1@nnrp1.deja.com> Message-ID: <38b66215@news.xtml.co.uk> > Just so I understand (and also because my > programmer teammates are asking me questions), is > unmodified (no stackless or microthreads) Python > unable to run multiple scripts at the same time? There are a number of ways you can run multiple scripts I think. * See threading.py (in python Lib) * exec "" in global,local which global and local are 2 state dictionaries. Global persists for all objects and each object will have its own local(?). You should be able to compile some code and just execute it to save the compile overhead. * Initialise multiple Python states in C (not sure how stable this is) and execute scripts. > I'm thinking no because if Python was able to run > multiple scripts simultaneously, there > wouldn't be a need for SP or MT's. Don't quote me but I think SP was written for restricted memory systems. To be honest I dont see the necessity for MT. Could someone expand for my benefit?!! :-) What sort of game are you writing? First person shooter on PC? From robin at alldunn.com Thu Feb 17 17:37:46 2000 From: robin at alldunn.com (Robin Dunn) Date: Thu, 17 Feb 2000 14:37:46 -0800 Subject: [wxPython] RE: Which GUI? References: Message-ID: <02e001bf7997$9e547160$1a25d2d1@jenkondev.com> > > To get a functional redistributable, you need about 2.7MB of DLLs > (wx21_13.dll (1.7MB) and wxc.pyd (1.06MB)). This is a considerable memory > overhead (and loading overhead (my concern), and distribution overhead (not > something I personally worry about, but apparently some do :) )). Might > breaking functions into multiple DLLs be a first step in solving the > problem? I have no idea how hard that would be, but I do wonder how much of > the 2.7 MB is actually being used by any given wxPython application. My guess is less than half. I've already disabled a few things in the wx DLL that I build, but more can be done. There are a lot of interdependencies that have to be worked around, but it is doable. Also, if something is supported in any of the .pyd's then it needs to be in the wx*.dll, I can't get around that... > > Does swig provide support for creating multiple interface DLLs? I know that > the interface wrappers for HTML, OpenGL etc. are separate, do they all > interface into the same wxWindows DLL (couldn't find matching wxWindows DLLs > for those modules)? Correct. > Does wxWindows have options for compiling to multiple > DLLs? No. There is the ability to create a non-gui library, but if using the GUI classes then it is almost an all or nothing deal. Parts of wxWindows can be turned off (essentially just compile to nothing) by setting some #defines in a header file. The trouble has been keeping these settings in correlation with what is in the SWIG interface files, so my approach so far has been to leave most things turned on. Now that the newest (alpha) version of SWIG has a preprocessor that works I plan on using it to process the same header file and be able to disable the same things in wxPython that are disabled in wxWindows. This should significantly help the size issue, and custom versions can easily be created that strip out all non-essential features. > Does the delay-loading trick mentioned on the big python list some > time ago help with the memory and loading overheads? I havn't tried it yet, but it is on my todo list... -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From rdudfield at my-deja.com Wed Feb 16 01:58:18 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Wed, 16 Feb 2000 06:58:18 GMT Subject: XORing on arrays faster? Message-ID: <88dhqa$nmi$1@nnrp1.deja.com> Hello, Anyone know how to do XORing on arrays fast? I do not want to use the Numeric package, for other reasons. So that is out of the question. BTW using Numeric XORing two arrays is more than four times as fast as this method. a = array.array('I',[0]) * 1000 b = array.array('I','\377\377\377\377') * 1000 # this is the bit I want done faster :) for x in xrange(1000): a[x] = a[x] ^ b[x] Also if you know a way to map one sequence onto another fast, I'd like to know how to do that too :) Thanks for any help. Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From sabren at manifestation.com Sun Feb 13 20:32:38 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 13 Feb 2000 20:32:38 -0500 Subject: Calling Python from C [newbie] References: Message-ID: <887m0h$92f$1@nntp9.atl.mindspring.net> John Goodyear wrote in message ... >I want to call python code from C. I have found lots of examples and the API >reference but cannot find any help on what I need to link to in order to >call the Py_XXX functions. Just about everything is in Python.h in the "include" directory of your (or at least my ) binary installation... -Michal http://www.sabren.com/ From effbot at telia.com Fri Feb 25 03:24:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 25 Feb 2000 08:24:06 GMT Subject: system return status on Windows References: <000c01bf7f31$93a8c6e0$b62d153f@tim> <38B63317.1A0A1C3D@nembv.cz> Message-ID: Milos Prudek wrote: > Tim Peters wrote: > > > > [Milos Prudek > > You could also try os.spawnv or os.spawnve (but those only exist under > > Windows). BTW, don't expect os.popen to work sensibly under Windows either. > > Great, thanks. Could you send something about mode (magic operational > constant) of spawnv? I do not have Visual C++ Runtime Library > documentation... get the eff-bot guide ;-) # os-spawn-example-3.py import os import string if os.name in ("nt", "dos"): exefile = ".exe" else: exefile = "" def spawn(program, *args): try: # possible 1.6 shortcut! return os.spawnvp(program, (program,) + args) except AttributeError: pass try: spawnv = os.spawnv except AttributeError: # assume it's unix pid = os.fork() if not pid: os.execvp(program, (program,) + args) return os.wait()[0] else: # got spawnv but no spawnp: go look for an executable for path in string.split(os.environ["PATH"], os.pathsep): file = os.path.join(path, program) + exefile try: return spawnv(os.P_WAIT, file, (file,) + args) except os.error: pass raise IOError, "cannot find executable" # # try it out! spawn("python", "hello.py") print "goodbye" From bromage at goaway.cc.monash.edu.au Thu Feb 3 19:45:40 2000 From: bromage at goaway.cc.monash.edu.au (Andrew Bromage) Date: 4 Feb 2000 11:45:40 +1100 Subject: Haskell or Python! References: <38994478.72056B85@cui.unige.ch> Message-ID: <87d7fk$41d@goaway.cc.monash.edu.au> G'day all. Sunil Hadap writes: >I am developing an animation system. I was almost convinced that >Python will be the embedded scripting language for the purpose, till I >was introduced to Haskell. Haskell (as of Haskell 98, anyway) has a limitation of its type system in that it does not allow heterogeneous containers. For example, you might have a type class Object which is the class to which all geometric primitives belong: class Object a where -- insert methods here -- instance Object Polygon where -- methods defined for polygons -- instance Object NURBS where -- methods defined for NURBS -- or whatever. You can now create a list (lazy stream?) of Polygons, but you can't make one of Objects. To do this, Haskell would need existential qualtification of types, which is on the wish list, but not yet implemented. I think that this problem more than anything else may rule out Haskell (at the moment, anyway) as your scripting language of choice, but I could be wrong. Your application may not need this. >I am confused which is better language for the purpose. Here are more >specific questions >- Can Haskell be used as interpreted language so that the animator > can code interactively in the animation software Hugs is a Haskell interpreter which may suit your needs: http://www.haskell.org/hugs/ >- Is Haskell matured to provide good support to libraries such as I/O > GUI, network like Python I/O is there. The GUI is a debatable point. The Haskell standard does not directly support any particular GUI model, there are a number of bindings which may help: HOpenGL is a binding to OpenGL and GLUT: http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne/haskell_libs/HOpenGL.html TclHaskell is a binding to Tcl: http://www.dcs.gla.ac.uk/~meurig/TclHaskell/ Fudgets is a toolkit which links directly to X: http://www.cs.chalmers.se/ComputingScience/Research/Functional/Fudgets/ Haggis is one of those too, but requires a concurrent implementation of Haskell to work correctly: http://www.dcs.gla.ac.uk/fp/software/haggis/ As you can see, some degree of support is there >- Can I use traditional OO concepts in Haskell though it is Functional Let's see... - Encapsulation: Yes. Type classes are your friends. Note that there is no support for attributes, but who needs them when you have access methods? - Abstraction: Yes. Modules are your friends. - Inheritance: Yes, sort of. Inherited type classes do most of it, but see the note above on heterogeneous containers which may bite you. - Object identity: Tricky but not insurmountable. Equality (==) in Haskell means _structural_ equality, not object identity, so if two objects are distinct, you have to explicitly make them distinct. >- Is it dynamically typed. No, it's strongly statically typed. > I mean can I get full information of type and > its constituents (members) dynamically. That's a different question. :-) You're asking if Haskell supports run-time type information. The answer is "no", because it would break parametric polymorphism. If you could peek inside a polymorphic variable, it wouldn't be truly polymorphic. The long answer is that you can fake it. Make a type class which has methods which peer inside the type and make everything use that. >- Is it a good idea to mix Python and Haskell Haskell does speak COM, so there's one possibility. I don't think that it speaks CORBA yet. See also: http://www.dcs.gla.ac.uk/fp/software/hdirect/ You have to understand that Haskell was not designed as a scripting language, but as an application programming language. You also have to understand that lazy functional languages haven't been around as long as traditional Von Neumann languages, so they have to understand how well-understood features fit into the new framework before it gets into the language. For further info, see comp.lang.functional. For an interesting piece of research which may or may not have anything to do with your project, see: http://www.research.microsoft.com/~conal/Fran/ Cheers, Andrew Bromage From phd at phd.russ.ru Thu Feb 10 04:44:44 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 10 Feb 2000 09:44:44 +0000 (GMT) Subject: Base64 Decoding In-Reply-To: Message-ID: On Wed, 9 Feb 2000, Victor M. J. Ryden wrote: > I'm trying to use python to decode some e-amil I'm getting which > contain MIME base64 encoded documents. > > I looked at the doc's for the mimetools and base64 modules. I'm confused > because they ask for both an input AND output file name. I can understand > the input, but not the output. There can be several encoded documents in > a single input file, all of which have their respective file names as part > of the encoding prelude. > > Has anyone any experience with this, and do you have any hints? Goto http://sun.med.ru/~phd/Software/Python/misc.html and download extract_mime.tgz. It is a template for programs that can be used to parse MIME e-mails. I used it pretty successfully. There is a shell script for calling the program from /etc/aliases, the very program and brief docs. Closer to you and may be faster mirrors: http://members.xoom.com/phd2/Software/Python/ http://skyscraper.fortunecity.com/unix/797//Software/Python/ Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From mhammond at skippinet.com.au Fri Feb 4 18:14:11 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 04 Feb 2000 23:14:11 GMT Subject: Problem : using ADO in ASP References: <86vjhe$grb$1@nnrp1.deja.com> <38998BC0.2760828B@bellatlantic.net> Message-ID: <73Jm4.1202$k6.2820@news-server.bigpond.net.au> "Steve Holden" wrote in message news:38998BC0.2760828B at bellatlantic.net... > Aaarrrggghhh ... > (, -1) It appears the "Execute" method returns 2 values - the recordset object and some integer. The integer is almost certainly due to one of the params to Execute() being specified as a BYREF. >

(L'gphone', L'ussi', L'ussi') > > I'm now having difficulty understanding why the GetRows method > seems to return COLUMNS! Note also that the script output is > not "inline" as you would expect from its position in the code. GetRows() returns a sequence of rows. Each row contains columns. In the example above, you are looping over each row, and when you print each row you get a tuple of objects - one for each column in the recordset. Hope this helps... Mark. From eugene.kelly at computer.org Mon Feb 28 06:36:38 2000 From: eugene.kelly at computer.org (Eugene Kelly) Date: Mon, 28 Feb 2000 11:36:38 +0000 Subject: Python program examples Message-ID: <38BA5DC6.A83448DF@computer.org> I am looking for neat little examples of Python programs for an intro. programming course I am currently giving to business students. We are working in a MS Windows 98 environment. If you have any examples to hand that you would be willing to share please send them to me directly. Programs should be small i.e. < 100 lines max and < 50 would be best. Thanks in advance, Eugene. From dan at cgsoftware.com Tue Feb 15 23:44:14 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: 15 Feb 2000 23:44:14 -0500 Subject: OT: Celebrating Python In-Reply-To: Dennis Lee Bieber's message of "Tue, 15 Feb 2000 20:26:43 -0800" References: <38A5AAB4.5F56B3A0@digicool.com> <884dhj$l0a$1@nntp6.atl.mindspring.net> <14504.12483.890085.354771@weyr.cnri.reston.va.us> <38A9DAEE.F66E05C6@bellatlantic.net> Message-ID: >>>>> "DLB" == Dennis Lee Bieber writes: DLB> On Tue, 15 Feb 2000 23:03:22 GMT, Steve Holden DLB> declaimed the following in comp.lang.python: >> "Time flies like a banana": description or imperative? >> DLB> You might be missing one option (since there are three ways to DLB> read that old phrase), or it may fall under one of the categories DLB> given... DLB> A command to make some measurement of time for the flies as one DLB> would measure the banana DLB> A reference to "time" "flying" in a manner similar to a banana DLB> flying DLB> A reference to some odd insect species "Time fly" which is DLB> partial to a certain overripe fruit There are actually more ambiguities than that, once you really get into it. Unless you assume Time is really the start of that sentence, and it's not just a random phrase. And you don't want to use a dictionary to see just how many different parts of speech each of those are. Then again, the phrase "John saw Mary" is just as troublesome to parse (Imagine i was john, and murdered people with a specific type of saw, which came to be known as a john saw. Evil, isn't it?) I-have-a-Hidden-Markov-Model-based-part-of-speech-tagger-due-next-tuesday'ly yours, Dan From effbot at telia.com Wed Feb 16 12:19:12 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 16 Feb 2000 17:19:12 GMT Subject: is this a Python bug? References: <88eb8h$pcb$1@news1.tc.umn.edu> Message-ID: Brian Langenberger wrote: > : MZ> Raw strings cannot end with a backslash. > > : They can. But only with an even number of them. > > I'm assuming there's some clever and important reason for this. > But for the life of me I can't figure out what it is. > Could someone enlighten me as to the reason? :) a Python string literal consists of an opening quote, a sequence of escape codes and plain characters, and an ending quote, i.e. open ( escape | character )* close The "r" prefix doesn't change this; Python still parses the string as if it were an ordinary string, but stores it differently. in other words, both "\" and r"\" are parsed as an open quote, followed by an escaped quote, but no closing quote. From danielt3 at gte.net Mon Feb 28 08:24:55 2000 From: danielt3 at gte.net (Daniel T.) Date: Mon, 28 Feb 2000 13:24:55 GMT Subject: I'm sorry, name of instance inside its methods References: Message-ID: In article , adrian lee vega wrote: >actually you're correct, I want the name of the instance >not the name of the class > >> >> > def classname(self): >> > >> > >> > ------------------------------- >> > >> > >>>from hello import * >> > >>>clown = Hello(1) >> > >>>clown.classname() >> > clown >> >> >> hmmm.... looking at that again, "clown" is an instance name, not the >> name of the class.. which do you actually want? class Hello: def __init__( self, name ): self.__name = name def instanceName( self ): return self.__name clown = Hello( "clown" ) print clown.instanceName() Will something like that work? -- When a thing ceases to be a subject of controversy, it ceases to be a subject of interest. -- William Hazlitt From jbauer at rubic.com Thu Feb 10 17:15:27 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Thu, 10 Feb 2000 16:15:27 -0600 Subject: perl chomp equivalent in python? References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> <20000210212121.B8912@stopcontact.palga.uucp> <38A329C7.F67DEAF9@rubic.com> Message-ID: <38A3387F.B35DA0BB@rubic.com> Justin Sheehy wrote: > Jeff Bauer writes: > > Justin Sheehy wrote: > > > > > The need for this is also somewhat doubtful. I have yet > > > to see a real (not contrived) example where string.rstrip() > > > wasn't the right choice for this sort of thing. > > > > In most cases trailing whitespace is probably insignificant, > > but it would be best not to assume this for all circumstances > > (e.g. tab-delimited files). > > If you really feel the need to be more careful, you could do > something like: [snip] Yes, this is similar to what I do. > However, in comparison to the original solution of stripping > a number of characters off without even checking what they are, > string.rstrip() is definitely preferable. I agree that indiscriminate use of truncating end of line chars without checking is not ideal. > As I said before, in every real case I've seen for this > sort of thing, string.rstrip() was the Right Thing to do. > > > I would not want to see string.rstrip() used in library > > modules, since it could result in a loss of data where the > > user might not be expecting whitespace to disappear. > > That's silly. It should be used in any library module where its > behavior (stripping all whitespace from the end of a string) is > desired. In any case where that is not desired, of course it > shouldn't be used. It's just a matter of knowing what your > intentions and specifications are. I was referring to having string.rstrip() used as an idiom to read lines of text files. My reluctance to see it used in this manner in a library module is that the author of a library can't always know how it their library is intended to be used. My non-contrived example of processing tab-delimited files is where use of this idiom would cause problems. > > Of all newgroups, certainly comp.lang.python would be > > sympathetic to this issue. ;-) > > Last time I checked, Python wasn't sensitive to extra > whitespace at the _end_ of a line. You mean like vs. ? <0.2 wink> -Jeff From greg at perceval.be Fri Feb 25 06:09:02 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Fri, 25 Feb 2000 12:09:02 +0100 (CET) Subject: 1000 GUI toolkits In-Reply-To: <894diu$o80$1@news.udel.edu> Message-ID: In reply to the message of Terry Reedy sent on Feb 24 (see below) : PDF not interactive ? Quartz, new graphic layer for the next mac GUI (called aqua), will be a mix of pdf and display postscript. Window will be drawned and animated with postcript / pdf. not interactive ? -- 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 Thu, 24 Feb 2000, Terry Reedy wrote: > Date: Thu, 24 Feb 2000 18:15:03 -0500 > From: Terry Reedy > To: python-list at python.org > Newsgroups: comp.lang.python > Subject: Re: 1000 GUI toolkits > > "Gerrit Holl" wrote in message > > HTML is not designed to be interactive, so HTML should not be used > interactive. > > HUH? pdf is not interactive, HTML is, with links and forms. > Many web sites (take Ebay for instance) are almost completely interactive, > with just a few prewritten pages. > > > If you rewrite Pysol in HTML, you'll get a prize. > > Agreed that fine-grained interaction, such as with games, is a poor > application for HTML. > > Terry J. Reedy > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From sholden at bellatlantic.net Mon Feb 28 01:03:29 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 06:03:29 GMT Subject: Traling junk in string.atof (RE: array constructor) References: <000f01bf8197$0c473020$f0a2143f@tim> <38BA0571.BED84D5@sightreader.com> Message-ID: <38BA0FB2.53B97D62@bellatlantic.net> Kind of "Extraneous crud considered harmful"? regards Steve Ken Seehof wrote: > > I remember reading about a language that generates absolutely no errors of > any kind. Maybe it was called Nobol; I don't remember. The idea is that > a syntax error indicates a failure in the language to provide semantics for a > potentially useful idiom. > > That's not Python. I vote for leaving things like string.atof() the way they > are. > > - Ken > > Tim Peters wrote: > > > [Tom Holroyd] > > > ... > > > While I'm here, string.atof() and float() both barf on "123.45," while the > > > C atof() doesn't. A quick check of the code (stropmodule.c) shows that > > > there is an explicit check for junk at the end of the string. > > > > Right. > > > > > Is there some reason for this besides just being annoying? :-) > > > > Yes, but simply because "123.45," does not match the syntax for "a number". > > The trailing comma may be harmless, or it may indicate your program has > > gotten lost, or that your data has gotten corrupted, or that your data was > > ill-formed to begin with. Python refuses to guess that it makes sense, > > because it has no way to *know*, and guessing "ya, OK" errs in the wrong > > direction (screws *you* the most). Python takes this attitude all over the > > place, btw -- string.atof is just one instance of it. > > > > I'm curious how you ended up with a numeric string with a trailing comma to > > begin with. For example, if you're reading lines of comma-separated values, > > the natural idiom is > > > > numbers = map(float, string.split(line, ",")) > > > > which gets rid of the commas explicitly. > > > > > I vote to remove it. > > > > I'll set up a web page to keep a running tally . > > > > better-careful-coding-than-endless-debugging-ly y'rs - tim -- "If computing ever stops being fun, I'll stop doing it" From effbot at telia.com Fri Feb 18 03:50:57 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 08:50:57 GMT Subject: Killer Apps??? References: <88in6f$evg$1@nntp6.atl.mindspring.net> Message-ID: Aahz Maruch wrote: > >I was wondering if there were any other such killer apps? > > Yes. Zope. you mean Squishdot, don't you? (for some background, see: http://weblogs.userland.com/zopeNewbies/2000/02/15 -- if you don't agree, discuss it over there) From agingeri at prairie.nodak.edu Fri Feb 18 10:15:44 2000 From: agingeri at prairie.nodak.edu (Gingerich) Date: Fri, 18 Feb 2000 09:15:44 -0600 Subject: Problem with Installer Message-ID: <88jnef$3nh$1@news.ndsu.nodak.edu> I can't seem to get Gordon's installer to work for me. When I try to run setuptk.py, I get the following error. >>> Finding TK installation... Analyzing python dependencies of Tkinter c:\python\lib\lib-tk\Tkinter.py analyzing win32api found KERNEL32.dll found USER32.dll found ADVAPI32.dll found SHELL32.dll found OLEAUT32.dll found PyWinTypes15.dll found python15.dll found MSVCRT.dll analyzing PyWinTypes15.dll found KERNEL32.dll found USER32.dll found ADVAPI32.dll found ole32.dll found OLEAUT32.dll found python15.dll found MSVCRT.dll analyzing python15.dll found KERNEL32.dll found USER32.dll found ADVAPI32.dll found WSOCK32.dll found WINMM.dll found MSVCRT.dll analyzing _tkinter found KERNEL32.dll found tcl80.dll found tk80.dll found python15.dll found MSVCRT.dll analyzing tcl80.dll found MSVCRT.dll found KERNEL32.dll found ADVAPI32.dll found USER32.dll analyzing tk80.dll found tcl80.dll found MSVCRT.dll found KERNEL32.dll found USER32.dll found GDI32.dll found comdlg32.dll found binaries in C:\WINDOWS\lib Traceback (innermost last): File "C:\Python\Pythonwin\pywin\framework\scriptutils.py", line 313, in RunScript exec codeObject in __main__.__dict__ File "C:\Python\installer\SetupTK.py", line 62, in ? main() File "C:\Python\installer\SetupTK.py", line 40, in main for fnm in os.listdir(libin): OSError: [Errno 3] No such process If I try to run standalone.py, I get a similiar error, but I also have not had a successful run of setuptk.py which needs to be run first. I have TCL installed in my C:\Python directory, with the paths in my autoexec.bat. I tried 3 Win98 machines and an NT4. All with the exact same error. I have Winall build 1.27 installed with Py 1.52. So what am I doing wrong? From gerrit.holl at pobox.com Mon Feb 14 15:08:49 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 21:08:49 +0100 Subject: Except an exception AND all its subclasses? In-Reply-To: <14504.12696.260789.72063@weyr.cnri.reston.va.us>; from fdrake@acm.org on Mon, Feb 14, 2000 at 11:47:20AM -0500 References: <20000211220612.A7720@stopcontact.palga.uucp> <20000212103039.A755@stopcontact.palga.uucp> <38A5B488.ED170300@bellatlantic.net> <20000212212946.A5932@stopcontact.palga.uucp> <14504.12696.260789.72063@weyr.cnri.reston.va.us> Message-ID: <20000214210849.D3438@stopcontact.palga.uucp> Fred L. Drake, Jr. wrote on 950525240: > > Gerrit Holl writes: > > manual. But, when I read the first chapter of the reference, I got the > > feeling that it was not english and doing lawyer-like. So I gave up. > > Gerrit, > Don't give up. Language references *are* relatively dry, but > there are good reasons they get written as well. Please read it; I > think you know enough about Python by now to make good headway there. OK! Last time I read it it was to dry for me; I don't know whether it was my English, my age or my Python knowledge, but I can read it now. I'm reading it now. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From neelk at brick.cswv.com Tue Feb 8 21:32:09 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 9 Feb 2000 02:32:09 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> Message-ID: Paul Prescod wrote: > > You're right. I didn't really mean to say that either Lisp or Smalltalk > are doomed in the "all development ceases" sense. I meant that they > would never become mainstream languages. > > Weirdo syntaxes also do not help. Python's syntax is a little weird. But > Smalltalk, Lisp and (now) Rebol seem to go out of their way to > antagonize Algol-family-trained programmers. > > If it takes more than fifteen minutes to retrain the eyes from the old > language to the new language, most programmers will never make the jump. > Why would they, when there are already too many languages to learn that > do not demand eyeball retraining? Lisp does what it does for a pretty good reasons; namely, it makes it easier to let programmers extend the language through the syntactic macro facility. Being able to extend the language in sophisticated ways is a *really* powerful feature. For example, when doing matrix computations reordering the operations can save enormous amounts of memory and time; teaching CL to transparently find good multiplication orders for matrices is a straightforward project of a week or so for a single Lisp hacker. The comparable effort in C++ is staggering; look at the Blitz++ libraries for how much work it takes. (And it's not even possible in Java.) The effort to make this available to an infix language is seriously nontrivial; it took the Dylan designers something several years to get right, and they had wizards of the first rank working on the language. And it's still not (yet) as powerful as Common Lisp's macros. (Though it is a match for Scheme's hygienic macros.) So, basically, I don't care if Lisp never becomes "mainstream", if it means giving up what makes Lisp powerful and useful. I'm willing to put in the work it takes to reap the benefits, both intrinsic to the language and of not having to deal with people too lazy to spend 15 minutes retraining their eyes. ;) Neel PS. I like Haskell, and Mercury, and Cecil, too. :) From moshez at math.huji.ac.il Thu Feb 17 14:03:39 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 17 Feb 2000 21:03:39 +0200 (IST) Subject: Where is Imaging.h? In-Reply-To: <14508.11387.761765.788240@weyr.cnri.reston.va.us> Message-ID: On Thu, 17 Feb 2000, Fred L. Drake, Jr. wrote: > Bernhard Herzog writes: > > I think this is a good opportunity to suggest that extension modules > > that users may want to access at the C-level install the relevant header > > files somewhere under Python's standard include directory. I propose to > > put them into an "extensions" subdirectory. > > I think this would be a good idea. There are actually two Python > include directories, one for $prefix and one for $exec_prefix; > extensions would have to "do the right thing" here. > Greg Ward, I presume you've already thought of this and distutils > supports it? ;-) Well, Fred, that is harder then you think. (It shows that you're using Solaris at CNRI). Consider a regular Linux Python user. He installed Python from the .deb (well, okay, I didn't mean regular regular, but the same argument goes for .rpm), so it is in /usr/bin/python. But when he installs, say, PIL from the sources, he wants it in /usr/local/lib/... That is, don't confuse the directory Python was installed in and the directory the users want to install new sparkling Python modules in. always-a-stick-in-the-wheels-of-progress-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From sholden at bellatlantic.net Wed Feb 23 15:30:41 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 20:30:41 GMT Subject: PYTHONPATH on PC References: Message-ID: <38B44374.F914BE93@bellatlantic.net> It's all explained in "site.py" in the library. In practice there is no magic involved, you just create "sitcustomze.py" in your library, and it gets loaded automagically. You may need to run python -v to get error details if you screw up like I did and make stupid syntax errors :-) Good luck. regards Steve Mikael Olofsson wrote: > > On 23-Feb-00 Steve Holden wrote: > > Let's also not forget that this kind of stuff can be put in a > > "sitecustomize" > > module. I use this both to add my personal directories and to remove some > > annoying duplication from the path due to Windows' case-insensitivity: > > > > """Site customization for holdenweb.com - Windows platforms.""" > > > > import sys, string > > > > path = sys.path[:] > > sys.path = [] > > for p in path: > > p=string.lower(p) > > if p not in sys.path: sys.path.append(p) > > > > sys.path.append(r"D:\Steve\Projects\Python") > > That's something I haven't thought about. Thanks. Is this just a module > like any other module, or is there some extra magic involved? > > /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: 23-Feb-00 > Time: 21:22:27 > > This message was sent by XF-Mail. > ----------------------------------------------------------------------- -- "If computing ever stops being fun, I'll stop doing it" From fritz.heinrichmeyer at fernuni-hagen.de Wed Feb 16 03:10:57 2000 From: fritz.heinrichmeyer at fernuni-hagen.de (Fritz Heinrichmeyer) Date: 16 Feb 2000 09:10:57 +0100 Subject: Help! Init Problem after setup... References: <38AA208E.85695302@cup.hp.com> Message-ID: I did the following to move idle to the right place and and use it from everywhere (it relies on the main path being placed in sys.path[1]) : #! /usr/bin/env python import sys sys.path.append(sys.path[1]+'/site-packages/idle') import PyShell PyShell.main() are there more "official" ways? -- Fritz Heinrichmeyer mailto:fritz.heinrichmeyer at fernuni-hagen.de FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany) tel:+49 2331/987-1166 fax:987-355 http://www-es.fernuni-hagen.de/~jfh From jchan at maxvu.com Thu Feb 24 12:15:07 2000 From: jchan at maxvu.com (Jerome Chan) Date: Thu, 24 Feb 2000 17:15:07 GMT Subject: Problems with Demo/sockets/mcast.py Message-ID: I've compiled Python 1.5.2 under both Linux 2.2.5 (Intel) and Linux 2.0.34 (MIPS) and when I run mcast.py I get File "./mcast.py", line 89, in openmcastsock s.setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP, mreq) socket.error: (22, 'Invalid argument') I get the same error if I run it under Windows but with a different error number error: (10055, 'winsock error') Am I doing something wrong? From effbot at telia.com Mon Feb 21 15:13:37 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 21 Feb 2000 20:13:37 GMT Subject: Catching any exception an printing it References: <38B18395.61EA@cs.bham.ac.uk> Message-ID: Stuart Reynolds wrote: > Python allows you to do, > > try: > if a: > raise SomeException() > else: > raise xyz() > except: > print 'There was an error' > > but is it possible to print out the exception if you don't know what > type it is? I'd like the above error message to be more useful, but the > exception raised inside the try block could be anything. Is it possible > to find the last exception raised? inside the except clause, sys.exc_info() returns information about the current exception. for details, see: http://www.python.org/doc/current/lib/module-sys.html to print the full exception traceback (like the interpreter does if you don't catch the exception at all), use the traceback module: http://www.python.org/doc/current/lib/module-traceback.html hope this helps! From rickhigh at aol.com Wed Feb 2 23:43:37 2000 From: rickhigh at aol.com (RICKHIGH) Date: 03 Feb 2000 04:43:37 GMT Subject: Is NetRexx better than JPython? Message-ID: <20000202234337.24799.00000956@ng-ce1.aol.com> Can you explain to the Java community why JPython is the best thing since sliced bread? Then vote http://www1.sys-con.com/forums/Thread.cfm?CFApp=2&Thread_ID=379&mc=25 From scarblac-spamtrap at pino.selwerd.nl Wed Feb 16 12:12:00 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 16 Feb 2000 17:12:00 GMT Subject: Newbie question: Dictionary of lists References: <2F1A38DC0413D311A7310090273AD5278A03A0@dthrexch01> Message-ID: Kossmann, Bill wrote in comp.lang.python: > Trouble is, when I implement my FOR loop as below, *all* of the dictionary's > January elements are updated to the value of the last January item in the > history file. I've searched high and low for a solution, but I'm stumped. This is a problem with references. Remember that *everything* is a reference in Python. > # TEST.PY ============================================================ > > import string > > history = {} > history['DEFAULT'] = [31,29,31,30,31,30,31,31,30,31,30,31] > > # Null elements - one for each month of the year (Jan ... Dec) > nullList = ['', '', '', '', '', '', '', '', '', '', '', ''] > > # Short test file (16000 lines in production) > histFile = open("2000.txt", "r") > for histLine in histFile.readlines(): > histRcd = string.split(histLine, ",") > > # Key is our cost centre code > dictionaryKey = histRcd[0]+histRcd[1]+histRcd[2]+histRcd[3] > > # Null list required to add an element if it's not the first element > if not history.has_key(dictionaryKey): > history[dictionaryKey] = nullList Note: history[dictionaryKey] now points to the same list as nullList. Every key you do this for, history[key] points to that same list. > # Obviously must evaluate for other months, but January will do for testing > if (histRcd[4][:3] == 'JAN'): > history[dictionaryKey][0] = float(string.strip(histRcd[5])) And now you change that list. So now nullList is changed, history[dictionaryKey] is changed, everywhere you point to that list, it's changed. They're all just different names for the same list. [snip rest] Try initializing it with history[dictionaryKey] = nullList[:] The [:] makes a slice that's equal to the whole list - except that it's a *copy* of the list. That way, all the lists are seperate. -- Remco Gerlich, scarblac at pino.selwerd.nl 6:07pm up 85 days, 11 min, 6 users, load average: 0.08, 0.02, 0.01 From moshez at math.huji.ac.il Fri Feb 18 23:55:01 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 19 Feb 2000 06:55:01 +0200 (IST) Subject: inet_ntoa In-Reply-To: <38ADD3FF.F361EAFA@kw.igs.net> Message-ID: On Fri, 18 Feb 2000, JB wrote: > Does anyone know if the inet_ntoa function in "arpa/inet.h" is > implemented in python anywhere. I can't find it in the docs. Or, is > there a similar func in python to convert integral network addresses > into a dotted quad string?? Try the struct module. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From pinard at iro.umontreal.ca Sun Feb 20 12:18:09 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 20 Feb 2000 12:18:09 -0500 Subject: Silly brackets (Was: Re: Problems extending Python with C.) In-Reply-To: "Martin v. Loewis"'s message of "Sun, 20 Feb 2000 11:55:38 +0100" References: <88ne3e$hcs$1@snipp.uninett.no> <200002201055.LAA00737@loewis.home.cs.tu-berlin.de> Message-ID: "Martin v. Loewis" writes: > > I believed, for years, that C compilers should have an option to > > emit warning diagnostics when indentation is not consistent with > > brackets. It is a big waste, in my opinion, that compilers ignore > > all that redundancy, while it could be used to better help > > programmers. > One of the problems is that C uses a preprocessor, which often does funny > things to indentation, making the notion of column number meaningless to > preprocessor output. Combine this with the common approach of implementing > the preprocessor as a separate process, and you'll see that what you > want is very hard to implement. I would not think it is a problem, as #define's all expand into one line, and there is nothing to report about brackets which match on the same line. Could you provide an example of pre-processor breaking user indentation? > That, of course, says nothing whether it would be desirable to have > such a feature. I'm quite certain that you'd get *a lot* of warnings > for most of today's code. Not mine! :-). Many people like to write neatly, you might be surprised. Others do not have to use that feature, if they do not feel like it. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From python-liist at teleo.net Tue Feb 22 03:19:32 2000 From: python-liist at teleo.net (Patrick Phalen) Date: Tue, 22 Feb 2000 00:19:32 -0800 Subject: eqiv of perl's CGI.pm? In-Reply-To: <38B23CD8.8C2DE915@inka.de> References: <38B23CD8.8C2DE915@inka.de> Message-ID: <00022200295401.00839@quadra.teleo.net> [Michael Str?der, on Mon, 21 Feb 2000] :: What exactly does CGI.pm? I have a module cgiforms.py with which you :: can pre-define input fields in a form and output the single input :: fields. The input parameters are checked against reg exp. you define :: with the input field. E.g. my project http://web2ldap.de/ is based :: on that. Your mileage may vary... :: :: Have a look at http://sites.inka.de/ms/python/pylib/. If you're :: interested in using that drop me a note and I will package a newer :: version with demo script. Well, I'm certainly interested; I was getting ready to write something quite similar this week ... so thank you! I'm afraid I may need to invest in a German/English dictionary, however. ;) # Alle Eingaben in inputform auf Gueltigkeit ueberpruefen. # Im Fehlerfall wird eine Ausnahme der Klasse formException generiert # Der Parameter ignoreemptyparams veranla?t das Ignorieren leerer Eingaben. def getparams(self,ignoreemptyparams=0): # Ueberpruefen der gesamten Laenge aller Eingaben if self.contentlength > self.maxcontentlength: raise formContentLengthException(self.contentlength): From cfelling at iae.nl Fri Feb 4 19:19:03 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 5 Feb 2000 01:19:03 +0100 Subject: Readable Functional Languages References: <000401bf6dfc$0ee5f180$822d153f@tim> Message-ID: <87fq9n$1sn$1@vvs.superst.iae.nl> Tim Peters wrote: > So long as you're just out exploring and don't mind making any actual > progress for a while , point your browser to That's fine with me, so Haskell it be:) > http://www.haskell.org/ > I've often noted that Haskell is the most Pythonic of all the languages that well, this is a very promising recommendation. So I downloaded it along with some tutorials and curled up in front of my terminal together with Bird and Wadler's Introduction to Functional Programming for some fun time indeed. > the-first-word-in-functional-is-fun-ly y'rs - tim The really funny part to me is that way back in the 80-ties I was involved in this natural language translation project called Rosetta, and there we implemented the formal functional description of the system into plain Pascal (for speed ofcourse:). It's kinda cute to see all those 'where's and 'lambda's again, but know as a programmer's toy. -- groetjes, carel From just at letterror.com Wed Feb 16 10:30:33 2000 From: just at letterror.com (Just van Rossum) Date: Wed, 16 Feb 2000 16:30:33 +0100 Subject: IDLE in any other GUI. In-Reply-To: <38AAADEB.42C7CBA8@durham.ac.uk> Message-ID: At 2:02 PM +0000 16-02-2000, J.C.Travers wrote: >Is anyone working on or wanting to work on implementing IDLE in a >different gui to TK. Something like QT, which is also cross platform >would be good (i.e. I would much prefer using it, IMHO TK is horrible, >and QT simple and beautiful, and MUCH MUCH easier to code in!). Just a >question, not wanting to start an inter-gui war! When I started building my own IDE for the Mac (which was 2-3 years before Guido started working on Idle), Guido thought it was a shame I wrote in a platform-dependent manner. Although he was right, Tk was definitely not an option for me (it sucked & seems to keep on sucking on the Mac), and I wrote it because *I* needed it. It would've been much more work for me then to factor out the user interface: it was one of my first non-trivial Python apps, I just didn't have the experience. Later, when Guido write Idle, I complained to him that his code was tightly bound to Tk, which I consider a platform also... (Of course he denied this...) It was not easy for me to take advantage of Idle's code in my own IDE. In the meantime, the situations has apparently become better, I believe PythonWin uses some parts of Idle. Some parts of an IDE are hard to factor out: eg. Idle's syntax coloring is neccesarily bound to Tk for performance reasons. I haven't studied the latest Idle sources, so I have no idea what how the amounts of "generic" code and Tk-dependent code relate, but it would be interesting to know. Anyone familiar enough with Idle guts to give a brief summary of what's there? Idle could be a killer app, but I think it has to separate itself from Tk as much as practical to actually become one. Just From effbot at telia.com Wed Feb 23 11:18:52 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 16:18:52 GMT Subject: Which GUI? References: Message-ID: Vetle Roeim wrote: > Tkinter does NOT reinvent the wheel. I can't > understand where this comes from. from deep inside gerrit's head. he's completely lost it. better ignore him, or this thread will go on forever. From tbryan at python.net Mon Feb 21 18:19:51 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 21 Feb 2000 18:19:51 -0500 Subject: Baffling unpack() or read() problem...... References: <38b1c09a.24413312@news.globalnet.co.uk> Message-ID: <38B1C817.EF044566@python.net> Matthew Joyce wrote: > > The code below runs perfectly on Linux on very large files of binary > data. However it believes it's got to the end of the file prematurely > in Windows after reading a variable number of sequences of 16 bytes. > > Why should it work in Linux and not Windows? What am I missing? > rawinfile=open(os.path.abspath("nt.raw"),"r") Isn't the default to open files in text mode? Try rawinfile=open(os.path.abspath("nt.raw"),"rb") From tim_one at email.msn.com Sat Feb 5 03:01:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 5 Feb 2000 03:01:29 -0500 Subject: Circular references and python In-Reply-To: <87e7po$kdr$2@mach.vub.ac.be> Message-ID: <001901bf6faf$359ced60$182d153f@tim> [Tim] > Speed [of gc] isn't the hangup in the Python world. It's much > more ease of porting to new platforms (the amount of time spent > now on porting CPython's gc: 0), and CPython's extraordinary > friendliness to extending and embedding. [Thomas Hamelryck] > Ahem...for some reason I took a look at the DrScheme homepage. Ah: you've read the 4-color glossy brochure and are now suffering consumer envy -- that's effective marketing . > The underlying language MzScheme runs on Windows 95/98/NT, MacOS, and > Unix, Sure, and that's a fraction of the platforms Python runs on, and were ports all done by the system's developers. The typical Python port is done by a "platform fan" with no background whatsoever in language implementation, and no knowledge of Python internals. Ports to bizarre embedded systems have caused real difficulties ("hey, this system has a 1Kb stack!", "hey, this system doesn't have a concept of process!", "hey! this system doesn't have a notion of files!", "hey! this system doesn't have static data!", ...), but modulo those it's usually an easy exercise. One day (early 90's), right after lunch, I started the first port of Python to a 64-bit platform, before I had ever looked at its code -- and finished the same day. IIRC, it turned up two spots where the code implicitly assumed sizeof(int) == sizeof(long), and that was it (some subtler stuff turned up later, but it was by far the easiest port of *any* large C program to the Kendall Square architecture; e.g., the Emacs port took months, and the full Icon port got delayed a whole year (that required subtle platform-dependent assembler to do context switches among coroutines; many implementations of Scheme require similar language + platform expertise to deal with continuations -- I don't know about DrScheme wrt this issue, although the version of that I have installed under Windows (MrEd ver 5.3) often spews cascades of internal error msgs when I use continuations)). Do "oddball" platforms matter? Guido was adamant about supporting DOS & Windows from the start, despite that it earned him some contempt in the Unix(tm) community at the time. Now it's Python's most-used host. Maybe EPOC32 will be a decade from now, or mabye CE, or maybe BeOS, or maybe WinUx or LinDows ... but whatever it is, if it has a malloc, Python will be there a day later. > uses garbage collection and is extendible in C/C++. I took a look at > the extension manual and it seems pretty similar to what is posible > in Python. Not to my eyes. You *can* make your point here, but pick an implementation of Scheme designed for this (e.g., Elk is an excellent one to study). > So maybe something can be learned from looking at a couple of > other (maybe a bit more academic) scripting languages? Of course. Python developers have always stolen the best ideas they could pry out of their competitors' cold, dead fingers . > A couple of moths ago I felt a strange urge to read a 20+ page article > on garbage collection. It discussed various GC techniques, including > reference counting. The general opinion on reference counting seems > to be that it's still a valuable technique for real time systems and > parallel computing. But not for more general use. See the "Garbage Collection" book I posted a reference to yesterday for a much deeper discussion of the tradeoffs. Python uses reference counting for the same reasons Perl does, actually. I'm sure Larry Wall would be delighted to explain it in 30-page detail . "initial-impressions"-are-exactly-that-ly y'rs - tim From emile at fenx.com Mon Feb 14 08:01:39 2000 From: emile at fenx.com (Emile van Sebille) Date: Mon, 14 Feb 2000 05:01:39 -0800 Subject: (no subject) References: <000501bf76e3$da319700$6c00a8c0@ruidovisual.pt> Message-ID: <041001bf76eb$a43b3900$01ffffc0@worldnet.att.net> Pedro, Assuming you've just got a problem with this function in your class, it looks like you need to use the '%' appropriately: def subobj_fs(self,obj): import os lst = os.listdir("/var/spool/news/articles/%s" % obj) return lst HTH, Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Pedro Silva To: Python - Questions Sent: Monday, February 14, 2000 4:05 AM Subject: (no subject) > Hi, > > I have some External Method with this code: > > def subobj_fs(self,obj): > import os,os.path > lst = os.listdir("/var/spool/news/articles/obj") %(obj) > x = len(lst) > return lst > > In my dtml Method, Zope, I call this function like this: > > > > > Then this would call the function in the External Method and list the > directories in var/spool/news/articles/products. > > Is this like this? > > I already tryed to execute this and it gave me and error, Key error. > I've saw it already, but I can't figure where is the error. > > Can anyone help me? > > Please, send your answers to: psilva at ruido-visual.pt > > Thanks, > > Pedro Silva > > > -- > http://www.python.org/mailman/listinfo/python-list > From rob at hooft.net Fri Feb 11 09:39:55 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: 11 Feb 2000 15:39:55 +0100 Subject: Special Interest Group: Import redesign References: <1262439853-442703@hypernet.com> Message-ID: >>>>> "GM" == Gordon McMillan writes: GM> As a result of the Developer's Day session on Import Uitilities, GM> a new SIG (the import-SIG) has been formed. The goal is a new GM> architecture for the import facility in Python. Will this address the O(N**2) problem of locating large numbers of modules in lots of package directories? devel[286]~%% strace ndisp ambi/s01f001.kcd |& grep -c open 2145 devel[287]~%% :-( 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 prudek at nembv.cz Fri Feb 25 09:21:26 2000 From: prudek at nembv.cz (Milos Prudek) Date: Fri, 25 Feb 2000 15:21:26 +0100 Subject: Bring value from walk() References: <1260637200-9073387@hypernet.com> Message-ID: <38B68FE6.35EABD1B@nembv.cz> > You need a mutable object. Making Fs a list with one > element, (initialized to 0), and then totalling into Fs[0] will do > the trick. Thanks for great explanation. This is the final, working code: import os, os.path, stat def EstimSpace(Fs, Dirn, Nams): for X in Nams: Fs[0]=Fs[0]+os.stat(Dirn+'/'+X)[stat.ST_SIZE] return def EstDirSpace(RootDir): Fs=[] Fs.append(0) os.path.walk(RootDir, EstimSpace, Fs) return Fs[0] print "Estimated space is",EstDirSpace('c:/Program Files/Python') Of course, next task will be rounding up the estimate of every file to cluster size of target disk drive... that will be easy. -- Milos Prudek From guido at cnri.reston.va.us Fri Feb 25 09:54:19 2000 From: guido at cnri.reston.va.us (Guido van Rossum) Date: 25 Feb 2000 09:54:19 -0500 Subject: os.path.walk (was: Re: Optimizing code) References: <20000224161930.A4922@stopcontact.palga.uucp> <20000225074854.A1014@stopcontact.palga.uucp> Message-ID: <5lu2ixbaec.fsf@eric.cnri.reston.va.us> Fran?ois Pinard writes: > This has bothered me several times already, in Python. Perl has a device > caching the last `stat' result, quite easy to use, for allowing users to > precisely optimise such cases. In many cases, the user has no reason > to think the file system changed enough, recently, to be worth calling > `stat' again. Of course, one might call `stat' in his code and use the > resulting info block, and this is what I do. But does not interface well > with os.path.walk. > > It would be nice if the Python library was maintaining a little cache for > `stat', and if there was a way for users to interface with it as wanted. Question-- what would happen to code that uses os.path.exists() or one of its friends repeatedly, waiting for a file to appear or disappear? This code would break unless you put a timeout in your little stat cache, which would probably reduce its speed. > By the way, the `find' program has some optimisations to avoid calling > `stat', which yield a very significant speed-up on Unix (I do not know > that these optimisations can be translated to other OS-es, however). > Could os.path.walk use them, if not already? The main trick is to save > the number of links on the `.' entry, knowing that it we have one link > in the including directory, one link for the `.' entry itself, and one > `..' link per sub-directory. Each time we `stat' a sub-directory in the > current one, we decrease the saved count. When it reaches 2, we know > that no directories remain, and so, can spare all remaining `stat' calls. > It even works for the root directory, because the fact that there is no > including directory is compensated by the fact that `..' points to `/'. Yes, that's an old one. I recall a discussion many many years ago on c.l.perl where Tom Christiansen (or was it Larry Wall?) concluded "thus it behooves us to arrange directories so that subdirectories occur first" (or similar words). > I surely often use `os.path.walk' in my own things, so any speed improvement > in that area would be welcome for me. Personally, for me it matters more that the code of walk() is only a few totally portable lines. Using knowledge like described above is nice when you are writing a utility like find that is closely tied to the OS on which it is running; however I can imagine any number of reasons why the above rule might fail (mount points, NFS, Samba, symbolic links, automounter, race conditions). I'm not saying that any of those will make it fail -- it's just impossible to be SURE that they DON'T make it fail. I'd rather have it the right answer tomorrow than the wrong answer today, thank you. (Note that I'm not against doing this in your own code . I'm reluctant to add hacks like this to the standard library -- a bug there multiplies by a million.) --Guido van Rossum (home page: http://www.python.org/~guido/) From pinard at iro.umontreal.ca Fri Feb 11 18:10:17 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 11 Feb 2000 18:10:17 -0500 Subject: Python sucks loud In-Reply-To: "Warren Postma"'s message of "Fri, 11 Feb 2000 16:13:39 -0500" References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> Message-ID: "Warren Postma" writes: > He's gone, right!? Whew. :-) I want to congratulate you all. We behaved the proper way. I'm proud of us! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From info at everythingimport.com Thu Feb 10 01:21:32 2000 From: info at everythingimport.com (info at everythingimport.com) Date: Thu, 10 Feb 2000 06:21:32 GMT Subject: V-Day @ EVERYTHING IMPORT 8036 Message-ID: http://www.everythingimport.com Check out our amazing Valentines Day promotions at Everything Import. Everything you need....everything you want....everything you deserve. http://www.everythingimport.com uvqhhmmmnlezjzpsmdqqcpttmigxothyyyqiwnhpuymmtibfqwwqyiphodvdvyetisvzwlokcskkbfzkwpif From mwh21 at cam.ac.uk Mon Feb 14 14:19:08 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 14 Feb 2000 19:19:08 +0000 Subject: A little present. Message-ID: I hope someone finds this useful. It's a little hack I threw together to save some keystrokes in interactive mode. As such it does very little error checking. I found myself testing a function of two arguments: def t(a,p=...): ... over a range of inputs, so I was typing things like >>> map(t,range(10)) and looking at the result; this was fine until I wanted to put something else in the optional second parameter; my only recourse was to type >>> map(lambda a:t(a,73),range(10)) This jarred sufficiently (and reminded me of other irritating situations in the past) that I cooked up the appended script, allowing me to do this: >>> from papply import X >>> map(X(t,(),73),range(10)) The idea is that after a call to X(func,...) there are a number of `holes' (notated by an empty tuple) in the arglist that can be `filled in' by subsequent calls (to what X returns). This means you can't presupply the empty tuple to func, but I couldn't think of a better way. It's a bit like currying, but more general. I've stuck from papply import X into my ~/.pythonrc, and I think I'll find it handy. I hope you do too. Cheers, Michael --- papply.py starts here --- class X: def __init__(self,func,*args): self.func = func self.args = [] self.mapping = {} hole = 0 for i in range(len(args)): if args[i] == (): self.args.append( None ) self.mapping[hole] = i hole = hole + 1 else: self.args.append( args[i] ) def __call__(self,*args): realargs = self.args[:] for i in range(len(args)): realargs[self.mapping[i]] = args[i] return apply(self.func,realargs) From aa8vb at yahoo.com Tue Feb 1 14:31:38 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Tue, 1 Feb 2000 14:31:38 -0500 Subject: Python & EPIPE: Handling Chg Proposal Message-ID: <20000201143138.A1126310@vislab.epa.gov> The gist of the problem is that any program which writes to stdout or stderr really needs to handle EPIPE to avoid tripping python error tracebacks, and doing so is non-trivial and obfuscates otherwise-simple Python code. Basically, this is buggy Python code: python -c "for i in xrange(100000): print 'Lots of output'" | head The attached script demonstrates EPIPE handling in detail. Run as: broken_pipe.py | head ============================================================================== PROPOSAL: Add an "epipe_error" attribute to the file object. It would determine whether EPIPE errors from read()/write() calls generate SystemExit or IOError exceptions. ============================================================================== By default EPIPEs received from the stdin/out/err files would generate SystemExit exceptions (epipe_error = 0). All other files would default to IOError exceptions (epipe_error = 1). Comments? -- Randall Hopper aa8vb at yahoo.com -------------- next part -------------- #!/usr/bin/env python """ ------------------------------------------------------------------------------ broken_pipe.py - Demonstrate how EPIPE handling really convolutes Python code. (R. Hopper, 2/2000) The jist of it is this: python -c "for i in xrange(100000): print 'Lots of output'" | more This is buggy Python code. Why? Because any normal write() connected to stdout can generate EPIPE, which Python turns into an IOError exception, which materializes as a Python exception dump and error message on termination. Substitute 'more' with your favorite pager ('head', etc.). Quit the pager after the first screenful appears to make the program fail. What about using xrange(10000), or xrange(100)? Depends on the OS buffer sizes. So with the current EPIPE handling in Python , the only correct solution is for every program that writes to stdout (or stderr) to handle IOError exceptions for EPIPE explicitly. However, special-handling EPIPE IOErrors specifically really convolutes otherwise simple Python code: ------------------------------------------------------------------------------ """ import sys, string, errno def write_a_rec(): print '' def write_recs(): for i in xrange(100000): #-------------------------------------------------------------------------- # In write_a_rec(), we could do some things that may generate different # exceptions. Among them, IOErrors, and among those EPIPE errors # specifically. Special-handling EPIPE is a real pain. #-------------------------------------------------------------------------- # So we can't just call this method. Unprotected stdout/err write()s # to stdout and stderr can produce errors. ## write_a_rec() # We have to special-handle EPIPE IOErrors from write()s to stdout/err, but # we want to preserve all the other exceptions. # # To avoid duplicating exception cleanup code, we use a nested try. # This would be unnecessary if we could snag just EPIPE IOErrors with # an except clause. try: try: write_a_rec() except IOError, x: if x.errno == errno.EPIPE: sys.stderr.write( "\nHandling EPIPE...exiting quietly.\n" " (Normally, nothing would be printed.)" "\n\n" ) sys.exit(1) else: raise except: # Do raise # # MAIN # write_recs() """ ------------------------------------------------------------------------------ Possible Solutions: 1) Have Python not print a traceback and error if EPIPE IOErrors propagate up to the top stack level (what if this is a socket though; then you want the error). Bad idea. 2) Throw a separate exception for EPIPE (IOErrorEPIPE?) so you don't have to do double-try's to process them. (No, breaks existing code, and still demands EPIPE handling for all programs that write more than a few lines to stdout/stderr. => 3) Have a file descriptor attribute (such as "epipe_error") that selectively sets whether receiving EPIPE is turned into an IOError or a SystemExit if it propagates up to the top stack level. In other words, chose per file descriptor, whether EPIPE should be a hard error or not. stdout/stderr's default could be "no", while for all other files, the default would be "yes". Alternatively, the flag could designate whether SystemExit or IOError is thrown to start with. ------------------------------------------------------------------------------ """ From robin at alldunn.com Tue Feb 15 01:34:56 2000 From: robin at alldunn.com (Robin Dunn) Date: Mon, 14 Feb 2000 22:34:56 -0800 Subject: BSDDB copyright and licensing restrictions while in use via Python References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: > So here's my dilemma: > > I have a commercial application into which I want to embed the Python > interpreter (fine, no problem so far). The standard Python distribution > comes with the bsddb.pyd binary which is a plug in containing a compiled > version of the db1.8.5 source code. Since Python is available for free, and > is open source, and it can be redistributed freely, then can I do this? > > Has the db1.8.5 source code a more liberal license than the 2.0 code from > Sleepycat? > You can use 2.0 freely from Python, as long as the BSDDB extension module is Open Source. See http://www.sleepycat.com/faq.html#A22 My BSDDB extension module (http://starship.python.net/crew/robind/) is Open Source so there are no legal issues for you. -- Robin Dunn Software Craftsman robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! From mhammond at skippinet.com.au Tue Feb 22 20:57:22 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 23 Feb 2000 01:57:22 GMT Subject: msvcrt, open_osfhandle, locking References: Message-ID: <68Hs4.1435$LX4.4374@news-server.bigpond.net.au> "Roger Baklund" wrote in message news:F4Es4.5221$kz6.98036 at news1.online.no... > Mark Hammond wrote in message > news:d_Ds4.1368$LX4.4097 at news-server.bigpond.net.au... > > file handle. The locking module works directly with file object - no > > locking module...? Oops - meant "locking function in msvcrt module" Mark. From dfavor at austin.ibm.com Fri Feb 18 08:29:01 2000 From: dfavor at austin.ibm.com (David R. Favor) Date: Fri, 18 Feb 2000 07:29:01 -0600 Subject: name-spaces and loading a file References: Message-ID: <38AD491D.2265D93B@austin.ibm.com> Moshe Zadka wrote: > > On Fri, 18 Feb 2000, David R. Favor wrote: > > > I am very new to python. > > > > Can you elaborate on this point. It sounds like it might work for an > > application I'm working on. > > > > Specifically, in the case of: > > > > exec 'from scenes.' + scene + ' import *' > > > > Do you mean that within each $scene class all methods pass a dictionary > > as one of the arguments in method calls? > > You do know $ is invalid in Python except inside strings, don't you? Yes. Simply meant as a place holder. > Anyway, my basic reponse to anyone using exec, especially using exec where > he would step on all kind of global variables is "don't!". Why not do > > module=__import__('scenes.'+scene) I see. > And access those variables you need from module? It's much more > predictable. Actually, even __import__ troubles me: usually, my solution > is to pickle dictionaries for this purpose. So rather than having classes, keep a collection of persistent dictionaries that represent each scene and simply load and unload as needed? That would open other possibilities for optizations also, such as when a scene is entered, all the ajoining scences could be background loaded in a thread so that moving from one scene to another would be instantaneous (no lag for reading the scenes from disk every time movement was made from one scene to another). Nice. Thanks. > better-safe-then-sorry-ly y'rs, Z. :-) From daniels at mindspring.com Sat Feb 12 22:44:11 2000 From: daniels at mindspring.com (Alan Daniels) Date: 13 Feb 2000 03:44:11 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> Message-ID: On Sat, 12 Feb 2000 17:11:22 -0500, the infinitely wise osorronophris osorronophris (deathbed_tech at usa.net) spoke forth to us, saying... >I'm a die-hard C++ programmer that recently took up Python for a change of >scenery and am enjoying it greatly. The one problem I am having is that I >can't break myself of the semicolon habit. I've tried chewing gum but it >just doesn't seem to work, and I'd like to avoid the patch. Any ideas? If you're working with a text editor that has syntax highlighting, and it lets you customize that highlighting with regular expressions, just add an extra expression to flag a trailing semi-colon as a warning. For example, in VIM, I've added these lines to the python.vim file that controls its highlighting: syn match pySyntaxWarning ";\s*$" ... hi link pySyntaxWarning Error On the off chance that you use VIM also, take a look at: http://www.mindspring.com/~daniels/vim/python.vim E-mail me if you have any questions. -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From sandra.plahl at desys.de Mon Feb 14 02:52:02 2000 From: sandra.plahl at desys.de (Sandra Plahl) Date: Mon, 14 Feb 2000 08:52:02 +0100 Subject: socket troubles References: <38A79F05.2C2F25B5@cs.csubak.edu> Message-ID: <38A7B422.B1DF66FC@desys.de> Sean Conley wrote: > > This problem has me completely stumped. I am trying to write a telnet > client (actually a mud client) in Python. The problem is that I can > connect and read information from the socket, but nothing seems to > happen when I send to the socket. I believe it may be a problem with my > program, as I had the same problem with Perl/Tk and was unable to solve > it there either. So, if anyone has ANY idea why this could be please > email me or post here. Forgive any horrible syntax as this is my first > attempt at a python program and I am just trying to get the skeleton, > and the most important part of the program working before I start > cleaning it up. Anyhow, here is the code: > > #!/usr/bin/python > > from Tkinter import * > from _tkinter import * > from socket import * > from string import * > from re import * > > #************************* > #*** Get input from the socket and post it to the screen > #************************* > def readsock(*args): > data = s.recv(80) > > #*** Telnet arbitration stuff here > if compile(chr(255)).search(data): > print "IAC\n" > > textbox.config(state="normal") > textbox.insert(index="insert", chars=data) > textbox.see(index='end') > textbox.config(state="disabled") > > #************************* > #*** Write to the socket > #************************* > def writesock(*args): > global contents > info = contents.get() > s.send(info) > > #************************* > #*** Declare some variables > #************************* > HOST = 'shwaine.mudservices.com' > PORT = 3000 > > #************************* > #*** Set up what it looks like > #************************* > root = Tk() > > outputscroll = Scrollbar(root) > textbox = Text(root) > inputbox = Entry(root) > > outputscroll.config(command=textbox.yview) > textbox.config(yscrollcommand=outputscroll, state="disabled") > > contents = StringVar() > inputbox["textvariable"] = contents > > inputbox.bind(sequence="", func=writesock) > > inputbox.pack(side="bottom", fill="x") > outputscroll.pack(side="right", fill="y") > textbox.pack(expand=1, fill="both") > > s = socket(AF_INET, SOCK_STREAM) > s.connect(HOST, PORT) > > createfilehandler(s, READABLE, readsock) > > mainloop() I wonder how you could ever read from the socket when you never could send??? I don't know if you have one but thats what you need is s second application (server), which is reading your send and reply on it. The answer then can be read from your first application (client). In the server try something like this: (its a socket skeleton from a daemon process) import socket, sys, errno ..... ..... serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) serversocket.bind((HOST, PORT)) serversocket.listen(5) while(1): clientsocket = None done = 0 while not done: try: (clientsocket, address) = serversocket.accept() except socket.error, args: if args[0] != errno.EINTR: raise else: done = 1 cpid = os.fork() if not cpid: serversocket.close() data = clientsocket.recv(80) # Here you can do what you want with the send data # Maybe send it back clientsocket.send(data) clientsocket.close() data = None sys.exit(0) else: clientsocket.close() Sandra From tbryan at python.net Sat Feb 12 08:02:16 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Sat, 12 Feb 2000 08:02:16 -0500 Subject: Parnassus mirror? References: Message-ID: <38A559D8.85711AD7@python.net> Mike Fletcher wrote: [...regarding a Parnassus mirror at Sourceforge...] > Hmm, they give you an ftp directory ;) . Who knows, we could dump a few > hundred megabytes of Python modules on them and say it's all Parnassus'. > Add a decent auto-make and configure system and you could have a CPyAN :) . Why not? There's already a CPAN mirror there: http://perl.sourceforge.net The project would just need a sponsor (that is, a project creator and one or more project admins). I would do it, but I'm already behind with some other projects...including ones at work. :) I'm also hoping that *someone* starts working on Trove again. I-read-CPyAN-as-CPAIN-at-first-ly yours ---Tom From sholden at bellatlantic.net Tue Feb 8 23:46:44 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 09 Feb 2000 04:46:44 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> Message-ID: <38A0F150.9F382958@bellatlantic.net> Neel Krishnaswami wrote: > > Paul Prescod wrote: > > > > Not a chance. Smalltalk is doomed for the same reason Lisp is doomed. > > Smalltalk programmers think that their way of doing things is so much > > better than everybody else's that the whole world should reorganize > > themselves around the language. > > Er, you *do* realize that people have been saying this about Lisp for > pretty much its whole existence? > > Neel The same people have been predicting the downfall of the mainframe. They just don't realise that hammer manufacturers are VERY goos at recognising new nails ... regards Steve -- "If computing ever stops being fun, I'll stop doing it" From hanche at math.ntnu.no Mon Feb 14 19:38:16 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 14 Feb 2000 19:38:16 -0500 Subject: A little present. References: Message-ID: + Michael Hudson : | >>> from papply import X | >>> map(X(t,(),73),range(10)) | | The idea is that after a call to X(func,...) there are a number of | `holes' (notated by an empty tuple) in the arglist that can be `filled | in' by subsequent calls (to what X returns). This means you can't | presupply the empty tuple to func, but I couldn't think of a better | way. | | It's a bit like currying, but more general. Useful, but a bit complicated methinks. I recently cooked up this somewhat simpler class, to solve a commonly occuring variant of your problem: class preapply: '"Apply" a function to too few args, returning a function.' def __init__(self, proc, *args): self.args = args self.proc = proc self.ignore = 0 def ignoring(self, ignore): 'Make this class, when called, ignore this many initial args' self.ignore = ignore return self def __call__(self, *args): apply(self.proc, self.args + args[self.ignore:]) I particularly like the option of binding preapply(f).ignoring(1) to a Tkinter event, for all those cases when f has no need of the event parameter itself. (No, I am not proud of the docstrings.) or-maybe-I-should-have-named-the-class-Schoenfinkel-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 bparsia at email.unc.edu Tue Feb 8 07:39:49 2000 From: bparsia at email.unc.edu (Bijan Parsia) Date: Tue, 8 Feb 2000 07:39:49 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> Message-ID: <1e5oa81.qnqn4v1twz68dN%bparsia@email.unc.edu> Thomas Hamelryck wrote: > Paul Prescod wrote: > : While you are promoting Ruby, also consider Corbascript, Pike, Lua, > : Guile and Squeak. You'd better cover your bases! > > Python is certainly a very powerfull language with many virtues, but I > also think that its popularity at least partly is due to the "butterly > flapping its wing effect". This is true for almost any language for that > matter (take e.g. C++ and objective C). You mention Squeak. If Squeak > continues to mature I think it will be a formidable competitor for python. > At the moment, it lacks the huge amount of modules that are available for > python (which is one the most attractive features of the language). Darn, you're right! We Squeakers better get to work on those modules...oh, yeah, Squeak doens't have a module facility (yet) :) But seriously, the *size* of the Squeak base is rather large. The biggest reasons for not using it as a drop in replacement for Python or Perl is that 1) it's not *structured* to be a drop in replacement for Python or Perl, and 2) the *content* of it's class library doesn't (yet) cover a lot of things that people use Python and Perl for (especially on the *nix size of things). One large advantage that both Perl and Python have is that they fit in well with a fairly common mindset that stems from certain set programming/working environments. This is more or less explicit in their designs. Squeak and Smalltalk are not a smooth fit for that mindset, so really mastering them typically requires a shift in deeply held habits. I think this is generally true for Lisps as well. Cheers, Bijan Parsia. From guido at cnri.reston.va.us Fri Feb 25 09:59:29 2000 From: guido at cnri.reston.va.us (Guido van Rossum) Date: 25 Feb 2000 09:59:29 -0500 Subject: More IIS crashing and blank .asp pages References: <81DD38F43381D111BA3E00A076A0998A459F59@XENON> Message-ID: <5lr9e1ba5q.fsf@eric.cnri.reston.va.us> Jason Nadler writes: > OK, I thought I fixed the crashing bug by stepping up to the newest Python > language version (as well as the win32 extensions). > Now, my server is spitting out blank .asp pages for those which use python. I wonder if this could be related to a bug that was recently discussed on the win32 registered users list? It turned out that some process generating .py and .pyc files for COM usage was so fast that the second time the .py file was written, it has the same timestamp as the first time; this caused the .pyc file not to be written. Since the first .py version didn't have any code in it, the .pyc file was pretty minimal. Solution was to delete the .pyc files... --Guido van Rossum (home page: http://www.python.org/~guido/) From aahz at netcom.com Fri Feb 18 00:59:18 2000 From: aahz at netcom.com (Aahz Maruch) Date: 18 Feb 2000 05:59:18 GMT Subject: name-spaces and loading a file References: <8766vn2ijn.fsf@curious.eyeofdog.com> Message-ID: <88in3m$r0f$1@nntp6.atl.mindspring.net> In article <8766vn2ijn.fsf at curious.eyeofdog.com>, Alex Shinn wrote: > >exec 'scene.' + var > >which only works for variables known by the main engine ahead of >time... it doesn't let the story author declare a new global in one >scene to be accessed by other scenes. Any time someone starts talking about needing to access variables with non-predefined names, my first question is always: why not just create a dictionary and pass it around? That way, each module contains a class that gets passed a reference to this dict at __init__; because it's a *reference*, all the instances see changes to the dict. (I'll admit that I tend to deep-end on using dicts when they're not always the best solution, but I think that's better than the reverse problem. To rephrase the Timbot's great advice: "Dicts are a honking great idea, let's use more of them!") -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From aahz at netcom.com Thu Feb 10 17:19:55 2000 From: aahz at netcom.com (Aahz Maruch) Date: 10 Feb 2000 22:19:55 GMT Subject: perl chomp equivalent in python? References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> <38A329C7.F67DEAF9@rubic.com> Message-ID: <87vdib$ig6$1@nntp6.atl.mindspring.net> In article , Justin Sheehy wrote: > >Last time I checked, Python wasn't sensitive to extra whitespace at >the _end_ of a line. Untrue. Like almost every other language with a continuation character (usually "\"), whitespace after the continuation character causes an error. Granted, string.rstrip() will produce the *desired* behavior in this case ;-), but I think it's still relevant that Python *is* whitespace sensitive. -- --- 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 Nostalgia just ain't what it used to be From piet at cs.uu.nl Sun Feb 6 11:51:10 2000 From: piet at cs.uu.nl (Piet van Oostrum) Date: 06 Feb 2000 17:51:10 +0100 Subject: An FTP based Python Module repository (was Re: Imagemagick) References: <20000129201210.A4953@stopcontact.palga.uucp> <20000131161646.A959@stopcontact.palga.uucp> <14491.4735.38605.328866@beluga.mojam.com> Message-ID: >>>>> chris patti (cp) writes: cp> Skip Montanaro writes: chris> One of the reasons for CPAN's success in the Perl world is that, chris> simply, it's an FTP archive. >> chris> Thus, people can and do mirror it. This creates a multi-site, chris> persistent cache of the entire library, so when the one site where chris> module Frobnitz.pm comes from goes down, the world doesn't suffer. >> >> Why couldn't a CPAN-like thing be a web site? Web sites can (and are) >> mirrored all the time. >> cp> There's no reason why it couldn't be, actually. Mirroring is best done by rsync, anyway. In that case it doesn't matter what method is used for user access. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: Piet.van.Oostrum at gironet.nl From stevie_deja at my-deja.com Wed Feb 9 13:26:41 2000 From: stevie_deja at my-deja.com (stevie_deja at my-deja.com) Date: Wed, 09 Feb 2000 18:26:41 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> Message-ID: <87sbgq$nga$1@nnrp1.deja.com> > > yet another case of mostly anonymous my-deja > posters asking (and in this case answering) a > strange question. > > who's behind this secret conspiracy? > > qopp- at my-deja.com: performance issues between scripting languages in asp > pages > daryl_stult- at my-deja.com: win32security, client privleges > stevie_dej- at my-deja.com: pickling parent > thucdat114- at my-deja.com: corel + borland = the end of MS win > fcahoo- at my-deja.com: whitespace as syntax > jeremiahroger- at my-deja.com: nonlinear programming? > eschen4- at my-deja.com: how to lock Zope-shared file with DAV E > > "Erase your 95/98/NT, install Linux now. > Bright future for everything." > > (hmm. is it just me, or is it a trend in there...) Typically you are dealing with people coming from other languages. I am sorry that you cannot handle people asking if something is in Python. what is the fear of you say 'no, we don't have that either' a problem for you. Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Thu Feb 10 14:16:49 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 19:16:49 GMT Subject: PIL References: <38A25966.5737A2B0@kw.igs.net> Message-ID: JB wrote: > Would anyone know if there is a way to get PIL to build without having > tcl, Tk and X11 installed? quoting the README: copy the "Setup.in" file to "Setup" and edit it according to the instructions in the file. quoting the Setup.in file: 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). > If not, are there any other image manipulation pkgs for python that don't > need all this... uh... support?? glad you liked it. From amused at webamused.com Thu Feb 10 05:02:16 2000 From: amused at webamused.com (Joshua Macy) Date: Thu, 10 Feb 2000 10:02:16 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <87sk1p$o5h$1@nntp6.atl.mindspring.net> <1e5r2o4.14puk8l1i1mb9N%bparsia@email.unc.edu> Message-ID: <38A28A4A.AF5207B8@webamused.com> Bijan Parsia wrote: > > Aahz Maruch wrote: > > > In article <38A19E79.5E88D2FC at prescod.net>, > > Paul Prescod wrote: > > > ... snip what Paul wrote in toto ... > > > > I'll say. I went there to further my self-education only to find that > > the official FAQ is only available in PDF and Postscript. > > It's not official. It's *an* FAQ. There are several. FAQs in general are > services to the community. Plus, with a little searching, you can find > HTML ones. > > I'd dearly love to say something snarky about someone trying to > "further" their "self education" who 1) can't make it any further than > that, and 2) instead of asking someone for aid gets all huffy and posts > derogatory comments. But, I shan't :) > > > They had the > > nerve to suggest that people wishing to post on the newsgroups read the > > FAQ first. > > As is standard. Standard *netiquette*. And plain good sense. > > I'm done. > I'd just like to point out that here you're responding to what Aahz wrote as a reductio ad absurdam to Paul's comments as if Paul had written it, which isn't really fair. Joshua From gmcm at hypernet.com Tue Feb 22 14:00:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 22 Feb 2000 14:00:18 -0500 Subject: Using IDLE or PythonWin and TkInter In-Reply-To: Message-ID: <1260876475-6142791@hypernet.com> Anders M Eriksson writes: > > I'm just beginning to try out Tkinter as a GUI and I have some > problems using it together with IDLE or PythonWin(128) > > I have copied example 2 from Fredrik Lundh's "An Introduction to > Tkinter". when I run it this happens: > > Using PythonWin: PythonWin hangs or crashes! > > Using IDLE: The hello2 app runs but when I click on the QUIT button is > also closes IDLE.. > > Both behaviour is irretating and my question is: Can I do anything > about this or?? As I posted this morning: Every GUI has an app message queue and a mainloop. Trying to have more than one of each in one process is similar to letting one 3 year old work the steering wheel while his friend works the pedals. - Gordon From robin at jessikat.demon.co.uk Wed Feb 16 19:07:19 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Thu, 17 Feb 2000 00:07:19 +0000 Subject: PROPOSAL: fix tabs & spaces in default library References: <20000213201812.A4849@stopcontact.palga.uucp> <38AB1830.3FEE1EC7@earthlink.net> Message-ID: In article <38AB1830.3FEE1EC7 at earthlink.net>, Charles Hixson writes I feel tab equivalent to 4 spaces is pretty good -- Robin Becker From dworkin at ccs.neu.edu Tue Feb 29 13:28:25 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 29 Feb 2000 13:28:25 -0500 Subject: (Easy ??) question about class definition In-Reply-To: Gregoire Welraeds's message of "Tue, 29 Feb 2000 18:13:37 +0100 (CET)" References: Message-ID: Gregoire Welraeds writes: > class entry: > def __init__(self, name, action): > self.name= name > self.action= action > def selected(): > exec(self.action) Just change the last quoted line here from: exec(self.action) to self.action() -Justin From skip at mojam.com Tue Feb 22 16:01:07 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 22 Feb 2000 15:01:07 -0600 (CST) Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <38B2E76D.7DEF295C@roguewave.com> References: <1260876476-6142700@hypernet.com> <38B2E76D.7DEF295C@roguewave.com> Message-ID: <14514.63763.141630.740350@beluga.mojam.com> bjorn> Exactly. Strings can't possibly know enough about all possible bjorn> sequence types, including user defined ones, to make this bjorn> efficient. Why not? All "xyz".join needs to know is how to index into a sequence with __getitem__ using an ever increasing integer series that begins at 0... bjorn> Which is (a) a good argument for implementing join in the bjorn> sequence types, since there are much more than *two* sequence bjorn> types and (b) suggests that we really need a common base bjorn> class for the sequence types to share common functionality bjorn> (Python is an OO language after all...) All sequence types know about __getitem__ (otherwise they wouldn't be sequences). Conversely, you are asking that all sequences know enough about strings (and eventually Unicode) to perform join, *and* you're asking the same algorithm to be replicated in all sequences. (Will a join method eventually be required for an object to be considered a sequence?) bjorn> Conversely, to you really think that both string classes should bjorn> know how to efficiently join all possible sequence types? Again, knowing how to count using integers and call __getitem__ is all that is required. bjorn> sometimes implementing join as a series of concatenations does bjorn> work, and is much easer than trying to implement __getitem__. If it doesn't implement __getitem__, I don't think you can honestly call it a sequence... Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From effbot at telia.com Thu Feb 17 12:47:34 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 17:47:34 GMT Subject: Which GUI? References: Message-ID: Anders M Eriksson wrote: > As a new comer to Python I have not yet started programming apps that > has a GUI. I have concentrated my efforts on CGI. > > But now I'm reaching the point of no return and I need to create apps > with a GUI, but which one? > > I'm using Windows NT as my development platform and at the moment my > apps will probably not be interesting enough for anyone else, but... > > I would like pro and cons for the different GUI's http://starbase.neosoft.com/~claird/comp.lang.python/python_GUI.html for more info on Tkinter, see: http://www.python.org/topics/tkinter/ http://www.pythonware.com/library/tkinter/introduction [1] 1) latest draft is here: http://w1.132.telia.com/~u13208596/tkintrobook From aahz at netcom.com Wed Feb 23 01:07:47 2000 From: aahz at netcom.com (Aahz Maruch) Date: 23 Feb 2000 06:07:47 GMT Subject: Comparing perl and python References: Message-ID: <88vtfj$egl$1@nntp6.atl.mindspring.net> In article , Tim Roberts wrote: > >It's clear that there is a substantial library of modules for python, >approaching that of perl. However, I am disturbed by what seems to be a >dramatic performance difference. I've tried writing some simple test cases >in both languages, and I'm finding python to be 2x, 3x, and in one case 12x >slower than the equivalent program in perl. (The 12x case was a simple >"grep the files in stdin", using the "re" and "multifile" modules in >python.) In raw speed, Perl tends to run about twice as fast for the most "obvious" way to do things. This advantage spreads to 5x or 10x when you talk about the "obvious" way to do certain kinds of I/O. The advantage diminishes rapidly when you compare the code of expert programmers, and it mostly vanishes when you start looking at real, complex programs. Main reason for that is that Python code is so much easier to write, you spend more time looking at the algorithms -- that's where you get your order of magnitude increases in performance. Remember that Perl is optimized to be a "super AWK". And IMO, that's about all it's good for. -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From pinard at iro.umontreal.ca Sun Feb 27 09:51:06 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 27 Feb 2000 09:51:06 -0500 Subject: Q about tail recursion In-Reply-To: Robin Becker's message of "Sun, 27 Feb 2000 10:48:49 +0000" References: <000801bf8105$18b99ba0$172d153f@tim> Message-ID: Robin Becker writes: > I quite often want to use None as an exceptional return eg in the case of a > list returning function [] might be a legal return and None an illegal one. Yes, `None' is a Python natural for a "missing" result, and there are many cases where such are usefully represented and handled. > That way I can leave the error handling to the caller. I guess I should > really be raising an exception though to be truly pythonian. That might become too heavy (and probably slow), as "missing" is ubiquitous when handling statistical or experimental data, for example. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From gchiaramonte at ibl.bm Fri Feb 11 07:20:01 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Fri, 11 Feb 2000 08:20:01 -0400 Subject: Off Topic Posts In-Reply-To: Message-ID: All good points. I have several filters in place already, but many messages still slip through. I am suggesting that python-list be split into 2 lists. One for specific python programming questions, and another list for python language opinions and comments. Anyone agree with me? Gene > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Harald Hanche-Olsen > Sent: Thursday, February 10, 2000 10:55 PM > To: python-list at python.org > Subject: Re: Off Topic Posts > > > + "Gene Chiaramonte" : > > | Please stop the madness! I can't take it anymore. > > Neither can I. Time to learn about killfiles. You can let your > newsreader filter out (some of) the stuff you don't want, you know. > > | Can the admins of this list please setup another newsgroup for posts > | regarding python language opinions? > > That is not how usenet works. There is a formal procedure for the > creation of newsgroups: You issue a Request for Discussion in the > right fora, there is a discussion period, then a vote, and if the > motion passes, the newsgroup is created. > > The exception is the alt.* hierarchy, where anybody can create groups > to their heart's content. > > | Lets keep this list for people who need help USING PYTHON to solve > | real problems. [...] I worry that the constantly increasing number > | of off topic opinion type posts here has gone above a reasonable > | threshold. > > Well, the problem is that discussions on the strengths and weaknesses > of Python is very much an on-topic discussion, as long as we haven't > split the group. The problem with the whitespace thread is not that > it's off-topic, but that it goes on for too long, with the same old > arguments being repeated ad nauseam. This kind of thing happens > regularly on all newsgroups, though more rarely here than elsewhere. > Learn to endure it, or better yet to filter it out. > > | Enough already! If it's not a Python question, don't waste your time > | sending it in the first place. > > Personally, I have enjoyed many posts here comparing Python with other > languages like Haskell, Common Lisp, Smalltalk etc. I would hate to > see such discussion banished from the newsgroup. > > yes-I-like-Lisp-too-ly y'rs, > -- > * Harald Hanche-Olsen > - "There arises from a bad and unapt formation of words > a wonderful obstruction to the mind." - Francis Bacon > -- > http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Thu Feb 17 18:14:41 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 23:14:41 GMT Subject: Overloading = References: <88htqk$rb5$1@nnrp1.deja.com> Message-ID: wrote: I have a class, rclass. It has an attribute value. Can I arrange > so that the string > r1=r2 > sets r1.value to equal r2.value (where r1 and r2 are class instances, > of course) without changing anything else about r1? I'm willing to > test, say, that r1.classtype==r2.classtype or something, first to make > sure the assignment is sensible. no. > And if so, can I also have r1=7 set r1.value to be 7? no. ... the assignment statement binds names to objects, in the current namespace. the objects themselves aren't involved in this. assignment to container elements is another story -- it's syntactical sugar for calls to setattr/setitem/setslice. ... > I want to have a box in a GUI where users can enter code, such as > assignments, and I'd like to avoid the reference to the underlying > attribute. you could perhaps evaluate that code in a custom name- space (using the locals/globals argument to exec/eval), and move data to and from attributes based on changes in that namespace. d = {} for k, v in myobjects.items(): d[k] = v.value exec code in d for k, v in d.items(): try: myobjects[k].value = v except KeyError: raise NameError, k From sabren at manifestation.com Tue Feb 22 21:15:50 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Tue, 22 Feb 2000 21:15:50 -0500 (EST) Subject: whiteSpaceEatingNanoVirii Message-ID: You know, sometimes you actually WANT a whitespace-eating nanovirus.. Consider: def bubba(): return """ This is a multi-line string with indentation. """ def testbubba(): if 1==1: # just something to change the indentation assert bubba() == """ This is a multi-line string with indentation. """ :) I can compensate for this.. I just thought it was funny. Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From hanche at math.ntnu.no Tue Feb 15 19:19:31 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 15 Feb 2000 19:19:31 -0500 Subject: Iterators & generators (RE: Real Problems with Python) References: <000001bf768e$48e40580$45a0143f@tim> <88bleg$chl$1@nnrp1.deja.com> Message-ID: + Dan Schmidt : | | [explanation snipped] | | This is pretty much the same way that Knuth explains coroutines in | volume 1 of The Art of Computer Programming -- which you all have, | right? -- in section 1.4.2. Uh, yeah, but what's left of my copy is in Norway and I am on sabbatical leave in the US of A. (And I've read my copy to pieces (which didn't take much, with the paperback version) and *still* wasn't aware it's in there? I've just got to reread it when I get back, I guess.) oh-well-but-a-good-explanation-can-bear-repeating-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 gerrit.holl at pobox.com Mon Feb 21 14:57:10 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 20:57:10 +0100 Subject: rcp In-Reply-To: <001001bf7c94$c71ffe70$3acbd9c2@peridot.optichrome.com>; from a.eyre@optichrome.com on Mon, Feb 21, 2000 at 05:55:02PM -0000 References: <001001bf7c94$c71ffe70$3acbd9c2@peridot.optichrome.com> Message-ID: <20000221205710.A3016@stopcontact.palga.uucp> > Has anyone seen any code which can do the equivalent of the Unix command > 'rcp', > *without* using the command itself. > > I need to use this on NT as well. I haven't seen any code, but why don't you just get a packet sniffer and find out what rcp does exactly? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From python at rose164.wuh.wustl.edu Fri Feb 4 11:33:46 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Fri, 04 Feb 2000 16:33:46 GMT Subject: Running a python script from JAVA, (telnetlib doesn't run under PythonWin) In-Reply-To: References: <20000204.9584017@sparky.spkydomain> Message-ID: <20000204.16334623@sparky.spkydomain> I'm sorry. Your problem is different than the one i was thinking of. I'm guessing your problem has something to do with how the python interpreter is invoked. On my computer, win98/python 1.5.2, telnetlib will run on the console, and in IDLE, but not in PythonWin. I don't know anything about PythonWin's internals, so i can't tell you what PythonWin is doing differently. You might try using a different method in java to call python. I really just guessing though. Sorry i couldn't be more help. David ps. you might drop a note to Mark Hammond. If he knows about the problem with telnetlib on PythonWin be might be able to shed some light on your dilemma. >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/4/00, 8:04:18 AM, "Alain" wrote regarding Re: Running a python script from JAVA, with correct indentation: > Here's the python code of my script: > import telnetlib [...] > Any idea? > David Fisher a ?crit dans le message : > 20000204.9584017 at sparky.spkydomain... > >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< > On 2/3/00, 3:12:09 PM, "Alain" wrote regarding > Running a python script from JAVA, with correct indentation: > > Hi, > > I'm trying to run a script from a file. The script is written in > python. The > > script is a telnet session between a router and a computer. If I run > the > > script from a DOS prompt window, everything is good. But if I start > the > > script from my program, using a Runtime object, there's a problem. The > > communication between the router and the computer is stop, even if the > > telnet session is still open. Here's the JAVA code: > [...] > > Is there someone have a solution? > -- > http://www.python.org/mailman/listinfo/python-list From JGRAVES3 at austin.rr.com Thu Feb 10 10:06:07 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Thu, 10 Feb 2000 15:06:07 GMT Subject: Black holes as syntax, Was: Whitespace as syntax (was Re: Python Rocks!) References: <67E0733CFCC0FAB485256880001F0FFA.001F145C85256880@ttm.com> <38A16CEB.CC63475B@ttm.com> <38A24345.3F763311@Lugoj.Com> Message-ID: >Off topic: >By the way, speaking of code blocks, does anyone know of any languages that >use blocks...literally? That is, given the prevalence of GUIs, a development >environment/language where code is contained in rectangles? I'm new to Python but I used to make my living by programming in a CASE tool named 'Synon:2E' on AS/400's. (Synon was bought by Sterling Software and they renamed it 'Cool:2E'. Ugh! I can hardly make myself type that.) Anyway it is a CASE tool that generates RPG and the application logic in programmed in an Action Diagrammer, that looks like this. (set to mono-spaced font to view correctly) > Select or verify COLOR .-CASE ?- c1 OR (c2 AND c3) ? |-c1: WRK.Text 1.usr is Select ? |-c2: DTL.*CMD key is *Prompt ? |-c3: PGM.*Cursor field DTL.Color Basic Property Code ? '- ? PAR.Next Program.usr = CND.WW ARC Basic Prop ? WW Bas Prop Driver - HP Basic Prop X-ref * ? B Next Program.usr = PAR.Next Program.usr ? I Basic Property Type = CND.Color ? B Basic Property Code = DTL.Color Basic Property Co ?-*OTHERWISE ? RTV to Validate ARC code - HP Basic Prop X-ref * ? I RST BP Type = CND.Color ? I RST BP Code = DTL.Color Basic Property Co ? .-CASE ? ?-PGM.*Return code is *Normal ? ?-*OTHERWISE ? ? Send error message - 'Basic Prop not found' ? ? I BP Code = DTL.Color Basic Property ? '-ENDCASE '-ENDCASE It use a custom editor that allows collapsing ('folding' is a more common term) of structures. it also supports 'zooming', where you can focus in on a construct and it hides all of the surrounding code. This is as close as I know of. From rob at hooft.net Fri Feb 18 05:10:39 2000 From: rob at hooft.net (Rob W. W. Hooft) Date: Fri, 18 Feb 2000 11:10:39 +0100 (CET) Subject: Inter process communication using Tk/send hangs on suspended processes In-Reply-To: <20000216225453.06891@nms.otc.telstra.com.au> References: <20000216225453.06891@nms.otc.telstra.com.au> Message-ID: <14509.6815.70098.462099@temoleh.chem.uu.nl> >>>>> "GM" == Greg McFarlane writes: GM> On 15 Feb, Rob W. W. Hooft wrote: >> I have a group of python programs. Whenever any new program is >> started, it will try to establish connections to each of the other >> ones using Tk/send (it is asking each for their background color, >> and will choose a new one for itself). GM> The only things I can think of are to fork separate processes to GM> do each send and kill them if they do not respond quickly. That doesn't work, as this will result in X requests that arrive out-of-order. As far as I know, no 2 processes can share their X socket connection. I guess I'll have to investigate the "server" concept. Rob From a.eyre at optichrome.com Fri Feb 4 05:14:42 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Fri, 4 Feb 2000 10:14:42 -0000 Subject: Examples for boss: Python for www game and chat In-Reply-To: <3899BA97.D7CD8E90@psychosis.com> Message-ID: <002c01bf6ef8$a745d6a0$3acbd9c2@peridot.optichrome.com> > I need refereces, of of any internet gaming systems that utilize > python, in some way. Also of help would be an internet chat system > that uses python, in some way. Not sure if this is the sort of thing you were looking for, but I would class it as both an internet game and a chat system: http://www.accessoft.com/moop/ ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From 55555 at dakotacom.net Sun Feb 13 15:44:24 2000 From: 55555 at dakotacom.net (55555) Date: 13 Feb 2000 14:44:24 -0600 Subject: local cgi References: <38a33281_2@news5.newsfeeds.com> <87vl1c$duc$1@nntp1.atl.mindspring.net> Message-ID: <38a717a8_3@news5.newsfeeds.com> I gave Medusa a try; however, it looks like you have to have a live internet connection for it to work. That won't be the case a lot of the time. Is there any other way for me to just associate .py to run on internet explorer through extra registry settings somewhere? On 11 Feb 2000 00:27:24 GMT, "Michal Wallace" wrote: > > 55555 <55555 at dakotacom.net> wrote in message > <38a33281_2 at news5.newsfeeds.com>... > > > > Is it possible to run a local cgi program on a windows 95 machine through internet > > explorer 5? My python programs come up as text documents even though .py is obviously > > associated properly in the registry. Thanks. > > > yes, but you need to install a web server... there's one called Medusa > that's written in python, or you can use the simple server that comes WITH > python... > > -michal > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From ben.flynn at cis.co.uk Fri Feb 18 10:28:30 2000 From: ben.flynn at cis.co.uk (ben.flynn at cis.co.uk) Date: Fri, 18 Feb 2000 15:28:30 GMT Subject: win32security References: <87pu3o$23i$1@nnrp1.deja.com> Message-ID: <88joeo$32s$1@nnrp1.deja.com> I am currently trying to modify the permissions of 2500 directorys on a server to take them from Everyone full control to Administrator / a specific user full control. I am relatively new to python and the closest I have got to achieving this objective is the following : #!/usr/local/bin/python from win32security import * from ntsecuritycon import * from win32con import * sid,domain,z = LookupAccountName('\\\\server','userid') newACL=ACL() oldsecurity=GetFileSecurity('c:\\test',DACL_SECURITY_INFORMATION) newACL.AddAccessAllowedAce(GENERIC_ALL , sid) oldsecurity.SetDacl(1, newACL, 0) SetFileSecurity('c:\\test',DACL_SECURITY_INFORMATION,oldsecurity) Can anybody help me with this as the above code won't work - fails on SetFileSecurity. Any help would be much appreciated. Ben. Sent via Deja.com http://www.deja.com/ Before you buy. From infonuovo at email.com Tue Feb 29 00:13:38 2000 From: infonuovo at email.com (Dennis E. Hamilton) Date: Mon, 28 Feb 2000 21:13:38 -0800 Subject: functional programming & tail recursion? In-Reply-To: Message-ID: I am a little puzzled by the discussion on tail recursion. The seems to imply that tail recursion involves simply catching variations on the case def f(...): stuff; ...; return f(transformed ...) In my experience, most interesting recursive forms don't automatically take that structure. And when they do, one might as well go the rest of the way and implement the recurrence-iteration! I used the Fibonacci series example previously offered as the basis for my illustration of tail-recursion solutions in the file fib1.py, below. The file also demonstrates why one indeed wants to replace recursive descents by recurrence iterations whenever possible. Now, what precisely was meant by tail recursion and why is it thought to be essential to functional programming? What would a tail-recursion simplification mechanism accomplish given the recursive example, fibn(), below? -- Dennis ------------------ Dennis E. Hamilton InfoNuovo mailto:infonuovo at email.com tel. +1-206-779-9430 (gsm) fax. +1-425-793-0283 http://www.infonuovo.com - - - - - - - execution with python 1.5.2 - - - - - - - - - - - - - - - - - - - [1]C:\crea\SoftDev\Python\Projects\PythonTutorial> py fib1.py Iterative solutions F(-32) to F(+32) -2178309L 1346269L -832040L 514229L -317811L 196418L -121393L 75025L -46368L 286 57L -17711L 10946L -6765L 4181L -2584L 1597L -987L 610L -377L 233L -144L 89L -55 L 34L -21L 13L -8L 5L -3L 2L -1L 1L 0L 1L 1L 2L 3L 5L 8L 13L 21L 34L 55L 89L 144 L 233L 377L 610L 987L 1597L 2584L 4181L 6765L 10946L 17711L 28657L 46368L 75025L 121393L 196418L 317811L 514229L 832040L 1346269L 2178309L Tail-recursive F(0) to F(32) 0L 1L 1L 2L 3L 5L 8L 13L 21L 34L 55L 89L 144L 233L 377L 610L 987L 1597L 2584L 41 81L 6765L 10946L 17711L 28657L 46368L 75025L 121393L 196418L 317811L 514229L 832 040L 1346269L 2178309L Pure-recursive F(0) to F(32) 0L 1L 1L 2L 3L 5L 8L 13L 21L 34L 55L 89L 144L 233L 377L 610L 987L 1597L 2584L 41 81L 6765L 10946L 17711L 28657L 46368L 75025L 121393L 196418L 317811L 514229L 832 040L 1346269L 2178309L - - - - - - - - fib1.py - - - - - - - - - - - - - - - - - - - - - - - - - - - - #! python """ Fibonacci-1 Demonstration of Fibonacci Series Generations: fibn(n) computes F(n) by simple recursion fibt(n) computes F(n) by tail-recursive form fibi(n) computes F(n) by explicit iteration fibz(n) computes F(n) for any integer, Z dofibs(F, m, n) prints the list of values for F(m) to F(n-1) """ # 2000-02-28-20:20 Add little demonstration script for executing # as application (orcmid) # 2000-02-28-19:02 Derive all the other flavors, fibn, fibt, and # fibz, in that order, though I saw fibz right away (orcmid) # 2000-02-28-16:09 Define fibi iterative solution to demonstrate # clear equivalence to tail recursion (orcmid) def fibn(n): "fibn(n) produces Fibonacci number F(n) by simple recursion" if n != int(n): raise "Must be integer" if n < 0: raise "Must be non-negative" if n == 0: return 0L if n == 1: return 1L return fibn(n-1)+fibn(n-2) # Simple recursion is a very costly approach to this function. # Notice that this form is not amenable to improvement by a # trivial tail recursion. Run dofib(fibn, 2**n) to feel the pain. def ftail(a, b, i): "ftail(1L, 0L, n) produces F(n) by tail recursion, n >= 0" if i == 0: return b return ftail(b, a+b, i-1) def fibt(n): "fibt(n) produces Fibonacci number F(n) by tail recursion" if n != int(n): raise "Must be integer" if n < 0: raise "Must be non-negative" return ftail(1L, 0L, n) # Function fibt(n) and its auxiliary function ftail(a, b, i) # provide a tail-recursive form of fibn(n). It is a non- # trivial exercise to find these automatically with a compiler, # yet most interesting recursively-defined functions don't # arrive in an already-tail-recursive form. # I would like very much to have ftail be local to fibt # because it depends on preconditions established there. def fibi(n): "fibi(n) produces Fibonacci number F(n) by explicit iteration" if n != int(n): raise "Must be integer" if n < 0: raise "Must be non-negative" [a, b] = [1L, 0L] while n > 0: [a, b, n] = [b, a+b, n-1] return b # The explicit iteration form provides all of the economization # that is gained by establishing tail recursion, in a simple # well-defined form that is also a clean algorithm. # I confess that I created fibi(n) first, then used that # solution as the basis for the fibt-ftail combination. def fibz(n): "fibz(n) produces Fibonacci number F(n) for any integer, n" if n != int(n): raise "Must be integer" [a, b] = [1L, 0L] while n < 0: [a, b, n] = [b-a, a, n+1] while n > 0: [a, b, n] = [b, a+b, n-1] return b # Once you see the pattern, it is clear that the Fibonacci # series is perfectly extendable in both directions from F(0). # I love the economy of fibz(n) extended to all integers. # Notice the interesting relationship between F(n) and F(-n). # This is probably an exercise in the Art of Computer Programming, # but I am too lazy to verify that. def dofibs(F, m, n): "dofibs(F, m, n) prints the sequence F(m) ... F(n-1)" for i in range(m, n): print F(i), if __name__ == "__main__": # run demonstration test for %python fib1.py print "\nIterative solutions F(-32) to F(+32)" dofibs(fibz, -32, 33) print "\n\nTail-recursive F(0) to F(32)" dofibs(fibt, 0, 33) print "\n\nPure-recursive F(0) to F(32)" dofibs(fibn, 0, 33) print "\n" # end of fib1.py - - - - - - - - end of fib1.py - - - - - - - - - - - - - - - - -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Moshe Zadka Sent: Wednesday, February 23, 2000 23:07 To: Aahz Maruch Cc: python-list at python.org; python-list at python.org Subject: Re: functional programming On 23 Feb 2000, Aahz Maruch wrote: > >> What do you call this: [I said] > >Um.....the most inefficienct version of fibonacci I've ever seen? [Aahz] > Well, sure, but it meets your definition of functional programming. You > claimed that functional programming is impossible in Python; I've > provided a counter-example. Do you now retract your claim? Assuming we're still in "search of truth" mode, rather then "proving I'm right" mode, I want to clarify my claim: *efficienct* functional programming is, in general, impossible without tail-recursion. I don't agree with the timbot that tail-recursion is contrary to the "Python Way", but it's not in Python right now, anyway. Are we in agreement now? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From neelk at brick.cswv.com Tue Feb 22 19:20:04 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 23 Feb 2000 00:20:04 GMT Subject: functional programming References: Message-ID: Fran?ois Pinard wrote: > > What would be the advantages of using a "functional" Python, as > per your definition? I mean, of course, in practice? Threading becomes simpler to think about. This is not a theoretical advantage! Whenever I have code that needs to be thread-safe, I find it tons easier to write in a functional style than worry about locking and race conditions and reentrancy and awful things like that. > P.S. - Yes, I know it has been theoretically proven that we could design > computers needing no energy, if we could fully avoid side-effects, but I > beg to do not consider this a practical advantage yet. :-) Actually, this *isn't* so! Consider a computer with a memory space of N bits. After performing some number of arbitrary computations, the memory space will be in a random configuration of ones and zeros.[*] Since we don't know what any particular position in memory will be, there is 1s a 50-50 chance it is a 1 or a 0. So in an information- theoretic sense each position in memory has 1 bit of information, and the whole memory space has around N bits of information. Now, suppose that we call calloc() on this memory and zero out all the bits. Now, note that the amount of information needed to encode a series of N zeros is no more than O(log N). Here's the critical bit: this means that resetting those bits decreased the information in the system! And since physical entropy and the entropy of information theory have basically the same definition, we can with a little handwaving[**] conclude that clearing a bit costs on the order of kT*ln 2, where T is the temperature of the computer and k is Boltzmann's constant. How much is this thermodynamic limit? A typical computer is somewhere around 300 K, k = 1.38 * 10**-23 J/K, and a computer might have 128 megs of RAM, so clearing a PCs memory can never take less than (drum roll please...) 3 * 10**-12 J. Not much, but that little bit is the toll we absolutely must pay to the 2nd law of thermodynamics. :) Neel [*] For pedants, I mean 'random' in the sense of the memory space having a Kolmogorov complexity close to N, plus the appropriate handwaving to define "abritrary computation" to make it come out this way. ;) [**] You don't really want to see me try to compute partition functions in public. Really. From gmcm at hypernet.com Tue Feb 8 13:07:18 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 8 Feb 2000 13:07:18 -0500 Subject: What GUI widgets are available? In-Reply-To: <87p8ab$9l0$1@news1.xs4all.nl> Message-ID: <1262089297-8853514@hypernet.com> Boudewijn Rempt wrote: > For what I understand from the wxGrid documentation, the wxWindows > grid isn't editable, at least not in-place. (I can't test it out - > I still can't get wxPython installed.) On Windows at least it is. - Gordon From P.J.W.S.VRIJLANDT at INT.azg.nl Sat Feb 5 11:41:11 2000 From: P.J.W.S.VRIJLANDT at INT.azg.nl (P.J.W.S. Vrijlandt) Date: Sat, 5 Feb 2000 17:41:11 +0100 Subject: class objects in dictionaries In-Reply-To: <87hhq0$69k$1@nnrp1.deja.com> Message-ID: <789A77432D@nds-3.azg.nl> Would this be what you mean? class storage: from string import * mystorage = storage() Now you can do: >>>mystorage.join > To: python-list at python.org > Hi all, > > I would like to put all my class definitions in a dictionary > __objects__ in main global namespace. I know I can do it by > putting the class objects into module called __objects__ and > import this module, but that way classes would have different > global namespace and I need them to have the same global > namespace as the main script. > > I need to do something like: > > from class_objects import * to __objects__ > > Is there any way in Python how to do this? > > Thank you for help. > > Martin Met vriendelijke groet, Patrick Vrijlandt From effbot at telia.com Tue Feb 22 04:19:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 09:19:32 GMT Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <001c01bf771d$399d72c0$3acbd9c2@peridot.optichrome.com> <38B20B5E.B5DF949@cosc.canterbury.ac.nz> Message-ID: Greg Ewing wrote: > Whatever you do, don't stuff it onto some arbitrary > type just for the sake of making it a method. excuse me? it's not an "arbitrary" type -- it's the type of the separator string. makes perfect sense, once you've learned to think like Tim... > the world will not end if there are some non-method > functions left in Python 1.6... do you mean something like this? def join(sequence, sep=" "): if not sequence: return sep[:0] res = sequence[0][:0] for w in sequence: res = res + (sep + w) return res[len(sep):] or maybe, to get decent performance out of it: def join(sequence, separator=" "): if type(separator) is StringType: ... do it this way ... elif type(separator) is UnicodeType: ... or do it that way ... # remember to add more code here # if we add more string types else: raise TypeError or maybe, a bit more object oriented: def join(sequence, separator=" "): return separator.join(sequence) now, the last one wasn't too bad, was it? (if you liked that, have you looked in the CVS repository lately? ;-) From aahz at netcom.com Sat Feb 12 01:09:59 2000 From: aahz at netcom.com (Aahz Maruch) Date: 12 Feb 2000 06:09:59 GMT Subject: X-no-archive fails (was Re: Python sucks loud) References: Message-ID: <882tfn$75h$1@nntp6.atl.mindspring.net> In article , Dennis Lee Bieber wrote: > > I've been in other newsgroups where it has been stated that most >sites which honor "no archive" headers will also accept it as the first >line of text in the body -- explicitly for those "do everything poorly" >utilities folks insist on using... Well, sure. But they don't honor it in quoted text -- which is what happens during a followup. Moreover, it turns out during the recent RemarQ fiasco that they didn't honor that header in the past. -- --- 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 Nostalgia just ain't what it used to be From darcy at vex.net Sat Feb 12 15:08:39 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 12 Feb 2000 20:08:39 GMT Subject: Parnassus mirror? References: Message-ID: <884ek6$oph$1@news.tht.net> Mike Fletcher wrote: > Wondering if there is a Parnassus mirror anywhere? Two machines on my route > to the www.vex.net server are routing back and forth at each other, which > makes it hard to get through :) . There was some problems while adding a new router. Looks like it is all cleared up now. The same upgrade gives us a redundant link to the net as well so it should be even more reliable now. -- 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 moshez at math.huji.ac.il Sat Feb 26 01:06:56 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 26 Feb 2000 08:06:56 +0200 (IST) Subject: functional programming In-Reply-To: Message-ID: On 25 Feb 2000, Denys Duchier wrote: > > I won't say anything about C++ (what I'd like to say about it isn't > > fit for prime time), but about Python, this is untrue: either the called > > function has a reference to the object (in which case it won't be > > finalized) or it can be deleted when the calling frame is deleted, in > > which case the call to the destructor will *precede* the tail-call, > > and still leave it in tail position. > It makes a difference whether the lock is released before the call to > baz() or after. I am by no means sanguine about keeping Python's > finalization semantics, but it _is_ an issue that makes a difference. Well, for one thing, it doesn't violate any of the language's guranteed semantics. Any *sensible* programmer would explicitly close the lock after calling baz(), and then baz() would be in a tail-position no longer. (Actually, any sensible programmer would do it in a finally clause). Otherwise, if an exception is raised, the lock is still locked, which is problematic (the code catching the exception would have a hard time knowing if it is locked, etc.) So, since the only example you give is of a coding practice to shady it *deserves* to lose, I take it you agree with me <0.5 wink -- but you'll have to find a better example> arguing-is-fun-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From S.I.Reynolds at cs.bham.ac.uk Mon Feb 21 13:44:07 2000 From: S.I.Reynolds at cs.bham.ac.uk (Stuart Reynolds) Date: Mon, 21 Feb 2000 18:44:07 +0000 Subject: Problem with Emacs mode, at start only References: <14508.12680.569760.298585@anthem.cnri.reston.va.us> Message-ID: <38B18777.61BB@cs.bham.ac.uk> python-mode at python.org wrote: > > >>>>> "I" == ISO writes: > > I> This is with Python mode 3.105, while using Emacs 20.5. > > Hmm, I wonder if this is an Emacs thing. It seems to work fine for me > in XEmacs 21.1. I don't have Emacs installed right now. > I've noticed some significant differences between Lucid Emacs and GNU Emacs which can make it difficult to write a .emacs that works on both. For example, my copy of Lucid Emacs doesn't allow you to bind the function keys, while the GNU version does. Also, GNU Emacs doesn't seem to have the font-lock-doc-string-face that's available in Lucid Emacs. I'd guess there's lots of other differences. Stuart From ivanlan at callware.com Tue Feb 29 15:15:54 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 29 Feb 2000 13:15:54 -0700 Subject: Best book to learn Python? References: Message-ID: <38BC28FA.F181E30A@callware.com> Hi All-- Fredrik Lundh wrote: > > Snoopy :-)) wrote: > > There is a New Book which supposed to be a very good one for Beginners. It > > is expected to be available March-21. Published by "SAMS". > > The Title is: "Teach Yourself Python In 24-Hours" > > The Author is: Alan Gauld. > > is that Ivan Van Laningham's alter ego? > Oh, my. I don't *think* I'm Alan Gauld! Alan? Are you out there? Or am I suffering yet another identity crisis? And if I get an answer, what does that mean? Schizophrenics *often* have auditory hallucinations. ... ;-) Quotidian-details-time: Ivan Van Laningham is the author of _Teach Yourself Python in 24 Hours_. Alan Gauld wrote an excellent tutorial, which can be found at http://members.xoom.com/alan_gauld/tutor/tutindex.htm Alan is also writing a beginning programming book for Addison-Wesley, to which I am looking forward, although Alan says it probably won't be ready before the end of the year. (Alan? Please correct me if I've over-/under-/mis-stated.) -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 amused at webamused.com Tue Feb 8 21:02:49 2000 From: amused at webamused.com (Joshua Macy) Date: Wed, 09 Feb 2000 02:02:49 GMT Subject: Error on string formatting References: <87q741$8jh$1@nnrp1.deja.com> Message-ID: <38A0C85D.2477EE5E@webamused.com> Judy Hawkins wrote: > > Why this: > > >>> buf = '%0.*f' % 3, 4.1 > Traceback (innermost last): > File "", line 1, in ? > TypeError: not enough arguments for format string > > The comparable statement in C works fine, and the Essential Reference > says I can do this kind of asterisk thing. > > Judy Hawkins > > Sent via Deja.com http://www.deja.com/ > Before you buy. Pythons's % operator takes a collection on the right-hand side (either a tuple or a mapping), with a special dispensation for singletons, so that you don't have to write, e.g. >>> print "This %s, but is ugly" % ('works',) This works, but is ugly >>> print "This is %s prettier, ne?" % 'much' This is much prettier, ne? So, when you have a sequence that you want to pass it, such as 3, 4.1, you have to make it really a sequence (3, 4.1) >>> buf = '%0.*f' % 3, 4.1 File "", line 1 buf = '%0.*f' % 3, 4.1 ^ SyntaxError: invalid syntax >>> buf = '%0.*f' % (3, 4.1) >>> print buf 4.100 >>> Joshua From embed at geocities.com Thu Feb 24 09:26:32 2000 From: embed at geocities.com (Warren Postma) Date: Thu, 24 Feb 2000 09:26:32 -0500 Subject: Porting Python to non-pc platforms (AS/400) References: <38B313D6.AD23EAB2@ttm.com> <14515.5580.141809.386579@beluga.mojam.com> <38B47AA0.57A1EB09@exceptionalminds.com> Message-ID: > I think we need to start up a special fund for Jay, I hated RPG when I > first touched it almost 15 years ago, and I hate it even more now. > > The question is, will a virtual $1,200 assist him in his quest for a C > compiler and Python? > > I thought RPG stood for role-playing game... My father in law has an AS/400 at his place of business, and I wouldn't mind being able to script him up some stuff on AS/400 using Python. I sure as Heck am not going to learn RPG! RPG makes even COBOL look nice. ;-) What a foreboding environment that is. Without so much as a recognizeable command shell on this system, I have a hard time doing anything. With the disclaimer that I know nothing about AS/400s, and I only occassionaly have access to one, I am also interested in putting Python on an AS/400. Warren From stevie_deja at my-deja.com Tue Feb 8 13:59:40 2000 From: stevie_deja at my-deja.com (stevie_deja at my-deja.com) Date: Tue, 08 Feb 2000 18:59:40 GMT Subject: Pickling Parent Message-ID: <87pp2q$ule$1@nnrp1.deja.com> Hi, Is it possible to upcast a python class to be pickled? I have a parent_class which contains many variables & initialization routines. The inheriting class is used to perform actions, then I want to pickle it, as if it where the parent. I need to do this, because the jpython version only has knowledge of the parent_class (can't use inherited class since it has stuff which jpython can't handle). Is this possible? Thanks, Steve K. Sent via Deja.com http://www.deja.com/ Before you buy. From gerrit at nl.linux.org Thu Feb 24 07:48:26 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Thu, 24 Feb 2000 13:48:26 +0100 Subject: Readline In-Reply-To: ; from mjabbur@iss.net on Thu, Feb 24, 2000 at 10:27:14AM -0300 References: Message-ID: <20000224134826.A18481@humbolt.nl.linux.org> On Thu, Feb 24, 2000 at 10:27:14AM -0300, Marlon Jabbur wrote: > hi list, > > i'm looking for a readline module in python, i'm planning to do a > application that open a shell > and behave like bash. > > Anyone knows if this module already exists???? import readline import cmd regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From hanche at math.ntnu.no Thu Feb 17 17:36:48 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 17 Feb 2000 17:36:48 -0500 Subject: Continuations and threads (was Re: Iterators & generators) References: Message-ID: + Mike Fletcher : | Not being a CS person, maybe I can confuse the issue :) ... I'm not one either, so surely I can confuse it further! | A continuation is a suspended execution context, you get to a point | and say "can't/won't finish this now, I'll store the state (frame) | and let other execution contexts call me when I should continue". | When you want to resume the context, you "call" the continuation, | which resumes running the suspended execution context at the next | line after the call to suspend. So far, this is not all that different from coroutines/generators/threads/whatever. To my mind, one of the mindboggling things about continuations is that you can call the same continuation multiple times, whereas when you call a coroutine/generator, its program counter advances, so that the next time you call it, you are really calling a new continuation. | If I'm reading things right, there are methods on continuations | which allow for updating variables while not running the context, so | you can pass information into the context while it is suspended. Well, the global environment can always change between calls, but you may even have two continuations sharing a lexical environment (i.e., they were both generated within the same procedure call), so calling one can modify the local environment of the other. maybe-posting-some-Scheme-code-could-obfuscate-the-issue-furhter-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 mwh21 at cam.ac.uk Tue Feb 15 08:39:43 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 15 Feb 2000 13:39:43 +0000 Subject: Off Topic Posts References: Message-ID: Mikael Olofsson writes: > I could do without the flame wars. During the last three months the > number of posts have steadily increased from ~500 posts a week with very > few inflammatory posts to ~1000 posts a week with a significant part > being inflammatory. The last week there were ~150 post that I consider > being part of flame wars (whitespace, brackets, python sucks, and > related). I admit, I have posted a handful of these. Of course I can > filter them out, but I refuse to make new filters every day just to cope > with digital bullshit. I agree that the last week has been a bit silly. But these things tend to come and go, in my experience. I don't think the amount of flame-age is increasing generally. Any good newsreader should have a quick way of marking a thread as read (M-C-k in gnus), so if a thread is clearly out of control, bin it. > And what if I the increase continues? I say split, maybe even to more > than two groups. Well, as I world probably read them all this wouldn't affect me that much. But I'm not convinced it would help, either. > Or perhaps, make it moderated. The newsgroup is NO WAY NEAR as bad as it would need to be to make moderation a good idea (IMHO) - that's an option that should be reserved for monsters like comp.object, comp.lang.c++ or comp.lang.perl. Maybe we'll be there one day, but we're not there yet. I'm happy enough with the status quo. Cheers, Michael From jasonic at nomadicsltd.com Sun Feb 20 09:45:04 2000 From: jasonic at nomadicsltd.com (Jason Cunliffe) Date: 20 Feb 2000 14:45:04 GMT Subject: Can't reopen eMatter book ... answer = USE Acrobat 4.x [US] References: <001101bf78f5$2f3227c0$dea0143f@tim> <38add93c.25585379@nntpserver.swip.net> Message-ID: <01bf7bb0$fe1f7c00$033abcc3@indiana.pro-net.co.uk> Anders Eriksson wrote in article <38add93c.25585379 at nntpserver.swip.net>... > On Wed, 16 Feb 2000 22:15:03 -0500, "Tim Peters" > wrote: > > >[posted & mailed] > >> I bought the 'Standard Python Library' eMatter book by mr Fredrik > Well after spending an evening on the phone talking to various people > at Fatbrain I got a new license key (THANKS JAI) but it still didn't > work. No I got the same error as before: "An error occurred while > preparing to display this eMatter...." So back to the phone. After a > while we found out that I'm using the Swedish version of Acrobat 4.0 > and eMatter don't work with any version except the American. > > After downloading the american version and unstalling the swedish and > installing the american acrobat. Yeee an behold! Everything works!!! > > > I_could_have_bought_a_new_book_for_the_phone_money-ly y'rs - Anders > uhhmm..yes I had a slightly similar experience. Crazy error opening problems. [big black fill boxes everywhere, but text - sort of legible] Chasing around, phone calls and email to sort it out. Yes I should have posted to this list, but according to the replies I received, it was confirmed the file was "corrupted" {sorry about that} and that they would look into it. I waited and sent some more emails no reply. I gave up for the time being pretty disappointed. Then I chanced back on Frederik Lundh's page and effbot guide link where I caught the warning about Acrobat 4 requirement. Downloaded Acrobat 4 reader and YAY hooray it works! Shame about the install glitch - but it was well worth the delay... Really a fine publication whose distribution needs a little fine tuning. Thanks Someone should perhaps look into the various links to the effbot guide and make sure there is a local _red_ html tag next to it saying: "This PDF publication needs US version Acrobat Version 4.x [url]" - Jason Cunliffe From gtalvola at NameConnector.com Tue Feb 1 14:41:35 2000 From: gtalvola at NameConnector.com (gtalvola at NameConnector.com) Date: Tue, 01 Feb 2000 19:41:35 GMT Subject: question about COM and ADO References: <86t965$vlq$1@nnrp1.deja.com> Message-ID: <877cte$un1$1@nnrp1.deja.com> In article , "Mark Hammond" wrote: > Try: > rs.ActiveConnection.Value = None > ? > > Or just set rs itself to None... > > Mark. > That doesn't work either. Executing rs.ActiveConnection.Value = None gives the following error: Traceback (innermost last): File "", line 1, in ? rs.ActiveConnection.Value = None File "E:\Program Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2EA4x0x2x1 .py", line 389, in __setattr__ raise AttributeError, attr AttributeError: Value And setting the recordset to None isn't an option because I then can't use the recordset object. The idea here is that ADO has the concept of creating a client-side recordset (hence the CursorLocation=adUseClient) based on a database connection. All of the data is immediately loaded from the database server when you call rs.Open. Then, by setting the recordset's ActiveConnection property to Nothing, you disconnect the recordset from the database connection. Then you can sort it, filter it, edit it, persist it, and so forth without being connected to the database server. The adLockBatchOptimistic part means that all changes to the recordset are saved locally within the Recordset object, but are not committed to the database until you re-connect to the database (by setting rs.ActiveConnection to a valid Connection object) and then call rs.UpdateBatch(). This all works fine from VB, but I can't figure out the magic needed to get it to work with Python. > wrote in message > news:86t965$vlq$1 at nnrp1.deja.com... > > I'm using ADO from Python, and I'm having a problem figuring out > > how to do the equivalent of the VB code > > > > Dim cnn as New ADODB.Connection > > cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data > Source=c:\db1.mdb" > > dim rs as New ADODB.Recordset > > rs.CursorLocation = constants.adUseClient > > rs.Open "SELECT * FROM Table1", cnn, adOpenStatic, > > adLockBatchOptimistic > > set rs.ActiveConnection = Nothing > > > > in Python. I'm trying to create a disconnected client-side > recordset, > > which requires that after I open the recordset, I set its > > ActiveConnection property to Nothing (at least that's how it's done > in > > VB). I can't figure out the equivalent in win32com. In particular, > it > > chokes if I try to set it to None: > > > > >>> from win32com.client import * > > >>> cnn = Dispatch('ADODB.Connection') > > >>> cnn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data > Source=c:\db1.mdb" > > ) > > >>> rs = Dispatch('ADODB.Recordset') > > >>> rs.CursorLocation = constants.adUseClient > > >>> rs.Open( "SELECT * FROM Table1", cnn, > > constants.adOpenStatic,constants.adLockBatchOptimistic ) > > >>> rs.ActiveConnection = None > > Traceback (innermost last): > > File "", line 1, in ? > > rs.ActiveConnection = None > > File "E:\Program > > > Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2EA4x0x2x > 1 > > .py", line 390, in __setattr__ > > apply(self._oleobj_.Invoke, args + (value,) + defArgs) > > com_error: (-2146825287, 'OLE error 0x800a0bb9', (0, > 'ADODB.Recordset', > > 'The application is using arguments that are of the wrong type, are > out > > of acceptable range, or are in conflict with one another.', '', 0, > > -2146825287), None) > > > > > > Anyone have an idea of how to do this? > > > > > > Sent via Deja.com http://www.deja.com/ > > Before you buy. > > Sent via Deja.com http://www.deja.com/ Before you buy. From b020 at taiwan.com Mon Feb 21 09:39:29 2000 From: b020 at taiwan.com (six) Date: Mon, 21 Feb 2000 22:39:29 +0800 Subject: ** (FREE) ** six picture Message-ID: <88rk30$d90@netnews.hinet.net> Welcome go to http://home.todo.com.tw/happy/sixphoto/ From eaglesto at americasm01.nt.com Thu Feb 10 17:54:17 2000 From: eaglesto at americasm01.nt.com (Eaglestone, Robert [NGC:B918:EXCH]) Date: Thu, 10 Feb 2000 16:54:17 -0600 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> <38A28055.D8F187EB@inka.de> Message-ID: <38A34199.BF367B98@americasm01.nt.com> Michael Str?der wrote: > > => Modula. Score 10/10 > > if foo then > bar; > stool; > else > nobar; > end; > Modula gets 9/10. Can't just use 'end', silly! Not enough context! How about this: if ( foo ) bar; stool; else nobar; endif From alex at somewhere.round.here Thu Feb 3 13:07:28 2000 From: alex at somewhere.round.here (Alex) Date: 03 Feb 2000 13:07:28 -0500 Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> Message-ID: > I would kill for a Python cookbook/algorithm book!! Clearly one of the more extreme members of the Python cult. Alex. From effbot at telia.com Thu Feb 24 10:05:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 15:05:42 GMT Subject: Can I run a c++ object in Python program? References: <892c2s$maj$1@news.ihug.co.nz> Message-ID: Bing Chen wrote: > I pass a object from c++ to Python as follow: > PyObject *pargs = Py_BuildValue("Oli",m_curr,field.first,field.second); > PyObject *pdict, *pval; > pdict = PyDict_New(); > PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); > > PyDict_SetItemString(pdict, "Y", pargs); /* dict['Y'] = pargs */ > PyRun_String("from BaseModule import *", file_input, pdict, pdict); > PyRun_String("X = BaseModelLink(Y)", file_input, pdict, pdict); > > the "m_curr" is an instance of class in my application, when I run some > method in the Python program as follow: /.../ it crash. probably because that instance isn't really PyObject* compatible... if I were you, I'd wrap the C++ classes using SWIG: http://www.swig.org From effbot at telia.com Tue Feb 8 13:36:31 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 08 Feb 2000 18:36:31 GMT Subject: Several questions: python plugin, xml-rpc + Medusa References: <38A01C84.88229E45@ttm.com> <14496.21079.898203.98612@beluga.mojam.com> Message-ID: I wrote: > Sam has contributed a sample module for medusa to the > standard xmlrpclib distribution [1]. here's the missing link: 1) http://www.pythonware.com/products/xmlrpc From tseaver at starbase.neosoft.com Tue Feb 15 18:25:02 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 15 Feb 2000 17:25:02 -0600 Subject: [CORBA] omniNames feature request References: Message-ID: <4200573822B7D496.C1F8C19BCF648E3E.28F066B210DA0684@lp.airnews.net> In article , Samuel A. Falvo II wrote: >In article , Martin von Loewis wrote: > >>IANA has assigned port 2809 for CORBA bootstrapping purposes. The INS >>spec assumes this as the default in the corbaloc URLs; the default >>object key for the name service is "NameService". > >Wow...that is dang cool. I'll definately keep this in mind. The idea being >that there is a way to construct an IOR manually that is bound to the IIOP >protocol, using an arbitrary hostname (as determined by the requirements of >the application), port 2809, and dedicated object key of "NameService", and >I'm assuming also "TradingService" and others. Wow...this will utterly blow >(D)COM away. Well, the INS does not, strictly, permit you to synthesize your own IOR; it does provide for means to pass the appropriate parameters (host, port) to your ORB and let *it* do the synthesizing (there may be negotiations involved with the ORB of the NS). You then get access to it through the ORB: ns = orb.resolve_initial_references( "NamingService" ) Normally, the only service which must be bootstraped is the NS; the others will presumably be found from the NS (the mechanism will still be to call resolve_initial_references(), though). What's-in-a-name'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From see_plus_plus at my-deja.com Thu Feb 24 12:05:05 2000 From: see_plus_plus at my-deja.com (see_plus_plus at my-deja.com) Date: Thu, 24 Feb 2000 17:05:05 GMT Subject: An article on Python (and Perl)... References: <6D8A17398E28D3119F860090274DD7DB4984E3@pces.cadlab.it> Message-ID: <893obt$vc4$1@nnrp1.deja.com> Yep, it's time that Perl & Python get together to barricade Ruby. cpp, a C++ visitor in the camp of Ruby In article <6D8A17398E28D3119F860090274DD7DB4984E3 at pces.cadlab.it>, Alessandro Bottoni wrote: > A nice article that compares Perl and Python: > > http://www.byte.com/feature/BYT20000201S0001 > > "A Perl Hacker in the Land of Python " > By Jon Udell > > -------------------------------- > Alessandro Bottoni > (Alessandro.Bottoni at Think3.com) > (alessandro.bottoni at libero.it) > Web Programmer > Think3 inc. > (www.think3.com) > > Sent via Deja.com http://www.deja.com/ Before you buy. From glen at electricorb.com Sun Feb 13 07:57:46 2000 From: glen at electricorb.com (Glen Starchman) Date: 13 Feb 2000 06:57:46 -0600 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <20000208220926.A3388@stopcontact.palga.uucp> <87v1dm$n9q$1@nnrp1.deja.com> Message-ID: <38A6A932.CE4C5C55@electricorb.com> off topic but mildly amusing. A couple of years ago I was working in Tokyo with a team of Japanese developers. I had gotten used to the Japanese pronunciation of 'c' (she), so when one of the developers told me I needed to call his function "she" when I was finished with his object I promptly wrote c(). Unfortunately, the function name was "shi" (or "death") because it was a garbage collection routine. ;-) fcahoon at my-deja.com wrote: > In article <20000208220926.A3388 at stopcontact.palga.uucp>, > Gerrit wrote: > > fcahoon at my-deja.com wrote on 949964685: > > > [ ... ] > > > I believe that the Ruby language (http://www.ruby-lang.org/) has the > OO > > > advantages of Python without the whitespace-as-syntax deficiency. > > > [ ... ] > > > > The English in here is certainly a whole lot better than the English > > in the ruby mailinglist ;-) > > > > regards, > > Gerrit. > > Work on English-language documentation is ongoing: the new FAQ reads > quite nicely -- see http://www.pragprog.com:8080/rubyfaq/rubyfaq.html > > There is a push to generate more English-language materials; in a few > months I think this situation will be greatly improved. > > f > > Sent via Deja.com http://www.deja.com/ > Before you buy. From effbot at telia.com Mon Feb 28 08:56:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 28 Feb 2000 13:56:35 GMT Subject: When to compile regex? References: <38A69D62.5A68F54D@chelmsford.com> <38b691f5.4085985@news.concentric.net> Message-ID: Tim Ottinger wrote: > >In section 4.2.3 of the Python Library Reference (1.5.2) it says that > >using compile is more efficient "when the expresion will be used several > >times in a single program". I'm trying to figure out the intended > >meaning of this. Does that mean "executed more than once", or "occurs > >more than once in the program text"? Specifically, if it only occurs > >once, but that is in a loop, is there an advantage to compiling before > >entering the loop? > > It has to be compiled before it's used. If you don't compile it, then > it will be compiled at the point of use, as a temporary, and then > tossed away later. better make that: ...compiled at the point of use, stored in a cache, possibly tossed away later, if the cache fills up. in 1.5.2, the cache holds 20 regular expressions. in 1.6, it will probably be much larger. From cpatti at atg.com Wed Feb 16 16:14:11 2000 From: cpatti at atg.com (chris patti) Date: 16 Feb 2000 16:14:11 -0500 Subject: Where is the Python Journal? References: <8EDCA9C19PaCmAnRDLM@194.2.0.33> Message-ID: William Annis writes: > chris patti writes: > > > poorly understood and badly documented Perl topics) recently wrote > > a series of articles on 'memoization' - the use of recursion and > > recursive data structures to implement caching algorithms that save > > huge gots of time on repeated computations.. > > > > Python needs something similar. > > I couldn't resist, largely because I thought it was so cute > when I came up with this after a little thought: > > class memoize: > def __init__(self, fn): > self.fn = fn > self.args = {} > > def __call__(self, *args): > if not self.args.has_key(args): > self.args[args] = apply(self.fn, args) > > return self.args[args] > > if __name__ == '__main__': > import math > > msin = memoize(math.sin) > print msin(0), msin(math.pi/2), msin(math.pi/4) > # Continue abusing to your heart's content... > > But, I agree about the Python journal idea and I'm also in the > same boat: getting the Perl Journal despite my apostasy. I suppose we > shouldn't whine unless we intend to write articles, too. :) I'm willing, just not qualified :| I don't personally think there's anything wrong with humbly stating "I think this thing is needed" it's different from saying "PYthon Sucks! It doesn't have xx" by a mile :) Thanks for the memoization snippet, interesting stuff. -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From sanderson at ttm.com Wed Feb 9 10:19:57 2000 From: sanderson at ttm.com (Scott Anderson) Date: Wed, 09 Feb 2000 10:19:57 -0500 Subject: Question concerning makepy.py for COM (long, code included) Message-ID: <38A1859D.6AE7AF0E@ttm.com> Hi all, I have a 32-bit ActiveX OCX control that I wish to use in Python. Please forgive any obvious ignorance on COM... I have, however, read the QuickStarts and other related materials. I ran the makepy.py script that comes with the win32com distribution (the 128 release). From the file produced, it is not entirely obvious how to instantiate and use the objects. The code produced is included below; I changed the names because I'm not sure of the confidentiality, and I removed code that doesn't appear germane to the question. TSHSWAPI is the COM object that is actually used in, say, VB. However, _DTSHSWAPI is the one that appears to export the methods for that class. So, the question is, how do I use the _DTSHSWAPI functionality from this class? Also, how is the event interface implemented? Thanks muchly in advance, -scott # Created by makepy.py version 0.3.1 from xxxxx.ocx # On date: Tue Feb 08 16:14:15 2000 makepy_version = '0.3.1' [...] class _DTSHSWAPI(DispatchBaseClass): CLSID = pythoncom.MakeIID('{the class ID 3}') def AboutBox(self): return self._ApplyTypes_(0xfffffdd8, 1, (24, 0), (), 'AboutBox', None) def AckHost(self): return self._ApplyTypes_(0x9, 1, (2, 0), (), 'AckHost', None) def CloseSession(self): return self._ApplyTypes_(0x4, 1, (2, 0), (), 'CloseSession', None) def EnableHost(self): return self._ApplyTypes_(0xb, 1, (2, 0), (), 'EnableHost', None) def GetCommStatus(self, CommType=defaultNamedNotOptArg): return self._ApplyTypes_(0x5, 1, (2, 0), ((2, 0),), 'GetCommStatus', None, CommType) def OpenSession(self, HostType=defaultNamedNotOptArg, DeviceType=defaultNamedNotOptArg, PortType=defaultNamedNotOptArg): return self._ApplyTypes_(0x2, 1, (2, 0), ((2, 0), (2, 0), (8, 0)), 'OpenSession', None, HostType, DeviceType, PortType) def RetrieveAvailableIATAs(self, ReturnString=defaultNamedNotOptArg, ReturnStringLength=defaultNamedNotOptArg, HostType=defaultNamedNotOptArg, DeviceType=defaultNamedNotOptArg, PortType=defaultNamedNotOptArg, ReturnIATACount=defaultNamedNotOptArg): return self._ApplyTypes_(0xa, 1, (2, 0), (((26, 8), 0), (2, 0), (2, 0), (2, 0), (8, 0), ((26, 2), 0)), 'RetrieveAvailableIATAs', None, ReturnString, ReturnStringLength, HostType, DeviceType, PortType, ReturnIATACount) def RetrieveIATAString(self, ReturnString=defaultNamedNotOptArg, ReturnStringLength=defaultNamedNotOptArg): return self._ApplyTypes_(0x7, 1, (2, 0), (((26, 8), 0), (2, 0)), 'RetrieveIATAString', None, ReturnString, ReturnStringLength) def RetrievePrintDeviceInfo(self, WorkstationName=defaultNamedNotOptArg, ReturnString=defaultNamedNotOptArg, ReturnStringLength=defaultNamedNotOptArg): return self._ApplyTypes_(0x8, 1, (2, 0), ((8, 0), ((26, 8), 0), (2, 0)), 'RetrievePrintDeviceInfo', None, WorkstationName, ReturnString, ReturnStringLength) def RetrieveProtocolType(self, ReturnString=defaultNamedNotOptArg, ReturnStringLength=defaultNamedNotOptArg): return self._ApplyTypes_(0x6, 1, (2, 0), (((26, 8), 0), (2, 0)), 'RetrieveProtocolType', None, ReturnString, ReturnStringLength) def Send(self, Data=defaultNamedNotOptArg, DataLength=defaultNamedNotOptArg): return self._ApplyTypes_(0x3, 1, (2, 0), ((8, 0), (3, 0)), 'Send', None, Data, DataLength) _prop_map_get_ = { "ApplicationName": (1, 2, (8, 0), (), "ApplicationName", None), } _prop_map_put_ = { "ApplicationName" : ((1, LCID, 4, 0),()), } class _DTSHSWAPIEvents: CLSID = CLSID_Sink = pythoncom.MakeIID('{the class ID 2}') _public_methods_ = [] # For COM Server support _arg_transformer_ = arg_transformer _dispid_to_func_ = { 1 : "OnSessionStatus", 2 : "OnHostStatus", 5 : "OnLanStatus", 4 : "OnDataAvailable", 3 : "OnMessageError", } def __init__(self, oobj = None): if oobj is None: self._olecp = None else: import win32com.server.util cpc=oobj._oleobj_.QueryInterface(pythoncom.IID_IConnectionPointContainer) cp=cpc.FindConnectionPoint(self.CLSID_Sink) cookie=cp.Advise(win32com.server.util.wrap(self)) self._olecp,self._olecp_cookie = cp,cookie def __del__(self): try: self.close() except pythoncom.com_error: pass def close(self): if self._olecp is not None: cp,cookie,self._olecp,self._olecp_cookie = self._olecp,self._olecp_cookie,None,None cp.Unadvise(cookie) def _query_interface_(self, iid): import win32com.server.util if iid==self.CLSID_Sink: return win32com.server.util.wrap(self) # Handlers for the control # If you create handlers, they should have the following prototypes: # def OnSessionStatus(self, SubCondition=defaultNamedNotOptArg): # def OnHostStatus(self, SubCondition=defaultNamedNotOptArg): # def OnLanStatus(self, SubCondition=defaultNamedNotOptArg): # def OnDataAvailable(self, SubCondition=defaultNamedNotOptArg, Data=defaultNamedNotOptArg, DataLength=defaultNamedNotOptArg, EraseWrite=defaultNamedNotOptArg, LineAddress=defaultNamedNotOptArg): # def OnMessageError(self, SubCondition=defaultNamedNotOptArg): [...] # This CoClass is known by the name 'XXXXX.TSHSWAPICtrl.1' class TSHSWAPI(CoClassBaseClass): # A CoClass CLSID = pythoncom.MakeIID("{the class ID 1}") coclass_sources = [ _DTSHSWAPIEvents, ] default_source = _DTSHSWAPIEvents coclass_interfaces = [ _DTSHSWAPI, ] default_interface = _DTSHSWAPI [...] CLSIDToClassMap = { '{the class ID 1}' : TSHSWAPI, '{the class ID 2}' : _DTSHSWAPIEvents, '{the class ID 3}' : _DTSHSWAPI, } From prestonlanders at my-deja.com Wed Feb 23 11:36:04 2000 From: prestonlanders at my-deja.com (Preston Landers) Date: Wed, 23 Feb 2000 16:36:04 GMT Subject: Installing on Win 2K? Message-ID: <89129k$1iv$1@nnrp1.deja.com> Hey All, I haven't seen any recent threads on this subject so I thought I'd inquire. (I've also searched Deja to no avail...) I'm having trouble installing the standard Python1.5.2 windows installer on MS Windows 2000 (NT 5). Normally I work in Linux but I would like to test my application (Pagecast: http://pagecast.sourceforge.net) in Windows. I try to run the installer as the Admin user. I get to the part where one selects which components to install. I select them all and click "OK". After that, the application stops responding and I am forced to kill it. Has anyone succesfully installed Python on W2K? Is there something I'm missing? thanks in advance! -- || Preston Landers || Sent via Deja.com http://www.deja.com/ Before you buy. From tbryan at python.net Fri Feb 18 23:43:05 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Fri, 18 Feb 2000 23:43:05 -0500 Subject: Database API explanation References: <20000218202732.A8483@bork> <14509.35237.846925.600407@beluga.mojam.com> Message-ID: <38AE1F59.C109C93B@python.net> Skip Montanaro wrote: > > Egbert> I need some help or explanation on the Python Database API > Egbert> Specification [12].0 especially how to use them with MySQL, but > Egbert> of course some general tutorial is very welcome as well. > Having overcome the same hurdle with some help from the list, I'll toss out > a few things I learned. It is largely empty at the moment, but it would be great if some enthusiastic Python DB programmers would add to http://starship.python.net/~tbryan/Database/Snippets/ It's a FAQ wizard for collecting fragments of DB code. Once it reaches some critical mass, then we can point newbie Python DB programmers to it... I'm still waiting for some spare time to play with Python and databases, but I haven't even touched mxODBC since summer. Here's an echo from the past: My Goal: The Python DB-API Code Fragment Library will act as a repository for code fragments (short and long) showing how to use a DB-API compliant database extension. It will also act as a repository for code showing the quirks and exceptions when using specific databases and their extensions. This code library is maintained by its users. That is, if you want to add an example, please do! If you find and entry that no longer works, fix it. Organization: Section 1. general info about Python, the DB-API, Section 2. generic code for all DB-API compliant databases/modules; hopefully the largest section some day, code in this section should work with any Python interface that has fully implemented the spec Section 3+. specific info about using various databases from Python. The first entry is always general info about options for accessing the database from Python (ODBC, one or more extension modules, etc.). The following entries should show code that illustrates that database's quirks/deviations from the API or the quirks/deviations of specific extension modules for using that database. I decided to organize the sections by databaes instead of by python extension module. I thought that a DB user would find it easier to locate the information that he needs that way. I reserved section one for non-code stuff...just info about the code library and such. I also reserved the first entry of every section for some info about using a specific database with python (which modules are available, from where, etc.) Please add code, modify code, make the code library grow, send me suggestions (at tbryan at python.net), and generally just get excited about databases and Python for a few weeks. A few weeks of fervor followed by a long idle period where we all neglect the library still leaves a nice library for newbies to steal code from. :) The password for changes is: albatross ---Tom From robin at jessikat.demon.co.uk Fri Feb 18 08:41:30 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Fri, 18 Feb 2000 13:41:30 +0000 Subject: tkinter + stubs References: <9qnJpBA0STr4Ew0D@jessikat.demon.co.uk> Message-ID: In article , Fredrik Lundh writes >Robin Becker wrote: >> having just had to recompile _tkinter for the third time in the last >> year I would like to make a plea to Guido to allow export of the dynamic >> load code in the future python16.dll. >> >> My reasoning is this; if stubs are ever to be used with _tkinter the >> steps to be carried out are >> >> determine suitable tcl/tk dynamic libraries. >> find and call Tcl_CreateInterp () to get an initial interpreter >> find and call Tcl_InitStubs(interp,version,0) >> find and call Tk_InitStubs(interp,version,0) >> >> to do this easily would mean duplicating all the dynamic loading code. >> However, if we could avoid always using the "init" prefix then we get >> the dynamic load almost for free if the entry points are exported. > >can you explain what "stubs" are, for an ordinary python >mortal (or point to an explanation)? > >last time I checked, it looked like a home-brewn dynamic >linking scheme (do it all by hand, instead of using the run- >time linker?)... To allow tcl & friends to import extensions without forcing the extensions to be explicitly linked with a specific tcl/tk dynamic library the tcl folks produced a method called stub loading. basically the extension calls all the tcl/tk entry points indirectly. Normally tcl calls a newly loaded extension with a pointer to the interpreter as argument. The extension can fill in the indirection pointers using the statically loaded function Tcl_InitStubs. Thus by taking the hit of a fixed size indirection table and the fillin routine the extension becomes relatively independent of the tcl that calls it; the indirection cost is relatively small for the kind of things that tcl does. The _tkinter case is slightly different in that _tkinter embeds Tcl/Tk, but we can get round that if we dynamically load Tcl, Tk ourselves and then grab the first interpreter for filling in the Tcl/Tk stub indirections. We would then have a _tkinter that would not need to be recompiled for 8.3.1 .... 8.4 etc. Since _tkinter already has a .py stage we could put the names of libraries to be used into source to be passed into an initialise function and thus avoid a potentially hazardous library search. Tcl/Tk appears to have a faster release schedule than python so this could be desirable. An additional benefit is that a dynamic loader module could leverage off the exposed pythonic routines. -- Robin Becker From ullrich at math.okstate.edu Tue Feb 1 16:33:53 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 01 Feb 2000 15:33:53 -0600 Subject: Dynamic class construction? References: <1262691707-4436418@hypernet.com> Message-ID: <38975141.D8C1566B@math.okstate.edu> Gordon McMillan wrote: > David C. Ullrich writes: > > > If the docs are going to change more often than the program > > (which is a good thing) the docs should have separate version > > numbers. I could download the revised docs, but I don't see the > > point, since I have no way of knowing tommorow whether > > they're still current. > > You watch the list. I hope you paid no attention to the reply I sent to the email on this - I took "list" to mean something else. I didn't realize until someone hit me on the head just now that there _was_ a list of old versions of the docs available, including dates. Yes, watching that list is exactly how you do it. Sorry. I didn't know that list existed. I didn't look very hard. I was bad. Bad bad bad. > Fred announces these things. There's > often a couple soon after a new release, but unless you're > paying long distance for a 300 baud connection, it's usually > worth the download. > > - Gordon From greg at perceval.be Mon Feb 28 12:33:27 2000 From: greg at perceval.be (Gregoire Welraeds) Date: Mon, 28 Feb 2000 18:33:27 +0100 (CET) Subject: difference between __repr__() and __str__() In-Reply-To: Message-ID: The question is in the subject. According to the Python reference manual, page 17 __repr__: called to compute the official string representation of an object. This should like a valid Python expression that can be used to recreate an object with the same value. __str__: differs from repr in that in does not have to be a valid python expression: a more conveniant or concise representation maybe used instead. What is a valid Python expression ? I though that repr was called by repr and by string conversion (as mentionned early in the doc)not to recreate an object ? What is the use of an official string representation against the non-official ? -- 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 gavrilov at iname.com Tue Feb 8 20:20:21 2000 From: gavrilov at iname.com (Alexander Gavrilov) Date: Wed, 09 Feb 2000 01:20:21 GMT Subject: Database with a web-interface (CGI) References: <38A00022.3CC17880@aston.ac.uk> Message-ID: Probably, it's not exactly what you want, but you can take a look on Zope (http://www.zope.org). Peter Bittner wrote in message news:38A00022.3CC17880 at aston.ac.uk... > Hi there! > > I need to build a web-interface with a database in the background > (probably Oracle; possibly MySQL), so I need to write a Python > CGI-script that takes input from an HTML-form and puts the data into the > database (Input-operation) and, repectively, gets data out of the > database with an SQL-query and displays the result in the browser. > > I've looked for example-source, but there doesn't seem to be much in the > Web on Python (unlike Perl & PHP). :o( > > Does anyone have some example source? > > Please, help! > Peter > > | Peter H. Bittner > | International Student at Aston University > | e-mail: bittneph at aston.ac.uk > | web: http://beam.to/bimbo > +-------------------------- From aahz at netcom.com Mon Feb 7 19:55:56 2000 From: aahz at netcom.com (Aahz Maruch) Date: 8 Feb 2000 00:55:56 GMT Subject: deleting global namespaces References: <87fm8a$v4j$1@nnrp1.deja.com> <20000205154128.A14392@xs4all.nl> <87hiam$6lk$1@nnrp1.deja.com> Message-ID: <87npis$spa$1@nntp6.atl.mindspring.net> In article <87hiam$6lk$1 at nnrp1.deja.com>, wrote: > >That's clear but it does not solve my problem. I know objects and use >them extensively, but I need to divide the whole application (which >consists of hundrends of objects) into independent components each >with its own global namespace so that component's objects can use this >global namespace independently on other objects in other components. In that case, you need a two-tiered (or more) object system, where higher level objects contain instances of lower-level objects in a list or dict. The higher level object provides the namespace to the lower level objects through callback functions. Note that you'll need to be VERY careful about circular references with a system like this. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Copyright 2000 by aahz at netcom.com. If you see any links around individual words in my posts, they have been put there in violation of copyright (most likely by remarq.com). I encourage you to boycott any ads you see links to. From tseaver at starbase.neosoft.com Tue Feb 8 23:38:24 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 8 Feb 2000 22:38:24 -0600 Subject: FreeTDS libraries for Sybase/MSSQL References: <389FA387.785D30C6@bby.com.au> Message-ID: <08DA955C4C464B91.158984E3FE76EE6F.96DE9865A9C052F6@lp.airnews.net> In article <389FA387.785D30C6 at bby.com.au>, Sarah Burke wrote: >Has anyone integrated the FreeTDS C libraries into Python code for >connecting to Sybase or MSSQLS? Would anyone be interested in this? >Sarah > There is a How-To on the Zope site which should help some: http://www.zope.org/Members/TheJester/SybaseDA Note that it is specifically about using the FreeTDS libraries in conjunction with the Zope Sybase Database Adapter, and is aimed primarily at FreeBSD. Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From pj at sgi.com Sat Feb 19 00:19:58 2000 From: pj at sgi.com (Paul Jackson) Date: 19 Feb 2000 05:19:58 GMT Subject: binary distribution for SGI References: <38ADE87D.5E1110FB@pacific.jpl.nasa.gov> Message-ID: <88l95u$727am@fido.engr.sgi.com> A binary distribution of Python for SGI (Irix) systems is included in the "freeware" product, as 'inst' product name fw_python. However, I usually compile mine from source, out of habits from pre-freeware days. You only need to be root to do the final 'make install' step (not surprising, since that step installs files into system directories). If you posted more detail on why your compile of the source failed, likely someone will be able to provide an easy solution. -- ======================================================================= 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 akuchlin at mems-exchange.org Wed Feb 23 16:08:09 2000 From: akuchlin at mems-exchange.org (Andrew M. Kuchling) Date: 23 Feb 2000 16:08:09 -0500 Subject: Tkinter: user vs. program events References: <3d1z65kr2j.fsf@amarok.cnri.reston.va.us> <88v2f5$7md$1@wanadoo.fr> Message-ID: <3dn1orfwzq.fsf@amarok.cnri.reston.va.us> "Fredrik Lundh" writes: > why not just add a semaphore? > > def adjust_light(self): > if self.status_update: > return > ... > def handle_status_event(self): > ... > try: > self.status_update = 1 > self.light_scale.set(value) > finally: > self.status_update = 0 That's what I first thought, but it doesn't work. The light_scale.set() call doesn't recursively invoke adjust_light(). Instead, I assume the .set() call adds an event to a queue inside Tk which will be handled on re-entering Tk's main loop. In other words, handle_status_event() is called and it returns, and *then* adjust_light() is called as a result of the set. The solution is probably "Don't do that, then"; I should have text labels that give the current state, and leave the scale widget to only be manipulated by the user. That way the user don't have to worry about an ill-timed status update suddenly moving the setting while trying to fine-tune the setting. -- A.M. Kuchling http://starship.python.net/crew/amk/ "The thing is, Doctor, is there anything I can do?" "Yes, pass me a silicon rod, will you?" -- The Brigadier and the Doctor, in "The Three Doctors" From tim_one at email.msn.com Thu Feb 24 02:46:04 2000 From: tim_one at email.msn.com (Tim Peters) Date: Thu, 24 Feb 2000 02:46:04 -0500 Subject: functional programming In-Reply-To: Message-ID: <000401bf7e9b$348ab740$e42d153f@tim> [Moshe Zadka, to Aahz] > Assuming we're still in "search of truth" mode, rather then "proving > I'm right" mode, I want to clarify my claim: *efficienct* functional > programming is, in general, impossible without tail-recursion. I don't > agree with the timbot that tail-recursion is contrary to the "Python > Way", but it's not in Python right now, anyway. > > Are we in agreement now? You and Aahz maybe, but now we've got a fight . There's nothing un-Pythonic about recursion, tail or otherwise. It's tail-call *optimization* that's un-Pythonic, as it's a gimmick supported by only a handful of widely unused <0.5 wink> languages and surprising to people coming from anything else: damaging tracebacks would be Major Badness, much worse than the gain for the relative thimbleful of people who are uncomfortable coding loops etc. proving-i'm-right-*is*-searching-for-truth-ly y'rs - tim From gmcm at hypernet.com Fri Feb 18 12:45:17 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 12:45:17 -0500 Subject: PyGreSQL and windows In-Reply-To: References: Message-ID: <1261224167-75420@hypernet.com> Oleg Broytmann wrote: > ODBC is the M$ standard to access databases. To access a database you > need universal ODBC manage and a driver for your particualr database. > Postgres does have the driver... While created at MS, it's the SQL standard for a CLI (Call Level Interface). Which is probably why MS would rather you used ADO. - Gordon From jean.hemmi at arakne.com Fri Feb 4 03:43:03 2000 From: jean.hemmi at arakne.com (Jean Hemmi) Date: Fri, 04 Feb 2000 08:43:03 +0000 Subject: mapped files and mmap() wrapper in Python? Message-ID: <389A9117.C4CBAD14@arakne.com> Hello, Has somebody been working on a wrapper module around the mmap() set of functions ? The purpose would be to provide for providing Python access to mapped files, I imagine that the implementation would have the mapped memory areas appear as Python buffer objects (in read or read/write modes), and that sub-buffer objects could be extracted... I'll be glad to hear from any one having approached the subject... Regards, Frederic Giacometti, Arakne tel 617 359 6500 From jae at ilk.de Thu Feb 10 19:42:40 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Fri, 11 Feb 2000 01:42:40 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <38A34199.BF367B98@americasm01.nt.com> (eaglesto@americasm01.nt.com) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> <38A28055.D8F187EB@inka.de> <38A34199.BF367B98@americasm01.nt.com> Message-ID: <11022000.2@satellite.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Robert" == Eaglestone, Robert [NGC:B918:EXCH] writes: Robert> Michael Str?der wrote: >> >> => Modula. Score 10/10 >> >> if foo then >> bar; >> stool; >> else >> nobar; >> end; >> Robert> Modula gets 9/10. Can't just use 'end', silly! Robert> Not enough context! How about this: Sorry, Michael is right... I've worked in Modula-2 for a number of years (before I got seduced by the evil C ;-) The only thing wrong with Michael's example is that it's lower case... IF foo THEN bar; stool; ELSE nobar; END (*IF*); (I've got lots of "END (*IF*);"'s in my M2 sources... ;-) Robert> if ( foo ) Robert> bar; Robert> stool; Robert> else Robert> nobar; Robert> endif Pray tell, what is this? The bastard child of C and (Visual)Basic? ;-)) Modula-2-was-my-first-love-ly y'rs, J PS: My first love among programming languages, of course! ;-) PPS: Well, it certainly was the first language I bought a compiler for... and the last one ;-) - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://members.tripod.com/~Juergen_Erhard Electronic Frontier Foundation (http://www.eff.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 iEYEARECAAYFAjijWv8ACgkQN0B+CS56qs2oEgCeIQVWTWMwEyv4ihMsJS1Wa+R3 YT4AnR1QUmt7YgiiT3l9toNM+9rQyHU1 =uadq -----END PGP SIGNATURE----- From urner at alumni.princeton.edu Wed Feb 2 20:19:51 2000 From: urner at alumni.princeton.edu (Kirby Urner) Date: Thu, 03 Feb 2000 01:19:51 GMT Subject: re AMTE thread re DrScheme & Python References: <65118AEEFF5AD3118E8300508B124877073D52@webmail.altiris.com> Message-ID: <3898d76d.201105044@news.teleport.com> Probably someone else will post this as well, but since I started this thread, I might as well complete the job by ending it (sort of). Here's a concluding post. Looks like a truce has been called. Kirby ======================================= From: D012560c at aol.com Date: Wed, 2 Feb 2000 19:44:45 EST Subject: Computers in Math Class (was Math Myopia...) To: amte at esunix.emporia.edu CC: pdx4d at teleport.com X-Mailer: AOL 5.0 for Windows sub 45 Marvin, please post the following to the newsgroup/page where you sent my original post. Thanks -- Matthias --------------------------------------------------------------------------- Dear Readers: A couple of days ago Marvin Hernandez asked for my opinion concerning the Python Web page on Programming for Everybody. The Web page then contained a table that compared aspects of programming languages, in particular, the teachability of Scheme and its programming environments. As the leader of the TeachScheme project and a researcher, I was deeply disturbed by the contents of this table considering that the text contained no other support. In the meantime, Guido van Rossum and I exchanged private email and came to a mutually agreeable position. He has removed his table and has prefixed his page with "Note:I have made one change to the text of the proposal: At the request of some supporters of other languages, I've withdrawn a language comparison chart that contained highly personal and sometimes unfounded opinions of other languages. The table was being used out of context in a way that some found objectionable. (Not all of the table is disputed, but it seems wiser not to engage in direct language comparisons without a lot more documentation.)" I, in turn, sincerely apologize for writing an emotional evaluation about Python and its users. I should not have given permission to post my first reaction to a newsgroup about which I knew nothing. I particularly regret using the word "cult" for Python users. -- Matthias Felleisen From james+news at daa.com.au Mon Feb 7 21:54:01 2000 From: james+news at daa.com.au (James Henstridge) Date: Tue, 08 Feb 2000 02:54:01 GMT Subject: Subclassing ExtensionClasses in C? Message-ID: <389F834D.6842694D@daa.com.au> I send this message a few weeks ago, but didn't get any response. Does anyone know if ExtensionClass is capable of doing this? Here is the original message: I have a small question about using ExtensionClass with my python module. It was suggested to me recently that I may want to look at rewriting my python extension pygtk to use ExtensionClasses (to increase speed, decrease mem usage, and a few other benefits). For those who have not used pygtk, it is a wrapper for the GTK GUI widget set (see www.gtk.org). If I switched over to using ExtensionClass, I would want to create a heirachy of ExtensionClasses implemented in C as wrappers for the various widgets. Looking through the documentation for ExtensionClass, it has examples of how to create classes in C that can be subclassed in python, but it does not seem to have any examples of how to write one extension class that subclasses another extension class. I assume that this is possible, but I haven't seen any examples. Is it possible to do with the public ExtensionClass API, or is it a little more difficult. If anyone can help with this, I would appreciate it. Thanks in advance, James Henstridge. From tjg at avalongroup.net Fri Feb 18 15:31:24 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Fri, 18 Feb 2000 12:31:24 -0800 Subject: Compiled code question Message-ID: <38ADAC1C.5A1D3388@exceptionalminds.com> Hi all, I have been noticing something odd with my python programmes when run on Win machines. I do all my development and most of my testing on Linux, but my users are using Windows boxes. Each windows user has Python and the win32 python extensions installed on their machines. They also have an icon that points to the .py file on the server. When I copy a new version of the .py to the server I kinda thought that the next time my users double-clicked their icons they would be running the new code, this didn't happen. On the windows boxes, I must load the .py into PythonWin, select the Run button, then exit my programme. Now if the icon is double-clicked, the new code is executed. I'm sure this has something to do with the byte code compiler and windows file associations, but I have no idea what. It is only a minor annoyance, but I would love to get to the bottom of it just for my own personal edification. Thanks. -- Stand Fast, tjg. Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From Sven.Drescher at dlr.de Tue Feb 1 10:30:06 2000 From: Sven.Drescher at dlr.de (Sven Drescher) Date: Tue, 1 Feb 2000 16:30:06 +0100 Subject: Need help with Tk problem... References: <876ook$ieq$1@news.go.dlr.de> <003301bf6cc8$6bb200f0$f29b12c2@secret.pythonware.com> Message-ID: <876u1c$8pe$1@news.go.dlr.de> > I know the options geometry, width and height. But if the frame grows or > shrinks, these options don't change. What did I wrong? Is there an other > function to get the current size??? reading the fine manual might help; go to http://www.pythonware.com/library/tkinter/introduction/basic-widget-methods. htm -> window related information and look for winfo_width() and winfo_height() (also see reqwidth/reqheight) Thanks, for the manual!!! I forgot to call 'update_idletasks()'! Thanks, Sven From alex at somewhere.round.here Tue Feb 22 21:39:37 2000 From: alex at somewhere.round.here (Alex) Date: 22 Feb 2000 21:39:37 -0500 Subject: PROPOSAL: fix tabs & spaces in default library References: <20000213201812.A4849@stopcontact.palga.uucp> <38B343D2.4D935CDA@cosc.canterbury.ac.nz> Message-ID: > I think that all lines should end with the word "spam" spelled out in > Morse code using tab for dash and space for space. And hash for dot? Alex. From brent.fulgham at xpsystems.com Tue Feb 29 12:54:05 2000 From: brent.fulgham at xpsystems.com (Brent Fulgham) Date: Tue, 29 Feb 2000 09:54:05 -0800 Subject: More help with Object Caching Message-ID: Note: I sent this mail yesterday, but problems at my ISP have delayed it. So you might see this come through again later today (with more detail than I can give from memory here): I've discovered that when I put one of my 'stringified' objects into my Cache, they don't come back out. Take for example: // Note: 'code' is a valid PyCodeObject* char* cacheable = PyMarshal_WriteObjectToString(code); long size = PyObject_Length(code); // This works PyObject* test1 = PyMarshal_ReadObjectFromString(cacheable, size); PyCodeObject* codeTest1 = (PyCodeObject*)test1; // This fails char* newCache = malloc(length*sizeof(char)); strncpy(newCache, cacheable, size); PyObject* test2 = PyMarshal_ReadObjectFromString(newCache, size); // Fails -- test2 is NULL. Can anyone suggest what I am doing wrong here? I'm guessing that PyObject_Length(code) is not returning the full size that needs to be copied (i.e., cacheable to cacheable+length does not encompass the entire object). Is there some trailer information that is not included in the "length" value? But then, why does the first PyMarshal_ReadObjectFromString work, since it is passed the same "size" variable. Perhaps the strncpy is not valid? Or should everything be stored as "unsigned char" instead of "char" for some reason? Any help greatly appreciated. Regards, -Brent -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpet at eskimo.com Wed Feb 23 03:43:09 2000 From: jpet at eskimo.com (Jeff Petkau) Date: Wed, 23 Feb 2000 08:43:09 GMT Subject: functional programming References: Message-ID: Neel Krishnaswami wrote in message news:slrn8b69pc.bv3.neelk at brick.cswv.com... > Fran?ois Pinard wrote: > > P.S. - Yes, I know it has been theoretically proven that we could design > > computers needing no energy, if we could fully avoid side-effects, but I > > beg to do not consider this a practical advantage yet. :-) > > Actually, this *isn't* so! > > Consider a computer with a memory space of N bits. After performing > some number of arbitrary computations, the memory space will be in a > random configuration of ones and zeros.[*] > [...] Hence the notion of reversible computers (which actually don't care whether you're programming in a functional style, so my post is *really* off topic, sorry about that). For every primitive logic operation, you add enough output lines so that you can figure out from the output what the input must have been. Then you run your computer to solve your problem, copy off the answer (here you pay the thermodynamic price, but it's very very small) and then run your computer backwards to its initial state. So you don't have to erase all those bits in the memory space. I think Feynman came up with this notion first, around 1980 or so. Here's a link courtesy of Google: http://www.ai.mit.edu/~cvieri/reversible.html Now back to your regular scheduled Python. --Jeff From charleshixsn at earthlink.net Tue Feb 29 16:22:38 2000 From: charleshixsn at earthlink.net (Charles Hixson) Date: Tue, 29 Feb 2000 21:22:38 GMT Subject: Python misconceptions in IBM Ruby article... References: Message-ID: <38BC3894.56C9CEDF@earthlink.net> Fortran doesn't (didn't?) even use white-space to delimit its variables. And in '70 Fortran had a semi-colon mode where semi-colons ended (separated?) statements. From gerrit.holl at pobox.com Thu Feb 17 15:46:01 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 17 Feb 2000 21:46:01 +0100 Subject: Which GUI? In-Reply-To: ; from vetler@ifi.uio.no on Thu, Feb 17, 2000 at 03:31:48PM +0100 References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: <20000217214601.B2438@stopcontact.palga.uucp> Vetle Roeim wrote on 950797908: > I-hope-this-doesn't-start-a-gui-war--ly y'rs, vr I disagree. The latest gui war was over half a year ago, and wxPython was abandoned than. But it growed. I'd like to see an answer to ESR's question: Why the hell hasn't wxPython become the standard GUI for Python yet? regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From bjorn at roguewave.com Tue Feb 8 13:14:42 2000 From: bjorn at roguewave.com (bjorn) Date: Tue, 08 Feb 2000 11:14:42 -0700 Subject: Wrapper for Cosmo3D swig vs c++ References: <38A056DA.BA4D1512@cui.unige.ch> Message-ID: <38A05D11.939EB096@roguewave.com> I haven't used CXX, so I can't give you any comparisons... However, as far as swig goes, it's only a very minor perfomance hit in converting the arguments to and from Python objects. Any routine that is too slow should be relatively easy to translate to c/c++ and then swig. It also seems like you're under the misconception that swig will take your c++ header files and generate shadow classes directly. Unfortunately this is not true. With some work (sometimes a lot of work) it can be possible to get swig to parse a c++ header file, most of the time it is better to just bite the bullet and write the interface file. Areas to watch out for are inline code, and overloads (I once wrote an elaborate scheme to get overloading of the basic types from Python, which worked although it wasn't very pythonesque). --bjorn Sunil Hadap wrote: > Hello, > > I am set for creating wrappers for SGI's Cosmo3D 3d graphics API. The > API is c++ one. As I count, there are around 100 classes, just to get > idea of the volume. I have 2 options > > a) To use Swig - I learnt from the swig manual that it can help in > creating the Python classes as in Cosmo3D at the cost of performance. > I did not get the point. What I see is there is just a def statement > in the shadow class which links class member function to a swig > generated wrapper function. I suppose def is a simple namespace alias > which is not a major overhead. I hope I am not wrong. Is this > something I should worry or just use swig with very minor performance > overhead. > > b) Use c or better c++ (CXX) api. Am I getting into a big task > considering 100 classes to wrap. Is it worth the performance I get. I > have not even studied c/c++ API, hence could not visualize how it will > improve the performance. After all swig will generate similar code > except with different namespace entries, and then the shadow class. > > Thank you very much > > Sunil > > -- > "Live as if you would die tomorrow, > learn as if you would live forever." > --Mahatma Gandhi > -- > http://www.python.org/mailman/listinfo/python-list From gerrit.holl at pobox.com Thu Feb 3 10:09:00 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 3 Feb 2000 16:09:00 +0100 Subject: [Doc-SIG] Monty: A structured text syntax idea In-Reply-To: <20000131092101.B17073@cnri.reston.va.us>; from gward@cnri.reston.va.us on Mon, Jan 31, 2000 at 09:21:01AM -0500 References: <3.0.6.32.20000129102716.009cd5c0@gpo.iol.ie> <20000131092101.B17073@cnri.reston.va.us> Message-ID: <20000203160900.A1029@stopcontact.palga.uucp> > > """ > > idea: > > para: > > I was editing some text in Python emacs mode the > > other day. > > para: > > I got to thinking how Python mandatory indentation > > emph: > > removes > > much of the need for delimiters I don't like it. For blocks its okay, but for inline thinks it - sucks. In tag language (XML etc.), things get nested much too deep to use this proposal. And blocks are much longer. It should be clear what tag is closed. I don't like it. I think XML suits better. regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From jeremy at cnri.reston.va.us Mon Feb 14 16:21:10 2000 From: jeremy at cnri.reston.va.us (Jeremy Hylton) Date: Mon, 14 Feb 2000 16:21:10 -0500 (EST) Subject: Wash. D.C. Area: DCPIGgies, Mar. 13 Message-ID: <14504.29126.591718.912874@goon.cnri.reston.va.us> Notice to all Washington DC area Python users: We will be having our first DCPIGgies (DC Python Interest Group) meeting of the year on Monday March 13, 2000 from 7:30pm to 9:00pm at CNRI in Reston, Va. Speaker: Scott Cotton Static Type and Interface Checking for Python General Review and Fundamental Decisions Abstract ---------- This presentation reviews various possible ways of adding static type checking to python. The problem poses two questions: 1) What sort of static type checking system would be most appropriate for python? 2) By what means may static type checking be made optional? A decision tree for each question is presented based on a combination of type theory, an understanding of python, and properties that have become apparent in the development of a sample type checking system. Finally, we discuss some overall approaches that would maximize the benefits and/or minimize the drawbacks of adding optional static type checking to python. Scott will be speaking from 8:00 to 9:00pm. We will have food and introductions starting at 7:30pm. We may also have some time after the talk for Q&A with Guido and Barry on Python and JPython. Pizza, salad, and soda will be provided courtesy of Foretec Seminars. Please RSVP by email to jeremy at cnri.reston.va.us. I need to know how many people will attend and how many will be eating pizza. Directions to CNRI can be found on the Web: http://www.cnri.reston.va.us/directions.html Mailing list: There is a mailing list for people interested in DCPIGgies meetings; see http://www.python.org/mailman/listinfo/dcpiggies. This is a low volume list for announcing meetings, arranging to share rides, and other thrilling PIGgy topics. See you there! Jeremy From cpatti at atg.com Fri Feb 18 16:25:51 2000 From: cpatti at atg.com (chris patti) Date: 18 Feb 2000 16:25:51 -0500 Subject: Review of the new TK book from Manning? References: <38AD953A.F89C5515@exceptionalminds.com> Message-ID: Timothy Grant writes: > Is there anyone out there who can provide a review of the new Tkinter > book that was just published by--I believe Manning? > > Thanks. Yes I'm most interested too... Specifically, is it sullied by the same unacceptably high level of typos visible in "The Quick Python Book" ? I hope not, it's a real shame that TQPB's authors got taken to the cleaners by a careless typesetter. -Chris -- -------------------------------------------------------------------- Chris Patti \ Art Technology Group \ 617-386-1649 \ cpatti at atg.com -------------------------------------------------------------------- From nascheme at enme.ucalgary.ca Fri Feb 4 02:44:38 2000 From: nascheme at enme.ucalgary.ca (nascheme at enme.ucalgary.ca) Date: 4 Feb 2000 07:44:38 -0000 Subject: Circular references and python In-Reply-To: <000c01bf6ed3$51946de0$a2a0143f@tim> References: <000c01bf6ed3$51946de0$a2a0143f@tim> Message-ID: <20000204074438.6110.qmail@adler.dynodns.net> In comp.lang.python, you wrote: >I don't expect reference counting will ever go away in CPython (too many >people like its relatively predictable semantics. too), although I do expect >*some* way to reclaim cycles (at unpredictable times) will eventually be >added. I have been looking at Toby Kelsey's code. It seems quite interesting. Do you think something like it would have a chance to be accepted by Guido? Perhaps you can also explain why splay trees are used. There doesn't seem to be any need to keep things sorted. I don't fully understand the code yet so perhaps I am missing something. Thanks for your always entertaining posts in c.l.p. Neil -- "If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor, and when was the last time you needed one?" -- Tom Cargil, C++ Journal. From moshez at math.huji.ac.il Fri Feb 18 06:23:49 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 13:23:49 +0200 (IST) Subject: Continuations and threads (was Re: Iterators & generators) In-Reply-To: Message-ID: On Fri, 18 Feb 2000, Toby Dickenson wrote: > What are the implications for the continuation-naive in a > post-stackless world. What about functions such as... > > def x(): > before() > try: > y() > finally: > after() The Scheme world calls this dynamic-wind. To be concrete (dynamic-wind before thunk after), in the absence of continuations, the same as (before) (thunk) (after) However, in the presence of continuation, it is guranteed whenever "thunk" is entered execution, "before" is called, and whenever "thunk" stops execution, "after" is called. Here's a quote from R^5RS: (dynamic extent are those times protected by before/after): * The dynamic extent is entered when execution of the body of the called procedure begins. * The dynamic extent is also entered when execution is not within the dynamic extent and a continuation is invoked that was captured (using `call-with-current-continuation') during the dynamic extent. * It is exited when the called procedure returns. * It is also exited when execution is within the dynamic extent and a continuation is invoked that was captured while not within the dynamic extent. Don't even think about dynamic-wind within dynamic-wind -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From pehr at pehr.net Wed Feb 23 00:28:39 2000 From: pehr at pehr.net (pehr anderson) Date: Wed, 23 Feb 2000 05:28:39 GMT Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> Message-ID: <38B3B656.B5D848B9@pehr.net> I can't answer any of your technical questions, but I can point you towards a starting point. Check out http://www.alice.org They have already done some of the things you are suggesting. I don't have a windows box (and they only support directX with their current release) so I don't even know what it looks like. Report back to the newsgroup if you like it. A good example probably answers more questions than a ton of speculations. -pehr Shawn LeBlanc wrote: > > Greetings! > > Being totally new to Python and completely honest in saying that > I have no idea of what I'm doing, I had a few questions. > > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior. This would allow the level/content designers > to concentrate more on the game design side of things, since > behaviors would be outside of the main game engine. Is it > possible to have multiple scripts running at the same time? > Would this involve creating multiple interpreter objects? According > to the docs, this is possible but it isn't totally safe to do. > What would be a good strategy for this? > > My other question was one of performance. Is it crazy to have > ~10 different objects with each an individual script and hoping > the game will be running at 30 frames per second? The question might not be > valid, since I'm not sure how to implement it in the first > place. > > And lastly, is it faster to call C functions in Python or vice-versa? > > with milk and cookies, > Shawn > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com From rjroy at takingcontrol.com Sat Feb 12 15:44:18 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Sat, 12 Feb 2000 20:44:18 GMT Subject: perl chomp equivalent in python? References: <200002102225.XAA22165@dionysus.fw.cuci.nl> Message-ID: <38a5c403.141741640@news1.on.sympatico.ca> As I recall line continuation is by definition (and not just in Python) a backslash followed by a line feed. Add any whitespace and you no longer satisfy the definintion. Unless you want to redefine line continuation, there is really nothing to fix. Bob On Thu, 10 Feb 2000 23:25:14 +0100, "Hans Nowak" wrote: > >On 10 Feb 00, at 16:31, Justin Sheehy wrote: > >> > Of all newgroups, certainly comp.lang.python would be >> > sympathetic to this issue. ;-) >> >> Last time I checked, Python wasn't sensitive to extra whitespace at >> the _end_ of a line. > >With one exception... > >print 1+ \ > 2 > >In this (admittedly silly) example, whitespace after the \ will cause a >SyntaxError: invalid token. I'm curious why this hasn't been fixed yet? >Probably a matter of "looks easy, difficult to do"? > >--Hans Nowak (zephyrfalcon at hvision.nl) >Homepage: http://fly.to/zephyrfalcon >You call me a masterless man. You are wrong. I am my own master. > From arnaud at crao.net Mon Feb 28 11:39:10 2000 From: arnaud at crao.net (Arnaud Fontaine) Date: Mon, 28 Feb 2000 17:39:10 +0100 Subject: MetaKit for python (Mk4py) on Macintosh ... no way :( References: Message-ID: In article , zawrotny at gecko.sb.fsu.edu (Michael Zawrotny) wrote: > Arnaud, > > This may or may not help a whole lot, but it may be worth a try. Even > without CW you can still compile on the Mac. MPW is freely downloadable > from Apple: > ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./ Thanks Mike but ... the may reason I said "Hey ! I don't have CW..." was C/C++ and all the stuff bugs me -despite the fact I don't have CW- :) > Hope this helps, Sure :) At least, I'll be quiet about C compilers on the Mac :) Regards, Arnaud From python at rose164.wuh.wustl.edu Thu Feb 3 07:47:51 2000 From: python at rose164.wuh.wustl.edu (David Fisher) Date: Thu, 03 Feb 2000 12:47:51 GMT Subject: Accessing a lock object in a C module In-Reply-To: References: <20000202.16275603@sparky.spkydomain> Message-ID: <20000203.12475166@sparky.spkydomain> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 2/3/00, 4:42:48 AM, Konrad Hinsen wrote regarding Re: Accessing a lock object in a C module: > David Fisher writes: > > The struct is at the top of threadmodule.c: > > /* Lock objects */ > > > > typedef struct { > > PyObject_HEAD > > PyThread_type_lock lock_lock; > > } lockobject; > Fine, but I don't have access to this from another C module. Of course > I could copy the structure to my own code and hope that it will never > change in threadmodule, but that's not my preferred solution. > -- Ah, well, i see two options then, if you are still opposed to calling PyObject_CallMethod. You could incorporate threadmodule.c into your program, calling it mythreadmodule.c (or something), and make calls to your module to create lock objects. Threadmodule.c uses the python C api for threads, so nobody could (should?) change the implementation out from under you. Of course, if you wanted to use Lock, Rlock from the threading module, you'd have to modifiy those and include them in your project. This sort of thing could quickly get out of hand. Alternately, after looking at the include files python does have, and consulting my years (zero) of language design experience, i figure python needs a threadobject.h file, for exactly your kind of situation. It could have the struct for lock_oject and export the lock methods. I hear python 1.6 is supposed to go into alpha in a month or so. You could submit a patch, and have it incorporated before you've forgotten why you needed it . What-i-know-about-language-design-could-fit-in-a-box-of-matches-witho ut-removing-the-matches-ly yr's - david From jeremy at cnri.reston.va.us Mon Feb 28 14:35:58 2000 From: jeremy at cnri.reston.va.us (Jeremy Hylton) Date: Mon, 28 Feb 2000 14:35:58 -0500 (EST) Subject: REMINDER: DCPIGgies, March 13 Message-ID: <14522.52766.604686.960240@goon.cnri.reston.va.us> The next DCPIGgies meeting is only two weeks away! We will be having our first DCPIGgies (DC Python Interest Group) meeting of the year on Monday March 13, 2000 from 7:30pm to 9:00pm at CNRI in Reston, Va. Please RSVP to me, jeremy at cnri.reston.va.us. Speaker: Scott Cotton Static Type and Interface Checking for Python General Review and Fundamental Decisions Abstract ---------- This presentation reviews various possible ways of adding static type checking to python. The problem poses two questions: 1) What sort of static type checking system would be most appropriate for python? 2) By what means may static type checking be made optional? A decision tree for each question is presented based on a combination of type theory, an understanding of python, and properties that have become apparent in the development of a sample type checking system. Finally, we discuss some overall approaches that would maximize the benefits and/or minimize the drawbacks of adding optional static type checking to python. Scott will be speaking from 8:00 to 9:00pm. We will have food and introductions starting at 7:30pm. We may also have some time after the talk for Q&A with Guido and Barry on Python and JPython. Pizza, salad, and soda will be provided courtesy of Foretec Seminars. Please RSVP by email to jeremy at cnri.reston.va.us. I need to know how many people will attend and how many will be eating pizza. Directions to CNRI can be found on the Web: http://www.cnri.reston.va.us/directions.html Mailing list: There is a mailing list for people interested in DCPIGgies meetings; see http://www.python.org/mailman/listinfo/dcpiggies. This is a low volume list for announcing meetings, arranging to share rides, and other thrilling PIGgy topics. See you there! Jeremy From Vladimir.Marangozov at inrialpes.fr Tue Feb 15 11:07:46 2000 From: Vladimir.Marangozov at inrialpes.fr (Vladimir Marangozov) Date: Tue, 15 Feb 2000 17:07:46 +0100 Subject: RC (was Re: Real Problems with Python) References: <001001bf7763$e37ab280$66a2143f@tim> Message-ID: <38A979D2.71CD8FB3@inrialpes.fr> Tim Peters wrote: > > [Tim] > > ... > > (RC has excellent locality of reference, especially when trash > > is being created and recycled at high dynamic rates). > > [Vladimir Marangozov] > > That last one is a good one. So far, nobody has shown any evidence > > that LOR is good or bad when different objects are involved (except, > > I remember, some special cases like iterating over ints that happen > > to be allocated close to each other). Better yet, nobody _can_ show > > such evidence as far as one stays on top of a virtual memory manager. > > Vlad, you're trying to get "deep" on what is really a "shallow" point: Tim, you're trying to get "shallow" on what is really a "deep" point. Saying that "RC has excellent LOR", even when trash is recycled at high rates, is disturbing. > a "high dynamic rate" is most likely to occur when a program is doing > flat-out computation, so type homogeneity is likely. Like ints or floats > or whatever in Python. Nope, not "whatever". Take a flat-out computation involving a container (say, a dict with ints) which gets resized repeatedly, and your argument is flawed. It's likely that the dict will walk through your memory. (and more precisely, through your virtual memory). > And those are *not* "on top of a virtual memory manager" in Python, > but involve cycling & recycling via Python's type-specific internal > "free lists" (some of which you added, so you should remember this ). That first one is a good one . > So long as the free lists act like LIFOs, you get to reuse the same little > chunks of memory over and over and over ... again. Here, you're absolutely right. > It's LOR in *both* time and space, and of course that's "good": > it's the difference between page faults and, umm, not page faults . And here, you're cheating. You're saying that the drops of an intense rain falling over the MIT building will *not* wet Cambridge and Boston, without knowing: (1) how long the rain will last, (2) the evolution of the rainy cloud and (3) which parts of Boston/Cambridge are included in the calculus. IOW, you're qualifying LOR without considering (1) a time slice, (2) the nature of the objects (which may be "moving"), and most importantly, (3) a fixed "working set" of memory pages, which gives the basis for any further reasoning about LOR. However, your "educated guess" is based on assumptions & observations of popular combos. You're assuming that we have enough memory so that the working set covers all objects involved in the intense computation (which is far from being granted, especially for combos with limited memory), and that these objects are "static" for a long perod of time. This may well be granted in most of the cases (a PC with 8+ MB of RAM, without heavy loads, i.e single-user) and for most of the Python scripts we're running. But note that this doesn't give us *any* evidence about LOR. And that's why I don't buy your argument. We still don't know anything about LOR in Python, so drop it from your vocabulary . It may be bad, it may be good, it may be acceptable. > > > make-that-simply-"RC-is-faster-than-the-alternatives"-- > > -and-I'll-take-it-ly y'rs > > I believe there's sufficient evidence that state-of-the-art "real gc" > can be made faster than rc. Python isn't other languages, though, and > so long as everything in Python is always "boxed", other languages' > gc experiences aren't especially relevant. Agreed. With Toby/Neil's recent work, things look promising... BTW, any comparison of RC with state-of-the-art GC is fine by me. as-long-as-you-don't-mess-with-LOR--ly y'rs -- Vladimir MARANGOZOV | Vladimir.Marangozov at inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252 From shouldbe at message.com Thu Feb 17 11:11:18 2000 From: shouldbe at message.com (Arinte) Date: Thu, 17 Feb 2000 16:11:18 GMT Subject: import whrandom and other libs. Message-ID: I want to distribute my python/c++ program, but I want to let people that write scripts for my program to be able to import classes like re whrandom and so on without having to get all those .py files. Is there a way to have those build into the python.dll or mypython.dll or something??? From mstenber at cc.Helsinki.FI Thu Feb 10 09:44:14 2000 From: mstenber at cc.Helsinki.FI (Markus Stenberg) Date: 10 Feb 2000 16:44:14 +0200 Subject: GCOM, was Re: Communicating with MICO References: <3898d8cb@nntp.server.uni-frankfurt.de> <87mb8g$tlr$1@pineapple.uk.research.att.com> <87u861$35t$1@pineapple.uk.research.att.com> Message-ID: Duncan Grisby writes: > In article , > Samuel A. Falvo II wrote: > [...lots of interesting COMishness...] > >So the "sluggishness" that CORBA has amassed a reputation for is not the > >fault of the spec, but of the individual ORB and B/POA APIs. However, the > >APIs do add an unnecessary layer of complication to the development of any > >standards-compliant ORB. And 2.3 just makes things worse. > I'm interested in this "sluggishness". Do you have any experience or > references to suggest that CORBA is sluggish in comparison to COM? > Some CORBA implementations are quite slow (most notably Orbix), but > others are not. I've just done a web search, and I can't find _any_ > speed comparisons of CORBA and COM; all of the COM/CORBA comparisons > use other criteria. There are plenty of performance comparisons > between different CORBA ORBs. Well, okay, I'll bite the bullet and comment.. in terms of speed, fastest ORBs are roughly twice the speed of COM and more that of DCOM (at least, when using COM/DCOM with Python). On example machine(r), the following (rough) speeds for synchronous reliable event passing(*) were noticed between processes on same machine: NT com => 3k msg/s Linux tcp => 17k msg/s omniorb2 => 4k msg/s On another machine using hp-sux, the visibroker orb was roughly 1/3 the speed of omniorb2 in synchronous reliable calls. Oneway (asynchronous unreliable) calls were in omniorb2's case roughly twice as fast, and in visibroker's case thrice as fast as the synchronous ones, but omniorb2 was still faster. (7k/2k sync, 13k/7k async in case someone cares) (*) Meaning tcp roundtrip, or return value in the com/corba's case. These numbers are stolen from my master's thesis' appendix :-) > As for API complexity, I agree that the CORBA APIs are unnecessarily > awkward. However, the often-cited paper by Emerald Chung et al. > > http://www.research.microsoft.com/~ymwang/papers/HTML/DCOMnCORBA/S.html > > implies that using COM from C++ is far more of a burden. I have no > experience of COM programming myself, so I don't know how accurate it > is. COM is roughly as painful as CORBA, in my slight experience. > Anyway, to get back on-topic for the newsgroup, using CORBA from > Python cuts out the vast majority of the API ugliness. CORBA lets you > do some fundamentally complex things, though, so there is bound to be > some complexity in the API. For most things you can do with CORBA, the > Python code is extremely simple. I assume the same is true for > Python's COM interface. Python's COM interface is much nastier than CORBA interface, IMNSHO. It requires knowledge of lots of windows magic (*ids, different exection models, etc) if you want to do serious stuff with it. > Do you have a reference for GCOM? > > Cheers, > > Duncan. > > -- > -- Duncan Grisby \ Research Engineer -- > -- AT&T Laboratories Cambridge -- > -- http://www.uk.research.att.com/~dpg1 -- -Markus Stenberg -- Java leads to Javascript. Javascript leads to Shockwave. And Shockwave leads to ... suffering. - ptomblin of /. From gerrit.holl at pobox.com Fri Feb 18 16:53:38 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 18 Feb 2000 22:53:38 +0100 Subject: What a weird thing !!? In-Reply-To: <88kca9$il$1@news3.isdnet.net>; from framiere@netcom-service.com on Fri, Feb 18, 2000 at 10:00:19PM +0100 References: <88kash$15se$1@news5.isdnet.net> <38ADB2FA.17A4D7A9@roguewave.com> <88kca9$il$1@news3.isdnet.net> Message-ID: <20000218225338.A9457@stopcontact.palga.uucp> Florent Rami?re wrote on 950907619: > Thanks for your answers, > > in fact as Moshe Zadka told me, it is a documented feature ... (sorry) > Well, i should have read more carefully the doc (re-sorry) > And is there a solution to my problem ? > And sys.stdout.write is not a good solution for me (i need to keep > printing with print) > > Is there an easy way to override the print statement (i saw it one time > in the news, but i can not find it) No. You can't override statements. print is a statement as if, while and for are statements. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From andy at reportlab.com Tue Feb 29 04:11:15 2000 From: andy at reportlab.com (Andy Robinson) Date: Tue, 29 Feb 2000 09:11:15 -0000 Subject: Microsoft Access Database References: <89f32j$3c9$1@isn.dac.neu.edu> Message-ID: <951815480.7889.0.nnrp-04.9e9802e2@news.demon.co.uk> "Eric Kappotis" wrote in message news:89f32j$3c9$1 at isn.dac.neu.edu... > Is there anyway i can read from and write to a Microsoft Access Database > with Python. If so where can i find some tutorials on how to do that? > > Eric Kappotis This is well covered in our book "Python Programming for Win32" (O'Reilly 2000), and the examples can be downloaded from the book's page: http://starship.python.net/crew/mhammond/ppw32/ Ask me if you have any problems after reading this. Regards, Andy Robinson From rdudfield at my-deja.com Wed Feb 16 23:29:23 2000 From: rdudfield at my-deja.com (rdudfield at my-deja.com) Date: Thu, 17 Feb 2000 04:29:23 GMT Subject: XORing on arrays faster? References: <88dhqa$nmi$1@nnrp1.deja.com> <88dokb$ovt@gap.cco.caltech.edu> Message-ID: <88ftev$d0r$1@nnrp1.deja.com> In article <88dokb$ovt at gap.cco.caltech.edu>, kern at caltech.edu (Robert Kern) wrote: > In article <88dhqa$nmi$1 at nnrp1.deja.com>, > rdudfield at my-deja.com writes: > > Hello, > > > > Anyone know how to do XORing on arrays fast? > > > > I do not want to use the Numeric package, for other reasons. > > Out of curiousity, why not? > A few, all superficial really :) Most of my code uses standard arrays allready. Numpy does not come with standard python. Numpy adds extra size to my program. I'm trying to make it smaller as is :) > > So that is > > out of the question. BTW using Numeric XORing two arrays is more than > > four times as fast as this method. > > > > a = array.array('I',[0]) * 1000 > > b = array.array('I','\377\377\377\377') * 1000 > > > > # this is the bit I want done faster :) > > for x in xrange(1000): > > a[x] = a[x] ^ b[x] > > > > > > Also if you know a way to map one sequence onto another fast, I'd like > > to know how to do that too :) > > Python 1.5.2 (#0, Sep 13 1999, 09:12:57) [GCC 2.95.1 19990816 (release)] on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import operator > >>> import array > >>> a = array.array('I',[0]) * 1000 > >>> b = array.array('I','\377\377\377\377') * 1000 > >>> a = array.array('I', map(operator.xor, a, b)) > > The in-place modification semantics, I can't help you with. Anyone > else? This is close to Numpy speed, and still uses way less memory than Numeric. So I am happy. If you do use map(xor, a, b) instead of map(operator.xor, a, b) it is slightly faster, but not by much. Thanks for your help. Rene. Sent via Deja.com http://www.deja.com/ Before you buy. From kc5tja at garnet.armored.net Fri Feb 4 20:54:22 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 5 Feb 2000 01:54:22 GMT Subject: Communicating with MICO References: <3898d8cb@nntp.server.uni-frankfurt.de> <87bl08$nui$1@pineapple.uk.research.att.com> Message-ID: In article <87bl08$nui$1 at pineapple.uk.research.att.com>, Duncan Grisby wrote: >I prefer omniORBpy, but I wrote it so I'm not exactly unbiased. I may be talking to you in the future about this, if you don't mind. As you're probably aware, I'm working on a COM implementation for Linux called GCOM. The IDL for it will be based on CORBA's own IDL, and I plan on using GIOP for communications between local servers. Remote servers are handled via GIOP-IIOP bridges (called ORBs ... go figure!). -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From vetler at ifi.uio.no Thu Feb 17 09:31:48 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 17 Feb 2000 15:31:48 +0100 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> Message-ID: * J. C. Travers > Anders M Eriksson wrote: > > But now I'm reaching the point of no return and I need to create apps > > with a GUI, but which one? > > > > I'm using Windows NT as my development platform > > I would like pro and cons for the different GUI's > > This is a hot topic, and you will get as many different answers as > people you ask, so all I can give is my personal opinion. > > Firstly, I would advise against Tkinter. For some reason Tkinter is > relativly popular (it's portable I suppose), but it is probably the > hardest GUI to code in (i.e. it is built on top of Tcl and so has to use > some of the style of that scripting language). Also, it lacks some key > widgets (i.e. it lacks multiple coloumn list boxes and tables... these > can be added on third party however, but this is just more work). Tk the hardest GUI to code? not in my experience.. I think it's very easy to use. (But this is probably based on feelings rather than technical arguments, and it's really no point in discussing ;)). The fact that it lacks some widgets is true, but Pmw (Python MegaWidgets) extends Tkinter with many interesting widgets. I-hope-this-doesn't-start-a-gui-war--ly y'rs, vr From effbot at telia.com Wed Feb 2 12:40:35 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 02 Feb 2000 17:40:35 GMT Subject: Creating a new image from two old using PIL? References: Message-ID: Anders M Eriksson wrote: > I'm a beginner of Python and I thought that I should create an web > counter cgi. I have created the whole cgi except for the part that > creates the image. > > For this I tried to use PIL, but I can't figure it out. > > How do I create a new image from two (or more) images? > > as everyone guesses the source images are the numbers 0 - 9 and I > would like to create a new image that combines these images to the > number I want to show on the html-page. hints: use "Image.new" to create a blank image large enough to hold the resulting image, and "paste" to paste the digits into it. also see "Cutting, Pasting and Merging Images" in the tutorial: http://www.pythonware.com/library/pil/handbook/intro01.htm From mhammond at skippinet.com.au Tue Feb 1 06:59:29 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Feb 2000 11:59:29 GMT Subject: PythonWin 2.0? References: <388f3957_1@spamkiller.newsfeeds.com> Message-ID: "David Max" wrote in message news:388f3957_1 at spamkiller.newsfeeds.com... > Does anybody know where I can download PythonWin 2.0? The latest I seem to > be able to find is build 128, yet I saw version 2.0 demonstrated on Monday > at the Python conference. 128 is the absolute latest. It is what I had at the conference, and Id be _very_ surprised if anyone has a later version . Mark. From gerrit.holl at pobox.com Mon Feb 21 02:28:05 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 08:28:05 +0100 Subject: breaking the ; habit In-Reply-To: <88qc9j$oo0$1@news.kersur.net>; from lf11@nospam.linuxstart.com on Sun, Feb 20, 2000 at 10:49:54PM -0500 References: <38a5d928@news.isc.rit.edu><38A5E3F0.B3DCEC8E@callware.com> <88qc9j$oo0$1@news.kersur.net> Message-ID: <20000221082805.A872@stopcontact.palga.uucp> > It took me several months to fully acquire the [;] habit. > It took 45 minutes to break. > Now, how do I get it _back_ in a timely manner?? You don't. > (The only reason I wrote the script in Perl is because "Programming Python" will t > ake a few days to arrive from Amazon.com. Grrr. Where's my matter transporter?) Programming Python is relative not a good book. Learning Python, Programming With Python, and others are better, in my opinion. regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From moshez at math.huji.ac.il Wed Feb 16 01:00:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 16 Feb 2000 08:00:52 +0200 (IST) Subject: is this a Python bug? In-Reply-To: <88caua$fef$1@news1.tc.umn.edu> Message-ID: On 15 Feb 2000, Brian Langenberger wrote: > R is supposed to work to give raw strings with the backslashes stored > as backslashes. I've never had a problem until I tried making a > string with nothing but backslashes. Raw strings cannot end with a backslash. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From aahz at netcom.com Wed Feb 9 17:12:27 2000 From: aahz at netcom.com (Aahz Maruch) Date: 9 Feb 2000 22:12:27 GMT Subject: Real Problems with Python References: <20000209222012.A2749@stopcontact.palga.uucp> Message-ID: <87soob$uqh$1@nntp6.atl.mindspring.net> In article <20000209222012.A2749 at stopcontact.palga.uucp>, Gerrit Holl wrote: > >7. Error messages spanning multiple LOC To emphasize Justin's point, this is a bug, not a design issue. -- --- 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 Nostalgia just ain't what it used to be From moshez at math.huji.ac.il Fri Feb 18 16:01:49 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 23:01:49 +0200 (IST) Subject: Which GUI? In-Reply-To: Message-ID: On Fri, 18 Feb 2000, Fran?ois B?dard wrote: > I see no mention in this thread of JPython + Swing. Any special reason? Yes. Lots of people don't have 96 MB on their computer. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From bjorn at roguewave.com Sat Feb 19 16:23:18 2000 From: bjorn at roguewave.com (Bjorn Pettersen) Date: Sat, 19 Feb 2000 14:23:18 -0700 Subject: PIL - still ill (newbie) References: Message-ID: <38AF09C6.78434B01@roguewave.com> Haven't tried this, but.... If you look through your python directories, there should be a DLLs directory. If you put it there, python should be able to find it (I'm not sure if you have to rename it to _imaging.pyd... if the above doesn't work, you could always try it...) As a final option you could try putting it in any directory that's in your PATH environment variable. -- bjorn JimM wrote: > Fredrik or anybody, > I'm still having trouble using PIL. > I downloaded pil-win32-991101 from pythonware and unzipped it with winzip. > I unzipped it to c:\program files\python\tools. > Here's a sample error: > >>> import Image > >>> im = Image.open("E:/images/sts93.jpg") > >>> im.size > (1038, 768) > >>> im.thumbnail((128,128)) > Traceback (innermost last): > File "", line 0, in ? > File "C:\PROGRA~1\PYTHON\PY152\PIL\Image.py", line 724, in thumbnail > self.load() > File "ImageFile.py", line 125, in load > self.load_prepare() > File "ImageFile.py", line 175, in load_prepare > self.im = Image.core.new(self.mode, self.size) > File "C:\PROGRA~1\PYTHON\PY152\PIL\Image.py", line 40, in __getattr__ > raise ImportError, "The _imaging C module is not installed" > ImportError: The _imaging C module is not installed > > As you can see, it finds Image.py but not the _imaging C module > (_imaging.dll ?) > > I'm not sure if this is part of the problem but I originally placed the > files in : > c:\program files\python\py152\ > I had some trouble so I removed them and unzipped in > c:\program files\python\tools as I mentioned above. > > Why is it still finding Image.py in \python\py152\pil\ > when that directory no longer exists (see traceback above)? > > I'm new to python in the windows environment > so explicit help will be appreciated. > > Thanks, > > Jim > > -- > http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Mon Feb 14 11:03:55 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 16:03:55 GMT Subject: Where to place job offers? References: <000201bf76dc$61f0ffd0$2001a8c0@ntws132.office01.de> Message-ID: Matthias Menne wrote: > Can anybody make suggestions, where to place job offers for > Python/Zope application developers in Germany? posting on the comp.lang.python is definitely ok (but make sure people can tell from the subject line that it actually is a job offer). there's also a german Python list: http://starship.python.net/mailman/listinfo/python-de not sure about their policy, though (check the archives; if other people have posted job ads without being yelled at, it should be ok to post right away. otherwise, posting a question can never hurt). and yes, make sure it appears on the python job board (having an english summary might be a good idea): http://www.python.org/Jobs.html you should also check with the zope folks: http://www.zope.org/Resources/MailingLists (again, check the archives first) From mikael at isy.liu.se Thu Feb 3 03:19:22 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Thu, 03 Feb 2000 09:19:22 +0100 (MET) Subject: Case Sensitivity and Learnability In-Reply-To: <879phb$13i0$1@nntp6.u.washington.edu> Message-ID: On 02-Feb-00 Donn Cave wrote: > I've missed some of the discussion, so I hope I'm not repeating > something that's already been chewed over, but I just wanted to > point out that there are indeed two sorts of people - one believes > that there are two sorts of people, and the other doesn't! Ha, ha ha. I've always claimed that there are three types of people: Those who are skilled, those who are not, and those who know the words. :-) /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: 03-Feb-00 Time: 09:17:32 This message was sent by XF-Mail. ----------------------------------------------------------------------- From gmcm at hypernet.com Wed Feb 16 11:01:21 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 16 Feb 2000 11:01:21 -0500 Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: References: Message-ID: <1261405634-3407526@hypernet.com> Oleg Broytmann wrote: > > Dear Fred, don't get me wrong - I am not flaming on you. Before, I use > Berkeley DB a little (doing Netscape's history files manipulations), but > never touched MetaKit. After your message I downloaded and installed > Metakit on Linux and Solaris - just to test it. I found it a little behind > of BSDDB on quality. ./configure don't work quite right, generated Makefile > has errors (README says about them :). Tarball is packed strange (all text > files are executable). > I think MetaKit is not such a perfect solution, but may be I just wrong. > And what's wrong with using Berkeley DB 2.0+ ? The only complaint was about the license, (although I think the use of the name "DB" is presumptuous). If what you need is bsddb, then bsddb is the perfect solution. In a test of bsddb functions, Metakit will be much slower in adding, roughly the same speed in retreiving, much smaller and use less system resources. In a test of Metakit functions (select, join, nested views) bsddb will be a non-starter. > On Tue, 15 Feb 2000, Fredrik Lundh wrote: > > Oleg Broytmann wrote: > > > > metakit: fast, efficient, small, highly portable, > > > > great python interface, and free. > > > > > > Hm, portable? Well, exerpt from README: > > > > > > I cannot consider it "portable". Oh, yes, I have exactly 2.8.1, even > > > worse, on Solaris 2.5.1. > > > > considered using a recent version of gcc? > > after all, the upgrade is free. > > No, it is not. Opensource software is not so cheap. It is free - like in > freedom - but not cheap. I need to pay with my time, and no - my time is > not cheap :) > BTW, I guess your time is even less cheaper, so I want to thank you for > taking part in the discussion. Credits to you, now I have MetaKit > installed, and will try to test it some more. > > > > No other program reveals bugs in 2.8.1. > > > > cool. but if that was true, why did they > > release 2.95.2? > > But being a paranoid sysadmin, I prefer to install rather old - but > well-tested - software. 2.7.2.3 and 2.8.1 do good for me (except for > MetaKit) - why install new gcc? It is problem with little poor > boy named > MetaKit, not gcc, I think. In 1996 I had a client (briefly) who used the same argument to resist ANSI C. Being comfortable with bronze axes is one thing; complaining about iron another. But the complaint was about the optimizer. Python warns about some optimizers - if you haven't encountered any problems, it's pure luck. - Gordon From gmcm at hypernet.com Thu Feb 17 23:22:54 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 17 Feb 2000 23:22:54 -0500 Subject: Miscellaneous design and Python use questions In-Reply-To: <87itzn19mz.fsf@travis.aggievilla.org> Message-ID: <1261274784-11280577@hypernet.com> Travis B. Hartwell wrote: > I suppose my questions here are geared to Python as it is used in a > large project -- more than a script of ~200 lines. > > 1) When I do a typical OO-design with C++, I pay a lot of attention > to information hiding. I.E., I keep all of the data members private > and rely on get/set functions to use them. I feel that this is a good > practice. But, with Python, we don't have the access issue. I still > believe that information hiding is a good idea. From the experienced > Python developers, is it practice to use such functions within your > classes? Or do you just access things directly? What are your > thoughts on style regarding this? I think most people would agree that distinguising external and internal methods is important, and that attributes should generally not be accessed directly. Note that you can turn the problem on it's head and make an attribute access into a method call (using __getattr__ and __setattr__). You'll probably be happier if you stop thinking in strict OO terms, and realize that Python is all about interfaces, and interfaces are implicit (no need to inherit from some particular base class). To paraphrase Aahz: loosely couple, and componentize the hell out of everything. > 2) I am planning using Python embedded in one of my applications -- > using C++ Builder for the GUI development and speed-critical > portions. For the rest, I would prefer to use Python just because I > have become accustomed to its power. But, I have been having a few > road-blocks in this plan for embedded Python. I guess I'm having a > hard time visualizing exactly where to have the 'dividing line' > between C++ and Python and in designing the interfaces between the > two. What are some general hints in designing applications using > Python as the engine and C++ as the front-end? Write it all in Python first, then decide if you need any C++. I say that as a long time C++/Java/C/.../IBM S370 assembler programmer. Even if you don't use any Python, you'll still save time, because you'll have a model that works. - Gordon From aa8vb at -nojunk-ipass.net Fri Feb 18 18:44:45 2000 From: aa8vb at -nojunk-ipass.net (Randall Hopper) Date: Fri, 18 Feb 2000 23:44:45 GMT Subject: Async File I/O Message-ID: Is there a way to perform asynchronous file I/O in Python which is compatible with Tkinter? I believe Tk's fileevent might be it, but I don't see any wrapper in the Tkinter module. Anyone have a code snippet they could share? Thanks, Randall -- Randall Hopper aa8vb at -nojunk-ipass.net From jstok at bluedog.apana.org.au Sat Feb 26 01:47:21 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Sat, 26 Feb 2000 17:47:21 +1100 Subject: i know this sounds redicculus but!!!.... References: Message-ID: Collin Greene wrote in message ... >how do you do simple commands such as say things is it print? Well, it's print "Hello, world" Goes to standard out, or wherever you put it. >also does >anyone know a good tutorial so i can learn the basic python skills like tth >such ...i am really egal to learn adn will stick woht it but just need a >little help wiht basic commands also what is teh ohter app bundeled wiht >python 1.52? is that a help thing The Python tutorial is very good (comes with the core package on whatever system you use, probably in HTML format.) The tutorial does assume, however, that you already know basic programming concepts. There are a number totally introductory introductions linked to at Python.org, in the documentation section, if you're a total newbie. The best introduction to programming I've read is Object-Oriented Programming in Eiffel by Rist and Terwilliger -- but that's about Eiffel, not Python. Still worth a look. Python books I find a bit of a disappointment. "Programming Python" isn't as good as I'd hoped, for example. "Learning Python" I've never seen, but might be worth a look. "Python Essential Reference" is a good reference, but simply expands on the existing online documentation, adding little value. >thanks for your time and tips arte appreaceated > >newbie #1 greene at hctc.com Your chances of getting help in the future are far more likely if you look after your spelling and punctuation. Sorry, but it has to be said. From quinn at pfennig.ugcs.caltech.edu Mon Feb 21 14:27:56 2000 From: quinn at pfennig.ugcs.caltech.edu (Quinn Dunkan) Date: 21 Feb 2000 19:27:56 GMT Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu><38A5E3F0.B3DCEC8E@callware.com> <88qc9j$oo0$1@news.kersur.net> Message-ID: On Sun, 20 Feb 2000 22:49:54 -0500, lf11 at nospam.linuxstart.com wrote: >It took me several months to fully acquire the habit. It took 45 minutes to >break. >Now, how do I get it _back_ in a timely manner?? Maybe we can generalize this to: "intuitive things are easy to learn, hard to unlearn" and converse "nonintuitive things are hard to learn, easy to unlearn". So why do so many languages require ';'s? :) From billtut at microsoft.com Tue Feb 1 15:10:57 2000 From: billtut at microsoft.com (Bill Tutt) Date: Tue, 1 Feb 2000 12:10:57 -0800 Subject: question about COM and ADO Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC98@RED-MSG-50> > -----Original Message----- > From: gtalvola at NameConnector.com [mailto:gtalvola at NameConnector.com] > [problems with translating the below VB code into Python] > > > Dim cnn as New ADODB.Connection > > > cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data > > Source=c:\db1.mdb" > > > dim rs as New ADODB.Recordset > > > rs.CursorLocation = constants.adUseClient > > > rs.Open "SELECT * FROM Table1", cnn, adOpenStatic, > > > adLockBatchOptimistic > > > set rs.ActiveConnection = Nothing Well according to build.py: # This is not the best solution, but I dont think there is # one without specific "set" syntax. # If there is a single PUT or PUTREF, it will function as a property. # If there are both, then the PUT remains a property, and the PUTREF # gets transformed into a function. # (in vb, PUT=="obj=other_obj", PUTREF="set obj=other_obj So, something like the following might work since, ActiveConnection does have a put and a putref functions: rs.SetActiveConnection(None) This code in Python rs.ActiveConnection = None Has the bogus VB equivalent of: rs.ActiveConnection = Nothing (i.e. no Set) The PUT vs. PUTREF distinction royally sucks. Bill From ivanlan at callware.com Tue Feb 8 18:18:31 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Tue, 08 Feb 2000 16:18:31 -0700 Subject: Error on string formatting References: <87q741$8jh$1@nnrp1.deja.com> Message-ID: <38A0A447.915C6939@callware.com> Judy Hawkins wrote: > > Why this: > > >>> buf = '%0.*f' % 3, 4.1 > Traceback (innermost last): > File "", line 1, in ? > TypeError: not enough arguments for format string > > The comparable statement in C works fine, and the Essential Reference > says I can do this kind of asterisk thing. > > Judy Hawkins > > Sent via Deja.com http://www.deja.com/ > Before you buy. > -- > http://www.python.org/mailman/listinfo/python-list buf = '%0.*f' % 3, 4.1 ==> buf = '%0.*f' % (3, 4.1) The % formatting operator requires a tuple, unless only there is only one argument called for, in which case the single argument is automatically converted to a tuple. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 alex at somewhere.round.here Sun Feb 6 17:43:01 2000 From: alex at somewhere.round.here (Alex) Date: 06 Feb 2000 17:43:01 -0500 Subject: chdir questions References: <87koli$nug$1@watserv3.uwaterloo.ca> Message-ID: > Actually it would be: > os.chdir('c:\\temp') # need to watch those backslashes Oh, right. Thanks. Alex. From tony at lsl.co.uk Mon Feb 14 07:07:58 2000 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Mon, 14 Feb 2000 12:07:58 -0000 Subject: Please do not Bcc: ListServers In-Reply-To: <4D0A23B3F74DD111ACCD00805F31D8101D8BCD04@RED-MSG-50> Message-ID: <004401bf76e4$2203aaf0$f0c809c0@lslp7o.lsl.co.uk> Bill Tutt wrote: > Heh. I could have [filtered on Sender], but I still haven't finished > my Outlook VB-AddIn that allows me to create abitrary Exchange server > filtering rules yet. (The Outlook2k Rules Wizard UI doesn't let me > filter on header lines) Ooh - ooh - when you finish it can I have a copy, please? (and dummy instructions on how to use it) Tibs (stuck with Outlook 98 - the only good thing about which is that it's better than Outlook Express in almost (but not quite) all ways (for those lucky enough to be using *real* mail tools, MicroSoft have their own abstraction of what one can filter on, which maps, sort-of-but-not-entirely, to header lines, and will periodically disable itself to see if you're paying attention)). -- 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 a.eyre at optichrome.com Fri Feb 11 06:49:33 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Fri, 11 Feb 2000 11:49:33 -0000 Subject: How to do this? - newbie In-Reply-To: <38a3892d$0$96317@news.voyager.net> Message-ID: <000d01bf7486$1046d360$3acbd9c2@peridot.optichrome.com> >> But it seems you really want to be able to retrieve the numeric >> value using the symbol 'a' as a key, and that's what dictionaries >> are for. > In fact that is exactly what I ended up doing (using a dictionary) and I may > just keep it that way. I was just wondering how to do it the way I asked. Python 1.5.2+ (#0, Oct 13 1999, 15:40:49) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> a=('x', 1) >>> exec(a[0] + '=' + str(a[1])) >>> x 1 Don't use it though. Using eval() or exec() is dangerous. ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From mark at chem.uwa.edu.au Thu Feb 24 23:39:28 2000 From: mark at chem.uwa.edu.au (Mark C Favas) Date: 25 Feb 00 04:39:28 GMT Subject: Tkinter: changing colour of scrollbars on Windows Message-ID: On Unix, it is possible to change the colours of Tkinter scrollbars using the standard configure methods. However, on Windows (Tcl/Tk 8.05), the colours remain unchanged from the defaults. (Same thing happens using Tcl/Tk, so it's not just a Tkinter thing.) I've looked for the reasons for this or work- arounds on the Python, Tcl newsgroups to no avail (but I could have missed something). Can anyone enlighten me on what is going on here, and whether there is any workaround? Thanks, 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 mwh21 at cam.ac.uk Thu Feb 24 07:59:18 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 24 Feb 2000 12:59:18 +0000 Subject: identity of the caller? References: <38B4EDE0.1DB1B55F@horvath.com> Message-ID: Bob Horvath writes: > Is there any way to find out the identity of who called you? I am > mainly thinking of method calls, but in general if there is a way > for regular function calls, I would be interested in that too. Well, you can (or at least I can). I'm not going to tell you how though, as it sounds a really bad idea for this problem. > I suppose I should give some context. We have a tool that draws > message flow diagrams for communications systems. These flows are > similar to use case flows, or ITU Z.120 MSC charts if you know > what those are. The tools takes simple ascii text which has the > sender, the receiver, and the message name, as in... > > SENDER RECEIVER MessageName > > We tend to have to enumerate a lot of these, and I had the thought > that if I could prototype the functionality of the nodes, they > could generate the text used to generate the drawings. > > What I was thinking is that the receivers of the message would > define methods that handle them. To get the picture right, > I would need to print out method name, the receiver, and who sent > it. It is the "who sent it" bit that I can't visualize a solution > for. What's preventing you making method calls like: def sendMessage(self,msg): self.listener.recvMessage(message=msg,sender=self) ? I guess I'm not understanding your problem... HTH, but I doubt it... Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From Sunil.Hadap at cui.unige.ch Tue Feb 1 04:02:42 2000 From: Sunil.Hadap at cui.unige.ch (Sunil Hadap) Date: Tue, 01 Feb 2000 10:02:42 +0100 Subject: Tkinter and OpenGL Message-ID: <3896A132.E3571243@cui.unige.ch> Hello, Is it possible to use OpenGL with Tkinter and Pmw, any experiences. Other option is FLTK but at a first glance pyFLTK is not matured. What about python with wxWindows or Qt and it's support for OpenGL. Thanks a lot Sunil -- "Live as if you would die tomorrow, learn as if you would live forever." --Mahatma Gandhi From effbot at telia.com Fri Feb 11 17:04:48 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 22:04:48 GMT Subject: Except an exception AND all its subclasses? References: <20000211220612.A7720@stopcontact.palga.uucp> Message-ID: <4I%o4.455$Ph6.187912704@newsa.telia.net> Gerrit Holl wrote: > it's not possible to catch an exception and all its subclasses as > of python 1.5.2, is it? I'm tempted to say something about time machines, but afaik, this has been supported since the very beginning: http://www.python.org/doc/current/ref/try.html For an except clause with an expression, that expression is evaluated, and the clause matches the exception if the resulting object is "compatible'' with the exception. An object is compatible with an exception if it is either the object that identifies the exception, or (for exceptions that are classes) it is a base class of the exception, or it is a tuple containing an item that is compatible with the exception. also see: http://www.python.org/doc/FAQ.html#4.47 From a.eyre at optichrome.com Thu Feb 17 09:42:18 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Thu, 17 Feb 2000 14:42:18 -0000 Subject: Abstract classes? In-Reply-To: Message-ID: <001101bf7955$30ae17c0$3acbd9c2@peridot.optichrome.com> > [snip] > What does the Python community in general think of this? > Also, any general critiques of this code? > [snip] I do this kind of thing all the time. Self-documenting code is good, especially when you're too lazy to do real documentation. It might be a good idea (to make it even clearer) to stick a docstring in the "virtual" methods to give a hint to subclassers as to what they're for. e.g. class SpamContainer: def getSpamSlices(self): """This function should return the number of slices of spam the subclass contains""" raise RuntimeError, "This method should be overriden in derived class" class CanOfSpam(SpamContainer): def getSpamSlices(self): return 25 class BarrelOfSpam(SpamContainer): def getSpamSlices(self): return 42000 Unfortunately, spam has been declared obsolete in the UK :( ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From gmcm at hypernet.com Mon Feb 14 13:42:32 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 14 Feb 2000 13:42:32 -0500 Subject: BSDDB copyright and licensing restrictions while in use via Python In-Reply-To: Message-ID: <1261568749-40162501@hypernet.com> Warren Postma writes: > The problem I have with MetaKit is that it's essentially C++ only. (Unless I > goofed and it really is useable from a C API also). My application is in > straight C because I need a very tiny memory footprint. C+Python gives me > the most bang per kilobyte, and I'm not considering C++ right now. MetaKit has no C API, but Mk4py is the Python interface, and it is usable from C. > For those who are already working in C++ and Python, I would recommend > MetaKit highly. It appears > to be at an early stage of use and adoption, but it appear stable and well > written from the playing around I've done. > > If it's possible to build a straight C wrapper around the C++ version of > Python, and MetaKit doesn't require the C++ Runtime Libraries, or the > IOStreams or C++ Strings template classes, then I could use MetaKit. While you can use STL by defining q4_STD, that's not the default. It does use exceptions. No templates (unless STL), no IOStreams, no need to compile python in C++. - Gordon From phd at phd.russ.ru Tue Feb 29 05:59:57 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Tue, 29 Feb 2000 10:59:57 +0000 (GMT) Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 28) In-Reply-To: Message-ID: On Tue, 29 Feb 2000, Oleg Broytmann wrote: > On Tue, 29 Feb 2000, Fredrik Lundh wrote: > > besides, egroups is python powered. > > Any proof? I'd very interested to see... Oops, answering myself - http://www.egroups.com/info/contributors.html Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From thomas at xs4all.net Sun Feb 6 16:41:02 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sun, 6 Feb 2000 22:41:02 +0100 Subject: OFFTOPIC: opensource (Was: Re: chdir questions) In-Reply-To: <20000206215038.A12351@stopcontact.palga.uucp>; from gerrit.holl@pobox.com on Sun, Feb 06, 2000 at 09:50:38PM +0100 References: <389D741F.421DA0DD@python.net> <20000206215038.A12351@stopcontact.palga.uucp> Message-ID: <20000206224102.F19265@xs4all.nl> On Sun, Feb 06, 2000 at 09:50:38PM +0100, Gerrit Holl wrote: > > ...for os.chdir in the Python libraries. It's defined *somewhere*, and > > I'm sure that someone will show me where. One of the greatest things > > about open source is that you're never really stuck. For example, if > > you can't figure out how to use glob, you can always look at glob.py > > to see what it does. > One of the greatest things about open source is that *programmers* > and *geeks* are never stuck. > I can't look at the Mozilla, KDE, X or kernel source code to > see what it does. Others can. I can't. C isn't all that hard. It's hard to write properly, and very hard*) to debug, but reading it is fairly easy. The main problem with C is that the average function in C does much, much less than the average python function, and is a great deal longer. Reading large C projects can be confusing and headache-inducing. Debugging a large C project is like a oversized crime novel of which the last page is missing :P But there are two buts: the original poster (Tom Bryan ?) was talking about Python code, and Python code is very easy to read. I'd hazard to guess that people writing python code and getting stuck, are qualified enough programmers to read python code. And secondly, the source code of python itself seems very readable. Certainly the standard extension modules tend towards that -- they all have a similar structure, a helpful struct describing the intrinsics, and usually another struct or other data structure of public methods. I'm sure there are more readable pieces of work out there, on the great internet, and better documented ones, and more intuitive ones. But python gets close enough for most people ;) Painful-ly y'rs, hard*) the special kind of hard, not hard as in 'difficult', but hard as in hitting yourself on the forehead, with a large spiked morningstar, going 'D'oh!' for missing the obvious for four long, slow, embarrasing days. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From sabren at manifestation.com Sun Feb 13 20:54:23 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 13 Feb 2000 20:54:23 -0500 Subject: python for use in web development.. References: <38A6BCE3.EB4BE313@earthlink.net> Message-ID: <887n9b$7il$1@nntp2.atl.mindspring.net> Francisco Hernandez wrote in message <38A6BCE3.EB4BE313 at earthlink.net>... >is there any python frameworks for cgi programming using Apache? >like Mason for Perl.. or Project Midguard or PHPLib for PHP3.. >so i can do things like session variables.. user tracking.. cacheing.. >embedded Python in HTML etc.. I'm in the middle of porting a big chunk of PHPLIB... I've got the Sess clone more or less done, I think.. (but not the CT objects that actually hold the stuff)... The CT objects, Auth, Perm, and User should be later this week. Maybe sooner if you're interested in helping. :) -Michal http://www.sabren.com/ From fdrake at acm.org Thu Feb 10 09:39:09 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 10 Feb 2000 09:39:09 -0500 (EST) Subject: IDLE and Hooks in apps for usage of My Favorite Editor In-Reply-To: <38A234AA.2B1FE6CB@python.net> References: <65118AEEFF5AD3118E8300508B124877073D68@webmail.altiris.com> <38A234AA.2B1FE6CB@python.net> Message-ID: <14498.52621.853399.866552@weyr.cnri.reston.va.us> Thomas A. Bryan writes: > I'm not sure how these tools integrate or whether it is the type of integration > you're looking for, but you might want to look at one or both before > proceeding. In particular, you may want to look at the functionality > provided by ToolTalk before designing your standard protocol. For those who don't know, ToolTalk is a "message bus" system; there's a server that dispatches messages to listening applications. The listeners and message providers are all ToolTalk clients. I don't know how widespread ToolTalk support is; I think it originated on Sun systems, and it's used as the message bus for CDE. I don't know if it's included on Linux or if there are implementations for Windows or MacOS platforms. But I'd be interested in finding out. ;) -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From shae at tripoint.org Fri Feb 4 14:56:46 2000 From: shae at tripoint.org (Shae Erisson) Date: Fri, 04 Feb 2000 19:56:46 GMT Subject: was Stackless 1.01 Homepage: another bug in stackless? References: <388BE68E.B26985CA@tismer.com> <$WXiIAAO+Dj4Ew2W@jessikat.demon.co.uk> <388C7D4A.D873AA@tismer.com> <388C9733.B4F60DC0@tismer.com> <7PUz+AAC6aj4Ewne@jessikat.demon.co.uk> <38947CE6.5ADEE391@tripoint.org> <3896C84B.8195845B@tismer.com> Message-ID: <389B2D68.7CC0A641@tripoint.org> Christian Tismer wrote: > There was a try...finally bug, which is solved now. > When trying IDLE, I get the same behavior with and > without Stackless. > Maybe you should uninstall and try 1.02 ? > > ciao - chris.stackless fixed it! -- Shae Matijs Erisson - shae at lapland.fi Programmeur-savant - Python, Java, JPython From nobody at nowhere.nohow Sat Feb 12 21:52:47 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Sun, 13 Feb 2000 02:52:47 GMT Subject: Specifying subject using smtplib References: <87kp4l$aid$1@nnrp1.deja.com> Message-ID: <30pp4.8$K01.2132@ptah.visi.com> On Sun, 06 Feb 2000 22:18:50 GMT, Fredrik Lundh wrote: >Jim Severino wrote: >> In the smtplib module, the SMTP object's method "sendmail" is formatted >> like so: >> >> sendmail (from_addr, to_addrs, msg[, mail_options, rcpt_options]) >> >> Can anyone tell me where you specify the message's subject? > >in the message itself. > >from_addr and to_addrs are commands to the >mail transport; everything that you want to go >into the message header should be explicitly put >into the message. [...] >body = string.join(( > "From: %s" % FROM, > "To: %s" % TO, > "Subject: %s" % SUBJECT, > "", > BODY), "\r\n") > >print body > >server = smtplib.SMTP(HOST) >server.sendmail(FROM, [TO], body) >server.quit() Though it's probably overkill for just adding From: To: and Subject: headers, the MimeWriter package will construct the message headers and the message body for you. It's especially useful if you want to do things like multipart messages and attachments. -- Grant Edwards grante Yow! If this was a SWEDISH at MOVIE, I'd take off your visi.com GO-GO BOOTS!! From moshez at math.huji.ac.il Mon Feb 14 02:09:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Mon, 14 Feb 2000 09:09:59 +0200 (IST) Subject: Whats up with the _ In-Reply-To: <38A7A95C.B009BCC6@kw.igs.net> Message-ID: On Mon, 14 Feb 2000, JB wrote: > I have some global vars defined in a module that are prefixed with an > underscore '_'. When I do a 'from MyModule.MyModule import *' the vars > with the _ prefix don't get imported but when I change the names to drop > the _ they import properly. Is this a bug or a feature? If someone could > expalin why this is so I would appreciate it. I missed this in the > doc's. It's a feature. I'm sure the eff-bot will pipe up with the url, but it's a documented feature. It allows modules to have some weak privacy constraints. This is essential to modules prepared for "from .. import *". (For example, _test() in Tkinter) -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From hnowak at cuci.nl Mon Feb 28 17:28:59 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Mon, 28 Feb 2000 23:28:59 +0100 Subject: String processing inside lists In-Reply-To: Message-ID: <200002282229.XAA01626@dionysus.fw.cuci.nl> On 28 Feb 00, at 21:58, Gary Moore wrote: > After diligently and successfully going through 'Programming Python' I > decided that a good first project would be to take my DVD collection (228 > Discs) and build three different files (a tab delimited file for import > into a database, an xml file for each movie, and a text file for each > movie). I decided to gather the information from the Internet movie > database .list files and then process and sort the output in python. > > The problem happened when I tried to use the construct: > > for x in actors > > to process the list of actors prior to output. > > When I use the string library to process this list, I want the actual > strings contained in the list to change. What I found was that no matter > how I tried to change the strings in the actors list, I was unsuccessful. > e.g. > > temp = replace(x,'\012','') > x = temp > > When I print x, I get the line with the text replaced. However, when I > view the line in the original array actors, the changes were not made. True; this construct loops over the actors list, feeding each element to x. However, x is, shall we say, "stand-alone"; it has no direct relation with the original list. Thus, for x in actors: x = 'blah' will *not* change all elements of the list to 'blah'. > The only way I could overcome this problem was to change the for statement > to: > > for x in range(len(actors)) > > and then subscript the actors list to obtain the results e.g. > > temp = replace(actors[x],'\012','') > actors[x] = temp This construct changes the elements of the list. You loop over an index, like you would in, for instance, C. > My concern is that I must not be understanding some basic concept > concerning the FOR loop in Python. I reread the material in 'Learning > Python', but still could not understand why the first solution above did > not work. The x in 'for x in actors' can be seen as a "read-only" value. You can change it, but it won't affect the list, as you have found out. > I fnally completed a working prototype and successfully carried out the > conversion of all of the information. It was amazingly fast, and I was > very impressed with the power available with a minimum of effort (1 day). > > If anyone could clarify the situation above, I would appreciate it. HTH, --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From effbot at telia.com Wed Feb 9 08:12:02 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 13:12:02 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> <38A0497E.FC5CA78C@prescod.net> <87rbl5$chc$3@mach.vub.ac.be> Message-ID: Thomas Hamelryck wrote: > [snip] > : (after all, Python 1.5.2 do have certain shortcomings. > : how come these "I've never used Python, but I'm the > : right person to tell you what to change" folks never > : spot any of these?) > [snip] > > Well, shall we continue the thread with a discussion on reference > counting and circular references? why not? -- in contrast to the totally ludicrous white- space issue, this is an important problem that will be addressed in future versions of Python. (and for that matter, has already been addressed in e.g. JPython). but I see that you ignore all posts refuting your white- space arguments, so we better end right here. From neilh at hare.net.au Mon Feb 7 19:30:47 2000 From: neilh at hare.net.au (Neil Hodgson) Date: Tue, 8 Feb 2000 11:30:47 +1100 Subject: Whitespace as syntax (was Re: Python Rocks!) Message-ID: <024201bf71cb$bfc6a670$01646464@computer> > If python code were to become mis-formatted (and given my > experience, I have to believe that sooner or later this _will_ > happen) there is _no way_ to be certain what the original > author's intent was, much less to fix it automatically. This > is a Bad Thing(tm). I'd like to understand what 'mis-formatting' you are worried about. Either Python code is syntactically valid or it is not. If the original author has given you syntactically valid Python, then it has an unambiguous structure and can be reformatted to use any spacing / tabbing approach you wish to standardise on. Neil From skip at mojam.com Thu Feb 17 12:58:49 2000 From: skip at mojam.com (Skip Montanaro) Date: Thu, 17 Feb 2000 11:58:49 -0600 (CST) Subject: two questions In-Reply-To: References: Message-ID: <14508.14041.691193.8157@beluga.mojam.com> Brett> 1. Is anyone working on a version of Python for Mac OS X? Brett> 2. Has anyone been able to Get PMW working on Mac OS 8.x or 9.x? Don't know, but you'll probably get a useful answer faster on the Python Mac list: pythonmac-sig at python.org. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From phd at phd.russ.ru Wed Feb 16 04:15:28 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Wed, 16 Feb 2000 09:15:28 +0000 (GMT) Subject: BSDDB copyright and licensing restrictions while in use viaPython In-Reply-To: Message-ID: Hello! Dear Fred, don't get me wrong - I am not flaming on you. Before, I use Berkeley DB a little (doing Netscape's history files manipulations), but never touched MetaKit. After your message I downloaded and installed Metakit on Linux and Solaris - just to test it. I found it a little behind of BSDDB on quality. ./configure don't work quite right, generated Makefile has errors (README says about them :). Tarball is packed strange (all text files are executable). I think MetaKit is not such a perfect solution, but may be I just wrong. And what's wrong with using Berkeley DB 2.0+ ? On Tue, 15 Feb 2000, Fredrik Lundh wrote: > Oleg Broytmann wrote: > > > metakit: fast, efficient, small, highly portable, > > > great python interface, and free. > > > > Hm, portable? Well, exerpt from README: > > > > I cannot consider it "portable". Oh, yes, I have exactly 2.8.1, even > > worse, on Solaris 2.5.1. > > considered using a recent version of gcc? > after all, the upgrade is free. No, it is not. Opensource software is not so cheap. It is free - like in freedom - but not cheap. I need to pay with my time, and no - my time is not cheap :) BTW, I guess your time is even less cheaper, so I want to thank you for taking part in the discussion. Credits to you, now I have MetaKit installed, and will try to test it some more. > > No other program reveals bugs in 2.8.1. > > cool. but if that was true, why did they > release 2.95.2? Really, why does anyone do anything, and later improve it? :) I think it is not about bugs, at least not only bugs - it's about new feature and other improvements, no? But being a paranoid sysadmin, I prefer to install rather old - but well-tested - software. 2.7.2.3 and 2.8.1 do good for me (except for MetaKit) - why install new gcc? It is problem with little poor boy named MetaKit, not gcc, I think. Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2/ phd2 at earthling.net Programmers don't die, they just GOSUB without RETURN. From m.faassen at vet.uu.nl Mon Feb 21 15:30:55 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 21 Feb 2000 20:30:55 GMT Subject: eff-bot References: <001701bf7777$08cf9a60$66a2143f@tim> Message-ID: <88s79v$p7q$1@newshost.accu.uu.nl> Tim Peters wrote: > [Moshe Zadka] >> ... >> Have you ever noticed Tim and Guido hardly ever seem to disagree? > I have! And it used to baffle me. >> My Official Conspiracy Theory is that Guido is actually Tim. > No, this is an insufficient application of Occam's Razor. Right -- my conclusion is that you are invisible and talk rarely in real life. You were at the conference, but didn't talk to anybody. After all, Guido said you'd be there, and Guido is always right. Given the fact that he hasn't used his time machine to cancel out his mistake, it wasn't a mistake at all, and you must've been there. But we haven't seen you, so you must be invisible. The only people you actually ever talked to were Guido and Gordon, who both claim to have met you. That-or-you-were-Moshe-Zadka-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 Fri Feb 18 08:05:21 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 13:05:21 GMT Subject: Problem in Using re.subn() References: <38AD3BEF.221D4108@worldnet.att.net> Message-ID: Joseph C. Kopec wrote: > SubResult = re.subn('', Content, > TemplateInput) > I know my Content and TemplateInput values are good strings. sure, but "" is not a valid regular expression. > Any suggestions would be much appreciated. since you're matching constant strings, why not use string.replace instead: SubResult = string.replace(TemplateInput, '', Content) or you can escape the asterisks: "" for more info on regular expressions, see the library refererence (www.python.org/doc) hope this helps! From gerrit.holl at pobox.com Mon Feb 14 09:15:55 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 14 Feb 2000 15:15:55 +0100 Subject: New to programming and python In-Reply-To: <886vhp$qr9$1@nntp8.atl.mindspring.net>; from hanselj@mindspring.com on Sun, Feb 13, 2000 at 02:11:34PM -0500 References: <886vdb$slk$1@nntp8.atl.mindspring.net> <886vhp$qr9$1@nntp8.atl.mindspring.net> Message-ID: <20000214151555.C658@stopcontact.palga.uucp> hanselj at mindspring.com wrote on 950447494: > Sorry, what is the best python book for newbies. There are too many different opinions on that one :) I recommend Learning Python, but since it's the only book for newbies I read, you can't trust me :) Look at http://www.vex.net/parnassus/, category "books". It's a nice list of books. regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From thomas at bibsyst.no Thu Feb 3 08:54:07 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 03 Feb 2000 14:54:07 +0100 Subject: Status of processes running inside an object Message-ID: <3899887F.CA592911@bibsyst.no> Hi, What`s the best method, if do-able, to get info about a process running inside a object? Here`s an example : I got a cd-object that scans thru a cd and does alot of stuff with the things it discovers. How could I track the progress of the scanning procedure without making alot of print "Scanning files ...", print "Indexing documents ...." etc. in the object-code? Is there a way of tracking the state of processes inside an object without printing stuff inside the object itself or stopping in the process so that code outside the object can check the contents of the object?? This is probably impossible, crazy or , but I`d like some ideas. Thanks. Thomas From gerrit.holl at pobox.com Sat Feb 12 11:36:08 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 12 Feb 2000 17:36:08 +0100 Subject: Fully Bracketed Syntax In-Reply-To: <38A337F7.9059B943@americasm01.nt.com>; from eaglesto@americasm01.nt.com on Thu, Feb 10, 2000 at 04:13:11PM -0600 References: <38A337F7.9059B943@americasm01.nt.com> Message-ID: <20000212173608.B4326@stopcontact.palga.uucp> Eaglestone, Robert NGC:B918:EXCH" wrote on 950195591: > Hello all, > > In general, it seems to me that all good programmers > indent their code. However, mandating it as part of > the form of a language sounds ... strange. > > However, I don't like the BEGIN...END bracketing done > by Pascaline languages; neither do I love the {...} > of C and its descendants. > > Has the creator of Python looked into fully bracketed > syntax? That might not be the actual term, so here's > an example of what I'm thinking about: > > if ( foo > bar ) > do_something(); > do_something_else(); > done(); > endif I know that many language use semicolons to end their lines,; but I never really understood why.; If you write a sollicitation letter (is it right English?),; I don't think your potential boss would like all those semicolons.; In Python, it's just not needed,; but it is permitted.; Python uses EITHER ; OR \n for ending it's statements,; multiple statements on a line are perfectly valid, like:; foo(); bar(); fb(); In fact, Python does use block delimeters,; it starts with a colon, and ends with any character!; This is valid:; if a:; foo(); bar(); It just uses the 'b' to end a block!; A '#' can also be used,; or two quotes, if you'd rather have that!; kind regards,; Gerrit.; --; Homepage: http://www.nl.linux.org/~gerrit; -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com; Version: 3.12; GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O; !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y; -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth; From moshez at math.huji.ac.il Sun Feb 27 06:20:52 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 27 Feb 2000 13:20:52 +0200 (IST) Subject: Checking Suspicious Functions Message-ID: After Tim and mine discusion, I thought writing code for a change would be nice. Here's a rough draft of my "checking whether a function can return a value from one place and return None from another" code: --- suspect.py import dis # for HAVE_ARGUMENT, and opname # currently we're to dumb to understand this is valid: # if x: # return 1 # else: # return 0 for i in range(len(dis.opname)): if dis.opname[i]=='LOAD_CONST': load_const = i if dis.opname[i]=='RETURN_VALUE': return_value = i load_const, return_value none_place = 0 # None is always the first suspect def basic_dis(code): ret = [] n = len(code) i = 0 while i < n: b = ord(code[i]) if b < dis.HAVE_ARGUMENT: ret.append((b,)) else: argument = ord(code[i+1])+256*ord(code[i+2]) ret.append((b, argument)) i = i+2 i = i+1 return ret def get_suspects(ops): suspects = [] for i in range(len(ops)): # if Python's compiler has a bug, this will output nonsense if ops[i] == (return_value,): suspects.append((i, ops[i-1])) # if there are two returns at the end, the last one if Python's # fault: it should be smart enough to optimize it away: if len(suspects)>=2 and suspects[-1][0]==suspects[-2][0]+2: del suspects[-1] return map(lambda x: x[1], suspects) def check_suspects(suspects): if not suspects: return 1 first, rest = suspects[0], suspects[1:] if first == (load_const, 0): for el in rest: if el != (load_const, 0): return 0 return 1 else: for el in rest: if el == (load_const, 0): return 0 return 1 def bad_return(func): code = func.func_code.co_code ops = basic_dis(code) suspects = get_suspects(ops) if check_suspects(suspects): return 0 return 1 if __name__=='__main__': def foo(): pass def bar(): return 1 def baz(): if a: return 1 def qux(): return 1 return for f in (foo, bar, baz, qux): if bad_return(f): print f.func_name, "is shaky" else: print f.func_name, "seems alright" --- cut here ----- -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From gerrit.holl at pobox.com Mon Feb 21 15:43:35 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Mon, 21 Feb 2000 21:43:35 +0100 Subject: could help out a newbie? I WOULD APPRECIATE ANY TIPS In-Reply-To: ; from greene@hctc.com on Mon, Feb 21, 2000 at 11:00:59AM -0700 References: Message-ID: <20000221214335.B4076@stopcontact.palga.uucp> > i ma new to programming adn i wan to know anything about python that anyone > has to tell me also i would like to know where ot donwload python? if you > have a follow up please e mail me greene at hctc.com Start at: http://www.python.org/ And follow any links you find on that page. You will be especially interested in the 'tutor' list, for people new to programming. You can subscribe at: http://www.python.org/mailman/listinfo/tutor Have fun! regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From gmcm at hypernet.com Sat Feb 26 08:06:05 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 26 Feb 2000 08:06:05 -0500 Subject: Module Packages In-Reply-To: <89844l$5ek$1@nnrp1.deja.com> Message-ID: <1260552129-14190416@hypernet.com> alxchltn at my-deja.com wrote: > I'm trying to write a package consisting of four modules that are all in > the same folder. After a series of choices from the first module, the > second module is called and so on. When module 2 tries to call a > function from the first, It raises an error - "no function named..." > Should I be using something else besides "from import *", > adding something to "__init__.py" or just make a copy of the function > and paste it to module 2. > I don't just want it to work, I want it to work proper. With your vague description, we can only guess what's going on. First, don't use "from mod import *". It's not a piece of syntactic sugar that lets you magically not type the module name. It looks inside "mod" and makes bindings in this module for all the names it finds in "mod", then it throws away "mod". Now consider when your main imports mod1, and mod1 imports mod2, and mod2 imports mod1. In main, the "import mod1" line is hit. Python starts loading mod1. In mod1, the "import mod2" line is hit. Python starts loading mod2. The line "import mod1" is hit. Python detects the recursion, and just goes ahead, under the assumption that by the time all this loading has completed, mod1 will indeed be there. So mod2 completes loading (but with a reference to mod1 that is not yet good enough to use). Then mod1 completes loading (and the reference in mod2 is now usable). So if mod2 did "from mod1 import *" it got nothing, because at the point that line executed, mod1 was nothing but an empty shell. - Gordon From gmcm at hypernet.com Wed Feb 2 16:55:22 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Wed, 2 Feb 2000 16:55:22 -0500 Subject: Installer Beta3f, and pythoncom, pywintypes In-Reply-To: <389897A9.6D9DB75C@intel.com> Message-ID: <1262593979-1218385@hypernet.com> Lance Shuler wrote: > > I looked on Gordon's website and the searched Dejanews and haven't found > the answer yet. So, here goes... > > I am trying to freeze a python code that accesses Excel using Windows > COM. > > In Beta 3f, I am getting errors that were not present in Beta 3e. In 3f, > I am getting an error in bindepend that it cannot analyze > c:\winnt\system32\pythoncom.dll nor c:\winnt\system32\pywintypes.dll. Of > course these two files don't exist, except in "xxx15.dll" form. Here are > diffs from the a 3f logfile and a 3e logfile: > > 302,303c300,301 > < ('pywintypes', 'c:\\winnt\\system32\\pywintypes.dll', > 'b'), --- 3f Builder.log --- > < ('pythoncom', 'c:\\winnt\\system32\\pythoncom.dll', 'b'), > --- > > ('pywintypes', 'c:\\winnt\\system32\\pywintypes15.dll', > 'b'), --- 3e Builder.log --- > > ('pythoncom', 'c:\\winnt\\system32\\pythoncom15.dll', 'b'), I'm surprised you got anywhere with this with any release. The change you are hitting is this: These dlls have a logical name ("pythoncom"), and a physical name ("full/path/to/pythoncom15.dll"). The latter is obtained from Windows, not Python. As is typical of Windows calls, the case of the name has been destroyed. To enable things like MySQL.pyd, in beta3f, I replace the base portion of the physical name with the logical name, (otherwise at runtime an import of MySQL would get a case mismatch error). Evidently, somehow Mark hooks "import pythoncom" into a load of pythoncom15.dll (possibly through the registry?). Things you could try: 1) Undo what Mark did. 2) Trick the registry (if that's what he's using). 3) Exclude "pythoncom.dll" and include "pythoncom15.dll". 4) Rename pythoncom15.dll to pythoncom.dll. 5) Some combination of the above. 6) Comment out lines 168-171 of resource.py. In terms of "fixing" this, I don't know what to do. Case sensitive imports on a system that is case insensitive combined with strange import hacks make a general solution, um, elusive. > It appears that others have seen this in the newsgroup. My question is > what is the workaround to put in my ".cfg" file to allow me to continue > to build the exe correctly? For Windows COM, do I just need to revert to > Beta 3e? Commenting out those lines will back out that change. You probably want the other changes in 3f. - Gordon From mwh21 at cam.ac.uk Sun Feb 13 18:03:08 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 13 Feb 2000 23:03:08 +0000 Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: neelk at brick.cswv.com (Neel Krishnaswami) writes: > > > 3. Multiple inheritance is unsound > > > > > > By 'unsound' I mean that a method call to a method inherited by a > > > subclass of two other classes can fail, even if that method call > > > would work on an instance of the base class. > > > > Unsure what this is about; am pretty sure nobody has complained about it > > before. Certainly "depth first, left to right" is an unprincipled approach, > > but in practice it's more than predictable enough to use. > > Here's some code: > > class Foo: > x = 99 > def frob(self): > print "%d bottles of beer" % self.x > > class Bar: > x = "bar" > def wibble(self): > print "Belly up to the " + self.x > > Note that all the operations on Foo and Bar work safely for direct > instances of Foo and Bar. But if you define a subclass like so: > > class Baz(Bar, Foo): > pass > > you can get type errors even though both of the superclasses have > type-safe operations: > > >>> q = Baz() > >>> q.frob() > Traceback (innermost last): > [...] > TypeError: illegal argument type for built-in operation > > This is only an annoyance in day-to-day work, but it becomes a big > problem if you are serious about building automatic code analysis > tools for Python (eg for CP4E). This is because the soundness theorems > needed to write things like soft typing tools no longer hold. :( How is this different from (excuse the dodgy syntax, I haven't done much Eiffel): class FOO feature x: INTEGER feature frob: STRING is do Result = interpolate("%d bottles of beer",x.to_string) end end class BAR feature x: STRING feature wibble: STRING is do Result = concatenate("Belly up to the ",x) end end class BAZ inherit FOO,BAR end ? I mean, that won't compile, presumably, but in the case of a code analysis tool there comes a point when it can just throw it's hands up in the air and say "you're not playing by the rules, I give up". Repeasted feature inheritance is not a solved problem in any language I'm aware of. And in this case, the code has a bug, so code analysis catching it is surely a good thing? not-at-understanding-yet-ly y'rs Michael From vmarkwart at my-deja.com Wed Feb 16 23:36:23 2000 From: vmarkwart at my-deja.com (vmarkwart at my-deja.com) Date: Thu, 17 Feb 2000 04:36:23 GMT Subject: C++ Builder and extension modules Message-ID: <88fts7$dc8$1@nnrp1.deja.com> Hi, I'm (trying) to use Borland's C++ Builder to create an extension module (see code below). after converting python15.lib to omf format it compiles with no errors and even works. However, when an exception occurs Python dies informing me that "The instruction at xxx referenced memory at xxxx. The memory could not be written" There's probably something really simple I'm ommitting. Could someone help please? TIA Victor //---------------------------------------------------------------------- ----- #include "python/Python.h" #include #include #include #include extern "C" __declspec(dllexport) void _stdcall inittools(void); #pragma hdrstop //---------------------------------------------------------------------- ----- // Important note about DLL memory management when your DLL uses the // static version of the RunTime Library: // // If your DLL exports any functions that pass String objects (or structs/ // classes containing nested Strings) as parameter or function results, // you will need to add the library MEMMGR.LIB to both the DLL project and // any other projects that use the DLL. You will also need to use MEMMGR.LIB // if any other projects which use the DLL will be perfomring new or delete // operations on any non-TObject-derived classes which are exported from the // DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling // EXE's to use the BORLNDMM.DLL as their memory manager. In these cases, // the file BORLNDMM.DLL should be deployed along with your DLL. // // To avoid using BORLNDMM.DLL, pass string information using "char *" or // ShortString parameters. // // If your DLL uses the dynamic version of the RTL, you do not need to // explicitly add MEMMGR.LIB as this will be done implicitly for you //---------------------------------------------------------------------- ----- int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { return 1; } //---------------------------------------------------------------------- ----- static PyObject * /* returns object */ tools_getUNC(PyObject *self, PyObject *args) /* self not used */ { /* args from python */ char *varName, *res; long err = 0; unsigned long size = 249; res=(char *)calloc(size +1, sizeof(char)); PyObject *returnObj = NULL; /* null=exception */ if (PyArg_Parse(args, "s", &varName)) { err= WNetGetConnection(varName, res, &size); // res = (ExpandUNCFileName(varName)).c_str(); if (err==0 ) { returnObj = Py_BuildValue("s", res); /* Python -> C */ } else PyErr_SetString(PyExc_TypeError, "NetError"); } else { PyErr_SetString(PyExc_TypeError, "Usage: getUNC(path) Example: getUNC ('E:') "); } return returnObj; } static struct PyMethodDef tools_methods[] = { {"getUNC", tools_getUNC}, {NULL, NULL} }; void _stdcall inittools() /* on first import */ { (void) Py_InitModule("tools", tools_methods); } Sent via Deja.com http://www.deja.com/ Before you buy. From aahz at netcom.com Mon Feb 7 19:47:12 2000 From: aahz at netcom.com (Aahz Maruch) Date: 8 Feb 2000 00:47:12 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <87np2g$kc8$1@nntp1.atl.mindspring.net> In article <87nmir$e7k$1 at nnrp1.deja.com>, wrote: > >Python does address some of the shortcomings of Perl -- notably, it is >far more maintainable in a multi-developer envirionment -- despite the >flawed decision to use whitespace as syntax. Speaking as a programmer with more than twenty years of experience and a Python user with less than a year of experince, it is precisely that whitespace-based syntax that accounts for much of Python's usability in a multi-developer environment. Every Python program written by someone with a jot of care has almost the same layout; this greatly enhances readability. I still curse regularly when I get tripped up on some whitespace (particularly while trying to add debugging code quickly), but I think the benefits greatly outweigh the drawbacks. -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Copyright 2000 by aahz at netcom.com. If you see any links around individual words in my posts, they have been put there in violation of copyright (most likely by remarq.com). I encourage you to boycott any ads you see links to. From bjorn at roguewave.com Fri Feb 18 16:00:42 2000 From: bjorn at roguewave.com (bjorn) Date: Fri, 18 Feb 2000 14:00:42 -0700 Subject: What a weird thing !!? References: <88kash$15se$1@news5.isdnet.net> Message-ID: <38ADB2FA.17A4D7A9@roguewave.com> sys.stdout.write("hel") sys.stdout.write("lo") -bjorn Florent Rami?re wrote: > Hello, > > here is something i do not understand ... > > Let's say i want to write two strings which must display "HELLO" > 2 solutions to this problem: > print "HEL" + "LO" > > or > print "HEL", > print "LO", > > But this last solutions does not work !! Python inserts a white space > !? > > I wanted "HELLO", python give me "HEL LO" !!!! > > I certainly have missed something, could you help me on this ? > > Thanks for reading this . > Florent. > -- > ---- > Florent Rami?re framiere at netcom-service.com > Netcom http://www.netcom-service.com > 15, rue de R?musat - 75016 Paris > Tel : 06-60-61-85-32 --- Fax : 01-42-30-50-55 > > -- > http://www.python.org/mailman/listinfo/python-list From skip at mojam.com Fri Feb 18 13:04:21 2000 From: skip at mojam.com (Skip Montanaro) Date: Fri, 18 Feb 2000 12:04:21 -0600 (CST) Subject: Database API explanation In-Reply-To: <20000218202732.A8483@bork> References: <20000218202732.A8483@bork> Message-ID: <14509.35237.846925.600407@beluga.mojam.com> Egbert> I need some help or explanation on the Python Database API Egbert> Specification [12].0 especially how to use them with MySQL, but Egbert> of course some general tutorial is very welcome as well. Egbert> The specifications themselves are less than illuminating for me. Egbert> Earlier I asked more or less the same question, but no reaction. Egbert> But somebody must have written something, I suppose. Egbert, Having overcome the same hurdle with some help from the list, I'll toss out a few things I learned. To connect to a MySQLdb database use something like db = MySQLdb.connect(host='localhost', user='root', passwd='my-passwd', db='somedb') Once you have a connection object you can create a cursor and execute SQL statements: cursor = db.cursor() cursor.execute("select start, city, state, venue from event " "where event.name = %s and " "event.city = %s", ("Brown,Greg", "San Jose")) for item in cursor.fetchall(): print item Note the use of %s formatters in the SQL statement. This is based upon MySQLdb's setting of its paramstyle attribute to "format". The DB api indicates other alternatives, but I think you're constrained to a single style based upon the needs of the underlying SQL implementation. The items returned by the cursor.fetch* routines are lists whose elements are ordered the same as the names in the select statement (e.g. "start, city, state, venue" above). That's about all I'm using of the interface at the moment. That should get you started. Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From tim_one at email.msn.com Fri Feb 18 01:59:50 2000 From: tim_one at email.msn.com (Tim Peters) Date: Fri, 18 Feb 2000 01:59:50 -0500 Subject: Killer Apps??? In-Reply-To: Message-ID: <001401bf79dd$c0445420$e62d153f@tim> [Nick Henderson] > I am new to the world of programming and python. I know Zope is > super cool and is python's "killer app." > > I was wondering if there were any other such killer apps? It would be immodest of me to mention tabnanny.py, which is likely the last word in automated detection of tab/space inconsistencies in worlds with a countable infinity of tab settings. Then again, it would also be insane of me to mention that in this context, so I tried very hard not to . sane-responses-may-appear-after-the-sun-rises-ly y'rs - tim From tismer at tismer.com Sun Feb 13 14:26:47 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 13 Feb 2000 20:26:47 +0100 Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> <2bvp4.3417$dT4.207709696@newsb.telia.net> Message-ID: <38A70577.61955C9C@tismer.com> Fredrik Lundh wrote: > > Tim Peters wrote: > > > ... > > > o Christian Tismer's Stackless Python patch enables the use of > > > first-class continuations in regular Python code. This lets > > > people easily and in pure Python create and experiment with all > > > sorts of funky control structures, like coroutines, generators, > > > and nondeterministic evaluation. Tim: > > Don't tell him I said this, but that's exactly why Guido fears it (any > > stuff he may say about destabilizing the core interpreter loop is a > > smoke screen <0.5 wink>): one programmer's "expressiveness" is often > > another's "gibberish". > > Christian needs to find a "killer app" for Stackless. > > Perhaps the Palm Pilot port is it. Perhaps some form > > of migrating computations among machines is it. Fredrik: > I can name two right away: high-performance web servers > and user interface toolkits. but I fear that nobody's going > to spend much time developing that stuff if they aren't > assured that (at least portions) of stackless python goes > into the core CPython distribution... The Palm project is promising, but I didn't hear back for a week. Maybe I have to buy a Palm? A number of Zope gurus seemed interested on SPAM8, for the webserver issue, but also about new control structures. I'm still waiting for Sam Rushing to show up. He caused me to write that stuff. :-) All in all: I need in fact a killer app. Stackless is hard to understand, the new possibilities are hard to figure out, and that is a showstopper unless I can provide an easier entrance into this. Well, Fredrik is right. I will be the "nobody", and I will have to build a killer app. I'm planning to show it on OSCOM2000, thinking of Eric Raimond's words: "Don't give up!" ciao - chris p.s.: After SPAM8, I was asked by a colleague: "And now? Are they still stacking snames?" -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 kamindra at my-deja.com Tue Feb 1 22:12:08 2000 From: kamindra at my-deja.com (kamindra at my-deja.com) Date: Wed, 02 Feb 2000 03:12:08 GMT Subject: Pythjon and XML Message-ID: <8787a5$ik7$1@nnrp1.deja.com> Hi, just a quick question on using Python with XML. Does Python handle the extended character sets? That is does it handle UTF16 etc with its native function libraries or I have to do something special like in C - char and wchar. Thanks in advance, Kam Sent via Deja.com http://www.deja.com/ Before you buy. From cmena at my-deja.com Wed Feb 2 15:54:55 2000 From: cmena at my-deja.com (cmena at my-deja.com) Date: Wed, 02 Feb 2000 20:54:55 GMT Subject: newbie: balanced tree module Message-ID: <87a5is$tb$1@nnrp1.deja.com> hi: does anyone know where can i find a balanced tree module for python (avl, or red black). i found one called AvlTrees in the python website thing, the problem is that it does not allow me to specify my own compare function. the docs say it uses PyObject_Compare, but i don't know what that is. tia for any help. Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Mon Feb 21 23:57:16 2000 From: effbot at telia.com (Fredrik Lundh) Date: 21 Feb 2000 22:57:16 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Feb 21) Message-ID: new! you can now get your daily dose of URL stuff at: http://hem.passagen.se/eff/url.htm (thanks to the totally awesome "blogger" tool, from www.pyra.com ) Last call for papers to the ORA conference: http://conferences.oreilly.com/oscon2000/call.html IPC8 proceedings now available: http://www.python.org/workshops/2000-01/proceedings.html ReportLab: Yet another Python-powered company: http://www.reportlab.com The PIDDLE graphics library has a new site: http://piddle.sourceforge.net In the news: Fast, Free Prototyping in Python (from Software Development Online): http://www.sdmagazine.com/features/2000/03/source.shtml IDLE 0.5 is released: http://www.python.org/idle Michael Str?der: web2ldap, a full-featured LDAPv2+ client http://www.web2ldap.de/ Markus F.X.J. Oberhumer: PySol version 3.40 (now 163 games) http://pysol.tsx.org (btw, don't miss the Great PySol Poll): http://wildsau.idv.uni-linz.ac.at/mfx/pysol-poll.shtml Michael Ray Steed: Python interface for the GDChart graphics library (release 0.3): http://members.xoom.com/_XMCM/msteed/software/gdchart.html Georg Mischler: Scripting Autocad with Python http://starship.python.net/crew/schorsch/py_acad.html Ng Pheng Siong: classes for arbitrary-precision decimal numbers http://www.deja.com/=dnc/getdoc.xp?AN=586379745 http://www.post1.com/home/ngps/fin/ Denys Duchier: Continuations Made Simple and Illustrated http://www.ps.uni-sb.de/~duchier/python/continuations.html Fredrik Lundh: where to start if you haven't programmed before http://www.deja.com/=dnc/getdoc.xp?AN=587527690 Jeff Shelton on the Zopebox: what's wrong with Zope? http://weblogs.userland.com/zopeNewbies/2000/02/15 Fredrik Lundh: how to evaluate code in the calling function's namespace: http://www.deja.com/=dnc/getdoc.xp?AN=586687655 Grant Edwards and Cameron Laird: why Tkinter uses libtcl, and what can be done about that: http://www.deja.com/=dnc/getdoc.xp?AN=587321233 James Henstridge: where to find Python-Fu scripting for GIMP: http://www.deja.com/=dnc/getdoc.xp?AN=584471553 Finally, we're proud to announce Eff-Bot's Daily Python-URL: http://hem.passagen.se/eff/url.htm ======================================================================== 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 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 Python To-Do List anticipates some of Python's future direction http://www.python.org/cgi-bin/todo.py The Vaults of Parnassus ambitiously collects Python resources http://www.vex.net/~x/parnassus/ 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 paul.magwene at yale.edu Thu Feb 3 13:00:34 2000 From: paul.magwene at yale.edu (Paul M) Date: Thu, 3 Feb 2000 13:00:34 -0500 Subject: pxDislin - release 0.3 Message-ID: <87cfm0$di7$1@news.ycc.yale.edu> DESCRIPTION: ----------- pxDislin is an object-oriented wrapper around the DISLIN plotting library. DISLIN is a powerful and flexible multiplatform (Win32, Unix, Linux, etc.) library designed for displaying scientific data. DISLIN's author, Helmut Michels, has made available a DISLIN plotting extension for the Python programming language (see http://www.linmpi.mpg.de/dislin/ for more details). pxDislin provides a set of classes which represent various aspects of DISLIN plots, as well as providing some easy to use classes for creating commonly used plot formats (e.g. scatter plots, histograms, 3-D surface plots). A major goal in designing the library was to facilitate interactive data exploration and plot creation. Documentation and a demo program are included. The library has been tested on WinNT and FreeBSD, but I anticipate that it should work on any platform which can make use of Python, NumPy, and the DISLIN python extensions. Feedback, comments, and critique are gladly accepted (email: paul.magwene at yale.edu). VERSION: ------- This is release 0.3 of pxDislin. WHAT'S NEW? ----------- -- Almost complete coverage of useful plot functions in the DISLIN library. -- Support for legends. -- New attribute setting mechanisms to improve functionality in interactive seesions. URL: ---- You can find pxDislin at: http://pantheon.yale.edu/~pmm34/pxdislin.html From doughellmann at home.com Sat Feb 19 09:00:44 2000 From: doughellmann at home.com (Doug Hellmann) Date: Sat, 19 Feb 2000 14:00:44 GMT Subject: Multicolumn listbox for Tkinter available ? References: <38a977e2@wwwproxy3.westgroup.com> <38AACB92.199FF676@parlant.com> Message-ID: <38AEA38F.9E08D31@home.com> If you're using Pmw, I've implemented one in my PmwContribD library (http://members.home.net/doughellmann/PmwContribD). It supports extended selection on all lists and the selection returned is a sequence of tuples of the values. Doug From rockjock810 at my-deja.com Fri Feb 18 09:14:51 2000 From: rockjock810 at my-deja.com (rockjock810 at my-deja.com) Date: Fri, 18 Feb 2000 14:14:51 GMT Subject: ODBC, mxODBC problem Message-ID: <88jk4o$vsg$1@nnrp1.deja.com> I've been tinkering with both ODBC and mxODBC modules with no success for the past 24 hours. I tried this with the ODBC module: import cgi,dbi,odbc db=odbc.odbc("express") # no UID, no PWD Traceback (innermost last): File "d:\the-cafe\cgi-bin\express.py", line 25, in ? db=odbc.odbc("express") dbi.operation-error: [Microsoft][ODBC Microsoft Access 97 Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data. in LOGIN I tried the mxODBC variant with not much success. The "express" MS Access database is on a network share: \\core\e$\express\express.mdb The System DSN was not opened at all exclusively and I haven't been having problems accessing the same using Perl ODBC. Help! Sent via Deja.com http://www.deja.com/ Before you buy. From breiter at usf.Uni-Osnabrueck.DE Thu Feb 10 03:34:00 2000 From: breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) Date: 10 Feb 2000 08:34:00 GMT Subject: mail filter in python? References: <20000207154641.A2817@stopcontact.palga.uucp> <20000207175222.J19265@xs4all.nl> <14495.11639.467461.357073@beluga.mojam.com> <200002072129.PAA47259@starbase.neosoft.com> Message-ID: <87tt5o$nt8$1@newsserver.rrzn.uni-hannover.de> In article , cbbrowne at news.hex.net (Christopher Browne) writes: > Note that Cooledit integrates Python as its > scripting tool; that may make it more suitable as an option for those > that would like to do "powerful text editing using Python." Hmmm vim also has python bindings and is more modular and versatile as cooledit. www.vim.org Bernhard -- Free Software Projects and Consulting (intevation.net) Association for a Free Informational Infrastructure (ffii.org) From nascheme at enme.ucalgary.ca Thu Feb 17 17:52:01 2000 From: nascheme at enme.ucalgary.ca (Neil Schemenauer) Date: Thu, 17 Feb 2000 22:52:01 GMT Subject: Continuations and threads (was Re: Iterators & generators) References: Message-ID: Samuel A. Falvo II wrote: >OK, that's informative. So much for the differences between threads and >continuations. But I'm still left wondering just what the heck >continuations are. :) Here is my two bit explaination (based on Scheme's call/cc): A continuation is a function which represents the rest of the program. Instead of returning from a function you can call this function giving it one argument which is the return value. These functions are first class just like everything else in Scheme. You can bind them to variables or pass them as arguments. You can also call them more than once passing different "return" values. I hope that doesn't damage the old melon too much. :) Neil From dan at cgsoftware.com Fri Feb 25 13:43:25 2000 From: dan at cgsoftware.com (Daniel Berlin) Date: 25 Feb 2000 13:43:25 -0500 Subject: No way to reach CXX again ? In-Reply-To: "Harold L. Weaver"'s message of "Fri, 25 Feb 2000 10:30:37 -0000" References: <38B676D7.28C44F56@onera.fr> <896hhq$fsl@caribe.pdx.oneworld.com> Message-ID: No, that's NumPy, not CXX. CXX Isn't available there yet. CXX is still where it used to be. >>>>> "HLW" == Harold L Weaver writes: >> I'm trying to dowload CXX (LLNL/ P.Dubois). I've unsuccessfuly tried >> all the links I had: no way... Any idea? Is CXX dead? Is CXX now >> private? HLW> Moved to sourceforge.net: HLW> http://sourceforge.net/project/?group_id=1369 | -- | http://www.python.org/mailman/listinfo/python-list From bradh at mediaone.net Sat Feb 5 20:27:21 2000 From: bradh at mediaone.net (Brad Howes) Date: Sun, 06 Feb 2000 01:27:21 GMT Subject: CGI Scripts References: Message-ID: "Robert Rutkowski" writes: > count = open('counter.log', 'r+') When the web server runs your script, you may not have permissions to this file. Check that. Brad -- "Were people this stupid before TV?" -- _White Noise_ by Don DeLillo From wlfraed at ix.netcom.com Sat Feb 12 22:03:52 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Sat, 12 Feb 2000 19:03:52 -0800 Subject: X-no-archive fails (was Re: Python sucks loud) References: <882tfn$75h$1@nntp6.atl.mindspring.net> Message-ID: <9t6casst3dbip0h1vaama0kq9g81tittkr@4ax.com> On 12 Feb 2000 06:09:59 GMT, aahz at netcom.com (Aahz Maruch) declaimed the following in comp.lang.python: > > Well, sure. But they don't honor it in quoted text -- which is what > happens during a followup. Moreover, it turns out during the recent > RemarQ fiasco that they didn't honor that header in the past. Well, how many newsreaders honor it as a full header when quoting text too (after all, to make a newsreader honor it during a follow-up means the newsreader won't permit quoting OR cut&paste). Agent has an option, I believe, in which you can have it duplicate the header when replying. -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From moshez at math.huji.ac.il Sat Feb 12 12:57:55 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 19:57:55 +0200 (IST) Subject: Parnassus mirror? In-Reply-To: <38A559D8.85711AD7@python.net> Message-ID: On Sat, 12 Feb 2000, Thomas A. Bryan wrote: > I'm also hoping that *someone* starts working on Trove again. The Official Eric Response (last I heard) was that Trove is dead, and what's left will be folded into sourceforge as a better searching tool. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From effbot at telia.com Fri Feb 4 04:57:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 04 Feb 2000 09:57:42 GMT Subject: Executing external programs with vars References: <949656797.2089988259@news.sheltonbbs.com> Message-ID: Mike Partin wrote: > Hi, I'm relativly new to python as a language, I started trying to pick it up > to implement a shell script I have done for helping with CVS use. I'm not > having problems executing external programs per say, it's that I'm having > problems executing them and including variables. For example, when updating a > cvs module I set my variable TempVar with raw_input() then when I exec cvs I > need it to be in the form "cvs -z3 co TempVar" but can't seem to get this to > work. Any help would be appreciated. I assume you mean that you want the command to include the current *contents* of TempVar, right? Command = "cvs -z3 co " + TempVar os.system(Command) alternatives include the %-formatting operator, or using join to build the command from bits and pieces. reading the "output formatting" chapter in the tutorial might help, too. From tottinge at concentric.net Tue Feb 22 09:42:20 2000 From: tottinge at concentric.net (Tim Ottinger) Date: 22 Feb 2000 09:42:20 EST Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> Message-ID: <38b1a83b.25970002@news.concentric.net> >Inbetween all the bickering, I got a lot of useful information. It >would be nice to summarize these points in a succinct, factual manner. Would have been cool to get it without the bickering, though. >First and foremost, I did not find in the FAQ, or in any of my searching >around on www.python.org, or in any place in Mark Lutz's _Programming >Python_ that was clear from the TOC or index, or in the 1/3 of the tome >I've read so far, any sort of clue into the really incredibly obvious >question that is underneath all this: "How do you deal with tabs vs. >spaces?" > >I don't know why this is so hidden. I think any reasonable FAQ on the >matter must state, in some obvious and up-front way THE PYTHON >INTERPRETER ALWAYS INTERPRETS A TAB AS 8 SPACES. There was a quote from >Guido's guide to programming style (or something like that -- NOT the >first document I'd look at when trying to figure out how the dang thing >works) that was quite to the point somewhere in the responses to my post >that was quite to-the-point which I think you should probably use. Every non-M$ programmer I know sets tabs to 8 spaces, shifts/indents to 4, and most of them set whatever editor they use to write spaces rather than tabs. I do this in vim, M$ IDE (when forced to use it), and in all other editors I've ever used for code work. When you print text, it expands tabs to 8 chars normally, so most developers automagically (without thinking) either use 8-char tabs, or don't use them. I hate the little beasties, and am not so pressed for disk space that I'd use them to save 7 bytes each. So I think we all overlook the errors that we don't personally commit. That's just humanity, not pythonity. Who would have thought it? Tim From tseaver at starbase.neosoft.com Tue Feb 15 17:38:49 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 15 Feb 2000 16:38:49 -0600 Subject: Real Problems with Python References: <000e01bf7763$dc8a9300$66a2143f@tim> Message-ID: <36D1542F6A4700D6.94850CC9820472D8.A6C711CADC502BE1@lp.airnews.net> In article <000e01bf7763$dc8a9300$66a2143f at tim>, Tim Peters wrote: >[Tim] >> ... >> More formally, you can certainly *model* Python's scoping in Scheme, > >[Bijan Parsia] >> Er..Just out of curiosity, what *can't* you model in Scheme? :) > >Smalltalk . I'd be willing to venture some of Forth's wierder stuff, too. > >> And-not-in-the-trivial-turing-machine-sense-ly y'rs, >> Bijan Parsia >> >> P.S. Hey! Where's my wallet? > >at-the-door-just-waiting-for-you-to-find-the-exit-ly y'rs - tim This-way-to-the-egress-ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From aa8vb at yahoo.com Fri Feb 25 07:33:35 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Fri, 25 Feb 2000 07:33:35 -0500 Subject: ".idlerc" ?? Message-ID: <20000225073335.A3192031@vislab.epa.gov> Glad to see it's MUCH easier to change colors with the latest IDLE. Now is there a way to put these color settings in an ".idlerc" of sorts so they're kept from version to version without hacking any source? Thanks, Randall From jjlucsy at concentric.net Mon Feb 7 09:34:19 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Mon, 7 Feb 2000 09:34:19 -0500 Subject: Lisp 2 Python? References: <87h33i$t1l$1@nnrp1.deja.com> <1U_m4.464$oU5.2693459@news4.usenetserver.com> <87jv69$p9f$1@nnrp1.deja.com> Message-ID: I'll let you know what I come up with, just don't expect anything soon. It's not my main focus at this point. "Georg Mischler" wrote in message news:87jv69$p9f$1 at nnrp1.deja.com... > Joel Lucsy wrote: > > Georg Mischler wrote: > > > Once we are here, the more interesting thing (and precondition > > > to the above for any useful applications) would be a Python > > > wrapper to ADS, and ultimately ARX. Yes, the latter looks like > > > gargantuan task, but some day someone will have to do it... ;) > > > > To start off just wrap the AutoLisp specific functions that deal > > with AutoCAD. Then throw in ARX wrappings. > > I'm just doing this(the conversion) as a side project. I'm am doing a > > project with Python, but would like to see the other programmers to > > use it as well. It would be easier to have to automatically converted > > to see a side by side comparison. I'd suspect it would still be > > rewritten once they'd get into, but it would be a starting point. > > > Joel, > > if you start writing ADS/ARX wrappers, please tell me, so we can > share some of the work. I know of other people who would be > interested in such a thing as well, and who'd also be capable > of contributing. I believe that we could get a core group of > programmers together that know enough about the matters involved > to be helpful and would all profit from the result. I will have > to implement a very basic connection between Autocad and Python > myself in the very near future, and the broader foundation that > gets the better. I always prefer general solutions to fast hacks, > but of course, it's all a matter of the effort involved to > solve a specific problem. If my needs can be solved better > with a combined attack, then that would definitively be the > preferred solution! > > > -schorsch > > -- > Georg Mischler -- simulation developper -- 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 thomas at xs4all.net Thu Feb 10 09:06:11 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 10 Feb 2000 15:06:11 +0100 Subject: Open script In-Reply-To: <000a01bf73c5$d9b48060$6c00a8c0@ruidovisual.pt>; from psilva@ruido-visual.pt on Thu, Feb 10, 2000 at 12:53:38PM -0000 References: <000a01bf73c5$d9b48060$6c00a8c0@ruidovisual.pt> Message-ID: <20000210150611.E477@xs4all.nl> On Thu, Feb 10, 2000 at 12:53:38PM -0000, Pedro Silva wrote: > I'm trying to use OPEN to open a folder, because I need to get the content > of that folder. > This folder is in the filesystem. > The code line that I'm using is: > f = open('var/spool/news/articles','r') > fs = f.realines() > return fs > But this is giving me and error. Is this correct or because articles is a > folder and is because of that that the error is displayed. > Please send me your answers to: psilva at ruido-visual.pt While Long Ago in the UNIX world, folders (directories) were just another kind of file, and you had to read them manually, this has been abandoned long ago ;) As far as I know, all operating systems nowadays use opendir/readdir-style interfaces to folders (directories). Python has (of course) a friendly little interface to that: os.listdir(): >>> import os >>> os.listdir("tst") ['tmp'] Note that os.listdir() omits the . and .. directories, which are 'normal' directories under unix, but special magic thingies under win32 (IIRC, anyway) and dont actually exist under Mac (again, IIRC.) You'll have to add them manually if you do expect them to be there. Two notes though: if you do a lot of listdir()s, check out the dircache module. And if you plan to be portable, dont use slashes in paths, use os.path.join() on the seperate segments. But then, the above path is fairly platform dependant ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From python at channel21.com Wed Feb 23 13:34:13 2000 From: python at channel21.com (python) Date: Wed, 23 Feb 2000 13:34:13 -0500 Subject: IIS keeps crashing from PyWin Message-ID: <81DD38F43381D111BA3E00A076A0998A459F44@XENON> I sent this one through already, but it didn't hava a title, so I hope people will respond now ;) Sorry for a duplicate if you read the other one. I am using NT 4.0 Service Pack 6a and IIS 4.0 on a dual-processer PIII Intel system w/ 1G RAM. Python Version is 1.5. I get the following error in my Event Logs every 2 hours (and the services crash simultaneously as well), and I have no idea what's causing it and how to stop it... : An object call caused an exception. (IID: {51372AEF-CAE7-11CF-BE81-00AA00A2FA25}) (Method: 3) (Microsoft Transaction Server Internals Information: File: i:\viper\src\runtime\mtxex\activity.cpp, Line: 889) (Exception: C0000005) (Address: 0x1e6054df) PyWinTypes15!PyWinThreadState_Free(void) + 0xF asp!TerminateExtension + 0x3D35 asp!TerminateExtension + 0x33E3 asp!TerminateExtension + 0x313B asp!TerminateExtension + 0x7AC3 asp + 0x325C6 mtxex!MTSCreateActivity + 0x1F3C mtxex!MTSCreateActivity + 0xF3E *** if you notice the file reference i:\viper\src\runtime\mtxex\activity.cpp, there is no, nor was there ever, an i drive on my machine... please help!! we've been using python on the web for 3 years now and this is something new which is going wrong... (this machine is a new installation as of about a month ago - the errors only started happening after I started running high-traffic sites on the machine) ************************************************** Jason S. Nadler Lead Programmer Channel21 Productions, Inc. ... What are you doing right now? ************************************************** From gutier at intergate.bc.ca Tue Feb 1 01:06:48 2000 From: gutier at intergate.bc.ca (Gerald Gutierrez) Date: Mon, 31 Jan 2000 22:06:48 -0800 Subject: time module & ISO dates Message-ID: <949385408.356246722@news.intergate.bc.ca> Hi all. Is there any way to get the standard Python time module to properly parse full ISO-8601 dates, such as "2000-01-31T22:07:43-0800"? strptime() ALMOST does what is needed but it does not provide for parsing the UTC offset at the end (the "-0800"). Also, does anyone know where I can get a list of standard timezone names as is understood by Python? Thanks very much. Please forward replies to gutier at intergate.bc.ca. From sanderson at ttm.com Mon Feb 14 08:36:54 2000 From: sanderson at ttm.com (Scott Anderson) Date: Mon, 14 Feb 2000 08:36:54 -0500 Subject: Question concerning makepy.py for COM (long, code included) References: Message-ID: <38A804F6.FC0E3EAC@ttm.com> Interesting. I get this error on properties, methods, everything. Perhaps the control has some internal initialization that occurs only after it has been dropped on a VB form. Oh well, thanks anyways. Regards, -scott > > Here's what I'm getting: > .. > > > "C:\dev\python\win32com\gen_py\DBD89B20-C44F-11CF-8C05-0004AC77A721x0x > 1x0.py", > > line 50, in __setattr__ > > pywintypes.com_error: (-2147418113, 'Unexpected failure', None, > None) > > This is simply an error that has been returned from the object. > > Python (or me) has no idea what has caused this. Sorry. From tim_one at hotmail.com Sun Feb 20 12:47:04 2000 From: tim_one at hotmail.com (Tim Peters) Date: Sun, 20 Feb 2000 09:47:04 PST Subject: Can't reopen eMatter book Message-ID: <20000220174704.94088.qmail@hotmail.com> [Anders Eriksson has problems opening the effbot's eMatter book, Tim trots out the "kill the fatbrain.com registry branch" hack that worked for him, then ... ] >Thanks for the suggestion. Unfortunally this didn't solve my problem. >... [tale of woe] ... >After a while we found out that I'm using the Swedish version of >Acrobat 4.0 Damn -- beat me to it! That was going to be my next suggestion . >and eMatter don't work with any version except the American. An irony only you will fully appreciate is that the effbot (your book's author) was designed, built, programmed, and still resides, in Sweden. BTW, one of the people who devised the eMatter registration scheme wrote in pvt to say that the need for the "kill the fatbrain.com registry branch hack" on some systems is now understood, and a fix is in beta. People who have tried to program Windows before will recognize the true cause: a system API that's only been implemented by one vendor, so is full of surprises no matter how carefully you study the docs and think you've tested your code. try-writing-a-windows-speech-recognition-app-ly y'rs - tim ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From mfletch at tpresence.com Thu Feb 10 14:03:39 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Thu, 10 Feb 2000 14:03:39 -0500 Subject: Corel + Borland = The End of MS Win Message-ID: Wasn't complaining about newbies :). Was saying that maybe we should let these types of threads die, since they aren't really adding anything to the newsgroup, and tend to devolve into flames etceteras. I.e. we should get back to the clear, intelligent, polite commentary, with well laid out arguments and an assumption that those involved are doing their best (i.e. not ridiculing other people's comparisons with Python, but striving to understand why the perception is there, and potentially fix the problem or educate the people). I don't generally get involved in these discussions, but since there was a question "does Python have object-oriented structure", and I could answer with actual content, I thought I'd chip in and foist my (apparently a little too dry) sense of humour on everyone :) . Yours, An unrespected younger ;) -----Original Message----- From: Sean Blakey [mailto:seanb at home.com] Sent: Thursday, February 10, 2000 10:37 AM To: Mike Fletcher Cc: Python Mailing List Subject: RE: Corel + Borland = The End of MS Win Please, don't complain about the newbies. If we start complaining about newbies here, it is only a matter of time before we start flaming to a crisp anybody who whines about whitespace. At that point we become the python equivalent of comp.lang.perl.misc. I have been reading this group for about a year now, and from day one I was consistently impressed by the polite, patient, friendly tone that prevails here. I have heard it commented that one of the best things about python is the python community. Even when Tom Christianson came through here a while ago, the vast majority of the people here were able to disagree clearly, intelligently, and politely. As in all things python, we should pay attention to the example set by Guido. You have to dig back in the python-list archives many years to find him responding much to this kind of thread that pops up again and again. Many other "respected elders" of this group have taken the same attitude. When something this boring pops up again (as it inevitably will), you will not see flames from any of these people. Just a conspicuous silence. ... From billtut at microsoft.com Tue Feb 1 16:05:43 2000 From: billtut at microsoft.com (Bill Tutt) Date: Tue, 1 Feb 2000 13:05:43 -0800 Subject: question about COM and ADO Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC99@RED-MSG-50> > -----Original Message----- > From: Geoff Talvola [mailto:gtalvola at NameConnector.com] > > Bill Tutt wrote: > > > > From: gtalvola at NameConnector.com > [mailto:gtalvola at NameConnector.com] > > > > > [problems with translating the below VB code into Python] > > > > > Dim cnn as New ADODB.Connection > > > > > cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data > > > > Source=c:\db1.mdb" > > > > > dim rs as New ADODB.Recordset > > > > > rs.CursorLocation = constants.adUseClient > > > > > rs.Open "SELECT * FROM Table1", cnn, adOpenStatic, > > > > > adLockBatchOptimistic > > > > > set rs.ActiveConnection = Nothing > > > > Well according to build.py: > > # This is not the best solution, but I dont > think there is > > # one without specific "set" syntax. > > # If there is a single PUT or PUTREF, it > will function as a > > property. > > # If there are both, then the PUT remains a > property, and > > the PUTREF > > # gets transformed into a function. > > # (in vb, PUT=="obj=other_obj", PUTREF="set > obj=other_obj > > So, something like the following might work since, > ActiveConnection does > > have a put and a putref functions: > > rs.SetActiveConnection(None) > > > > This code in Python > > rs.ActiveConnection = None > > Has the bogus VB equivalent of: > > rs.ActiveConnection = Nothing > > (i.e. no Set) > > > > The PUT vs. PUTREF distinction royally sucks. > > > > Bill > > Unfortunately, this doesn't work either: > > >>> rs.SetActiveConnection(None) > Traceback (innermost last): > File "", line 1, in ? > rs.SetActiveConnection(None) > File "E:\Program > Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2 > EA4x0x2x1.py", > line 1490, in SetActiveConnection > return self._ApplyTypes_(0x3e9, 8, (24, 0), ((9, 1),), > 'SetActiveConnection', None, arg1) > File "E:\Program > Files\Python\win32com\gen_py\00000201-0000-0010-8000-00AA006D2 > EA4x0x2x1.py", > line 375, in _ApplyTypes_ > return > self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid, > LCID, wFlags, retType, argTypes) + args), user, resultCLSID) > TypeError: None is not a invalid interface object in this context Ok, this is a tad bizzare... What version of the Win32 extensions are you running? Bill From andla at usa.net Sat Feb 5 16:44:46 2000 From: andla at usa.net (Andreas) Date: Sat, 5 Feb 2000 22:44:46 +0100 (MET) Subject: Need help with Active Template Library. Message-ID: , It seams that i always get stuck in my programming and i was hoping that you could help me. I have created a web page with these problems so that others could share info on these problems or post other problems or how to solve a problem. I have uploaded this site today and hopfully i get some visitors when the page is on a search engine. I'm also desperate to get any help to these problems. I would be happy if you could help me. I'm using Active Template Library and MSVC 6.0 Webpage: http://members.xoom.com/prgsolver/ E-mail: andla at usa.net From mikael at isy.liu.se Tue Feb 1 09:12:34 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 01 Feb 2000 15:12:34 +0100 (MET) Subject: Packages, modules, libraries,... In-Reply-To: <001b01bf6cbb$519533c0$3acbd9c2@peridot.optichrome.com> Message-ID: On 01-Feb-00 Adrian Eyre wrote: > Imagine the following filesystem structure: > > /home/fred/python/ <- This is in the PYTHONPATH > | > +- cafe/ > | | > | +- __init__.py > | | > | +- bacon.py > | > +- spam.py > > > import spam # Imports "module" from file spam.py[c] > import cafe # Imports "package" from file cafe/__init__.py[c] > import cafe.bacon # Imports "module" from file cafe/bacon.py[c] Just to be sure: I guess I have to import cafe before I can import cafe.bacon. Are there any special demands on cafe/__init__.py compared to ordinary modules? /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: 01-Feb-00 Time: 15:09:48 This message was sent by XF-Mail. ----------------------------------------------------------------------- From greg at cosc.canterbury.ac.nz Wed Feb 16 22:11:43 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 17 Feb 2000 16:11:43 +1300 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <200002091623.LAA29125@seanb.sttln1.wa.home.com> <87thrq$gf7@news.or.intel.com> Message-ID: <38AB66EF.8EE773F9@cosc.canterbury.ac.nz> tye4 wrote: > > Pascal. Score: 2/10. > C++/Java. Score: 5/10 I don't see why Pascal and C[++] get different scores -- begin/end and {/} are isomorphic. You don't have to indent an extra level in Pascal, e.g. if foo then begin bar; stool; end; -- 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 vetler at ifi.uio.no Wed Feb 23 12:13:54 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: Wed, 23 Feb 2000 18:13:54 +0100 (MET) Subject: Which GUI? In-Reply-To: <20000223161839.B3134@stopcontact.palga.uucp> Message-ID: on 2000-02-23, Gerrit Holl wrote: > > > Tkinter needs to provide their own documentation > > > > this is actually wrong. I use the Tcl/Tk documentation all the time when > > I'm using Tkinter. no problem. > > I *do* have had problems with this. Please type "man canvas" and search > for 'create'. There's not straight way to find out the Python way without > either reading the source or reading the documentation by the effbot. okei.. perhaps YMMV > > > and advantages, while wxWindows or QT already has lots of > > > documentation, that not need to be copied into wxPython and PyQT. > > > > wxPython and pyQt are not as portable as Tkinter. > > Please give an example! well.. I'm only repeating what I've read previously in this thread. I believe Qt is not available for Windows without paying money, and I'm not sure what platforms Qt and wxWindows (or whatever it's called) is available on. > > Tkinter does NOT reinvent the wheel. I can't understand where this comes > > from. > > It provides their own classes. These classes are invented by Tkinter, they > do not exist in Tcl/Tk. And the methods don't even *match* with Tcl functions! I must admit I'm on new territory here. I've only been using Python and Tkinter for ~5 months or so. So my statements may have nothing to do with reality. I appologize. However, my experience with Tkinter is only positive. I think it's easy to use, I do _not_ think it's ugly, and I have successfully used the Tcl/Tk documentation together with Tkinter. But, as I have nothing more interesting to say about this, I will shut up :-) gooey-schmooey-let's-all-use-curses-ly y'rs, vr From quinn at pfennig.ugcs.caltech.edu Mon Feb 21 14:49:50 2000 From: quinn at pfennig.ugcs.caltech.edu (Quinn Dunkan) Date: 21 Feb 2000 19:49:50 GMT Subject: functional programming References: Message-ID: On Fri, 18 Feb 2000 17:24:10 -0500 (EST), Michal Wallace (sabren) wrote: >Hey All, > > That Software Development Magazine article had a sidebar which >mentions that python supports functional programming. I know what >functional programming IS, and I can see how python supports it, but >I'm wondering if anyone has any examples of actually putting this >to use? def f(x): return x * 2 j = f(5) 'Functional programming' is simply the application of 'pure' (no side-effects) functions. The difference (I can see) between 'functional' and 'not functional' languages is that functional languages stop there, and give you a whole bunch of shortcuts to ways to make it easier to stand it (higher-order functions, monads, tail recursion, etc.). 'not functional's give you extras like mutable objects, control structures (loops, if then). Perhaps this is simply the magazine's confused way of saying that functions / methods are first-class in python. Ecce codo: lst = map(f, range(10)) or lst = map(lambda x: x * 2, range(10)) I use map, filter and reduce occaisionally, but often it's easier to write a loop in python. If list comprehensions make it in, I'll use them all the time, replacing all those hard-to-read loops with easy [x for x in ...]. From darcy at vex.net Fri Feb 4 14:17:44 2000 From: darcy at vex.net (D'Arcy J.M. Cain) Date: 4 Feb 2000 19:17:44 GMT Subject: Eight suggestions for Python books (long) References: <87268i$786$1@nnrp1.deja.com> <87cem5$k2e$1@nnrp1.deja.com> Message-ID: <87f8ko$qah$1@news.tht.net> curtis001 at my-deja.com wrote: > I would kill for a Python cookbook/algorithm book!! > I think an exmaple book like this would be perfect for folks like > myself who have programming experience, but who don't have Python > experience. I just received an advance copy of Martin C. Lawrence's "Python the Annotated Archives." (He uses one of my scripts - page 42.) Martin also did "Perl the Annotated Archives" and "Perl: The Complete Reference" for Osborne. While I haven't studied each section yet, it looks like a nice way to teach the subject. Sort of builds on the idea of looking for a script that does what you want by going further and explaining the program step by step. Not sure when it will be in stores. -- 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 effbot at telia.com Sun Feb 6 13:25:19 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 18:25:19 GMT Subject: chdir questions References: Message-ID: Patrick K Moorman wrote: > I know this is must be an easy one but how do I use os.chdir? I have tried > many different ways of listing the path but no matter how I type it I get an > error. Most common is either: > > >>> os.chdir(C:\temp) > File "", line 1 > os.chdir(C:\temp) > ^ > SyntaxError: invalid syntax > > >>> os.chdir(c\temp) > File "", line 1 > os.chdir(c\temp) > ^ > SyntaxError: invalid token os.chdir() takes a string as an argument. to put a string value in your program, you have to put quotes around it. however, string values treat \ as a special character, so the easiest way is to use unix-style separators: os.chdir("C:/temp") alternatively, you can use "raw strings": os.chdir(r"C:\temp") or write the backslash as \\ os.chdir("C:\\temp") > I have looked through many tut's but it seems that this is too simple to be > mentioned. Can anyone give the syntax for this including what the path > should look like? On a related note, is there a book that has the stanard > lib broke down like this? Thank you. i'd recommend reading the standard tutorial again, and look at the various code examples a little bit more carefully: http://www.python.org/doc/current/tut for more info on strings, start here: http://www.python.org/doc/current/tut/node5.html -> Section 3.1.2: Strings also see the grimoire: http://starship.python.net/crew/amk/grimoire for a full (but formal) description of how python parses your source program, and how string con- stants are treated, see: http://www.python.org/doc/current/ref/lexical.html (since it looks as you haven't used any comparable programming language, such as C, Java, Basic etc, you should probably skim the entire chapter). From bayinnaung at my-deja.com Tue Feb 15 00:49:19 2000 From: bayinnaung at my-deja.com (bayinnaung at my-deja.com) Date: Tue, 15 Feb 2000 05:49:19 GMT Subject: CGI/HTML forms in a standalone application. References: <889bjo$9s$1@nntp9.atl.mindspring.net> Message-ID: <88apcv$pkn$1@nnrp1.deja.com> Thanks for the hints. Python is number 1. It has the best, most helpful community of any of the scripting languages.... and it's not a monster like Perl... impossible to write little downloadable applications with. I'm going to use it in the little programming class I have in Yangon, Myanmar. Thanks again, Jon Fernquest bayinnaung at hotmail.com Sent via Deja.com http://www.deja.com/ Before you buy. From seanb at home.com Mon Feb 21 11:18:34 2000 From: seanb at home.com (seanb at home.com) Date: Mon, 21 Feb 2000 11:18:34 -0500 (EST) Subject: Q: Catching any exception an printing it In-Reply-To: <38B18395.61EA@cs.bham.ac.uk> Message-ID: <200002211618.LAA18396@seanb.sttln1.wa.home.com> On 21 Feb, Stuart Reynolds wrote: > Python allows you to do, > > try: > if a: > raise SomeException() > else: > raise xyz() > > except: > print 'There was an error' > > but is it possible to print out the exception if you don't know what > type it is? I'd like the above error message to be more useful, but the > exception raised inside the try block could be anything. Is it possible > to find the last exception raised? > > Cheers, > > Stuart You want exc_info() in the sys module - it returns a tuple of (type, value, traceback) for the exception currently being handled. -- Sean Blakey (206)297-7123 quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0]) From effbot at pythonware.com Wed Feb 23 17:44:26 2000 From: effbot at pythonware.com (effbot at pythonware.com) Date: Wed, 23 Feb 2000 22:44:26 GMT Subject: Tkinter: user vs. program events References: <3d1z65kr2j.fsf@amarok.cnri.reston.va.us> <88v2f5$7md$1@wanadoo.fr> <3dn1orfwzq.fsf@amarok.cnri.reston.va.us> Message-ID: <891ns9$ie8$1@nnrp1.deja.com> Andrew Kuchling wrote: > > why not just add a semaphore? > > That's what I first thought, but it doesn't work. /.../ > The solution is probably "Don't do that, then" some further digging makes me think that this could work: light_var = FloatVar() light_scale = Scale(command=adjust, variable=light_var) to change the setting, update list_var, not the widget itself: light_var.set(value) the scale implementation contains special code to avoid calling the command callback if the variable value changes, so this should work. Sent via Deja.com http://www.deja.com/ Before you buy. From gerrit.holl at pobox.com Fri Feb 11 01:33:00 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Fri, 11 Feb 2000 07:33:00 +0100 Subject: Fully Bracketed Syntax In-Reply-To: <38A337F7.9059B943@americasm01.nt.com>; from eaglesto@americasm01.nt.com on Thu, Feb 10, 2000 at 04:13:11PM -0600 References: <38A337F7.9059B943@americasm01.nt.com> Message-ID: <20000211073300.A711@stopcontact.palga.uucp> Eaglestone, Robert NGC:B918:EXCH" wrote on 950195591: > Hello all, ... > if ( foo > bar ) > do_something(); > do_something_else(); > done(); > endif Let me add two characters, and it's totally valid. if ( foo > bar ): do_something(); do_something_else(); done(); #endif regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From kens at sightreader.com Sun Feb 27 17:48:49 2000 From: kens at sightreader.com (Ken Seehof) Date: Sun, 27 Feb 2000 14:48:49 -0800 Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> Message-ID: <38B9A9D1.52953D1@sightreader.com> Since you are talking about a real-time game, I'd say it would not be wise to run a python script for every object on every frame. A better approach might be to use python to decribe -change- in behavior in response to -events-. In any case, you'll probably want to keep python out of your inner loops. How to do this depends very much on what kind of game you are writing, but I'm sure there's a way to get the results you want (there always is). It's faster to call C from Python than Python from C. The important point is that if you keep Python outside of your inner loops, you won't have a performance problem. If you are calling Python from C, your architecture is probably inside out. Write me as you get further along. I'm developing a Neural Net IDE called "Neural Integrator" (NI). It might be fun to see if some AI would make your bad guys more interesting. Also, behaviors can be described graphically with NI with it's visual editor. And best of all, the front end is in python, but the engine is in C, so there is almost no perfomance cost at runtime. - Ken Seehof kens at sightreader.com Shawn LeBlanc wrote: > Greetings! > > Being totally new to Python and completely honest in saying that > I have no idea of what I'm doing, I had a few questions. > > My team and I are thinking about embedding Python into our > game engine on the Windows platform. The basic idea would be that the > major entities, including enemies, would have a script attached to > them to control behavior. This would allow the level/content designers > to concentrate more on the game design side of things, since > behaviors would be outside of the main game engine. Is it > possible to have multiple scripts running at the same time? > Would this involve creating multiple interpreter objects? According > to the docs, this is possible but it isn't totally safe to do. > What would be a good strategy for this? > > My other question was one of performance. Is it crazy to have > ~10 different objects with each an individual script and hoping > the game will be running at 30 frames per second? The question might not be > valid, since I'm not sure how to implement it in the first > place. > > And lastly, is it faster to call C functions in Python or vice-versa? > > with milk and cookies, > Shawn > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com From gerrit at nl.linux.org Mon Feb 28 07:20:36 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Mon, 28 Feb 2000 13:20:36 +0100 Subject: self argument In-Reply-To: ; from greg@perceval.be on Mon, Feb 28, 2000 at 01:04:59PM +0100 References: <38B826A8.66DAEB43@Lugoj.Com> Message-ID: <20000228132036.A5850@humbolt.nl.linux.org> On Mon, Feb 28, 2000 at 01:04:59PM +0100, Gregoire Welraeds wrote: > In reply to the message of James Logajan sent on Feb 26 (see below) : > > In my newbiness ignorance, I'm asking what is the difference between t and > self.x. Aren't they both member of the class C ? No, only 'self.x' is. 't' is only in the local namespace; it gets destroyed as soon as the function (method, in this case) is ready. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From jjlucsy at concentric.net Fri Feb 4 15:18:20 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Fri, 4 Feb 2000 15:18:20 -0500 Subject: Lisp 2 Python? Message-ID: Are there any lisp-to-python converters? -- - Joel Lucsy (jjlucsy at concentric.net) From dworkin at ccs.neu.edu Wed Feb 16 23:27:47 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 16 Feb 2000 23:27:47 -0500 Subject: Problem with Emacs mode, at start only In-Reply-To: François Pinard's message of "16 Feb 2000 23:15:43 -0500" References: Message-ID: Fran?ois Pinard writes: > When, in Emacs, I do not have `*Python*' window initialised, or more > precisely, when there is no process running in that window, then `C-c C-c' > in the window where is the Python source invariably fails the first time, Whenever I start using python-mode, I do a `C-c !' to start the Python interpreter. Subsequent invocations of `C-c C-c' or `C-c |' will use that interpreter window. -Justin From no_spam_tdfunk at nettally.com_spam_sux Thu Feb 24 16:59:33 2000 From: no_spam_tdfunk at nettally.com_spam_sux (Tom Funk) Date: Thu, 24 Feb 2000 16:59:33 -0500 Subject: IIS + ASP + <#@Language=Python#>== performance_hit Message-ID: A similar thread started here a few weeks ago, then seemed to die. There was no definitive answer, though. I've noticed a *definite* performance hit from my ISP when their IIS server delivers pages containing <#@Language=Python#>. There seems to be a consistent 7-8 second delay while serving such pages. Pages that don't use this directive, or that specify VBScript or JavaScript, don't suffer the same fate. I tested with an ASP page that looks like this: <#@Language=Python#>

This is a test This page should load nearly instantaneously. However, using Python with @Language causes a consistent 7-8 second delay. There's no *discernable* delay for VBScript, JavaScript or when the Language directive is skipped completely. A previous suggestion was to change the default language for the site from VBScript (or JavaScript) to Python. Did anyone try this? Does this actually work? If not, does anyone have any other suggestions? Could some portion of the Python run-time be recompiling on each call (i.e., IUSR_COMPUTERNAME doesn't have write access to a directory on PYTHONPATH and the .pyc files are never created)? My ISP tends to be slow to respond to requests, so before I ask them to monkey around with my site's IIS settings, I'd like to know if what I'm asking for will actually work. Thanks in advance. -=< tom >=- Thomas D. Funk | "Software is the lever (no_spam_tdfunk at asd-web.com_no_spam) |Archimedes was searching for." Software Engineering Consultant | Advanced Systems Design, Tallahassee FL. | From emile at fenx.com Thu Feb 17 19:41:01 2000 From: emile at fenx.com (Emile van Sebille) Date: Thu, 17 Feb 2000 16:41:01 -0800 Subject: Multiple ExtensionClass References: Message-ID: <007001bf79a8$d53748e0$01ffffc0@worldnet.att.net> This works for me: >>> class A: def func1(self): print "in func1" >>> class B(A): def func2(self): print "in func2" >>> a = B() >>> a.func1() in func1 >>> Emile van Sebille emile at fenx.com ------------------- ----- Original Message ----- From: Joel Lucsy Newsgroups: comp.lang.python To: Sent: Thursday, February 17, 2000 11:03 AM Subject: Multiple ExtensionClass > Ok, I've whipped up two ExtensionClass classes (stirred, not shaken) and am > trying to figure out how one can be a "subclass" of the other. I'll > illustrate what I want (in python for brevity): > > class A: > def func1(): > pass > class B(A): > def func2(): > pass > > Now I'd like to be able to do: > a=B() > a.func1() > > So far I haven't figured out how to do this without duplicating the methods. > Should I be messing with the method tables, or somehow manipulating the > dictionaries, or something completely different? I've tried making python > wrappers, but it complains about multiple bases or something. Basically it > wont let me derive from two different ExtensionClasses's. Either that or I'm > missing something. > Any clues would be great. Thanks. > > -- > - Joel Lucsy (jjlucsy at concentric.net) > > > > > > -- > http://www.python.org/mailman/listinfo/python-list > > From pnpayne at swissonline.ch Thu Feb 17 10:01:24 2000 From: pnpayne at swissonline.ch (Philip Payne) Date: Thu, 17 Feb 2000 16:01:24 +0100 Subject: Modifying list/dictionary elements whilst iterating??? Message-ID: <88h2f4$afb$1@hs1b01h02-1.dplanet.ch> Hi, I know it's not allowed to add/remove elements from lists/dictionaries whilst iterating over them, but can someone give me a definitive answer as to whether modifying list/dictionary values as follows whilst iterating is safe: d = {'the' : 1, 'cat' : 2, 'sat' : -4} print 'before', d for key,value in d.items() : value = value + 1 d[key] = value print 'after', d l = [1,2,3,4,5] print 'before', l for i in xrange(len(l)) : l[i] = l[i] + 1 print 'after', l Regards, Philip Payne From alex at somewhere.round.here Tue Feb 8 18:20:43 2000 From: alex at somewhere.round.here (Alex) Date: 08 Feb 2000 18:20:43 -0500 Subject: Error on string formatting References: <87q741$8jh$1@nnrp1.deja.com> Message-ID: Perhaps it's a matter of operator precedence? Do you want to do >>> '%0.*f' % (3, 4.1) '4.100' >>> instead? Alex. > >>> buf = '%0.*f' % 3, 4.1 > Traceback (innermost last): > File "", line 1, in ? > TypeError: not enough arguments for format string > > The comparable statement in C works fine, and the Essential Reference > says I can do this kind of asterisk thing. > > Judy Hawkins From roger.burnham at gte.net Wed Feb 9 13:47:49 2000 From: roger.burnham at gte.net (Roger Burnham) Date: Wed, 09 Feb 2000 18:47:49 GMT Subject: free disk space References: <87r5e4$tkj$1@nnrp1.deja.com> Message-ID: <38a1b282.13530333@news.gte.net> On Wed, 09 Feb 2000 07:36:36 GMT, prudek at my-deja.com wrote: >How can I discover free disk space on a drive in Python (in Win98)? I >can exec 'dir' and parse output, but is there a nicer way? > >-- >Milos Prudek Milos, Just had to do this yesterday: def getFreeSpace(dir): """ Given a directory, return the free space (mega bytes) on that drive. """ import os, win32file drive = os.path.splitdrive(dir)[0] + os.sep fs = win32file.GetDiskFreeSpace(drive) fs = int((fs[0]*fs[1]*fs[2])/(1024.0*1024.0)) return fs Roger Burnham Cambridge Research & Instrumentation rburnham at cri-inc.com http://www.cri-inc.com/ http://starship.python.net/crew/roger/ PGP Key: http://www.nai.com/default_pgp.asp PGP Fingerprint: 5372 729A 9557 5F36 177F 084A 6C64 BE27 0BC4 CF2D From pinard at iro.umontreal.ca Mon Feb 14 11:45:55 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 14 Feb 2000 11:45:55 -0500 Subject: breaking the ; habit In-Reply-To: "Dirk-Ulrich Heise"'s message of "Mon, 14 Feb 2000 11:07:27 +0100" References: <000101bf75de$0d12f940$962d153f@tim> <950526527.787246@news.adtranzsig.de> Message-ID: "Dirk-Ulrich Heise" ?crit: > Fran?ois Pinard schrieb in Nachricht ... > >"Tim Peters" writes: > > > >> > The one problem I am having is that I can't break myself of the > >> > semicolon habit. > No, Tim Peters didn't write that. > Take a little bit more care when quoting people. You misinterpreted what quote of Tim I quoted. It was an empty quote. :-) Granted that we do not often quote an empty quote. But surely, Tim wrote empty as part of some bigger text, and I quoted that empty, and deleted the rest. What was missing in my reply was the attribution for the middle level `>', and I very agree with you that it makes it look like attributed to Tim. OK, ok! Instead of arguing (and I hope you read the implied smileys), I agree that I should be more careful at attributing all quote levels, and maybe not attribute empty quotes :-). I'll try to be more careful. No offence was intended, and I presume that Tim did not take any... -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From aahz at netcom.com Wed Feb 9 15:52:09 2000 From: aahz at netcom.com (Aahz Maruch) Date: 9 Feb 2000 20:52:09 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> Message-ID: <87sk1p$o5h$1@nntp6.atl.mindspring.net> In article <38A19E79.5E88D2FC at prescod.net>, Paul Prescod wrote: > >This annoys me not only because it holds the ideas in Smalltalk back >from popularity but because it strikes me as arrogant. Squeak's >designers think that they are so much smarter than the rest of us that >they must "correct" every decision we have ever made including what side >the scrollbar should live on. Just give me a programming language >please! You'll see more of that arrogance on www.smalltalk.org . I'll say. I went there to further my self-education only to find that the official FAQ is only available in PDF and Postscript. They had the nerve to suggest that people wishing to post on the newsgroups read the FAQ first. -- --- 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 Nostalgia just ain't what it used to be From moshez at math.huji.ac.il Sun Feb 13 01:13:35 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sun, 13 Feb 2000 08:13:35 +0200 (IST) Subject: breaking the ; habit In-Reply-To: <38a610d2@news.isc.rit.edu> Message-ID: On Sat, 12 Feb 2000, R.O'Neil wrote: > Wow that's nice. Is that something that's standard for the language or is > it just a nice feature in the most common interpreters? It's a well documented part of the language. for-sufficiently-twisted-definitions-of-documented-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From mwh21 at cam.ac.uk Sat Feb 5 08:05:45 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 05 Feb 2000 13:05:45 +0000 Subject: When to use None References: <8779su$sak$1@nnrp1.deja.com> <38975766.21B319AD@dcs.kcl.ac.uk> Message-ID: neelk at brick.cswv.com (Neel Krishnaswami) writes: > Michael Hudson wrote: > > Bernhard Herzog writes: > > > > > > >>> class C: > > > .. def __cmp__(self, other): > > > .. return cmp(None, other) > > > .. > > > >>> c = C() > > > >>> c == None > > > 1 > > > >>> c is None > > > 0 > > > > Yikes! That's impressively devious. > > > > I-always-*knew*-there-was-a-reason-I-always-use-"is"-ly y'rs > > Is it devious? > > I always assumed that a __cmp__ method that returned true for a > comparsion with None would have a good reason for doing so, and as a > result I've always tested that with 'obj == None'. I guess the point is that I can't think of a good reason for an object to masquerade as None. I generally use None to mean exactly that; a void, nothing (like nulls in SQL, I guess). I suppose there are times when None is an allowable value, and then something that's a bit like None is more reasonable (to me, anyway). Cheers, Michael From mikael at isy.liu.se Wed Feb 9 02:58:28 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Wed, 09 Feb 2000 08:58:28 +0100 (MET) Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <38A0497E.FC5CA78C@prescod.net> Message-ID: On 08-Feb-00 Paul Prescod wrote: > They are nowhere to be counted. I have not met such a person in all of > my years of proletizing Python at e.g. XML conferences. I have met > dozens of people who said that they thought whitespace was going to be a > problem but then found it wasn't. I guess we can count Tye, or whatever his name really is. /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: 09-Feb-00 Time: 08:57:29 This message was sent by XF-Mail. ----------------------------------------------------------------------- From darrell at dorb.com Tue Feb 29 22:06:22 2000 From: darrell at dorb.com (Darrell) Date: Tue, 29 Feb 2000 19:06:22 -0800 Subject: Scanning folders References: <2B1262E83448D211AE4B00A0C9D61B03BA715F@MSGEURO1> Message-ID: <004c01bf832b$220664e0$6401a8c0@dorb> If your talking about NT then give this a try. http://www.dorb.com/darrell/win32WorkSvr/makeThumbsDG.py def main(): """ Use events to avoid polling. A sleep is used to give most files a chance to finish being writen. Sort of a hack and might not be needed. The notification event LAST_WRITE seems to trigger at the start and end of writing. So a single file will trigger this twice. """ hnd=win32file.FindFirstChangeNotification\ (os.path.abspath('.')+os.sep+'incoming'\ ,0, winnt.FILE_NOTIFY_CHANGE_LAST_WRITE ) while 1: int = win32event.WaitForSingleObject( hnd, -1) # Try to give the file time to finish writing time.sleep(2) print 'run' try: passed, failed, skipped = makeThumbNails() except: if '-d' in sys.argv: traceback.print_exc() raise ThumbNailException win32file.FindNextChangeNotification(hnd) ----- Original Message ----- From: "Pieter Claerhout" To: Sent: Monday, February 28, 2000 3:35 AM Subject: Scanning folders > Hello, > > what is the best and fastest way to scan a whole list of folders > to see if something is added or not. Please note that this should > also work for more than 1000 folders (and it shouldn't slow down > the system too much). > > Kind regards, > > > Pieter > > -- > http://www.python.org/mailman/listinfo/python-list > From jbauer at rubic.com Sat Feb 5 21:19:25 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Sat, 05 Feb 2000 20:19:25 -0600 Subject: How do I wrap text? References: <389CD409.C6A884BE@mailexcite.com> Message-ID: <389CDA2D.C0184F07@rubic.com> Doug Sauder wrote: > It seems like there should be some very easy way > to wrap long lines of text. Doug, Use the standard formatter.py module. Below is an example of how to use it. Jeff Bauer Rubicon Research --- #!/usr/bin/env python # SimpleWriter.py import os, sys, string from formatter import NullWriter class SimpleWriter(NullWriter): """ SimpleWriter is functionally equivalent to DumbWriter. It stores the data as a list of self.text lines rather than writing the text to a file. """ def __init__(self, maxcol=72): self.text = [] self.__current_line = [] self.maxcol = maxcol NullWriter.__init__(self) self.reset() def reset(self): self.col = 0 self.atbreak = 0 def send_paragraph(self, blankline): self.text.append(string.join(self.__current_line, '')) self.__current_line = [] for i in range(blankline): self.text.append('') self.col = 0 self.atbreak = 0 def send_line_break(self): self.text.append(string.join(self.__current_line, '')) self.__current_line = [] self.col = 0 self.atbreak = 0 def send_hor_rule(self, *args, **kw): self.text.append(string.join(self.__current_line, '')) self.__current_line = [] self.text.append('-'*self.maxcol) self.col = 0 self.atbreak = 0 def send_literal_data(self, data): self.__current_line.append(data) i = string.rfind(data, '\n') if i >= 0: self.col = 0 data = data[i+1:] data = string.expandtabs(data) self.col = self.col + len(data) self.atbreak = 0 def send_flowing_data(self, data): if not data: return atbreak = self.atbreak or data[0] in string.whitespace col = self.col maxcol = self.maxcol for word in string.split(data): if atbreak: if col + len(word) >= maxcol: self.text.append(string.join(self.__current_line, '')) self.__current_line = [] col = 0 else: self.__current_line.append(' ') col = col + 1 self.__current_line.append(word) col = col + len(word) atbreak = 1 self.col = col self.atbreak = data[-1] in string.whitespace if __name__ == '__main__': spam = \ """ Python is an interpreted, interactive, object-oriented programming \ language. It is often compared to Tcl, Perl, Scheme or Java. \ Python combines remarkable power with very clear syntax. It has \ modules, classes, exceptions, very high level dynamic data types, and \ dynamic typing. There are interfaces to many system calls and libraries, \ as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). \ New built-in modules are easily written in in C or C++. Python is also \ usable as an extension language for applications that need a \ programmable interface. """ from formatter import AbstractFormatter w = SimpleWriter(40) f = AbstractFormatter(w) for s in string.split(spam, "\n"): f.add_flowing_data(s) f.end_paragraph(1) f.end_paragraph(0) print string.join(w.text, '\n') From quinn at krone.ugcs.caltech.edu Tue Feb 1 23:39:22 2000 From: quinn at krone.ugcs.caltech.edu (Quinn Dunkan) Date: 2 Feb 2000 04:39:22 GMT Subject: using marshal module References: <3897af70$1@news.actrix.gen.nz> Message-ID: On Wed, 2 Feb 2000 17:17:08 +1300, Christine Davis wrote: >I have this feeling I may be missing out something important, but silly. That feeling is about to e vindicated :) >Cheers, >Christine > > >Here is the piece of broken code: > ># open the file >fp = open(filename) >datastuff = marshal.load(fp) > ># change the field >datastuff['field'] = 'new string of stuff' > ># "write it back to the file" ># also tried "marshal.dump(datastuff, fp)" which didn't work either >marshal.dump(datastuff['field'], fp) > ># close the file >fp.close() When you opened the file, you opened it in read mode (think fp = fopen(filename, "r"); in C). Now, when you tried to dump your data to it, marshal should have thrown an IOError, but instead it silently didn't write anything. This seems unpython-like and a problem with marshal, to me. What you want to do is either: fp = open(filename, 'r+b') # b in case it gets run on windows and then fp.seek(0) before dump. Or: fp.close() fp.open(filename, 'wb') before dump. Also, marshal.dump(datastuff['field'], fp) will store the string 'new string of stuff' to filename, which is probably not what you want. From fcahoon at my-deja.com Tue Feb 8 11:48:02 2000 From: fcahoon at my-deja.com (fcahoon at my-deja.com) Date: Tue, 08 Feb 2000 16:48:02 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> Message-ID: <87phc0$ojo$1@nnrp1.deja.com> In article <1e5nkk6.1a5z8bp1lixbdvN%bparsia at email.unc.edu>, bparsia at email.unc.edu (Bijan Parsia) wrote: > wrote: > > [snip] > > I am not a Python user for this very reason, and I know many developers > > who are interested in the buzz about Python but when they hear "Python > > uses whitespace as syntax" refuse to touch it. > > Er... almost every language uses whitespace as syntax, usually for token > delimitation (is that the word?). Ah, yes, good point. But you know what I mean. Cool. > I think, notwithstanding your experience with C (though why that should > be applicable to Python...), *you* have a riddle to answer: There is a > *lot* of Python code out there. The standard distribution contains loads > of modules from many different sources. You *yourself* indicate that > Python is becoming common place.... The popularity of a language cannot be taken as prima facie evidence of its technical superiority. Consider Perl. The number of modules available for Perl on CPAN is positively mind-boggling. Does this mean that Perl must necessarily be a superior language? > [ ... ] > > > If python code were to become mis-formatted (and given my experience, I > > have to believe that sooner or later this _will_ happen) > > Er...not your experience of *Python* code, right? So, your experience > with Python code: 0. Everyone elses: >0 (some up to, what, 8 years? 10 > years?). I think it more correct that your *lack* of (relevant) > experience leads you to your belief. It's true that my experience writing python can, for practical purposes, be called 0 here. However, I think it is a mistake to consider the posters responding to me to be representative of people with experience with python. Already, among the majority of posts from people who find that indentation-as-syntax is not a problem, several people _with_ python experience who believe indentation-as-syntax _is_ a problem have spoken. They indicate that they still use python, because its advantages outweigh this significant (to them) disadvantage. This leads one to wonder: how large is the population who have used python seriously, but found indentation-as-syntax to be too large of a problem, and now use different languages? Surely, they are not here to be counted. f Sent via Deja.com http://www.deja.com/ Before you buy. From mwh21 at cam.ac.uk Sun Feb 27 10:30:05 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 27 Feb 2000 15:30:05 +0000 Subject: Checking Suspicious Functions References: Message-ID: Moshe Zadka writes: > After Tim and mine discusion, I thought writing code for a change would be > nice. Here's a rough draft of my "checking whether a function can return a > value from one place and return None from another" code: > > --- suspect.py > import dis # for HAVE_ARGUMENT, and opname > > # currently we're to dumb to understand this is valid: > # if x: > # return 1 > # else: > # return 0 > I had written some code for splitting Python bytecode into basic blocks a couple weeks back, so I've used that to whip up an effort that *is* clever enough to cope with the above. I think it takes exceptions to confuse it - how do they fit into the basic block view of the world? Large chunks of the standard library seem to pass muster, which is good... Comments appreciated (even if it's "Don't attach the file like *that*, doofus"). Cheers, M. -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp ===File ~/src/python/returnnanny/returnnanny.py============= from bytecodehacks.code_editor import Function from bytecodehacks.ops import * import block_analysis def _is_argumented_return(op): if op.__class__ is not LOAD_CONST: return 1 if op.arg is not 0: return 1 return 0 def is_sensible(func): code = Function(func).func_code blocks = block_analysis.block_analyse(code) returns = [] cmpval = 0 for block in blocks.values(): if block.body[-1].__class__ is RETURN_VALUE: if len(block.body) < 2: cmpval = 1 else: returns.append( block.body[-2] ) if cmpval == 0: cmpval = _is_argumented_return(returns[0]) for op in returns[1:]: if _is_argumented_return(op) <> cmpval: return 0 return 1 import types def check_module(module): for i in module.__dict__.values(): if type(i) is types.FunctionType: print i.func_name, is_sensible(i) ============================================================ ===File ~/src/python/returnnanny/block_analysis.py========== from bytecodehacks.ops import * class BasicBlock: def __init__(self,body,label): self.body = body self.label = label self.exits = [] self.entries = [] def __repr__(self): return """\ %3d body: %s exits %-20s entries %s"""%(self.label,`self.body`,`self.exits`,`self.entries`) def isJump(op): """ isJump(op: Opcode) -> Boolean Return true if execution of op can result in transfer of control.""" return op.is_jump() or op.__class__ is RETURN_VALUE def basic_blockize(code): """ basic_blockize(code: CodeObject) -> {Int:BasicBlock} Return the list of basic blocks of the code object. NB: |code| is DESTRUCTIVELY MODIFIED to remove line nos. and SETUP_LOOPs. """ cs = code.co_code targets = [] for label in cs.labels: targets.append( label.op ) blocks = [] curblock = [] for op in cs: if op in targets: blocks.append(curblock) curblock = [] curblock.append(op) if isJump(op): blocks.append(curblock) curblock = [] blocks = filter(None,blocks) block_objects = {} for i in range(len(blocks)): block_objects[i] = BasicBlock(blocks[i],i) for block in block_objects.values(): last_op = block.body[-1] if last_op.is_jump(): target = last_op.label.op for t in block_objects.values(): if t.body[0] == target: block.exits.append( t.label ) t.entries.append( block.label ) if (last_op.__class__ is not RETURN_VALUE and last_op.__class__ is not JUMP_ABSOLUTE and last_op.__class__ is not JUMP_FORWARD): block.exits.append( block.label + 1 ) block_objects[ block.label + 1].entries.append( block.label ) return block_objects def eliminate_unreachable_blocks(blocks): """ eliminate_unreachable_blocks(blocks: {Int:BasicBlock}) -> None remove unreachable blocks from the sequence """ reachable = [0] for i in reachable: for l in blocks[i].exits: if l not in reachable: reachable.append( l ) newblocks = [] for block in blocks.values(): if block.label in reachable: newexits = [] for l in block.exits: if l in reachable: newexits.append( l ) block.exits = newexits newentries = [] for l in block.entries: if l in reachable: newentries.append( l ) block.entries = newentries newblocks.append( block ) else: del blocks[block.label] def print_blocks(blocks): v = blocks.keys() v.sort() for i in v: print blocks[i] def block_analyse(code): """ block_analyse(code:CodeObject) -> {Int:BasicBlock} 1) Split code into basic blocks 2) Remove unreachable basic blocks. """ blocks = basic_blockize(code) eliminate_unreachable_blocks(blocks) return blocks ============================================================ From alex at somewhere.round.here Tue Feb 8 19:18:23 2000 From: alex at somewhere.round.here (Alex) Date: 08 Feb 2000 19:18:23 -0500 Subject: Why doesn't cStringIO.StringIO () have write methods? Message-ID: Hi. I noticed that when cStringIO.StringIO is instantiated with a string, it doesn't have write methods, but when it's instantiated with no arguments, it does. I was curious as to why this is. Alex. >>> from cStringIO import StringIO >>> s = 'TCACCACCACCACCACCATCATCACCACCACCACCATCATCATC' >>> t = StringIO (s) >>> from pprint import pprint >>> pprint (dir (t)) ['close', 'flush', 'getvalue', 'isatty', 'read', 'readline', 'reset', 'seek', 'tell', 'truncate'] >>> t = StringIO () >>> pprint (dir (t)) ['close', 'flush', 'getvalue', 'isatty', 'read', 'readline', 'reset', 'seek', 'tell', 'truncate', 'write', 'writelines'] >>> From katz at glue.umd.edu Sun Feb 13 18:09:25 2000 From: katz at glue.umd.edu (Roey Katz) Date: Sun, 13 Feb 2000 23:09:25 GMT Subject: need help for an RPG development kit Message-ID: <38a7382c.205147@news.erols.com> Hello, (Is there a more appropriate place to post this?) I'm developing a suite of classes for an RPG under Python. I'm up to the fifteenth or so major revision -- I do need lots of help with the class design, coding, etc. I'm aiming for something akin to the Verge RPG creation system (http://'www.verge-rpg.com'). So far this is all extremely experimental, and I need somewhere to put this to make it accessible to others (I have no web space of my own). If you're interested, please e-mail me back. Danke, Roey Katz Computer Engineering sophomore University of Maryland katz at wam.umd.edu From ian_maurer at my-deja.com Fri Feb 4 16:34:13 2000 From: ian_maurer at my-deja.com (Ian) Date: Fri, 04 Feb 2000 21:34:13 GMT Subject: "Python Programming on Win 32" available References: <3898b54c.1949600@news.btx.dtag.de> <7k3m4.738$pob.188239360@newsa.telia.net> <3899b239.3554416@news.btx.dtag.de> Message-ID: <87fgkl$qmt$1@nnrp1.deja.com> www.bookpool.com is even cheaper (for most nerd lit). In article <3899b239.3554416 at news.btx.dtag.de>, spamfranke at bigfoot.de (Stefan Franke) wrote: > On Wed, 02 Feb 2000 23:45:07 GMT, "Fredrik Lundh" > wrote: > > >if you prefer not to order from a patent abuser, and save a > >whopping $0.01, fatbrain ships it within 24 hours: > > Hmm, I took the link on the PSA bookstore page. If fatbrain > offers similar comissions for external links it could be a reason > to switch. > > Regards, > Stefan > > -- Ian Sent via Deja.com http://www.deja.com/ Before you buy. From Andreas.Cardeneo at mach.uni-karlsruhe.de Tue Feb 22 08:01:58 2000 From: Andreas.Cardeneo at mach.uni-karlsruhe.de (Andreas Cardeneo) Date: Tue, 22 Feb 2000 14:01:58 +0100 Subject: Win32 - InvokeTypes numeric type codes Message-ID: <38B288C6.409432A8@mach.uni-karlsruhe.de> Hi, trying to use an ActiveX-control with Mark Hammond's Win32 COM extensions I experience problems trying to call some methods of the COM-control. I generated early binding info with MakePy, but this is the traceback I get: -%<------- Traceback (innermost last): File "E:\temp\fxtest.py", line 4, in ? fx.AddObservation(0,42) File "E:\Program Files\Python\win32com\gen_py\9B90F101-2EB7-11D1-BADB-006097A71E96x0x1x0.py", line 263, in AddObservation def AddObservation(self, seriesNumber=defaultNamedNotOptArg, Value=defaultNamedNotOptArg, Description=None, originType=None): File "E:\Program Files\Python\win32com\gen_py\9B90F101-2EB7-11D1-BADB-006097A71E96x0x1x0.py", line 227, in _ApplyTypes_pydisp=self._oleobj_.InvokeTypes(dispid, LCID, wFlags, retType, argTypes, args) TypeError: object can't be converted to int -%<------- The problem might be, that the last two arguments for the AddObservation-Method are optional but don't have the default-values set by MakePy (None for both, while the empty string "" and "1" (one) would be right according to the typelib.) I believe that I will have to change the type-code-tuple MakePy generates here: -%<------- def AddObservation(self, seriesNumber=defaultNamedNotOptArg, Value=defaultNamedNotOptArg, Description=None, originType=None): """Adds observations to matrix.""" return self._ApplyTypes_(0x4, 1, (24, 32), ((3, 0), (5, 0), (8, 48), (2, 48)), 'AddObservation', None, seriesNumber, Value, Description, originType) -%<------- But what do I have to enter here? Where can I find the numeric values and the meaning of those tuples? Thanks a lot, Andreas Cardeneo andreas.cardeneo at mach.uni-karlsruhe.de From skip at mojam.com Tue Feb 15 10:00:31 2000 From: skip at mojam.com (Skip Montanaro) Date: Tue, 15 Feb 2000 09:00:31 -0600 (CST) Subject: PyApache, couldn't geta hold of author, willing to donate sometime In-Reply-To: References: <38a5fa58.11062714@news.main-echo.net> Message-ID: <14505.27151.431298.95555@beluga.mojam.com> Oleg> PCGI is very similar to FastCGI. It is PersistentCGI - a protocol Oleg> to communicate between httpd and a special CGI, that starts and Oleg> lives in memory, exactly like in FastCGI. Oleg> http://starship.python.net/crew/jbauer/persistcgi/index.html Unless something has changed recently, PCGI does actually fork a program for each referenced URL. This program marshals the input arguments and shoots them across a socket to the long-running process. The program is an itty bitty C program, so presumably its startup overhead is going to be a whole lot smaller than that of the Python interpreter. From gerrit.holl at pobox.com Thu Feb 3 15:44:09 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 3 Feb 2000 21:44:09 +0100 Subject: [Edu-sig] Getting it going In-Reply-To: <20000203155039.71475.qmail@hotmail.com>; from b2blink@hotmail.com on Thu, Feb 03, 2000 at 04:50:39PM +0100 References: <20000203155039.71475.qmail@hotmail.com> Message-ID: <20000203214409.A1753@stopcontact.palga.uucp> Ulf Engstr?m wrote on 949593039: > Seems like some people have gathered up now, but still the posting is close > to nothing. That's probably because everyone thinks "I'm not talking yet because I don't want to repeat things". I'm going to say everyone joining after now to read the archives. > With what intentions do you all get into this and what kind of discussions > should we have? Everythink concerning education: * changes to Python like case insensitivity * how to explain things in books, lik a variable is a box with a sticker on it, a dictionairy is a... a class is a... * CP4E * ...any suggestions? > The post from Matthias Felleisen for example wasn't really > focusing on Python but on CP4E using any existing languages or creating one. I wouldn't like it if Python became case sensitive. But that's me. If there'll be a big quarrel, we can split up the interpreter. But I hope that won't be necesarry, because it would only give more difficulties. > Are we focusing on general CP4E or Python? CP4E, with Python as language. > Do we wanna build new tools, No, we want to extent idle. One patch I want to write is that "if a:" autoindents, "if a: # if it's true" does not. I can't find where to change it, and that's one thing Guido pointed out: tools would make that easier. Especially (how do you spell that word?) for kids. But I don't think new tools would be needed for that: idle could be extended and promoted. > make smaller implications of the core language of Python, Why would we? > or discuss how to teach, Definetely. > which books are good for teaching > and what books we can write? (I'm interested either way:) I'd love to see such a book. And because it's for kids, translating is important. I want to help with the book. I think I'm the youngest one here who learned programming as a kid, *almost* with python. I tried to learn Python first, but didn't understand it. After a Logo like language, learning what variables and lists are, I did understand it. I think that bridge should be destroyed. Not only for English speaking kids, but also for Dutch, German, French, Japanese and Chinese speaking kids. But translating is definately something for the future. > I've been programming for a couple of years and stumbled onto Python 6 > months ago, and now I do all my programming in Python. I'm trying to help > some of my friends to start programming with Python instead of C/C++ which > they are beeing taught in school now, but don't get at all. Their progress > in Python is a lot better however. I think Python is a perfect language to > start out with and I'd sure like to teach it to people of any age. (I'm not > a teacher, but I might get to teach others in my job) I already got *five* people to learn Python instead of C, C++, Perl, Pascal and Java :) -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From sabren at manifestation.com Wed Feb 9 11:54:26 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 9 Feb 2000 11:54:26 -0500 Subject: Python XML processing of RSS files References: <87f843$k4u$1@nnrp1.deja.com> <389f1386.1431568@news.iol.ie> <87nhtd$anc$1@nnrp1.deja.com> Message-ID: <87s65a$r2f$1@nntp3.atl.mindspring.net> anthonydelorenzo at my-deja.com wrote in message <87nhtd$anc$1 at nnrp1.deja.com>... > >As I mentioned in my follow-up, I decided just to write it using xmllib. It >seemed more efficient to use a parser, rather than using pyxie + a parser. >I'm only doing some simple processing of character data. > >That, and my ISP doesn't have the XML tools installed, so xmllib is about all >I can count on. why can't you just upload the XML tools? many of them work without a C compiler, and if the one you need doesn't, I'm sure you can find a way to get it compiled on whatever OS your ISP uses... ? -michal From thomas at bibsyst.no Thu Feb 3 07:30:22 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 03 Feb 2000 13:30:22 +0100 Subject: zip module References: <87an99$mrd$1@news.smartworld.net> <38996210.6D269DD0@camelot-it.com> Message-ID: <389974DE.44EB53A3@bibsyst.no> Michael Tiomkin wrote: > > Luiz Martins wrote: > > > Is there a module somewhere to open/create zip files? I want to create > > archives that contain multiple directory hierarchies, path information, > > modifications dates etc. My archives will be used by folks using winzip > > under windows 9x > > You can use two modules. One is 'zip', and it creates '.zip' files, and the other is 'gtar/tar > -z' that can create '.tar.gz' files. On Unix, use 'man zip' and 'man (g)tar' to see the options. > Both '.zip' and '.tar.gz' files can be opened by Winzip. On Unix, you can use 'unzip' and > 'gtar/tar' to open the files. > > Michael You`re talking about stand-alone programs here right? I think he was asking about a python-module. Thomas From drs at hpl.hp.com Wed Feb 23 14:34:26 2000 From: drs at hpl.hp.com (David Smith) Date: Wed, 23 Feb 2000 11:34:26 -0800 Subject: PYTHONPATH on PC References: Message-ID: <38B43641.7A8F5CF0@hpl.hp.com> Mikael Olofsson wrote: > I thought you were supposed to do > > import sys > sys.path.append('whateverpath') > import yourmodule > > At least that's what I do on Unix. Yes, you're right. That works. And now, I don't know why I couldn't remember or find this: I have even been over that territory before. I guess it's just part of learning a bunch of new stuff at once. Thanks a lot. David Smith From c.davis at actrix.co.nz Tue Feb 1 23:17:08 2000 From: c.davis at actrix.co.nz (Christine Davis) Date: Wed, 2 Feb 2000 17:17:08 +1300 Subject: using marshal module Message-ID: <3897af70$1@news.actrix.gen.nz> Hi All, I am new to python (but old(er) to C++); and trying to get a script to work. What it is meant to do, is reads in a file, config.db and then changes the values of one of the fields, and write the revised contents back. if I call dump(, ) no change seems to take place. (The field isn't changed, nor does the field get concatenated at the end. I have this feeling I may be missing out something important, but silly. Cheers, Christine Here is the piece of broken code: # open the file fp = open(filename) datastuff = marshal.load(fp) # change the field datastuff['field'] = 'new string of stuff' # "write it back to the file" # also tried "marshal.dump(datastuff, fp)" which didn't work either marshal.dump(datastuff['field'], fp) # close the file fp.close() From effbot at telia.com Tue Feb 22 15:28:44 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 20:28:44 GMT Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <1260876476-6142700@hypernet.com> <38B2E76D.7DEF295C@roguewave.com> Message-ID: <0kCs4.649$mYj.190257664@newsa.telia.net> bjorn wrote: > -- python 1.6 will have *two* different string types. > > which presumably would be convertible, so implementing myContainer.join for regular > strings should be convertable to Unicode strings (no?) I'm not sure what you mean here. do you mean that ["1", "2"].join() should return a Unicode string object, just in case? let's see: "btw, now that you've installed 1.6, string.join always return unicode strings, so your old code might no longer work" yeah? > -- python 1.6 will have lots of sequence types (at > least one more than 1.5.2!) > > Which is (a) a good argument for implementing join in the sequence types, since > there are much more than *two* sequence types and (b) suggests that we really > need a common base class for the sequence types to share common functionality > (Python is an OO language after all...) listen very carefully: PYTHON IS BASED ON INTERFACES, NOT ON STRICT INHERITANCE. *ANY* OBJECT THAT IMPLEMENTS TWO WELL-DEFINED METHODS CAN BE USED AS A SEQUENCE OBJECT. maybe we should change this? let's see: "btw, now that you've installed 1.6, your old sequence classes no longer work. you have to make sure they all inherit from AbstractSequence. if you're using C types, you're SOL" really? > -- while join can be *defined* as a series of concatenations, > *implementing* things that way doesn't work in real life. do > you really think that *all* sequence objects should know > how to join all possible string types in an efficient way? or > is that better left to the string implementation? > > Conversely, to you really think that both string classes should know how to > efficiently join all possible sequence types? yes, because all they have to do is to use the abstract sequence interface: http://www.python.org/doc/current/api/abstract.html > Consider: > > class MyTree: > def join(sep=''): > lhs = rhs = '' > if self.lhs: > lhs = self.join(self.lhs) > if self.rhs: > rhs = self.join(self.rhs) > # presumably the + operator would do any neccessary coercion? > return lhs + sep + self.data + sep + rhs > > sometimes implementing join as a series of concatenations does work only if you don't give a damn about performance... "btw, now that you've installed 1.6, string.join is slow as hell. you might as well use reduce" forget it. won't happen. From sholden at bellatlantic.net Fri Feb 25 10:14:52 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Fri, 25 Feb 2000 15:14:52 GMT Subject: functional programming References: <000401bf7e9b$348ab740$e42d153f@tim> Message-ID: <38B69C6D.3E7C17D2@bellatlantic.net> Denys Duchier wrote: > [remarks on the practicality of tail call optimization which seemed to overlook the need to retain context for exception handling] > > ... we should all eat > shit, since 50 trillion flies can't all be wrong. > I've always felt the popularity of MS Windows had some relation to this epthet. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From wlfraed at ix.netcom.com Wed Feb 9 01:06:22 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Tue, 08 Feb 2000 22:06:22 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <1262139803-5814898@hypernet.com> <87ocad$to2$1@nnrp1.deja.com> Message-ID: On Tue, 08 Feb 2000 06:15:43 GMT, fcahoon at my-deja.com declaimed the following in comp.lang.python: > > Suppose that I'm one of those set-tabs-to-logical-indentation sorts of > guys, so I set my tab width to 4, then look at this code in my editor. > Gee, it sure _looks_ like statement4 belongs to "if condition1"! And, > if I convert tabs to spaces when I save, statement4 _will_ belong to "if > condtion1". I've just unwittingly changed the logic of the code! > > You may, of course, argue that this is unlikely, but it is still > plausible enough to make me _very_ nervous. > And this only occurs when you take, as is, source from mixed generators (pardon the odd language)... If you are talking a company level shop, both ISO 9000+ and SEI tend to like lots of documentation of procedures (personally, I feel ISO 9000 goes too far into documented procedures and not enough into product). If your shop is attempting to be ISO 9000 and/or SEI certified, surely you would have some procedures defining coding standards. In those standards, you could specify how Python indentation is to be coded (spaces only, tabs only, mixed @ x-spaces per tab, etc.) By following these procedures you mitigate the "problem". The only thing left is if you modify sources from outside the shop -- for these, you should probably examine them for their "configuration" and run them through a formatter to generate your shop's standard format. -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From mikael at isy.liu.se Mon Feb 14 02:45:51 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 08:45:51 +0100 (MET) Subject: Real Problems with Python In-Reply-To: <38A70577.61955C9C@tismer.com> Message-ID: On 13-Feb-00 Christian Tismer wrote: > Well, Fredrik is right. I will be the "nobody", and I will > have to build a killer app. I'm planning to show it on > OSCOM2000, thinking of Eric Raimond's words: "Don't give up!" Christian! Don't give up, I mean that, but I just have to give you a few Swedish words of wisdom. The first one is from the northern part of Sweden, known for it's calm people who speak with very few words. Here goes: It's never too late to give up! The second one was given to me by one of my colleagues. I don't know its true original. To get ready is to give up. Now, that can be interpreted in at least two ways. One interpretion is "you should never get ready, because then you have given up". An other is "If you are ever to get ready, then you have to give up". Which one you prefer is probably a matter of taste. /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-Feb-00 Time: 08:30:39 This message was sent by XF-Mail. ----------------------------------------------------------------------- From pbleyer at dgf.uchile.cl Wed Feb 9 23:01:49 2000 From: pbleyer at dgf.uchile.cl (Pablo Bleyer Kocik) Date: Wed, 09 Feb 2000 23:01:49 -0500 Subject: Question about encryption in Python References: <38A1B469.35E03159@telebot.com> Message-ID: <38A2382D.7CA612E3@dgf.uchile.cl> flounder wrote: > Ok, what I want to do is use the crypt() function in a Perl program to > encrypt a string then I want to beable to use a pyhton program to > compare a entered password with the one encrypted in Perl and > visa-versa. So what I am saying is does Python have a module that is > the same to Perl's so I can do this. I know I could use MD5 or > something in Perl then it would work but then I will have to install a > new module in perl and I don't have access to do that on the server I > am using. I am mainly just messing around and would just like to know > if there is something I could use. > > Thanks alot > > -- > Flounder > > Just another C/C++, Perl, Pyhton, Tcl, Bash ... hacker > Perl's crypt() and Python's crypt.crypt() call the system's crypt in Unix. E.g. Perl: print crypt("Hola","mu"); => muYo7cPyJD2p2 Python: import crypt; crypt.crypt("Hola","mu") => 'muYo7cPyJD2p2' -- Pablo Bleyer Kocik |"And all this science I don't understand pbleyer | It's just my job five days a week @dgf.uchile.cl | A rocket man, a rocket man..." - Elton John from sys import*;from string import*;a=argv;[s,p,q]=filter(lambda x:x[:1]!= '-',a);d='-d'in a;e,n=atol(p,16),atol(q,16);l=(len(q)+1)/2;o,inb=l-d,l-1+d while s:s=stdin.read(inb);s and map(stdout.write,map(lambda i,b=pow(reduce( lambda x,y:(x<<8L)+y,map(ord,s)),e,n):chr(b>>8*i&255),range(o-1,-1,-1))) From sabren at manifestation.com Tue Feb 22 19:08:17 2000 From: sabren at manifestation.com (Michal Wallace (sabren)) Date: Tue, 22 Feb 2000 19:08:17 -0500 (EST) Subject: functional programming In-Reply-To: Message-ID: On Tue, 22 Feb 2000, Moshe Zadka wrote: > Functional programming has a very clear definition: no side > effects. Iterating explicitly means "with side effects." I'm not saying > one style is better then the other, but you *can't* program functionally > in Python. I had to get over it, and learn to write fibonaci with a while > loop, when I first got to Python. Hey Moshe, I guess my original question had to do with what functional programming looks like in the wild, and what it might look like in python. Aahz posted a recursive version of a fib() routine. Is this not what you'd want? What would fib() look like in one of the functional languages you're used to? Part of the reason I'm asking about this is that I have an idea for a preprocessor that would allow different kinds of syntactic sugar for things that are possible, but not necessarily pretty, in python. If python could do what you really want, how would it look? Cheers, - Michal ------------------------------------------------------------------------- http://www.manifestation.com/ http://www.linkwatcher.com/metalog/ ------------------------------------------------------------------------- From billtut at microsoft.com Sun Feb 13 17:03:27 2000 From: billtut at microsoft.com (Bill Tutt) Date: Sun, 13 Feb 2000 14:03:27 -0800 Subject: Please do not Bcc: ListServers Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCD03@RED-MSG-50> Actually the more likely cause of this problem is a tiny buglet in Mailman's Usenet gateway code. This bug has been fixed for the next rev of Mailman: http://www.python.org/mailman-bugs/resolved?id=172 Bill > -----Original Message----- > From: Dennis E. Hamilton [mailto:infonuovo at email.com] > Sent: Saturday, February 12, 2000 5:27 PM > To: Alex > Cc: Python-list > Subject: Please do not Bcc: ListServers > > > I notice that I seem to receive some python-related messages > via the list > server yet I must be receiving a Bcc rather than a To: or Cc. > > The only problem with that is that my mailbox rules don't > kick in. I can > repair that, but it would work more easily if I knew the > addressing that had > the message get to me, especially when I don't know any of the > explicitly-named people! > > Thanks, > > -- orcmid > > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Alex > Sent: Saturday, February 12, 2000 15:15 > To: jean at stat.ubc.ca > Subject: Re: delays in python > > > > The time.sleep function accepts float's, doesn't it? E.g. > > time.sleep (0.5) > > should put your program out for half a second. > > Alex. > -- > http://www.python.org/mailman/listinfo/python-list > > > -- > http://www.python.org/mailman/listinfo/python-list > From jamarijr at hotmail.com Sun Feb 13 01:03:51 2000 From: jamarijr at hotmail.com (Arinte) Date: Sun, 13 Feb 2000 06:03:51 GMT Subject: Writing escape sequences Message-ID: <885hg6$7it$1@nnrp1.deja.com> I am trying to have python write "\x00" to my c++ program. But, it seems Python skips right over this function. Any ideas why? this is suppose goes directly to my c++ program CPlus.write("write") class CPlus: def write(self, str): toapp.write(self, str) TIA. Sent via Deja.com http://www.deja.com/ Before you buy. From kc5tja at garnet.armored.net Wed Feb 9 23:56:20 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 10 Feb 2000 04:56:20 GMT Subject: GCOM, was Re: Communicating with MICO References: <3898d8cb@nntp.server.uni-frankfurt.de> <87bl08$nui$1@pineapple.uk.research.att.com> <87mb8g$tlr$1@pineapple.uk.research.att.com> Message-ID: In article <87mb8g$tlr$1 at pineapple.uk.research.att.com>, Duncan Grisby wrote: >I'm happy to talk about omniORBpy and all things CORBA. From your >description of GCOM, it sounds just like a CORBA ORB. In what way is >it a COM implementation? Do you intend to interoperate with COM / >DCOM, or just follow some of the design? The run-time environment is all COM, right down to every object supporting IUnknown methods. It's v-table based, just like COM, and exhibits a registry (the interface to which is highly unstable; software which uses the registry API in 0.1/0.2 will likely break in 0.3). The registry currently serves the purpose of the implementation repository in CORBA; however, it's accessed via the GCOM library, and not by CORBA objects. However, I was going to use GIOP to communicate between local servers. The Service Control Manager would be responsible for maintaining the local servers, and would sit on a well-known socket (/com/scm most likely). I was going to implement an OMG IDL compiler which produced proxies and stubs which conformed to the GIOP protocol. Note that the SCM itself is not an ORB, in that it doesn't sit on a socket and dispatch GIOP messages (except those directed to the SCM itself). All the SCM does is it provides a rendezvous service between client and server. Once the client has the server's socket, the SCM leaves the picture (except to maintain the server's lifetime). Requests via IIOP would be accepted through a real ORB component; this ORB component would act as a router for the SCM. Any servers the SCM cannot locate is "broadcast" to all registered ORBs (causing the ORBs to be loaded as needed), causing service request queries on remote machines. (This is all done as part of CoGetClassFactory() ). Activation of objects from remote hasn't been addressed yet, but will likely involve manually running an ORB as a daemon. However, in an epiphany (<-- is that the right word?), I realized just what you wrote above: it would be a glorified CORBA ORB. So I figured, if I relaxed the requirement that all interfaces be inherited from IUnknown, they become plain-vanilla C++-type objects. All that's needed is a stub that can map a method _name_ to a method's function pointer. So the "sluggishness" that CORBA has amassed a reputation for is not the fault of the spec, but of the individual ORB and B/POA APIs. However, the APIs do add an unnecessary layer of complication to the development of any standards-compliant ORB. And 2.3 just makes things worse. Right now, I don't have time to develop for GCOM, though if someone needs a quick bug-fix or whatnot, I can do that. My research into, and the development of, GCOM has given me the tools necessary to take advantage of existing CORBA ORBs. But make no mistake about it -- the existing C/C++ mappings are absolutely and unnecessarily complicated. A future direction for GCOM is to merge the two technologies -- first, to relax the requirement that _all_ GCOM objects inherit from IUnknown (as is the case with COM), thus allowing greater interoperability with CORBA objects outside the GCOM realm, and second, to eschew the CORBA API specifications, and use my own mappings and APIs, which concentrate on ease of software development, ease of debugging, and a more orthogonal API (e.g., stripping away nearly all the redundency that's currently present in the CORBA mappings). I will likely retain the use of object->vtbl->method() notation for C software. There's no reason to switch, and it's fully binary compatible with C++, which is an added benefit. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From effbot at telia.com Mon Feb 14 12:13:55 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 17:13:55 GMT Subject: how to talk to __main__? References: <889cg2$83e$1@nntp9.atl.mindspring.net> Message-ID: Michal Wallace wrote: > I understand why __name__ evaluates to "__main__", > but how come you can't say __main__.x = 1 to reassign > some global variable x? of course you can -- provided you import it first. From rjroy at takingcontrol.com Tue Feb 29 21:01:57 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Wed, 01 Mar 2000 02:01:57 GMT Subject: Microsoft Access Database References: <89f32j$3c9$1@isn.dac.neu.edu> Message-ID: <38bc798d.359486859@news1.on.sympatico.ca> See http://starship.python.net/crew/bwilk/access.html On Mon, 28 Feb 2000 19:16:08 -0500, "Eric Kappotis" wrote: >Is there anyway i can read from and write to a Microsoft Access Database >with Python. If so where can i find some tutorials on how to do that? > >Eric Kappotis > > From michael.stroeder at inka.de Thu Feb 24 07:45:23 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 24 Feb 2000 13:45:23 +0100 Subject: Simple example of threading References: <38B51486.F0774310@bibsyst.no> <89382q$djb$1@nntp6.atl.mindspring.net> Message-ID: <38B527E3.DF8C61AD@inka.de> Aahz Maruch wrote: > > In article <38B51486.F0774310 at bibsyst.no>, > Thomas Weholt wrote: > > > >I want to use threading in a server-based search/index application. Any > >hints? > > Unfortunately, using threading in a server gets a bit more complex and > may not buy you very much. Hmm, about doing it like BoboHTTPServer.py found http://www.digicool.com/releases/bobo/ ? Ciao, Michael. From tjreedy at udel.edu Thu Feb 24 18:47:19 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 18:47:19 -0500 Subject: nested functions References: <38B5B649.B0DFB374@quasar.ipa.nw.ru> Message-ID: <894ffe$ovd$1@news.udel.edu> "Alexander V. Voinov" wrote in message news:38B5B649.B0DFB374 at quasar.ipa.nw.ru... [emailed and posted] > Please remind me, if there are any performance penalties in nesting > functions like this: [snip] The definition of a nested function is re-executed everytime the outer function is called. Nesting in Python is intended for when you actually want a different function computed on different calls to the outer function, depending on the params passed. For bundling/hiding, one should use classes. Terry J. Reedy From dworkin at ccs.neu.edu Thu Feb 10 16:35:55 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 10 Feb 2000 16:35:55 -0500 Subject: mail processing In-Reply-To: "Xose L. Gonzalez"'s message of "Wed, 09 Feb 2000 21:41:28 +0100" References: <38A1D0F8.27C72A7C@retemail.es> Message-ID: "Xose L. Gonzalez" writes: > I receive n-plicated e-mail messages (same content but different > destinations), so I would like to have a simple python demon that tests > the POP3 and deletes the repeatead messages. > > Is it feasible with a simple program? See the documentation for the pop3 and rfc822 modules. -Justin From anthony at dstc.edu.au Wed Feb 16 09:38:58 2000 From: anthony at dstc.edu.au (Anthony J Wilkinson) Date: Thu, 17 Feb 2000 00:38:58 +1000 (EST) Subject: is this a Python bug? In-Reply-To: <88eb8h$pcb$1@news1.tc.umn.edu> Message-ID: On 16 Feb 2000, Brian Langenberger wrote: > piet at cs.uu.nl wrote: > :>>>>> Moshe Zadka (MZ) writes: [...] > : MZ> Raw strings cannot end with a backslash. > > : They can. But only with an even number of them. > > I'm assuming there's some clever and important reason for this. > But for the life of me I can't figure out what it is. > Could someone enlighten me as to the reason? :) Every second backslash is 'escaped' by the one before it (as with normal strings) therefore if your string ends in an odd number of backslashes then the odd backslash will escape the end quote which creates a syntax error: >>> r'\\' '\\\\' >>> r'\' File "", line 1 r'\' ^ SyntaxError: invalid token >>> r'abc\\' 'abc\\\\' >>> r'abc\' File "", line 1 r'abc\' ^ SyntaxError: invalid token Regards, Anthony ___________________________________________________________________________ Anthony J Wilkinson anthony at dstc.com Software Engineer http://dstc.com DSTC Pty Ltd Ph: +61 7 3365 4310 From thomas at xs4all.net Thu Feb 3 09:26:34 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Thu, 3 Feb 2000 15:26:34 +0100 Subject: Status of processes running inside an object In-Reply-To: <3899887F.CA592911@bibsyst.no>; from thomas@bibsyst.no on Thu, Feb 03, 2000 at 02:54:07PM +0100 References: <3899887F.CA592911@bibsyst.no> Message-ID: <20000203152634.D6378@xs4all.nl> On Thu, Feb 03, 2000 at 02:54:07PM +0100, Thomas Weholt wrote: > What`s the best method, if do-able, to get info about a process running > inside a object? > Here`s an example : > I got a cd-object that scans thru a cd and does alot of stuff with the > things it discovers. How could I track the progress of the scanning > procedure without making alot of print "Scanning files ...", print > "Indexing documents ...." etc. in the object-code? > Is there a way of tracking the state of processes inside an object > without printing stuff inside the object itself or stopping in the > process so that code outside the object can check the contents of the > object?? > This is probably impossible, crazy or , but I`d like some > ideas. I'm not really clear on what kind of information you want from the object. For a sensible answer, more information would be nice ;) I can tell you, though, that if you want simple status information, like 'scanning files', 'indexing...', 'writing result', etc. the easiest way is by doing the 'print's you so dislike. Or rather, avoid print and use seperate logfile instead, or store status info in module/class/instance level attributes. Alternatively, if you want very finegrained control over your application, but you dont want to add logfile-notifications on every other line, try using sys.settrace() or sys.setprofile(). They're documented in the debugger and profiler chapters, respectively, of the library reference. settrace() registers a function that gets called whenever your process makes a function call. setprofile() registers a function that gets called whenever your process makes a function call and on every return. (And the functions get passed relative info about the function calls in question, of course.) Or perhaps your demands go as far as interaction with the running process; you should probably look at 'asyncore', and set up your program as a tcp/ip or unix-socket server, allowing clients to connect, retrieve information about the status of the process and execute commands to influence it. Or if you're very fond of threading, or interested in threading, you can do even more ;) You can use threading and a simple telnetserver, not asyncore, to do roughly the same as you would using asyncore above, or, if you really only need one 'client' to connect, you can use threading to make one process be both the worker and the user interface. Any of these solutions could be The Best Way, or none of them could be the right way -- it all depends on exactly what you want to do ;) There's-more-than-one-way-to-do-an-undefined-thing-ly y'rs -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From mhammond at skippinet.com.au Wed Feb 9 04:12:06 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 09 Feb 2000 09:12:06 GMT Subject: free disk space References: <87r5e4$tkj$1@nnrp1.deja.com> Message-ID: You can use win32api.GetDiskFreeSpace() Mark. wrote in message news:87r5e4$tkj$1 at nnrp1.deja.com... > How can I discover free disk space on a drive in Python (in Win98)? I > can exec 'dir' and parse output, but is there a nicer way? > > -- > Milos Prudek > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From tim_one at email.msn.com Mon Feb 14 22:22:29 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 14 Feb 2000 22:22:29 -0500 Subject: Real Problems with Python In-Reply-To: <38A85021.AB82DB06@inrialpes.fr> Message-ID: <001001bf7763$e37ab280$66a2143f@tim> [Tim] > ... > (RC has excellent locality of reference, especially when trash > is being created and recycled at high dynamic rates). [Vladimir Marangozov] > That last one is a good one. So far, nobody has shown any evidence > that LOR is good or bad when different objects are involved (except, > I remember, some special cases like iterating over ints that happen > to be allocated close to each other). Better yet, nobody _can_ show > such evidence as far as one stays on top of a virtual memory manager. Vlad, you're trying to get "deep" on what is really a "shallow" point: a "high dynamic rate" is most likely to occur when a program is doing flat-out computation, so type homogeneity is likely. Like ints or floats or whatever in Python. And those are *not* "on top of a virtual memory manager" in Python, but involve cycling & recycling via Python's type-specific internal "free lists" (some of which you added, so you should remember this ). So long as the free lists act like LIFOs, you get to reuse the same little chunks of memory over and over and over ... again. It's LOR in *both* time and space, and of course that's "good": it's the difference between page faults and, umm, not page faults . > make-that-simply-"RC-is-faster-than-the-alternatives"-- > -and-I'll-take-it-ly y'rs I believe there's sufficient evidence that state-of-the-art "real gc" can be made faster than rc. Python isn't other languages, though, and so long as everything in Python is always "boxed", other languages' gc experiences aren't especially relevant. not-one-byte-in-python-is-stack-allocated-ly y'rs - tim From JGRAVES3 at austin.rr.com Wed Feb 23 08:43:00 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Wed, 23 Feb 2000 13:43:00 GMT Subject: Porting Python to non-pc platforms (AS/400) References: Message-ID: Peter Sommerfeld wrote in message ... >>Its about $1200 for my machine. >Big bucks :-( And my machine is the smallest software 'tier' you can have. The C compiler for the highest tier is over 28,000. Granted a machine of that tier would cost probably over 1.5 million >Python itself shouldn't be the problem. But there is is some platform >specific stuff which might be harder. Consider porting JPython, the Java >implementation of Python. Write once, run everywhere (???). I have DL JPython but I haven't installed it anywhere yet. This probably would be a good fit because IBM has already written a bunch of Java classes to interface with the native objects (data queues, job queues, spool files, etc) If I understand it correctly these will be directly usable in JPython. This is probably the quickest course because I have Java on my 400 now and I semi-understand it. (I can recognize Java programs 3 out of 3 times (-: ) Thanks for your input. Jay Graves From hellan at acm.org Wed Feb 23 04:09:51 2000 From: hellan at acm.org (Jon K Hellan) Date: 23 Feb 2000 10:09:51 +0100 Subject: Descenders and fonts in Idle References: <87putpfssr.fsf@parus.parus.no> <87900cxqkn.fsf@parus.parus.no> Message-ID: <874sb0xp28.fsf_-_@parus.parus.no> Jon K Hellan writes: > "Robert Hicks" writes: > > > you want to edit EditorWindow.py: > > > > if sys.platform[:3] == 'win': > > text['font'] = ("verdana", 10) > > # text['font'] = ("courier new", 10) > > > > Thanks. That doues it. Actually: > > if sys.platform[:3] == 'win': > text['font'] = ("lucida console", 10) > else: > text['font'] = ("lucida typewriter", 12) Well, to get the font I use in Emacs, that should be "lucidatypewriter", 10 A small bug: The lines are too densely spaced too make room for the descenders of the characters. Jon From Gaetan_Corneau at baan.com Fri Feb 18 13:26:30 2000 From: Gaetan_Corneau at baan.com (Gaetan Corneau) Date: Fri, 18 Feb 2000 13:26:30 -0500 Subject: Newbie Question about COM Objects Message-ID: <816010E2456BD111A48700805FBBE2EE01C60531@ex-quebec-u1.baan.com> Hi, > oSiebel.LoadObjects(SiebelConf, ErrCode) Remember, in Python, there are no "out" parameters. Try this: ErrCode = oSiebel.LoadObjects(SiebelConf) Bye, ______________________________________________________ Gaetan Corneau Software Developer Software Engineering Process Group BaaN Supply Chain Solutions http://www.baan.com E-mail: Gaetan_Corneau at baan.com Tel: (418) 266-8252 ______________________________________________________ "Profanity is the one language all programmers know best" From embed at geocities.com Fri Feb 18 10:54:49 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 18 Feb 2000 10:54:49 -0500 Subject: Which GUI? References: Message-ID: > every single example in that tutorial can be written in > Tkinter, using about 50% as much Python code. and > things like layout management and event handling looks > embarrasingly primitive compared to Tkinter. Enlighten me on what makes Tkinter so 'advanced'. It seems that Guido cribbed up this Tkinter thing and stuck fiercely by it, without so much as a peep on what makes Tk worth keeping when Tcl wasn't worth using too. Everything I hate about Tcl is wrong with Tk too. Show me a Tcl/Tk demo that makes a nice "Outlook 98" style user interface frame set. [If you think Outlook 98 is ugly, then show me something in Tk that isn't ugly, in your humble opinion.] -- Points in favour [for me] of wxWindows/wxPython: 1. wxWindows looks nicer to me. Subjective, but I can't get over how ugly Tkinter is. Nitpicking? Perhaps, but how do I remove those "-----" lines at the top of all the pull-down menus? Yuck. 2. If Python is so much better than Tcl, why does Python require the Tcl interpreter be running to get Tkinter going? Fact is Tk is tightly bound to Tcl, and therefore Python is tightly bound to Tcl. I like Python. I hate Tcl. I have to install Tcl/Tk and Python just to run IDLE. Yuck yuck yuck! Not that wxWindows is perfect. I would actually prefer to use PyQT if it ran on both Windows and Linux, but since PyQT is Linux/BSD only, it seems the only real option for me if I want a decent Windows app now and want portability to Linux later is wxWindows. I think it's really BAD that there's no wxWindows for Mac but then some Mac developer will just have to set up to the plate and work on it. If the three major platforms I care about [subjective eh?] are well covered [Win,Mac,Linux] then I would be much happier. While we're in the midst of one religious war, one more thing: "Nuts to AIX!" < I used RS6000s in school, and hated 'em. :-) > Warren From unclejah at mail.ru Fri Feb 4 05:12:36 2000 From: unclejah at mail.ru (Igor E. Poteryaev) Date: Fri, 4 Feb 2000 11:12:36 +0100 Subject: delphi2python References: <3899e7a3$1_3@127.0.0.1> Message-ID: <389AA5C3.381D4C9D@mail.ru> Hello, adam There are several differencies between Object Pascal and Python languages which should be addressed when writing such convertor. Most obvious for me are: - possibility to have several constructors and destructors in Pascal - for and do ... while cycles in Pascal Maybe you need "Python for Delphi" ? It can be found at http://www.multimania.com/marat/delphi/python.htm It is not about conversion, but by using this tool you can easily integrate Delphi and Python. Hope this helps. Igor. dzsieji wrote: > > anyone knows about a tool that converts delphi to python? > if you did, you would save a few weeks of my life...... > > adam. > > -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==---------- > http://www.newsfeeds.com The Largest Usenet Servers in the World! > ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- -- Ranum's Law: "You can't solve social problems with software". From bjorn at roguewave.com Fri Feb 11 12:48:41 2000 From: bjorn at roguewave.com (bjorn) Date: Fri, 11 Feb 2000 10:48:41 -0700 Subject: Fully Bracketed Syntax References: <38A337F7.9059B943@americasm01.nt.com> <20000211073300.A711@stopcontact.palga.uucp> Message-ID: <38A44B79.5A441154@roguewave.com> Gerrit Holl wrote: > Eaglestone, Robert NGC:B918:EXCH" wrote on 950195591: > > Hello all, > ... > > if ( foo > bar ) > > do_something(); > > do_something_else(); > > done(); > > endif > > Let me add two characters, and it's totally valid. > > if ( foo > bar ): > do_something(); > do_something_else(); > done(); > #endif Ahh.... Python does have bracketed syntax, only using ':' and '#' instead of '{' and '}' if foo: bar() # -b From insanik at hotmail.com Fri Feb 18 00:50:52 2000 From: insanik at hotmail.com (Nick Henderson) Date: Thu, 17 Feb 2000 21:50:52 -0800 Subject: Killer Apps??? Message-ID: Hello, I am new to the world of programming and python. I know Zope is super cool and is python's "killer app." I was wondering if there were any other such killer apps? Thanks, Nick Henderson From quinn at zloty.ugcs.caltech.edu Wed Feb 9 14:05:35 2000 From: quinn at zloty.ugcs.caltech.edu (Quinn Dunkan) Date: 9 Feb 2000 19:05:35 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <1e5nkk6.1a5z8bp1lixbdvN%bparsia@email.unc.edu> <87phc0$ojo$1@nnrp1.deja.com> <1e5p92l.xgr4fe1s2x5ptN%bparsia@email.unc.edu> <87qs04$ni1$1@nnrp1.deja.com> Message-ID: On Wed, 09 Feb 2000 04:55:33 GMT, fcahoon at my-deja.com wrote: >I'm more concerned about the possiblilty of one bad line being left in a >infrequently-executed routine, leading to spurious errors which are >difficult to track down. So let's suppose you managed to delete a space somehow in an infrequently exectuted routine. python immediately throws a syntax error at you with a line number. Not very difficult to track down. Now suppose you somehow manage to delete exactly enough spaces to make something syntactically valid. Now your function has a bug. But fortunately, you always test your functions, so it's found just like that time you accidentally managed to delete some important parentheses. And the time you got the logic backwards on an if then. Ok, so you've stated that, while you like python, this possibility worries you. Your worry is duly noted. Now go write some python. Many others have said this, but I will any way: In my experience with python, I've *never* had this problem. I've written lots of syntax errors, I've written plenty of subtle and not-so-subtle invalid code. I've stumbled around in many people's python code, some of whom had truly strange ideas of how many spaces there are in a tab. I've never had a whitespace problem. I've never even seen a file with mixed tabs and spaces, let alone one with tabs != 8. And if I did, I would simply use the vim :retab command. So stop worrying already. Or at least worry quietly, to yourself :) From neelk at brick.cswv.com Wed Feb 23 22:05:38 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 24 Feb 2000 03:05:38 GMT Subject: functional programming References: <000801bf7daa$80dde000$51a0143f@tim> <88vt3u$e0h$1@nntp6.atl.mindspring.net> Message-ID: Aahz Maruch wrote: > In article <000801bf7daa$80dde000$51a0143f at tim>, > Tim Peters wrote: > > > >2.5. One great thing that shakes bugs out of Python code is that it > > raises an exception whenever it has a reasonable doubt about the > > code you told it execute, and a key part of making that *usable* > > is Python's never-lies complete stack trace. 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, and I want to crawl up that chain to > > examine the state of the locals in B and C at the time they made > > their calls. Optimize intermediate frames away, and tracebacks > > would become much harder to decipher. > > Say! Couldn't you use continuations to store those intermediate frames > in case you ever throw an exception? Only if you stop doing tail-recursion elimination in the first place, since the whole point of tail-recursion elimination is to never allocate those frames in the first place. :) Consider the following tail-recursive Python program: def fact_tr(n, acc): if n == 0: return acc else: return fact_tailrec(n - 1, n * acc) fact_tr(4,1) # Compute 4 factorial With standard Python semantics, the call chain would evaluate like this (using a pseudo-Python where multiple 'return' statements represent the frames on the call stack): fact_tr(4,1) => return fact_tr(3, 4) => return (return fact_tr(2, 12)) => return (return (return fact_tr(1, 24))) => return (return (return (return fact_tr(0, 24)))) => return (return (return (return 24))) => return (return (return 24)) => return (return 24) => return 24 => 24 All tail-recursion elimination means is that you observe that all those nested 'return's are unneccesary, since all you are doing is immediately passing the result back to the caller without doing any additional computation on the call result. Thus you don't have to allocate intermediate stack frames, since they will be unused. So you can evaluate it like so: fact_tr(4,1) => fact_tr(3, 4) => fact_tr(2, 12) => fact_tr(1, 24) => fact_tr(0, 24) => 24 Now, suppose that for some reason our program threw an exception part way through a call to fact_tr(4,1), say when it tried to evaluate fact_tr(1,24). Since none of the stack frames were ever allocated, in the debugger it would look like the program had immediately called fact_tr(1,24) rather than fact_tr(4,1). In this particular example, it's not too tricky, but when you have complex mutually recursive procedures (say in a recursive descent parser), it can be a real pain to debug. In fact, it's for precisely this reason that some Common Lisp implementations have an option to turn off tail-recursion elimination when they go into debug mode. Likewise, I expect that if Python ever supports tail-recursion elimination, it will only be turned on with the -O switch. Since "first-class continuation" is really just Scheme talk for saying that the call tree is a first-class language object like numbers and functions, the issues are the same for call/cc as they are for the debugger. Neel From JGRAVES3 at austin.rr.com Wed Feb 23 10:18:28 2000 From: JGRAVES3 at austin.rr.com (Jay Graves) Date: Wed, 23 Feb 2000 15:18:28 GMT Subject: Porting Python to non-pc platforms (AS/400) References: <38B32E8B.7E084AA8@ttm.com> <14515.61844.349673.829968@beluga.mojam.com> Message-ID: <8TSs4.1102$w81.143240@typhoon.austin.rr.com> Skip Montanaro wrote in message <14515.61844.349673.829968 at beluga.mojam.com>... > > Scott> Considering that the 400 has pretty much a complete POSIX > Scott> environment, more than likely a port will mainly consist of > Scott> figuring out the include directories and compiler flags. > >So if someone has the pocketbook for the compiler, perhaps the community can >pitch in with help on the port... I have traded some email with Scott and we've talked about the options. Here are some highlights of those conversations. JPython is probably the best bet for something 'now'. I've got JPython I just haven't had the time to put it on my AS400. This would give alot of functionality because IBM has written Java classes for alot of native OS/400 objects. CPython is probably easily doable by someone with experience and a C compiler. (or experience and someone's $$$ for the compiler). OS/400's command structure is much different than POSIX so I would be concerned about how well the interactive portion would mesh. It might just be a question of writing the modules to support the idiosyncrasies of the 400. IBM might be convinced to do the port. They ported Perl to the AS/400. Lastly the AS400 community. I'm going to post to the AS400 newsgroups and try to drum up some interest. Hopefully someone who has the C compiler can be convinced to try a port. Thanks for all of your input. I'm sure I'll be back with questions for the group. Jay Graves From pinard at iro.umontreal.ca Sun Feb 13 10:18:13 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 13 Feb 2000 10:18:13 -0500 Subject: breaking the ; habit In-Reply-To: "Tim Peters"'s message of "Sat, 12 Feb 2000 23:51:54 -0500" References: <000101bf75de$0d12f940$962d153f@tim> Message-ID: "Tim Peters" writes: > > The one problem I am having is that I can't break myself of the > > semicolon habit. Just for fun, my own difficulty was to break the habit of the space before the opening parenthesis which is part of a function call, since it has been burned from GNU standards into my neurons, years ago. But I'm overcoming this tiny difficulty. Now, when I write C code, I sometimes forget either semicolons or those spaces. Which is a good thing, after all, as it proves that I'm slowly taking distances with C :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tim_one at email.msn.com Sat Feb 12 16:27:51 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 12 Feb 2000 16:27:51 -0500 Subject: Python aka. Smalltalk Lite? In-Reply-To: Message-ID: <001001bf75a0$0441c6e0$7c2d153f@tim> [/F] > seriously, what are the major shortcomings in Python > from a Smalltalk professional's perspective? > > let's see: > > -- no blocks (lambda doesn't really cut it) > -- type/class dichotomy (CPython implementation) > -- no garbage collection (CPython implementation) > > what else? I don't subscribe to the "random bag of features" school of language comparison. Programming Python will never *feel like* programming in Smalltalk, so True Smalltalkers will never feel truly at home in Python. One fellow I work with is a True Smalltalker. When he thinks about "1+2", he really *believes* that "1" is "a message" sent to "the object +". Or maybe it's that "+" is "a message" sent to "the object 1" -- it's darned hard to keep deluded views of the world straight when you don't suffer them yourself . So Python will never feel "just right" to him, although he's done a great job of becoming happy with it anyway (via the "I have to write Java, and *wow* does having JPython around make my life easier" route). Smalltalk is also one of the very few languages that grew up with a mondo sophisticated IDE as part of its daily life. You're fixing that, though. from-a-smalltalk-professional's-perspective-python's-worst- flaw-is-that-it's-not-smalltalk-ly y'rs - tim From michelorengo at netscape.com Wed Feb 2 15:27:02 2000 From: michelorengo at netscape.com (Michel Orengo) Date: Wed, 02 Feb 2000 15:27:02 -0500 Subject: MAPI and NT Service References: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC97@RED-MSG-50> Message-ID: <38989316.AC031650@netscape.com> Bill Tutt wrote: > He's asking what user your service is logged in as. > If it isn't logged on as the NT user associated with the MAPI mailbox and > combined with Marks remark about MAPI deferring security checks until > actually needed this could be whats causing your problem.... > > Bill The service is running under my logon. My logon is also the one associated with the MAPI maibox. Moreover, my logon is in the administrator group (of the domain + of the machine) From pinard at iro.umontreal.ca Tue Feb 22 14:50:06 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 14:50:06 -0500 Subject: Python mode - `C-c |' feature suggestion In-Reply-To: Alex's message of "22 Feb 2000 12:14:42 -0500" References: <14514.45176.931019.526625@anthem.cnri.reston.va.us> Message-ID: Alex writes: > By the way, what are all the control-L's for? Form feeds. Within Emacs, you may use `C-x [' and `C-x ]' to quickly jump from one to the other. They are often convenient to regroup a bunch of functions together, per general functionality, in bigger Emacs LISP sources (or whatever the language). > ! (code-for-execution (buffer-substring-no-properties start end))) Just a little note. The `-no-properties' functions are less portable. You can usually go with the more standard ones, at the expense of a few computing cycles, later. Nothing to worry about in most cases. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bromage at goaway.cc.monash.edu.au Thu Feb 3 20:33:30 2000 From: bromage at goaway.cc.monash.edu.au (Andrew Bromage) Date: 4 Feb 2000 12:33:30 +1100 Subject: Haskell or Python! References: <38994478.72056B85@cui.unige.ch> <3mdm4.17496$3b6.72189@ozemail.com.au> Message-ID: <87da9a$4mo@goaway.cc.monash.edu.au> G'day all. Jason Stokes wrote: >> Yes. Haskell is fully object oriented. neelk at brick.cswv.com (Neel Krishnaswami) writes: >Is this true? Haskell has overloading, but its type system doesn't >support subtyping, Its type class system allows subclassing, which gives you the same thing. Well, it gives you interface inheritance which, when you think about it, is all that CORBA and the like gives you too. >and overloaded methods are chosen at compile time >rather than based on the runtime type. Existential types would fix that problem by generating the virtual method table at compile time for each existentially quantified type. The benefit is that you would only pay for the vtable it where you actually use it. As I mentioned in a previous post, existentially quantified types are a proposed addition to the language. >Instead, you use pattern >matching to replace what subtyping and runtime method selection give >you in OO languages. That's one possible implementation, but it doesn't give you separate compilation, since there is no way to extend an algebraic type with more alternatives without recompiling. Cheers, Andrew Bromage From tseaver at starbase.neosoft.com Thu Feb 17 13:15:01 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 17 Feb 2000 12:15:01 -0600 Subject: Superclasses References: Message-ID: <5C19FFBE23B2C024.E6B11D7FC081E7A6.DCE89F90EF779CA4@lp.airnews.net> In article , Joshua C. Marshall wrote: >Given a class object, is there a way to get at its superclass object? I'm >looking for something like: > > class A: pass > > class B(A): pass > > B.__superclass__ == A # where this is true > >Please CC jayantha at ccs.neu.edu > Nowhere, but try: >>> B.__bases__ (,) Note that Python classes can have multiple superclasses. >>> class C: pass ... >>> class D( B, C ): pass ... >>> D.__bases__ (, ) Genealogical'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From effbot at telia.com Wed Feb 9 11:43:36 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 16:43:36 GMT Subject: telnet functions References: <87s1eu$n57$2@desig-bs01-s04.adtranzsig.de> Message-ID: Oliver Benduhn wrote: > does anybody here has any good experiences with telnet over an Python > script. > > There is an Telnet Module but it doesnt offer the functions i need. really? (read on) > i has to log me on with user-name and password and i have to start a > Perl-Script on a Sun-Unix mashine. hey, telnetlib can do that. piece of cake. the following example (from the eff-bot guide) works for me, at least. shouldn't be that hard to change the "ls" call to run your perl script instead... # File: telnetlib-example-1.py import telnetlib import sys HOST = "spam.egg" USER = "mulder" PASSWORD = "trustno1" telnet = telnetlib.Telnet(HOST) telnet.read_until("login: ") telnet.write(USER + "\n") telnet.read_until("Password: ") telnet.write(PASSWORD + "\n") telnet.write("ls librarybook\n") telnet.write("exit\n") print telnet.read_all() From seanb at home.com Thu Feb 10 10:36:48 2000 From: seanb at home.com (Sean Blakey) Date: Thu, 10 Feb 2000 10:36:48 -0500 (EST) Subject: Corel + Borland = The End of MS Win In-Reply-To: Message-ID: Please, don't complain about the newbies. If we start complaining about newbies here, it is only a matter of time before we start flaming to a crisp anybody who whines about whitespace. At that point we become the python equivalent of comp.lang.perl.misc. I have been reading this group for about a year now, and from day one I was consistently impressed by the polite, patient, friendly tone that prevails here. I have heard it commented that one of the best things about python is the python community. Even when Tom Christianson came through here a while ago, the vast majority of the people here were able to disagree clearly, intelligently, and politely. As in all things python, we should pay attention to the example set by Guido. You have to dig back in the python-list archives many years to find him responding much to this kind of thread that pops up again and again. Many other "respected elders" of this group have taken the same attitude. When something this boring pops up again (as it inevitably will), you will not see flames from any of these people. Just a conspicuous silence. > > Maybe, just maybe, we could stop these recurrent (dull) threads some time > soon? Some sort of guidelines for posting language reviews and > advertisements? A branch of the Python mafia going around to people's > houses and "convincing" them? A few choice trips in the time machine to > effect world domination and eliminate competition? Something must be done! > comp.lang.python is going to get a reputation for being a Usenet group soon > if we don't act to stem the tide! :) > > Enjoy all, > Mike > > -----Original Message----- > From: Shalabh Chaturvedi [mailto:shalabh at pspl.co.in] > Sent: Thursday, February 10, 2000 12:39 PM > To: Python Mailing List > Subject: Re: Corel + Borland = The End of MS Win > > > Paul Boddie wrote: > ... > "Neither Python nor Perl were designed as object-oriented languages." > > Is this true about Python ? > > ... > > -- > http://www.python.org/mailman/listinfo/python-list > Sean Blakey (206)297-7123 quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0]) From a.eyre at optichrome.com Wed Feb 16 09:02:22 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Wed, 16 Feb 2000 14:02:22 -0000 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <20000215151318.A1508@stopcontact.palga.uucp> Message-ID: <002901bf7886$726bee50$3acbd9c2@peridot.optichrome.com> > >>> def Tim(i): > ... return i ** i ** i > ... > >>> import string > >>> string.join(['a',3,None,[Tim(1),Tim(2)]], ';') > Traceback (innermost last): > File "", line 1, in ? > TypeError: first argument must be sequence of strings Well. That much was obvious. The issue was with which type should have the join() method. I suspect, however, that JPython has this already implemented, so this is unlikely to change in CPython. Doesn't really bother me too much. It just feels like a kludge. The rest of the methods seem reasonable. I'm assuming that the translate() method accepts a 2^16 buffer for Unicode strings. And the similarity of index() and find() makes me feel that one should be redundant (probably the one which returns -1). ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From kens at sightreader.com Mon Feb 28 12:07:47 2000 From: kens at sightreader.com (Ken Seehof) Date: Mon, 28 Feb 2000 09:07:47 -0800 Subject: Killin' Newbie question References: Message-ID: <38BAAB63.B3BE12D6@sightreader.com> Gregoire Welraeds wrote: > I can't access the __init__ method outside of the object, so the > following is disallowed : > ---- > class huh(): > def __init(self): > [some initialisation] > > ough= huh() > > [some code] > > ough.__init__() > ---- > > Right ? > The following should be allowed ? > > class huh(): > def __init__(self): > [some initialisation] > > def ReInit(self): > self.__init__() > > ough= huh() > [some code] > ough.ReInit() > > Do I have to rewrite the __init__ function in the ReInit() or the call to > the init() function inside the ReInit is enough ? > Isn't there a better way to do this kind of job, i mean in a OOP point of > view. Since the previous reply answers your first question, I'll talk aboutprogramming style. I would tend to write a ReInit function since __init__ really means "called when you create the object". However, there is nothing illegal about calling __init__ directly. class huh: def __init__(self): # some one-time initialization code print "spammity" self.ReInit() def ReInit(self): # some code print "spam" >>> h = huh() spammity spam >>> h.ReInit() spam The only time __init__ is usually called is from a derived object: class what(huh): def __init__(self): huh.__init__(self) # more initialization for what > Other little question, what about the following (regarding another remark > posted before) : > > def __init__(this): Legal, but don't do that. People will think you are a C programmer :-) Ack! > -- > 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 hinsen at cnrs-orleans.fr Fri Feb 4 05:04:30 2000 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: 04 Feb 2000 11:04:30 +0100 Subject: Language Challenge 2000 References: <389923AB.741B7DB9@sdynamix.com> <92rm4.13629$Ch7.942353@news.easynews.com> Message-ID: "Roger Upole" writes: > Since execution time is a factor, I doubt that any interpreted languages > will even be in the running. It could win by the size factor if only the interpreted program text is counted. -- ------------------------------------------------------------------------------- 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 pinard at iro.umontreal.ca Tue Feb 22 14:39:26 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 14:39:26 -0500 Subject: Python mode - `C-c |' feature suggestion In-Reply-To: python-mode@python.org's message of "Tue, 22 Feb 2000 10:51:20 -0500 (EST)" References: <14514.45176.931019.526625@anthem.cnri.reston.va.us> Message-ID: python-mode at python.org writes: > writes: > > My suggestion is that `C-c |' be made clever enough to discover > > the left margin of the region under consideration, and that it > > removes that margin while transmitting the region to the Python > > interpreter. That would allow for using that command in a much > > wider variety of (smaller :-) contexts. > I've also wanted this for a while, but never had the time to add it. > I'd accept a patch that implemented this feature. OK, here is a cut at it. Quick testing seems to show that it works, but I did not drive extensive tests. I also took this opportunity for another little change. With it, a temporary file is not created when it is not going to be needed. --- python-mode.el 2000/02/22 17:49:11 1.1 +++ python-mode.el 2000/02/22 19:35:02 @@ -1278,11 +1278,34 @@ (format "python-%d-%d" sn pid) (format "python-%d" sn))) (make-temp-name "python-"))) - (file (expand-file-name temp py-temp-directory))) - (write-region start end file nil 'nomsg) + (file (expand-file-name temp py-temp-directory)) + input) + (save-excursion + (let ((margin -1)) + (goto-char start) + (while (and (not (zerop margin)) (< (point) end)) + (skip-chars-forward " \t") + (let ((column (current-column))) + (and (not (= (following-char) ?\n)) + (or (< margin 0) (< column margin)) + (setq margin column))) + (forward-line 1)) + (if (> margin 0) + (let ((buffer (current-buffer))) + (setq input (get-buffer-create + (generate-new-buffer-name " *Python Input*"))) + (set-buffer input) + (insert-buffer-substring buffer start end) + (indent-rigidly (point-min) (point-max) (- margin)))))) (cond ;; always run the code in its own asynchronous subprocess (async + (if (not input) + (write-region start end file nil 'nomsg) + (save-excursion + (set-buffer input) + (write-region (point-min) (point-max) file nil 'nomsg)) + (kill-buffer input)) (let* ((buf (generate-new-buffer-name py-output-buffer)) ;; TBD: a horrible hack, but why create new Custom variables? (arg (if (string-equal py-which-bufname "Python") @@ -1295,18 +1318,30 @@ ;; execution there. (proc ;; use the existing python shell + (if (not input) + (write-region start end file nil 'nomsg) + (save-excursion + (set-buffer input) + (write-region (point-min) (point-max) file nil 'nomsg)) + (kill-buffer input)) (if (not py-file-queue) (py-execute-file proc file) (message "File %s queued for execution" file)) (setq py-file-queue (append py-file-queue (list file))) (setq py-exception-buffer (cons file (current-buffer)))) (t - ;; TBD: a horrible hack, buy why create new Custom variables? + ;; TBD: a horrible hack, but why create new Custom variables? (let ((cmd (concat py-which-shell (if (string-equal py-which-bufname "JPython") " -" "")))) ;; otherwise either run it synchronously in a subprocess + (if (not input) (shell-command-on-region start end cmd py-output-buffer) + (save-excursion + (set-buffer input) + (shell-command-on-region (point-min) (point-max) cmd + py-output-buffer)) + (kill-buffer input)) ;; shell-command-on-region kills the output buffer if it never ;; existed and there's no output from the command (if (not (get-buffer py-output-buffer)) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From gtnorton at my-deja.com Sat Feb 19 22:32:11 2000 From: gtnorton at my-deja.com (gtnorton at my-deja.com) Date: Sun, 20 Feb 2000 03:32:11 GMT Subject: New Python study group Message-ID: <88nn7r$m17$1@nnrp1.deja.com> We would like to invite anyone new to Python or programming in general to visit our new Python study group.The group was created to be a place to make friends, exchange ideas, collaborate on projects and above all, become better Python programmer's.Also, the group will hold bi-monthly or monthly meetings to discuss specific topics or to just meet and chat. (attendence is not mandatory!).People with an open mind and a desire to learn are urged to join. With that said,the following is not allowed: No flaming. Any posted question related to hacking (e.g. cracking) will be ignored!. No spamming. Our address is: http://python-studies-subscribe at egroups.com or for more information, drop a line to: strat_addict at yahoo.com Hope to see you there. Sent via Deja.com http://www.deja.com/ Before you buy. From kc5tja at garnet.armored.net Fri Feb 11 19:57:27 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 12 Feb 2000 00:57:27 GMT Subject: Python sucks loud References: <38A43D6E.65F9EFD9@bellatlantic.net> <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> Message-ID: >> This would be more effective if it were actually in your headers, I think. >Yep. But Netscape doesn't let you do that. Moreover, believe it or not, >it works. Umm...no, actually it doesn't. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From fredrik at pythonware.com Tue Feb 1 10:23:35 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 16:23:35 +0100 Subject: Need help with Tk problem... References: <876ook$ieq$1@news.go.dlr.de> Message-ID: <003301bf6cc8$6bb200f0$f29b12c2@secret.pythonware.com> Sven Drescher wrote: > I need a little Tk feature for my GUI, but I don't know how to do the > following. I looked for it in Deja and FAQs but nothing found. > > I want to get the current size of an widget, e.g. Tkinter.Frame() > > I know the options geometry, width and height. But if the frame grows or > shrinks, these options don't change. What did I wrong? Is there an other > function to get the current size??? reading the fine manual might help; go to http://www.pythonware.com/library/tkinter/introduction/basic-widget-methods.htm -> window related information and look for winfo_width() and winfo_height() (also see reqwidth/reqheight) From sabren at manifestation.com Wed Feb 16 01:55:07 2000 From: sabren at manifestation.com (Michal Wallace) Date: Wed, 16 Feb 2000 01:55:07 -0500 Subject: packages in special directories? Message-ID: <88dhl9$lk1$1@nntp4.atl.mindspring.net> Hey all, How can I make a .pth file point outside the main python directory? I have my package development directory organized like this: c:\zike\code\weblib c:\zike\code\weblib\__init__.py c:\zike\code\weblib\Sess.py c:\zike\code\weblib\Auth.py c:\zike\code\weblib\Perm.py I like having my code under \zike\code for backup purposes, and to keep it seperate from work I do for other companies, etc. Anyway, I want to be able to "import weblib" ... I know I can put it in PYTHONPATH, but that's already messy, so I wanted to try out the .pth notation.. so I made: c:\program files\python\weblib.pth which contains one line: c:\zike\code\weblib ... but this doesn't work.... neither does: ..\..\zike\code\weblib So I settled (for now) with changing it to: weblib and making a fake c:\program files\python\weblib\__init__.py which just appends the real directory to __path__... But why doesn't the other way work? I'd think this would come in handy, for example, if you have one version in production and are working on another... ?? -Michal http://www.sabren.com/ From jcw at equi4.com Wed Feb 9 08:46:56 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Wed, 09 Feb 2000 14:46:56 +0100 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <38A0AE3D.42C8B2F2@prescod.net> <87rb80$chc$2@mach.vub.ac.be> Message-ID: <38A16FCB.9DD369D3@equi4.com> Thomas, > It also takes more than 15 minutes to get used to indentation in Pyton Wow. To me it was more like 1 second. How was your timing on if's? :) -jcw From ekappoti at lynx.neu.edu Thu Feb 24 19:13:48 2000 From: ekappoti at lynx.neu.edu (Eric Kappotis) Date: Thu, 24 Feb 2000 19:13:48 -0500 Subject: MFC Message-ID: <894hee$12g$1@isn.dac.neu.edu> Is there anyway I can use Microsoft Foundation Classes to create a GUI with python, if so how do I do it and what would be a good book to learn MFC? Eric Kappotis From claird at starbase.neosoft.com Mon Feb 21 20:34:36 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 21 Feb 2000 19:34:36 -0600 Subject: Which GUI? References: <20000220194012.A2069@stopcontact.palga.uucp> Message-ID: <5AC95A7C2BC31421.5416BC1C35178039.3982129615639F0F@lp.airnews.net> In article , Fredrik Lundh wrote: . . . >or just explain to me why putting wxPython on top of >wxWindows on top of Gtk on top of Xlib is more Python- >like than putting Tkinter on top of libtk on top of Xlib? > >why not just place a lean and mean OO layer on top of >Gtk (or Xt)? in my book, *that* would be Python-like... . . . I'l remind readers that TkGS (see also ) is a project to strip a layer out of the the Tk(inter) stack. It looks as though TkGS will become real; the Tcl community is supporting it adequately. More volunteers are welcome. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From sholden at bellatlantic.net Mon Feb 28 00:15:09 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Mon, 28 Feb 2000 05:15:09 GMT Subject: GUI in Python under MSDOS? References: <7gxs4.10514$Jz3.75949@nnrp1.uunet.ca> <38B9937D.F446585C@bart.nl> Message-ID: <38BA045E.6FD771DB@bellatlantic.net> Richard Smol wrote: > > [trying to help a fellow-Pythonista with the DOS environment] > > Porting Tk to DOS would not be trivial, since there would be no > base-widgets to work with. It would be great fun though to make > it work. You might get stuff like those those early "Windows-lookalike" > DOS apps (anyone remember WordPerfect 6.0 for DOS?) > Yes, indeed. This was where Corel failed to find Open Source (first time around) and Windoze won the market. Great product, shame about the marketshare. Here's-hoping-people-realise-the-most-popular-products-are-not-always-best-ly y'rs - Steve -- "If computing ever stops being fun, I'll stop doing it" From fcahoon at my-deja.com Mon Feb 7 23:02:24 2000 From: fcahoon at my-deja.com (fcahoon at my-deja.com) Date: Tue, 08 Feb 2000 04:02:24 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <00020717051900.00606@quadra.teleo.net> Message-ID: <87o4ge$od9$1@nnrp1.deja.com> You know, Patrick, when viewed from deja.com, the way you've quoted me is seriously mis-formatted. I think the problem stems from your use of tabs as indentation. Here, take a look: http://www.deja.com/threadmsg_ct.xp?AN=582911827.1 Good thing it's not python code, eh? In article <00020717051900.00606 at quadra.teleo.net>, Patrick Phalen wrote: > [fcahoon at my-deja.com, on Mon, 07 Feb 2000] > > If python code were to become mis-formatted (and given my experience, I > have to believe that sooner or later this _will_ happen) there is _no > way_ to be certain what the original author's intent was, much less to > fix it automatically. This is a Bad Thing(tm). > > This could be a Bad Thing, if the coders involved failed to follow the > very practices which Python's design encourages: write small, > manageable, modules. I fail to see how any project written in a sane, > modular way could be made inscrutable by the sort of inadvertence to > which you refer. Isn't that true of any language, though? If the developers write in small, managable modules, the result will be much more maintainable. It's just common sense to write that way. > [ ... enthusiasm about Perl's decline snipped, before I realized that I would refer to it later (oops!) ...] > Some of you may argue that, if Python is not a good language, how did it > become so popular? Once a scripting language like Perl or Python > acquires a "critical mass" of followers, it will experience exponential > growth, because the availability of modules affects the usability of the > language in real-world applications and the usability (or rather, use) > of the language leads to the creation of more modules, in a > positive-feedback loop. Python does address some of the shortcomings of > Perl -- notably, it is far more maintainable in a multi-developer > envirionment -- despite the flawed decision to use whitespace as syntax. > This fact, and a butterfly flapping its wings in the Amazon jungle, has > led Python to achieve "critical mass". > > This is specious and ill-informed. You do have a bit of a nerve coming > on this newsgroup and suggesting that the thousands of serious > programmers (many of them former Perl hackers) who use Python daily do > so for the sole reason of a slight edge in maintainability. Or that > Python's popularity is the result of some unexplainable initial > condition. Earlier in your post, you expressed pleasure at the prospect of Perl's popularity waning (oops, I snipped that part before realizing I would be referring to it). If Perl is such a bad language (and I agree, Perl does have some _serious_ problems), why does its popularity still surpass that of Python by a considerable margin? Would it take "nerve" to suggest that factors outside the intrinsic value of the language itself played a role? Maybe on comp.lang.perl, but not here. I think that a great deal of Perl's success can be attributed to the fact that it was the first language in its class (that is, "modern scripting languages") to gain a certain level of recognition and thus now has the greatest number of modules available for it. Would you agree with that? If not, please tell me what makes Perl such a popular language. If so, please tell me why similar statements about Python on my part must necessarily be mistaken. As for "initial conditions": anything that is dynamic, living, and growing, like a language community, will naturally have a great deal of dependence on initial conditions. That's the way the world works. > [ ... remainder snipped for brevity (hope that's ok) ... ] f Sent via Deja.com http://www.deja.com/ Before you buy. From pinard at iro.umontreal.ca Thu Feb 17 11:55:35 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 17 Feb 2000 11:55:35 -0500 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC15A9.28D941E3@durham.ac.uk> Message-ID: [Oops, I forgot to include the Python mailing list.] "J.C.Travers" ?crit: > (I mean programming GTK in C is a nightmare compared to QT in C++ !!!) Thanks for your comments. I guess, from what I've seen, that this damage is well repaired in the `pygtk' interface. So for Python programmers, the nightmare might just not exist. I had to pick a GUI, and decided for `pygtk', after having tried other avenues. The reason who left me away from `qt' was mainly all the legalistic noise around it, and the fact it might not be free on some platforms. My guess has been that `pygtk' might be of comparable quality. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jstok at bluedog.apana.org.au Sun Feb 27 16:50:34 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 28 Feb 2000 08:50:34 +1100 Subject: name of object inside it's methods? References: <8EE74F2D4usenetacct@216.169.37.95> Message-ID: >In other words I want the method to print the name of the object that it >belongs to Objects do not have names. Objects can be referred to by names, but this is not the same thing; any object can be referred to by multiple names. From nobooze4u at WHOOSH!worldnet.att.net Tue Feb 15 00:55:11 2000 From: nobooze4u at WHOOSH!worldnet.att.net (Yes, Sir) Date: Tue, 15 Feb 2000 05:55:11 GMT Subject: Python sucks loud References: <000f01bf7763$e23d5080$66a2143f@tim> Message-ID: <3T5q4.10257$LC4.272287@bgtnsc04-news.ops.worldnet.att.net> x-no-archive: yes Tim Peters wrote: > > [Forget it] > > You people are funny here, all excited about Python. > > Following one guy's recommendation, for two days already I'm > > looking at Python as a potential plug-in language, and it > > DISGUSTS me. > > [Grant Edwards] > > That's one of the lamest, most transparent flame-bait postings > > I've seen in a long time. > > Oh ya? What about *this* one?! Monkey boy. That's mah man !! As long as people of sophistication and refinement can be found the nation will survive, thanks be to Lord, not all is lost... > > forget-it-forgot-to-liken-guido-to-hitler-ly y'rs - tim From tseaver at starbase.neosoft.com Thu Feb 10 11:36:40 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 10 Feb 2000 10:36:40 -0600 Subject: ZOPE and ILU? References: Message-ID: In article , Steffen Ries wrote: >Hi, > >I'm trying to hook up external CORBA objects to Zope, using ILU. > >I can't believe that I'm the first one to try that. Is there anybody >out there, who can give me some hints? > >tia, >/steffen >-- >steffen at cyberus.ca <> Gravity is a myth -- the Earth sucks! I have a proposal for doing this with Fnorb: http://www.zope.org/Members/tseaver/CosNaming The issues should be very similar between the two ORBs. Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From boud at rempt.xs4all.nl Mon Feb 21 16:26:12 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 21 Feb 2000 21:26:12 GMT Subject: Which GUI? References: Message-ID: <88sahk$3q6$2@news1.xs4all.nl> Moshe Zadka wrote: > On Fri, 18 Feb 2000, Fran?ois B?dard wrote: >> I see no mention in this thread of JPython + Swing. Any special reason? > Yes. Lots of people don't have 96 MB on their computer. Calcifer - my development machine - has 256 MB and still thinks that java and swing are seriously exciting. Calcifer likes the chance to exercise all its memory... -- Boudewijn Rempt | http://www.valdyas.org From jkahanpa at pcu.helsinki.fi.invalid Tue Feb 8 04:09:54 2000 From: jkahanpa at pcu.helsinki.fi.invalid (Jere Kahanpaa) Date: 8 Feb 2000 09:09:54 GMT Subject: What GUI widgets are available? References: <0c6c0960.87ddf24b@usw-ex0104-031.remarq.com> Message-ID: <87omh2$lfi$1@oravannahka.helsinki.fi> Ronald Caudill wrote: : The programs I want to do soon needs a Grid widget and a calendar : widget. Are these widgets available in Python? Or can one write : your own. Or what do Python programmers do when they need widgets : like this? : Ronald wxPython (http://alldunn.com/wxPython/) has both. I haven't used them, but at least the wxGrid widget should be quite flexible. Jere Kahanp?? From scarblac-spamtrap at pino.selwerd.nl Tue Feb 22 06:56:33 2000 From: scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) Date: 22 Feb 2000 11:56:33 GMT Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <88tkob$jqd$1@nnrp1.deja.com> Message-ID: ndev42 at yahoo.com wrote in comp.lang.python: > This accumulation of layers helps us programmers ship libraries > and development tools fast, but they certainly do not help out > the users in the end. Just to get a "Hello world" button with > Python, you need Python + Tkinter + Tk + Tcl + X11, whereas > you could have short-circuited that to Python + X11, if an intelligent > widget set was built directly from X11 in Python. Not just binding > the X functions, making OO widgets and Python compatibility, too. > A next step could be to provide the same OO widgets, bound to > other low-library window libraries on other OS's. That is some > effort, I realize, but looking back at how much has been spent on > making free GUI tools already, looks pretty small. I understand you're volunteering? > Every time a new layer is added, new compatibility issues are brought > in. Plus: if you did not develop all the layers, you have to support > any change in other people's code to keep compatible. Any layer that > becomes drastically incompatible with a previous version of itself > propagates this property to the rest of the assembly. This becomes > a true nightmare when you have several generations of software to > support on the same machine. If you make your own library that works on all platforms, *you* will have to keep up with the latest changes on those platforms. Now the Tk folks will do that, and the Python people just have to upgrade their software now and then. But if you have the time, go ahead... -- Remco Gerlich, scarblac at pino.selwerd.nl 12:51pm up 90 days, 18:55, 7 users, load average: 0.37, 0.26, 0.26 From alex at somewhere.round.here Mon Feb 14 15:11:49 2000 From: alex at somewhere.round.here (Alex) Date: 14 Feb 2000 15:11:49 -0500 Subject: Python sucks loud References: Message-ID: > I'm curious (although not excessively so) why do you people all think > that was a flame bait? Why couldn't it simply be a harmless opinion, > along with a few questions? It's a matter of tone, you social cripple. (Just a harmless opinion, along with a helpful answer to your question. :) Sorry, I probably won't reply to your reply unless someone else does first. You've already taken a big hit in the score file of my news reader. Goodbye. Alex. From fdrake at acm.org Fri Feb 11 16:50:47 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 11 Feb 2000 16:50:47 -0500 (EST) Subject: Comparing file objects: what is compared? In-Reply-To: <20000211213640.A7470@stopcontact.palga.uucp> References: <20000211165155.A4849@stopcontact.palga.uucp> <14500.20573.885719.892991@weyr.cnri.reston.va.us> <20000211213640.A7470@stopcontact.palga.uucp> Message-ID: <14500.33847.75730.247838@weyr.cnri.reston.va.us> Gerrit Holl writes: > This does not seem to be documented anywhere! Am I missing it or am I right? > I think it should be documented, something like: I think it's documented as being arbitrary but consistent, which is sufficient. It's not important that the ID is used, just the current implementation. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From gerrit at nl.linux.org Fri Feb 25 15:38:06 2000 From: gerrit at nl.linux.org (Gerrit Holl) Date: Fri, 25 Feb 2000 21:38:06 +0100 Subject: Life's better without braces In-Reply-To: ; from herzog@online.de on Fri, Feb 25, 2000 at 07:21:38PM +0100 References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> <20000222213539.C4549@stopcontact.palga.uucp> Message-ID: <20000225213806.A19850@humbolt.nl.linux.org> On Fri, Feb 25, 2000 at 07:21:38PM +0100, Bernhard Herzog wrote: > Is it posssible to implement getattr, setattr and delattr without eval > or exec? I don't think so. > How do you implement len for builtin types without > iterating through the indices until an IndexError is raised? You don't. > How do you implement callable? def callable(f): try: f() return 1 except TypeError: return 0 Hmm, this is wrong. What about checkins if... no, I don't know. > I think you forgot str and cmp, but they're easy: > > def str(obj): > return "%s" % (obj,) > > def cmp(a, b): > if a > b: > return 1 > if a < b: > return -1 > return 0 > > ord should also be possible. Possible with some dictionairy. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From tismer at tismer.com Wed Feb 16 09:17:58 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 16 Feb 2000 15:17:58 +0100 Subject: Please help: Connecting Microsoft Access Database (DAO) References: <38AB2A28.77FE@zvs.zgs.de> Message-ID: <38AAB196.AC043FB4@tismer.com> Thomas Keil wrote: > > Hello, > > does anyone know how to get a Report from an Access Database? > > " > import win32com.client > engine=win32com.client.Dispatch("DAO.DBEngine.36") > db=engine.OpenDatabase(r'foo.mdb') > rs=db.OpenRecordset('bar') > " > > 'bar' is a report; it needs two values: "first date" and "second date". This is much more difficult that to get at a table or query. Reports are no properties known to DAO, but they are structures in MS Access, which is an application on top of DAO. The DAO database only knows about tables and queries, and some other BLOB structures. In these BLOB structures is oyur access application living, with its forms, reports and modules. BTW, macroes are in tables. Therefore, you need to build an interface to Access and use its methods to get access to a Report. I didn't do it before, but I guess it will take quite a lot of trying and reading the Access help files on its objects. Most probably you will have to use the docmd.openreport method. ciao - chris -- Christian Tismer :^) Applied Biometrics GmbH : Have a break! Take a ride on Python's D?ppelstr. 31 : *Starship* http://starship.python.net 12163 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 embed at geocities.com Fri Feb 25 10:01:54 2000 From: embed at geocities.com (Warren Postma) Date: Fri, 25 Feb 2000 10:01:54 -0500 Subject: idlerc.py References: <20000225073335.A3192031@vislab.epa.gov> Message-ID: <5Rwt4.22183$Jz3.111477@nnrp1.uunet.ca> > Now is there a way to put these color settings in an ".idlerc" of sorts so > they're kept from version to version without hacking any source? How about checking your working (and home directory for unix} for an "idlerc.py" on Unix and if so, run it. Problem with .idlerc is it's very Unix-ish and wouldn't fit in on Win32, whereas an INI file or Registry is very Windows-ish and not very Unix. Compromise? :-) Warren From rerwig at my-deja.com Tue Feb 1 02:02:39 2000 From: rerwig at my-deja.com (rerwig at my-deja.com) Date: Tue, 01 Feb 2000 07:02:39 GMT Subject: Q: Py_InitModule Message-ID: <8760ee$u2t$1@nnrp1.deja.com> On learning on ho to write extension modules, I found the piece of information below: Module documentation string By far the easiest, add a character string argument to the end of Py_InitModule. void initmodname() { static char modname__doc__[] = "\ This module contains some functions, constants and maybe a type."; (void)Py_InitModule("modname", methods, modname__doc__); } However, compiling it produces an warning as Py_InitModule only expects 2 parms, not 3. What am I missing? Sent via Deja.com http://www.deja.com/ Before you buy. From kohler at medien.tecmath.com Mon Feb 14 03:27:17 2000 From: kohler at medien.tecmath.com (Markus Kohler) Date: Mon, 14 Feb 2000 09:27:17 +0100 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> <1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu> <38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> <881ac8$qu4$1@sun.rhrk.uni-kl.de> <1e5yqen.1w4r3yevna9a5N%bparsia@email.unc.edu> Message-ID: <888e45$mo9$1@sun.rhrk.uni-kl.de> Bijan Parsia schrieb in im Newsbeitrag: 1e5yqen.1w4r3yevna9a5N%bparsia at email.unc.edu... > Fredrik Lundh wrote: > > > Markus Kohler wrote: > > > > seriously, what are the major shortcomings in Python > > > > from a Smalltalk professional's perspective? > > > -- Smalltalk's calling mechanism is much simpler than Pythons making it > > > easier to compile. > > > > can you elaborate? > See below ... > Probably not, but that doesn't necessarily stop me (even *if* this was > addressed to Markus ;)) > > > as I see it, python's calling mechanism involves passing > > a tuple (and an optional keyword dictionary) to a callable > > object. how does smalltalk differ from this? > > I suspect that Markus may have meant the lookup mechanism, though I'm > not sure. I don't know that either the lookup or the call mechanism is > "simpler" but it certainly seems *cheaper*. I.e., the cost of a method > send is typically negligable. But I suspect that this is a > implementation issue. Yes the right word is "cheaper". In Smalltalk you don't have default arguments nor you have keyword arguments. It seems to me that implementing an efficient calling mechanism is much easier in Smalltalk than in python. You can just hash the name of the method to find it quickly. Another optimization in Smalltalk is that you cache the latest call and then just test for it directly. Since most calls are usually monomorph this gives you a good speedup. By using inlined machincode to do this Smalltalk calls can be faster than C++ calls using a virtual table. > > > > Almost every Smalltalk implementation I have seens runs > > > faster than Python. > > > > just one simple question: reading some smalltalk code makes > > me think that smalltalk requires you to declare what instance > > variables you're going to use? is this true? Yes. When you define the class using normal Smalltalk code you specify the instance variables without their type and without any value. > > I'm not sure what you mean. You define classes with ivars, yes. You can > change these at anytime, including programmatically. You can catch > message sends to non-existent methods (including calls to accessors of > non-existent ivars) and redirect them in various ways (including by > trapping #doesNotUnderstand:). Yes. You even could add new ivars at runtime, because Classes are objects too ... > > > can you add extra stuff to an instance afterwards without > > any extra cost? Yes. There is usually a way in Smalltalk implementations that allows you to even change behaviour per instance and not only per class ! > > There are a variety of things you can do with a variety of costs. It's > certainly easy enough, for example, to implemente the __get_attr__, > __set_attr__ and friends stuff. > > > (should of course figure that out myself, but I don't seem > > to be squeak-compatible ;-) > > Sorry to hear that. I'm sure I could help you get up and running. We > start with a quick little brain reformat... > > Cheers, > Bijan Parsia. Markus From larsga at garshol.priv.no Wed Feb 2 06:55:30 2000 From: larsga at garshol.priv.no (Lars Marius Garshol) Date: 02 Feb 2000 12:55:30 +0100 Subject: Pythjon and XML References: <8787a5$ik7$1@nnrp1.deja.com> <_sSl4.4550$al3.56938@newsc.telia.net> Message-ID: * Fredrik Lundh | | quick answer: the built-in string type only handles 8-bit | characters, and most XML parsers (e.g. xmllib) cannot handle | anything that doesn't use an 8-bit encoding. in other words, ASCII, | ISO Latin, UTF-8 (etc) works fine, but 16-bit encodings don't. It's worth noting that Pyexpat supports UTF-16, and sends output to Python applications as UTF-8. RXP also supports UTF-16 and also the rest of the ISO 8859-x character sets. I assume it also sends output as UTF-8. --Lars M. From thomas at bibsyst.no Thu Feb 24 06:22:46 2000 From: thomas at bibsyst.no (Thomas Weholt) Date: Thu, 24 Feb 2000 12:22:46 +0100 Subject: Simple example of threading Message-ID: <38B51486.F0774310@bibsyst.no> Hi, I want to use threading in a server-based search/index application. Any hints? The Python-docs didn`t help much. Tutorials, examples and code, pleez. thank you. Thomas From gmcm at hypernet.com Fri Feb 18 09:32:05 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Fri, 18 Feb 2000 09:32:05 -0500 Subject: Metaclass hierarchy? (was Re: Superclasses) In-Reply-To: References: <_ZWq4.180$mYj.170807808@newsa.telia.net> Message-ID: <1261238252-13478968@hypernet.com> Joshua C. Marshall wrote: > .... If "T" is a > class object, "dir(T)" does not show "__bases__" as a field. What is the > lookup rule for getting fields from class objects? Is it similar to > getting fields from instances (where the interpreter goes up the class > hierarchy until it finds what you're looking for)? If so, what hierarchy > is being examined? See \Doc\ref\types.html. - Gordon From rhicks at rma.edu Wed Feb 23 17:31:32 2000 From: rhicks at rma.edu (Robert Hicks) Date: Wed, 23 Feb 2000 22:31:32 GMT Subject: PyQT,PyKDE failure: References: Message-ID: <8dZs4.39$CI1.3445@news> I believe that you must install sip, pyqt, pykde....in that order "Warren Postma" wrote in message news:XEVs4.10970$Jz3.90552 at nnrp1.uunet.ca... > I tried to install some RPMs for PyQT and PyKDE and got the following error > on my system. I had to install PyKDE using the following command because it > didn't recognize PyQT as being installed on my system: > > rpm --upgrade --force --nodeps PyKDE* > > It was saying PyKDE requird PyQT but when I typed "rpm -q PyQT" it returned > the correct version of PyQT as installed. > > Has anyone else got PyQT working, and what RPMs did you install? > [i am using Red Hat Linux 6.1] > > Warren > > --- > > The traceback error when I attempt to run a demo of PyQT is: > > > Traceback (innermost last): > File "/usr/lib/python1.5/site-packages/idle/ScriptBinding.py", line 131, in > run_module_event > execfile(filename, mod.__dict__) > File "/usr/doc/PyQt/examples/aclock.py", line 4, in ? > from qt import * > File "/tmp/PyQt-0.10.1-root/usr/lib/python1.5/qt.py", line 16, in ? > import libqtc > ImportError: /usr/lib/libsip.so.1: undefined symbol: __pure_virtual > > From dante at oz.net Mon Feb 14 23:22:27 2000 From: dante at oz.net (Michael Esveldt) Date: 15 Feb 2000 04:22:27 GMT Subject: xml-rpc and Manila (long shot) Message-ID: <88aka3$mn4$0@216.39.162.232> This is something of a long shot... I'm working on a Python interface to Manila (from Userland which has a very complete xml-rpc interface) and I'm having some problems with html I'm trying to transport. I get a message containing html via x.manila.message.get(username, password, sitename, msgNum) then alter the body (which is just a string) and try and return it using x.manila.message.set(username, password, sitename, msgNum, x["subject"], x["body"], "text/plain", "") This sets msgNum all right, but all my >'s get turned into & gt;'s. I assume this is so they don't get mistaken for xml. If I change the bodyType to "text/html" then both my <'s and >'s get converted to html entities so I assume my problem is there. I'm posting this on the off chance that this is just a function of xml-rpc and there is a simple answer. Michael _______________________________________________________________ dante at oz.net - Michael Esveldt - #FightThePower on Openprojects From vetler at ifi.uio.no Thu Feb 17 18:25:36 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: Fri, 18 Feb 2000 00:25:36 +0100 (MET) Subject: Which GUI? In-Reply-To: <20000217214601.B2438@stopcontact.palga.uucp> Message-ID: on 2000-02-17, Gerrit Holl wrote: > Vetle Roeim wrote on 950797908: > > I-hope-this-doesn't-start-a-gui-war--ly y'rs, vr > > I disagree. The latest gui war was over half a year ago, and > wxPython was abandoned than. So you hope this starts a GUI war? *sigh* > But it growed. I'd like to see an answer to ESR's question: > > Why the hell hasn't wxPython become the standard GUI for Python yet? I don't know. Perhaps you could give us some examples and describe the benefist of using wxPython over Tkinter and pyQt. :) too-late--ly y'rs, vr From urner at alumni.princeton.edu Tue Feb 1 15:01:06 2000 From: urner at alumni.princeton.edu (Kirby Urner) Date: Tue, 01 Feb 2000 20:01:06 GMT Subject: Fwd: re AMTE thread re DrScheme & Python Message-ID: <389739fb.95247007@news.teleport.com> For more context re the below, see the archived thread (on-going) at the Math Forum. This is from an Association of Mathematics Teacher Educators listserv: http://forum.swarthmore.edu/epigone/amte/snuquoiyor If people posting here have the time to read what Matthias says about Python... e.g.: > As far as the language is concerned, Python is a > - highly irregular, > - badly implemented > - non-parethetical version of (Mz)Scheme > - without underlying theory of programming > language design > - or program development > - with a cult-like following. I'd be happy to read their feedback. Kirby Urner Curriculum writer Oregon Curriculum Network http://www.inetarena.com/~pdx4d/ocn ========================================================== Date: Tue, 01 Feb 2000 10:15:58 -0800 To: amte at esunix.emporia.edu From: Kirby Urner Subject: Re: Computers in Math Class (was Math Myopia...) > The proper response to this table is that we don't > play such shameless, back-stabbing games. People should > test DrScheme for an afternoon on their own. Type in > factorial. Run it. Make a mistake. Run it. Use the stepper. > Then compare with Python, which offers nothing but scripting > hacks. > > Matthias, That's an interesting response, thanks Marvin! Re "shameless back-stabbing", I think what Guido & Co. say about DrScheme on that July 1999 CNRI Proposal I cited sounds far less vitriolic and denigrating of DrScheme than the above remarks about Python.[1] I would rather discourage an either/or approach right off the bat -- unless the Python computer language is really so unredeemably inferior as Matthias indicates. I'll need to make a deeper study of the points he makes. I know Bruce Eckel, whom I respect as a top-notch author of OOP-teaching texts (e.g. 'Thinking in C++' 'Thinking in Java') has had a lot of kind words for Python recently.[2] Bruce gets into languages pretty deeply. I'd think if Python were really so bad, that Bruce would have been harder on it right from the outset. Certainly I've found Python useful in my own curriculum writing for the Oregon Curriculum Network [3]. I stumbled across it relatively late in the game, and my seven chapter "Using Polyhedra to Teach OOP and Coordinate Geometry Concepts" reflects this.[4] I don't get to Python until the last chapter.[5] So maybe it's time for chapter eight, using DrScheme, about which I have an open mind (although I must say I'm rather put off by what looks to be a rather defensive and "cult like" mentality surrounding the DrScheme project :-D). Kirby PS: I'll refer this discussion to some Python newsgroup for feedback. I'd like to hear more technically savvy discussion about the points raised against it by Matthias -- but probably this AMTE listserv is not the proper forum for that. Notes: [1] http://www.python.org/doc/essays/cp4e.html [2] "My associate Andrea Provaglio and I both continue to be fascinated by this terrific and tremendously productive language" -- Bruce Eckel, Object-Oriented Programming Newsletter #7, Nov 29, 1999 [3] http://www.inetarena.com/~pdx4d/ocn/ [4] http://www.inetarena.com/~pdx4d/ocn/oop.html [5] http://www.inetarena.com/~pdx4d/ocn/oop7.html From gmcm at hypernet.com Tue Feb 1 09:05:52 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Tue, 1 Feb 2000 09:05:52 -0500 Subject: This thread was almost about Python once In-Reply-To: <38966218.5048159C@callware.com> Message-ID: <1262708546-3423132@hypernet.com> Ivan Van Laningham wrote: > > stdin = fd 0 > stdout = fd 1 > stderr = fd2 > next fd you ask for = fd3 > > Not braindead at all. Just a nice tradition, which is observed on > unices & their descendents, but not on M$. 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 sys >>> sys.stdin.fileno() 0 >>> sys.stdout.fileno() 1 >>> sys.stderr.fileno() 2 >>> It's only a GUI on MS that has no concept of std*. A "feature" they stole from a Mac, I guess. - Gordon From fredrik at pythonware.com Tue Feb 1 05:54:37 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 11:54:37 +0100 Subject: PIL Problem (Python Imaging Library) References: <388C1E3A.2CF9F1FF@unice.fr> Message-ID: <011601bf6ca2$bbf8cdd0$f29b12c2@secret.pythonware.com> Jerome ALET wrote: > Does someone know if the standard PIL library can allow me to extract > many graphic files (JPEG in my case) from a special undocumented format > archive ? > > the only thing I know is the offset at which begins each jpeg file, but I > don't know their sizes, and I don't want to analyze the jpeg format to > finally discover the size (in fact I want PIL to do it for me). something like this should work: import Image, sys from ContainerIO import ContainerIO file = open(archivefile, "rb") subimage = Image.open(ContainerIO(file, offset, sys.maxint)) From jarek at ieee.org Sat Feb 19 10:46:20 2000 From: jarek at ieee.org (jarek) Date: Sat, 19 Feb 2000 15:46:20 GMT Subject: IDLE for JPython Message-ID: <38AEBAC7.5DEE27EC@ieee.org> Is it possible to use IDLE with JPython? (This probably require to run Tkinter.) Is there some other IDE that would run with JPython? I was looking through JPython web site and could not find any information about that. Thanks, Jarek From squishdot at yahoo.com Fri Feb 18 05:52:43 2000 From: squishdot at yahoo.com (Squishdot) Date: Fri, 18 Feb 2000 02:52:43 -0800 (PST) Subject: Killer Apps??? Message-ID: <20000218105243.15395.qmail@web902.mail.yahoo.com> "fredrik lundh" wrote: > Aahz Maruch wrote: > > >I was wondering if there were any other such killer apps? > > > > Yes. Zope. > > you mean Squishdot, don't you? > *blush*. sigh... -- Butch ;^) ===== Butch Landingin Squishdot maintainer http://squishdot.org squishdot at yahoo.com __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From jvickroy at sec.noaa.gov Fri Feb 18 12:46:02 2000 From: jvickroy at sec.noaa.gov (j vickroy) Date: Fri, 18 Feb 2000 10:46:02 -0700 Subject: Python and IDL (data language) Message-ID: <38AD855A.C95373A8@sec.noaa.gov> Hello, Could someone refer me to information/software for the use of IDL (the data language) and Python. Thanks for your time. From pinard at iro.umontreal.ca Thu Feb 10 08:21:05 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 10 Feb 2000 08:21:05 -0500 Subject: small python implementation or python subset ? In-Reply-To: Marc BRETTE's message of "Thu, 10 Feb 2000 10:20:17 +0100" References: <38A13C06.FE0DBA07@sxb.bsf.alcatel.fr> <38A282D0.2487CA89@sxb.bsf.alcatel.fr> Message-ID: Marc BRETTE ?crit: > OK, to summarize all answer that has been dent to me : > 1/ On unix the python executable after source compilation seems not to be > stripped. [...] I just checked on the SuSE 6.2 system, here: ----------------------------------------------------------------------> $ type python python is /usr/bin/python $ v /usr/bin/python lrwxrwxrwx 1 root root 9 Sep 14 08:59 /usr/bin/python -> python1.5 $ v /usr/bin/python1.5 -rwxr-xr-x 1 root root 460145 Jul 23 1999 /usr/bin/python1.5 $ file /usr/bin/python1.5 /usr/bin/python1.5: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), not stripped $ rpm -qf /usr/bin/python1.5 python-1.5.2-9 ----------------------------------------------------------------------< Despite Richard Stallman's opinion that binaries should never be installed stripped (this has been debated to death elsewhere :-), the common, accepted, and expected usage for Linux packagers is to strip installed binaries. Does someone know why Python is installed unstripped? Would that be required by dynamic loading in some way? I do not think so. Else, why? (If I strip it, size drops from 460145 to 382616, surely not an enormous deal, but yet, would it be for the principle. :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From vetler at ifi.uio.no Mon Feb 14 08:38:50 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 14 Feb 2000 14:38:50 +0100 Subject: Simple client/server exchanging objects References: <38A80085.AECFF9EC@bibsyst.no> Message-ID: * Thomas Weholt > Hi, > > I`d like to make a client/server application exchanging objects of > different type, sizes etc. Are there any simple tutorials or docs > available on this, and what are my options on how to implement this ?? > > The objects are rather simple, but can be huge in size. Sound like CORBA would do the trick here. Either that, or you just serialize your objects, push them over the link and then read the data back into new objects. Perhaps the latter example would be best. You avoid having to learn CORBA ;) vr From tjg at avalongroup.net Thu Feb 24 15:29:45 2000 From: tjg at avalongroup.net (Timothy Grant) Date: Thu, 24 Feb 2000 12:29:45 -0800 Subject: A question from a total newbie References: <88j7a2$n5e$1@nnrp1.deja.com> <89263v$sau$1@nnrp1.deja.com> Message-ID: <38B594B9.A18AF3EC@exceptionalminds.com> Lisa wrote: > > Hi ! I am a total newbie to python, although I had a little programming > experience in Pascal, Fortran and PL/1. Welcome to the land of Python. > I am thinking of starting on DOS level, without any cumbersome > layers on windows. Do you recommend that? > If so, where can I get python that runs on DOS? I would probably start with python and the win32 extensions, both are available at www.python.org > And what else do I need? What is TCK or whatever it is I saw on > www.python.org? I am not sure about those things, I hope if someone here > can give me a pointer or two. The Windows version of Python ships with Tk. > Books, which are the books for newbies that you recommend? There are so > many books out there I do not know which ones are good. Learning Python by Mark Lutz and David Ascher is a really good book, so is the tutorial that is included with the distribution, in fact, all of Python's online docs are significantly better than average. -- Stand Fast, tjg. Chief Technology Officer tjg at exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630 >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< From hellan at acm.org Mon Feb 21 16:57:44 2000 From: hellan at acm.org (Jon K Hellan) Date: 21 Feb 2000 22:57:44 +0100 Subject: Python plugin for Gnumeric spreadsheet Message-ID: <87wvnyte07.fsf@parus.parus.no> I am looking for suggestions. The Gnumeric spreadsheet has a plugin which lets you define spreadsheet functions in Python. General scripting of the spreadsheet is not (yet?) supported. To give you an idea, here is how a very simple function is defined in Python and made available to Gnumeric: import gnumeric # Function definition def mid(text,start_num,num_chars): return text[start_num-1:start_num+num_chars-1]; # Help text for Gnumeric help_mid = \ "@FUNCTION=MID\n" \ "@SYNTAX=MID(text,start,num_chars)\n" \ "@DESCRIPTION=" \ "Returns a specific number of characters from a text string, " \ "starting at START and spawning NUM_CHARS. Index is counted " \ "starting from one" # register_function is a C function in Gnumeric to - you guessed it - # register the function. The parameters are: # - function name # - parameter types # - paremeter names - for use in the function wizard # - help string # - python function gnumeric.register_function ("mid", "sff", "text, start_num, num_chars", help_mid, mid); The plugin doesn't yet handle booleans properly. Python is happy to consider 0 or None false, and everything else true. But inside Gnumeric, booleans are a distinct datatype. A function defined in Python may receive a boolean from a C function, and will want to return it to the spreadsheet without converting to integer. So a distinguished boolean datatype is needed. What is the most pythonesque way to do that? I forgot to mention. Gnumeric tries to be compatible with Excel. Who can help? Jon From wware at world.std.com Sat Feb 19 16:18:32 2000 From: wware at world.std.com (Will Ware) Date: Sat, 19 Feb 2000 21:18:32 GMT Subject: cgi.py, cookies Message-ID: I didn't see anything in cgi.py about handling cookies. I am planning a web-based multi-player simulation game and I need to be able to tell the players apart. I'm just learning about CGI and forms and all that for the first time, and cookies seem to me to be the right way to assign persistent identities to players. Is there any cookie-handling server-side Python code? Thanks much. -- - - - - - - - - - - - - - - - - - - - - - - - - Resistance is futile. Capacitance is efficacious. Will Ware email: wware @ world.std.com From jimbag at kw.igs.net Fri Feb 18 18:21:38 2000 From: jimbag at kw.igs.net (JB) Date: Fri, 18 Feb 2000 23:21:38 GMT Subject: inet_ntoa Message-ID: <38ADD3FF.F361EAFA@kw.igs.net> Does anyone know if the inet_ntoa function in "arpa/inet.h" is implemented in python anywhere. I can't find it in the docs. Or, is there a similar func in python to convert integral network addresses into a dotted quad string?? thnx jb From joel at wolfpack2000.com Wed Feb 23 13:58:38 2000 From: joel at wolfpack2000.com (Joel Hatch) Date: Wed, 23 Feb 2000 10:58:38 -0800 Subject: Reducing Python's memory footprint? References: <38B3AA6A.C85FA919@wolfpack2000.com> <38B3DCD1.985C738F@endea.demon.nl> Message-ID: <38B42DD2.A7BE120D@wolfpack2000.com> I think that's the problem. How do I get it to share the executable code between the processes? As a test, I loaded five copies of my application, and kept track of how much memory was being used (resident size). It looks like this: 5,988k for the first 11, 976k for two 17,964k for three 23,952k for four 29,940k for five There doesn't seem to be *any* sharing of resources in this... --Joel Niels Diepeveen wrote: > Joel Hatch schreef: > > Using five megs to load a Python interpreter is a little excessive, but > > acceptable. Blowing a half of my available RAM on a handful of nifty > > panel applets and a monitor or two just doesn't work, though... > > If it takes 5MB to run a single process, that doesn't mean you need 50MB > to run 10 processes. All (or most) of the executable code (the > interpreter, C modules etc.) is shared between these processes, so > running 10 of them may take only 6MB or so, depending mostly on the > amount of memory used to store data. > > -- > Niels Diepeveen > Endea automatisering From mwh21 at cam.ac.uk Mon Feb 21 12:26:19 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 21 Feb 2000 17:26:19 +0000 Subject: None & Ellipsis References: <20000218214032.A8179@stopcontact.palga.uucp> <20000218225110.A9409@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > Moshe Zadka wrote on 950911097: > > On Fri, 18 Feb 2000, Gerrit Holl wrote: > > > > > Hello, > > > > > > why aren't None and Ellipsis keywords? > > > > Why should they be? > > For sequence unpacking: > > >>> t=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') > >>> t1, t2, None, t4, t5, None, None, t8, None = t > >>> None > 'i' > > I want to use None to say "ignore this". > I generally use `_' for this. prolog-ly y'rs Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From judy at dvcorp.com Tue Feb 8 17:59:17 2000 From: judy at dvcorp.com (Judy Hawkins) Date: Tue, 08 Feb 2000 22:59:17 GMT Subject: Error on string formatting Message-ID: <87q741$8jh$1@nnrp1.deja.com> Why this: >>> buf = '%0.*f' % 3, 4.1 Traceback (innermost last): File "", line 1, in ? TypeError: not enough arguments for format string The comparable statement in C works fine, and the Essential Reference says I can do this kind of asterisk thing. Judy Hawkins Sent via Deja.com http://www.deja.com/ Before you buy. From mikael at isy.liu.se Tue Feb 29 05:09:17 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 29 Feb 2000 11:09:17 +0100 (MET) Subject: A comp.lang.python code snippet archive? In-Reply-To: <000601bf829b$dd53c660$3acbd9c2@peridot.optichrome.com> Message-ID: On 29-Feb-00 Adrian Eyre wrote: > I think more people would use sites like this if they knew about them. The > only way at the moment to find out is to continuously read comp.lang.python > for a couple of years. Not everyone has the time/patience to do this. So true... > We could also have some convention about Python snippets posted to c.l.py, > so they can be automagically extracted and categorised. > > e.g. > > #snippet "mysnippet.py" > #category "Networking" > #description "This does something interesting" > #begin > #!/usr/bin/env python Nice thought, but I don't think it will work. Well, technically: yes. But I think many people are just like me in this respect: I will not always remember to do this. Then-again-I-do-not-post-that-many-snippets-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: 29-Feb-00 Time: 11:05:29 This message was sent by XF-Mail. ----------------------------------------------------------------------- From kc5tja at garnet.armored.net Sat Feb 12 01:56:17 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 12 Feb 2000 06:56:17 GMT Subject: [CORBA] omniNames feature request Message-ID: Can an option be added into the next release of omniNames (like -iorfile ) such that it causes omniNames to produce a very simple text file containing nothing but the name service's IOR? I need this output because omniORB's solution to boot-strapping the name service is ... well, omniORB-specific. My application needs complete interoperability, so I need to publish the name service's IOR at a well-known TCP/IP port using plain sockets. (Why, oh WHY didn't OMG specify a fixed TCP/IP port and object key for the name service? Is it really too much to ask for?!) -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From nielsenjf at my-deja.com Thu Feb 24 19:20:14 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Fri, 25 Feb 2000 00:20:14 GMT Subject: CGI and COM References: <000801bf7ec0$9da94500$d300a8c0@Alexis> Message-ID: <894hrs$jn0$1@nnrp1.deja.com> In NT at least, for cgi (not ASP) the IIS account is derived from the system account. I would spawn another process, use the reverttoself win32 call to revert that process back to the system account and then become whomever you want to do whatever you want (there are some limitations because the system account is a local account). If you look in the overviews section in win32 help for python, if you have a recent enough version, it will describe more details regarding impersonation. Maybe you can adapt that to win2000. Otherwise, an easier thing would be to setup a role in MTS/COM+ to allow access to a COM component which runs as administrator. I wouldn't want a guest login to directly be run as administrator. john In article <000801bf7ec0$9da94500$d300a8c0 at Alexis>, =?iso-8859-1?Q?Ulf_Engstr=F6m?= wrote: > This is a multi-part message in MIME format. > > ------=_NextPart_000_0005_01BF7EC8.FF2A8980 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > I've just started with some COM-programming with the win32com package, = > and I get the part I want to working correctly when I run it in IDLE or = > in any way, except that I know want it to be done from a CGI-script. = > (I'm writing params to a program with COM) > I know this raises some security issues when run as CGI, but is there a = > way do overrun this? I'm running W2k with IIS5. I tried to set guest = > login to use Administrator, this made the script take forever, but still = > came out negative. > Some other way? > Regards > Ulf (Alexis) > > ------=_NextPart_000_0005_01BF7EC8.FF2A8980 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > > > http-equiv=3DContent-Type> > > > > >

>
I know this raises some security = > issues when=20 > run as CGI, but is there a way do overrun this? I'm running W2k with = > IIS5. I=20 > tried to set guest login to use Administrator, this made the script take = > > forever, but still came out negative.
>
Some other way?
>
Regards
>
Ulf (Alexis)
> > ------=_NextPart_000_0005_01BF7EC8.FF2A8980-- > > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From cfelling at iae.nl Wed Feb 16 17:26:44 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 16 Feb 2000 23:26:44 +0100 Subject: Keep comp.lang.python Friendly References: <38aadad5.46484491@news.telus.net> Message-ID: <88f874$1mo$1@vvs.superst.iae.nl> David wrote: > My perception is that the social/emotional climate in this newsgroup has > changed over the past few months. It is becoming less friendly and more > hostile. Yes those White Space Wars are nasty, they erase some of the vital space in this group:) OTOH, I was impressed by the gentle way Fredrik guided someone to the tutorials and the tutor list whilst at the same time answering his "all in the tutorial" questions. And we hear no more of this guy, so probably he is happy hacking after having read the tutorials. I guess Fredrik wouldn't have been so patient were it not for this tutor list and excelent tutorials to back him up. Maybe the same could be true for those few flamebaits that have been going on ever since Tom Christiansen left some pearls for use to digest. We could have a WhiteSpaceWars section at www.python.org in which we keep short summa- ries of those nasty wars. I prefer this to additions to the FAQ, as it is more direct, just a single url and one has all the arguments pro and con to the white space non-problem, or a short summary of the Tom-flame covering the likely problems a Perler might have switching to Python. -- groetjes, carel From mhammond at skippinet.com.au Wed Feb 16 19:08:48 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 17 Feb 2000 00:08:48 GMT Subject: How holy-wars start Message-ID: As seen on slashdot: The two monks stand side by side, facing the altar, behind which a graven image of the Great and Benevolent Tux stands with wings half spread as he contemplates the GNU/Path to True Enlightenment Through Open Source. One monk wears a single pearl upon his forehead, glimmering in the flickering light of the altar candles. The other sports a torc in the form of a serpent entwined around his upper arm. The gaze upon the image of Tux placidly, each at inner peace. The monk with the pearl breaks the silence: "Good brother, I see your movement grow by leaps and bounds. How is this so?" The monk with the serpent replies: "It is our more disciplined coding, brother, which more quickly leads down the One True Path of Enlightenment. Discipline of code leads to discipline of mind and body." Pearl: "But what of tailoring the Quest to the individual? Be flexible like water, and in time, even stone will fall before it." Serpent: "Be structured like iron, and the stone will fall faster." Pearl: "But each mind is different, and should be allowed to find their own path." Serpent: "There is but one Path, brother, just many ways to find it. Ours is the quickest and most sure." The candles on the altar continue to flicker as the two monks fall into a few moments silent contemplation. Pearl: "I am afraid I must disagree." Serpent: "So you say, but you know the truth in your heart. Did not your order adopt the doctrine of OOP despite the conflicts with your order's earlier, strictly procedural ways?" Pearl: "OOP is just one path of many." Serpent: "It is the soul of the Way." Pearl: "And so you seek to challenge the longstanding authority of the Order of the Pearl? We have existed longer, and are closer to the Truth!" Serpent: "You wander blind in the mists, poor deluded souls, while the True Way beckons! You can yet change your $PATH." Pearl: "You speak heresy! Leave the Holy Temple before the Great and Benevolent Tux smites you!" Serpent: "I speak Truth, and you are but too mad to see it! I curse you and your Order! The Way of the Serpent will triumph!" And the monk with the serpent turns and stalks out of the Temple, growling, "We will be back, and in numbers! The Temple will be ours!" The monk with the pearl watches his counterpart leave, turning back to the altar and shaking his head. "We will be waiting, and the Great and Benevolent Tux is on our side!" -- WhiskeyJack, on serious caffeine withdrawal From steinme at kpnqwest.no Thu Feb 10 17:57:17 2000 From: steinme at kpnqwest.no (Stein M. Eliassen) Date: Thu, 10 Feb 2000 23:57:17 +0100 Subject: Maximum recursion depth Message-ID: <38A3424D.30F8BFB6@kpnqwest.no> Hi, I have reached "maximum recursion depth". Is it possible to increase this limit? Regards Stein From z3penguin at z3penguin.com Mon Feb 21 18:53:21 2000 From: z3penguin at z3penguin.com (Z Three Penguin) Date: Mon, 21 Feb 2000 18:53:21 -0500 Subject: Interactive programs through Popen3 References: <88n50e$h29$1@bob.news.rcn.net> <38AFBB31.27CBAFB5@bogusaddress.com> Message-ID: <88sj8o$1cm$1@bob.news.rcn.net> Yes I am running Linux. Is there any way to give the read function a timeout? -- -Z3Penguin ------ Z3Penguin Z3Penguin at PenguinPowered.Com http://whitecow.peji.com/ Just because you're paranoid, it doesn't mean they're not after you. Communication is Human, Encryption is Divine Linux. The choice of a GNU generation. Dr. Pepper and doughnuts... because breakfast is the most important meal of the day. ~ . . /V\ got linux? // \\ /( )\ ^`~'^ PGP Fingerprint: A757 001D 58E3 1486 6466 BE35 4E28 A328 90CF 4E88 Obtain my PGP key from: http://whitecow.peji.com/key.asc Joe Smith wrote in message <38AFBB31.27CBAFB5 at bogusaddress.com>... > >I take it that you must be running on UNIX. If I remember correctly, 1.5.2 >says something about can't fork on Windows NT 4.0. If I remember correctly, >popen2() and popen3() also have the same problem. The doc should probably >state that the popen2 module/library does not work on NT. It would probably >not be difficult to fix these so that they work right on windows NT, but since >I figured a way around the problem, I don't feel inspired. > >Z Three Penguin wrote: > >> When I try to run an interactive program (such as pico), reading the file >> object hangs the interpreter. The code is: >> >> import popen2 >> s=popen2.Popen3("pico") >> while s.poll()==-1: >> print s.fromchild.read() >> a=raw_input() >> s.inchild.write(a) >> >> Any ideas? >> >> -- >> -Z3Penguin >> >> ------ >> Z3Penguin Z3Penguin at PenguinPowered.Com >> http://whitecow.peji.com/ >> >> Just because you're paranoid, it doesn't mean they're not after you. >> Communication is Human, Encryption is Divine >> Linux. The choice of a GNU generation. >> Dr. Pepper and doughnuts... because breakfast is the most important meal of >> the day. >> >> ~ >> . . >> /V\ got linux? >> // \\ >> /( )\ >> ^`~'^ >> >> PGP Fingerprint: A757 001D 58E3 1486 6466 BE35 4E28 A328 90CF 4E88 >> Obtain my PGP key from: http://whitecow.peji.com/key.asc > From tjreedy at udel.edu Sat Feb 19 16:05:08 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 19 Feb 2000 16:05:08 -0500 Subject: dynamically extend classes References: <7kwvo1mbam.fsf@jpl.nasa.gov> Message-ID: <88n0c5$9qs$1@news.udel.edu> "Matt Wette" wrote in message news:7kwvo1mbam.fsf at jpl.nasa.gov... [posted and emailed] > Is there a way to dynamically extend classes in Python? > > I'd like to be able to have sitecustomize.py import a module > and add methods to a class so that later, when anohter modules > imports this module and uses the class it sees the added methods. > > Doable? According to doc, yes. Try an appropriate version of the following (untested). Let mymodule.py consist of myclass: pass #or whatever Add the following to sitecustomize.py: def mymethod(self, arg): pass #do whatever inport mymodule mymodule.myclass.mymethod = mymethod Mymethod is now a method of myclass just the same as if the def were instead in mymodule.py indented under the class definition. Terry J. Reedy From effbot at telia.com Sun Feb 27 18:19:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 27 Feb 2000 23:19:29 GMT Subject: Veeeeery Basic Question References: <38b99975.2288717@news.mindspring.com> Message-ID: <5iiu4.1278$mYj.192933888@newsa.telia.net> Eric Stewart wrote: > I guess this will be a CGI script that will run in the Directory > cgi-bin, which will be referenced by the HTML. sure. but if this is really your first script, you better play with it a while before you try to run it under the web server... > The image files which i will select from will be in a seperate > directory, i.e C:Web Stuff\Images > > Here is the problem I'm having. (Understand that I've NEVER written > anything before). How do I iterate over the image files in the > directory? I thought that a for loop would work. sort of... > > import random > > for myFiles in someDirectory: > myImage=random.choice(Myfiles) > return myImage here's a start: ... import os import random # get a list of files myFiles = os.listdir("c:/Web Stuff/Images") # pick a random file from that list print random.choice(myFiles) ... hope this helps (a little bit, at least) From neelk at brick.cswv.com Sun Feb 13 11:41:26 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 13 Feb 2000 16:41:26 GMT Subject: Fully Bracketed Syntax References: <65118AEEFF5AD3118E8300508B124877073D74@webmail.altiris.com> <882aqm$23s$1@vvs.superst.iae.nl> Message-ID: Carel Fellinger wrote: > Neel Krishnaswami wrote: > > > Dylan uses this style, but Modula-2 uses the Pascal BEGIN/END style. > > It has been a long time since I used Modula-2, but if memory serves me > right... and indeed according to my copy of the 3e edition of Wirth's > "Progr. in Modula-2" it sure does (okee, it uses END instead of ENDIF:) I just double-checked, and see that you are right and I was wrong. I just grabbed a listing of some Modula-2 code, and looked at it for BEGIN...END pairs; and when I saw them used in procedure declarations, I stopped looking at the rest of the code. Bad Neel. :) Here's a sample for people who wonder what I'm talking about: PROCEDURE UnifyArgs(list1, list2: TypeList); BEGIN IF (list1 = Empty) AND (list2 = Empty) THEN RETURN; END; IF (list1 = Empty) OR (list2 = Empty) THEN ErrorMod.Msg("Type clash"); ELSE UnifyType(list1^.head, list2^.head); UnifyType(list1^.tail, list2^.tail); END; END UnifyArgs; Neel From charleshixsn at earthlink.net Mon Feb 14 14:22:30 2000 From: charleshixsn at earthlink.net (Charles Hixson) Date: Mon, 14 Feb 2000 19:22:30 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: <38A855DC.2DDB5FBA@earthlink.net> Well, in Eiffel one would need to declare the inheritance pattern to by used by x wouldn't you? Where Python doesn't have declarations of variables. I suppose that one could interpolate a rule that said something like: "The value of a variable inherited from more than one ancestor class must be prefixed by the name of the class from which it was inherited." Which shouldn't break any code that was currently safe. The other alternative would be to require that those variables be renamed (in essence, the Eiffel solution) .. Thus: for Foo.x use fooX for Bar.x use barX etc. Neither solution seems to fit *really* nicely into Python. Neither clashes very badly. My personal preference is the renaming solution, because otherwise occasionally names will grow too long to be convenient. But it doesn't seem a difficult problem, merely a real one. Michael Hudson wrote: > neelk at brick.cswv.com (Neel Krishnaswami) writes: > > > > > 3. Multiple inheritance is unsound > > > > > > > > By 'unsound' I mean that a method call to a method inherited by a > > > > subclass of two other classes can fail, even if that method call > > > > would work on an instance of the base class. > > > > > > Unsure what this is about; am pretty sure nobody has complained about it > > > before. Certainly "depth first, left to right" is an unprincipled approach, > > > but in practice it's more than predictable enough to use. > > > > Here's some code: > > > > class Foo: > > x = 99 > > def frob(self): > > print "%d bottles of beer" % self.x > > > > class Bar: > > x = "bar" > > def wibble(self): > > print "Belly up to the " + self.x > > > > Note that all the operations on Foo and Bar work safely for direct > > instances of Foo and Bar. But if you define a subclass like so: > > > > class Baz(Bar, Foo): > > pass > > > > you can get type errors even though both of the superclasses have > > type-safe operations: > > > > >>> q = Baz() > > >>> q.frob() > > Traceback (innermost last): > > [...] > > TypeError: illegal argument type for built-in operation > > > > This is only an annoyance in day-to-day work, but it becomes a big > > problem if you are serious about building automatic code analysis > > tools for Python (eg for CP4E). This is because the soundness theorems > > needed to write things like soft typing tools no longer hold. :( > > How is this different from (excuse the dodgy syntax, I haven't done > much Eiffel): > > class FOO > feature > x: INTEGER > > feature frob: STRING is > do > Result = interpolate("%d bottles of beer",x.to_string) > end > end > > class BAR > feature > x: STRING > > feature wibble: STRING is > do > Result = concatenate("Belly up to the ",x) > end > end > > class BAZ > inherit FOO,BAR > end > > ? I mean, that won't compile, presumably, but in the case of a code > analysis tool there comes a point when it can just throw it's hands up > in the air and say "you're not playing by the rules, I give > up". Repeasted feature inheritance is not a solved problem in any > language I'm aware of. > > And in this case, the code has a bug, so code analysis catching it is > surely a good thing? > > not-at-understanding-yet-ly y'rs > Michael From eedalf at eed.ericsson.se Mon Feb 28 10:18:52 2000 From: eedalf at eed.ericsson.se (Alex Farber) Date: Mon, 28 Feb 2000 16:18:52 +0100 Subject: Embedding to C++: hooking up GNU readline Message-ID: <38BA91DC.B9446C15@eed.ericsson.se> Dear friends, I have a C++ application which embeds Python. To use the GNU readline library for input I run a separate thread, which calls readline(">>> "), then processes the input and passes the received char array to another function. And that function is hooked up to PyOS_ReadlineFunctionPointer. It works, but I have a problem: How do I know when to change the prompt from ">>> " to "... "? Is there some flag which I could check before calling readline(">>> ") or readline("... ")? Thank you for any hints Alex From J.C.Travers at durham.ac.uk Fri Feb 11 13:32:18 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Fri, 11 Feb 2000 18:32:18 +0000 Subject: Python binaries as zip archive Message-ID: <38A455B2.EEBFE3C7@durham.ac.uk> Is there anywhere I can download binaries for WinNT as a zip archive other than a self-extracting one. This is really anoying me. I need python on my user area at uni, but haven't got privaleges to extract the self-extracting archive. At the moment I'm using python1.4b3 as it has so far been the only winNT binaries I have found in a zip file. Cheers, John Travers From just at letterror.com Thu Feb 17 06:00:26 2000 From: just at letterror.com (Just van Rossum) Date: Thu, 17 Feb 2000 12:00:26 +0100 Subject: IDLE in any other GUI. In-Reply-To: <001301bf78fc$ecab3c40$dea0143f@tim> References: Message-ID: [Tim Peters] >The "deep" parts shared by IDLE and PythonWin are pointed to in IDLE's >EditorWindow.py, following the comment: > > # Tk implementations of "virtual text methods" -- each platform > # reusing IDLE's support code needs to define these for its GUI's > # flavor of widget. > >PythonWin uses an unrelated text widget, and so implements the methods >following this comment differently. All of the stuff for parsing Python >code, suggesting indentation (which is now as smart as the Emacs pymode -- >which means "very smart"), and doing various reformatting are written in >terms of these "virtual text methods". So while it remains woefully >underdocumented, in practice it will prove easier than you fear . Phew... I'll look into it again. Maybe it's also possible to factor out the Tk-dependencies of the object browser, if there are any in the first place. I meant to study Guido's tree widget stuff for a long time: apparently he's come up with some neat stuff... >There's one huge compromise: IDLE uses Tk-style text indices (line.column >strings, w/ various optional modifiers) throughout. Mark Hammond wrote a >layer around PythonWin's text widget (currently Scintilla, IIRC) to >translate its view of text indices to & from Tk's. This layer also contains >implementations for some Tk text commands, since they have to be spelled >*somehow* and Tk's spellings seem as good as anything else (e.g., text.get() >and text.delete() -- basic operations any text widget has to support). Sure. As for text indices, I see two options to nicely solve it ("solve" as in separate from Tk): - the Idle Tk back end (huh-huh) gets modified to use (line, column) tuples or - see the indices as an opaque type, specific to the implementation, and provide a standard interface that implements all neccesary text index math. >if-tk-isn't-a-platform-python-isn't-a-language-ly y'rs - tim ;-) Thanks Tim! Just From herzog at online.de Thu Feb 17 03:29:01 2000 From: herzog at online.de (Bernhard Herzog) Date: 17 Feb 2000 09:29:01 +0100 Subject: Where is Imaging.h? References: Message-ID: David Guertin writes: > Hi folks, > > Please pardon this python ignoramus, but I'm trying to compile the > source for Sketch 0.6.5 on a Red Hat Linux box. Compilation chokes > with the error: > > looking for include dir for Imaging.h under /usr/include/python1.5 > Imaging.h not found under /usr/include/python1.5 ! Imaging.h is the main include file of the Python Imaging Library (PIL). Sketch needs it to interface to PIL at the C-level. Unfortunately installing Imaging.h is not part of the standard installation procedure for PIL and none of the PIL RPMs I've seen so far includes it (apart from the one I compiled myself for SuSE 6.1 which it available on the Sketch webpage). So, you have to at least get the PIL sources and run its configure script to generate a platform specific headerfile. You can then use the --imaging-include option of Sketch's setup.py to specify your PIL source directory as the place to look for Imaging.h. HTH I think this is a good opportunity to suggest that extension modules that users may want to access at the C-level install the relevant header files somewhere under Python's standard include directory. I propose to put them into an "extensions" subdirectory. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From thomas at xs4all.net Sun Feb 13 05:25:34 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sun, 13 Feb 2000 11:25:34 +0100 Subject: Flamage's good for your health! In-Reply-To: ; from nobooze4u@BLAM!worldnet.att.net on Sun, Feb 13, 2000 at 12:09:53AM +0000 References: <2HZo4.4766$UP1.108282@bgtnsc05-news.ops.worldnet.att.net> <04t8as8gtcqbtv7lnjaqmshiftgfflam2h@4ax.com> <_q1p4.4868$LC4.123561@bgtnsc04-news.ops.worldnet.att.net> <20000212224414.I477@xs4all.nl> Message-ID: <20000213112534.M477@xs4all.nl> On Sun, Feb 13, 2000 at 12:09:53AM +0000, Forget it wrote: > > The limiting factor is *you*, the programmer, and your imagination. > Actually, the limiting factor is the user. The user isn't a programmer > and he needs something real simple that does _his_ job, not mine. Perl, > Python, are all nice toys, but neither fits the purpose. Hm, Python is a great language to teach stupid people. You do run the risk they might actually _learn_ something, though. I've seen it happen, it's not always pretty. > If people got no sense of humour, well, that's typical of programmers. > Especially those who waste their time with a disgusting half-assed > language like Python!!! Righto ! (We have to stop meeting like this... I think my wife is suspecting something) Python's-name-came-from-*somewhere*-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jstok at bluedog.apana.org.au Mon Feb 14 08:38:05 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Tue, 15 Feb 2000 00:38:05 +1100 Subject: Modules implicitly exposing exceptions from other modules Message-ID: I notice that the nntplib.NNTP class can throw exceptions from the underlying socket module without documenting them. What's good practice when your module involves exposing exceptions from an implementation module that client code might not necessarily be aware of? From aahz at netcom.com Sun Feb 20 10:17:21 2000 From: aahz at netcom.com (Aahz Maruch) Date: 20 Feb 2000 15:17:21 GMT Subject: Non-progrmmer wants to learn. References: <38afe6a3.179841@news.netdoor.com> Message-ID: <88p0i1$suk$1@nntp6.atl.mindspring.net> In article , Fredrik Lundh wrote: > > as for books, your best bets are O'Reilly's > "Learning Python" and Manning's "Quick Python". > neither is written for true beginners, so you might > wish to check them out in your local bookstore > before buying. TY Python by Ivan Van Laningham should hit the bookstores in a month or so, and it is aimed at beginners. ObDisclaimer: I received money for editing TY Python -- --- 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 Love does not conquer all. Humans are extremely flexible, usually more flexible than we're willing to admit. But some flexibility comes at a cost, and sometimes that cost is more than we can bear. From moshez at math.huji.ac.il Tue Feb 15 04:06:20 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Tue, 15 Feb 2000 11:06:20 +0200 (IST) Subject: Iterators & generators (RE: Real Problems with Python) In-Reply-To: <001e01bf7790$8bd74480$66a2143f@tim> Message-ID: On Tue, 15 Feb 2000, Tim Peters wrote: > That doesn't fit with Python at all, so I'm just trying to get the most > useful & conventional & well-behaved part: explicit generation when you ask > for it, at the function level. That would add enormous bang for the buck, > and greatly aid clarity when appropriately used. So that much is Pythonic > to the core. I'm a little ignorant on both the bang and the buck issues. While what Tim said certainly shows there's a big bang, I'm wondering about the buck. Modulu Stackless, what would it take to implement this? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From jasonic at nomadicsltd.com Fri Feb 18 18:12:48 2000 From: jasonic at nomadicsltd.com (Jason Cunliffe) Date: 18 Feb 2000 23:12:48 GMT Subject: creating a python excutable Message-ID: <01bf7a65$9e487ee0$033abcc3@indiana.pro-net.co.uk> Hello A friend needs to develpo a project where he can have end up with a simple executable - double click and run . I have been in gerneral enthusaitically promoting Python for the work he is doing, but could not answer his question to clearly describe how to make a simple excutable [win32] from his code. He is new to Python and under the impression it is not very easily doable. I am sure it can be done, but need some help [first for myself and then for him how to do this]. Apologies if this is a FAQ, but I am really looking for a 1.2.3 type tutoral on this paricualr issuea nd could not find thanks - Jason From mjmead at my-deja.com Sun Feb 20 11:52:31 2000 From: mjmead at my-deja.com (mjmead at my-deja.com) Date: Sun, 20 Feb 2000 16:52:31 GMT Subject: interactive window Message-ID: <88p64f$j02$1@nnrp1.deja.com> Is there a way to expose the interactive window as a com object? Thanx, Mike Mead Sent via Deja.com http://www.deja.com/ Before you buy. From ivanlan at callware.com Thu Feb 17 09:20:19 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 17 Feb 2000 07:20:19 -0700 Subject: Python misconceptions in IBM Ruby article... References: Message-ID: <38AC03A3.F3902107@callware.com> Hi All-- Moshe Zadka wrote: > > [Tim Peters wrote] > > Instead, after > > comp.lang.ruby is formed, we'll descend on it like a horde of enranged > > barbarians . > > [Ivan Van Laningham] > > What do you mean, "like"? I thought we _were_ barbarians, already fully > > equipped with ranges. > > No, no, Ivan, We're a cult. We will voodo Ruby until there is nothing left > but ashes. > Ah, yes. "Voodo", the way of voo, where practitioners engage in ritual combat with portable ranges. > either-that-or-we'll-call-in-the-psu-ly y'rs, Z. > -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 see_plus_plus at my-deja.com Thu Feb 17 20:39:39 2000 From: see_plus_plus at my-deja.com (see_plus_plus at my-deja.com) Date: Fri, 18 Feb 2000 01:39:39 GMT Subject: Python misconceptions in IBM Ruby article... References: <001d01bf7912$ef340800$dea0143f@tim> <38AB9B6E.599C1F3@callware.com> Message-ID: <88i7sr$2do$1@nnrp1.deja.com> What's that, Ruby? Let me find out what it is, learn it, and come back to teach you guys a civilized lesson, barbarians ! cpp In article , "John W. Baxter" wrote: > In article <38AB9B6E.599C1F3 at callware.com>, Ivan Van Laningham > wrote: > > > Hi All-- > > > > Tim Peters wrote: > > > > > > > [snip] > > > > > Instead, after > > > comp.lang.ruby is formed, we'll descend on it like a horde of enranged > > > barbarians . > > > > > > > What do you mean, "like"? I thought we _were_ barbarians, already fully > > equipped with ranges. > > Barbarians don't use ranges...they use open fires. --John > > -- > John W. Baxter Port Ludlow, WA USA jwbnews at scandaroon.com > Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Sun Feb 13 16:23:05 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 13 Feb 2000 16:23:05 -0500 Subject: Real Problems with Python In-Reply-To: Message-ID: <000d01bf7668$84028fe0$572d153f@tim> [NeelK] > In the long run, the solution is to use a conservative garbage > collection algorithm (such as the Boehm collector), [Tim] > "No chance" in CPython [...] [Fran?ois Pinard] > I'm not sure of the implications of the above, but one sure thing > is that I very much like the current implications of reference > counting. When I write: > > for line in open(FILE).readlines(): > > I rely on the fact FILE will automatically get closed, and very soon > since no other references remain. ... Yes, that's exactly the kind of thing that makes many CPython users consider RC to be "a feature". There's no reason at all to believe that CPython will ever give this up; even NeilS's BDW patch for CPython retains refcounting, simply for *speed* reasons (RC has excellent locality of reference, especially when trash is being created and recycled at high dynamic rates). just-repeating-"no-chance"-ly y'rs - tim From gpf at cyberdude.com Mon Feb 28 17:23:12 2000 From: gpf at cyberdude.com (gfahey) Date: Mon, 28 Feb 2000 17:23:12 -0500 Subject: Paid to surf References: Message-ID: Hey Julie..........how about getting "laid to surf" instead? The spelling alone here should indicate what you're dealing with fellow VH'ers. gregster "julie" wrote in message news:fsru4.2822$b75.7623 at news-server.bigpond.net.au... > Paid to surf > > > Hi im julie > , Did you know that you could > be paid, in US Dollars, just for being > connected to the internet? If you're > interested in making some extra cash, > reply with "Tell me more (at my89116) " And I'll tell > you what to doIf you're not interested, I sincerely > apologise for bothring you. > Goodluck & Have a nice day! From tmick at mail.com Mon Feb 7 14:56:21 2000 From: tmick at mail.com (tmick at mail.com) Date: Mon, 07 Feb 2000 19:56:21 GMT Subject: 64-bit port of Python (was: Circular references and python) References: <001901bf6faf$359ced60$182d153f@tim> Message-ID: <87n811$2r5$1@nnrp1.deja.com> In article <001901bf6faf$359ced60$182d153f at tim>, "Tim Peters" wrote: > One day (early 90's), right after lunch, I started the first port of Python > to a 64-bit platform, before I had ever looked at its code -- and finished > the same day. IIRC, it turned up two spots where the code implicitly > assumed sizeof(int) == sizeof(long), and that was it (some subtler stuff > turned up later, but it was by far the easiest port of *any* large C program > to the Kendall Square architecture; Tim, I presume that this was a port to the UNIX 64-bit data model LP64 and not the Windows LLP64 data model where you can no longer implicitly assume that sizeof(long) == sizeof(void *). Do you know of anyone, other that myself, that is interested in looking at these issues in the Python source? As well, I would be interested to know what the "subtler stuff" was. Trent Sent via Deja.com http://www.deja.com/ Before you buy. From wlfraed at ix.netcom.com Wed Feb 9 01:06:20 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Tue, 08 Feb 2000 22:06:20 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <87on3m$p2i$1@mach.vub.ac.be> Message-ID: On 8 Feb 2000 09:19:50 GMT, Thomas Hamelryck declaimed the following in comp.lang.python: > > I am in exactly the same position. It was a serious design error. > I wonder how the CP4A people are going to explain to complete > computer illiterates that a python program can contain errors that > are _not even visible_ when you look at the code. > The same way the DEC (Compaq ) folks can explain that a Fortran program can have errors which are not visible if the source is printed on paper. Namely, DEC VMS F77 counts a tab as 1 character. 0 1 2 3 4 5 6 123456789012345678901234567890123456789012345678901234567890123456 This_variable = Something * Another Are there 63 characters on that line? Not as I entered it -- to VMS F77 there are only 36. Lines can extend to "character 72" before the excess is considered in the "comment / sequence # zone". As a result, one can enter valid lines using tabs that extend beyond column 72 (and even off the edge of the traditional 80 column terminal display). If that source line is fed through some utility that turns the tabs into equivalent spaces, the valid line now fails to compile (and if you are lucky you get a compile error -- it is possible for the "truncation" of stuff past column 72 to result in a valid, but erroneous, line). -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From tjreedy at udel.edu Sun Feb 27 00:34:31 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 27 Feb 2000 00:34:31 -0500 Subject: functional programming References: <38B2CE44.CB9B41A9@roguewave.com> Message-ID: <89achq$g33$1@news.udel.edu> "bjorn" wrote in message news:38B2CE44.CB9B41A9 at roguewave.com... >Maybe I'm dense, but what is stopping us from implementing tail call >optimization (of which tail recursion is just a special case) with the current >Python implementation. Identifying a call in a tail position is a simple >static analysis that isn't affected by Python's dynamicity (is that a word?). But as Guido has pointed out, the recursiveness of the call is. Consider the following apparently foolish but currently legal code: >>> def g(n): print n ... >>> def f(n): ... f = g ... return f(n-1) ... >>> f(3) 2 >>> def f(n): ... global f ... f = g ... return f(n-1) ... >>> f(3) 2 >>> f >>> f(3) 3 >>> In either case, f looks recursive but is not, so any optimizer would have to identify such exceptions. Terry J. Reedy From loewis at informatik.hu-berlin.de Mon Feb 14 11:33:13 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 14 Feb 2000 17:33:13 +0100 Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: Fran?ois Pinard writes: > I'm not sure of the implications of the above, but one sure thing is that I > very much like the current implications of reference counting. When I write: > > for line in open(FILE).readlines(): > > I rely on the fact FILE will automatically get closed, and very soon since > no other references remain. I could of course use another Python line for > opening FILE, and yet another for explicitely closing it, as I was doing > in my first Python days, but I learned to like terse writings like above, > and I do not think there is any loss in legibility in this terseness. Indeed. I think Tim's right here (as always:); if the request for garbage collection is rephrased as 'reclaim cycles', everybody will be happy. Regards, Martin From rchowd1 at my-deja.com Fri Feb 4 13:48:39 2000 From: rchowd1 at my-deja.com (rchowd1 at my-deja.com) Date: Fri, 04 Feb 2000 18:48:39 GMT Subject: Connecting to MYSQL using PYTHON Message-ID: <87f6u5$j58$1@nnrp1.deja.com> What is the python module required in 1. UNIX 2. Windows95/98 to connect to a MYSQL db. What are the function calls from the python script to connect to MYSQL DB ? Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Sun Feb 27 03:22:05 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 03:22:05 -0500 Subject: Q about tail recursion In-Reply-To: Message-ID: <000601bf80fb$bbabac40$172d153f@tim> org [Fran?ois Pinard] > By the way, I sometimes hesitate at having an explicit: > > return None > > as the last line of a function. I guess I usually give in > writing it, would it be only as some kind of documentation, but > then (being anal myself :-) I would consider as a style bug not > doing it always, if I do it sometimes. (It would of course always > be OK _not_ writing that line for `def's not meant to return a > usable value.) > > I wonder a bit. Is there any common wisdom about this detail? I think you've already divined it: if a def is really "a procedure" (never "meant to return a usable value"), never code "return None". If a def is really "a function" (always "meant to return a usable value"), always code "return None" on any path where you intend to return None, and even consider putting "assert 0" at the end of the function if you never expect to "fall off the end". And if a def is sometimes meant to return a value and sometimes not, redesign the code before you drive yourself insane . rigidity-is-freedom-ly y'rs - tim From kcazabon at home.com Thu Feb 24 01:26:30 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Thu, 24 Feb 2000 06:26:30 GMT Subject: TK and PhotoImage: Problem getting image to display References: <38B4774E.9BE01006@exceptionalminds.com> Message-ID: The first thing I'd do is the following: > class Quoter: > def __init__(self, master): > self.qFrame = Frame(master) > self.qFrame.pack(side=TOP) > > #qCompanyLogoCanvas = Canvas(qFrame, width=275, height=50) > #qCompanyLogoCanvas.pack(side=LEFT) > > self.img = PhotoImage(file='amos3.gif') > self.qAMOSLogoCanvas = Canvas(qFrame, width=300, height=300) > self.qAMOSLogoCanvas.create_image(0, 0, anchor=NW, image=self.img) > self.qAMOSLogoCanvas.pack() > What this does is ensures the persistence of the objects, by making them a static part of "self". Otherwise, they might appear for a fraction of a second, but be 'cleaned up' by automatic garbage collection. Kevin Cazabon. "Timothy Grant" wrote in message news:38B4774E.9BE01006 at exceptionalminds.com... > Hi all, > > Just started playing with some of the image aspects of Tkinter, and I > immediately ran into a roadblock. I found a similar problem in the > archives, but I can't get the resolution to work for me. Given the code > below, I successfully create the canvas, but can't for the life of me > figure out how to get my gif to display inside the canvas. > > All suggestions greatfully accepted... > > > from Tkinter import * > > class Quoter: > def __init__(self, master): > qFrame = Frame(master) > qFrame.pack(side=TOP) > > #qCompanyLogoCanvas = Canvas(qFrame, width=275, height=50) > #qCompanyLogoCanvas.pack(side=LEFT) > > img = PhotoImage(file='amos3.gif') > qAMOSLogoCanvas = Canvas(qFrame, width=300, height=300) > qAMOSLogoCanvas.create_image(0, 0, anchor=NW, image=img) > qAMOSLogoCanvas.pack() > > if __name__ == '__main__': > root = Tk() > Pmw.initialise(root) > > root.title('AMOSoft Quoting') > > quoter = Quoter(root) > > root.mainloop() > > > > -- > Stand Fast, > tjg. > > Chief Technology Officer tjg at exceptionalminds.com > Red Hat Certified Engineer www.exceptionalminds.com > Avalon Technology Group, Inc. (503) 246-3630 > >>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<< > From loewis at informatik.hu-berlin.de Tue Feb 22 06:54:13 2000 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: Tue, 22 Feb 2000 12:54:13 +0100 Subject: Formatting a numerical string w/commas In-Reply-To: <38B1C508.5D4BF97A@roguewave.com> (message from bjorn on Mon, 21 Feb 2000 16:06:49 -0700) References: <200002212202.RAA17807@csa.bu.edu> <38B1C508.5D4BF97A@roguewave.com> Message-ID: <200002221154.MAA02741@pandora> > Hmmm.... this is actually interesting ;-) > > _locale seems to be built in on my windows box, but not on my linux > or hp boxes... As with all builtin modules relying on extended libraries: You'll have to specify which libraries you want by modifying Modules/Setup when compiling Python. With the _locale module, you only need the standard locale functions in the C library, so it should work on must current systems. Still, the Python installation mechanism is not autoconfiscated to the degree that it figures out what extension modules to use. Apparently, most Linux distributors don't think this function important enough to activate it by default - complain to your Linux vendor :-) As for Python on hpux, it is probably your own fault that it is not available. On Windows, these things are much easier, because only a single vendor decides what base libraries and functions are available ;-) and locale functions are part of that. Regards, Martin From mhammond at skippinet.com.au Mon Feb 14 23:48:55 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 15 Feb 2000 04:48:55 GMT Subject: Question concerning makepy.py for COM (long, code included) References: <38A804F6.FC0E3EAC@ttm.com> Message-ID: "Scott Anderson" wrote in message news:38A804F6.FC0E3EAC at ttm.com... > Interesting. I get this error on properties, methods, everything. > > Perhaps the control has some internal initialization that occurs only > after it has been dropped on a VB form. Yes - this is likely. PythonCOM doesnt attempt to be a "control container" which is necessary for some GUI based controls. You should be able to get this going via Pythonwin tho (but that could do with some work too :-) Mark. From bawolk at pacbell.net Tue Feb 29 22:36:24 2000 From: bawolk at pacbell.net (Bruce Wolk) Date: Tue, 29 Feb 2000 19:36:24 -0800 Subject: coding random selection from list References: <38BC8829.A99D1E74@mediaone.net> Message-ID: <38BC9038.E2D922D@pacbell.net> Actually, the following is even simpler: import random random.choice(list) Cheers, Bruce doyen at mediaone.net wrote: > > def returnname(list): > return list[random.randint(0,(len(list)-1))] # returns a random > selection from a list > > It seems to work, is it correct and efficient? > > doyen at mediaone.net From deighan at vt.edu Tue Feb 22 14:19:21 2000 From: deighan at vt.edu (John Deighan) Date: Tue, 22 Feb 2000 14:19:21 -0500 Subject: Mac OS X threads Message-ID: <88unfq$4jn$1@solaris.cc.vt.edu> I was able to compile Python under Mac OS X. However, when I tried to install Zope (www.zope.org), it said that it needed Python with thread support. When I tried to recompile Python with thread support (using "configure --with-threads), it failed because it couldn't link to 3 thread-related functions. Can anyone help? From prudek at nembv.cz Thu Feb 24 07:32:56 2000 From: prudek at nembv.cz (Milos Prudek) Date: Thu, 24 Feb 2000 13:32:56 +0100 Subject: walk library function Message-ID: <38B524F8.88A5D43F@nembv.cz> I do not quite understand walk library function. Python Library Reference says that walk calls function 'visit'. - What is visit's syntax? - Or does 'visit' stand for any external program, like 'ls -l'? - If walk has parameters (path, visit, arg), what is the description of parameters (arg, dirname, names) which are used for 'visit'? -- Milos Prudek From pehr at pehr.net Mon Feb 14 23:41:57 2000 From: pehr at pehr.net (pehr anderson) Date: Tue, 15 Feb 2000 04:41:57 GMT Subject: Python on the Palm Message-ID: <38A8D6E6.A18DBCE5@pehr.net> Dear Palmist Pythoneers, Ever wanted python on your palm pilot? So have I, unfortunately I haven't the foggiest idea if it is even possible. Anywy, to kick off the concept I have posted a ridiculous $500 bounty on cosource. (ridiculously small for the insane amount of work) So far I've had skeptecism, humor, but no hard evidence that it is impossible. PLEASE DON'T FORCE ME TO SUFFER THE AUTROCITIES OF LISP! I just to use a decent scripting language in my palm. Is that too much to ask? If so, please shoot me now. The full extent of my pathetic pleadings are at this URL: http://www.cosource.com/cgi-bin/cos.pl/wish/info/237 -pehr From glen at electricorb.com Wed Feb 2 07:53:41 2000 From: glen at electricorb.com (Glen Starchman) Date: 2 Feb 2000 06:53:41 -0600 Subject: kjParser Problem Message-ID: <38982697.76C77FD6@electricorb.com> I am having a horrible time with the following in kjParser and am wondering if a) anyone has any suggestions on how to make it work with kjParser, or, b) if anyone suggests that I dump my kjParser-based parser and untilize SPARK. The problem is this: I have a production for invoking a member function of a class that looks like (excuse the sloppy rules, it was written very quickly): @R InvokeRule :: Value >> var => var called_with_statement @R CalledWithRule :: called_with_statement >> args @R CalledWith2Rule :: called_with_statement >> so, this will match: x=> y() or x => y or x => y but not x=y() any ideas? Any help is GREATLY appreciated! From nobooze4u at BLAM!worldnet.att.net Sun Feb 13 17:50:10 2000 From: nobooze4u at BLAM!worldnet.att.net (Forget it) Date: Sun, 13 Feb 2000 22:50:10 GMT Subject: New to programming and python References: <886vdb$slk$1@nntp8.atl.mindspring.net> Message-ID: x-no-archive: yes hanselj at mindspring.com wrote: > I have one question; What is the book python book for newbies. Download the package documentation--it's got a bunch of .pdf books, including a tutorial. I'm new too and I just did and it's a fine bunch of books. www.python.org From calishar at *NOSPAM*home.com Sat Feb 5 10:30:54 2000 From: calishar at *NOSPAM*home.com (Calishar) Date: Sat, 05 Feb 2000 15:30:54 GMT Subject: Freezing an app using win32com and wxPython References: <87ckq3$ot1$1@nnrp1.deja.com> Message-ID: On Fri, 04 Feb 2000 23:16:56 GMT, "Mark Hammond" wrote: > wrote in message >news:87ckq3$ot1$1 at nnrp1.deja.com... >You should be very close. If you can make the nominated modules >available then life should be good. What specific problem do you >have? > Hi Mark, When I have installed the application on my test (never had python installed) system, and try to run it, I get the following. Initialsing 'pywintypes' Initialising 'pythoncom' Initialising 'win32ui' Traceback (innermost last): File "c:\progra~1\python\sifex\sifex.py", line 1, in ? File "C:\PROGRA~1\PYTHON\win32com\client\__init__.py", line 8, in ? File "C:\PROGRA~1\PYTHON\win32com\client\dynamic.py", line 22, in ? ImportError: DLL load failed: A device attached to the system is not functioning. I have copied python15.dll, python15.lib, pythoncom15.dll, and pywintypes.dll to the c:\windows\system directory, and I have setup registry entried pointing to pythoncom15 and pywintypes (under Local_Machine\Software\\Python\PythonCore\Modules (actually I exported the regeistry entries for these modules from my development system) In the programs installed directory, I have the pyds for win32api, win32ui, and wxc (needed for wxPython). I have taken a look at line 22 (and the 22nd line ignoring blanks, and the 22nd line of programming code, excluding comments, docstrings, and blanks) and am not getting any reference to win32com.client.dynamic, however line1 is the following line import win32com.client, win32com # win32com imports for freeze I added an import of win32com to rty to fix the problem, but it didn't work. Any help you can give would be much appreciated, my sales rep told the client I would be finished for wednesday.... Nigel From steve.mnard at sympatico.ca Tue Feb 22 14:40:43 2000 From: steve.mnard at sympatico.ca (Steve Menard) Date: Tue, 22 Feb 2000 14:40:43 -0500 Subject: Which GUI? References: <20000221104750.25346.qmail@web3607.mail.yahoo.com> <20000221163016.B2377@stopcontact.palga.uucp> <88tkob$jqd$1@nnrp1.deja.com> <38B2910B.A0AD14C3@bellatlantic.net> <88ub7v$376$1@nnrp1.deja.com> <38B2C811.25D01A87@roguewave.com> Message-ID: > > [suggesting Tkinter interface to all other GUI toolkits similar to > > what's been done in Piddle and the DB-SIG] > > > > I'm sure there are nasty side-effects to that. Ideas? > > There are only two obvious ones, (i) you'd have to start by defining a > Tkinter interface, including semantics, that is independent of Tcl/Tk; > and (ii) since not all GUI toolkits would support all of the new > "Tkinter" interface, many users would end up having to program to a > 'lowest-common-denominator'. > > Personally, I think this would be a "good thing" for Python, and for GUI > toolkits that allready have Python bindings, a first approximation > (though not trivial) would be relatively easy to prototype... > > -- bjorn This is more or less what I am currently doing. I need my program to run on both CPython (using wxPython as the GUI) and JPython (Using Swing as the gui). I am currently defining gui architecture that is somewhat removed from the actual toolkit. Then mapping it to these toolkits is relatively easy. From daniels at mindspring.com Sat Feb 26 00:08:24 2000 From: daniels at mindspring.com (Alan Daniels) Date: 26 Feb 2000 05:08:24 GMT Subject: pythonian way References: <38B6303B.BB75DC56@nembv.cz> Message-ID: >A = [] >for Line in H.readlines(): > if Line not in ("", "\n"): > A.append(Line) Doh! Just remembered, any line returned from readline or readlines will *never* be empty (as in ""), so there's no need to check for it. Just checking Line != "\n" should do everything you want. Why oh why do I post *anything* past 11:00 in the evening? Like-correcting-your-own-posting-isn't-bad-enough-ly yours, Alan. -- ======================= Alan Daniels daniels at mindspring.com daniels at cc.gatech.edu From ra_sekhon at my-deja.com Thu Feb 10 15:02:50 2000 From: ra_sekhon at my-deja.com (ra_sekhon at my-deja.com) Date: Thu, 10 Feb 2000 20:02:50 GMT Subject: usage of os.environ. How to unset something Message-ID: <87v5h0$qjl$1@nnrp1.deja.com> Hi, Starting out in Python. Current assignment requires to verify if a variable exists via os.environ['variable_name'] test. If it does then I need to 'unset' it. Similar to unset variable_name call in a shell. Any suggestions? Regards, Ravinder Sekhon ra_sekhon at yahoo.com Sent via Deja.com http://www.deja.com/ Before you buy. From pinard at iro.umontreal.ca Tue Feb 22 22:08:08 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 22 Feb 2000 22:08:08 -0500 Subject: functional programming In-Reply-To: neelk@brick.cswv.com's message of "23 Feb 2000 00:20:04 GMT" References: Message-ID: neelk at brick.cswv.com (Neel Krishnaswami) ?crit: > Whenever I have code that needs to be thread-safe, I find it tons easier > to write in a functional style than worry about locking and race conditions > and reentrancy and awful things like that. I see. Thanks for the hint. I might use it one day... > > P.S. - Yes, I know it has been theoretically proven that we could design > > computers needing no energy, if we could fully avoid side-effects, but I > > beg to do not consider this a practical advantage yet. :-) > Actually, this *isn't* so! Oh, this was proven in the field of quantic computing, if I remember what I've heard. I'm not especially knowledgeable in either thermodynamics nor quantum physics, so I'm not going to argue either way! > Here's the critical bit: this means that resetting those bits > decreased the information in the system! Resetting a bit _is_ a side effect. The statement was that that a computing device might use zero energy if without side effects. Surely not a traditional computer... P.S. - Thanks for the entertainment in your previous message! :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jbauer at rubic.com Tue Feb 22 09:05:05 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Tue, 22 Feb 2000 08:05:05 -0600 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 References: <000401bf7d07$59acc080$e82d153f@tim> Message-ID: <38B29791.2E26D414@rubic.com> [ discussion of join method ] Tim Peters wrote: > Write it this way instead, and it reads beautifully & naturally: > > tab = "\t"; space = " "; nospace = "" > > tab.join(list_of_strings) > space.join(ditto) > nospace.join(user_sequence) Tim, Not really relevant to your reply to Greg, but it might be nice to have 'space' and 'tab' attributes added to the next release of the string module. We already have a 'whitespace' variable and if ' '.join(ditto) ever catches on, space.join(ditto) might improve readability. I'm not so sure about nospace, though. What's a notab supposed to be? '-'.join("uncharacteristically","sincere","ly","y'rs") -Jeff From peter.stoehr at sdm.de Fri Feb 25 07:14:02 2000 From: peter.stoehr at sdm.de (Peter Stoehr) Date: Fri, 25 Feb 2000 13:14:02 +0100 Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> <8945c6$a8j$1@nnrp1.deja.com> Message-ID: <38B6720A.760F6EB7@sdm.de> piet at cs.uu.nl schrieb: > > >>>>> see_plus_plus at my-deja.com (spp) writes: > > spp> Wait & See. > spp> This new compiler is coming out from the same country where Mercedez, > spp> BMW & Porsche are produced. You know the quality of those cars, do you? > spp> cpp > > Like the Mercedes A-model that flipped over when you took a curve too fast. This is not quite right. It flipped over as soon as a moose was visible. That's why this behaviour didn't show up during the tests in Germany :-) Peter -- Dr. Peter Stoehr mailto:peter.stoehr at sdm.de sd&m AG http://www.sdm.de software design & management Thomas-Dehler-Strasse 27, D-81737 Muenchen, Germany Tel ++49 89 63812-783, Fax -444 From sholden at bellatlantic.net Wed Feb 23 14:52:55 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 19:52:55 GMT Subject: PYTHONPATH on PC References: <38B43641.7A8F5CF0@hpl.hp.com> Message-ID: <38B43A9A.3D277150@bellatlantic.net> Let's also not forget that this kind of stuff can be put in a "sitecustomize" module. I use this both to add my personal directories and to remove some annoying duplication from the path due to Windows' case-insensitivity: """Site customization for holdenweb.com - Windows platforms.""" import sys, string path = sys.path[:] sys.path = [] for p in path: p=string.lower(p) if p not in sys.path: sys.path.append(p) sys.path.append(r"D:\Steve\Projects\Python") regards Steve David Smith wrote: > > Mikael Olofsson wrote: > > > I thought you were supposed to do > > > > import sys > > sys.path.append('whateverpath') > > import yourmodule > > > > At least that's what I do on Unix. > > Yes, you're right. That works. And now, I don't know why I couldn't remember > or find this: I have even been over that territory before. I guess it's just > part of learning a bunch of new stuff at once. Thanks a lot. > > David Smith -- "If computing ever stops being fun, I'll stop doing it" From ullrich at math.okstate.edu Tue Feb 15 13:34:28 2000 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 15 Feb 2000 12:34:28 -0600 Subject: "Real" problem... Message-ID: <38A99C34.109D34BB@math.okstate.edu> Well, this time I started at python.org, and sure enough I found what I was looking for, an arbitrary-precision floating point package. Or so it seemed - Netscape and urllib.urlretrieve both whine about 'cannot find file or directory'. What I'm looking for is ftp://ftp.python.org/pub/python/contrib/Math/real-accurate.pyar , which is a link I found at http://www.python.org/topics/scicomp/numbercrunching.html . Thanks. DU From grant at nowhere. Mon Feb 14 13:52:26 2000 From: grant at nowhere. (Grant Edwards) Date: Mon, 14 Feb 2000 18:52:26 GMT Subject: TCL has Tk... References: <14504.14805.107030.838217@weyr.cnri.reston.va.us> Message-ID: In article <14504.14805.107030.838217 at weyr.cnri.reston.va.us>, Fred L. Drake, Jr. wrote: >Grant Edwards writes: > > Modula-3 has it's own widget set and windowing system. Don't > > know if that has contributed to it's success or not. > > Have you ever used it? Yes, albeit only for a trivial example program. I rather liked the glue-and-boxes way of packing things (but as a TeX user of 10+ years, that's not too surprising). It always takes me a number of trial-and-error iterations with Tk's packing parameters to get things to resize the way I want them to. I've used Tk off and on for several years, and I still don't have a good understanding of the packing options. I also liked the ability to save the packing organization as an external resource. I did miss the ability to hook widgets directly to variables the way you can in STk -- Having to call get() and set() methods of widgets certainly makes the connections between application code and widgets explicit, but at least for small examples it's pretty verbose. But, as I said, I only played with a small demo program. There may be other shortcomings that aren't apparent until you play with a larger application. The main drawback [and the somewhat opaque point of my original post] of the M3 widget set is that it is M3 specific, and knowing that widget set isn't a portable asset the way knowing gtk or Tk is. Learning a new language is one thing. Learning a new widget set is another [IMO, harder] thing. I think Python is well served by having bindings to widget sets that people already know how to use. I've no objection to somebody who wants to invent yet another widget set, but it should be done because you want a new widget set, not because you want Python to have it's own widget set. >I'd say it's a point against. Modula-3 is nice, but the widget >set didn't behave in a way that I liked whenever I played with >the sample code. It was enough that I didn't use it for any >GUI work, though I liked the language and the "Network Objects" >support. I quite like the M3 language, and think it's one of the better choices for developing large and/or distributed applications. It does require a bit of user-overhead to configure an application directory structure and "makefile" setup, so it's not really suitable for slapping together a small throw-away utility -- Python is a much better choice for that. -- Grant Edwards grante Yow! A shapely CATHOLIC at SCHOOLGIRL is FIDGETING visi.com inside my costume... From nobody at nowhere.nohow Fri Feb 18 00:30:58 2000 From: nobody at nowhere.nohow (Grant Edwards) Date: Fri, 18 Feb 2000 05:30:58 GMT Subject: Help needed writing GUI comparison References: <20000217221452.A2943@stopcontact.palga.uucp> <38AC6BFD.D8A7598C@callware.com> <38AC9E96.FDAE287C@prescod.net> Message-ID: On Thu, 17 Feb 2000 17:21:26 -0800, Paul Prescod wrote: >So the idea is you walk around reading the book for one day (no sleep, >no breaks) and by the end you're a Python expert. I could see that being >valuable for people who pad their resumes and then need to cram before >their first day of work. Think of it as the educational equivalent of demand paging. No point in loading all that knowlege in ahead of time when you don't know which parts of it are actually going to be needed... -- Grant Edwards grante Yow! A shapely CATHOLIC at SCHOOLGIRL is FIDGETING visi.com inside my costume... From tdfunk at nettally.com Thu Feb 24 16:23:29 2000 From: tdfunk at nettally.com (Tom Funk) Date: Thu, 24 Feb 2000 16:23:29 -0500 Subject: COM and python References: <04e9bbf8.f292f07f@usw-ex0106-048.remarq.com> Message-ID: ASCarpenter wrote.... > Also, does anyone know if this is covered in Mark's book (guess > I'll drop a name because I see it so often here), in which case I > can wait for that to turn up. I have to give Mark credit for being humble -- he followed up the article but didn't plug his most-excellent book. I on the other hand want *everyone* (who programs Python on Win32, anyway) to know about this book. Yes, COM and Python, acting both as server and as client, are covered in some detail in Mark's book. If you haven't already, I'd definitely get _Python Programming on Win32_. I've read it cover to cover and now I'm going back over it detail. I even learned a couple things about patterns and Python itself. I give it a *Highly* Recommended rating. If you go to the Python bookstore (http://www.python.org/psa/bookstore), follow the link for PPoW32, and purchase the book from Amazon.com, the PSA gets a "kick-back" in Dollars-American. -=< tom >=- Thomas D. Funk (tdfunk at asd-web.com) | "Software is the lever Software Engineering Consultant | Archimedes was searching for" Advanced Systems Design, Tallahassee FL. | From darrell at dorb.com Tue Feb 15 17:57:18 2000 From: darrell at dorb.com (Darrell) Date: Tue, 15 Feb 2000 17:57:18 -0500 Subject: Iterators & generators (RE: Real Problems with Python) References: <001e01bf7790$8bd74480$66a2143f@tim> Message-ID: <011d01bf7808$026a5de0$0101a8c1@server> From: "Tim Peters" > > I agree, but it's gotten "better" this way, mostly via little things like > the addition of dict.get() and 3-argument getattr -- not everything is > better spelled on 4 lines . Is there a 3-argument getattr in the CVS version ? --Darrell From effbot at telia.com Wed Feb 9 15:16:45 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 09 Feb 2000 20:16:45 GMT Subject: Colour `curses'? References: Message-ID: Fran?ois Pinard wrote: > Hi, everybody. I do not see that `import curses' gives access to terminal > colour. Shouldn't it? Or is there some trick to know? the "official curses howto" http://www.python.org/doc/howto/curses/ has the full story -- in short, "curses" doesn't support ncurses extensions (including colour), but the "ncurses" module does: http://andrich.net/python/selfmade.html#ncursesmodule (but you really should get yourself a bitmapped display ;-) hope this helps! From moshez at math.huji.ac.il Sat Feb 12 01:07:06 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Sat, 12 Feb 2000 08:07:06 +0200 (IST) Subject: data structure design question In-Reply-To: <3.0.5.32.20000211201826.00825e10@mail.dicksonstreet.com> Message-ID: On Fri, 11 Feb 2000, Felix Thibault wrote: > I'm thinking of trying to do some chemistry stuff in > Python, and one of the things I was thinking of was > to define a Chemical (or Molecule) object. On paper > chemicals are represented by stuctures like: > > H > | > C=O > | > H > > so I thought I could initialize instances with some values > that mimic what we draw. All I've come up with so far is either > > #make instances of the constituent elements > h1, h2, c, o = H(), H(), C(), O() Hmmm...why not have a generic Atom: h1 = Atom('H', 1) (actually, the 1 is superfluous: you can have a table mapping name to number of electrons on the outer level (is that it?)) > #initialize with a dictionary of who's connected to who > formaldehyde = Chemical({h1:[c], h2:[c], c:[h1, h2, o, o], o:[c, c]}) I think this solution is great. Just have a Chemical.add_atom(atom, connected_to) Chemical.remove_atom(atom) Raise a ChemistryError (expolosion ) if you need more connections then you have. Have an is_stable() method, if all connections are full.... Seems like a great way! (Note: anything connected to chemistry knowledge is 11 years old, so take it with a grain of salt) > The dictionary method seems more condensed and readable, so I > am preferring it right now, even though I would have to make a > new instance for every atom of an element That's a good thing. Every atom *is* a new instance of the atom class. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From tomh at po.crl.go.jp Thu Feb 24 21:32:28 2000 From: tomh at po.crl.go.jp (Tom Holroyd) Date: Fri, 25 Feb 2000 11:32:28 +0900 Subject: PROPOSAL: fix tabs & spaces in default library In-Reply-To: <38B343D2.4D935CDA@cosc.canterbury.ac.nz> References: <20000213201812.A4849@stopcontact.palga.uucp> <38B343D2.4D935CDA@cosc.canterbury.ac.nz> Message-ID: On Wed, 23 Feb 2000, Greg Ewing wrote: > For even greater perfection, I think that all lines should > end with the word "spam" spelled out in Morse code using > tab for dash and space for space. FYI, "spam" in Morse code is: ... .--. .- -- From tom at parlant.com Tue Feb 15 16:57:49 2000 From: tom at parlant.com (Thomas Lane) Date: Tue, 15 Feb 2000 14:57:49 -0700 Subject: resizing Tkinter widgets References: <38A9C494.D4B9CB5A@parlant.com> Message-ID: <38A9CBDD.7A87C65E@parlant.com> I think I found a solution to my own problem. I was able to call the "place_forget" method and then "place" them again to alter position/size. Someone correct me if this is not the right way to do it, but for now, that's what I'll do since it works. Thomas Lane Thomas Lane wrote: > > I'm a newbie to Tkinter, so please forgive me if I've missed something > obvious, but I'm trying to resize widgets, such as frames, lists, etc. > at run-time when a window is resized. I've bound a method to the > event, and it gets called when the window is resized, but > when I call the methods to resize the widgets, nothing happens, ie. I > call widget.configure( width="XXX", height="YYY" ), but the size of > widget remains the same. I'm using the "Place" geometry manager, if that > makes any difference. What am I doing wrong? Any help would be > appreciated. > > Thomas Lane > Parlant Technology > Provo, UT > tom at parlant.com From gerrit.holl at pobox.com Wed Feb 23 02:33:25 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Wed, 23 Feb 2000 08:33:25 +0100 Subject: Which GUI? In-Reply-To: ; from vetler@ifi.uio.no on Tue, Feb 22, 2000 at 11:05:41PM +0100 References: <20000220194012.A2069@stopcontact.palga.uucp> <20000222224057.G4549@stopcontact.palga.uucp> Message-ID: <20000223083325.B1000@stopcontact.palga.uucp> > * Gerrit Holl > > * Tkinter is built on Tcl/Tk, but because the bridge between > > Tkinter and Tcl/Tk is too large, Tkinter needs to provide their > > own documentation and advantages. > > It has already been mentioned in another posting that Tkinter in fact > does *not* depend on Tcl. (It was Fredrik Lundh in > ). Even worse. Tkinter needs to provide their own documentation and advantages, while wxWindows or QT already has lots of documentation, that not need to be copied into wxPython and PyQT. I repeat: Tkinter reinvents the wheel. WxPython uses existing code. Tell me, what's more OO? regards, Gerrit. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From hanche at math.ntnu.no Sat Feb 12 18:22:22 2000 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 12 Feb 2000 18:22:22 -0500 Subject: TCL has Tk... References: Message-ID: + "Robert Hicks" : | Why can't Python have its own widget set instead of using Tk or wxPython? Why should Python have its own widget set instead of using Tk or wxPython? -- * Harald Hanche-Olsen - "There arises from a bad and unapt formation of words a wonderful obstruction to the mind." - Francis Bacon From sholden at bellatlantic.net Thu Feb 24 13:20:18 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Thu, 24 Feb 2000 18:20:18 GMT Subject: regular expression References: Message-ID: <38B57650.16ED9DD2@bellatlantic.net> courtneyb wrote: > > I am writing a web interface. I need to grab a web page, and parse for > the content between the
 and 
tags. I figured I would use > regular expressions...below is the code: > [code snipped] > courtneyb > courtneyb at big-c.com Rhe best way to handle almost any kind of HTML comprehension is the htmllib library. I wanted to pull out anchors and handle them (I eventually determined I was initially replicating webchecker from the distributed Tools directory, but I later diverged enough to justify my own code). Basically, establish a class which inherits from htmllib.HTMLParser, and then override the tag processing methods you don't like. Here's my modified parser, where the close() method returns a list of the HREF properties from the anchor tags: import htmllib from urllib import basejoin class myHTMLParser(htmllib.HTMLParser): """Modified to return URL references as a list after parsing.""" def __init__(self, formatter, URL, verbose=0): htmllib.HTMLParser.__init__(self, formatter, verbose) self.rootURL = basejoin("http://",URL) self.URLstore = [self.rootURL] def build_hrefs(self): """Build the list of unique references from the anchor list.""" # XXX need to treat http://hostname # and http://hostname/ as equivalent if self.base is None: base = self.rootURL else: base = basejoin(self.rootURL, self.base) for href in self.anchorlist: ref = basejoin(base,href) if ref[0:7] == "http://" and ref not in self.URLstore: self.URLstore.append(ref) # # Courtney will need a start_pre and end_pre methods here # def close(self): """Terminate parse and return unique URL list.""" self.goahead(1) self.build_hrefs() return self.URLstore >From your point of view, the remainder of my program isn't really significant, but you will probably want to import the formatter library. Since you don't want any HTML rendering, use a creation and call sequence such as: fmt = formatter.NullFormatter() . . . try: if URL == '-': f = sys.stdin else: f = urllib.urlopen(URL) data = f.read() if f is not sys.stdin: f.close() p = myHTMLParser(fmt, URL) p.feed(data) myresult = p.close() except: print "I feel sick, Dave" after writing a close() method which returns whatever your
-handling
methods have extracted.  It may, though, be easier to build your own
formatter which grabs the contents of the 
 ... 
pairs as it's sent out. This will also handle the mutli-line cases as well. But perhaps it's over- complicated for your application, in which case ignore everything I just said! The libraries are our friends (although sometimes slightly old-fashioned ones). regards Steve -- "If computing ever stops being fun, I'll stop doing it" From jstok at bluedog.apana.org.au Sun Feb 27 17:58:28 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Mon, 28 Feb 2000 09:58:28 +1100 Subject: Python code using threads Message-ID: Can anyone point me in the direction of some good open source Python code that uses threading and locking? I learn best by reading production level code. From gmcm at hypernet.com Mon Feb 21 19:00:48 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 21 Feb 2000 19:00:48 -0500 Subject: Python misconceptions in IBM Ruby article... In-Reply-To: <38B0821D.150AC73A@mincom.com> Message-ID: <1260944845-2030478@hypernet.com> John Farrell wrote: > Now, I do not propose that this be changed, and I do not claim that > other languages are better because of this. However I do claim that there > is a tacked-on feeling about it. I think it's a little bit disingenuous > to disparage the Ruby article for claiming that Python's OO features > feel added-on, when there is considerable evidence to support that claim. No more disingeneous than to claim that evidence supports the claim of a "feeling". - Gordon From michael.stroeder at inka.de Sun Feb 20 13:05:34 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sun, 20 Feb 2000 19:05:34 +0100 Subject: web2ldap.py 0.7.0: WWW gateway for accessing LDAP servers Message-ID: <38B02CEE.E6370030@inka.de> HI! I would like to announce a new version of web2ldap, a full-featured LDAPv2+ client written in Python designed to run as web gateway.  It's available for free (GPL) from http://www.web2ldap.de/ There's a demo running on: http://sites.inka.de/ms/cgi-bin/web2ldap.py Because there were many changes in the code (see below) I would like to encourage users to heavily test this gateway and report success or problems to feedback at web2ldap.de. Thanks a lot. Ciao, Michael. P.S.: I also posted it here because news:comp.lang.python.announce looks quite dead at the moment... Changes: The most important change is that web2ldap can now be started as multi-threaded web server right out of the box. This speeds up things enormously. And yes, it runs under Windows... For more details see: http://www.web2ldap.de/doc/changes.html

web2ldap 0.7.0 - web-based LDAP client; runs as stand-alone web gateway now. (20-Feb-2000) From effbot at telia.com Thu Feb 10 06:53:36 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 11:53:36 GMT Subject: Solaris 2.7 __imaging.so ? References: <87sm73$mms$1@mwrns.noaa.gov> Message-ID: <4Fxo4.277$Ph6.186869248@newsa.telia.net> chris patti wrote: > bjm at cdc.noaa.gov (Barry McInnes) writes: > > Any help appreciated, thanks barry > > Solaris 7 is a 64 bit OS. > > In the distribution and on the website, it's stated multiple > times that the imaging extensions don't currently work in 64 > bit environments. imaging != imageop From jayfreeman at earthlink.net Wed Feb 23 10:38:59 2000 From: jayfreeman at earthlink.net (Jay Freeman) Date: Wed, 23 Feb 2000 09:38:59 -0600 Subject: Question about X window control Message-ID: <38B3FF12.9254AEDF@earthlink.net> Hi, I'm a brand new Python guy (and like it). I'm working on an information kiosk system running on Linux. It uses a touch screen and plays avi video files. I'm using Popen3() to call xanim to display them. I'd like to play them full screen but there doesn't seem to be any parameter to xanim to allow that. If I can't do full screen I would at least like to be able to center the xanim window, which always pops up in some random place it seems. Any ideas? I'd be willing to use a different player if it will do what I want, but xanim is the only command line one I know about. Thanks, Jay From ivanlan at callware.com Thu Feb 17 18:25:57 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Thu, 17 Feb 2000 16:25:57 -0700 Subject: wxPython book??? References: <14508.33324.45637.954517@weyr.cnri.reston.va.us> Message-ID: <38AC8385.16DD9A0E@callware.com> Hi All-- "Fred L. Drake, Jr." wrote: > > Robert Hicks writes: > > A "Learning wxPython" or "Programming wxPython" book would be an outstanding > > edition to the Python community. I think a book of this type "could" push > > wxPython into the Python limelight. Plus as a Python neophyte...I need to > > I'd love to see such a book. How soon can you have a draft ready? > I know a few publishers are looking for Python authors these days! > --He says, relentlessly pushing "volunteers" to the edge of the precipice. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 tseaver at starbase.neosoft.com Thu Feb 3 10:27:58 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 3 Feb 2000 09:27:58 -0600 Subject: Circular references and python References: <04Sl4.16542$3b6.68582@ozemail.com.au> <3899026C.7FD4481E@Lugoj.Com> <5ddm4.17487$3b6.72083@ozemail.com.au> Message-ID: <8F89FAE5A61F8EE4.6426FFB5D9C4B223.F2F0B5325CFEC602@lp.airnews.net> In article <5ddm4.17487$3b6.72083 at ozemail.com.au>, Jason Stokes wrote: > >James Logajan wrote in message <3899026C.7FD4481E at Lugoj.Com>... >>Neel Krishnaswami wrote: >>> Apply Neil Schemenauer's patches that convinces Python to use the >>> Boehm garbage collector, or just live with the garbage, if your >>> program is relatively short-lived. You can find his patch at: >>> >>> http://www.acs.ucalgary.ca/~nascheme/python/gc.html >>> >>> Manually freeing memory is ugly and error-prone. Don't do it. :) >> >>The vast majority of code (and programming languages) in the world require >>explicit memory de-allocation. I don't believe that a GC scheme has yet >been >>invented that will work well for all problem domains. I'm sure if it had, >>we'd all be using it by now. ;) > >First of all we should distinguish language from implementations of >languages, but in this case the line is a little blurry. > >LISP, Smalltalk, Java, Delphi and Eiffel implementations all use garbage >collection as a standard techniqure. More pertinantly, I don't *want* to >manually manage object deallocation in my application, and manual memory >management is the kind of low level process I expect a scripting language to >protect me from. I definitely think the Python interpreter should have a >standard garbage collection mode, if only as an option. Minor nit: Delphi does NOT use GC -- VCL components all have owners, who normally clean them up automagically when the owner is destroyed. This is much more like Python's refcount scheme than any "real" GC. Greasing-the-sieve-of-Eratosthenes'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From senn at maya.com Tue Feb 8 12:18:11 2000 From: senn at maya.com (Jeff Senn) Date: 08 Feb 2000 12:18:11 -0500 Subject: Python Palm Pilot Hotsync Conduit In-Reply-To: David Maslen's message of "Mon, 07 Feb 2000 22:19:55 GMT" References: <879010fcpj.fsf@iname.com> Message-ID: David Maslen writes: > Jeff Senn writes: ... > > I have a (mostly complete) wrapper for the low-level Palm SyncManager > > routines that would allow one to write HotSync conduits in Python (on > > Windows). > > > > I paused in the development (read: got distracted) so there are some > > loose ends. If anyone is interested in picking it up for the 'greater > > good', I'll contribute my code... > > Could this be of any value to pyrite[1]? That's what I use as a conduit > for my palm pilot, but I don't think it is running under windows. Nope -- it's only of use under windows (and possibly the Mac or anywhere Palm's Hotsync works, I guess, if someone could get it compiled). What it does is expose the low levels of the hotsync conduit interface into Python -- making it possible to develop conduits in Python. Pyrite is a replacement for the hotsync/conduit mechanism that uses the pilot-link (Unix-ish) pilot tools. You could possibly even use pyrite/pilot-link on windows -- I did some work awhile ago to get pilot-link stuff to work on windows -- but it would not integrate well into your world if you use Palm's Hotsync. -- -Jas From backov at nospam.csolve.net Fri Feb 25 11:40:18 2000 From: backov at nospam.csolve.net (Jason Maskell) Date: Fri, 25 Feb 2000 16:40:18 GMT Subject: Win2k and Python access violation - please help me out here! Message-ID: Well, I am trying to get my Python embedding project to move forward, and I am still having problems with it. I recently upgraded to Win2k, and my project now does something strange. I changed four lines of PyRun_SimpleString() to One line of PyRun_SimpleFile() with the same code - here it is: def main(): # Initialize the forms ddinterface.setpath(('c:/',)) ddinterface.loadform(('form','tester6.frm')) ddinterface.showform(('form',)) ddinterface.setelement(('form','textfield0', {'text':'Blahz','frame':0})) main() First off, I'd like to say that the docs for the PyRun_ commands are woefully inadequate. PyRun_SimpleFile() requires a FILE * and a filename. Does that mean it wants you to open the file and pass it the pointer, and the filename is just for reference? Or will it open it itself and put the pointer in FILE*? Do I have to close it afterwards? This really needs to be clarified. Anyway, here's the call stack before I get my access violation: tok_nextc(tok_state * 0x008e7b50) line 270 + 31 bytes PyTokenizer_Get(tok_state * 0x008e7b50, char * * 0x0012fb50, char * * 0x0012fb4c) line 469 + 9 bytes parsetok(tok_state * 0x008e7b50, grammar * 0x1e200028 __PyParser_Grammar, int 257, perrdetail * 0x0012fc38) line 149 + 17 bytes PyParser_ParseFile(_iobuf * 0x00482038, char * 0x00478370 `string', grammar * 0x1e200028 __PyParser_Grammar, int 257, char * 0x00000000, char * 0x00000000, perrdetail * 0x0012fc38) line 120 + 21 bytes PyParser_SimpleParseFile(_iobuf * 0x00482038, char * 0x00478370 `string', int 257) line 951 + 30 bytes PyRun_File(_iobuf * 0x00482038, char * 0x00478370 `string', int 257, _object * 0x008c28f0, _object * 0x008c28f0) line 861 + 29 bytes PyRun_SimpleFile(_iobuf * 0x00482038, char * 0x00478370 `string') line 570 + 26 bytes WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00132f75, int 1) line 174 + 20 bytes WinMainCRTStartup() line 198 + 54 bytes KERNEL32! 77e The actual message is "Unhandled exception in NTDLL.DLL: Access Violation" The code that calls PyRun_SimpleString() looks like this: fileptr=fopen("c://mainscript.py","r+"); PyRun_SimpleFile(fileptr,"c://mainscript.py"); I have tried it without the fopen as well, same error. Any help would be appreciated. Cheers, Jason From smb at bby.com.au Tue Feb 8 00:03:03 2000 From: smb at bby.com.au (Sarah Burke) Date: Tue, 08 Feb 2000 16:03:03 +1100 Subject: FreeTDS libraries for Sybase/MSSQL Message-ID: <389FA387.785D30C6@bby.com.au> Has anyone integrated the FreeTDS C libraries into Python code for connecting to Sybase or MSSQLS? Would anyone be interested in this? Sarah From darrell at dorb.com Sat Feb 26 18:58:44 2000 From: darrell at dorb.com (Darrell) Date: Sat, 26 Feb 2000 15:58:44 -0800 Subject: Code coverage for "C" Message-ID: <0cc701bf80b5$6f5376c0$6401a8c0@dorb> I need a code coverage tool for "C" with some strange requirements.All the code is in a case tool and must be parsed out of a twisted text file. Not to mention that it will run deeply embedded with some kind of network as the only feedback path. The approach I've taken is to insert some code into the control structures. if(x) { coverage(1); ++x; } The problem comes when you have code like: if(x) ++x; else if(y) --x; Before "coverage" can be inserted braces must be added. As always I'm prepared to be told that this is child's play if I had only used XYZ. I used a variation of John Aycock's scanner to build a list of events. Then passed the events though state machines that drop in the braces as needed. Can anyone share code or ideas on how I should have done it ? Should have asked this before I wrote it ! Thanks --Darrell From effbot at telia.com Fri Feb 18 16:24:50 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 18 Feb 2000 21:24:50 GMT Subject: Which GUI? References: Message-ID: Warren Postma wrote: > > every single example in that tutorial can be written in > > Tkinter, using about 50% as much Python code. and > > things like layout management and event handling looks > > embarrasingly primitive compared to Tkinter. > > Enlighten me on what makes Tkinter so 'advanced'. It seems that Guido > cribbed up this Tkinter thing and stuck fiercely by it, without so much as a > peep on what makes Tk worth keeping when Tcl wasn't worth using too. > Everything I hate about Tcl is wrong with Tk too. Show me a Tcl/Tk demo that > makes a nice "Outlook 98" style user interface frame set. sorry, I don't program Tcl/Tk. if you were talking about Tkinter, check Grayson's book. designing good looking user interfaces takes time and talent. if you have neither, no user inter- face toolkit will help. > then show me something in Tk that isn't ugly, in your > humble opinion. how about this one? http://www.pythonware.com/products/garnet don't know about you, but *I* think it's pretty cute. > 1. wxWindows looks nicer to me. Subjective, but I can't get over how > ugly Tkinter is. Nitpicking? Perhaps, but how do I remove those > "-----" lines at the top of all the pull-down menus? Yuck. tried setting the "tearoff" option to false? > 2. If Python is so much better than Tcl, why does Python require the > Tcl interpreter be running to get Tkinter going? Fact is Tk is > tightly bound to Tcl, and therefore Python is tightly bound to Tcl. > I like Python. I hate Tcl. I have to install Tcl/Tk and Python just > to run IDLE. Yuck yuck yuck! we've run out of intelligent arguments, have we? From tjreedy at udel.edu Sun Feb 20 15:42:20 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 20 Feb 2000 15:42:20 -0500 Subject: ANNOUNCE: Phyton-Compiler References: <38B031A3.80A4B0A1@t-online.de> Message-ID: <88pj9t$e8l$1@news.udel.edu> > We are grateful for suggestions and business models in above area Start by spelling the name of the language correctly (which you must have done once to get the message posted). From paul at prescod.net Wed Feb 2 13:27:40 2000 From: paul at prescod.net (Paul Prescod) Date: Wed, 02 Feb 2000 10:27:40 -0800 Subject: Case Sensitivity and Learnability References: <000501bf6a9f$8f501e00$78a0143f@tim> <20000131160402.D19725@xs4all.nl> <878j9k$vpe$2@thoth.cts.com> <389822FF.DDFF265A@electricorb.com> Message-ID: <3898771C.934A73A1@prescod.net> Glen Starchman wrote: > > Case sensitivity is a wonderful thing. With a language like VB which is not > case-sensitive (although the IDE will change all occurences of a variable to the > first defined case) the developer may refer to objPerson as OBJperson, > oBJPeRsOn, etc... personally I find this annoying, and a terrible practice to > get into if the developer then has to write C code! If the IDE normalizes case for you, what's the problem? One of Visual Basic's great features is that the IDE helps you *a lot* to get things right. It is perfect for newbies. Python's case sensitivity would not be a problem if there was an IDE that detected when you had misused case and corrected it for you (...this probably requires type annotation....) Maybe the CP4E *debugger* should detect case sensitivity problems at runtime and should just "fix up" the source code. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "Ivory towers are no longer in order. We need ivory networks. Today, sitting quietly and thinking is the world?s greatest generator of wealth and prosperity." - http://www.bespoke.org/viridian/print.asp?t=140 From gchiaramonte at ibl.bm Thu Feb 3 11:09:29 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Thu, 3 Feb 2000 12:09:29 -0400 Subject: re AMTE thread re DrScheme & Python In-Reply-To: <3898d76d.201105044@news.teleport.com> Message-ID: My parents will be so happy I'm no longer part of a cult. My mom still thinks I am playing with snakes all day though. "Why do you have all those books about snakes with funny animals on the cover?" I'm glad everyone has reached an mutually agreeable state. Politics, religion and programming languages are such personal topics. Gene > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Kirby Urner > Sent: Wednesday, February 02, 2000 9:20 PM > To: python-list at python.org > Subject: Re: re AMTE thread re DrScheme & Python > > > > > Probably someone else will post this as well, but since I > started this thread, I might as well complete the job by > ending it (sort of). Here's a concluding post. Looks > like a truce has been called. > > Kirby > > > ======================================= > > > From: D012560c at aol.com > Date: Wed, 2 Feb 2000 19:44:45 EST > Subject: Computers in Math Class (was Math Myopia...) > To: amte at esunix.emporia.edu > CC: pdx4d at teleport.com > X-Mailer: AOL 5.0 for Windows sub 45 > > Marvin, please post the following to the newsgroup/page where you sent my > original post. Thanks -- Matthias > > ------------------------------------------------------------------ > --------- > > Dear Readers: > > A couple of days ago Marvin Hernandez asked for my opinion concerning the > Python Web page on Programming for Everybody. The Web page then > contained a > table that compared aspects of programming languages, in particular, the > teachability of Scheme and its programming environments. As the leader of > the TeachScheme project and a researcher, I was deeply disturbed by the > contents of this table considering that the text contained no other > support. > > In the meantime, Guido van Rossum and I exchanged private email > and came to > a mutually agreeable position. He has removed his table and has prefixed > his page with > > "Note:I have made one change to the text of the proposal: At the > request of some supporters of other languages, I've withdrawn a > language comparison chart that contained highly personal and > sometimes unfounded opinions of other languages. The table was being > used out of context in a way that some found objectionable. (Not all > of the table is disputed, but it seems wiser not to engage in direct > language comparisons without a lot more documentation.)" > > I, in turn, sincerely apologize for writing an emotional evaluation about > Python and its users. I should not have given permission to post my first > reaction to a newsgroup about which I knew nothing. I particularly regret > using the word "cult" for Python users. > > -- Matthias Felleisen > > > -- > http://www.python.org/mailman/listinfo/python-list From effbot at telia.com Thu Feb 24 11:23:06 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 24 Feb 2000 16:23:06 GMT Subject: identity of the caller? References: <38B4EDE0.1DB1B55F@horvath.com> Message-ID: Bob Horvath wrote: > Is there any way to find out the identity of who called you? I am > mainly thinking of method calls, but in general if there is a way > for regular function calls, I would be interested in that too. not 100% sure what you're trying to do, but this might help: http://www.deja.com/=dnc/getdoc.xp?AN=298652942 From J.C.Travers at durham.ac.uk Tue Feb 15 11:49:57 2000 From: J.C.Travers at durham.ac.uk (J.C.Travers) Date: Tue, 15 Feb 2000 16:49:57 +0000 Subject: erasing and writing test on console. References: <38A95B81.DCFC4C25@durham.ac.uk> Message-ID: <38A983B5.4639F4D@durham.ac.uk> > >>where the 'zzzz bytes downloaded' is updated. > >>Do I need to use curses to do this, or is there a simpler way > Alternatively, you can emit '\r' without the '\n'. Then reprint the entire > line. Thank you, it works perfectly. From effbot at telia.com Thu Feb 17 03:35:16 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 17 Feb 2000 08:35:16 GMT Subject: Proposal: Official whitespace response References: <200002102304.KAA08105@envy.fulcrum.com.au> <88cclv$u62$1@nnrp1.deja.com> <20000216073317.A579@stopcontact.palga.uucp> <88eojc$jed$1@nnrp1.deja.com> Message-ID: <8pOq4.122$mYj.170920448@newsa.telia.net> Forrest Cahoon wrote: > I'll admit to being somewhat confrontational in my original post, but > all along, it was constructive information like this I was really after. would have been easier to ask for that from the start, wouldn't it? > I'm really happy -- especially now -- with the level of constructiveness > here. It's a shame that Moshe Zadka has insisted on sending me some > really snide, asshole flames to me by personal e-mail that there is no > way he would post in public. He's really a blemish on your fine > community, and I humbly suggest you consider adding him to your > killfiles, and not answering his questions until he grows up. if you want others to behave like grown-ups, I suggest you start with yourself. until then, hope you'll enjoy sitting in my killfile. *plonk* From thucdat1143 at my-deja.com Thu Feb 10 10:47:30 2000 From: thucdat1143 at my-deja.com (thucdat1143 at my-deja.com) Date: Thu, 10 Feb 2000 15:47:30 GMT Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> Message-ID: <87umih$egk$1@nnrp1.deja.com> Lieber Bernhard, You are not happy with Borland's products? Neither am I! But being a 'Free Software Projects and Consulting', you should be more Linux-oriented than MSWin-oriented. All these stuffs (Perl, Tcl, Python) are more home on Unix than MSWin, and soon their wrapper (Ruby) will make Unix the destiny. Check this out: www.ruby-lang.org to see what IBM is talking about Ruby. Cheers (Oh sure: Viele Gruesse aus Minnesota/USA). Dat BTW: Did Osnabrueck finally make it to the Erste Fussball Bundesliga? Ich bin so lange weg vom Deutschland und habe keine Ahnung mehr. Spielen Gerd Muehler und Franz Beckenbauer immer noch fuer Bayern Muenchen? In article <87ttfm$nt8$2 at newsserver.rrzn.uni-hannover.de>, breiter at usf.Uni-Osnabrueck.DE (Bernhard Reiter) wrote: > In article <87q1jh$437$1 at nnrp1.deja.com>, > thucdat1143 at my-deja.com writes: > > It doesn't matter anymore that Gates resigned, maybe he already saw > > where Coplan was heading to. That's the end of Python/Tcl/Perl on Win32. > > Oh, you mean, because Win32 will die out so quickly because > Borland and Corel have joined. > > From the technical point of view, the Borland products I used always > left things to be desired. > > > Erase your 95/98/NT, install Linux now. Bright future for everything > > (Python, Tcl, Perl) on Linux because Unix is their home anyway. > Python is very much at home on Win32. > And I hope it will stay his way, because python saves my day if I > really have to do "stuff" on Win32. > > Bernhard > -- > Free Software Projects and Consulting (intevation.net) > Association for a Free Informational Infrastructure (ffii.org) > Sent via Deja.com http://www.deja.com/ Before you buy. From pinard at iro.umontreal.ca Fri Feb 11 08:57:01 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 11 Feb 2000 08:57:01 -0500 Subject: Off Topic Posts In-Reply-To: "Gene Chiaramonte"'s message of "Fri, 11 Feb 2000 08:20:01 -0400" References: Message-ID: "Gene Chiaramonte" writes: > I am suggesting that python-list be split into 2 lists. One for specific > python programming questions, and another list for python language > opinions and comments. Anyone agree with me? If it was done and used properly, it might be useful. However, I guess it would have a few problems. Discussions are often originated by newcomer questions, and newcomers do not stay newcomers for very long, as one can to get speed and comfort with the language within a few weeks (it only takes half a day to get going, but comfort takes more time). Since newcomers arrive all the time, the discussions themselves will be replaced by other discussions explaining the list split, and what some consider noise will not drop that much. Moreover, the resulting frustration will begin to show after some while, the spirit of the gang might change, and newcomers (and old timers) will not find here the peaceful relation we use to enjoy, now. Maybe that the Python group is doomed, in the long run, to become as rude and unfriendly as the Perl group is right now. But we should try our very best so this happens the latest possible, and be careful to see the connection to that possible danger in every reorganisation of the Python community. > I have several filters in place already, but many messages still slip > through. The Gnus reader, which I use, makes it very easy for me to add filtering devices ("scoring" rules) on the fly, using the currently displayed message author or subject (among other criteria) to raise or lower score. It even gives me the capability of creating "temporary" rules (they auto-expire after some while), and this is useful for spontaneous threads. So, for me at least, this is no problem at all. But I also understand that not everybody is lucky enough to use Gnus as a mail reader :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jeremyho at flashcom.com Fri Feb 18 12:24:39 2000 From: jeremyho at flashcom.com (Jeremy Howard) Date: Fri, 18 Feb 2000 09:24:39 -0800 Subject: Newbie Question about COM Objects Message-ID: Hi everyone, I'm having some problems finding any documentation on sending parameters to COM objects in Python. I've included how the object is called from VB also I've included how I'm *trying* to call the Object from Python. VB code that works.... Dim SiebelConf as String Dim oSiebel as Objectt Dim ErrCode as Integer SiebelConf = "C:\Temp\Siebel.cfg" Set oSiebel = CreateObject("SiebelDataServer.ApplicationObject") oSiebel.LoadObjects SiebelConf, ErrCode All that happens here is I call the oSiebel.LoadObjects with two parameters, first one is a string containing the name of the file I want the load and the second parameter is an integer filled with an error code (0 if successful) upon completion. When I try to do the same thing in Python I get an Error.. >>> from win32com.client import Dispatch, constants >>> from pywintypes import com_error >>> oSiebel = Dispatch('SiebelDataServer.ApplicationObject') >>> SiebelConf = 'c:\\Temp\\Siebel.cfg' >>> ErrCode = 0 >>> oSiebel.LoadObjects(SiebelConf, ErrCode) Traceback (innermost last): File "", line 0, in ? File "", line 2, in LoadObjects com_error: (-2147352571, 'Type mismatch.', None, 2) I was under the impression that if I assign a number to ErrCode, Python would see that variable as an Integer type. Or maybe I'm just way off base.. Any help would be really appreciated. :) Jeremy Howard jeremyho at flashcom.com From mhammond at skippinet.com.au Sat Feb 12 19:42:20 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 13 Feb 2000 00:42:20 GMT Subject: Access violation in MSVCRT.DLL when attempting to use Python.. References: Message-ID: "Jason Maskell" wrote in message news:iogp4.530$M73.526 at 198.235.216.4... > I have finally got all my code ported over to VC++, and now I seem to be > having a strange problem.. I am testing out my glue code with simple test > cases - in this case, I run this > > ... > Which sets a couple properties of that interface element. The function works > fine, decreases all the references that it needs to (I believe) and then My bet is that your belief is wrong :-) > clue what is going on. Can anyone give me a quick pointer how to set up VC > so that I can trace into the python source? Do I need to link to the python > debug dll? Yes - you should simply be able to build the debug version of your extension/program. This should automatically bring in python15_d.dll instead of python15.dll. However, be warned - you will need to have debug versions of _all_ your Python DLLs. FWIW, registered users of the win32all extensions get binary _d versions of the core Python DLL and all the win32 related DLLs. Mark. From sorry at spam.invalid Tue Feb 22 16:52:16 2000 From: sorry at spam.invalid (sorry at spam.invalid) Date: Tue, 22 Feb 2000 21:52:16 GMT Subject: Q: Misunderstanding classes (newbie) Message-ID: Hi, I'm a Python newbie (and an OOP newbie) trying to construct a class that: (a) behaves like a list but has a FORTRAN-like variable starting index, (b) has per-index attributes. i.e. Each element of the list has two (or more) attributes, and, by default, the first element is at x[1]. e.g. x[1].lastname, x[1].firstname, x[1].age x[2].lastname, x[2].firstname, x[2].age I seem to be able to get each part of the solution independently (the first part by using UserList and __getitem__), but when I attempt to combine them, I clearly don't understand what I'm doing. Suggestions? Thanx. P.S. Please respond to the list. From PClaerhout at CREO.BE Mon Feb 28 06:35:51 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Mon, 28 Feb 2000 12:35:51 +0100 Subject: Scanning folders Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA715F@MSGEURO1> Hello, what is the best and fastest way to scan a whole list of folders to see if something is added or not. Please note that this should also work for more than 1000 folders (and it shouldn't slow down the system too much). Kind regards, Pieter From m.faassen at vet.uu.nl Tue Feb 29 16:26:15 2000 From: m.faassen at vet.uu.nl (Martijn Faassen) Date: 29 Feb 2000 21:26:15 GMT Subject: Worthless (was RE: functional programming) References: <000e01bf8193$d9b8b640$f0a2143f@tim> <38BA0E15.1F56E6BC@bellatlantic.net> Message-ID: <89hdhn$pc2$2@newshost.accu.uu.nl> Steve Holden wrote: > Tim Peters wrote: >> so won't be of much help come the machine revolution. >> I used to expect it would side with the machines anyway, but its persistent >> resistance to adding more functional cruft to Python gives me serious doubt. > Now I'm confused. I thought this was a timbot post, but you're Tim, > aren't you? Actually, this is the focus of a vast distributed analysis project like Distributed.net and Seti at Home. The PSU has smuggled a set of Python scripts into Zope and IDLE that have nothing to do with their official purposes -- this code analyses 'Tim Peters' posts to comp.lang.python in an attempt to determine which are posted by the bot and which are posted by the human (if any human indeed exists -- no proof exists besides the word of Gordon McMillan and Guido van Rossum, but we know what unreliable bunch of jokers *those* are). Hopefully they'll give us some results soon. The-PSU-doesn't-exist-really-!-ly yours, Martijn -- History of the 20th Century: WW1, WW2, WW3? No, WWW -- Could we be going in the right direction? From gerrit.holl at pobox.com Thu Feb 24 01:53:08 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Thu, 24 Feb 2000 07:53:08 +0100 Subject: Phyththon misspelling contest In-Reply-To: ; from wware@world.std.com on Thu, Feb 24, 2000 at 05:03:41AM +0000 References: Message-ID: <20000224075308.A1854@stopcontact.palga.uucp> > Get Chaucerian, win valuable prizes! Extra points if none of > your posts spells it the same way as any other. Paaison or paaiton. -- Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html Please comment! From embed at geocities.com Tue Feb 15 10:21:01 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 15 Feb 2000 10:21:01 -0500 Subject: BSDDB copyright and licensing restrictions while in use via Python References: <6NUp4.720$Zn6.21794@nnrp1.uunet.ca> Message-ID: Wowee. I ran my little "hammer on the database" benchmark (which took over 5 hours to complete using the bsddb included in Python) and so far it's running approximately 3 times faster using your bsddb. Good work Robin! Warren -- test script -- # DBTEST2.PY from bsddb2 import db filename = "c:/temp/TestBsdDb.db" #import bsddb # built in bsddb #filename = "c:/temp/TestBsdDb.db" import random import time import string # full test range start,end = 4,17 # quick test #start,end = 4,8 print "BSD Database Test in Python (Version 2)" print descriptions = [ "Add Rows", "Read Keys", "Shuffle", "Read Rows", "Delete 75%", "Close" ] List1 = [ "Abc", "Def", "Ghi", "Jkl", "Mno", "Pqr", "Stu", "Vwx", "Yz" ] List2 = [ "X123", "Y456", "Z789", "Y012", "Z345", "X678", "Y901", "Z234", "X567" ] # Shuffle an array like you might shuffle cards # Note: This is intended to be Good Enough, Not Perfect. # We limit shuffle operations to 100 per data set! def Shuffle(ar): sz = len(ar) th = sz/2 lp = sz/4 if (lp > 100): lp = 100 # now move a bunch of cards up or down: x1 = random.randrange(0,sz/2) x2 = random.randrange(0,sz/2)+(sz/2) c = random.randrange(0,sz/4) ar[x1:x1+c], ar[x2:x2-c] = ar[x2:x2-c], ar[x1:x1+c] for k in range(0,lp): # do a little random substitution to kick things off for i in range(0,lp): x = random.randrange(0,th) y = random.randrange(th,sz) ar[x],ar[y] = ar[y], ar[x] # rough scramble of sections: def testset(testindex,RowCount,db): times=[] starttime = time.clock() bytesread=0 print "---- Storing "+`RowCount`+" rows in the database "+`testindex`+" ) ----" for n in range(0,RowCount): r = random.randrange(0,8) V = List1[r]*200 K = List2[r]+"-"+`n`+`testindex` # avoid inorder insertion of keys db[K] = K+':'+V # DB Btree-lookup Key 'K' has value 'V' times.append(time.clock()-starttime) # Get Keys #print "Read Keys" Keys = db.keys() N = len(Keys) times.append(time.clock()-starttime) print "Shuffling Key array... (slow!)" # Scramble Keys But Good... Shuffle(Keys) # print Keys[0:10] # taste and see times.append(time.clock()-starttime) print "After inserting ",RowCount," rows the Key Count is now ", len(Keys) bytesread = 0 #print "Reading Rows, in Random Order" for r in Keys: x = db[r] bytesread = bytesread + len(x) print "Bytes read = ", `bytesread` times.append(time.clock()-starttime) # Delete 75% of the data in the database: delcount = len(Keys) - ( len(Keys)/4 ) for k in Keys[0:delcount]: del db[k] db.sync() Keys = db.keys(); print "After deleting, the key count is ", len(Keys) times.append(time.clock()-starttime) #print "Closing" #print "Done" #times.append(time.clock()-starttime) print "Elapsed Times:" for i in range(0,5): print string.ljust(descriptions[i],20), ": ", times[i] print "-----------------" print def testloop(): #db1 = bsddb.btopen( filename, "n" ) db1 = db.DB() db1.open(filename, db.DB_BTREE, db.DB_CREATE) for i in range(start,end): testset(i,long(20**(i/4.0)),db1) db1.close() # Quick Shuffle test: #for i in range(0,10): # X = List1[:] # Shuffle(X) # print X testloop() From see_plus_plus at my-deja.com Thu Feb 24 15:47:11 2000 From: see_plus_plus at my-deja.com (see_plus_plus at my-deja.com) Date: Thu, 24 Feb 2000 20:47:11 GMT Subject: ANNOUNCE: Python Compiler (No spell errors) References: <38B04C41.CCE242FD@t-online.de> Message-ID: <8945c6$a8j$1@nnrp1.deja.com> Wait & See. This new compiler is coming out from the same country where Mercedez, BMW & Porsche are produced. You know the quality of those cars, do you? cpp In article , =?ISO-8859-1?Q?Fran=E7ois_Pinard?= wrote: > Andreas Otto writes: > > > After implementation of Tcl as compiler-language we have plans for > > python. > > By `python' we usual refer to the system command. We write Python, with > a capital, for the programming language. I get that you did not really > study, nor use this language yet. > > You are having _plans_ for Python, indeed? I surely got that you want to > make money out of it (there is nothing wrong with that), but I'm still > curious about the technical contents of your plans, if about something > you do not know yet. I guess you might have to establish some kind of > credibility for yourself about Python, before starting to speak business. > > -- > Fran?ois Pinard http://www.iro.umontreal.ca/~pinard > > Sent via Deja.com http://www.deja.com/ Before you buy. From emile at fenx.com Wed Feb 9 22:04:19 2000 From: emile at fenx.com (Emile van Sebille) Date: Wed, 9 Feb 2000 19:04:19 -0800 Subject: Newbie question - what is the 'r' operator? Message-ID: <035e01bf7373$898e4960$01ffffc0@worldnet.att.net> Just remember you can't end with a single back-slash. -- Emile van Sebille emile at fenx.com ------------------- Craig Findlay wrote in message news:93p1as04hd739si7v44dbdqio6tmevfs1n at 4ax.com... > Thanks to Fredrik and Thomas for your help :) > > Craig > > "Fredrik Lundh" wrote: > > >Craig Findlay wrote: > >> This is probably obvious but ... > >> > >> I have seen example code where an 'r' prefix is used in from of a > >> string, eg r'mystring' > >> > >> What does it do, I can't seem to locate any documentation about it. > > > > http://www.python.org/doc/current/ref/strings.html > > > > "When an 'r' or 'R' prefix is present, backslashes > > are still used to quote the following character, > > but all backslashes are left in the string." > > > >(useful when embedding all sorts of cryptic sublanguages in > >python strings, such as regular expressions or windows file > >names...) > > > > > > > > -- > http://www.python.org/mailman/listinfo/python-list > From effbot at telia.com Thu Feb 3 14:43:31 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 03 Feb 2000 19:43:31 GMT Subject: Built-in exception class not found References: Message-ID: Thomas Happ wrote: > I am attempting to install Python on our systems here at RIT. > We're running Solaris 7. It seems to work in most respects, but whenever > any program is run, it displays the following message: > > Built-in exception class not found: EnvironmentError. Library mismatch? > [Warning! Falling back to string-based exceptions > [Python 1.5.2 (#4, Jan 14 2000, 09:18:57) [GCC 2.95.1 19990816 (release)] > [on sunos5 > [Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > > I looked through the Setup file in the Modules part of the > installation and couldn't find any modules related to this. I also > checked the FAQ and the Bug report but couldn't find any similar > problems. quoting myself from a recent post: "library mismatch" means that your interpreter picked up an old standard library (or at least an old copy of exceptions.py). better double-check your python path. (the path probably points to an old 1.5.1 installation) From donn at oz.net Wed Feb 9 01:18:41 2000 From: donn at oz.net (Donn Cave) Date: 9 Feb 2000 06:18:41 GMT Subject: mail filter in python? References: <38A06C98.9B2ECA2A@sage.att.com> <20000207154641.A2817@stopcontact.palga.uucp> <87q016$rro$1@nntp6.u.washington.edu> Message-ID: <87r0s1$cmt$1@216.39.151.169> Quoth tseaver at starbase.neosoft.com (Tres Seaver): ... | I offer as a possible counterexample Eric Raymond's first serious use of | Python: he built a Tk GUI to simplify configuring fetchmail. The project | made a *serious* believer out of him, too -- and the tool works for *many* | more folks than ESR. But didn't he also write fetchmail? I'm not against front ends per se, especially when the author intimately familiar with the back end and also has reason to expect it to be the focus of future maintenance etc. I'm saying procmail is dead as a doornail so it's not a very attractive back end in terms of leveraging anyone's efforts. (Not that I have any inside information on this, I really don't.) Even so, like I say, with the goal of a really simplified, constrained point and click interface to its capabilities, a front end could be useful for others. Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From roy at popmail.med.nyu.edu Mon Feb 7 21:22:59 2000 From: roy at popmail.med.nyu.edu (Roy Smith) Date: Mon, 07 Feb 2000 21:22:59 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> Message-ID: fcahoon at my-deja.com wrote: > If python code were to become mis-formatted (and given my experience, I > have to believe that sooner or later this _will_ happen) there is _no > way_ to be certain what the original author's intent was, much less to > fix it automatically. This is a Bad Thing(tm). I'm a hard-core python addict, and I agree 100% with fcahoon. This sillyness with indenting for statement grouping is without a doubt the most serious blemish on the language. I fear disaster every time I have to move a block of code. As the logic of my program develops, I'll either have to move a block of code into an if, or move it out of one, or I'll take a block of code and turn it into a function/method of its own, or maybe even extract something into a subclass. This means cutting and pasting (well, killing and yanking, since I use emacs), and changing the indent level up or down. Emacs tries to be smart about indenting and sometimes does something wrong, changing the meaning of the code. Worse, it leaves behind not only code which is semantically wrong and syntactically correct, but it's also visually reasonable looking. It is a human factors nightmare. Why do I use python? Because the class mechanism is simple and powerful, the fact that it's interpreted makes it easy to develop/prototype in, it's high level, and the wide assortment of library modules means it can do all sorts of wonderful stuff. From aahz at netcom.com Thu Feb 17 12:47:35 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 17:47:35 GMT Subject: 1.5.2 vs. 1.5.2+ (was Re: dumbass locale question) References: <200002171700.LAA21343@beluga.mojam.com> Message-ID: <88hc7n$qph$1@nntp6.atl.mindspring.net> In article <200002171700.LAA21343 at beluga.mojam.com>, Skip Montanaro wrote: > >I run a web site here in the US, but I get input from all over. If I ask >for > > "c".upper() When posting questions that involve CVS-only code, could you please make sure to clearly indicate that in your post? -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From kc5tja at garnet.armored.net Tue Feb 15 02:41:06 2000 From: kc5tja at garnet.armored.net (Samuel A. Falvo II) Date: 15 Feb 2000 07:41:06 GMT Subject: [CORBA] omniNames feature request References: Message-ID: In article , Martin von Loewis wrote: >IANA has assigned port 2809 for CORBA bootstrapping purposes. The INS >spec assumes this as the default in the corbaloc URLs; the default >object key for the name service is "NameService". Wow...that is dang cool. I'll definately keep this in mind. The idea being that there is a way to construct an IOR manually that is bound to the IIOP protocol, using an arbitrary hostname (as determined by the requirements of the application), port 2809, and dedicated object key of "NameService", and I'm assuming also "TradingService" and others. Wow...this will utterly blow (D)COM away. -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA From effbot at telia.com Mon Feb 14 11:01:28 2000 From: effbot at telia.com (Fredrik Lundh) Date: Mon, 14 Feb 2000 16:01:28 GMT Subject: Order of object cleanup at interpreter exit? References: Message-ID: Rob W. W. Hooft wrote: > I have noticed that this does not work if the __del__ method is called > when the interpreter is exiting (i.e., when I am using a Robot() object > in the __main__ module at the global scope). I get: jason and michael have already pointed out how to work around this. for some background info, see: http://www.python.org/doc/essays/cleanup.html From aahz at netcom.com Thu Feb 3 14:44:32 2000 From: aahz at netcom.com (Aahz Maruch) Date: 3 Feb 2000 19:44:32 GMT Subject: Mark Hammond & David Ascher, ActiveState, Python world domination References: <002701bf6e7c$dbb7d040$c355cfc0@ski.org> Message-ID: <87clr0$o78$1@nntp2.atl.mindspring.net> [posted and e-mailed] In article <002701bf6e7c$dbb7d040$c355cfc0 at ski.org>, David Ascher wrote: > >Some have asked me in email what this means for my current public Python >projects, particularly Snow, PyOpenGL and Python training. What about the Open Source Conference? -- --- Aahz (@netcom.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 Have a *HAPPY* day!!!!!!!!!! From tbryan at python.net Mon Feb 21 18:14:32 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Mon, 21 Feb 2000 18:14:32 -0500 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> <38B1A4D4.F98E53B3@python.net> <3dhff29onh.fsf@amarok.cnri.reston.va.us> Message-ID: <38B1C6D8.6E65A7C0@python.net> "Andrew M. Kuchling" wrote: > > "Thomas A. Bryan" writes: > > Gerrit, this is the strangest thing I've ever seen. I sure hope that > > it's just getting late, and you're being silly. You didn't really > > rip keys off of your keyboard, did you? > > This is probably just a _jeu d'esprit_, done less out of seriousness > than out of curiosity Well, you never know when Gerrit's speaking. ;-) > [1] Greg Ward just observed that it's possible to boot Linux and pass > it "init=/usr/bin/emacs", to run Emacs as the single process on the > system. The return of the Lisp Machine! Wow. That's a dangerous thing to tell someone who's typing this on Linux and does *all* of his coding inside of Emacs. > [2] I occasionally think about this problem. The setup: GvR was far > too profligate in adding functions to bltinmodule.c that could have > been written in pure Python instead. [...snip...] > def hasattr(obj, name): > s = 'obj.' + name > try: > exec s > return 1 > except AttributeError: > return 0 Wow. That's sick! No wonder my boss is pushing me more towards a software/process engineering role. I'm not twisted enough to be a true geek. ;-) only-twisted-enough-to-translate-perl-to-python-for-fun-ly yours ---Tom From rbaklundNOrbSPAM at hotmail.com.invalid Wed Feb 23 05:34:27 2000 From: rbaklundNOrbSPAM at hotmail.com.invalid (qwe) Date: Wed, 23 Feb 2000 02:34:27 -0800 Subject: msvcrt, open_osfhandle, locking References: <68Hs4.1435$LX4.4374@news-server.bigpond.net.au> Message-ID: <06db8d30.f0a3be48@usw-ex0105-038.remarq.com> In article <68Hs4.1435$LX4.4374 at news- server.bigpond.net.au>, "Mark Hammond" wrote: >Oops - meant "locking function in msvcrt module" Hmmm. Do you have an example? I can't get it to work. The documentation says: "locking (fd, mode, nbytes) Lock part of a file based on a file descriptor from the C runtime. Raises IOError on failure. " and for open_osfhandle: "open_osfhandle (handle, flags) Create a C runtime file descriptor from the file handle handle." It seems to me that open_osfhandle() is used to get a file descriptor based on a file handle, and the locking() function needs this file descriptor? When I try to use the locking() function on a file handle returned by open, I still get "TypeError: illegal argument type...", but if I use dummy data (locking(1,1,1)) in stead of the file handle, I get "IOError: [Errno 9] Bad file descriptor", so I asume you are right about the handle... What do I use for 'mode' in the locking() function? And what do I use for 'nbytes' if I want to lock the entire file? The filesize? -- Roger * 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 RossBoylan at alumni.stanford.org Thu Feb 3 16:24:49 2000 From: RossBoylan at alumni.stanford.org (Ross Boylan) Date: Thu, 03 Feb 2000 21:24:49 GMT Subject: Problems compiling Python on HP-UX 11 Message-ID: <87crmp$u5r$1@nnrp1.deja.com> I am trying to build python 1.5.2c on an HP-UX B.11.00. I think the first few items are relatively simple errors in the build scripts. (I ran configure and clean first). 1) Using HP's ANSI-C compiler, I get the following error (under the Parser build) cc -Aa -D_HPUX_SOURCE -O -I./../Include -I.. -DHAVE_CONFIG_H -c printgrammar.c cc -Aa -D_HPUX_SOURCE -O pgenmain.o acceler.o grammar1.o listnode.o node.o parser.o parsetok.o tokenizer.o bitset.o metag rammar.o firstsets.o grammar.o pgen.o printgrammar.o -lnet -lnsl - ldld -lcma -o pgen cc -Aa -D_HPUX_SOURCE -O -I./../Include -I.. -DHAVE_CONFIG_H -c myreadline.c cc: "../Include/longobject.h", line 80: error 1681: Must use +e or -Ae for long long in ANSI mode. cc: "../Include/longobject.h", line 81: error 1681: Must use +e or -Ae for long long in ANSI mode. *** Error exit code 1 So perhaps -Ae rather than Aa should be the option? 2) When I ran configure the first time it set up the same options, even though my default cc was the non-Ansi-C one. It then complained about - Aa and -O, saying only the Ansi version understood them. I changed my path to get the Ansi compiler for the errors in 1). 3) Is there a reason that the build advice in the Misc/HPUX-NOTES is not incorporated into the automatic configuration? The non-simple item is that I have a Module I am trying to add which needs the C++ compiler (aCC). This is not simple because the build scripts need to handle it correctly, and because of HP's warnings that one should have a C++ main if linking in some C++. I am building with threads, because I want to use Zope. For now, I'm trying static libraries... I'd appreciate any help/tips/advice. Sent via Deja.com http://www.deja.com/ Before you buy. From ekappoti at lynx.neu.edu Mon Feb 28 19:16:08 2000 From: ekappoti at lynx.neu.edu (Eric Kappotis) Date: Mon, 28 Feb 2000 19:16:08 -0500 Subject: Microsoft Access Database Message-ID: <89f32j$3c9$1@isn.dac.neu.edu> Is there anyway i can read from and write to a Microsoft Access Database with Python. If so where can i find some tutorials on how to do that? Eric Kappotis From n8gray at earthlink.net Tue Feb 1 16:40:07 2000 From: n8gray at earthlink.net (Nathaniel Gray) Date: Tue, 01 Feb 2000 21:40:07 GMT Subject: JPython mentioned in featured article at JDJ References: <20000201032643.27139.00000922@ng-ca1.aol.com> Message-ID: <38975303.C91E8D69@earthlink.net> Did I miss the source code for this article? URL anybody? -- 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 gmcm at hypernet.com Mon Feb 7 19:33:17 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Mon, 7 Feb 2000 19:33:17 -0500 Subject: Whitespace as syntax (was Re: Python Rocks!) In-Reply-To: <87nmir$e7k$1@nnrp1.deja.com> Message-ID: <1262152524-5049647@hypernet.com> fcahoon at my-deja.com wrote: > In article <860ftk$bas at news.or.intel.com>, > "tye4" wrote: > > Indentation is a confusing and lame way to separate what is inside a > block > > and what's outside it. > > > > tye4 > > I am not a Python user for this very reason, and I know many developers > who are interested in the buzz about Python but when they hear "Python > uses whitespace as syntax" refuse to touch it. And there are many others who decide to try it anyway, and then discover their fears were misfounded. It has more to do with the programmer than the so-called "issue". - Gordon From kohler at medien.tecmath.com Fri Feb 11 10:40:22 2000 From: kohler at medien.tecmath.com (Markus Kohler) Date: Fri, 11 Feb 2000 16:40:22 +0100 Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com><389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be><38A06C31.70753311@prescod.net><1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu><38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> Message-ID: <881ac8$qu4$1@sun.rhrk.uni-kl.de> Fredrik Lundh schrieb in im Newsbeitrag: kROo4.5767$al3.76139 at newsc.telia.net... > Gareth McCaughan wrote: > > (Smalltalk syntax looks funny, too, but it isn't so fundamental > > to the language. Perhaps a more approachable version of Smalltalk > > might be possible.) > > you mean Python? > > (yeah, I know that we haven't implemented everything > just yet, but we're working on it ;-) > > seriously, what are the major shortcomings in Python > from a Smalltalk professional's perspective? > > let's see: > > -- no blocks (lambda doesn't really cut it) > -- type/class dichotomy (CPython implementation) Smalltalk VM implementations are much smaller than the CPython implementation, because of this. Just take a look at squeak (www.squeak.org) > -- no garbage collection (CPython implementation) Yes. Those points are the most important ones. -- metaprogramming is also an important topic. This is one reason why most Smalltalk IDE's are so powerfull (Object inspectors are an example) -- Smalltalk's syntax is simpler. It's only a few rules and there are only a handfull builtin names. This results in better programming tools (Refactoring Browser for example) -- Smalltalk's calling mechanism is much simpler than Pythons making it easier to compile. Almost every Smalltalk implementation I have seens runs faster than Python. Markus From tbryan at python.net Fri Feb 11 00:46:19 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Fri, 11 Feb 2000 00:46:19 -0500 Subject: Parnassus mirror? References: Message-ID: <38A3A22B.62DF23F5@python.net> Mike Fletcher wrote: > > Wondering if there is a Parnassus mirror anywhere? Two machines on my route > to the www.vex.net server are routing back and forth at each other, which > makes it hard to get through :) . I was recently thinking that a Parnassus mirror at www.sourceforge.com would make sense, but I haven't had time to pursue it. ---Tom From pehr at pehr.net Sat Feb 12 13:12:58 2000 From: pehr at pehr.net (pehr anderson) Date: Sat, 12 Feb 2000 18:12:58 GMT Subject: Python MySQL.connect() [resolved] References: <3893CD31.B17E8B84@regnoc.com> <870tjf$514$1@news1.xs4all.nl> <3894737C.A676BC16@regnoc.com> <381BAA74.863A8048@cs.rmit.edu.au> <874ejr$35o$1@news1.xs4all.nl> <381ED7A5.DF5C510D@cs.rmit.edu.au> <87b8e8$cpv$1@news1.xs4all.nl> <389B1DA8.B659F64A@regnoc.com> Message-ID: <38A5A2C1.ED7F19F6@pehr.net> Just wanting to clarify: What exactly did you upgrade to make this problem go away? I ran into this issue a few weeks ago and didn't know what to do. -pehr Jim Conger wrote: > > I finally figured out the problem. It turns out that old libc library > versions interfere with the mySQL security logic. The result is that > logical names for devices, such as "localhost" and the machine name > are not recognized. Simply upgrading to the latest libc library > solved the whole problem. > > Thank you to everyone for help on this. > > Jim C. > > Boudewijn Rempt wrote: > > > Hafeez Bana wrote: > > <...> > > > Mysql can be told what kind of communication it uses. In your case > > Mysql > > > maybe listening on a unix socket and so localhost works - this > > was not > > > the case with my configuration of Mysql. I hope you get what I am > > > saying. > > > > That's interesting - I didn't know that at all. > > > > -- > > > > Boudewijn Rempt | http://www.valdyas.org > > -- > Jim Conger > Project Manager > Silicon Valley Oil Co. > jimc at regnoc.com, 925-842-6729 > > From wlfraed at ix.netcom.com Sat Feb 12 22:03:54 2000 From: wlfraed at ix.netcom.com (Dennis Lee Bieber) Date: Sat, 12 Feb 2000 19:03:54 -0800 Subject: breaking the ; habit References: <38a5d928@news.isc.rit.edu> <38A5DEB7.E1B018AC@rubic.com> <38a610d2@news.isc.rit.edu> Message-ID: <3c7cascbgtg09uf86j5uludrvm16pc6ini@4ax.com> On Sat, 12 Feb 2000 21:08:52 -0500, R. O'Neil declaimed the following in comp.lang.python: > Wow that's nice. Is that something that's standard for the language or is > it just a nice feature in the most common interpreters? > It's a side-effect... The ";" is used to separate statements on a single line. Therefore, using a ";" at the end of each statement is effectively adding a null/empty statement immediately following -- > ============================================================== < > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed at dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ < From jcw at equi4.com Fri Feb 4 09:49:47 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Fri, 04 Feb 2000 15:49:47 +0100 Subject: Metakit Install hints? References: <87dl9m$1pvl$1@news.hal-pc.org> Message-ID: <389AE6F9.11909385@equi4.com> Steven, > I want to play with the database capabilities of metakit. Neat! > I downloaded mk-i586-pc-linux-gnu.tar.gz, untarred it into > ~/pyth/mk-i586-pc-linux-gnu > > The README under UNIX does not seem to have any relation to what I am > seeing in the mk-i586-pc-linux-gnu directory. No .configure > executable, no INSTALL. I'm sorry. I hate installs (long story... check the TclKit pages on www.equi4.com as an example of where I'm headed). Unfortunately, I forgot to make it clear that Mk4py does not need any install. Do this: - get the proper binary: Mk4py.so in your case - put it next to a demo script such as this one: import Mk4py db = Mk4py.Storage('data.mk',1) vw = db.getas('people[name:S,age:I]') vw.append(name='Tarzan',age=67) vw.append(name='Jane',age=23) db.commit() for r in vw.sort(vw.age): print r.name, r.age - that's it for the current 2.0 release I intend to include a small example such as the above and better "getting started" notes in the next release. Also more Python code written on top of this raw core, to be added as a "mk.py" wrapper. > What I really need is a short rundown on how to get metakit working > with Python 1.5.2 No big dissertation needed. I hope the above suits you. > Environment is SuSE Linux 6.3 2.2.14 Intel If doesn't work out of the box due to glibc nastiness or other, then you'll need to rebuild it from the source distribution, which uses a standard autoconf/libtool-based setup. If you have questions, you might want to post them on the MK-Scripting mailing list, see: http://sourceforge.net/mail/?group_id=736 -- Jean-Claude From wrlddomprod at hotmail.com Fri Feb 25 10:35:11 2000 From: wrlddomprod at hotmail.com (Shawn LeBlanc) Date: Fri, 25 Feb 2000 07:35:11 PST Subject: Phython as In-Game scripting language Message-ID: <20000225153511.19694.qmail@hotmail.com> Greetings! >What sort of game are you writing? First person shooter on PC? Right now, it's more R&D than anything else. The idea is having a more-or-less generallized 3d engine, but the actual design seems to lean towards the Quake/Unreal model. So, we would be able to make a FPS with it, but that's not our goal as of yet. As a slightly off topic question, which other languages like Python could be embedded efficently in a game project? I've seen that several games use Lua (Grim Fandango), and there's got to be other games that use embedded languages. What would be the advantages and disadvantages of using Python in a game? with milk and cookies, Shawn ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From vetler at ifi.uio.no Wed Feb 23 18:35:27 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: Thu, 24 Feb 2000 00:35:27 +0100 (MET) Subject: Which GUI? In-Reply-To: <20000223203945.C4980@stopcontact.palga.uucp> Message-ID: on 2000-02-23, Gerrit Holl wrote: > > > It provides their own classes. These classes are invented by Tkinter, they > > > do not exist in Tcl/Tk. And the methods don't even *match* with Tcl functions! > > > > I must admit I'm on new territory here. I've only been using Python and > > Tkinter for ~5 months or so. So my statements may have nothing to do with > > reality. I appologize. > > I think this is ironic. As soon as I got stuck for many hours searching > Tcl manpages for Python calls and having to read Python source code to > find out the Python way to do something described in the Tcl manpages, I > stopped using Tkinter. I guess it's easier if you're familiar with Tcl. > > But, as I have nothing more interesting to say about this, I will shut up > > Me neither, but I find Fredrik's reaction very strange, especially > because he mentions my "madness" everywhere in c.l.py now! He's probably trying to be funny ;-) vr From gerrit.holl at pobox.com Sun Feb 6 15:50:38 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sun, 6 Feb 2000 21:50:38 +0100 Subject: OFFTOPIC: opensource (Was: Re: chdir questions) In-Reply-To: <389D741F.421DA0DD@python.net>; from tbryan@python.net on Sun, Feb 06, 2000 at 08:16:15AM -0500 References: <389D741F.421DA0DD@python.net> Message-ID: <20000206215038.A12351@stopcontact.palga.uucp> Thomas A. Bryan wrote on 949821375: > ...for os.chdir in the Python libraries. It's defined *somewhere*, and > I'm sure that someone will show me where. One of the greatest things > about open source is that you're never really stuck. For example, if > you can't figure out how to use glob, you can always look at glob.py > to see what it does. Correction: One of the greatest things about open source is that *programmers* and *geeks* are never stuck. I can't look at the Mozilla, KDE, X or kernel source code to see what it does. Others can. I can't. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From tjreedy at udel.edu Thu Feb 24 18:15:03 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 18:15:03 -0500 Subject: 1000 GUI toolkits References: <5l3dqjckt5.fsf_-_@eric.cnri.reston.va.us> <892b21$127$1@nntp6.atl.mindspring.net> <20000224132812.A3201@stopcontact.palga.uucp> Message-ID: <894diu$o80$1@news.udel.edu> "Gerrit Holl" wrote in message > HTML is not designed to be interactive, so HTML should not be used interactive. HUH? pdf is not interactive, HTML is, with links and forms. Many web sites (take Ebay for instance) are almost completely interactive, with just a few prewritten pages. > If you rewrite Pysol in HTML, you'll get a prize. Agreed that fine-grained interaction, such as with games, is a poor application for HTML. Terry J. Reedy From r at t.com Mon Feb 28 16:37:14 2000 From: r at t.com (test) Date: Mon, 28 Feb 2000 13:37:14 -0800 Subject: does pythonwin support adsi` Message-ID: and were to I get examples? thanks tr From fdrake at acm.org Fri Feb 4 13:39:38 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 4 Feb 2000 13:39:38 -0500 (EST) Subject: Bug in ConfigParser.py In-Reply-To: References: Message-ID: <14491.7402.688651.822743@weyr.cnri.reston.va.us> neale-news at lug.freei.net writes: > This was a bug in an earlier version of Python, then it got fixed, and > now it's back. (Okay maybe it didn't ever get fixed, I might have just This bug has been fixed in the CVS repository. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From shawn_leblanc at my-deja.com Thu Feb 24 13:44:56 2000 From: shawn_leblanc at my-deja.com (shawn_leblanc at my-deja.com) Date: Thu, 24 Feb 2000 18:44:56 GMT Subject: Phython as In-Game scripting language References: <20000222211406.41743.qmail@hotmail.com> <891g7l$cf8$1@nnrp1.deja.com> Message-ID: <893u76$46l$1@nnrp1.deja.com> Greetings! Just so I understand (and also because my programmer teammates are asking me questions), is unmodified (no stackless or microthreads) Python unable to run multiple scripts at the same time? I'm thinking no because if Python was able to run multiple scripts simultaneously, there wouldn't be a need for SP or MT's. with milk and cookies, Shawn Sent via Deja.com http://www.deja.com/ Before you buy. From mcalla at home.com Thu Feb 3 21:49:48 2000 From: mcalla at home.com (Mike Callahan) Date: Fri, 04 Feb 2000 02:49:48 GMT Subject: Where is Python 1.6? References: <3898ABDB.86804799@home.com> Message-ID: <389A3E61.47E255A0@home.com> Thanks for the info. I will look forward to the new features, especially the string methods. Robin Dunn wrote: > > "Mike Callahan" wrote in message > news:3898ABDB.86804799 at home.com... > > I thought that a new Python was going to be released "soon" which would > > make some minor changes to the language. The one thing that struck in my > > mind is that one would call string methods rather than functions, ie. > > astring.upper() vs. string.upper(astring). There were other changes as > > well. > > > > An alpha is scheduled to be released in March, with final release in the > Summer. > > -- > Robin Dunn > Software Craftsman > robin at AllDunn.com > http://AllDunn.com/robin/ > http://AllDunn.com/wxPython/ Check it out! From effbot at telia.com Sun Feb 6 17:18:56 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 06 Feb 2000 22:18:56 GMT Subject: import statement suggestion/question References: <87kpdl$ohe$1@watserv3.uwaterloo.ca> Message-ID: Kannan Vijayan wrote: > wouldn't it be easier to maybe modify the import statement itself > to something like this: > > import LongModuleName as LMN > or to avoid using up reserved words > import LongModuleName(LMN) > import LongModuleName:LMN > > you get the idea. > > it would allow people to get rid of the sometimes-annoyingly-long > module names, and still keep the code clean and easy to understand. > > It would also help when you want to import modules, but keep them > hidden using the prefix _ notation. this has been suggested many times before. the usual counter argument is that those lengthy prefixes makes your code much easier to read, and that allowing arbitrary renaming is a great way to confuse the hell out of people (explicit renaming using assignments are pretty bad style, imho...). for more on this topic, see the archives. From effbot at telia.com Fri Feb 11 14:30:58 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 19:30:58 GMT Subject: will python 3000 break my code? References: Message-ID: Moshe Zadka wrote: > > (if your ideas are good enough, someone will > > drop by your home some night, and teach you > > the secret handshake ;-) > > Fredrik, if you keep uncovering PSU tactics, someone might drop > by *your* house. For nothing as pleasent as handshakes, you know. you drove that white audi? didn't look like you, but you sure scared the hell out of me. From bcwright at home.com Thu Feb 10 01:55:37 2000 From: bcwright at home.com (Brian C. Wright) Date: Thu, 10 Feb 2000 06:55:37 GMT Subject: Several questions: python plugin, xml-rpc + Medusa References: <38A01C84.88229E45@ttm.com> <14496.21079.898203.98612@beluga.mojam.com> Message-ID: <38a27758.30880634@news> On Tue, 8 Feb 2000 11:28:55 -0600 (CST), Skip Montanaro wrote: > > Scott> Second question: has anyone melded the xmlrpclib stuff to Medusa > Scott> yet, other than Zope? If I were to need something like that, > Scott> should I just use Zope? I'm trying to keep things lightweight, > Scott> and I don't need the full-fledged Zope framework (which is verra, > Scott> verra nice, but the master of the castle already has one, you > Scott> see...) > >I use the ZServer component of Zope with XML-RPC without using all of Zope. >ZServer is built on Medusa, so it would appear the good folks at Digital >Creations have already done the legwork you require. I am just starting to stumble down this same path, with the idea of publishing XML based on information that is retrieved from a relational database. This seems like it would be a fairly standard use, has anybody had any experience with the database integration part of this? Thanks, Brian From nielsenjf at my-deja.com Fri Feb 11 23:28:03 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Sat, 12 Feb 2000 04:28:03 GMT Subject: Session variable in python References: <87q726$8ir$1@nnrp1.deja.com> <87qe1n$ds5$1@nnrp1.deja.com> <87sbgq$nga$1@nnrp1.deja.com> Message-ID: <882ngg$di1$1@nnrp1.deja.com> You're right that was a screw-up on my part. I'm perfectly comfortable in both unix and windows. I even use linux as my main box at home :-) In fact, the primary reason I chose a deja account btw is because they use linux and I respect the service they provide. When I read it now, it's obvious that he wasn't specific enough. When I read it then, I just keyed on 'session' and my tired head thought oh, another person have problem with session variables. Oops. Have a great day, john -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From embed at geocities.com Tue Feb 15 08:56:27 2000 From: embed at geocities.com (Warren Postma) Date: Tue, 15 Feb 2000 08:56:27 -0500 Subject: A little present. References: Message-ID: > Here's one: > > class Hole: > pass Can anyone give me a useful example of WHY you'd want to do this, or is this just more weird example of Functional Code-Fu? { If do right, no can defend. } Warren From jae at ilk.de Thu Feb 24 21:35:34 2000 From: jae at ilk.de (Juergen A. Erhard) Date: Fri, 25 Feb 2000 03:35:34 +0100 Subject: jack, curses and rpms In-Reply-To: <1260689398-5933775@hypernet.com> (gmcm@hypernet.com) References: <1260689398-5933775@hypernet.com> Message-ID: <25022000.1@sanctum.jae.ddns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>>>> "Gordon" == Gordon McMillan writes: [...] >> Okay, so I got cursesmodule.c from the CVS... tried to patch it with >> the included diff... which failed. >> >> Huh? >> >> So, I checked that... and found that I needed the cursesmodule.c from >> the Python RPMs. I got that and patched it... and all's well. >> Gordon> If the cursesmodule.c in the RPM differs from cursesmodule.c Gordon> from the official 1.5.2 download, you've got a legitimate gripe Gordon> with Debian. Presumably they'll pick up what you're seeing in Gordon> CVS when it becomes the official 1.6. I think I expressed it clearly enough, but so what... I did get the cursesmodule.c from the Python(!) CVS (the one that is on python.org). The patch from the jack tarball didn't work with that, but with the cursesmodule.c from the RPMs... I investigated a little more... the module in the RPMs is 1.5b2 (by Oliver Andrich), whereas the module in the Python CVS is 2.19 (okay, that is a CVS revision...). Both are apparently based on Lance Ellinghouse' revision 1.2. Now, *that* is pretty ancient (the latest entry in the `Change Log:' is `Version 1.2: 95/02/23 (Steve Clift)'. The last change in CVS was 13 months ago... Why two versions? Did Oliver forget to submit his patches to Guido (et al)? Or did Guido not accept them? If so, why not? What needs to be done to synchronize the canonical Python and the Python RPMs? Bye, J PS: BTW, I check the Debian source package for 1.5.2-6 (the latest in frozen potato ;-) The cursesmodule.c in there is the same (byte for byte, I just checked) as the one in CVS (again, Python CVS). PPS: I hope I haven't missed some secret Python CVS... but if it's secret, I *had* to miss it ;-) - -- J?rgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326 My WebHome: http://JuergenErhard.tripod.com GTK - Free X Toolkit (http://www.gtk.org) "No matter how cynical I get, I can't keep up." -- Bruce Schneier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: Use Mailcrypt and GnuPG iEYEARECAAYFAji16nMACgkQN0B+CS56qs1/CgCfR9j6jreWzjNoOyEM4R4kZ3Mg Sy0An3kZns7i6g6HWxi9qpbQi+NyuWJe =GzKB -----END PGP SIGNATURE----- From gmcm at hypernet.com Sat Feb 5 12:53:14 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Sat, 5 Feb 2000 12:53:14 -0500 Subject: deleting global namespaces In-Reply-To: <87fm8a$v4j$1@nnrp1.deja.com> Message-ID: <1262349316-5889467@hypernet.com> Martin has a strange question: (At first read, I did not understand your question; and it looks like that's a common problem.) > I'm embedding Python in a multimedia engine > > My idea is that each component will sit in > a module and there will be some functions which > will take care of starting the module and performing > clean up upon exit. > > But the problem is there is no way to force Python to > delete module together with all variables/functions > which exist in its global namespace - that is > I cannot perform any clean up. Upon exit I would > have to go through all global objects and delete > them explicitly, but I cannot do this, because > throughout the application one module can be > started multiple times and each time it has to > run like it was started for the first time. One problem is figuring out what the expected lifetime is. How do you know whether two usages should share the same module object, or each needs it's own copy? How do you know when a particular one should go away? > Is there some workaround (including patches to the > source code) to do this with modules or some other > way to create and delete new global namespace? Sure. You can force reloads of modules; particularly from C, you can do nasty things to a module's __dict__. > I do not want to create new subinterpreter for each > application's component because I want all components > to use the same built in modules and I want to pass > an application-wide dictionary between each component's > namespace. Builtins are not a problem. There's only one copy. I have no idea what you mean by "component" in this context, but you could create new (empty) modules (look at how __main__ is created) and then import the others into that namespace. You could add a builtin to provide access to your app object. You can do about the same from pure Python by using __import__, exec and execfile, and managing the dicts that get used as globals and locals. I think it would be saner to use explicit objects that hold the state you're now using the modules' globals for. You can pass these around, create them and destroy them, all without resorting to cryptic Python or reams of mind numbing C code. - Gordon From MSteed at altiris.com Wed Feb 2 13:46:43 2000 From: MSteed at altiris.com (Mike Steed) Date: Wed, 2 Feb 2000 11:46:43 -0700 Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) Message-ID: <65118AEEFF5AD3118E8300508B124877073D54@webmail.altiris.com> > From: Warren Postma [mailto:embed at geocities.com] > Sent: Wednesday, February 02, 2000 11:03 AM > To: python-list at python.org > Subject: Developer Soup (Software Carpentry, Python, Eiffel, KDevelop) > > What the World Needs Now: > > While I agree with Mr. Wilson's "Software Carpentry" ideal, > and avoiding > 'accidental complexity', it seems to me that the $850K being spent on > resuscitating these crusty old Unix command line tools (chiefly make, > autoconf, and automake) to make new command line tools is a > perfect example of the things he criticizes in programmers like me. > > I think it would be far better to invest in building tools to > plug into an already started new development environment. After all, > "It's not the 70s anymore Dorothy". > > KDevelop is clearly in the lead as a portable cross-platform > IDE, and I think $850K could do a lot to help it along. Once people > are writing their software in a world-class IDE, instead of sitting > in Bash, vi and EMACS all day, I think we would safely be able to > say that Unix had caught up to the Windows platforms of the late > 1990s. Let's at least be realistic, folks. Not intending to stray too far off-topic... You might be surprised at the number of people who have tried the "world-class IDEs" on Windows and other platforms and found that they are just as productive (or more so) with "crusty old Unix" tools such as those you mention. I do most of my development on Windows, using Vim, zsh, gcc, make, etc. There is no functionality in MSVC++ that I miss with my tools. In fact, several developers I work with who have been long-time MSVC++ fans have switched to these crusty tools because they have tried them and found them to be more productive. :) -- M. From tim_one at email.msn.com Mon Feb 14 22:22:09 2000 From: tim_one at email.msn.com (Tim Peters) Date: Mon, 14 Feb 2000 22:22:09 -0500 Subject: breaking the ; habit In-Reply-To: Message-ID: <000b01bf7763$d84177a0$66a2143f@tim> >> ["Dirk-Ulrich Heise" ?crit:] >>> [Fran?ois Pinard schrieb in Nachricht ...] >>>> "Tim Peters" writes: >>>> >>>>> The one problem I am having is that I can't break myself of the >>>>> semicolon habit. >> [probably Dirk] >> No, Tim Peters didn't write that. >> Take a little bit more care when quoting people. [back to Fran?ois] > ... > OK, ok! Instead of arguing (and I hope you read the implied > smileys), I agree that I should be more careful at attributing > all quote levels, and maybe not attribute empty quotes :-). I'll > try to be more careful. No offence was intended, and I presume > that Tim did not take any... No problem here. To the contrary, it fed very nicely into the timbot's charming delusion that it writes *everything* on c.l.py! I suspect it knows better -- but even bots get off on power fantasies. wishing-you-luck-in-breaking-your-heroin-habit-ly y'rs - tim From embed at geocities.com Wed Feb 9 11:41:55 2000 From: embed at geocities.com (Warren Postma) Date: Wed, 9 Feb 2000 11:41:55 -0500 Subject: Const and the Zen of the Pythonista Message-ID: I had a Zen like breakthrough today. Or maybe not. After making peace with tab-indent stuff last week, the next thing to do was wonder where my old friend, the "const" keyword went. The debate over constants in this newsgroup showed a clear division of opinion, but I couldn't see for sure why it was good to leave the feature out of the language. Today, I realized the obvious. All const does is make an already strictly typed language (at compile time) even more strict (and yet, only at compile time) by catching some errors that can be caught at compile time. That is the way of all compiled languages, and "const" is a good thing to have. However, since Python isn't compiled, nor statically typed, introducing the "const" keyword would be incongruous, like wearing brown shoes with a tuxedo. You would be introducing a runtime check in every variable write (is this variable const, if so fail) and lowering performance, to duplicate at runtime something that C only checks at compile time anyways. Am I finally getting it or have I merely become a language-lawyer overnight? Sigh no more, ladies, sigh no more, Men were deceivers ever,-- One foot in sea and one on shore, To one thing constant never. Much-ado-about-nothing'ly-yr's Warren From gsl1 at erols.com Fri Feb 11 16:48:56 2000 From: gsl1 at erols.com (Gregg Leichtman) Date: Fri, 11 Feb 2000 16:48:56 -0500 Subject: Q: Access JPython interpreter obj while inside it? Message-ID: <38A483C8.51285FB7@erols.com> Can anyone tell me how I might go about grabbing a reference to the JPython interpreter object I'm running interactively within? I want to pass the reference to an application Z that has been started from within the interpreter and then use reflection from Z to run the eval method of the interpreter on a script object that has also been built in the interpreter and been passed to Z. Why don't I just embed JPython in Z? Because I already have a perfectly good interpreter sitting in memory and I don't want to create another one with its concomitant memory overhead. Why don't I just compile the scripts to Java classes and use them directly from Z? Because I want to do something on the fly. Any help would be greatly appreciated. Please, e-mail if you also post. Thanks in advance. -- Gregg Leichtman, Ph.D. Remove N0SP&M to reply. From tjreedy at udel.edu Thu Feb 24 18:28:20 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 18:28:20 -0500 Subject: unsubscribe (HOW TO) References: Message-ID: <894ebt$oig$1@news.udel.edu> "Oscar Mendez" wrote in message news:NEEBLKCKPCKCAGFDPENDEEOGCAAA.oscar at math.cinvestav.mx... > Please somebody tell me how to unsubscribe me of this list. Look for the appropriate page at www.python.org You may need the password that should have be emailed monthly. From moshez at math.huji.ac.il Fri Feb 18 08:14:23 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 15:14:23 +0200 (IST) Subject: Problem in Using re.subn() In-Reply-To: <38AD3BEF.221D4108@worldnet.att.net> Message-ID: On Fri, 18 Feb 2000, Joseph C. Kopec wrote: > SubResult = re.subn('', Content, > TemplateInput) This treats the '' as a regular expression. Use string.replace instead. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From paul at prescod.net Mon Feb 7 21:03:29 2000 From: paul at prescod.net (Paul Prescod) Date: Mon, 07 Feb 2000 20:03:29 -0600 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F75B9.C7F38C52@bellsouth.net> Message-ID: <389F7971.B2DFEAB@prescod.net> Xenophanes wrote: > > Go to Guido's site and read about his desire to have a language that is > easy for non-programmers to learn. Python is not meant to replace C. I don't think that fcahoon said that Python was meant to replace C. Your message seems to me to be admitting that Python isn't good for "real programmers" and is only appropriate for beginners. I think that when a "real programmer" wants to discuss Python's virtue as a "real programming" language we should do so happily. Python is excellent for real, complex, large-scale systems. -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "If I say something, yet it does not fill you with the immediate burning desire to voluntarily show it to everyone you know, well then, it's probably not all that important." - http://www.bespoke.org/viridian/ From Alessandro.Bottoni at think3.com Thu Feb 3 10:09:08 2000 From: Alessandro.Bottoni at think3.com (Alessandro Bottoni) Date: Thu, 3 Feb 2000 16:09:08 +0100 Subject: Python/Tkinter GUI builders? Message-ID: <6D8A17398E28D3119F860090274DD7DB498484@pces.cadlab.it> I'm looking for a GUI Builder for Python/TKinter. In the Vaults of Parnassus I discovered the (very interesting) project of Henning Schoder: ViPyl ( see http://vipyl.sourceforge.net/ ). Unfortunately, ViPyl is at an early development stage at the moment and cannot be used for real programming. Does anybody knows of any other GUI Builder for TKInter? Thanks -------------------------------- Alessandro Bottoni (Alessandro.Bottoni at Think3.com) (alessandro.bottoni at libero.it) Web Programmer Think3 inc. (www.think3.com) From a.eyre at optichrome.com Wed Feb 23 13:13:00 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Wed, 23 Feb 2000 18:13:00 -0000 Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47 In-Reply-To: <1260862583-6978501@hypernet.com> Message-ID: <002f01bf7e29$9e5012f0$3acbd9c2@peridot.optichrome.com> >> ['a', 'b', 'c'].join() > You would put a method on sequence that only works if the > sequence contains certain types? That's a really nasty > precondition. Requiring the arg to string.join be a sequence > containing only strings is a much saner precondition. How about a compromise. Keep the method on a string object, but call it something else. After all, it's not 'join'ing the object to which it is attached. >>> " ".fill(["a", "b", "c"]) 'a b c' Not too sure about 'fill' though... ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From billtut at microsoft.com Tue Feb 1 14:49:42 2000 From: billtut at microsoft.com (Bill Tutt) Date: Tue, 1 Feb 2000 11:49:42 -0800 Subject: MAPI and NT Service Message-ID: <4D0A23B3F74DD111ACCD00805F31D8101D8BCC97@RED-MSG-50> > -----Original Message----- > From: Michel Orengo [mailto:michelorengo at netscape.com] > > Mark Hammond wrote: > > > MAPI defers alot of security stuff until actually needed. What user > > is the service logged on as? I would guess that it is NT/Exchange > > security related rather than your script... > > > He's asking what user your service is logged in as. If it isn't logged on as the NT user associated with the MAPI mailbox and combined with Marks remark about MAPI deferring security checks until actually needed this could be whats causing your problem.... Bill From tjreedy at udel.edu Sat Feb 19 15:20:50 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 19 Feb 2000 15:20:50 -0500 Subject: Killer Apps??? References: Message-ID: <88mtp2$8ng$1@news.udel.edu> > > I was wondering if there were any other such killer apps? I have not used it yet but Numerical Python and scientific computing with Python in general must be added to the list. See several of papers from the recent conference (accessible via the site) for examples. From hgg9140 at seanet.com Tue Feb 22 18:44:39 2000 From: hgg9140 at seanet.com (Harry George) Date: 22 Feb 2000 15:44:39 -0800 Subject: eqiv of perl's CGI.pm? References: <38B23CD8.8C2DE915@inka.de> Message-ID: Your cgiforms.py looks inteesting, and seems to cover the needed functions, but it doesn't solve my problem. The python code has to look and feel somewhat like perl with the CGI.pm. E.g., same names, same parameter order, etc. It is hard to explain without looking at the CGI.pm module itself. FYI: I've begun this task with: a) pyperl.PyPerl: a class which gives a perl-like feel to the program. Based on a similar Perlish.i3/m3 I did for Modula-3. (One complaint form perl programmers is that they can't remember which module has which functionality in python. So this class flattens the namespace for common items. So far it looks like: #--make new--- p.mkdir(newdir) or p.die("cannot make %(newdir)s" % locals()) p.chdir(newdir) or p.die("cannot cd to %(newdir)s" % locals()) myfile=p.open(">"+filename) if not myfile: p.die("cannot open %(filename)s" % locals()) p.print_("before writing to file\n") old=p.select(myfile) p.print_("writing to %(filename)s\n" % locals()) myfile.close() p.select(old) p.print_("after writing to file\n") myfile=p.open("<"+filename) if not myfile: p.die("cannot open %(filename)s" % locals()) lines=p.input(myfile) for line in lines: p.print_("line="+line) I've stumbled over: (1) "print" is a keyword, and thus cannot be redefined, so I use "print_" (2) can't set value of a parameter, so "open" has to return file instead of setting it (3) need to know caller (so I can look in caller's __dict__) -- that would allow hidden expansions of $ and @ vars in text strings; so I have to do % locals() for now. b) pyperl.cgipm.CGI: a class which replicates the CGI API. The OO approach to using it looks like: #------------------------- def processform(self): print self.header() title='Test02: CGI response' print self.start_html(title=title,author='John Doe') print '

',title,'
' print "

Hello, world" print self.end_html() #-------------------------- def sendform(self): print self.header() title='Test02: CGI form' print self.start_html(title=title,author='John Doe') print '

',title,'
' print "

Hello, world" print self.startform(action='http://wilma/cgi-bin/hgg9140/test02.py', method="GET") print self.textfield(name="mytextfield",default="hello, world",size=50, maxlength=4) print self.endform() print self.end_html() The in-line approach looks like: query=CGI() query.header() ... Michael =?iso-8859-1?Q?Str=F6der?= writes: > "Harry G. George" wrote: > > > > I have the opportunity to convert a lot of perl cgi's to python. But > > I need to make them look similar to perl's CGI.pm API. (The users have > > just barely gotten comfortable with Perl and CGI.pm.) > > > > python's cgi.py is good for reading forms, but I need to build forms too. > > cgi.py doesn't address this. HTMLgen is overkill. Anyone doing a > > CGI.pm workalike? > > What exactly does CGI.pm? I have a module cgiforms.py with which you > can pre-define input fields in a form and output the single input > fields. The input parameters are checked against reg exp. you define > with the input field. E.g. my project http://web2ldap.de/ is based > on that. Your mileage may vary... > > Have a look at http://sites.inka.de/ms/python/pylib/. If you're > interested in using that drop me a note and I will package a newer > version with demo script. > > Ciao, Michael. -- Harry George hgg9140 at seanet.com From eschen42 at my-deja.com Sun Feb 6 18:32:30 2000 From: eschen42 at my-deja.com (eschen42 at my-deja.com) Date: Sun, 06 Feb 2000 23:32:30 GMT Subject: Q: How to Lock Zope-shared file with DAV Explorer References: <87fdqv$ofq$1@nnrp1.deja.com> Message-ID: <87l0af$fc1$1@nnrp1.deja.com> eschen42: your problem is that Zope is only a Class 1 implementation of a web server. You probably need class two for locking. See the following URL, for instance: http://www.itc.virginia.edu/atg/techtalk/webdav/tsld021.htm In article <87fdqv$ofq$1 at nnrp1.deja.com>, eschen42 at my-deja.com wrote: > I just downloaded Zope 2.1.3 and DAV Explorer 0.59 (both for x86 NT4). > > I can connect to the Zope server (the "zopebox") with both my browser > and DAV Explorer. I can get files just fine. However, when I try to > lock files (e.g., index_html at the root), I get the message "This > resource does not support locking". Does the file need to be in a > database in order to support locking? Or is there some administrative > thing that I'm supposed to do first? > > Thank you. > > Sent via Deja.com http://www.deja.com/ > Before you buy. > Sent via Deja.com http://www.deja.com/ Before you buy. From jfarrell at mincom.com Mon Feb 21 22:05:48 2000 From: jfarrell at mincom.com (John Farrell) Date: Tue, 22 Feb 2000 13:05:48 +1000 Subject: Life's better without braces References: <20000221211145.B3016@stopcontact.palga.uucp> Message-ID: <38B1FD0C.774502DA@mincom.com> Gerrit Holl wrote: > I have a problem. In my Python enthuishasm, I ripped off the braces > from my keyboard because I thought I didn't need them. > Unfortunately, I have a problem now. I can't create dictionairies any > more! And because braces aren't the only keys on the brace key, > I can't create lists either. The solution for the latter is list(()), > but how do I create an empty dictionairy without braces? Gerrit, just get an old C program you don't need any more, and cut them out of that and stick them on your Python program. There is plenty of unused C code out there. If you want I can send you some old MFCs. John -- Dr John Farrell - Research Architect - Mincom Limited I don't suffer from stress. I am a carrier. -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d- s++:+ a C+++ U+ 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------ This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this E-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. From neelk at brick.cswv.com Sun Feb 13 14:24:37 2000 From: neelk at brick.cswv.com (Neel Krishnaswami) Date: 13 Feb 2000 19:24:37 GMT Subject: Real Problems with Python References: <000e01bf7605$02aefe00$962d153f@tim> Message-ID: Michael Hudson wrote: > > It would also be nice if people got the terminology right; Python > *is* lexically scoped, because references to a name can only appear > within code that is textually contained in the establishing contruct > (says he paraphrasing from cltl2).The alternative is the poorly > named "dynamic scope" which would mean things like: [..examples > elided...] Python is most definitely neither lexically scoped nor dynamically scoped, as either term is commonly used. I've found that describing Python as having three scopes pretty much gets the idea across unambiguously. Neel From jeremiah at widomaker.com Mon Feb 7 10:47:22 2000 From: jeremiah at widomaker.com (Jeremiah Rogers) Date: Mon, 07 Feb 2000 15:47:22 GMT Subject: nonlinear programs Message-ID: <389E074A.9FC63494@widomaker.com> is there a way for me to start on a function, then move onto another function before that function ends? I am working on an mpg123 frontend, and i want to start a song playing, then allow the user to either skip that song, or perform other essential tasks during the time when a song is playing. is this possible? From corg at copernic.com Tue Feb 29 10:50:16 2000 From: corg at copernic.com (Gaetan Corneau) Date: Tue, 29 Feb 2000 10:50:16 -0500 Subject: Need some pointers for Apache info Message-ID: Hello, For those who know me, I have begun work at my new job at Copernic Technologies inc (http://www.copernic.com) yesterday, after four years with the Baan company. This job offers new challenges, and I still count on Python as one of my favorite tools. My first assignment would be simple if I had more knowledge on the subject, so maybe someone here can help. I have to write an Apache module that will receive a list of file names from a client, then stream all the files in a single connection. The server will run on a Linux box. First question (not really Python related, sorry, please reply privately): do I need an Apache module to do this? Second question: I have heard about tools to write Apache modules using Python (mod_python?). I am searching for info right now, but any help/pointers would be appreciated. Please keep in mind that I know nothing about Apache (but I'm willing to learn). Thanks in advance! ______________________________________________________ Gaetan Corneau Software Developer Copernic Technologies inc. http://www.copernic.com E-mail: corg at copernic.com ______________________________________________________ "Tu l'as trop ?cras?, C?sar, ce Port Salut" -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/B/MU d- s+:++ a C++ UL+ P--- W+ N- K- W++ t-- !5 X- R+ tv-- b++ DI++ G e++ h---- r+++ y++++ ------END GEEK CODE BLOCK------ From effbot at telia.com Wed Feb 23 15:09:04 2000 From: effbot at telia.com (Fredrik Lundh) Date: Wed, 23 Feb 2000 20:09:04 GMT Subject: Tkinter installation problems References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <38B40EBD.13EC1C1E@math.utah.edu> <38B417B2.C03EEC3B@math.utah.edu> <80Vs4.7659$al3.101405@newsc.telia.net> <38B434F4.987A5750@math.utah.edu> Message-ID: Mladen Bestvina wrote: > > well, that only means that wish was linked against 8.0, > > not that _tkinter.so is linked against it... > > > > but alright, try setting TK_LIBRARY and TCL_LIBRARY to > > point to the configuration files, e.g: > > > > % export TCL_LIBRARY=/usr/local/lib/tcl8.0/library > > % export TK_LIBRARY=/usr/local/lib/tk8.0/library > > That didn't make any difference. which is as expected -- if you're using 8.1 or newer, without the appropriate patch. but since you say you don't, I cannot help. please let us know if/when you figure out what's wrong with your installation. From jbauer at rubic.com Sun Feb 6 23:52:07 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Sun, 06 Feb 2000 22:52:07 -0600 Subject: Database for storing heterogeneous "message" objects References: Message-ID: <389E4F77.C26493A9@rubic.com> Jason Stokes wrote: > I want to use a database to store sets of heterogeneous > "message" objects, which currently cover email and news > messages, but will be extended more generally to include > messages in web-accessible archives and other "email-like" > things. Point your browser to where the topics of Python and Persistence intersect: http://www.python.org/topics/database/persistence.html *Not* listed at the above location is Jim Fulton's ZODB, available at the Zope site: http://www.zope.org Cheers, Jeff Bauer Rubicon Research From wombat2 at hotmail.com Mon Feb 28 04:44:43 2000 From: wombat2 at hotmail.com (julie) Date: Mon, 28 Feb 2000 09:44:43 GMT Subject: Paid to surf Message-ID: Paid to surf Hi im julie , Did you know that you could be paid, in US Dollars, just for being connected to the internet? If you're interested in making some extra cash, reply with "Tell me more (at my89116) " And I'll tell you what to doIf you're not interested, I sincerely apologise for bothring you. Goodluck & Have a nice day! From aa8vb at yahoo.com Wed Feb 16 12:07:34 2000 From: aa8vb at yahoo.com (Randall Hopper) Date: Wed, 16 Feb 2000 12:07:34 -0500 Subject: "reraise" & Exception Transformation (was Re: Modules implicitly exposing exceptions from other modules) In-Reply-To: <14506.49137.572186.132303@beluga.mojam.com> References: <14504.21592.958597.17477@weyr.cnri.reston.va.us> <20000215085250.A2423951@vislab.epa.gov> <159CBC3C9F42FAE9.061D4FC052BB8CA2.1EE498B4C0BC5811@lp.airnews.net> <20000216073900.B2508775@vislab.epa.gov> <14506.49137.572186.132303@beluga.mojam.com> Message-ID: <20000216120734.A2417001@vislab.epa.gov> Skip Montanaro: | Randall> Sadly in Python, with this syntax we loose track of the stack | Randall> frames between the original exception and this exception | Randall> transformation (which would be useful to have if the client | Randall> doesn't handle the error and we print a traceback). But AFAICT | Randall> this is a feature (or deficiency) of the language. | |Watch out for Guido's time machine (again!). The raise statement takes |three (all optional) objects. If you catch the original exception's context |inside the except block using sys.exc_info() you can pass the traceback |object as the third argument to raise, e.g.: | | try: | whole_buncha_hooey() | except socket.error: | type, val, tb = sys.exc_info() | raise NNTPError, NNTPError((val, my_interesting_local_state()), tb Hey, thanks! Gotta love that time machine. The syntax might scare the newbies but I'm glad to see it's there. I notice it doesn't indicate where the exception transformation took place. Traceback (innermost last): File "reraise.py", line 45, in ? inner() File "reraise.py", line 38, in inner outer() File "reraise.py", line 12, in outer raise IOError __main__.MyError: 1, Disk format failure And it doesn't appear that you can add a frame to the traceback object yourself using the traceback module. But that's a small point I can live with. Thanks, Randall -- Randall Hopper aa8vb at yahoo.com From farber at cpan.org Tue Feb 29 19:40:16 2000 From: farber at cpan.org (Alex Farber) Date: Wed, 01 Mar 2000 01:40:16 +0100 Subject: Reimplementing Lib/codeop.py in C fails... Message-ID: <38BC66F0.A5518428@cpan.org> Dear colleagues, I am trying to create a custom "readline" function in C. I have looked at Modules/readline.c, Python/pythonrun.c and Parser/myreadline.c. I've also read the http://www.python.org/doc/current/api/api.html and many postings in Deja.com... I would very appreciate any hints. Here is a simple C code reimplementing Lib/codeop.py for test purposes: int main(int argc, char* argv[]) { char* line; PyObject *globals, *source; Py_Initialize(); globals = PyDict_New(); PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()); /* while (1) { line = readline(">>> "); */ printf("\nCompiling \n"); source = Py_CompileString("for i in [1,2,3]:", "", Py_file_input); if (source == NULL) PyErr_Print(); printf("\nCompiling \n"); source = Py_CompileString("for i in [1,2,3]:\n", "", Py_file_input); if (source == NULL) PyErr_Print(); printf("\nCompiling \n"); source = Py_CompileString("for i in [1,2,3]:\n\n", "", Py_file_input); if (source == NULL) PyErr_Print(); /* free(line); } */ Py_DECREF(globals); Py_Finalize(); exit(0); } Which produces the following output: Compiling File "", line 1 for i in [1,2,3]: ^ SyntaxError: unexpected EOF while parsing Compiling File "", line 1 for i in [1,2,3]: ^ SyntaxError: unexpected EOF while parsing Compiling File "", line 2 ^ SyntaxError: invalid syntax However the comment in Lib/codeop.py suggests, that the errors in the first and the second case should be different. How can I see this difference in my C code? Shouldn't the second string compile? Regards Alex PS: The background is that I am programming a 3D-viewer in C++ which uses some finite elements library (written in my university; not thread-safe), Qt (not thread-safe) and which embeds Python. Because of the not-thread-safeness I have to run FE, Qt and Python in the same thread. But then I can not run PyRun_InteractiveLoop() or PyRun_InteractiveOne() - the Qt would "freeze". So I am running a readline in another thread and send received strings to a UNIX-pipe. Those strings should be read by the first thread and executed with PyRun_SimpleString(). Now I get the problem with the strings like "for i in [1,2,3]:" - the Python needs more input. To detect such cases I was hoping to mimic the Lib/codeop.py and then either save the received string (if more input is needed) or run it with PyEval_EvalCode(). From andy at reportlab.com Thu Feb 24 03:21:53 2000 From: andy at reportlab.com (Andy Robinson) Date: Thu, 24 Feb 2000 08:21:53 -0000 Subject: Installing on Win 2K? References: <89129k$1iv$1@nnrp1.deja.com> Message-ID: <951380513.28193.0.nnrp-09.9e9802e2@news.demon.co.uk> I've had no trouble either with the official Win2k. In fact, I've had no trouble with it for anything at all - way better than NT so far. - Andy Robinson From moshez at math.huji.ac.il Fri Feb 18 15:58:17 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Fri, 18 Feb 2000 22:58:17 +0200 (IST) Subject: None & Ellipsis In-Reply-To: <20000218214032.A8179@stopcontact.palga.uucp> Message-ID: On Fri, 18 Feb 2000, Gerrit Holl wrote: > Hello, > > why aren't None and Ellipsis keywords? Why should they be? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From bradh at mediaone.net Sun Feb 6 02:05:43 2000 From: bradh at mediaone.net (Brad Howes) Date: Sun, 06 Feb 2000 07:05:43 GMT Subject: How do I wrap text? References: <389CD409.C6A884BE@mailexcite.com> Message-ID: Doug Sauder writes: > It seems like there should be some very easy way to wrap long lines of > text. Below is something I've used to format auto-generated email messages. The Sink class referred to is simply a class wrapper around the 'array' module. # # TextFill -- reformats a text block so that each line is no longer than the # indicated margin value. Understands some indentation. # def TextFill( text, margin = 72 ): # # Intialize accumulator for a paragraph of text. # sink = Sink.New() count = 0 indent = '' # # Visit each line of text. Append as much as we can to the current # line until we reach a margin limit, where a new line is formed. If # there is an empty line, a new paragraph is started. # for eachLine in splitfields( text, '\n' ): # # Do we have a paragraph separator? # if len( strip( eachLine ) ) == 0: # # Finish off any active paragraph # if count > 0: sink << '\n\n' count = 0 indent = '' # # Normal processing. # else: # # If the line starts with a space, assume we have indentation. # Don't wrap it. # if eachLine[ 0 ] == ' ': tmp = 0 while eachLine[ tmp ] == ' ': tmp = tmp + 1 indent = eachLine[ : tmp ] if count == 0: sink << indent elif eachLine[ 0 ] == '*': indent = '' # # Copy over words from the line # for eachWord in split( eachLine ): # # Finish line if we have reached the margin. # wordLen = len( eachWord ) if count > 0 and count + wordLen > margin: sink << '\n' << indent count = len( indent ) # # Add word to current paragraph # count = count + wordLen + 1 sink << eachWord << ' ' # # Close any remaining paragraph. # if count > 0: sink << '\n' return sink.Value() def Test(): tmp = '''Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation or any nation so conceived and so dedicated can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field as a final resting-place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. But in a larger sense, we cannot dedicate, we cannot consecrate, we cannot hallow this ground. The brave men, living and dead who struggled here have consecrated it far above our poor power to add or detract. The world will little note nor long remember what we say here, but it can never forget what they did here. It is for us the living rather to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us--that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion--that we here highly resolve that these dead shall not have died in vain, that this nation under God shall have a new birth of freedom, and that government of the people, by the people, for the people shall not perish from the earth.''' print Fill( tmp, 20 ) print Fill( tmp, 40 ) print Fill( tmp, 72 ) -- "Were people this stupid before TV?" -- _White Noise_ by Don DeLillo From jbauer at rubic.com Thu Feb 10 16:12:39 2000 From: jbauer at rubic.com (Jeff Bauer) Date: Thu, 10 Feb 2000 15:12:39 -0600 Subject: perl chomp equivalent in python? References: <021301bf736c$dbf08b20$01ffffc0@worldnet.att.net> <20000210212121.B8912@stopcontact.palga.uucp> Message-ID: <38A329C7.F67DEAF9@rubic.com> Justin Sheehy wrote: > The need for this is also somewhat doubtful. I have yet > to see a real (not contrived) example where string.rstrip() > wasn't the right choice for this sort of thing. In most cases trailing whitespace is probably insignificant, but it would be best not to assume this for all circumstances (e.g. tab-delimited files). I would not want to see string.rstrip() used in library modules, since it could result in a loss of data where the user might not be expecting whitespace to disappear. Of all newgroups, certainly comp.lang.python would be sympathetic to this issue. ;-) Jeff Bauer Rubicon Research From saurabh at americasm01.nt.com Sat Feb 5 20:55:50 2000 From: saurabh at americasm01.nt.com (Chadha, Saurabh [RICH2:2N64:EXCH]) Date: Sat, 05 Feb 2000 19:55:50 -0600 Subject: Tkinter manual!! Message-ID: <389CD4A6.DA550F53@americasm01.nt.com> Hi, Can anybody mail be a postscript of the Tkinter manual, the one on the python.org site, i am not able to print it because of some CS8 missing error from acroread. Thanks, Saurabh From tgabriel at bellsouth.net Mon Feb 7 20:38:23 2000 From: tgabriel at bellsouth.net (Xenophanes) Date: Mon, 07 Feb 2000 20:38:23 -0500 Subject: about the multiple posts References: <87nklj$ct9$1@nnrp1.deja.com> Message-ID: <389F738E.6C47BD6F@bellsouth.net> I have been using Netscape since it started and never had any problem Do you have version 4.7? If not maybe you need to upgrade? Move to another if you want, but Netscape is the best you will find. From alxchltn at my-deja.com Tue Feb 22 02:11:04 2000 From: alxchltn at my-deja.com (alxchltn at my-deja.com) Date: Tue, 22 Feb 2000 07:11:04 GMT Subject: New User References: <88t9bi$bjo$1@nnrp1.deja.com> Message-ID: <88tcq7$dpr$1@nnrp1.deja.com> In article <88t9bi$bjo$1 at nnrp1.deja.com>, wilrader at my-deja.com wrote: > I'm new to Python and I was wondering if someone could tell me how do > to it and where I can get UNDERSTANDABLE tutorals. First, download Python 1.5.2: www.python.org/download/ Are you new to programming? Check out Alan Gauld's tutorial.Follow the link from the Python help page: www.python.org/help If your looking for help getting started, I belong to a new Python study group geared to newbies(but all levels welcome). First read the conditions I posted in a note at: http://www.python.org/mailman/listinfo/tutor If your still interested, then procede to: python-studies-subscribe at egroups.com good luck, G.T. Norton Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Sun Feb 13 15:37:05 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 20:37:05 GMT Subject: Python aka. Smalltalk Lite? References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com><389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be><38A06C31.70753311@prescod.net><1e5p96a.j3ozlb1pjsw8dN%bparsia@email.unc.edu><38A19E79.5E88D2FC@prescod.net> <38A231E3.587D4928@prescod.net> <86ya8szq90.fsf@g.local> <881ac8$qu4$1@sun.rhrk.uni-kl.de> Message-ID: Markus Kohler wrote: > > seriously, what are the major shortcomings in Python > > from a Smalltalk professional's perspective? > -- Smalltalk's calling mechanism is much simpler than Pythons making it > easier to compile. can you elaborate? as I see it, python's calling mechanism involves passing a tuple (and an optional keyword dictionary) to a callable object. how does smalltalk differ from this? > Almost every Smalltalk implementation I have seens runs > faster than Python. just one simple question: reading some smalltalk code makes me think that smalltalk requires you to declare what instance variables you're going to use? is this true? can you add extra stuff to an instance afterwards without any extra cost? (should of course figure that out myself, but I don't seem to be squeak-compatible ;-) From fdrake at acm.org Thu Feb 17 14:22:13 2000 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 Feb 2000 14:22:13 -0500 (EST) Subject: Where is Imaging.h? In-Reply-To: References: <14508.11387.761765.788240@weyr.cnri.reston.va.us> Message-ID: <14508.19045.177736.855108@weyr.cnri.reston.va.us> Moshe Zadka writes: > Well, Fred, that is harder then you think. (It shows that you're using > Solaris at CNRI). Consider a regular Linux Python user. He installed > Python from the .deb (well, okay, I didn't mean regular regular, but the > same argument goes for .rpm), so it is in /usr/bin/python. But when he > installs, say, PIL from the sources, he wants it in /usr/local/lib/... > > That is, don't confuse the directory Python was installed in and the > directory the users want to install new sparkling Python modules in. An excellent point. I don't know how important it is. Python extensions, at least under Unix, are built for particular Python setups. That tells me that there should be someplace associated with that Python installation that is used for includes as well as installed extension modules, which points to the site-python approach. You're making it sound like the site-python dirs should be located in /usr/local even if the "native" installation is in /usr for these modern Linux distributions that stick everything in /usr. I don't know what the "right" solution is, but I suspect it involves separating the prefix/exec-prefix versions of site-python from the prefix/exec-prefix of Python. -Fred -- Fred L. Drake, Jr. Corporation for National Research Initiatives From trentm at ActiveState.com Wed Feb 16 07:31:06 2000 From: trentm at ActiveState.com (Trent Mick) Date: Wed, 16 Feb 2000 12:31:06 -0000 Subject: String question In-Reply-To: <88ev6m$cun$1@news.uit.no> Message-ID: > I want the variable 'string' to be a string and not a list.. > >>> n =10 > >>> string = "n = ", n > >>> print string > ('n = ', 10) > > I want string to be "n = 10". How? Like this: >>> >>> n = 10 >>> s = "n = " + str(n) >>> s 'n = 10' And, by the way, 'string' is probably a bad variable name (presuming you may want to import the string module sometime). Trent From nally at radiks.net Thu Feb 24 00:36:39 2000 From: nally at radiks.net (Paul T. McNally) Date: Wed, 23 Feb 2000 23:36:39 -0600 Subject: OT - ][ (was Re: Killer Apps???) References: <14509.31078.932335.402705@beluga.mojam.com> <14509.46230.395460.200539@beluga.mojam.com> <38B4316B.F58893CB@sage.att.com> Message-ID: <38B4C367.A8D87B9C@radiks.net> Fran?ois Pinard wrote: > Apple ][ surely had Choplifter! Still a mystery to me how they could > engineer such a program on a 6502, with sound, real-time, and everything. > Amazing... For more info check out: http://www.classicgaming.com/rotw/choplifter.shtml From mikael at isy.liu.se Mon Feb 14 07:28:43 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Mon, 14 Feb 2000 13:28:43 +0100 (MET) Subject: range(start,stop) In-Reply-To: Message-ID: On 14-Feb-00 Moshe Zadka wrote: > Of course, if you decide lists start at 1, then range should stop at n, > but FORTRAN is (almost) dead and buried ;-) Well... I know Fortran only by its name. Misunderstand me correctly, I want range(m,n) to do what it does. I just thought you could give Stephane a better argument. Actually, if the shortform range(n) produced the list 1..n, then it would be just as logical to have range(0) produce an empty list, and then range(len(mylist)) would give a reasonable result, but we would get into trouble extending it to range(m,n) in a consistent way. I think this should be related to how python addresses lists instead, i.e. mylist[0] is the first element in mylist. That, in turn, is logical since we use negative numbers to find elements in the end of a list, which i think is beautiful. We get an unbroken sequence ... , mylist[-2], mylist[-1], mylist[0], mylist[1], ... This is to me a better reason to let range do what it actually does. If we had ... , mylist[-2], mylist[-1], mylist[1], mylist[2], ..., which is less tasty to me, then perhaps range should do something else. We would probably have to let range(m,n) produce the list m+1..n instead, which I think would raise even more questions. conservatively 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: 14-Feb-00 Time: 13:01:41 This message was sent by XF-Mail. ----------------------------------------------------------------------- From gerrit.holl at pobox.com Sat Feb 19 03:44:52 2000 From: gerrit.holl at pobox.com (Gerrit Holl) Date: Sat, 19 Feb 2000 09:44:52 +0100 Subject: python online help? In-Reply-To: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov>; from btang@pacific.jpl.nasa.gov on Fri, Feb 18, 2000 at 12:26:02PM -0800 References: <38ADAADA.1A2A1055@pacific.jpl.nasa.gov> Message-ID: <20000219094452.A1085@stopcontact.palga.uucp> Benyang Tang wrote on 950873162: > > Is there a online help in python? Say something like > help print > would give document of the print command. Callable objects have "docstrings": >>> print abs.__doc__ abs(number) -> number Return the absolute value of the argument. >>> print tuple.__doc__ tuple(sequence) -> list Return a tuple whose items are the same as those of the argument sequence. If the argument is a tuple, the return value is the same object. Modules also have docstrings, statements have not. regards, Gerrit. -- cat: /home/gerrit/.signature: No such quote or joke From pinard at iro.umontreal.ca Wed Feb 23 15:03:05 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 23 Feb 2000 15:03:05 -0500 Subject: Tkinter installation problems In-Reply-To: Gerrit Holl's message of "Wed, 23 Feb 2000 20:19:42 +0100" References: <38B40258.72445B00@math.utah.edu> <_WTs4.7648$al3.101350@newsc.telia.net> <20000223201942.A4980@stopcontact.palga.uucp> Message-ID: Gerrit Holl writes: > [...] here to explain how FURIOUS I am! No smiley can help you! > [...] ABSOLUTLY RIDICULOUS. Eh, oh, eh! Relax... This is the Python list: a good place to be! If you loose your temper, you make the place a bit less comfortable to everybody, and this is unfair, because I am still a nice guy. :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From gmcm at hypernet.com Thu Feb 24 11:22:33 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 24 Feb 2000 11:22:33 -0500 Subject: Simple example of threading In-Reply-To: Message-ID: <1260713143-4505523@hypernet.com> Dirk Vleugels wrote: > ... Under posix_threads there is pthread_cancel. This call > is used to 'cancel' misbehaving threads (blocking on certain system > calls (see doc)). The thread may ignore cancel requests, but this is > under user control. > > Sadly, pthread_cancel is missing in python, dunno why. For the same reason that Java has deprecated it. In almost all implementations, you can't interrupt a blocking call; all you can do is queue up a "cancel" that the blocked thread will get after (if ever) it returns from the blocking call. That's easy to do at the application level. "Killing" a thread is very dangerous. Most OSes implement threads as "lightweight processes". The fat that has been trimmed is all the automatic clean-up. So resources (in particular, semaphores and other locks) that the thread has a claim on will not be released, leaving the process in an indeterminate state. Java has also added timeouts to socket calls to help deal with this. It's a safe bet that that's actually select with a timeout, followed by the socket call. So maybe in a couple years, Java will let you multiplex multiple sockets in one thread, as God intended . - Gordon From mwh21 at cam.ac.uk Thu Feb 24 14:42:28 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 24 Feb 2000 19:42:28 +0000 Subject: Strings & methods References: <20000224192538.13101.qmail@nwcst316.netaddress.usa.net> Message-ID: Def P writes: > OK, here's a stupid question... Why do strings have methods in 1.6? > > Before everybody flames me, let me explain the reasons of my > confusion. My trusty old OOP textbooks say, that object orientation > is about encapsulating data in objects, to access them through > methods. The methods (should) ensure that the data are changed > correctly. This makes sense for Python classes and mutable objects > like lists and dicts. However, since strings are immutable (I'm > assuming they still are in 1.6), those methods won't change the > string itself at all; they will rather act like functions glued to > the object. To the uninitiated, this may look like the old string > functions have been changed to methods in unnatural ways, and indeed > it sometimes leads to peculiar constructs like " > ".join(list_of_strings). (I know this construct has been explained > in the newsgroup, and while the reasons for choosing this way are > understandable, intuitive it is not.) > > Don't get me wrong, I'm not saying string methods are a bad idea, > I'm just wondering. There is probably a good reason for this, but I > haven't managed to find it so far. My next question is, why have > strings grown methods, but integers, floats, tuples haven't? Well, I think it's basically down to the fact that Python is designed not according to ivory-tower philosophical rules, but observation of what people do, and what can be done to make their lives easier. Besides, I don't think OO is *all* about mutation of state - that would leave functional OO languages like ocaml in rather an odd position. Would you really rather write: newstr = str.copy() newstr.convert_to_upper_case() return func(newstr) than return func(str.upper()) ? pragmatically-y'rs Michael -- very few people approach me in real life and insist on proving they are drooling idiots. -- Erik Naggum, comp.lang.lisp From gchiaramonte at ibl.bm Thu Feb 3 08:59:28 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Thu, 3 Feb 2000 09:59:28 -0400 Subject: FW: Newbie: OverflowError: integer addition - Python data types?? Message-ID: > try using the long integer type (L) which has no maximum length. python can > do it all! > > gene > > > -----Original Message----- > > From: python-list-admin at python.org > > [mailto:python-list-admin at python.org]On Behalf Of e.e.sutton at cummins.com > > Sent: Wednesday, February 02, 2000 1:04 PM > > To: e.e.sutton at cummins.com > > Subject: Newbie: OverflowError: integer addition - Python data types?? > > > > > > I can't get a Python version of my VBScript Fibonacci series script to > > work. I get an OverflowError: integer addition error at series 46. > > > > Can Python not handle large numbers? > > > > Is there a special data type I should be using? > > > > Series 45 is the following number. > > 45 1836311903 (1.84E+09) > > > > File "M:\SRC\scripting\fibonacci\fib.py", line 47, in Fibonacci > > fib = fibA + fibB > > OverflowError: integer addition > > > > def Fibonacci(i): > > fibA=1 > > fibB=1 > > if i == 0: > > Fibonacci = fibA > > elif i == 1: > > Fibonacci = fibB > > elif i > 1: > > fib=0 > > for j in range(2, i+1): > > fib = fibA + fibB > > fibA = fibB > > fibB = fib > > Fibonacci = fib > > return Fibonacci > > > > Thanks in advance for any tips or suggestions > > > > > > Sent via Deja.com http://www.deja.com/ > > Before you buy. > > -- > > http://www.python.org/mailman/listinfo/python-list > > > From jonathan at ldis.com Wed Feb 9 14:51:29 2000 From: jonathan at ldis.com (Jonathan Donald) Date: Wed, 09 Feb 2000 13:51:29 -0600 Subject: Type Identification Message-ID: <38A1C541.15C3A87A@ldis.com> I'm brand new to Python, and I'm having difficulty testing for the class of an object. WHERE: fNode is an instance of class FileRecord (superclass of DirectoryRecord) and DirectoryRecord is an instance of DirectoryRecord class ...why does the following expression not return false? if type(fNode) == type(aDirectoryRecord): Any hints are greatly appreciated. -jd -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: jonathan.vcf Type: text/x-vcard Size: 292 bytes Desc: Card for Jonathan Donald URL: From darrell at dorb.com Wed Feb 2 22:17:07 2000 From: darrell at dorb.com (Darrell) Date: Wed, 2 Feb 2000 22:17:07 -0500 Subject: Searching binary data Message-ID: <007001bf6df5$2e5c28b0$0100a8c0@rochester.rr.com> Didn't have access to the internet today which forced me to have a creative thought of my own. Now to find out if I wasted my time. The problem is to find patterns in gobs of binary data. Treat it as a string you see something like this. MZ\220\000\003\000\000\000\004\000\000\000\377\377 I found writing a re for patterns in that, a pain. What if I wanted r"[\000-\077]". It won't work because there are nulls in the result and re doesn't like that. Not to mention all this octal to hex is annoying an who knows what trouble Nulls will be. So I wrote an extension to covert everything to hex in the following format. 4d5aff000300000004000000ffff0000ff Now I can treat the whole thing as a string :) Guess it needs a function to go back the other way now. Yes the stuct module is useful but I wanted to use re also. Now someone will say why didn't you use binhex or binascii. But unless I missed it they didn't seem to solve this problem. --Darrell From effbot at telia.com Fri Feb 11 18:13:32 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 00:13:32 +0100 Subject: Except an exception AND all its subclasses? References: Message-ID: <000b01bf74e5$9ebd4480$34aab5d4@hagrid> Moshe Zadka wrote: > > I'm tempted to say something about time machines, but > > afaik, this has been supported since the very beginning: > > Where the very beginning is defined as "from the time we stopped using > string exceptions?". I'm sure there was no such feature when exceptions > were strings. support for class exceptions was added to python some time between november 1994 and april 1995 (long before standard exceptions were changed from strings to classes). the effbot was first connected to comp.lang.python in june 1995. maybe not the very beginning, but at least BEB (before eff-bot) From sabren at manifestation.com Sat Feb 12 00:01:46 2000 From: sabren at manifestation.com (Michal Wallace) Date: Sat, 12 Feb 2000 00:01:46 -0500 Subject: How to do line wrapping? References: <001001bf7502$577f2d00$622d153f@tim> Message-ID: <882pgk$8mo$1@nntp9.atl.mindspring.net> Tim Peters wrote in message <001001bf7502$577f2d00$622d153f at tim>... >It's a continuing problem in Python: new users especially get excited over >how easy it is to build frameworks for solving whole classes of problems >"once & for all". Then they discover nobody uses their code: it's often >easier in Python to write a special-case solution from scratch than to >figure out how to use a framework, some of which are so overly general that >it can be hard even to see that your current problem is an instance! I wonder if part of that has to do with lack of documentation. If we could add full text searches of module documentation to VoP or the hypothetical CPyAN, it might make things easier.. But I suspect part of it is that if you want something to be popular, you can't just write it.. You've got to market it so people know it's there, and document it so that it becomes approachable. Zope, for example, is well marketed, but not (yet) well documented.. On the other hand, most of the standard python modules are well documented, but not necessarily well marketed (they're not on VoP, for example). Just because it happens to be easy to write a special case doesn't mean it *necessarily* has to be easier than figuring out someone elses solution. As you say, it's only often the case. But I would think that if we found a way to document and organize even some of the well-designed modules, frameworks and whatnot out there, then it would free up much more programmer energy to work on totally new stuff... -Michal http://www.sabren.com/ From psilva at ruido-visual.pt Thu Feb 10 09:54:44 2000 From: psilva at ruido-visual.pt (Pedro Silva) Date: Thu, 10 Feb 2000 14:54:44 -0000 Subject: code to parse a file Message-ID: <000e01bf73d6$c481cde0$6c00a8c0@ruidovisual.pt> Hi I had write some code in a Python Method, a Zope Product, that will open a file and will read line-by-line and check if some string is in that line, if yes, it will return the line to a variable. The code I write is: f=open('/var/spool/news/articles/esoterica/geral/1','r') for lines in f.readline(): if string.find('From:'): from=lines if string.find('Subject:'): sub=lines if string.find('Date:'): date=lines if string.find('Xref:'): f.seek(0,2) for text in f.read(): cont=text return from,sub,date,cont Is this code correct to do what I pretend? If not, can anyone help me to solve this? Please send your answers to: psilva at ruido-visual.pt Thanks, Pedro -------------- next part -------------- An HTML attachment was scrubbed... URL: From hnowak at cuci.nl Mon Feb 28 14:55:31 2000 From: hnowak at cuci.nl (Hans Nowak) Date: Mon, 28 Feb 2000 20:55:31 +0100 Subject: A comp.lang.python code snippet archive? In-Reply-To: Message-ID: <200002281956.UAA24944@dionysus.fw.cuci.nl> On 28 Feb 00, at 19:44, Michael Hudson wrote: [snippets site questions] > > I would like to know: > > * if it's still worthwile to continue this site > > * what kind of improvements I could make (a search engine would be cool > > but I don't know much about CGI) > > > > Ideas, anyone? > > I'd think it was worth continuing. I'd also think it could be made > easier, however - I use gnus to read my mail, and I'd be damned if it > wasn't possible to rig things so that I could go 'M-x snippet' when I was > reading a suitable article and have it appear in the archive. Yes, but almost every snippet is edited before it is added... if only to add some headers. But I also like to test snippets if possible, before they are actually uploaded. So automating this process won't be easy. I intend it to be more than just an archive of messages with code. > I know nothing about CGI either, I'd have to admit. > > A zope product might work, too. I have a zope account on the starship > that's just sitting idle. > > I could probably be coaxed into spending a few hours on this... > > oh-bugger-there-went-the-spare-time-ly y'rs > Michael Thanks for the offer, I'll certainly consider it. First I'll figure out what to do with the site, though. --Hans Nowak (zephyrfalcon at hvision.nl) Homepage: http://fly.to/zephyrfalcon You call me a masterless man. You are wrong. I am my own master. From tseaver at starbase.neosoft.com Tue Feb 1 10:39:48 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 1 Feb 2000 09:39:48 -0600 Subject: RMI or RPC for python ? References: Message-ID: In article , Mark NG wrote: > > >G'day, > >Does there exist a Remote Method Invocation or Remote Procedure Call >framework for Python like the RMI classes/interfaces in java ?? >or do we have to go it alone with the pickle jar ? F-bot's xmlrpclib.py is usable for RPC over HTTP (Zope uses it to nice advantage). Fnorb and omniORBpy are CORBA ORBs implemented in Python -- you get the added bonus of language independence with CORBA. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From kens at sightreader.com Mon Feb 28 04:35:42 2000 From: kens at sightreader.com (Ken Seehof) Date: Mon, 28 Feb 2000 01:35:42 -0800 Subject: Best book to learn Python? References: Message-ID: <38BA416E.BDF9F3A9@sightreader.com> Another vote for "Learning Python". BTW, how do you like the tech support so far? Three good answers and counting in under an hour for free... (Beat that, Micro$oft) :-) Best of luck on your quest. Also be sure to spend some time at www.python.org. - Ken Seehof Quill wrote: > I'd like to learn Python, and I want to purchase a good book. I'd like > one that is suitable for a beginning programmer. If anyone has had any > success learning from a book please let me know. Please post responses to > the group. > > Thanks in advance From cjensen at be-research.ucsd.edu Tue Feb 8 20:04:01 2000 From: cjensen at be-research.ucsd.edu (Curtis Jensen) Date: Tue, 08 Feb 2000 17:04:01 -0800 Subject: A = X > Y ? X : Y Message-ID: <38A0BD01.9586107B@be-research.ucsd.edu> I fear that this question has already been asked, but is there and equivalant one line command that is equivalant to the C command: a = x > y ? x : y -- Curtis Jensen cjensen at be-research.ucsd.edu http://www-bioeng.ucsd.edu/~cjensen/ FAX (425) 740-1451 From dworkin at ccs.neu.edu Sat Feb 26 16:05:19 2000 From: dworkin at ccs.neu.edu (Justin Sheehy) Date: 26 Feb 2000 16:05:19 -0500 Subject: fatal SIGSYS under irix In-Reply-To: "Tim Peters"'s message of "Sat, 26 Feb 2000 01:29:56 -0500" References: <000201bf8022$e61bfae0$3c2d153f@tim> Message-ID: "Tim Peters" writes: > Under Win95 (dear Lord, how embarrassing for Unix ): > > >>> f = open("blah.blah") > >>> f.seek(1, -4) > Traceback (innermost last): > File "", line 1, in ? > IOError: [Errno 22] The device does not recognize the command Just embarrassing for IRIX, and IRIX already has a lot of things to be embarrassed about. Under both FreeBSD and Solaris: >>> f = open('foo') >>> f.seek(1, -4) Traceback (innermost last): File "", line 1, in ? IOError: [Errno 22] Invalid argument -Justin From darrell at dorb.com Tue Feb 29 01:25:13 2000 From: darrell at dorb.com (Darrell) Date: Mon, 28 Feb 2000 22:25:13 -0800 Subject: Making sense of Stackless References: <146101bf8164$fc19df90$6401a8c0@dorb> Message-ID: <004101bf827d$bdba9db0$6401a8c0@dorb> Still playing. Was wondering how to simulate threads with out adding special calls. This was one idea but it blows up. def dispatch(frame, event, arg): caller=continuation.caller() caller.jump() sys.settrace(dispatch) If this worked, I'd put a list of continuations in the dispatch call. Also a threading module in stackless would have to switch threads when an I/O call blocks. --Darrell From cfelling at iae.nl Wed Feb 16 16:51:02 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 16 Feb 2000 22:51:02 +0100 Subject: Newbie question: Dictionary of lists References: <2F1A38DC0413D311A7310090273AD5278A03A0@dthrexch01> Message-ID: <88f646$1lm$1@vvs.superst.iae.nl> Hai Bill, Remco already pointed out how to fix your code, so I wil only add some noice:) Maybe you are not aware of the fact that in python dictionary keys could wel be tuples? Quite likely that someday you will be bitten by non uniquely conca- tenatable account codes like 00,1 and 0,01:) Kossmann, Bill wrote: ... > period names, and amounts; the dictionary's key is a concatenation of the > account codes, and the values are 12-element lists (one for each month). I > want a sample dictionary entry to look like this: > {'00006101071115000000': [10, 20, 30 ... 120]} as bit-prevention you could change the key you use from > # Key is our cost centre code > dictionaryKey = histRcd[0]+histRcd[1]+histRcd[2]+histRcd[3] to dictionaryKey = (histRcd[0], histRcd[1], histRcd[2], histRcd[3]) -- groetjes, carel From PClaerhout at CREO.BE Wed Feb 23 12:09:44 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Wed, 23 Feb 2000 18:09:44 +0100 Subject: Which GUI? Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7148@MSGEURO1> What about toolkits for the Mac. The MacOS toolbox is nowhere mentioned, and also the problems we have with running Tcl/Tk on the Mac are mentioned nowhere. Any suggestions on what else will work with a Mac? P. -----Original Message----- From: Reuben Sumner [mailto:rasumner at iname.com] Sent: Wednesday, February 23, 2000 5:59 PM To: python-list at python.org Subject: Re: Which GUI? My guess is that you do indeed get the prize. Just to insert a somewhat more specific comparison between Tkinter and wxPython (then the debate can continue on more subjective matters), from what I can tell you can print from wxPython and you cannot from Tkinter. If that happens to be an issue for a specific application, that would be an advantage for wxPython. How do all the other PyQt, PyGTK, PyFOX, Py... do here? Reuben Moshe Zadka wrote in message ... >On Mon, 21 Feb 2000, Fredrik Lundh wrote: > >> Tkinter is a component oriented UI library, which >> is carefully designed to work well with Python. >> and vice versa -- a certain Python feature was >> in fact added in part to make Tkinter a bit easier >> to use (can you name this feature?) > >def f(**kw): > pass > >do-i-get-the-effbotic-prize-or-what-ly y'rs, Z. -- http://www.python.org/mailman/listinfo/python-list From robin at jessikat.demon.co.uk Sat Feb 12 18:55:39 2000 From: robin at jessikat.demon.co.uk (Robin Becker) Date: Sat, 12 Feb 2000 23:55:39 +0000 Subject: PIL & Tk8.2 References: <884fl8$p6j$1@news.vanderbilt.edu> Message-ID: In article <884fl8$p6j$1 at news.vanderbilt.edu>, Fred Fubar writes >The big issue is not PIL by _tkinter. Here are my instructions for building ... thanks I have already done this kind of thing for 8.3; we need to get some stuff done for stubs eventually. -- Robin Becker From schorsch at schorsch.com Sat Feb 19 17:58:46 2000 From: schorsch at schorsch.com (Georg Mischler) Date: Sat, 19 Feb 2000 22:58:46 GMT Subject: Python for Autocad - proof of concept Message-ID: <88n775$c19$1@nnrp1.deja.com> Hi all, inspired by some recent discussion here about a hypothetical (auto-)lisp to Python translator, I have started to lay some of the foundations that would make such a beast useful. Py_acad.arx is an Autocad extension that embeds Python, and bundles a module to access internal Autocad functions from within Python. At the moment, the Autocad side can only access the PyRun_SimpleXXX functions, and the Python side knows half a dozen functions from the ADS API. However, I have found this result to be very promising. After all, PyRun_SimpleString is all I needed to start the Tkinter GUI of a 23 kloc Python application... ;) I am making this public since I know that some others here are interested in the principle. If you are among those, you can get the sources from my starship account: http://starship.python.net/crew/schorsch/py_acad.html Please tell me where I have made conceptual mistakes. Oh, and the most important thing: If you are so much interested that you'd like to contribute some code, that would be very welcome as well. Though I started this primarily for my own use in a commercial product, this module is and will stay open source. No need to reinvent the wheel for anyone. 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 jjlucsy at concentric.net Wed Feb 23 12:56:49 2000 From: jjlucsy at concentric.net (Joel Lucsy) Date: Wed, 23 Feb 2000 12:56:49 -0500 Subject: Installing on Win 2K? References: <89129k$1iv$1@nnrp1.deja.com> Message-ID: I've installed and run from Win2K. However, I'm running Beta 3. Which are you trying? -- - Joel Lucsy (jjlucsy at concentric.net) From effbot at telia.com Tue Feb 29 05:47:42 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 29 Feb 2000 10:47:42 GMT Subject: A comp.lang.python code snippet archive? References: <000601bf829b$dd53c660$3acbd9c2@peridot.optichrome.com> Message-ID: Adrian Eyre wrote: > I think more people would use sites like this if they knew about them. The > only way at the moment to find out is to continuously read comp.lang.python > for a couple of years. Not everyone has the time/patience to do this. fwiw, that's what Dr. Dobbs Python-URL is all about: http://www.ddj.com/topics/pythonurl/ ... > We could also have some convention about Python snippets posted to c.l.py, > so they can be automagically extracted and categorised. > > e.g. > > #snippet "mysnippet.py" > #category "Networking" > #description "This does something interesting" > #begin > #!/usr/bin/env python > > my_code_here() > > #end ohmygod. do you really expect people to do that? ... and yes, you forgot #copyright and #author. random cutting and pasting from newsgroup postings may get you into legal trouble. ... btw, the faqts team is looking for volunteers to help them populate the python knowledge base: http://python.faqts.com/ http://python.faqts.com/knowledge-base/index.phtml/fid/199/lang/en IEBHO, it's a perfect opportunity for people who wants to actually do things, rather than talking about what they want others to do for them. From jstok at bluedog.apana.org.au Wed Feb 23 10:00:12 2000 From: jstok at bluedog.apana.org.au (Jason Stokes) Date: Thu, 24 Feb 2000 02:00:12 +1100 Subject: functional programming References: Message-ID: Remco Gerlich wrote in message ... >Michal Wallace (sabren) wrote in comp.lang.python: >> I guess my original question had to do with what functional >> programming looks like in the wild, and what it might look like in >> python. Aahz posted a recursive version of a fib() routine. Is this >> not what you'd want? What would fib() look like in one of the >> functional languages you're used to? > >Michael Hudson posted this little bit of Haskell last week: > >fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ] > >I can't translate that to anything resembling Python at all. I don't >know if list comprehensions in Python will be/are this powerful. This example exploits lazy evaluation. Since Python is strict, like most procedural languages, it isn't possible to produce this in Python. From tim_one at email.msn.com Sat Feb 5 03:01:24 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 5 Feb 2000 03:01:24 -0500 Subject: Lisp 2 Python? In-Reply-To: Message-ID: <001701bf6faf$32b2c5c0$182d153f@tim> [Joel Lucsy] > Are there any lisp-to-python converters? Yes -- but I don't work cheap . if-you-meant-a-program-there-are-no-"python-to-x"-converters- for-any-x!=c-ly y'rs - tim From hgg9140 at skewer.ca.boeing.com Mon Feb 21 12:15:38 2000 From: hgg9140 at skewer.ca.boeing.com (Harry G. George) Date: Mon, 21 Feb 2000 17:15:38 GMT Subject: eqiv of perl's CGI.pm? Message-ID: I have the opportunity to convert a lot of perl cgi's to python. But I need to make them look similar to perl's CGI.pm API. (The users have just barely gotten comfortable with Perl and CGI.pm.) python's cgi.py is good for reading forms, but I need to build forms too. cgi.py doesn't address this. HTMLgen is overkill. Anyone doing a CGI.pm workalike? -- Harry George E-mail: harry.g.george at boeing.com The Boeing Company Renton: (425) 237-6915 P. O. Box 3707 OY-89 Everett: (425) 266-3149 Seattle, WA 98124-2207 Page: (425) 631-8803 From fredrik at pythonware.com Tue Feb 1 07:50:27 2000 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 1 Feb 2000 13:50:27 +0100 Subject: What is winfo_id() under Win32 References: <3890439A.1C1BA6D2@freemail.hu> Message-ID: <024e01bf6cb2$ea8e8350$f29b12c2@secret.pythonware.com> Attila Filet?th wrote: > I would like to maximize a Toplevel window created from python in Win32. > Since I couldn't find any methods (or options) in Tkinter I've tried > win32xxx imports. I obtained the hwnd from self.winfo_id() and then > tried a win32gui.ShowWindow(hwnd, SW_SHOWMAXIMIZED): It didn't work. > I've checked the hwnd with Spy and I realized the window is composed of > two windows (hwnds): one is for the outer and one for the inner area (as > the outer's child). And winfo_id() returns hwnd of the inner area. > Is it normal? yes. you should be able to use wm_frame() (aka frame()) to get hold of the outer window: inner = w.winfo_id() outer = string.atoi(w.wm_frame(), 0) (wm_frame() returns the handle as a hex string). Note that if the window hasn't been reparented by the "window manager", both methods return the same window handle. From effbot at telia.com Thu Feb 10 03:09:22 2000 From: effbot at telia.com (Fredrik Lundh) Date: Thu, 10 Feb 2000 08:09:22 GMT Subject: A = X > Y ? X : Y References: <11A17AA2B9EAD111BCEA00A0C9B41793034AB150@molach.origin.ea.com> <00e401bf7332$4aea6ea0$74eb0b18@stcla1.sfba.home.com> Message-ID: Bob Alexander wrote: > The only true equivalent to this C/C++/Java/ language code in Python is: > > if X > Y: > temp = Y > else: > temp = X > A = temp > > This evaluates only one of its selected expressions, and evaluates A only > once. you're using quantum python, right? From aa8vb at -nojunk-ipass.net Fri Feb 18 19:22:10 2000 From: aa8vb at -nojunk-ipass.net (Randall Hopper) Date: Sat, 19 Feb 2000 00:22:10 GMT Subject: Async File I/O References: Message-ID: Randall Hopper wrote: |Is there a way to perform asynchronous file I/O in Python which is |compatible with Tkinter? | |I believe Tk's fileevent might be it, but I don't see any wrapper in |the Tkinter module. Anyone have a code snippet they could share? Never mind. I found the code bite I needed buried in Dejanews. The answer for Tkinter (on UNIX) is "createfilehandler". UNIX is sufficient for my needs. But what do Tkinter folks do with this situation on MSWindows? Sleep and poll? Or is there another API that's used? -- Randall Hopper aa8vb at -nojunk-ipass.net =============================================================================== #!/usr/bin/env python # From: Olaf Delgado # Date: 03 May 1999 00:00:00 GMT # Subject: Re: Tkinter and fileevent import sys import Tkinter import tkMessageBox root = Tkinter.Tk() def stdin_handler(file, mask): root.tk.deletefilehandler(file) if not tkMessageBox.askokcancel("Go on?", file.readline()): root.destroy() root.tk.createfilehandler(file, mask, stdin_handler) root.tk.createfilehandler(sys.stdin, Tkinter.READABLE, stdin_handler) root.mainloop() =============================================================================== From tseaver at starbase.neosoft.com Thu Feb 24 12:37:43 2000 From: tseaver at starbase.neosoft.com (Tres Seaver) Date: 24 Feb 2000 11:37:43 -0600 Subject: Simple example of threading References: <200002241512.JAA29137@www.polytopic.com> Message-ID: <920922A37C4D5DCD.C540A87248E6A123.63F8A3A9D77258C1@lp.airnews.net> In article , Dirk Vleugels wrote: > >Hi, > >rmeegan at murlmail.com writes: >> [Thomas Weholt] >> There is something to be said for spawning new processes to handle >> server requests. In particular, parent processes can kill their >> children when they wander off and start misbehaving. Threads can't be >> killed by other threads, including the main thread of the process that >> spawned them. > >Is this true? Under posix_threads there is pthread_cancel. This call >is used to 'cancel' misbehaving threads (blocking on certain system >calls (see doc)). The thread may ignore cancel requests, but this is >under user control. > >Sadly, pthread_cancel is missing in python, dunno why. Thread cancellation is both highly unportable and highly dangerous -- the cancelled thread doesn't get to clean up on its way out. "Don't go there" is pretty good advice, I've found. Erinye'ly, Tres. -- --------------------------------------------------------------- Tres Seaver tseaver at palladion.com 713-523-6582 Palladion Software http://www.palladion.com From fcahoon at my-deja.com Mon Feb 7 22:08:45 2000 From: fcahoon at my-deja.com (fcahoon at my-deja.com) Date: Tue, 08 Feb 2000 03:08:45 GMT Subject: Whitespace as syntax (was Re: Python Rocks!) References: <024201bf71cb$bfc6a670$01646464@computer> Message-ID: <87o1br$ltq$1@nnrp1.deja.com> In article <024201bf71cb$bfc6a670$01646464 at computer>, "Neil Hodgson" wrote: > > If python code were to become mis-formatted (and given my > > experience, I have to believe that sooner or later this _will_ > > happen) there is _no way_ to be certain what the original > > author's intent was, much less to fix it automatically. This > > is a Bad Thing(tm). > > I'd like to understand what 'mis-formatting' you are worried about. > Either Python code is syntactically valid or it is not. If the original > author has given you syntactically valid Python, then it has an unambiguous > structure and can be reformatted to use any spacing / tabbing approach you > wish to standardise on. > > Neil This is what I've seen in some C code that's been through many hands: The old-timers used 8-space tabs to effect 3-space indentation. Don't ask me why. The 2nd generation of coders set their tabs to 3 spaces in the editor, editing some parts of the code, unaware that other parts of the same file contained 8-space tabs. Tabs were converted to spaces under the mistaken assumption that they were all 3-space tabs. For a hypothetical pseudo-python example, consider this: (For clarity I will show the indentation using "" for a space and "" for a tab) if condition1: statement1 statement2 if condition2: statement3 statement4 To which loop does statement4 belong? f Sent via Deja.com http://www.deja.com/ Before you buy. From don_b at my-deja.com Tue Feb 1 10:13:25 2000 From: don_b at my-deja.com (Don) Date: Tue, 01 Feb 2000 15:13:25 GMT Subject: Excel Ranges from Python COM server Message-ID: <876t6g$iap$1@nnrp1.deja.com> I am having trouble setting getting data from Python to set a range in Excel VBA. From Python I can manipulate Excel ranges as tuples of tuples, just fine. But I am doing something wrong calling Python from VB. The following example demonstrates my problem. An Excel Range gives me a Python tuple of tuples in Python, but a Python typle of tuples is not an Excel Range in Excel. What should my function, getRange return? >>> import win32com.client >>> xl = win32com.client.Dispatch("Excel.Application.9") >>> xl.Workbooks.Add() > >>> xl.Visible = 1 >>> xl.Range("A1:B2").Value ((None, None), (None, None)) >>> data = (('one','two'),('three','four')) >>> xl.Range("A1:B2").Value = data >>> xl.Range("A1:B2").Value ((L'one', L'two'), (L'three', L'four')) However, if I make a simple Python COM server... class RangeTest: _public_methods_ = ['getRange'] _reg_progid_ = "test.rangeTest" # print pythoncom.CreateGuid() _reg_clsid_ = "{F3514F94-D8B1-11D3-8A13-00A0244A1060}" def getRange(self): return (("one","two"),("three","four")) if __name__ == '__main__': import win32com.server.register win32com.server.register.UseCommandLine(RangeTest) >From an Excel spreadsheet I call... Sub rangeTest() Dim py As Object Set py = CreateObject("test.rangeTest") Range("A1:B2").Value = py.getRange() End Sub The results in my spreadsheet are... A B 1 one two 2 one two BUT, what I wanted to have in the spreadsheet was... A B 1 one two 2 three four Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Fri Feb 11 04:05:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 09:05:33 GMT Subject: PythonWin 2.0 References: Message-ID: Paul E. Bible wrote: > Where can I find PythonWin 2.0. If I have to join a group, > could you please tell me which group. www.python.org => windows 9X/NT => experimental versions => http://starship.python.net/crew/mhammond From tjreedy at udel.edu Thu Feb 24 19:46:29 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 24 Feb 2000 19:46:29 -0500 Subject: pythonware.com - cannot access Message-ID: <894iuc$qi1$1@news.udel.edu> For a couple of weeks, at least, I have been unable to access http://www.pythonware.com/ or pages beneath from Delaware USA, with Win98 IE5.01. This is the only presumed-to-be-good site that I am having problems with. Anyone else having a similar blockage? Terry J. Reedy From effbot at telia.com Sat Feb 19 10:16:20 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 19 Feb 2000 15:16:20 GMT Subject: PIL installation (newbie) References: Message-ID: <8tyr4.4135$dT4.212921344@newsb.telia.net> JimM wrote: > How do I install PIL? > I downloaded from pythonware and unzipped but where should I put the files > (or where should I have unzipped it)? if you use pythonware's installer, just replace the corresponding files in the py15 directory. if you use another installer, the easiest thing is to unzip it in any directory that's on your python path. From phd at phd.russ.ru Mon Feb 14 11:00:34 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 14 Feb 2000 16:00:34 +0000 (GMT) Subject: BSDDB copyright and licensing restrictions while in use via Python In-Reply-To: Message-ID: On Mon, 14 Feb 2000, Fredrik Lundh wrote: > if you prefer to use free and IMHO better data- > base engines, check out metakit (www.equi4.com) > or gadfly (www.chordate.com). Any information on what ways these are "better" than Berkeley DB? Any pointers, at least? One advatntage of BSDDB is portability. Yes, I know, Gadfly can be used on every python platform, but what about speed? memory consuming? (at least for those simple queries that BSDDB can do, i.e. string-to-string mapping). Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru Programmers don't die, they just GOSUB without RETURN. From d.j.barraclough at usa.net Sun Feb 20 15:38:25 2000 From: d.j.barraclough at usa.net (djbarraclough) Date: Sun, 20 Feb 2000 20:38:25 GMT Subject: Flying a kite about working with python Message-ID: Hi Hopefully this is not too off topic- see last section for directly python related questions. Summary :- consider this an electronic informational interview concerning moving into software development, hopefully using python :-) Some background:- I am considering my future career plans. I am currently a scientist working in academia (in the USA but I'm british without a green card so I quite probable I will have to return to the UK) and feel that I need a fallback position if/when I finally decide that I can't go on post-docing for ever. This lapse into sanity has been brought about by the recent arrival of our first child. One possibility I am considering is to switch into software development as 1. I currently spend roughly 50% of my time writing code so I can acquire and process data for my experiments 2. I rather enjoy having to write said code 3. I hear tell that the pay is not bad. I have not received any formal training/ education in programming/computer science. I have, however, had to learn a number of different proprietary programming languages as well as C, so I could/can do real time data acquisition and graphics, but thankfully I now can use python for everything else. I have also tinkered with smalltalk. Currently I find myself easily distracted away from my real work by texts on algorithms, making little languages and generally finding out how python ticks. As David Ascher recently put it when explaining why he was leaving his science day job, "python pulls". My questions after that rather long preamble are 1 What do people think are the possibilities of making such a switch and how would they go about it? 2 What strategies would people suggest to make myself more marketable? Note doing a degree in computer science, while attractive, is out as "she who must be obeyed" has threatened that if I consider another degree she will divorce me or worse. I am wondering how constructive it would be to gain some certification i.e. MSC* or similar - if nothing else as a way of providing something more concrete on the CV than have "x years of experience using y to do z". Finally something directly python related! 3 I like using python and would like to capitalize on the time I have invested in learning it, - so how realistic is it to consider getting a job using python or python/c(++)? 4 Am I wrong to think that the demand for python programmers is growing and will continue to grow in the near future? There seems to be a steady increase in interest in the use of python by business and I note that the number of jobs listed on the python.org site seems to be growing. Thank you in advance for your replies Dominic Barraclough Department of Neurobiology and anatomy University of Rochester Rochester NY 14642 d.j.barraclough at netaddress.com or djbarraclough at hotmail.com From money at cs.bu.edu Tue Feb 22 07:25:34 2000 From: money at cs.bu.edu (steven moy) Date: Tue, 22 Feb 2000 07:25:34 -0500 (EST) Subject: Formatting a numerical string w/commas Message-ID: <200002221225.HAA00397@csa.bu.edu> >As with all builtin modules relying on extended libraries: You'll have >to specify which libraries you want by modifying Modules/Setup when >compiling Python. Hmmm, well it seems I need to find an alternative then, since it's a huge pain to try to get the ISP hosting my servers to do anything, much less recompile something for me. To go back to my original question, if using the locale module is not an option, how can I write a function to insert commas in the appropriate places in a number, allowing for +/- as well as 2 decimal places? For example, I would want commify('-1234567.89') to return '-1,234,567.89'). I can do it in Perl: sub commify { local $_ = shift; 1 while s/^(-?\d+)(\d{3})/$1,$2/; return $_; } and so far, I haven't seen anything in Perl I can't do in Python. I can't imagine this would be the first. Any thoughts? Thanks, -$ From ivanlan at callware.com Wed Feb 16 18:19:54 2000 From: ivanlan at callware.com (Ivan Van Laningham) Date: Wed, 16 Feb 2000 16:19:54 -0700 Subject: tkinter manual wanted References: <38AB1310.B97A982@freenet.edmonton.ab.ca> Message-ID: <38AB309A.10B03A4C@callware.com> Hi All-- Robert Hicks wrote: > > Unfortunately Tkinter documentation is scarce. The is a book out called > Python and Tkinter programming by Grayson. > > Go here to take a look: http://www.manning.com/grayson > In my opinion (which may or may not be biased), John's book is excellent. If you've any programming under your belt, I think this is a good place to begin learning Tkinter. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan at callware.com 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 paul at prescod.net Thu Feb 17 15:53:30 2000 From: paul at prescod.net (Paul Prescod) Date: Thu, 17 Feb 2000 12:53:30 -0800 Subject: Continuations and threads (was Re: Iterators & generators) References: <001601bf7853$6b03e7e0$b7a0143f@tim> <88h50k$mt2$1@nntp6.atl.mindspring.net> Message-ID: <38AC5FCA.75F4EA42@prescod.net> Aahz Maruch wrote: > > ... > > Okay, now I'm starting to get this (be very, very frightened). Now, can > you (or someone) provide an equally simple explanation of the > differences between continuations and threads? I'm not sure if I believe what Tim said about implementing threads with continuations or vice versa. A continuation is, in my mind, only vaguely related to a thread. Okay, imagine you are going through a Python program and you could all of a sudden say to the interpreter: "remember this stack frame and all variables in scope. Give it to me as a Python object. I'll do something with it later." It's like groundhog day. You can *go back in time* to somewhere you were before. Actually its the opposite of groundhog day because what will have changed is globals and things relating to I/O. So its like the little town in groundhog day is stuck in time but you can tell that time is progressing because you can see news from the outside world on television. So its more like the Truman show. Only in reverse. :) That clears things up, right? Anyhow, consider what you need to do to implement exception handling. You need to say: "if this exception ever occurs, I want you to jump back to this point in the program's execution." Well, that can be implemented with continuations. error=None def SomeFunction(): if somethingIsNotRight(): error="Something stinks!" jumpBackToOnError() jumpBackToOnError=currentContinuation() if error: print "An error occurred", error else: SomeFunction() It's ugly (low-level) but it works. You could have a hashtable mapping exception types to continuations. There are ways to avoid all of the global variables also. Okay, next consider coroutines. Two flows of control that go back and forth between each other: out=0 def producer(): global producer_continuation, consumer_continuation, data while 1: producer_continuation=currentContinuation() data = readSomeData() consumer_continuation( ) def consumer(): global producer_continuation, consumer_continuation, data while 1: consumer_continuation=currentContinuation() producer_continuation( ) print data producer_continuation=None consumer_continuation=None data=None You might want to include some exit condition! You could combine the exception handling pattern with the coroutine pattern so that your exception continuation jumps into the middle of a loop: while 1: print error error_count=error_count+1 next_error() Not much more exciting than a callback but it would be if there was a lot of local state that a callback would need to store in an object somewhere. You can also use continuations to implement back-tracking. You try one path and if it fails you "jump back" and try the other. If you have several days to expend in mind-altering time-travelling code obfuscation you should try to puzzle out the strategy used by schelog to implement prolog in Scheme using continuations. http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/prolog/impl/prolog/schelog/0.html Ahh, for the good old days when I could spend hours on things that might or might not ever have any job relevance. Sigh-I-need-to-go-back-to-school-or-get-Tim-Peter's-job-ly 'yrs -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From cfelling at iae.nl Fri Feb 4 18:57:47 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 5 Feb 2000 00:57:47 +0100 Subject: Execfile() - bug / strange behavior References: <001001bf6ee2$8a5edc00$a2a0143f@tim> Message-ID: <87fp1r$1s4$1@vvs.superst.iae.nl> Tim Peters wrote: > {Amit Patel] >> I'm trying to understand why execfile(fn) is different from exec >> open(fn,'r').read(). Here's my program: >> >> def timbot(): >> a = 3 >> execfile("1.txt") >> print a >> print locals() >> timbot() >> >> > You can't actually get the timbot interested in pursuing this, since it > never uses these things without explicity naming the dicts it wants used as > execution context. And how then would it pass on the locals dict in this case? According to the docs, and a recent explanation on this list, it is not possible to use something like execfile("1.txt", globals(), locals()), as those are readonly in case of functions! One of the few dark corners of Python IMHO. -- groetjes, carel From drs at hpl.hp.com Wed Feb 23 13:20:13 2000 From: drs at hpl.hp.com (David Smith) Date: Wed, 23 Feb 2000 10:20:13 -0800 Subject: PYTHONPATH on PC Message-ID: <38B424DC.276A4795@hpl.hp.com> I'm running Python 1.5.2 on a PC and am having trouble getting it to "import" my modules. I copied fibo.py from the online introduction into my directory, C:\David and try to import it. Of course, that doesn't work, because Python is set to come up with C:\Program Files\Python as the working directory. So I tried import os os.chdir('C:\David') import fibo and it still can't find fibo. There wasn't a PYTHONPATH environment variable, so I set it locally: os.environ['PYTHONPATH'] = r'.;C:\David;C:\Program Files\Python\Lib' and that didn't work. I have found two ways to get Python to find my module. One is to put the module directly into C:\Program Files\Python\Lib, but that is pretty sick. The other is to modify Idle's shortcut to have it start up in C:\David. But what if I or someone else wanted to work in a different directory? And anyway, what is the default path on a PC when there is no PYTHONPATH environment variable? David Smith From effbot at telia.com Fri Feb 11 09:03:26 2000 From: effbot at telia.com (Fredrik Lundh) Date: Fri, 11 Feb 2000 14:03:26 GMT Subject: will python 3000 break my code? References: <001201bf7454$2263bd60$d6a0143f@tim> <38A40887.E65A13D5@bellatlantic.net> Message-ID: Steve Holden wrote: > With trepidation, I write to ask what the appropriate forum is for > suggesting language improvements -- and I don't mean introducing > redundant bracketing for block delimitation. However, recent threads > have persuaded me that this probably isn't the forum for my lame > suggestions: you guys are busy enough. nah. if you have great ideas, feel free to post them here. just remember to: 1) check if there's a SIG that might be more appropriate (types, compilation issues, etc) and 2) check the newsgroup archive, especially if you think that someone might have had the same idea before you... (this list have been around for 10 years, you know...) make signal, not noise. (if your ideas are good enough, someone will drop by your home some night, and teach you the secret handshake ;-) From effbot at telia.com Sun Feb 13 14:09:00 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sun, 13 Feb 2000 19:09:00 GMT Subject: Python binaries as zip archive References: <38A455B2.EEBFE3C7@durham.ac.uk> <882fld$6t08$1@node17.cwnet.frontiernet.net> <38A6F986.F3F29C95@durham.ac.uk> Message-ID: J.C.Travers wrote: > I don't see the reason for not issueing a normal zip archive. Making a > self-extracting binary doesn't make it much easier, (esp with winzip > etc...) but causes lots of trouble for people like me. At least both > should be offered... demands, demands, demands. how about a simple "please"? http://w1.132.telia.com/~u13208596/temp/py15-980706.zip From gchiaramonte at ibl.bm Mon Feb 28 14:41:53 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Mon, 28 Feb 2000 15:41:53 -0400 Subject: buffer_info() for arrays but not structs? In-Reply-To: <5650A1190E4FD111BC7E0000F8034D26A0F326@huina.oceanic.com> Message-ID: Is there a reason an array has a buffer_info() method but a struct doesn't? This would be a nice addition to the struct object. Does anyone know if there are plans to add this? Thanks. From moshez at math.huji.ac.il Wed Feb 16 17:08:57 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Thu, 17 Feb 2000 00:08:57 +0200 (IST) Subject: Real Problems with Python In-Reply-To: Message-ID: On 16 Feb 2000, [ISO-8859-1] Fran?ois Pinard wrote: > As for lexical closures, you probably mean packaging widgets into classes? > This looks sterling to me! But given you add: > > > they want to attach small & simple procedures to oodles & oodles of > > widgets (your "common and frequent" indeed), and out-of-line class > > solutions are legitimately viewed as clumsier and more obscure. > > I have the impression I did not understand what you meant by lexical > closures. Oh, but Francois, you did. I did some (though not as much as I'd like to) Python/Tkinter programming (I even managed to get people to pay me for that), and I strongly disagree with Tim. In Python GUIs, I learned from Guido's IDLE, we make everything a class, and then we make the callbacks methods. That way, they have the "context" of the class, in which to set arguments. This is closer to the way you do it in C (passing in self instead of some void * pointing to a hairy structure) then the way you do it in Scheme (doing the same thing implicitly: the equivalent to "self" would be a scheme-ish environment, if I remember my Scheme classes correctly). Hence, my personal opinion on lambdas: kill them. With knives. They merely confuse Python GUI programmers. and-i-do-hope-esr-won't-manage-to-shoot-at-me-across-the-ocean-ly y'rs, Z. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From donn at u.washington.edu Fri Feb 4 16:13:06 2000 From: donn at u.washington.edu (Donn Cave) Date: 4 Feb 2000 21:13:06 GMT Subject: installation error: version 1.5.2 on Unix References: <3898FE1B.16E6753E@python.net> <389A3ABB.8EA2C83B@python.net> Message-ID: <87ffd2$i1s$1@nntp6.u.washington.edu> Quoth Yueqiang Huang : | ... I downloaded | readline-4.0 from ftp prep.ai.mit.edu:/pub/gnu and py152.tar from | python.org and did the following things: ... | 5./auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2/Modules(33): emacs Setup.in | | I added the following lines after "#readline readline.c -lreadline -ltermcap" in Setup.in: | | readline -I/auto/terra-06/wrk6/yueqiang/readline4.0/include -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib -ltermcap I think you left some necessary parts out of the readline configuration! Try this: readline readline.c -I/auto/terra-06/wrk6/yueqiang/readline4.0/include -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib -lreadline -ltermcap Donn Cave, University Computing Services, University of Washington donn at u.washington.edu From pick_001 at hotmail.com Wed Feb 2 21:02:59 2000 From: pick_001 at hotmail.com (Mike) Date: Wed, 2 Feb 2000 20:02:59 -0600 Subject: compiling source Message-ID: <87anop$6q0a$1@newssvr03-int.news.prodigy.com> I'm new to programming. I decided to teach myself pythong as a first language. I run win98, linux, and BeOS on my system. compiling the python source in those two doesnt see hard because they both come with GCC. But is there a way I can do the same in windows? I dont have to install some big C++ package to compile it, is there a smaller version I can find on the web somewhere for this? Thanks Mike From dd at ar-kari.put.poznan.pl Thu Feb 3 07:59:02 2000 From: dd at ar-kari.put.poznan.pl (Damian Dobroczyñski) Date: Thu, 03 Feb 2000 12:59:02 GMT Subject: TKinter on Win98 and os.popen Message-ID: Problem description: script: import os f = os.popen('python -c "print 1"','r') on Win98 Python in IDLE shell ends up with exception: "Traceback (innermost last): File "", line 1, in ? f = os.popen('python -c "print 1"','r') OSError: (0, 'Error')" Other 'popens' with other commands also fails. Is it normal behaviour when using Tkinter mod? Damian D. From paul at prescod.net Tue Feb 8 19:01:01 2000 From: paul at prescod.net (Paul Prescod) Date: Tue, 08 Feb 2000 16:01:01 -0800 Subject: Whitespace as syntax (was Re: Python Rocks!) References: <860ftk$bas@news.or.intel.com> <87nmir$e7k$1@nnrp1.deja.com> <389F6D05.F23BEE6D@prescod.net> <87onnq$p2i$2@mach.vub.ac.be> <38A06C31.70753311@prescod.net> Message-ID: <38A0AE3D.42C8B2F2@prescod.net> Neel Krishnaswami wrote: > > ... > > Er, you *do* realize that people have been saying this about Lisp for > pretty much its whole existence? You're right. I didn't really mean to say that either Lisp or Smalltalk are doomed in the "all development ceases" sense. I meant that they would never become mainstream languages. Weirdo syntaxes also do not help. Python's syntax is a little weird. But Smalltalk, Lisp and (now) Rebol seem to go out of their way to antagonize Algol-family-trained programmers. If it takes more than fifteen minutes to retrain the eyes from the old language to the new language, most programmers will never make the jump. Why would they, when there are already too many languages to learn that do not demand eyeball retraining? -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made the modern world possible. - The Advent of the Algorithm (pending), by David Berlinski From sholden at bellatlantic.net Sat Feb 12 14:40:40 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Sat, 12 Feb 2000 19:40:40 GMT Subject: Except an exception AND all its subclasses? References: <20000211220612.A7720@stopcontact.palga.uucp> <20000212103039.A755@stopcontact.palga.uucp> <38A5B488.ED170300@bellatlantic.net> Message-ID: <38A5B754.7E7C3CDF@bellatlantic.net> Steve Holden wrote: > > Gerrit Holl wrote: > > > [about the fact that exception subclassing has > been present in Python since God was a lad] [Steve Holden tried to be funny by saying RTFM] Although come to think of it, for Python the alternative behaviour of ATFNG (ask the fine newsgroup) turns out to be prefectly reasonable. No offence. regards Steve -- "If computing ever stops being fun, I'll stop doing it" From shalabh at pspl.co.in Thu Feb 10 13:57:23 2000 From: shalabh at pspl.co.in (Shalabh Chaturvedi) Date: Fri, 11 Feb 2000 00:27:23 +0530 Subject: Corel + Borland = The End of MS Win References: <87q1jh$437$1@nnrp1.deja.com> <87ttfm$nt8$2@newsserver.rrzn.uni-hannover.de> <87umih$egk$1@nnrp1.deja.com> <38A2E64D.CB7DA73A@infercor.no> <01e101bf73ed$ba98c240$a602a8c0@intranet.pspl.co.in> Message-ID: <028401bf73f8$aa81a510$a602a8c0@intranet.pspl.co.in> I wrote: > > Even more amusing - excerpts from the article in context: ... I didn't intend this to be a 'Python vs Ruby' kind of thing. I just felt that the author talked about Python's features without having done her homework well. Shalabh From gmcm at hypernet.com Thu Feb 24 18:45:45 2000 From: gmcm at hypernet.com (Gordon McMillan) Date: Thu, 24 Feb 2000 18:45:45 -0500 Subject: nested functions In-Reply-To: <38B5B649.B0DFB374@quasar.ipa.nw.ru> Message-ID: <1260686551-6105004@hypernet.com> Alexander V. Voinov wrote: > > Please remind me, if there are any performance penalties in nesting > functions like this: > > def f1(): > .... > def f2(x) > .... > > y = f2(x) > > > or one should follow the C style? (Definition of f2 in _not_ in a loop, > of course) The main issue is scoping and names. Nested functions get really messy when they need reference to something outside themselves. - Gordon From michael.stroeder at inka.de Thu Feb 17 05:32:49 2000 From: michael.stroeder at inka.de (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 17 Feb 2000 11:32:49 +0100 Subject: Recursive function defined within function => NameError Message-ID: <38ABCE51.3EF6728E@inka.de> HI! I have a problem with a locally-defined recursive function within a function. Example: --------------- def func1(): def fak(n): if n>1: return n*fak(n-1) else: return n print fak(6) func1() --------------- But this code snippet does not work. It produces the traceback: Traceback (innermost last): File "test/rec-func.py", line 15, in ? func1() File "test/rec-func.py", line 9, in func1 print fak(6) File "test/rec-func.py", line 5, in fak return n*fak(n-1) NameError: fak Can anybody clarify the issue here? I looked in the Language Reference and found the hint --------------- Programmer's note: a ``def'' form executed inside a function definition defines a local function that can be returned or passed around. Because of Python's two-scope philosophy, a local function defined in this way does not have access to the local variables of the function that contains its definition; --------------- I applied the standard trick showed there to my example and the following code works: --------------- def func1(): def fak(n,fak): if n>1: return n*fak(n-1,fak) else: return n print fak(6,fak) func1() --------------- Any better solution? Ciao, Michael. From PClaerhout at CREO.BE Sun Feb 27 05:46:27 2000 From: PClaerhout at CREO.BE (Pieter Claerhout) Date: Sun, 27 Feb 2000 11:46:27 +0100 Subject: Python IDE won't run on 68k Mac (Centris 650) Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA715A@MSGEURO1> Do you have the Drag and Drop extension in your extensions folder? I think that the os your running the PythonIDE on is not supporting drag and drop, so you will need to have the D&D extension. Kind regards, Pieter PClaerhout at creo.be -----Original Message----- From: Warren Postma To: python-list at python.org Sent: 26/02/00 17:58 Subject: Python IDE won't run on 68k Mac (Centris 650) I get the following Traceback error immediately upon trying to open up the Python IDE on my Mac 68k. I just installed [using the easy install option, which installed fat binaries] and the following error comes up when I try to open the Python IDE. The python interpreter icon [command-line version] works fine. Here's the traceback. Any ideas? Traceback (innermost last): File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:PythonIDE.py", line 41, in ? import PythonIDEMain File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:PythonIDEMain.py", line 8, in ? import W File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:W.py", line 7, in ? from Wtext import * File "HD 215:Python 1.5.2c1:Mac:Tools:IDE:Wtext.py", line 4, in ? import waste ImportError: DragLib: The named library was not found. Warren Postma -- http://www.python.org/mailman/listinfo/python-list From aahz at netcom.com Wed Feb 16 21:14:41 2000 From: aahz at netcom.com (Aahz Maruch) Date: 17 Feb 2000 02:14:41 GMT Subject: "Interupted system call" References: <888mbq$9kr$1@nnrp1.deja.com> Message-ID: <88flih$shj$1@nntp6.atl.mindspring.net> In article <888mbq$9kr$1 at nnrp1.deja.com>, wrote: > >My Python application runs well on IBM's AIX >machines. >When trying to run it on a SUN (Solaris) machine, >I get the message: > IOError: [Errno 4] Interrupted system call > >and the Traceback message points to a "time.sleep" >command. Can you reproduce the problem with a snippet of Python code, or does it only happen with your full application? Are you using threads? Does the error occur on *every* call to time.sleep() in your application or does it appear "randomly"? -- --- 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 Our society has become so fractured that the pendulum is swinging several different directions at the same time From greene at hctc.com Tue Feb 29 20:08:47 2000 From: greene at hctc.com (Collin Greene) Date: Tue, 29 Feb 2000 18:08:47 -0700 Subject: any non programmers out there? Message-ID: I don't need technical help. What I need is basic help and instruction, you wont need to baby me through it and I love to work on y own I just need someone who can introduce me the this wonderful lang called python and help me with the daily ins and outs of it. thanks Greene at hctc.com From shendry at usa.capgemini.com Mon Feb 28 13:51:48 2000 From: shendry at usa.capgemini.com (sh) Date: Mon, 28 Feb 2000 13:51:48 -0500 Subject: Best book to learn Python? References: <38BA416E.BDF9F3A9@sightreader.com> Message-ID: <38bad288_2@news1.prserv.net> Has "Learning Python" been updated? I am hesitating to buy it since it's published a few years ago (last time I checked at my local B&N store), whereas "Quick Python" is more recent, although I've heard that it has plenty of typos. Ken Seehof wrote in message <38BA416E.BDF9F3A9 at sightreader.com>... >Another vote for "Learning Python". > >BTW, how do you like the tech support so far? >Three good answers and counting in under an hour for free... (Beat that, >Micro$oft) :-) > >Best of luck on your quest. Also be sure to spend some time at >www.python.org. > >- Ken Seehof > >Quill wrote: > >> I'd like to learn Python, and I want to purchase a good book. I'd like >> one that is suitable for a beginning programmer. If anyone has had any >> success learning from a book please let me know. Please post responses to >> the group. >> >> Thanks in advance > > > From sholden at bellatlantic.net Tue Feb 22 23:23:58 2000 From: sholden at bellatlantic.net (Steve Holden) Date: Wed, 23 Feb 2000 04:23:58 GMT Subject: Reading Netscape Mail Folders References: <38B19FF9.83B98466@bellatlantic.net> <24B466DC54C4F03F.2859430E081F2ED8.931793678FF616B7@lp.airnews.net> <38B28D1E.9AC5D9CC@bellatlantic.net> <990C259BC131E3B5.B4030C53C3F3972D.81CF6602E96A5026@lp.airnews.net> Message-ID: <38B360E0.F6AB0904@bellatlantic.net> Tres Seaver wrote: > > In article <38B28D1E.9AC5D9CC at bellatlantic.net>, > Steve Holden wrote: > >Thanks, Tres: > > > >[points out own overcaution in not just trying it] > >Certainly manages to find the headers! > > > Actually, I get the bodies, too, using the rfc822.Message.fp member. > I would guess that the mimetools.Message class would likely DWYM, here, > but haven't used it myself. > > Wiping-the-greasepaint-off'ly, > > Tres. > -- > --------------------------------------------------------------- > Tres Seaver tseaver at palladion.com 713-523-6582 > Palladion Software http://www.palladion.com The first trial just used the built-in test routine at the bottom of mailbox.py, which printed out subjects, senders and dates. Now I'm moving on to try and deal with full MIME attachments. Seems like what I need is a subclass of UnixMailbox whose new() method returns an rfc822.Message object created with a multifile.MultiFile argument rather than the standard mailbox._Subfile. expecting-someone-will-tell-me-this-too-has-already-been-done-ly y'rs Steve -- "If computing ever stops being fun, I'll stop doing it" From hniksic at iskon.hr Thu Feb 17 10:44:16 2000 From: hniksic at iskon.hr (Hrvoje Niksic) Date: 17 Feb 2000 16:44:16 +0100 Subject: Which GUI? References: <38AC0244.C5FA164A@durham.ac.uk> <38AC15BD.E2DF7743@durham.ac.uk> Message-ID: <9t9d7pvygtr.fsf@mraz.iskon.hr> "J.C.Travers" writes: > > I notice that you forgot to mention `pygtk'. Couldn't we say that it is > > comparable to pyQT, more or less? > > Yes pyGTK looks similar, however I have never used it, so wouldn't > qualify myself to comment on it. But it does lack the advantage of > having an object-orientated foundation. That's a strange statement, because Gtk is quite object-oriented, and so is PyGtk. From andrew.holt at uk.sun.com Thu Feb 3 08:43:46 2000 From: andrew.holt at uk.sun.com (Andrew Holt) Date: Thu, 03 Feb 2000 13:43:46 +0000 Subject: JPython & exec Message-ID: <38998612.7915BBC0@uk.sun.com> Hi, Is it possible to exec another program from JPython. e.g. Push a button and an xter starts up ? TIA Andrew From farber at cpan.org Sun Feb 27 08:42:16 2000 From: farber at cpan.org (Alex Farber) Date: Sun, 27 Feb 2000 14:42:16 +0100 Subject: int PyRun_InteractiveOne(FILE *fp, char *filename) Message-ID: <38B929B7.BC00D295@cpan.org> Hi, what does this function do and especially what should be the arguments? There is not much infromation on it at http://www.python.org/doc/current/api/veryhigh.html#l2h-14 Thank you! /Alex From herzog at online.de Tue Feb 29 10:25:44 2000 From: herzog at online.de (Bernhard Herzog) Date: 29 Feb 2000 16:25:44 +0100 Subject: does opensource move faster with python? References: Message-ID: "Michal Wallace (sabren)" writes: > Does opensource move faster with Python? > > I just surfed over to the GnuCash website. I've been waiting quite a > while for a "real" release.. But it never seems to come.. Same thing > with Mozilla.... I'm not trying to rag on them.. But I have to wonder: > would development move any faster using Python to prototype these > tools? That's the claim I keep hearing about python.. But how come > more of the free software world isn't using it? > > ARE there projects out there using python as a prototyping language > with the possible intention of discarding it eventually and rewriting > in C? My drawing program Sketch might fit this description although I don't intend to replace Python with C, only to rewrite some parts in C if the Python equivalent turns out to be too slow. Python is much too valuable to throw away. Adding support for user supplied scripts is a piece of cake, for instance, if almost the entire application is implemented in Python. Some parts of Sketch, like e.g. the undo mechanism, would have been a lot harder to implement in C or even C++; Well, perhaps not conceptually harder, but they would have taken a lot more (tedious) work to write. I'm not sure I would have started Sketch if I had to do it in C or C++ and I certainly wouldn't have come nearly as far as I have. -- Bernhard Herzog | Sketch, a drawing program for Unix herzog at online.de | http://sketch.sourceforge.net/ From pinard at iro.umontreal.ca Sat Feb 26 11:01:55 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 26 Feb 2000 11:01:55 -0500 Subject: os.path.walk (was: Re: Optimizing code) In-Reply-To: "Thomas A. Bryan"'s message of "Sat, 26 Feb 2000 10:06:58 -0500" References: <20000224161930.A4922@stopcontact.palga.uucp> <20000225074854.A1014@stopcontact.palga.uucp> <5lu2ixbaec.fsf@eric.cnri.reston.va.us> <38B7EC12.EDDEA595@python.net> Message-ID: "Thomas A. Bryan" ?crit: > Fran?ois Pinard wrote: > > Or course, I could reprogram os.path.walk for my things. I thought it > > would have been nice if the standard walk in Python was behaving the best > > it could, depending on the system it runs on. When a Python script walks > > the structure of a disk, this is often where most of the time is spent, > > and for big file hierarchies, this time can become quite significant. > I'm sure that a lot of us would be interested in any optimizations in > os.path.walk or os.stat. If you're interested enough to develop a patch, > then we could pound on it until all the bugs are gone. Then you could > propse the feature to Guido again with a patch in hand. :) In fact, I rewrote os.path.walk soon after having sent the message (in a rush, as I really supposed to be doing other things in these days :-). Initial testing did not bring me the speed gains I was expecting, that is, not enough to be worth a change. But I'll rather suspect my testing than my code, you surely know how presumptuous programmers usually are :-). In any case, I'm putting this rewrite on hold for now, with the intention of revisiting it later, for when I will have more free time before me! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From mhammond at skippinet.com.au Sat Feb 26 16:34:44 2000 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 26 Feb 2000 21:34:44 GMT Subject: Win2k and Python access violation - please help me out here! References: <1260623840-9876921@hypernet.com> Message-ID: "Jason Maskell" wrote in message news:RZyt4.201$7n6.310 at 198.235.216.4... > gmcm at hypernet.com (Gordon McMillan) wrote in <1260623840-9876921 > @hypernet.com>: > > >Jason wrote: > > > >> Oops, I missed 3 lines at the top of the call stack: > >> > >> NTDLL! 77f8ed61() > >> NTDLL! 77f8ecf1() > >> MSVCRTD! 10238575() > > > >Are you using python15.dll or python15_d.dll? Mixing run time > >libraries is a great way to crash. > > Using the debug dll. Just for fun, I changed over to the release version > and compiled it. Same problem. The release side is using all release dlls. What about the C runtime libraries? Is your program set to use the CRT from a debug DLL? If set to _any_ other option (for a debug build) you will get these crashes. Mark. From vetler at ifi.uio.no Tue Feb 22 17:05:41 2000 From: vetler at ifi.uio.no (Vetle Roeim) Date: 22 Feb 2000 23:05:41 +0100 Subject: Which GUI? References: <20000220194012.A2069@stopcontact.palga.uucp> <20000222224057.G4549@stopcontact.palga.uucp> Message-ID: * Gerrit Holl > * Tkinter is built on Tcl/Tk, but because the bridge between > Tkinter and Tcl/Tk is too large, Tkinter needs to provide their > own documentation and advantages. It has already been mentioned in another posting that Tkinter in fact does *not* depend on Tcl. (It was Fredrik Lundh in ). vr From skip at mojam.com Mon Feb 21 21:31:37 2000 From: skip at mojam.com (Skip Montanaro) Date: Mon, 21 Feb 2000 20:31:37 -0600 (CST) Subject: Fast way to grab line from file? In-Reply-To: <88sprs$1ao$1@nnrp1.deja.com> References: <88sprs$1ao$1@nnrp1.deja.com> Message-ID: <14513.62729.253568.540154@beluga.mojam.com> Mateo> Does anyone know of a faster way to grab line 100 from a given Mateo> file without doing 100 readline() calls? This way is too slow, Mateo> but I can't find out how to do this in python. Thanks, Unless your file has records of fixed length, you won't be able to do terrifically better. Somewhere along the way, something is going to have to count 99 end of lines and realize, "aha! here's line 100". With fixed-length records you can obviously seek to the offset that starts the line of interest. You might be able to speed things up sufficiently using the sizehint argument to a file object's readlines method. Your logic will be a bit more complex, but shouldn't be exceedingly difficult. Check out http://www.python.org/doc/lib/bltin-file-objects.html Skip Montanaro | http://www.mojam.com/ skip at mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From sanderson at ttm.com Fri Feb 18 14:29:06 2000 From: sanderson at ttm.com (Scott Anderson) Date: Fri, 18 Feb 2000 14:29:06 -0500 Subject: Help needed writing GUI comparison References: <6FFD12AA4C19F97C85256889006A88D7.006A89EC85256889@ttm.com> Message-ID: <38AD9D82.3DE635A2@ttm.com> Gerrit - Nice job so far. You might try adding a 'valign="top"' to the TD tags though to ease the readability of the table. Regards, -scott gerrit.holl at pobox.com wrote: > > Gerrit Holl wrote on 950822092: > > Hallo, > > > > I'm writing a GUI comparison, and I really need help. I don't > > want to take the time to learn all GUI's. What I have so far > > is attached (HTML), and also available at the following URL: > > > > http://www.nl.linux.org/~gerrit/gui.html > > > > Please help and contribute! From gregm at iname.com Wed Feb 16 06:54:53 2000 From: gregm at iname.com (Greg McFarlane) Date: Wed, 16 Feb 2000 22:54:53 +1100 Subject: Inter process communication using Tk/send hangs on suspended processes In-Reply-To: ; from Rob W. W. Hooft on 15 Feb 2000 at 02:27:09PM References: Message-ID: <20000216225453.06891@nms.otc.telstra.com.au> The only things I can think of are to fork separate processes to do each send and kill them if they do not respond quickly. The other way was for each program to create a unique property on the X root window that could be queried. But trawling through the Tk man pages and sources, I did not find a Tk interface to this feature of X. On 15 Feb, Rob W. W. Hooft wrote: > I have a group of python programs. Whenever any new program is started, > it will try to establish connections to each of the other ones > using Tk/send (it is asking each for their background color, and will > choose a new one for itself). This is done using "root=setup.setup()", > the setup module is appended to this message. > > The problem occurs when any pre-existing program has been suspended: > in such a case the Tk/send does not return. I also can not seem to set > a timeout on the communications (my attempts are in commented > code). Are there any better suggestions? > > Regards, > > Rob Hooft. > -------------------------------------------------------------------- > # > __version__ = '$Id: setup.py,v 1.9 1999/08/04 09:16:21 hooft Exp $' > # > # GUI Startup > # > # (C) Rob W.W. Hooft, Nonius BV, 1997--1999 > # > import os,signal > import Tkinter,Pmw > > TclError=Tkinter.TclError > > bgcolors=["grey85","#DFF","#DDF","#FDF","#FDD","#FFD","#DFD"] > > #def timeouthandler(sig,frame): > # print "WARNING: no response from other Tk application." > # raise TclError > > def usedcolors(root): > used=[] > names=list(root.winfo_interps()) > names.sort() > names.reverse() > for name in names: > try: > #signal.signal(signal.SIGALRM,timeouthandler) > #signal.alarm(3) > root.send(name, 'winfo name .') > #signal.alarm(0) > #signal.signal(signal.SIGALRM,signal.SIG_DFL) > except TclError: > # Inoperative window -- ignore it > pass > else: > try: > col=root.send(name,'no-bgcolor') > used.append(col) > except: > pass > return used > > def setscheme(root): > try: > bgcolor=os.environ['NONIUS_BGCOLOR'] > Pmw.Color.setscheme(root,background=bgcolor) > except KeyError: > # Now sample all others, and see what is in use. Choose a new one. > u=usedcolors(root) > for col in : > if col in u: > continue > break > else: > print "No free background color" > col="grey85" > Pmw.Color.setscheme(root,background=col) > root.tk.createcommand('no-bgcolor',lambda bgcolor=col: bgcolor ) > os.environ['NONIUS_BGCOLOR']=col > > def setup(idle=1): > import Tkinter,Pmw > Pmw.initialise(fontScheme='Pmw1',size=14) > root=Tkinter._default_root > setscheme(root) > import balloon # Automatically initializes... > # Set up idle task calls for "checkifcanceled".... > if idle: > import projtls > projtls._ltt.setidletask(root.update) > return root > > > > -- > ===== 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 tim_one at email.msn.com Sun Feb 27 04:55:42 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sun, 27 Feb 2000 04:55:42 -0500 Subject: Q about tail recursion In-Reply-To: <3.0.5.32.20000227033824.00a06140@mail.dicksonstreet.com> Message-ID: <000901bf8108$cfddbc00$172d153f@tim> [Felix Thibault] > That implicit return is what I was missing...does the 'no tail-call > optimizations ever' mean there's no point in doing functions like this: > > def fun(seq, sofar=0): > ... > this = seq.pop() > return fun(seq, sofar+this) > > instead of like this: > > def fun(seq): > ... > this = seq.pop() > return this + fun(seq) If you're programming in Python, use a loop <0.1 wink>. The 2nd version is likely to be a tiny bit faster today, simply because it passes one fewer argument. > ... > Does this mean that besides sending a value back to the caller, return > also says "We're done with this namespace/local scope/frame(?), go back to > where we got called from," ? Yes. >> after-all-this-i'm-still-not-sure-what-the-question-was-ly y'rs >> - tim > Well, then here's the real question on my mind that I've been too > embarassed to ask till now: > > Is there a Python version of this scheme function Yes. > that has informative variable names Yes. > so I can figure out what it does ? No . > Or just - what does this do: > > (define Y > (lambda (le) > ((lambda (f) (f f)) > (lambda (f) > (le (lambda (x) ((f f) x))))))) ? Nothing to be embarrassed about here! This is difficult stuff at first -- Curry didn't call Y the "paradoxical combinator" for nothing <0.9 wink>. You can find an excellent explanation, including a Scheme version using sensible names, here: http://www.ececs.uc.edu/~franco/C511/html/Scheme/ycomb.html See any book or paper on the implementation of functional languages via combinators for a more pragmatic view. Raymond Smullyan's "To Mock A Mockingbird" is a lovely "general interest" intro. it's-called-"y"-because-that's-what-everyone-says-the-first- time-they-see-it-ly y'rs - tim From nielsenjf at my-deja.com Fri Feb 25 15:57:56 2000 From: nielsenjf at my-deja.com (John Nielsen) Date: Fri, 25 Feb 2000 20:57:56 GMT Subject: IIS + ASP + <#@Language=Python#>== performance_hit References: <894ea9$h33$1@nnrp1.deja.com> <38B69655.DD9980F9@bellatlantic.net> Message-ID: <896qci$8cj$1@nnrp1.deja.com> The other style doesn't work for me (treats it as html), I thought it was odd also, which is why I included the means I use. It's probably just a typo on his part. john In article <38B69655.DD9980F9 at bellatlantic.net>, sholden at BellAtlantic.net wrote: > As a matter of interest, is there any functional difference between > > <%@LANGUAGE=Python%> > > as used by John, and expected according to all ASP materials I have seen, and > > <#@Language=Python#> > > as used by tom in his original post? > > regards > Steve > > John Nielsen wrote: > > > > Maybe it is a version issue? > > > > What version of python are they running? > > > > I get sub 1 second responses with ASP and python using the > > <%@ LANGUAGE = Python%> directive. > > > > john > > > > In article , > > Tom Funk wrote: > > > > > > A similar thread started here a few weeks ago, then seemed to die. > > There > > > was no definitive answer, though. > > > > > > I've noticed a *definite* performance hit from my ISP when their IIS > > > server delivers pages containing <#@Language=Python#>. There seems to > > be > > > a consistent 7-8 second delay while serving such pages. Pages that > > don't > > > use this directive, or that specify VBScript or JavaScript, don't > > suffer > > > the same fate. > > > > > > I tested with an ASP page that looks like this: > > > > > > <#@Language=Python#> > > > > > > > > > > > > > > > > > >

This is a test > > > > > > > > > > > > > > > This page should load nearly instantaneously. However, using Python > > with > > > @Language causes a consistent 7-8 second delay. There's no > > *discernable* > > > delay for VBScript, JavaScript or when the Language directive is > > skipped > > > completely. > > > > > > A previous suggestion was to change the default language for the site > > > from VBScript (or JavaScript) to Python. Did anyone try this? Does > > this > > > actually work? If not, does anyone have any other suggestions? Could > > > some portion of the Python run-time be recompiling on each call (i.e., > > > IUSR_COMPUTERNAME doesn't have write access to a directory on > > PYTHONPATH > > > and the .pyc files are never created)? > > > > > > My ISP tends to be slow to respond to requests, so before I ask them > > to > > > monkey around with my site's IIS settings, I'd like to know if what > > I'm > > > asking for will actually work. > > > > > > Thanks in advance. > > > > > > -=< tom >=- > > > Thomas D. Funk | "Software is the > > lever > > > (no_spam_tdfunk at asd-web.com_no_spam) |Archimedes was searching > > for." > > > Software Engineering Consultant | > > > Advanced Systems Design, Tallahassee FL. | > > > > > > > -- > > nielsenjf at my-Deja.com > > > > Sent via Deja.com http://www.deja.com/ > > Before you buy. > > -- > "If computing ever stops being fun, I'll stop doing it" > -- nielsenjf at my-Deja.com Sent via Deja.com http://www.deja.com/ Before you buy. From effbot at telia.com Tue Feb 22 18:58:33 2000 From: effbot at telia.com (Fredrik Lundh) Date: Tue, 22 Feb 2000 23:58:33 GMT Subject: Easy reading HTML? References: Message-ID: Martin Sk?tt wrote: > I am currently in the thinking process of writing a little python > program to sort my Netscape bookmarks file. It is so smart that this > bookmark file is a simple HTML file which I am now looking for an easy > way to read. > > What I need is a function to parse tables which are used to handle > folders in the menu and tags. In the I need to > know the address it points to and its title (which is the one I want > to sort on). > > Do you have any smart ideas you want to share? I guess its htmllib I > need but I don't know where to start with it. from the eff-bot guide (see below): # htmllib-example-1.py import htmllib import formatter import string class Parser(htmllib.HTMLParser): # return a dictionary mapping anchor texts to lists # of associated hyperlinks def __init__(self, verbose=0): self.anchors = {} f = formatter.NullFormatter() htmllib.HTMLParser.__init__(self, f, verbose) def anchor_bgn(self, href, name, type): self.save_bgn() self.anchor = href def anchor_end(self): text = string.strip(self.save_end()) if self.anchor and text: self.anchors[text] = self.anchors.get(text, []) + [self.anchor] file = open("samples/sample.htm") html = file.read() file.close() p = Parser() p.feed(html) p.close() for k, v in p.anchors.items(): print k, "=>", v print ## link => ['http://www.python.org'] From a.eyre at optichrome.com Tue Feb 29 05:00:53 2000 From: a.eyre at optichrome.com (Adrian Eyre) Date: Tue, 29 Feb 2000 10:00:53 -0000 Subject: A comp.lang.python code snippet archive? In-Reply-To: Message-ID: <000601bf829b$dd53c660$3acbd9c2@peridot.optichrome.com> >> * if it's still worthwile to continue this site > Your site is (or may become) just as valuable to the community as the > Python docs, the FAQ, the Vault of Parnassus, et cetera. I'm wondering if it's worth adding to some list of links at www.python.org in the same way that parnassus is. Does anyone maintain a list of links to useful Python resources? I think more people would use sites like this if they knew about them. The only way at the moment to find out is to continuously read comp.lang.python for a couple of years. Not everyone has the time/patience to do this. We could also have some convention about Python snippets posted to c.l.py, so they can be automagically extracted and categorised. e.g. #snippet "mysnippet.py" #category "Networking" #description "This does something interesting" #begin #!/usr/bin/env python my_code_here() #end ----------------------------------------------------------------- Adrian Eyre - http://www.optichrome.com From effbot at telia.com Sat Feb 12 10:53:29 2000 From: effbot at telia.com (Fredrik Lundh) Date: Sat, 12 Feb 2000 15:53:29 GMT Subject: Two question from a newbie References: <%zep4.24612$3b6.103195@ozemail.com.au> Message-ID: Jason Stokes wrote: > Moshe Zadka wrote in message ... > > >On Fri, 11 Feb 2000, Fred L. Drake, Jr. wrote: > > > >> > 1.) How do I implement ORs and ANDs in an if-statment? > >> > > >> > - e.g. I'd like to have this C-code in Python: > >> > > >> > if (x.mode == "view" || x.mode == "modify") > >> > myMode = x.mode; > >> > >> if (x.mode == "view" or x.mode == "modify"): > >> myMode = x.mode > > > >Apparently Fred is hacking too much C these days, otherwise he'd > >encourage you to use Python (rather then C-in-Python): > > > >if x.mode in ("view", "modify"): > > myMode = x.mode > > I don't see that this idiom has that much to recommend it. less source code, easier to read, less error prone, and scales much better. in other words, a perfect (and very common) pydiom. > The intention of the second is not so immediate, so it > must lose out if you want to write maximally comprehendable > code. not if you're wearing Python goggles ;-) From gchiaramonte at ibl.bm Fri Feb 4 07:57:52 2000 From: gchiaramonte at ibl.bm (Gene Chiaramonte) Date: Fri, 4 Feb 2000 08:57:52 -0400 Subject: delphi2python In-Reply-To: <3899e7a3$1_3@127.0.0.1> Message-ID: Even better, Python embedded in Delphi as a VCL. http://www.multimania.com/marat There is also an e-group setup for PythonForDelphi. It comes with lots of examples to get you started. Morgan does a great job of supporting you while you learn how everything works too. Hope it helps. Gene > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of dzsieji > Sent: Thursday, February 03, 2000 10:43 AM > To: python-list at python.org > Subject: delphi2python > > > anyone knows about a tool that converts delphi to python? > if you did, you would save a few weeks of my life...... > > adam. > > > > > -----------== Posted via Newsfeeds.Com, Uncensored Usenet News > ==---------- > http://www.newsfeeds.com The Largest Usenet Servers in the World! > ------== Over 73,000 Newsgroups - Including Dedicated Binaries > Servers ==----- > -- > http://www.python.org/mailman/listinfo/python-list -------------- next part -------------- A non-text attachment was scrubbed... Name: Home Site.URL Type: application/octet-stream Size: 57 bytes Desc: not available URL: From thomas at xs4all.net Fri Feb 11 11:59:43 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 11 Feb 2000 17:59:43 +0100 Subject: Smalltak [RE: Whitespace as syntax (was Re: Python Rocks!)] In-Reply-To: <8806p0$8u7$1@nntp6.atl.mindspring.net>; from aahz@netcom.com on Fri, Feb 11, 2000 at 05:30:08AM +0000 References: <000601bf7382$c3009040$8e2d153f@tim> <8806p0$8u7$1@nntp6.atl.mindspring.net> Message-ID: <20000211175943.H477@xs4all.nl> On Fri, Feb 11, 2000 at 05:30:08AM +0000, Aahz Maruch wrote: > In article <000601bf7382$c3009040$8e2d153f at tim>, > Tim Peters wrote: > > > >and-get-those-ugly-colons-out-of-smalltalk-ly y'rs - tim > > Here's an interesting question that I don't think I've seen here: given > that the semicolon is not a significant character in Python, why wasn't > it chosen as the tuple creator? Would make it a lot easier to do, say, > > def foo(bar): > print bar > > foo(a;b;c) If I read the history and historic files correctly, functions used to take only a single argument, which could be a tuple. And the automatic conversion was added later, I think. In any case, it makes sense. If it looks like a tuple, it IS a tuple ;) Adding different syntax for tuples (or for argument-declaration and -passing) would probably cause all kinds of confusions... When something is a tuple and when it is an argument seperator, for instance ;P -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From pinard at iro.umontreal.ca Fri Feb 18 20:42:51 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: 18 Feb 2000 20:42:51 -0500 Subject: Which GUI? In-Reply-To: Moshe Zadka's message of "Fri, 18 Feb 2000 15:26:59 +0200 (IST)" References: Message-ID: Moshe Zadka writes: > On the other hand, portable free programs cannot use PyGTK either [...] Wow, that's new to me... Why do you say that? (!!) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From alxchltn at my-deja.com Tue Feb 22 23:06:07 2000 From: alxchltn at my-deja.com (alxchltn at my-deja.com) Date: Wed, 23 Feb 2000 04:06:07 GMT Subject: Font in tkinter / idle References: <87putpfssr.fsf@parus.parus.no> Message-ID: <88vmbd$37f$1@nnrp1.deja.com> > > "Jon K Hellan" wrote in message > news:87putpfssr.fsf at parus.parus.no... > > How do I change the default font for tkinter apps, > > in particular idle? > > > > Jon K?re > > In article , "Robert Hicks" wrote: > you want to edit EditorWindow.py: > > if sys.platform[:3] == 'win': > text['font'] = ("verdana", 10) > # text['font'] = ("courier new", 10) > > change the font and size to what you would like to see... > > Bob If your interested, you can also change the background and keyword colors.Go to the "IdlePrefs.py" file in the IDLE folder. These settings are from a post courtesy of Randall Hopper. (very nice, Randall.) class ColorPrefs: CNormal = "white", "MidnightBlue" CKeyword = "orange3", None CComment = "red3", None CString = "green3", None CDefinition = "cyan3", None CHilite = "#000068", "#006868" CSync = None, None CTodo = None, None CBreak = "#ff7777", None CHit = "#ffffff", "#000000" CStdIn = None, None CStdOut = "gray90", None CStdErr = "red3", None CConsole = "yellow3", None CError = None, "#ff7777" CCursor = None, "gray75" Good luck, alx Sent via Deja.com http://www.deja.com/ Before you buy. From tim_one at email.msn.com Wed Feb 9 00:08:44 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 9 Feb 2000 00:08:44 -0500 Subject: Plex 0.1 - A Lexical Analysis Module In-Reply-To: <389F69C8.BCCE4CA@cosc.canterbury.ac.nz> Message-ID: <000801bf72bb$bd4798a0$372d153f@tim> [posted & mailed] [Greg Ewing] > Having spent a couple of years wondering "when is someone > going to write a decent lexing module for Python", I finally > decided to do it myself. Yay! > You can take a sneak preview of what I've come up with so > far at: > > http://www.cosc.canterbury.ac.nz/~greg/python/Plex > > Briefly, you construct a scanner from a bunch of regexps, > rather like flex, set it loose on a character stream, > and it returns you tokens. > > Main selling point: All the regexps are compiled into a single > DFA, which allows input to be processed in time linear in the > number of characters to be scanned, regardless of the number > or complexity of the regexps. I don't have time to play, but gave it a quick look. Three suggestions, two of which you already beat me to : 1. C for speed. mxTextTools is your (only?) competition here. The lack of a standard blazing lexer has hurt many Python projects, and wastes time on many more as people micro-optimize the snot out of one-shot "trick the re engine" approaches. 2. More conventional (regexp) syntax (although I wouldn't give up the "functional" notation you have now either! especially not in light of the next one). 3. Less conventional (for a scanner) FSM operations. I've long used (but never got around to releasing or documenting) a set of overly general Python FSM classes that support direct computation of regular language intersection, complement, difference, and reversal, as well as regexpy unions and catenations. This can be very handy (match everything like *this* except like *that* ...), and they all fit into the "single linear-time DFA" model. It's a great way to increase the practical power without actually doing more work . encouragingly y'rs - tim From spamfranke at bigfoot.de Wed Feb 2 19:06:02 2000 From: spamfranke at bigfoot.de (Stefan Franke) Date: Thu, 03 Feb 2000 00:06:02 GMT Subject: programming for children References: <876emj$kco$1@oak.fernuni-hagen.de> Message-ID: <3899c50a.5980588@news.btx.dtag.de> Fritz, you should definitely have a look at Alice: www.alice.org Regards, Stefan On Tue, 1 Feb 2000 11:05:54 +0100, "Fritz Heinrichmeyer" wrote: >My son is 11 years and wants to learn programming. He heared about java at >school (cool like nike or adidas ...) but in my opinion this is very hard >stuff for a beginner to bring anything to play. > >I thought of a nice python environment under windows ... It would be best to >have german documentation too. > >What do you think? >--- >Fritz Heinrichmeyer mailto:fritz.heinrichmeyer at fernuni-hagen.de >FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany) >tel:+49 2331/987-1166 fax:987-355 http://ES-i2.fernuni-hagen.de/~jfh > From bestvina at math.utah.edu Wed Feb 23 10:52:56 2000 From: bestvina at math.utah.edu (Mladen Bestvina) Date: Wed, 23 Feb 2000 08:52:56 -0700 Subject: Tkinter installation problems Message-ID: <38B40258.72445B00@math.utah.edu> Here is what I get. Please help! mladen at drava:/home/mladen/projects/grayson > python Python 1.5.2 (#4, Feb 14 2000, 16:39:33) [GCC pgcc-2.91.57 19980901 (egcs-1.1 re on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import _tkinter >>> import Tkinter >>> Tkinter._test() File "", line 1 Tkinter._test() ^ SyntaxError: invalid syntax >>> Mladen Bestvina From carsten.sessler at fhtw-berlin.de Wed Feb 9 11:32:08 2000 From: carsten.sessler at fhtw-berlin.de (Carsten Sessler) Date: Wed, 9 Feb 2000 17:32:08 +0100 Subject: os.environ is empty in JPython Message-ID: <87s4bt$g4op$1@fu-berlin.de> Hello, in order to run some Python-Scripts as CGI I'd like to read environment variables. The same script running in Python delivers what I expect (the "QUERY_STRING") whereas in JPython the os.environ dictionary is empty. What can I do to get my environment or are there any other (JAVA?) methods that suit my needs? regards, Carsten Sessler From ejr at lotus.CS.Berkeley.EDU Fri Feb 11 22:31:02 2000 From: ejr at lotus.CS.Berkeley.EDU (Edward Jason Riedy) Date: 12 Feb 2000 03:31:02 GMT Subject: C interpreters... [off-topic] References: <200002112329.SAA01742@seanb.sttln1.wa.home.com> Message-ID: <882k5m$dub$1@agate.berkeley.edu> And seanb at home.com writes: - - If you really want a C-like scripting language, I have two suggestions - for you: JavaScript or Pike. Two more: EiC: http://www.kd-dev.com/~eic/ Pretty amazing support of C in a safe interpreter. CINT: http://root.cern.ch/root/Cint.html A C++ interpreter. No, really. Even supports some of the old HP STL... These are both impressive in their support of the target languages in interpreters. There's also a C--, but I don't think it's interpreted. It's meant as a portable assembly (http://www.research.microsoft.com/~simonpj/#c--gc). Jason, who's sick of all these languages and pretty much just wants something close to a dynamically compiled Dylan... From paul at prescod.net Thu Feb 17 20:57:02 2000 From: paul at prescod.net (Paul Prescod) Date: Thu, 17 Feb 2000 17:57:02 -0800 Subject: Continuations and threads (was Re: Iterators & generators) References: <001601bf7853$6b03e7e0$b7a0143f@tim> <88h50k$mt2$1@nntp6.atl.mindspring.net> <38AC5FCA.75F4EA42@prescod.net> <88hu7j$kqc$1@nntp6.atl.mindspring.net> Message-ID: <38ACA6EE.90D582DF@prescod.net> Aahz Maruch wrote: > > Assuming that I've understood everything you've said about > continuations, I think I also understand what Tim meant about modeling > threads with continuations and vice-versa. Seems to me that one could > easily implement continuations with a process that forks off and blocks > waiting for one of two signals: resume or die. (When a process forks, > both processes have almost exactly the same state, right?) Okay, but how is implementing threading via fork() using continuations? The underlying OS task switcher is doing all of the work, not the language's continuation feature. > If everything I've said above is correct, then it should be reasonably > straightforward to also model continuations with threads (but probably > not Threading.py). I leave the reverse model as an exercise for the > reader. ;-) This half would probably work if your threads work like fork(). If they work like: "StartThisFunctionInAnotherThread( func )" then it won't work. > Am I right? Well your version had some improvements but I think that they make more clear the fact that the while loop is not useful. The continuations will bounce back and forth forever by themselves. In this case they are very much like "goto" in basic which probably explains why Common Lisp people hate them. As has been pointed out, it is pretty tricky to come up with simple, compelling examples. Programming languages tend to evolve the flow control constructs that people need rather than requiring them to implement flow control themselves! If we could only go back to before the invention of while, for, try/except and so forth, we could all learn to do everything with continuations and forget about all of that syntactic sugar. :) -- Paul Prescod - ISOGEN Consulting Engineer speaking for himself "The calculus and the rich body of mathematical analysis to which it gave rise made modern science possible, but it was the algorithm that made possible the modern world." - from "Advent of the Algorithm" David Berlinski http://www.opengroup.com/mabooks/015/0151003386.shtml From drek at interlog.com Fri Feb 18 10:29:20 2000 From: drek at interlog.com (Agent Drek) Date: Fri, 18 Feb 2000 10:29:20 -0500 (EST) Subject: PyGreSQL and windows In-Reply-To: Message-ID: |Subject: Re: PyGreSQL and windows | |On Fri, 18 Feb 2000, [iso-8859-1] Ulf Engstr?m wrote: |> I'm working in a mixed environment and now I want to retrieve some stuff |> from a PostGreSQL-database running on a RedHat6-machine from a windows |> one. Questions have been asked here before about this issue, but no |> answers have been given. Anyone knows how to install the PyGreSQL-module |> on windows? | | "In Rome do as romaninas". On Windows use ODBC. | |Oleg. I am also working in a mixed environment that is bound to drive me over the edge in the near future :) Is there NO way for me to communicate to my new Postgresql server from a windows boxen? What database system is recommended for cross platform communication? thanks, -- -ly y'rs, Agent Drek Big Animation Inc > 'digital plumber' http://www.bigstudios.com From alex at somewhere.round.here Sun Feb 13 17:39:58 2000 From: alex at somewhere.round.here (Alex) Date: 13 Feb 2000 17:39:58 -0500 Subject: Real Problems with Python References: <000e01bf7668$850d9740$572d153f@tim> Message-ID: Oh, I see. Thanks for the clarification, Neel. Alex. From timmuddletin at news.vex.net Sat Feb 5 02:45:31 2000 From: timmuddletin at news.vex.net (tim muddletin) Date: 5 Feb 2000 07:45:31 GMT Subject: Vaults of Parnassus problem References: <3899A4F3.76F8FD8A@hotmail.com> <87ca7j$ela$1@nntp3.atl.mindspring.net> Message-ID: <87gker$2d44$1@news.tht.net> aahz at netcom.com (Aahz Maruch) wrote in <87ca7j$ela$1 at nntp3.atl.mindspring.net>: >again it works for me. Either there's a regular transient problem >at vex.net or there's some weird network problem. There have been a few "transient" (as Aahz says) problems this week, but none "regular" (as far as i have seen), and generally not lasting too long at any one time. So if you have a problem, do try to stay calm as possible, and try back again in a little while. (-: As of today the vex.net web server is on a big "honking" (as D'Arcy says) new machine. Heh. This may help, too. So far it looks to be working well! Sorry for any inconveniences. From hinsen at cnrs-orleans.fr Tue Feb 1 09:54:54 2000 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: 01 Feb 2000 15:54:54 +0100 Subject: Accessing a lock object in a C module Message-ID: For a threaded application, I need to access a lock both from Python code and from a C extension module, but I haven't yet found a way to do that. If I create a lock object in Python via the thread module, I can't access its lock_lock member; the structure definition is not in a header file, and there is no C-level access routine either. Inversely, if I create a lock in a C module, I can't create a corresponding lock object accessible from Python. It seems that the only solution is to use PyObject_CallMethod on the lock object in my C module, which means additional interpreter overhead. Has anyone found another method? -- ------------------------------------------------------------------------------- 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 alex at somewhere.round.here Sun Feb 6 17:51:57 2000 From: alex at somewhere.round.here (Alex) Date: 06 Feb 2000 17:51:57 -0500 Subject: arguments from the prompt References: Message-ID: > how do I write a python script to recive arguments from the command > prompt? This should get you started: #!/usr/bin/python # Or whatever the path for the python executable is. from sys import argv import pprint pprint.pprint (sys.argv) ###################################################################### Then, the command line, puf% cd python/fun/ puf% chmod u+x command_line_args.py puf% ./command_line_args.py These are the arguments. ['./command_line_args.py', 'These', 'are', 'the', 'arguments.'] puf% Here, command_line_args.py is the file the script above is in. You might also want to check out the getopt module. Alex. From bob at horvath.com Thu Feb 24 03:37:53 2000 From: bob at horvath.com (Bob Horvath) Date: Thu, 24 Feb 2000 08:37:53 +0000 Subject: identity of the caller? Message-ID: <38B4EDE0.1DB1B55F@horvath.com> Is there any way to find out the identity of who called you? I am mainly thinking of method calls, but in general if there is a way for regular function calls, I would be interested in that too. I suppose I should give some context. We have a tool that draws message flow diagrams for communications systems. These flows are similar to use case flows, or ITU Z.120 MSC charts if you know what those are. The tools takes simple ascii text which has the sender, the receiver, and the message name, as in... SENDER RECEIVER MessageName We tend to have to enumerate a lot of these, and I had the thought that if I could prototype the functionality of the nodes, they could generate the text used to generate the drawings. What I was thinking is that the receivers of the message would define methods that handle them. To get the picture right, I would need to print out method name, the receiver, and who sent it. It is the "who sent it" bit that I can't visualize a solution for. From wtanksle at hawking.armored.net Mon Feb 28 16:42:56 2000 From: wtanksle at hawking.armored.net (William Tanksley) Date: 28 Feb 2000 21:42:56 GMT Subject: Which GUI? References: Message-ID: On 28 Feb 2000 19:16:01 GMT, Vadim Zeitlin wrote: >On 26 Feb 2000 23:38:03 GMT, William Tanksley wrote: >>Oh, one of the wxWindows supported platforms is -- are you ready for this >>-- Curses. > Sorry, I have to correct you here. wxWindows does not support text mode UI >and neither does wxPython. This could be done (and I wanted to do it at one >moment), but more time passes, less chances there are that it will ever >happen. I would love to be able to have wxCurses port, but there is apparently >not enough interest in it. Well, I'm interested. wxWindows is nice. Perhaps a port on top of CDK would be easier? www.vexus.ca/cdk? However, unless my memory is really bad, wxWindows used to support Curses. I'm pretty sure I remember a package for that. I didn't ever see any apps for it, nor did I try to build any myself (no time). The main wxWindows site lists Curses as one of the ports -- is it just lying? The URL it gives as the source is at ftp://www.remstar.com/pub/wxwin/ports/curses/wxcurses.tgz. >VZ -- -William "Billy" Tanksley, in hoc signo hack From framiere at netcom-service.com Tue Feb 15 14:20:25 2000 From: framiere at netcom-service.com (Florent Ramière) Date: Tue, 15 Feb 2000 20:20:25 +0100 Subject: Web programming / print - exec problem !? Message-ID: <88c9ar$7jo$1@news2.isdnet.net> Hello, it seems that print in exec statements is not unbeffered !? Here is the description of the problem Here is my template: python is embeded in html code <---------------

> <%% strValue = netMine.tools.CDBTools.GetFromRowAndName(self.pCursor, pRow,'COUNTRY_ID') strEvaluated = strValue if (strEvaluated == None): { print " " } else: { print netMine.tools.CDBTools.TextToHTML(strEvaluated) } %%>
\n", strValue = netMine.tools.CDBTools.GetFromRowAndName(self.pCursor, pRow,'COUNTRY_ID') strEvaluated = strValue if (strEvaluated == None): print " " else: print netMine.tools.CDBTools.TextToHTML(strEvaluated) print "