Re: Turn off ZeroDivisionError?

2008-02-15 Thread Steve Holden
Mark Dickinson wrote: > On Feb 15, 2:35 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> There are an uncountable number of infinities, all different. > > If you're talking about infinite cardinals or ordinals in set theory, > then yes. But that hardly seems relevant to using floating-point as a >

Re: linux disc space

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: > Jeff Schwab wrote: >> I'm not sure how superuser-only space would be reserved in the first >> place. I don't see anything relevant in the fdisk man page. > > The UFS and ext2 filesystem space allocation routines become very > inefficient when free space gets too low, so fo

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
skawaii <[EMAIL PROTECTED]> writes: > >>> t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/")) > TypeError: populate_all_tribes() takes exactly 1 argument (8 given) > > Can anybody clue me in on what I'm doing wrong? Does my function need > to have a different signature (i.e. *a

Passing a callable object to Thread

2008-02-15 Thread skawaii
I'm trying to execute a function in its own thread, due to this method taking a very long time to complete. I really don't see the need to inherit the Thread class, as basically every online example shows (at least the ones I found), nor do I want to. I want to pass the method into the Thread const

Re: Passing a callable object to Thread

2008-02-15 Thread skawaii
On Feb 15, 7:23 pm, Paul Rubin wrote: > t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) Thanks, that did it. After playing around in the interpreter a bit, I realize now that args=("data/w7/") doesn't create a tuple, like I thought it would. I h

Re: Error messages when using the Console Module

2008-02-15 Thread Gabriel Genellina
En Fri, 15 Feb 2008 11:59:07 -0200, peter <[EMAIL PROTECTED]> escribió: > I am developing code using the effbot Console module, which gives > control over the Windows terminal settings. My problem is that while > this module redirects standard output to a new console window, it > seems to redir

Re: Floating point bug?

2008-02-15 Thread Steven D'Aprano
On Fri, 15 Feb 2008 10:55:47 -0800, Zentrader wrote: > I disagree with this statement > But that doesn't change the fact that it will expose the same > rounding-errors as floats do - just for different numbers. The > example used has no rounding errors. Of course it does. Three thirds equals one

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Steven D'Aprano
On Thu, 14 Feb 2008 20:09:38 -0800, John Nagle wrote: > For Python, I'd suggest throwing a Python exception on all errors > recognized by the FPU, except maybe underflow. If you're doing such > serious number-crunching that you really want to handle NANs, you're > probably not writing in Python a

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Steven D'Aprano
On Fri, 15 Feb 2008 14:35:34 -0500, Steve Holden wrote: >> I don't understand: why would +INF not be equal to itself? Having INF >> == INF be True seems like something that makes sense both >> mathematically and computationally. >> [...] > > There are an uncountable number of infinities, all d

Re: returning regex matches as lists

2008-02-15 Thread Gabriel Genellina
En Fri, 15 Feb 2008 17:07:21 -0200, Jonathan Lukens <[EMAIL PROTECTED]> escribió: > I am in the last phase of building a Django app based on something I > wrote in Java a while back. Right now I am stuck on how to return the > matches of a regular expression as a list *at all*, and in particula

Re: Floating point bug?

2008-02-15 Thread Jeff Schwab
Steven D'Aprano wrote: > On Fri, 15 Feb 2008 10:55:47 -0800, Zentrader wrote: > >> I disagree with this statement >> But that doesn't change the fact that it will expose the same >> rounding-errors as floats do - just for different numbers. The >> example used has no rounding errors. > > Of cour

Re: returning regex matches as lists

2008-02-15 Thread Gabriel Genellina
En Fri, 15 Feb 2008 19:25:59 -0200, Jonathan Lukens <[EMAIL PROTECTED]> escribió: >> What would you like to see instead? > > I had mostly just expected that there was some method that would > return each entire match as an item on a list. I have this pattern: > import re corporate_nam

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Mark Dickinson
On Feb 15, 7:59 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 15 Feb 2008 14:35:34 -0500, Steve Holden wrote: > >> I don't understand: why would +INF not be equal to itself? Having INF > >> == INF be True seems like something that makes sense both > >> mathematically

Re: Assignment saves time?

2008-02-15 Thread Steven D'Aprano
On Fri, 15 Feb 2008 12:51:19 -0800, rpglover64 wrote: > I ran it in an interactive python shell, which might have made a > difference. > > import timeit > time1=timeit.Timer('s=len(li); s==1000', 'li=range(1000)') > time2=timeit.Timer('len(li)==1000', 'li=range(1000)') > store=min(time1.repeat(5)

seperate directory for .pyc files

2008-02-15 Thread Amit Gupta
Python'ites Is there an environment variable or some settings, that python can use to know the directory name for dumping .pyc files. Not a hard-requirement, I just don't like pyc files alongwith py files in my work area. Thanks A -- http://mail.python.org/mailman/listinfo/python-list

Re: call 'the following function' using decorators

2008-02-15 Thread castironpi
> > > > I assert it's easier to write: > > > > > start_new_thread( this_func ) > > > > def thrA(): > > > >     normal_suite() > > > > > than > > > > > def thrA(): > > > >     normal_suite() > > > > start_new_thread( thrA ) > > > > > If you don't, stop reading. Nothing beats if forkthread(): but wh

Hairy brainstorm

2008-02-15 Thread castironpi
Hold the future holds effectively nothing for single-threaded programs; single-core PUs have reached the point of diminishing returns of circuit size and IC design; thinking multi-threaded's the way to go. Recognizing that even in event-driven programs, order of execution is important, what does a

Re: seperate directory for .pyc files

2008-02-15 Thread Jeff Schwab
Amit Gupta wrote: > Python'ites > > Is there an environment variable or some settings, that python can use > to know the directory name for dumping .pyc files. > > Not a hard-requirement, I just don't like pyc files alongwith py files > in my work area. Does this help? # ls.py import subprocess

Re: sockets -- basic udp client

2008-02-15 Thread Gabriel Genellina
En Fri, 15 Feb 2008 20:24:19 -0200, 7stud <[EMAIL PROTECTED]> escribió: > My question pertains to this example: > > #!/usr/bin/env python > > import socket, sys, time > > host = sys.argv[1] > textport = sys.argv[2] > > s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > try: > port = int(

Re: seperate directory for .pyc files

2008-02-15 Thread Gabriel Genellina
En Fri, 15 Feb 2008 23:11:28 -0200, Amit Gupta <[EMAIL PROTECTED]> escribió: > Is there an environment variable or some settings, that python can use > to know the directory name for dumping .pyc files. No. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Solve a Debate

2008-02-15 Thread castironpi
On Feb 15, 12:32 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-15, Ivan Van Laningham <[EMAIL PROTECTED]> wrote: > > > Lookup tables are always significantly faster than a bunch of > > ifs. > > Mostly always.  It depends on what you mean by "lookup table", > and it depends on how the la

Re: Help Parsing an HTML File

2008-02-15 Thread 7stud
On Feb 15, 2:28 pm, [EMAIL PROTECTED] wrote: > Hello Python Community, > > It'd be great if someone could provide guidance or sample code for > accomplishing the following: > > I have a single unicode file that has  descriptions of hundreds of > objects. The file fairly resembles HTML-EXAMPLE paste

Re: Passing a callable object to Thread

2008-02-15 Thread Steve Holden
skawaii wrote: > On Feb 15, 7:23 pm, Paul Rubin wrote: >> t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) > > Thanks, that did it. After playing around in the interpreter a bit, I > realize now that args=("data/w7/") doesn't create a tuple, like

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Paul Rubin
Mark Dickinson <[EMAIL PROTECTED]> writes: > > But the IEEE standard only supports one of them, aleph(0). > > Technically two: plus and minus aleph(0). > > Not sure that alephs have anything to do with it. They really do not. The extended real line can be modelled in set theory, but the "infinit

Re: Passing a callable object to Thread

2008-02-15 Thread Benjamin
On Feb 15, 6:51 pm, skawaii <[EMAIL PROTECTED]> wrote: > On Feb 15, 7:23 pm, Paul Rubin wrote: > > > t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) > > Thanks, that did it. After playing around in the interpreter a bit, I > realize now that args

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-15 Thread Anthony Baxter
On Feb 15, 2008 11:27 AM, Terry Reedy <[EMAIL PROTECTED]> wrote: > So, thanks to Martin for trying on the release manager role, and looking > forward to [ANN] Python 2.5.2 released. Hear, hear! Thanks to Martin for getting this out, and apologies from me that it didn't happen sooner. -- http://ma

Re: Passing a callable object to Thread

2008-02-15 Thread Carsten Haese
On Fri, 2008-02-15 at 19:21 -0800, Benjamin wrote: > You could type args=tuple("data/w7/"). That will produce an 8-tuple containing single-character strings, not a 1-tuple containing one string. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/pyth

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Assuming you're right, what alternative would you suggest? Would it > allow parenthesized expressions to retain their customary meaning? It is kind of weird that there is even such a thing as a 1-tuple. -- http://mail.python.org/mailman/listinfo/python-l

Re: Passing a callable object to Thread

2008-02-15 Thread Steve Holden
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: >> Assuming you're right, what alternative would you suggest? Would it >> allow parenthesized expressions to retain their customary meaning? > > It is kind of weird that there is even such a thing as a 1-tuple. I agree that zero-length

Re: Solve a Debate

2008-02-15 Thread Dan Bishop
On Feb 15, 10:24 am, nexes <[EMAIL PROTECTED]> wrote: > Alright so me and my friend are having argument. > > Ok the problem we had been asked a while back, to do a programming > exercise (in college) > That would tell you how many days there are in a month given a > specific month. > > Ok I did my

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > > They really do not. The extended real line can be modelled in set > > theory, but the "infinity" in it is not a cardinal as we would > > normally treat them in set theory. > > Georg Cantor disagrees. Whether Aleph 1 is the cardinality of the set > of r

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Jeff Schwab
Paul Rubin wrote: > Mark Dickinson <[EMAIL PROTECTED]> writes: >>> But the IEEE standard only supports one of them, aleph(0). >>> Technically two: plus and minus aleph(0). >> Not sure that alephs have anything to do with it. > > They really do not. The extended real line can be modelled in set >

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > Why not? They seem intuitive to me. I would find it weird if you > couldn't have 0-tuple, and even weirder if you couldn't have a > 1-tuple. Maybe my brain has been warped by too much C++ code. The idea is that a 2-tuple (of numbers, say) is a pair of

Re: Passing a callable object to Thread

2008-02-15 Thread Jeff Schwab
Paul Rubin wrote: > Jeff Schwab <[EMAIL PROTECTED]> writes: >> Why not? They seem intuitive to me. I would find it weird if you >> couldn't have 0-tuple, and even weirder if you couldn't have a >> 1-tuple. Maybe my brain has been warped by too much C++ code. > > The idea is that a 2-tuple (of

Re: returning regex matches as lists

2008-02-15 Thread Jonathan Lukens
On Feb 15, 8:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 15 Feb 2008 19:25:59 -0200, Jonathan Lukens > <[EMAIL PROTECTED]> escribió: > > > > >> What would you like to see instead? > > > I had mostly just expected that there was some method that would > > return each entire match

Re: Passing a callable object to Thread

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: > Paul Rubin wrote: >> Steve Holden <[EMAIL PROTECTED]> writes: >>> Assuming you're right, what alternative would you suggest? Would it >>> allow parenthesized expressions to retain their customary meaning? >> >> It is kind of weird that there is even such a thing as a 1-tuple.

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > > The idea is that a 2-tuple (of numbers, say) is a pair of numbers, a > > 3-tuple is three numbers, and a 1-tuple is one number. That would > > mean a number and a 1-tuple of numbers are the same thing, not > > separate types. > > No, that doesn't follow

Re: Hairy brainstorm

2008-02-15 Thread castironpi
On Feb 15, 8:04 pm, [EMAIL PROTECTED] wrote: > Hold the future holds effectively nothing for single-threaded > programs; single-core PUs have reached the point of diminishing > returns of circuit size and IC design; thinking multi-threaded's the > way to go. > > Recognizing that even in event-drive

Re: Solve a Debate

2008-02-15 Thread Steve Holden
Dan Bishop wrote: > On Feb 15, 10:24 am, nexes <[EMAIL PROTECTED]> wrote: >> Alright so me and my friend are having argument. >> >> Ok the problem we had been asked a while back, to do a programming >> exercise (in college) >> That would tell you how many days there are in a month given a >> specif

Where can I get the module MyUtils?

2008-02-15 Thread Python_Doctor
I inherited a piece of python code which imports "MyUtils" i.e. it has a line: import MyUtils When I execute the code I get: ImportError: No module named MyUtils I assume the code is looking for another module called MyUtils.py. Is this a standard Python module? Where can I download this module

Re: Help Parsing an HTML File

2008-02-15 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > I have a single unicode file that has descriptions of hundreds of > objects. The file fairly resembles HTML-EXAMPLE pasted below. > > I need to parse the file in such a way to extract data out of the html > and to come up with a tab separated file that would look like O

Re: What's "the standard" for code docs?

2008-02-15 Thread John Nagle
Preston Landers wrote: > Hey guys and gals. What are all the cool kids using these days to > document their code? HTML. Text-only docs are so last-cen. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: XML pickle

2008-02-15 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > On Feb 15, 11:10 am, [EMAIL PROTECTED] wrote: Can you use set( '{ss}Type' ) somehow? >>> What is 'ss' here? A prefix? >>> What about actually reading the tutorial? >>> http://codespeak.net/lxml/tutorial.html#namespaces And any way to make this look closer t

<    1   2