adding values to keys

2008-02-15 Thread Brandon
Hi all, I'm not sure if I'm calling the right method in a dictionary. I have: for k,v in dict.items(): NT = k,range(alpha,omega)#where alpha and omega are previously defined as 1 and 4, respectively print NT which gives: ('w', [0,1,2,3]) ('x', [0,1,2,3]) ('y', [0,1,2,3]) ('z',

Re: dictionary of operators

2008-02-15 Thread A.T.Hofkamp
On 2008-02-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > In the standard library module "operator", it would be nice to have a > dictionary > mapping operators strings with their respective functions. Something like: > > { > '+': add, > '-': sub, > 'in': contains, >

Re: a question in python curses modules

2008-02-15 Thread Marc 'BlackJack' Rintsch
On Fri, 15 Feb 2008 11:55:11 +0800, Marco wrote: > Hi, I wanna write a simple curses program, but somethings confuse > me, my code here: > > #!/usr/bin/python > > import os > import sys > import time > import curses > > class CursesObject( object ): > > def __init__(self): > > sel

Re: adding values to keys

2008-02-15 Thread Bruno Desthuilliers
Brandon a écrit : > Hi all, > > I'm not sure if I'm calling the right method in a dictionary. I have: > > for k,v in dict.items(): don't use 'dict' as an identifier, this shadows the builtin dict type. > NT = k,range(alpha,omega)#where alpha and omega are > previously defined as 1

Re: adding values to keys

2008-02-15 Thread Bruno Desthuilliers
Dennis Lee Bieber a écrit : > On Thu, 14 Feb 2008 23:55:21 -0800 (PST), Brandon > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: (snip) >> MT.fromkeys(NT[0], range(alpha,omega)) > > Note that NT is a single tuple -- your previous loop throws away the > prior value and binds

How to increase the APR cache size?????

2008-02-15 Thread Manikandan R
Hai Friends, How can we increase the ARP cache size? For storing a single entry how many bytes will it takes? What is the default ARP cache size? (Plz mention you are saying in bytes or in number of entries it can store) Thank's and Regard's, R.Ma

Re: XML pickle

2008-02-15 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: >> I cannot tell if the above approach will solve your problem or not. > > Well, declare me a persistent object. Ok, from now on, you are a persistent object. :) > from lxml import etree > > SS= '{urn:schemas-microsoft-com:office:spreadsheet}' > book= etree.Element( 'W

Re: dictionary of operators

2008-02-15 Thread Robert Bossy
A.T.Hofkamp wrote: > On 2008-02-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Hi, >> >> In the standard library module "operator", it would be nice to have a >> dictionary >> mapping operators strings with their respective functions. Something like: >> >> { >> '+': add, >> '-'

Assignment saves time?

2008-02-15 Thread rpglover64
In timing my code, which I probably screwed up, I found something curious: given that li=range(1000), the code block (enclosed in braces for clarification) { size=len(li) size==1000 } runs slightly faster than { len(li)==1000 } I tested this using the timeit module, and though the differenc

newbie question: converting csv to another dialect

2008-02-15 Thread Albert-jan Roskam
Hi all, I have a csv file with tab as a delimiter. I want to convert it into one that is comma delimited. I changed the regional settings on my computer to US. At first I thought I could use the CSV module for this, by reading the csv file, registering the new (desired = comma-delimited) dialect

Re: How to tell if I'm being run from a shell or a module

2008-02-15 Thread Sion Arrowsmith
Gabriel Genellina <[EMAIL PROTECTED]> wrote: >a) See if the __main__ module has a __file__ attribute. >b) See if sys.stdin is a real tty c) See if sys.argv[0] != '' (Although this works for the command line interactive shell, I've a suspicion it will fail with IDLE. But I don't have IDLE to hand

Re: newbie question: converting csv to another dialect

2008-02-15 Thread Chris
On Feb 15, 1:11 pm, Albert-jan Roskam <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a csv file with tab as a delimiter. I want to > convert it into one that is comma delimited. I changed > the regional settings on my computer to US. > > At first I thought I could use the CSV module for > this, by

Re: Assignment saves time?

2008-02-15 Thread Hrvoje Niksic
[EMAIL PROTECTED] writes: > I tested this using the timeit module, and though the difference was > small, I would have expected the first code block to do slightly > worse, Can you post your entire benchmark, so that we can repeat it? When I tried the obvious, I got the expected result: $ pytho

Regarding Python.h

2008-02-15 Thread Raj kumar
Hi to all, I'm new to Python. I am using python2.4. I have one application written in c language in which it includes python like #include "Python.h" But when i try to install it, i'm getting an error like Python.h: No such file or directory I feel gcc is unable to get the path for Python.h What

Re: Regarding Python.h

2008-02-15 Thread Christian Heimes
Raj kumar wrote: > Hi to all, > I'm new to Python. > I am using python2.4. > I have one application written in c language in which it includes python like > > #include "Python.h" > > But when i try to install it, i'm getting an error like > Python.h: No such file or directory > I feel gcc is unab

Re: Is there a way to use .NET DLL from Python

2008-02-15 Thread Luis M. González
On Feb 14, 6:26 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Feb 13, 6:58 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > > > > > On 13 feb, 00:26, Dino Viehland <[EMAIL PROTECTED]> wrote: > > > > >> Oh, I know what you mean. > > > >> But that was exactly the reason for having a .DLLs folder, i

Re: newbie question: converting csv to another dialect

2008-02-15 Thread Bruno Desthuilliers
Albert-jan Roskam a écrit : > Hi all, > > I have a csv file with tab as a delimiter. I want to > convert it into one that is comma delimited. I changed > the regional settings on my computer to US. > > At first I thought I could use the CSV module for > this, by reading the csv file, registering

Re: Assignment saves time?

2008-02-15 Thread cokofreedom
> $ python -m timeit -s 'l=[]' 'len(l)==1000' > 100 loops, best of 3: 0.256 usec per loop > $ python -m timeit -s 'l=[]' 'len(l)==1000' > 100 loops, best of 3: 0.27 usec per loop > > $ python -m timeit -s 'l=[]' 's=len(l); s==1000' > 100 loops, best of 3: 0.287 usec per loop > $ python

Re: copying files through Python

2008-02-15 Thread [EMAIL PROTECTED]
On Feb 13, 10:50 pm, Lalit <[EMAIL PROTECTED]> wrote: > I need to write a program which would transfer files under one folder > structure (there are sub folders) to single folder. find /fromdir -exec mv {} /todir \; -print Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: Error messages when using the Console Module

2008-02-15 Thread Christian Heimes
peter wrote: > 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 redirect standard error messages to a black hole. So when my > new

Error messages when using the Console Module

2008-02-15 Thread peter
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 redirect standard error messages to a black hole. So when my new code fails, I have no

Re: copying files through Python

2008-02-15 Thread James Matthews
Basically copying a file is reading a character or string from one file and writing it to the other. On Fri, Feb 15, 2008 at 3:06 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Feb 13, 10:50 pm, Lalit <[EMAIL PROTECTED]> wrote: > > > I need to write a program which would transfer files und

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-15 Thread Luis M. González
On 14 feb, 22:39, Paul Rubin wrote: > I join everyone else in thanking Martin for his work on this whole > effort. This wording and naming thing is a trivial subtopic. Thanks Martin and company for the good job! By the way, I'm not a native speaker either and I understo

Re: a question in python curses modules

2008-02-15 Thread Sion Arrowsmith
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >When the interpreter shuts down it has to remove objects. Everything you >need in a `__del__()` method must be referenced by that object to be sure >that it is still there and not already garbage collected. *But* it's not >guaranteed that `__d

PYTHON 2.4 PROGRAMMER NEEDED (Direct Client)

2008-02-15 Thread sarosh
Friends , I need a Python Developer Please send resume with rate and contact details to [EMAIL PROTECTED] Duration : Long Term Location: NYC Interview : Immediately Rate: open Experience with: Required Skills: Python 2.4 or greater Twisted Matrix 2.5 Object Oriented Programming

Re: adding values to keys

2008-02-15 Thread Steve Holden
Dennis Lee Bieber wrote: > On Thu, 14 Feb 2008 23:55:21 -0800 (PST), Brandon > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Hi all, >> >> I'm not sure if I'm calling the right method in a dictionary. I have: >> >> for k,v in dict.items(): > > Don't call your dictio

Re: Turtle graphics speed(). Seems broken

2008-02-15 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > I think the speed function may be broken from the turtle graphics > package > > > "from turtle import * > > speed('fastest') > > forward(50)" > > > I have tried all of the different speed settings, but I get no change > in the turtle's speed does anyone know how

RELEASED zif.sedna 0.9 beta2

2008-02-15 Thread Jim Washington
zif.sedna provides python access to the very cool XML database, Sedna, available at http://modis.ispras.ru/sedna/, under Apache 2.0 license. It's not about kool-aid or sit-ups. It's another option for storing, modifying, and retrieving hierarchical data. zif.sedna is available from the Python

Turtle graphics speed(). Seems broken

2008-02-15 Thread Alexander . Oot
I think the speed function may be broken from the turtle graphics package "from turtle import * speed('fastest') forward(50)" I have tried all of the different speed settings, but I get no change in the turtle's speed does anyone know how to fix this? -- http://mail.python.org/mailman/li

Pop-up Menu of a Graphics Image?

2008-02-15 Thread W. Watson
Is there a library that contains a pop-up menu class from a mouse click on a graphics image? -- Wayne Watson (Nevada City, CA) Web Page: -- http://mail.python.org/mailman/listinfo/python-list

Re: Pop-up Menu of a Graphics Image?

2008-02-15 Thread Jon "Fluffy" Saul
On Fri, Feb 15, 2008 at 9:55 AM, W. Watson <[EMAIL PROTECTED]> wrote: > Is there a library that contains a pop-up menu class from a mouse click on a > graphics image? > -- > Wayne Watson (Nevada City, CA) > > Web Page: > -- > http://mail.python

Solve a Debate

2008-02-15 Thread nexes
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 like this (just pseudo): If month = 1 or 3 or etc noDa

Accessing Oracle/Access database py2.4

2008-02-15 Thread Ahmed, Shakir
I was used import odbc to connect oracle or access table before, now I switched to python 2.4 and is giving me error message. I appreciate any help on that. Thanks sh -- http://mail.python.org/mailman/listinfo/python-list

Re: copying files through Python

2008-02-15 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > On Feb 13, 10:50 pm, Lalit <[EMAIL PROTECTED]> wrote: > >> I need to write a program which would transfer files under one folder >> structure (there are sub folders) to single folder. > > > > find /fromdir -exec mv {} /todir \; -print > > -type f -- http://mail.py

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Steve Holden
W. Watson wrote: > Thanks. I found this to work: > > input_file=open('junkin.txt','r') > output_file=open('junkout.txt','w') > for (line_cnt, each_line) in enumerate(input_file): > output_file.write('%4d '%(line_cnt+1)+each_line) You can improve this slightly by using string formatting more

Re: How do I execute a command from within python and wait on that command?

2008-02-15 Thread Rafael Sachetto
os.system(command) or proc = popen2.Popen3(command) proc.wait() 2008/2/15, black_13 <[EMAIL PROTECTED]>: > how do i exec a command (such as xcopy) from with win32 python and > wait on that command > to come to completion? and also cleanly terminate the command shell? > thanks > black_13 > >

linux disc space

2008-02-15 Thread DataSmash
I simply want to capture the free disc space in a variable so that I can compare changes. I'm aware of a few commands like "df -h" or "du - k", but I can't figure out how to capture those values as a variable. I also looked at os.statvfs(), but that output doesn't seem to make any sense at all to

Re: How to increase the APR cache size?????

2008-02-15 Thread Steve Holden
Manikandan R wrote: > Hai Friends, > How can we increase the ARP cache size? Why do you want to? The answer is operating-system-specific anyway. > For storing a single entry how many bytes will it takes? The answer is operating-system-specific. Why is this impor

Re: Solve a Debate

2008-02-15 Thread Tim Chase
> 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 like this (just pseudo): > > If month = 1 or 3 or etc > noDays = 31 > Elseif month = 4 or 6

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Grant Edwards
On 2008-02-15, Mark Dickinson <[EMAIL PROTECTED]> wrote: >> If you're doing such serious number-crunching that you really >> want to handle NANs, you're probably not writing in Python >> anyway. I disagree completely. I do a lot of number crunching in Python where I want IEEE NaN and Inf behavio

Re: Solve a Debate

2008-02-15 Thread Quentin Gallet-Gilles
If the data becomes much bigger, change your way of storing it, not the code. You don't want to code hundreds of "if - elif - else" because you have hundreds of different data, right ? TheDailyWTF is full of horror stories like this, by the way ;-) Data growth shouldn't result in modification in lo

Re: How do I execute a command from within python and wait on that command?

2008-02-15 Thread Matt Nordhoff
Rafael Sachetto wrote: > os.system(command) > > or > > proc = popen2.Popen3(command) > proc.wait() I don't know about "cleanly terminat[ing] the command shell", but you should use the subprocess module now, not any of the other functions scattered around. -- -- http://mail.python.org/mailman/l

Re: Floating point bug?

2008-02-15 Thread Zentrader
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. For anything less that 28 significant digits it rounds to 1.0. With floats 1.0/3 yields 0.3

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread [EMAIL PROTECTED]
> See Subject. It's a simple txt file, each line is a Python stmt, but I need > up to four digits added to each line with a space between the number field > and the text. Perhaps someone has already done this or there's a source on > the web for it. I'm not yet into files with Python. A sudden need

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Steve Holden
Mark Dickinson wrote: > On Feb 14, 11:09 pm, John Nagle <[EMAIL PROTECTED]> wrote: >> You also need to think about how conditionals interact with >> quiet NANs. Properly, comparisons like ">" have three possibilities: > > True. There was a recent change to Decimal to make comparisons (other

Re: XML pickle

2008-02-15 Thread castironpi
On Feb 15, 12:07 pm, [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 > > > > > A

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

2008-02-15 Thread Torsten Bronger
Hallöchen! Preston Landers writes: > [...] > > I've been using effbot's PythonDoc for a while, but it seems like > "the new standard" (if there is one) is docutils and restructured > text (ReST.) Is that accurate? In my opinion this is true. And with Epydoc being the best tool for generating

Re: XML pickle

2008-02-15 Thread castironpi
> > 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 to the original? > > What's the difference you experience? Target:

Re: Accessing Oracle/Access database py2.4

2008-02-15 Thread M.-A. Lemburg
On 2008-02-15 17:06, Ahmed, Shakir wrote: > I was used import odbc to connect oracle or access table before, now I > switched to python 2.4 and is giving me error message. I appreciate any > help on that. The win32 odbc module is very old and no longer maintained. If you're looking for a reliab

Re: QOTW: Re: dream hardware

2008-02-15 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > On Feb 14, 10:50 pm, [EMAIL PROTECTED] (Aahz) wrote: >> In article <[EMAIL PROTECTED]>, >> Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >>> On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: What is dream hardware for the Python interpreter? >>> I'm not sure tha

returning regex matches as lists

2008-02-15 Thread Jonathan Lukens
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 particular given that the regex has a number of groupings. The only method I've seen that returns a

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

2008-02-15 Thread Jeff Schwab
Preston Landers wrote: > Hey guys and gals. What are all the cool kids using these days to > document their code? My goal is to create in-line documentation of > each package/module/class/method and create some semi-nice looking (or > at least usable) packaged documentation from it, in HTML and/o

Re: linux disc space

2008-02-15 Thread Chris
On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: > I simply want to capture the free disc space in a variable so that I > can compare changes. I'm aware of a few commands like "df -h" or "du - > k", but I can't figure out how to capture those values as a variable. > I also looked at os.sta

Re: linux disc space

2008-02-15 Thread DataSmash
On Feb 15, 1:32 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Chris wrote: > > On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: > >> I simply want to capture the free disc space in a variable so that I > >> can compare changes. I'm aware of a few commands like "df -h" or "du - > >> k", but

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Carl Banks
On Feb 14, 11:09 pm, John Nagle <[EMAIL PROTECTED]> wrote: > You also need to think about how conditionals interact with > quiet NANs. Properly, comparisons like ">" have three possibilities: > True, False, and "raise". Many implementations don't do that well, > which means that you lose tri

Re: Pop-up Menu of a Graphics Image?

2008-02-15 Thread W. Watson
I want to allow a user who is looking at a graphic to be able to right-click on the graphic to produce a menu of choices. Does the PIL have something, a class or whatever? What in Tkinter would be useful for this purpose? GTK? Jon "Fluffy" Saul wrote: > On Fri, Feb 15, 2008 at 9:55 AM, W. Watso

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: > Mark Dickinson wrote: >> On Feb 14, 11:09 pm, John Nagle <[EMAIL PROTECTED]> wrote: >>> You also need to think about how conditionals interact with >>> quiet NANs. Properly, comparisons like ">" have three possibilities: >> >> True. There was a recent change to Decimal

Re: linux disc space

2008-02-15 Thread Jeff Schwab
Chris wrote: > On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: >> I simply want to capture the free disc space in a variable so that I >> can compare changes. I'm aware of a few commands like "df -h" or "du - >> k", but I can't figure out how to capture those values as a variable. >> I al

Re: mmap and shared memory

2008-02-15 Thread Ryan Smith-Roberts
On Feb 11, 3:41 pm, Matias Surdi <[EMAIL PROTECTED]> wrote: > Suppose I've a process P1, which generates itself a lot of data , for > example 2Mb. > Then, I've a process P2 which must access P1 shared memory and, > probably, modify this data. > To accomplish this, I've been digging around python's

Re: XML pickle

2008-02-15 Thread castironpi
> In Economics, they call it "Economy to Scale"- the effect, and the > point, and past it, where the cost to produce N goods on a supply > curve on which 0 goods costs 0 exceeds that on one on which 0 goods > costs more than 0: the opposite of diminishing returns.  Does the > benefit of encapsulati

Re: returning regex matches as lists

2008-02-15 Thread Jonathan Lukens
> 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_names = >>> re.compile(u'(?u)\\b([А-Я]{2,}\\s+)([<<"][а-яА-Я]+)(\\s*-?[а-яА-Я]+)*([>>"])') >>> t

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Mark Dickinson
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 model for the doubly extended rea

Re: linux disc space

2008-02-15 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Available space is how much you can actually access as a non-root user. > Apparently (thank you Jean-Paul), space can be reserved for superuser > use only; such space is "free," but not "available." > I'm not sure how su

Re: linux disc space

2008-02-15 Thread Jean-Paul Calderone
On Fri, 15 Feb 2008 11:32:09 -0800, Jeff Schwab <[EMAIL PROTECTED]> wrote: >Chris wrote: >> On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: >>> I simply want to capture the free disc space in a variable so that I >>> can compare changes. I'm aware of a few commands like "df -h" or "du - >

Re: Help Parsing an HTML File

2008-02-15 Thread Mike Driscoll
On Feb 15, 3: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: Solve a Debate

2008-02-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of nexes > Sent: Friday, February 15, 2008 11:25 AM > To: python-list@python.org > Subject: Solve a Debate > > Alright so me and my friend are having argument. > > Ok the problem we had been asked

Re: Floating point bug?

2008-02-15 Thread Diez B. Roggisch
Zentrader schrieb: >> That's a misconception. The decimal-module has a different base (10 >> instead of 2), and higher precision. But that doesn't change the fact >> that it will expose the same rounding-errors as floats do - just for >> different numbers. >> >> >>> import decimal as d >> >>> d =

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Mark Dickinson
On Feb 14, 11:09 pm, John Nagle <[EMAIL PROTECTED]> wrote: > You also need to think about how conditionals interact with > quiet NANs. Properly, comparisons like ">" have three possibilities: True. There was a recent change to Decimal to make comparisons (other than !=, ==) with NaNs do the

Re: Floating point bug?

2008-02-15 Thread Jeff Schwab
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. I think we're using the term "rounding error" to mean different things. If t

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Mark Dickinson
On Feb 15, 1:38 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-15, Mark Dickinson <[EMAIL PROTECTED]> wrote: > > >> If you're doing such serious number-crunching that you really > >> want to handle NANs, you're probably not writing in Python > >> anyway. > Some dodgy quoting here: that

Help Parsing an HTML File

2008-02-15 Thread egonslokar
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 pasted below. I need to parse the file in such a way to extra

Re: a question in python curses modules

2008-02-15 Thread Marc 'BlackJack' Rintsch
On Fri, 15 Feb 2008 15:10:12 +, Sion Arrowsmith wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >>When the interpreter shuts down it has to remove objects. Everything you >>need in a `__del__()` method must be referenced by that object to be sure >>that it is still there and not

Re: QOTW: Re: dream hardware

2008-02-15 Thread castironpi
On Feb 14, 10:50 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano  <[EMAIL PROTECTED]> wrote: > > >On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: > > >> What is dream hardware for the Python interpreter? > > >I'm not sure that the Python interpreter act

Re: Floating point bug?

2008-02-15 Thread Mark Dickinson
On Feb 15, 3:30 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > The point is that all numbering systems with a base + precision will > have (rational) values they can't exactly represent. Q\R is of course > out of the question by definition This 'Decimal is exact' myth has been appearing o

How do I execute a command from within python and wait on that command?

2008-02-15 Thread black_13
how do i exec a command (such as xcopy) from with win32 python and wait on that command to come to completion? and also cleanly terminate the command shell? thanks black_13 -- http://mail.python.org/mailman/listinfo/python-list

Re: linux disc space

2008-02-15 Thread Steve Holden
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 for regular uses the filesystem

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Steve Holden
[EMAIL PROTECTED] wrote: >> See Subject. It's a simple txt file, each line is a Python stmt, but I need >> up to four digits added to each line with a space between the number field >> and the text. Perhaps someone has already done this or there's a source on >> the web for it. I'm not yet into fil

Re: Solve a Debate

2008-02-15 Thread Grant Edwards
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 language implements things. If you by "lookup table" you mean a linearly in

Re: XML pickle

2008-02-15 Thread castironpi
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 to the original? >

sockets -- basic udp client

2008-02-15 Thread 7stud
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(textport) except ValueError: # That didn't work. Look it up instread. port = socket.ge

What's "the standard" for code docs?

2008-02-15 Thread Preston Landers
Hey guys and gals. What are all the cool kids using these days to document their code? My goal is to create in-line documentation of each package/module/class/method and create some semi-nice looking (or at least usable) packaged documentation from it, in HTML and/or PDF format. I've been using

Re: Accessing Oracle/Access database py2.4

2008-02-15 Thread Steve Holden
Ahmed, Shakir wrote: > I was used import odbc to connect oracle or access table before, now I > switched to python 2.4 and is giving me error message. I appreciate any > help on that. > So this error message is a secret? One possibility is that you are trying to use a 2.3 extension module wit

Re: Solve a Debate

2008-02-15 Thread Ivan Van Laningham
Hi All-- Lookup tables are always significantly faster than a bunch of ifs. Metta, Ivan On Fri, Feb 15, 2008 at 10:10 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > > Ok the problem we had been asked a while back, to do a programming > > exercise (in college) > > That would tell you how many days t

scary thought for consideration

2008-02-15 Thread Blubaugh, David A.
To All, I am wondering as far as the integration of MyHDL with Python 2.5, if there might be any potential version incompatibility issues? What I mean is will MyHDL not operate correctly, if it is executed with a Python 2.5 version not a Python 2.4? I will be testing to see if this possibility i

Re: linux disc space

2008-02-15 Thread Jeff Schwab
Christian Heimes 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. > > man mkfs > > :) Thank you. Looks like the feature is only supported by particular file systems. I don't see

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Grant Edwards
On 2008-02-15, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Feb 15, 1:38 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2008-02-15, Mark Dickinson <[EMAIL PROTECTED]> wrote: >> >> >> If you're doing such serious number-crunching that you really >> >> want to handle NANs, you're probably not w

Re: XML pickle

2008-02-15 Thread castironpi
On Feb 15, 2:58 pm, [EMAIL PROTECTED] wrote: > > In Economics, they call it "Economy to Scale"- the effect, and the > > point, and past it, where the cost to produce N goods on a supply > > curve on which 0 goods costs 0 exceeds that on one on which 0 goods > > costs more than 0: the opposite of di

Re: Assignment saves time?

2008-02-15 Thread rpglover64
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)) call=min(time2.repeat(5)) store=min(min(time1.repeat(5)),store) cal

Re: Assignment saves time?

2008-02-15 Thread rpglover64
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)) call=min(time2.repeat(5)) store=min(min(time1.repeat(5)),store) cal

Re: Email Directly from python

2008-02-15 Thread Daniel Folkes
You could always just set up a gmail account and use that SMTP. Thats what I do. Then all you have to do is google search for "gmail smtp python" and get some easy code. You can even send attatchments really easy. -Daniel Folkes brad wrote: > I'd like to send email directly from within python

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Jeff Schwab
W. Watson wrote: > See Subject. It's a simple txt file, each line is a Python stmt, but I > need up to four digits added to each line with a space between the > number field and the text. Perhaps someone has already done this or > there's a source on the web for it. I'm not yet into files with P

Re: linux disc space

2008-02-15 Thread Christian Heimes
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. man mkfs :) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: linux disc space

2008-02-15 Thread Jeff Schwab
DataSmash wrote: > On Feb 15, 1:32 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: >> Chris wrote: >>> On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: I simply want to capture the free disc space in a variable so that I can compare changes. I'm aware of a few commands like "df -h" or

Re: scary thought for consideration

2008-02-15 Thread Guilherme Polo
2008/2/15, Blubaugh, David A. <[EMAIL PROTECTED]>: > > > > To All, > > > I am wondering as far as the integration of MyHDL with Python 2.5, if there > might be any potential version incompatibility issues? What I mean is will > MyHDL not operate correctly, if it is executed with a Python 2.5 versi

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Grant Edwards
On 2008-02-15, Carl Banks <[EMAIL PROTECTED]> 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 Pytho

Re: [OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Steve Holden
I'll see your IBM 650 and raise you a Univac 418 with a FastRand drum. regards Steve W. Watson wrote: > Good grief! You go a long way back. Want to try for an IBM 650 with a drum > memory? > > Gabriel Genellina wrote: >> En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> >> es

Re: returning regex matches as lists

2008-02-15 Thread John Machin
On Feb 16, 6:07 am, Jonathan Lukens <[EMAIL PROTECTED]> wrote: > 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 particular > given that the reg

Re: Help Parsing an HTML File

2008-02-15 Thread Tim Chase
> 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 OUTPUT- > FILE below. BeautifulSoup[1]. Your one-stop-shop for all your HTML parsing needs. What you do with the parsed data, is an exercise left to the reade

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Mark Dickinson
On Feb 15, 5:27 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > True enough, but aren't they of indeterminate magnitude? Since infinity > == infinity + delta for any delta, comparison for equality seems a > little specious. The equality is okay; it's when you start trying to apply arithmetic laws l

Re: Assignment saves time?

2008-02-15 Thread Gabriel Genellina
En Fri, 15 Feb 2008 18:51:19 -0200, <[EMAIL PROTECTED]> escribió: > 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(time

  1   2   >