Re: performance of tight loop

2010-12-13 Thread Ryan Kelly
On Tue, 2010-12-14 at 08:08 +0100, Ulrich Eckhardt wrote: > Steven D'Aprano wrote: > > Replacing "while True" with "while 1" may save a tiny bit of overhead. > > Whether it is significant or not is another thing. > > Is this the price for an intentional complexity or just a well-known > optimizer

Re: performance of tight loop

2010-12-13 Thread Ulrich Eckhardt
Steven D'Aprano wrote: > Replacing "while True" with "while 1" may save a tiny bit of overhead. > Whether it is significant or not is another thing. Is this the price for an intentional complexity or just a well-known optimizer deficiency? Just curious... Uli -- Domino Laser GmbH Geschäftsführ

Re: performance of tight loop

2010-12-13 Thread Ulrich Eckhardt
gry wrote: > I have a little data generator that I'd like to go faster... any > suggestions? > maxint is usually 9223372036854775808(max 64bit int), but could > occasionally be 99. > width is usually 500 or 1600, rows ~ 5000. > > from random import randint > > def row(i, wd, mx): > first = ['

Re: Added Python, WSGI to XAMPP

2010-12-13 Thread Gerry Reno
On 12/13/2010 11:13 PM, rusi wrote: > On Dec 10, 2:29 am, Gerry Reno wrote: > >> If you have any need of a portable LAMP stack, I just finished writing >> some How-To's for getting Python, VirtualEnv and WSGI frameworks running >> with XAMPP: >> >> How-To: Add VirtualEnv and Pylons (WSGI framew

Re: Added Python, WSGI to XAMPP

2010-12-13 Thread rusi
On Dec 10, 2:29 am, Gerry Reno wrote: > If you have any need of a portable LAMP stack, I just finished writing > some How-To's for getting Python, VirtualEnv and WSGI frameworks running > with XAMPP: > > How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP >

Re: performance of tight loop

2010-12-13 Thread Steven D'Aprano
On Mon, 13 Dec 2010 18:50:38 -0800, gry wrote: > [python-2.4.3, rh CentOS release 5.5 linux, 24 xeon cpu's, 24GB ram] I > have a little data generator that I'd like to go faster... any > suggestions? > maxint is usually 9223372036854775808(max 64bit int), but could > occasionally be 99. > width is

Re: Catching user switching and getting current active user from root on linux

2010-12-13 Thread Tim Harig
On 2010-12-13, mpnordland wrote: > I think I do understand multiuser systems, although I'm sorry I did > not make my self clear. Yes, I understand that there can be multiple > people logged in, and yes if you really wanted to, you could login as Apparantly you do not. There is nothing that preve

performance of tight loop

2010-12-13 Thread gry
[python-2.4.3, rh CentOS release 5.5 linux, 24 xeon cpu's, 24GB ram] I have a little data generator that I'd like to go faster... any suggestions? maxint is usually 9223372036854775808(max 64bit int), but could occasionally be 99. width is usually 500 or 1600, rows ~ 5000. from random import randi

Re: Added Python, WSGI to XAMPP

2010-12-13 Thread Gerry Reno
On 12/13/2010 07:12 PM, Chris Withers wrote: > On 14/12/2010 00:14, Gerry Reno wrote: >> On 12/13/2010 06:34 PM, Chris Withers wrote: >>> On 09/12/2010 21:29, Gerry Reno wrote: How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP

Re: Added Python, WSGI to XAMPP

2010-12-13 Thread Gerry Reno
On 12/13/2010 06:34 PM, Chris Withers wrote: > On 09/12/2010 21:29, Gerry Reno wrote: >> How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP >> > > You mean Pyramid, right? ;-) > > Chris > Maybe, if there's no Zope. Or we'll run

PyArg_ParseTuple question

2010-12-13 Thread Mark Crispin
In a C module, I want to pick up the arguments for a Python call like: module.call("string1",["string2a", "string2b", "string2c"], "string3") and stash these into: char *arg1; char *arg2[]; char *arg3; All arguments are required, and we can assume that the arg2 vector i

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread Sridhar Ratnakumar
On 2010-12-13, at 4:21 PM, Terry Reedy wrote: > On 12/13/2010 4:23 PM, Sridhar Ratnakumar wrote: > >>> The PSF 3.1 Windows installer ships with tcl/tk 8.5 and ttk support. > >> Maybe that was changed in 3.1.3. > > No, 3.1 (not sure of 3.0) has always used 8.5 on windows and included > tkinter.

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread Terry Reedy
On 12/13/2010 4:23 PM, Sridhar Ratnakumar wrote: The PSF 3.1 Windows installer ships with tcl/tk 8.5 and ttk support. Maybe that was changed in 3.1.3. No, 3.1 (not sure of 3.0) has always used 8.5 on windows and included tkinter.ttk module. I did this for ActivePython 2.7, import Tkint

Re: Added Python, WSGI to XAMPP

2010-12-13 Thread Chris Withers
On 14/12/2010 00:14, Gerry Reno wrote: On 12/13/2010 06:34 PM, Chris Withers wrote: On 09/12/2010 21:29, Gerry Reno wrote: How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP Maybe, if there's no Zope. Or we'll run away scre

Re: Catching user switching and getting current active user from root on linux

2010-12-13 Thread Carl Banks
On Dec 13, 3:04 pm, mpnordland wrote: > I think I do understand multiuser systems, although I'm sorry I did > not make my self clear. Yes, I understand that there can be multiple > people logged in, and yes if you really wanted to, you could login as > yourself as many times as you want. This is n

Re: Added Python, WSGI to XAMPP

2010-12-13 Thread Chris Withers
On 09/12/2010 21:29, Gerry Reno wrote: How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP You mean Pyramid, right? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.si

Re: find memory leaks in running program

2010-12-13 Thread Chris Withers
On 07/12/2010 16:51, Marco Hornung wrote: 1. What are the best tools to analyze pythons memory stack, while it is running? Look for the heapy stuff in the guppy package. 2. Is there a possibility to analyze the memory stack of a program with external programs? (without to change the source c

Re: Reading by positions plain text files

2010-12-13 Thread javivd
On Dec 12, 11:21 pm, Dennis Lee Bieber wrote: > On Sun, 12 Dec 2010 07:02:13 -0800 (PST), javivd > declaimed the following in > gmane.comp.python.general: > > > > > f = open(r'c:c:\somefile.txt', 'w') > > > f.write('0123456789\n0123456789\n0123456789') > >         Not the most explanatory sample

Re: "Download/windows" site page

2010-12-13 Thread Cristian Consonni
2010/12/13 Martin v. Loewis : [...] >> It is not mentioned "Windows 7". >> >> Is there some problem with 7 or it is simply an omission? > > It's simply an omission. You'll notice that Windows 2003 and Windows > 2008, as well as Windows 2003 R2 and Windows 2008R2 are omitted as > well. Likely, Pytho

Tkinter's unbind method

2010-12-13 Thread Emeka
Hello All I have an uncompleted version of a game http://pastebin.com/gkhTaYPZ I am trying to code I have struggled to make method unbind work. But it has refused to listen to me. Could someone come to my help? Regards, Emeka http://pastebin.com/gkhTaYPZ -- *Satajanus Nig. Ltd * -- htt

Re: Catching user switching and getting current active user from root on linux

2010-12-13 Thread mpnordland
I think I do understand multiuser systems, although I'm sorry I did not make my self clear. Yes, I understand that there can be multiple people logged in, and yes if you really wanted to, you could login as yourself as many times as you want. This is not a server based program, it is intended for u

Re: "Download/windows" site page

2010-12-13 Thread Martin v. Loewis
Am 13.12.2010 23:38, schrieb Cristian Consonni: > Dear all, > > I'm not sure this is the right place to point this out, but on this page: > > http://www.python.org/download/windows/ > > It is not mentioned "Windows 7". > > Is there some problem with 7 or it is simply an omission? It's simply a

"Download/windows" site page

2010-12-13 Thread Cristian Consonni
Dear all, I'm not sure this is the right place to point this out, but on this page: http://www.python.org/download/windows/ It is not mentioned "Windows 7". Is there some problem with 7 or it is simply an omission? A friend of mine is refusing to install python on his machine because "it does n

Re: Sage's Python

2010-12-13 Thread Rhodri James
On Fri, 10 Dec 2010 17:11:55 -, Akand Islam wrote: In my system (Ubuntu 10.04) there are sage-4.6, python 2.6.5, tk8.5- dev installed. When I give command from terminal "sage -f python-2.6.5.p8" to get sage's python it shows following message: No command 'sage' found, did you mean: Comma

Re: run a function in another processor in python

2010-12-13 Thread News123
On 12/09/2010 10:54 AM, Astan Chee wrote: > Hi, > I've got a python script that calls a function many times with various > arguments and returns a result. What I'm trying to do is run this > function each on different processors and compile the result at the > end based on the function result. The

Re: Exception handling in Python 3.x

2010-12-13 Thread Arnaud Delobelle
Ethan Furman writes: > Ethan Furman wrote: >> Arnaud Delobelle wrote: >>> >>> I missed the start of this discussion but there are two simpler ways: >>> >>> def func(iterable): >>> for x in iterable: >>> print(x) >>> return >>> raise ValueError("... empty iterable") >> >> >

Re: Request for feedback on API design

2010-12-13 Thread Ethan Furman
Steven D'Aprano wrote: I am soliciting feedback regarding the API of my statistics module: http://code.google.com/p/pycalcstats/ Specifically the following couple of issues: (1) Multivariate statistics such as covariance have two obvious APIs: A pass the X and Y values as two separate it

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread Sridhar Ratnakumar
On 2010-12-13, at 11:50 AM, Terry Reedy wrote: > On 12/13/2010 1:48 PM, Sridhar Ratnakumar wrote: > >> We generally build with the latest compatible version of extensions >> (except for Tcl/Tk on 2.5/2.6/3.1 as python.org still uses 8.4) ... > > The PSF 3.1 Windows installer ships with tcl/tk 8

Re: Exception handling in Python 3.x

2010-12-13 Thread Ethan Furman
Ethan Furman wrote: Arnaud Delobelle wrote: I missed the start of this discussion but there are two simpler ways: def func(iterable): for x in iterable: print(x) return raise ValueError("... empty iterable") For the immediate case this is a cool solution. Drat --

Re: Is there any way to SSH from Python ?!

2010-12-13 Thread Godson Gera
On Mon, Dec 13, 2010 at 10:33 AM, Darshak Bavishi wrote: > Hi Experts, > > I need to know that is there any way to SSH (From Windows Host) to Unix > machine ?! > > If Yes than How ? > > Because when i use telenet it not showing the no result !! As earlier it > was suggested that i should try with

Re: Exception handling in Python 3.x

2010-12-13 Thread Ethan Furman
Ethan Furman wrote: Please don't top-post. Rob Richardson wrote: -Original Message- I missed the start of this discussion but there are two simpler ways: def func(iterable): for x in iterable: print(x) return raise ValueError("... empty iterable") Or using 3

Re: Exception handling in Python 3.x

2010-12-13 Thread Ethan Furman
Arnaud Delobelle wrote: I missed the start of this discussion but there are two simpler ways: def func(iterable): for x in iterable: print(x) return raise ValueError("... empty iterable") For the immediate case this is a cool solution. Unfortunately, it doesn't fix t

Re: Exception handling in Python 3.x

2010-12-13 Thread Arnaud Delobelle
"Rob Richardson" writes: You shouldn't top-post! > Arnaud, > > Wouldn't your first suggestion exit after the first element in iterable? Yes, after printing that element, which is what the code I quoted did. > And would your second suggestion throw an exception after normal > processing of all

Re: Exception handling in Python 3.x

2010-12-13 Thread Ethan Furman
Please don't top-post. Rob Richardson wrote: -Original Message- I missed the start of this discussion but there are two simpler ways: def func(iterable): for x in iterable: print(x) return raise ValueError("... empty iterable") Or using 3.x's next's optional

Re: Request for feedback on API design

2010-12-13 Thread Arnaud Delobelle
Steven D'Aprano writes: > I am soliciting feedback regarding the API of my statistics module: > > http://code.google.com/p/pycalcstats/ > > > Specifically the following couple of issues: > > (1) Multivariate statistics such as covariance have two obvious APIs: > > A pass the X and Y values as

RE: Exception handling in Python 3.x

2010-12-13 Thread Rob Richardson
Arnaud, Wouldn't your first suggestion exit after the first element in iterable? And would your second suggestion throw an exception after normal processing of all elements in the interator? RobR -Original Message- I missed the start of this discussion but there are two simpler ways:

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread Terry Reedy
On 12/13/2010 1:48 PM, Sridhar Ratnakumar wrote: We generally build with the latest compatible version of extensions (except for Tcl/Tk on 2.5/2.6/3.1 as python.org still uses 8.4) ... The PSF 3.1 Windows installer ships with tcl/tk 8.5 and ttk support. You ought to too. but that should not

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread python
Sridhar, > You can find the versions used in ActivePython here, > http://docs.activestate.com/activepython/2.7/whatsincluded.html Thank you - that page answered my questions. Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception handling in Python 3.x

2010-12-13 Thread Arnaud Delobelle
Paul Rubin writes: > Steven D'Aprano writes: >> Apart from this horrible idiom: >> >> def func(iterable): >> it = iter(iterable) >> failed = False >> try: >> x = next(it) >> except StopIteration: >> failed = True >> if failed: >> raise ValueError("can'

Re: Directly calling python's function arguments dispatcher

2010-12-13 Thread Pascal Chambon
Le 12/12/2010 23:41, Peter Otten a écrit : Pascal Chambon wrote: I've encountered several times, when dealing with adaptation of function signatures, the need for explicitly resolving complex argument sets into a simple variable mapping. Explanations. Consider that function: def foo(a1,

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread Sridhar Ratnakumar
On 2010-12-13, at 10:38 AM, pyt...@bdurham.com wrote: > [SRID] Release notes for 2.7.1.3 [...] > [SRID] - Upgrade to Tcl/Tk 8.5.9 (`changes `_) > Do the Windows versions of ActivePython 2.7.1.3 have different versions > of Tcl/Tk, sqlite3(.dll), and/or openssl (_ssl.pyd?

Re: ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread python
Sridhar, Do the Windows versions of ActivePython 2.7.1.3 have different versions of Tcl/Tk, sqlite3(.dll), and/or openssl (_ssl.pyd?) than the python.org builds of Python 2.7.1? Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

ANN: ActivePython 2.7.1.3 is now available

2010-12-13 Thread Sridhar Ratnakumar
ActiveState is pleased to announce ActivePython 2.7.1.3, a complete, ready-to-install binary distribution of Python 2.7. http://www.activestate.com/activepython/downloads What's New in ActivePython-2.7.1.3 == *Release date: 6-Dec-2010* New Features & Upgrade

Re: default argument in method

2010-12-13 Thread Steve Holden
On 12/13/2010 12:14 PM, Godson Gera wrote: > > > On Sun, Dec 12, 2010 at 5:05 PM, ernest > wrote: > > Hi, > > I'd like to have a reference to an instance attribute as > default argument in a method. It doesn't work because > "self" is not defined at th

Re: packaging and installing

2010-12-13 Thread Godson Gera
On Mon, Dec 13, 2010 at 10:46 PM, Brian Blais wrote: > Hello, > > I was wondering if there is any standard or suggested way of installing > packages *without* going to the commandline. I often have students who, > from there experience in Windows, have never looked at the commandline > before an

packaging and installing

2010-12-13 Thread Brian Blais
Hello, I was wondering if there is any standard or suggested way of installing packages *without* going to the commandline. I often have students who, from there experience in Windows, have never looked at the commandline before and it is a bit of a challenge to get them to install something (

Re: default argument in method

2010-12-13 Thread Godson Gera
On Sun, Dec 12, 2010 at 5:05 PM, ernest wrote: > Hi, > > I'd like to have a reference to an instance attribute as > default argument in a method. It doesn't work because > "self" is not defined at the time the method signature is > evaluated. For example: > > class C(object): >def __init__(se

Re: while True or while 1

2010-12-13 Thread Grant Edwards
On 2010-12-12, Steven D'Aprano wrote: > With the "while True" idiom in Python 2.x, you can easily exit out of an > infinite loop without using break: > while True: > ... print "Looping" > ... True = 0 > ... > Looping while True: # Execute an infinite loop in 0 seconds. >

Re: unicode compare errors

2010-12-13 Thread Ross
On Dec 10, 4:09 pm, Nobody wrote: > On Fri, 10 Dec 2010 11:51:44 -0800, Ross wrote: > > Since I can't control the encoding of the input file that users > > submit, how to I get past this?  How do I make such comparisons be > > True? > On Fri, 10 Dec 2010 12:07:19 -0800, Ross wrote: > > I found I c

AttributeError while running ssh (from windows) paramiko need help

2010-12-13 Thread Darshak Bavishi
Hi Experts , while i am running following demo ssh script of paramiko --> *import base64* *import getpass* *import os* *import socket* *import sys* *import traceback* * * *import paramiko* *import interactive* * * * * *# setup logging* *paramiko.util.log_to_file('demo_simple.log')* * * *# get ho

Re: class browser

2010-12-13 Thread Adam Tauno Williams
On Sun, 2010-12-12 at 05:01 -0800, rusi wrote: > On Dec 8, 11:24 pm, Adam Tauno Williams > wrote: > > On Wed, 2010-12-08 at 13:18 +0530, Rustom Mody wrote: > > > If I have a medium to large python code base to browse/study, what are > > > the class browsers available? > > Monodevelop has good Pyth

Re: Is there any way to SSH from Python ?!

2010-12-13 Thread Christian Heimes
Am 13.12.2010 12:41, schrieb Darshak Bavishi: > Hi, > > I have downloaded paramiko and installed it now it needs Pycrypto . So i > tried to install pycrypto but its giving error of vcvarsall.bat > so from christian suggestion i downloaded MinGW . But i have no idea how to > install it in windows m

PyCon 2011 Registration and Financial aid open and available!

2010-12-13 Thread Jesse Noller
[Sorry for that last partial email] I wanted to take a moment and let everyone know that the PyCon 2011 Registration system is now online and accepting registrations for the conference! http://us.pycon.org/2011/tickets/ PyCon 2011 is looking to be the biggest, and most impressive PyCon yet, we'v

PyCon 2011 Registration and Financial aid open and available!

2010-12-13 Thread Jesse Noller
Just q -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there any way to SSH from Python ?!

2010-12-13 Thread Darshak Bavishi
Hi, I have downloaded paramiko and installed it now it needs Pycrypto . So i tried to install pycrypto but its giving error of vcvarsall.bat so from christian suggestion i downloaded MinGW . But i have no idea how to install it in windows machine pls help me out of this!! On Mon, Dec 13, 2010 at

Re: Is there any way to SSH from Python ?!

2010-12-13 Thread Felipe Vinturini
On Mon, Dec 13, 2010 at 3:11 AM, Darshak Bavishi wrote: > > i am trying from last week but no luck !! > > one thing only found that pexpect it not useful in windows > > pls help out of this > > On Mon, Dec 13, 2010 at 10:39 AM, Chris Rebert wrote: > >> On Sun, Dec 12, 2010 at 9:03 PM, Darshak Bav

Re: while True or while 1

2010-12-13 Thread Jean-Michel Pichavant
Paul Rubin wrote: Steven D'Aprano writes: I'm actually quite fond of the look of "while 1:", and sometimes use it, not because it's faster, but just because I like it. for v in itertools.repeat(True): ... ;-) while '__For_ever___' not in ['nit-picking']: :) JM -- http

Re: default argument in method

2010-12-13 Thread Jean-Michel Pichavant
ernest wrote: Hi, I'd like to have a reference to an instance attribute as default argument in a method. It doesn't work because "self" is not defined at the time the method signature is evaluated. For example: class C(object): def __init__(self): self.foo = 5 def m(self, val=se

Re: Python critique

2010-12-13 Thread Jean-Michel Pichavant
Octavian Rasnita wrote: From: "Steven D'Aprano" ... Can you please tell me how to write the following program in Python? my $n = 1; { my $n = 2; print "$n\n"; } print "$n\n"; If this program if ran in Perl, it prints: 2 1 Lots of ways. Here's one: n = 1 class Scope: n

Re: How to install pycrypto mode in windows ?!

2010-12-13 Thread Christian Heimes
Am 13.12.2010 11:20, schrieb Darshak Bavishi: > Hi Experts , > > I am using python 2.6 and i had installed paramiko module which needs > pycrypto but , > when i am installing pycrypto in windows its giving error as follows: > [...] > can u suggest any source to get pycrypto to avoid such events?!

How to install pycrypto mode in windows ?!

2010-12-13 Thread Darshak Bavishi
Hi Experts , I am using python 2.6 and i had installed paramiko module which needs pycrypto but , when i am installing pycrypto in windows its giving error as follows: creating build\lib.win32-2.6\Crypto\PublicKey copying .\PublicKey\DSA.py -> build\lib.win32-2.6\Crypto\PublicKey copying .\Publi

Re: Proposed changes to logging defaults

2010-12-13 Thread Jean-Michel Pichavant
Vinay Sajip wrote: On Dec 10, 10:17 am, Jean-Michel Pichavant wrote: Hi Jean-Michel, I think Antoine answered your other points, so I'll address the last one: Last question, if no handler is found, why not simply drop the log event, doing nothing ? It sounds pretty reasonable and less int

Re: Objects and validation

2010-12-13 Thread bruno.desthuilli...@gmail.com
On 12 déc, 15:28, pyt...@lists.fastmail.net wrote: > I have a routine in Python which is extracting information from a > website. This information is read and inserted into objects. > > I currently have all the validations and checks implemented in the > routines which are reading the HTML and crea