Re: SimplePrograms challenge

2007-06-12 Thread Steven Bethard
Stefan Behnel wrote: > Steven Bethard wrote: >> If you want to parse invalid HTML, I strongly encourage you to look into >> BeautifulSoup. Here's the updated code: >> >> import ElementSoup # http://effbot.org/zone/element-soup.htm >> import cStringIO >> >> tree = ElementSoup.parse(cStri

Re: Multiline lamba implementation in python.

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 20:48:41 -0300, Josh Gilbert <[EMAIL PROTECTED]> escribió: > Guido doesn't want multiline lambdas, that's a really good reason not to > add > them. They are, on the other hand, very useful at times. Even if he did > add > multiline lambdas it's not certain that he would a

Windows XP timezone language issue

2007-06-12 Thread Paul Sijben
I ran into an internationalization issue. I need a consistent idea about the timezone my application is running on. However when I run the following: >>> import time >>> time.tzname I get back ('West-Europa (standaardtijd)', 'West-Europa (zomertijd)') which is in dutch (the language of the host

Re: SimplePrograms challenge

2007-06-12 Thread Stefan Behnel
Steven Bethard wrote: > Rob Wolfe wrote: >> Steven Bethard <[EMAIL PROTECTED]> writes: >>> I'd hate to steer a potential new Python developer to a clumsier >> >> "clumsier"??? >> Try to parse this with your program: >> >> page2 = ''' >> URLs >> >> >> http://domain1/page1";>som

Re: Problem Inheriting from "str" Class

2007-06-12 Thread Gabriel Genellina
En Wed, 13 Jun 2007 03:01:16 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I'm writing a program and want to create a class that is derived from > the "str" base type. When I do so, however, I have problems with the > __init__ method. When I run the code below, it will call my new >

Problem Inheriting from "str" Class

2007-06-12 Thread [EMAIL PROTECTED]
I'm writing a program and want to create a class that is derived from the "str" base type. When I do so, however, I have problems with the __init__ method. When I run the code below, it will call my new __init__ method when there is zero or one (value) parameter. However, if I try to pass two pa

Re: updating db with csv

2007-06-12 Thread Tim Roberts
Captain Paralytic <[EMAIL PROTECTED]> wrote: >On 11 Jun, 07:37, Tim Roberts <[EMAIL PROTECTED]> wrote: >| Not in standard SQL. MySQL supports a REPLACE extension that does >| an UPDATE if the key already exists, and an INSERT if it does not. >| There is also an extension clause to the INSERT stat

Re: for ... else ?

2007-06-12 Thread Matthieu TC
> > > On 6/12/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > >> for x in iterable: > > >>do something with x > > >> else: > > >>do something when there are no more x > > > > >> You can think the above as: > > > > >> while there are still values in iterable: > > >>do some

Re: How to save python codes in files?

2007-06-12 Thread Evan Klitzke
On 6/12/07, why? <[EMAIL PROTECTED]> wrote: > Im working with Python 2.2 on my red hat linux system. Is there any > way to write python codes in separate files and save them so that i > can view/edit them in the future? Actually I've just started with > python and would be grateful for a response.

How to save python codes in files?

2007-06-12 Thread why?
Im working with Python 2.2 on my red hat linux system. Is there any way to write python codes in separate files and save them so that i can view/edit them in the future? Actually I've just started with python and would be grateful for a response. Thanx! -- http://mail.python.org/mailman/listinfo/

Re: for ... else ?

2007-06-12 Thread why?
> > > On 6/12/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > >> for x in iterable: > > >>do something with x > > >> else: > > >>do something when there are no more x > > > > >> You can think the above as: > > > > >> while there are still values in iterable: > > >>do something with

Re: Multiline lamba implementation in python.

2007-06-12 Thread Kay Schluehr
On 12 Jun., 20:17, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 12 Jun., 14:57, Facundo

Re: Bytes/File Size Format Function

2007-06-12 Thread half . italian
On Jun 12, 8:47 pm, samuraisam <[EMAIL PROTECTED]> wrote: > Quick file size formatting for all those seekers out there... > > import math > > def filesizeformat(bytes, precision=2): > """Returns a humanized string for a given amount of bytes""" > bytes = int(bytes) > if bytes is 0: >

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Steve Howell
--- John Nagle <[EMAIL PROTECTED]> wrote: > > There's a real reason. Remember, functions are > dynamically > replaceable. The compiler would have to detect that > the function > doesn't modify or replace itself while recursing for > this optimization > to be valid. Worst case, another thre

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Martin v. Löwis
> I used INT64 and initialize its value from PyArg_ParseTuple. > The code is PyArg_ParseTuple(args, "l", &nValue). > It should be PyArg_ParseTuple(args, "L", &nValue). That's still incorrect. For the L format flag, use PY_LONG_LONG, not your own INT64 type. More generally: always use the type docu

Bytes/File Size Format Function

2007-06-12 Thread samuraisam
Quick file size formatting for all those seekers out there... import math def filesizeformat(bytes, precision=2): """Returns a humanized string for a given amount of bytes""" bytes = int(bytes) if bytes is 0: return '0bytes' log = math.floor(math.log(bytes, 1024)) retu

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread John Nagle
Alexander Schmolck wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >>On Mon, 11 Jun 2007 01:28:09 +0100, Alexander Schmolck wrote: >>>Steven D'Aprano <[EMAIL PROTECTED]> writes: >>Don't keep us in suspense. What do you believe is the true reason? > > > It's easier to spot that some rational

Re: cgi.FieldStorage() not working on Windows

2007-06-12 Thread arorap
Thanks for your reply. The reason I want to run it as CGI (even though mod_php is available on my local computer) is that the target machine to which I will finally be uploading my scripts runs CGI. cgihandler should work just like CGI. Any clue why the cgi.FieldStorage()might not be working ?

Re: Pattern Classification Frameworks?

2007-06-12 Thread Miki
Hello Evan, > What frameworks are there available for doing pattern classification? > ... Two Bayesian classifiers are SpamBayes (http://spambayes.sf.net) and Reverend Thomas (http://www.divmod.org/projects/reverend). IMO the latter will be easier to play with. > Also, as a sidenote, are there an

Re: matrix class

2007-06-12 Thread DarrenWeber
On Jun 12, 6:20 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Jun 12, 7:31 pm, DarrenWeber <[EMAIL PROTECTED]> > wrote: > > > > > Below is a module (matrix.py) with a class to implement some basic > > matrix operations on a 2D list. Some things puzzle me about the best > > way to do this (please

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Allen
On 6 13 , 9 00 , Allen <[EMAIL PROTECTED]> wrote: > On 6 13 , 4 06 , "Martin v. Lo"wis" <[EMAIL PROTECTED]> wrote: > > > Allen schrieb: > > > > My C extension works wrong, and debug it, found that sizeof (INT64) = > > > 4, not 8. > > > I compile on Windows XP platform. > > > Please tell me how

Re: questions about solving equations in scipy

2007-06-12 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi all, > > I have two questions about scipy. You're likely to get a better response from the scipy mailing list. Here, you'll primarily get me, and I have to rush out right now. http://www.scipy.org/Mailing_Lists > 1) When I was trying to solve a single variable eq

Re: how to kill a process

2007-06-12 Thread James T. Dennis
Richard Rossel <[EMAIL PROTECTED]> wrote: > Hi Fellows, > I have a problem with process termination. I have a python code that > apache runs through a django interface. > The code is very simple, first, it creates a process with the > subprocess.Popen call, and afterwards, (using a web request) the

Why can't easy_install Django

2007-06-12 Thread kernel1983
I look it up in PyPI There are info about Django: Package Score Description Django096 0.96 6 Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. DjangoPaste 0.0 6 Integration of Python Paste and Django TurboDjango 0.95w2 6 Django template for

Re: matrix class

2007-06-12 Thread Dan Bishop
On Jun 12, 7:31 pm, DarrenWeber <[EMAIL PROTECTED]> wrote: > Below is a module (matrix.py) with a class to implement some basic > matrix operations on a 2D list. Some things puzzle me about the best > way to do this (please don't refer to scipy, numpy and numeric because > this is a personal progr

Re: Accessing global namespace from module

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 18:37:45 -0300, Reuben D. Budiardja <[EMAIL PROTECTED]> escribió: >> import sys >> from types import ModuleType as module >> >> def setup(namespace): >> plotModule = module('plot') >> for key,value in namespace.items(): >> if key[:2] != '__': >>

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Allen
On 6 13 , 4 06 , "Martin v. Lo"wis" <[EMAIL PROTECTED]> wrote: > Allen schrieb: > > > My C extension works wrong, and debug it, found that sizeof (INT64) = > > 4, not 8. > > I compile on Windows XP platform. > > Please tell me how to fix it to support INT64? > > What *is* INT64? It's not a builti

Re: Splitting SAX results

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 16:16:45 -0300, IamIan <[EMAIL PROTECTED]> escribió: > I do know how split works, but thank you for the response. The end > result that I want is a dictionary made up of the title results coming > through SAX, looking like {'Title1: Description', > 'Title2:Description'}. > > Th

Re: Convert String to Int and Arithmetic

2007-06-12 Thread James T. Dennis
tereglow <[EMAIL PROTECTED]> wrote: > Hello, > I am a complete newbie to Python and am accustomed to coding in PHP/ > Perl/Shell. I am trying to do the following: > I have a string: > cpuSpeed = 'Speed: 10' > What I would like to do is extract the '10' from the string, > and di

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Alexander Schmolck
"Anders J. Munch" <[EMAIL PROTECTED]> writes: > Like Steven said, tail-call optimisation is not necessary as you can always > hand-optimise it yourself. Care to demonstrate on some code written in CPS (a compiler or parser, say)? 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Mon, 11 Jun 2007 01:28:09 +0100, Alexander Schmolck wrote: > >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >> >>> On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: >>> > As for why tail calls are not optimized out, it was decided t

matrix class

2007-06-12 Thread DarrenWeber
Below is a module (matrix.py) with a class to implement some basic matrix operations on a 2D list. Some things puzzle me about the best way to do this (please don't refer to scipy, numpy and numeric because this is a personal programming exercise for me in creating an operational class in pure pyt

Re: logging module and threading

2007-06-12 Thread James T. Dennis
Ross Boylan <[EMAIL PROTECTED]> wrote: > I would like my different threads to log without stepping on each > other. > Past advice on this list (that I've found) mostly says to send the > messages to a Queue. That would work, but bypasses the logging > module's facilities. > The logging module it

Re: Multiline lamba implementation in python.

2007-06-12 Thread Steve Howell
--- Josh Gilbert <[EMAIL PROTECTED]> wrote: > > I know that the standard Python response is that you > might as well define a > function, indeed, the name might provide useful > documentation. In reality, > however, the vast majority of my anonymous functions > are callbacks (tends to > lead to na

questions about solving equations in scipy

2007-06-12 Thread [EMAIL PROTECTED]
Hi all, I have two questions about scipy. 1) When I was trying to solve a single variable equations using scipy, I found two methods: scipy.optimize.fsolve, which is designated to find the roots of a polynomial, and scipy.optimize.newton, which is used for Scalar function root finding according t

Re: A gotcha: Python pain point?

2007-06-12 Thread Beorn
On Jun 12, 5:00 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Beorn wrote: [...] > > I can see how it works now, but I haven't found an easy-to-read > > documentation on this. > > This has been discussed here very often. Python closures do capture the > names, not the values. If you want a va

MS Word parser

2007-06-12 Thread [EMAIL PROTECTED]
Hi all, I'm currently using antiword to extract content from MS Word files. Is there another way to do this without relying on any command prompt application? -- http://mail.python.org/mailman/listinfo/python-list

Re: cgi.FieldStorage() not working on Windows

2007-06-12 Thread Graham Dumpleton
On Jun 13, 1:17 am, arorap <[EMAIL PROTECTED]> wrote: > I've mod_php installed with Apache 2.2. In one of my folders, I'm > using the cgihandler as the PythonHandler as my target host runs > python only as CGI. Here cgi.FieldStorage() doesn't seem to work. I > can see the form data in sys.stdin but

Re: excel column autofit

2007-06-12 Thread John Machin
On Jun 13, 8:09 am, Lance Hoffmeyer <[EMAIL PROTECTED]> wrote: > Hey all, > > Wondering why the syntax won't autofit Column A? > I am not getting any errors. > > Also, is there a way of reducing the number of > syntax lines? Basically, I am wondering if there > is an easier way to copy and paste?

Re: excel column autofit

2007-06-12 Thread Jeff Peck
Lance Hoffmeyer wrote: > Hey all, > > Wondering why the syntax won't autofit Column A? > I am not getting any errors. > > Also, is there a way of reducing the number of > syntax lines? Basically, I am wondering if there > is an easier way to copy and paste? > > Thanks in Advance. > > Lance > > # A

Re: How does mod_python know where's Python installed ?

2007-06-12 Thread Graham Dumpleton
On Jun 13, 7:03 am, arorap <[EMAIL PROTECTED]> wrote: > Hi, > > I recently setupmod_pythonsuccessfully and things work smooth. > However, I do not remember tellingmod_pythonwhere to find Python > installation. There's not environment variable which gives that > information. As such how doesmod_pyth

Re: Multiline lamba implementation in python.

2007-06-12 Thread Josh Gilbert
On 6/12/07, Facundo Batista <[EMAIL PROTECTED]> wrote: Josh Gilbert wrote: > I don't expect multiline lambdas to be added to Python. I'm not so sure that > that's a bad thing. Regardless, isn't it possible to write your own Yes, it is a bad thing. Why? Because it would another way to do somet

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > # print the first 100 primes > for prime in itertools.islice(iter_primes(), > 100): > print prime > Sure. FWIW, in the example I posted, I kept the output loop a little more pedestrian (using an if/break idiom), and I printed pr

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Steve Howell
--- Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 12 Jun 2007 15:51:07 -0700, Steve Howell > wrote: > > > > > --- "Anders J. Munch" <[EMAIL PROTECTED]> wrote: > >> > >> Converting tail-recursion to iteration is > trivial, > >> and perfectly reasonable for > >> a human to do by hand. Y

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > On 6/12/07, Steve Howell <[EMAIL PROTECTED]> > wrote: > > --- Steven Bethard <[EMAIL PROTECTED]> > wrote: > > > import itertools > > > > > > def iter_primes(): > > > # an iterator of all numbers between 2 and > > > +infinity > > > numbers

Re: SimplePrograms challenge

2007-06-12 Thread Steven Bethard
Steve Howell wrote: > --- Steven Bethard <[EMAIL PROTECTED]> wrote: >> How about we just comment it better? >> >> import itertools >> >> def iter_primes(): >> # an iterator of all numbers between 2 and +infinity >> numbers = itertools.count(2) [snip] > > Actually, just one small caveat--

Re: Pattern Classification Frameworks?

2007-06-12 Thread Evan Klitzke
On 6/12/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > In fact, a wide variety of classifiers are used in text classification, > including Bayesian approaches, support vector machines, conditional > random fields, etc. > > > Are there any other frameworks I should be aware of? > > I have used (but

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Steven D'Aprano
On Tue, 12 Jun 2007 15:51:07 -0700, Steve Howell wrote: > > --- "Anders J. Munch" <[EMAIL PROTECTED]> wrote: >> >> Converting tail-recursion to iteration is trivial, >> and perfectly reasonable for >> a human to do by hand. You add an outer "while >> True"-loop, the recursive call >> becomes

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread John Nagle
Steve Howell wrote: > --- "Anders J. Munch" <[EMAIL PROTECTED]> wrote: > >>Converting tail-recursion to iteration is trivial, >>and perfectly reasonable for >>a human to do by hand. You add an outer "while >>True"-loop, the recursive call >>becomes a tuple assignment, and other code paths end >

Re: Postpone creation of attributes until needed

2007-06-12 Thread Steven D'Aprano
On Tue, 12 Jun 2007 08:53:11 -0700, Frank Millman wrote: >> Since, as far as I can tell, there is no minimum time between creating the >> instance at (1) and trying to access instance.y at (2), there is no >> minimum time between (1) and calling compute() at (4), except for the >> execution time o

Re: Who uses Python?

2007-06-12 Thread Vern . Muhr
On Jun 4, 1:53 pm, Mark Carter <[EMAIL PROTECTED]> wrote: > Thomas Jollans wrote: > > Broadly speaking, everyone who uses python programs in it and may thus be > > considered a "programmer". > > A woman from a job agency 'phoned me up the other day, and asked me if I > was any good with "algortihms

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- I wrote: > [...] was the final straw in converting > me from Python to Perl. Er, Perl to Python. In looking backwards, I started writing backwards. And no, I'm not ever going back to Perl... Boa

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > --- George Sakkis <[EMAIL PROTECTED]> wrote: > >> from itertools import count, ifilter > >> def sieve(): > >> seq = count(2) > >> while True: > >> p = seq.next() > >> seq = ifilter(p.__rmod__, seq) > >

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- Steven Bethard <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > --- George Sakkis <[EMAIL PROTECTED]> wrote: > >> from itertools import count, ifilter > >> def sieve(): > >> seq = count(2) > >> while True: > >> p = seq.next() > >> seq = ifilter(p.__rmod__, seq) > >

Re: SimplePrograms challenge

2007-06-12 Thread Steven Bethard
Steve Howell wrote: > --- George Sakkis <[EMAIL PROTECTED]> wrote: >> from itertools import count, ifilter >> def sieve(): >> seq = count(2) >> while True: >> p = seq.next() >> seq = ifilter(p.__rmod__, seq) >> yield p [snip] > Is there a way to broaden the problem s

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- Rob Wolfe <[EMAIL PROTECTED]> wrote: > > What about simple HTML parsing? As a matter of fact > this is not > language concept, but shows the power of Python > standard library. > Besides, that's very popular problem among newbies. I totally agree with the relevance of this example. FWIW it

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Steve Howell
--- "Anders J. Munch" <[EMAIL PROTECTED]> wrote: > > Converting tail-recursion to iteration is trivial, > and perfectly reasonable for > a human to do by hand. You add an outer "while > True"-loop, the recursive call > becomes a tuple assignment, and other code paths end > with a break out of

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- George Sakkis <[EMAIL PROTECTED]> wrote: > > from itertools import count, ifilter > def sieve(): > seq = count(2) > while True: > p = seq.next() > seq = ifilter(p.__rmod__, seq) > yield p > > > I suspect that it violates your second rule though > :) > I'm g

Re: SimplePrograms challenge

2007-06-12 Thread George Sakkis
On Jun 11, 5:56 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > Hi, I'm offering a challenge to extend the following > page by one good example: > > http://wiki.python.org/moin/SimplePrograms > > Right now the page starts off with 15 examples that > cover lots of ground in Python, but they're still

Re: SimplePrograms challenge

2007-06-12 Thread Steve Howell
--- Rob Wolfe <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > > > I'd hate to steer a potential new Python developer > > to a clumsier [...] > > [...] > But as far as HTML (not XML) is concerned this is > not very realistic solution. > I think both posted examples wou

Re: SimplePrograms challenge

2007-06-12 Thread Steven Bethard
Steven Bethard wrote: > Rob Wolfe wrote: >> Steven Bethard <[EMAIL PROTECTED]> writes: >>> I'd hate to steer a potential new Python developer to a clumsier >> >> "clumsier"??? >> Try to parse this with your program: >> >> page2 = ''' >> URLs >> >> >> http://domain1/page1";>som

excel column autofit

2007-06-12 Thread Lance Hoffmeyer
Hey all, Wondering why the syntax won't autofit Column A? I am not getting any errors. Also, is there a way of reducing the number of syntax lines? Basically, I am wondering if there is an easier way to copy and paste? Thanks in Advance. Lance # ADD ROW LABELS sh = wb.Worksheets ("Total") sh.

Re: SimplePrograms challenge

2007-06-12 Thread Steven Bethard
Rob Wolfe wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: >> I'd hate to steer a potential new Python developer to a clumsier > > "clumsier"??? > Try to parse this with your program: > > page2 = ''' > URLs > > > http://domain1/page1";>some page1 > http://domain2/pag

Re: set IP in linux with python

2007-06-12 Thread fscked
On Jun 12, 1:23 pm, fscked <[EMAIL PROTECTED]> wrote: > I have a text file with some network info like IP, mask, gateway, etc, > that I want to set on a linux box. This script will run on the host > that will be getting the new info. I can parse the data in the text > file and get my data in a list

Re: SimplePrograms challenge

2007-06-12 Thread Rob Wolfe
Steven Bethard <[EMAIL PROTECTED]> writes: > I'd hate to steer a potential new Python developer to a clumsier "clumsier"??? Try to parse this with your program: page2 = ''' URLs http://domain1/page1";>some page1 http://domain2/page2";>some page2 ''' > libra

Re: for ... else ?

2007-06-12 Thread Paddy
On Jun 12, 7:55 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 12 Jun 2007 10:41:28 -0300, Chris Mellon <[EMAIL PROTECTED]> > escribió: > > > > > On 6/12/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >> for x in iterable: > >>do something with x > >> else: > >>do somethin

Re: Accessing global namespace from module

2007-06-12 Thread Reuben D. Budiardja
On Monday 11 June 2007 23:49:14 Gabriel Genellina wrote: > En Mon, 11 Jun 2007 22:19:15 -0300, Reuben D. Budiardja > > It'll be great if I can > > put > > this trick on a single file that is included by the main scripts, to > > > According to your description on how things work, you will need the

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Anders J. Munch
Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> Not tail calls, in general, no. >> Sorry, how does that work? You're suggesting that there is an algorithm >> which the compiler could follow to optimize away tail-recursion, but human >> beings can't follow the same algorithm? >>

How does mod_python know where's Python installed ?

2007-06-12 Thread arorap
Hi, I recently setup mod_python successfully and things work smooth. However, I do not remember telling mod_python where to find Python installation. There's not environment variable which gives that information. As such how does mod_python know where to find Python ? When I print sys.path in my s

Re: stdout/err and C extentions

2007-06-12 Thread hg
Robert Bauck Hamar wrote: > hg wrote: > >> Robert Bauck Hamar wrote: >> >>> hg wrote: >>> Hi, I have the following * C extention - redir.c #include "Python.h" PyObject * test_redir_test(PyObject *self) { fprintf(

Re: Accessing global namespace from module

2007-06-12 Thread Reuben D. Budiardja
On Monday 11 June 2007 23:49:14 Gabriel Genellina wrote: > En Mon, 11 Jun 2007 22:19:15 -0300, Reuben D. Budiardja > > >It'll be great if I can > > put > > this trick on a single file that is included by the main scripts, to > > avoid > > violating DRY principle. > > According to your description

Re: SimplePrograms challenge

2007-06-12 Thread Steven Bethard
Rob Wolfe wrote: > Steve Howell wrote: >> Hi, I'm offering a challenge to extend the following >> page by one good example: >> >> http://wiki.python.org/moin/SimplePrograms > > What about simple HTML parsing? As a matter of fact this is not > language concept, but shows the power of Python standar

Re: Simple Threading Example Doesn't Work (2.5.1)

2007-06-12 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Seun Osewa wrote: > I've tried to run several threading examples in Python 2.5.1 (with > Stackless) For example: > > import threading > > theVar = 1 > > class MyThread ( threading.Thread ): > >def run ( self ): > > global theVar >

Re: Pattern Classification Frameworks?

2007-06-12 Thread Steven Bethard
Evan Klitzke wrote: > What frameworks are there available for doing pattern classification? > I'm generally interested in the problem of mapping some sort of input > to one or more categories. For example, I want to be able to solve > problems like taking text and applying one or more tags to it li

Re: List sequential initialization

2007-06-12 Thread Chris Mellon
On 6/12/07, HMS Surprise <[EMAIL PROTECTED]> wrote: > Thanks for the explaination. It didn't seem natural and from the > tutorial I read: > > A value can be assigned to several variables simultaneously: > > >>> x = y = z = 0 # Zero x, y and z > > > Maybe I infer too much > And yet, yo

set IP in linux with python

2007-06-12 Thread fscked
I have a text file with some network info like IP, mask, gateway, etc, that I want to set on a linux box. This script will run on the host that will be getting the new info. I can parse the data in the text file and get my data in a list, but I can't figure out how to put it in the right place of t

Re: stdout/err and C extentions

2007-06-12 Thread Robert Bauck Hamar
hg wrote: > Robert Bauck Hamar wrote: > >> hg wrote: >> >>> Hi, >>> >>> I have the following >>> >>> * C extention - redir.c >>> >>> >>> #include "Python.h" >>> >>> PyObject * test_redir_test(PyObject *self) { >>> fprintf(stdout, "Hello from an extention!\n"); >>> P

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Martin v. Lo
Allen schrieb: > My C extension works wrong, and debug it, found that sizeof (INT64) = > 4, not 8. > I compile on Windows XP platform. > Please tell me how to fix it to support INT64? What *is* INT64? It's not a builtin type of standard C, it isn't defined by Microsoft C, and it isn't predefined b

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 10:01:47 -0300, Allen <[EMAIL PROTECTED]> escribió: > The problem is obviously compiler involved. > But I don't know why the sizeof INT64 is changed to be 4. This prints 8, compiled with Visual C++ 2005 Express, Python 2.5.1, inside a Python extension with all the normal d

Re: file open default location

2007-06-12 Thread T. Crane
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > En Tue, 12 Jun 2007 11:48:32 -0300, <[EMAIL PROTECTED]> escribió: >> On Jun 12, 9:09 am, "Richard Brodie" <[EMAIL PROTECTED]> wrote: > >>> If you open a DOS window and run Python from there, it will write the >>> f

Re: stdout/err and C extentions

2007-06-12 Thread hg
Robert Bauck Hamar wrote: > hg wrote: > >> Hi, >> >> I have the following >> >> * C extention - redir.c >> >> >> #include "Python.h" >> >> PyObject * test_redir_test(PyObject *self) { >> fprintf(stdout, "Hello from an extention!\n"); >> Py_INCREF(Py_None); >> retur

Re: a question about unicode in python

2007-06-12 Thread kyosohma
On Jun 12, 12:29 pm, "Evan Klitzke" <[EMAIL PROTECTED]> wrote: > On 6/12/07, hzqij <[EMAIL PROTECTED]> wrote: > > > i have a python source code test.py > > > # -*- coding: UTF-8 -*- > > As Marc pointed out, you should test the actual file encoding of the > program to check that it is, in fact, UTF-

Re: stdout/err and C extentions

2007-06-12 Thread Robert Bauck Hamar
hg wrote: > Hi, > > I have the following > > * C extention - redir.c > > > #include "Python.h" > > PyObject * test_redir_test(PyObject *self) { > fprintf(stdout, "Hello from an extention!\n"); > Py_INCREF(Py_None); > return Py_None; > } > [...] > **

Re: Forgetting an import

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 15:03:18 -0300, HMS Surprise <[EMAIL PROTECTED]> escribió: > Thanks for the reloads folks. This is a big help as I am running a > jython based tool (maxq) and re-starting takes awhile. > > Can't seem to make reload work using the form "from dvTime > import ...". So I am prefa

stdout/err and C extentions

2007-06-12 Thread hg
Hi, I have the following * C extention - redir.c #include "Python.h" PyObject * test_redir_test(PyObject *self) { fprintf(stdout, "Hello from an extention!\n"); Py_INCREF(Py_None); return Py_None; } static PyMethodDef test_redir_methods[] = { {"test", (PyCFuncti

Simple Threading Example Doesn't Work (2.5.1)

2007-06-12 Thread Seun Osewa
Hello, I've tried to run several threading examples in Python 2.5.1 (with Stackless) For example: import threading theVar = 1 class MyThread ( threading.Thread ): def run ( self ): global theVar print 'This is thread ' + str ( theVar ) + ' speaking.'

Re: Splitting SAX results

2007-06-12 Thread IamIan
I do know how split works, but thank you for the response. The end result that I want is a dictionary made up of the title results coming through SAX, looking like {'Title1: Description', 'Title2:Description'}. The XML data looks like: Title1:Description Link Desc Author Date Title2:Description

Longest issue tracker thread?

2007-06-12 Thread John J. Lee
Reading a recent message about a mozilla project bugzilla comment thread 7 years old, I am curious re how dismally long and drawn-out a tracker thread has so far been observed in the wild. Possibly there are older issues in the Python project's own tracker, for starters? Separate prizes will be a

Re: file open default location

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 11:48:32 -0300, <[EMAIL PROTECTED]> escribió: > On Jun 12, 9:09 am, "Richard Brodie" <[EMAIL PROTECTED]> wrote: >> If you open a DOS window and run Python from there, it will write the >> files >> in whatever directory you were in when you typed the command. >> >> If you are

Re: List sequential initialization

2007-06-12 Thread HMS Surprise
Thanks for the explaination. It didn't seem natural and from the tutorial I read: A value can be assigned to several variables simultaneously: >>> x = y = z = 0 # Zero x, y and z Maybe I infer too much thanks again, jh -- http://mail.python.org/mailman/listinfo/python-list

Re: how to kill a process

2007-06-12 Thread Richard Rossel
On 12 jun, 13:24, "Evan Klitzke" <[EMAIL PROTECTED]> wrote: > On 6/12/07, Richard Rossel <[EMAIL PROTECTED]> wrote: > > > But when the python code is called to kill the created process, the > > process is left in a zombie state. > > If the process is left in a zombie state, it's because the parent

Re: for ... else ?

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 10:41:28 -0300, Chris Mellon <[EMAIL PROTECTED]> escribió: > On 6/12/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> for x in iterable: >>do something with x >> else: >>do something when there are no more x >> >> >> You can think the above as: >> >> while there ar

Re: httplib / connection

2007-06-12 Thread Gabriel Genellina
En Tue, 12 Jun 2007 09:09:12 -0300, rhXX <[EMAIL PROTECTED]> escribió: > i'm using this tutorial example Glad to see you could make it work finally. Which tutorial was that? The httplib.HTTP class that you were using is very old and deprecated for several years now. -- Gabriel Genellina --

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | > So? Tim wrote 'There should be one-- and preferably only one --obvious way | > to do it'. The primary clause is that there should at least one. The | > secondary clause is that once there is a good and obvious way

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > On 12 Jun., 14:57, Facundo Batista <[EMAIL PROTECTED]> wrote: > > > > > Remember that the *only*

Re: Forgetting an import

2007-06-12 Thread Yongjian Xu
ipython supports deepreload which will recompile the bytecode from the file no matter what. You can set the option up in ipython and use it. It requires no exit to the current env. Jim On 6/12/07, Larry Bates <[EMAIL PROTECTED]> wrote: HMS Surprise wrote: > I imported a set of functions from a

Re: List sequential initialization

2007-06-12 Thread René Fleschenberg
HMS Surprise schrieb: > I thought if I could do this: > >>> a = b = '' Bind both the names a and b to the same string object. > >>> a = 'a' Bind the name a to a *new* string object with the value 'a'. This replaces the previous binding of the name a. > >>> la = lb = [] Bind both the names la a

Re: Forgetting an import

2007-06-12 Thread HMS Surprise
Thanks for the reloads folks. This is a big help as I am running a jython based tool (maxq) and re-starting takes awhile. Can't seem to make reload work using the form "from dvTime import ...". So I am prefacing my calls with the module name now. thanx, jh -- http://mail.python.org/mailman/lis

List sequential initialization

2007-06-12 Thread HMS Surprise
I thought if I could do this: >>> a = b = '' >>> a = 'a' >>> a 'a' >>> b '' then this would behave similarly: >>> la = lb = [] >>> la.append('a') >>> la ['a'] >>> lb ['a'] I thought wrong! But don't know why. Inquiring minds want to know. thanx, jh -- http://mail.python.org/mailman/lis

Tamil/Indian Languages Support in Tkinter

2007-06-12 Thread reverse_gear
hi, Does Tkinter has support for tamil/Indian Languages?? I tried this code it is able to print both tamil and german text on console.. but on Tkinter Label it is printing only the german code Plz help from Tkinter import * import codecs german_ae = unicode('\xc3\xa4','utf-8') tamil_text = unicode

  1   2   3   >