discarded iterator.next() at interactive global scope doesn't bump interator??

2005-09-04 Thread Bengt Richter
Is this a well known bug that's been fixed? I couldn't find any discussion of it, but maybe my googling's off today ;-/ >>> def foo(): ... it = iter(range(10)) ... while True: ... i = it.next() ... print i ... if i&3==0: ... print 'skipping next'

Re: Sockets: code works locally but fails over LAN

2005-09-04 Thread Bryan Olson
n00m wrote: > Bryan; > Look at how I corrected your the very first version > (see added arguments in both functions). And now it > really can handle multiple connections! Ah, yes, I see. (In my defense, I had already fixed that bug in my second version.) -- --Bryan -- http://mail.python.or

Re: discarded iterator.next() at interactive global scope doesn't bump interator??

2005-09-04 Thread Peter Otten
Bengt Richter wrote: [it.next() appears to be a noop in the interactive interpreter] > I guess it could be in the read-eval-print loop Indeed: >>> for i in range(5): ... 42 ... 42 42 42 42 42 Whereas: >>> for i in range(5): ... None >>> Every line with an expression that doesn't eva

Re: OpenSource documentation problems

2005-09-04 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > legitimate. Python's core developers are in a leadership position for > > Python whether they like it or not; and users and volunteers absorb > > the attitudes of the leaders. > > So, what you are saying is because the developers (I explain in > anothe

Code for generating validation codes (in images)

2005-09-04 Thread morphex
Hi, does anyone of you know of some code I can use to generate validation code images? Those images you can see on various login forms used to prevent bots for performing a brute-force attack.. Thanks, Morten -- http://mail.python.org/mailman/listinfo/python-list

Re: Code for generating validation codes (in images)

2005-09-04 Thread Paul Rubin
"morphex" <[EMAIL PROTECTED]> writes: > does anyone of you know of some code I can use to generate validation > code images? > > Those images you can see on various login forms used to prevent bots > for performing a brute-force attack.. http://en.wikipedia.org/wiki/CAPTCHA -- http://mail.python

Re: Code for generating validation codes (in images)

2005-09-04 Thread Giuseppe di Sabato (aka deelan)
morphex wrote: > Hi, > > does anyone of you know of some code I can use to generate validation > code images? > > Those images you can see on various login forms used to prevent bots > for performing a brute-force attack.. take a look at the "pycaptcha" package:

Re: Code for generating validation codes (in images)

2005-09-04 Thread morphex
Great, thanks to you both. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Xiao Jianfeng
Paul Watson wrote: >This sounds pretty interesting. How about a switch to invoke this >handling for the one-liner crowd and those who wish to use it? > > > >Somehow, I never heard any C programmers suggest that the default >processing not include the need for: > >#include > > I think it

Re: Command config, quitting, binary, Timer

2005-09-04 Thread Diez B. Roggisch
> ! import Tkinter > ! def dogo(): > ! while 1: > ! b.config(command=lambda:None) > ! root = Tkinter.Tk() > ! b = Tkinter.Button(root, text="Go", command=dogo) > ! b.pack() > ! root.mainloop() I guess tkinter has to keep a name-reference pair (some days a discussion about this arose

Re: os.system(r"ls") prints to screen??

2005-09-04 Thread Xah Lee
Steve Holden wrote: > This is all pretty basic stuff. Perhaps you should stop your verbal > assault on the computer science community and start to learn the > principles of what you are doing. is this a supressed behavior that a human animal can finally instinctively and justifiably release at ano

documentation error

2005-09-04 Thread bill
>From 3.2 in the Reference Manual "The Standard Type Hierarchy": "Integers These represent elements from the mathematical set of whole numbers." The generally recognized definition of a 'whole number' is zero and the positive integers. That is to say, -1 is not a whole number. The documenta

Re: discarded iterator.next() at interactive global scope doesn't bump interator??

2005-09-04 Thread Bengt Richter
On Sun, 04 Sep 2005 10:10:33 +0200, Peter Otten <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: > >[it.next() appears to be a noop in the interactive interpreter] > >> I guess it could be in the read-eval-print loop > >Indeed: > for i in range(5): >... 42 >... >42 >42 >42 >42 >42 > >Whe

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Colin J. Williams
Rick Wotnaz wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>What would people think about adding sys to __builtins__ so that >>"import sys" is no longer necessary? This is something I must >>add to every script I write that's not a one-liner since they >>hav

Re: 'isa' keyword

2005-09-04 Thread Colin J. Williams
Rocco Moretti wrote: > Terry Hancock wrote: > >> On Thursday 01 September 2005 07:28 am, Fuzzyman wrote: >> >>> What's the difference between this and ``isinstance`` ? >> >> >> I must confess that an "isa" operator sounds like it would >> have been slightly nicer syntax than the isinstance() built

Re: documentation error

2005-09-04 Thread tiissa
bill wrote: >>From 3.2 in the Reference Manual "The Standard Type Hierarchy": > > "Integers > These represent elements from the mathematical set of whole > numbers." > > The generally recognized definition of a 'whole number' is zero and the > positive integers. This term is ambiguous as it

ANN: SIP v4.3 Released

2005-09-04 Thread Phil Thompson
Riverbank Computing is pleased to announce the release of SIP v4.3 available from http://www.riverbankcomputing.co.uk/sip/. SIP is a tool for generating Python modules that wrap C or C++ libraries. It is similar to SWIG. It is used to generate PyQt and PyKDE. Full documentation is available

Replacing large number of substrings

2005-09-04 Thread Will McGugan
Hi, Is there a simple way of replacing a large number of substrings in a string? I was hoping that str.replace could take a dictionary and use it to replace the occurrences of the keys with the dict values, but that doesnt seem to be the case. To clarify, something along these lines.. >>> di

Re: Sockets: code works locally but fails over LAN

2005-09-04 Thread n00m
Bryan Olson wrote: > Ah, yes, I see. (In my defense, I had already fixed that bug in > my second version.) 1. Yes! I myself noticed that, but your 2nd version looks a bit more verbose. 2. This all means... what? ONLY send() vs sendall() matters? Sometimes send() really sends ALL and my version work

sizeof(long) from python

2005-09-04 Thread John
I want to know the sizeof(long) / sizeof(int) ... in C from python. (This is to read a set of numbers output from a C Code and can be machine dependent). Is there an easy way except writing a C program and parsing its output? Thanks, --j -- http://mail.python.org/mailman/listinfo/python-list

ANN: PyQt v3.15 Released

2005-09-04 Thread Phil Thompson
Riverbank Computing is pleased to announce the release of PyQt v3.14 available from http://www.riverbankcomputing.co.uk/pyqt/. Changes since the last release include: - improved integration between Qt's ActiveQt framework and Python's win32com modules - support for QScintilla v1.6 - support for

Re: sizeof(long) from python

2005-09-04 Thread Simon Percivall
Take a look at the struct module (http://docs.python.org/lib/module-struct.html), it does what you want. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system(r"ls") prints to screen??

2005-09-04 Thread Steve Holden
Xah Lee wrote: > Steve Holden wrote: > >>This is all pretty basic stuff. Perhaps you should stop your verbal >>assault on the computer science community and start to learn the >>principles of what you are doing. > > > is this a supressed behavior that a human animal can finally > instinctively a

Re: sizeof(long) from python

2005-09-04 Thread John
Thanks a lot, That solved my problem. --j -- http://mail.python.org/mailman/listinfo/python-list

DrPython debugger

2005-09-04 Thread Pandiani
Hello, I've been experimenting with different Python IDEs since I started to learn Python. I must say that WingIDE is the best I tried, but unfortunately it's not free and that 10 minutes use is killing me. So I decide to write my Python programs in DrPython which was recommended by vegaseat. DrPyt

Re: Command config, quitting, binary, Timer

2005-09-04 Thread bearophileHUGS
Witn your suggestions and with some tests and work I've solved most of the problems, thank you all for the comments. Peter Hansen: >What did you expect to happen with the infinite loop inside dogo()?< I expected that the same memory used by the b.config(command=...) can be used by the successive

Re: Replacing large number of substrings

2005-09-04 Thread tiissa
Will McGugan wrote: > Hi, > > Is there a simple way of replacing a large number of substrings in a > string? I was hoping that str.replace could take a dictionary and use it > to replace the occurrences of the keys with the dict values, but that > doesnt seem to be the case. You can look at th

Re: Replacing large number of substrings

2005-09-04 Thread Robert Kern
Will McGugan wrote: > Hi, > > Is there a simple way of replacing a large number of substrings in a > string? I was hoping that str.replace could take a dictionary and use it > to replace the occurrences of the keys with the dict values, but that > doesnt seem to be the case. > > To clarify, so

Re: Problems with Python for Windows extensions

2005-09-04 Thread KK
thx for ur reply u r rite that i should use a raw string, but that doesn't solve the problem i am q annoyed by this strange behaviour. i tried to run the script on my friend's pc, which is python2.4 + pywin 204 + office 2000, but same thing happened now i am thinking to generate a vbs from python

regular expression unicode character class trouble

2005-09-04 Thread Diez B. Roggisch
Hi, I need in a unicode-environment the character-class set("\w") - set("[0-9]") or aplha w/o num. Any ideas how to create that? And what performance implications do I have to fear? I mean I guess that the characterclasses aren't implementet as sets, but as comparison-function that compares a

Re: os.system(r"ls") prints to screen??

2005-09-04 Thread Xah Lee
do you know what the Muses do when a mortal challenged them? And, please tell me exactly what capacity you hold under the official Python organization so that i can calculate to what degree i can kiss your ass or feign mum of your ignorance. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ Steve Hol

String from File -> List without parsing

2005-09-04 Thread Gregor Horvath
Hi, given the dynamic nature of python I assume that there is an elegant solution for my problem, but I did not manage to find it. I have a file that contains for example on line: ['147', '148', '146'] when I read the file f = file("I050901.ids").readlines() I have a string f[0] == "['147

Re: Binary Trees in Python

2005-09-04 Thread Jorgen Grahn
On Sun, 21 Aug 2005 08:52:10 -0400, François Pinard <[EMAIL PROTECTED]> wrote: > [Jorgen Grahn] > >> Neither C++ nor Python has tree structures in their standard >> libraries. I assume that's because there is no single interface that >> is proven to suit everybody's needs. > > It is already easy w

Re: Problems with Python for Windows extensions

2005-09-04 Thread Kartic
Hi, Invoking Execute as shown below works.. I have no explanation why your VB to Py converted code did not work. wdFindContinue = 1 objSelection.Find.Execute('Contosa', False, True, False, False, True, True, wdFindContinue, True, 'Fabrikam', wdReplaceAll, False, False, False, False) This find

Re: Managing events

2005-09-04 Thread cantabile
Thanks to you all for these answers. I'll try these ideas and post back comments and results. -- http://mail.python.org/mailman/listinfo/python-list

dual processor

2005-09-04 Thread John Brawley
Greetings, all. I have a program I'm trying to speed up by putting it on a new machine. The new machine is a Compaq W6000 2.0 GHz workstation with dual XEON processors. I've gained about 7x speed over my old machine, which was a 300 MHz AMD K6II, but I think there ought to be an even greater speed

Re: dual processor

2005-09-04 Thread Paul Rubin
"John Brawley" <[EMAIL PROTECTED]> writes: > However, the thought occurs that Python (2.4.1) may not have the ability to > take advantage of the dual processors, so my question: > Does it? No. > If not, who knows where there might be info from people trying to make > Python run 64-bit, on multipl

Re: String from File -> List without parsing

2005-09-04 Thread Jean-François Doyon
Gregor, You want to use eval(): Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> eval('[3,54,5]') [3, 54, 5] >>> Cheers, J.F. Gregor Horvath wrote: > Hi, > > given the dynamic nature of

Re: documentation error

2005-09-04 Thread Reinhold Birkenfeld
tiissa wrote: > bill wrote: >>>From 3.2 in the Reference Manual "The Standard Type Hierarchy": >> >> "Integers >> These represent elements from the mathematical set of whole >> numbers." >> >> The generally recognized definition of a 'whole number' is zero and the >> positive integers. > > T

Re: regular expression unicode character class trouble

2005-09-04 Thread Steven Bethard
Diez B. Roggisch wrote: > Hi, > > I need in a unicode-environment the character-class > > set("\w") - set("[0-9]") > > or aplha w/o num. Any ideas how to create that? I'd use something like r"[^_\d\W]", that is, all things that are neither underscores, digits or non-alphas. In action: py> re

Re: Considering moving from PowerBuilder to Python

2005-09-04 Thread Norm Goertzen
Wolfgang Keller wrote: >> But I also really would like to find something very close to Sybase's >> patented datawindow technology -- it's a real time-saver. >> >> BTW: As most readers (including me) probably don't know Powerbuilder: >> What is a Datawindow? Some kind of data-aware GUI widget

How to integrate an array?

2005-09-04 Thread Tom Kaz
I need to compute integral of some array function, something like: from scipy import * f = lambda x: array( [sin(x),cos(x)] ) integrate.quad(f, 0, 1) Unfortunately integrate.quad requires Float type. Any ideas how to perform this? Thanks, T.Kaz. -- http://mail.python.org/mailman/listinfo/py

is dict.copy() a deep copy or a shallow copy

2005-09-04 Thread Alex
Entering the following in the Python shell yields >>> help(dict.copy) Help on method_descriptor: copy(...) D.copy() -> a shallow copy of D >>> Ok, I thought a dictionary copy is a shallow copy. Not knowing exactly what that meant I went to http://en.wikipedia.org/wiki/Deep_copy where I coul

Assigning 'nochage' to a variable.

2005-09-04 Thread [EMAIL PROTECTED]
Has anyone else felt a desire for a 'nochange' value resembling the 'Z'-state of a electronic tri-state output? var1 = 17 var1 = func1() # func1() returns 'nochange' this time print var1 # prints 17 It would be equivalent to: var1 = 17 var2, bool1 = func1() if bool1: var1 = var2

Re: dual processor

2005-09-04 Thread Jeremy Jones
John Brawley wrote: >Greetings, all. >I have a program I'm trying to speed up by putting it on a new machine. >The new machine is a Compaq W6000 2.0 GHz workstation with dual XEON >processors. >I've gained about 7x speed over my old machine, which was a 300 MHz AMD >K6II, but I think there ought t

Re: documentation error

2005-09-04 Thread Bryan Olson
Reinhold Birkenfeld wrote: > tiissa wrote: > >>bill wrote: >> From 3.2 in the Reference Manual "The Standard Type Hierarchy": >>> >>>"Integers >>>These represent elements from the mathematical set of whole >>>numbers." >>> >>>The generally recognized definition of a 'whole number

Re: How to integrate an array?

2005-09-04 Thread Robert Kern
Tom Kaz wrote: > I need to compute integral of some array function, something > like: > > from scipy import * > f = lambda x: array( [sin(x),cos(x)] ) > integrate.quad(f, 0, 1) > > Unfortunately integrate.quad requires Float type. > > Any ideas how to perform this? Do each function separately.

Re: dual processor

2005-09-04 Thread Paul Rubin
Jeremy Jones <[EMAIL PROTECTED]> writes: > to pass data around between processes. Or an idea I've been tinkering > with lately is to use a BSD DB between processes as a queue just like > Queue.Queue in the standard library does between threads. Or you > could use Pyro between processes. Or CORBA

Re: dual processor

2005-09-04 Thread Jeremy Jones
Paul Rubin wrote: >Jeremy Jones <[EMAIL PROTECTED]> writes: > > >>to pass data around between processes. Or an idea I've been tinkering >>with lately is to use a BSD DB between processes as a queue just like >>Queue.Queue in the standard library does between threads. Or you >>could use Pyro be

Re: Assigning 'nochage' to a variable.

2005-09-04 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Has anyone else felt a desire for a 'nochange' value > resembling the 'Z'-state of a electronic tri-state output? No. but if you must, you can emulate that using properties or __getattr__/__setattr__- of course then limited to classes, but writen c.var1 instead of var1

Re: how to do this?

2005-09-04 Thread Justin Straube
Thanks Steve and Peter, these two methods are a lot of help. Ill have to play with each in my actual app to find which works best. I found more info on trace_variable() at http://effbot.org/tkinterbook/variable.htm and also some more info on events and bindings at http://effbot.org/tkinterb

Re: documentation error

2005-09-04 Thread Bengt Richter
On Sun, 04 Sep 2005 20:02:10 GMT, Bryan Olson <[EMAIL PROTECTED]> wrote: >Reinhold Birkenfeld wrote: > > tiissa wrote: > > > >>bill wrote: > >> > From 3.2 in the Reference Manual "The Standard Type Hierarchy": > >>> > >>>"Integers > >>>These represent elements from the mathematical set of

Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
After considering several alternatives and trying out a few ideas with a modified list object Bengt Richter posted, (Thank You), I think I've found a way to make slice operation (especially far end indexing) symmetrical and more consistent. So to find out if this is indeed a possibility, it

Re: How to integrate an array?

2005-09-04 Thread Tom Kaz
> Do each function separately. The routine that scipy.integrate.quad uses > adapts to the local conditions of the function (when the function is > flat, it uses fewer samples; when steep, more). It's not so easy to do it separately. I want to integrate function that includes linalg.expm - as yo

Re: is dict.copy() a deep copy or a shallow copy

2005-09-04 Thread Max Erickson
"Alex" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: D={'Python': 'good', 'Basic': 'simple'} E=D.copy() E > {'Python': 'good', 'Basic': 'simple'} D['Basic']='oh my' D > {'Python': 'good', 'Basic': 'oh my'} E > {'Python': 'good', 'Basic': 'simple'} > > Hmm

Re: How to integrate an array?

2005-09-04 Thread Robert Kern
Tom Kaz wrote: [I wrote:] (please attribute quotes) >>Do each function separately. The routine that scipy.integrate.quad uses >>adapts to the local conditions of the function (when the function is >>flat, it uses fewer samples; when steep, more). > > It's not so easy to do it separately. I want

Controlling memory allocation

2005-09-04 Thread cwoolf
Let's say I have an OS that can't limit the amount of memory a process is allowed to consume, but I want to run some Python code in a simulated low memory environment... Is there a way to tell Python to limit the size of it's heap? Can you ask it to use a function other than malloc through the C

GETTING IMAGEDATA FROM A BUTTON

2005-09-04 Thread pythonprogrammer
Does anyone know how to get pixeldata from the image of a button without taking a screenshot? -- http://mail.python.org/mailman/listinfo/python-list

GETTING IMAGEDATA FROM A BUTTON

2005-09-04 Thread pythonprogrammer
Does anyone know how to get pixeldata from the image of a button without taking a screenshot? -- http://mail.python.org/mailman/listinfo/python-list

Re: String from File -> List without parsing

2005-09-04 Thread John Machin
Gregor Horvath wrote: > Hi, > > given the dynamic nature of python I assume that there is an elegant > solution for my problem, but I did not manage to find it. > > I have a file that contains for example on line: > ['147', '148', '146'] > when I read the file > f = file("I050901.ids").readline

Re: Replacing large number of substrings

2005-09-04 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, Will McGugan <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a simple way of replacing a large number of substrings in a > string? I was hoping that str.replace could take a dictionary and use it > to replace the occurrences of the keys with the dict values, but t

RE: GETTING IMAGEDATA FROM A BUTTON

2005-09-04 Thread Delaney, Timothy (Tim)
pythonprogrammer wrote: > Does anyone know how to get pixeldata from the image of a button > without taking a screenshot? Yes. http://www.catb.org/~esr/faqs/smart-questions.html Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Assigning 'nochage' to a variable.

2005-09-04 Thread Terry Reedy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Has anyone else felt a desire for a 'nochange' value No. > resembling the 'Z'-state of a electronic tri-state output? Not familiar with that. > > var1 = 17 > var1 = func1() # func1() returns 'nochange' this ti

Python Doc Problem Example: os.system

2005-09-04 Thread Xah Lee
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the the function due to its well-named-ness: import os os.system("ls") however, according to the doc http://www.

Re: Possible improvement to slice opperations.

2005-09-04 Thread Terry Reedy
"Ron Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Slicing is one of the best features of Python in my opinion, but > when you try to use negative index's and or negative step increments > it can be tricky and lead to unexpected results. > > This topic has come up fairly oft

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Terry Reedy
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Rick Wotnaz wrote: >> +1 here. As far as I'm concerned, both os and sys could be special- >> cased that way. That said, I would guess the likelihood of that >> happening is 0. >> > +1 for both. Some people might pr

Re: OpenSource documentation problems

2005-09-04 Thread Aahz
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > >Bear in mind that the PSF made its very first grants last year. The >reason none of those grants was awarded to a documentation project was >that the (volunteer) Grants Committee and helpers didn't see any >documentation

Re: Python Doc Problem Example: os.system

2005-09-04 Thread Jeremy Jones
Xah Lee wrote: >Python Doc Problem Example: os.system > >Xah Lee, 2005-09 > >today i'm trying to use Python to call shell commands. e.g. in Perl >something like > >output=qx(ls) > >in Python i quickly located the the function due to its >well-named-ness: > >import os >os.system("ls") > > >however,

learning python

2005-09-04 Thread placid
Hi all, I was just wondering about good books that teach python (either with programming or no programming experience at all) ? Or some online tutorial? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: learning python

2005-09-04 Thread Christopher Culver
"placid" <[EMAIL PROTECTED]> writes: > I was just wondering about good books that teach python (either with > programming or no programming experience at all) ? Or some online > tutorial? Did you even bother doing a web search? "Learn Python" or "Python tutorial" would be enough. Christopher --

Re: documentation error

2005-09-04 Thread Bryan Olson
Bengt Richter wrote: > Bryan Olson wrote: >>Consider deleting the sentence in which the Python doc tries to >>define mathematical integers. > This is a nice site: > > http://mathworld.wolfram.com/WholeNumber.html > http://mathworld.wolfram.com/topics/Integers.html So maybe: Integers

Re: OpenSource documentation problems

2005-09-04 Thread Steve Holden
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: > >>Bear in mind that the PSF made its very first grants last year. The >>reason none of those grants was awarded to a documentation project was >>that the (volunteer) Grants Committee and helpers didn't see

Re: learning python

2005-09-04 Thread placid
Christopher Culver wrote: > "placid" <[EMAIL PROTECTED]> writes: > > I was just wondering about good books that teach python (either with > > programming or no programming experience at all) ? Or some online > > tutorial? > > Did you even bother doing a web search? "Learn Python" or "Python > tuto

Re: learning python

2005-09-04 Thread Benji York
placid wrote: > Christopher Culver wrote: >>"placid" <[EMAIL PROTECTED]> writes: >>>I was just wondering about good books that teach python (either with >>>programming or no programming experience at all) ? Or some online >>>tutorial? >> >>Did you even bother doing a web search? "Learn Python" or "

Magic Optimisation

2005-09-04 Thread simonwittber
Hello People. I've have a very tight inner loop (in a game app, so every millisecond counts) which I have optimised below: def loop(self): self_pool = self.pool self_call_exit_funcs = self.call_exit_funcs self_pool_popleft = self.pool.popleft self_pool_append =

Re: Possible improvement to slice opperations.

2005-09-04 Thread Patrick Maupin
> After considering several alternatives and trying out a few ideas with a > modified list object Bengt Richter posted, (Thank You), I think I've > found a way to make slice operation (especially far end indexing) > symmetrical and more consistent. I don't know that it makes it more consistent.

Re: Magic Optimisation

2005-09-04 Thread Paul McGuire
This isn't much prettier, but what if you extract the try-except overhead out from the while loop? You only expect the exception to fire one time, at the end of the list. You can also eliminate any localization of variables for calls that are not called in the loop, such as self_pool (which does

Re: Magic Optimisation

2005-09-04 Thread Paul Rubin
[EMAIL PROTECTED] writes: > However, it is very ugly. Does anyone have any tips on how I could get > this optimisation to occor magically, via a decorator perhaps? Have you tried psyco? -- http://mail.python.org/mailman/listinfo/python-list

Re: dual processor

2005-09-04 Thread William Park
John Brawley <[EMAIL PROTECTED]> wrote: > Greetings, all. I have a program I'm trying to speed up by putting it > on a new machine. The new machine is a Compaq W6000 2.0 GHz > workstation with dual XEON processors. I've gained about 7x speed > over my old machine, which was a 300 MHz AMD K6II, b

RE: Magic Optimisation

2005-09-04 Thread Delaney, Timothy (Tim)
[EMAIL PROTECTED] wrote: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940 For an even bigger improvement (in general), look at psyco: http://psyco.sourceforge.net/. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Magic Optimisation

2005-09-04 Thread simonwittber
I guess it is hard to see what the code is doing without a complete example. The StopIteration is actually raised by task.next(), at which point task is removed from the list of generators (self.pool). So the StopIteration can be raised at any time. The specific optimisation I am after, which wil

Re: Magic Optimisation

2005-09-04 Thread simonwittber
Yes. It slows down the loop when there are only a few iterators in the pool, and speeds it up when there are > 2000. My use case involves < 1000 iterators, so psyco is not much help. It doesn't solve the magic creation of locals from instance vars either. Sw. -- http://mail.python.org/mailman/l

mod_python: what's going on here?

2005-09-04 Thread Robert J. Hansen
I'm not entirely certain comp.lang.python is the proper newsgroup for mod_python questions, but "comp.lang.python.web" doesn't seem to exist, so... my apologies in advance if this is considered off-topic. I'm attempting to get mod_python 3.1.4/python 2.4.1 working on Apache 2.0.54 running under OS

Re: Magic Optimisation

2005-09-04 Thread Paul Rubin
[EMAIL PROTECTED] writes: > My use case involves < 1000 iterators, so psyco is not much help. It > doesn't solve the magic creation of locals from instance vars either. How about using __slots__ to put those instance vars at fixed offsets in the pool object (self then needs to be a new-style class

Re: Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
Terry Reedy wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Slicing is one of the best features of Python in my opinion, but >>when you try to use negative index's and or negative step increments >>it can be tricky and lead to unexpected results. >> >>This to

Re: String from File -> List without parsing

2005-09-04 Thread Gregor Horvath
John Machin wrote: >> f = file("I050901.ids").readlines() > > Y3K bug alert :-) but then there is Python 3000 and Hurd, which solves all problems of this universe :-) > Something like this: > > >>> def munch(astrg): > ...return [x[1:-1] for x in astrg.rstrip("\n")[1:-1].split(", ")] T

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Rick Wotnaz
"Terry Reedy" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > "Colin J. Williams" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Rick Wotnaz wrote: >>> +1 here. As far as I'm concerned, both os and sys could be >>> special- cased that way. That said, I would guess the

Re: learning python

2005-09-04 Thread placid
Benji York wrote: > placid wrote: > > Christopher Culver wrote: > >>"placid" <[EMAIL PROTECTED]> writes: > >>>I was just wondering about good books that teach python (either with > >>>programming or no programming experience at all) ? Or some online > >>>tutorial? > >> > >>Did you even bother doin

Re: Possible improvement to slice opperations.

2005-09-04 Thread Ron Adam
Patrick Maupin wrote: >>After considering several alternatives and trying out a few ideas with a >> modified list object Bengt Richter posted, (Thank You), I think I've >>found a way to make slice operation (especially far end indexing) >>symmetrical and more consistent. > > > I don't know that

Re: Magic Optimisation

2005-09-04 Thread simonwittber
> def loop(self): > self_pool = self.pool > self_call_exit_funcs = self.call_exit_funcs > self_pool_popleft = self.pool.popleft > self_pool_append = self.pool.append > check = self.pool.__len__ > while check() > 0: > task = self_pool_p

use mod_python' session and redirect

2005-09-04 Thread wafd Alex
hi all when i use Session object to save a object and then i use util.redirect(req,url) to redirect a .psp.But in my psp i cann't load session so i cann't get object from session,help me,thanks here is my code .py s=Session.Session(req) s["cur_user"]=user s.set_timeout(1

Re: Magic Optimisation

2005-09-04 Thread simonwittber
Psyco actually slowed down the code dramatically. I've fixed up the code (replaced the erroneous return statement) and uploaded the code for people to examine: The test code is here: http://metaplay.dyndns.org:82/~xerian/fibres.txt These are the run times (in seconds) of the test file. without p

Re: mod_python: what's going on here?

2005-09-04 Thread Steve Holden
Robert J. Hansen wrote: > I'm not entirely certain comp.lang.python is the proper newsgroup for > mod_python questions, but "comp.lang.python.web" doesn't seem to exist, > so... my apologies in advance if this is considered off-topic. > > I'm attempting to get mod_python 3.1.4/python 2.4.1 working

ftp upload through proxy ?

2005-09-04 Thread Tonino
Hi, I have been searching the groups for a way to upload a file using URLLIB (2) to a ftp site using a proxy server. I read the ftplib does not support proxy servers and I know that urllib does support it. I can download a file from a ftp site through the proxy - but now I need to be able to uploa