Re: Bit of List replacing trouble (newbie)

2008-05-21 Thread Peter Otten
Zethex wrote: > At the moment i'm doing a piece of work for school and I'm stuck at the > moment. > > I have a list of words, for example: > > Sentence = ['A', 'dog', 'walked', 'across', 'the', 'street'] > > I have another list which I need to use to replace certain words, and its > in the form

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Henrique Dante de Almeida
On May 22, 1:41 am, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > > > >  Notice that 1e16-1 doesn't exist in IEEE double precision: > > >  1e16-2 == 0x1.1c37937e07fffp+53 > > >  1e16 == 0x1.1c37937e08p+53 > > > >  (that is, the hex representation ends with "7fff", then goes to > > > "8000"

Re: php vs python

2008-05-21 Thread NC
On May 21, 1:10 pm, notbob <[EMAIL PROTECTED]> wrote: > > So, here's my delimna: I want to start a blog. Yeah, who doesn't. > Yet, I want learn the guts of it instead of just booting up some > wordwank or whatever. Here's a simple computation to consider... WordPress' codebase is approximately a

Re: related to python

2008-05-21 Thread Dan Bishop
On May 21, 9:34 pm, "salil_reeves" <[EMAIL PROTECTED]> wrote: > develop a function called standardise_phrase to convert > the user's input to a standard form for subsequent processing. This > involves: > 1. removing all inter-word punctuation, which for our purposes is > assumed to > consist only o

Bit of List replacing trouble (newbie)

2008-05-21 Thread Zethex
At the moment i'm doing a piece of work for school and I'm stuck at the moment. I have a list of words, for example: Sentence = ['A', 'dog', 'walked', 'across', 'the', 'street'] I have another list which I need to use to replace certain words, and its in the form of: synonyms = [

Re: related to python

2008-05-21 Thread Dan Upton
This looks like a homework assignment, but... On Wed, May 21, 2008 at 10:34 PM, salil_reeves <[EMAIL PROTECTED]> wrote: > develop a function called standardise_phrase to convert > the user's input to a standard form for subsequent processing. This > involves: > 1. removing all inter-word punctuati

Re: Write bits in file

2008-05-21 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >On May 20, 12:14 am, Tim Roberts <[EMAIL PROTECTED]> wrote: >> Monica Leko <[EMAIL PROTECTED]> wrote: >> >> >I have a specific format and I need binary representation. Does >> >Python have some built-in function which will, for instance, represent >>

Re: related to python

2008-05-21 Thread Dan Bishop
On May 21, 9:34 pm, "salil_reeves" <[EMAIL PROTECTED]> wrote: > develop a function called standardise_phrase to convert > the user's input to a standard form for subsequent processing. This > involves: > 1. removing all inter-word punctuation, which for our purposes is > assumed to > consist only o

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Henrique Dante de Almeida
On May 22, 1:36 am, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > On May 22, 1:26 am, Henrique Dante de Almeida <[EMAIL PROTECTED]> > wrote: > > > > > On May 21, 3:38 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > > > >>> a = 1e16-2. > > > >>> a > > > 9998.0 > > > >>> a+0.999

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Henrique Dante de Almeida
On May 22, 1:26 am, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > On May 21, 3:38 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > > >>> a = 1e16-2. > > >>> a > > 9998.0 > > >>> a+0.999     # gives expected result > > 9998.0 > > >>> a+0.   # doesn't round correct

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Henrique Dante de Almeida
On May 21, 3:38 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: >>> a = 1e16-2. > >>> a > 9998.0 > >>> a+0.999     # gives expected result > 9998.0 > >>> a+0.   # doesn't round correctly. > > 1.0 Notice that 1e16-1 doesn't exist in IEEE double precision:

Re: C-like assignment expression?

2008-05-21 Thread Kay Schluehr
On 21 Mai, 19:56, sturlamolden <[EMAIL PROTECTED]> wrote: > On May 21, 11:38 am, [EMAIL PROTECTED] wrote: > > > if (match = my_re1.match(line): > > # use match > > elsif (match = my_re2.match(line)): > > # use match > > elsif (match = my_re3.match(line)) > > # use match > > > ...buy this is i

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Carl Banks
On May 21, 11:27 pm, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 7:01 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > The crucial thing is not to slow down the calculations with useless > > bells and whistles. > > Are you running your simulations on a system that does or does not > support

Re: Python and Flaming Thunder

2008-05-21 Thread Giampaolo Rodola'
On 21 Mag, 17:34, Dave Parker <[EMAIL PROTECTED]> wrote: > [...] symbols are more confusing for people to learn about than > words. There are lots of people who are fluent in English, but > dislike math. > > So, I opted for a simple, unambiguous, non-mathematical way of > expressing "assignment"

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 7:01 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > The crucial thing is not to slow down the calculations with useless > bells and whistles. Are you running your simulations on a system that does or does not support the "useless bell and whistle" of correct rounding? If not, how do you p

Re: about python modules

2008-05-21 Thread Scott David Daniels
srinivas wrote: ... i want to know how to import my functions folder to python in sucha way that the functions in functions folder should work like python library modules . i have python in folder C:\python25\.. and functions folder D:\programs\Functions\ pls help me friends how to do that.

Re: Publish a program

2008-05-21 Thread alex23
On May 21, 11:31 pm, TheSaint <[EMAIL PROTECTED]> wrote: > Other idea, I'll apreciate somebody to join and put new views on this > project. Have you thought about putting the full project somewhere like http://code.google.com/ ? Nothing gets comments & criticisms like used code :) -- http://mail

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
On May 21, 7:49 pm, MRAB <[EMAIL PROTECTED]> wrote: > I've thought of one possible drawback: "a" and "an" can be used as > variables, so the "is a" part might cause a problem. You'd need to > check the parser to find out... Good point, I hadn't noticed that. I'll check it out. -- http://mail.pyth

Re: Python's doc problems: sort

2008-05-21 Thread alex23
On May 22, 2:28 am, Xah <[EMAIL PROTECTED]> wrote: > «No, what was generally rejected was the idea that *you* could bring > more clarity to the documentation, based on the complete absence of it > in your posts & "essays". Basically, noone wanted docs that would > randomly degenerate into ad homin

Re: extracting title and/or summary of a website

2008-05-21 Thread alex23
On May 22, 3:28 am, रवींदर ठाकुर (ravinder thakur) <[EMAIL PROTECTED]> wrote: > is there any lib in python that provides a mechanism to get the title > of a web page ? also is there anything available to get a nice summary > like the way google shows below every link ? It's not part of the standar

related to python

2008-05-21 Thread salil_reeves
develop a function called standardise_phrase to convert the user's input to a standard form for subsequent processing. This involves: 1. removing all inter-word punctuation, which for our purposes is assumed to consist only of commas (`,'), full stops (`.'), exclamation marks (`!') or question m

Re: How do I know when all threads are done?

2008-05-21 Thread John Nagle
Zerge wrote: I can launch threads just fine, but then I have to do a time.sleep(n) so the main thread from which they where launched will wait for all the threads to return. How can I detect when all threads are done and then return control to the main threads? Thanks for your help Use "j

Re: Psyche (scheme in python), how to run on vista?

2008-05-21 Thread alex23
On May 22, 5:19 am, [EMAIL PROTECTED] wrote: > anyone using psyche? > > how do you run it on Vista? what file do you click? there is no > obvious file like psyche.py... After installation, you should be able to find 'psyche.bat' in C: \Python2.X\Scripts. However, it hard codes the path for the py

Re: backport of 'set' to python 2.3?

2008-05-21 Thread Daniel Fetchinson
>> Does anyone have a pure python implementation of the builtin 'set' >> object so that I could use that in python 2.3? > > Yes. You have one in Python 2.3 already > http://www.python.org/doc/2.3.5/lib/module-sets.html>, it's just > not a builtin. > >> If this would be the case that would be really

Re: backport of 'set' to python 2.3?

2008-05-21 Thread Larry Bates
Daniel Fetchinson wrote: Does anyone have a pure python implementation of the builtin 'set' object so that I could use that in python 2.3? If this would be the case that would be really great as I wouldn't have to change my code that runs happily on 2.5 and makes use of 'set'. Speed and performan

How do I know when all threads are done?

2008-05-21 Thread Zerge
I can launch threads just fine, but then I have to do a time.sleep(n) so the main thread from which they where launched will wait for all the threads to return. How can I detect when all threads are done and then return control to the main threads? Thanks for your help -- http://mail.python.org/m

Re: backport of 'set' to python 2.3?

2008-05-21 Thread Ben Finney
"Daniel Fetchinson" <[EMAIL PROTECTED]> writes: > Does anyone have a pure python implementation of the builtin 'set' > object so that I could use that in python 2.3? Yes. You have one in Python 2.3 already http://www.python.org/doc/2.3.5/lib/module-sets.html>, it's just not a builtin. > If this

Re: Python and Flaming Thunder

2008-05-21 Thread MRAB
On May 21, 8:34 pm, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 1:14 pm, MRAB <[EMAIL PROTECTED]> wrote: > > > I wonder whether "is" could be used both for "x is value" and "x is a > > type" without causing a problem: > > > If command is a string ... > > > If command is "quit" ... > > I thi

Re: php vs python

2008-05-21 Thread Larry Bates
notbob wrote: I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my delimna: I want to start a

Re: php vs python

2008-05-21 Thread alex23
On May 22, 6:10 am, notbob <[EMAIL PROTECTED]> wrote: > Well, that's my actual question, then. Is php really so bad I'm just > wasting my time? Or is it really the quickest way to blog functionality? > Would I be better served in the long run learning python, which claims to be > easy as pie to l

Re: HTMLParser error

2008-05-21 Thread alex23
On May 22, 8:18 am, [EMAIL PROTECTED] wrote: > Sorry, im new to both python and newsgroups, this is all pretty > confusing. So I need a line in my __init__ function of my class? The > spider class I made inherits from HTMLParser. Its just using the > feed() function that produces errors though, the

backport of 'set' to python 2.3?

2008-05-21 Thread Daniel Fetchinson
Does anyone have a pure python implementation of the builtin 'set' object so that I could use that in python 2.3? If this would be the case that would be really great as I wouldn't have to change my code that runs happily on 2.5 and makes use of 'set'. Speed and performance doesn't matter, any impl

Re: php vs python

2008-05-21 Thread Baris-C
On May 21, 11:10 pm, notbob <[EMAIL PROTECTED]> wrote: > I'm not posting this just to initiate some religious flame war, though it's > the perfect subject to do so.  No, I actaully want some serious advice about > these two languages and since I think usenet is the best arena to find it, > here ya'

Re: Returning to 'try' block after catching an exception

2008-05-21 Thread Ben Finney
alex23 <[EMAIL PROTECTED]> writes: > On May 22, 9:13 am, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > > In case it's not clear what I meant: after executing > > some_function() exception SomeExcpetion gets risen. Then, in > > except block I do something to fix whatever is causing the > > exception

Re: Python and Flaming Thunder

2008-05-21 Thread Collin
Dave Parker wrote: On May 20, 7:05 pm, Collin <[EMAIL PROTECTED]> wrote: Personally, FT is a bit meh to me. The way you issue your statements I always think something is wrong, mainly because when I want to define, say, x, in python I'd go: x = "whatever" Instantly noting that I defined x. Wh

Re: Returning to 'try' block after catching an exception

2008-05-21 Thread alex23
On May 22, 9:13 am, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > In case it's not clear what I meant: after executing some_function() > exception SomeExcpetion gets risen. Then, in except block I do something > to fix whatever is causing the exception and then I would like to go back > to try block,

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Carl Banks
On May 21, 4:56 pm, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > My understand is no, not if you're using IEEE floating point. > > Yes, that would explain it. I assumed that Python automatically > switched from hardware floating point t

Re: simple way to touch a file if it does not exist

2008-05-21 Thread bukzor
On May 21, 5:37 pm, Nikhil <[EMAIL PROTECTED]> wrote: > bukzor wrote: > > On May 21, 5:10 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > >> On 22 Mag, 01:15, Nikhil <[EMAIL PROTECTED]> wrote: > > >>> what are the simple ways? > >>> I could think of os.open(), os.exec(touch file) > >>> are the

Re: simple way to touch a file if it does not exist

2008-05-21 Thread Nikhil
bukzor wrote: On May 21, 5:10 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: On 22 Mag, 01:15, Nikhil <[EMAIL PROTECTED]> wrote: what are the simple ways? I could think of os.open(), os.exec(touch file) are there any simpler methods? Just use os.path.exists to check for file existence and

Re: simple way to touch a file if it does not exist

2008-05-21 Thread bukzor
On May 21, 5:10 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 22 Mag, 01:15, Nikhil <[EMAIL PROTECTED]> wrote: > > > what are the simple ways? > > I could think of os.open(), os.exec(touch file) > > > are there any simpler methods? > > Just use os.path.exists to check for file existence a

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread bukzor
On May 21, 3:28 pm, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 4:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > Which is exactly what the python decimal module does. > > Thank you (and Jerry Hill) for pointing that out. If I want to check > Flaming Thunder's results against an

Re: simple way to touch a file if it does not exist

2008-05-21 Thread Giampaolo Rodola'
On 22 Mag, 01:15, Nikhil <[EMAIL PROTECTED]> wrote: > what are the simple ways? > I could think of os.open(), os.exec(touch file) > > are there any simpler methods? Just use os.path.exists to check for file existence and open() as replacement for touch. >>> import os >>> if not os.path.exists('fi

Re: Returning to 'try' block after catching an exception

2008-05-21 Thread bukzor
On May 21, 4:33 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > André <[EMAIL PROTECTED]> wrote innews:[EMAIL PROTECTED]: > > > How about something like the following (untested) > > > done = False > > while not done: > > try: > > some_function() > > done = True > > except: > > so

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Agustin Villena
On 20 mayo, 12:10, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 19 May 2008 10:54:05 -0300, Agustin Villena > <[EMAIL PROTECTED]> escribió: > > > On May 18, 4:31 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> Agustin Villena schrieb: > > >> > is there anyway to show the class of

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Agustin Villena
> And not that useful - why would one care about the function being > defined in class X or Y when one have the exact file and line ? I have 3 reasons: 1) My developing time is expended running unit tests and browsing tracebacks to find which is the real problem. Knowing the offender class (inst

Re: Returning to 'try' block after catching an exception

2008-05-21 Thread Terry Reedy
"Karlo Lozovina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | André <[EMAIL PROTECTED]> wrote in | news:[EMAIL PROTECTED]: | | > How about something like the following (untested) | > | > done = False | > while not done: | > try: | > some_function() | > done = True | >

Re: Returning to 'try' block after catching an exception

2008-05-21 Thread Karlo Lozovina
André <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > How about something like the following (untested) > > done = False > while not done: > try: > some_function() > done = True > except: > some_function2() > some_function3() Sure, that works, but I was aiming for

Re: Python and Flaming Thunder

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 5:27 PM, Fuzzyman <[EMAIL PROTECTED]> wrote: > On May 14, 10:30 pm, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: >> > Dave Parker schrieb: >> > > All of the calculators and textbooks that elementary school students >> > > use, use "^" for powers. >> >> I've never seen th

Re: Returning to 'try' block after catching an exception

2008-05-21 Thread André
On May 21, 8:13 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > I'm not sure if Python can do this, and I can't find it on the web. So, > here it goes: > > try: > some_function() > except SomeException: > some_function2() > some_function3() > ... > # somehow goto 'try' block aga

simple way to touch a file if it does not exist

2008-05-21 Thread Nikhil
what are the simple ways? I could think of os.open(), os.exec(touch file) are there any simpler methods? -- http://mail.python.org/mailman/listinfo/python-list

Returning to 'try' block after catching an exception

2008-05-21 Thread Karlo Lozovina
I'm not sure if Python can do this, and I can't find it on the web. So, here it goes: try: some_function() except SomeException: some_function2() some_function3() ... # somehow goto 'try' block again In case it's not clear what I meant: after executing some_function() excep

Re: Separate output for log file and stdout

2008-05-21 Thread amit . uttam
On May 19, 4:05 pm, "Kam-Hung Soh" <[EMAIL PROTECTED]> wrote: > On Tue, 20 May 2008 06:58:28 +1000, <[EMAIL PROTECTED]> wrote: > > On May 16, 6:37 pm, Ben Finney <[EMAIL PROTECTED]> > > wrote: > >> [EMAIL PROTECTED] writes: > >> > I've recently jumped big time into python and I'm working on a > >>

Re: persistent deque

2008-05-21 Thread inhahe
something randomly made me realize why my second solution didn't work, so i fixed it. now you have a working persistent deque. 1. if you call somepdequeobject.load(filename) (as opposed to pdeque.load(filename)), do you want it to return a new object that it loaded from file, or do you want it

ANN: PyQt v4.4.2 Released

2008-05-21 Thread Phil Thompson
Riverbank Computing is pleased to announce the release of PyQt v4.4.2 available from http://www.riverbankcomputing.com/software/pyqt/. This release adds full support for Qt v4.4.0 including the new QtHelp, QtWebKit, QtXmlPatterns and phonon modules. A Windows installer is provided for the GPL v

Re: Separate output for log file and stdout

2008-05-21 Thread amit . uttam
On May 19, 4:05 pm, "Kam-Hung Soh" <[EMAIL PROTECTED]> wrote: > On Tue, 20 May 2008 06:58:28 +1000, <[EMAIL PROTECTED]> wrote: > > On May 16, 6:37 pm, Ben Finney <[EMAIL PROTECTED]> > > wrote: > >> [EMAIL PROTECTED] writes: > >> > I've recently jumped big time into python and I'm working on a > >>

Re: php vs python

2008-05-21 Thread Paul Rubin
notbob <[EMAIL PROTECTED]> writes: > Well, that's my actual question, then. Is php really so bad I'm just > wasting my time? Or is it really the quickest way to blog functionality? php is very easy to get started with and some big sites have been written in it. There is lots of low cost php hos

Re: best way to check if pid is dead?

2008-05-21 Thread bukzor
On May 21, 1:27 pm, bukzor <[EMAIL PROTECTED]> wrote: > On May 21, 12:13 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > > > > > In article > > <[EMAIL PROTECTED]>, > > >  bukzor <[EMAIL PROTECTED]> wrote: > > > Does anyone have a pythonic way to check if a process is dead, given > > > the pid? > > > >

Re: C-like assignment expression?

2008-05-21 Thread Paddy
On May 21, 10:38 am, [EMAIL PROTECTED] wrote: > Hello, > > I have an if-elif chain in which I'd like to match a string against > several regular expressions. Also I'd like to use the match groups > within the respective elif... block. The C-like idiom that I would > like to use is this: > > if (mat

Segmentation fault on updating a BYTEA field [psycopg2]

2008-05-21 Thread George Sakkis
I have a simple DB table that stores md5 signature pairs: Table "public.duplicate" Column | Type | Modifiers --+---+--- sig | bytea | not null orig_sig | bytea | not null Indexes: "duplicate_pkey" PRIMARY KEY, btree (sig) "ix_duplicate_orig_sig" btree (ori

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 4:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Which is exactly what the python decimal module does. Thank you (and Jerry Hill) for pointing that out. If I want to check Flaming Thunder's results against an independent program, I'll know to use Python with the decimal module.

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Diez B. Roggisch
Dave Parker schrieb: On May 21, 3:19 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: The fact is, sometimes it's better to get it fast and be good enough, where you can use whatever methods you want to deal with rounding error accumulation. I agree. I also think that the precision/speed tradeoff s

Re: HTMLParser error

2008-05-21 Thread jonbutler88
On May 21, 11:08 am, alex23 <[EMAIL PROTECTED]> wrote: > On May 21, 8:04 pm, alex23 <[EMAIL PROTECTED]> wrote: > > > Is your Spider class a subclass ofHTMLParser? Is it over-riding > > __init__? If so, is it doing something like: > > >     super(Spider, self).__init__() > > > If this is your issue[

Re: Running programs under a python program...

2008-05-21 Thread Matthew Woodcraft
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > So I have a python program that runs a bunch of other programsit > then loops forever, occasionally executing other programs. > > To run each of these programs my python code executes: > subprocess.Popen(command_line, shell=True, stdout=fd, > stder

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 3:41 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > When told why you got different results (an answer you > probably already knew, if you know enough about IEEE to do the > auto-conversion you alluded to) ... Of course I know a lot about IEEE, but you are assuming that I also know a l

Re: php vs python

2008-05-21 Thread notbob
On 2008-05-21, Damon Getsman <[EMAIL PROTECTED]> wrote: > My suggestion, if you want to keep that gray meat sparking, is to go > with only html & php. You could have the php dumping your entries > into date/time named textfiles on there when you're writing, and when > someone is reading, it just

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Chris Mellon
On Wed, May 21, 2008 at 4:29 PM, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 3:17 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > >> If you're going to use every post and question about Python as an >> opportunity to pimp your own pet language you're going irritate even >> more people than

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 3:19 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > The fact is, sometimes it's better to get it fast and be good enough, > where you can use whatever methods you want to deal with rounding > error accumulation. I agree. I also think that the precision/speed tradeoff should be under user

Re: php vs python

2008-05-21 Thread notbob
On 2008-05-21, Carl Banks <[EMAIL PROTECTED]> wrote: > If you just want to write a simple blog, PHP is probably good enough. > It's undeniably easier to jump into web programming with PHP-- > partially because of it's widespread support and straightforward > usage, partially because Python web sol

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 3:17 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > If you're going to use every post and question about Python as an > opportunity to pimp your own pet language you're going irritate even > more people than you have already. Actually, I've only posted on 2 threads that were questions

Re: Python and Flaming Thunder

2008-05-21 Thread Fuzzyman
On May 14, 10:30 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Dave Parker schrieb: > > > All of the calculators and textbooks that elementary school students > > > use, use "^" for powers. > > I've never seen this symbol in textbooks. In textbooks, powers are > written using superscript.

Re: php vs python

2008-05-21 Thread notbob
On 2008-05-21, Michael Vilain <[EMAIL PROTECTED]> wrote: > your site. They may even have a blogging package you can administer > entries without any programming. > > What's your end-goal here? If you can't program, you may be better off > with a package or tool that does all the heavy lifting

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 4:56 PM, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > >> My understand is no, not if you're using IEEE floating point. > > Yes, that would explain it. I assumed that Python automatically > switched from hardware floa

Re: php vs python

2008-05-21 Thread Damon Getsman
In my opinion, with the previous experience that you have in coding that you've mentioned, you're probably better off if you minimize the amount of new syntaxes you'll have to pick up. Standard technique for what you're trying to accomplish is more often than not Apache with the PHP and MySQL supp

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Diez B. Roggisch
Dave Parker schrieb: On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: My understand is no, not if you're using IEEE floating point. Yes, that would explain it. I assumed that Python automatically switched from hardware floating point to multi-precision floating point so that the u

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Chris Mellon
On Wed, May 21, 2008 at 3:56 PM, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > >> My understand is no, not if you're using IEEE floating point. > > Yes, that would explain it. I assumed that Python automatically > switched from hardware floa

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Matthieu Brucher
2008/5/21 Dave Parker <[EMAIL PROTECTED]>: > On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > My understand is no, not if you're using IEEE floating point. > > Yes, that would explain it. I assumed that Python automatically > switched from hardware floating point to multi-precisi

Re: php vs python

2008-05-21 Thread Carl Banks
On May 21, 4:10 pm, notbob <[EMAIL PROTECTED]> wrote: > Sometimes it seems overwhelming, but I > persevere because it's more fun/challenging than video games, which bore me > to tears. Ha, exactly the opposite here. > Well, that's my actual question, then. Is php really so bad I'm just > wasting

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > My understand is no, not if you're using IEEE floating point. Yes, that would explain it. I assumed that Python automatically switched from hardware floating point to multi-precision floating point so that the user is guaranteed to al

Re: php vs python

2008-05-21 Thread Jeffrey Froman
notbob wrote: > I > persevere because it's more fun/challenging than video games This is the crux of the matter from where I'm sitting. If the purpose of learning a programming language is fun, then the primary relevant question is: Is it more fun to code in Python or PHP? The answer i

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Jerry Hill
On Wed, May 21, 2008 at 4:34 PM, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 12:38 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > >> >>> a+0.999 # gives expected result >> 9998.0 >> >>> a+0. # doesn't round correctly. >> >> 1.0 > > Shouldn't both of th

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Dave Parker
On May 21, 12:38 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > >>> a+0.999     # gives expected result > 9998.0 > >>> a+0.   # doesn't round correctly. > > 1.0 Shouldn't both of them give .0? I wrote the same program under Flaming Thunder:

Re: best way to check if pid is dead?

2008-05-21 Thread bukzor
On May 21, 12:13 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > bukzor <[EMAIL PROTECTED]> wrote: > > Does anyone have a pythonic way to check if a process is dead, given > > the pid? > > > This is the function I'm using is quite OS dependent. A good candidate > >

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Mark Dickinson
On May 21, 3:22 pm, Marc Christiansen <[EMAIL PROTECTED]> wrote: > On my system, it works: > >  Python 2.5.2 (r252:60911, May 21 2008, 18:49:26) >  [GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2 >  Type "help", "copyright", "credits" or "license" for more information. >  >>> a = 1e16 - 2.; a >  99

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Marc Christiansen
Mark Dickinson <[EMAIL PROTECTED]> wrote: > On SuSE 10.2/Xeon there seems to be a rounding bug for > floating-point addition: > > [EMAIL PROTECTED]:~> python > Python 2.5 (r25:51908, May 25 2007, 16:14:04) > [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2 > Type "help", "copyright", "cred

php vs python

2008-05-21 Thread notbob
I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my delimna: I want to start a blog. Yeah, who

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
On May 21, 1:29 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > ... --somewhat akin to the > guy who a month or so ago wanted to sneakily teach his high school > class programming fundamentals by teaching them game programming. Yep, that's kind of my plan, too. After I get enough "computer language

Re: xpath with big files

2008-05-21 Thread Stefan Behnel
Vladimir Kropylev wrote: > I've encountered a problem when trying to use lxml.etree.xpath with > big (63Mb) file. It returns empty list on any request. > Is there any restriction on file size for lxml.etree.xpath? No. > This is what I do: > > f=open(filename) > tree = etree.parse(f) > f.close()

Re: getting dir(x), but not as list of strings?

2008-05-21 Thread Terry Reedy
"Gary Herron" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | [EMAIL PROTECTED] wrote: | > I want to iterate over members of a module, something like: | > | > for i in dir(x): | > if type(i) == types.FunctionType: ... | > | > but of course dir() returns a list of strings

Re: Removing Space and "-" from a string

2008-05-21 Thread Terry Reedy
"Paul Hankin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On May 20, 5:02 pm, "Ahmed, Shakir" <[EMAIL PROTECTED]> wrote: > I have thousands of records in MS Access database table, which records I > am fetching using python script. One of the columns having string like > '8 58-2155

Re: best way to check if pid is dead?

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 3:02 PM, bukzor <[EMAIL PROTECTED]> wrote: > Does anyone have a pythonic way to check if a process is dead, given > the pid? > > This is the function I'm using is quite OS dependent. A good candidate > might be "try: kill(pid)", since it throws an exception if the pid is > d

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
On May 21, 1:14 pm, MRAB <[EMAIL PROTECTED]> wrote: > I wonder whether "is" could be used both for "x is value" and "x is a > type" without causing a problem: > > If command is a string ... > > If command is "quit" ... I think you are right. I like "If command is "quit" ...". For a user who wasn

Re: Python and Flaming Thunder

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 12:11 PM, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 21, 10:00 am, "Dan Upton" <[EMAIL PROTECTED]> wrote: > >> Sounds to me like the teacher is being difficult, ... > > No, proof-by-contradiction is a common technique in math. If you can > show that x=8 and x=10, then

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread [EMAIL PROTECTED]
On May 21, 10:04 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > Yes, C defines "char" to be one byte, but it doesn't define the > size of a "byte" other than it's at least big enough to hold > one character (or something like that). In practice, a byte is > pretty much guaranteed to be at least 8

Psyche (scheme in python), how to run on vista?

2008-05-21 Thread notnorwegian
anyone using psyche? how do you run it on Vista? what file do you click? there is no obvious file like psyche.py... -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with import / namespace

2008-05-21 Thread Laszlo Nagy
ohad frand wrote Hi Thanks for the answer. I probably didnt write the problem accurately but it is not as you described. (i already read before the section that you pointed and it didnt help me) the problem is that i dont want to import a file from different directory but only from the same di

Re: Python and Flaming Thunder

2008-05-21 Thread MRAB
On May 21, 4:15 pm, Dave Parker <[EMAIL PROTECTED]> wrote: > > Or just: > > > If command is "quit" ... > > Hmmm. In Flaming Thunder, I'm using "is" (and "is an", "is a", etc) > for assigning and checking types. For example, to read data from a > file and check for errors: > > Read data from

Re: best way to check if pid is dead?

2008-05-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, bukzor <[EMAIL PROTECTED]> wrote: > Does anyone have a pythonic way to check if a process is dead, given > the pid? > > This is the function I'm using is quite OS dependent. A good candidate > might be "try: kill(pid)", since it throws an exception if the pid is

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread bukzor
On May 21, 11:38 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On SuSE 10.2/Xeon there seems to be a rounding bug for > floating-point addition: > > [EMAIL PROTECTED]:~> python > Python 2.5 (r25:51908, May 25 2007, 16:14:04) > [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2 > Type "help"

best way to check if pid is dead?

2008-05-21 Thread bukzor
Does anyone have a pythonic way to check if a process is dead, given the pid? This is the function I'm using is quite OS dependent. A good candidate might be "try: kill(pid)", since it throws an exception if the pid is dead, but that sends a signal which might interfere with the process. Thanks.

Re: What replaces `` in py3k?

2008-05-21 Thread bukzor
On May 21, 10:48 am, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On May 21, 10:45 am, bukzor <[EMAIL PROTECTED]> wrote: > > > What are backticks going to be translated into? > > repr Thanks for the quick reply! --Buck -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >