Re: TurboGears /.-ed, >new == True< or >new == "True"

2005-10-13 Thread Erik Max Francis
Andy Leszczynski wrote: > So how does it correspond to other piece of the code: > > 2 def notfound(self, pagename): > 3 return dict(pagename=pagename, data="", new=True) > > new is a boolean here? It comes through as a CGI query. -- Erik Max Francis && [EMAIL PROTECTED] && http://

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-13 Thread Steve Holden
Rune Strand wrote: > Ok, Alex. I know a good explanation when I see one. Thanks! > Make that "...when someone beats me over the head with it" ;-) Glad you have the explanation you needed, anyway. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC

Re: installer for amd64 build of python?

2005-10-13 Thread magneticlemur
Brett, >I don't have an answer for you, but just to clarity for future >readers... based on the quote above, I assume you mean a native 64-bit >build for Windows, right? You never stated what platform you need this >for, I for one use a 64-bit build of Python on Linux just fine... but >yes, Windo

Re: Multiple assignments simplification

2005-10-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I don't know if C++ compilers can do such optimizations. working on a Python to C/C++ translator without knowing what kind of optimizations a C/C++ compiler can do for you sounds like a great way to waste your time... (I would be rather bit surprised if any contemporar

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
Ron Garret wrote: > Is this a bug or a feature? > > class mydict(dict): >def __setitem__(self, key, val): > print 'foo' > dict.__setitem__(self, key, val) > > d=mydict() d[1]=2 > > foo > d.setdefault(2,3) Feature. If it wouldn't bypass __setitem__, how exactly would

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Diez B. Roggisch
Delaney, Timothy (Tim) wrote: > Tom Anderson wrote: > > >>Except that in smalltalk, this isn't true: in ST, every variable >>*appears* to contain a reference to an object, but implementations >>may not actually work like that. In particular, SmallTalk 80 (and >>some earlier smalltalks, and all su

Re: Scope problem with nested functions.

2005-10-13 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote > I'm having trouble resolving a scope problem. I have a module, > called from another script, with this structure: the code you posted gives a syntax error. if I fix that, and add some boilerplate to call getCcyMappings from inside the parseFile function, I get: Trace

Re: Looking for a Python mentor

2005-10-13 Thread Rob Cowie
I'll gladly give you a hand. I should point out - I'm no expert. I think I've reached a point a bit beyond yours; I learnt OO programming principles with java and have spent this last Summer learning python. I have a good grasp of it. If you want to get in touch, email rob_cowie AT mac DOT com -

Re: A Tree class, my $0.02 contribution to the python community.

2005-10-13 Thread Antoon Pardon
Op 2005-10-12, George Sakkis schreef <[EMAIL PROTECTED]>: > "Antoon Pardon" <[EMAIL PROTECTED]> wrote: >> Comments are welcome: >> >> http://www.pardon-sleeuwaegen.be/antoon/avltree.html > > How about adding two shortcut methods, nextkey(k) and prevkey(k), to return > the next and previous > key

Re: Perl-Python-a-Day: Sorting

2005-10-13 Thread Diez B. Roggisch
> In Perl, sort is a function, not some Object Oriented thing. It returns > the sorted result as another list. This is very simple and nice. And sometimes exteremely stupid - if your list is large, and making a copy just form sorting it (when you don't have to keep a referenece to the old list)

Re: Jargons of Info Tech industry

2005-10-13 Thread Paul Rubin
Roedy Green <[EMAIL PROTECTED]> writes: > Next Mr. Phish had to present his passport etc when he got his Thawte > ID. Now Interpol has a much better handle on putting him in jail. > He can't repudiate his phishing attempt. Any underage drinker in a college town can tell you a hundred ways to get

Re: Here I am again, same old arguments

2005-10-13 Thread CJ
Wow, thanks alot. I pretty much (due to my own desire to get the program to )(@#T(=!!! work and be done with it) just turned the list into a function that returns a list that isn't attached to anything but the function itself, but I've taken the advice to heart. Most of what you posted makes

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > AFAIK some LISPs do a similar trick to carry int values on > cons-cells. And by this tehy reduce integer precision to 28 bit or > something. Surely _not_ going to pass a regression test suite :) Lisps often use just one tag bit, to distinguish betwe

Re: installer for amd64 build of python?

2005-10-13 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > Does anyone know of an available downloader for an amd64 bit > build of (a modern) python? There is no official build. The only official Win64 build is for Itanium, see www.python.org/2.4.2 > I've done my due diligence search of python docs and > mailing archives, and I

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Peter Otten
Diez B. Roggisch wrote: > Ron Garret wrote: >> Is this a bug or a feature? >> >> class mydict(dict): >>def __setitem__(self, key, val): >> print 'foo' >> dict.__setitem__(self, key, val) >> >> >d=mydict() >d[1]=2 >> >> foo >> >d.setdefault(2,3) > > > Feature. If it

Re: installer for amd64 build of python?

2005-10-13 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Does anyone know of an available downloader for an amd64 bit > build of (a modern) python? I've gotten a bug report from someone using Python under Linux on an amd64, so compiling for 64 bits definitely is feasible. You could try the Fedora Core 4 amd64 distro (http://

Re: Jargons of Info Tech industry

2005-10-13 Thread Ross Bamford
On Thu, 13 Oct 2005 09:04:17 +0100, > wrote: > Roedy Green <[EMAIL PROTECTED]> writes: >> Next Mr. Phish had to present his passport etc when he got his Thawte >> ID. Now Interpol has a much better handle on putting him in jail. >> He can't repudiate his phishing attempt. > > Any underage drinker

Re: Jargons of Info Tech industry

2005-10-13 Thread axel
In comp.lang.perl.misc Roedy Green <[EMAIL PROTECTED]> wrote: > On Thu, 13 Oct 2005 01:17:45 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote >>No, that's what makes email a vector for infection. What makes using >>the address book - for whatever purpose - possible for viruses is >>having an API that

Re: how to make this code faster

2005-10-13 Thread [EMAIL PROTECTED]
hello, I found that scipy only works with python 2.3 or? I don't know if the logic is correct: 1. loop inside loop uses a lot of resources 2. Numeric or Numpy can make program faster 3. It use kind of Array/Matrix analysis style 4. We have to change our algorithms so that Numeric or Numpy can hel

Re: installer for amd64 build of python?

2005-10-13 Thread magneticlemur
Martin, >I'm not at all mystified. The operating system was only released >after the release of Python 2.4, there is no official compiler >available yet to the general public, and I don't have the hardware >to test such a release. >It's fairly likely that Python 2.5 will not see official AMD64 >Win

Re: Pass a tuple (or list) to a C wrapper function

2005-10-13 Thread Fredrik Lundh
Jeremy Moles wrote: > Probably what you want to do though is just keep the tuple as is and > iterate over it using the PySequence_* protocol: > > http://docs.python.org/api/sequence.html I did post a complete and tested example a few days ago, which contained code that showed how to do this. a c

RE: Scope problem with nested functions.

2005-10-13 Thread AddisonN
Thanks Fredrik, that's fixed it. Apologies for the lazy typing - should have cut and pasted the whole thing. -Original Message- From: Fredrik Lundh [mailto:[EMAIL PROTECTED] Sent: 13 October 2005 08:55 To: python-list@python.org Subject: Re: Scope problem with nested functions. <[EMAIL P

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >>AFAIK some LISPs do a similar trick to carry int values on >>cons-cells. And by this tehy reduce integer precision to 28 bit or >>something. Surely _not_ going to pass a regression test suite :) > > > Lisps often use just one

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Fredrik Lundh
Tom Anderson wrote: > In both smalltalk and python, every single variable contains a reference > to an object - there isn't the object/primitive distinction you find in > less advanced languages like java. > > Except that in smalltalk, this isn't true: in ST, every variable *appears* > to contain

Re: Pythot doc problem: lambda keyword...

2005-10-13 Thread Jamie Border
"Pisin Bootvong" <[EMAIL PROTECTED]> wrote: Xah Lee ?: [...] > Fuck the Python liers and ignorant fuckheads. Motherfucking don't know > shit and yet lying thru their teeth with fanfare. [...] > Xah > [EMAIL PROTECTED] > ? http://xahlee.org/ [elided] PB> BTW, you post to the wrong group. No

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
> The implementation is certainly a design decision. setdefault() could be > implemented in terms of __set/getitem__() as > > def setdefault(self, key, value=None): > try: > return self[key] > except KeyError: > self[key] = value > return self[key] > > I guess it's

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > That particular implementation used 3 or 4 tag-bits. Of course you are > right that nowadays python won't notice the difference, as larger nums > get implicitely converted to a suitable representation. But then the > efficiency goes away... Basically

Teaching Python, was: Re: is there any Python code for spatial tessellation?

2005-10-13 Thread Magnus Lycka
Shi Mu wrote: > is there any course website about teaching python? > for instance, some computer science courses website? Your subject line wasn't very helpful... See: http://mcsp.wartburg.edu/zelle/python/ http://mail.python.org/pipermail/edu-sig/ http://tech.canterburyschool.org/pycon/ http://w

Reload the network configuration directly from a python sript ?

2005-10-13 Thread HIL
Hi everybody, I wrote a python script to setup my network interface under Linux. To perform it, I use directly from my python script external programs as 'ifconfig' and 'route' ans I fill the file /etc/resolv.conf with the good nameserver IP. So, it it works and my network is up. My problem is t

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-13 Thread Fredrik Lundh
Rune Strand wrote: >> those modules are already imported when Python gets to your code, so >> the only "overhead" you're saving is a little typing. > > I don't understand this. Could you please elaborate? - if sys or os > are not imported for any other causes how are they already imported? becau

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > (fwiw, switching to tagging in CPython would break most about > everything. might as well start over, and nobody's likely to do > that to speed up integer- dominated programs a little...) Yeah, a change of that magnitude in CPython would be madness, b

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Steve Holden
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >>That particular implementation used 3 or 4 tag-bits. Of course you are >>right that nowadays python won't notice the difference, as larger nums >>get implicitely converted to a suitable representation. But then the >>efficiency

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Peter Otten
Diez B. Roggisch wrote: >> The implementation is certainly a design decision. setdefault() could be >> implemented in terms of __set/getitem__() as >> >> def setdefault(self, key, value=None): >> try: >> return self[key] >> except KeyError: >> self[key] = value >>

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Until someone does the experiment this stuff is bound to be > speculation (what's that saying about "premature optimization"?). 40 years of practical Lisp implementation efforts and around the globe and hundreds of published papers on the subject might n

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Fredrik Lundh
Peter Otten wrote: > Are we talking about the same setdefault()? > > setdefault(...) >D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D note that it might be spelled "setdefault", but it should be pronounced "get or set". -- http://mail.python.org/mailman/listinfo/python

Re: Here I am again, same old arguments

2005-10-13 Thread gene tani
google "cheat sheet" or "quick reference" http://rgruet.free.fr/#QuickRef http://infohost.nmt.edu/tcc/help/pubs/python22/ http://www.onlamp.com/pub/a/python/excerpt/PythonPocketRef/index.html http://diveintopython.org/appendix/abstracts.html http://www.yukoncollege.yk.ca/~ttopper/COMP118/rCheatShe

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Duncan Booth
Diez B. Roggisch wrote: > So if setdefault > was implemented as > > def setdefault(self, v): > self["SOME_DEFAULT_KEY_NAME"] = v if setdefault was implemented that way then all current uses of setdefault would throw an exception. setdefault takes *three* parameters: self, key, value. Once

Re: Looking for a Python mentor

2005-10-13 Thread Nir Aides
Hello Len, You should try the #python IRC room. It is always very active and helpful. Nir LenS wrote: > Hello > > Was wandering if there is any place where some one could go to get > mentoring on python coding. I have started coding in python but I am > the only one in the shop using it. S

Re: Looking for a Python mentor

2005-10-13 Thread Kent Johnson
LenS wrote: > Hello > > Was wandering if there is any place where some one could go to get > mentoring on python coding. I have started coding in python but I am > the only one in the shop using it. So there is no one around to look > over my code give suggestions on improvement, in style, logi

Re: Setdefault bypasses __setitem__

2005-10-13 Thread Diez B. Roggisch
> Are we talking about the same setdefault()? > > > D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D > > There is no per-instance default value just on per call: Oh. You're right. I was somehow under the impression that setdefault is per-instance, so that I can avoid d.get(ke

Re: Here I am again, same old arguments

2005-10-13 Thread Steven D'Aprano
On Thu, 13 Oct 2005 08:05:00 +, CJ wrote: > 1) Why no global variables? I'm taking your word for it that they're bad. Far > be it from me to > argue with you, but why are they bad ideas to begin with? Most of the > languages I've used up to > this point have been reliant on globals, so I'm

Re: Pass a tuple (or list) to a C wrapper function

2005-10-13 Thread Java and Swing
Fredrik...I forgot about that...wish Google Groups had a way to quickly find the topics a user posts. anyhow, for receiving an object from python..is it ok = PyArg_ParseTuple(args, "sO", &x, &y); ...is it "sO" or "s0" is it O (as in the letter) or 0 (as in the number)? I would think "O" the

graphic memory & animation

2005-10-13 Thread Peres
Hello! Python is great!... but the erasing of the graphic memory is slow (I used surf.fill from Pygame). Does anyone know how to erase the screen faster, in animated graphics?   With many thanks   Valerie Peres   -- http://mail.python.org/mailman/listinfo/python-list

wxPython question

2005-10-13 Thread vpr
Hi Does anyone have some example code to create a wx dialog that apears off screen on the bottom right hand corner and slides up into the screen ? Thanx /vpr -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple assignments simplification

2005-10-13 Thread bearophileHUGS
Thank you George Sakkis for your fast and accurate answer. In my life I am encountering lot of graph-based solutions to my problems. I'll try to implement your solution as soon as possible. Fredrik Lundh>working on a Python to C/C++ translator without knowing what kind of optimizations a C/C++ co

Adding methods to an object

2005-10-13 Thread Gabriele *darkbard* Farina
Hi, there is a way to add methods to an object dynamically? I need to do something like this. I remember python allowed this ... class A(object): def do(s, m): print m @staticmethod def init(obj): obj.do = A.do class Test(object): pass o = Test() A.init(o) o.do(10) Now it gives me an

Re: Pass a tuple (or list) to a C wrapper function

2005-10-13 Thread Java and Swing
Fredrik, ...I tried using your code... static long *get_long_array(PyObject *data, int *data_size) { int i, size; long* out; PyObject* seq; seq = PySequence_Fast(data, "expected a sequence"); if (!seq) return NULL; size = PySequence_Size(seq); if (size < 0)

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-13 Thread Alex Martelli
Rune Strand <[EMAIL PROTECTED]> wrote: > Ok, Alex. I know a good explanation when I see one. Thanks! You're welcome! I've tried to give good (but shorter!-) explanations in the Nutshell, too, but of course it's easier to aim a specific explanation to a specific questioner than to try and clarify

Re: wxPython question

2005-10-13 Thread Will McGugan
vpr wrote: > Hi > > Does anyone have some example code to create a wx dialog that apears > off screen on the bottom right hand corner and slides up into the > screen ? > Andrea Gavana does.. http://xoomer.virgilio.it/infinity77/eng/freeware.html#toasterbox Will McGugan -- http://www.willmcgug

Re: Adding methods to an object

2005-10-13 Thread bearophileHUGS
This isn't code of mine, it's probably from the cookbook, maybe with little changes: | def addMethod(object, method, name=None): | if name is None: name = method.func_name | class newclass(object.__class__): | pass | setattr(newclass, name, method) | object.__class__ = newc

Re: Pass a tuple (or list) to a C wrapper function

2005-10-13 Thread Java and Swing
I got it. I had get_long_array placed after the method that was calling it.. i.e. void doStuf(...) { x = get_long_array(...); } static long *get_long_array(PyObject *data, int *data_size) { ... } ...I put get_long_array before it in my code..and its fine. Thanks Java and Swing wrote: > Fr

When to free memory for C wrapper?

2005-10-13 Thread Java and Swing
I have been posting lately about writing a C wrapper so Python can access my C functions. In my wrapper function I have something like... static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { PyObject *data; char *result; long *d; PyArg_ParseTuple(args, "O:wrap_doStuff"

Re: When to free memory for C wrapper?

2005-10-13 Thread Java and Swing
One other thing, I was reading about Py_DECREF...and I see it says "A safe approach is to always use the generic operations (functions whose name begins with "PyObject_", "PyNumber_", "PySequence_" or "PyMapping_"). These operations always increment the reference count of the object they return. T

Re: Adding methods to an object

2005-10-13 Thread rcramsdell
gabriele, This works (A, Test, and o as defined by you): >>> a=A() >>> o.do(a, 10) 10 Your problem is that do() really has two parameters, an A instance and whatever you want to print. Why not do this: >>> def newdo(m): ... print m ... >>> newdo(10) 10 >>> o=Test() >>> o.newdo = newdo >>>

Re: Adding methods to an object

2005-10-13 Thread Steven D'Aprano
On Thu, 13 Oct 2005 06:06:20 -0700, Gabriele *darkbard* Farina wrote: > Hi, there is a way to add methods to an object dynamically? Yes. There are three different sorts of methods, and three ways of adding them. py> class Parrot: ... def __init__(self): ... pass py> # Parrot is the

Re: how to make this code faster

2005-10-13 Thread George Sakkis
<[EMAIL PROTECTED]> wrote: > hello, > > I found that scipy only works with python 2.3 or? You can use Numeric instead of scipy if you need/want to: from Numeric import arange,reshape,sin def computeMatrix(n): xcoor = arange(0,1,1/float(n)) ycoor = reshape(xcoor, (n,1)) return sin(xc

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Alex Martelli
Tom Anderson <[EMAIL PROTECTED]> wrote: > On Tue, 11 Oct 2005, Alex Martelli wrote: > > > Tom Anderson <[EMAIL PROTECTED]> wrote: > > ... > >> Has anyone looked into using a real GC for python? I realise it would be a > > > > If you mean mark-and-sweep, with generational twists, > > Yes, more

How to call a script from another?

2005-10-13 Thread Christian
From a not even newbie: Without knowing much about Python (yet) I'm trying to install the CMS Zope via FTP (with the well documented changes to make it work on an Apache server). By birth Zope is started from a shell script. And not having the permissions to execute such ones I'll try writing

Re: Perl-Python-a-Day: Sorting

2005-10-13 Thread Lasse Vågsæther Karlsen
Diez B. Roggisch wrote: > Diez > > [1] http://xahlee.org/PageTwo_dir/Personal_dir/mi_pixra.html Oh man... Talk about ... bummer. Seriously, who do we call to get someone with a straightjacket to show up at his home? -- Lasse Vågsæther Karlsen http://usinglvkblog.blogspot.com/ mailto:[EMAIL P

Your message to Trasno awaits moderator approval

2005-10-13 Thread trasno-bounces
Your mail to 'Trasno' with the subject Re: Your letter Is being held until the list moderator can review it for approval. The reason it is being held: SpamAssassin identified this message as possible spam (score 3) Either the message will get posted to the list, or you will receive not

Well written open source Python apps

2005-10-13 Thread Ben
Could anyone suggest an open source project that has particularly well written Python? I am especially looking for code that people would describe as "very Python-ic". (Not trying to start any kind of war - just wanted some good examples of a well written Python app to read.) Thanks! -Ben P.S.

Re: How to call a script from another?

2005-10-13 Thread Jaime Wyant
I think this is the simplest way to do that: import sys sys.path.append('/path/to/directory/containg/script') import zopescript zopescript.main() The code above assumes: o that the path you use to append contains an __init__.py in it... o zopescript is the module you want to `run' o main is the

cgi python

2005-10-13 Thread Python_it
I going to use the cgi-handler (mod_python): http://www.modpython.org/live/mod_python-3.2.2b/doc-html/hand-cgi.html If I test a simply py script it works code: === print "Content-type: text/html\n" print """ TEST """ But if I test a py script with cgi comments (import

Re: Pass a tuple (or list) to a C wrapper function

2005-10-13 Thread Fredrik Lundh
Java and Swing wrote: > and I get this error.. > > C:\project\myapp.c(549) : error C2040: 'get_long_array' : 'long > *(struct _object *,int *)' differs in levels of indirection from 'int > ()' so what's on line 549 in myapp.c? what other warnings did you get from the compiler? do you have other

Re: cgi python

2005-10-13 Thread Christian Hausknecht
Python_it wrote: > I going to use the cgi-handler (mod_python): > > http://www.modpython.org/live/mod_python-3.2.2b/doc-html/hand-cgi.html > > > If I test a simply py script it works > > code: > === > print "Content-type: text/html\n" > print """ > > > TEST > > > """ >

Re: Jargons of Info Tech industry

2005-10-13 Thread Mike Meyer
Roedy Green <[EMAIL PROTECTED]> writes: > On Thu, 13 Oct 2005 01:32:03 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote > or quoted : >>That won't prevent phishing, that will just raise the threshhold a >>little. The first hurdle you have to get past is that most mail agents >>want to show a human name,

Re: cgi python

2005-10-13 Thread Paul Boddie
Python_it wrote: > I going to use the cgi-handler (mod_python): > > http://www.modpython.org/live/mod_python-3.2.2b/doc-html/hand-cgi.html > > If I test a simply py script it works You don't say how you test it, but I imagine that you just point your browser to the location where the program is pu

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Scott David Daniels
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: (about tag bits) >>... Basically I think that trying to come up with all sorts of >> optimizations for rather marginal problems (number crunching >> should be - if a python domain at all - done using Numarray) > I don't think

Re: Comparing lists

2005-10-13 Thread jon
To take the heat out of the discussion: sets are blazingly fast. -- http://mail.python.org/mailman/listinfo/python-list

passing variable arguments to a function

2005-10-13 Thread Ryan Wilcox
Hello all, I want to be able to pass a variable number of parameters into a Python function. Now, I know how to _receive_ variable arguments, but I don't know how to _send_ them. def myFunction(*args): print args myList = [1, 2, 3, 4] myFunction(myList) this function will print out ([1, 2,

Re: graphic memory & animation

2005-10-13 Thread Fredrik Lundh
"Peres" wrote: > Python is great!... but the erasing of the graphic memory is slow (I used > surf.fill from Pygame). define slow. > Does anyone know how to erase the screen faster, in animated graphics? if you're doing animation on modern hardware, there's hardly any reason not to use double bu

Re: passing variable arguments to a function

2005-10-13 Thread Christophe
Ryan Wilcox a écrit : > Hello all, > > I want to be able to pass a variable number of parameters into a Python > function. Now, I know how to _receive_ variable arguments, but I don't > know how to _send_ them. > > def myFunction(*args): > print args > > myList = [1, 2, 3, 4] > myFunction(my

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread Paul Rubin
Scott David Daniels <[EMAIL PROTECTED]> writes: > Current speeds are due to deep pipelines, and a conditional in the > INCREF code would blow a pipeline. I think most of the time, branch prediction will prevent the cache flush. Anyway, with consed integers, there's still going to be a conditional

Re: Well written open source Python apps

2005-10-13 Thread Michael Ekstrand
On Thursday 13 October 2005 09:43, Ben wrote: > Could anyone suggest an open source project that has particularly > well written Python? I am especially looking for code that people > would describe as "very Python-ic". (Not trying to start any kind of > war - just wanted some good examples of a

Re: Well written open source Python apps

2005-10-13 Thread Micah Elliott
On Oct 13, Ben wrote: > Could anyone suggest an open source project that has particularly well > written Python? I am especially looking for code that people would > describe as "very Python-ic". (Not trying to start any kind of war - > just wanted some good examples of a well written Python app

Re: Pass a tuple (or list) to a C wrapper function

2005-10-13 Thread Fredrik Lundh
"Java and Swing" wrote: > anyhow, for receiving an object from python..is it > > ok = PyArg_ParseTuple(args, "sO", &x, &y); > > ...is it "sO" or "s0" is it O (as in the letter) or 0 (as in the > number)? I would think "O" the letter..but it looks like a zero. eh? if you're not sure, what ke

PyDev 0.9.8.3 released

2005-10-13 Thread Fabio Zadrozny
Hi All, PyDev - Python IDE (Python Development Enviroment for Eclipse) version 0.9.8.3 has been released. Check the homepage (http://pydev.sourceforge.net/) for more details. Details for Release: 0.9.8.3 Major highlights: * Debugger was improved to be faster (mor

Re: How to call a script from another?

2005-10-13 Thread Scott David Daniels
Jaime Wyant wrote: > I think this is the simplest way to do that: > > import sys > sys.path.append('/path/to/directory/containing/script') > > import zopescript > zopescript.main() > > The code above assumes: > o that the path you use to append contains an __init__.py in it... I don't think this

Re: passing variable arguments to a function

2005-10-13 Thread Fredrik Lundh
Ryan Wilcox wrote: > I want to be able to pass a variable number of parameters into a Python > function. Now, I know how to _receive_ variable arguments, but I don't > know how to _send_ them. > > def myFunction(*args): > print args > > myList = [1, 2, 3, 4] > myFunction(myList) > > this funct

Re: cgi python

2005-10-13 Thread Fredrik Lundh
Paul Boddie wrote: > Testing Web applications can be hard, but the traceback tells you > everything you need to know here. especially if you make sure to use the cgitb module: http://docs.python.org/lib/module-cgitb.html while developing/debugging. -- http://mail.python.org/mailman/li

ImportError: No module named dbm

2005-10-13 Thread mhardas
Hi all, Iam trying to get 'cvs2svn' to get to work on a Trustix Linux machine. However is suspect that no dbm is installed because running cvs2svn gives the following error: ERROR: your installation of Python does not contain a suitable DBM module -- cvs2svn cannot continue. See http://python.org/

Re: How to call a script from another?

2005-10-13 Thread Christian
Thanks guy's, you have opened my eyes and made my next step a whole lot easier. Chris -- http://mail.python.org/mailman/listinfo/python-list

Technical question on complexity.

2005-10-13 Thread Jerzy Karczmarczuk
Anybody knows where I can find a concrete and guaranteed answer to the following extremely basic and simple question? What is the complexity of appending an element at the end of a list? Concatenating with another? The point is that I don't know what is the allocation policy... If Python lists ar

wxPython & Cygwin

2005-10-13 Thread Gilles DRIDI
Does someone has installed wxPython on the Cygwin platform, environment ? Thank you Gilles DRIDI http://cdridi.club.fr -- http://mail.python.org/mailman/listinfo/python-list

Re: Technical question on complexity.

2005-10-13 Thread Fredrik Lundh
Jerzy Karczmarczuk wrote: > Anybody knows where I can find a concrete and guaranteed answer to the > following > extremely basic and simple question? > > What is the complexity of appending an element at the end of a list? amortized O(1) > Concatenating with another? O(n) > The point is that

Re: Let My Terminal Go

2005-10-13 Thread Jorgen Grahn
On Tue, 11 Oct 2005 22:01:23 GMT, Dan Stromberg <[EMAIL PROTECTED]> wrote: > On Tue, 11 Oct 2005 03:30:23 -0700, Mystilleef wrote: > >> Hello, >> >> Thank you. That's all I needed. For some reason, I had always assumed >> forking was an expensive process. I guess I was ill-informed. > > In a loop,

Re: Let My Terminal Go

2005-10-13 Thread Paul Rubin
Jorgen Grahn <[EMAIL PROTECTED]> writes: > It depends on what you mean by expensive -- web servers can fork for each > HTTP request they get, in real-world scenarios, and get away with it. This is OS dependent. Forking on Windows is much more expensive than forking on Linux. -- http://mail.pytho

Re: Perl-Python-a-Day: Sorting

2005-10-13 Thread Marcin 'Qrczak' Kowalczyk
Abdulaziz Ghuloum <[EMAIL PROTECTED]> writes: > Python FAQs contain an entry to the schwartzian transform. > > http://www.python.org/doc/faq/programming.html#i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python This entry is obsolete: it should mention the 'key' option of

Re: Let My Terminal Go

2005-10-13 Thread Grant Edwards
On 2005-10-13, Paul Rubin <> wrote: > Jorgen Grahn <[EMAIL PROTECTED]> writes: >> It depends on what you mean by expensive -- web servers can fork for each >> HTTP request they get, in real-world scenarios, and get away with it. > > This is OS dependent. Forking on Windows is much more > expensive

Re: Python's garbage collection was Re: Python reliability

2005-10-13 Thread skip
Diez> AFAIK some LISPs do a similar trick to carry int values on Diez> cons-cells. And by this tehy reduce integer precision to 28 bit Diez> or something. Surely _not_ going to pass a regression test suite Diez> :) I'm pretty sure this was tried a few years ago w/ Python. I don'

Re: Let My Terminal Go

2005-10-13 Thread Paul Rubin
Grant Edwards <[EMAIL PROTECTED]> writes: > Since the NT kernel is descended from VMS, I'm not surprised > that a fork is expensive. Apache 2.x supports concurrency via threading as an alternative to forking, basically in order to get acceptable performance on Windows. -- http://mail.python.org/m

form filling XML

2005-10-13 Thread George
How can I do the following in python: given two strings: form=""" My Sample Web Page What are the weekdays? Monday Tuesday Wednesday Thursday Friday """ fillin=""" maandag dinsdag woensdag donderdag vrijdag zaterdag zondag """ How can I compare the text in the element tags with the

Re: ImportError: No module named dbm

2005-10-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Can you tell me how do I go about getting the dbm module and install > it.?? http://www.google.com/search?q=trustix+python+dbm -- http://mail.python.org/mailman/listinfo/python-list

Re: Let My Terminal Go

2005-10-13 Thread Fredrik Lundh
Jorgen Grahn wrote: > > Done once, it's usually not unacceptable. > > In fact, I can't think of a scenario where it /would/ be unacceptable ;-) if you're stuck on a system that doesn't use copy-on-write ? -- http://mail.python.org/mailman/listinfo/python-list

Forcing a stack trace from the command line?

2005-10-13 Thread Willie Walker
Hi: I'm working on Orca, a screen reader for the GNOME platform, and it's being done in Python. Python is working really for us right now and I'm quite happy with many aspects of it. Is there a function like CTRL-Backspace in Python? There is a hang in my code somewhere and I'm unable to find i

Re: form filling XML

2005-10-13 Thread Fredrik Lundh
"George" <[EMAIL PROTECTED]> wrote: > How can I compare the text in the element tags with the elements > tags in filling and if they match replace the text within the elements > tags with the text in the matching element tag of fillin. > For example Since the text Monday in form matches the Elem

1-liner to iterate over infinite sequence of integers?

2005-10-13 Thread Neal Becker
I can do this with a generator: def integers(): x = 1 while (True): yield x x += 1 for i in integers(): Is there a more elegant/concise way? -- http://mail.python.org/mailman/listinfo/python-list

Re: installer for amd64 build of python?

2005-10-13 Thread Brett Hoerner
As an aside to this, are there any freely available C compilers for Windows that can compile 64-bit binaries? I find nothing for Cygwin or MinGW... -- http://mail.python.org/mailman/listinfo/python-list

Re: installer for amd64 build of python?

2005-10-13 Thread Trent Mick
[Brett Hoerner wrote] > As an aside to this, are there any freely available C compilers for > Windows that can compile 64-bit binaries? I find nothing for Cygwin or > MinGW... Yes. The MS Platform SDK is free and includes a compiler that can target x86, ia64 and x64 (the latter is what MS -- and

Re: 1-liner to iterate over infinite sequence of integers?

2005-10-13 Thread Will McGugan
Neal Becker wrote: > I can do this with a generator: > > def integers(): > x = 1 > while (True): > yield x > x += 1 > > for i in integers(): > > Is there a more elegant/concise way? > import itertools for i in itertools.count(): print i Wi

  1   2   3   >