Re: Hypergeometric distribution

2006-01-01 Thread Steven D'Aprano
On Sat, 31 Dec 2005 16:24:02 -0800, Raven wrote: > Thanks to all of you guys, I could resolve my problem using the > logarithms as proposed by Robert. I needed to calculate the factorial > for genomic data, more specifically for the number of genes in the > human genome i.e. about 30.000 and that

Re: IDE for Python ?

2006-01-01 Thread Ravi Teja
[EMAIL PROTECTED] wrote: > I'm getting realy tired of learning new languages. > And especially frustrated at the 'syntax errors' when switching > between them. > > There are basically only a few common concepts needed for > all the languages. Hence linux's p2c: Pascal to C translator. > > A good

Re: Python article in Free Software Magazine

2006-01-01 Thread bonono
Steven D'Aprano wrote: > On Sat, 31 Dec 2005 14:42:36 -0600, Kirk Strauser wrote: > > > I wrote this article which was published in Free Software Magazine: > > > > http://www.freesoftwaremagazine.com/free_issues/issue_09/intro_zope_1/ > > > > It's intended as a high-level overview of the language,

Re: Python article in Free Software Magazine

2006-01-01 Thread Dan Sommers
On Sun, 01 Jan 2006 18:06:10 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I don't want to nit-pick all my way through the article, which is very > decent and is worth reading, but I will say one more thing: you > describe Python as "an expressive, interpreted language" ... So does

Numeric RandomArray seed problem

2006-01-01 Thread [EMAIL PROTECTED]
Hello, I tried calling RandomArray.seed() by calling RandomArray.get_seed() I get the seed number (x,y). My problem is that x is always 113611 any advice? Thanks pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: Application architecture (long post - sorry)

2006-01-01 Thread Ernst Noch
[EMAIL PROTECTED] wrote: > Hi all, > > I want to create a mobile field worker data solution. > > Let me explain... > > I work for a company that has some software used by call takers to > enter information into a database about faults with electrical > appliances they manufacture, sell to custom

Line replace

2006-01-01 Thread DarkBlue
Hello I need some help I have a text file which changes dynamically and has 200-1800 lines. I need to replace a line , this line can be located via a text marker like : somelines # THIS IS MY MARKER This is the line to be replaced somemorelines My question is how to do this

Re: Python article in Free Software Magazine

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 06:09:14 -0500, Dan Sommers wrote: > On Sun, 01 Jan 2006 18:06:10 +1100, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> I don't want to nit-pick all my way through the article, which is very >> decent and is worth reading, but I will say one more thing: you >> describe Pyth

Re: Python article in Free Software Magazine

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 02:55:01 -0800, bonono wrote: >> But sadly, many decision makers don't understand these subtleties. To >> them, compiled languages like C++ and Java are Good, interpreted languages >> are Bad and doomed to be slow and weak. As soon as you describe >> Zope/Python as "interpreted

Re: Line replace

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 19:31:38 +0800, DarkBlue wrote: > Hello > > I need some help > > I have a text file which changes dynamically and has > 200-1800 lines. I need to replace a line , this line > can be located via a text marker like : > > somelines > # THIS IS MY MARKER > This is

Re: Application architecture (long post - sorry)

2006-01-01 Thread Martin P. Hellwig
Mike Meyer wrote: > [EMAIL PROTECTED] writes: >> I have looked at the options for developing the client for these >> "electronic job sheets" and have decided upon Microsoft Pocket PC and >> the .net compact framework. It seems the easiest environment for >> developing and the PDA's can be obtained

Compressing folders in Windows using Python.

2006-01-01 Thread sri2097
Hi, I'm trying to zip a particular fiolder and place the zipped folder into a target folder using python. I have used the following command in 'ubuntu'. zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) I execute this using os.command(zip_command). It works fine... But when I run th

Re: Line replace

2006-01-01 Thread Sam Pointon
>Hello > > I need some help > > I have a text file which changes dynamically and has > 200-1800 lines. I need to replace a line , this line > can be located via a text marker like : > > somelines > # THIS IS MY MARKER > This is the line to be replaced > somemorelines > > My question is how

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 04:07:11 -0800, sri2097 wrote: > Hi, > I'm trying to zip a particular fiolder and place the zipped folder into > a target folder using python. I have used the following command in > 'ubuntu'. > > zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) > > I execute thi

Re: Python article in Free Software Magazine

2006-01-01 Thread bonono
Steven D'Aprano wrote: > I'm worried > about people who pre-judging (as in prejudice) Python negatively on the > basis of buzzwords they barely understand. > For those with prejudice, it doesn't matter anyway. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Heiko Wundram
Steven D'Aprano wrote: >> But when I run this script in Windows XP, I get an error while >> executing the above zip command. > > Would you like to tell us what error you get? I presume the error he's seeing is something along the line of: "zip: Bad command or filename." That's basically because

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Heiko Wundram
Heiko Wundram wrote: > That's basically because there is no commandline builtin for zipping up > files on Windows, and I don't know of WinZIP or any of the InfoZIP derived > GUIs installing a command-line zipper. btw. the zip command isn't builtin on Unix either. It's only available if you install

Re: Line replace

2006-01-01 Thread DarkBlue
Steven D'Aprano wrote: > Let me see if I understand your problem... you need to edit a text file > in place at the same time that another process is also changing the file > in place? That's hard. You need some way to decide who gets precedence if > both you and the other process both try to cha

f2py and common blocks /Carl

2006-01-01 Thread Carl
I have been experimenting with f2py and some fortran code that I want to port to Python. I have the following fortran file (TEST_00.f): C FILE: TEST_00.f SUBROUTINE FOO(WORK) IMPLICIT REAL*8 (A-H, O-Z) COMMON /SIZES/ NINT DIMENSION WORK(NINT) DIMENSION USOL(NINT)

Re: Line replace

2006-01-01 Thread Paul Rubin
DarkBlue <[EMAIL PROTECTED]> writes: > Now our authorized clients register themselves automatically with > computername,id and ip address via a small python script which sends this > information to a firebird database on our server... > Every client has a marker in the hosts.allow file > so if a ch

Re: Line replace

2006-01-01 Thread DarkBlue
> Why don't you use the database to store those markers? It should > support concurrent updates properly. That's a database's job. The markers are just there to have a static way to find the line after the marker, which is the one which might have to be changed. Nx -- http://mail.python.org/m

Re: Application architecture (long post - sorry)

2006-01-01 Thread limeydrink
In response to Mike's post... I know exactly where you're coming from and you are right a web based solution is the simplest and would be the fastest to develop and rollout etc. but.. The cost is in the data, in the uk you get charged for the amount of data you send/receive by GPRS and this data

Re: Python article in Free Software Magazine

2006-01-01 Thread Ernst Noch
Steven D'Aprano wrote: > On Sun, 01 Jan 2006 06:09:14 -0500, Dan Sommers wrote: > > >>On Sun, 01 Jan 2006 18:06:10 +1100, >>Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> >>>I don't want to nit-pick all my way through the article, which is very >>>decent and is worth reading, but I will say one

Re: Line replace

2006-01-01 Thread Paul Rubin
DarkBlue <[EMAIL PROTECTED]> writes: > The markers are just there to have a static way to find the line > after the marker, which is the one which might have to be changed. OK, why don't you store those changing lines in the database? Can you arrange for those changeable lines to be fixed length,

Re: logging module example

2006-01-01 Thread Chris Smith
One thing that made little sense to me when I was first working on this is the following variation on the original script: #--begin test script-- import logging forest = ["root","trunk","branch","leaf"] lumber_jack = {forest[0] : logging.DEBUG ,forest[1] : logging.INFO

Re: Line replace

2006-01-01 Thread DarkBlue
> OK, why don't you store those changing lines in the database? > > Can you arrange for those changeable lines to be fixed length, i.e. > by padding with spaces or something? If you can, then you could just > overwrite them in place. Use flock or fcntl (Un*x) or the comparable > Windows locking

Re: python coding contest

2006-01-01 Thread Claudio Grondi
Claudio Grondi wrote: >> Please send me comments, suggestions and ideas. > > > Now, after the contest is over I analysed the outcome of it and have > come to the conclusion, that there were two major factors which > contributed to squeezing of code: > > (1). usage of available variants for c

Re: Global Variables in OOP and Python

2006-01-01 Thread Kay Schluehr
Steven D'Aprano wrote: > On Fri, 30 Dec 2005 20:00:51 -0500, Mike Meyer wrote: > > > >> The other way I thought of is to create a separate class that consists > >> of the variables and to use the > >> > >> from import * > >> > >> in all of the files (namespaces) where it is needed. > > > > Except

Re: python coding contest

2006-01-01 Thread Claudio Grondi
Steven D'Aprano wrote: > On Sun, 01 Jan 2006 03:34:33 +0100, Claudio Grondi wrote: > > >>>Please send me comments, suggestions and ideas. >> >>Now, after the contest is over I analysed the outcome of it and have >>come to the conclusion, that there were two major factors which >>contributed to

Re: Compressing folders in Windows using Python.

2006-01-01 Thread bren[at]gillatt.org
Heiko Wundram wrote: > Steven D'Aprano wrote: > >>>But when I run this script in Windows XP, I get an error while >>>executing the above zip command. >> >>Would you like to tell us what error you get? > > > I presume the error he's seeing is something along the line of: > > "zip: Bad command or

Re: Xah's Edu Corner: Tech Geekers and their Style

2006-01-01 Thread John W. Kennedy
Xah Lee wrote: > With all the whizbang of styles and features in CSS2, a basic, > necessary, functional layout feature as multi-columns is not there yet. > This is a indication of the fatuousness of the IT industry's > technologies and its people. No, this is an indication of what happens to an in

Help please with binary file read

2006-01-01 Thread Stewart Arnold
I'm trying to convert a Real Basic routine into Python and I can't read the long integer data from a file. Here is the Real Basic code: b=f.OpenAsBinaryFile b.LittleEndian=True i=b.ReadByte titles=b.ReadLong shows=b.ReadLong i=b.ReadLong And here is my code:

how to show Chinese Characters in the value set of a dictionary

2006-01-01 Thread zxo102
Hi there, I have a dictionary with values of Chinses Characters. For example, >>> dict = {} >>> dict['c1']="中国一" >>> dict['c2']="中国二" >>> dict.values() ['\xd6\xd0\xb9\xfa\xb6\xfe', '\xd6\xd0\xb9\xfa\xd2\xbb'] Since the result of dict.values will be inserted into web pages and handled by jav

Re: Python article in Free Software Magazine

2006-01-01 Thread Kirk Strauser
On Sunday 01 January 2006 01:06 am, Steven D'Aprano wrote: > I don't want to nit-pick all my way through the article, There's nothing wrong with that, and if I hadn't been prepared for it, I wouldn't have posted the link in here. You have fair points. Unfortunately, though, the word length of t

Re: python coding contest

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 15:49:58 +0100, Claudio Grondi wrote: > What I have thought about as a simpler/better solution is a method > allowing to avoid processing the content of the string or long integer > object by looping over its content. How can you avoid looping over its content? Whether you

Re: Help please with binary file read

2006-01-01 Thread Grant Edwards
On 2006-01-01, Stewart Arnold <[EMAIL PROTECTED]> wrote: > I'm trying to convert a Real Basic routine into Python and I > can't read the long integer data from a file. http://docs.python.org/lib/module-struct.html -- Grant Edwards grante Yow! Here I am in 53

Re: Global Variables in OOP and Python

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 06:48:48 -0800, Kay Schluehr wrote: >> Agree about from module import * being bad, but it is still generally poor >> practice for the same reason using global variables is generally poor >> practice. > > No, I don't think so. The general wisdom is that global variables are > b

Re: how to show Chinese Characters in the value set of a dictionary

2006-01-01 Thread Nikos Kouremenos
On Sun, 01 Jan 2006 07:35:31 -0800, zxo102 wrote: > > Hi there, > I have a dictionary with values of Chinses Characters. For > example, > dict = {} dict['c1']="中国一" dict['c2']="中国二" dict.values() > ['\xd6\xd0\xb9\xfa\xb6\xfe', '\xd6\xd0\xb9\xfa\xd2\xbb'] > > Since the

Re: Line replace

2006-01-01 Thread Mike Meyer
DarkBlue <[EMAIL PROTECTED]> writes: > pseudocode is like this: > > get newlinetext from database # this is ok done with kinterbas > preferably check if file not in use by other process > open file and find desired marker > go to line after marker and replace that one with newlinetext > close the

Re: how to show Chinese Characters in the value set of a dictionary

2006-01-01 Thread Diez B. Roggisch
zxo102 schrieb: > Hi there, > I have a dictionary with values of Chinses Characters. For > example, > > dict = {} dict['c1']="中国一" dict['c2']="中国二" dict.values() > > ['\xd6\xd0\xb9\xfa\xb6\xfe', '\xd6\xd0\xb9\xfa\xd2\xbb'] > > Since the result of dict.values will be insert

Try Python update

2006-01-01 Thread Mike Meyer
After spending time I should have been sleeping working on it, the try python site is much more functional. It now allows statements, including multi-line statements and expressions. You can't create code objects yet, so it's still more a programmable calculator than anything real. I've got some o

LocaWapp: localhost web applications (v.03 - 2005 Dec 31)

2006-01-01 Thread LocaWapp
http://cheeseshop.python.org/packages/source/L/LocaWapp/locawapp-03.tar.gz LocaWapp: localhost web applications (v.03 - 2005 Dec 31) Copyright (c) 2005 RDJ This code is distributed for your utility but WITHOUT ANY WARRANTY. http://LocaWapp.blogspot.com - Run: pyt

Re: python coding contest

2006-01-01 Thread Claudio Grondi
Steven D'Aprano wrote: > On Sun, 01 Jan 2006 15:49:58 +0100, Claudio Grondi wrote: > > > >>What I have thought about as a simpler/better solution is a method >>allowing to avoid processing the content of the string or long integer >>object by looping over its content. > > > How can you avoi

Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
Mike, I'm not a coder really at all (I dabble with vbscript & jscript) but an asking for help to get this working. I have tried this... params = urllib.urlencode({'action': 'hs.ExecX10ByName "Kitchen Espresso Machine", "On", 100'}) urllib.urlopen("http://192.168.1.11:80/hact/kitchen

Re: python coding contest

2006-01-01 Thread bonono
Steven D'Aprano wrote: > I'm reminded of a time I was going for a drive in the country when I drove > past an apple orchid. Standing in the orchid was a farmer with a pig. He > lifted the pig into the air, and the pig then bit an apple and slowly > chewed it. The farmer then carried him over to an

Re: how-to POST form data to ASP pages?

2006-01-01 Thread Alan Kennedy
[livin] > I'm not a coder really at all (I dabble with vbscript & jscript) but an > asking for help to get this working. > > I have tried this... > > params = urllib.urlencode({'action': 'hs.ExecX10ByName "Kitchen > Espresso Machine", "On", 100'}) > urllib.urlopen("http://192.168.1.

Problems with Tkinter

2006-01-01 Thread Steffen Mutter
Hi all and a happy new year! My first try fiddling around with GUIs ended disappointing, instead of showing the window title as expected 'Demofenster' ist still shows 'tk' instead. What did I do wrong? #!/usr/bin/env python from Tkinter import * fenster = Tk() fenster.title = 'Demofenster' fen

Re: Help please with binary file read

2006-01-01 Thread Stewart Arnold
Grant Perfect! Thanks :) Stewart "Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2006-01-01, Stewart Arnold <[EMAIL PROTECTED]> wrote: > >> I'm trying to convert a Real Basic routine into Python and I >> can't read the long integer data from a file. > > http://d

Re: bsddb3 locking questions

2006-01-01 Thread Eric S. Johansson
man, I'm in really bad form replying to myself twice but I'me solved the problem at least in a simple form. Eric S. Johansson wrote: > Eric S. Johansson wrote: >> are there any simple examples of how to do record locking with bsddb3? #!/usr/bin/python from bsddb import db # th

Re: Problems with Tkinter

2006-01-01 Thread Kevin
Try: fenster.title("Demofenster") "title" a class method, not a variable. Kevin. "Steffen Mutter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all and a happy new year! > > My first try fiddling around with GUIs ended disappointing, instead of > showing the window title as

Re: python coding contest

2006-01-01 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Steven D'Aprano wrote: > >>I'm reminded of a time I was going for a drive in the country when I drove >>past an apple orchid. Standing in the orchid was a farmer with a pig. He >>lifted the pig into the air, and the pig then bit an apple and slowly >>chewed it. The farme

Re: Problems with Tkinter

2006-01-01 Thread Cousin Stanley
> My first try fiddling around with GUIs ended disappointing, > instead of showing the window title as expected 'Demofenster' > ist still shows 'tk' instead. > > What did I do wrong? > > > #!/usr/bin/env python > > from Tkinter import * > fenster = Tk() > fenster.title = 'Demofenster' > fenster

Re: Problems with Tkinter

2006-01-01 Thread Steffen Mutter
Am Sun, 01 Jan 2006 18:36:56 +0100 schrieb Kevin: > Try: > > fenster.title("Demofenster") Exactly. I had a look in Michael Lauer's 'Python & GUI-Toolkits' meanwhile, so I found the clue. > "title" a class method, not a variable. Yep. Thank you: > Kevin. Steffen -- http://mail.python.org/ma

Re: Problems with Tkinter

2006-01-01 Thread Mario Wehbrink
Steffen Mutter schrieb in comp.lang.python: > fenster.title = 'Demofenster' Try: fenster.title("Demofenster") instead Mario -- Mario Wehbrink -- http://mail.python.org/mailman/listinfo/python-list

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Christian Tismer
sri2097 wrote: > Hi, > I'm trying to zip a particular fiolder and place the zipped folder into > a target folder using python. I have used the following command in > 'ubuntu'. > > zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) > > I execute this using os.command(zip_command). It w

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Tim N. van der Leeuw
Christian Tismer wrote: > sri2097 wrote: > > Hi, > > I'm trying to zip a particular fiolder and place the zipped folder into > > a target folder using python. I have used the following command in > > 'ubuntu'. > > > > zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) > > > > I execute

Re: Filling out forms with python

2006-01-01 Thread Christoph Haas
On Friday 30 December 2005 06:30, Steve Young wrote: > Hi, I was wondering if there's a way to fill out forms online using > python. Say for example if you wanted to make a search on some search > engine without having to actually open a browser or something like that. Try twill: http://www.idyll.

Re: Try Python update

2006-01-01 Thread UrsusMaximus
Cool. I think its really a good thing. Could come in handy when one is on a strange Windows machine with no Python installed, or when using a PDA that doesn't have Python etc. And its just a neat feat. ;-))) Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
Hi Alan, I have tried the code you suggested and a more simple set of post parameters (below). import urllib name_value_pairs = {'control_device': 'Kitchen Lights=off'} params = urllib.urlencode(name_value_pairs) urllib.urlopen("http://192.168.1.11:80";, params)

Re: python coding contest

2006-01-01 Thread Claudio Grondi
Claudio Grondi wrote: > Steven D'Aprano wrote: > >> On Sun, 01 Jan 2006 15:49:58 +0100, Claudio Grondi wrote: >> >> >> >>> What I have thought about as a simpler/better solution is a method >>> allowing to avoid processing the content of the string or long >>> integer object by looping over its

Python or Java or maybe PHP?

2006-01-01 Thread liorm
Hi everyone, I need to write a web app, that will support millions of user accounts, template-based user pages and files upload. The client is going to be written in Flash. I wondered if I coudl get your opinions - what do you think is the best language to use for the server? Python or Java? And I

Re: python coding contest

2006-01-01 Thread Jacob Hallen
In article <[EMAIL PROTECTED]>, Simon Hengel <[EMAIL PROTECTED]> wrote: >Hello, > >> After all, I'd really love to set up another contest with >> different measures and criteria. > >for future events i will take a close look at other possibilities for >doing a ranking. At the moment the 22c3 and t

Preventing control characters from entering an XML file

2006-01-01 Thread Frank Niessink
Hi list, First of all, I wish you all a happy 2006. I have a small question that googling didn't turn up an answer for. So hopefully you'll be kind enough to send me in the right direction. I'm developing a desktop application, called Task Coach, that saves its domain objects (tasks, mostly :-

Re: how-to POST form data to ASP pages?

2006-01-01 Thread Alan Kennedy
[livin] > I have tried the code you suggested and .. > .. Either way I get this error log... > > File "Q:\python\python23.zlib\urllib.py", line 78, in urlopen > File "Q:\python\python23.zlib\urllib.py", line 183, in open > File "Q:\python\python23.zlib\urllib.py", line 297, in open_http > File "Q

Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
The library is the PC version of 2.3 --- I have done some more testing. I simplified my .py to only 2 lines... import urllib urllib.urlopen('http://192.168.1.11', urllib.urlencode({'control_device': 'Kitchen Lights=off'})) I get this error... File "Q:\python\python23.zlib\urllib.py", line 78,

Re: Python article in Free Software Magazine

2006-01-01 Thread Ed Jensen
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I don't want to nit-pick all my way through the article, which > is very decent and is worth reading, but I will say one more thing: you > describe Python as "an expressive, interpreted language". Python is no > more interpreted than Java. Like Java, it

Re: Python article in Free Software Magazine

2006-01-01 Thread Ed Jensen
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I don't want to nit-pick all my way through the article, which > is very decent and is worth reading, but I will say one more thing: you > describe Python as "an expressive, interpreted language". Python is no > more interpreted than Java. Like Java, it

loops breaks and returns

2006-01-01 Thread rbt
Is it more appropriate to do this: while 1: if x: return x Or this: while 1: if x: break return x Or, does it matter? -- http://mail.python.org/mailman/listinfo/python-list

Problem overriding sys.excepthook

2006-01-01 Thread Lunchtimemama
Yo all, I'm getting into Python for the first time and I'm really having a blast. I've hit a bit of a snag and was wondering if someone could lend some insight. Here be the code: import sys def myexcepthook(type, value, tb): import traceback rawreport = traceback.format_exception(type, value,

Re: Memoization and encapsulation

2006-01-01 Thread Tom Anderson
On Sat, 31 Dec 2005 [EMAIL PROTECTED] wrote: >just> I actually prefer such a global variable to the default arg >just> trick. The idiom I generally use is: > >just> _cache = {} >just> def func(x): >just> result = _cache.get(x) >just> if result is None: >just>

Re: MidiToText : EventDispatcher instance has no attribute 'sysex_events'

2006-01-01 Thread Max M
Carsten Haese wrote: > On Fri, 2005-12-30 at 09:52, tim wrote: > >>Trying to convert midi to text using MidiToText.py. >>I get the following: >> >>midi_port: 0 >>Traceback (most recent call last): >> File "MidiToText.py", line 176, in ? >>midiIn.read() >> File "C:\Python24\Lib\site-packages\

Re: loops breaks and returns

2006-01-01 Thread Peter Hansen
rbt wrote: > Is it more appropriate to do this: > > while 1: > if x: > return x > > Or this: > > while 1: > if x: > break > return x The former would be considered bad style by some people. Others would consider it perfectly acceptable in a small function (say, no

Re: Hypergeometric distribution

2006-01-01 Thread Raven
Thanks Steven for your very interesting post. This was a critical instance from my problem: >>>from scipy import comb >>> comb(14354,174) inf The scipy.stats.distributions.hypergeom function uses the scipy.comb function, so it returned nan since it tries to divide an infinite. I did not tried to

Re: Python as a Server vs Running Under Apache

2006-01-01 Thread mojosam
I guess I'm a little confused, and this certainly comes from not yet having tried to do anything with Python on a web server. I remarked once to a Python programmer that it appeared to me that if I had a web page that called a Python program, that the server would: 1. Load Python 2. Run the progra

Re: Try Python update

2006-01-01 Thread Devan L
Mike Meyer wrote: > After spending time I should have been sleeping working on it, the try > python site is much more functional. It now allows statements, > including multi-line statements and expressions. You can't create code > objects yet, so it's still more a programmable calculator than > an

Re: Problem overriding sys.excepthook

2006-01-01 Thread Patrick Maupin
Lunchtimemama wrote: > Yo all, I'm getting into Python for the first time and I'm really > having a blast. I've hit a bit of a snag and was wondering if someone > could lend some insight. Here be the code: > > import sys > def myexcepthook(type, value, tb): > import traceback > rawreport = tra

Re: loops breaks and returns

2006-01-01 Thread Sam Pointon
rbt wrote: > Is it more appropriate to do this: > > while 1: > if x: > return x > > Or this: > > while 1: > if x: > break > return x > > Or, does it matter? I would pick the first form if that's the only place where x would be returned from the function. However, if the

Tkinter app hanging on windows

2006-01-01 Thread msoulier
Hello, I have a very simple Tkinter application that I'm using to dispatch a mechanize crawl of a web form, when a button is clicked. Most of the time it will be idle, until the user decides to unminimize it and click that button. Unfortunately, I'm finding that after several hours of being up, w

Re: Python as a Server vs Running Under Apache

2006-01-01 Thread Jean-Paul Calderone
On 1 Jan 2006 14:44:07 -0800, mojosam <[EMAIL PROTECTED]> wrote: >I guess I'm a little confused, and this certainly comes from not yet >having tried to do anything with Python on a web server. > >I remarked once to a Python programmer that it appeared to me that if I >had a web page that called a P

The New Extension IDE - EXTEIDE

2006-01-01 Thread EXTEIDE (sent by Nabble.com)
EXTEIDE is freeware. Anyone can download now. Please visit http://www.exteide.com Thanks. Sent from the Python - python-list forum at Nabble.com: The New Extension IDE - EXTEIDE -- http://mail.python.org/mailman/listinfo/python-list

Re: Hypergeometric distribution

2006-01-01 Thread Paul Rubin
"Raven" <[EMAIL PROTECTED]> writes: > Yes I am calculating hundreds of hypergeometric probabilities so I need > fast calculations Can you use Stirling's approximation to get the logs of the factorials? -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing control characters from entering an XML file

2006-01-01 Thread Scott David Daniels
Frank Niessink wrote: > ... > Character Range > Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | > [#x1-#x10]" > > - What is the easiest/most pythonic (preferably build-in) way of > checking a unicode string for control characters and weeding those > characters out? dr

Getting terse tracebacks?

2006-01-01 Thread Roy Smith
Is there any way to make the traceback printer built into the interpreter elide all the directories in pathnames (like strip_dirs() does for the profiler)? I'm working in a deep directory tree, and the full pathnames to my python source files are pushing 150 characters. I either need a laptop wit

Re: Problem overriding sys.excepthook

2006-01-01 Thread Lunchtimemama
Forgive my ignorance, but I'm not quite sure what you mean. I tried importing the traceback module at the beginning of the script, but that didn't make a difference. Could you provide example code to illustrate your comment? Thanks. -LTM -- http://mail.python.org/mailman/listinfo/python-list

Re: Try Python update

2006-01-01 Thread Mike Meyer
"Devan L" <[EMAIL PROTECTED]> writes: >> If you want to try an online P{ython tool that lets you save code, try >> Devan L's at http://www.datamech.com/devan/trypython/trypython.py. > My code uses one of the recipes from the Python Cookbook, 7.6 Pickling > Code Objects. It's limited to closures tho

how to scrape url out of href

2006-01-01 Thread homepricemaps
i need to scrape a url out of an href. it seems that people recommend that i use beautiful soup but had some problems. does anyone have sample code for scraping the actual url out of an href like this one http://www.cnn.com"; target="_blank"> -- http://mail.python.org/mailman/listinfo/python-l

Re: Numeric RandomArray seed problem

2006-01-01 Thread Sean Richards
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hello, > > I tried calling RandomArray.seed() > by calling RandomArray.get_seed() I get the seed number (x,y). > My problem is that x is always 113611 any advice? In [1]: from RandomArray import * In [2]: seed? Type: function Base Cla

Re: how to scrape url out of href

2006-01-01 Thread Paul Rubin
[EMAIL PROTECTED] writes: > does anyone have sample code for scraping the actual url out of an href > like this one > > http://www.cnn.com"; target="_blank"> If you've got the tag by itself like that, just use a regexp to get the href out. -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2006-01-01 Thread Michael Spencer
Claudio Grondi wrote: > ...I analysed the outcome of it and have > come to the conclusion, that there were two major factors which > contributed to squeezing of code: > >(1). usage of available variants for coding of the same thing >(2). sqeezing the size of used numeric and string litera

Re: Python as a Server vs Running Under Apache

2006-01-01 Thread Mike Meyer
"mojosam" <[EMAIL PROTECTED]> writes: > Is this advice accurate? Are there other things to consider? Isn't > there just some way (short of running something like Zope) that would > keep Python resident in the server's RAM? This is a shared server, so > the web host probably doesn't like stuff si

Build Python using Mars compiler?

2006-01-01 Thread rzed
Has anyone tried to compile Python (on Windows) using the Digital Mars compiler? If so, can you give some hints how you did it? Or ... can anyone suggest an approach to compiling from the ground up using a compiler that isn't mentioned in the thicket of #ifdefs? Where to start? What to look ou

Re: how to scrape url out of href

2006-01-01 Thread homepricemaps
sorry paul-i'm an extremely beginner programmer, if that! ;-) can you give me an example? thanks in advance Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > does anyone have sample code for scraping the actual url out of an href > > like this one > > > > http://www.cnn.com"; target="_blank"> > >

Re: how to scrape url out of href

2006-01-01 Thread Mike Meyer
[EMAIL PROTECTED] writes: > i need to scrape a url out of an href. it seems that people recommend > that i use beautiful soup but had some problems. What problem are you having with BeautifulSoup? It's working fine for here. > does anyone have sample code for scraping the actual url out of an hr

Re: python coding contest

2006-01-01 Thread Alex Martelli
Christian Tismer <[EMAIL PROTECTED]> wrote: > Hans Nowak wrote: > > >... for u in(3,14,10)) > > > > can be written as: > > > >... for u in 3,14,10) > > > > which would shave off a character. Tuples don't always need parentheses... > > This would work with a list comprehension. > Do

Re: how-to POST form data to ASP pages?

2006-01-01 Thread livin
The library is the PC version of 2.3 --- I have done some more testing. I simplified my .py to only 2 lines... import urllib urllib.urlopen('http://192.168.1.11', urllib.urlencode({'control_device': 'Kitchen Lights=off'})) I get this error... File "Q:\python\python23.zlib\urllib.py", line 78,

Re: Try Python update

2006-01-01 Thread Devan L
Mike Meyer wrote: > "Devan L" <[EMAIL PROTECTED]> writes: > >> If you want to try an online P{ython tool that lets you save code, try > >> Devan L's at http://www.datamech.com/devan/trypython/trypython.py. > > My code uses one of the recipes from the Python Cookbook, 7.6 Pickling > > Code Objects.

Re: Python or Java or maybe PHP?

2006-01-01 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Hi everyone, > > I need to write a web app, that will support millions of user accounts, > template-based user pages and files upload. The client is going to be > written in Flash. I wondered if I coudl get your opinions - what do you > think is the best language to u

Re: Line replace

2006-01-01 Thread DarkBlue
Thank you for all the suggestions It appears the safest solution still is using a temp file as was so apt suggested further up here without it I maybe white water rafting without a canoe. I also will test the feasibility to regenerate the whole file from the database. Nx -- http://mail.python

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-01 Thread Alex Martelli
Anton Vredegoor <[EMAIL PROTECTED]> wrote: ... > Google's not a nice company (yeah, I know I'm posting from a google > account). If you look at their job requirements it's clear they will > only hire people with long backstabbing histories. Such as...? Guido van Rossum? Greg Stein? Vint Cerf?

Re: Hypergeometric distribution

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 14:24:39 -0800, Raven wrote: > Thanks Steven for your very interesting post. > > This was a critical instance from my problem: > from scipy import comb comb(14354,174) > inf Curious. It wouldn't surprise me if scipy was using floats, because 'inf' is usually a float

  1   2   >